1
1
# This file is part of Autoconf. -*- Autoconf -*-
2
2
# Parameterized macros.
3
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
4
# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
3
m4_define([_AC_COPYRIGHT_YEARS],
4
[Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
5
2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software
6
8
# This program is free software: you can redistribute it and/or modify
7
9
# it under the terms of the GNU General Public License as published by
188
195
## ----------------------------- ##
196
## Implementing shell functions. ##
197
## ----------------------------- ##
200
# AC_REQUIRE_SHELL_FN(NAME-TO-CHECK, COMMENT, BODY, [DIVERSION = SHELL_FN]
201
# ------------------------------------------------------------------------
202
# Same as AS_REQUIRE_SHELL_FN except that the default diversion comes
203
# later in the script (speeding up configure --help and --version).
204
AC_DEFUN([AC_REQUIRE_SHELL_FN],
205
[AS_REQUIRE_SHELL_FN([$1], [$2], [$3], m4_default_quoted([$4], [SHELL_FN]))])
209
## ----------------------------- ##
189
210
## Implementing Autoconf loops. ##
190
211
## ----------------------------- ##
247
268
[m4_define([AC_PACKAGE_STRING], [$1 $2])])
248
269
m4_ifndef([AC_PACKAGE_BUGREPORT],
249
270
[m4_define([AC_PACKAGE_BUGREPORT], [$3])])
271
m4_ifndef([AC_PACKAGE_URL],
272
[m4_define([AC_PACKAGE_URL],
273
m4_if([$5], [], [m4_if(m4_index([$1], [GNU ]), [0],
274
[[http://www.gnu.org/software/]m4_defn([AC_PACKAGE_TARNAME])[/]])],
253
# AC_COPYRIGHT(TEXT, [VERSION-DIVERSION = VERSION_USER])
279
# AC_COPYRIGHT(TEXT, [VERSION-DIVERSION = VERSION_USER],
280
# [FILTER = m4_newline])
254
281
# ------------------------------------------------------
255
282
# Emit TEXT, a copyright notice, in the top of `configure' and in
256
# --version output. Macros in TEXT are evaluated once.
283
# --version output. Macros in TEXT are evaluated once. Process
284
# the --version output through FILTER (m4_newline, m4_do, and
285
# m4_copyright_condense are common filters).
257
286
m4_define([AC_COPYRIGHT],
258
[AS_COPYRIGHT([$1])[]dnl
259
m4_divert_text(m4_default([$2], [VERSION_USER]),
287
[AS_COPYRIGHT([$1])[]]dnl
288
[m4_divert_text(m4_default_quoted([$2], [VERSION_USER]),
289
[m4_default([$3], [m4_newline])([$1])])])# AC_COPYRIGHT
265
292
# AC_REVISION(REVISION-INFO)
342
370
# We dump to VERSION_FSF to make sure we are inserted before the
343
371
# user copyrights, and after the setup of the --version handling.
344
372
m4_define([_AC_INIT_COPYRIGHT],
346
[Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
347
2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
348
This configure script is free software; the Free Software Foundation
373
[AC_COPYRIGHT(m4_defn([_AC_COPYRIGHT_YEARS]), [VERSION_FSF], [
374
m4_copyright_condense])dnl
376
[This configure script is free software; the Free Software Foundation
349
377
gives unlimited permission to copy, distribute and modify it.],
378
[VERSION_FSF], [m4_echo])])
354
381
# File Descriptors
1305
1341
# confdefs.h avoids OS command line length limits that DEFS can exceed.
1306
1342
rm -f -r conftest* confdefs.h
1307
1344
dnl AIX cpp loses on an empty file, NextStep 3.3 (patch 3) loses on a file
1308
1345
dnl containing less than 14 bytes (including the newline).
1309
dnl But the defines below solve this problem.
1346
AS_ECHO(["/* confdefs.h */"]) > confdefs.h
1311
1348
# Predefined preprocessor variables.
1312
1349
AC_DEFINE_UNQUOTED([PACKAGE_NAME], ["$PACKAGE_NAME"],
1313
[Define to the full name of this package.])
1350
[Define to the full name of this package.])dnl
1314
1351
AC_DEFINE_UNQUOTED([PACKAGE_TARNAME], ["$PACKAGE_TARNAME"],
1315
[Define to the one symbol short name of this package.])
1352
[Define to the one symbol short name of this package.])dnl
1316
1353
AC_DEFINE_UNQUOTED([PACKAGE_VERSION], ["$PACKAGE_VERSION"],
1317
[Define to the version of this package.])
1354
[Define to the version of this package.])dnl
1318
1355
AC_DEFINE_UNQUOTED([PACKAGE_STRING], ["$PACKAGE_STRING"],
1319
[Define to the full name and version of this package.])
1356
[Define to the full name and version of this package.])dnl
1320
1357
AC_DEFINE_UNQUOTED([PACKAGE_BUGREPORT], ["$PACKAGE_BUGREPORT"],
1321
1358
[Define to the address where bug reports for this package
1359
should be sent.])dnl
1360
AC_DEFINE_UNQUOTED([PACKAGE_URL], ["$PACKAGE_URL"],
1361
[Define to the home page for this package.])
1324
1363
# Let the site file select an alternate cache file if it wants to.
1342
# AC_INIT([PACKAGE, VERSION, [BUG-REPORT])
1343
# ----------------------------------------
1381
# AC_INIT([PACKAGE, VERSION, [BUG-REPORT], [TARNAME], [URL])
1382
# ----------------------------------------------------------
1344
1383
# Include the user macro files, prepare the diversions, and output the
1345
1384
# preamble of the `configure' script.
1386
# If BUG-REPORT is omitted, do without (unless the user previously
1387
# defined the m4 macro AC_PACKAGE_BUGREPORT). If TARNAME is omitted,
1388
# use PACKAGE to seed it. If URL is omitted, use
1389
# `http://www.gnu.org/software/TARNAME/' if PACKAGE begins with `GNU',
1390
# otherwise, do without.
1346
1392
# Note that the order is important: first initialize, then set the
1347
1393
# AC_CONFIG_SRCDIR.
1348
1394
m4_define([AC_INIT],
1650
1700
AC_DEFUN([AC_CONFIG_AUX_DIRS],
1652
1702
for ac_dir in $1; do
1653
if test -f "$ac_dir/install-sh"; then
1655
ac_install_sh="$ac_aux_dir/install-sh -c"
1657
elif test -f "$ac_dir/install.sh"; then
1659
ac_install_sh="$ac_aux_dir/install.sh -c"
1661
elif test -f "$ac_dir/shtool"; then
1663
ac_install_sh="$ac_aux_dir/shtool install -c"
1703
for ac_t in install-sh install.sh shtool; do
1704
if test -f "$ac_dir/$ac_t"; then
1706
ac_install_sh="$ac_aux_dir/$ac_t -c"
1667
1711
if test -z "$ac_aux_dir"; then
1668
AC_MSG_ERROR([cannot find install-sh or install.sh in $1])
1712
AC_MSG_ERROR([cannot find install-sh, install.sh, or shtool in $1])
1671
1715
# These three variables are undocumented and unsupported,
2038
2083
# Set VARIABLE to VALUE, verbatim, or 1. Remember the value
2039
2084
# and if VARIABLE is affected the same VALUE, do nothing, else
2040
2085
# die. The third argument is used by autoheader.
2041
m4_define([AC_DEFINE], [_AC_DEFINE_Q([\], $@)])
2086
m4_define([AC_DEFINE], [_AC_DEFINE_Q([_$0], $@)])
2088
# _AC_DEFINE(STRING)
2089
# ------------------
2090
# Append the pre-expanded STRING and a newline to confdefs.h, as if by
2091
# a quoted here-doc.
2092
m4_define([_AC_DEFINE],
2093
[AS_ECHO(["AS_ESCAPE([[$1]])"]) >>confdefs.h])
2044
2096
# AC_DEFINE_UNQUOTED(VARIABLE, [VALUE], [DESCRIPTION])
2045
2097
# ----------------------------------------------------
2046
# Similar, but perform shell substitutions $ ` \ once on VALUE.
2047
m4_define([AC_DEFINE_UNQUOTED], [_AC_DEFINE_Q([], $@)])
2050
# _AC_DEFINE_Q(QUOTE, VARIABLE, [VALUE], [DESCRIPTION])
2098
# Similar, but perform shell substitutions $ ` \ once on VALUE, as
2099
# in an unquoted here-doc.
2100
m4_define([AC_DEFINE_UNQUOTED], [_AC_DEFINE_Q([_$0], $@)])
2102
# _AC_DEFINE_UNQUOTED(STRING)
2103
# ---------------------------
2104
# Append the pre-expanded STRING and a newline to confdefs.h, as if
2105
# with an unquoted here-doc, but avoiding a fork in the common case of
2106
# no backslash, no command substitution, no complex variable
2107
# substitution, and no quadrigraphs.
2108
m4_define([_AC_DEFINE_UNQUOTED],
2109
[m4_if(m4_bregexp([$1], [\\\|`\|\$(\|\${\|@]), [-1],
2110
[AS_ECHO(["AS_ESCAPE([$1], [""])"]) >>confdefs.h],
2111
[cat >>confdefs.h <<_ACEOF
2116
# _AC_DEFINE_Q(MACRO, VARIABLE, [VALUE], [DESCRIPTION])
2051
2117
# -----------------------------------------------------
2052
2118
# Internal function that performs common elements of AC_DEFINE{,_UNQUOTED}.
2054
# m4_index is roughly 5 to 8 times faster than m4_bpatsubst, so only
2055
# use the regex when necessary. AC_name is defined with over-quotation,
2056
# so that we can avoid m4_defn.
2119
# MACRO must take one argument, which is the fully expanded string to
2120
# append to confdefs.h as if by a possibly-quoted here-doc.
2122
# m4_index is roughly 5 to 8 times faster than m4_bpatsubst, so we use
2123
# m4_format rather than regex to grab prefix up to first (). AC_name
2124
# is defined with over-quotation, so that we can avoid m4_defn; this
2125
# is only safe because the name should not contain $.
2127
# Guarantee a match in m4_index, so as to avoid a bug with precision
2128
# -1 in m4_format in older m4.
2057
2129
m4_define([_AC_DEFINE_Q],
2058
[m4_pushdef([AC_name], m4_if(m4_index([$2], [(]), [-1], [[[$2]]],
2059
[m4_bpatsubst([[[$2]]], [(.*)])]))dnl
2060
AC_DEFINE_TRACE(AC_name)dnl
2061
m4_cond([m4_index([$3], [
2130
[m4_pushdef([AC_name], m4_format([[[%.*s]]], m4_index([$2(], [(]), [$2]))]dnl
2131
[AC_DEFINE_TRACE(AC_name)]dnl
2132
[m4_cond([m4_index([$3], [
2063
2134
[AS_LITERAL_IF([$3], [m4_bregexp([[$3]], [[^\\]
2064
2135
], [-])])], [], [],
2065
[m4_warn([syntax], [AC_DEFINE]m4_ifval([$1], [], [[_UNQUOTED]])dnl
2066
[: `$3' is not a valid preprocessor define value])])dnl
2067
m4_ifval([$4], [AH_TEMPLATE(AC_name, [$4])])dnl
2068
m4_popdef([AC_name])dnl
2069
cat >>confdefs.h <<$1_ACEOF
2070
[@%:@define] $2 m4_if([$#], 2, 1, [$3], [], [/**/], [$3])
2136
[m4_warn([syntax], [AC_DEFINE]m4_if([$1], [_AC_DEFINE], [],
2137
[[_UNQUOTED]])[: `$3' is not a valid preprocessor define value])])]dnl
2138
[m4_ifval([$4], [AH_TEMPLATE(AC_name, [$4])
2139
])_m4_popdef([AC_name])]dnl
2140
[$1(m4_expand([[@%:@define] $2 ]m4_if([$#], 2, 1,
2141
[$3], [], [/**/], [[$3]])))
2227
2298
# Note that when tracing, most shells will leave the traces in stderr
2228
2299
# starting with "+": that's what this macro tries to address.
2300
# The return code is 0 if COMMAND succeeded, so that it can be used directly
2301
# in AS_IF constructs.
2229
2302
AC_DEFUN([_AC_RUN_LOG_STDERR],
2230
[{ ($2) >&AS_MESSAGE_LOG_FD
2233
grep -v '^ *+' conftest.er1 >conftest.err
2235
cat conftest.err >&AS_MESSAGE_LOG_FD
2236
_AS_ECHO_LOG([\$? = $ac_status])
2237
(exit $ac_status); }])
2303
[{ { $2; } >&AS_MESSAGE_LOG_FD
2306
if test -s conftest.err; then
2307
grep -v '^ *+' conftest.err >conftest.er1
2308
cat conftest.er1 >&AS_MESSAGE_LOG_FD
2309
mv -f conftest.er1 conftest.err
2311
_AS_ECHO_LOG([\$? = $ac_status])
2312
test $ac_status = 0; }])
2315
# _AC_RUN_LOG_LIMIT(COMMAND, LOG-COMMANDS, [LINES])
2316
# -------------------------------------------------
2317
# Like _AC_RUN_LOG, but only log LINES lines from stderr,
2318
# defaulting to 10 lines.
2319
AC_DEFUN([_AC_RUN_LOG_LIMIT],
2320
[{ { $2; } >&AS_MESSAGE_LOG_FD
2323
if test -s conftest.err; then
2324
sed 'm4_default([$3], [10])a\
2325
... rest of stderr output deleted ...
2326
m4_default([$3], [10])q' conftest.err >conftest.er1
2327
cat conftest.er1 >&AS_MESSAGE_LOG_FD
2328
rm -f conftest.er1 conftest.err
2330
_AS_ECHO_LOG([\$? = $ac_status])
2331
test $ac_status = 0; }])
2239
2334
# _AC_DO_ECHO(COMMAND)
2240
2335
# --------------------
2241
2336
# Echo COMMAND. This is designed to be used just before evaluating COMMAND.
2242
2337
AC_DEFUN([_AC_DO_ECHO],
2243
2338
[m4_if([$1], [$ac_try], [], [ac_try="$1"
2245
2340
dnl If the string contains '\"', '`', or '\\', then just echo it rather
2246
2341
dnl than expanding it. This is a hack, but it is safer, while also
2247
2342
dnl typically expanding simple substrings like '$CC', which is what we want.
2368
2488
# This macro can be used during the selection of a preprocessor.
2369
2489
# eval is necessary to expand ac_cpp.
2370
2490
AC_DEFUN([_AC_PREPROC_IFELSE],
2371
[m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl
2372
AS_IF([_AC_DO_STDERR([$ac_cpp conftest.$ac_ext]) >/dev/null && {
2373
test -z "$ac_[]_AC_LANG_ABBREV[]_preproc_warn_flag$ac_[]_AC_LANG_ABBREV[]_werror_flag" ||
2374
test ! -s conftest.err
2377
[_AC_MSG_LOG_CONFTEST
2379
rm -f conftest.err m4_ifval([$1], [conftest.$ac_ext])[]dnl
2491
[AC_REQUIRE_SHELL_FN([ac_fn_]_AC_LANG_ABBREV[_try_cpp],
2492
[AS_FUNCTION_DESCRIBE([ac_fn_]_AC_LANG_ABBREV[_try_cpp], [LINENO],
2493
[Try to preprocess conftest.$ac_ext, and return whether this succeeded.])],
2495
[m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])]dnl
2496
[AS_IF([ac_fn_[]_AC_LANG_ABBREV[]_try_cpp "$LINENO"], [$2], [$3])
2497
rm -f conftest.err[]m4_ifval([$1], [ conftest.$ac_ext])[]dnl
2380
2498
])# _AC_PREPROC_IFELSE
2383
2500
# AC_PREPROC_IFELSE(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
2384
2501
# ---------------------------------------------------------------
2385
2502
# Try to preprocess PROGRAM. Requires that the preprocessor for the
2435
2552
## Examining syntax. ##
2436
2553
## ------------------ ##
2555
# _AC_COMPILE_IFELSE_BODY
2556
# -----------------------
2557
# Shell function body for _AC_COMPILE_IFELSE.
2558
m4_define([_AC_COMPILE_IFELSE_BODY],
2559
[ AS_LINENO_PUSH([$[]1])
2560
rm -f conftest.$ac_objext
2561
AS_IF([_AC_DO_STDERR($ac_compile) && {
2562
test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag" ||
2563
test ! -s conftest.err
2564
} && test -s conftest.$ac_objext],
2566
[_AC_MSG_LOG_CONFTEST
2570
])# _AC_COMPILE_IFELSE_BODY
2439
2573
# _AC_COMPILE_IFELSE(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
2440
2574
# ----------------------------------------------------------------
2441
2575
# Try to compile PROGRAM.
2442
2576
# This macro can be used during the selection of a compiler.
2443
m4_define([_AC_COMPILE_IFELSE],
2444
[m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl
2445
rm -f conftest.$ac_objext
2446
AS_IF([_AC_DO_STDERR($ac_compile) && {
2447
test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag" ||
2448
test ! -s conftest.err
2449
} && test -s conftest.$ac_objext],
2451
[_AC_MSG_LOG_CONFTEST
2453
rm -f core conftest.err conftest.$ac_objext m4_ifval([$1], [conftest.$ac_ext])[]dnl
2577
AC_DEFUN([_AC_COMPILE_IFELSE],
2578
[AC_REQUIRE_SHELL_FN([ac_fn_]_AC_LANG_ABBREV[_try_compile],
2579
[AS_FUNCTION_DESCRIBE([ac_fn_]_AC_LANG_ABBREV[_try_compile], [LINENO],
2580
[Try to compile conftest.$ac_ext, and return whether this succeeded.])],
2582
[m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])]dnl
2583
[AS_IF([ac_fn_[]_AC_LANG_ABBREV[]_try_compile "$LINENO"], [$2], [$3])
2584
rm -f core conftest.err conftest.$ac_objext[]m4_ifval([$1], [ conftest.$ac_ext])[]dnl
2454
2585
])# _AC_COMPILE_IFELSE
2477
2608
## --------------------- ##
2611
# _AC_LINK_IFELSE_BODY
2612
# --------------------
2613
# Shell function body for _AC_LINK_IFELSE.
2614
m4_define([_AC_LINK_IFELSE_BODY],
2615
[ AS_LINENO_PUSH([$[]1])
2616
rm -f conftest.$ac_objext conftest$ac_exeext
2617
AS_IF([_AC_DO_STDERR($ac_link) && {
2618
test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag" ||
2619
test ! -s conftest.err
2620
} && test -s conftest$ac_exeext && {
2621
test "$cross_compiling" = yes ||
2622
AS_TEST_X([conftest$ac_exeext])
2625
[_AC_MSG_LOG_CONFTEST
2627
# Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
2628
# created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
2629
# interfere with the next link command; also delete a directory that is
2630
# left behind by Apple's compiler. We do this before executing the actions.
2631
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
2634
])# _AC_LINK_IFELSE_BODY
2480
2637
# _AC_LINK_IFELSE(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
2481
2638
# -------------------------------------------------------------
2482
2639
# Try to link PROGRAM.
2488
2645
# reported by Chris Johns in
2489
2646
# <http://lists.gnu.org/archive/html/autoconf/2007-03/msg00085.html>.
2491
m4_define([_AC_LINK_IFELSE],
2492
[m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl
2493
rm -f conftest.$ac_objext conftest$ac_exeext
2494
AS_IF([_AC_DO_STDERR($ac_link) && {
2495
test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag" ||
2496
test ! -s conftest.err
2497
} && test -s conftest$ac_exeext && {
2498
test "$cross_compiling" = yes ||
2499
AS_TEST_X([conftest$ac_exeext])
2502
[_AC_MSG_LOG_CONFTEST
2504
dnl Delete also the IPA/IPO (Inter Procedural Analysis/Optimization)
2505
dnl information created by the PGI compiler (conftest_ipa8_conftest.oo),
2506
dnl as it would interfere with the next link command.
2507
rm -rf conftest.dSYM
2508
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
2509
conftest$ac_exeext m4_ifval([$1], [conftest.$ac_ext])[]dnl
2648
AC_DEFUN([_AC_LINK_IFELSE],
2649
[AC_REQUIRE_SHELL_FN([ac_fn_]_AC_LANG_ABBREV[_try_link],
2650
[AS_FUNCTION_DESCRIBE([ac_fn_]_AC_LANG_ABBREV[_try_link], [LINENO],
2651
[Try to link conftest.$ac_ext, and return whether this succeeded.])],
2653
[m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])]dnl
2654
[AS_IF([ac_fn_[]_AC_LANG_ABBREV[]_try_link "$LINENO"], [$2], [$3])
2655
rm -f core conftest.err conftest.$ac_objext \
2656
conftest$ac_exeext[]m4_ifval([$1], [ conftest.$ac_ext])[]dnl
2510
2657
])# _AC_LINK_IFELSE
2550
2713
# We also remove conftest.o as if the compilation fails, some compilers
2551
2714
# don't remove it. We remove gmon.out and bb.out, which may be
2552
2715
# created during the run if the program is built with profiling support.
2553
m4_define([_AC_RUN_IFELSE],
2554
[m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl
2555
rm -f conftest$ac_exeext
2556
AS_IF([_AC_DO_VAR(ac_link) && _AC_DO_TOKENS(./conftest$ac_exeext)],
2558
[AS_ECHO(["$as_me: program exited with status $ac_status"]) >&AS_MESSAGE_LOG_FD
2559
_AC_MSG_LOG_CONFTEST
2561
[( exit $ac_status )
2563
rm -rf conftest.dSYM
2564
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext m4_ifval([$1],
2565
[conftest.$ac_ext])[]dnl
2716
AC_DEFUN([_AC_RUN_IFELSE],
2717
[AC_REQUIRE_SHELL_FN([ac_fn_]_AC_LANG_ABBREV[_try_run],
2718
[AS_FUNCTION_DESCRIBE([ac_fn_]_AC_LANG_ABBREV[_try_run], [LINENO],
2719
[Try to link conftest.$ac_ext, and return whether this succeeded.
2720
Assumes that executables *can* be run.])],
2722
[m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])]dnl
2723
[AS_IF([ac_fn_[]_AC_LANG_ABBREV[]_try_run "$LINENO"], [$2], [$3])
2724
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
2725
conftest.$ac_objext conftest.beam[]m4_ifval([$1], [ conftest.$ac_ext])[]dnl
2566
2726
])# _AC_RUN_IFELSE
2569
2728
# AC_RUN_IFELSE(PROGRAM,
2570
2729
# [ACTION-IF-TRUE], [ACTION-IF-FALSE],
2571
2730
# [ACTION-IF-CROSS-COMPILING = RUNTIME-ERROR])
2615
2774
AS_VAR_SET([ac_File], [no])
2617
AS_VAR_IF([ac_File], [yes], [$2], [$3])[]dnl
2776
AS_VAR_IF([ac_File], [yes], [$2], [$3])
2618
2777
AS_VAR_POPDEF([ac_File])dnl
2619
2778
])# AC_CHECK_FILE
2781
# _AC_CHECK_FILES(FILE)
2782
# ---------------------
2783
# Helper to AC_CHECK_FILES, which generates two of the three arguments
2784
# to AC_CHECK_FILE based on FILE.
2785
m4_define([_AC_CHECK_FILES],
2786
[[$1], [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_$1]), [1],
2787
[Define to 1 if you have the file `$1'.])]])
2622
2790
# AC_CHECK_FILES(FILE..., [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
2623
2791
# -----------------------------------------------------------------
2792
# For each word in the whitespace-separated FILE list, perform either
2793
# ACTION-IF-FOUND or ACTION-IF-NOT-FOUND. For files that exist, also
2794
# provide the preprocessor variable HAVE_FILE.
2624
2795
AC_DEFUN([AC_CHECK_FILES],
2625
[m4_foreach_w([AC_FILE_NAME], [$1],
2626
[AC_CHECK_FILE(AC_FILE_NAME,
2627
[AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]AC_FILE_NAME), 1,
2628
[Define to 1 if you have the
2796
[m4_map_args_w([$1], [AC_CHECK_FILE(_$0(], [)[$2], [$3])])])
2634
2799
## ------------------------------- ##
2636
2801
## ------------------------------- ##
2804
# _AC_CHECK_DECL_BODY
2805
# -------------------
2806
# Shell function body for AC_CHECK_DECL.
2807
m4_define([_AC_CHECK_DECL_BODY],
2808
[ AS_LINENO_PUSH([$[]1])
2809
AC_CACHE_CHECK([whether $[]2 is declared], [$[]3],
2810
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$[]4],
2815
[AS_VAR_SET([$[]3], [yes])],
2816
[AS_VAR_SET([$[]3], [no])])])
2818
])# _AC_CHECK_DECL_BODY
2639
2820
# AC_CHECK_DECL(SYMBOL,
2640
2821
# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
2641
2822
# [INCLUDES = DEFAULT-INCLUDES])
2642
2823
# -------------------------------------------------------
2643
2824
# Check whether SYMBOL (a function, variable, or constant) is declared.
2644
2825
AC_DEFUN([AC_CHECK_DECL],
2645
[AS_VAR_PUSHDEF([ac_Symbol], [ac_cv_have_decl_$1])dnl
2646
AC_CACHE_CHECK([whether $1 is declared], [ac_Symbol],
2647
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT([$4])],
2652
[AS_VAR_SET([ac_Symbol], [yes])],
2653
[AS_VAR_SET([ac_Symbol], [no])])])
2654
AS_VAR_IF([ac_Symbol], [yes], [$2], [$3])[]dnl
2826
[AC_REQUIRE_SHELL_FN([ac_fn_]_AC_LANG_ABBREV[_check_decl],
2827
[AS_FUNCTION_DESCRIBE([ac_fn_]_AC_LANG_ABBREV[_check_decl],
2828
[LINENO SYMBOL VAR],
2829
[Tests whether SYMBOL is declared, setting cache variable VAR accordingly.])],
2831
[AS_VAR_PUSHDEF([ac_Symbol], [ac_cv_have_decl_$1])]dnl
2832
[ac_fn_[]_AC_LANG_ABBREV[]_check_decl ]dnl
2833
["$LINENO" "$1" "ac_Symbol" "AS_ESCAPE([AC_INCLUDES_DEFAULT([$4])], [""])"
2834
AS_VAR_IF([ac_Symbol], [yes], [$2], [$3])
2655
2835
AS_VAR_POPDEF([ac_Symbol])dnl
2656
2836
])# AC_CHECK_DECL
2839
# _AC_CHECK_DECLS(SYMBOL, ACTION-IF_FOUND, ACTION-IF-NOT-FOUND,
2841
# -------------------------------------------------------------
2842
# Helper to AC_CHECK_DECLS, which generates the check for a single
2843
# SYMBOL with INCLUDES, performs the AC_DEFINE, then expands
2844
# ACTION-IF-FOUND or ACTION-IF-NOT-FOUND.
2845
m4_define([_AC_CHECK_DECLS],
2846
[AC_CHECK_DECL([$1], [ac_have_decl=1], [ac_have_decl=0], [$4])]dnl
2847
[AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_DECL_$1]), [$ac_have_decl],
2848
[Define to 1 if you have the declaration of `$1',
2849
and to 0 if you don't.])]dnl
2850
[m4_ifvaln([$2$3], [AS_IF([test $ac_have_decl = 1], [$2], [$3])])])
2659
2852
# AC_CHECK_DECLS(SYMBOLS,
2660
2853
# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
2661
2854
# [INCLUDES = DEFAULT-INCLUDES])
2664
2857
# documentation for a detailed explanation of this difference with
2665
2858
# other AC_CHECK_*S macros. SYMBOLS is an m4 list.
2666
2859
AC_DEFUN([AC_CHECK_DECLS],
2667
[m4_foreach([AC_Symbol], [$1],
2668
[AC_CHECK_DECL(AC_Symbol,
2669
[AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_DECL_]AC_Symbol), 1,
2670
[Define to 1 if you have the declaration
2671
of `]AC_Symbol[', and to 0 if you don't.])
2673
[AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_DECL_]AC_Symbol), 0)
2860
[m4_map_args_sep([_$0(], [, [$2], [$3], [$4])], [], $1)])
2863
# _AC_CHECK_DECL_ONCE(SYMBOL)
2864
# ---------------------------
2865
# Check for a single SYMBOL once.
2866
m4_define([_AC_CHECK_DECL_ONCE],
2867
[AC_DEFUN([_AC_Check_Decl_$1], [_AC_CHECK_DECLS([$1])])]dnl
2868
[AC_REQUIRE([_AC_Check_Decl_$1])])
2679
2870
# AC_CHECK_DECLS_ONCE(SYMBOLS)
2680
2871
# ----------------------------
2681
2872
# Like AC_CHECK_DECLS(SYMBOLS), but do it at most once.
2682
2873
AC_DEFUN([AC_CHECK_DECLS_ONCE],
2684
m4_foreach([AC_Symbol], [$1],
2685
[AC_DEFUN([_AC_Check_Decl_]m4_defn([AC_Symbol]),
2686
[AC_CHECK_DECLS(m4_defn([AC_Symbol]))])
2687
AC_REQUIRE([_AC_Check_Decl_]m4_defn([AC_Symbol]))])
2874
[m4_map_args_sep([_AC_CHECK_DECL_ONCE(], [)], [], $1)])
2778
2964
_AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$3], [($1) <= $ac_mid])],
2779
2965
[ac_hi=$ac_mid; break],
2780
[ac_lo=`expr $ac_mid + 1`
2966
[AS_VAR_ARITH([ac_lo], [$ac_mid + 1])
2781
2967
if test $ac_lo -le $ac_mid; then
2785
ac_mid=`expr 2 '*' $ac_mid + 1`])
2971
AS_VAR_ARITH([ac_mid], [2 '*' $ac_mid + 1])])
2787
2973
[AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$3], [($1) < 0])],
2788
2974
[ac_hi=-1 ac_mid=-1
2790
2976
_AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$3], [($1) >= $ac_mid])],
2791
2977
[ac_lo=$ac_mid; break],
2792
[ac_hi=`expr '(' $ac_mid ')' - 1`
2978
[AS_VAR_ARITH([ac_hi], ['(' $ac_mid ')' - 1])
2793
2979
if test $ac_mid -le $ac_hi; then
2797
ac_mid=`expr 2 '*' $ac_mid`])
2983
AS_VAR_ARITH([ac_mid], [2 '*' $ac_mid])])
2799
2985
[ac_lo= ac_hi=])])
2800
2986
# Binary search between lo and hi bounds.
2801
2987
while test "x$ac_lo" != "x$ac_hi"; do
2802
ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
2988
AS_VAR_ARITH([ac_mid], ['(' $ac_hi - $ac_lo ')' / 2 + $ac_lo])
2803
2989
_AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$3], [($1) <= $ac_mid])],
2804
[ac_hi=$ac_mid], [ac_lo=`expr '(' $ac_mid ')' + 1`])
2991
[AS_VAR_ARITH([ac_lo], ['(' $ac_mid ')' + 1])])
2993
case $ac_lo in @%:@((
2994
?*) AS_VAR_SET([$2], [$ac_lo]); $4 ;;
2810
2997
])# _AC_COMPUTE_INT_COMPILE
2813
# _AC_COMPUTE_INT_RUN(EXPRESSION, VARIABLE, PROLOGUE, [IF-FAILS])
2814
# ---------------------------------------------------------------
3000
# _AC_COMPUTE_INT_RUN(EXPRESSION, VARIABLE, PROLOGUE, [IF-SUCCESS],
3002
# -----------------------------------------------------------------
2815
3003
# Store the evaluation of the integer EXPRESSION in VARIABLE.
3005
# AC_LANG_INT_SAVE intentionally does not end the file in a newline, so
3006
# we must add one to make it a text file before passing it to read.
2816
3007
m4_define([_AC_COMPUTE_INT_RUN],
2817
3008
[_AC_RUN_IFELSE([AC_LANG_INT_SAVE([$3], [$1])],
2818
[$2=`cat conftest.val`], [$4])])
3009
[echo >>conftest.val; read $2 <conftest.val; $4], [$5])
3011
])# _AC_COMPUTE_INT_RUN
3014
# _AC_COMPUTE_INT_BODY
3015
# --------------------
3016
# Shell function body for AC_COMPUTE_INT.
3017
m4_define([_AC_COMPUTE_INT_BODY],
3018
[ AS_LINENO_PUSH([$[]1])
3019
if test "$cross_compiling" = yes; then
3020
_AC_COMPUTE_INT_COMPILE([$[]2], [$[]3], [$[]4],
3021
[ac_retval=0], [ac_retval=1])
3023
_AC_COMPUTE_INT_RUN([$[]2], [$[]3], [$[]4],
3024
[ac_retval=0], [ac_retval=1])
3028
])# _AC_COMPUTE_INT_BODY
2821
3030
# AC_COMPUTE_INT(VARIABLE, EXPRESSION, PROLOGUE, [IF-FAILS])
2822
3031
# ----------------------------------------------------------
3032
# Store into the shell variable VARIABLE the value of the integer C expression
3033
# EXPRESSION. The value should fit in an initializer in a C variable of type
3034
# `signed long'. If no PROLOGUE are specified, the default includes are used.
3035
# IF-FAILS is evaluated if the value cannot be found (which includes the
3036
# case of cross-compilation, if EXPRESSION is not computable at compile-time.
2823
3037
AC_DEFUN([AC_COMPUTE_INT],
2824
[AC_LANG_COMPILER_REQUIRE()dnl
2825
if test "$cross_compiling" = yes; then
2826
_AC_COMPUTE_INT_COMPILE([$2], [$1], [$3], [$4])
2828
_AC_COMPUTE_INT_RUN([$2], [$1], [$3], [$4])
2830
rm -f conftest.val[]dnl
3038
[AC_LANG_COMPILER_REQUIRE()]dnl
3039
[AC_REQUIRE_SHELL_FN([ac_fn_]_AC_LANG_ABBREV[_compute_int],
3040
[AS_FUNCTION_DESCRIBE([ac_fn_]_AC_LANG_ABBREV[_compute_int],
3041
[LINENO EXPR VAR INCLUDES],
3042
[Tries to find the compile-time value of EXPR in a program that includes
3043
INCLUDES, setting VAR accordingly. Returns whether the value could
3046
[AS_IF([ac_fn_[]_AC_LANG_ABBREV[]_compute_int "$LINENO" "$2" "$1" ]dnl
3047
["AS_ESCAPE([$3], [""])"],
2833
3051
# _AC_COMPUTE_INT(EXPRESSION, VARIABLE, PROLOGUE, [IF-FAILS])
2834
3052
# -----------------------------------------------------------