diff options
author | pelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4> | 2005-02-11 11:28:00 +0000 |
---|---|---|
committer | pelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4> | 2005-02-11 11:28:00 +0000 |
commit | 792230ac910a791f667aa313e0c1c3370b651939 (patch) | |
tree | 00644f2bf0a8d6e7672cee996b7cd7174d8ebf7e /configure.in | |
parent | 0d1ae94464557c9220f6d55b210c9abcfd928878 (diff) | |
download | mpfr-792230ac910a791f667aa313e0c1c3370b651939.tar.gz |
Clean up configure (more simplier).
Still a bug with CXXCPP to solve.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@3292 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'configure.in')
-rw-r--r-- | configure.in | 160 |
1 files changed, 61 insertions, 99 deletions
diff --git a/configure.in b/configure.in index a565546ea..25e4e06a8 100644 --- a/configure.in +++ b/configure.in @@ -31,27 +31,25 @@ AM_MAINTAINER_MODE dnl AC_CONFIG_HEADERS([mpfrconf.h:mpfrconf.in]) dnl Extra arguments to configure -with_gmp_include= -with_gmp_library= AC_ARG_WITH(gmp_include, [ --with-gmp-include=DIR GMP include directory ], - with_gmp_include=$withval) + CPPFLAGS="$CPPFLAGS -I$withval") AC_ARG_WITH(gmp_lib, [ --with-gmp-lib=DIR GMP lib directory ], - with_gmp_lib=$withval) + LDFLAGS="-L$withval $LDFLAGS") AC_ARG_WITH(gmp_build, - [ --with-gmp-build=DIR GMP build directory], - [with_gmp_build=yes - with_gmp_include=$withval/ - with_gmp_lib=$withval/.libs + [ --with-gmp-build=DIR GMP build directory], [ + CPPFLAGS="$CPPFLAGS -I$withval" + LDFLAGS="-L$withval -L$withval/.libs $LDFLAGS" if test -r $withval/Makefile ; then GMP_CFLAGS=`grep -w "CFLAGS =" $withval/Makefile | sed 's/CFLAGS = //'` GMP_CC=`grep -w "CC =" $withval/Makefile | sed 's/CC = //'` fi ]) AC_ARG_WITH(gmp, - [ --with-gmp=DIR GMP install directory ], - with_gmp_include=$withval/include with_gmp_lib=$withval/lib) + [ --with-gmp=DIR GMP install directory ], [ + CPPFLAGS="$CPPFLAGS -I$withval/include" + LDFLAGS="-L$withval/lib $LDFLAGS" ]) AC_ARG_WITH(irix64, [ --with-irix64=on/off Irix 32/64 bits support ], @@ -84,10 +82,6 @@ AC_ARG_ENABLE(thread-safe, test_CFLAGS=${CFLAGS+set} -dnl Same as in gmp acinclude.m4, though currently we're using the normal -dnl config.sub, so the additional exact cpu types don't arise. -dnl define(X86_PATTERN,[[i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-*]]) - dnl dnl Setup CC and CFLAGS @@ -110,11 +104,7 @@ if test -n "$GMP_CFLAGS" && test -z "$user_redefine_cc" ; then CFLAGS=$GMP_CFLAGS CC=$GMP_CC AC_MSG_CHECKING(for CC=$GMP_CC and CFLAGS=$GMP_CFLAGS) - AC_RUN_IFELSE([AC_LANG_SOURCE([[ - int main() { return 0; } - ]])], [ - AC_MSG_RESULT(yes) - ], [ + AC_RUN_IFELSE([AC_LANG_PROGRAM([[]],[[]])], [AC_MSG_RESULT(yes)], [ AC_MSG_RESULT(no) CFLAGS=$old_cflags CC=$old_cc @@ -146,12 +136,6 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[]])],[AC_MSG_RESULT(yes) GCC= CFLAGS="-fp_port -mp -wd1572 -wd265 -wd186 -wd239 $CFLAGS" -dnl Mixing Libtool and ICC doesn't work well. -dnl so disable shared while libtool doesn't support ICC -dnl (-soname option not recognised). - enable_static=yes - enable_shared=no - AC_MSG_NOTICE(enable static, disable shared) ],[AC_MSG_RESULT(no)]) dnl If compiler is gcc, then use some specific flags. @@ -170,18 +154,18 @@ AC_CHECK_MACHTYPE dnl Set the OS-dependent flags. case $OS_TYPE in - HP-UX*) - if test -n "$GCC"; then - LDFLAGS="-Xlinker +allowunsats $LDFLAGS" - fi - ;; - IRIX64) - if [[ "$irix64" = "on" ]]; then - CFLAGS ="-mabi=64 $CFLAGS" - else - CFLAGS ="-mabi=n32 $CFLAGS" - fi - ;; + HP-UX*) + if test -n "$GCC"; then + LDFLAGS="-Xlinker +allowunsats $LDFLAGS" + fi + ;; + IRIX64) + if [[ "$irix64" = "on" ]]; then + CFLAGS ="-mabi=64 $CFLAGS" + else + CFLAGS ="-mabi=n32 $CFLAGS" + fi + ;; esac AC_C_CONST @@ -194,13 +178,14 @@ dnl Setup LIBTOOL dnl dnl Currently libtool always detect a C++ and fortran compiler dnl Reduce the search list to g++ and g77 -dnl It may freeze with cl on some systems -dnl For CXXCPP, it is defintevely an ugly hack which should be remove +dnl It may freeze with cl on some systems with old libtool. +dnl For CXXCPP, it is definitevely an ugly hack which should be remove dnl as soon as possible but otherwise some systems may not be able to -dnl build MPFR while they should +dnl build MPFR while they should. +dnl Remove this when Libtool >= 2.0 is used AC_PROG_CXX([g++]) AC_PROG_F77([g77]) -CXXCPP="grep limits" +dnl CXXCPP="grep limits" dnl Configs for Windows DLLs. dnl libtool requires "-no-undefined" for win32 dll @@ -231,7 +216,7 @@ case $host in fi ;; esac -# Never enable CXX and GCJ in libtool +# Never enable CXX and GCJ in libtool (remove this for libtool >= 2.0) if test "${with_tags+set}" != set; then with_tags= fi @@ -244,16 +229,13 @@ dnl dnl Setup GMP detection dnl -dnl Detect GMP Header -if test -d "$with_gmp_include"; then - CPPFLAGS="$CPPFLAGS -I$with_gmp_include" -fi +dnl Check GMP Header AC_MSG_CHECKING(for gmp.h) AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ #include "gmp.h" ]])],[AC_MSG_RESULT(yes)],[ AC_MSG_RESULT(no) - AC_MSG_ERROR([gmp.h may be missing ${with_gmp_include:+in $with_gmp_include}]) + AC_MSG_ERROR([gmp.h can't be found, or is unusable.]) ]) AC_MSG_CHECKING(for recent GMP) @@ -267,28 +249,7 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ AC_MSG_ERROR([GMP 4.1.0 min required]) ]) -dnl Check if we can link with GMP -dnl If with_gmp_lib exists, add it to the LDFLAGS using -L -dnl Remember that in case libgmp is not installed, libtool will modify -dnl the -L directory by adding ".libs". But the Autoconf tests must -dnl use the real directory. So we have to check for this. -if test -d "$with_gmp_lib"; then - ORG_LDFLAGS="$LDFLAGS" - LDFLAGS="-L$with_gmp_lib $LDFLAGS" - if test -e "$with_gmp_lib/libgmp.la" && test -z "$with_gmp_build" && grep "installed=no" $with_gmp_lib/libgmp.la > /dev/null ; then - AC_MSG_WARN([GMP isn't properly installed in $with_gmp_lib. -Reinstall properly GMP (with --prefix); -or edit $with_gmp_lib/libgmp.la and set installed=yes]) - fi -fi -AC_CHECK_LIB(gmp, __gmp_version, [LIBS="-lgmp $LIBS"], - [AC_MSG_ERROR(libgmp not found)]) - dnl Check if we can use internal header files of GMP. -dnl TODO: Check for this before including libgmp, -dnl and remove sub_nc test after (setting gmp_internal) -dnl TODO: Static and dynamic lib may be different. static may work -dnl while dynamic not (according to include) and vice-versa. AC_MSG_CHECKING(for gmp internal files) AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ #include "gmp.h" @@ -297,33 +258,47 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ ]])],[ AC_MSG_RESULT(yes) AC_DEFINE([MPFR_HAVE_GMP_IMPL],1,[Use GMP Internal Files]) - dnl Check for valid BITS_PER_MP_LIMB and BYTES_PER_MP_LIMB + gmp_internal_file_check=yes +],[ + AC_MSG_RESULT(no) + AC_FUNC_ALLOCA +]) + +dnl Check for valid BITS_PER_MP_LIMB and BYTES_PER_MP_LIMB +dnl This test doesn't need to link with libgmp (at least it should). +if test -n "$gmp_internal_file_check" ; then AC_MSG_CHECKING(for valid BITS_PER_MP_LIMB and BYTES_PER_MP_LIMB) - AC_TRY_RUN([ + AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include <limits.h> #include "gmp.h" #include "gmp-impl.h" -int main() { +]], [[ return BITS_PER_MP_LIMB == BYTES_PER_MP_LIMB * CHAR_BIT - && sizeof(mp_limb_t) == BYTES_PER_MP_LIMB ? 0 : 1; } - ], AC_MSG_RESULT(yes), [ + && sizeof(mp_limb_t) == BYTES_PER_MP_LIMB ? 0 : 1; +]])], [AC_MSG_RESULT(yes)], [ AC_MSG_RESULT(no) - AC_MSG_WARN([BITS_PER_MP_LIMB or BYTES_PER_MP_LIMB are incorrect. + AC_MSG_ERROR([BITS_PER_MP_LIMB or BYTES_PER_MP_LIMB are incorrect. You probably need to change some of the GMP or MPFR compile options.])], - AC_MSG_RESULT([can't test])) - AC_CHECK_FUNC([__gmpn_sub_nc], - [AC_DEFINE([MPFR_HAVE_MPN_SUB_NC],1,[Function mpn_sub_nc is available])]) - ],[AC_MSG_RESULT(no) AC_FUNC_ALLOCA -]) + [AC_MSG_RESULT([can't test])]) +fi + +dnl Check if we can link with GMP +AC_CHECK_LIB(gmp, __gmp_version, [LIBS="-lgmp $LIBS"], + [AC_MSG_ERROR(libgmp not found)]) + +dnl Check if we can use mpn_sub_nc +if test -n "$gmp_internal_file_check" ; then + AC_CHECK_FUNC([__gmpn_sub_nc], + [AC_DEFINE([MPFR_HAVE_MPN_SUB_NC],1,[Function mpn_sub_nc is available])]) +fi dnl Check for corresponding 'gmp.h' and libgmp.a AC_MSG_CHECKING(if gmp.h version and libgmp version are the same) -AC_RUN_IFELSE([AC_LANG_SOURCE([[ +AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> #include <string.h> #include "gmp.h" -int main() -{ +]], [[ char buffer[100]; if (__GNU_MP_VERSION_PATCHLEVEL != 0) sprintf (buffer, "%d.%d.%d", __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR, @@ -332,23 +307,14 @@ int main() sprintf (buffer, "%d.%d", __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR); printf ("(%s/%s) ", buffer, gmp_version); return (strcmp (buffer, gmp_version) != 0) ? 1 : 0; -} -]])], AC_MSG_RESULT(yes), +]])], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no) AC_MSG_WARN(['gmp.h' and 'libgmp' seems to have different versions.])], AC_MSG_RESULT([can't test]) ) -dnl Rechange the Library directory if we use GMP build directory -dnl ie. libgmp is not installed, so libtool with -Ltoto -dnl looks inside toto/.libs -dnl But the standards ways of compiling must look inside the right -dnl directory. Doliprane SVP. -if test -n "$with_gmp_build" ; then - LDFLAGS="-L$with_gmp_include $ORG_LDFLAGS" -fi - -dnl Remove also many MACROS (AC_DEFINE) which are unused by MPFR. +dnl Remove also many MACROS (AC_DEFINE) which are unused by MPFR +dnl and polluate the build. if test -f confdefs.h; then sed '/#define PACKAGE_/d' <confdefs.h >confdefs.tmp sed '/#define HAVE_STRING/d' <confdefs.tmp >confdefs.h @@ -369,11 +335,7 @@ if test -f confdefs.h; then mv confdefs.tmp confdefs.h fi - -AC_SUBST(INCLUDES) -AC_SUBST(LDADD) -AC_SUBST(LDFLAGS) -AC_SUBST(CFLAGS) +dnl Output AC_CONFIG_FILES([Makefile tests/Makefile]) AC_OUTPUT |