Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Annotation of /branches/cuda/config/check_smlnj.m4
ViewVC logotype

Annotation of /branches/cuda/config/check_smlnj.m4

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5597 - (view) (download)

1 : jhr 5597 dnl check_smlnj.m4
2 :     dnl
3 :     dnl COPYRIGHT (c) 2019 The The SML/NJ Fellowship (http://smlnj.org/)
4 :     dnl
5 :     dnl @synopsis CHECK_SMLNJ(ACTION-IF-UNKNOWN)
6 :     dnl
7 :     dnl This macro attempts to figure out the location of the SML/NJ installation,
8 :     dnl as well as its version. It will check the user's path, as well as the
9 :     dnl standard locations of /usr/local/smlnj/bin and /usr/local/bin.
10 :     dnl You can override the version of SML/NJ used by defining either the SML_CMD
11 :     dnl or the SMLNJ_CMD variable in the environment (SMLNJ_CMD is for backwards
12 :     dnl compatibility; SML_CMD is prefered).
13 :     dnl This macro sets the following shell variables when it executes successfully:
14 :     dnl
15 :     dnl SML_CMD* -- the absolute path to the "sml" command
16 :     dnl SMLNJ_CMD* -- same as $SML_CMD; for backward compatibility
17 :     dnl SMLNJ_PATH* -- the
18 :     dnl SMLNJ_VERSION -- the version as "<major>.<minor>.<patch>", where
19 :     dnl the ".<patch>" is optional.
20 :     dnl SMLNJ_MAJOR_VERSION -- major version number
21 :     dnl SMLNJ_MINOR_VERSION -- minor version number
22 :     dnl SMLNJ_PATCH_VERSION -- patch number (empty if there is no patch number)
23 :     dnl SMLNJ_ARCH* -- the host archectecture
24 :     dnl SMLNJ_OPSYS* -- the host operating system
25 :     dnl SMLNJ_HEAP_SUFFIX* -- the heap suffix
26 :     dnl
27 :     dnl * This macro also does an AC_SUBST for the variables marked with "*"
28 :     dnl
29 :     dnl @author John Reppy <jhr@cs.uchicago.edu>
30 :     dnl
31 :     AC_DEFUN([CHECK_SMLNJ], [
32 :     dnl
33 :     dnl first we check for the existence of SML/NJ
34 :     dnl
35 :     if test z$SML_CMD != z ; then
36 :     SMLNJ_CMD=$SML_CMD
37 :     elif test z$SMLNJ_CMD != z ; then
38 :     SML_CMD=$SMLNJ_CMD
39 :     else
40 :     AC_PATH_PROGS(SML_CMD, sml, none, [$PATH:/usr/local/smlnj/bin:/usr/local/bin])
41 :     SMLNJ_CMD=$SML_CMD
42 :     fi
43 :     dnl
44 :     dnl
45 :     if test $SML_CMD = none; then
46 :     $1
47 :     else
48 :     dnl
49 :     dnl SML/NJ is installed, so determine its location
50 :     dnl
51 :     SMLNJ_PATH=`dirname $SML_CMD`
52 :     dnl
53 :     dnl Determine the version numbers
54 :     dnl
55 :     AC_MSG_CHECKING([version of SML/NJ])
56 :     ac_check_smlnj_version=`$SML_CMD @SMLversion`
57 :     if test $? -eq 0 ; then
58 :     dnl
59 :     dnl normalize the ac_check_smlnj_version variable
60 :     dnl
61 :     case $ac_check_smlnj_version in
62 :     sml*) ac_check_smlnj_version=`echo $ac_check_smlnj_version | sed -e 's/sml //'` ;;
63 :     *) AC_MSG_ERROR([bogus SML/NJ version ($ac_check_smlnj_version) reported]);;
64 :     esac
65 :     SMLNJ_VERSION=$ac_check_smlnj_version
66 :     case $ac_check_smlnj_version in
67 :     110)
68 :     dnl
69 :     dnl Versions 110.0.x report "sml 110" for the @SMLversion flag, so we need to
70 :     dnl do some more work.
71 :     dnl
72 :     banner=`echo "" | $SML_CMD | head -1`
73 :     [ac_check_smlnj_version=`echo $banner \
74 :     | sed -e 's/.*Version \([0-9.]*\).*/\1/'`]
75 :     SMLNJ_VERSION=$ac_check_smlnj_version
76 :     ;;
77 :     *.*.*) ;;
78 :     *.*) ac_check_smlnj_version="$ac_check_smlnj_version".0 ;;
79 :     *) ac_check_smlnj_version="$ac_check_smlnj_version".0.0 ;;
80 :     esac
81 :     [SMLNJ_MAJOR_VERSION=`echo $ac_check_smlnj_version \
82 :     | sed -e 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'`]
83 :     [SMLNJ_MINOR_VERSION=`echo $ac_check_smlnj_version \
84 :     | sed -e 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'`]
85 :     [SMLNJ_PATCH_VERSION=`echo $ac_check_smlnj_version \
86 :     | sed -e 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'`]
87 :     AC_MSG_RESULT([$SMLNJ_VERSION])
88 :     AC_SUBST(SML_CMD)
89 :     AC_SUBST(SMLNJ_CMD)
90 :     AC_SUBST(SMLNJ_PATH)
91 :     else
92 :     $1
93 :     fi
94 :     dnl
95 :     dnl Determine the heap suffix; we assume that this has the form <arch>-<opsys>
96 :     dnl
97 :     AC_MSG_CHECKING([heap suffix of SML/NJ])
98 :     ac_check_smlnj_suffix=`$SML_CMD @SMLsuffix`
99 :     if test $? -eq 0 ; then
100 :     SMLNJ_HEAP_SUFFIX=$ac_check_smlnj_suffix
101 :     [SMLNJ_ARCH=`echo $ac_check_smlnj_suffix \
102 :     | sed -e 's/\([a-z0-9A-Z]*\)-\([a-z0-9A-Z]*\)/\1/'`]
103 :     [SMLNJ_OPSYS=`echo $ac_check_smlnj_suffix \
104 :     | sed -e 's/\([a-z0-9A-Z]*\)-\([a-z0-9A-Z]*\)/\2/'`]
105 :     AC_MSG_RESULT([$SMLNJ_HEAP_SUFFIX])
106 :     AC_SUBST(SMLNJ_HEAP_SUFFIX)
107 :     AC_SUBST(SMLNJ_ARCH)
108 :     AC_SUBST(SMLNJ_OPSYS)
109 :     else
110 :     $1
111 :     fi
112 :     fi
113 :     ])dnl

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0