dnl Run autoconf on this file to produce the system configuration dnl script "configure" # FileName [ configure.in ] # # PackageName [ cusp ] # # 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.7 2009-04-13 18:44:51 hhkim 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/sat/sat.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 a different location for the CUSP # 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]) #---------------------------------------------------------------------- # Checks for programs we need #---------------------------------------------------------------------- AC_PATH_PROG(AR, ar, ar) AC_PROG_RANLIB AC_CANONICAL_TARGET AC_SUBST(target) # Determine the name of the C compiler we're going to use AC_ARG_ENABLE(times-resolution, [ --enable-times-resolution= Set the resolution of the times() function (only necessary for non-POSIX systems).], [AC_DEFINE_UNQUOTED(CLOCK_RESOLUTION,$enableval)], [AC_DEFINE_UNQUOTED(CLOCK_RESOLUTION,60)]) 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. if test "$gcc_ok" != no; then case "$gcc_ok" in yes | g++) CC=gcc ;; *) 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 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 ;; 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 -static -fno-strict-aliasing" 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 -static -fno-strict-aliasing" 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], [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" ;; 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 # Define HAVE_SYS_WAIT_H if sys/wait.h exists and is POSIX-compliant AC_HEADER_SYS_WAIT 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" # Check for gmp library AC_CHECK_LIB(gmp, __gmpz_init, , [AC_MSG_WARN([GNU MP not found, see http://gmplib.org/])]) # Check for these system header files AC_CHECK_HEADERS(sys/file.h sys/stat.h unistd.h errno.h sys/wait.h pwd.h sys/types.h sys/times.h sys/time.h signal.h sys/signal.h) # Check for gmp header file AC_CHECK_HEADERS(/usr/include/gmp.h) #---------------------------------------------------------------------- # 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 #---------------------------------------------------------------------- # Checks for library functions. #---------------------------------------------------------------------- AC_PROG_GCC_TRADITIONAL AC_FUNC_MEMCMP AC_TYPE_SIGNAL AC_CHECK_FUNCS(gettimeofday sysconf 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)