Page MenuHomeHEPForge

aclocal.m4
No OneTemporary

aclocal.m4

dnl $Id: aclocal.m4,v 1.29.14.1 2005/11/06 21:14:35 ohl Exp $
dnl --------------------------------------------------------------------
dnl
dnl THO_FILENAME_CASE_CONVERSION
dnl
dnl Define two variables LOWERCASE and UPPERCASE for /bin/sh filters
dnl that convert strings to lower and upper case, respectively
dnl
AC_DEFUN([THO_FILENAME_CASE_CONVERSION],
[AC_SUBST([LOWERCASE])
AC_SUBST([UPPERCASE])
AC_PATH_PROGS(TR,tr)
AC_PATH_PROGS(SED,sed)
AC_MSG_CHECKING([for case conversion])
if test -n "$TR"; then
LOWERCASE="$TR A-Z a-z"
UPPERCASE="$TR a-z A-Z"
THO_FILENAME_CASE_CONVERSION_TEST
fi
if test -n "$UPPERCASE" && test -n "$LOWERCASE"; then
AC_MSG_RESULT([$TR works])
else
LOWERCASE="$SED y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/"
UPPERCASE="$SED y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/"
THO_FILENAME_CASE_CONVERSION_TEST
if test -n "$UPPERCASE" && test -n "$LOWERCASE"; then
AC_MSG_RESULT([$SED works])
fi
fi])
dnl
AC_DEFUN([THO_FILENAME_CASE_CONVERSION_TEST],
[if test "`echo fOo | $LOWERCASE`" != "foo"; then
LOWERCASE=""
fi
if test "`echo fOo | $UPPERCASE`" != "FOO"; then
UPPERCASE=""
fi])
dnl
dnl --------------------------------------------------------------------
dnl
dnl THO_LIB_LAPACK
dnl
AC_DEFUN([THO_LIB_LAPACK],
[AC_SUBST([HAVE_LIBLAPACK])
AC_SUBST([LIBLAPACK])
AC_CHECK_LIB([lapack], [dsyev_],
[HAVE_LIBLAPACK=yes
LIBLAPACK="-llapack -lblas $FLIBS"],
[],
[-lblas $FLIBS])
if test X$HAVE_LIBLAPACK != Xyes; then
AC_CHECK_LIB([cxml], [dsyev_],
[HAVE_LIBLAPACK=yes
LIBLAPACK="-lcxml $FLIBS"],
[],
[$FLIBS])
fi
])
dnl
dnl --------------------------------------------------------------------
dnl
dnl THO_PROG_F
dnl THO_PROG_F95
dnl
dnl These allow to set F and F95 to overwrite the defaults
dnl (assuming that the names contain no spaces!)
dnl
AC_DEFUN([THO_PROG_F],[AC_PATH_PROGS(F,$F F)])
AC_DEFUN([THO_PROG_F95],[AC_PATH_PROGS(F95,$F95 $F90 lf95 f95 f90 ifort ifc fort)])
dnl
dnl --------------------------------------------------------------------
dnl
dnl THO_FORTRAN_VENDOR(VARIABLE, COMPILER)
dnl
AC_DEFUN([THO_FORTRAN_VENDOR],
[AC_SUBST([$1])
if test -n "$2"; then
$1=unknown
AC_MSG_CHECKING([vendor of '$2'])
$2 -V >conftest.out 2>&1
if grep -q 'NAGWare' conftest.out; then
$1=NAG
elif grep -q 'Intel(R)' conftest.out; then
$1=Intel
if grep -q 'Version 9\.' conftest.out; then
F95_IFC_VERSION=9
elif grep -q 'Version 8\.' conftest.out; then
F95_IFC_VERSION=8
elif grep -q 'Version 7\.1' conftest.out; then
F95_IFC_VERSION=7
F95_IFC_MINOR_VERSION=1
elif grep -q 'Version 7\.0' conftest.out; then
F95_IFC_VERSION=7
F95_IFC_MINOR_VERSION=0
elif grep -q 'Version 7\.' conftest.out; then
F95_IFC_VERSION=7
elif grep -q 'Version 6\.' conftest.out; then
F95_IFC_VERSION=6
elif grep -q 'Version 5\.' conftest.out; then
F95_IFC_VERSION=5
else
AC_MSG_WARN([version of Intel Fortran compiler not recognized, dnl
continuing at your own peril ...])
F95_IFC_VERSION=0
fi
else
$2 -version >conftest.out 2>&1
if grep -q 'Compaq' conftest.out; then
$1=Compaq
else
$2 --version >conftest.out 2>&1
if grep -q 'Lahey' conftest.out; then
$1=Lahey
else
$1=UNKNOWN
fi
fi
fi
AC_MSG_RESULT([[$]$1])
rm -f conftest.out
fi])
dnl
dnl --------------------------------------------------------------------
dnl
dnl THO_FORTRAN_TEST_EXTENSION(VARIABLE, COMPILER, EXTENSION)
dnl
AC_DEFUN([THO_FORTRAN_TEST_EXTENSION],
[AC_SUBST([$1])
if test -n "$2"; then
THO_COMPILE_FORTRAN90([$1], [$2], [$3], [], [$3], [])
fi])
dnl
dnl --------------------------------------------------------------------
dnl
dnl THO_FORTRAN_FIND_EXTENSION(VARIABLE, COMPILER, EXTENSIONS)
dnl
AC_DEFUN([THO_FORTRAN_FIND_EXTENSION],
[AC_SUBST([$1])
for ext in $3; do
AC_MSG_CHECKING([whether '$2' accepts .$ext])
THO_FORTRAN_TEST_EXTENSION([$1], [$2], [$ext])
if test -n "[$]$1"; then
AC_MSG_RESULT([yes])
break
else
AC_MSG_RESULT([no])
fi
done])
dnl
dnl --------------------------------------------------------------------
dnl
dnl THO_FORTRAN_TEST_OPTION(VARIABLE, COMPILER, EXTENSION, OPTION)
dnl
dnl Test whether the COMPILER accepts the OPTION (using EXTENSION
dnl for the test source). If so, the VARIABLE will be set to OPTION.
dnl
AC_DEFUN([THO_FORTRAN_TEST_OPTION],
[if test -n "$2"; then
THO_COMPILE_FORTRAN90([$1], [$2 $4], [$3], [], [$4], [])
fi])
dnl
dnl --------------------------------------------------------------------
dnl
dnl THO_FORTRAN_FIND_OPTION(VARIABLE, COMPILER, EXTENSION, OPTIONS)
dnl
dnl Append the first accepted option from OPTIONS to VARIABLE.
dnl
AC_DEFUN([THO_FORTRAN_FIND_OPTION],
[AC_SUBST([$1])
for option in $4; do
AC_MSG_CHECKING([whether '$2' accepts $option])
THO_FORTRAN_TEST_OPTION([tmp_$1], [$2], [$3], [$option])
if test -n "[$]tmp_$1"; then
$1="[$]$1 [$]tmp_$1"
AC_MSG_RESULT([yes])
break
else
AC_MSG_RESULT([no])
fi
done])
dnl
dnl --------------------------------------------------------------------
dnl
dnl THO_FORTRAN_FILTER_OPTIONS(VARIABLE, COMPILER, EXTENSION, OPTIONS)
dnl
dnl Append all accepted options from OPTIONS to VARIABLE.
dnl
AC_DEFUN([THO_FORTRAN_FILTER_OPTIONS],
[AC_SUBST([$1])
for option in $4; do
AC_MSG_CHECKING([whether '$2' accepts $option])
THO_FORTRAN_TEST_OPTION([tmp_$1], [$2], [$3], [$option])
if test -n "[$]tmp_$1"; then
$1="[$]$1 [$]tmp_$1"
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
done])
dnl
dnl --------------------------------------------------------------------
dnl
dnl THO_FORTRAN_TEST_PURE(VARIABLE, COMPILER, EXTENSION)
dnl
AC_DEFUN([THO_FORTRAN_TEST_PURE],
[AC_SUBST([$1])
if test -n "$2"; then
AC_MSG_CHECKING([whether '$2' accepts PURE functions])
THO_COMPILE_FORTRAN90([$1], [$2], [$3],
[module conftest_module
implicit none
private :: f
contains
pure function f (x) result (fx)
real, intent(in) :: x
real :: fx
fx = x
end function f
end module conftest_module
], [$3], [])
if test "[$]$1" = "$3"; then
$1=yes
else
$1=no
fi
AC_MSG_RESULT([[$]$1])
fi])
dnl
dnl --------------------------------------------------------------------
dnl
dnl THO_COMPILE_FORTRAN90(VARIABLE, COMPILER, EXTENSION, MODULE,
dnl VALUE_SUCCESS, VALUE_FAILURE, KEEP)
dnl
AC_DEFUN([THO_COMPILE_FORTRAN90],
[cat >conftest.$3 <<__END__
$4
program conftest
print *, 42
end program conftest
__END__
$2 -o conftest conftest.$3 >/dev/null 2>&1
./conftest >conftest.out 2>/dev/null
if test 42 = "`sed 's/ //g' conftest.out`"; then
$1="$5"
else
$1="$6"
fi
if test -z "$7"; then
rm -f conftest* CONFTEST*
fi])
dnl
dnl --------------------------------------------------------------------
dnl
dnl THO_FORTRAN90_MODULE_FILE(NAME, EXTENSION, COMPILER, EXTENSION)
dnl
AC_DEFUN([THO_FORTRAN90_MODULE_FILE],
[AC_SUBST([$1])
AC_SUBST([$2])
AC_MSG_CHECKING([for Fortran90 module file naming convention])
THO_COMPILE_FORTRAN90([tho_result], [$3], [$4],
[module module_NAME
implicit none
integer, parameter, public :: forty_two = 42
end module module_NAME], [ok], [], [KEEP])
if test -n "$tho_result"; then
$1=unknown
$2=unknown
for name in module_NAME module_name MODULE_NAME conftest; do
for ext in m mod M MOD d D; do
if test -f "$name.$ext"; then
$1="$name"
$2="$ext"
break 2
fi
done
done
AC_MSG_RESULT([name: [$]$1, extension: .[$]$2 ])
else
$1=""
$2=""
AC_MSG_RESULT([compiler failed])
fi
rm -f conftest* CONFTEST* module_name* module_NAME* MODULE_NAME*])
dnl
dnl --------------------------------------------------------------------
dnl --------------------------------------------------------------------
dnl
dnl THO_PATH_PROGS(NAME, PROGS, ARGS)
dnl
dnl Make sure that a program can be run
dnl (I had a problem with ocamlc.opt being compiled but
dnl dumping core on an Alpha)
dnl
AC_DEFUN([THO_PATH_PROGS],
[for name in $2; do
AC_PATH_PROGS($1,[$]name)
if test -n "[$]$1"; then
[$]$1 $3 >/dev/null 2>&1 && break
unset $1
unset ac_cv_path_$1
fi
done])
dnl
dnl --------------------------------------------------------------------
dnl --------------------------------------------------------------------
dnl
AC_DEFUN([THO_OCAML_BASE],
[AC_PATH_PROGS(OCAML,ocaml)
THO_PATH_PROGS(OCAMLC,ocamlc.opt ocamlc,</dev/null)
THO_PATH_PROGS(OCAMLOPT,ocamlopt.opt ocamlopt,</dev/null)
dnl THO_PATH_PROGS(OCAMLLEX,ocamllex.opt ocamllex,</dev/null)
AC_PATH_PROGS(OCAMLLEX,ocamllex)
AC_PATH_PROGS(OCAMLYACC,ocamlyacc)
AC_PATH_PROGS(OCAMLMKTOP,ocamlmktop)
AC_PATH_PROGS(OCAMLCP,ocamlcp)
AC_PATH_PROGS(OCAMLDEP,ocamldep)])
dnl
dnl --------------------------------------------------------------------
dnl
AC_DEFUN([THO_OCAML_LIBDIR],
[AC_REQUIRE([AC_PROG_AWK])
AC_REQUIRE([THO_OCAML_BASE])
AC_SUBST(OCAML_LIBDIR)
if test -n "$OCAMLC"; then
AC_MSG_CHECKING([for OCaml library directory])
AC_CACHE_VAL([tho_cv_ocaml_libdir],
[tho_cv_ocaml_libdir="`$OCAMLC -v | $AWK 'NR==2 {print [$]4}'`"
if test -f $tho_cv_ocaml_libdir/stdlib.cma; then
:
elif test -f /usr/local/lib/ocaml/stdlib.cma; then
tho_cv_ocaml_libdir=/usr/local/lib/ocaml
else
tho_cv_ocaml_libdir=""
fi])
OCAML_LIBDIR="$tho_cv_ocaml_libdir"
if test -n "$OCAML_LIBDIR"; then
AC_MSG_RESULT([$OCAML_LIBDIR])
else
AC_MSG_RESULT([not found])
fi
fi])
dnl
dnl --------------------------------------------------------------------
dnl
dnl NB: strip the "+n (date)" for CVS versions
dnl
AC_DEFUN([THO_OCAML_VERSION],
[AC_REQUIRE([AC_PROG_AWK])
AC_REQUIRE([THO_OCAML_BASE])
AC_SUBST(OCAML_VERSION)
if test -n "$OCAMLC"; then
AC_MSG_CHECKING([for OCaml version])
AC_CACHE_VAL([tho_cv_ocaml_version],
[tho_cv_ocaml_version="`$OCAMLC -v | \
$AWK 'NR==1 && [$]5 ~ /version/ {
changequote(<<,>>)dnl
split (<<$>>6, version, "[.+]+");
printf ("%d%02d%03d", version[1], version[2], version[3])}'`"
changequote([,])])
OCAML_VERSION=$tho_cv_ocaml_version
if test -n "$OCAML_VERSION"; then
AC_MSG_RESULT([$OCAML_VERSION])
else
AC_MSG_RESULT([not found])
OCAML_VERSION="0"
fi
fi])
dnl
dnl --------------------------------------------------------------------
dnl
AC_DEFUN([THO_OCAML_REQUIRE_VERSION],
[AC_REQUIRE([THO_OCAML_VERSION])
AC_MSG_CHECKING([for OCaml version $1])
if test "$OCAML_VERSION" -ge "$1"; then
AC_MSG_RESULT([ok])
else
AC_MSG_ERROR([found version $OCAML_VERSION])
fi])
dnl
dnl --------------------------------------------------------------------
dnl
AC_DEFUN([THO_OCAML_LABLGTK],
[AC_REQUIRE([THO_OCAML_BASE])
AC_SUBST(LABLGTKDIR)
LABLGTKDIR=$OCAML_LIBDIR
AC_MSG_CHECKING([for OCaml/GTK+ toolkit directory])
if test -f $LABLGTKDIR/lablgtk.cma; then
AC_MSG_RESULT([$LABLGTKDIR])
else
LABLGTKDIR=$OCAML_LIBDIR/lablgtk
if test -f $LABLGTKDIR/lablgtk.cma; then
AC_MSG_RESULT([$LABLGTKDIR])
else
AC_MSG_RESULT([not found])
fi
fi])
dnl
dnl --------------------------------------------------------------------
dnl --------------------------------------------------------------------
dnl
AC_DEFUN([THO_OCAMLWEB],[AC_PATH_PROGS(OCAMLWEB,ocamlweb)])
dnl
dnl --------------------------------------------------------------------
dnl
AC_DEFUN([THO_OCAMLWEB_VERSION],
[AC_REQUIRE([AC_PROG_AWK])
AC_REQUIRE([THO_OCAMLWEB])
AC_SUBST(OCAMLWEB_VERSION)
if test -n "$OCAMLWEB"; then
AC_MSG_CHECKING([for ocamlweb version])
AC_CACHE_VAL([tho_cv_ocamlweb_version],
[tho_cv_ocamlweb_version="`$OCAMLWEB --version 2>&1 |
$AWK 'NR==1 && [$]4 ~ /version/ {
changequote(<<,>>)dnl
split (<<$>>5, version, "[.+]+");
printf ("%d%02d%03d", version[1], version[2], version[3])}'`"
changequote([,])])
OCAMLWEB_VERSION=$tho_cv_ocamlweb_version
if test -n "$OCAMLWEB_VERSION"; then
AC_MSG_RESULT([$OCAMLWEB_VERSION])
else
AC_MSG_RESULT([not found])
OCAMLWEB_VERSION="0"
fi
fi])
dnl
dnl --------------------------------------------------------------------
dnl
AC_DEFUN([THO_OCAMLWEB_REQUIRE_VERSION],
[AC_REQUIRE([THO_OCAMLWEB_VERSION])
AC_MSG_CHECKING([for ocamlweb version $1])
if test "$OCAMLWEB_VERSION" -ge "$1"; then
AC_MSG_RESULT([ok])
else
AC_MSG_RESULT([too old])
OCAMLWEB=false
fi])
dnl
dnl --------------------------------------------------------------------

File Metadata

Mime Type
text/x-m4
Expires
Wed, May 14, 10:20 AM (1 d, 16 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5111098
Default Alt Text
aclocal.m4 (12 KB)

Event Timeline