dnl Run autoconf on this file to produce the system configuration dnl script "configure" # FileName [ configure.in ] # # PackageName [ vis ] # # Synopsis [ System configuration script for autoconf ] # # SeeAlso [ Makefile.in ] # # Author [ Stephen Edwards ] # # Copyright [ # Copyright (c) 1994-1996 The Regents of the Univ. of California. # All rights reserved. # # Permission is hereby granted, without written agreement and without license # or royalty fees, to use, copy, modify, and distribute this software and its # documentation for any purpose, provided that the above copyright notice and # the following two paragraphs appear in all copies of this software. # # IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR # DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT # OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF # CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND # FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN # "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE # MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # ] # # Revision [$Id: configure.in,v 1.62 2004/08/20 18:31:32 fabio Exp $] # Require autoconf version 2.11 or above -- it checks to see if the C # compiler actually works! AC_PREREQ(2.11) AC_INIT(src/cmd/cmd.h) # Look for install.sh, config.guess, and config.sub in the "helpers" dir AC_CONFIG_AUX_DIR(helpers) #---------------------------------------------------------------------- # Configuration options #---------------------------------------------------------------------- # Give the configurer a chance to set the location of the GLU tree AC_SUBST(glulibdir) AC_ARG_WITH(glu-libdir, [ --with-glu-libdir= Specify directories to search for the GLU library. Expects to find /libglu.a], [glulibdir=$withval], [glulibdir=""]) AC_SUBST(gluincdir) AC_ARG_WITH(glu-incdir, [ --with-glu-incdir= Specify directories to search for the GLU headers], [gluincdir=$withval], [gluincdir=""]) # Give the configurer a chance to set a different location for the VIS # headers and library AC_SUBST(vislibdir) AC_ARG_WITH(vis-libdir, [ --with-vis-libdir= Specify directories to search for the VIS and headers. Defaults to \".\". Expects to find /libvis.a], [vislibdir=$withval], [vislibdir="."]) # Give the configurer a chance to set a different location for the VIS # source. When specified, "srcdir" points to "master" source, and # "local_srcdir" points to the source under local development. AC_SUBST(local_srcdir) AC_ARG_WITH(local-srcdir, [ --with-local-srcdir= Specify the root directory to search for source for packages (the PKGS list). Expects to find, e.g., /tbl/tbl.c], [local_srcdir=$withval], [local_srcdir=$srcdir]) # Give the configurer a chance to set the BDD library AC_SUBST(BDDLIB) AC_ARG_WITH(bdd, [ --with-bdd= Specify the BDD library to link against. Defaults to --with-bdd=cu.], [BDDLIB=$withval], [BDDLIB=cu]) #---------------------------------------------------------------------- # Checks for programs we need #---------------------------------------------------------------------- AC_PATH_PROG(ZCHAFF,zchaff) AC_PATH_PROG(AR, ar, ar) AC_PROG_RANLIB AC_CANONICAL_SYSTEM AC_SUBST(target) # Determine the name of the C compiler we're going to use AC_ARG_ENABLE(gcc, [ --enable-gcc Allow use of gcc if available], [gcc_ok=$enableval], [gcc_ok=no]) # We cannot set CC=g++ directly because many configuration test programs # do not compile with g++. Hence, when the user specifies --enable-gcc=g++, # we set CC=gcc during configuration, and then CC=g++ at the end. # The same applies to icpc and icc. if test "$gcc_ok" != no; then case "$gcc_ok" in yes | g++) CC=gcc ;; icpc) CC=icc ;; *) CC=$gcc_ok esac else if test -z "$CC" ; then # Balakrishna Kumthekar # As we do not support cc on RS6000, Cygwin and SunOS. case "$target" in rs6000-ibm-aix* | *-pc-cygwin32 | sparc-sun-sunos*) CC=gcc ;; *) CC=cc ;; esac fi fi AC_PROG_CC AC_ARG_ENABLE(64, [ --enable-64 Use 64-bit pointers on 64-bit Alpha machines], [use_sixty_four=$enableval], [use_sixty_four=no]) # Gcc does not support 32-bit pointers on the Alphas. if test "$gcc_ok" != no; then use_sixty_four=yes fi # Roderick Bloem (rbloem@colorado.edu): making a special case for # ultrix install, since it's annoying about setting groupids. case "$target" in mips-dec-ultrix*) INSTALL="helpers/install-sh -c" INSTALL_PROGRAM="\${INSTALL}" INSTALL_DATA="\${INSTALL} -m 644";; *) AC_PROG_INSTALL ;; esac # Determine the compiler flags to use DEBUG_CFLAGS="-g" DEBUG_LDFLAGS="" case "$target" in i686-pc-linux-gnu) # Linux with Intel compiler # -ansi: ANSI C conformance # -ip: inter-procedural optimization OPTIMIZE_CFLAGS="-g -O3 -ansi -ip" ;; sparc-sun-solaris* | i386-pc-solaris*) # Sparc and X86 Solaris: # -xO3: Highest safe level of optimization # -native: Optimize for the native processor (if supported) # -dalign: Generate double-word load/store for performance # (only for SPARC) # and other arcane compilation flags. if test "$GCC" = yes; then OPTIMIZE_CFLAGS="-O" else case "$target" in sparc-sun-solaris*) ALIGN=" -dalign" ;; *) ALIGN="" ;; esac AC_MSG_CHECKING([for -native]) CFLAGS="-xO3 -native$ALIGN" AC_CACHE_VAL(ac_cv_have_native, [ AC_TRY_RUN([ main(){exit(0);} ],ac_cv_have_native=yes,ac_cv_have_native=no,ac_cv_have_native=no)]) if test $ac_cv_have_native = yes ; then AC_MSG_RESULT(working) OPTIMIZE_CFLAGS="-xO3 -native$ALIGN" else AC_MSG_RESULT(broken) AC_MSG_CHECKING([for fallback optimization flags]) CFLAGS="-xO3 -fns -fsimple=2$ALIGN -ftrap=%none -xlibmil" AC_CACHE_VAL(ac_cv_have_fallback, [ AC_TRY_RUN([ main(){exit(0);} ],ac_cv_have_fallback=yes,ac_cv_have_fallback=no,ac_cv_have_fallback=no)]) if test $ac_cv_have_fallback = yes ; then AC_MSG_RESULT(working) OPTIMIZE_CFLAGS="-xO3 -fns -fsimple=2$ALIGN -ftrap=%none -xlibmil" else AC_MSG_RESULT(broken) OPTIMIZE_CFLAGS="-O" fi fi fi ;; mips-dec-ultrix*) # MIPS-based DECstations running Ultrix: # -std1: Produce non-ANSI code warnings, and define __STDC__ # -O: Use the global "ucode" optimizer # -Olimit 5000: Don't optimize routines bigger than 5000 basic blocks OPTIMIZE_CFLAGS="-std1 -O -Olimit 5000" ;; alpha-dec-osf*) # DEC Alpha running OSF: # 64-bit mode: # -g3: Produce symbol table information for optimized code # -O4: Enable every optimization # -std: Enforce the ANSI standard with extensions, define __STDC__ # -ieee_with_no_inexact: Disable (potentially slow) signaling # for inexact floating-point results # -tune host: Tune instructions for the compilation host machine OPTIMIZE_CFLAGS="-g3 -O4 -std -ieee_with_no_inexact -tune host" DEBUG_CFLAGS="-g -std -ieee_with_no_inexact" # -non_shared: Do not use shared libraries # -om: Generate an OMAGIC file for the om optimizer OPTIMIZE_LDFLAGS="-non_shared" if test "$use_sixty_four" = "no"; then # 32-bit mode: # -xtaso: Make the compiler respond to #pragma pointer_size directives OPTIMIZE_CFLAGS="$OPTIMIZE_CFLAGS -xtaso" DEBUG_CFLAGS="$DEBUG_CFLAGS -xtaso" # -taso: Load the executable into the lower 31-bit address space OPTIMIZE_LDFLAGS="$OPTIMIZE_LDFLAGS -om -taso" DEBUG_LDFLAGS="$DEBUG_LDFLAGS -taso" AC_DEFINE(SIZEOF_VOID_P, 4) ac_sizeof_voidp=4 fi ;; hppa*-*-hpux*) # HP running HPUX # -Aa: Behave as an ANSI compiler # -D_HPUX_SOURCE: Include "HP-specific" symbols in the header # files (e.g., this means sys/resource.h has struct rusage) # +Onolimit: removes resource restrictions for optimization OPTIMIZE_CFLAGS="-O -Aa +Onolimit -D_HPUX_SOURCE" DEBUG_CFLAGS="-g -Aa -D_HPUX_SOURCE" ;; *) # Other systems: OPTIMIZE_CFLAGS="-O" ;; esac if test "$GCC" = yes; then case "$target" in i686-pc-linux-gnu | i386-pc-solaris* | i386-pc-cygwin32 | i386-*-freebsd*) AC_MSG_CHECKING([for -mcpu and -malign compiler options]) CFLAGS="-g -O6 -mcpu=pentiumpro -malign-double" AC_TRY_COMPILE(,,ac_have_mcpu=yes,ac_have_mcpu=no) if test "$ac_have_mcpu" = yes; then AC_MSG_RESULT(working) OPTIMIZE_CFLAGS="-g -O6 -mcpu=pentiumpro -malign-double" else AC_MSG_RESULT(broken) OPTIMIZE_CFLAGS="-g -O3" fi ;; sparc-sun-solaris*) AC_MSG_CHECKING([for -mtune compiler option]) CFLAGS="-g -O6 -mtune=ultrasparc" AC_TRY_COMPILE(,,ac_have_mtune=yes,ac_have_mtune=no) if test "$ac_have_mtune" = yes; then AC_MSG_RESULT(working) OPTIMIZE_CFLAGS="-g -O6 -mtune=ultrasparc" else AC_MSG_RESULT(not working) OPTIMIZE_CFLAGS="-g -O3" fi ;; *) OPTIMIZE_CFLAGS="-g -O3" ;; esac OPTIMIZE_LDFLAGS="" DEBUG_CFLAGS="-g" DEBUG_LDFLAGS="" fi AC_ARG_WITH(comp-mode, [ --with-comp-mode= Specify a special compilation mode: optimize (the default): Produce optimized code, with symbol table information if supported on the platform/compiler, and without asserts. debug: Produce unoptimized code with symbol table information and asserts enabled purify: Unoptimized code linked with purify quantify: Optimized code without asserts linked with quantify], [comp_mode=$withval], [comp_mode=optimize]) AC_SUBST(LINKER) AC_SUBST(PLINKER) LINKER="$CC" case "$comp_mode" in debug) CFLAGS="$DEBUG_CFLAGS" LDFLAGS="$DEBUG_LDFLAGS" ;; purify) CFLAGS="$DEBUG_CFLAGS" LDFLAGS="$DEBUG_LDFLAGS" AC_DEFINE(PURIFY) LINKER="purify -cache-dir=/tmp $CC" PLINKER="purify -log-file=./purify.log -cachedir=/tmp $CC" ;; quantify) CFLAGS="$OPTIMIZE_CFLAGS" LDFLAGS="$OPTIMIZE_LDFLAGS" AC_DEFINE(QUANTIFY) AC_DEFINE(NDEBUG) LINKER="quantify $CC" ;; optimize | *) CFLAGS="$OPTIMIZE_CFLAGS" LDFLAGS="$OPTIMIZE_LDFLAGS" AC_DEFINE(NDEBUG) ;; esac AC_PROG_LEX AC_MSG_CHECKING(if $LEX accepts the -o and -P options) AC_CACHE_VAL(ac_cv_flex_accepts_op, [ ac_cv_flex_accepts_op=yes ; echo "%%\ %%" | $LEX -Ptest -o/dev/null >/dev/null 2>&1 || ac_cv_flex_accepts_op=no ]) if test $ac_cv_flex_accepts_op = yes ; then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) AC_MSG_WARN([You either need a newer version of flex, or need to modify the defintion of LEX in the Makefile to point to a version that does accept -p -t and -o.]) fi AC_PROG_YACC AC_MSG_CHECKING([if $YACC accepts the -p, -t, and -o options]) AC_CACHE_VAL(ac_cv_yacc_accepts_pto, [ ac_cv_yacc_accepts_pto=yes ; echo "%token terminal\ %%\ nonterminal: terminal\ %%" > config.in $YACC -ptest -o /dev/null config.in >/dev/null 2>&1 || ac_cv_yacc_accepts_pto=no rm -f config.in ]) if test $ac_cv_yacc_accepts_pto = yes ; then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) AC_MSG_WARN([You either need a newer version of bison, or need to modify the defintion of YACC in the Makefile to point to a version that does accept -p -t and -o.]) fi #---------------------------------------------------------------------- # Checks for headers and libraries #---------------------------------------------------------------------- AC_HEADER_STDC AC_SUBST(LIBDIRS) # add -lucb to LIBS and -L/usr/ucblib to LIBDIRS # if there's a libucb.a available # (Solaris needs this for signals) ac_save_ldflags="$LDFLAGS" LDFLAGS=-L/usr/ucblib AC_CHECK_LIB(ucb,main,LIBDIRS="$LIBDIRS -L/usr/ucblib") LDFLAGS="$ac_save_ldflags" # add -lbsd if there's a libbsd.a available # (e.g., Linux needs this for bsd_ioctl) AC_CHECK_LIB(bsd,main) # Check if libreadline exists and the function readline can be used. # This implies checking for the availability of libtermcap or of a # suitable replacement. (We only look for libncurses.) AC_CACHE_VAL(vis_cv_termcap_lib, [AC_CHECK_LIB(termcap, tgetent, vis_cv_termcap_lib=-ltermcap, [AC_CHECK_LIB(ncurses, tgetent, vis_cv_termcap_lib=-lncurses, bash_cv_termcap_lib=none)])]) if test "$vis_cv_termcap_lib" != none; then AC_CHECK_LIB(readline, readline, ac_readline_flag=1, ac_readline_flag=0, $vis_cv_termcap_lib) if test $ac_readline_flag = 1 ; then LIBS="$LIBS -lreadline $vis_cv_termcap_lib" ; AC_DEFINE(HAVE_LIBREADLINE) fi fi # Check for the dirent header file, which is quite a mess AC_HEADER_DIRENT # Check for these system header files AC_CHECK_HEADERS(sys/termios.h sys/ioctl.h sys/time.h signal.h sys/signal.h readline/readline.h readline/history.h) # This is for Linux AC_CHECK_HEADERS(bsd/sgtty.h) # Some systems want both sys/ioctl.h and sys/termios.h, but others can # only have one -- check for that AC_MSG_CHECKING(whether sys/termios.h and sys/ioctl.h should both be included) AC_CACHE_VAL(ac_cv_ioctl_with_termios, [AC_TRY_CPP([ #include #include ], ac_cv_ioctl_with_termios=1, ac_cv_ioctl_with_termios=0 )]) if test $ac_cv_ioctl_with_termios = 1 ; then AC_MSG_RESULT(yes) ; AC_DEFINE(IOCTL_WITH_TERMIOS) else AC_MSG_RESULT(no) fi # cmdFile.c wants to be able to use TIOCGETC to do file completion, # but some systems (e.g., HPUX) don't have this # AC_MSG_CHECKING(for TIOCGETC) AC_CACHE_VAL(ac_cv_have_ioctl_with_tiocgetc, [if test $ac_cv_ioctl_with_termios = 1 ; then AC_EGREP_CPP(yes, [#include #include #ifdef TIOCGETC yes #endif], ac_cv_have_ioctl_with_tiocgetc=yes, ac_cv_have_ioctl_with_tiocgetc=no) else AC_EGREP_CPP(yes, [#include #ifdef TIOCGETC yes #endif], ac_cv_have_ioctl_with_tiocgetc=yes, ac_cv_have_ioctl_with_tiocgetc=no) fi]) if test $ac_cv_have_ioctl_with_tiocgetc = "yes" ; then AC_MSG_RESULT(yes) ; AC_DEFINE(HAVE_IOCTL_WITH_TIOCGETC) else AC_MSG_RESULT(no) fi # # cmdFile.c wants to turn off interrupts, but some systems don't # # seem to know how to do that using TIOCLBIS # # # # This is probably fairly fragile, and it's probably cmdFile.c that should # # be fixed # # # # This has been very unreliable (e.g., on Solaris), so the facility has # # been turned off # # if test $ac_cv_have_ioctl_with_tiocgetc = "yes" ; then # # AC_MSG_CHECKING(for TIOCLBIS) # # AC_CACHE_VAL(ac_cv_have_term_interrupts, # [AC_EGREP_CPP(yes, # [#include # #include # #ifdef TIOCLBIS # yes # #endif # ], ac_cv_have_term_interrupts=1, # ac_cv_have_term_interrupts=0 )]) # # if test $ac_cv_have_term_interrupts = 1 ; then # AC_MSG_RESULT(yes) ; AC_DEFINE(HAVE_TERM_INTERRUPTS) # else # AC_MSG_RESULT(no) # fi # # fi # ac_cv_have_ioctl_with_tiocgetc #---------------------------------------------------------------------- # Checks for typedefs, structures, and compiler characteristics. #---------------------------------------------------------------------- # Check to see if the compiler understands "const" # #define it empty otherwise AC_C_CONST # Sort out "time.h" nonsense AC_HEADER_TIME AC_STRUCT_TM # Set RETSIGTYPE to the proper return type for a signal handler (void or int) AC_TYPE_SIGNAL # Roderick Bloem (rbloem@colorado.edu) : On Irix we need ttold case "$target" in mips-sgi-irix*) AC_DEFINE(NEED_TTOLD);; esac #---------------------------------------------------------------------- # Checks for library functions. #---------------------------------------------------------------------- AC_PROG_GCC_TRADITIONAL AC_FUNC_MEMCMP AC_TYPE_SIGNAL AC_CHECK_FUNCS(gettimeofday strchr strstr setvbuf getenv unlink mkstemp close) #----------------------------------------------------------------------- # Check for mawk, gawk, nawk, awk in that order #----------------------------------------------------------------------- AC_PROG_AWK #---------------------------------------------------------------------- # Create the Makefile from Makefile.in #---------------------------------------------------------------------- if test "$gcc_ok" = "g++"; then CC=$gcc_ok fi AC_OUTPUT(Makefile)