| 1 |
#
|
| 2 |
# autoconf input for Objective Caml programs
|
| 3 |
# Copyright (C) 2001 Jean-Christophe Filliātre
|
| 4 |
# from a first script by Georges Mariano
|
| 5 |
#
|
| 6 |
# This library is free software; you can redistribute it and/or
|
| 7 |
# modify it under the terms of the GNU Library General Public
|
| 8 |
# License version 2, as published by the Free Software Foundation.
|
| 9 |
#
|
| 10 |
# This library is distributed in the hope that it will be useful,
|
| 11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
| 13 |
#
|
| 14 |
# See the GNU Library General Public License version 2 for more details
|
| 15 |
# (enclosed in the file LGPL).
|
| 16 |
|
| 17 |
# the script generated by autoconf from this input will set the following
|
| 18 |
# variables:
|
| 19 |
# OCAMLC "ocamlc" if present in the path, or a failure
|
| 20 |
# or "ocamlc.opt" if present with same version number as ocamlc
|
| 21 |
# OCAMLOPT "ocamlopt" (or "ocamlopt.opt" if present), or "no"
|
| 22 |
# OCAMLBEST either "byte" if no native compiler was found,
|
| 23 |
# or "opt" otherwise
|
| 24 |
# OCAMLDEP "ocamldep"
|
| 25 |
# OCAMLLEX "ocamllex" (or "ocamllex.opt" if present)
|
| 26 |
# OCAMLYACC "ocamlyac"
|
| 27 |
# OCAMLLIB the path to the ocaml standard library
|
| 28 |
# OCAMLVERSION the ocaml version number
|
| 29 |
# OCAMLWEB "ocamlweb" (not mandatory)
|
| 30 |
# OCAMLWIN32 "yes"/"no" depending on Sys.os_type = "Win32"
|
| 31 |
# EXE ".exe" if OCAMLWIN32=yes, "" otherwise
|
| 32 |
|
| 33 |
# check for one particular file of the sources
|
| 34 |
# ADAPT THE FOLLOWING LINE TO YOUR SOURCES!
|
| 35 |
AC_INIT(driver/cduce.mli)
|
| 36 |
|
| 37 |
# Check for Ocaml compilers
|
| 38 |
|
| 39 |
# we first look for ocamlc in the path; if not present, we fail
|
| 40 |
AC_CHECK_PROG(OCAMLC,ocamlc,ocamlc,no)
|
| 41 |
if test "$OCAMLC" = no ; then
|
| 42 |
AC_MSG_ERROR(Cannot find ocamlc.)
|
| 43 |
fi
|
| 44 |
|
| 45 |
# we extract Ocaml version number and library path
|
| 46 |
OCAMLVERSION=`$OCAMLC -v | sed -n -e 's|.*version *\(.*\)$|\1|p' `
|
| 47 |
echo "ocaml version is $OCAMLVERSION"
|
| 48 |
OCAMLLIB=`$OCAMLC -v | tail -1 | cut -f 4 -d " "`
|
| 49 |
echo "ocaml library path is $OCAMLLIB"
|
| 50 |
|
| 51 |
# then we look for ocamlopt; if not present, we issue a warning
|
| 52 |
# if the version is not the same, we also discard it
|
| 53 |
# we set OCAMLBEST to "opt" or "byte", whether ocamlopt is available or not
|
| 54 |
AC_CHECK_PROG(OCAMLOPT,ocamlopt,ocamlopt,no)
|
| 55 |
OCAMLBEST=byte
|
| 56 |
if test "$OCAMLOPT" = no ; then
|
| 57 |
AC_MSG_WARN(Cannot find ocamlopt; bytecode compilation only.)
|
| 58 |
else
|
| 59 |
AC_MSG_CHECKING(ocamlopt version)
|
| 60 |
TMPVERSION=`$OCAMLOPT -v | sed -n -e 's|.*version *\(.*\)$|\1|p' `
|
| 61 |
if test "$TMPVERSION" != "$OCAMLVERSION" ; then
|
| 62 |
AC_MSG_RESULT(differs from ocamlc; ocamlopt discarded.)
|
| 63 |
OCAMLOPT=no
|
| 64 |
else
|
| 65 |
AC_MSG_RESULT(ok)
|
| 66 |
OCAMLBEST=opt
|
| 67 |
fi
|
| 68 |
fi
|
| 69 |
|
| 70 |
# checking for ocamlc.opt
|
| 71 |
AC_CHECK_PROG(OCAMLCDOTOPT,ocamlc.opt,ocamlc.opt,no)
|
| 72 |
if test "$OCAMLCDOTOPT" != no ; then
|
| 73 |
AC_MSG_CHECKING(ocamlc.opt version)
|
| 74 |
TMPVERSION=`$OCAMLCDOTOPT -v | sed -n -e 's|.*version *\(.*\)$|\1|p' `
|
| 75 |
if test "$TMPVERSION" != "$OCAMLVERSION" ; then
|
| 76 |
AC_MSG_RESULT(differs from ocamlc; ocamlc.opt discarded.)
|
| 77 |
else
|
| 78 |
AC_MSG_RESULT(ok)
|
| 79 |
OCAMLC=$OCAMLCDOTOPT
|
| 80 |
fi
|
| 81 |
fi
|
| 82 |
|
| 83 |
# checking for ocamlopt.opt
|
| 84 |
if test "$OCAMLOPT" != no ; then
|
| 85 |
AC_CHECK_PROG(OCAMLOPTDOTOPT,ocamlopt.opt,ocamlopt.opt,no)
|
| 86 |
if test "$OCAMLOPTDOTOPT" != no ; then
|
| 87 |
AC_MSG_CHECKING(ocamlc.opt version)
|
| 88 |
TMPVER=`$OCAMLOPTDOTOPT -v | sed -n -e 's|.*version *\(.*\)$|\1|p' `
|
| 89 |
if test "$TMPVER" != "$OCAMLVERSION" ; then
|
| 90 |
AC_MSG_RESULT(differs from ocamlc; ocamlopt.opt discarded.)
|
| 91 |
else
|
| 92 |
AC_MSG_RESULT(ok)
|
| 93 |
OCAMLOPT=$OCAMLOPTDOTOPT
|
| 94 |
fi
|
| 95 |
fi
|
| 96 |
fi
|
| 97 |
|
| 98 |
# ocamldep, ocamllex and ocamlyacc should also be present in the path
|
| 99 |
AC_CHECK_PROG(OCAMLDEP,ocamldep,ocamldep,no)
|
| 100 |
if test "$OCAMLDEP" = no ; then
|
| 101 |
AC_MSG_ERROR(Cannot find ocamldep.)
|
| 102 |
fi
|
| 103 |
|
| 104 |
AC_CHECK_PROG(OCAMLLEX,ocamllex,ocamllex,no)
|
| 105 |
if test "$OCAMLLEX" = no ; then
|
| 106 |
AC_MSG_ERROR(Cannot find ocamllex.)
|
| 107 |
else
|
| 108 |
AC_CHECK_PROG(OCAMLLEXDOTOPT,ocamllex.opt,ocamllex.opt,no)
|
| 109 |
if test "$OCAMLLEXDOTOPT" != no ; then
|
| 110 |
OCAMLLEX=$OCAMLLEXDOTOPT
|
| 111 |
fi
|
| 112 |
fi
|
| 113 |
|
| 114 |
AC_CHECK_PROG(OCAMLYACC,ocamlyacc,ocamlyacc,no)
|
| 115 |
if test "$OCAMLYACC" = no ; then
|
| 116 |
AC_MSG_ERROR(Cannot find ocamlyacc.)
|
| 117 |
fi
|
| 118 |
|
| 119 |
AC_CHECK_PROG(OCAMLWEB,ocamlweb,ocamlweb,true)
|
| 120 |
|
| 121 |
# platform
|
| 122 |
AC_MSG_CHECKING(platform)
|
| 123 |
if echo "let _ = Sys.os_type" | ocaml | grep -q Win32; then
|
| 124 |
AC_MSG_RESULT(Win32)
|
| 125 |
OCAMLWIN32=yes
|
| 126 |
EXE=.exe
|
| 127 |
else
|
| 128 |
OCAMLWIN32=no
|
| 129 |
EXE=
|
| 130 |
fi
|
| 131 |
|
| 132 |
# substitutions to perform
|
| 133 |
AC_SUBST(OCAMLC)
|
| 134 |
AC_SUBST(OCAMLOPT)
|
| 135 |
AC_SUBST(OCAMLDEP)
|
| 136 |
AC_SUBST(OCAMLLEX)
|
| 137 |
AC_SUBST(OCAMLYACC)
|
| 138 |
AC_SUBST(OCAMLBEST)
|
| 139 |
AC_SUBST(OCAMLVERSION)
|
| 140 |
AC_SUBST(OCAMLLIB)
|
| 141 |
AC_SUBST(OCAMLWEB)
|
| 142 |
AC_SUBST(OCAMLWIN32)
|
| 143 |
AC_SUBST(EXE)
|
| 144 |
|
| 145 |
# Finally create the Makefile from Makefile.in
|
| 146 |
|
| 147 |
AC_OUTPUT(Makefile)
|
| 148 |
chmod a-w Makefile
|