dnl Copyright (c)1994-2000 Begemot Computer Associates. All rights reserved. dnl See the file COPYRIGHT for details of redistribution and use. dnl $Id: configure.in,v 1.12 2000/03/04 08:03:27 hbb Exp $ AC_INIT(Config/install.sh) AC_CONFIG_AUX_DIR(Config) AC_CANONICAL_SYSTEM AC_PROG_MAKE_SET AC_PROG_CC AC_PROG_CPP AC_PROG_INSTALL AC_C_BIGENDIAN AC_PROG_LIBTOOL AC_SUBST(LIBTOOL_DEPS) dnl ******************************************************************** dnl dnl Define a couple of useful functions dnl dnl ******************************************************************** dnl dnl Find one of a list of files in a list of directories dnl $1 - list of possible file names dnl $2 - list of directories dnl $3 - variable name to set file name to dnl $4 - variable name to set directory to AC_DEFUN(FU_FIND_FILES, [ for file in $1; do for dir in $2; do if test -f $dir/$file ; then $3=$dir $4=$file break 2 fi done done ]) AC_DEFUN(FU_FIND_FILE_IN_DIR, [ FU_FIND_FILES($1, $2, $3, dummy) if test "$$3" = "" ; then AC_ERROR([$1 not found in $2; try $4]) fi ]) AC_DEFUN(FU_FIND_FILE_IN_DIR_NAME, [ FU_FIND_FILES($1, $2, $3, $4) if test "$$3" = "" ; then AC_ERROR([$1 not found in $2; try $5]) fi ]) AC_DEFUN(FU_REQUIRE_FILE_IN_DIR, [ FU_FIND_FILES($1, $2, $3, dummy) if test "$$3" = "" ; then AC_ERROR([$1 not found in $2]) fi ]) AC_ARG_ENABLE(debug, [ --disable-debug Disable debug symbols in executables.], if test "$enableval" = "no" ; then DBGFLAGS= fi, DBGFLAGS=-g LDFLAGS="$LDFLAGS -g" ) AC_SUBST(DBGFLAGS) AC_ARG_ENABLE(warnings, [ --enable-warnings=FLAGS Enable compiler warnings (default is -Wall -Wimplicit -Wformat).], WFLAGS=$enableval, WFLAGS="-Wall -Wimplicit -Wformat" ) AC_SUBST(WFLAGS) AC_ARG_ENABLE(optimisation, [ --enable-optimisation=FLAGS Set compiler optimisation flags to FLAGS. Default is -O2 -fomit-frame-pointer.], COPT=$enableval, COPT="-O2 -fomit-frame-pointer" ) AC_SUBST(COPT) AC_ARG_ENABLE(fpp, [ --disable-fpp Build a processor without fpp.], if test "$enableval" != "no"; then AC_DEFINE(FPP) fi, AC_DEFINE(FPP) ) AC_ARG_ENABLE(regs, [ --disable-regs Disable usage of global register variables on certain architectures (i386 and sparc). Use of register variables may speed up emulation.], use_regs=$enableval, use_regs=yes ) if test "$use_regs" != "no" ; then AC_CACHE_CHECK([whether to use register variables], ac_cv_use_registers,[ case "$target_cpu" in i?86) ac_cv_use_registers=yes;; sparc*) ac_cv_use_registers=yes;; *) ac_cv_use_registers=no;; esac ]) if test "$ac_cv_use_registers" = "yes" ; then AC_DEFINE(USE_REGISTERS) fi fi dnl ******************************************************************** dnl dnl Find the begemot library dnl dnl ******************************************************************** begemot_dir="/usr/local/include /home/include /usr/include /usr/begemot/include /usr/local/begemot/include" AC_ARG_WITH(begemot, [ --with-begemot=DIR location where begemot header files and libraries are found. ], begemot_dir=$withval) AC_CACHE_CHECK([checking for begemot.h], ac_cv_begemot_include, [ FU_FIND_FILE_IN_DIR( include/begemot.h, $begemot_dir, ac_cv_begemot_include, --with-begemot) ]) BEGEMOT_INCLUDE=$ac_cv_begemot_include/include AC_SUBST(BEGEMOT_INCLUDE) AC_CACHE_CHECK([checking for -lbegemot], ac_cv_begemot_libdir, [ FU_FIND_FILE_IN_DIR( lib/libbegemot.so lib/libbegemot.a, $begemot_dir, ac_cv_begemot_libdir, --with-begemot) ]) BEGEMOT_LIBDIR=$ac_cv_begemot_libdir/lib AC_SUBST(BEGEMOT_LIBDIR) dnl ********************************************************************** dnl dnl Check, whether the assembler is available and produces the right files. dnl dnl ********************************************************************** AC_ARG_WITH(as11, [ --with-as11=FILE Use FILE as the pdp11 assembler to assemble boot and test codes. Configure tries to check whether this is the right assembler. If not given than as11 is searched in the current path. Disable assembling by setting FILE to no or with --without-as11.], as11=$withval, as11="" ) if test "$as11" = "" ; then AC_PATH_PROG(as11, as11, no) fi if test "$as11" = "no" ; then as11="" fi if test "$as11" != "" ; then AC_CACHE_CHECK([checking the pdp11 assembler], ac_cv_as11,[ ac_cv_as11="broken" rm -f config.s11 config.11 cat <config.s11 . = 173000 reset mov #2000, r6 mov #177440, r5 EMU eval $as11 -o config.11 config.s11 2>&5 1>&5 cmp config.11 - 1>&5 2>&5 <<'EMU' f600 000a 05 00 c6 15 00 04 c5 15 20 ff EMU if test $? -eq 0; then ac_cv_as11=ok fi rm -f config.s11 config.11 ]) if test "$ac_cv_as11" != "ok" ; then as11="" fi fi if test "$as11" = "" ; then AS11= else AS11=$as11 fi AC_SUBST(AS11) dnl ********************************************************************** dnl dnl Check which ethernet interfaces we can build dnl dnl ********************************************************************** EPP_TARGETS="" AC_SUBST(EPP_TARGETS) AC_CACHE_CHECK([check whether to build epp_fifo], ac_cv_epp_fifo, AC_TRY_RUN([ # include # include int main() { return mkfifo("config.fifo", 0777); }], rm -f config.fifo ac_cv_epp_fifo=yes, ac_cv_epp_fifo=no, ac_cv_epp_fifo=no ) ) if test "$ac_cv_epp_fifo" = "yes" ; then EPP_TARGETS="$EPP_TARGETS epp_fifo" fi AC_CACHE_CHECK([check whether to build epp_bpf], ac_cv_epp_bpf, ac_cv_epp_bpf=no if test -b /dev/bpf0 ; then ac_cv_epp_bpf=yes fi if test -c /dev/bpf0 ; then ac_cv_epp_bpf=yes fi ) if test "$ac_cv_epp_bpf" = "yes" ; then EPP_TARGETS="$EPP_TARGETS epp_bpf" fi AC_CACHE_CHECK([check whether to build epp_tun], ac_cv_epp_tun, ac_cv_epp_tun=no if test -b /dev/tun0 ; then ac_cv_epp_tun=yes fi if test -c /dev/tun0 ; then ac_cv_epp_tun=yes fi ) if test "$ac_cv_epp_tun" = "yes" ; then EPP_TARGETS="$EPP_TARGETS epp_tun" fi AC_CACHE_CHECK([check whether to build epp_tap], ac_cv_epp_tap, ac_cv_epp_tap=no if test -b /dev/tap0 ; then ac_cv_epp_tap=yes fi if test -c /dev/tap0 ; then ac_cv_epp_tap=yes fi ) if test "$ac_cv_epp_tap" = "yes" ; then EPP_TARGETS="$EPP_TARGETS epp_tap" fi dnl Well, that's a pain - tap/tun need different header files on FreeBSD dnl and Linux! if test "$ac_cv_epp_tun" = "yes" -o "$ac_cv_epp_tap" = "yes"; then AC_CHECK_HEADERS(net/if_var.h) AC_CHECK_HEADERS(net/if_tap.h) fi dnl ********************************************************************** dnl dnl Find socket() dnl dnl ********************************************************************** AC_CHECK_LIB(xnet, socket, LIB_SOCKET="-lxnet", AC_CHECK_LIB(socket, socket, LIB_SOCKET="-lsocket -lnsl")) AC_SUBST(LIB_SOCKET) dnl ********************************************************************** dnl dnl Lock for the sin_len field. dnl dnl ********************************************************************** AC_CACHE_CHECK([check for sin_len in struct sockaddr_in], ac_cv_sin_len, AC_EGREP_HEADER(sin_len, netinet/in.h, ac_cv_sin_len=yes, ac_cv_sin_len=no) ) if test "$ac_cv_sin_len" = "yes"; then AC_DEFINE(HAVE_SIN_LEN) fi AC_CHECK_HEADERS(paths.h) dnl ********************************************************************** dnl dnl Do we have STREAMS? We can't simply test for stropts.h, because f... dnl Linux has one, but no STREAMS! dnl dnl ********************************************************************** AC_CHECK_HEADER(sys/stream.h, AC_DEFINE(HAVE_STREAMS) have_streams=1) AC_CHECK_FUNCS(cfmakeraw bzero bcopy) AC_CACHE_CHECK([checking for third argument to msync], ac_cv_msync3, AC_EGREP_CPP(yes,[ # include # include # ifdef MS_SYNC yes # endif ], ac_cv_msync3=yes, ac_cv_msync3=no ) ) if test "$ac_cv_msync3" = "yes" ; then AC_DEFINE(HAVE_MS_SYNC) fi if test "$have_streams" = "" ; then AC_CACHE_CHECK([checking for O_ASYNC in fcntl], ac_cv_o_async, AC_EGREP_CPP(yes, [ # include # ifdef O_ASYNC yes # endif ], ac_cv_o_async=yes, ac_cv_o_async=no ) ) if test "$ac_cv_o_async" = "yes"; then AC_DEFINE(HAVE_O_ASYNC) fi fi dnl ********************************************************************** dnl dnl Check for SIGINFO, use SIGUSR2 instead. dnl dnl ********************************************************************** AC_CACHE_CHECK([check for SIGINFO], ac_cv_siginfo, AC_EGREP_CPP(yes, [#include # ifdef SIGINFO yes #endif ], ac_cv_siginfo=yes, ac_cv_siginfo=no)) if test "$ac_cv_siginfo" != "yes" ; then AC_DEFINE(SIGINFO, SIGUSR2) fi dnl ********************************************************************** dnl dnl Look for ulong and uint dnl dnl ********************************************************************** changequote(<<,>>) pat_ulong="[^a-zA-Z]ulong[^a-zA-Z0-9_]" pat_uint="[^a-zA-Z]uint[^a-zA-Z0-9_]" pat_uchar="[^a-zA-Z]uchar[^a-zA-Z0-9_]" changequote([,]) AC_CACHE_CHECK([check for typedef of ulong], ac_cv_ulong, AC_EGREP_HEADER($pat_ulong,sys/types.h,ac_cv_ulong=yes,ac_cv_ulong=no) ) if test "$ac_cv_ulong" = "yes"; then AC_DEFINE(HAVE_ULONG) fi AC_CACHE_CHECK([check for typedef of uint], ac_cv_uint, AC_EGREP_HEADER($pat_uint, sys/types.h, ac_cv_uint=yes, ac_cv_uint=no) ) if test "$ac_cv_uint" = "yes"; then AC_DEFINE(HAVE_UINT) fi AC_CACHE_CHECK([check for typedef of uchar], ac_cv_uchar, AC_EGREP_HEADER($pat_uchar, sys/types.h,ac_cv_uchar=yes,ac_cv_uchar=no) ) if test "$ac_cv_uchar" = "yes"; then AC_DEFINE(HAVE_UCHAR) fi AC_PATH_PROG(path_xterm, xterm, /usr/X11/bin/xterm, $PATH:/usr/X11/bin/xterm:/usr/openwin/bin/xterm:/usr/X11R6/xterm) AC_DEFINE_UNQUOTED(_PATH_XTERM, "$path_xterm") dnl ********************************************************************** dnl dnl Determine, which instruction code to use. dnl dnl ********************************************************************** AC_ARG_WITH(ins, [ --with-ins=ARG Specifies which code to use for instruction emulation. Default is assembler code on sparc and i386, generic on others. ARG may be 'generic' or 'as'.], use_ins=$withval, use_ins=check ) AC_MSG_CHECKING([which emulation code to use]) if test "$use_ins" = "check" ; then case "$target_cpu" in i?86) use_ins=i386-assembler AC_DEFINE(INS_I386);; sparc*) use_ins=sparc-assembler AC_DEFINE(INS_SPARC);; *) use_ins=generic AC_DEFINE(INS_GENERIC);; esac elif test "$use_ins" = "generic" ; then use_ins=generic AC_DEFINE(INS_GENERIC) elif test "$use_ins" = "as" ; then case "$target_cpu" in i?86) use_ins=i386-assembler AC_DEFINE(INS_I386);; sparc*) use_ins=sparc-assembler AC_DEFINE(INS_SPARC);; *) AC_ERROR([no assembler code for this architecture]);; esac else AC_ERROR([bad argument for --with-ins]) fi AC_MSG_RESULT($use_ins) AC_ARG_WITH(float, [ --with-float=ARG Specifies which code to use for FPP instruction emulation. Default is assembler code on sparc and i386, generic on others. ARG may be 'generic', 'as' or 'qlib'.], use_ins=$withval, use_ins=check ) AC_MSG_CHECKING([which FPP emulation code to use]) if test "$use_ins" = "check" ; then case "$target_cpu" in i?86) use_ins=i386-assembler AC_DEFINE(FLOAT_I386);; sparc*) use_ins=sparc-assembler AC_DEFINE(FLOAT_SPARC);; *) use_ins=generic AC_DEFINE(FLOAT_GENERIC);; esac elif test "$use_ins" = "generic" ; then use_ins=generic AC_DEFINE(FLOAT_GENERIC) elif test "$use_ins" = "as" ; then case "$target_cpu" in i?86) use_ins=i386-assembler AC_DEFINE(FLOAT_I386);; sparc*) use_ins=sparc-assembler AC_DEFINE(FLOAT_SPARC);; *) AC_ERROR([no FPP assembler code for this architecture]);; esac elif test "$use_ins" = "qlib" ; then case "$target_cpu" in sparc*) use_ins=qlib AC_DEFINE(FLOAT_QLIB);; *) AC_ERROR([qlib is available only on the sparc]);; esac else AC_ERROR([bad argument for --with-float]) fi AC_MSG_RESULT($use_ins) AC_DEFINE_UNQUOTED(SYSTEMS, "$target_os") AC_DEFINE_UNQUOTED(PROCS, "$target_cpu") MKDEF=Config/Makefile.pre MKC=Config/Makefile.c MKCLEAN=Config/Makefile.clean POST="$MKC:$MKCLEAN" AC_OUTPUT( Makefile:$MKDEF:Makefile.in:$MKC Utils/Makefile:$MKDEF:Utils/Makefile.in:$POST Misc/Makefile:$MKDEF:Misc/Makefile.in:$POST IOProgs/Makefile:$MKDEF:IOProgs/Makefile.in:$POST libutil/Makefile:$MKDEF:libutil/Makefile.in:$POST Boot/Makefile:$MKDEF:Boot/Makefile.in:$MKCLEAN Tests/Makefile:$MKDEF:Tests/Makefile.in:$MKCLEAN, [ changequote({,}) dnl The following is necessary on (at last some versions of) Linux: they dnl seem to have a problem with their caches. The find sees a link count of 2 dnl on the current directory if all files were freshly created and doesn't stat dnl the files (this is an optimisation for that case), so it will never under- dnl stand, that there are a couple of directories in there. The touch seems to dnl flush one of the caches out. touch . for i in `find . -name Makefile` ; do dirname=`dirname $i | sed -e 's%/[^/][^/]*%/..%g' -e 's%^[^/.]*/%../%' -e 's%^\./%%'` ed $i 2>/dev/null >/dev/null <