| 1 | dnl == autoconf source for the Glasgow FP tools == |
|---|
| 2 | dnl (run "grep '^dnl \*' configure.ac | sed -e 's/dnl / /g; s/\*\*/ +/g;'" |
|---|
| 3 | dnl (or some such) to see the outline of this file) |
|---|
| 4 | dnl |
|---|
| 5 | # |
|---|
| 6 | # (c) The University of Glasgow 1994-2012 |
|---|
| 7 | # |
|---|
| 8 | # Configure script template for GHC |
|---|
| 9 | # |
|---|
| 10 | # Process with 'autoreconf' to get a working configure script. |
|---|
| 11 | # |
|---|
| 12 | # For the generated configure script, do "./configure --help" to |
|---|
| 13 | # see what flags are available. (Better yet, read the documentation!) |
|---|
| 14 | # |
|---|
| 15 | |
|---|
| 16 | AC_INIT([The Glorious Glasgow Haskell Compilation System], [7.5], [glasgow-haskell-bugs@haskell.org], [ghc]) |
|---|
| 17 | |
|---|
| 18 | # Set this to YES for a released version, otherwise NO |
|---|
| 19 | : ${RELEASE=NO} |
|---|
| 20 | |
|---|
| 21 | # The primary version (e.g. 7.5, 7.4.1) is set in the AC_INIT line |
|---|
| 22 | # above. If this is not a released version, then we will append the |
|---|
| 23 | # date to the version number (e.g. 7.4.20111220). The date is |
|---|
| 24 | # constructed by finding the date of the most recent patch in the |
|---|
| 25 | # git repository. If this is a source distribution (not a git |
|---|
| 26 | # checkout), then we ship a file 'VERSION' containing the full version |
|---|
| 27 | # when the source distribution was created. |
|---|
| 28 | |
|---|
| 29 | if test ! -f mk/config.h.in; then |
|---|
| 30 | echo "mk/config.h.in doesn't exist: perhaps you haven't run 'perl boot'?" |
|---|
| 31 | exit 1 |
|---|
| 32 | fi |
|---|
| 33 | |
|---|
| 34 | AC_SUBST([CONFIGURE_ARGS], [$ac_configure_args]) |
|---|
| 35 | |
|---|
| 36 | dnl ---------------------------------------------------------- |
|---|
| 37 | dnl ** Find unixy sort and find commands, |
|---|
| 38 | dnl ** which are needed by FP_SETUP_PROJECT_VERSION |
|---|
| 39 | |
|---|
| 40 | dnl ** Find find command (for Win32's benefit) |
|---|
| 41 | FP_PROG_FIND |
|---|
| 42 | |
|---|
| 43 | dnl ** Find sort command (for the benefit of Win32 environs) |
|---|
| 44 | FP_PROG_SORT |
|---|
| 45 | |
|---|
| 46 | dnl ---------------------------------------------------------- |
|---|
| 47 | FP_SETUP_PROJECT_VERSION |
|---|
| 48 | |
|---|
| 49 | # Hmmm, we fix the RPM release number to 1 here... Is this convenient? |
|---|
| 50 | AC_SUBST([release], [1]) |
|---|
| 51 | |
|---|
| 52 | # First off, a distrib sanity check.. |
|---|
| 53 | AC_CONFIG_SRCDIR([mk/config.mk.in]) |
|---|
| 54 | |
|---|
| 55 | dnl * We require autoconf version 2.52 |
|---|
| 56 | dnl We need 2.50 due to the use of AC_SYS_LARGEFILE and AC_MSG_NOTICE. |
|---|
| 57 | dnl We need 2.52 due to the use of AS_TR_CPP and AS_TR_SH. |
|---|
| 58 | AC_PREREQ([2.52]) |
|---|
| 59 | |
|---|
| 60 | # ------------------------------------------------------------------------- |
|---|
| 61 | # Prepare to generate the following header files |
|---|
| 62 | # |
|---|
| 63 | # |
|---|
| 64 | AC_CONFIG_HEADER(mk/config.h) |
|---|
| 65 | |
|---|
| 66 | # No, semi-sadly, we don't do `--srcdir'... |
|---|
| 67 | if test x"$srcdir" != 'x.' ; then |
|---|
| 68 | echo "This configuration does not support the \`--srcdir' option.." |
|---|
| 69 | exit 1 |
|---|
| 70 | fi |
|---|
| 71 | |
|---|
| 72 | dnl -------------------------------------------------------------- |
|---|
| 73 | dnl * Project specific configuration options |
|---|
| 74 | dnl -------------------------------------------------------------- |
|---|
| 75 | dnl What follows is a bunch of options that can either be configured |
|---|
| 76 | dnl through command line options to the configure script or by |
|---|
| 77 | dnl supplying defns in the build tree's mk/build.mk. Having the option to |
|---|
| 78 | dnl use either is considered a Feature. |
|---|
| 79 | |
|---|
| 80 | dnl ** What command to use to compile compiler sources ? |
|---|
| 81 | dnl -------------------------------------------------------------- |
|---|
| 82 | |
|---|
| 83 | AC_ARG_WITH([ghc], |
|---|
| 84 | [AC_HELP_STRING([--with-ghc=ARG], |
|---|
| 85 | [Use ARG as the path to GHC [default=autodetect]])], |
|---|
| 86 | [WithGhc="$withval"], |
|---|
| 87 | [if test "$GHC" = ""; then |
|---|
| 88 | AC_PATH_PROG([GHC], [ghc]) |
|---|
| 89 | fi |
|---|
| 90 | WithGhc="$GHC"]) |
|---|
| 91 | |
|---|
| 92 | |
|---|
| 93 | dnl ** Tell the make system which OS we are using |
|---|
| 94 | dnl $OSTYPE is set by the operating system to "msys" or "cygwin" or something |
|---|
| 95 | AC_SUBST(OSTYPE) |
|---|
| 96 | |
|---|
| 97 | dnl ** Booting from .hc files? |
|---|
| 98 | dnl -------------------------------------------------------------- |
|---|
| 99 | AC_ARG_ENABLE(hc-boot, |
|---|
| 100 | [AC_HELP_STRING([--enable-hc-boot], |
|---|
| 101 | [Boot the Glasgow Haskell Compiler from intermediate .hc files. |
|---|
| 102 | (This option is mostly of interest to porters.) [default=no]])], |
|---|
| 103 | [ if test x"$enableval" = x"yes"; then |
|---|
| 104 | BootingFromHc=YES |
|---|
| 105 | else |
|---|
| 106 | BootingFromHc=NO |
|---|
| 107 | fi |
|---|
| 108 | ], |
|---|
| 109 | [BootingFromHc=NO] |
|---|
| 110 | ) |
|---|
| 111 | AC_SUBST(BootingFromHc) |
|---|
| 112 | |
|---|
| 113 | AC_ARG_ENABLE(bootstrap-with-devel-snapshot, |
|---|
| 114 | [AC_HELP_STRING([--enable-bootstrap-with-devel-snapshot], |
|---|
| 115 | [Allow bootstrapping using a development snapshot of GHC. This is not guaranteed to work.])], |
|---|
| 116 | EnableBootstrapWithDevelSnaphost=YES, |
|---|
| 117 | EnableBootstrapWithDevelSnaphost=NO |
|---|
| 118 | ) |
|---|
| 119 | |
|---|
| 120 | if test "$WithGhc" != ""; then |
|---|
| 121 | FPTOOLS_GHC_VERSION([GhcVersion], [GhcMajVersion], [GhcMinVersion], [GhcPatchLevel])dnl |
|---|
| 122 | |
|---|
| 123 | if test "$GhcMajVersion" = "unknown" -o "$GhcMinVersion" = "unknown"; then |
|---|
| 124 | AC_MSG_ERROR([Cannot determine the version of $WithGhc. Is it really GHC?]) |
|---|
| 125 | fi |
|---|
| 126 | |
|---|
| 127 | AC_SUBST(GhcVersion)dnl |
|---|
| 128 | AC_SUBST(GhcMajVersion)dnl |
|---|
| 129 | AC_SUBST(GhcMinVersion)dnl |
|---|
| 130 | AC_SUBST(GhcPatchLevel)dnl |
|---|
| 131 | GhcMinVersion2=`echo "$GhcMinVersion" | sed 's/^\\(.\\)$/0\\1/'` |
|---|
| 132 | GhcCanonVersion="$GhcMajVersion$GhcMinVersion2" |
|---|
| 133 | |
|---|
| 134 | BOOTSTRAPPING_GHC_INFO_FIELD([OS_STAGE0],[target os],['unkown']) |
|---|
| 135 | BOOTSTRAPPING_GHC_INFO_FIELD([CC_STAGE0],[C compiler command],['$(CC)']) |
|---|
| 136 | if test "x$OS_STAGE0" != "xOSDarwin"; then |
|---|
| 137 | BOOTSTRAPPING_GHC_INFO_FIELD([AR_STAGE0],[ar command],['$(AR)']) |
|---|
| 138 | BOOTSTRAPPING_GHC_INFO_FIELD([AR_OPTS_STAGE0],[ar flags],['$(AR_OPTS)']) |
|---|
| 139 | BOOTSTRAPPING_GHC_INFO_FIELD([ArSupportsAtFile_STAGE0],[ar supports at file],['$(ArSupportsAtFile)']) |
|---|
| 140 | else |
|---|
| 141 | AR_STAGE0='$(AR)' |
|---|
| 142 | AR_OPTS_STAGE0='$(AR_OPTS)' |
|---|
| 143 | ArSupportsAtFile_STAGE0='$(ArSupportsAtFile)' |
|---|
| 144 | fi |
|---|
| 145 | fi |
|---|
| 146 | |
|---|
| 147 | dnl ** Must have GHC to build GHC, unless --enable-hc-boot is on |
|---|
| 148 | if test "$BootingFromHc" = "NO"; then |
|---|
| 149 | if test "$WithGhc" = ""; then |
|---|
| 150 | AC_MSG_ERROR([GHC is required unless bootstrapping from .hc files.]) |
|---|
| 151 | fi |
|---|
| 152 | FP_COMPARE_VERSIONS([$GhcVersion],[-lt],[7.0], |
|---|
| 153 | [AC_MSG_ERROR([GHC version 7.0 or later is required to compile GHC.])])dnl |
|---|
| 154 | |
|---|
| 155 | if test `expr $GhcMinVersion % 2` = "1"; then |
|---|
| 156 | if test "$EnableBootstrapWithDevelSnaphost" = "NO"; then |
|---|
| 157 | AC_MSG_ERROR([ |
|---|
| 158 | $WithGhc is a development snapshot of GHC, version $GhcVersion. |
|---|
| 159 | Bootstrapping using this version of GHC is not supported, and may not |
|---|
| 160 | work. Use --enable-bootstrap-with-devel-snapshot to try it anyway, |
|---|
| 161 | or --with-ghc to specify a different GHC to use.]) |
|---|
| 162 | fi |
|---|
| 163 | fi |
|---|
| 164 | |
|---|
| 165 | GHC_PACKAGE_DB_FLAG=package-db |
|---|
| 166 | FP_COMPARE_VERSIONS([$GhcVersion],[-lt],[7.5],GHC_PACKAGE_DB_FLAG=package-conf) |
|---|
| 167 | AC_SUBST(GHC_PACKAGE_DB_FLAG) |
|---|
| 168 | fi; |
|---|
| 169 | |
|---|
| 170 | # GHC is passed to Cabal, so we need a native path |
|---|
| 171 | if test "${WithGhc}" != "" |
|---|
| 172 | then |
|---|
| 173 | ghc_host_os=`"${WithGhc}" +RTS --info | grep 'Host OS' | sed -e 's/.*, "//' -e 's/")//'` |
|---|
| 174 | |
|---|
| 175 | if test "$ghc_host_os" = "mingw32" |
|---|
| 176 | then |
|---|
| 177 | if test "${OSTYPE}" = "msys" |
|---|
| 178 | then |
|---|
| 179 | WithGhc=`echo "${WithGhc}" | sed "s#^/\([a-zA-Z]\)/#\1:/#"` |
|---|
| 180 | else |
|---|
| 181 | # Canonicalise to <drive>:/path/to/ghc |
|---|
| 182 | WithGhc=`cygpath -m "${WithGhc}"` |
|---|
| 183 | fi |
|---|
| 184 | echo "GHC path canonicalised to: ${WithGhc}" |
|---|
| 185 | fi |
|---|
| 186 | fi |
|---|
| 187 | AC_SUBST([WithGhc]) |
|---|
| 188 | |
|---|
| 189 | dnl ** Without optimization some INLINE trickery fails for GHCi |
|---|
| 190 | SRC_CC_OPTS="-O" |
|---|
| 191 | |
|---|
| 192 | FP_ICONV |
|---|
| 193 | FP_GMP |
|---|
| 194 | |
|---|
| 195 | dnl-------------------------------------------------------------------- |
|---|
| 196 | dnl * Choose host(/target/build) platform |
|---|
| 197 | dnl-------------------------------------------------------------------- |
|---|
| 198 | dnl If we aren't explicitly told what values to use with configure flags, |
|---|
| 199 | dnl we ask the bootstrapping compiler what platform it is for |
|---|
| 200 | |
|---|
| 201 | if test "${WithGhc}" != "" |
|---|
| 202 | then |
|---|
| 203 | bootstrap_host=`"${WithGhc}" +RTS --info | grep '^ ,("Host platform"' | sed -e 's/.*, "//' -e 's/")//' | tr -d '\r'` |
|---|
| 204 | bootstrap_target=`"${WithGhc}" +RTS --info | grep '^ ,("Target platform"' | sed -e 's/.*, "//' -e 's/")//' | tr -d '\r'` |
|---|
| 205 | if test "$bootstrap_host" != "$bootstrap_target" |
|---|
| 206 | then |
|---|
| 207 | echo "Bootstrapping GHC is a cross compiler. This probably isn't going to work" |
|---|
| 208 | fi |
|---|
| 209 | fi |
|---|
| 210 | |
|---|
| 211 | # We have to run these unconditionally, but we may discard their |
|---|
| 212 | # results in the following code |
|---|
| 213 | AC_CANONICAL_BUILD |
|---|
| 214 | AC_CANONICAL_HOST |
|---|
| 215 | AC_CANONICAL_TARGET |
|---|
| 216 | |
|---|
| 217 | # Testing ARM ABI |
|---|
| 218 | # required for code generation (LLVM options) |
|---|
| 219 | ARM_ABI=SOFT |
|---|
| 220 | echo HOST: $host |
|---|
| 221 | |
|---|
| 222 | case $host in |
|---|
| 223 | arm*-*-linux-gnueabihf) |
|---|
| 224 | ARM_ABI=HARD |
|---|
| 225 | ;; |
|---|
| 226 | arm*-*-linux-gnueabi) |
|---|
| 227 | ARM_ABI=SOFTFP |
|---|
| 228 | ;; |
|---|
| 229 | esac |
|---|
| 230 | |
|---|
| 231 | FPTOOLS_SET_PLATFORM_VARS |
|---|
| 232 | |
|---|
| 233 | # Verify that the installed (bootstrap) GHC is capable of generating |
|---|
| 234 | # code for the requested build platform. |
|---|
| 235 | if test "$BootingFromHc" = "NO" |
|---|
| 236 | then |
|---|
| 237 | if test "$BuildPlatform" != "$bootstrap_target" |
|---|
| 238 | then |
|---|
| 239 | echo "This GHC (${WithGhc}) does not generate code for the build platform" |
|---|
| 240 | echo " GHC target platform : $bootstrap_target" |
|---|
| 241 | echo " Desired build platform : $BuildPlatform" |
|---|
| 242 | exit 1 |
|---|
| 243 | fi |
|---|
| 244 | fi |
|---|
| 245 | |
|---|
| 246 | # Testing if we shall enable shared libs support on Solaris. |
|---|
| 247 | # Anything older than SunOS 5.11 aka Solaris 11 (Express) is broken. |
|---|
| 248 | |
|---|
| 249 | SOLARIS_BROKEN_SHLD=NO |
|---|
| 250 | |
|---|
| 251 | case $host in |
|---|
| 252 | i386-*-solaris2) |
|---|
| 253 | # here we go with the test |
|---|
| 254 | MINOR=`uname -r|cut -d '.' -f 2-` |
|---|
| 255 | if test "$MINOR" -lt "11"; then |
|---|
| 256 | SOLARIS_BROKEN_SHLD=YES |
|---|
| 257 | fi |
|---|
| 258 | ;; |
|---|
| 259 | esac |
|---|
| 260 | |
|---|
| 261 | AC_SUBST(SOLARIS_BROKEN_SHLD) |
|---|
| 262 | |
|---|
| 263 | AC_ARG_WITH(hc, |
|---|
| 264 | [AC_HELP_STRING([--with-hc=ARG], |
|---|
| 265 | [Use ARG as the path to the compiler for compiling ordinary |
|---|
| 266 | Haskell code (default= value of --with-ghc)])], |
|---|
| 267 | [WithHc="$withval"], |
|---|
| 268 | [WithHc=$WithGhc] |
|---|
| 269 | ) |
|---|
| 270 | AC_SUBST(WithHc) |
|---|
| 271 | |
|---|
| 272 | # This uses GHC, so put it after the "GHC is required" check above: |
|---|
| 273 | FP_INTREE_GHC_PWD |
|---|
| 274 | FP_FIND_ROOT |
|---|
| 275 | |
|---|
| 276 | if test "$HostOS" = "mingw32" |
|---|
| 277 | then |
|---|
| 278 | test -d inplace || mkdir inplace |
|---|
| 279 | |
|---|
| 280 | if test "$HostArch" = "i386" |
|---|
| 281 | then |
|---|
| 282 | # NB. If you update the tarballs to a new version of gcc, don't |
|---|
| 283 | # forget to tweak the paths in driver/gcc/gcc.c. |
|---|
| 284 | if ! test -d inplace/mingw || |
|---|
| 285 | test inplace/mingw -ot ghc-tarballs/mingw/binutils*.tar.lzma || |
|---|
| 286 | test inplace/mingw -ot ghc-tarballs/mingw/gcc-core*.tar.lzma || |
|---|
| 287 | test inplace/mingw -ot ghc-tarballs/mingw/gcc-c++*.tar.lzma || |
|---|
| 288 | test inplace/mingw -ot ghc-tarballs/mingw/libgcc*.tar.gz || |
|---|
| 289 | test inplace/mingw -ot ghc-tarballs/mingw/libgmp*.tar.gz || |
|---|
| 290 | test inplace/mingw -ot ghc-tarballs/mingw/libmpc*.tar.gz || |
|---|
| 291 | test inplace/mingw -ot ghc-tarballs/mingw/libmpfr*.tar.gz || |
|---|
| 292 | test inplace/mingw -ot ghc-tarballs/mingw/libstdc*.tar.lzma || |
|---|
| 293 | test inplace/mingw -ot ghc-tarballs/mingw/mingwrt*-dev.tar.gz || |
|---|
| 294 | test inplace/mingw -ot ghc-tarballs/mingw/mingwrt*-dll.tar.gz || |
|---|
| 295 | test inplace/mingw -ot ghc-tarballs/mingw/w32api*.tar.lzma |
|---|
| 296 | then |
|---|
| 297 | AC_MSG_NOTICE([Making in-tree mingw tree]) |
|---|
| 298 | rm -rf inplace/mingw |
|---|
| 299 | mkdir inplace/mingw |
|---|
| 300 | ( |
|---|
| 301 | cd inplace/mingw && |
|---|
| 302 | tar --lzma -xf ../../ghc-tarballs/mingw/binutils*.tar.lzma && |
|---|
| 303 | tar --lzma -xf ../../ghc-tarballs/mingw/gcc-core*.tar.lzma && |
|---|
| 304 | tar --lzma -xf ../../ghc-tarballs/mingw/gcc-c++*.tar.lzma && |
|---|
| 305 | tar --lzma -xf ../../ghc-tarballs/mingw/libgcc*.tar.lzma && |
|---|
| 306 | tar --lzma -xf ../../ghc-tarballs/mingw/libgmp*.tar.lzma && |
|---|
| 307 | tar --lzma -xf ../../ghc-tarballs/mingw/libmpc*.tar.lzma && |
|---|
| 308 | tar --lzma -xf ../../ghc-tarballs/mingw/libmpfr*.tar.lzma && |
|---|
| 309 | tar --lzma -xf ../../ghc-tarballs/mingw/libstdc*.tar.lzma && |
|---|
| 310 | tar -z -xf ../../ghc-tarballs/mingw/mingwrt*-dev.tar.gz && |
|---|
| 311 | tar -z -xf ../../ghc-tarballs/mingw/mingwrt*-dll.tar.gz && |
|---|
| 312 | tar --lzma -xf ../../ghc-tarballs/mingw/w32api*.tar.lzma && |
|---|
| 313 | mv bin/gcc.exe bin/realgcc.exe |
|---|
| 314 | ) |
|---|
| 315 | PATH=`pwd`/inplace/mingw/bin:$PATH inplace/mingw/bin/realgcc.exe driver/gcc/gcc.c driver/utils/cwrapper.c driver/utils/getLocation.c -Idriver/utils -o inplace/mingw/bin/gcc.exe |
|---|
| 316 | AC_MSG_NOTICE([In-tree mingw tree created]) |
|---|
| 317 | fi |
|---|
| 318 | mingwbin="$hardtop/inplace/mingw/bin/" |
|---|
| 319 | else |
|---|
| 320 | # NB. If you update the tarballs to a new version of gcc, don't |
|---|
| 321 | # forget to tweak the paths in driver/gcc/gcc.c. |
|---|
| 322 | if ! test -d inplace/mingw || |
|---|
| 323 | test inplace/mingw -ot ghc-tarballs/mingw64/mingw-w64-bin_*.zip |
|---|
| 324 | then |
|---|
| 325 | AC_MSG_NOTICE([Making in-tree mingw tree]) |
|---|
| 326 | rm -rf inplace/mingw |
|---|
| 327 | mkdir inplace/mingw |
|---|
| 328 | ( |
|---|
| 329 | cd inplace/mingw && |
|---|
| 330 | unzip ../../ghc-tarballs/mingw64/mingw-w64-bin_*.zip |
|---|
| 331 | ) |
|---|
| 332 | AC_MSG_NOTICE([In-tree mingw tree created]) |
|---|
| 333 | fi |
|---|
| 334 | mingwbin="$hardtop/inplace/mingw/bin/x86_64-w64-mingw32-" |
|---|
| 335 | fi |
|---|
| 336 | |
|---|
| 337 | CC="${mingwbin}gcc.exe" |
|---|
| 338 | LD="${mingwbin}ld.exe" |
|---|
| 339 | NM="${mingwbin}nm.exe" |
|---|
| 340 | fp_prog_ar="${mingwbin}ar.exe" |
|---|
| 341 | |
|---|
| 342 | if ! test -d inplace/perl || |
|---|
| 343 | test inplace/perl -ot ghc-tarballs/perl/ghc-perl*.tar.gz |
|---|
| 344 | then |
|---|
| 345 | AC_MSG_NOTICE([Making in-tree perl tree]) |
|---|
| 346 | rm -rf inplace/perl |
|---|
| 347 | mkdir inplace/perl |
|---|
| 348 | ( |
|---|
| 349 | cd inplace/perl && |
|---|
| 350 | tar -zxf ../../ghc-tarballs/perl/ghc-perl*.tar.gz |
|---|
| 351 | ) |
|---|
| 352 | AC_MSG_NOTICE([In-tree perl tree created]) |
|---|
| 353 | fi |
|---|
| 354 | fi |
|---|
| 355 | |
|---|
| 356 | XCODE_VERSION() |
|---|
| 357 | |
|---|
| 358 | SplitObjsBroken=NO |
|---|
| 359 | if test "$TargetOS_CPP" = "darwin" |
|---|
| 360 | then |
|---|
| 361 | # Split objects is broken (#4013) with XCode < 3.2 |
|---|
| 362 | if test "$XCodeVersion1" -lt 3 |
|---|
| 363 | then |
|---|
| 364 | SplitObjsBroken=YES |
|---|
| 365 | else |
|---|
| 366 | if test "$XCodeVersion1" -eq 3 |
|---|
| 367 | then |
|---|
| 368 | if test "$XCodeVersion2" -lt 2 |
|---|
| 369 | then |
|---|
| 370 | SplitObjsBroken=YES |
|---|
| 371 | fi |
|---|
| 372 | fi |
|---|
| 373 | fi |
|---|
| 374 | fi |
|---|
| 375 | AC_SUBST([SplitObjsBroken]) |
|---|
| 376 | |
|---|
| 377 | dnl ** Building a cross compiler? |
|---|
| 378 | dnl -------------------------------------------------------------- |
|---|
| 379 | BuildingCrossCompiler=NO |
|---|
| 380 | PortingCompiler=NO |
|---|
| 381 | CrossCompiling=NO |
|---|
| 382 | # If 'host' and 'target' differ, then this means we are building a cross-compiler. |
|---|
| 383 | if test "$host" != "$target" ; then |
|---|
| 384 | BuildingCrossCompiler=YES |
|---|
| 385 | CrossCompiling=YES |
|---|
| 386 | cross_compiling=yes # This tells configure that it can accept just 'target', |
|---|
| 387 | # otherwise you get |
|---|
| 388 | # configure: error: cannot run C compiled programs. |
|---|
| 389 | # If you meant to cross compile, use `--host'. |
|---|
| 390 | fi |
|---|
| 391 | if test "$build" != "$host" ; then |
|---|
| 392 | CrossCompiling=YES |
|---|
| 393 | PortingCompiler=YES |
|---|
| 394 | fi |
|---|
| 395 | # Note: cross_compiling is set to 'yes' in both 'port' and 'toolchain' cases |
|---|
| 396 | if ! test "$host" = "$target" -o "$host" = "$build" ; then |
|---|
| 397 | AC_MSG_ERROR([ |
|---|
| 398 | You've selected: |
|---|
| 399 | |
|---|
| 400 | build: $build (the architecture we're building on) |
|---|
| 401 | host: $host (the architecture the compiler we're building will execute on) |
|---|
| 402 | target: $target (the architecture the compiler we're building will produce code for) |
|---|
| 403 | |
|---|
| 404 | host must equal build or target. The two allowed cases are: |
|---|
| 405 | |
|---|
| 406 | --host=<arch> --target=<arch> to _port_ GHC to run on a foreign architecture |
|---|
| 407 | and produce code for that architecture |
|---|
| 408 | --target=<arch> to build a cross compiler _toolchain_ that runs |
|---|
| 409 | locally but produces code for a foreign |
|---|
| 410 | architecture |
|---|
| 411 | ]) |
|---|
| 412 | fi |
|---|
| 413 | if test "$CrossCompiling" = "YES" |
|---|
| 414 | then |
|---|
| 415 | CrossCompilePrefix="${target}-" |
|---|
| 416 | else |
|---|
| 417 | CrossCompilePrefix="" |
|---|
| 418 | fi |
|---|
| 419 | TargetPlatformFull="${target}" |
|---|
| 420 | AC_SUBST(BuildingCrossCompiler) # 'toolchain' case |
|---|
| 421 | AC_SUBST(PortingCompiler) # 'port' case |
|---|
| 422 | AC_SUBST(CrossCompiling) # BuildingCrossCompiler OR PortingCompiler |
|---|
| 423 | AC_SUBST(CrossCompilePrefix) |
|---|
| 424 | AC_SUBST(TargetPlatformFull) |
|---|
| 425 | AC_ARG_WITH([alien], |
|---|
| 426 | [AC_HELP_STRING([--with-alien=ARG], |
|---|
| 427 | [Supply script for running target binaries locally when cross-compiling])], |
|---|
| 428 | [AlienScript="$withval"], |
|---|
| 429 | [AlienScript=""]) |
|---|
| 430 | AC_SUBST(AlienScript) |
|---|
| 431 | |
|---|
| 432 | dnl ** Which gcc to use? |
|---|
| 433 | dnl -------------------------------------------------------------- |
|---|
| 434 | FIND_GCC([WhatGccIsCalled], [gcc], [gcc]) |
|---|
| 435 | CC="$WhatGccIsCalled" |
|---|
| 436 | export CC |
|---|
| 437 | |
|---|
| 438 | dnl ** Which ld to use? |
|---|
| 439 | dnl -------------------------------------------------------------- |
|---|
| 440 | FP_ARG_WITH_PATH_GNU_PROG([LD], [ld], [ld]) |
|---|
| 441 | LdCmd="$LD" |
|---|
| 442 | AC_SUBST([LdCmd]) |
|---|
| 443 | |
|---|
| 444 | dnl ** Which nm to use? |
|---|
| 445 | dnl -------------------------------------------------------------- |
|---|
| 446 | FP_ARG_WITH_PATH_GNU_PROG([NM], [nm], [nm]) |
|---|
| 447 | NmCmd="$NM" |
|---|
| 448 | AC_SUBST([NmCmd]) |
|---|
| 449 | |
|---|
| 450 | dnl ** Which LLVM llc to use? |
|---|
| 451 | dnl -------------------------------------------------------------- |
|---|
| 452 | FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL([LLC], [llc]) |
|---|
| 453 | LlcCmd="$LLC" |
|---|
| 454 | AC_SUBST([LlcCmd]) |
|---|
| 455 | |
|---|
| 456 | dnl ** Which LLVM opt to use? |
|---|
| 457 | dnl -------------------------------------------------------------- |
|---|
| 458 | FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL([OPT], [opt]) |
|---|
| 459 | OptCmd="$OPT" |
|---|
| 460 | AC_SUBST([OptCmd]) |
|---|
| 461 | |
|---|
| 462 | dnl ** Mac OS X: explicit deployment target |
|---|
| 463 | dnl -------------------------------------------------------------- |
|---|
| 464 | AC_ARG_WITH([macosx-deployment-target], |
|---|
| 465 | [AC_HELP_STRING([--with-macosx-deployment-target=VERSION], |
|---|
| 466 | [Build for Mac OS VERSION and higher (default= version of build host)])], |
|---|
| 467 | [FP_MACOSX_DEPLOYMENT_TARGET="$withval" |
|---|
| 468 | if test "x$TargetOS_CPP-$TargetVendor_CPP" != "xdarwin-apple"; then |
|---|
| 469 | # ignore everywhere, but on Mac OS |
|---|
| 470 | AC_MSG_WARN([--macosx-deployment-target is only available on Mac OS X]) |
|---|
| 471 | FP_MACOSX_DEPLOYMENT_TARGET=none |
|---|
| 472 | fi], |
|---|
| 473 | [FP_MACOSX_DEPLOYMENT_TARGET=none] |
|---|
| 474 | ) |
|---|
| 475 | FP_CHECK_MACOSX_DEPLOYMENT_TARGET |
|---|
| 476 | AC_SUBST(MACOSX_DEPLOYMENT_VERSION) |
|---|
| 477 | AC_SUBST(MACOSX_DEPLOYMENT_SDK) |
|---|
| 478 | |
|---|
| 479 | dnl -------------------------------------------------------------- |
|---|
| 480 | dnl End of configure script option section |
|---|
| 481 | dnl -------------------------------------------------------------- |
|---|
| 482 | |
|---|
| 483 | |
|---|
| 484 | dnl -------------------------------------------------------------- |
|---|
| 485 | dnl * General configuration checks |
|---|
| 486 | dnl -------------------------------------------------------------- |
|---|
| 487 | |
|---|
| 488 | dnl ** Can the unix package be built? |
|---|
| 489 | dnl -------------------------------------------------------------- |
|---|
| 490 | |
|---|
| 491 | if test "$TargetOS" = "mingw32" |
|---|
| 492 | then |
|---|
| 493 | GhcLibsWithUnix=NO |
|---|
| 494 | else |
|---|
| 495 | GhcLibsWithUnix=YES |
|---|
| 496 | fi |
|---|
| 497 | AC_SUBST([GhcLibsWithUnix]) |
|---|
| 498 | |
|---|
| 499 | dnl ** does #! work? |
|---|
| 500 | AC_SYS_INTERPRETER() |
|---|
| 501 | |
|---|
| 502 | dnl ** look for `perl' |
|---|
| 503 | case $HostOS_CPP in |
|---|
| 504 | cygwin32|mingw32) |
|---|
| 505 | PerlCmd=$hardtop/inplace/perl/perl |
|---|
| 506 | ;; |
|---|
| 507 | *) |
|---|
| 508 | AC_PATH_PROG(PerlCmd,perl) |
|---|
| 509 | if test -z "$PerlCmd" |
|---|
| 510 | then |
|---|
| 511 | echo "You must install perl before you can continue" |
|---|
| 512 | echo "Perhaps it is already installed, but not in your PATH?" |
|---|
| 513 | exit 1 |
|---|
| 514 | else |
|---|
| 515 | FPTOOLS_CHECK_PERL_VERSION |
|---|
| 516 | fi |
|---|
| 517 | ;; |
|---|
| 518 | esac |
|---|
| 519 | |
|---|
| 520 | dnl ** does #! path/to/perl work? (sometimes it's too long...) |
|---|
| 521 | FPTOOLS_SHEBANG_PERL |
|---|
| 522 | |
|---|
| 523 | dnl ** check for Python |
|---|
| 524 | AC_PATH_PROG(PythonCmd,python) |
|---|
| 525 | |
|---|
| 526 | dnl ** look for GCC and find out which version |
|---|
| 527 | dnl Figure out which C compiler to use. Gcc is preferred. |
|---|
| 528 | dnl If gcc, make sure it's at least 3.0 |
|---|
| 529 | dnl |
|---|
| 530 | FP_GCC_VERSION |
|---|
| 531 | |
|---|
| 532 | dnl ** look to see if we have a C compiler using an llvm back end. |
|---|
| 533 | dnl |
|---|
| 534 | FP_CC_LLVM_BACKEND |
|---|
| 535 | |
|---|
| 536 | FP_PROG_LD_HashSize31 |
|---|
| 537 | FP_PROG_LD_ReduceMemoryOverheads |
|---|
| 538 | |
|---|
| 539 | FPTOOLS_SET_C_LD_FLAGS([target],[CFLAGS],[LDFLAGS],[IGNORE_LINKER_LD_FLAGS],[CPPFLAGS]) |
|---|
| 540 | FPTOOLS_SET_C_LD_FLAGS([build],[CONF_CC_OPTS_STAGE0],[CONF_GCC_LINKER_OPTS_STAGE0],[CONF_LD_LINKER_OPTS_STAGE0],[CONF_CPP_OPTS_STAGE0]) |
|---|
| 541 | FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE1],[CONF_GCC_LINKER_OPTS_STAGE1],[CONF_LD_LINKER_OPTS_STAGE1],[CONF_CPP_OPTS_STAGE1]) |
|---|
| 542 | # Stage 3 won't be supported by cross-compilation |
|---|
| 543 | FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE2],[CONF_GCC_LINKER_OPTS_STAGE2],[CONF_LD_LINKER_OPTS_STAGE2],[CONF_CPP_OPTS_STAGE2]) |
|---|
| 544 | |
|---|
| 545 | FP_GCC_EXTRA_FLAGS |
|---|
| 546 | |
|---|
| 547 | dnl ** figure out how to invoke cpp directly (gcc -E is no good) |
|---|
| 548 | AC_PROG_CPP |
|---|
| 549 | |
|---|
| 550 | AC_SUBST(CONF_CC_OPTS_STAGE0) |
|---|
| 551 | AC_SUBST(CONF_CC_OPTS_STAGE1) |
|---|
| 552 | AC_SUBST(CONF_CC_OPTS_STAGE2) |
|---|
| 553 | AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE0) |
|---|
| 554 | AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE1) |
|---|
| 555 | AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE2) |
|---|
| 556 | AC_SUBST(CONF_LD_LINKER_OPTS_STAGE0) |
|---|
| 557 | AC_SUBST(CONF_LD_LINKER_OPTS_STAGE1) |
|---|
| 558 | AC_SUBST(CONF_LD_LINKER_OPTS_STAGE2) |
|---|
| 559 | AC_SUBST(CONF_CPP_OPTS_STAGE0) |
|---|
| 560 | AC_SUBST(CONF_CPP_OPTS_STAGE1) |
|---|
| 561 | AC_SUBST(CONF_CPP_OPTS_STAGE2) |
|---|
| 562 | |
|---|
| 563 | dnl ** Set up the variables for the platform in the settings file. |
|---|
| 564 | dnl May need to use gcc to find platform details. |
|---|
| 565 | dnl -------------------------------------------------------------- |
|---|
| 566 | FPTOOLS_SET_HASKELL_PLATFORM_VARS |
|---|
| 567 | |
|---|
| 568 | dnl ** figure out how to do context diffs |
|---|
| 569 | FP_PROG_CONTEXT_DIFF |
|---|
| 570 | |
|---|
| 571 | dnl Let's make sure install-sh is executable here. If we got it from |
|---|
| 572 | dnl a darcs repo, it might not be (see bug #978). |
|---|
| 573 | chmod +x install-sh |
|---|
| 574 | dnl ** figure out how to do a BSD-ish install |
|---|
| 575 | AC_PROG_INSTALL |
|---|
| 576 | |
|---|
| 577 | dnl If you can run configure, you certainly have /bin/sh |
|---|
| 578 | AC_DEFINE([HAVE_BIN_SH], [1], [Define to 1 if you have /bin/sh.]) |
|---|
| 579 | |
|---|
| 580 | dnl ** how to invoke `ar' and `ranlib' |
|---|
| 581 | FP_PROG_AR_SUPPORTS_ATFILE |
|---|
| 582 | FP_PROG_AR_NEEDS_RANLIB |
|---|
| 583 | |
|---|
| 584 | dnl ** Check to see whether ln -s works |
|---|
| 585 | AC_PROG_LN_S |
|---|
| 586 | |
|---|
| 587 | FP_SETTINGS |
|---|
| 588 | |
|---|
| 589 | dnl ** Find the path to sed |
|---|
| 590 | AC_PATH_PROGS(SedCmd,gsed sed,sed) |
|---|
| 591 | |
|---|
| 592 | |
|---|
| 593 | dnl ** check for time command |
|---|
| 594 | AC_PATH_PROG(TimeCmd,time) |
|---|
| 595 | |
|---|
| 596 | dnl ** check for tar |
|---|
| 597 | dnl if GNU tar is named gtar, look for it first. |
|---|
| 598 | AC_PATH_PROGS(TarCmd,gnutar gtar tar,tar) |
|---|
| 599 | |
|---|
| 600 | dnl ** check for patch |
|---|
| 601 | dnl if GNU patch is named gpatch, look for it first |
|---|
| 602 | AC_PATH_PROGS(PatchCmd,gpatch patch, patch) |
|---|
| 603 | |
|---|
| 604 | dnl ** check for dtrace (currently only implemented for Mac OS X) |
|---|
| 605 | HaveDtrace=NO |
|---|
| 606 | AC_PATH_PROG(DtraceCmd,dtrace) |
|---|
| 607 | if test -n "$DtraceCmd"; then |
|---|
| 608 | if test "x$TargetOS_CPP-$TargetVendor_CPP" = "xdarwin-apple" -o "x$TargetOS_CPP-$TargetVendor_CPP" = "xsolaris2-unknown"; then |
|---|
| 609 | HaveDtrace=YES |
|---|
| 610 | fi |
|---|
| 611 | fi |
|---|
| 612 | AC_SUBST(HaveDtrace) |
|---|
| 613 | |
|---|
| 614 | AC_PATH_PROG(HSCOLOUR,HsColour) |
|---|
| 615 | # HsColour is passed to Cabal, so we need a native path |
|---|
| 616 | if test "$HostOS" = "mingw32" && \ |
|---|
| 617 | test "${OSTYPE}" != "msys" && \ |
|---|
| 618 | test "${HSCOLOUR}" != "" |
|---|
| 619 | then |
|---|
| 620 | # Canonicalise to <drive>:/path/to/gcc |
|---|
| 621 | HSCOLOUR=`cygpath -m ${HSCOLOUR}` |
|---|
| 622 | fi |
|---|
| 623 | |
|---|
| 624 | dnl ** check for DocBook toolchain |
|---|
| 625 | FP_CHECK_DOCBOOK_DTD |
|---|
| 626 | FP_DOCBOOK_XSL |
|---|
| 627 | FP_PROG_DBLATEX |
|---|
| 628 | |
|---|
| 629 | dnl ** check for ghc-pkg command |
|---|
| 630 | FP_PROG_GHC_PKG |
|---|
| 631 | |
|---|
| 632 | dnl ** check for installed happy binary + version |
|---|
| 633 | dnl (don't do it if we're booting from .hc files though.) |
|---|
| 634 | if test "$BootingFromHc" = "NO"; then |
|---|
| 635 | FPTOOLS_HAPPY |
|---|
| 636 | fi; |
|---|
| 637 | |
|---|
| 638 | dnl ** check for installed alex binary + version |
|---|
| 639 | dnl (don't do it if we're booting from .hc files though.) |
|---|
| 640 | if test "$BootingFromHc" = "NO"; then |
|---|
| 641 | FPTOOLS_ALEX |
|---|
| 642 | fi; |
|---|
| 643 | |
|---|
| 644 | dnl -------------------------------------------------- |
|---|
| 645 | dnl ### program checking section ends here ### |
|---|
| 646 | dnl -------------------------------------------------- |
|---|
| 647 | |
|---|
| 648 | dnl -------------------------------------------------- |
|---|
| 649 | dnl * Platform header file and syscall feature tests |
|---|
| 650 | dnl ### checking the state of the local header files and syscalls ### |
|---|
| 651 | |
|---|
| 652 | dnl ** check for full ANSI header (.h) files |
|---|
| 653 | AC_HEADER_STDC |
|---|
| 654 | |
|---|
| 655 | dnl ** Enable large file support. NB. do this before testing the type of |
|---|
| 656 | dnl off_t, because it will affect the result of that test. |
|---|
| 657 | AC_SYS_LARGEFILE |
|---|
| 658 | |
|---|
| 659 | dnl ** check for specific header (.h) files that we are interested in |
|---|
| 660 | AC_CHECK_HEADERS([bfd.h ctype.h dirent.h dlfcn.h errno.h fcntl.h grp.h limits.h locale.h nlist.h pthread.h pwd.h signal.h sys/cpuset.h sys/mman.h sys/resource.h sys/select.h sys/time.h sys/timeb.h sys/timers.h sys/times.h sys/utsname.h sys/wait.h termios.h time.h utime.h windows.h winsock.h sched.h]) |
|---|
| 661 | |
|---|
| 662 | dnl ** check if it is safe to include both <time.h> and <sys/time.h> |
|---|
| 663 | AC_HEADER_TIME |
|---|
| 664 | |
|---|
| 665 | dnl ** do we have long longs? |
|---|
| 666 | AC_CHECK_TYPES([long long]) |
|---|
| 667 | |
|---|
| 668 | dnl ** what are the sizes of various types |
|---|
| 669 | AC_CHECK_SIZEOF(char, 1) |
|---|
| 670 | AC_CHECK_SIZEOF(double, 8) |
|---|
| 671 | AC_CHECK_SIZEOF(float, 4) |
|---|
| 672 | AC_CHECK_SIZEOF(int, 4) |
|---|
| 673 | AC_CHECK_SIZEOF(long, 4) |
|---|
| 674 | if test "$ac_cv_type_long_long" = yes; then |
|---|
| 675 | AC_CHECK_SIZEOF(long long, 8) |
|---|
| 676 | fi |
|---|
| 677 | AC_CHECK_SIZEOF(short, 2) |
|---|
| 678 | AC_CHECK_SIZEOF(unsigned char, 1) |
|---|
| 679 | AC_CHECK_SIZEOF(unsigned int, 4) |
|---|
| 680 | AC_CHECK_SIZEOF(unsigned long, 4) |
|---|
| 681 | if test "$ac_cv_type_long_long" = yes; then |
|---|
| 682 | AC_CHECK_SIZEOF(unsigned long long, 8) |
|---|
| 683 | fi |
|---|
| 684 | AC_CHECK_SIZEOF(unsigned short, 2) |
|---|
| 685 | AC_CHECK_SIZEOF(void *, 4) |
|---|
| 686 | |
|---|
| 687 | dnl for use in settings.in |
|---|
| 688 | WordSize=$ac_cv_sizeof_void_p |
|---|
| 689 | AC_SUBST(WordSize) |
|---|
| 690 | |
|---|
| 691 | dnl ** what are alignment constraints on various types |
|---|
| 692 | FP_CHECK_ALIGNMENT(char) |
|---|
| 693 | FP_CHECK_ALIGNMENT(double) |
|---|
| 694 | FP_CHECK_ALIGNMENT(float) |
|---|
| 695 | FP_CHECK_ALIGNMENT(int) |
|---|
| 696 | FP_CHECK_ALIGNMENT(long) |
|---|
| 697 | if test "$ac_cv_type_long_long" = yes; then |
|---|
| 698 | FP_CHECK_ALIGNMENT(long long) |
|---|
| 699 | fi |
|---|
| 700 | FP_CHECK_ALIGNMENT(short) |
|---|
| 701 | FP_CHECK_ALIGNMENT(unsigned char) |
|---|
| 702 | FP_CHECK_ALIGNMENT(unsigned int) |
|---|
| 703 | FP_CHECK_ALIGNMENT(unsigned long) |
|---|
| 704 | if test "$ac_cv_type_long_long" = yes; then |
|---|
| 705 | FP_CHECK_ALIGNMENT(unsigned long long) |
|---|
| 706 | fi |
|---|
| 707 | FP_CHECK_ALIGNMENT(unsigned short) |
|---|
| 708 | FP_CHECK_ALIGNMENT(void *) |
|---|
| 709 | |
|---|
| 710 | FP_CHECK_FUNC([WinExec], |
|---|
| 711 | [@%:@include <windows.h>], [WinExec("",0)]) |
|---|
| 712 | |
|---|
| 713 | FP_CHECK_FUNC([GetModuleFileName], |
|---|
| 714 | [@%:@include <windows.h>], [GetModuleFileName((HMODULE)0,(LPTSTR)0,0)]) |
|---|
| 715 | |
|---|
| 716 | dnl ** check return type of signal handlers |
|---|
| 717 | dnl Foo: assumes we can use prototypes. |
|---|
| 718 | dnl On BCC, signal handlers have type "int(void)", elsewhere its "void(int)". |
|---|
| 719 | dnl AC_CACHE_CHECK([type of signal handlers], ac_cv_type_signal_handler, |
|---|
| 720 | dnl [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> |
|---|
| 721 | dnl #include <signal.h> |
|---|
| 722 | dnl #ifdef signal |
|---|
| 723 | dnl #undef signal |
|---|
| 724 | dnl #endif |
|---|
| 725 | dnl void (*signal (int, void (*)(int)))(int); |
|---|
| 726 | dnl ]], |
|---|
| 727 | dnl [[int i;]])], |
|---|
| 728 | dnl [ac_cv_type_signal_handler=void_int], |
|---|
| 729 | dnl [ac_cv_type_signal_handler=int_void])]) |
|---|
| 730 | dnl if test "$ac_cv_type_signal_handler" = void_int; then |
|---|
| 731 | dnl AC_DEFINE(VOID_INT_SIGNALS) |
|---|
| 732 | dnl fi |
|---|
| 733 | |
|---|
| 734 | dnl On BCC, signal handlers have type "int(void)", elsewhere its "void(int)". |
|---|
| 735 | AC_TYPE_SIGNAL |
|---|
| 736 | if test "$ac_cv_type_signal" = void; then |
|---|
| 737 | AC_DEFINE([VOID_INT_SIGNALS], [1], [Define to 1 if signal handlers have type void (*)(int). Otherwise, they're assumed to have type int (*)(void).]) |
|---|
| 738 | fi |
|---|
| 739 | |
|---|
| 740 | dnl ** check for more functions |
|---|
| 741 | dnl ** The following have been verified to be used in ghc/, but might be used somewhere else, too. |
|---|
| 742 | AC_CHECK_FUNCS([getclock getrusage gettimeofday setitimer siginterrupt sysconf times ctime_r sched_setaffinity setlocale]) |
|---|
| 743 | |
|---|
| 744 | if test "$cross_compiling" = "no" ; then |
|---|
| 745 | AC_TRY_RUN([ |
|---|
| 746 | #include <sys/types.h> |
|---|
| 747 | #include <sys/time.h> |
|---|
| 748 | int main(void) { |
|---|
| 749 | struct itimerval tval; |
|---|
| 750 | tval.it_value.tv_sec = 1; |
|---|
| 751 | tval.it_value.tv_usec = 0; |
|---|
| 752 | tval.it_interval = tval.it_value; |
|---|
| 753 | return setitimer(ITIMER_VIRTUAL, &tval, (void*)0) != 0; |
|---|
| 754 | } |
|---|
| 755 | ],[AC_DEFINE([HAVE_SETITIMER_VIRTUAL], [1], [Define to 1 if setitimer accepts ITIMER_VIRTUAL, 0 else.])]) |
|---|
| 756 | fi |
|---|
| 757 | |
|---|
| 758 | dnl ** On OS X 10.4 (at least), time.h doesn't declare ctime_r if |
|---|
| 759 | dnl ** _POSIX_C_SOURCE is defined |
|---|
| 760 | AC_CHECK_DECLS([ctime_r], , , |
|---|
| 761 | [#define _POSIX_SOURCE 1 |
|---|
| 762 | #define _POSIX_C_SOURCE 199506L |
|---|
| 763 | #include <time.h>]) |
|---|
| 764 | |
|---|
| 765 | dnl ** check for mingwex library |
|---|
| 766 | AC_CHECK_LIB(mingwex, closedir, HaveLibMingwEx=YES, HaveLibMingwEx=NO) |
|---|
| 767 | AC_SUBST(HaveLibMingwEx) |
|---|
| 768 | |
|---|
| 769 | if test $HaveLibMingwEx = YES ; then |
|---|
| 770 | AC_DEFINE([HAVE_MINGWEX], [1], [Define to 1 if you have the mingwex library.]) |
|---|
| 771 | fi |
|---|
| 772 | |
|---|
| 773 | dnl ** check for math library |
|---|
| 774 | dnl Keep that check as early as possible. |
|---|
| 775 | dnl as we need to know whether we need libm |
|---|
| 776 | dnl for math functions or not |
|---|
| 777 | dnl (see http://hackage.haskell.org/trac/ghc/ticket/3730) |
|---|
| 778 | AC_CHECK_LIB(m, atan, HaveLibM=YES, HaveLibM=NO) |
|---|
| 779 | if test $HaveLibM = YES |
|---|
| 780 | then |
|---|
| 781 | AC_DEFINE([HAVE_LIBM], [1], [Define to 1 if you need to link with libm]) |
|---|
| 782 | fi |
|---|
| 783 | |
|---|
| 784 | dnl ** check whether this machine has BFD and libiberty installed (used for debugging) |
|---|
| 785 | dnl the order of these tests matters: bfd needs libiberty |
|---|
| 786 | AC_CHECK_LIB(iberty, xmalloc) |
|---|
| 787 | AC_CHECK_LIB(bfd, bfd_uncompress_section_contents) |
|---|
| 788 | |
|---|
| 789 | dnl ################################################################ |
|---|
| 790 | dnl Check for libraries |
|---|
| 791 | dnl ################################################################ |
|---|
| 792 | |
|---|
| 793 | dnl ** check whether we need -ldl to get dlopen() |
|---|
| 794 | |
|---|
| 795 | AC_CHECK_LIB(dl, dlopen, |
|---|
| 796 | [HaveLibDL=YES |
|---|
| 797 | AC_DEFINE([HAVE_LIBDL], [1], [Define to 1 if you need -ldl to get dlopen().]) |
|---|
| 798 | LIBS="$LIBS -ldl"], |
|---|
| 799 | [HaveLibDL=NO]) |
|---|
| 800 | AC_SUBST(HaveLibDL) |
|---|
| 801 | |
|---|
| 802 | dnl -------------------------------------------------- |
|---|
| 803 | dnl * Miscellaneous feature tests |
|---|
| 804 | dnl -------------------------------------------------- |
|---|
| 805 | |
|---|
| 806 | dnl ** can we get alloca? |
|---|
| 807 | AC_FUNC_ALLOCA |
|---|
| 808 | |
|---|
| 809 | dnl ** working vfork? |
|---|
| 810 | AC_FUNC_FORK |
|---|
| 811 | |
|---|
| 812 | dnl ** determine whether or not const works |
|---|
| 813 | AC_C_CONST |
|---|
| 814 | |
|---|
| 815 | dnl ** are we big endian? |
|---|
| 816 | AC_C_BIGENDIAN |
|---|
| 817 | FPTOOLS_FLOAT_WORD_ORDER_BIGENDIAN |
|---|
| 818 | |
|---|
| 819 | dnl ** check for leading underscores in symbol names |
|---|
| 820 | FP_LEADING_UNDERSCORE |
|---|
| 821 | |
|---|
| 822 | dnl ** check for ld, whether it has an -x option, and if it is GNU ld |
|---|
| 823 | FP_PROG_LD_X |
|---|
| 824 | FP_PROG_LD_IS_GNU |
|---|
| 825 | FP_PROG_LD_BUILD_ID |
|---|
| 826 | FP_PROG_LD_NO_COMPACT_UNWIND |
|---|
| 827 | |
|---|
| 828 | FP_VISIBILITY_HIDDEN |
|---|
| 829 | |
|---|
| 830 | dnl ** check for librt |
|---|
| 831 | AC_CHECK_LIB(rt, clock_gettime) |
|---|
| 832 | AC_CHECK_FUNCS(clock_gettime timer_create timer_settime) |
|---|
| 833 | FP_CHECK_TIMER_CREATE |
|---|
| 834 | |
|---|
| 835 | dnl ** check for Apple's "interesting" long double compatibility scheme |
|---|
| 836 | AC_MSG_CHECKING(for printf\$LDBLStub) |
|---|
| 837 | AC_TRY_LINK_FUNC(printf\$LDBLStub, |
|---|
| 838 | [ |
|---|
| 839 | AC_MSG_RESULT(yes) |
|---|
| 840 | AC_DEFINE([HAVE_PRINTF_LDBLSTUB],[1], |
|---|
| 841 | [Define to 1 if we have printf$LDBLStub (Apple Mac OS >= 10.4, PPC).]) |
|---|
| 842 | ], |
|---|
| 843 | [ |
|---|
| 844 | AC_MSG_RESULT(no) |
|---|
| 845 | AC_DEFINE([HAVE_PRINTF_LDBLSTUB],[0], |
|---|
| 846 | [Define to 1 if we have printf$LDBLStub (Apple Mac OS >= 10.4, PPC).]) |
|---|
| 847 | ]) |
|---|
| 848 | |
|---|
| 849 | dnl ** check for eventfd which is needed by the I/O manager |
|---|
| 850 | AC_CHECK_HEADERS([sys/eventfd.h]) |
|---|
| 851 | AC_CHECK_FUNCS([eventfd]) |
|---|
| 852 | |
|---|
| 853 | # test for GTK+ |
|---|
| 854 | AC_PATH_PROGS([GTK_CONFIG], [pkg-config]) |
|---|
| 855 | if test -n "$GTK_CONFIG"; then |
|---|
| 856 | if $GTK_CONFIG gtk+-2.0 --atleast-version=2.0; then |
|---|
| 857 | GTK_CONFIG="$GTK_CONFIG gtk+-2.0" |
|---|
| 858 | else |
|---|
| 859 | AC_MSG_WARN([GTK+ not usable, need at least version 2.0]) |
|---|
| 860 | GTK_CONFIG= |
|---|
| 861 | fi |
|---|
| 862 | fi |
|---|
| 863 | AC_SUBST([GTK_CONFIG]) |
|---|
| 864 | |
|---|
| 865 | # checking for PAPI |
|---|
| 866 | AC_CHECK_LIB(papi, PAPI_library_init, HavePapiLib=YES, HavePapiLib=NO) |
|---|
| 867 | AC_CHECK_HEADER([papi.h], [HavePapiHeader=YES], [HavePapiHeader=NO]) |
|---|
| 868 | AC_SUBST(HavePapiLib) |
|---|
| 869 | AC_SUBST(HavePapiHeader) |
|---|
| 870 | |
|---|
| 871 | AC_CHECK_FUNCS(__mingw_vfprintf) |
|---|
| 872 | |
|---|
| 873 | if test "$HavePapiLib" = "YES" -a "$HavePapiHeader" = "YES"; then |
|---|
| 874 | HavePapi=YES |
|---|
| 875 | else |
|---|
| 876 | HavePapi=NO |
|---|
| 877 | fi |
|---|
| 878 | AC_SUBST(HavePapi) |
|---|
| 879 | |
|---|
| 880 | if test "$HAVE_DOCBOOK_XSL" = "NO" || |
|---|
| 881 | test "$XsltprocCmd" = "" |
|---|
| 882 | then |
|---|
| 883 | BUILD_DOCBOOK_HTML=NO |
|---|
| 884 | else |
|---|
| 885 | BUILD_DOCBOOK_HTML=YES |
|---|
| 886 | fi |
|---|
| 887 | AC_SUBST(BUILD_DOCBOOK_HTML) |
|---|
| 888 | |
|---|
| 889 | if test "$DblatexCmd" = "" |
|---|
| 890 | then |
|---|
| 891 | BUILD_DOCBOOK_PS=NO |
|---|
| 892 | BUILD_DOCBOOK_PDF=NO |
|---|
| 893 | else |
|---|
| 894 | BUILD_DOCBOOK_PS=YES |
|---|
| 895 | BUILD_DOCBOOK_PDF=YES |
|---|
| 896 | fi |
|---|
| 897 | AC_SUBST(BUILD_DOCBOOK_PS) |
|---|
| 898 | AC_SUBST(BUILD_DOCBOOK_PDF) |
|---|
| 899 | |
|---|
| 900 | LIBRARY_VERSION(base) |
|---|
| 901 | LIBRARY_VERSION(Cabal, Cabal/Cabal) |
|---|
| 902 | LIBRARY_VERSION(ghc-prim) |
|---|
| 903 | LIBRARY_ghc_VERSION="$ProjectVersion" |
|---|
| 904 | AC_SUBST(LIBRARY_ghc_VERSION) |
|---|
| 905 | |
|---|
| 906 | if grep ' ' compiler/ghc.cabal.in 2>&1 >/dev/null; then |
|---|
| 907 | AC_MSG_ERROR([compiler/ghc.cabal.in contains tab characters; please remove them]) |
|---|
| 908 | fi |
|---|
| 909 | |
|---|
| 910 | AC_CONFIG_FILES([mk/config.mk mk/install.mk mk/project.mk compiler/ghc.cabal ghc/ghc-bin.cabal utils/runghc/runghc.cabal ghc.spec settings docs/users_guide/ug-book.xml docs/users_guide/ug-ent.xml docs/index.html libraries/prologue.txt distrib/ghc.iss distrib/configure.ac]) |
|---|
| 911 | AC_CONFIG_COMMANDS([mk/stamp-h],[echo timestamp > mk/stamp-h]) |
|---|
| 912 | AC_OUTPUT |
|---|
| 913 | |
|---|
| 914 | # We got caught by |
|---|
| 915 | # http://savannah.gnu.org/bugs/index.php?1516 |
|---|
| 916 | # $(eval ...) inside conditionals causes errors |
|---|
| 917 | # with make 3.80, so warn the user if it looks like they're about to |
|---|
| 918 | # try to use it. |
|---|
| 919 | # We would use "grep -q" here, but Solaris's grep doesn't support it. |
|---|
| 920 | checkMake380() { |
|---|
| 921 | if $1 --version 2>&1 | head -1 | grep 'GNU Make 3\.80' > /dev/null |
|---|
| 922 | then |
|---|
| 923 | echo |
|---|
| 924 | echo "WARNING: It looks like \"$1\" is GNU make 3.80." |
|---|
| 925 | echo "This version cannot be used to build GHC." |
|---|
| 926 | echo "Please use GNU make >= 3.81." |
|---|
| 927 | fi |
|---|
| 928 | } |
|---|
| 929 | |
|---|
| 930 | checkMake380 make |
|---|
| 931 | checkMake380 gmake |
|---|
| 932 | |
|---|
| 933 | echo [" |
|---|
| 934 | ---------------------------------------------------------------------- |
|---|
| 935 | Configure completed successfully. |
|---|
| 936 | |
|---|
| 937 | Building GHC version : $ProjectVersion |
|---|
| 938 | |
|---|
| 939 | Build platform : $BuildPlatform |
|---|
| 940 | Host platform : $HostPlatform |
|---|
| 941 | Target platform : $TargetPlatform |
|---|
| 942 | "] |
|---|
| 943 | |
|---|
| 944 | if test "$BootingFromHc" = "YES"; then |
|---|
| 945 | echo ["\ |
|---|
| 946 | Bootstrapping from HC files. |
|---|
| 947 | "] |
|---|
| 948 | else |
|---|
| 949 | echo ["\ |
|---|
| 950 | Bootstrapping using : $WithGhc |
|---|
| 951 | which is version : $GhcVersion |
|---|
| 952 | "] |
|---|
| 953 | fi |
|---|
| 954 | |
|---|
| 955 | echo ["\ |
|---|
| 956 | Using GCC : $WhatGccIsCalled |
|---|
| 957 | which is version : $GccVersion |
|---|
| 958 | Building a cross compiler : $BuildingCrossCompiler |
|---|
| 959 | Porting to foreign arch : $PortingCompiler |
|---|
| 960 | Alien script : $AlienScript |
|---|
| 961 | |
|---|
| 962 | ld : $LdCmd |
|---|
| 963 | Happy : $HappyCmd ($HappyVersion) |
|---|
| 964 | Alex : $AlexCmd ($AlexVersion) |
|---|
| 965 | Python : $PythonCmd |
|---|
| 966 | Perl : $PerlCmd |
|---|
| 967 | dblatex : $DblatexCmd |
|---|
| 968 | xsltproc : $XsltprocCmd"] |
|---|
| 969 | |
|---|
| 970 | if test "$HSCOLOUR" = ""; then |
|---|
| 971 | echo [" |
|---|
| 972 | HsColour was not found; documentation will not contain source links |
|---|
| 973 | "] |
|---|
| 974 | else |
|---|
| 975 | echo ["\ |
|---|
| 976 | HsColour : $HSCOLOUR |
|---|
| 977 | "] |
|---|
| 978 | fi |
|---|
| 979 | |
|---|
| 980 | echo ["\ |
|---|
| 981 | Building DocBook HTML documentation : $BUILD_DOCBOOK_HTML |
|---|
| 982 | Building DocBook PS documentation : $BUILD_DOCBOOK_PS |
|---|
| 983 | Building DocBook PDF documentation : $BUILD_DOCBOOK_PDF"] |
|---|
| 984 | |
|---|
| 985 | echo ["---------------------------------------------------------------------- |
|---|
| 986 | "] |
|---|
| 987 | |
|---|
| 988 | echo "\ |
|---|
| 989 | For a standard build of GHC (fully optimised with profiling), type (g)make. |
|---|
| 990 | |
|---|
| 991 | To make changes to the default build configuration, copy the file |
|---|
| 992 | mk/build.mk.sample to mk/build.mk, and edit the settings in there. |
|---|
| 993 | |
|---|
| 994 | For more information on how to configure your GHC build, see |
|---|
| 995 | http://hackage.haskell.org/trac/ghc/wiki/Building |
|---|
| 996 | " |
|---|