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

SCM Repository

[diderot] View of /branches/vis15/config/check_smlnj.m4
ViewVC logotype

View of /branches/vis15/config/check_smlnj.m4

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4792 - (download) (annotate)
Thu Oct 20 15:45:49 2016 UTC (3 years ago) by jhr
File size: 3099 byte(s)
  improvements to SML/NJ configuration
dnl check_smlnj.m4
dnl
dnl COPYRIGHT (c) 2016 The The SML/NJ Fellowship (http://smlnj.org/)
dnl
dnl @synopsis CHECK_SMLNJ(ACTION-IF-UNKNOWN)
dnl
dnl This macro attempts to figure out the location of the SML/NJ installation,
dnl as well as its version.  It will check the user's path, as well as the
dnl standard locations of /usr/local/smlnj/bin and /usr/local/bin.
dnl You can override the version of SML/NJ used by defining either the SML_CMD
dnl or the SMLNJ_CMD variable in the environment (SMLNJ_CMD is for backwards
dnl compatibility; SML_CMD is prefered).
dnl This macro sets the following shell variables when it executes successfully:
dnl
dnl	SML_CMD			-- the absolute path to the "sml" command
dnl	SMLNJ_CMD		-- same as $SML_CMD; for backward compatibility
dnl	SMLNJ_PATH		-- the
dnl	SMLNJ_VERSION		-- the version as "<major>.<minor>.<patch>", where
dnl				   the ".<patch>" is optional.
dnl	SMLNJ_MAJOR_VERSION	-- major version number
dnl	SMLNJ_MINOR_VERSION	-- minor version number
dnl	SMLNJ_PATCH_VERSION	-- patch number (empty if there is no patch number)
dnl
dnl This macro also does an AC_SUBST for SMLNJ_CMD, SML_CMD, and SMLNJ_PATH.
dnl
dnl @author John Reppy <jhr@cs.uchicago.edu>
dnl
AC_DEFUN([CHECK_SMLNJ], [
dnl
dnl first we check for the existence of SML/NJ
dnl
  if test z$SML_CMD != z ; then
    SMLNJ_CMD=$SML_CMD
  elif test z$SMLNJ_CMD != z ; then
    SML_CMD=$SMLNJ_CMD
  else
    AC_PATH_PROGS(SML_CMD, sml, none, [$PATH:/usr/local/smlnj/bin:/usr/local/bin])
    SMLNJ_CMD=$SML_CMD
  fi
dnl
dnl
  if test $SML_CMD = none; then
    $1
  else
dnl
dnl SML/NJ is installed, so determine its location
dnl
    SMLNJ_PATH=`dirname $SML_CMD`
dnl
dnl Determine the version numbers
dnl
    AC_MSG_CHECKING([version of SML/NJ])
    ac_check_smlnj_version=`$SML_CMD @SMLversion`
    if test $? -eq 0 ; then
dnl
dnl normalize the ac_check_smlnj_version variable
dnl
      case $ac_check_smlnj_version in
	sml*) ac_check_smlnj_version=`echo $ac_check_smlnj_version | sed -e 's/sml //'` ;;
	*) AC_MSG_ERROR([bogus SML/NJ version ($ac_check_smlnj_version) reported]);;
      esac
      SMLNJ_VERSION=$ac_check_smlnj_version
      case $ac_check_smlnj_version in
	110)
dnl
dnl Versions 110.0.x report "sml 110" for the @SMLversion flag, so we need to
dnl do some more work.
dnl
	  banner=`echo "" | $SML_CMD | head -1`
	  [ac_check_smlnj_version=`echo $banner \
	    | sed -e 's/.*Version \([0-9.]*\).*/\1/'`]
	  SMLNJ_VERSION=$ac_check_smlnj_version
	  ;;
	*.*.*) ;;
	*.*) ac_check_smlnj_version="$ac_check_smlnj_version".0 ;;
	*) ac_check_smlnj_version="$ac_check_smlnj_version".0.0 ;;
      esac
      [SMLNJ_MAJOR_VERSION=`echo $ac_check_smlnj_version \
	| sed -e 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'`]
      [SMLNJ_MINOR_VERSION=`echo $ac_check_smlnj_version \
	| sed -e 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'`]
      [SMLNJ_PATCH_VERSION=`echo $ac_check_smlnj_version \
	| sed -e 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'`]
      AC_MSG_RESULT([$SMLNJ_VERSION])
      AC_SUBST(SML_CMD)
      AC_SUBST(SMLNJ_CMD)
      AC_SUBST(SMLNJ_PATH)
    else
      $1
    fi
  fi
])dnl

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