Repository : ssh://darcs.haskell.org//srv/darcs/packages/integer-gmp On branch : master
http://hackage.haskell.org/trac/ghc/changeset/2cf2423a0c0c1e6495812467deee4df0cb4320fa >--------------------------------------------------------------- commit 2cf2423a0c0c1e6495812467deee4df0cb4320fa Author: Ian Lynagh <[email protected]> Date: Tue Jan 1 17:01:00 2013 +0000 Provide a way for OS X users to indicate a preference for the GMP framework We used to always use the framework if it existed. Now the make variable GMP_PREFER_FRAMEWORK can be used to control whether the library or the framework is preferred. Fixes #7466. >--------------------------------------------------------------- aclocal.m4 | 39 +++++++++++++++++++++++++++++++++++++++ configure.ac | 49 ++++++++++++++++++++++--------------------------- gmp/ghc.mk | 4 ++++ 3 files changed, 65 insertions(+), 27 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..8a9c467 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,39 @@ + +dnl-------------------------------------------------------------------- +dnl * Check whether this machine has gmp/gmp3 installed +dnl-------------------------------------------------------------------- + +AC_DEFUN([LOOK_FOR_GMP_LIB],[ + if test "$HaveFrameworkGMP" = "NO" + then + AC_CHECK_LIB([gmp], [__gmpz_fdiv_qr], + [HaveLibGmp=YES; GMP_LIBS=gmp]) + if test "$HaveLibGmp" = "NO" + then + AC_CHECK_LIB([gmp3], [__gmpz_fdiv_qr], + [HaveLibGmp=YES; GMP_LIBS=gmp3]) + fi + fi +]) + +dnl-------------------------------------------------------------------- +dnl * Mac OS X only: check for GMP.framework +dnl-------------------------------------------------------------------- + +AC_DEFUN([LOOK_FOR_GMP_FRAMEWORK],[ + if test "$HaveLibGmp" = "NO" + then + case $target_os in + darwin*) + AC_MSG_CHECKING([for GMP.framework]) + save_libs="$LIBS" + LIBS="-framework GMP" + AC_TRY_LINK_FUNC(__gmpz_fdiv_qr, + [HaveFrameworkGMP=YES; GMP_FRAMEWORK=GMP]) + LIBS="$save_libs" + AC_MSG_RESULT([$HaveFrameworkGMP]) + ;; + esac + fi +]) + diff --git a/configure.ac b/configure.ac index b6a8003..7ea296c 100644 --- a/configure.ac +++ b/configure.ac @@ -27,38 +27,33 @@ AC_ARG_WITH([gmp-libraries], [GMP_LIB_DIRS=$withval; LDFLAGS="-L$withval"], [GMP_LIB_DIRS=]) +AC_ARG_WITH([gmp-framework-preferred], + [AC_HELP_STRING([--with-gmp-framework-preferred], + [on OSX, prefer the GMP framework to the gmp lib])], + [GMP_PREFER_FRAMEWORK=YES], + [GMP_PREFER_FRAMEWORK=NO]) dnl-------------------------------------------------------------------- -dnl * Check whether this machine has gmp/gmp3 installed +dnl * Detect gmp dnl-------------------------------------------------------------------- -AC_CHECK_LIB([gmp], [__gmpz_fdiv_qr], - [HaveLibGmp=YES; GMP_LIBS=gmp], - [HaveLibGmp=NO; GMP_LIBS=]) -if test "$HaveLibGmp" = "NO"; then -AC_CHECK_LIB([gmp3], [__gmpz_fdiv_qr], - [HaveLibGmp=YES; GMP_LIBS=gmp3], - [HaveLibGmp=NO; GMP_LIBS=]) +HaveLibGmp=NO +GMP_LIBS= +HaveFrameworkGMP=NO +GMP_FRAMEWORK= + +if test "$GMP_PREFER_FRAMEWORK" = "YES" +then + LOOK_FOR_GMP_FRAMEWORK + LOOK_FOR_GMP_LIB +else + LOOK_FOR_GMP_LIB + LOOK_FOR_GMP_FRAMEWORK +fi +if test "$HaveFrameworkGMP" = "YES" || test "$HaveLibGmp" = "NO" +then + AC_CHECK_HEADER([gmp.h], , [AC_MSG_ERROR([Cannot find gmp.h])]) fi - -dnl-------------------------------------------------------------------- -dnl * Mac OS X only: check for GMP.framework -dnl-------------------------------------------------------------------- - -case $target_os in - darwin*) - AC_MSG_CHECKING([for GMP.framework]) - save_libs="$LIBS" - LIBS="-framework GMP" - AC_TRY_LINK_FUNC(__gmpz_fdiv_qr, - [HaveFrameworkGMP=YES; GMP_FRAMEWORK=GMP; GMP_LIBS=], - [HaveFrameworkGMP=NO]) - LIBS="$save_libs" - AC_MSG_RESULT([$HaveFrameworkGMP]) - ;; -esac - -AC_CHECK_HEADER([gmp.h], , [HaveFrameworkGMP=NO; HaveLibGmp=NO; GMP_LIBS=]) dnl-------------------------------------------------------------------- dnl * Make sure we got some form of gmp diff --git a/gmp/ghc.mk b/gmp/ghc.mk index 8c60e6f..b39f36a 100644 --- a/gmp/ghc.mk +++ b/gmp/ghc.mk @@ -39,6 +39,10 @@ ifeq "$(findstring clean,$(MAKECMDGOALS))" "" include libraries/integer-gmp/gmp/config.mk endif +ifeq "$(GMP_PREFER_FRAMEWORK)" "YES" +libraries/integer-gmp_CC_OPTS += --with-gmp-framework-preferred +endif + libraries/integer-gmp_CC_OPTS += $(addprefix -I,$(GMP_INCLUDE_DIRS)) libraries/integer-gmp_CC_OPTS += $(addprefix -L,$(GMP_LIB_DIRS)) _______________________________________________ Cvs-libraries mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-libraries
