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