These new --target options are used to tell the build system where it can find the cross compiler version of gcc. The test for HAVE_SETITIMER_VIRTUAL is commented out because it doesn't work in a cross compile. libraries/Cabal/Distribution/Simple/Toolchain.hs.in is used here to make the cross compiler information available to cabal. --- ghc-6.10.2.orig/configure.ac 2009-03-31 06:13:16.000000000 +1300 +++ ghc-6.10.2/configure.ac 2009-06-18 15:54:37.000000000 +1200 @@ -188,6 +188,15 @@ HostVendor_CPP='unknown' HostOS_CPP='linux' ;; +arm-apple-darwin*) + HostPlatform=arm-apple-darwin + TargetPlatform=arm-apple-darwin + BuildPlatform=arm-apple-darwin + HostPlatform_CPP='arm_apple_darwin' + HostArch_CPP='arm' + HostVendor_CPP='apple' + HostOS_CPP='darwin' + ;; arm*-openbsd*) HostPlatform=arm-unknown-openbsd TargetPlatform=arm-unknown-openbsd @@ -721,6 +730,114 @@ ) AC_SUBST(WhatGccIsCalled) +AC_ARG_WITH(target-gcc, +[AC_HELP_STRING([--with-target-gcc=ARG], + [Use ARG as the path to the target version of gcc])], +[TARGET_GCC="$withval"], +[TARGET_GCC="$WhatGccIsCalled"] +) +AC_SUBST(TARGET_GCC) + +AC_ARG_WITH(target-ld, +[AC_HELP_STRING([--with-target-ld=ARG], + [Use ARG as the path to the target version of ld])], +[TARGET_LD="$withval"], +[TARGET_LD="$LD"] +) +AC_SUBST(TARGET_LD) + +AC_ARG_WITH(target-ar, +[AC_HELP_STRING([--with-target-ar=ARG], + [Use ARG as the path to the target version of ar])], +[TARGET_AR="$withval"], +[TARGET_AR="$AR"] +) +AC_SUBST(TARGET_AR) + +AC_ARG_WITH(target-ranlib, +[AC_HELP_STRING([--with-target-ranlib=ARG], + [Use ARG as the path to the target version of ranlib])], +[TARGET_RANLIB="$withval"], +[TARGET_RANLIB="$RANLIB"] +) +AC_SUBST(TARGET_RANLIB) + +AC_ARG_WITH(target-strip, +[AC_HELP_STRING([--with-target-strip=ARG], + [Use ARG as the path to the target version of strip])], +[TARGET_STRIP="$withval"], +[TARGET_STRIP="$STRIP"] +) +AC_SUBST(TARGET_STRIP) + +AC_ARG_WITH(target-cflags, +[AC_HELP_STRING([--with-target-cflags=ARG], + [Use ARG as the CFLAGS for the target gcc])], +[TARGET_CFLAGS="$withval"], +[TARGET_CFLAGS=""] +) +AC_SUBST(TARGET_CFLAGS) + +AC_ARG_WITH(target-cppflags, +[AC_HELP_STRING([--with-target-cppflags=ARG], + [Use ARG as the CPPFLAGS for the target gcc])], +[TARGET_CPPFLAGS="$withval"], +[TARGET_CPPFLAGS=""] +) +AC_SUBST(TARGET_CPPFLAGS) + +AC_ARG_WITH(target-ldflags, +[AC_HELP_STRING([--with-target-ldflags=ARG], + [Use ARG as the LDFLAGS for the target gcc])], +[TARGET_LDFLAGS="$withval"], +[TARGET_LDFLAGS=""] +) +AC_SUBST(TARGET_LDFLAGS) + +AC_ARG_WITH(local-gcc, +[AC_HELP_STRING([--with-local-gcc=ARG], + [Use ARG as the path to the local version of gcc (whose output can execute locally)])], +[LOCAL_GCC="$withval"], +[LOCAL_GCC="$TARGET_GCC"] +) +AC_SUBST(LOCAL_GCC) + +AC_ARG_WITH(local-cflags, +[AC_HELP_STRING([--with-local-cflags=ARG], + [Use ARG as the CFLAGS for the local gcc])], +[LOCAL_CFLAGS="$withval"], +[LOCAL_CFLAGS="$TARGET_CFLAGS"] +) +AC_SUBST(LOCAL_CFLAGS) + +AC_ARG_WITH(local-cppflags, +[AC_HELP_STRING([--with-local-cppflags=ARG], + [Use ARG as the CPPFLAGS for the local gcc])], +[LOCAL_CPPFLAGS="$withval"], +[LOCAL_CPPFLAGS="$TARGET_CPPFLAGS"] +) +AC_SUBST(LOCAL_CPPFLAGS) + +AC_ARG_WITH(local-ldflags, +[AC_HELP_STRING([--with-local-ldflags=ARG], + [Use ARG as the LDFLAGS for the local gcc])], +[LOCAL_LDFLAGS="$withval"], +[LOCAL_LDFLAGS=""] +) +AC_SUBST(LOCAL_LDFLAGS) + +AC_ARG_WITH(toolchain-name, +[AC_HELP_STRING([--with-toolchain-name=ARG], + [Give a name to the toolchain])], +[TOOLCHAIN_NAME="$withval" +TOOLCHAIN_EXE_PREFIX="${TOOLCHAIN_NAME}-" +TOOLCHAIN_VERSION_TAGS="-${TOOLCHAIN_NAME}"], +[TOOLCHAIN_EXE_PREFIX="" +TOOLCHAIN_VERSION_TAGS=""] +) +AC_SUBST(TOOLCHAIN_EXE_PREFIX) +AC_SUBST(TOOLCHAIN_VERSION_TAGS) + dnl ** Which ld to use? dnl -------------------------------------------------------------- AC_ARG_WITH(ld, @@ -1088,6 +1205,14 @@ FP_CHECK_ALIGNMENT(unsigned short) FP_CHECK_ALIGNMENT(void *) +# ARM - to do: do this properly +AC_DEFINE([ALIGNMENT_LONG], 4, []) +AC_DEFINE([ALIGNMENT_UNSIGNED_LONG], 4, []) +AC_DEFINE([ALIGNMENT_VOID_P], 4, []) +AC_DEFINE([SIZEOF_LONG], 4, []) +AC_DEFINE([SIZEOF_UNSIGNED_LONG], 4, []) +AC_DEFINE([SIZEOF_VOID_P], 4, []) + FP_CHECK_FUNC([WinExec], [@%:@include ], [WinExec("",0)]) @@ -1122,17 +1247,17 @@ dnl ** The following have been verified to be used in ghc/, but might be used somewhere else, too. AC_CHECK_FUNCS([getclock getrusage gettimeofday setitimer siginterrupt sysconf times ctime_r]) -AC_TRY_RUN([ -#include -#include -int main(void) { - struct itimerval tval; - tval.it_value.tv_sec = 1; - tval.it_value.tv_usec = 0; - tval.it_interval = tval.it_value; - return setitimer(ITIMER_VIRTUAL, &tval, (void*)0) != 0; -} -],[AC_DEFINE([HAVE_SETITIMER_VIRTUAL], [1], [Define to 1 if setitimer accepts ITIMER_VIRTUAL, 0 else.])]) +dnl AC_TRY_RUN([ +dnl #include +dnl #include +dnl int main(void) { +dnl struct itimerval tval; +dnl tval.it_value.tv_sec = 1; +dnl tval.it_value.tv_usec = 0; +dnl tval.it_interval = tval.it_value; +dnl return setitimer(ITIMER_VIRTUAL, &tval, (void*)0) != 0; +dnl } +dnl ],[AC_DEFINE([HAVE_SETITIMER_VIRTUAL], [1], [Define to 1 if setitimer accepts ITIMER_VIRTUAL, 0 else.])]) dnl ** On OS X 10.4 (at least), time.h doesn't declare ctime_r if dnl ** _POSIX_C_SOURCE is defined @@ -1262,7 +1387,7 @@ dnl ** check for librt AC_CHECK_LIB(rt, clock_gettime) AC_CHECK_FUNCS(clock_gettime timer_create timer_settime) -FP_CHECK_TIMER_CREATE +dnl FP_CHECK_TIMER_CREATE dnl ** check for Apple's "interesting" long double compatibility scheme AC_MSG_CHECKING(for printf\$LDBLStub) @@ -1303,7 +1428,8 @@ fi AC_SUBST(HavePapi) -AC_CONFIG_FILES([mk/config.mk compiler/ghc.cabal ghc/ghc-bin.cabal utils/runghc/runghc.cabal ghc.spec extra-gcc-opts docs/users_guide/ug-book.xml]) +AC_CONFIG_FILES([mk/config.mk compiler/ghc.cabal ghc/ghc-bin.cabal utils/runghc/runghc.cabal ghc.spec extra-gcc-opts docs/users_guide/ug-book.xml + libraries/Cabal/Distribution/Simple/Toolchain.hs]) AC_CONFIG_COMMANDS([mk/stamp-h],[echo timestamp > mk/stamp-h]) AC_OUTPUT