[18] | 1 | dnl Process this file with autoconf to produce a configure script. |
---|
| 2 | AC_PREREQ(2.11) |
---|
| 3 | AC_INIT(src/parser/main.c) |
---|
| 4 | |
---|
| 5 | # Look for install.sh, config.guess, and config.sub in the "helpers" dir |
---|
| 6 | AC_CONFIG_AUX_DIR(helpers) |
---|
| 7 | |
---|
| 8 | #---------------------------------------------------------------------- |
---|
| 9 | # Configuration options |
---|
| 10 | #---------------------------------------------------------------------- |
---|
| 11 | |
---|
| 12 | # Give the configurer a chance to set the location of the GLU tree |
---|
| 13 | |
---|
| 14 | AC_SUBST(glulibdir) |
---|
| 15 | AC_ARG_WITH(glu-libdir, |
---|
| 16 | [ --with-glu-libdir=<libdir> Specify directories to search for the GLU library. Expects to find <libdir>/libglu.a], |
---|
| 17 | [glulibdir=$withval], [glulibdir=""]) |
---|
| 18 | |
---|
| 19 | AC_SUBST(gluincdir) |
---|
| 20 | AC_ARG_WITH(glu-incdir, |
---|
| 21 | [ --with-glu-incdir=<incdir> Specify directories to search for the GLU headers], |
---|
| 22 | [gluincdir=$withval], [gluincdir=""]) |
---|
| 23 | |
---|
| 24 | # Give the configurer a chance to set a different location for the VIS |
---|
| 25 | # headers and library |
---|
| 26 | |
---|
| 27 | AC_SUBST(vl2mvlibdir) |
---|
| 28 | AC_ARG_WITH(vl2mv-libdir, |
---|
| 29 | [ --with-vl2mv-libdir=<libdir> Specify directories to search for the vl2mv |
---|
| 30 | library and headers. Defaults to \".\". |
---|
| 31 | Expects to find <libdir>/libvl2mv.a], |
---|
| 32 | [vl2mvlibdir=$withval], |
---|
| 33 | [vl2mvlibdir="."]) |
---|
| 34 | |
---|
| 35 | # Give the configurer a chance to set a different location for the vl2mv |
---|
| 36 | # source. When specified, "srcdir" points to "master" source, and |
---|
| 37 | # "local_srcdir" points to the source under local development. |
---|
| 38 | |
---|
| 39 | AC_SUBST(local_srcdir) |
---|
| 40 | AC_ARG_WITH(local-srcdir, |
---|
| 41 | [ --with-local-srcdir=<srcdir> Specify the root directory to search for |
---|
| 42 | source for packages (the PKGS list). |
---|
| 43 | Expects to find, e.g., <srcdir>/parser/main.c], |
---|
| 44 | [local_srcdir=$withval], |
---|
| 45 | [local_srcdir=$srcdir]) |
---|
| 46 | |
---|
| 47 | dnl Checks for programs. |
---|
| 48 | |
---|
| 49 | #---------------------------------------------------------------------- |
---|
| 50 | # Checks for programs we need |
---|
| 51 | #---------------------------------------------------------------------- |
---|
| 52 | |
---|
| 53 | AC_PATH_PROG(AR, ar, ar) |
---|
| 54 | AC_PROG_RANLIB |
---|
| 55 | AC_PROG_AWK |
---|
| 56 | AC_PATH_PROG(SED, sed, sed) |
---|
| 57 | |
---|
| 58 | AC_CANONICAL_SYSTEM |
---|
| 59 | AC_SUBST(target) |
---|
| 60 | |
---|
| 61 | # Balakrisha Kumthekar (kumtheka@colorado.edu): making a special case |
---|
| 62 | # for ultrix install, since its annoying about setting groupids. |
---|
| 63 | case "$target" in |
---|
| 64 | mips-dec-ultrix*) |
---|
| 65 | INSTALL="helpers/install-sh -c" |
---|
| 66 | INSTALL_PROGRAM="\${INSTALL}" |
---|
| 67 | INSTALL_DATA="\${INSTALL} -m 644";; |
---|
| 68 | |
---|
| 69 | *) |
---|
| 70 | AC_PROG_INSTALL ;; |
---|
| 71 | esac |
---|
| 72 | |
---|
| 73 | # Determine the name of the C compiler we're going to use |
---|
| 74 | |
---|
| 75 | AC_ARG_ENABLE(gcc, |
---|
| 76 | [ --enable-gcc Allow use of gcc if available], |
---|
| 77 | [gcc_ok=$enableval], [gcc_ok=no]) |
---|
| 78 | |
---|
| 79 | if test "$gcc_ok" != no; then |
---|
| 80 | case "$gcc_ok" in |
---|
| 81 | yes) |
---|
| 82 | CC=gcc ;; |
---|
| 83 | *) |
---|
| 84 | CC=$gcc_ok |
---|
| 85 | esac |
---|
| 86 | else |
---|
| 87 | # Balakrishna Kumthekar <kumtheka@colorado.edu> |
---|
| 88 | # As we do not support cc on RS6000, Cygwin and SunOS. |
---|
| 89 | case "$target" in |
---|
| 90 | rs6000-ibm-aix* | *-pc-cygwin32 | sparc-sun-sunos*) |
---|
| 91 | CC=gcc ;; |
---|
| 92 | *) |
---|
| 93 | CC=cc ;; |
---|
| 94 | esac |
---|
| 95 | fi |
---|
| 96 | |
---|
| 97 | AC_PROG_CC |
---|
| 98 | |
---|
| 99 | AC_ARG_ENABLE(64, |
---|
| 100 | [ --enable-64 Use 64-bit pointers on 64-bit Alpha machines], |
---|
| 101 | [use_sixty_four=$enableval], [use_sixty_four=no]) |
---|
| 102 | |
---|
| 103 | if test "$gcc_ok" != no; then |
---|
| 104 | use_sixty_four=yes |
---|
| 105 | fi |
---|
| 106 | |
---|
| 107 | |
---|
| 108 | # Determine the compiler flags to use |
---|
| 109 | |
---|
| 110 | DEBUG_CFLAGS="-g" |
---|
| 111 | DEBUG_LDFLAGS="" |
---|
| 112 | |
---|
| 113 | case "$target" in |
---|
| 114 | |
---|
| 115 | sparc-sun-solaris* | i386-pc-solaris*) |
---|
| 116 | # Sparc and X86 Solaris: |
---|
| 117 | # -xO3: Highest safe level of optimization |
---|
| 118 | # -native: Optimize for the native processor (if supported) |
---|
| 119 | # -dalign: Generate double-word load/store for performance |
---|
| 120 | # (only for SPARC) |
---|
| 121 | # and other arcane compilation flags. |
---|
| 122 | if test "$GCC" = yes; then |
---|
| 123 | OPTIMIZE_CFLAGS="-O" |
---|
| 124 | else |
---|
| 125 | case "$target" in |
---|
| 126 | sparc-sun-solaris*) |
---|
| 127 | ALIGN=" -dalign" ;; |
---|
| 128 | *) |
---|
| 129 | ALIGN="" ;; |
---|
| 130 | esac |
---|
| 131 | AC_MSG_CHECKING([for -native]) |
---|
| 132 | CFLAGS="-xO3 -native$ALIGN" |
---|
| 133 | AC_CACHE_VAL(ac_cv_have_native, |
---|
| 134 | [ AC_TRY_RUN([ |
---|
| 135 | main(){exit(0);} |
---|
| 136 | ],ac_cv_have_native=yes,ac_cv_have_native=no,ac_cv_have_native=no)]) |
---|
| 137 | if test $ac_cv_have_native = yes ; then |
---|
| 138 | AC_MSG_RESULT(working) |
---|
| 139 | OPTIMIZE_CFLAGS="-xO3 -native$ALIGN" |
---|
| 140 | else |
---|
| 141 | AC_MSG_RESULT(broken) |
---|
| 142 | AC_MSG_CHECKING([for fallback optimization flags]) |
---|
| 143 | CFLAGS="-xO3 -fns -fsimple=2$ALIGN -ftrap=%none -xlibmil" |
---|
| 144 | AC_CACHE_VAL(ac_cv_have_fallback, |
---|
| 145 | [ AC_TRY_RUN([ |
---|
| 146 | main(){exit(0);} |
---|
| 147 | ],ac_cv_have_fallback=yes,ac_cv_have_fallback=no,ac_cv_have_fallback=no)]) |
---|
| 148 | if test $ac_cv_have_fallback = yes ; then |
---|
| 149 | AC_MSG_RESULT(working) |
---|
| 150 | OPTIMIZE_CFLAGS="-xO3 -fns -fsimple=2$ALIGN -ftrap=%none -xlibmil" |
---|
| 151 | else |
---|
| 152 | AC_MSG_RESULT(broken) |
---|
| 153 | OPTIMIZE_CFLAGS="-O" |
---|
| 154 | fi |
---|
| 155 | fi |
---|
| 156 | fi |
---|
| 157 | ;; |
---|
| 158 | |
---|
| 159 | mips-dec-ultrix*) |
---|
| 160 | # MIPS-based DECstations running Ultrix: |
---|
| 161 | # -std1: Produce non-ANSI code warnings, and define __STDC__ |
---|
| 162 | # -O: Use the global "ucode" optimizer |
---|
| 163 | # -Olimit 5000: Don't optimize routines bigger than 5000 basic blocks |
---|
| 164 | OPTIMIZE_CFLAGS="-std1 -O -Olimit 5000" ;; |
---|
| 165 | |
---|
| 166 | alpha-dec-osf*) |
---|
| 167 | # DEC Alpha running OSF: |
---|
| 168 | |
---|
| 169 | # 64-bit mode: |
---|
| 170 | # -g3: Produce symbol table information for optimized code |
---|
| 171 | # -O4: Enable every optimization |
---|
| 172 | # -std: Enforce the ANSI standard with extensions, define __STDC__ |
---|
| 173 | # -ieee_with_no_inexact: Disable (potentially slow) signaling |
---|
| 174 | # for inexact floating-point results |
---|
| 175 | # -tune host: Tune instructions for the compilation host machine |
---|
| 176 | |
---|
| 177 | OPTIMIZE_CFLAGS="-g3 -O4 -std -ieee_with_no_inexact -tune host" |
---|
| 178 | DEBUG_CFLAGS="-g -std -ieee_with_no_inexact" |
---|
| 179 | |
---|
| 180 | # -non_shared: Do not use shared libraries |
---|
| 181 | # -om: Generate an OMAGIC file for the om optimizer |
---|
| 182 | OPTIMIZE_LDFLAGS="-non_shared" |
---|
| 183 | |
---|
| 184 | if test "$use_sixty_four" = "no"; then |
---|
| 185 | # 32-bit mode: |
---|
| 186 | # -xtaso: Make the compiler respond to #pragma pointer_size directives |
---|
| 187 | OPTIMIZE_CFLAGS="$OPTIMIZE_CFLAGS -xtaso" |
---|
| 188 | DEBUG_CFLAGS="$DEBUG_CFLAGS -xtaso" |
---|
| 189 | |
---|
| 190 | # -taso: Load the executable into the lower 31-bit address space |
---|
| 191 | OPTIMIZE_LDFLAGS="$OPTIMIZE_LDFLAGS -om -taso" |
---|
| 192 | DEBUG_LDFLAGS="$DEBUG_LDFLAGS -taso" |
---|
| 193 | |
---|
| 194 | AC_DEFINE(SIZEOF_VOID_P, 4) |
---|
| 195 | ac_sizeof_voidp=4 |
---|
| 196 | fi |
---|
| 197 | ;; |
---|
| 198 | |
---|
| 199 | hppa*-*-hpux*) |
---|
| 200 | # HP running HPUX |
---|
| 201 | # -Aa: Behave as an ANSI compiler |
---|
| 202 | # -D_HPUX_SOURCE: Include "HP-specific" symbols in the header |
---|
| 203 | # files (e.g., this means sys/resource.h has struct rusage) |
---|
| 204 | OPTIMIZE_CFLAGS="-O -Aa -D_HPUX_SOURCE" |
---|
| 205 | DEBUG_CFLAGS="-g -Aa -D_HPUX_SOURCE" ;; |
---|
| 206 | |
---|
| 207 | *) |
---|
| 208 | # Other systems: |
---|
| 209 | OPTIMIZE_CFLAGS="-O" ;; |
---|
| 210 | |
---|
| 211 | esac |
---|
| 212 | |
---|
| 213 | if test "$GCC" = yes; then |
---|
| 214 | case "$target" in |
---|
| 215 | i686-pc-linux-gnu | i386-pc-solaris* | i386-pc-cygwin32) |
---|
| 216 | AC_MSG_CHECKING([for -mcpu and -malign compiler options]) |
---|
| 217 | CFLAGS="-g -O6 -mcpu=pentiumpro -malign-double" |
---|
| 218 | AC_TRY_COMPILE(,,ac_have_mcpu=yes,ac_have_mcpu=no) |
---|
| 219 | if test "$ac_have_mcpu" = yes; then |
---|
| 220 | AC_MSG_RESULT(working) |
---|
| 221 | OPTIMIZE_CFLAGS="-g -O6 -mcpu=pentiumpro -malign-double" |
---|
| 222 | else |
---|
| 223 | AC_MSG_RESULT(broken) |
---|
| 224 | OPTIMIZE_CFLAGS="-g -O3" |
---|
| 225 | fi |
---|
| 226 | ;; |
---|
| 227 | sparc-sun-solaris*) |
---|
| 228 | AC_MSG_CHECKING([for -mtune compiler option]) |
---|
| 229 | CFLAGS="-g -O6 -mtune=ultrasparc" |
---|
| 230 | AC_TRY_COMPILE(,,ac_have_mtune=yes,ac_have_mtune=no) |
---|
| 231 | if test "$ac_have_mtune" = yes; then |
---|
| 232 | AC_MSG_RESULT(working) |
---|
| 233 | OPTIMIZE_CFLAGS="-g -O6 -mtune=ultrasparc" |
---|
| 234 | else |
---|
| 235 | AC_MSG_RESULT(not working) |
---|
| 236 | OPTIMIZE_CFLAGS="-g -O3" |
---|
| 237 | fi |
---|
| 238 | ;; |
---|
| 239 | *) |
---|
| 240 | OPTIMIZE_CFLAGS="-g -O3" |
---|
| 241 | ;; |
---|
| 242 | esac |
---|
| 243 | OPTIMIZE_LDFLAGS="" |
---|
| 244 | DEBUG_CFLAGS="-g" |
---|
| 245 | DEBUG_LDFLAGS="" |
---|
| 246 | fi |
---|
| 247 | |
---|
| 248 | AC_ARG_WITH(comp-mode, |
---|
| 249 | [ --with-comp-mode=<mode> Specify a special compilation mode: |
---|
| 250 | optimize (the default): Produce optimized |
---|
| 251 | code, with symbol table information |
---|
| 252 | if supported on the platform/compiler, |
---|
| 253 | and without asserts. |
---|
| 254 | debug: Produce unoptimized code with symbol table |
---|
| 255 | information and asserts enabled |
---|
| 256 | purify: Unoptimized code linked with purify |
---|
| 257 | quantify: Optimized code without asserts |
---|
| 258 | linked with quantify], |
---|
| 259 | [comp_mode=$withval], |
---|
| 260 | [comp_mode=optimize]) |
---|
| 261 | AC_SUBST(LINKER) |
---|
| 262 | |
---|
| 263 | LINKER="$CC" |
---|
| 264 | |
---|
| 265 | case "$comp_mode" in |
---|
| 266 | debug) |
---|
| 267 | CFLAGS="$DEBUG_CFLAGS" |
---|
| 268 | LDFLAGS="$DEBUG_LDFLAGS" ;; |
---|
| 269 | purify) |
---|
| 270 | CFLAGS="$DEBUG_CFLAGS" |
---|
| 271 | LDFLAGS="$DEBUG_LDFLAGS" |
---|
| 272 | AC_DEFINE(PURIFY) |
---|
| 273 | LINKER="purify -cache-dir=/tmp $CC" ;; |
---|
| 274 | quantify) |
---|
| 275 | CFLAGS="$OPTIMIZE_CFLAGS" |
---|
| 276 | LDFLAGS="$OPTIMIZE_LDFLAGS" |
---|
| 277 | AC_DEFINE(QUANTIFY) |
---|
| 278 | AC_DEFINE(NDEBUG) |
---|
| 279 | LINKER="quantify $CC" ;; |
---|
| 280 | optimize | *) |
---|
| 281 | CFLAGS="$OPTIMIZE_CFLAGS" |
---|
| 282 | LDFLAGS="$OPTIMIZE_LDFLAGS" |
---|
| 283 | AC_DEFINE(NDEBUG) ;; |
---|
| 284 | esac |
---|
| 285 | |
---|
| 286 | AC_PROG_LEX |
---|
| 287 | AC_MSG_CHECKING(if $LEX accepts the -o and -P options) |
---|
| 288 | |
---|
| 289 | AC_CACHE_VAL(ac_cv_flex_accepts_op, |
---|
| 290 | [ ac_cv_flex_accepts_op=yes ; |
---|
| 291 | echo "%%\ |
---|
| 292 | %%" | $LEX -Ptest -o/dev/null >/dev/null 2>&1 || ac_cv_flex_accepts_op=no ]) |
---|
| 293 | if test $ac_cv_flex_accepts_op = yes ; then |
---|
| 294 | AC_MSG_RESULT(yes) |
---|
| 295 | else |
---|
| 296 | AC_MSG_RESULT(no) |
---|
| 297 | AC_MSG_WARN([You either need a newer version of flex, or need to modify |
---|
| 298 | the defintion of LEX in the Makefile to point to a version that does |
---|
| 299 | accept -p -t and -o.]) |
---|
| 300 | fi |
---|
| 301 | |
---|
| 302 | AC_PROG_LN_S |
---|
| 303 | AC_PROG_MAKE_SET |
---|
| 304 | AC_PATH_PROG(AR, ar, ar) |
---|
| 305 | AC_PROG_RANLIB |
---|
| 306 | AC_PROG_YACC |
---|
| 307 | AC_MSG_CHECKING([if $YACC accepts the -p, -t, and -o options]) |
---|
| 308 | AC_CACHE_VAL(ac_cv_yacc_accepts_pto, |
---|
| 309 | [ ac_cv_yacc_accepts_pto=yes ; |
---|
| 310 | echo "%token terminal\ |
---|
| 311 | %%\ |
---|
| 312 | nonterminal: terminal\ |
---|
| 313 | %%" > config.in |
---|
| 314 | $YACC -ptest -o /dev/null config.in >/dev/null 2>&1 || ac_cv_yacc_accepts_pto=norm -f config.in ]) |
---|
| 315 | if test $ac_cv_yacc_accepts_pto = yes ; then |
---|
| 316 | AC_MSG_RESULT(yes) |
---|
| 317 | else |
---|
| 318 | AC_MSG_RESULT(no) |
---|
| 319 | AC_MSG_WARN([You either need a newer version of bison, or need to modify |
---|
| 320 | the defintion of YACC in the Makefile to point to a version that does |
---|
| 321 | accept -p -t and -o.]) |
---|
| 322 | fi |
---|
| 323 | |
---|
| 324 | dnl Checks for libraries. |
---|
| 325 | |
---|
| 326 | AC_SUBST(LIBDIRS) |
---|
| 327 | |
---|
| 328 | # add -lucb to LIBS and set LIBDIRS to -L/usr/ucblib |
---|
| 329 | # if there's a libucb.a available |
---|
| 330 | # (Solaris needs this for signals) |
---|
| 331 | |
---|
| 332 | ac_save_ldflags="$LDFLAGS" |
---|
| 333 | LDFLAGS=-L/usr/ucblib |
---|
| 334 | AC_CHECK_LIB(ucb,main,LIBDIRS=-L/usr/ucblib) |
---|
| 335 | LDFLAGS="$ac_save_ldflags" |
---|
| 336 | |
---|
| 337 | # add -lbsd if there's a libbsd.a available |
---|
| 338 | # (e.g., Linux needs this for bsd_ioctl) |
---|
| 339 | AC_CHECK_LIB(bsd,main) |
---|
| 340 | |
---|
| 341 | dnl Replace `main' with a function in -lglu: |
---|
| 342 | AC_CHECK_LIB(glu, main) |
---|
| 343 | dnl Replace `main' with a function in -lm: |
---|
| 344 | AC_CHECK_LIB(m, main) |
---|
| 345 | |
---|
| 346 | dnl Checks for header files. |
---|
| 347 | AC_CHECK_HEADERS(sys/time.h) |
---|
| 348 | |
---|
| 349 | dnl Checks for typedefs, structures, and compiler characteristics. |
---|
| 350 | AC_HEADER_TIME |
---|
| 351 | AC_STRUCT_TM |
---|
| 352 | |
---|
| 353 | dnl Checks for library functions. |
---|
| 354 | AC_HEADER_STDC |
---|
| 355 | AC_FUNC_STRFTIME |
---|
| 356 | AC_FUNC_VPRINTF |
---|
| 357 | AC_CHECK_FUNCS(getcwd gettimeofday strstr) |
---|
| 358 | |
---|
| 359 | |
---|
| 360 | AC_OUTPUT(Makefile) |
---|