Improve the size-change detection heuristics in the compare tool
[ghc.git] / distrib / configure.ac.in
1 dnl
2 dnl Binary distribution configure script
3 dnl
4 #!/bin/sh
5 #
6
7 AC_INIT([The Glorious Glasgow Haskell Compilation System], [@ProjectVersion@], [glasgow-haskell-bugs@haskell.org], [ghc])
8
9 FP_BINDIST_GHC_PWD
10 FP_FIND_ROOT
11
12 BootingFromHc=NO
13 AC_SUBST(BootingFromHc)
14
15 dnl--------------------------------------------------------------------
16 dnl * Deal with arguments telling us gmp is somewhere odd
17 dnl--------------------------------------------------------------------
18
19 FP_GMP
20
21 bootstrap_target=`ghc/stage2/build/tmp/ghc-stage2 +RTS --info | grep '^ ,("Target platform"' | sed -e 's/.*, "//' -e 's/")//' | tr -d '\r'`
22 FPTOOLS_SET_PLATFORM_VARS
23
24 BuildingCrossCompiler=NO
25 PortingCompiler=NO
26 CrossCompiling=NO
27 CrossCompilePrefix=""
28 TargetPlatformFull="${target}"
29
30 AC_SUBST(BuildingCrossCompiler)  # 'toolchain' case
31 AC_SUBST(PortingCompiler)        # 'port' case
32 AC_SUBST(CrossCompiling)         # BuildingCrossCompiler OR PortingCompiler
33 AC_SUBST(CrossCompilePrefix)
34 AC_SUBST(TargetPlatformFull)
35
36 #
37 dnl ** Check Perl installation **
38 #
39 AC_PATH_PROG(PerlCmd,perl)
40 if test -z "$PerlCmd"; then
41    echo "You must install perl before you can continue"
42    echo "Perhaps it is already installed, but not in your PATH?"
43    exit 1
44 fi
45 FPTOOLS_SHEBANG_PERL
46
47 #
48 dnl ** figure out how to do a BSD-ish install **
49 #
50 AC_PROG_INSTALL
51
52 #
53 dnl ** how to do symlinks **
54 #
55 AC_PROG_LN_S()
56
57 #
58 dnl ** Find the path to sed **
59 #
60 AC_PATH_PROG(SedCmd,gsed sed,sed)
61
62 XCODE_VERSION()
63
64 dnl ** Which gcc to use?
65 dnl --------------------------------------------------------------
66 FIND_GCC([WhatGccIsCalled], [gcc], [gcc])
67 CC="$WhatGccIsCalled"
68 export CC
69
70 FP_GCC_VERSION
71 AC_PROG_CPP
72
73 FP_PROG_LD_HashSize31
74 FP_PROG_LD_ReduceMemoryOverheads
75
76 #
77 dnl ** Check gcc version and flags we need to pass it **
78 #
79 FP_GCC_EXTRA_FLAGS
80
81 FPTOOLS_SET_C_LD_FLAGS([target],[CFLAGS],[LDFLAGS],[IGNORE_LINKER_LD_FLAGS],[CPPFLAGS])
82 FPTOOLS_SET_C_LD_FLAGS([build],[CONF_CC_OPTS_STAGE0],[CONF_GCC_LINKER_OPTS_STAGE0],[CONF_LD_LINKER_OPTS_STAGE0],[CONF_CPP_OPTS_STAGE0])
83 FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE1],[CONF_GCC_LINKER_OPTS_STAGE1],[CONF_LD_LINKER_OPTS_STAGE1],[CONF_CPP_OPTS_STAGE1])
84 # Stage 3 won't be supported by cross-compilation
85 FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE2],[CONF_GCC_LINKER_OPTS_STAGE2],[CONF_LD_LINKER_OPTS_STAGE2],[CONF_CPP_OPTS_STAGE2])
86
87 AC_SUBST(CONF_CC_OPTS_STAGE0)
88 AC_SUBST(CONF_CC_OPTS_STAGE1)
89 AC_SUBST(CONF_CC_OPTS_STAGE2)
90 AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE0)
91 AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE1)
92 AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE2)
93 AC_SUBST(CONF_LD_LINKER_OPTS_STAGE0)
94 AC_SUBST(CONF_LD_LINKER_OPTS_STAGE1)
95 AC_SUBST(CONF_LD_LINKER_OPTS_STAGE2)
96 AC_SUBST(CONF_CPP_OPTS_STAGE0)
97 AC_SUBST(CONF_CPP_OPTS_STAGE1)
98 AC_SUBST(CONF_CPP_OPTS_STAGE2)
99
100 dnl ** Set up the variables for the platform in the settings file.
101 dnl May need to use gcc to find platform details.
102 dnl --------------------------------------------------------------
103 FPTOOLS_SET_HASKELL_PLATFORM_VARS
104
105 dnl WordSize for settings.in
106 AC_CHECK_SIZEOF(void *, 4)
107 WordSize=$ac_cv_sizeof_void_p
108 AC_SUBST(WordSize)
109
110 #
111 dnl ** how to invoke `ar' and `ranlib'
112 #
113 FP_PROG_AR_NEEDS_RANLIB
114
115 FP_SETTINGS
116
117 #
118 AC_CONFIG_FILES(settings mk/config.mk mk/install.mk)
119 AC_OUTPUT
120
121 # We get caught by
122 #     http://savannah.gnu.org/bugs/index.php?1516
123 #     $(eval ...) inside conditionals causes errors
124 # with make 3.80, so warn the user if it looks like they're about to
125 # try to use it.
126 # We would use "grep -q" here, but Solaris's grep doesn't support it.
127 checkMake380() {
128     if $1 --version 2>&1 | head -1 | grep 'GNU Make 3\.80' > /dev/null
129     then
130         echo
131         echo "WARNING: It looks like \"$1\" is GNU make 3.80."
132         echo "This version cannot be used to build GHC."
133         echo "Please use GNU make >= 3.81."
134     fi
135 }
136
137 checkMake380 make
138 checkMake380 gmake
139
140 echo "****************************************************"
141 echo "Configuration done, ready to 'make install'"
142 echo "(see README and INSTALL files for more info.)"
143 echo "****************************************************"