-
Notifications
You must be signed in to change notification settings - Fork 17
/
configure.ac
142 lines (117 loc) · 3.99 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#
# 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/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)
# Find out what type of system we're running on
AC_CANONICAL_BUILD
Platform="$build_cpu-$build_vendor-$build_os"
# This isn't right for msys mingw.
PREFIX="$prefix"
if test "$prefix" = "NONE"
then
if test "$build_os" = "cygwin"
then
PREFIX="c:/cygwin$ac_default_prefix"
else
PREFIX="$ac_default_prefix"
fi
fi
AC_SUBST(PREFIX)
case $Platform in
*-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 "$build_os" = "mingw32"
then
AC_DEFINE(__MINGW32__,[1],[Defined if compiling with mingw])
LEADING_UNDERSCORE=1
fi
if test "$build_os" = "cygwin"
then
AC_DEFINE(CYGWIN,[1],[Defined if compiling with mingw])
LEADING_UNDERSCORE=1
fi
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 "System.Directory.getCurrentDirectory >>= putStrLn.init.tail.show " | ghc --interactive -ignore-dot-ghci -v0 | tr -d '\r'`
AC_DEFINE_UNQUOTED(TOP, "$TOP", [Path to top of build tree])
AC_SUBST(TOP)
# necessary tools
# allow user supplied haskell compiler
AC_ARG_WITH(ghc,
AC_HELP_STRING([--with-ghc=<ghc>],[use a specific Haskell compiler]),
[ GHC="$withval"
if test ! -f "$GHC" ; then
AC_MSG_ERROR([$GHC not found. You need GHC to build this project])
fi
],
[ AC_CHECK_PROG(GHC,ghc,ghc)
if test -z "$GHC" ; then
AC_MSG_ERROR([You need GHC to build this project])
fi
]
)
AC_DEFINE_UNQUOTED(WITH_GHC, "$GHC", [Which ghc to use])
AC_SUBST(GHC)
# Work out value of __GLASGOW_HASKELL__
if test -n "$GHC" ; then
AC_MSG_CHECKING([for value of __GLASGOW_HASKELL__])
echo "main = print __GLASGOW_HASKELL__" > t.hs
GLASGOW_HASKELL=`echo 'main' | "$GHC" --interactive -ignore-dot-ghci -v0 -cpp t.hs`
rm t.hs
AC_MSG_RESULT([$GLASGOW_HASKELL])
fi
AC_SUBST(GLASGOW_HASKELL)
# 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 | tr -d '\r'`
AC_MSG_RESULT([$GHC_LIB_PATH])
fi
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],
[
AC_DEFINE_UNQUOTED(DEBUG, [1], [Defined if a debugging version is to be built]) ],
[ : ])
# Allow a debugging version of hs-plugins to be built
AC_ARG_ENABLE(hsx,
[ --enable-hsx Enable a debug version of hs-plugins to be built],
[ HASKELL_SRC=haskell-src-exts ;
AC_DEFINE_UNQUOTED(WITH_HSX, [1],
[Defined if hs-plugins is to be built with Niklas Broberg's HSX parser]) ],
[ HASKELL_SRC=haskell-src ])
AC_SUBST(HASKELL_SRC)
#AC_CHECK_PROG(TEX,tex,tex)
#if test -z "$TEX" ; then
# AC_MSG_WARN(tex is needed to build some of the documentation)
#fi
#AC_CHECK_PROG(TEX2PAGE,tex2page,tex2page)
#if test -z "$TEX2PAGE" ; then
# AC_MSG_WARN(tex2page is needed to build some of the documentation
# http://www.ccs.neu.edu/home/dorai/tex2page/tex2page-doc.html)
#fi
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 testsuite/makewith/io/TestIO.conf testsuite/makewith/unsafeio/Unsafe.conf])
AC_OUTPUT