1996-02-13 08:29:09 -08:00
|
|
|
#! /bin/sh
|
|
|
|
|
|
|
|
#*********************************************************************#
|
|
|
|
# #
|
1996-04-30 07:53:58 -07:00
|
|
|
# Objective Caml #
|
1996-02-13 08:29:09 -08:00
|
|
|
# #
|
|
|
|
# Xavier Leroy, projet Cristal, INRIA Rocquencourt #
|
|
|
|
# #
|
|
|
|
# Copyright 1995 Institut National de Recherche en Informatique et #
|
|
|
|
# Automatique. Distributed only by permission. #
|
|
|
|
# #
|
|
|
|
#*********************************************************************#
|
|
|
|
|
1996-02-25 06:45:47 -08:00
|
|
|
# $Id$
|
1996-02-13 08:29:09 -08:00
|
|
|
|
|
|
|
bindir=/usr/local/bin
|
1996-04-30 07:53:58 -07:00
|
|
|
libdir=/usr/local/lib/ocaml
|
1996-02-13 08:29:09 -08:00
|
|
|
mandir=/usr/local/man/man1
|
|
|
|
manext=1
|
|
|
|
host_type=unknown
|
|
|
|
cc=''
|
|
|
|
cclibs=''
|
1996-06-19 02:43:01 -07:00
|
|
|
x11_include_dir=''
|
|
|
|
x11_lib_dir=''
|
1996-02-13 08:29:09 -08:00
|
|
|
|
|
|
|
# Parse command-line arguments
|
|
|
|
|
|
|
|
while : ; do
|
|
|
|
case "$1" in
|
|
|
|
"") break;;
|
1996-06-24 09:52:12 -07:00
|
|
|
-bindir|--bindir) bindir=$2;;
|
|
|
|
-libdir|--libdir) libdir=$2;;
|
|
|
|
-mandir|--mandir) mandir=$2
|
|
|
|
manext=`echo $mandir | sed -e 's/^.*\(.\)$/\1/'`;;
|
1996-02-13 08:29:09 -08:00
|
|
|
-host*|--host*) host_type=$2;;
|
|
|
|
-cc*) cc="$2";;
|
1996-04-01 07:22:44 -08:00
|
|
|
-lib*) cclibs="$2 ";;
|
1996-06-19 02:43:01 -07:00
|
|
|
-x11include*|--x11include*) x11_include_dir=$2;;
|
|
|
|
-x11lib*|--x11lib*) x11_lib_dir=$2;;
|
1996-02-13 08:29:09 -08:00
|
|
|
*) echo "Unknown option \"$1\"." 1>&2; exit 2;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
|
|
|
# Generate the files
|
|
|
|
|
|
|
|
cd config/auto-aux
|
|
|
|
rm -f s.h m.h Makefile
|
|
|
|
touch s.h m.h Makefile
|
|
|
|
|
|
|
|
# Where to install
|
|
|
|
|
|
|
|
echo "BINDIR=$bindir" >> Makefile
|
|
|
|
echo "LIBDIR=$libdir" >> Makefile
|
|
|
|
echo "MANDIR=$mandir" >> Makefile
|
|
|
|
echo "MANEXT=$manext" >> Makefile
|
|
|
|
|
|
|
|
# Determine the system type
|
|
|
|
|
1996-02-25 06:45:47 -08:00
|
|
|
if test "$host_type" = "unknown"; then
|
|
|
|
if host_type=`./config.guess`; then :; else
|
|
|
|
echo "Cannot guess host type"
|
|
|
|
echo "You must specify one with the -host option"
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if host=`./config.sub $host_type`; then :; else
|
|
|
|
echo "Please specify the correct host type with the -host option"
|
|
|
|
exit 2
|
|
|
|
fi
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "Configuring for a $host ..."
|
|
|
|
|
|
|
|
# Do we have gcc?
|
|
|
|
|
|
|
|
if test -z "$cc"; then
|
|
|
|
if sh ./searchpath gcc; then
|
|
|
|
echo "gcc found"
|
|
|
|
cc=gcc
|
|
|
|
else
|
|
|
|
cc=cc
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
1997-03-21 02:44:35 -08:00
|
|
|
# Check for buggy versions of GCC
|
|
|
|
|
|
|
|
case "$cc" in
|
|
|
|
gcc*)
|
|
|
|
case `$cc --version` in
|
|
|
|
2.7.2.1)
|
|
|
|
echo ""
|
|
|
|
echo "WARNING: you are using gcc version 2.7.2.1."
|
|
|
|
echo "This version of gcc is known to generate incorrect code"
|
1997-06-13 08:46:05 -07:00
|
|
|
echo "for the Objective Caml runtime system, at least on some"
|
|
|
|
echo "Intel x86 machines. (The symptom is a crash of boot/ocamlc when"
|
|
|
|
echo "compiling stdlib/pervasives.mli.)"
|
1997-03-21 02:44:35 -08:00
|
|
|
echo "You are strongly advised to use another version of gcc, such as"
|
|
|
|
echo "2.7.2 or 2.7.2.2, which are known to work well with Objective Caml."
|
|
|
|
echo ""
|
|
|
|
echo "Press <enter> to proceed or <interrupt> to stop."
|
|
|
|
read reply;;
|
|
|
|
esac;;
|
|
|
|
esac
|
|
|
|
|
1997-03-11 01:25:23 -08:00
|
|
|
# Configure the bytecode compiler
|
1996-02-13 08:29:09 -08:00
|
|
|
|
1997-03-11 01:25:23 -08:00
|
|
|
bytecc="$cc"
|
|
|
|
bytecccompopts=""
|
|
|
|
bytecclinkopts=""
|
1996-02-13 08:29:09 -08:00
|
|
|
|
1997-03-11 01:25:23 -08:00
|
|
|
case "$bytecc,$host" in
|
1997-05-13 07:02:58 -07:00
|
|
|
cc,*-*-nextstep*)
|
1997-03-11 01:25:23 -08:00
|
|
|
# GNU C extensions disabled, but __GNUC__ still defined!
|
|
|
|
bytecccompopts="-fno-defer-pop -Wall -U__GNUC__ -posix"
|
|
|
|
bytecclinkopts="-posix";;
|
|
|
|
gcc,alpha-*-osf*)
|
|
|
|
bytecccompopts="-fno-defer-pop -Wall"
|
|
|
|
# -taso puts code in lower 4GB
|
|
|
|
bytecclinkopts="-Xlinker -taso";;
|
|
|
|
gcc*)
|
|
|
|
bytecccompopts="-fno-defer-pop -Wall";;
|
1997-03-21 02:44:35 -08:00
|
|
|
cc,mips-*-irix6*)
|
1997-03-11 01:25:23 -08:00
|
|
|
# Add -32 flag to ensure compatibility with native-code compiler
|
|
|
|
bytecccompopts="-32"
|
|
|
|
# Turn off warning "unused library"
|
|
|
|
bytecclinkopts="-32 -Wl,-woff,84";;
|
1997-03-21 02:44:35 -08:00
|
|
|
cc*,mips-*-irix6*)
|
1997-03-11 01:25:23 -08:00
|
|
|
# Turn off warning "unused library"
|
|
|
|
bytecclinkopts="-Wl,-woff,84";;
|
|
|
|
esac
|
|
|
|
|
|
|
|
echo "BYTECC=$bytecc" >> Makefile
|
|
|
|
echo "BYTECCCOMPOPTS=$bytecccompopts" >> Makefile
|
|
|
|
echo "BYTECCLINKOPTS=$bytecclinkopts" >> Makefile
|
|
|
|
|
|
|
|
# Configure compiler to use in further tests
|
|
|
|
|
|
|
|
cc="$bytecc $bytecclinkopts"
|
|
|
|
export cc cclibs
|
1996-02-13 08:29:09 -08:00
|
|
|
|
|
|
|
# Check the sizes of data types
|
|
|
|
|
|
|
|
echo "Checking the sizes of integers and pointers..."
|
1997-04-11 07:27:45 -07:00
|
|
|
set `sh ./runtest sizes.c`
|
1996-02-13 08:29:09 -08:00
|
|
|
case "$1,$2,$3" in
|
1996-02-15 08:19:09 -08:00
|
|
|
4,4,4) echo "OK, this is a regular 32 bit architecture."
|
1996-07-01 05:43:28 -07:00
|
|
|
echo "#undef ARCH_SIXTYFOUR" >> m.h;;
|
1996-02-13 08:29:09 -08:00
|
|
|
4,8,8) echo "Wow! A 64 bit architecture!"
|
1997-04-28 08:51:29 -07:00
|
|
|
echo "#define ARCH_SIXTYFOUR" >> m.h
|
|
|
|
case "$bytecc,$host" in
|
|
|
|
gcc,alpha-*-osf*) echo "#define ARCH_CODE32" >> m.h;;
|
|
|
|
*) echo "#undef ARCH_CODE32" >> m.h;;
|
|
|
|
esac;;
|
1996-02-13 08:29:09 -08:00
|
|
|
8,*,*) echo "Wow! A 64 bit architecture!"
|
1996-04-30 07:53:58 -07:00
|
|
|
echo "Unfortunately, Objective Caml does not handle the case"
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "sizeof(int) = 8."
|
1996-04-30 07:53:58 -07:00
|
|
|
echo "Objective Caml won't run on this architecture."
|
1996-02-13 08:29:09 -08:00
|
|
|
exit 2;;
|
1997-04-28 08:51:29 -07:00
|
|
|
*,*,8) echo "Wow! A 64 bit architecture!"
|
1996-04-30 07:53:58 -07:00
|
|
|
echo "Unfortunately, Objective Caml cannot work in the case"
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "sizeof(long) != sizeof(long *)."
|
1996-04-30 07:53:58 -07:00
|
|
|
echo "Objective Caml won't run on this architecture."
|
1996-02-13 08:29:09 -08:00
|
|
|
exit 2;;
|
1996-06-19 02:43:01 -07:00
|
|
|
*,*,*) echo "This architecture seems to be neither 32 bits nor 64 bits."
|
1996-04-30 07:53:58 -07:00
|
|
|
echo "Objective Caml won't run on this architecture."
|
1996-02-13 08:29:09 -08:00
|
|
|
exit 2;;
|
|
|
|
*) echo "Unable to compile the test program."
|
|
|
|
echo "Make sure the C compiler $cc is properly installed."
|
|
|
|
exit 2;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# Determine endianness
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
sh ./runtest endian.c
|
1996-02-13 08:29:09 -08:00
|
|
|
case $? in
|
|
|
|
0) echo "This is a big-endian architecture."
|
1996-07-01 05:43:28 -07:00
|
|
|
echo "#define ARCH_BIG_ENDIAN" >> m.h;;
|
1996-02-13 08:29:09 -08:00
|
|
|
1) echo "This is a little-endian architecture."
|
1996-07-01 05:43:28 -07:00
|
|
|
echo "#undef ARCH_BIG_ENDIAN" >> m.h;;
|
1996-02-13 08:29:09 -08:00
|
|
|
2) echo "This architecture seems to be neither big endian nor little endian."
|
1996-04-30 07:53:58 -07:00
|
|
|
echo "Objective Caml won't run on this architecture."
|
1996-02-13 08:29:09 -08:00
|
|
|
exit 2;;
|
|
|
|
*) echo "Something went wrong during endianness determination."
|
|
|
|
echo "You'll have to figure out endianness yourself"
|
1996-07-01 05:43:28 -07:00
|
|
|
echo "(option ARCH_BIG_ENDIAN in m.h).";;
|
1996-02-13 08:29:09 -08:00
|
|
|
esac
|
|
|
|
|
|
|
|
# Determine alignment constraints
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
sh ./runtest dblalign.c
|
1996-02-13 08:29:09 -08:00
|
|
|
case $? in
|
1996-02-15 08:19:09 -08:00
|
|
|
0) echo "Doubles can be word-aligned."
|
1996-07-01 05:43:28 -07:00
|
|
|
echo "#undef ARCH_ALIGN_DOUBLE" >> m.h;;
|
1996-02-13 08:29:09 -08:00
|
|
|
1) echo "Doubles must be doubleword-aligned."
|
1996-07-01 05:43:28 -07:00
|
|
|
echo "#define ARCH_ALIGN_DOUBLE" >> m.h;;
|
1996-02-13 08:29:09 -08:00
|
|
|
*) echo "Something went wrong during alignment determination for doubles."
|
|
|
|
echo "I'm going to assume this architecture has alignment constraints over doubles."
|
1996-04-30 07:53:58 -07:00
|
|
|
echo "That's a safe bet: Objective Caml will work even if"
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "this architecture has actually no alignment constraints."
|
1996-07-01 05:43:28 -07:00
|
|
|
echo "#define ARCH_ALIGN_DOUBLE" >> m.h;;
|
1996-02-13 08:29:09 -08:00
|
|
|
esac
|
|
|
|
|
|
|
|
# Configure the native-code compiler
|
|
|
|
|
|
|
|
arch=none
|
|
|
|
model=default
|
|
|
|
system=unknown
|
|
|
|
|
|
|
|
case "$host" in
|
|
|
|
alpha-*-osf*) arch=alpha;;
|
|
|
|
sparc-*-sunos4.*) arch=sparc; system=sunos;;
|
|
|
|
sparc-*-solaris2.*) arch=sparc; system=solaris;;
|
1996-04-18 09:27:16 -07:00
|
|
|
sparc-*-*bsd*) arch=sparc; system=bsd;;
|
1996-09-18 06:24:56 -07:00
|
|
|
i[3456]86-*-linuxaout) arch=i386; system=linux_aout;;
|
|
|
|
i[3456]86-*-linuxoldld) arch=i386; system=linux_aout;;
|
1996-02-13 08:29:09 -08:00
|
|
|
i[3456]86-*-linux) arch=i386; system=linux_elf;;
|
|
|
|
i[3456]86-*-*bsd*) arch=i386; system=bsd;;
|
|
|
|
i[3456]86-*-nextstep*) arch=i386; system=nextstep;;
|
1996-09-18 06:24:56 -07:00
|
|
|
i[3456]86-*-solaris*) arch=i386; system=solaris;;
|
1997-03-21 02:44:35 -08:00
|
|
|
mips-*-irix6*) arch=mips; system=irix;;
|
1997-02-01 09:40:41 -08:00
|
|
|
mips-*-ultrix*) arch=mips; system=ultrix;;
|
1996-06-23 02:27:14 -07:00
|
|
|
hppa1.1-*-hpux*) arch=hppa; system=hpux;;
|
|
|
|
hppa1.1-*-nextstep*) arch=hppa; system=nextstep;;
|
1996-07-03 09:14:11 -07:00
|
|
|
rs6000-*-aix*) arch=power; model=rs6000; system=aix;;
|
|
|
|
powerpc-*-aix*) arch=power; model=ppc; system=aix;;
|
1996-07-03 11:39:36 -07:00
|
|
|
powerpc-*-linux*) arch=power; model=ppc; system=elf;;
|
1996-10-24 09:14:57 -07:00
|
|
|
m68k-*-sunos*) arch=m68k; system=sunos;;
|
1996-02-13 08:29:09 -08:00
|
|
|
esac
|
|
|
|
|
|
|
|
case "$arch" in
|
|
|
|
alpha|mips) nativecc=cc;;
|
|
|
|
*) nativecc="$bytecc";;
|
|
|
|
esac
|
|
|
|
|
1997-02-03 06:41:42 -08:00
|
|
|
nativecccompopts=''
|
|
|
|
nativecclinkopts=''
|
|
|
|
|
1996-06-25 05:41:56 -07:00
|
|
|
case "$arch,$nativecc,$system" in
|
1997-02-01 09:40:41 -08:00
|
|
|
alpha,cc,*) nativecccompopts=-std1;;
|
1997-02-03 06:41:42 -08:00
|
|
|
mips,cc,irix) nativecccompopts=-32
|
|
|
|
nativecclinkopts="-32 -Wl,-woff,84";;
|
1997-02-01 09:40:41 -08:00
|
|
|
mips,cc,ultrix) nativecccompopts=-std;;
|
1997-03-11 01:25:23 -08:00
|
|
|
*,*,nextstep) nativecccompopts="-Wall -U__GNUC__ -posix"
|
1997-03-08 04:16:23 -08:00
|
|
|
nativecclinkopts="-posix";;
|
1997-02-01 09:40:41 -08:00
|
|
|
*,gcc,*) nativecccompopts=-Wall;;
|
1996-02-13 08:29:09 -08:00
|
|
|
esac
|
|
|
|
|
1996-09-18 06:24:56 -07:00
|
|
|
asflags=''
|
|
|
|
aspp='$(AS)'
|
|
|
|
asppflags=''
|
|
|
|
|
|
|
|
case "$arch,$model,$system" in
|
|
|
|
alpha,*,*) asflags='-O2'; asppflags="$asflags";;
|
1997-02-01 09:40:41 -08:00
|
|
|
mips,*,irix) asflags='-32 -O2'; asppflags="$asflags";;
|
|
|
|
mips,*,ultrix) asflags='-O2'; asppflags="$asflags";;
|
1996-09-18 06:24:56 -07:00
|
|
|
sparc,*,bsd) aspp='gcc'; asppflags='-c -DSYS_$(SYSTEM)';;
|
|
|
|
sparc,*,*) asppflags='-P -DSYS_$(SYSTEM)';;
|
|
|
|
i386,*,solaris) asppflags='-P -DSYS_$(SYSTEM)';;
|
|
|
|
i386,*,*) aspp='gcc'; asppflags='-c -DSYS_$(SYSTEM)';;
|
|
|
|
hppa,*,*) aspp="$cc"; asppflags='-c -DSYS_$(SYSTEM)';;
|
|
|
|
power,rs6000,aix) asflags='-u -m pwr -w'; asppflags="$asflags";;
|
|
|
|
power,ppc,aix) asflags='-u -m ppc -w'; asppflags="$asflags";;
|
|
|
|
power,*,elf) aspp='gcc'; asppflags='-c';;
|
1996-02-13 08:29:09 -08:00
|
|
|
esac
|
|
|
|
|
|
|
|
echo "ARCH=$arch" >> Makefile
|
|
|
|
echo "MODEL=$model" >> Makefile
|
|
|
|
echo "SYSTEM=$system" >> Makefile
|
|
|
|
echo "NATIVECC=$nativecc" >> Makefile
|
|
|
|
echo "NATIVECCCOMPOPTS=$nativecccompopts" >> Makefile
|
|
|
|
echo "NATIVECCLINKOPTS=$nativecclinkopts" >> Makefile
|
|
|
|
echo "ASFLAGS=$asflags" >> Makefile
|
1996-09-18 06:24:56 -07:00
|
|
|
echo "ASPP=$aspp" >> Makefile
|
|
|
|
echo "ASPPFLAGS=$asppflags" >> Makefile
|
1996-02-13 08:29:09 -08:00
|
|
|
|
|
|
|
# Where is ranlib?
|
|
|
|
|
|
|
|
if sh ./searchpath ranlib; then
|
|
|
|
echo "ranlib found"
|
|
|
|
echo "RANLIB=ranlib" >> Makefile
|
1996-11-07 02:54:28 -08:00
|
|
|
echo "RANLIBCMD=ranlib" >> Makefile
|
1996-02-13 08:29:09 -08:00
|
|
|
else
|
|
|
|
echo "ranlib not used"
|
1996-11-07 02:54:28 -08:00
|
|
|
echo "RANLIB=ar rs" >> Makefile
|
|
|
|
echo "RANLIBCMD=" >> Makefile
|
1996-02-13 08:29:09 -08:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Do #! scripts work?
|
|
|
|
|
|
|
|
if (SHELL=/bin/sh; export SHELL; ./sharpbang > /dev/null); then
|
|
|
|
echo "#! appears to work in shell scripts"
|
1996-05-09 07:59:34 -07:00
|
|
|
if test `echo $bindir/ocamlrun | wc -c` -gt 32; then
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "We won't use it, though, because the path"
|
1996-05-09 07:59:34 -07:00
|
|
|
echo " $bindir/ocamlrun"
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "is too long (more than 32 characters -- some kernels don't support this)"
|
|
|
|
echo "SHARPBANGSCRIPTS=false" >> Makefile
|
|
|
|
else
|
|
|
|
echo "SHARPBANGSCRIPTS=true" >> Makefile
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "No support for #! in shell scripts"
|
|
|
|
echo "SHARPBANGSCRIPTS=false" >> Makefile
|
|
|
|
fi
|
|
|
|
|
1996-10-06 09:36:37 -07:00
|
|
|
# This is obviously a Unix system
|
|
|
|
|
|
|
|
echo '#define OCAML_OS_TYPE "Unix"' >> s.h
|
|
|
|
|
1996-02-13 08:29:09 -08:00
|
|
|
# Find a good byte move function
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./runtest -Dcopy=memmove -Dreverse bytecopy.c; then
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "Function \"memmove\" is provided and handles overlapping moves correctly."
|
|
|
|
echo "#define HAS_MEMMOVE" >> s.h
|
|
|
|
fi
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./runtest -Dcopy=bcopy bytecopy.c; then
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "Function \"bcopy\" is provided and handles overlapping moves correctly."
|
|
|
|
echo "#define HAS_BCOPY" >> s.h
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Check the semantics of signal handlers
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot sigaction sigprocmask; then
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "POSIX signal handling found."
|
|
|
|
echo "#define POSIX_SIGNALS" >> s.h
|
|
|
|
else
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./runtest signals.c; then
|
1996-02-21 02:49:46 -08:00
|
|
|
echo "Signals have the BSD semantics."
|
|
|
|
echo "#define BSD_SIGNALS" >> s.h
|
|
|
|
else
|
|
|
|
echo "Signals have the System V semantics."
|
|
|
|
fi
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot sigsetmask; then
|
1996-02-21 02:49:46 -08:00
|
|
|
echo "sigsetmask() found"
|
|
|
|
echo "#define HAS_SIGSETMASK" >> s.h
|
|
|
|
fi
|
1996-02-13 08:29:09 -08:00
|
|
|
fi
|
|
|
|
|
|
|
|
# For the sys module
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot strerror; then
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "strerror() found."
|
|
|
|
echo "#define HAS_STRERROR" >> s.h
|
|
|
|
fi
|
|
|
|
|
|
|
|
# For the terminfo module
|
|
|
|
|
1997-02-23 08:29:36 -08:00
|
|
|
for libs in "" "-lcurses" "-ltermcap" "-lcurses -ltermcap"; do
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot $libs tgetent tgetstr tgetnum tputs; then
|
1997-02-23 08:29:36 -08:00
|
|
|
echo "termcap functions found (with libraries '$libs')"
|
|
|
|
echo "#define HAS_TERMCAP" >> s.h
|
|
|
|
cclibs="${cclibs}${libs}"
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
1996-02-13 08:29:09 -08:00
|
|
|
|
1996-04-01 07:22:44 -08:00
|
|
|
# Configuration for the libraries
|
|
|
|
|
|
|
|
otherlibraries="unix str num dynlink"
|
|
|
|
|
1996-02-13 08:29:09 -08:00
|
|
|
# For the Unix library
|
|
|
|
|
1997-02-23 08:29:36 -08:00
|
|
|
has_sockets=no
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot socket socketpair bind listen accept connect; then
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "You have BSD sockets."
|
|
|
|
echo "#define HAS_SOCKETS" >> s.h
|
1997-02-23 08:29:36 -08:00
|
|
|
has_sockets=yes
|
1997-04-11 07:27:45 -07:00
|
|
|
elif sh ./hasgot -lnsl -lsocket socket socketpair bind listen accept connect; then
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "You have BSD sockets (with the additional libraries -lnsl -lsocket)"
|
|
|
|
cclibs="$cclibs -lnsl -lsocket"
|
|
|
|
echo "#define HAS_SOCKETS" >> s.h
|
1997-02-23 08:29:36 -08:00
|
|
|
has_sockets=yes
|
1996-02-13 08:29:09 -08:00
|
|
|
fi
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot -i unistd.h; then
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "unistd.h found."
|
|
|
|
echo "#define HAS_UNISTD" >> s.h
|
|
|
|
fi
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot -i dirent.h; then
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "dirent.h found."
|
|
|
|
echo "#define HAS_DIRENT" >> s.h
|
|
|
|
fi
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot rewinddir; then
|
1996-06-25 02:27:34 -07:00
|
|
|
echo "rewinddir() found."
|
|
|
|
echo "#define HAS_REWINDDIR" >> s.h
|
|
|
|
fi
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot lockf; then
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "lockf() found."
|
|
|
|
echo "#define HAS_LOCKF" >> s.h
|
|
|
|
fi
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot mkfifo; then
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "mkfifo() found."
|
|
|
|
echo "#define HAS_MKFIFO" >> s.h
|
|
|
|
fi
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot getcwd; then
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "getcwd() found."
|
|
|
|
echo "#define HAS_GETCWD" >> s.h
|
|
|
|
fi
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot getwd; then
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "getwd() found."
|
|
|
|
echo "#define HAS_GETWD" >> s.h
|
|
|
|
fi
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot getpriority setpriority; then
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "getpriority() found."
|
|
|
|
echo "#define HAS_GETPRIORITY" >> s.h
|
|
|
|
fi
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot -i utime.h && sh ./hasgot utime; then
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "utime() found."
|
|
|
|
echo "#define HAS_UTIME" >> s.h
|
|
|
|
fi
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot utimes; then
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "utimes() found."
|
|
|
|
echo "#define HAS_UTIMES" >> s.h
|
|
|
|
fi
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot dup2; then
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "dup2() found."
|
|
|
|
echo "#define HAS_DUP2" >> s.h
|
|
|
|
fi
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot fchmod fchown; then
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "fchmod() found."
|
|
|
|
echo "#define HAS_FCHMOD" >> s.h
|
|
|
|
fi
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot truncate ftruncate; then
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "truncate() found."
|
|
|
|
echo "#define HAS_TRUNCATE" >> s.h
|
|
|
|
fi
|
|
|
|
|
1997-02-23 08:29:36 -08:00
|
|
|
has_select=no
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot select; then
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "select() found."
|
|
|
|
echo "#define HAS_SELECT" >> s.h
|
1996-04-03 02:01:15 -08:00
|
|
|
has_select=yes
|
1996-02-13 08:29:09 -08:00
|
|
|
fi
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot -i sys/select.h; then
|
1996-06-24 09:35:58 -07:00
|
|
|
echo "sys/select.h found."
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "#define HAS_SYS_SELECT_H" >> s.h
|
|
|
|
fi
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot symlink readlink lstat; then
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "symlink() found."
|
|
|
|
echo "#define HAS_SYMLINK" >> s.h
|
|
|
|
fi
|
|
|
|
|
1997-02-23 08:29:36 -08:00
|
|
|
has_wait=no
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot waitpid; then
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "waitpid() found."
|
|
|
|
echo "#define HAS_WAITPID" >> s.h
|
1996-06-25 02:27:34 -07:00
|
|
|
has_wait=yes
|
|
|
|
fi
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot wait4; then
|
1996-06-25 02:27:34 -07:00
|
|
|
echo "wait4() found."
|
|
|
|
echo "#define HAS_WAIT4" >> s.h
|
|
|
|
has_wait=yes
|
1996-02-13 08:29:09 -08:00
|
|
|
fi
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot -i sys/param.h && sh ./runtest getgroups.c; then
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "getgroups() found."
|
|
|
|
echo "#define HAS_GETGROUPS" >> s.h
|
|
|
|
fi
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot -i termios.h &&
|
|
|
|
sh ./hasgot tcgetattr tcsetattr tcsendbreak tcflush tcflow; then
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "POSIX termios found."
|
|
|
|
echo "#define HAS_TERMIOS" >> s.h
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Async I/O under OSF1 3.x are so buggy that the test program hangs...
|
|
|
|
testasyncio=true
|
|
|
|
if test -f /usr/bin/uname; then
|
1997-02-01 09:40:41 -08:00
|
|
|
case "`/usr/bin/uname -s -r`" in
|
1996-02-13 08:29:09 -08:00
|
|
|
"OSF1 V3."*) testasyncio=false;;
|
|
|
|
esac
|
|
|
|
fi
|
1997-04-11 07:27:45 -07:00
|
|
|
if $testasyncio && sh ./runtest async_io.c; then
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "Asynchronous I/O are supported."
|
|
|
|
echo "#define HAS_ASYNC_IO" >> s.h
|
|
|
|
fi
|
|
|
|
|
1997-02-23 08:29:36 -08:00
|
|
|
has_setitimer=no
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot setitimer; then
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "setitimer() found."
|
|
|
|
echo "#define HAS_SETITIMER" >> s.h
|
1996-04-03 02:01:15 -08:00
|
|
|
has_setitimer="yes"
|
1996-02-13 08:29:09 -08:00
|
|
|
fi
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot gethostname; then
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "gethostname() found."
|
|
|
|
echo "#define HAS_GETHOSTNAME" >> s.h
|
|
|
|
fi
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot -i sys/utsname.h && sh ./hasgot uname; then
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "uname() found."
|
|
|
|
echo "#define HAS_UNAME" >> s.h
|
|
|
|
fi
|
|
|
|
|
1997-02-23 08:29:36 -08:00
|
|
|
has_gettimeofday=no
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot gettimeofday; then
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "gettimeofday() found."
|
|
|
|
echo "#define HAS_GETTIMEOFDAY" >> s.h
|
1996-04-03 02:01:15 -08:00
|
|
|
has_gettimeofday="yes"
|
1996-02-13 08:29:09 -08:00
|
|
|
fi
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot mktime; then
|
1996-06-24 09:35:58 -07:00
|
|
|
echo "mktime() found."
|
|
|
|
echo "#define HAS_MKTIME" >> s.h
|
|
|
|
fi
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot setsid; then
|
1997-02-14 08:29:10 -08:00
|
|
|
echo "setsid() found."
|
|
|
|
echo "#define HAS_SETSID" >> s.h
|
|
|
|
fi
|
|
|
|
|
1997-02-23 08:29:36 -08:00
|
|
|
# Determine if the debugger is supported
|
|
|
|
|
|
|
|
if test "$has_sockets" = "yes"; then
|
|
|
|
echo "Replay debugger supported."
|
|
|
|
debugger="ocamldebugger"
|
|
|
|
else
|
|
|
|
echo "No replay debugger (missing system calls)"
|
|
|
|
debugger=""
|
|
|
|
fi
|
|
|
|
|
1996-02-13 08:29:09 -08:00
|
|
|
# Determine the target architecture for the "num" library
|
|
|
|
|
|
|
|
case "$host" in
|
1997-02-01 09:40:41 -08:00
|
|
|
mips-*-ultrix*) bignum_arch=mips;;
|
1996-02-13 08:29:09 -08:00
|
|
|
alpha*) bignum_arch=alpha;;
|
|
|
|
i960*) bignum_arch=i960;;
|
|
|
|
sparc-*-sunos*) bignum_arch=supersparc;;
|
|
|
|
sparc-*-solaris*) bignum_arch=supersparc-solaris;;
|
1996-04-18 09:27:16 -07:00
|
|
|
sparc-*-*bsd*) bignum_arch=sparc;;
|
1996-10-24 09:14:57 -07:00
|
|
|
m68k-*-sunos*) bignum_arch=68K;;
|
1996-02-13 08:29:09 -08:00
|
|
|
*) bignum_arch=C
|
|
|
|
esac
|
|
|
|
|
|
|
|
echo "BIGNUM_ARCH=$bignum_arch" >> Makefile
|
|
|
|
|
1996-04-03 02:01:15 -08:00
|
|
|
# Determine if the threads library is supported
|
|
|
|
|
|
|
|
if test "$has_select" = "yes" \
|
|
|
|
&& test "$has_setitimer" = "yes" \
|
1996-06-25 02:27:34 -07:00
|
|
|
&& test "$has_gettimeofday" = "yes" \
|
|
|
|
&& test "$has_wait" = "yes"; then
|
|
|
|
echo "Threads library supported."
|
1996-04-03 02:01:15 -08:00
|
|
|
otherlibraries="$otherlibraries threads"
|
|
|
|
else
|
|
|
|
echo "No threads library (missing system calls)"
|
|
|
|
fi
|
|
|
|
|
1996-02-13 08:29:09 -08:00
|
|
|
# Determine the location of X include files and libraries
|
|
|
|
|
|
|
|
x11_include="not found"
|
1996-04-02 00:40:00 -08:00
|
|
|
x11_link="not found"
|
1996-02-13 08:29:09 -08:00
|
|
|
|
1996-06-19 02:43:01 -07:00
|
|
|
for dir in $x11_include_dir \
|
1996-04-01 07:22:44 -08:00
|
|
|
/usr/X11R6/include /usr/X11R5/include /usr/X11R4/include \
|
|
|
|
/usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 \
|
|
|
|
/usr/local/X11R6/include /usr/local/X11R5/include /usr/local/X11R4/include \
|
|
|
|
/usr/local/include/X11R6 /usr/local/include/X11R5 /usr/local/include/X11R4 \
|
|
|
|
/usr/X11/include /usr/include/X11 /usr/local/X11/include \
|
|
|
|
/usr/local/include/X11 /usr/X386/include /usr/x386/include \
|
|
|
|
/usr/XFree86/include/X11 /usr/include /usr/local/include \
|
|
|
|
/usr/unsupported/include /usr/athena/include /usr/local/x11r5/include \
|
1996-06-19 02:43:01 -07:00
|
|
|
/usr/lpp/Xamples/include /usr/openwin/include /usr/openwin/share/include \
|
|
|
|
/opt/X11R6/include /opt/X11R5/include
|
1996-04-01 07:22:44 -08:00
|
|
|
do
|
|
|
|
if test -f $dir/X11/X.h; then
|
1997-03-21 06:23:00 -08:00
|
|
|
x11_include=$dir
|
1996-02-13 08:29:09 -08:00
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
1996-06-19 02:43:01 -07:00
|
|
|
for dir in $x11_lib_dir \
|
1996-04-01 07:22:44 -08:00
|
|
|
/usr/X11R6/lib /usr/X11R5/lib /usr/X11R4/lib \
|
|
|
|
/usr/lib/X11R6 /usr/lib/X11R5 /usr/lib/X11R4 \
|
|
|
|
/usr/local/X11R6/lib /usr/local/X11R5/lib /usr/local/X11R4/lib \
|
|
|
|
/usr/local/lib/X11R6 /usr/local/lib/X11R5 /usr/local/lib/X11R4 \
|
|
|
|
/usr/X11/lib /usr/lib/X11 /usr/local/X11/lib \
|
|
|
|
/usr/local/lib/X11 /usr/X386/lib /usr/x386/lib \
|
|
|
|
/usr/XFree86/lib/X11 /usr/lib /usr/local/lib \
|
|
|
|
/usr/unsupported/lib /usr/athena/lib /usr/local/x11r5/lib \
|
1996-06-19 02:43:01 -07:00
|
|
|
/usr/lpp/Xamples/lib /usr/openwin/lib /usr/openwin/share/lib \
|
|
|
|
/opt/X11R6/lib /opt/X11R5/lib
|
1996-04-01 07:22:44 -08:00
|
|
|
do
|
|
|
|
if test -f $dir/libX11.a || \
|
|
|
|
test -f $dir/libX11.so || \
|
|
|
|
test -f $dir/libX11.sa; then
|
1996-04-02 00:40:00 -08:00
|
|
|
x11_link="-cclib -L$dir -cclib -lX11"
|
1996-02-13 08:29:09 -08:00
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
|
1996-04-02 00:40:00 -08:00
|
|
|
if test "$x11_include" = "not found" || test "$x11_link" = "not found"
|
1996-02-13 08:29:09 -08:00
|
|
|
then
|
1996-06-25 02:27:34 -07:00
|
|
|
echo "X11 not found, the \"graph\" library will not be supported."
|
1996-04-01 07:22:44 -08:00
|
|
|
else
|
1997-03-21 06:23:00 -08:00
|
|
|
echo "Location of X11 include files: $x11_include/X11"
|
1996-04-02 00:40:00 -08:00
|
|
|
echo "Options for linking with X11: $x11_link"
|
1996-04-01 07:22:44 -08:00
|
|
|
otherlibraries="$otherlibraries graph"
|
1997-03-21 06:23:00 -08:00
|
|
|
if test "$x11_include" = "/usr/include"; then
|
|
|
|
x11_include=""
|
|
|
|
else
|
|
|
|
x11_include="-I$x11_include"
|
|
|
|
fi
|
|
|
|
echo "X11_INCLUDES=$x11_include" >> Makefile
|
|
|
|
echo "X11_LINK=$x11_link" >> Makefile
|
1996-04-01 07:22:44 -08:00
|
|
|
fi
|
|
|
|
|
1996-06-12 06:53:43 -07:00
|
|
|
# See if we can compile the dbm library
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot -i ndbm.h
|
1996-06-12 06:53:43 -07:00
|
|
|
then
|
|
|
|
echo "NDBM library found."
|
|
|
|
otherlibraries="$otherlibraries dbm"
|
|
|
|
else
|
1996-06-25 02:27:34 -07:00
|
|
|
echo "NDBM not found, the \"dbm\" library will not be supported."
|
1996-06-12 06:53:43 -07:00
|
|
|
fi
|
|
|
|
|
1996-02-13 08:29:09 -08:00
|
|
|
# Finish generated files
|
|
|
|
|
1996-04-01 07:22:44 -08:00
|
|
|
cclibs="$cclibs -lm"
|
|
|
|
echo "CCLIBS=$cclibs" >> Makefile
|
|
|
|
echo "OTHERLIBRARIES=$otherlibraries" >> Makefile
|
1997-02-23 08:29:36 -08:00
|
|
|
echo "DEBUGGER=$debugger" >> Makefile
|
1996-02-13 08:29:09 -08:00
|
|
|
|
|
|
|
rm -f tst hasgot.c
|
|
|
|
rm -f ../m.h ../s.h ../Makefile
|
|
|
|
mv m.h s.h Makefile ..
|
1996-04-01 07:22:44 -08:00
|
|
|
|
|
|
|
# Print a summary
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo "** Configuration summary **"
|
|
|
|
echo
|
1996-04-30 07:53:58 -07:00
|
|
|
echo "Directories where Objective Caml will be installed:"
|
1996-04-01 07:22:44 -08:00
|
|
|
echo " binaries.................. $bindir"
|
|
|
|
echo " standard library.......... $libdir"
|
|
|
|
echo " manual pages.............. $mandir (with extension .$manext)"
|
|
|
|
|
|
|
|
echo "Configuration for the bytecode compiler:"
|
|
|
|
echo " C compiler used........... $bytecc"
|
|
|
|
echo " options for compiling..... $bytecccompopts"
|
|
|
|
echo " options for linking....... $bytecclinkopts $cclibs"
|
|
|
|
|
|
|
|
echo "Configuration for the native-code compiler:"
|
|
|
|
if test "$arch" = "none"; then
|
|
|
|
echo " (not supported on this platform)"
|
|
|
|
else
|
|
|
|
if test "$model" = "default"; then
|
|
|
|
echo " hardware architecture..... $arch"
|
|
|
|
else
|
|
|
|
echo " hardware architecture..... $arch ($model)"
|
|
|
|
fi
|
|
|
|
if test "$system" = "unknown"; then : ; else
|
|
|
|
echo " OS variant................ $system"
|
|
|
|
fi
|
|
|
|
echo " C compiler used........... $nativecc"
|
|
|
|
echo " options for compiling..... $nativecccompopts"
|
|
|
|
echo " options for linking....... $nativecclinkopts $cclibs"
|
1996-09-18 06:24:56 -07:00
|
|
|
echo " assembler ................ \$(AS) $asflags"
|
|
|
|
echo " preprocessed assembler ... $aspp $asppflags"
|
1996-04-01 07:22:44 -08:00
|
|
|
fi
|
|
|
|
|
1997-02-23 08:29:36 -08:00
|
|
|
if test "$debugger" = "ocamldebugger"; then
|
|
|
|
echo "Source-level replay debugger: supported"
|
|
|
|
else
|
|
|
|
echo "Source-level replay debugger: not supported"
|
|
|
|
fi
|
|
|
|
|
1996-04-01 07:22:44 -08:00
|
|
|
echo "Configuration for the external libraries:"
|
|
|
|
echo " libraries supported....... $otherlibraries"
|
|
|
|
|
1996-04-03 02:01:15 -08:00
|
|
|
echo "The \"num\" library:"
|
|
|
|
echo " target architecture ...... $bignum_arch"
|
|
|
|
|
1996-04-01 07:22:44 -08:00
|
|
|
if test "$x11_include" != "not found" && test "$x11_lib" != "not found"; then
|
|
|
|
echo "The \"graph\" library:"
|
1997-03-21 06:23:00 -08:00
|
|
|
echo " options for compiling .... $x11_include"
|
1996-04-01 07:22:44 -08:00
|
|
|
echo " options for linking ...... $x11_link"
|
|
|
|
fi
|
|
|
|
|