From: wolfgang Date: Sat, 12 Oct 2002 23:12:12 +0000 (+0000) Subject: [project @ 2002-10-12 23:12:08 by wolfgang] X-Git-Tag: Approx_11550_changesets_converted~1557 X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=31442604c1d4ee4102a459a64e4afc39c49fc8a2 [project @ 2002-10-12 23:12:08 by wolfgang] Make the Mac OS X build use the HaskellSupport.framework (a MacOS-style "framework" that includes the required libraries libgmp and dlcompat) if it is present. The HaskellSupport.framework is not yet in CVS, but is available from me. --- diff --git a/configure.in b/configure.in index 36e28c8..04a79c8 100644 --- a/configure.in +++ b/configure.in @@ -953,6 +953,21 @@ AC_CHECK_LIB(gmp, __gmpz_fdiv_qr, HaveLibGmp=YES; LibGmp=gmp, AC_SUBST(HaveLibGmp) AC_SUBST(LibGmp) +dnl ** (Mac OS X only: check for HaskellSupport.framework) +HaveFrameworkHaskellSupport=NO +if test $HostPlatform = "powerpc-apple-darwin"; then + AC_MSG_CHECKING([for HaskellSupport.framework]) + save_libs="$LIBS" + LIBS="-framework HaskellSupport" + AC_TRY_LINK_FUNC(__gmpz_fdiv_qr, HaveFrameworkHaskellSupport=YES,) + if test $HaveFrameworkHaskellSupport = YES; then + AC_DEFINE(HAVE_FRAMEWORK_HASKELLSUPPORT) + fi; + LIBS="$save_libs" + AC_MSG_RESULT([$HaveFrameworkHaskellSupport]) +fi; +AC_SUBST(HaveFrameworkHaskellSupport) + dnl ** check for mingwex library AC_CHECK_LIB(mingwex, closedir, HaveLibMingwEx=YES, HaveLibMingwEx=NO) AC_SUBST(HaveLibMingwEx) @@ -1027,85 +1042,104 @@ dnl ################################################################ dnl ** check for libdl & RTLD_NEXT -AC_CHECK_LIB(dl, dlopen, - [HaveLibDL=YES - AC_DEFINE(HAVE_LIBDL) - LIBS="$LIBS -ldl"], - [HaveLibDL=NO]) -AC_CHECK_FUNCS(dlopen) -AC_SUBST(HaveLibDL) - -dnl ** sometimes RTLD_NEXT is hidden in #ifdefs we really don't wan to set -AC_MSG_CHECKING(for RTLD_NEXT from dlfcn.h) -AC_EGREP_CPP(yes, -[ - #include - #ifdef RTLD_NEXT - yes - #endif -], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_RTLDNEXT) - HaveRtldNext=YES -], [ - AC_MSG_RESULT(no) - HaveRtldNext=NO - ]) -AC_SUBST(HaveRtldNext) - -dnl ** RTLD_LOCAL isn't available on cygwin or openbsd -AC_MSG_CHECKING(for RTLD_LOCAL from dlfcn.h) -AC_EGREP_CPP(yes, -[ - #include - #ifdef RTLD_LOCAL - yes - #endif -], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_RTLDLOCAL) - HaveRtldLocal=YES -], [ - AC_MSG_RESULT(no) - HaveRtldLocal=NO - ]) -AC_SUBST(HaveRtldLocal) - -dnl ** RTLD_GLOBAL isn't available on openbsd -AC_MSG_CHECKING(for RTLD_GLOBAL from dlfcn.h) -AC_EGREP_CPP(yes, -[ - #include - #ifdef RTLD_GLOBAL - yes - #endif -], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_RTLDGLOBAL) - HaveRtldGlobal=YES -], [ - AC_MSG_RESULT(no) - HaveRtldGlobal=NO - ]) -AC_SUBST(HaveRtldGlobal) - -dnl ** RTLD_NOW isn't available on openbsd -AC_MSG_CHECKING(for RTLD_NOW from dlfcn.h) -AC_EGREP_CPP(yes, -[ - #include - #ifdef RTLD_NOW - yes - #endif -], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_RTLDNOW) - HaveRtldNow=YES -], [ - AC_MSG_RESULT(no) - HaveRtldNow=NO - ]) -AC_SUBST(HaveRtldNow) +dnl (Mac OS X only) ... but don't check if we already have the +dl HaskellSupport.framework + +if test $HaveFrameworkHaskellSupport = YES; then + HaveLibDL = NO + HaveRtldNext=NO + HaveRtldLocal=YES + AC_DEFINE(HAVE_RTLDLOCAL) + HaveRtldGlobal=YES + AC_DEFINE(HAVE_RTLDGLOBAL) + HaveRtldNow=YES + AC_DEFINE(HAVE_RTLDNOW) + AC_SUBST(HaveLibDL) + AC_SUBST(HaveRtldNext) + AC_SUBST(HaveRtldLocal) + AC_SUBST(HaveRtldGlobal) + AC_SUBST(HaveRtldNow) +else + AC_CHECK_LIB(dl, dlopen, + [HaveLibDL=YES + AC_DEFINE(HAVE_LIBDL) + LIBS="$LIBS -ldl"], + [HaveLibDL=NO]) + AC_CHECK_FUNCS(dlopen) + AC_SUBST(HaveLibDL) + + dnl ** sometimes RTLD_NEXT is hidden in #ifdefs we really don't wan to set + AC_MSG_CHECKING(for RTLD_NEXT from dlfcn.h) + AC_EGREP_CPP(yes, + [ + #include + #ifdef RTLD_NEXT + yes + #endif + ], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_RTLDNEXT) + HaveRtldNext=YES + ], [ + AC_MSG_RESULT(no) + HaveRtldNext=NO + ]) + AC_SUBST(HaveRtldNext) + + dnl ** RTLD_LOCAL isn't available on cygwin or openbsd + AC_MSG_CHECKING(for RTLD_LOCAL from dlfcn.h) + AC_EGREP_CPP(yes, + [ + #include + #ifdef RTLD_LOCAL + yes + #endif + ], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_RTLDLOCAL) + HaveRtldLocal=YES + ], [ + AC_MSG_RESULT(no) + HaveRtldLocal=NO + ]) + AC_SUBST(HaveRtldLocal) + + dnl ** RTLD_GLOBAL isn't available on openbsd + AC_MSG_CHECKING(for RTLD_GLOBAL from dlfcn.h) + AC_EGREP_CPP(yes, + [ + #include + #ifdef RTLD_GLOBAL + yes + #endif + ], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_RTLDGLOBAL) + HaveRtldGlobal=YES + ], [ + AC_MSG_RESULT(no) + HaveRtldGlobal=NO + ]) + AC_SUBST(HaveRtldGlobal) + + dnl ** RTLD_NOW isn't available on openbsd + AC_MSG_CHECKING(for RTLD_NOW from dlfcn.h) + AC_EGREP_CPP(yes, + [ + #include + #ifdef RTLD_NOW + yes + #endif + ], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_RTLDNOW) + HaveRtldNow=YES + ], [ + AC_MSG_RESULT(no) + HaveRtldNow=NO + ]) + AC_SUBST(HaveRtldNow) +fi FPTOOLS_CHECK_LIB_NOWARN(m, atan) diff --git a/ghc/rts/Linker.c b/ghc/rts/Linker.c index a465dc7..261caf1 100644 --- a/ghc/rts/Linker.c +++ b/ghc/rts/Linker.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Linker.c,v 1.104 2002/10/02 09:36:00 wolfgang Exp $ + * $Id: Linker.c,v 1.105 2002/10/12 23:12:08 wolfgang Exp $ * * (c) The GHC Team, 2000, 2001 * @@ -31,7 +31,9 @@ #include #endif -#ifdef HAVE_DLFCN_H +#if defined(HAVE_FRAMEWORK_HASKELLSUPPORT) +#include +#elif defined(HAVE_DLFCN_H) #include #endif @@ -502,15 +504,15 @@ typedef struct _RtsSymbolVal { #define RTS_EXTRA_SYMBOLS \ Sym(__divsf3) #elif defined(powerpc_TARGET_ARCH) -#define RTS_EXTRA_SYMBOLS \ +#define RTS_EXTRA_SYMBOLS \ Sym(__divdi3) \ Sym(__udivdi3) \ Sym(__moddi3) \ - Sym(__umoddi3) \ - Sym(__ashldi3) \ - Sym(__ashrdi3) \ - Sym(__lshrdi3) \ - SymX(__eprintf) + Sym(__umoddi3) \ + Sym(__ashldi3) \ + Sym(__ashrdi3) \ + Sym(__lshrdi3) \ + Sym(__eprintf) #else #define RTS_EXTRA_SYMBOLS /* nothing */ #endif diff --git a/ghc/rts/Makefile b/ghc/rts/Makefile index c0dcae5..4f8c669 100644 --- a/ghc/rts/Makefile +++ b/ghc/rts/Makefile @@ -177,6 +177,7 @@ endif # and not worth re-implementing in our Makefile framework. ifneq "$(HaveLibGmp)" "YES" +ifneq "$(HaveFrameworkHaskellSupport)" "YES" ifneq "$(HOSTPLATFORM)" "i386-unknown-mingw32" boot :: cd gmp && ./configure --enable-shared=no \ @@ -208,6 +209,7 @@ clean distclean maintainer-clean :: INSTALL_LIBS += gmp/libgmp.a endif +endif gmp/libgmp.a :: $(MAKE) -C gmp MAKEFLAGS= diff --git a/ghc/rts/rts.conf.in b/ghc/rts/rts.conf.in index 8af549b..4230e14 100644 --- a/ghc/rts/rts.conf.in +++ b/ghc/rts/rts.conf.in @@ -21,8 +21,14 @@ Package { ], hs_libraries = [ "HSrts" ], - extra_libraries = [ "gmp" - , "m" /* for ldexp() */ + extra_libraries = [ + "m" /* for ldexp() */ +#ifndef HAVE_FRAMEWORK_HASKELLSUPPORT + , "gmp" +#ifdef HAVE_LIBDL + , "dl" +#endif +#endif #ifdef mingw32_TARGET_OS ,"winmm" /* for the threadDelay timer */ ,"wsock32" /* for the linker */ @@ -127,4 +133,7 @@ Package { , "-u", "__stginit_Prelude" #endif ] +#ifdef HAVE_FRAMEWORK_HASKELLSUPPORT + , extra_frameworks = [ "HaskellSupport" ] +#endif } diff --git a/mk/config.h.in b/mk/config.h.in index d2b23e7..7efbc2b 100644 --- a/mk/config.h.in +++ b/mk/config.h.in @@ -1057,3 +1057,5 @@ /* Define if signal.h defines SIGPOLL */ #undef HAVE_SIGPOLL +/* Define if the HaskellSupport.framework is installed (Mac OS X only) */ +#undef HAVE_FRAMEWORK_HASKELLSUPPORT diff --git a/mk/config.mk.in b/mk/config.mk.in index 38c09ef..4e8790f 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -684,6 +684,11 @@ LibGmp = @LibGmp@ HaveLibMingwEx = @HaveLibMingwEx@ #----------------------------------------------------------------------------- +# HaskellSupport framework (Mac OS X) +# +HaveFrameworkHaskellSupport = @HaveFrameworkHaskellSupport@ + +#----------------------------------------------------------------------------- # Regex libraries # (if present in libc use that one, otherwise use the one in the tree) #