Test "ghc-pkg check" passes in bindisttest
[ghc.git] / distrib / configure-bin.ac
1 dnl
2 dnl Binary distribution configure script
3 dnl
4 #!/bin/sh
5 #
6
7 # Is it there?
8 AC_INIT(mk/config.mk.in)
9
10 exeext=''
11
12 #
13 # First off, what system are we running under?
14 #
15 AC_CANONICAL_SYSTEM
16
17 dnl ** canonicalize platform names
18 # Canonicali[sz]e the platform name
19 TargetPlatform=`/bin/sh $srcdir/config.sub $target` || exit 1
20
21 #
22 # The following will be more difficult when we *are* cross-compiling.
23 # Suitable names to slam in *_CPP are in platform.h.in.
24 # We also record the architecture, vendor, and operating system (OS)
25 # separately.
26 case $TargetPlatform in
27 alpha*-dec-osf[[12]]*)
28         TargetPlatform=alpha-dec-osf1;;
29 alpha*-dec-osf[[345]]*)
30         TargetPlatform=alpha-dec-osf3;;
31 alpha*-unknown-linux)
32         TargetPlatform=alpha-unknown-linux;;
33 alpha*-unknown-freebsd*)
34         TargetPlatform=alpha-unknown-freebsd;;
35 hppa1.1-hp-hpux*)
36         TargetPlatform=hppa1.1-hp-hpux;;
37 i[[3456]]86-*-linuxaout*)
38         TargetPlatform=i386-unknown-linuxaout;;
39 i[[3456]]86-*-linux*)
40         TargetPlatform=i386-unknown-linux;;
41 i[[3456]]86-*-freebsd2*)
42         TargetPlatform=i386-unknown-freebsd2;;
43 i[[3456]]86-*-freebsd[[3-9]]*)
44         TargetPlatform=i386-unknown-freebsd;;
45 i[[3456]]86-*-netbsd*)
46         TargetPlatform=i386-unknown-netbsd;;
47 i[[3456]]86-*-openbsd*)
48         TargetPlatform=i386-unknown-openbsd;;
49 i[[3456]]86-*-solaris2*)
50         TargetPlatform=i386-unknown-solaris2;;
51 i[[3456]]86-*-cygwin*)
52         exeext='.exe'
53         TargetPlatform=i386-unknown-cygwin32;;
54 i[[3456]]86-*-mingw32*)
55         exeext='.exe'
56         TargetPlatform=i386-unknown-mingw32
57         ;;
58 i[[3456]]86-apple-darwin*)
59         TargetPlatform=i386-apple-darwin;;
60 m68k-next-nextstep2)
61         TargetPlatform=m68k-next-nextstep2;;
62 m68k-next-nextstep3)
63         TargetPlatform=m68k-next-nextstep3;;
64 i[[3456]]86-next-nextstep3)
65         TargetPlatform=i386-next-nextstep3;;
66 m68k-sun-sunos4*)
67         TargetPlatform=m68k-sun-sunos4;;
68 mips-dec-ultrix*)
69         TargetPlaformP=mips-dec-ultrix;;
70 mips-sgi-irix*)
71         TargetPlatform=mips-sgi-irix;;
72 powerpc-ibm-aix*)
73         TargetPlatform=powerpc-ibm-aix;;
74 rs6000-ibm-aix*)
75         TargetPlatform=rs6000-ibm-aix;;
76 powerpc-apple-darwin*)
77         TargetPlatform=powerpc-apple-darwin;;
78 powerpc-*-linux*)
79         TargetPlatform=powerpc-unknown-linux;;
80 powerpc64-*-linux*)
81         TargetPlatform=powerpc64-unknown-linux;;
82 sparc-sun-sunos4*)
83         TargetPlatform=sparc-sun-sunos4;;
84 sparc-sun-solaris2*)
85         TargetPlatform=sparc-sun-solaris2;;
86 x86_64-*-linux*)
87         TargetPlatform=x86_64-unknown-linux;;
88 x86_64-*-freebsd*)
89         TargetPlatform=x86_64-unknown-freebsd;;
90 x86_64-*-openbsd*)
91         TargetPlatform=x86_64-unknown-openbsd;;
92 x86_64-*-netbsd*)
93         TargetPlatform=x86_64-unknown-netbsd;;
94 x86_64-apple-darwin*)
95         TargetPlatform=x86_64-apple-darwin;;
96 *)
97         echo "Unrecognised platform: $TargetPlatform"
98         exit 1
99         ;;
100 esac
101 echo "Which we'll further canonicalise into: $TargetPlatform"
102
103 AC_SUBST(TargetPlatform)
104 AC_SUBST(exeext)
105
106 FP_FIND_ROOT
107
108 dnl--------------------------------------------------------------------
109 dnl * Deal with arguments telling us gmp is somewhere odd
110 dnl--------------------------------------------------------------------
111
112 FP_ARG_GMP
113
114 GMP_INCLUDE_DIRS=
115 GMP_LIB_DIRS=
116 if test "x$gmp_libraries" != "xNONE"; then
117   LDFLAGS="-L$gmp_libraries $LDFLAGS"
118   GMP_LIB_DIRS=$gmp_libraries
119 fi
120 if test "x$gmp_includes" != "xNONE"; then
121   CPPFLAGS="-I$gmp_includes $CPPFLAGS"
122   GMP_INCLUDE_DIRS=$gmp_includes
123 fi
124 AC_SUBST(GMP_INCLUDE_DIRS)
125 AC_SUBST(GMP_LIB_DIRS)
126
127 #
128 dnl ** Check Perl installation **
129 #
130 AC_PATH_PROG(PerlCmd,perl)
131 if test -z "$PerlCmd"; then
132    echo "You must install perl before you can continue"
133    echo "Perhaps it is already installed, but not in your PATH?"
134    exit 1
135 fi
136 FPTOOLS_SHEBANG_PERL
137
138 #
139 dnl ** figure out how to do a BSD-ish install **
140 #
141 AC_PROG_INSTALL
142
143 #
144 dnl ** how to do symlinks **
145 #
146 AC_PROG_LN_S()
147
148 #
149 dnl ** how to invoke `ar' and `ranlib'
150 #
151 FP_PROG_AR_NEEDS_RANLIB
152
153 #
154 dnl ** Find the path to sed **
155 #
156 AC_PATH_PROG(SedCmd,sed)
157
158 #
159 dnl ** How to invoke cpp directly **
160 #
161 FP_HAVE_GCC
162 AC_PROG_CPP
163
164 #
165 dnl ** Check gcc version and flags we need to pass it **
166 #
167 FP_GCC_EXTRA_FLAGS
168
169 #
170 AC_CONFIG_FILES(extra-gcc-opts mk/config.mk)
171 AC_OUTPUT
172
173 echo "****************************************************"
174 echo "Configuration done, ready to 'make install'"
175 echo "(see README and INSTALL files for more info.)"
176 echo "****************************************************"