-
Notifications
You must be signed in to change notification settings - Fork 2
/
configure.in
507 lines (442 loc) · 15.1 KB
/
configure.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
dnl Run autoconf on this file to produce the system configuration
dnl script "configure"
# FileName [ configure.in ]
#
# PackageName [ mvsis ]
#
# Synopsis [ System configuration script for autoconf ]
#
# SeeAlso [ Makefile.in ]
#
# Author [ MVSIS group, with original contribution from Stephen Edwards. ]
#
# Copyright [
# Copyright (c) 1994-2003 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.3 2005/05/18 04:14:36 alanmi 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/base/cmd/cmd.h)
# 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 MVSIS
# 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=<srcdir> Specify the root directory to search for
source for packages (the PKGS list).
Expects to find, e.g., <srcdir>/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_SYSTEM
AC_SUBST(target)
# 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=yes])
if test "$gcc_ok" = "yes"; then
CC=gcc
else
# Balakrishna Kumthekar <kumtheka@colorado.edu>
# As we do not support cc on RS6000, Cygwin32 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" = "yes"; then
use_sixty_four="yes"
fi
# Roderick Bloem (rbloem@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 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="-O6 -mcpu=pentiumpro -malign-double"
GPROF_CFLAGS="-pg -g -O"
MEMWATCH_CFLAGS="-g -O -DMEMWATCH -DMEMWATCH_STDIO"
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="-O6 -mtune=ultrasparc"
else
AC_MSG_RESULT(not working)
OPTIMIZE_CFLAGS="-g -O3"
fi
;;
*)
OPTIMIZE_CFLAGS="-O3"
;;
esac
OPTIMIZE_LDFLAGS=""
DEBUG_CFLAGS="-g -O2 -Wall"
DEBUG_LDFLAGS=""
GPROF_LDFLAGS="-pg"
MEMWATCH_LDFLAGS="-DMEMWATCH -DMEMWATCH_STDIO obj/memwatch.c"
fi
#
# TO USE MEMWATCH (v 2.69) TOOL:
# copy memwatch.[ch] to obj/
# ./configure --with-comp-mode=memwatch
# run mvsis
# memwatch.log will be produced which contains memory problems.
# (make sure memwatch.h is included in all files)
AC_ARG_WITH(comp-mode,
[ --with-comp-mode=<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.
gprof: Produce profiling traces for gprof
memwatch: use tool memwatch to detect memory leaks
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=debug])
AC_SUBST(LINKER)
AC_SUBST(PLINKER)
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"
PLINKER="purify -log-file=./purify.log -cachedir=/tmp $CC" ;;
quantify)
CFLAGS="$OPTIMIZE_CFLAGS"
LDFLAGS="$OPTIMIZE_LDFLAGS"
AC_DEFINE(QUANTIFY)
AC_DEFINE(NDEBUG)
LINKER="quantify $CC" ;;
gprof)
CFLAGS="$GPROF_CFLAGS"
LDFLAGS="$GPROF_LDFLAGS" ;;
memwatch)
CFLAGS="$MEMWATCH_CFLAGS"
LDFLAGS="$MEMWATCH_LDFLAGS" ;;
optimize | *)
CFLAGS="$OPTIMIZE_CFLAGS"
LDFLAGS="$OPTIMIZE_LDFLAGS"
AC_DEFINE(NDEBUG) ;;
esac
#----------------------------------------------------------------------
# Do not require LEX or YACC in MVSIS 2.0
#----------------------------------------------------------------------
# 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
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)
# Check if libreadline exists and the function readline can be used
ac_save_libs="$LIBS"
LIBS=-ltermcap
AC_CHECK_LIB(readline,readline,ac_readline_flag=1,ac_readline_flag=0)
if test $ac_readline_flag = 1 ; then
LIBS="$ac_save_libs -lreadline -ltermcap" ; AC_DEFINE(HAVE_LIBREADLINE)
else
LIBS="$ac_save_libs"
fi
# Check for the dirent header file, which is quite a mess
AC_HEADER_DIRENT
# Check for these system header files
AC_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/resource.h sys/termios.h sys/ioctl.h sys/time.h signal.h sys/signal.h)
# This is for Linux
AC_CHECK_HEADERS(bsd/sgtty.h)
# Some systems want both sys/ioctl.h and sys/termios.h, but others can
# only have one -- check for that
AC_MSG_CHECKING(whether sys/termios.h and sys/ioctl.h should both be included)
AC_CACHE_VAL(ac_cv_ioctl_with_termios,
[AC_TRY_CPP([
#include <sys/termios.h>
#include <sys/ioctl.h>
], ac_cv_ioctl_with_termios=1, ac_cv_ioctl_with_termios=0 )])
if test $ac_cv_ioctl_with_termios = 1 ; then
AC_MSG_RESULT(yes) ; AC_DEFINE(IOCTL_WITH_TERMIOS)
else
AC_MSG_RESULT(no)
fi
# cmdFile.c wants to be able to use TIOCGETC to do file completion,
# but some systems (e.g., HPUX) don't have this
#
AC_MSG_CHECKING(for TIOCGETC)
AC_CACHE_VAL(ac_cv_have_ioctl_with_tiocgetc,
[if test $ac_cv_ioctl_with_termios = 1 ; then
AC_EGREP_CPP(yes,
[#include <sys/termios.h>
#include <sys/ioctl.h>
#ifdef TIOCGETC
yes
#endif],
ac_cv_have_ioctl_with_tiocgetc=yes,
ac_cv_have_ioctl_with_tiocgetc=no)
else
AC_EGREP_CPP(yes,
[#include <sys/ioctl.h>
#ifdef TIOCGETC
yes
#endif],
ac_cv_have_ioctl_with_tiocgetc=yes,
ac_cv_have_ioctl_with_tiocgetc=no)
fi])
if test $ac_cv_have_ioctl_with_tiocgetc = "yes" ; then
AC_MSG_RESULT(yes) ; AC_DEFINE(HAVE_IOCTL_WITH_TIOCGETC)
else
AC_MSG_RESULT(no)
fi
# # cmdFile.c wants to turn off interrupts, but some systems don't
# # seem to know how to do that using TIOCLBIS
# #
# # This is probably fairly fragile, and it's probably cmdFile.c that should
# # be fixed
# #
# # This has been very unreliable (e.g., on Solaris), so the facility has
# # been turned off
#
# if test $ac_cv_have_ioctl_with_tiocgetc = "yes" ; then
#
# AC_MSG_CHECKING(for TIOCLBIS)
#
# AC_CACHE_VAL(ac_cv_have_term_interrupts,
# [AC_EGREP_CPP(yes,
# [#include <sys/ioctl.h>
# #include <sys/termios.h>
# #ifdef TIOCLBIS
# yes
# #endif
# ], ac_cv_have_term_interrupts=1,
# ac_cv_have_term_interrupts=0 )])
#
# if test $ac_cv_have_term_interrupts = 1 ; then
# AC_MSG_RESULT(yes) ; AC_DEFINE(HAVE_TERM_INTERRUPTS)
# else
# AC_MSG_RESULT(no)
# fi
#
# fi # ac_cv_have_ioctl_with_tiocgetc
#----------------------------------------------------------------------
# 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
# Roderick Bloem (rbloem@colorado.edu) : On Irix we need ttold
case "$target" in
mips-sgi-irix*)
AC_DEFINE(NEED_TTOLD);;
esac
#----------------------------------------------------------------------
# Checks for library functions.
#----------------------------------------------------------------------
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MEMCMP
AC_TYPE_SIGNAL
AC_CHECK_FUNCS(gettimeofday strchr strstr setvbuf getenv unlink)
#-----------------------------------------------------------------------
# Check for mawk, gawk, nawk, awk in that order
#-----------------------------------------------------------------------
# AC_PROG_AWK
#----------------------------------------------------------------------
# Create the Makefile from Makefile.in
#----------------------------------------------------------------------
AC_OUTPUT(Makefile)