Skip to content

Commit

Permalink
Update ocaml-autoconf macro from upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
kerneis committed Aug 26, 2013
1 parent ed0a3d0 commit a084d92
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 69 deletions.
72 changes: 44 additions & 28 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,7 @@ OCAMLMKLIB
OCAMLMKTOP
OCAMLDEP
OCAML
OCAMLNATDYNLINK
OCAMLOPTDOTOPT
OCAMLCDOTOPT
OCAMLBEST
Expand Down Expand Up @@ -3379,7 +3380,7 @@ fi
$as_echo "OCaml version is $OCAMLVERSION" >&6; }
# If OCAMLLIB is set, use it
if test "$OCAMLLIB" = ""; then
OCAMLLIB=`$OCAMLC -where 2>/dev/null || $OCAMLC -v|tail -1|cut -d ' ' -f 4`
OCAMLLIB=`$OCAMLC -where 2>/dev/null | tr -d '\015' || $OCAMLC -v|tail -1|cut -d ' ' -f 4`
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: OCAMLLIB previously set; preserving it." >&5
$as_echo "OCAMLLIB previously set; preserving it." >&6; }
Expand Down Expand Up @@ -3485,17 +3486,17 @@ fi
OCAMLBEST=byte
if test "$OCAMLOPT" = "no"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find ocamlopt; bytecode compilation only." >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find ocamlopt; bytecode compilation only." >&5
$as_echo "$as_me: WARNING: Cannot find ocamlopt; bytecode compilation only." >&2;}
else
TMPVERSION=`$OCAMLOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
if test "$TMPVERSION" != "$OCAMLVERSION" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: versions differs from ocamlc; ocamlopt discarded." >&5
TMPVERSION=`$OCAMLOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
if test "$TMPVERSION" != "$OCAMLVERSION" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: versions differs from ocamlc; ocamlopt discarded." >&5
$as_echo "versions differs from ocamlc; ocamlopt discarded." >&6; }
OCAMLOPT=no
else
OCAMLBEST=opt
fi
OCAMLOPT=no
else
OCAMLBEST=opt
fi
fi
Expand Down Expand Up @@ -3594,18 +3595,18 @@ else
fi
if test "$OCAMLCDOTOPT" != "no"; then
TMPVERSION=`$OCAMLCDOTOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
if test "$TMPVERSION" != "$OCAMLVERSION" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: versions differs from ocamlc; ocamlc.opt discarded." >&5
TMPVERSION=`$OCAMLCDOTOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
if test "$TMPVERSION" != "$OCAMLVERSION" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: versions differs from ocamlc; ocamlc.opt discarded." >&5
$as_echo "versions differs from ocamlc; ocamlc.opt discarded." >&6; }
else
OCAMLC=$OCAMLCDOTOPT
fi
else
OCAMLC=$OCAMLCDOTOPT
fi
fi
# checking for ocamlopt.opt
if test "$OCAMLOPT" != "no" ; then
if test -n "$ac_tool_prefix"; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}ocamlopt.opt", so it can be a program name with args.
set dummy ${ac_tool_prefix}ocamlopt.opt; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
Expand Down Expand Up @@ -3697,22 +3698,37 @@ else
OCAMLOPTDOTOPT="$ac_cv_prog_OCAMLOPTDOTOPT"
fi
if test "$OCAMLOPTDOTOPT" != "no"; then
TMPVERSION=`$OCAMLOPTDOTOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
if test "$TMPVERSION" != "$OCAMLVERSION" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: version differs from ocamlc; ocamlopt.opt discarded." >&5
if test "$OCAMLOPTDOTOPT" != "no"; then
TMPVERSION=`$OCAMLOPTDOTOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
if test "$TMPVERSION" != "$OCAMLVERSION" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: version differs from ocamlc; ocamlopt.opt discarded." >&5
$as_echo "version differs from ocamlc; ocamlopt.opt discarded." >&6; }
else
OCAMLOPT=$OCAMLOPTDOTOPT
fi
fi
else
OCAMLOPT=$OCAMLOPTDOTOPT
fi
fi
fi
fi
# checking for native dynlink
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dynlink.cmxa" >&5
$as_echo_n "checking for dynlink.cmxa... " >&6; }
if test -f "$OCAMLLIB/dynlink.cmxa" ; then
OCAMLNATDYNLINK=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
OCAMLNATDYNLINK=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
# checking for ocaml toplevel
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}ocaml", so it can be a program name with args.
Expand Down Expand Up @@ -4379,7 +4395,7 @@ else
fi
if test "$OCAMLLEX" != "no"; then
if test -n "$ac_tool_prefix"; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}ocamllex.opt", so it can be a program name with args.
set dummy ${ac_tool_prefix}ocamllex.opt; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
Expand Down Expand Up @@ -4471,9 +4487,9 @@ else
OCAMLLEXDOTOPT="$ac_cv_prog_OCAMLLEXDOTOPT"
fi
if test "$OCAMLLEXDOTOPT" != "no"; then
OCAMLLEX=$OCAMLLEXDOTOPT
fi
if test "$OCAMLLEXDOTOPT" != "no"; then
OCAMLLEX=$OCAMLLEXDOTOPT
fi
fi
Expand Down
95 changes: 54 additions & 41 deletions m4/ocaml.m4
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
dnl autoconf macros for OCaml
dnl
dnl Copyright © 2013 Gabriel Kerneis
dnl Copyright © 2009 Richard W.M. Jones
dnl Copyright © 2009 Stefano Zacchiroli
dnl Copyright © 2000-2005 Olivier Andrieu
Expand All @@ -18,7 +19,7 @@ AC_DEFUN([AC_PROG_OCAML],
AC_MSG_RESULT([OCaml version is $OCAMLVERSION])
# If OCAMLLIB is set, use it
if test "$OCAMLLIB" = ""; then
OCAMLLIB=`$OCAMLC -where 2>/dev/null || $OCAMLC -v|tail -1|cut -d ' ' -f 4`
OCAMLLIB=`$OCAMLC -where 2>/dev/null | tr -d '\015' || $OCAMLC -v|tail -1|cut -d ' ' -f 4`
else
AC_MSG_RESULT([OCAMLLIB previously set; preserving it.])
fi
Expand All @@ -31,48 +32,60 @@ AC_DEFUN([AC_PROG_OCAML],
AC_CHECK_TOOL([OCAMLOPT],[ocamlopt],[no])
OCAMLBEST=byte
if test "$OCAMLOPT" = "no"; then
AC_MSG_WARN([Cannot find ocamlopt; bytecode compilation only.])
AC_MSG_WARN([Cannot find ocamlopt; bytecode compilation only.])
else
TMPVERSION=`$OCAMLOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
if test "$TMPVERSION" != "$OCAMLVERSION" ; then
AC_MSG_RESULT([versions differs from ocamlc; ocamlopt discarded.])
OCAMLOPT=no
else
OCAMLBEST=opt
fi
TMPVERSION=`$OCAMLOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
if test "$TMPVERSION" != "$OCAMLVERSION" ; then
AC_MSG_RESULT([versions differs from ocamlc; ocamlopt discarded.])
OCAMLOPT=no
else
OCAMLBEST=opt
fi
fi
AC_SUBST([OCAMLBEST])
# checking for ocamlc.opt
AC_CHECK_TOOL([OCAMLCDOTOPT],[ocamlc.opt],[no])
if test "$OCAMLCDOTOPT" != "no"; then
TMPVERSION=`$OCAMLCDOTOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
if test "$TMPVERSION" != "$OCAMLVERSION" ; then
AC_MSG_RESULT([versions differs from ocamlc; ocamlc.opt discarded.])
else
OCAMLC=$OCAMLCDOTOPT
fi
TMPVERSION=`$OCAMLCDOTOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
if test "$TMPVERSION" != "$OCAMLVERSION" ; then
AC_MSG_RESULT([versions differs from ocamlc; ocamlc.opt discarded.])
else
OCAMLC=$OCAMLCDOTOPT
fi
fi
# checking for ocamlopt.opt
if test "$OCAMLOPT" != "no" ; then
AC_CHECK_TOOL([OCAMLOPTDOTOPT],[ocamlopt.opt],[no])
if test "$OCAMLOPTDOTOPT" != "no"; then
TMPVERSION=`$OCAMLOPTDOTOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
if test "$TMPVERSION" != "$OCAMLVERSION" ; then
AC_MSG_RESULT([version differs from ocamlc; ocamlopt.opt discarded.])
else
OCAMLOPT=$OCAMLOPTDOTOPT
fi
fi
AC_CHECK_TOOL([OCAMLOPTDOTOPT],[ocamlopt.opt],[no])
if test "$OCAMLOPTDOTOPT" != "no"; then
TMPVERSION=`$OCAMLOPTDOTOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
if test "$TMPVERSION" != "$OCAMLVERSION" ; then
AC_MSG_RESULT([version differs from ocamlc; ocamlopt.opt discarded.])
else
OCAMLOPT=$OCAMLOPTDOTOPT
fi
fi
fi
AC_SUBST([OCAMLOPT])
fi
AC_SUBST([OCAMLC])
# checking for native dynlink
AC_MSG_CHECKING([for dynlink.cmxa])
if test -f "$OCAMLLIB/dynlink.cmxa" ; then
OCAMLNATDYNLINK=yes
AC_MSG_RESULT([yes])
else
OCAMLNATDYNLINK=no
AC_MSG_RESULT([no])
fi
AC_SUBST([OCAMLNATDYNLINK])
# checking for ocaml toplevel
AC_CHECK_TOOL([OCAML],[ocaml],[no])
Expand All @@ -98,10 +111,10 @@ AC_DEFUN([AC_PROG_OCAMLLEX],
# checking for ocamllex
AC_CHECK_TOOL([OCAMLLEX],[ocamllex],[no])
if test "$OCAMLLEX" != "no"; then
AC_CHECK_TOOL([OCAMLLEXDOTOPT],[ocamllex.opt],[no])
if test "$OCAMLLEXDOTOPT" != "no"; then
OCAMLLEX=$OCAMLLEXDOTOPT
fi
AC_CHECK_TOOL([OCAMLLEXDOTOPT],[ocamllex.opt],[no])
if test "$OCAMLLEXDOTOPT" != "no"; then
OCAMLLEX=$OCAMLLEXDOTOPT
fi
fi
AC_SUBST([OCAMLLEX])
])
Expand All @@ -122,7 +135,7 @@ AC_DEFUN([AC_PROG_CAMLP4],
if test "$CAMLP4" != "no"; then
TMPVERSION=`$CAMLP4 -v 2>&1| sed -n -e 's|.*version *\(.*\)$|\1|p'`
if test "$TMPVERSION" != "$OCAMLVERSION" ; then
AC_MSG_RESULT([versions differs from ocamlc])
AC_MSG_RESULT([versions differs from ocamlc])
CAMLP4=no
fi
fi
Expand Down Expand Up @@ -172,15 +185,15 @@ AC_DEFUN([AC_CHECK_OCAML_PKG],
found=no
for pkg in $1 $2 ; do
if $OCAMLFIND query $pkg >/dev/null 2>/dev/null; then
AC_MSG_RESULT([found])
AS_TR_SH([OCAML_PKG_$1])=$pkg
found=yes
break
AC_MSG_RESULT([found])
AS_TR_SH([OCAML_PKG_$1])=$pkg
found=yes
break
fi
done
if test "$found" = "no" ; then
AC_MSG_RESULT([not found])
AS_TR_SH([OCAML_PKG_$1])=no
AC_MSG_RESULT([not found])
AS_TR_SH([OCAML_PKG_$1])=no
fi
AC_SUBST(AS_TR_SH([OCAML_PKG_$1]))
Expand All @@ -197,16 +210,16 @@ EOF
unset found
for $1 in $$1 $4 ; do
if $OCAMLC -c -I "$$1" conftest.ml >&5 2>&5 ; then
found=yes
break
found=yes
break
fi
done
if test "$found" ; then
AC_MSG_RESULT([$$1])
AC_MSG_RESULT([$$1])
else
AC_MSG_RESULT([not found])
$1=no
AC_MSG_RESULT([not found])
$1=no
fi
AC_SUBST([$1])
])
Expand All @@ -219,7 +232,7 @@ AC_DEFUN([AC_CHECK_OCAML_WORD_SIZE],
AC_MSG_CHECKING([for OCaml compiler word size])
cat > conftest.ml <<EOF
print_endline (string_of_int Sys.word_size)
EOF
EOF
OCAML_WORD_SIZE=`$OCAML conftest.ml`
AC_MSG_RESULT([$OCAML_WORD_SIZE])
AC_SUBST([OCAML_WORD_SIZE])
Expand Down

0 comments on commit a084d92

Please sign in to comment.