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