source: vis_dev/glu-2.3/configure.in @ 104

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

library glu 2.3

  • Property svn:executable set to *
File size: 15.8 KB
Line 
1dnl     Run autoconf on this file to produce the system configuration
2dnl     script "configure"
3
4# FileName      [ configure.in ]
5#
6# PackageName   [ glu ]
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.50 2004/09/09 17:48:10 fabio Exp $]
36
37# Require version 2.11 or above -- it checks to see if the C compiler
38# actually works!
39
40AC_PREREQ(2.11)
41
42AC_INIT(src/array/array.c)
43
44# Look for install.sh, config.guess, and config.sub in the "helpers" dir
45AC_CONFIG_AUX_DIR(helpers)
46
47AC_ARG_ENABLE(times-resolution, [  --enable-times-resolution=<hertz>
48                          Set the resolution of the times() function (only
49                          necessary for non-POSIX systems).],
50        [AC_DEFINE_UNQUOTED(CLOCK_RESOLUTION,$enableval)],
51        [AC_DEFINE_UNQUOTED(CLOCK_RESOLUTION,60)])
52
53#----------------------------------------------------------------------
54# Set local_srcdir
55#----------------------------------------------------------------------
56# Give the configurer a chance to set a different location for the GLU
57# source.  When specified, "srcdir" points to "master" source, and
58# "local_srcdir" points to the source under local development.
59
60AC_SUBST(local_srcdir)
61AC_ARG_WITH(local-srcdir,
62[  --with-local-srcdir=<srcdir> Specify the root directory to search for
63                          source for packages (the PKGS list).
64                          Expects to find, e.g., <srcdir>/array/array.c],
65[local_srcdir=$withval],
66[local_srcdir=$srcdir])
67
68AC_ARG_WITH(datasize,
69[  --with-datasize=<size>  (Default: 67108864.) Specify maximum datasize in
70                          bytes for systems without working getrlimit.
71                          The application may use this value to size some
72                          data structures, but may still try to exceed it.],
73[datasize=$withval],
74[datasize=67108864])
75AC_DEFINE_UNQUOTED(RLIMIT_DATA_DEFAULT,$datasize)
76
77#----------------------------------------------------------------------
78# Checks for programs we need
79#----------------------------------------------------------------------
80
81AC_PATH_PROG(AR, ar, ar)
82AC_PROG_RANLIB
83
84AC_CANONICAL_SYSTEM
85AC_SUBST(target)
86
87# Determine the name of the C compiler we're going to use
88
89AC_ARG_ENABLE(gcc,
90  [  --enable-gcc            Allow use of gcc if available],
91  [gcc_ok=$enableval], [gcc_ok=no])
92
93# We cannot set CC=g++ directly because many configuration test programs
94# do not compile with g++.  Hence, when the user specifies --enable-gcc=g++,
95# we set CC=gcc during configuration, and then CC=g++ at the end.
96# The same applies to icpc and icc.
97if test "$gcc_ok" != no; then
98  case "$gcc_ok" in
99    yes | g++)
100      CC=gcc ;;
101    icpc)
102      CC=icc ;;
103    *)
104      CC=$gcc_ok
105  esac
106else
107  if test -z "$CC" ; then
108    # Balakrishna Kumthekar <kumtheka@colorado.edu>
109    # As we do not support cc on RS6000, Cygwin and SunOS.
110    case "$target" in
111    rs6000-ibm-aix* | *-pc-cygwin32 | sparc-sun-sunos*)
112      CC=gcc ;;
113    *)
114      CC=cc ;;
115    esac
116  fi
117fi
118AC_PROG_CC
119
120# Icc fools AC_PROG_CC into believing it is gcc because it defines __GNUC__.
121# To avoid this confusion we add the following test.
122if test "$CC" = icc; then
123  GCC=
124fi
125
126AC_ARG_ENABLE(64,
127  [  --enable-64             Use 64-bit pointers on 64-bit Alpha machines],
128  [use_sixty_four=$enableval], [use_sixty_four=no])
129
130# Gcc does not support 32-bit pointers on the Alphas.
131if test "$gcc_ok" != no; then
132  use_sixty_four=yes
133fi
134
135
136# Balakrisha Kumthekar <kumtheka@colorado.edu>: making a special case
137# for ultrix install, since it's annoying about setting groupids.
138case "$target" in
139  mips-dec-ultrix*)
140    INSTALL="helpers/install-sh -c"
141    INSTALL_PROGRAM="\${INSTALL}"
142    INSTALL_DATA="\${INSTALL} -m 644";;
143
144  *)
145  AC_PROG_INSTALL ;;
146esac
147
148# Determine the compiler flags to use
149
150DEBUG_CFLAGS="-g"
151DEBUG_LDFLAGS=""
152
153case "$target" in
154
155  i686-pc-linux-gnu)
156        # Linux with Intel compiler
157        # -ansi: ANSI C conformance
158        # -ip: inter-procedural optimization
159        OPTIMIZE_CFLAGS="-g -O3 -ansi -ip"
160        ;;
161
162  sparc-sun-solaris* | i386-pc-solaris*)
163        # Sparc and X86 Solaris:
164        # -xO3: Highest safe level of optimization
165        # -native: Optimize for the native processor (if supported)
166        # -dalign: Generate double-word load/store for performance
167        #          (only for SPARC)
168        # and other arcane compilation flags.
169        if test "$GCC" = yes; then
170          OPTIMIZE_CFLAGS="-O"
171        else
172          case "$target" in
173            sparc-sun-solaris*)
174              ALIGN=" -dalign" ;;
175            *)
176              ALIGN="" ;;
177          esac
178          AC_MSG_CHECKING([for -native])
179          CFLAGS="-xO3 -native$ALIGN"
180          AC_CACHE_VAL(ac_cv_have_native,
181          [ AC_TRY_RUN([
182          main(){exit(0);}
183          ],ac_cv_have_native=yes,ac_cv_have_native=no,ac_cv_have_native=no)])
184          if test $ac_cv_have_native = yes ; then
185            AC_MSG_RESULT(working)
186            OPTIMIZE_CFLAGS="-xO3 -native$ALIGN"
187          else
188            AC_MSG_RESULT(broken)
189            AC_MSG_CHECKING([for fallback optimization flags])
190            CFLAGS="-xO3 -fns -fsimple=2$ALIGN -ftrap=%none -xlibmil"
191            AC_CACHE_VAL(ac_cv_have_fallback,
192            [ AC_TRY_RUN([
193            main(){exit(0);}
194            ],ac_cv_have_fallback=yes,ac_cv_have_fallback=no,ac_cv_have_fallback=no)])
195            if test $ac_cv_have_fallback = yes ; then
196              AC_MSG_RESULT(working)
197              OPTIMIZE_CFLAGS="-xO3 -fns -fsimple=2$ALIGN -ftrap=%none -xlibmil"
198            else
199              AC_MSG_RESULT(broken)
200              OPTIMIZE_CFLAGS="-O"
201            fi
202          fi
203        fi
204        ;;
205
206  mips-dec-ultrix*)
207        # MIPS-based DECstations running Ultrix:
208        # -std1: Produce non-ANSI code warnings, and define __STDC__
209        # -O: Use the global "ucode" optimizer
210        # -Olimit 5000: Don't optimize routines bigger than 5000 basic blocks
211        OPTIMIZE_CFLAGS="-std1 -O -Olimit 5000" ;;
212   
213  alpha-dec-osf*)
214        # DEC Alpha running OSF:
215
216        # 64-bit mode:
217        # -g3: Produce symbol table information for optimized code
218        # -O4: Enable every optimization
219        # -std: Enforce the ANSI standard with extensions, define __STDC__
220        # -ieee_with_no_inexact: Disable (potentially slow) signaling
221        #   for inexact floating-point results
222        # -tune host: Tune instructions for the compilation host machine
223        OPTIMIZE_CFLAGS="-g3 -O4 -std -ieee_with_no_inexact -tune host"
224        DEBUG_CFLAGS="-g -std -ieee_with_no_inexact"
225
226        # -non_shared: Do not use shared libraries
227        # -om: Generate an OMAGIC file for the om optimizer
228        OPTIMIZE_LDFLAGS="-non_shared"
229
230        if test "$use_sixty_four" = "no"; then
231          # 32-bit mode:
232          # -xtaso: Make the compiler respond to #pragma pointer_size directives
233          OPTIMIZE_CFLAGS="$OPTIMIZE_CFLAGS -xtaso"
234          DEBUG_CFLAGS="$DEBUG_CFLAGS -xtaso"
235
236          # -taso: Load the executable into the lower 31-bit address space
237          OPTIMIZE_LDFLAGS="$OPTIMIZE_LDFLAGS -om -taso"
238          DEBUG_LDFLAGS="$DEBUG_LDFLAGS -taso"
239
240          AC_DEFINE(SIZEOF_VOID_P, 4)
241          ac_sizeof_voidp=4
242        fi
243        ;;
244
245  hppa*-*-hpux*)
246        # HP running HPUX
247        # -Aa: Behave as an ANSI compiler
248        # -D_HPUX_SOURCE: Include "HP-specific" symbols in the header
249        #   files (e.g., this means sys/resource.h has struct rusage)
250        OPTIMIZE_CFLAGS="-O -Aa -D_HPUX_SOURCE"
251        DEBUG_CFLAGS="-g -Aa -D_HPUX_SOURCE" ;;
252
253     *)
254        # Other systems:
255        OPTIMIZE_CFLAGS="-O" ;;
256
257esac
258
259if test "$GCC" = yes; then
260  case "$target" in
261    i686-pc-linux-gnu | i386-pc-solaris* | i386-pc-cygwin32 | i386-*-freebsd*)
262      AC_MSG_CHECKING([for -mcpu and -malign compiler options])
263      CFLAGS="-g -O6 -mcpu=pentiumpro -malign-double"
264      AC_TRY_COMPILE(,,ac_have_mcpu=yes,ac_have_mcpu=no)
265      if test "$ac_have_mcpu" = yes; then
266        AC_MSG_RESULT(working)
267        OPTIMIZE_CFLAGS="-g -O6 -mcpu=pentiumpro -malign-double"
268      else
269        AC_MSG_RESULT(broken)
270        OPTIMIZE_CFLAGS="-g -O3"
271      fi
272      ;;
273    sparc-sun-solaris*)
274      AC_MSG_CHECKING([for -mtune compiler option])
275      CFLAGS="-g -O6 -mtune=ultrasparc"
276      AC_TRY_COMPILE(,,ac_have_mtune=yes,ac_have_mtune=no)
277      if test "$ac_have_mtune" = yes; then
278        AC_MSG_RESULT(working)
279        OPTIMIZE_CFLAGS="-g -O6 -mtune=ultrasparc"
280      else
281        AC_MSG_RESULT(not working)
282        OPTIMIZE_CFLAGS="-g -O3"
283      fi
284      ;;
285    *)
286      OPTIMIZE_CFLAGS="-g -O3"
287      ;;
288  esac
289  OPTIMIZE_LDFLAGS=""
290  DEBUG_CFLAGS="-g"
291  DEBUG_LDFLAGS=""
292fi
293
294AC_ARG_WITH(comp-mode,
295[  --with-comp-mode=<mode> Specify a special compilation mode:
296                          optimize (the default): Produce optimized
297                                code, with symbol table information
298                                if supported on the platform/compiler,
299                                and without asserts.
300                          debug: Produce unoptimized code with symbol table
301                                information and asserts enabled
302                          purify: Unoptimized code linked with purify
303                          quantify: Optimized code without asserts
304                                linked with quantify],
305[comp_mode=$withval],
306[comp_mode=optimize])
307AC_SUBST(LINKER)
308AC_SUBST(PLINKER)
309
310LINKER="$CC"
311
312case "$comp_mode" in
313  debug)
314       CFLAGS="$DEBUG_CFLAGS"
315       LDFLAGS="$DEBUG_LDFLAGS" ;;
316  purify)
317       CFLAGS="$DEBUG_CFLAGS"
318       LDFLAGS="$DEBUG_LDFLAGS"
319       AC_DEFINE(PURIFY)
320       LINKER="purify -cache-dir=/tmp $CC"
321       PLINKER="purify -log-file=./purify.log -cachedir=/tmp $CC" ;;
322  quantify)
323       CFLAGS="$OPTIMIZE_CFLAGS"
324       LDFLAGS="$OPTIMIZE_LDFLAGS"
325       AC_DEFINE(QUANTIFY)
326       AC_DEFINE(NDEBUG)
327       LINKER="quantify $CC" ;;
328  optimize | *)
329       CFLAGS="$OPTIMIZE_CFLAGS"
330       LDFLAGS="$OPTIMIZE_LDFLAGS"
331       AC_DEFINE(NDEBUG) ;;
332esac
333
334#----------------------------------------------------------------------
335# Checks for libraries
336#----------------------------------------------------------------------
337
338# Define STDC_HEADERS if the system has ANSI C header files
339AC_HEADER_STDC
340
341# Define HAVE_SYS_WAIT_H if sys/wait.h exists and is POSIX-compliant
342AC_HEADER_SYS_WAIT
343
344# Check for these system header files
345AC_CHECK_HEADERS(sys/file.h sys/stat.h unistd.h errno.h assert.h sys/wait.h pwd.h sys/types.h sys/times.h sys/time.h sys/resource.h)
346
347# Check how the compiler handles functions with variable argument lists
348#
349# If there's a <stdarg.h>, this is probably an ANSI compiler and the "..."
350# notation will probably work.  If not, there may be another version
351# called <varargs.h>, that uses an argument of the type "va_alist"
352# (see, e.g., Ultrix, Digital Unix)
353AC_CHECK_HEADERS(stdarg.h varargs.h)
354
355#----------------------------------------------------------------------
356# Checks for typedefs, structures, and compiler characteristics.
357#----------------------------------------------------------------------
358
359# Check to see if the compiler understands "const"
360# #define it empty otherwise
361AC_C_CONST
362
363# Check the size of pointers, longs and ints
364
365if test -z "$ac_sizeof_voidp"; then
366  AC_CHECK_SIZEOF(void *,4)
367fi
368AC_CHECK_SIZEOF(int,4)
369AC_CHECK_SIZEOF(long,4)
370
371# Check for a working implementation of IEEE 754 floating point
372# Specifically, check for correct treatment of +Infinity
373AC_MSG_CHECKING([for +Infinity (IEEE 754 floating point)])
374AC_CACHE_VAL(ac_cv_have_ieee_754,
375[ AC_TRY_RUN([
376#include <math.h>
377main()
378{
379    if (HUGE_VAL != HUGE_VAL * 3 || HUGE_VAL != HUGE_VAL / 3) exit(1);
380    exit(0);
381}
382],ac_cv_have_ieee_754=yes,ac_cv_have_ieee_754=no,ac_cv_have_ieee_754=no)])
383if test $ac_cv_have_ieee_754 = yes ; then
384  AC_MSG_RESULT(working)
385  AC_DEFINE(HAVE_IEEE_754)
386else
387  AC_MSG_RESULT(broken)
388fi
389
390# Check the size of the virtual memory page
391#
392# The Cal BDD package uses this
393#
394# This compiles and runs a small program that gets the pagesize from
395# the "getpagesize()" UNIX system function.
396
397AC_MSG_CHECKING([the size of the virtual memory system's page])
398AC_CACHE_VAL(ac_cv_sys_pagesize,
399[ AC_TRY_RUN([
400
401#include <stdio.h>
402#ifdef HAVE_UNISTD_H
403#  include <unistd.h>
404#endif
405
406main() {
407  FILE * f = fopen( "conftestval", "w" );
408  if ( f == NULL ) exit(1);
409  fprintf( f, "%d\n", (int) getpagesize() );
410  exit(0);
411}
412], ac_cv_sys_pagesize=`cat conftestval`, ac_cv_sys_pagesize=unknown, ac_cv_sys_pagesize=unknown)])
413case "$ac_cv_sys_pagesize" in
414   512)
415     AC_MSG_RESULT(512)
416     PAGE_SIZE=512
417     LG_PAGE_SIZE=9 ;;
418   1024)
419     AC_MSG_RESULT(1K)
420     PAGE_SIZE=1024
421     LG_PAGE_SIZE=10 ;;
422   2048)
423     AC_MSG_RESULT(2K)
424     PAGE_SIZE=2048
425     LG_PAGE_SIZE=11 ;;
426   4096)
427     AC_MSG_RESULT(4K)
428     PAGE_SIZE=4096
429     LG_PAGE_SIZE=12 ;;
430   8192)
431     AC_MSG_RESULT(8K)
432     PAGE_SIZE=8192
433     LG_PAGE_SIZE=13 ;;
434   16384)
435     AC_MSG_RESULT(16K)
436     PAGE_SIZE=16384
437     LG_PAGE_SIZE=14 ;;
438   32768)
439     AC_MSG_RESULT(32K)
440     PAGE_SIZE=32768
441     LG_PAGE_SIZE=15 ;;
442   65536)
443     AC_MSG_RESULT(64K)
444     PAGE_SIZE=65536
445     LG_PAGE_SIZE=16 ;;
446   unknown)
447     AC_MSG_RESULT([could not determine -- assuming 4K])
448     PAGE_SIZE=4096
449     LG_PAGE_SIZE=12 ;;
450   *)
451     AC_MSG_RESULT(Invalid page size $ac_cv_sys_pagesize -- assuming 4K)
452     PAGE_SIZE=4096
453     LG_PAGE_SIZE=12 ;;
454esac
455AC_DEFINE_UNQUOTED(PAGE_SIZE, $PAGE_SIZE)
456AC_DEFINE_UNQUOTED(LG_PAGE_SIZE, $LG_PAGE_SIZE)
457
458# Check the endianness
459#
460# This compiles and runs a small program that gets endian type.
461
462AC_MSG_CHECKING([endian type])
463AC_CACHE_VAL(ac_cv_sys_endian,
464[ AC_TRY_RUN([
465
466#include <stdio.h>
467#ifdef HAVE_UNISTD_H
468#  include <unistd.h>
469#endif
470
471typedef struct EpDoubleStruct {
472  union {
473    double      value;
474    struct IeeeDoubleStruct {   /* LITTLE_ENDIAN */
475      unsigned int mantissa1: 32;
476      unsigned int mantissa0: 20;
477      unsigned int exponent: 11;
478      unsigned int sign: 1;
479    } bits;
480  } type;
481  int           exponent;
482} EpDouble;
483
484main()
485{
486  EpDouble      epd;
487  FILE          *f = fopen("conftestval", "w" );
488
489  if (!f) exit(1);
490  epd.type.value = -1.0;
491  if (epd.type.bits.sign == 1 && epd.type.bits.exponent == 1023 &&
492      epd.type.bits.mantissa0 == 0 && epd.type.bits.mantissa1 == 0)
493    fprintf(f, "0\n");
494  else
495    fprintf(f, "1\n");
496  fclose(f);
497  exit(0);
498}
499], ac_cv_sys_endian=`cat conftestval`, ac_cv_sys_endian=unknown, ac_cv_sys_endian=unknown)])
500case "$ac_cv_sys_endian" in
501   0)
502     AC_MSG_RESULT(LITTLE_ENDIAN)
503     AC_DEFINE_UNQUOTED(EPD_LITTLE_ENDIAN, 1) ;;
504   1)
505     AC_MSG_RESULT(BIG_ENDIAN)
506     AC_DEFINE_UNQUOTED(EPD_BIG_ENDIAN, 1) ;;
507   *)
508     AC_MSG_RESULT(Invalid endian size $ac_cv_sys_endian -- assuming LITTLE_ENDIAN)
509     AC_DEFINE_UNQUOTED(EPD_LITTLE_ENDIAN, 1) ;;
510esac
511
512#----------------------------------------------------------------------
513# Checks for library functions.
514#----------------------------------------------------------------------
515
516# Add memcmp.o to LIBOBJS if the memcmp() function is unavailable or broken
517AC_FUNC_MEMCMP
518
519# Define RETSIGTYPE to be void or int depending on the expected return type of
520# a signal handler
521AC_TYPE_SIGNAL
522
523# Define HAVE_STRCOLL if the strcoll function exists and works
524AC_FUNC_STRCOLL
525
526# Define HAVE_VFORK_H if vfork.h is present, otherwise define "vfork" to be
527# "fork"
528AC_FUNC_VFORK
529
530# Look for these functions and define HAVE_... for each if present
531AC_CHECK_FUNCS(sysconf gethostname strcspn strerror strspn strstr getenv strchr getrlimit getrusage valloc)
532
533#----------------------------------------------------------------------
534# Create the Makefile from Makefile.in
535#----------------------------------------------------------------------
536if test "$gcc_ok" = "g++"; then
537  CC=$gcc_ok
538fi
539AC_OUTPUT(Makefile)
540
Note: See TracBrowser for help on using the repository browser.