Improve the configure script
authorIan Lynagh <igloo@earth.li>
Tue, 16 Jun 2009 17:37:53 +0000 (17:37 +0000)
committerIan Lynagh <igloo@earth.li>
Tue, 16 Jun 2009 17:37:53 +0000 (17:37 +0000)
configure.ac
gmp/config.mk.in [new file with mode: 0644]
gmp/ghc.mk

index bac536d..428e151 100644 (file)
@@ -33,12 +33,12 @@ dnl * Check whether this machine has gmp/gmp3 installed
 dnl--------------------------------------------------------------------
 
 AC_CHECK_LIB([gmp],  [__gmpz_fdiv_qr],
-             [HAVE_GMP=YES; GMP_LIBS=gmp],
-             [HAVE_GMP=NO;  GMP_LIBS=])
-if test "$HAVE_GMP" = "NO"; then
+             [HaveLibGmp=YES; GMP_LIBS=gmp],
+             [HaveLibGmp=NO;  GMP_LIBS=])
+if test "$HaveLibGmp" = "NO"; then
 AC_CHECK_LIB([gmp3], [__gmpz_fdiv_qr],
-             [HAVE_GMP=YES; GMP_LIBS=gmp3],
-             [HAVE_GMP=NO;  GMP_LIBS=])
+             [HaveLibGmp=YES; GMP_LIBS=gmp3],
+             [HaveLibGmp=NO;  GMP_LIBS=])
 fi
 
 dnl--------------------------------------------------------------------
@@ -51,10 +51,10 @@ case $target_os in
     save_libs="$LIBS"
     LIBS="-framework GMP"
     AC_TRY_LINK_FUNC(__gmpz_fdiv_qr,
-      [HAVE_GMP_FRAMEWORK=yes; GMP_FRAMEWORK=GMP; GMP_LIBS=; HAVE_GMP=YES],
-      [HAVE_GMP_FRAMEWORK=no])
+      [HaveFrameworkGMP=yes; GMP_FRAMEWORK=GMP; GMP_LIBS=],
+      [HaveFrameworkGMP=no])
     LIBS="$save_libs"
-    AC_MSG_RESULT([$HAVE_GMP_FRAMEWORK])
+    AC_MSG_RESULT([$HaveFrameworkGMP])
     ;;
 esac
 
@@ -62,19 +62,14 @@ dnl--------------------------------------------------------------------
 dnl * Make sure we got some form of gmp
 dnl--------------------------------------------------------------------
 
-if test "$HAVE_GMP" = "NO"; then
-  AC_MSG_ERROR([cannot find the gmp library on the system.]
-    [If you have gmp installed in a non-standard location re-run ./configure]
-    [and specify the flags --with-gmp-includes= and/or --with-gmp-libraries=])
-fi
-
-
 AC_SUBST(GMP_INCLUDE_DIRS)
 AC_SUBST(GMP_LIBS)
 AC_SUBST(GMP_LIB_DIRS)
 AC_SUBST(GMP_FRAMEWORK)
+AC_SUBST(HaveLibGmp)
+AC_SUBST(HaveFrameworkGMP)
 
-AC_CONFIG_FILES([integer.buildinfo])
+AC_CONFIG_FILES([integer.buildinfo gmp/config.mk])
 
 dnl--------------------------------------------------------------------
 dnl * Generate the header cbits/GmpDerivedConstants.h
diff --git a/gmp/config.mk.in b/gmp/config.mk.in
new file mode 100644 (file)
index 0000000..db36659
--- /dev/null
@@ -0,0 +1,4 @@
+
+HaveLibGmp = @HaveLibGmp@
+HaveFrameworkGMP = @HaveFrameworkGMP@
+
index 76350f7..a1852c8 100644 (file)
@@ -10,6 +10,9 @@
 #
 # -----------------------------------------------------------------------------
 
+ifneq "$(phase)" "0"
+
+include libraries/integer-gmp/gmp/config.mk
 
 # Compile GMP only if we don't have it already
 #
@@ -147,3 +150,5 @@ endif
 #      $(RM) -rf gmpbuild-shared
 #endif
 
+endif
+