From: Ian Lynagh Date: Sun, 11 Mar 2007 17:50:25 +0000 (+0000) Subject: Have configure take arguments telling it where gmp is; fixes trac #957 X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=ca5ded310c0a596be199a3da5f14be2fb2020687 Have configure take arguments telling it where gmp is; fixes trac #957 --- diff --git a/aclocal.m4 b/aclocal.m4 index 9050299..1daac04 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1054,4 +1054,26 @@ case $fptools_cv_timer_create_works in esac ]) +# FP_ARG_GMP +# ------------- +AC_DEFUN([FP_ARG_GMP], +[ +AC_ARG_WITH([gmp-includes], + [AC_HELP_STRING([--with-gmp-includes], + [directory containing gmp.h])], + [gmp_includes=$withval], + [gmp_includes=NONE]) + +AC_ARG_WITH([gmp-libraries], + [AC_HELP_STRING([--with-gmp-libraries], + [directory containing gmp library])], + [gmp_libraries=$withval], + [gmp_libraries=NONE]) +])# FP_ARG_GMP + +AC_DEFUN([CHECK_GMP], +[AC_REQUIRE([AC_PROG_CPP]) +AC_REQUIRE([AC_PROG_CC]) +]) + # LocalWords: fi diff --git a/configure.ac b/configure.ac index 5ce9210..39856a2 100644 --- a/configure.ac +++ b/configure.ac @@ -64,6 +64,25 @@ if test x"$srcdir" != 'x.' ; then fi dnl-------------------------------------------------------------------- +dnl * Deal with arguments telling us gmp is somewhere odd +dnl-------------------------------------------------------------------- + +FP_ARG_GMP + +GMP_INCLUDE_DIRS= +GMP_LIB_DIRS= +if test "x$gmp_libraries" != "xNONE"; then + LDFLAGS="-L$gmp_libraries $LDFLAGS" + GMP_LIB_DIRS=$gmp_libraries +fi +if test "x$gmp_includes" != "xNONE"; then + CPPFLAGS="-I$gmp_includes $CPPFLAGS" + GMP_INCLUDE_DIRS=$gmp_includes +fi +AC_SUBST(GMP_INCLUDE_DIRS) +AC_SUBST(GMP_LIB_DIRS) + +dnl-------------------------------------------------------------------- dnl * Choose host(/target/build) platform dnl-------------------------------------------------------------------- diff --git a/mk/config.mk.in b/mk/config.mk.in index ef0c479..c928dbf 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -882,6 +882,9 @@ endif HaveLibGmp = @HaveLibGmp@ LibGmp = @LibGmp@ +GMP_INCLUDE_DIRS=@GMP_INCLUDE_DIRS@ +GMP_LIB_DIRS=@GMP_LIB_DIRS@ + #----------------------------------------------------------------------------- # GMP framework (Mac OS X) # diff --git a/rts/Makefile b/rts/Makefile index e9612a9..6bf4271 100644 --- a/rts/Makefile +++ b/rts/Makefile @@ -292,6 +292,24 @@ endif CLEAN_FILES += gmp/libgmp.a +# Need to get the GMP vars in through CPP to package.conf.in, and put +# quotes around each element. + +empty = +space = $(empty) $(empty) +comma = , +PACKAGE_CPP_OPTS += -DGMP_INCLUDE_DIRS='$(subst $(space),$(comma),$(patsubst %,"%",$(strip $(GMP_INCLUDE_DIRS))))' +PACKAGE_CPP_OPTS += -DGMP_LIB_DIRS='$(subst $(space),$(comma),$(patsubst %,"%",$(strip $(GMP_LIB_DIRS))))' + +ifneq "$(GMP_INCLUDE_DIRS)" "" +SRC_HC_OPTS += -I$(GMP_INCLUDE_DIRS) +SRC_CC_OPTS += -I$(GMP_INCLUDE_DIRS) +SRC_HSC2HS_OPTS += -I$(GMP_INCLUDE_DIRS) +endif +ifneq "$(GMP_LIB_DIRS)" "" +SRC_LD_OPTS += -L$(GMP_LIB_DIRS) +endif + #----------------------------------------------------------------------------- # # Building the GUM SysMan diff --git a/rts/package.conf.in b/rts/package.conf.in index 0ccdb3c..77fb192 100644 --- a/rts/package.conf.in +++ b/rts/package.conf.in @@ -15,13 +15,13 @@ hidden-modules: import-dirs: #ifdef INSTALLING -library-dirs: LIB_DIR +library-dirs: LIB_DIR GMP_LIB_DIRS # ifdef mingw32_HOST_OS , LIB_DIR"/gcc-lib" /* force the dist-provided gcc-lib/ into scope. */ # endif #else /* !INSTALLING */ -library-dirs: FPTOOLS_TOP_ABS"/rts" +library-dirs: FPTOOLS_TOP_ABS"/rts" GMP_LIB_DIRS # if !defined(HAVE_LIBGMP) && !defined(HAVE_FRAMEWORK_GMP) , FPTOOLS_TOP_ABS"/rts/gmp" # endif @@ -58,7 +58,7 @@ extra-libraries: "m" /* for ldexp() */ #endif #ifdef INSTALLING -include-dirs: INCLUDE_DIR +include-dirs: INCLUDE_DIR GMP_INCLUDE_DIRS # ifdef mingw32_HOST_OS , INCLUDE_DIR"/mingw" # endif