source: vis_dev/vis-2.3/configure.in

Last change on this file was 14, checked in by cecile, 13 years ago

vis2.3

  • Property svn:executable set to *
File size: 16.3 KB
Line 
1dnl     Run autoconf on this file to produce the system configuration
2dnl     script "configure"
3
4# FileName      [ configure.in ]
5#
6# PackageName   [ vis ]
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.62 2004/08/20 18:31:32 fabio 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/cmd/cmd.h)
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 the location of the GLU tree
52
53AC_SUBST(glulibdir)
54AC_ARG_WITH(glu-libdir,
55[  --with-glu-libdir=<libdir> Specify directories to search for the GLU library.
56                          Expects to find <libdir>/libglu.a],
57[glulibdir=$withval], [glulibdir=""])
58
59AC_SUBST(gluincdir)
60AC_ARG_WITH(glu-incdir,
61[  --with-glu-incdir=<incdir> Specify directories to search for the GLU headers],
62[gluincdir=$withval], [gluincdir=""])
63
64# Give the configurer a chance to set a different location for the VIS
65# headers and library
66
67AC_SUBST(vislibdir)
68AC_ARG_WITH(vis-libdir,
69[  --with-vis-libdir=<libdir> Specify directories to search for the VIS
70                          and headers.  Defaults to \".\".
71                          Expects to find <libdir>/libvis.a],
72[vislibdir=$withval],
73[vislibdir="."])
74
75# Give the configurer a chance to set a different location for the VIS
76# source.  When specified, "srcdir" points to "master" source, and
77# "local_srcdir" points to the source under local development.
78
79AC_SUBST(local_srcdir)
80AC_ARG_WITH(local-srcdir,
81[  --with-local-srcdir=<srcdir> Specify the root directory to search for
82                          source for packages (the PKGS list).
83                          Expects to find, e.g., <srcdir>/tbl/tbl.c],
84[local_srcdir=$withval],
85[local_srcdir=$srcdir])
86
87# Give the configurer a chance to set the BDD library
88
89AC_SUBST(BDDLIB)
90AC_ARG_WITH(bdd,
91[  --with-bdd=<bddPackage> Specify the BDD library to link against.
92                          Defaults to --with-bdd=cu.],
93[BDDLIB=$withval],
94[BDDLIB=cu])
95
96#----------------------------------------------------------------------
97# Checks for programs we need
98#----------------------------------------------------------------------
99AC_PATH_PROG(ZCHAFF,zchaff)
100AC_PATH_PROG(AR, ar, ar)
101AC_PROG_RANLIB
102
103AC_CANONICAL_SYSTEM
104AC_SUBST(target)
105
106# Determine the name of the C compiler we're going to use
107
108AC_ARG_ENABLE(gcc,
109  [  --enable-gcc            Allow use of gcc if available],
110  [gcc_ok=$enableval], [gcc_ok=no])
111
112# We cannot set CC=g++ directly because many configuration test programs
113# do not compile with g++.  Hence, when the user specifies --enable-gcc=g++,
114# we set CC=gcc during configuration, and then CC=g++ at the end.
115# The same applies to icpc and icc.
116if test "$gcc_ok" != no; then
117  case "$gcc_ok" in
118    yes | g++)
119      CC=gcc ;;
120    icpc)
121      CC=icc ;;
122    *)
123      CC=$gcc_ok
124  esac
125else
126  if test -z "$CC" ; then
127    # Balakrishna Kumthekar <kumtheka@colorado.edu>
128    # As we do not support cc on RS6000, Cygwin and SunOS.
129    case "$target" in
130    rs6000-ibm-aix* | *-pc-cygwin32 | sparc-sun-sunos*)
131      CC=gcc ;;
132    *)
133      CC=cc ;;
134    esac
135  fi
136fi
137AC_PROG_CC
138
139AC_ARG_ENABLE(64,
140  [  --enable-64             Use 64-bit pointers on 64-bit Alpha machines],
141  [use_sixty_four=$enableval], [use_sixty_four=no])
142
143# Gcc does not support 32-bit pointers on the Alphas.
144if test "$gcc_ok" != no; then
145  use_sixty_four=yes
146fi
147
148
149# Roderick Bloem (rbloem@colorado.edu): making a special case for
150# ultrix install, since it's annoying about setting groupids.
151case "$target" in
152  mips-dec-ultrix*)
153    INSTALL="helpers/install-sh -c"
154    INSTALL_PROGRAM="\${INSTALL}"
155    INSTALL_DATA="\${INSTALL} -m 644";;
156
157  *)
158  AC_PROG_INSTALL ;;
159esac
160
161# Determine the compiler flags to use
162
163DEBUG_CFLAGS="-g"
164DEBUG_LDFLAGS=""
165
166case "$target" in
167
168  i686-pc-linux-gnu)
169        # Linux with Intel compiler
170        # -ansi: ANSI C conformance
171        # -ip: inter-procedural optimization
172        OPTIMIZE_CFLAGS="-g -O3 -ansi -ip"
173        ;;
174
175  sparc-sun-solaris* | i386-pc-solaris*)
176        # Sparc and X86 Solaris:
177        # -xO3: Highest safe level of optimization
178        # -native: Optimize for the native processor (if supported)
179        # -dalign: Generate double-word load/store for performance
180        #          (only for SPARC)
181        # and other arcane compilation flags.
182        if test "$GCC" = yes; then
183          OPTIMIZE_CFLAGS="-O"
184        else
185          case "$target" in
186            sparc-sun-solaris*)
187              ALIGN=" -dalign" ;;
188            *)
189              ALIGN="" ;;
190          esac
191          AC_MSG_CHECKING([for -native])
192          CFLAGS="-xO3 -native$ALIGN"
193          AC_CACHE_VAL(ac_cv_have_native,
194          [ AC_TRY_RUN([
195          main(){exit(0);}
196          ],ac_cv_have_native=yes,ac_cv_have_native=no,ac_cv_have_native=no)])
197          if test $ac_cv_have_native = yes ; then
198            AC_MSG_RESULT(working)
199            OPTIMIZE_CFLAGS="-xO3 -native$ALIGN"
200          else
201            AC_MSG_RESULT(broken)
202            AC_MSG_CHECKING([for fallback optimization flags])
203            CFLAGS="-xO3 -fns -fsimple=2$ALIGN -ftrap=%none -xlibmil"
204            AC_CACHE_VAL(ac_cv_have_fallback,
205            [ AC_TRY_RUN([
206            main(){exit(0);}
207            ],ac_cv_have_fallback=yes,ac_cv_have_fallback=no,ac_cv_have_fallback=no)])
208            if test $ac_cv_have_fallback = yes ; then
209              AC_MSG_RESULT(working)
210              OPTIMIZE_CFLAGS="-xO3 -fns -fsimple=2$ALIGN -ftrap=%none -xlibmil"
211            else
212              AC_MSG_RESULT(broken)
213              OPTIMIZE_CFLAGS="-O"
214            fi
215          fi
216        fi
217        ;;
218
219  mips-dec-ultrix*)
220        # MIPS-based DECstations running Ultrix:
221        # -std1: Produce non-ANSI code warnings, and define __STDC__
222        # -O: Use the global "ucode" optimizer
223        # -Olimit 5000: Don't optimize routines bigger than 5000 basic blocks
224        OPTIMIZE_CFLAGS="-std1 -O -Olimit 5000" ;;
225   
226  alpha-dec-osf*)
227        # DEC Alpha running OSF:
228
229        # 64-bit mode:
230        # -g3: Produce symbol table information for optimized code
231        # -O4: Enable every optimization
232        # -std: Enforce the ANSI standard with extensions, define __STDC__
233        # -ieee_with_no_inexact: Disable (potentially slow) signaling
234        #   for inexact floating-point results
235        # -tune host: Tune instructions for the compilation host machine
236        OPTIMIZE_CFLAGS="-g3 -O4 -std -ieee_with_no_inexact -tune host"
237        DEBUG_CFLAGS="-g -std -ieee_with_no_inexact"
238
239        # -non_shared: Do not use shared libraries
240        # -om: Generate an OMAGIC file for the om optimizer
241        OPTIMIZE_LDFLAGS="-non_shared"
242
243        if test "$use_sixty_four" = "no"; then
244          # 32-bit mode:
245          # -xtaso: Make the compiler respond to #pragma pointer_size directives
246          OPTIMIZE_CFLAGS="$OPTIMIZE_CFLAGS -xtaso"
247          DEBUG_CFLAGS="$DEBUG_CFLAGS -xtaso"
248
249          # -taso: Load the executable into the lower 31-bit address space
250          OPTIMIZE_LDFLAGS="$OPTIMIZE_LDFLAGS -om -taso"
251          DEBUG_LDFLAGS="$DEBUG_LDFLAGS -taso"
252
253          AC_DEFINE(SIZEOF_VOID_P, 4)
254          ac_sizeof_voidp=4
255        fi
256        ;;
257
258  hppa*-*-hpux*)
259        # HP running HPUX
260        # -Aa: Behave as an ANSI compiler
261        # -D_HPUX_SOURCE: Include "HP-specific" symbols in the header
262        #   files (e.g., this means sys/resource.h has struct rusage)
263        # +Onolimit: removes resource restrictions for optimization
264        OPTIMIZE_CFLAGS="-O -Aa +Onolimit -D_HPUX_SOURCE"
265        DEBUG_CFLAGS="-g -Aa -D_HPUX_SOURCE" ;;
266
267     *)
268        # Other systems:
269        OPTIMIZE_CFLAGS="-O" ;;
270
271esac
272
273if test "$GCC" = yes; then
274  case "$target" in
275    i686-pc-linux-gnu | i386-pc-solaris* | i386-pc-cygwin32 | i386-*-freebsd*)
276      AC_MSG_CHECKING([for -mcpu and -malign compiler options])
277      CFLAGS="-g -O6 -mcpu=pentiumpro -malign-double"
278      AC_TRY_COMPILE(,,ac_have_mcpu=yes,ac_have_mcpu=no)
279      if test "$ac_have_mcpu" = yes; then
280        AC_MSG_RESULT(working)
281        OPTIMIZE_CFLAGS="-g -O6 -mcpu=pentiumpro -malign-double"
282      else
283        AC_MSG_RESULT(broken)
284        OPTIMIZE_CFLAGS="-g -O3"
285      fi
286      ;;
287    sparc-sun-solaris*)
288      AC_MSG_CHECKING([for -mtune compiler option])
289      CFLAGS="-g -O6 -mtune=ultrasparc"
290      AC_TRY_COMPILE(,,ac_have_mtune=yes,ac_have_mtune=no)
291      if test "$ac_have_mtune" = yes; then
292        AC_MSG_RESULT(working)
293        OPTIMIZE_CFLAGS="-g -O6 -mtune=ultrasparc"
294      else
295        AC_MSG_RESULT(not working)
296        OPTIMIZE_CFLAGS="-g -O3"
297      fi
298      ;;
299    *)
300      OPTIMIZE_CFLAGS="-g -O3"
301      ;;
302  esac
303  OPTIMIZE_LDFLAGS=""
304  DEBUG_CFLAGS="-g"
305  DEBUG_LDFLAGS=""
306fi
307
308AC_ARG_WITH(comp-mode,
309[  --with-comp-mode=<mode> Specify a special compilation mode:
310                          optimize (the default): Produce optimized
311                                code, with symbol table information
312                                if supported on the platform/compiler,
313                                and without asserts.
314                          debug: Produce unoptimized code with symbol table
315                                information and asserts enabled
316                          purify: Unoptimized code linked with purify
317                          quantify: Optimized code without asserts
318                                linked with quantify],
319[comp_mode=$withval],
320[comp_mode=optimize])
321AC_SUBST(LINKER)
322AC_SUBST(PLINKER)
323
324LINKER="$CC"
325
326case "$comp_mode" in
327  debug)
328       CFLAGS="$DEBUG_CFLAGS"
329       LDFLAGS="$DEBUG_LDFLAGS" ;;
330  purify)
331       CFLAGS="$DEBUG_CFLAGS"
332       LDFLAGS="$DEBUG_LDFLAGS"
333       AC_DEFINE(PURIFY)
334       LINKER="purify -cache-dir=/tmp $CC"
335       PLINKER="purify -log-file=./purify.log -cachedir=/tmp $CC" ;;
336  quantify)
337       CFLAGS="$OPTIMIZE_CFLAGS"
338       LDFLAGS="$OPTIMIZE_LDFLAGS"
339       AC_DEFINE(QUANTIFY)
340       AC_DEFINE(NDEBUG)
341       LINKER="quantify $CC" ;;
342  optimize | *)
343       CFLAGS="$OPTIMIZE_CFLAGS"
344       LDFLAGS="$OPTIMIZE_LDFLAGS"
345       AC_DEFINE(NDEBUG) ;;
346esac
347
348AC_PROG_LEX
349AC_MSG_CHECKING(if $LEX accepts the -o and -P options)
350
351AC_CACHE_VAL(ac_cv_flex_accepts_op,
352[ ac_cv_flex_accepts_op=yes ;
353echo "%%\
354%%" | $LEX -Ptest -o/dev/null >/dev/null 2>&1 || ac_cv_flex_accepts_op=no ])
355if test $ac_cv_flex_accepts_op = yes ; then
356  AC_MSG_RESULT(yes)
357else
358  AC_MSG_RESULT(no)
359  AC_MSG_WARN([You either need a newer version of flex, or need to modify
360the defintion of LEX in the Makefile to point to a version that does
361accept -p -t and -o.])
362fi
363
364AC_PROG_YACC
365AC_MSG_CHECKING([if $YACC accepts the -p, -t, and -o options])
366AC_CACHE_VAL(ac_cv_yacc_accepts_pto,
367[ ac_cv_yacc_accepts_pto=yes ;
368echo "%token terminal\
369%%\
370nonterminal: terminal\
371%%" > config.in
372$YACC -ptest -o /dev/null config.in >/dev/null 2>&1 || ac_cv_yacc_accepts_pto=no
373rm -f config.in ])
374if test $ac_cv_yacc_accepts_pto = yes ; then
375  AC_MSG_RESULT(yes)
376else
377  AC_MSG_RESULT(no)
378  AC_MSG_WARN([You either need a newer version of bison, or need to modify
379the defintion of YACC in the Makefile to point to a version that does
380accept -p -t and -o.])
381fi
382
383#----------------------------------------------------------------------
384# Checks for headers and libraries
385#----------------------------------------------------------------------
386AC_HEADER_STDC
387
388AC_SUBST(LIBDIRS)
389
390# add -lucb to LIBS and -L/usr/ucblib to LIBDIRS
391# if there's a libucb.a available
392# (Solaris needs this for signals)
393
394ac_save_ldflags="$LDFLAGS"
395LDFLAGS=-L/usr/ucblib
396AC_CHECK_LIB(ucb,main,LIBDIRS="$LIBDIRS -L/usr/ucblib")
397LDFLAGS="$ac_save_ldflags"
398
399# add -lbsd if there's a libbsd.a available
400# (e.g., Linux needs this for bsd_ioctl)
401AC_CHECK_LIB(bsd,main)
402
403# Check if libreadline exists and the function readline can be used.
404# This implies checking for the availability of libtermcap or of a
405# suitable replacement.  (We only look for libncurses.)
406AC_CACHE_VAL(vis_cv_termcap_lib,
407[AC_CHECK_LIB(termcap, tgetent, vis_cv_termcap_lib=-ltermcap,
408  [AC_CHECK_LIB(ncurses, tgetent, vis_cv_termcap_lib=-lncurses,
409    bash_cv_termcap_lib=none)])])
410if test "$vis_cv_termcap_lib" != none; then
411  AC_CHECK_LIB(readline, readline, ac_readline_flag=1,
412               ac_readline_flag=0, $vis_cv_termcap_lib)
413  if test $ac_readline_flag = 1 ; then
414    LIBS="$LIBS -lreadline $vis_cv_termcap_lib" ; AC_DEFINE(HAVE_LIBREADLINE)
415  fi
416fi
417
418# Check for the dirent header file, which is quite a mess
419AC_HEADER_DIRENT
420
421# Check for these system header files
422AC_CHECK_HEADERS(sys/termios.h sys/ioctl.h sys/time.h signal.h sys/signal.h readline/readline.h readline/history.h)
423
424# This is for Linux
425AC_CHECK_HEADERS(bsd/sgtty.h)
426
427# Some systems want both sys/ioctl.h and sys/termios.h, but others can
428# only have one -- check for that
429
430AC_MSG_CHECKING(whether sys/termios.h and sys/ioctl.h should both be included)
431
432AC_CACHE_VAL(ac_cv_ioctl_with_termios,
433[AC_TRY_CPP([
434#include <sys/termios.h>
435#include <sys/ioctl.h>
436], ac_cv_ioctl_with_termios=1, ac_cv_ioctl_with_termios=0 )])
437if test $ac_cv_ioctl_with_termios = 1 ; then
438  AC_MSG_RESULT(yes) ; AC_DEFINE(IOCTL_WITH_TERMIOS)
439else
440  AC_MSG_RESULT(no)
441fi
442
443# cmdFile.c wants to be able to use TIOCGETC to do file completion,
444# but some systems (e.g., HPUX) don't have this
445#
446 
447AC_MSG_CHECKING(for TIOCGETC)
448
449AC_CACHE_VAL(ac_cv_have_ioctl_with_tiocgetc,
450[if test $ac_cv_ioctl_with_termios = 1 ; then
451  AC_EGREP_CPP(yes,
452[#include <sys/termios.h>
453#include <sys/ioctl.h>
454#ifdef TIOCGETC
455  yes
456#endif],
457  ac_cv_have_ioctl_with_tiocgetc=yes,
458  ac_cv_have_ioctl_with_tiocgetc=no)
459else
460  AC_EGREP_CPP(yes,
461[#include <sys/ioctl.h>
462#ifdef TIOCGETC
463  yes
464#endif],
465  ac_cv_have_ioctl_with_tiocgetc=yes,
466  ac_cv_have_ioctl_with_tiocgetc=no)
467fi])
468if test $ac_cv_have_ioctl_with_tiocgetc = "yes" ; then
469  AC_MSG_RESULT(yes) ; AC_DEFINE(HAVE_IOCTL_WITH_TIOCGETC)
470else
471  AC_MSG_RESULT(no)
472fi
473
474#  # cmdFile.c wants to turn off interrupts, but some systems don't
475#  # seem to know how to do that using TIOCLBIS
476#  #
477#  # This is probably fairly fragile, and it's probably cmdFile.c that should
478#  # be fixed
479#  #
480#  # This has been very unreliable (e.g., on Solaris), so the facility has
481#  # been turned off
482#
483#  if test $ac_cv_have_ioctl_with_tiocgetc = "yes" ; then
484
485#    AC_MSG_CHECKING(for TIOCLBIS)
486
487#    AC_CACHE_VAL(ac_cv_have_term_interrupts,
488#    [AC_EGREP_CPP(yes,
489#    [#include <sys/ioctl.h>
490#  #include <sys/termios.h>
491#  #ifdef TIOCLBIS
492#   yes
493#  #endif
494#  ], ac_cv_have_term_interrupts=1,
495#    ac_cv_have_term_interrupts=0 )])
496
497#    if test $ac_cv_have_term_interrupts = 1 ; then
498#      AC_MSG_RESULT(yes) ; AC_DEFINE(HAVE_TERM_INTERRUPTS)
499#    else
500#      AC_MSG_RESULT(no)
501#    fi
502
503#  fi   # ac_cv_have_ioctl_with_tiocgetc
504
505#----------------------------------------------------------------------
506# Checks for typedefs, structures, and compiler characteristics.
507#----------------------------------------------------------------------
508
509# Check to see if the compiler understands "const"
510# #define it empty otherwise
511AC_C_CONST
512
513# Sort out "time.h" nonsense
514AC_HEADER_TIME
515
516AC_STRUCT_TM
517
518# Set RETSIGTYPE to the proper return type for a signal handler (void or int)
519AC_TYPE_SIGNAL
520
521# Roderick Bloem (rbloem@colorado.edu) :  On Irix we need ttold
522case "$target" in
523  mips-sgi-irix*)
524    AC_DEFINE(NEED_TTOLD);;
525esac
526
527#----------------------------------------------------------------------
528# Checks for library functions.
529#----------------------------------------------------------------------
530
531AC_PROG_GCC_TRADITIONAL
532AC_FUNC_MEMCMP
533AC_TYPE_SIGNAL
534AC_CHECK_FUNCS(gettimeofday strchr strstr setvbuf getenv unlink mkstemp close)
535
536#-----------------------------------------------------------------------
537# Check for mawk, gawk, nawk, awk in that order
538#-----------------------------------------------------------------------
539AC_PROG_AWK
540
541#----------------------------------------------------------------------
542# Create the Makefile from Makefile.in
543#----------------------------------------------------------------------
544if test "$gcc_ok" = "g++"; then
545  CC=$gcc_ok
546fi
547AC_OUTPUT(Makefile)
Note: See TracBrowser for help on using the repository browser.