Merge branch 'refs/heads/vect-avoid' into vect-avoid-merge
[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=@TargetPlatform@
22 FPTOOLS_SET_PLATFORM_VARS
23
24 # ToDo: if Stage1Only=YES, should be YES
25 CrossCompiling=NO
26 CrossCompilePrefix=""
27 TargetPlatformFull="${target}"
28
29 AC_SUBST(CrossCompiling)
30 AC_SUBST(CrossCompilePrefix)
31 AC_SUBST(TargetPlatformFull)
32
33 Unregisterised="@Unregisterised@"
34 AC_SUBST(Unregisterised)
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
46 #
47 dnl ** figure out how to do a BSD-ish install **
48 #
49 AC_PROG_INSTALL
50
51 #
52 dnl ** how to do symlinks **
53 #
54 AC_PROG_LN_S()
55
56 #
57 dnl ** Find the path to sed **
58 #
59 AC_PATH_PROG(SedCmd,gsed sed,sed)
60
61 XCODE_VERSION()
62
63 dnl ** Which gcc to use?
64 dnl --------------------------------------------------------------
65 FIND_GCC([WhatGccIsCalled], [gcc], [gcc])
66 CC="$WhatGccIsCalled"
67 export CC
68
69 dnl ** Which ld to use?
70 dnl --------------------------------------------------------------
71 FP_ARG_WITH_PATH_GNU_PROG([LD], [ld], [ld])
72 LdCmd="$LD"
73 AC_SUBST([LdCmd])
74
75 FP_GCC_VERSION
76 AC_PROG_CPP
77
78 FP_PROG_LD_HashSize31
79 FP_PROG_LD_ReduceMemoryOverheads
80 FP_PROG_LD_IS_GNU
81 FP_PROG_LD_BUILD_ID
82 FP_PROG_LD_NO_COMPACT_UNWIND
83
84 #
85 dnl ** Check gcc version and flags we need to pass it **
86 #
87 FP_GCC_EXTRA_FLAGS
88
89 FPTOOLS_SET_C_LD_FLAGS([target],[CFLAGS],[LDFLAGS],[IGNORE_LINKER_LD_FLAGS],[CPPFLAGS])
90 FPTOOLS_SET_C_LD_FLAGS([build],[CONF_CC_OPTS_STAGE0],[CONF_GCC_LINKER_OPTS_STAGE0],[CONF_LD_LINKER_OPTS_STAGE0],[CONF_CPP_OPTS_STAGE0])
91 FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE1],[CONF_GCC_LINKER_OPTS_STAGE1],[CONF_LD_LINKER_OPTS_STAGE1],[CONF_CPP_OPTS_STAGE1])
92 # Stage 3 won't be supported by cross-compilation
93 FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE2],[CONF_GCC_LINKER_OPTS_STAGE2],[CONF_LD_LINKER_OPTS_STAGE2],[CONF_CPP_OPTS_STAGE2])
94
95 AC_SUBST(CONF_CC_OPTS_STAGE0)
96 AC_SUBST(CONF_CC_OPTS_STAGE1)
97 AC_SUBST(CONF_CC_OPTS_STAGE2)
98 AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE0)
99 AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE1)
100 AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE2)
101 AC_SUBST(CONF_LD_LINKER_OPTS_STAGE0)
102 AC_SUBST(CONF_LD_LINKER_OPTS_STAGE1)
103 AC_SUBST(CONF_LD_LINKER_OPTS_STAGE2)
104 AC_SUBST(CONF_CPP_OPTS_STAGE0)
105 AC_SUBST(CONF_CPP_OPTS_STAGE1)
106 AC_SUBST(CONF_CPP_OPTS_STAGE2)
107
108 dnl ** Set up the variables for the platform in the settings file.
109 dnl May need to use gcc to find platform details.
110 dnl --------------------------------------------------------------
111 FPTOOLS_SET_HASKELL_PLATFORM_VARS
112
113 dnl WordSize for settings.in
114 AC_CHECK_SIZEOF(void *, 4)
115 WordSize=$ac_cv_sizeof_void_p
116 AC_SUBST(WordSize)
117
118 #
119 dnl ** how to invoke `ar' and `ranlib'
120 #
121 FP_PROG_AR_NEEDS_RANLIB
122
123 FP_SETTINGS
124
125 #
126 AC_CONFIG_FILES(settings mk/config.mk mk/install.mk)
127 AC_OUTPUT
128
129 # We get caught by
130 #     http://savannah.gnu.org/bugs/index.php?1516
131 #     $(eval ...) inside conditionals causes errors
132 # with make 3.80, so warn the user if it looks like they're about to
133 # try to use it.
134 # We would use "grep -q" here, but Solaris's grep doesn't support it.
135 checkMake380() {
136     if $1 --version 2>&1 | head -1 | grep 'GNU Make 3\.80' > /dev/null
137     then
138         echo
139         echo "WARNING: It looks like \"$1\" is GNU make 3.80."
140         echo "This version cannot be used to build GHC."
141         echo "Please use GNU make >= 3.81."
142     fi
143 }
144
145 checkMake380 make
146 checkMake380 gmake
147
148 echo "****************************************************"
149 echo "Configuration done, ready to 'make install'"
150 echo "(see README and INSTALL files for more info.)"
151 echo "****************************************************"