Have configure take arguments telling it where gmp is; fixes trac #957
authorIan Lynagh <igloo@earth.li>
Sun, 11 Mar 2007 17:50:25 +0000 (17:50 +0000)
committerIan Lynagh <igloo@earth.li>
Sun, 11 Mar 2007 17:50:25 +0000 (17:50 +0000)
aclocal.m4
configure.ac
mk/config.mk.in
rts/Makefile
rts/package.conf.in

index 9050299..1daac04 100644 (file)
@@ -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
index 5ce9210..39856a2 100644 (file)
@@ -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--------------------------------------------------------------------
 
index ef0c479..c928dbf 100644 (file)
@@ -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)
 #
index e9612a9..6bf4271 100644 (file)
@@ -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
index 0ccdb3c..77fb192 100644 (file)
@@ -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