From 56ee3049b28d020a639cd5889fefcae4daee55ae Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sun, 19 Jun 2011 11:31:32 -0600 Subject: [PATCH] switch `configure' to use "$host_..." instead of `uname' to support cross compilation; the main risk of this change is that I might have some GNU canonical system names wrog, since they're different from `uname' results --- src/configure | 88 ++++++++++++++++------------------------- src/racket/configure.ac | 83 ++++++++++++++++---------------------- 2 files changed, 66 insertions(+), 105 deletions(-) diff --git a/src/configure b/src/configure index 90b8552837..e793d7c902 100755 --- a/src/configure +++ b/src/configure @@ -1798,7 +1798,7 @@ ac_config_headers="$ac_config_headers racket/mzconfig.h" ac_aux_dir= -for ac_dir in lt "$srcdir"/lt ; do +for ac_dir in lt "$srcdir"/lt; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" @@ -1814,8 +1814,8 @@ for ac_dir in lt "$srcdir"/lt ; do fi done if test -z "$ac_aux_dir"; then - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in lt \"$srcdir\"/lt " >&5 -echo "$as_me: error: cannot find install-sh or install.sh in lt \"$srcdir\"/lt " >&2;} + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in lt \"$srcdir\"/lt" >&5 +echo "$as_me: error: cannot find install-sh or install.sh in lt \"$srcdir\"/lt" >&2;} { (exit 1); exit 1; }; } fi @@ -2144,23 +2144,6 @@ if test "${enable_noopt+set}" = set; then fi -###### Get OS Type ####### - -echo Host is $host - -if test -x "/bin/uname" ; then - UNAME=/bin/uname -elif test -x "/usr/bin/uname" ; then - UNAME=/usr/bin/uname -elif test -x "/usr/local/bin/uname" ; then - UNAME=/usr/local/bin/uname -else - echo configure: cannot find uname - exit 1 -fi - -OS=`$UNAME -s` - ###### Some flags imply other flags ####### if test "${enable_smalloskit}" = "yes" ; then @@ -2188,20 +2171,23 @@ if test "${enable_lt}" = "yes" ; then fi if test "${enable_shared}" = "yes" ; then - if test "$OS" = "Darwin" ; then + case "$host_os" in + darwin*) if test "${enable_xonx}" != "yes" ; then echo "ERROR: don't use --enable-shared or --enable-dynlib under Mac OS X," echo " unless you also use --enable-xonx" exit 1 fi - fi + ;; + esac fi enable_quartz=no if test "${enable_xonx}" = "yes" ; then enable_quartz=no else - if test "$OS" = "Darwin" ; then + case "$host_os" in + darwin*) enable_quartz=yes enable_origtree=yes if test "${prefix}" != "NONE" ; then @@ -2215,7 +2201,8 @@ else exit 1 fi fi - fi + ;; + esac fi if test "${enable_iconv}" = "" ; then @@ -2386,8 +2373,6 @@ CGCOPTIONS= GC2OPTIONS= DYN_CFLAGS= -LIBS= - WXVARIANT="wx_xt" MROPTIONS= @@ -3941,36 +3926,30 @@ OSX=".osx" NOT_OSX="" CGC_X86_64="" -case $OS in - SunOS) - case `$UNAME -r` in - 5.*) - STATICLINK="-Wl,-Bstatic" # after -ldl - LIBS="$LIBS -lsocket -lnsl -lintl" - need_gcc_static_libgcc="yes" - check_gcc_dash_e="yes" - ;; - *) - ;; - esac +case "$host_os" in + solaris2*) + STATICLINK="-Wl,-Bstatic" # after -ldl + LIBS="$LIBS -lsocket -lnsl -lintl" + need_gcc_static_libgcc="yes" + check_gcc_dash_e="yes" ;; - AIX) + aix*) enable_cgcdefault="yes" EXTRALIBS="-Wl,-brtl,-bE:\$(srcdir)/../racket/include/racket.exp" ;; - *FreeBSD) + *freebsd*) LIBS="$LIBS -rdynamic" DYN_CFLAGS="-fPIC" enable_pthread=yes ;; - OpenBSD) + openbsd*) LIBS="$LIBS -rdynamic -Wl,--export-dynamic" enable_pthread=yes ;; - NetBSD) + netbsd*) LIBS="$LIBS -rdynamic" ;; - IRIX) + irix*) enable_cgcdefault="yes" STATICLINK="/usr/lib/libC.a /usr/lib/libmalloc.a" if test "$X_PRE_LIBS" = " -lSM -lICE" ; then @@ -3978,17 +3957,17 @@ case $OS in X_PRE_LIBS="" fi ;; - Linux) + linux*) LIBS="$LIBS -ldl -lm -rdynamic" DYN_CFLAGS="-fPIC" STRIP_DEBUG="strip -S" - case `$UNAME -m` in + case "$host_cpu" in #Required for CentOS 4.6 x86_64) enable_parallel_by_default=yes CGC_X86_64="1" ;; - ppc) + ppc|powerpc) ;; alpha) EXTRA_GMP_OBJ="gmp_alpha_gcc.o" @@ -4001,7 +3980,7 @@ case $OS in ;; esac ;; - OSF1) + osf1*) enable_cgcdefault="yes" if test "$CC" = "cc" ; then COMPFLAGS="$COMPFLAGS -ieee_with_inexact -assume noaligned_objects" @@ -4010,7 +3989,7 @@ case $OS in EXTRA_GMP_DEP='$(EXTRA_GMP_DEP_FILE)' fi ;; - HP-UX) + hpux*) enable_cgcdefault="yes" if test "$CC" = "gcc"; then COMPFLAGS="$COMPFLAGS -fPIC" @@ -4023,7 +4002,7 @@ case $OS in fi LIBS="$LIBS -Wl,-E" ;; - CYGWIN*) + cygwin*) enable_cgcdefault="yes" MZINSTALLTARGET=unix-cygwin-install if test "${enable_shared}" = "yes" ; then @@ -4033,11 +4012,11 @@ case $OS in fi EXE_SUFFIX=".exe" ;; - BeOS) + beos*) enable_cgcdefault="yes" enable_sgc=yes ;; - Darwin) + darwin*) if test "${enable_sdk}" != "" ; then PREFLAGS="$PREFLAGS -isysroot ${enable_sdk} -mmacosx-version-min=10.4 -DEXTRA_EXCEPTION_STUBS" @@ -4055,7 +4034,7 @@ case $OS in need_cc_in_extras=yes fi - case "`$UNAME -m`" in + case "$host_cpu" in i386|x86_64) enable_parallel_by_default=yes ;; @@ -4071,7 +4050,7 @@ case $OS in # Force 32-bit build unless mac64 is enabled: if test "${enable_mac64}" != "yes" ; then - if test "`${UNAME} -m`" != "Power Macintosh" ; then + if test "$host_cpu" != "powerpc" ; then if test "${ORIG_CC}" = "" ; then PREFLAGS="${PREFLAGS} -m32" CPPFLAGS="${CPPFLAGS} -m32" @@ -4118,8 +4097,7 @@ case $OS in ;; esac -MACH=`$UNAME -p` -case "$MACH" in +case "$host_cpu" in alpha | sparc | powerpc) if test "$CC" = "gcc" ; then if test "$as_was_set" = "no" ; then diff --git a/src/racket/configure.ac b/src/racket/configure.ac index 5a12c84cd0..9e5b353555 100644 --- a/src/racket/configure.ac +++ b/src/racket/configure.ac @@ -23,6 +23,9 @@ AC_INIT([Racket]) AC_CONFIG_SRCDIR(racket/src/bignum.c) AC_CONFIG_HEADERS([racket/mzconfig.h]) +AC_CONFIG_AUX_DIR(lt) +AC_CANONICAL_SYSTEM + AC_ARG_ENABLE(gracket, [ --enable-gracket build GRacket as well as Racket (enabled by default)], , enable_gracket=yes ) AC_ARG_ENABLE(jit, [ --enable-jit support JIT compiler (enabled by default)], , enable_jit=yes) AC_ARG_ENABLE(foreign, [ --enable-foreign support foreign calls (enabled by default)], , enable_foreign=yes) @@ -68,21 +71,6 @@ AC_ARG_ENABLE(gcov, [ --enable-gcov compile to gather gcov statist AC_ARG_ENABLE(noopt, [ --enable-noopt drop -O C flags]) -###### Get OS Type ####### - -if test -x "/bin/uname" ; then - UNAME=/bin/uname -elif test -x "/usr/bin/uname" ; then - UNAME=/usr/bin/uname -elif test -x "/usr/local/bin/uname" ; then - UNAME=/usr/local/bin/uname -else - echo configure: cannot find uname - exit 1 -fi - -OS=`$UNAME -s` - ###### Some flags imply other flags ####### if test "${enable_smalloskit}" = "yes" ; then @@ -110,20 +98,23 @@ if test "${enable_lt}" = "yes" ; then fi if test "${enable_shared}" = "yes" ; then - if test "$OS" = "Darwin" ; then + case "$host_os" in + darwin*) if test "${enable_xonx}" != "yes" ; then echo "ERROR: don't use --enable-shared or --enable-dynlib under Mac OS X," echo " unless you also use --enable-xonx" exit 1 fi - fi + ;; + esac fi enable_quartz=no if test "${enable_xonx}" = "yes" ; then enable_quartz=no else - if test "$OS" = "Darwin" ; then + case "$host_os" in + darwin*) enable_quartz=yes enable_origtree=yes if test "${prefix}" != "NONE" ; then @@ -137,7 +128,8 @@ else exit 1 fi fi - fi + ;; + esac fi if test "${enable_iconv}" = "" ; then @@ -308,8 +300,6 @@ CGCOPTIONS= GC2OPTIONS= DYN_CFLAGS= -LIBS= - WXVARIANT="wx_xt" MROPTIONS= @@ -468,36 +458,30 @@ OSX=".osx" NOT_OSX="" CGC_X86_64="" -case $OS in - SunOS) - case `$UNAME -r` in - 5.*) - STATICLINK="-Wl,-Bstatic" # after -ldl - LIBS="$LIBS -lsocket -lnsl -lintl" - need_gcc_static_libgcc="yes" - check_gcc_dash_e="yes" - ;; - *) - ;; - esac +case "$host_os" in + solaris2*) + STATICLINK="-Wl,-Bstatic" # after -ldl + LIBS="$LIBS -lsocket -lnsl -lintl" + need_gcc_static_libgcc="yes" + check_gcc_dash_e="yes" ;; - AIX) + aix*) enable_cgcdefault="yes" EXTRALIBS="-Wl,-brtl,-bE:\$(srcdir)/../racket/include/racket.exp" ;; - *FreeBSD) + *freebsd*) LIBS="$LIBS -rdynamic" DYN_CFLAGS="-fPIC" enable_pthread=yes ;; - OpenBSD) + openbsd*) LIBS="$LIBS -rdynamic -Wl,--export-dynamic" enable_pthread=yes ;; - NetBSD) + netbsd*) LIBS="$LIBS -rdynamic" ;; - IRIX) + irix*) enable_cgcdefault="yes" STATICLINK="/usr/lib/libC.a /usr/lib/libmalloc.a" if test "$X_PRE_LIBS" = " -lSM -lICE" ; then @@ -505,17 +489,17 @@ case $OS in X_PRE_LIBS="" fi ;; - Linux) + linux*) LIBS="$LIBS -ldl -lm -rdynamic" DYN_CFLAGS="-fPIC" STRIP_DEBUG="strip -S" - case `$UNAME -m` in + case "$host_cpu" in #Required for CentOS 4.6 x86_64) enable_parallel_by_default=yes CGC_X86_64="1" ;; - ppc) + ppc|powerpc) ;; alpha) EXTRA_GMP_OBJ="gmp_alpha_gcc.o" @@ -528,7 +512,7 @@ case $OS in ;; esac ;; - OSF1) + osf1*) enable_cgcdefault="yes" if test "$CC" = "cc" ; then COMPFLAGS="$COMPFLAGS -ieee_with_inexact -assume noaligned_objects" @@ -537,7 +521,7 @@ case $OS in EXTRA_GMP_DEP='$(EXTRA_GMP_DEP_FILE)' fi ;; - HP-UX) + hpux*) enable_cgcdefault="yes" if test "$CC" = "gcc"; then COMPFLAGS="$COMPFLAGS -fPIC" @@ -550,7 +534,7 @@ case $OS in fi LIBS="$LIBS -Wl,-E" ;; - CYGWIN*) + cygwin*) enable_cgcdefault="yes" MZINSTALLTARGET=unix-cygwin-install if test "${enable_shared}" = "yes" ; then @@ -560,11 +544,11 @@ case $OS in fi EXE_SUFFIX=".exe" ;; - BeOS) + beos*) enable_cgcdefault="yes" enable_sgc=yes ;; - Darwin) + darwin*) if test "${enable_sdk}" != "" ; then PREFLAGS="$PREFLAGS -isysroot ${enable_sdk} -mmacosx-version-min=10.4 -DEXTRA_EXCEPTION_STUBS" @@ -582,7 +566,7 @@ case $OS in need_cc_in_extras=yes fi - case "`$UNAME -m`" in + case "$host_cpu" in i386|x86_64) enable_parallel_by_default=yes ;; @@ -598,7 +582,7 @@ case $OS in # Force 32-bit build unless mac64 is enabled: if test "${enable_mac64}" != "yes" ; then - if test "`${UNAME} -m`" != "Power Macintosh" ; then + if test "$host_cpu" != "powerpc" ; then if test "${ORIG_CC}" = "" ; then PREFLAGS="${PREFLAGS} -m32" CPPFLAGS="${CPPFLAGS} -m32" @@ -645,8 +629,7 @@ case $OS in ;; esac -MACH=`$UNAME -p` -case "$MACH" in +case "$host_cpu" in alpha | sparc | powerpc) if test "$CC" = "gcc" ; then if test "$as_was_set" = "no" ; then