HEADS UP: First go at cabalising hs-plugins build system. Bugs have been introduced though

This commit is contained in:
Don Stewart
2005-08-18 05:03:08 +00:00
parent fcbbc78a28
commit e568f1f6bf
52 changed files with 453 additions and 1197 deletions

View File

@ -1,10 +1,17 @@
#
# Copyright (c) 2004 Don Stewart - http://www.cse.unsw.edu.au/~dons
# Copyright (c) 2004-5 Don Stewart - http://www.cse.unsw.edu.au/~dons
# LGPL version 2.1 or later (see http://www.gnu.org/copyleft/lesser.html)
#
# SUBSTs go into config.mk.in (TOP,PREFIX,GHC,INSTAlL)
# AC_DEFINES go into config.h
# only AC_DEFINES are visible in Haskell src
# sanity test
AC_INIT(src/plugins/System/Plugins.hs)
AC_INIT(plugins/System/Plugins.hs)
# Prepare to generate the config.h.in file
AC_CONFIG_HEADERS([config.h])
# untested on earlier than 2.52, but it won't work anyway
AC_PREREQ(2.53)
@ -30,43 +37,35 @@ AC_SUBST(PREFIX)
case $Platform in
powerpc-apple-darwin*)
MACOSX=yes
AC_DEFINE_UNQUOTED(MACOSX, [1], [Defined if compiling on the mac])
LEADING_UNDERSCORE=1
;;
*)
MACOSX=no
LEADING_UNDERSCORE=0
;;
esac
if test "$MACOSX" = "yes"
then
WHOLE_ARCHIVE_FLAG=-all_load
LEADING_UNDERSCORE=1
SYMS="$SYMS -DMACOSX"
else
WHOLE_ARCHIVE_FLAG=--whole-archive
LEADING_UNDERSCORE=0
fi
AC_SUBST(WHOLE_ARCHIVE_FLAG)
AC_SUBST(LEADING_UNDERSCORE)
if test "$build_os" = "mingw32"
then
AC_DEFINE(__MINGW32__,[1],[Defined if compiling with mingw])
LEADING_UNDERSCORE=1
SYMS="$SYMS -D__MINGW32__"
fi
AC_SUBST(LEADING_UNDERSCORE)
AC_SUBST(SYMS)
if test "$build_os" = "cygwin"
then
AC_DEFINE(CYGWIN,[1],[Defined if compiling with mingw])
LEADING_UNDERSCORE=1
SYMS="$SYMS -DCYGWIN"
fi
AC_SUBST(LEADING_UNDERSCORE)
AC_SUBST(SYMS)
AC_DEFINE_UNQUOTED(LEADING_UNDERSCORE, $LEADING_UNDERSCORE,
[Whether symbols are prefixed with a leading underscore])
# Find pwd, in a cygwin friendly way.
# Suggested by: http://www.haskell.org/ghc/docs/latest/html/users_guide/ch11s04.html
TOP=`echo "Directory.getCurrentDirectory >>= putStrLn.init.tail.show " | ghc --interactive -ignore-dot-ghci -v0`
AC_DEFINE_UNQUOTED(TOP, "$TOP", [Path to top of build tree])
AC_SUBST(TOP)
# necessary tools
@ -85,24 +84,9 @@ AC_ARG_WITH(ghc,
fi
]
)
AC_DEFINE_UNQUOTED(WITH_GHC, $GHC, [Which ghc to use])
AC_SUBST(GHC)
# find path to GHC libs, for runtime_loader
if test -n "$GHC" ; then
AC_MSG_CHECKING([for ghc library directory])
GHC_LIB_PATH=`$GHC --print-libdir`
AC_MSG_RESULT([$GHC_LIB_PATH])
fi
AC_SUBST(GHC_LIB_PATH)
# check ghc version here
if test -n "$GHC" ; then
AC_MSG_CHECKING([for ghc version])
GHC_VERSION=`$GHC --numeric-version`
AC_MSG_RESULT([$GHC_VERSION])
fi
AC_SUBST(GHC_VERSION)
# Work out value of __GLASGOW_HASKELL__
if test -n "$GHC" ; then
AC_MSG_CHECKING([for value of __GLASGOW_HASKELL__])
@ -113,94 +97,21 @@ if test -n "$GHC" ; then
fi
AC_SUBST(GLASGOW_HASKELL)
dnl ** quote char breaks sed
changequote(, )dnl
MAJOR=`echo "$GHC_VERSION" | sed 's/^\([^\.]*\)\.\([^\.]*\).*/\1/'`
MINOR=`echo "$GHC_VERSION" | sed 's/^\([^\.]*\)\.\([^\.]*\).*/\2/'`
changequote([, ])dnl
if test "$MAJOR" -lt "6"; then
AC_MSG_ERROR(Found major $MAJOR. You need a ghc version >= 6.2) ;
# find path to GHC libs, for runtime_loader
if test -n "$GHC" ; then
AC_MSG_CHECKING([for ghc library directory])
GHC_LIB_PATH=`$GHC --print-libdir`
AC_MSG_RESULT([$GHC_LIB_PATH])
fi
if test "$MINOR" -lt "2"; then
AC_MSG_ERROR(You need a ghc version >= 6.2) ;
fi
#Allow plugins to be built with Cabal libraries
AC_ARG_ENABLE(cabal,
[ --enable-cabal Enable use of Cabal packages in pluggable-1-branch
of GHC],
[ CABAL=1 ],
[ CABAL=0 ])
# used by the Makefile`s to alter dependencies.
if test "$MAJOR" -ge "6" -a "$MINOR" -ge "4"; then
CABAL=1
fi
AC_SUBST(CABAL)
AC_DEFINE_UNQUOTED(GHC_LIB_PATH, "$GHC_LIB_PATH", [Path to ghc libraries])
# Allow a debugging version of hs-plugins to be built
AC_ARG_ENABLE(debug,
[ --enable-debug Enable a debug version of hs-plugins to be built],
[ DEBUG_OPTS=-DDEBUG ],
[ DEBUG_OPTS= ])
[ AC_DEFINE_UNQUOTED(DEBUG, [1], [Defined if a debugging version is to be built]) ],
[ : ])
AC_SUBST(DEBUG_OPTS)
# Search for ghc-pkg
AC_MSG_CHECKING([for ghc-pkg])
ghc_pkg_guess=`echo $GHC | sed 's,ghc\(@<:@^/\\@:>@*\)$,ghc-pkg\1,'`
if "$ghc_pkg_guess" -l > /dev/null 2>&1; then
matching_ghc_pkg=$ghc_pkg_guess
else
matching_ghc_pkg=no
fi
if test x"$matching_ghc_pkg" = xno; then
AC_CHECK_PROG([GHCPKG], [ghc-pkg])
if test -z "$GHCPKG" ; then
AC_MSG_ERROR([ghc-pkg not found.])
fi
else
GHCPKG=$matching_ghc_pkg
fi
AC_MSG_RESULT([$GHCPKG])
AC_SUBST(GHCPKG)
AC_CHECK_PROG(HADDOCK,haddock,haddock)
if test -z "$HADDOCK" ; then
AC_MSG_WARN(You need Haddock if you want developer documentation)
fi
AC_CHECK_PROG(HAPPY,happy,happy)
if test -z "$HAPPY" ; then
AC_MSG_WARN(If you change or remove the parser you'll need Happy)
fi
AC_CHECK_PROG(ALEX,alex,alex)
if test -z "$ALEX" ; then
AC_MSG_WARN(If you change or remove the lexer files you'll need alex)
fi
AC_CHECK_PROG(LD,ld,ld)
if test -z "$LD" ; then
AC_MSG_WARN(You need ld -export-dynamic)
fi
AC_CHECK_PROG(AR,ar,ar)
if test -z "$AR" ; then
AC_MSG_WARN(You need ar to build the library)
fi
AC_CHECK_PROG(RANLIB,ranlib,ranlib)
if test -z "$RANLIB" ; then
AC_MSG_WARN(You need randlib to build the library)
fi
AC_CHECK_PROG(RM,rm,rm)
if test -z "$RM" ; then
AC_MSG_WARN(You need rm!)
fi
AC_CHECK_PROG(TEX,tex,tex)
if test -z "$TEX" ; then
@ -212,14 +123,11 @@ if test -z "$TEX2PAGE" ; then
documentation: http://www.ccs.neu.edu/home/dorai/tex2page/tex2page-doc.html)
fi
AC_CHECK_FUNC(arc4random, [SYMS="$SYMS -DHAVE_ARC4RANDOM"])
AC_SUBST(SYMS)
AC_CHECK_FUNCS(arc4random)
AC_PROG_INSTALL
# System.Process uses cmd or command.com shell on Windows, doen't use Cygwin or MSYS shell
AC_CONFIG_FILES(config.mk config.h examples/makewith/io/TestIO.conf examples/makewith/unsafeio/Unsafe.conf)
AC_CONFIG_FILES([config.mk examples/makewith/io/TestIO.conf examples/makewith/unsafeio/Unsafe.conf])
AC_OUTPUT