[project @ 2002-11-21 03:34:07 by chak]
[ghc-hetmet.git] / distrib / configure-bin.in
1 dnl
2 dnl Binary distribution configure script
3 dnl
4 #!/bin/sh
5 #
6
7 # Is it there?
8 AC_INIT(Makefile.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         # We assume you're using mingw32 via the gcc that comes
57         # with cygwin, and not the native port, so let's augment
58         # the gcc command-line used here with -mno-cygwin -mwin32
59         # to arrange for good things to happen.
60         CFLAGS="-mno-cygwin -mwin32 $CFLAGS"
61         TargetPlatform=i386-unknown-mingw32
62         ;;
63 m68k-next-nextstep2)
64         TargetPlatform=m68k-next-nextstep2;;
65 m68k-next-nextstep3)
66         TargetPlatform=m68k-next-nextstep3;;
67 i[[3456]]86-next-nextstep3)
68         TargetPlatform=i386-next-nextstep3;;
69 m68k-sun-sunos4*)
70         TargetPlatform=m68k-sun-sunos4;;
71 mips-dec-ultrix*)
72         TargetPlaformP=mips-dec-ultrix;;
73 mips-sgi-irix*)
74         TargetPlatform=mips-sgi-irix;;
75 powerpc-ibm-aix*)
76         TargetPlatform=powerpc-ibm-aix;;
77 rs6000-ibm-aix*)
78         TargetPlatform=rs6000-ibm-aix;;
79 powerpc-apple-darwin*)
80         TargetPlatform=powerpc-apple-darwin;;
81 sparc-sun-sunos4*)
82         TargetPlatform=sparc-sun-sunos4;;
83 sparc-sun-solaris2*)
84         TargetPlatform=sparc-sun-solaris2;;
85 *)
86         echo "Unrecognised platform: $TargetPlatform"
87         exit 1
88         ;;
89 esac
90 echo "Which we'll further canonicalise into: $TargetPlatform"
91
92 AC_SUBST(TargetPlatform)
93 AC_SUBST(exeext)
94
95 AC_CHECK_PROG(PerlCmd,perl,$ac_dir/$ac_word)
96 if test -z "$PerlCmd"; then
97     echo "You must install perl before you can continue"
98     echo "Perhaps it is already installed, but not in your PATH?"
99     echo ""
100     echo "Continuing, assuming perl will be available as: perl"
101 fi
102 #
103 dnl ** does #!.../perl work? (sometimes it's too long...)
104 echo "checking if \`#!$PerlCmd' works in shell scripts"
105 echo "#!$PerlCmd"'
106 exit $1;
107 ' > conftest
108 chmod u+x conftest
109 (SHELL=/bin/sh; export SHELL; ./conftest 69 > /dev/null)
110 if test $? -ne 69; then
111    echo "It does!"
112 else
113    echo "It doesn't!  Perhaps \`#!$PerlCmd' is too long (often 32 characters max).."
114 fi
115 rm -f conftest
116
117 #
118 dnl ** figure out how to do a BSD-ish install **
119 #
120 AC_PROG_INSTALL
121
122 #
123 dnl ** how to do symlinks **
124 #
125 AC_PROG_LN_S()
126
127 #
128 dnl ** Find the path to sed **
129 #
130 AC_PATH_PROG(SedCmd,sed)
131
132 #
133 dnl ** How to invoke cpp directly **
134 #
135 AC_PROG_CC
136 FPTOOLS_HAVE_GCC
137 AC_PROG_CPP
138
139 #
140 AC_OUTPUT(Makefile)
141
142 echo "****************************************************"
143 echo "Configuration done, ready to either 'make install'"
144 echo "or 'make in-place'."
145 echo "(see README and INSTALL files for more info.)"
146 echo "****************************************************"