From 6d3eda35c4d6eda1449d473f4773d520b3c9083a Mon Sep 17 00:00:00 2001 From: Juan Jose Garcia Ripoll Date: Wed, 9 Sep 2009 14:52:14 +0200 Subject: [PATCH] src/configure.in: detect existence of gmp.h or gmp/gmp.h and signal error when using system libraries without finding the header. --- src/aclocal.m4 | 6 +- src/configure | 732 ++++++++++++++++++++++++++++++++--------------- src/configure.in | 10 +- 3 files changed, 517 insertions(+), 231 deletions(-) diff --git a/src/aclocal.m4 b/src/aclocal.m4 index ed7b70372..71953d534 100644 --- a/src/aclocal.m4 +++ b/src/aclocal.m4 @@ -432,9 +432,11 @@ ECL_INT16_T="" ECL_INT32_T="" ECL_INT64_T="" AC_SUBST(ECL_STDINT_HEADER) -AC_CHECK_HEADER([stdint.h],[ECL_STDINT_HEADER="#include "],[]) +AC_CHECK_HEADER([stdint.h],[AC_DEFINE(HAVE_STDINT_H) +ECL_STDINT_HEADER="#include "],[]) if test -z "${ECL_STDINT_HEADER}"; then -AC_CHECK_HEADER([inttypes.h],[ECL_STDINT_HEADER="#include "],[]) +AC_CHECK_HEADER([inttypes.h],[AC_DEFINE(HAVE_INTTYPES_H) +ECL_STDINT_HEADER="#include "],[]) fi if test -n "${ECL_STDINT_HEADER}" -a -z "${ECL_UINT8_T}"; then AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifdef HAVE_INTTYPES_H diff --git a/src/configure b/src/configure index 2511fd563..8e7164a17 100755 --- a/src/configure +++ b/src/configure @@ -660,9 +660,9 @@ SONAME SONAME1 SONAME2 SONAME3 +ECL_GMP_HEADER EGREP GREP -ECL_GMP_HEADER INSTALL_INFO INFOEXT thehost @@ -4727,6 +4727,7 @@ fi fi + ECL_GMP_HEADER= if test "${with_system_gmp}" = "yes"; then { $as_echo "$as_me:$LINENO: checking for __gmpz_init in -lgmp" >&5 $as_echo_n "checking for __gmpz_init in -lgmp... " >&6; } @@ -4801,230 +4802,6 @@ $as_echo "$as_me: error: System gmp library requested but not found." >&2;} { (exit 1); exit 1; }; } fi - else - SUBDIRS="${SUBDIRS} gmp" - CORE_LIBS="-leclgmp ${CORE_LIBS}" - if test ${enable_shared} = "no"; then - LIBRARIES="${LIBRARIES} ${LIBPREFIX}eclgmp.${LIBEXT}" - fi - fi -fi - - -if test "${with_gmp}" = "no" ; then - { $as_echo "$as_me:$LINENO: Not using GMP library at all. Are you sure?" >&5 -$as_echo "$as_me: Not using GMP library at all. Are you sure?" >&6;} - EXTRA_OBJS="${EXTRA_OBJS} big_ll.o" - ECL_GMP_HEADER='nofile' -else - -cat >>confdefs.h <<\_ACEOF -#define WITH_GMP 1 -_ACEOF - - EXTRA_OBJS="${EXTRA_OBJS} big.o" - ECL_GMP_HEADER='gmp.h' - if test "${with_system_gmp}" = "no" ; then - { $as_echo "$as_me:$LINENO: Configuring included GMP library:" >&5 -$as_echo "$as_me: Configuring included GMP library:" >&6;} - test -d gmp && rm -rf gmp - if test -z "$gmp_build"; then - gmp_build="${build_alias}" - fi - if mkdir gmp; then - ECL_GMP_HEADER='ecl/gmp.h' - (destdir=`${PWDCMD}`; cd gmp; CC="${CC} ${PICFLAG}" \ - $srcdir/gmp/configure --disable-shared --prefix=${destdir} \ - --infodir=${destdir}/doc --includedir=${destdir}/ecl --with-pic \ - --libdir=${destdir} --build=${gmp_build} --host=${host_alias} \ - CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" CPPFLAGS="$CPPFLAGS" CC="${CC} ${PICFLAG}" \ - ABI=$ABI $with_gmp) - fi - fi - with_gmp="yes" -fi - -{ $as_echo "$as_me:$LINENO: checking GMP autoconf" >&5 -$as_echo_n "checking GMP autoconf... " >&6; } -{ $as_echo "$as_me:$LINENO: result: \"${with_gmp}.${with_system_gmp}.${enable_slow_config}\"" >&5 -$as_echo "\"${with_gmp}.${with_system_gmp}.${enable_slow_config}\"" >&6; } -if test "${with_gmp}.${with_system_gmp}.${enable_slow_config}" = "yes.no.yes"; then - -{ $as_echo "$as_me:$LINENO: checking Using the GMP library to guess good compiler/linker flags" >&5 -$as_echo_n "checking Using the GMP library to guess good compiler/linker flags... " >&6; } -if test ! -f gmp/config.status; then - { { $as_echo "$as_me:$LINENO: error: Cannot find GMP's configuration file. Aborting" >&5 -$as_echo "$as_me: error: Cannot find GMP's configuration file. Aborting" >&2;} - { (exit 1); exit 1; }; } -fi -GMP_CFLAGS=`grep '^s,@CFLAGS@' gmp/config.status| sed 's&s,@CFLAGS@,\(.*\),;t t&\1&'` -GMP_LDFLAGS=`grep '^s,@GMP_LDFLAGS@' gmp/config.status| sed 's&s,@GMP_LDFLAGS@,\(.*\),;t t&\1&'`; -# Notice that GMP_LDFLAGS is designed to be passed to libtool, and therefore -# some options could be prefixed by -Wc, which means "flag for the compiler". -LDFLAGS=`echo ${LDFLAGS} ${GMP_LDFLAGS} | sed 's%-Wc,%%g'` -CFLAGS=`echo ${CFLAGS} ${GMP_CFLAGS} | sed 's%-Wc,%%g'` -GMP_CFLAGS="" -GMP_LDFLAGS="" -#host=`grep '^s,@host@' config.status | sed 's&s,@host@,\(.*\),;t t&\1&'` -{ $as_echo "$as_me:$LINENO: checking C/C++ compiler flags" >&5 -$as_echo_n "checking C/C++ compiler flags... " >&6; } -{ $as_echo "$as_me:$LINENO: result: ${CFLAGS}" >&5 -$as_echo "${CFLAGS}" >&6; } -{ $as_echo "$as_me:$LINENO: checking Linker flags" >&5 -$as_echo_n "checking Linker flags... " >&6; } -{ $as_echo "$as_me:$LINENO: result: ${LDFLAGS}" >&5 -$as_echo "${LDFLAGS}" >&6; } - -fi - - -LIBS="${LIBS} -lm" - -{ $as_echo "$as_me:$LINENO: checking for getpwnam in -lsun" >&5 -$as_echo_n "checking for getpwnam in -lsun... " >&6; } -if test "${ac_cv_lib_sun_getpwnam+set}" = set; then - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsun $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char getpwnam (); -int -main () -{ -return getpwnam (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - ac_cv_lib_sun_getpwnam=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_sun_getpwnam=no -fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_sun_getpwnam" >&5 -$as_echo "$ac_cv_lib_sun_getpwnam" >&6; } -if test "x$ac_cv_lib_sun_getpwnam" = x""yes; then - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBSUN 1 -_ACEOF - - LIBS="-lsun $LIBS" - -fi - # on IRIX adds -lsun -{ $as_echo "$as_me:$LINENO: checking for ffi_call in -lffi" >&5 -$as_echo_n "checking for ffi_call in -lffi... " >&6; } -if test "${ac_cv_lib_ffi_ffi_call+set}" = set; then - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lffi $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char ffi_call (); -int -main () -{ -return ffi_call (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - ac_cv_lib_ffi_ffi_call=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_ffi_ffi_call=no -fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_ffi_ffi_call" >&5 -$as_echo "$ac_cv_lib_ffi_ffi_call" >&6; } -if test "x$ac_cv_lib_ffi_ffi_call" = x""yes; then - has_ffi_lib=yes -else - has_ffi_lib=no -fi - { $as_echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } @@ -5411,6 +5188,499 @@ fi done +if test "${ac_cv_header_gmp_h+set}" = set; then + { $as_echo "$as_me:$LINENO: checking for gmp.h" >&5 +$as_echo_n "checking for gmp.h... " >&6; } +if test "${ac_cv_header_gmp_h+set}" = set; then + $as_echo_n "(cached) " >&6 +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_gmp_h" >&5 +$as_echo "$ac_cv_header_gmp_h" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking gmp.h usability" >&5 +$as_echo_n "checking gmp.h usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking gmp.h presence" >&5 +$as_echo_n "checking gmp.h presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: gmp.h: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: gmp.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: gmp.h: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: gmp.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: gmp.h: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: gmp.h: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: gmp.h: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: gmp.h: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: gmp.h: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: gmp.h: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: gmp.h: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: gmp.h: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: gmp.h: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: gmp.h: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: gmp.h: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: gmp.h: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for gmp.h" >&5 +$as_echo_n "checking for gmp.h... " >&6; } +if test "${ac_cv_header_gmp_h+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_header_gmp_h=$ac_header_preproc +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_gmp_h" >&5 +$as_echo "$ac_cv_header_gmp_h" >&6; } + +fi +if test "x$ac_cv_header_gmp_h" = x""yes; then + ECL_GMP_HEADER='gmp.h' +fi + + + if test "${ac_cv_header_gmp_gmp_h+set}" = set; then + { $as_echo "$as_me:$LINENO: checking for gmp/gmp.h" >&5 +$as_echo_n "checking for gmp/gmp.h... " >&6; } +if test "${ac_cv_header_gmp_gmp_h+set}" = set; then + $as_echo_n "(cached) " >&6 +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_gmp_gmp_h" >&5 +$as_echo "$ac_cv_header_gmp_gmp_h" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking gmp/gmp.h usability" >&5 +$as_echo_n "checking gmp/gmp.h usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking gmp/gmp.h presence" >&5 +$as_echo_n "checking gmp/gmp.h presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: gmp/gmp.h: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: gmp/gmp.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: gmp/gmp.h: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: gmp/gmp.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: gmp/gmp.h: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: gmp/gmp.h: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: gmp/gmp.h: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: gmp/gmp.h: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: gmp/gmp.h: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: gmp/gmp.h: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: gmp/gmp.h: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: gmp/gmp.h: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: gmp/gmp.h: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: gmp/gmp.h: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: gmp/gmp.h: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: gmp/gmp.h: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for gmp/gmp.h" >&5 +$as_echo_n "checking for gmp/gmp.h... " >&6; } +if test "${ac_cv_header_gmp_gmp_h+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_header_gmp_gmp_h=$ac_header_preproc +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_gmp_gmp_h" >&5 +$as_echo "$ac_cv_header_gmp_gmp_h" >&6; } + +fi +if test "x$ac_cv_header_gmp_gmp_h" = x""yes; then + ECL_GMP_HEADER='gmp/gmp.h' +fi + + + else + SUBDIRS="${SUBDIRS} gmp" + CORE_LIBS="-leclgmp ${CORE_LIBS}" + if test ${enable_shared} = "no"; then + LIBRARIES="${LIBRARIES} ${LIBPREFIX}eclgmp.${LIBEXT}" + fi + fi +fi + + +if test "${with_gmp}" = "no" ; then + { $as_echo "$as_me:$LINENO: Not using GMP library at all. Are you sure?" >&5 +$as_echo "$as_me: Not using GMP library at all. Are you sure?" >&6;} + EXTRA_OBJS="${EXTRA_OBJS} big_ll.o" + ECL_GMP_HEADER='nofile' +else + +cat >>confdefs.h <<\_ACEOF +#define WITH_GMP 1 +_ACEOF + + EXTRA_OBJS="${EXTRA_OBJS} big.o" + if test "${with_system_gmp}" = "no" ; then + { $as_echo "$as_me:$LINENO: Configuring included GMP library:" >&5 +$as_echo "$as_me: Configuring included GMP library:" >&6;} + test -d gmp && rm -rf gmp + if test -z "$gmp_build"; then + gmp_build="${build_alias}" + fi + ECL_GMP_HEADER='ecl/gmp.h' + if mkdir gmp; then + (destdir=`${PWDCMD}`; cd gmp; CC="${CC} ${PICFLAG}" \ + $srcdir/gmp/configure --disable-shared --prefix=${destdir} \ + --infodir=${destdir}/doc --includedir=${destdir}/ecl --with-pic \ + --libdir=${destdir} --build=${gmp_build} --host=${host_alias} \ + CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" CPPFLAGS="$CPPFLAGS" CC="${CC} ${PICFLAG}" \ + ABI=$ABI $with_gmp) + fi + else + if test "x$ECL_GMP_HEADER" = "x"; then + { { $as_echo "$as_me:$LINENO: error: Can not find GMP header." >&5 +$as_echo "$as_me: error: Can not find GMP header." >&2;} + { (exit 1); exit 1; }; } + fi + fi + with_gmp="yes" +fi + +{ $as_echo "$as_me:$LINENO: checking GMP autoconf" >&5 +$as_echo_n "checking GMP autoconf... " >&6; } +{ $as_echo "$as_me:$LINENO: result: \"${with_gmp}.${with_system_gmp}.${enable_slow_config}\"" >&5 +$as_echo "\"${with_gmp}.${with_system_gmp}.${enable_slow_config}\"" >&6; } +if test "${with_gmp}.${with_system_gmp}.${enable_slow_config}" = "yes.no.yes"; then + +{ $as_echo "$as_me:$LINENO: checking Using the GMP library to guess good compiler/linker flags" >&5 +$as_echo_n "checking Using the GMP library to guess good compiler/linker flags... " >&6; } +if test ! -f gmp/config.status; then + { { $as_echo "$as_me:$LINENO: error: Cannot find GMP's configuration file. Aborting" >&5 +$as_echo "$as_me: error: Cannot find GMP's configuration file. Aborting" >&2;} + { (exit 1); exit 1; }; } +fi +GMP_CFLAGS=`grep '^s,@CFLAGS@' gmp/config.status| sed 's&s,@CFLAGS@,\(.*\),;t t&\1&'` +GMP_LDFLAGS=`grep '^s,@GMP_LDFLAGS@' gmp/config.status| sed 's&s,@GMP_LDFLAGS@,\(.*\),;t t&\1&'`; +# Notice that GMP_LDFLAGS is designed to be passed to libtool, and therefore +# some options could be prefixed by -Wc, which means "flag for the compiler". +LDFLAGS=`echo ${LDFLAGS} ${GMP_LDFLAGS} | sed 's%-Wc,%%g'` +CFLAGS=`echo ${CFLAGS} ${GMP_CFLAGS} | sed 's%-Wc,%%g'` +GMP_CFLAGS="" +GMP_LDFLAGS="" +#host=`grep '^s,@host@' config.status | sed 's&s,@host@,\(.*\),;t t&\1&'` +{ $as_echo "$as_me:$LINENO: checking C/C++ compiler flags" >&5 +$as_echo_n "checking C/C++ compiler flags... " >&6; } +{ $as_echo "$as_me:$LINENO: result: ${CFLAGS}" >&5 +$as_echo "${CFLAGS}" >&6; } +{ $as_echo "$as_me:$LINENO: checking Linker flags" >&5 +$as_echo_n "checking Linker flags... " >&6; } +{ $as_echo "$as_me:$LINENO: result: ${LDFLAGS}" >&5 +$as_echo "${LDFLAGS}" >&6; } + +fi + + +LIBS="${LIBS} -lm" + +{ $as_echo "$as_me:$LINENO: checking for getpwnam in -lsun" >&5 +$as_echo_n "checking for getpwnam in -lsun... " >&6; } +if test "${ac_cv_lib_sun_getpwnam+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsun $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char getpwnam (); +int +main () +{ +return getpwnam (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + ac_cv_lib_sun_getpwnam=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_sun_getpwnam=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_sun_getpwnam" >&5 +$as_echo "$ac_cv_lib_sun_getpwnam" >&6; } +if test "x$ac_cv_lib_sun_getpwnam" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBSUN 1 +_ACEOF + + LIBS="-lsun $LIBS" + +fi + # on IRIX adds -lsun +{ $as_echo "$as_me:$LINENO: checking for ffi_call in -lffi" >&5 +$as_echo_n "checking for ffi_call in -lffi... " >&6; } +if test "${ac_cv_lib_ffi_ffi_call+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lffi $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char ffi_call (); +int +main () +{ +return ffi_call (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + ac_cv_lib_ffi_ffi_call=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_ffi_ffi_call=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_ffi_ffi_call" >&5 +$as_echo "$ac_cv_lib_ffi_ffi_call" >&6; } +if test "x$ac_cv_lib_ffi_ffi_call" = x""yes; then + has_ffi_lib=yes +else + has_ffi_lib=no +fi + if test "${ac_cv_header_ffi_ffi_h+set}" = set; then { $as_echo "$as_me:$LINENO: checking for ffi/ffi.h" >&5 $as_echo_n "checking for ffi/ffi.h... " >&6; } @@ -8554,7 +8824,11 @@ $as_echo "$ac_cv_header_stdint_h" >&6; } fi if test "x$ac_cv_header_stdint_h" = x""yes; then - ECL_STDINT_HEADER="#include " + cat >>confdefs.h <<\_ACEOF +#define HAVE_STDINT_H 1 +_ACEOF + +ECL_STDINT_HEADER="#include " fi @@ -8687,7 +8961,11 @@ $as_echo "$ac_cv_header_inttypes_h" >&6; } fi if test "x$ac_cv_header_inttypes_h" = x""yes; then - ECL_STDINT_HEADER="#include " + cat >>confdefs.h <<\_ACEOF +#define HAVE_INTTYPES_H 1 +_ACEOF + +ECL_STDINT_HEADER="#include " fi diff --git a/src/configure.in b/src/configure.in index 47bd0d7a0..1ffd53c38 100644 --- a/src/configure.in +++ b/src/configure.in @@ -332,10 +332,13 @@ if test "x${with_gmp}" != "xno"; then [with_system_gmp=yes], [with_system_gmp=no] ) fi + ECL_GMP_HEADER= if test "${with_system_gmp}" = "yes"; then AC_CHECK_LIB( [gmp], [__gmpz_init], [FASL_LIBS="${FASL_LIBS} -lgmp"], [AC_MSG_ERROR([System gmp library requested but not found.])]) + AC_CHECK_HEADER( [gmp.h], [ECL_GMP_HEADER='gmp.h'] ) + AC_CHECK_HEADER( [gmp/gmp.h], [ECL_GMP_HEADER='gmp/gmp.h'] ) else SUBDIRS="${SUBDIRS} gmp" CORE_LIBS="-leclgmp ${CORE_LIBS}" @@ -355,15 +358,14 @@ if test "${with_gmp}" = "no" ; then else AC_DEFINE( [WITH_GMP], [1], [Use GMP for bignums] ) EXTRA_OBJS="${EXTRA_OBJS} big.o" - ECL_GMP_HEADER='gmp.h' if test "${with_system_gmp}" = "no" ; then AC_MSG_NOTICE(Configuring included GMP library:) test -d gmp && rm -rf gmp if test -z "$gmp_build"; then gmp_build="${build_alias}" fi + ECL_GMP_HEADER='ecl/gmp.h' if mkdir gmp; then - ECL_GMP_HEADER='ecl/gmp.h' dnl Notice we need -DPIC to force the assembler to generate PIC code (destdir=`${PWDCMD}`; cd gmp; CC="${CC} ${PICFLAG}" \ $srcdir/gmp/configure --disable-shared --prefix=${destdir} \ @@ -372,6 +374,10 @@ else CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" CPPFLAGS="$CPPFLAGS" CC="${CC} ${PICFLAG}" \ ABI=$ABI $with_gmp) fi + else + if test "x$ECL_GMP_HEADER" = "x"; then + AC_MSG_ERROR([Can not find GMP header.]) + fi fi with_gmp="yes" fi