1 # This file is part of Autoconf. -*- Autoconf -*-
2 # Programming languages support.
3 # Copyright (C) 2001-2012 Free Software Foundation, Inc.
5 # This file is part of Autoconf. This program is free
6 # software; you can redistribute it and/or modify it under the
7 # terms of the GNU General Public License as published by the
8 # Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # Under Section 7 of GPL version 3, you are granted additional
17 # permissions described in the Autoconf Configure Script Exception,
18 # version 3.0, as published by the Free Software Foundation.
20 # You should have received a copy of the GNU General Public License
21 # and a copy of the Autoconf Configure Script Exception along with
22 # this program; see the files COPYINGv3 and COPYING.EXCEPTION
23 # respectively. If not, see <http://www.gnu.org/licenses/>.
25 # Written by David MacKenzie, with help from
26 # Akim Demaille, Paul Eggert,
27 # Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
28 # Roland McGrath, Noah Friedman, david d zuhn, and many others.
33 # 1. Language selection
34 # 2. and routines to produce programs in a given language.
40 # 3. Looking for a compiler
41 # And possibly the associated preprocessor.
42 # 3a. C 3b. C++ 3c. Objective C 3d. Objective C++
44 # 4. Compilers' characteristics.
49 ## ----------------------- ##
50 ## 1a/2a. The C language. ##
51 ## ----------------------- ##
54 # ------------------------ #
55 # 1a. Language selection. #
56 # ------------------------ #
60 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
61 AC_LANG_DEFINE([C], [c], [C], [CC], [],
63 ac_cpp='$CPP $CPPFLAGS'
64 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&AS_MESSAGE_LOG_FD'
65 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AS_MESSAGE_LOG_FD'
66 ac_compiler_gnu=$ac_cv_c_compiler_gnu
72 AU_DEFUN([AC_LANG_C], [AC_LANG(C)])
75 # ------------------------ #
76 # 2a. Producing programs. #
77 # ------------------------ #
80 # AC_LANG_CONFTEST(C)(BODY)
81 # -------------------------
82 # We can't use '#line $LINENO "configure"' here, since
83 # Sun c89 (Sun WorkShop 6 update 2 C 5.3 Patch 111679-08 2002/05/09)
84 # rejects $LINENO greater than 32767, and some configure scripts
85 # are longer than 32767 lines.
86 m4_define([AC_LANG_CONFTEST(C)],
87 [cat confdefs.h - <<_ACEOF >conftest.$ac_ext
93 # AC_LANG_PROGRAM(C)([PROLOGUE], [BODY])
94 # --------------------------------------
95 m4_define([AC_LANG_PROGRAM(C)],
97 m4_ifdef([_AC_LANG_PROGRAM_C_F77_HOOKS], [_AC_LANG_PROGRAM_C_F77_HOOKS])[]dnl
98 m4_ifdef([_AC_LANG_PROGRAM_C_FC_HOOKS], [_AC_LANG_PROGRAM_C_FC_HOOKS])[]dnl
102 dnl Do *not* indent the following line: there may be CPP directives.
103 dnl Don't move the `;' right after for the same reason.
110 # _AC_LANG_IO_PROGRAM(C)
111 # ----------------------
112 # Produce source that performs I/O, necessary for proper
113 # cross-compiler detection.
114 m4_define([_AC_LANG_IO_PROGRAM(C)],
115 [AC_LANG_PROGRAM([@%:@include <stdio.h>],
116 [FILE *f = fopen ("conftest.out", "w");
117 return ferror (f) || fclose (f) != 0;
121 # AC_LANG_CALL(C)(PROLOGUE, FUNCTION)
122 # -----------------------------------
123 # Avoid conflicting decl of main.
124 m4_define([AC_LANG_CALL(C)],
126 m4_if([$2], [main], ,
127 [/* Override any GCC internal prototype to avoid an error.
128 Use char because int might match the return type of a GCC
129 builtin and then its argument prototype would still apply. */
133 char $2 ();])], [return $2 ();])])
136 # AC_LANG_FUNC_LINK_TRY(C)(FUNCTION)
137 # ----------------------------------
138 # Don't include <ctype.h> because on OSF/1 3.0 it includes
139 # <sys/types.h> which includes <sys/select.h> which contains a
140 # prototype for select. Similarly for bzero.
142 # This test used to merely assign f=$1 in main(), but that was
143 # optimized away by HP unbundled cc A.05.36 for ia64 under +O3,
144 # presumably on the basis that there's no need to do that store if the
145 # program is about to exit. Conversely, the AIX linker optimizes an
146 # unused external declaration that initializes f=$1. So this test
147 # program has both an external initialization of f, and a use of f in
148 # main that affects the exit status.
150 m4_define([AC_LANG_FUNC_LINK_TRY(C)],
152 [/* Define $1 to an innocuous variant, in case <limits.h> declares $1.
153 For example, HP-UX 11i <limits.h> declares gettimeofday. */
154 #define $1 innocuous_$1
156 /* System header to define __stub macros and hopefully few prototypes,
157 which can conflict with char $1 (); below.
158 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
159 <limits.h> exists even on freestanding compilers. */
169 /* Override any GCC internal prototype to avoid an error.
170 Use char because int might match the return type of a GCC
171 builtin and then its argument prototype would still apply. */
176 /* The GNU C library defines this for functions which it implements
177 to always fail with ENOSYS. Some functions are actually named
178 something starting with __ and the normal name is an alias. */
179 #if defined __stub_$1 || defined __stub___$1
182 ], [return $1 ();])])
185 # AC_LANG_BOOL_COMPILE_TRY(C)(PROLOGUE, EXPRESSION)
186 # -------------------------------------------------
187 # Return a program that is valid if EXPRESSION is nonzero.
188 # EXPRESSION must be an integer constant expression.
189 # Be sure to use this array to avoid `unused' warnings, which are even
190 # errors with `-W error'.
191 m4_define([AC_LANG_BOOL_COMPILE_TRY(C)],
192 [AC_LANG_PROGRAM([$1], [static int test_array @<:@1 - 2 * !($2)@:>@;
193 test_array @<:@0@:>@ = 0;
194 return test_array @<:@0@:>@;
198 # AC_LANG_INT_SAVE(C)(PROLOGUE, EXPRESSION)
199 # -----------------------------------------
200 # We need `stdio.h' to open a `FILE' and `stdlib.h' for `exit'.
201 # But we include them only after the EXPRESSION has been evaluated.
202 m4_define([AC_LANG_INT_SAVE(C)],
204 static long int longval () { return $2; }
205 static unsigned long int ulongval () { return $2; }
206 @%:@include <stdio.h>
207 @%:@include <stdlib.h>],
209 FILE *f = fopen ("conftest.val", "w");
214 long int i = longval ();
217 fprintf (f, "%ld", i);
221 unsigned long int i = ulongval ();
224 fprintf (f, "%lu", i);
226 /* Do not output a trailing newline, as this causes \r\n confusion
227 on some platforms. */
228 return ferror (f) || fclose (f) != 0;
233 ## ---------------------- ##
234 ## 1b. The C++ language. ##
235 ## ---------------------- ##
240 # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
241 AC_LANG_DEFINE([C++], [cxx], [CXX], [CXX], [C],
243 ac_cpp='$CXXCPP $CPPFLAGS'
244 ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&AS_MESSAGE_LOG_FD'
245 ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AS_MESSAGE_LOG_FD'
246 ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
252 AU_DEFUN([AC_LANG_CPLUSPLUS], [AC_LANG(C++)])
256 ## ------------------------------ ##
257 ## 1c. The Objective C language. ##
258 ## ------------------------------ ##
261 # AC_LANG(Objective C)
262 # --------------------
263 AC_LANG_DEFINE([Objective C], [objc], [OBJC], [OBJC], [C],
265 ac_cpp='$OBJCPP $CPPFLAGS'
266 ac_compile='$OBJC -c $OBJCFLAGS $CPPFLAGS conftest.$ac_ext >&AS_MESSAGE_LOG_FD'
267 ac_link='$OBJC -o conftest$ac_exeext $OBJCFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AS_MESSAGE_LOG_FD'
268 ac_compiler_gnu=$ac_cv_objc_compiler_gnu
274 AU_DEFUN([AC_LANG_OBJC], [AC_LANG(Objective C)])
278 ## -------------------------------- ##
279 ## 1d. The Objective C++ language. ##
280 ## -------------------------------- ##
283 # AC_LANG(Objective C++)
284 # ----------------------
285 AC_LANG_DEFINE([Objective C++], [objcxx], [OBJCXX], [OBJCXX], [C++],
287 ac_cpp='$OBJCXXCPP $CPPFLAGS'
288 ac_compile='$OBJCXX -c $OBJCXXFLAGS $CPPFLAGS conftest.$ac_ext >&AS_MESSAGE_LOG_FD'
289 ac_link='$OBJCXX -o conftest$ac_exeext $OBJCXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AS_MESSAGE_LOG_FD'
290 ac_compiler_gnu=$ac_cv_objcxx_compiler_gnu
295 ## -------------------------------------------- ##
296 ## 3. Looking for Compilers and Preprocessors. ##
297 ## -------------------------------------------- ##
299 # -------------------- #
300 # 3a. The C compiler. #
301 # -------------------- #
304 # _AC_ARG_VAR_CPPFLAGS
305 # --------------------
306 # Document and register CPPFLAGS, which is used by
307 # AC_PROG_{CC, CPP, CXX, CXXCPP, OBJC, OBJCPP, OBJCXX, OBJCXXCPP}.
308 AC_DEFUN([_AC_ARG_VAR_CPPFLAGS],
309 [AC_ARG_VAR([CPPFLAGS],
310 [(Objective) C/C++ preprocessor flags, e.g. -I<include dir>
311 if you have headers in a nonstandard directory <include dir>])])
314 # _AC_ARG_VAR_LDFLAGS
315 # -------------------
316 # Document and register LDFLAGS, which is used by
317 # AC_PROG_{CC, CXX, F77, FC, OBJC, OBJCXX}.
318 AC_DEFUN([_AC_ARG_VAR_LDFLAGS],
319 [AC_ARG_VAR([LDFLAGS],
320 [linker flags, e.g. -L<lib dir> if you have libraries in a
321 nonstandard directory <lib dir>])])
326 # Document and register LIBS, which is used by
327 # AC_PROG_{CC, CXX, F77, FC, OBJC, OBJCXX}.
328 AC_DEFUN([_AC_ARG_VAR_LIBS],
330 [libraries to pass to the linker, e.g. -l<library>])])
335 # Find the C preprocessor. Must be AC_DEFUN'd to be AC_REQUIRE'able.
336 AC_DEFUN([AC_LANG_PREPROC(C)],
337 [AC_REQUIRE([AC_PROG_CPP])])
340 # _AC_PROG_PREPROC_WORKS_IFELSE(IF-WORKS, IF-NOT)
341 # -----------------------------------------------
342 # Check if $ac_cpp is a working preprocessor that can flag absent
343 # includes either by the exit status or by warnings.
344 # This macro is for all languages, not only C.
345 AC_DEFUN([_AC_PROG_PREPROC_WORKS_IFELSE],
347 for ac_[]_AC_LANG_ABBREV[]_preproc_warn_flag in '' yes
349 # Use a header file that comes with gcc, so configuring glibc
350 # with a fresh cross-compiler works.
351 # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
352 # <limits.h> exists even on freestanding compilers.
353 # On the NeXT, cc -E runs the code through the compiler's parser,
354 # not just through cpp. "Syntax error" is here to catch this case.
355 _AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@ifdef __STDC__
356 @%:@ include <limits.h>
358 @%:@ include <assert.h>
362 [# Broken: fails on valid input.
365 # OK, works on sane cases. Now check whether nonexistent headers
366 # can be detected and how.
367 _AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@include <ac_nonexistent.h>]])],
368 [# Broken: success on invalid input.
370 [# Passes both tests.
375 # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
376 rm -f conftest.i conftest.err conftest.$ac_ext
377 AS_IF([$ac_preproc_ok], [$1], [$2])
378 ])# _AC_PROG_PREPROC_WORKS_IFELSE
383 # Find a working C preprocessor.
384 # We shouldn't have to require AC_PROG_CC, but this is due to the concurrency
385 # between the AC_LANG_COMPILER_REQUIRE family and that of AC_PROG_CC.
386 AN_MAKEVAR([CPP], [AC_PROG_CPP])
387 AN_PROGRAM([cpp], [AC_PROG_CPP])
388 AC_DEFUN([AC_PROG_CPP],
389 [AC_REQUIRE([AC_PROG_CC])dnl
390 AC_ARG_VAR([CPP], [C preprocessor])dnl
391 _AC_ARG_VAR_CPPFLAGS()dnl
393 AC_MSG_CHECKING([how to run the C preprocessor])
394 # On Suns, sometimes $CPP names a directory.
395 if test -n "$CPP" && test -d "$CPP"; then
398 if test -z "$CPP"; then
399 AC_CACHE_VAL([ac_cv_prog_CPP],
401 # Double quotes because CPP needs to be expanded
402 for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
404 _AC_PROG_PREPROC_WORKS_IFELSE([break])
412 AC_MSG_RESULT([$CPP])
413 _AC_PROG_PREPROC_WORKS_IFELSE([],
414 [AC_MSG_FAILURE([C preprocessor "$CPP" fails sanity check])])
421 # Treat warnings from the preprocessor as errors.
422 AC_DEFUN([AC_PROG_CPP_WERROR],
423 [AC_REQUIRE([AC_PROG_CPP])dnl
424 ac_c_preproc_warn_flag=yes])# AC_PROG_CPP_WERROR
426 # AC_LANG_COMPILER(C)
427 # -------------------
428 # Find the C compiler. Must be AC_DEFUN'd to be AC_REQUIRE'able.
429 AC_DEFUN([AC_LANG_COMPILER(C)],
430 [AC_REQUIRE([AC_PROG_CC])])
435 # We used to name the cache variable this way.
436 AU_DEFUN([ac_cv_prog_gcc],
437 [ac_cv_c_compiler_gnu])
440 # AC_PROG_CC([COMPILER ...])
441 # --------------------------
442 # COMPILER ... is a space separated list of C compilers to search for.
443 # This just gives the user an opportunity to specify an alternative
444 # search list for the C compiler.
445 AN_MAKEVAR([CC], [AC_PROG_CC])
446 AN_PROGRAM([cc], [AC_PROG_CC])
447 AN_PROGRAM([gcc], [AC_PROG_CC])
448 AC_DEFUN([AC_PROG_CC],
450 AC_ARG_VAR([CC], [C compiler command])dnl
451 AC_ARG_VAR([CFLAGS], [C compiler flags])dnl
452 _AC_ARG_VAR_LDFLAGS()dnl
453 _AC_ARG_VAR_LIBS()dnl
454 _AC_ARG_VAR_CPPFLAGS()dnl
456 [AC_CHECK_TOOLS(CC, [$1])],
457 [AC_CHECK_TOOL(CC, gcc)
458 if test -z "$CC"; then
460 dnl AC_CHECK_TOOL(CC, cc)
461 dnl but without the check for a tool without the prefix.
462 dnl Until the check is removed from there, copy the code:
463 if test -n "$ac_tool_prefix"; then
464 AC_CHECK_PROG(CC, [${ac_tool_prefix}cc], [${ac_tool_prefix}cc])
467 if test -z "$CC"; then
468 AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
470 if test -z "$CC"; then
471 AC_CHECK_TOOLS(CC, cl.exe)
475 test -z "$CC" && AC_MSG_FAILURE([no acceptable C compiler found in \$PATH])
477 # Provide some information about the compiler.
478 _AS_ECHO_LOG([checking for _AC_LANG compiler version])
481 for ac_option in --version -v -V -qversion; do
482 _AC_DO_LIMIT([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD])
485 m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
486 m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl
487 _AC_LANG_COMPILER_GNU
488 if test $ac_compiler_gnu = yes; then
501 # Check whether -g works, even if CFLAGS is set, in case the package
502 # plays around with CFLAGS (such as to build both debugging and normal
503 # versions of a library), tasteless as that idea is.
504 # Don't consider -g to work if it generates warnings when plain compiles don't.
505 m4_define([_AC_PROG_CC_G],
506 [ac_test_CFLAGS=${CFLAGS+set}
507 ac_save_CFLAGS=$CFLAGS
508 AC_CACHE_CHECK(whether $CC accepts -g, ac_cv_prog_cc_g,
509 [ac_save_c_werror_flag=$ac_c_werror_flag
513 _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
514 [ac_cv_prog_cc_g=yes],
516 _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
518 [ac_c_werror_flag=$ac_save_c_werror_flag
520 _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
521 [ac_cv_prog_cc_g=yes])])])
522 ac_c_werror_flag=$ac_save_c_werror_flag])
523 if test "$ac_test_CFLAGS" = set; then
524 CFLAGS=$ac_save_CFLAGS
525 elif test $ac_cv_prog_cc_g = yes; then
526 if test "$GCC" = yes; then
532 if test "$GCC" = yes; then
541 # AC_PROG_GCC_TRADITIONAL
542 # -----------------------
543 AC_DEFUN([AC_PROG_GCC_TRADITIONAL],
544 [AC_REQUIRE([AC_PROG_CC])dnl
545 if test $ac_cv_c_compiler_gnu = yes; then
546 AC_CACHE_CHECK(whether $CC needs -traditional,
547 ac_cv_prog_gcc_traditional,
548 [ ac_pattern="Autoconf.*'x'"
549 AC_EGREP_CPP($ac_pattern, [#include <sgtty.h>
551 ac_cv_prog_gcc_traditional=yes, ac_cv_prog_gcc_traditional=no)
553 if test $ac_cv_prog_gcc_traditional = no; then
554 AC_EGREP_CPP($ac_pattern, [#include <termio.h>
556 ac_cv_prog_gcc_traditional=yes)
558 if test $ac_cv_prog_gcc_traditional = yes; then
559 CC="$CC -traditional"
562 ])# AC_PROG_GCC_TRADITIONAL
567 AC_DEFUN([AC_PROG_CC_C_O],
568 [AC_REQUIRE([AC_PROG_CC])dnl
569 if test "x$CC" != xcc; then
570 AC_MSG_CHECKING([whether $CC and cc understand -c and -o together])
572 AC_MSG_CHECKING([whether cc understands -c and -o together])
574 set dummy $CC; ac_cc=`AS_ECHO(["$[2]"]) |
575 sed 's/[[^a-zA-Z0-9_]]/_/g;s/^[[0-9]]/_/'`
576 AC_CACHE_VAL(ac_cv_prog_cc_${ac_cc}_c_o,
577 [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
578 # Make sure it works both with $CC and with simple cc.
579 # We do the test twice because some compilers refuse to overwrite an
580 # existing .o file with -o, though they will create one.
581 ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&AS_MESSAGE_LOG_FD'
583 if _AC_DO_VAR(ac_try) &&
584 test -f conftest2.$ac_objext && _AC_DO_VAR(ac_try);
586 eval ac_cv_prog_cc_${ac_cc}_c_o=yes
587 if test "x$CC" != xcc; then
588 # Test first that cc exists at all.
589 if _AC_DO_TOKENS(cc -c conftest.$ac_ext >&AS_MESSAGE_LOG_FD); then
590 ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&AS_MESSAGE_LOG_FD'
592 if _AC_DO_VAR(ac_try) &&
593 test -f conftest2.$ac_objext && _AC_DO_VAR(ac_try);
598 # cc exists but doesn't like -o.
599 eval ac_cv_prog_cc_${ac_cc}_c_o=no
604 eval ac_cv_prog_cc_${ac_cc}_c_o=no
608 if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then
612 AC_DEFINE(NO_MINUS_C_MINUS_O, 1,
613 [Define to 1 if your C compiler doesn't accept -c and -o together.])
619 # ---------------------- #
620 # 3b. The C++ compiler. #
621 # ---------------------- #
624 # AC_LANG_PREPROC(C++)
625 # --------------------
626 # Find the C++ preprocessor. Must be AC_DEFUN'd to be AC_REQUIRE'able.
627 AC_DEFUN([AC_LANG_PREPROC(C++)],
628 [AC_REQUIRE([AC_PROG_CXXCPP])])
633 # Find a working C++ preprocessor.
634 # We shouldn't have to require AC_PROG_CC, but this is due to the concurrency
635 # between the AC_LANG_COMPILER_REQUIRE family and that of AC_PROG_CXX.
636 AC_DEFUN([AC_PROG_CXXCPP],
637 [AC_REQUIRE([AC_PROG_CXX])dnl
638 AC_ARG_VAR([CXXCPP], [C++ preprocessor])dnl
639 _AC_ARG_VAR_CPPFLAGS()dnl
641 AC_MSG_CHECKING([how to run the C++ preprocessor])
642 if test -z "$CXXCPP"; then
643 AC_CACHE_VAL(ac_cv_prog_CXXCPP,
645 # Double quotes because CXXCPP needs to be expanded
646 for CXXCPP in "$CXX -E" "/lib/cpp"
648 _AC_PROG_PREPROC_WORKS_IFELSE([break])
650 ac_cv_prog_CXXCPP=$CXXCPP
652 CXXCPP=$ac_cv_prog_CXXCPP
654 ac_cv_prog_CXXCPP=$CXXCPP
656 AC_MSG_RESULT([$CXXCPP])
657 _AC_PROG_PREPROC_WORKS_IFELSE([],
658 [AC_MSG_FAILURE([C++ preprocessor "$CXXCPP" fails sanity check])])
664 # AC_LANG_COMPILER(C++)
665 # ---------------------
666 # Find the C++ compiler. Must be AC_DEFUN'd to be AC_REQUIRE'able.
667 AC_DEFUN([AC_LANG_COMPILER(C++)],
668 [AC_REQUIRE([AC_PROG_CXX])])
673 # We used to name the cache variable this way.
674 AU_DEFUN([ac_cv_prog_gxx],
675 [ac_cv_cxx_compiler_gnu])
678 # AC_PROG_CXX([LIST-OF-COMPILERS])
679 # --------------------------------
680 # LIST-OF-COMPILERS is a space separated list of C++ compilers to search
681 # for (if not specified, a default list is used). This just gives the
682 # user an opportunity to specify an alternative search list for the C++
684 # aCC HP-UX C++ compiler much better than `CC', so test before.
685 # FCC Fujitsu C++ compiler
686 # KCC KAI C++ compiler
688 # xlC_r AIX C Set++ (with support for reentrant code)
690 AN_MAKEVAR([CXX], [AC_PROG_CXX])
691 AN_PROGRAM([CC], [AC_PROG_CXX])
692 AN_PROGRAM([c++], [AC_PROG_CXX])
693 AN_PROGRAM([g++], [AC_PROG_CXX])
694 AC_DEFUN([AC_PROG_CXX],
695 [AC_LANG_PUSH(C++)dnl
696 AC_ARG_VAR([CXX], [C++ compiler command])dnl
697 AC_ARG_VAR([CXXFLAGS], [C++ compiler flags])dnl
698 _AC_ARG_VAR_LDFLAGS()dnl
699 _AC_ARG_VAR_LIBS()dnl
700 _AC_ARG_VAR_CPPFLAGS()dnl
701 _AC_ARG_VAR_PRECIOUS([CCC])dnl
702 if test -z "$CXX"; then
703 if test -n "$CCC"; then
708 [g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC])],
712 # Provide some information about the compiler.
713 _AS_ECHO_LOG([checking for _AC_LANG compiler version])
716 for ac_option in --version -v -V -qversion; do
717 _AC_DO_LIMIT([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD])
720 m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
721 m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl
722 _AC_LANG_COMPILER_GNU
723 if test $ac_compiler_gnu = yes; then
735 # Check whether -g works, even if CXXFLAGS is set, in case the package
736 # plays around with CXXFLAGS (such as to build both debugging and
737 # normal versions of a library), tasteless as that idea is.
738 # Don't consider -g to work if it generates warnings when plain compiles don't.
739 m4_define([_AC_PROG_CXX_G],
740 [ac_test_CXXFLAGS=${CXXFLAGS+set}
741 ac_save_CXXFLAGS=$CXXFLAGS
742 AC_CACHE_CHECK(whether $CXX accepts -g, ac_cv_prog_cxx_g,
743 [ac_save_cxx_werror_flag=$ac_cxx_werror_flag
744 ac_cxx_werror_flag=yes
747 _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
748 [ac_cv_prog_cxx_g=yes],
750 _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
752 [ac_cxx_werror_flag=$ac_save_cxx_werror_flag
754 _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
755 [ac_cv_prog_cxx_g=yes])])])
756 ac_cxx_werror_flag=$ac_save_cxx_werror_flag])
757 if test "$ac_test_CXXFLAGS" = set; then
758 CXXFLAGS=$ac_save_CXXFLAGS
759 elif test $ac_cv_prog_cxx_g = yes; then
760 if test "$GXX" = yes; then
766 if test "$GXX" = yes; then
777 # Test if the C++ compiler accepts the options `-c' and `-o'
778 # simultaneously, and define `CXX_NO_MINUS_C_MINUS_O' if it does not.
779 AC_DEFUN([AC_PROG_CXX_C_O],
780 [AC_REQUIRE([AC_PROG_CXX])dnl
781 AC_LANG_PUSH([C++])dnl
782 AC_CACHE_CHECK([whether $CXX understands -c and -o together],
783 [ac_cv_prog_cxx_c_o],
784 [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
785 # We test twice because some compilers refuse to overwrite an existing
786 # `.o' file with `-o', although they will create one.
787 ac_try='$CXX $CXXFLAGS -c conftest.$ac_ext -o conftest2.$ac_objext >&AS_MESSAGE_LOG_FD'
789 if _AC_DO_VAR(ac_try) &&
790 test -f conftest2.$ac_objext &&
791 _AC_DO_VAR(ac_try); then
792 ac_cv_prog_cxx_c_o=yes
794 ac_cv_prog_cxx_c_o=no
797 if test $ac_cv_prog_cxx_c_o = no; then
798 AC_DEFINE(CXX_NO_MINUS_C_MINUS_O, 1,
799 [Define to 1 if your C++ compiler doesn't accept
800 -c and -o together.])
802 AC_LANG_POP([C++])dnl
807 # ------------------------------ #
808 # 3c. The Objective C compiler. #
809 # ------------------------------ #
812 # AC_LANG_PREPROC(Objective C)
813 # ----------------------------
814 # Find the Objective C preprocessor. Must be AC_DEFUN'd to be AC_REQUIRE'able.
815 AC_DEFUN([AC_LANG_PREPROC(Objective C)],
816 [AC_REQUIRE([AC_PROG_OBJCPP])])
821 # Find a working Objective C preprocessor.
822 AC_DEFUN([AC_PROG_OBJCPP],
823 [AC_REQUIRE([AC_PROG_OBJC])dnl
824 AC_ARG_VAR([OBJCPP], [Objective C preprocessor])dnl
825 _AC_ARG_VAR_CPPFLAGS()dnl
826 AC_LANG_PUSH(Objective C)dnl
827 AC_MSG_CHECKING([how to run the Objective C preprocessor])
828 if test -z "$OBJCPP"; then
829 AC_CACHE_VAL(ac_cv_prog_OBJCPP,
831 # Double quotes because OBJCPP needs to be expanded
832 for OBJCPP in "$OBJC -E" "/lib/cpp"
834 _AC_PROG_PREPROC_WORKS_IFELSE([break])
836 ac_cv_prog_OBJCPP=$OBJCPP
838 OBJCPP=$ac_cv_prog_OBJCPP
840 ac_cv_prog_OBJCPP=$OBJCPP
842 AC_MSG_RESULT([$OBJCPP])
843 _AC_PROG_PREPROC_WORKS_IFELSE([],
844 [AC_MSG_FAILURE([Objective C preprocessor "$OBJCPP" fails sanity check])])
846 AC_LANG_POP(Objective C)dnl
850 # AC_LANG_COMPILER(Objective C)
851 # -----------------------------
852 # Find the Objective C compiler. Must be AC_DEFUN'd to be AC_REQUIRE'able.
853 AC_DEFUN([AC_LANG_COMPILER(Objective C)],
854 [AC_REQUIRE([AC_PROG_OBJC])])
858 # AC_PROG_OBJC([LIST-OF-COMPILERS])
859 # ---------------------------------
860 # LIST-OF-COMPILERS is a space separated list of Objective C compilers to
861 # search for (if not specified, a default list is used). This just gives
862 # the user an opportunity to specify an alternative search list for the
863 # Objective C compiler.
864 # objcc StepStone Objective-C compiler (also "standard" name for OBJC)
865 # objc David Stes' POC. If you installed this, you likely want it.
866 # cc Native C compiler (for instance, Apple).
868 AN_MAKEVAR([OBJC], [AC_PROG_OBJC])
869 AN_PROGRAM([objcc], [AC_PROG_OBJC])
870 AN_PROGRAM([objc], [AC_PROG_OBJC])
871 AC_DEFUN([AC_PROG_OBJC],
872 [AC_LANG_PUSH(Objective C)dnl
873 AC_ARG_VAR([OBJC], [Objective C compiler command])dnl
874 AC_ARG_VAR([OBJCFLAGS], [Objective C compiler flags])dnl
875 _AC_ARG_VAR_LDFLAGS()dnl
876 _AC_ARG_VAR_LIBS()dnl
877 _AC_ARG_VAR_CPPFLAGS()dnl
878 _AC_ARG_VAR_PRECIOUS([OBJC])dnl
880 [m4_default([$1], [gcc objcc objc cc CC])],
882 # Provide some information about the compiler.
883 _AS_ECHO_LOG([checking for _AC_LANG compiler version])
886 for ac_option in --version -v -V -qversion; do
887 _AC_DO_LIMIT([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD])
890 m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
891 m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl
892 _AC_LANG_COMPILER_GNU
893 if test $ac_compiler_gnu = yes; then
899 AC_LANG_POP(Objective C)dnl
905 # Check whether -g works, even if OBJCFLAGS is set, in case the package
906 # plays around with OBJCFLAGS (such as to build both debugging and
907 # normal versions of a library), tasteless as that idea is.
908 # Don't consider -g to work if it generates warnings when plain compiles don't.
909 m4_define([_AC_PROG_OBJC_G],
910 [ac_test_OBJCFLAGS=${OBJCFLAGS+set}
911 ac_save_OBJCFLAGS=$OBJCFLAGS
912 AC_CACHE_CHECK(whether $OBJC accepts -g, ac_cv_prog_objc_g,
913 [ac_save_objc_werror_flag=$ac_objc_werror_flag
914 ac_objc_werror_flag=yes
917 _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
918 [ac_cv_prog_objc_g=yes],
920 _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
922 [ac_objc_werror_flag=$ac_save_objc_werror_flag
924 _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
925 [ac_cv_prog_objc_g=yes])])])
926 ac_objc_werror_flag=$ac_save_objc_werror_flag])
927 if test "$ac_test_OBJCFLAGS" = set; then
928 OBJCFLAGS=$ac_save_OBJCFLAGS
929 elif test $ac_cv_prog_objc_g = yes; then
930 if test "$GOBJC" = yes; then
936 if test "$GOBJC" = yes; then
946 # -------------------------------- #
947 # 3d. The Objective C++ compiler. #
948 # -------------------------------- #
951 # AC_LANG_PREPROC(Objective C++)
952 # ------------------------------
953 # Find the Objective C++ preprocessor. Must be AC_DEFUN'd to be AC_REQUIRE'able.
954 AC_DEFUN([AC_LANG_PREPROC(Objective C++)],
955 [AC_REQUIRE([AC_PROG_OBJCXXCPP])])
960 # Find a working Objective C++ preprocessor.
961 AC_DEFUN([AC_PROG_OBJCXXCPP],
962 [AC_REQUIRE([AC_PROG_OBJCXX])dnl
963 AC_ARG_VAR([OBJCXXCPP], [Objective C++ preprocessor])dnl
964 _AC_ARG_VAR_CPPFLAGS()dnl
965 AC_LANG_PUSH(Objective C++)dnl
966 AC_MSG_CHECKING([how to run the Objective C++ preprocessor])
967 if test -z "$OBJCXXCPP"; then
968 AC_CACHE_VAL(ac_cv_prog_OBJCXXCPP,
970 # Double quotes because OBJCXXCPP needs to be expanded
971 for OBJCXXCPP in "$OBJCXX -E" "/lib/cpp"
973 _AC_PROG_PREPROC_WORKS_IFELSE([break])
975 ac_cv_prog_OBJCXXCPP=$OBJCXXCPP
977 OBJCXXCPP=$ac_cv_prog_OBJCXXCPP
979 ac_cv_prog_OBJCXXCPP=$OBJCXXCPP
981 AC_MSG_RESULT([$OBJCXXCPP])
982 _AC_PROG_PREPROC_WORKS_IFELSE([],
983 [AC_MSG_FAILURE([Objective C++ preprocessor "$OBJCXXCPP" fails sanity check])])
984 AC_SUBST(OBJCXXCPP)dnl
985 AC_LANG_POP(Objective C++)dnl
986 ])# AC_PROG_OBJCXXCPP
989 # AC_LANG_COMPILER(Objective C++)
990 # -------------------------------
991 # Find the Objective C++ compiler. Must be AC_DEFUN'd to be AC_REQUIRE'able.
992 AC_DEFUN([AC_LANG_COMPILER(Objective C++)],
993 [AC_REQUIRE([AC_PROG_OBJCXX])])
997 # AC_PROG_OBJCXX([LIST-OF-COMPILERS])
998 # -----------------------------------
999 # LIST-OF-COMPILERS is a space separated list of Objective C++ compilers to
1000 # search for (if not specified, a default list is used). This just gives
1001 # the user an opportunity to specify an alternative search list for the
1002 # Objective C++ compiler.
1003 # FIXME: this list is pure guesswork
1004 # objc++ StepStone Objective-C++ compiler (also "standard" name for OBJCXX)
1005 # objcxx David Stes' POC. If you installed this, you likely want it.
1006 # c++ Native C++ compiler (for instance, Apple).
1007 # CXX You never know.
1008 AN_MAKEVAR([OBJCXX], [AC_PROG_OBJCXX])
1009 AN_PROGRAM([objcxx], [AC_PROG_OBJCXX])
1010 AC_DEFUN([AC_PROG_OBJCXX],
1011 [AC_LANG_PUSH(Objective C++)dnl
1012 AC_ARG_VAR([OBJCXX], [Objective C++ compiler command])dnl
1013 AC_ARG_VAR([OBJCXXFLAGS], [Objective C++ compiler flags])dnl
1014 _AC_ARG_VAR_LDFLAGS()dnl
1015 _AC_ARG_VAR_LIBS()dnl
1016 _AC_ARG_VAR_CPPFLAGS()dnl
1017 _AC_ARG_VAR_PRECIOUS([OBJCXX])dnl
1018 AC_CHECK_TOOLS(OBJCXX,
1019 [m4_default([$1], [g++ objc++ objcxx c++ CXX])],
1021 # Provide some information about the compiler.
1022 _AS_ECHO_LOG([checking for _AC_LANG compiler version])
1025 for ac_option in --version -v -V -qversion; do
1026 _AC_DO_LIMIT([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD])
1029 m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
1030 m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl
1031 _AC_LANG_COMPILER_GNU
1032 if test $ac_compiler_gnu = yes; then
1038 AC_LANG_POP(Objective C++)dnl
1044 # Check whether -g works, even if OBJCFLAGS is set, in case the package
1045 # plays around with OBJCFLAGS (such as to build both debugging and
1046 # normal versions of a library), tasteless as that idea is.
1047 # Don't consider -g to work if it generates warnings when plain compiles don't.
1048 m4_define([_AC_PROG_OBJCXX_G],
1049 [ac_test_OBJCXXFLAGS=${OBJCXXFLAGS+set}
1050 ac_save_OBJCXXFLAGS=$OBJCXXFLAGS
1051 AC_CACHE_CHECK(whether $OBJCXX accepts -g, ac_cv_prog_objcxx_g,
1052 [ac_save_objcxx_werror_flag=$ac_objcxx_werror_flag
1053 ac_objcxx_werror_flag=yes
1054 ac_cv_prog_objcxx_g=no
1056 _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
1057 [ac_cv_prog_objcxx_g=yes],
1059 _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
1061 [ac_objcxx_werror_flag=$ac_save_objcxx_werror_flag
1063 _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
1064 [ac_cv_prog_objcxx_g=yes])])])
1065 ac_objcxx_werror_flag=$ac_save_objcx_werror_flag])
1066 if test "$ac_test_OBJCXXFLAGS" = set; then
1067 OBJCXXFLAGS=$ac_save_OBJCXXFLAGS
1068 elif test $ac_cv_prog_objcxx_g = yes; then
1069 if test "$GOBJCXX" = yes; then
1070 OBJCXXFLAGS="-g -O2"
1075 if test "$GOBJCXX" = yes; then
1081 ])# _AC_PROG_OBJCXX_G
1085 ## ------------------------------- ##
1086 ## 4. Compilers' characteristics. ##
1087 ## ------------------------------- ##
1089 # -------------------------------- #
1090 # 4a. C compiler characteristics. #
1091 # -------------------------------- #
1094 # _AC_PROG_CC_C89 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE])
1095 # ----------------------------------------------------------------
1096 # If the C compiler is not in ANSI C89 (ISO C90) mode by default, try
1097 # to add an option to output variable CC to make it so. This macro
1098 # tries various options that select ANSI C89 on some system or
1099 # another. It considers the compiler to be in ANSI C89 mode if it
1100 # handles function prototypes correctly.
1101 AC_DEFUN([_AC_PROG_CC_C89],
1102 [_AC_C_STD_TRY([c89],
1103 [[#include <stdarg.h>
1106 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
1107 struct buf { int x; };
1108 FILE * (*rcsopen) (struct buf *, struct stat *, int);
1109 static char *e (p, i)
1115 static char *f (char * (*g) (char **, int), char **p, ...)
1120 s = g (p, va_arg (v,int));
1125 /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
1126 function prototypes and stuff, but not '\xHH' hex character constants.
1127 These don't provoke an error unfortunately, instead are silently treated
1128 as 'x'. The following induces an error, until -std is added to get
1129 proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
1130 array size at least. It's necessary to write '\x00'==0 to get something
1131 that's true only with -std. */
1132 int osf4_cc_array ['\x00' == 0 ? 1 : -1];
1134 /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
1135 inside strings and character constants. */
1137 int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
1139 int test (int i, double x);
1140 struct s1 {int (*f) (int a);};
1141 struct s2 {int (*f) (double a);};
1142 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
1145 [[return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];]],
1146 dnl Don't try gcc -ansi; that turns off useful extensions and
1147 dnl breaks some systems' header files.
1148 dnl AIX circa 2003 -qlanglvl=extc89
1149 dnl old AIX -qlanglvl=ansi
1150 dnl Ultrix, OSF/1, Tru64 -std
1151 dnl HP-UX 10.20 and later -Ae
1152 dnl HP-UX older versions -Aa -D_HPUX_SOURCE
1153 dnl SVR4 -Xc -D__EXTENSIONS__
1154 [-qlanglvl=extc89 -qlanglvl=ansi -std \
1155 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"], [$1], [$2])[]dnl
1159 # _AC_C_STD_TRY(STANDARD, TEST-PROLOGUE, TEST-BODY, OPTION-LIST,
1160 # ACTION-IF-AVAILABLE, ACTION-IF-UNAVAILABLE)
1161 # --------------------------------------------------------------
1162 # Check whether the C compiler accepts features of STANDARD (e.g `c89', `c99')
1163 # by trying to compile a program of TEST-PROLOGUE and TEST-BODY. If this fails,
1164 # try again with each compiler option in the space-separated OPTION-LIST; if one
1165 # helps, append it to CC. If eventually successful, run ACTION-IF-AVAILABLE,
1166 # else ACTION-IF-UNAVAILABLE.
1167 AC_DEFUN([_AC_C_STD_TRY],
1168 [AC_MSG_CHECKING([for $CC option to accept ISO ]m4_translit($1, [c], [C]))
1169 AC_CACHE_VAL(ac_cv_prog_cc_$1,
1170 [ac_cv_prog_cc_$1=no
1172 AC_LANG_CONFTEST([AC_LANG_PROGRAM([$2], [$3])])
1175 CC="$ac_save_CC $ac_arg"
1176 _AC_COMPILE_IFELSE([], [ac_cv_prog_cc_$1=$ac_arg])
1177 test "x$ac_cv_prog_cc_$1" != "xno" && break
1179 rm -f conftest.$ac_ext
1182 case "x$ac_cv_prog_cc_$1" in
1184 AC_MSG_RESULT([none needed]) ;;
1186 AC_MSG_RESULT([unsupported]) ;;
1188 CC="$CC $ac_cv_prog_cc_$1"
1189 AC_MSG_RESULT([$ac_cv_prog_cc_$1]) ;;
1191 AS_IF([test "x$ac_cv_prog_cc_$1" != xno], [$5], [$6])
1195 # _AC_PROG_CC_C99 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE])
1196 # ----------------------------------------------------------------
1197 # If the C compiler is not in ISO C99 mode by default, try to add an
1198 # option to output variable CC to make it so. This macro tries
1199 # various options that select ISO C99 on some system or another. It
1200 # considers the compiler to be in ISO C99 mode if it handles _Bool,
1201 # // comments, flexible array members, inline, long long int, mixed
1202 # code and declarations, named initialization of structs, restrict,
1203 # va_copy, varargs macros, variable declarations in for loops and
1204 # variable length arrays.
1205 AC_DEFUN([_AC_PROG_CC_C99],
1206 [_AC_C_STD_TRY([c99],
1207 [[#include <stdarg.h>
1208 #include <stdbool.h>
1213 // Check varargs macros. These examples are taken from C99 6.10.3.5.
1214 #define debug(...) fprintf (stderr, __VA_ARGS__)
1215 #define showlist(...) puts (#__VA_ARGS__)
1216 #define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__))
1218 test_varargs_macros (void)
1223 debug ("X = %d\n", x);
1224 showlist (The first, second, and third items.);
1225 report (x>y, "x is %d but y is %d", x, y);
1228 // Check long long types.
1229 #define BIG64 18446744073709551615ull
1230 #define BIG32 4294967295ul
1231 #define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0)
1233 your preprocessor is broken;
1237 your preprocessor is broken;
1239 static long long int bignum = -9223372036854775807LL;
1240 static unsigned long long int ubignum = BIG64;
1242 struct incomplete_array
1250 const wchar_t *name;
1254 typedef const char *ccp;
1257 test_restrict (ccp restrict text)
1259 // See if C++-style comments work.
1260 // Iterate through items via the restricted pointer.
1261 // Also check for declarations in for loops.
1262 for (unsigned int i = 0; *(text+i) != '\0'; ++i)
1267 // Check varargs and va_copy.
1269 test_varargs (const char *format, ...)
1272 va_start (args, format);
1274 va_copy (args_copy, args);
1285 str = va_arg (args_copy, const char *);
1288 number = va_arg (args_copy, int);
1291 fnumber = va_arg (args_copy, double);
1303 _Bool success = false;
1306 if (test_restrict ("String literal") == 0)
1308 char *restrict newvar = "Another string";
1311 test_varargs ("s, d' f .", "string", 65, 34.234);
1312 test_varargs_macros ();
1314 // Check flexible array members.
1315 struct incomplete_array *ia =
1316 malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10));
1318 for (int i = 0; i < ia->datasize; ++i)
1319 ia->data[i] = i * 1.234;
1321 // Check named initializers.
1322 struct named_init ni = {
1324 .name = L"Test wide string",
1325 .average = 543.34343,
1330 int dynamic_array[ni.number];
1331 dynamic_array[ni.number - 1] = 543;
1333 // work around unused variable warnings
1334 return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x'
1335 || dynamic_array[ni.number - 1] != 543);
1338 dnl GCC -std=gnu99 (unused restrictive modes: -std=c99 -std=iso9899:1999)
1339 dnl AIX -qlanglvl=extc99 (unused restrictive mode: -qlanglvl=stdc99)
1341 dnl Intel ICC -std=c99, -c99 (deprecated)
1343 dnl Solaris -D_STDC_C99=
1344 dnl cc's -xc99 option uses linker magic to define the external
1345 dnl symbol __xpg4 as if by "int __xpg4 = 1;", which enables C99
1346 dnl behavior for C library functions. This is not wanted here,
1347 dnl because it means that a single module compiled with -xc99
1348 dnl alters C runtime behavior for the entire program, not for
1349 dnl just the module. Instead, define the (private) symbol
1350 dnl _STDC_C99, which suppresses a bogus failure in <stdbool.h>.
1351 dnl The resulting compiler passes the test case here, and that's
1352 dnl good enough. For more, please see the thread starting at:
1353 dnl http://lists.gnu.org/archive/html/autoconf/2010-12/msg00059.html
1355 dnl with extended modes being tried first.
1356 [[-std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc99]], [$1], [$2])[]dnl
1362 AC_DEFUN([AC_PROG_CC_C89],
1363 [ AC_REQUIRE([AC_PROG_CC])dnl
1370 AC_DEFUN([AC_PROG_CC_C99],
1371 [ AC_REQUIRE([AC_PROG_CC])dnl
1378 AC_DEFUN([AC_PROG_CC_STDC],
1379 [ AC_REQUIRE([AC_PROG_CC])dnl
1380 AS_CASE([$ac_cv_prog_cc_stdc],
1381 [no], [ac_cv_prog_cc_c99=no; ac_cv_prog_cc_c89=no],
1382 [_AC_PROG_CC_C99([ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99],
1383 [_AC_PROG_CC_C89([ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89],
1384 [ac_cv_prog_cc_stdc=no])])])
1385 AC_MSG_CHECKING([for $CC option to accept ISO Standard C])
1386 AC_CACHE_VAL([ac_cv_prog_cc_stdc], [])
1387 AS_CASE([$ac_cv_prog_cc_stdc],
1388 [no], [AC_MSG_RESULT([unsupported])],
1389 [''], [AC_MSG_RESULT([none needed])],
1390 [AC_MSG_RESULT([$ac_cv_prog_cc_stdc])])
1396 AC_DEFUN([AC_C_BACKSLASH_A],
1398 AC_CACHE_CHECK([whether backslash-a works in strings], ac_cv_c_backslash_a,
1399 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
1404 char buf['\a' == 'a' ? -1 : 1];
1406 return buf[0] != "\a"[0];
1408 [ac_cv_c_backslash_a=yes],
1409 [ac_cv_c_backslash_a=no])])
1410 if test $ac_cv_c_backslash_a = yes; then
1411 AC_DEFINE(HAVE_C_BACKSLASH_A, 1,
1412 [Define if backslash-a works in C strings.])
1419 # Has been merged into AC_PROG_CC.
1420 AU_DEFUN([AC_C_CROSS], [])
1423 # AC_C_CHAR_UNSIGNED
1424 # ------------------
1425 AC_DEFUN([AC_C_CHAR_UNSIGNED],
1426 [AH_VERBATIM([__CHAR_UNSIGNED__],
1427 [/* Define to 1 if type `char' is unsigned and you are not using gcc. */
1428 #ifndef __CHAR_UNSIGNED__
1429 # undef __CHAR_UNSIGNED__
1431 AC_CACHE_CHECK(whether char is unsigned, ac_cv_c_char_unsigned,
1432 [AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT([])],
1433 [((char) -1) < 0])],
1434 ac_cv_c_char_unsigned=no, ac_cv_c_char_unsigned=yes)])
1435 if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then
1436 AC_DEFINE(__CHAR_UNSIGNED__)
1438 ])# AC_C_CHAR_UNSIGNED
1441 # AC_C_BIGENDIAN ([ACTION-IF-TRUE], [ACTION-IF-FALSE], [ACTION-IF-UNKNOWN],
1442 # [ACTION-IF-UNIVERSAL])
1443 # -------------------------------------------------------------------------
1444 AC_DEFUN([AC_C_BIGENDIAN],
1445 [AH_VERBATIM([WORDS_BIGENDIAN],
1446 [/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
1447 significant byte first (like Motorola and SPARC, unlike Intel). */
1448 #if defined AC_APPLE_UNIVERSAL_BUILD
1449 # if defined __BIG_ENDIAN__
1450 # define WORDS_BIGENDIAN 1
1453 # ifndef WORDS_BIGENDIAN
1454 # undef WORDS_BIGENDIAN
1457 AC_CACHE_CHECK([whether byte ordering is bigendian], [ac_cv_c_bigendian],
1458 [ac_cv_c_bigendian=unknown
1459 # See if we're dealing with a universal compiler.
1462 [[#ifndef __APPLE_CC__
1463 not a universal capable compiler
1468 # Check for potential -arch flags. It is not universal unless
1469 # there are at least two -arch flags with different values.
1472 for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do
1473 if test -n "$ac_prev"; then
1475 i?86 | x86_64 | ppc | ppc64)
1476 if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then
1479 ac_cv_c_bigendian=universal
1485 elif test "x$ac_word" = "x-arch"; then
1489 if test $ac_cv_c_bigendian = unknown; then
1490 # See if sys/param.h defines the BYTE_ORDER macro.
1493 [[#include <sys/types.h>
1494 #include <sys/param.h>
1496 [[#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \
1497 && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \
1502 [# It does; now see whether it defined to BIG_ENDIAN or not.
1505 [[#include <sys/types.h>
1506 #include <sys/param.h>
1508 [[#if BYTE_ORDER != BIG_ENDIAN
1512 [ac_cv_c_bigendian=yes],
1513 [ac_cv_c_bigendian=no])])
1515 if test $ac_cv_c_bigendian = unknown; then
1516 # See if <limits.h> defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris).
1519 [[#include <limits.h>
1521 [[#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN)
1525 [# It does; now see whether it defined to _BIG_ENDIAN or not.
1528 [[#include <limits.h>
1530 [[#ifndef _BIG_ENDIAN
1534 [ac_cv_c_bigendian=yes],
1535 [ac_cv_c_bigendian=no])])
1537 if test $ac_cv_c_bigendian = unknown; then
1538 # Compile a test program.
1540 [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
1542 /* Are we little or big endian? From Harbison&Steele. */
1546 char c[sizeof (long int)];
1549 return u.c[sizeof (long int) - 1] == 1;
1551 [ac_cv_c_bigendian=no],
1552 [ac_cv_c_bigendian=yes],
1553 [# Try to guess by grepping values from an object file.
1556 [[short int ascii_mm[] =
1557 { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
1558 short int ascii_ii[] =
1559 { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
1560 int use_ascii (int i) {
1561 return ascii_mm[i] + ascii_ii[i];
1563 short int ebcdic_ii[] =
1564 { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
1565 short int ebcdic_mm[] =
1566 { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
1567 int use_ebcdic (int i) {
1568 return ebcdic_mm[i] + ebcdic_ii[i];
1572 [[return use_ascii (foo) == use_ebcdic (foo);]])],
1573 [if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then
1574 ac_cv_c_bigendian=yes
1576 if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
1577 if test "$ac_cv_c_bigendian" = unknown; then
1578 ac_cv_c_bigendian=no
1580 # finding both strings is unlikely to happen, but who knows?
1581 ac_cv_c_bigendian=unknown
1585 case $ac_cv_c_bigendian in #(
1588 [AC_DEFINE([WORDS_BIGENDIAN], 1)]);; #(
1592 dnl Note that AC_APPLE_UNIVERSAL_BUILD sorts less than WORDS_BIGENDIAN;
1593 dnl this is a necessity for proper config header operation. Warn if
1594 dnl the user did not specify a config header but is relying on the
1595 dnl default behavior for universal builds.
1597 [AC_CONFIG_COMMANDS_PRE([m4_ifset([AH_HEADER], [],
1598 [AC_DIAGNOSE([obsolete],
1599 [AC_C_BIGENDIAN should be used with AC_CONFIG_HEADERS])])])dnl
1600 AC_DEFINE([AC_APPLE_UNIVERSAL_BUILD],1,
1601 [Define if building universal (internal helper macro)])])
1605 [AC_MSG_ERROR([unknown endianness
1606 presetting ac_cv_c_bigendian=no (or yes) will help])]) ;;
1613 # Do nothing if the compiler accepts the inline keyword.
1614 # Otherwise define inline to __inline__ or __inline if one of those work,
1615 # otherwise define inline to be empty.
1617 # HP C version B.11.11.04 doesn't allow a typedef as the return value for an
1618 # inline function, only builtin types.
1620 AN_IDENTIFIER([inline], [AC_C_INLINE])
1621 AC_DEFUN([AC_C_INLINE],
1622 [AC_CACHE_CHECK([for inline], ac_cv_c_inline,
1624 for ac_kw in inline __inline__ __inline; do
1625 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1626 [#ifndef __cplusplus
1628 static $ac_kw foo_t static_foo () {return 0; }
1629 $ac_kw foo_t foo () {return 0; }
1632 [ac_cv_c_inline=$ac_kw])
1633 test "$ac_cv_c_inline" != no && break
1636 AH_VERBATIM([inline],
1637 [/* Define to `__inline__' or `__inline' if that's what the C compiler
1638 calls it, or to nothing if 'inline' is not supported under any name. */
1642 case $ac_cv_c_inline in
1645 case $ac_cv_c_inline in
1647 *) ac_val=$ac_cv_c_inline;;
1649 cat >>confdefs.h <<_ACEOF
1651 #define inline $ac_val
1661 AC_DEFUN([AC_C_CONST],
1662 [AC_CACHE_CHECK([for an ANSI C-conforming const], ac_cv_c_const,
1663 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
1666 /* Ultrix mips cc rejects this sort of thing. */
1667 typedef int charset[2];
1668 const charset cs = { 0, 0 };
1669 /* SunOS 4.1.1 cc rejects this. */
1670 char const *const *pcpcc;
1672 /* NEC SVR4.0.2 mips cc rejects this. */
1673 struct point {int x, y;};
1674 static struct point const zero = {0,0};
1675 /* AIX XL C 1.02.0.0 rejects this.
1676 It does not let you subtract one const X* pointer from another in
1677 an arm of an if-expression whose if-part is not a constant
1679 const char *g = "string";
1680 pcpcc = &g + (g ? g-g : 0);
1681 /* HPUX 7.0 cc rejects these. */
1683 ppc = (char**) pcpcc;
1684 pcpcc = (char const *const *) ppc;
1685 { /* SCO 3.2v4 cc rejects this sort of thing. */
1688 char const *s = 0 ? (char *) 0 : (char const *) 0;
1693 { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
1695 const int *foo = &x[0];
1698 { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
1699 typedef const int *iptr;
1703 { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying
1704 "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
1705 struct s { int j; const int *ap[3]; } bx;
1706 struct s *b = &bx; b->j = 5;
1708 { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
1712 return !cs[0] && !zero.x;
1715 [ac_cv_c_const=yes],
1716 [ac_cv_c_const=no])])
1717 if test $ac_cv_c_const = no; then
1719 [Define to empty if `const' does not conform to ANSI C.])
1726 # based on acx_restrict.m4, from the GNU Autoconf Macro Archive at:
1727 # http://autoconf-archive.cryp.to/acx_restrict.html
1729 # Determine whether the C/C++ compiler supports the "restrict" keyword
1730 # introduced in ANSI C99, or an equivalent. Define "restrict" to the alternate
1731 # spelling, if any; these are more likely to work in both C and C++ compilers of
1732 # the same family, and in the presence of varying compiler options. If only
1733 # plain "restrict" works, do nothing. Here are some variants:
1734 # - GCC supports both __restrict and __restrict__
1735 # - older DEC Alpha C compilers support only __restrict
1736 # - _Restrict is the only spelling accepted by Sun WorkShop 6 update 2 C
1737 # Otherwise, define "restrict" to be empty.
1738 AN_IDENTIFIER([restrict], [AC_C_RESTRICT])
1739 AC_DEFUN([AC_C_RESTRICT],
1740 [AC_CACHE_CHECK([for C/C++ restrict keyword], ac_cv_c_restrict,
1741 [ac_cv_c_restrict=no
1742 # The order here caters to the fact that C++ does not require restrict.
1743 for ac_kw in __restrict __restrict__ _Restrict restrict; do
1744 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1745 [[typedef int * int_ptr;
1746 int foo (int_ptr $ac_kw ip) {
1753 [ac_cv_c_restrict=$ac_kw])
1754 test "$ac_cv_c_restrict" != no && break
1757 AH_VERBATIM([restrict],
1758 [/* Define to the equivalent of the C99 'restrict' keyword, or to
1759 nothing if this is not supported. Do not define if restrict is
1760 supported directly. */
1762 /* Work around a bug in Sun C++: it does not support _Restrict or
1763 __restrict__, even though the corresponding Sun C compiler ends up with
1764 "#define restrict _Restrict" or "#define restrict __restrict__" in the
1765 previous line. Perhaps some future version of Sun C++ will work with
1766 restrict; if so, hopefully it defines __RESTRICT like Sun C does. */
1767 #if defined __SUNPRO_CC && !defined __RESTRICT
1769 # define __restrict__
1771 case $ac_cv_c_restrict in
1773 no) AC_DEFINE([restrict], []) ;;
1774 *) AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;;
1781 # Note that, unlike const, #defining volatile to be the empty string can
1782 # actually turn a correct program into an incorrect one, since removing
1783 # uses of volatile actually grants the compiler permission to perform
1784 # optimizations that could break the user's code. So, do not #define
1785 # volatile away unless it is really necessary to allow the user's code
1786 # to compile cleanly. Benign compiler failures should be tolerated.
1787 AC_DEFUN([AC_C_VOLATILE],
1788 [AC_CACHE_CHECK([for working volatile], ac_cv_c_volatile,
1789 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
1791 int * volatile y = (int *) 0;
1792 return !x && !y;])],
1793 [ac_cv_c_volatile=yes],
1794 [ac_cv_c_volatile=no])])
1795 if test $ac_cv_c_volatile = no; then
1796 AC_DEFINE(volatile,,
1797 [Define to empty if the keyword `volatile' does not work.
1798 Warning: valid code using `volatile' can become incorrect
1799 without. Disable with care.])
1806 # Checks if `#' can be used to glue strings together at the CPP level.
1807 # Defines HAVE_STRINGIZE if positive.
1808 AC_DEFUN([AC_C_STRINGIZE],
1809 [AC_CACHE_CHECK([for preprocessor stringizing operator],
1810 [ac_cv_c_stringize],
1811 [AC_EGREP_CPP([@%:@teststring],
1814 char *s = x(teststring);],
1815 [ac_cv_c_stringize=no],
1816 [ac_cv_c_stringize=yes])])
1817 if test $ac_cv_c_stringize = yes; then
1818 AC_DEFINE(HAVE_STRINGIZE, 1,
1819 [Define to 1 if cpp supports the ANSI @%:@ stringizing operator.])
1826 # Check if the C compiler supports prototypes, included if it needs
1828 AC_DEFUN([AC_C_PROTOTYPES],
1829 [AC_REQUIRE([AC_PROG_CC])dnl
1830 AC_MSG_CHECKING([for function prototypes])
1831 if test "$ac_cv_prog_cc_c89" != no; then
1832 AC_MSG_RESULT([yes])
1833 AC_DEFINE(PROTOTYPES, 1,
1834 [Define to 1 if the C compiler supports function prototypes.])
1835 AC_DEFINE(__PROTOTYPES, 1,
1836 [Define like PROTOTYPES; this can be used by system headers.])
1843 # AC_C_FLEXIBLE_ARRAY_MEMBER
1844 # --------------------------
1845 # Check whether the C compiler supports flexible array members.
1846 AC_DEFUN([AC_C_FLEXIBLE_ARRAY_MEMBER],
1848 AC_CACHE_CHECK([for flexible array members],
1852 [[#include <stdlib.h>
1855 struct s { int n; double d[]; };]],
1856 [[int m = getchar ();
1857 struct s *p = malloc (offsetof (struct s, d)
1858 + m * sizeof (double));
1860 return p->d != (double *) NULL;]])],
1861 [ac_cv_c_flexmember=yes],
1862 [ac_cv_c_flexmember=no])])
1863 if test $ac_cv_c_flexmember = yes; then
1864 AC_DEFINE([FLEXIBLE_ARRAY_MEMBER], [],
1865 [Define to nothing if C supports flexible array members, and to
1866 1 if it does not. That way, with a declaration like `struct s
1867 { int n; double d@<:@FLEXIBLE_ARRAY_MEMBER@:>@; };', the struct hack
1868 can be used with pre-C99 compilers.
1869 When computing the size of such an object, don't use 'sizeof (struct s)'
1870 as it overestimates the size. Use 'offsetof (struct s, d)' instead.
1871 Don't use 'offsetof (struct s, d@<:@0@:>@)', as this doesn't work with
1872 MSVC and with C++ compilers.])
1874 AC_DEFINE([FLEXIBLE_ARRAY_MEMBER], 1)
1881 # Check whether the C compiler supports variable-length arrays.
1882 AC_DEFUN([AC_C_VARARRAYS],
1884 AC_CACHE_CHECK([for variable-length arrays],
1887 [AC_LANG_PROGRAM([],
1888 [[static int x; char a[++x]; a[sizeof a - 1] = 0; return a[0];]])],
1889 [ac_cv_c_vararrays=yes],
1890 [ac_cv_c_vararrays=no])])
1891 if test $ac_cv_c_vararrays = yes; then
1892 AC_DEFINE([HAVE_C_VARARRAYS], 1,
1893 [Define to 1 if C supports variable-length arrays.])
1900 # Check if the C compiler supports GCC's typeof syntax.
1901 # The test case provokes incompatibilities in the Sun C compilers
1902 # (both Solaris 8 and Solaris 10).
1903 AC_DEFUN([AC_C_TYPEOF],
1905 AC_CACHE_CHECK([for typeof syntax and keyword spelling], ac_cv_c_typeof,
1907 for ac_kw in typeof __typeof__ no; do
1908 test $ac_kw = no && break
1909 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
1914 + ! (($ac_kw (value))
1915 (($ac_kw (value)) 0 < ($ac_kw (value)) -1
1916 ? ($ac_kw (value)) - 1
1917 : ~ (~ ($ac_kw (value)) 0
1918 << sizeof ($ac_kw (value)))))]; }
1921 (! ((void) ((ac__typeof_type_ *) 0), 0));
1923 [ac_cv_c_typeof=$ac_kw])
1924 test $ac_cv_c_typeof != no && break
1926 if test $ac_cv_c_typeof != no; then
1927 AC_DEFINE([HAVE_TYPEOF], 1,
1928 [Define to 1 if typeof works with your compiler.])
1929 if test $ac_cv_c_typeof != typeof; then
1930 AC_DEFINE_UNQUOTED([typeof], [$ac_cv_c_typeof],
1931 [Define to __typeof__ if your compiler spells it that way.])
1939 # Expands to some language dependent source code for testing the presence of
1941 AC_DEFUN([_AC_LANG_OPENMP],
1942 [AC_LANG_SOURCE([_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])])
1944 # _AC_LANG_OPENMP(C)
1945 # ------------------
1946 m4_define([_AC_LANG_OPENMP(C)],
1952 int main () { return omp_get_num_threads (); }
1955 # _AC_LANG_OPENMP(C++)
1956 # --------------------
1957 m4_copy([_AC_LANG_OPENMP(C)], [_AC_LANG_OPENMP(C++)])
1959 # _AC_LANG_OPENMP(Fortran 77)
1960 # ---------------------------
1961 m4_define([_AC_LANG_OPENMP(Fortran 77)],
1967 call omp_set_num_threads(2)
1971 # _AC_LANG_OPENMP(Fortran)
1972 # ------------------------
1973 m4_copy([_AC_LANG_OPENMP(Fortran 77)], [_AC_LANG_OPENMP(Fortran)])
1977 # Check which options need to be passed to the C compiler to support OpenMP.
1978 # Set the OPENMP_CFLAGS / OPENMP_CXXFLAGS / OPENMP_FFLAGS variable to these
1980 # The options are necessary at compile time (so the #pragmas are understood)
1981 # and at link time (so the appropriate library is linked with).
1982 # This macro takes care to not produce redundant options if $CC $CFLAGS already
1983 # supports OpenMP. It also is careful to not pass options to compilers that
1984 # misinterpret them; for example, most compilers accept "-openmp" and create
1985 # an output file called 'penmp' rather than activating OpenMP support.
1986 AC_DEFUN([AC_OPENMP],
1988 OPENMP_[]_AC_LANG_PREFIX[]FLAGS=
1989 AC_ARG_ENABLE([openmp],
1990 [AS_HELP_STRING([--disable-openmp], [do not use OpenMP])])
1991 if test "$enable_openmp" != no; then
1992 AC_CACHE_CHECK([for $[]_AC_CC[] option to support OpenMP],
1993 [ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp],
1994 [AC_LINK_IFELSE([_AC_LANG_OPENMP],
1995 [ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp='none needed'],
1996 [ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp='unsupported'
1997 dnl Try these flags:
1998 dnl GCC >= 4.2 -fopenmp
1999 dnl SunPRO C -xopenmp
2001 dnl SGI C, PGI C -mp
2002 dnl Tru64 Compaq C -omp
2003 dnl IBM C (AIX, Linux) -qsmp=omp
2006 dnl Lahey Fortran (Linux) --openmp
2007 dnl If in this loop a compiler is passed an option that it doesn't
2008 dnl understand or that it misinterprets, the AC_LINK_IFELSE test
2009 dnl will fail (since we know that it failed without the option),
2010 dnl therefore the loop will continue searching for an option, and
2011 dnl no output file called 'penmp' or 'mp' is created.
2012 for ac_option in -fopenmp -xopenmp -openmp -mp -omp -qsmp=omp -homp \
2013 -Popenmp --openmp; do
2014 ac_save_[]_AC_LANG_PREFIX[]FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
2015 _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $ac_option"
2016 AC_LINK_IFELSE([_AC_LANG_OPENMP],
2017 [ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp=$ac_option])
2018 _AC_LANG_PREFIX[]FLAGS=$ac_save_[]_AC_LANG_PREFIX[]FLAGS
2019 if test "$ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp" != unsupported; then
2023 case $ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp in #(
2024 "none needed" | unsupported)
2027 OPENMP_[]_AC_LANG_PREFIX[]FLAGS=$ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp ;;
2030 AC_SUBST([OPENMP_]_AC_LANG_PREFIX[FLAGS])