source: vis_dev/cusp-1.1/configure.in @ 26

Last change on this file since 26 was 12, checked in by cecile, 13 years ago

cusp added

  • Property svn:executable set to *
File size: 11.8 KB
RevLine 
[12]1dnl     Run autoconf on this file to produce the system configuration
2dnl     script "configure"
3
4# FileName      [ configure.in ]
5#
6# PackageName   [ cusp ]
7#
8# Synopsis      [ System configuration script for autoconf ]
9#
10# SeeAlso       [ Makefile.in ]
11#
12# Author        [ Stephen Edwards <sedwards@eecs.berkeley.edu> ]
13#
14# Copyright     [
15#  Copyright (c) 1994-1996 The Regents of the Univ. of California.
16#  All rights reserved.
17#
18#  Permission is hereby granted, without written agreement and without license
19#  or royalty fees, to use, copy, modify, and distribute this software and its
20#  documentation for any purpose, provided that the above copyright notice and
21#  the following two paragraphs appear in all copies of this software.
22#
23#  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
24#  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
25#  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
26#  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27#
28#  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
29#  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
30#  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
31#  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
32#  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
33#  ]
34#
35# Revision      [$Id: configure.in,v 1.7 2009-04-13 18:44:51 hhkim Exp $]
36 
37# Require autoconf version 2.11 or above -- it checks to see if the C
38# compiler actually works!
39
40AC_PREREQ(2.11)
41
42AC_INIT(src/sat/sat.c)
43
44# Look for install.sh, config.guess, and config.sub in the "helpers" dir
45AC_CONFIG_AUX_DIR(helpers)
46
47#----------------------------------------------------------------------
48# Configuration options
49#----------------------------------------------------------------------
50
51# Give the configurer a chance to set a different location for the CUSP
52# source.  When specified, "srcdir" points to "master" source, and
53# "local_srcdir" points to the source under local development.
54
55AC_SUBST(local_srcdir)
56AC_ARG_WITH(local-srcdir,
57[  --with-local-srcdir=<srcdir> Specify the root directory to search for
58                          source for packages (the PKGS list).
59                          Expects to find, e.g., <srcdir>/tbl/tbl.c],
60[local_srcdir=$withval],
61[local_srcdir=$srcdir])
62
63#----------------------------------------------------------------------
64# Checks for programs we need
65#----------------------------------------------------------------------
66AC_PATH_PROG(AR, ar, ar)
67AC_PROG_RANLIB
68
69AC_CANONICAL_TARGET
70AC_SUBST(target)
71
72# Determine the name of the C compiler we're going to use
73AC_ARG_ENABLE(times-resolution, [  --enable-times-resolution=<hertz>
74                          Set the resolution of the times() function (only
75                          necessary for non-POSIX systems).],
76        [AC_DEFINE_UNQUOTED(CLOCK_RESOLUTION,$enableval)],
77        [AC_DEFINE_UNQUOTED(CLOCK_RESOLUTION,60)])
78
79
80AC_ARG_ENABLE(gcc,
81  [  --enable-gcc            Allow use of gcc if available],
82  [gcc_ok=$enableval], [gcc_ok=no])
83
84# We cannot set CC=g++ directly because many configuration test programs
85# do not compile with g++.  Hence, when the user specifies --enable-gcc=g++,
86# we set CC=gcc during configuration, and then CC=g++ at the end.
87if test "$gcc_ok" != no; then
88  case "$gcc_ok" in
89    yes | g++)
90      CC=gcc ;;
91    *)
92      CC=$gcc_ok
93  esac
94else
95  if test -z "$CC" ; then
96    # Balakrishna Kumthekar <kumtheka@colorado.edu>
97    # As we do not support cc on RS6000, Cygwin and SunOS.
98    case "$target" in
99    rs6000-ibm-aix* | *-pc-cygwin32 | sparc-sun-sunos*)
100      CC=gcc ;;
101    *)
102      CC=cc ;;
103    esac
104  fi
105fi
106AC_PROG_CC
107
108AC_ARG_ENABLE(64,
109  [  --enable-64             Use 64-bit pointers on 64-bit Alpha machines],
110  [use_sixty_four=$enableval], [use_sixty_four=no])
111
112# Gcc does not support 32-bit pointers on the Alphas.
113if test "$gcc_ok" != no; then
114  use_sixty_four=yes
115fi
116
117# Roderick Bloem (rbloem@colorado.edu): making a special case for
118# ultrix install, since it's annoying about setting groupids.
119case "$target" in
120  mips-dec-ultrix*)
121    INSTALL="helpers/install-sh -c"
122    INSTALL_PROGRAM="\${INSTALL}"
123    INSTALL_DATA="\${INSTALL} -m 644";;
124  *)
125  AC_PROG_INSTALL ;;
126esac
127
128# Determine the compiler flags to use
129
130DEBUG_CFLAGS="-g"
131DEBUG_LDFLAGS=""
132
133case "$target" in
134
135  sparc-sun-solaris* | i386-pc-solaris*)
136        # Sparc and X86 Solaris:
137        # -xO3: Highest safe level of optimization
138        # -native: Optimize for the native processor (if supported)
139        # -dalign: Generate double-word load/store for performance
140        #          (only for SPARC)
141        # and other arcane compilation flags.
142        if test "$GCC" = yes; then
143          OPTIMIZE_CFLAGS="-O"
144        else
145          case "$target" in
146            sparc-sun-solaris*)
147              ALIGN=" -dalign" ;;
148            *)
149              ALIGN="" ;;
150          esac
151          AC_MSG_CHECKING([for -native])
152          CFLAGS="-xO3 -native$ALIGN"
153          AC_CACHE_VAL(ac_cv_have_native,
154          [ AC_TRY_RUN([
155          main(){exit(0);}
156          ],ac_cv_have_native=yes,ac_cv_have_native=no,ac_cv_have_native=no)])
157          if test $ac_cv_have_native = yes ; then
158            AC_MSG_RESULT(working)
159            OPTIMIZE_CFLAGS="-xO3 -native$ALIGN"
160          else
161            AC_MSG_RESULT(broken)
162            AC_MSG_CHECKING([for fallback optimization flags])
163            CFLAGS="-xO3 -fns -fsimple=2$ALIGN -ftrap=%none -xlibmil"
164            AC_CACHE_VAL(ac_cv_have_fallback,
165            [ AC_TRY_RUN([
166            main(){exit(0);}
167            ],ac_cv_have_fallback=yes,ac_cv_have_fallback=no,ac_cv_have_fallback=no)])
168            if test $ac_cv_have_fallback = yes ; then
169              AC_MSG_RESULT(working)
170              OPTIMIZE_CFLAGS="-xO3 -fns -fsimple=2$ALIGN -ftrap=%none -xlibmil"
171            else
172              AC_MSG_RESULT(broken)
173              OPTIMIZE_CFLAGS="-O"
174            fi
175          fi
176        fi
177        ;;
178
179  alpha-dec-osf*)
180        # DEC Alpha running OSF:
181
182        # 64-bit mode:
183        # -g3: Produce symbol table information for optimized code
184        # -O4: Enable every optimization
185        # -std: Enforce the ANSI standard with extensions, define __STDC__
186        # -ieee_with_no_inexact: Disable (potentially slow) signaling
187        #   for inexact floating-point results
188        # -tune host: Tune instructions for the compilation host machine
189        OPTIMIZE_CFLAGS="-g3 -O4 -std -ieee_with_no_inexact -tune host"
190        DEBUG_CFLAGS="-g -std -ieee_with_no_inexact"
191
192        # -non_shared: Do not use shared libraries
193        # -om: Generate an OMAGIC file for the om optimizer
194        OPTIMIZE_LDFLAGS="-non_shared"
195        if test "$use_sixty_four" = "no"; then
196          # 32-bit mode:
197          # -xtaso: Make the compiler respond to #pragma pointer_size directives
198          OPTIMIZE_CFLAGS="$OPTIMIZE_CFLAGS -xtaso"
199          DEBUG_CFLAGS="$DEBUG_CFLAGS -xtaso"
200
201          # -taso: Load the executable into the lower 31-bit address space
202          OPTIMIZE_LDFLAGS="$OPTIMIZE_LDFLAGS -om -taso"
203          DEBUG_LDFLAGS="$DEBUG_LDFLAGS -taso"
204
205          AC_DEFINE(SIZEOF_VOID_P, 4)
206          ac_sizeof_voidp=4
207        fi
208        ;;
209
210  hppa*-*-hpux*)
211        # HP running HPUX
212        # -Aa: Behave as an ANSI compiler
213        # -D_HPUX_SOURCE: Include "HP-specific" symbols in the header
214        #   files (e.g., this means sys/resource.h has struct rusage)
215        # +Onolimit: removes resource restrictions for optimization
216        OPTIMIZE_CFLAGS="-O -Aa +Onolimit -D_HPUX_SOURCE"
217        DEBUG_CFLAGS="-g -Aa -D_HPUX_SOURCE" ;;
218
219     *)
220        # Other systems:
221        OPTIMIZE_CFLAGS="-O" ;;
222
223esac
224
225if test "$GCC" = yes; then
226  case "$target" in
227    i686-pc-linux-gnu | i386-pc-solaris* | i386-pc-cygwin32 | i386-*-freebsd*)
228      AC_MSG_CHECKING([for -mcpu and -malign compiler options])
229      CFLAGS="-g -O6 -mcpu=pentiumpro -malign-double -static -fno-strict-aliasing"
230      AC_TRY_COMPILE(,,ac_have_mcpu=yes,ac_have_mcpu=no)
231      if test "$ac_have_mcpu" = yes; then
232        AC_MSG_RESULT(working)
233        OPTIMIZE_CFLAGS="-g -O6 -mcpu=pentiumpro -malign-double -static -fno-strict-aliasing"
234      else
235        AC_MSG_RESULT(broken)
236        OPTIMIZE_CFLAGS="-g -O3"
237      fi
238      ;;
239    sparc-sun-solaris*)
240      AC_MSG_CHECKING([for -mtune compiler option])
241      CFLAGS="-g -O6 -mtune=ultrasparc"
242      AC_TRY_COMPILE(,,ac_have_mtune=yes,ac_have_mtune=no)
243      if test "$ac_have_mtune" = yes; then
244        AC_MSG_RESULT(working)
245        OPTIMIZE_CFLAGS="-g -O6 -mtune=ultrasparc"
246      else
247        AC_MSG_RESULT(not working)
248        OPTIMIZE_CFLAGS="-g -O3"
249      fi
250      ;;
251    *)
252      OPTIMIZE_CFLAGS="-g -O3"
253      ;;
254  esac
255  OPTIMIZE_LDFLAGS=""
256  DEBUG_CFLAGS="-g"
257  DEBUG_LDFLAGS=""
258fi
259
260AC_ARG_WITH(comp-mode,
261[  --with-comp-mode=<mode> Specify a special compilation mode:
262                          optimize (the default): Produce optimized
263                                code, with symbol table information
264                                if supported on the platform/compiler,
265                                and without asserts.
266                          debug: Produce unoptimized code with symbol table
267                                information and asserts enabled],
268[comp_mode=$withval],
269[comp_mode=optimize])
270AC_SUBST(LINKER)
271AC_SUBST(PLINKER)
272
273LINKER="$CC"
274
275case "$comp_mode" in
276  debug)
277       CFLAGS="$DEBUG_CFLAGS"
278       LDFLAGS="$DEBUG_LDFLAGS" ;;
279  optimize | *)
280       CFLAGS="$OPTIMIZE_CFLAGS"
281       LDFLAGS="$OPTIMIZE_LDFLAGS"
282       AC_DEFINE(NDEBUG) ;;
283esac
284
285AC_PROG_LEX
286AC_MSG_CHECKING(if $LEX accepts the -o and -P options)
287
288AC_CACHE_VAL(ac_cv_flex_accepts_op,
289[ ac_cv_flex_accepts_op=yes ;
290echo "%%\
291%%" | $LEX -Ptest -o/dev/null >/dev/null 2>&1 || ac_cv_flex_accepts_op=no ])
292if test $ac_cv_flex_accepts_op = yes ; then
293  AC_MSG_RESULT(yes)
294else
295  AC_MSG_RESULT(no)
296  AC_MSG_WARN([You either need a newer version of flex, or need to modify
297the defintion of LEX in the Makefile to point to a version that does
298accept -p -t and -o.])
299fi
300
301AC_PROG_YACC
302AC_MSG_CHECKING([if $YACC accepts the -p, -t, and -o options])
303AC_CACHE_VAL(ac_cv_yacc_accepts_pto,
304[ ac_cv_yacc_accepts_pto=yes ;
305echo "%token terminal\
306%%\
307nonterminal: terminal\
308%%" > config.in
309$YACC -ptest -o /dev/null config.in >/dev/null 2>&1 || ac_cv_yacc_accepts_pto=no
310rm -f config.in ])
311if test $ac_cv_yacc_accepts_pto = yes ; then
312  AC_MSG_RESULT(yes)
313else
314  AC_MSG_RESULT(no)
315  AC_MSG_WARN([You either need a newer version of bison, or need to modify
316the defintion of YACC in the Makefile to point to a version that does
317accept -p -t and -o.])
318fi
319
320#----------------------------------------------------------------------
321# Checks for headers and libraries
322#----------------------------------------------------------------------
323AC_HEADER_STDC
324
325# Define HAVE_SYS_WAIT_H if sys/wait.h exists and is POSIX-compliant
326AC_HEADER_SYS_WAIT
327
328
329AC_SUBST(LIBDIRS)
330
331# add -lucb to LIBS and -L/usr/ucblib to LIBDIRS
332# if there's a libucb.a available
333# (Solaris needs this for signals)
334
335ac_save_ldflags="$LDFLAGS"
336LDFLAGS=-L/usr/ucblib
337AC_CHECK_LIB(ucb,main,LIBDIRS="$LIBDIRS -L/usr/ucblib")
338LDFLAGS="$ac_save_ldflags"
339
340# Check for gmp library
341AC_CHECK_LIB(gmp, __gmpz_init, ,
342  [AC_MSG_WARN([GNU MP not found, see http://gmplib.org/])])
343
344# Check for these system header files
345AC_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)
346
347# Check for gmp header file
348AC_CHECK_HEADERS(/usr/include/gmp.h)
349
350#----------------------------------------------------------------------
351# Checks for typedefs, structures, and compiler characteristics.
352#----------------------------------------------------------------------
353
354# Check to see if the compiler understands "const"
355# #define it empty otherwise
356AC_C_CONST
357
358# Sort out "time.h" nonsense
359AC_HEADER_TIME
360
361AC_STRUCT_TM
362
363# Set RETSIGTYPE to the proper return type for a signal handler (void or int)
364AC_TYPE_SIGNAL
365
366#----------------------------------------------------------------------
367# Checks for library functions.
368#----------------------------------------------------------------------
369
370AC_PROG_GCC_TRADITIONAL
371AC_FUNC_MEMCMP
372AC_TYPE_SIGNAL
373AC_CHECK_FUNCS(gettimeofday sysconf strchr strstr setvbuf getenv unlink mkstemp close)
374
375#-----------------------------------------------------------------------
376# Check for mawk, gawk, nawk, awk in that order
377#-----------------------------------------------------------------------
378AC_PROG_AWK
379
380#----------------------------------------------------------------------
381# Create the Makefile from Makefile.in
382#----------------------------------------------------------------------
383if test "$gcc_ok" = "g++"; then
384  CC=$gcc_ok
385fi
386AC_OUTPUT(Makefile)
Note: See TracBrowser for help on using the repository browser.