Update the OS X package build scripts
[ghc-hetmet.git] / distrib / configure-bin.ac
index bccef9c..425e906 100644 (file)
@@ -5,100 +5,28 @@ dnl
 #
 
 # Is it there?
-AC_INIT(Makefile.in)
+AC_INIT(mk/config.mk.in)
 
-exeext=''
+FP_FIND_ROOT
 
-#
-# First off, what system are we running under?
-#
-AC_CANONICAL_SYSTEM
-
-dnl ** canonicalize platform names
-# Canonicali[sz]e the platform name
-TargetPlatform=`/bin/sh $srcdir/config.sub $target` || exit 1
+dnl--------------------------------------------------------------------
+dnl * Deal with arguments telling us gmp is somewhere odd
+dnl--------------------------------------------------------------------
 
-#
-# The following will be more difficult when we *are* cross-compiling.
-# Suitable names to slam in *_CPP are in platform.h.in.
-# We also record the architecture, vendor, and operating system (OS)
-# separately.
-case $TargetPlatform in
-alpha*-dec-osf[[12]]*)
-       TargetPlatform=alpha-dec-osf1;;
-alpha*-dec-osf[[345]]*)
-       TargetPlatform=alpha-dec-osf3;;
-alpha*-unknown-linux)
-       TargetPlatform=alpha-unknown-linux;;
-alpha*-unknown-freebsd*)
-       TargetPlatform=alpha-unknown-freebsd;;
-hppa1.1-hp-hpux*)
-       TargetPlatform=hppa1.1-hp-hpux;;
-i[[3456]]86-*-linuxaout*)
-       TargetPlatform=i386-unknown-linuxaout;;
-i[[3456]]86-*-linux*)
-       TargetPlatform=i386-unknown-linux;;
-i[[3456]]86-*-freebsd2*)
-       TargetPlatform=i386-unknown-freebsd2;;
-i[[3456]]86-*-freebsd[[3-9]]*)
-       TargetPlatform=i386-unknown-freebsd;;
-i[[3456]]86-*-netbsd*)
-       TargetPlatform=i386-unknown-netbsd;;
-i[[3456]]86-*-openbsd*)
-       TargetPlatform=i386-unknown-openbsd;;
-i[[3456]]86-*-solaris2*)
-       TargetPlatform=i386-unknown-solaris2;;
-i[[3456]]86-*-cygwin*)
-       exeext='.exe'
-       TargetPlatform=i386-unknown-cygwin32;;
-i[[3456]]86-*-mingw32*)
-       exeext='.exe'
-       # We assume you're using mingw32 via the gcc that comes
-       # with cygwin, and not the native port, so let's augment
-       # the gcc command-line used here with -mno-cygwin -mwin32
-       # to arrange for good things to happen.
-       CFLAGS="-mno-cygwin -mwin32 $CFLAGS"
-       TargetPlatform=i386-unknown-mingw32
-       ;;
-m68k-next-nextstep2)
-       TargetPlatform=m68k-next-nextstep2;;
-m68k-next-nextstep3)
-       TargetPlatform=m68k-next-nextstep3;;
-i[[3456]]86-next-nextstep3)
-       TargetPlatform=i386-next-nextstep3;;
-m68k-sun-sunos4*)
-       TargetPlatform=m68k-sun-sunos4;;
-mips-dec-ultrix*)
-        TargetPlaformP=mips-dec-ultrix;;
-mips-sgi-irix*)
-       TargetPlatform=mips-sgi-irix;;
-powerpc-ibm-aix*)
-       TargetPlatform=powerpc-ibm-aix;;
-rs6000-ibm-aix*)
-       TargetPlatform=rs6000-ibm-aix;;
-powerpc-apple-darwin*)
-       TargetPlatform=powerpc-apple-darwin;;
-sparc-sun-sunos4*)
-       TargetPlatform=sparc-sun-sunos4;;
-sparc-sun-solaris2*)
-       TargetPlatform=sparc-sun-solaris2;;
-x86_64-*-linux*)
-        TargetPlatform=x86_64-unknown-linux;;
-x86_64-*-freebsd*)
-       TargetPlatform=x86_64-unknown-freebsd;;
-x86_64-*-openbsd*)
-       TargetPlatform=x86_64-unknown-openbsd;;
-x86_64-*-netbsd*)
-       TargetPlatform=x86_64-unknown-netbsd;;
-*)
-        echo "Unrecognised platform: $TargetPlatform"
-        exit 1
-        ;;
-esac
-echo "Which we'll further canonicalise into: $TargetPlatform"
+FP_ARG_GMP
 
-AC_SUBST(TargetPlatform)
-AC_SUBST(exeext)
+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 ** Check Perl installation **
@@ -122,6 +50,11 @@ dnl ** how to do symlinks **
 AC_PROG_LN_S()
 
 #
+dnl ** how to invoke `ar' and `ranlib'
+#
+FP_PROG_AR_NEEDS_RANLIB
+
+#
 dnl ** Find the path to sed **
 #
 AC_PATH_PROG(SedCmd,sed)
@@ -133,10 +66,15 @@ FP_HAVE_GCC
 AC_PROG_CPP
 
 #
-AC_OUTPUT(Makefile)
+dnl ** Check gcc version and flags we need to pass it **
+#
+FP_GCC_EXTRA_FLAGS
+
+#
+AC_CONFIG_FILES(extra-gcc-opts mk/config.mk mk/install.mk)
+AC_OUTPUT
 
 echo "****************************************************"
-echo "Configuration done, ready to either 'make install'"
-echo "or 'make in-place'."
+echo "Configuration done, ready to 'make install'"
 echo "(see README and INSTALL files for more info.)"
 echo "****************************************************"