[project @ 1997-03-14 07:52:06 by simonpj]
[ghc-hetmet.git] / distrib / configure-bin.in
1 dnl
2 dnl Binary distribution configure script
3 dnl
4 #!/bin/sh
5 #
6
7 AC_INIT(Makefile.in)
8
9 #
10 # First off, what system are we running under?
11 #
12 AC_CANONICAL_SYSTEM
13
14 dnl ** canonicalize platform names
15 # Canonicali[sz]e the platform name
16 TargetPlatform=`/bin/sh $srcdir/config.sub $target` || exit 1
17
18 #
19 # The following will be more difficult when we *are* cross-compiling.
20 # Suitable names to slam in *_CPP are in platform.h.in.
21 # We also record the architecture, vendor, and operating system (OS)
22 # separately.
23 case $HostPlatform in
24 alpha-dec-osf[[1234]]*)
25         TargetPlatform=alpha-dec-osf1;;
26 hppa1.1-hp-hpux*)
27         TargetPlatform=hppa1.1-hp-hpux;;
28 i[[3456]]86-*-linuxaout*)
29         TargetPlatform=i386-unknown-linuxaout;;
30 i[[3456]]86-*-linux*)
31         TargetPlatform=i386-unknown-linux;;
32 i[[3456]]86-*-freebsd*)
33         TargetPlatform=i386-unknown-freebsd;;
34 i[[3456]]86-*-netbsd*)
35         TargetPlatform=i386-unknown-netbsd;;
36 i[[3456]]86-*-solaris2*)
37         TargetPlatform=i386-unknown-solaris2;;
38 i[[3456]]86-*-cygwin32*)
39         TargetPlatform=i386-unknown-cygwin32;;
40 m68k-next-nextstep2)
41         TargetPlatform=m68k-next-nextstep2;;
42 m68k-next-nextstep3)
43         TargetPlatform=m68k-next-nextstep3;;
44 i[[3456]]86-next-nextstep3)
45         TargetPlatform=i386-next-nextstep3
46 m68k-sun-sunos4*)
47         TargetPlatform=m68k-sun-sunos4 #hack
48 mips-dec-ultrix*)
49         TargetPlaformP=mips-dec-ultrix;;
50 mips-sgi-irix*)
51         TargetPlatform=mips-sgi-irix;;
52 powerpc-ibm-aix*)
53         TargetPlatform=powerpc-ibm-aix;;
54 sparc-sun-sunos4*)
55         TargetPlatform=sparc-sun-sunos4;;
56 sparc-sun-solaris2*)
57         TargetPlatform=sparc-sun-solaris2;;
58 *)
59         echo "Unrecognised platform: $TargetPlatform"
60         exit 1
61         ;;
62 esac
63 echo "Which we'll canonicalise into: $TargetPlatform"
64
65 platform=$TargetPlatform
66 AC_SUBST(platform)
67
68 AC_CHECK_PROG(PerlCmd,perl,$ac_dir/$ac_word)
69 if test -z "$PerlCmd"; then
70     echo "You must install perl before you can continue"
71     echo "Perhaps it is already installed, but not in your PATH?"
72     exit 1
73 else
74     $PerlCmd -v >conftest.out 2>&1
75     if egrep "version 4" conftest.out >/dev/null 2>&1; then
76         if egrep "Patch level: 35" conftest.out >/dev/null 2>&1; then
77             echo "
78 ************************************************************************
79 Uh-oh...looks like you have Perl 4.035.
80
81 Perl version 4.035 has a bug to do with recursion that will bite if
82 you run the lit2texi script, when making Info files from
83 literate files of various sorts.  Either use the current version
84 (4.036), an older version (e.g., perl 4.019) or apply the patch in
85 glafp-utils/perl-4.035-fixes to your 4.035 perl.
86 ************************************************************************
87 "
88         fi
89     else
90         if egrep "version 5" conftest.out >/dev/null 2>&1; then
91             :
92         else
93             echo "I'm not sure if your version of perl will work,"
94             echo "but it's worth a shot, eh?"
95         fi
96     fi
97     rm -fr conftest*
98 fi
99 #
100 dnl ** does #!.../perl work? (sometimes it's too long...)
101 echo "checking if \`#!$PerlCmd' works in shell scripts"
102 echo "#!$PerlCmd"'
103 exit $1;
104 ' > conftest
105 chmod u+x conftest
106 (SHELL=/bin/sh; export SHELL; ./conftest 69 > /dev/null)
107 if test $? -ne 69; then
108    echo "It does!"
109 else
110    echo "It doesn't!  Perhaps \`#!$PerlCmd' is too long (often 32 characters max)"
111    exit 1
112 fi
113 rm -f conftest
114 #
115 dnl ** check if perl library is properly installed
116 # (by seeing if a "do 'getopts.pl'" works...
117 if $PerlCmd -e 'do "getopts.pl" || exit(1); exit(0);' > /dev/null 2>&1 ; then
118     :
119 else
120     echo "I think your perl library is misinstalled."
121     echo "The following script did not work:"
122     echo '      do "getopts.pl" || exit(1); exit(0);'
123     exit 1
124 fi
125
126 dnl ** figure out how to do a BSD-ish install
127 #
128 AC_PROG_INSTALL
129 #
130
131
132 AC_OUTPUT(Makefile)
133