dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.11) AC_INIT(src/parser/main.c) # 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(vl2mvlibdir) AC_ARG_WITH(vl2mv-libdir, [ --with-vl2mv-libdir= Specify directories to search for the vl2mv library and headers. Defaults to \".\". Expects to find /libvl2mv.a], [vl2mvlibdir=$withval], [vl2mvlibdir="."]) # Give the configurer a chance to set a different location for the vl2mv # 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., /parser/main.c], [local_srcdir=$withval], [local_srcdir=$srcdir]) dnl Checks for programs. #---------------------------------------------------------------------- # Checks for programs we need #---------------------------------------------------------------------- AC_PATH_PROG(AR, ar, ar) AC_PROG_RANLIB AC_PROG_AWK AC_PATH_PROG(SED, sed, sed) AC_CANONICAL_SYSTEM AC_SUBST(target) # Balakrisha Kumthekar (kumtheka@colorado.edu): making a special case # for ultrix install, since its 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 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]) if test "$gcc_ok" != no; then case "$gcc_ok" in yes) CC=gcc ;; *) CC=$gcc_ok esac else # 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 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]) if test "$gcc_ok" != no; then use_sixty_four=yes fi # Determine the compiler flags to use DEBUG_CFLAGS="-g" DEBUG_LDFLAGS="" case "$target" in 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) OPTIMIZE_CFLAGS="-O -Aa -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) 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) 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" ;; 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_LN_S AC_PROG_MAKE_SET AC_PATH_PROG(AR, ar, ar) AC_PROG_RANLIB 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=norm -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 dnl Checks for libraries. AC_SUBST(LIBDIRS) # add -lucb to LIBS and set LIBDIRS to -L/usr/ucblib # 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=-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) dnl Replace `main' with a function in -lglu: AC_CHECK_LIB(glu, main) dnl Replace `main' with a function in -lm: AC_CHECK_LIB(m, main) dnl Checks for header files. AC_CHECK_HEADERS(sys/time.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_HEADER_TIME AC_STRUCT_TM dnl Checks for library functions. AC_HEADER_STDC AC_FUNC_STRFTIME AC_FUNC_VPRINTF AC_CHECK_FUNCS(getcwd gettimeofday strstr) AC_OUTPUT(Makefile)