Update autoconf to version 2.61
[msysgit.git] / share / autoconf / autoconf / lang.m4
blob98166339ee992d4dfc5f5247d4950064137a2eee
1 # This file is part of Autoconf.                       -*- Autoconf -*-
2 # Programming languages support.
3 # Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006 Free Software
4 # Foundation, Inc.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
9 # 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 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 # 02110-1301, USA.
21 # As a special exception, the Free Software Foundation gives unlimited
22 # permission to copy, distribute and modify the configure scripts that
23 # are the output of Autoconf.  You need not follow the terms of the GNU
24 # General Public License when using or distributing such scripts, even
25 # though portions of the text of Autoconf appear in them.  The GNU
26 # General Public License (GPL) does govern all other use of the material
27 # that constitutes the Autoconf program.
29 # Certain portions of the Autoconf source text are designed to be copied
30 # (in certain cases, depending on the input) into the output of
31 # Autoconf.  We call these the "data" portions.  The rest of the Autoconf
32 # source text consists of comments plus executable code that decides which
33 # of the data portions to output in any given case.  We call these
34 # comments and executable code the "non-data" portions.  Autoconf never
35 # copies any of the non-data portions into its output.
37 # This special exception to the GPL applies to versions of Autoconf
38 # released by the Free Software Foundation.  When you make and
39 # distribute a modified version of Autoconf, you may extend this special
40 # exception to the GPL to apply to your modified version as well, *unless*
41 # your modified version has the potential to copy into its output some
42 # of the text that was the non-data portion of the version that you started
43 # with.  (In other words, unless your change moves or copies text from
44 # the non-data portions to the data portions.)  If your modification has
45 # such potential, you must delete any notice of this special exception
46 # to the GPL from your modified version.
48 # Written by David MacKenzie, with help from
49 # Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
50 # Roland McGrath, Noah Friedman, david d zuhn, and many others.
53 # Table of Contents:
55 # 1. Language selection
56 #    and routines to produce programs in a given language.
57 #  a. generic routines
58 #  b. C
59 #  c. C++
60 #  d. Fortran 77
62 # 2. Producing programs in a given language.
63 #  a. generic routines
64 #  b. C
65 #  c. C++
66 #  d. Fortran 77
68 # 3. Looking for a compiler
69 #    And possibly the associated preprocessor.
70 #  a. Generic routines.
71 #  b. C
72 #  c. C++
73 #  d. Fortran 77
75 # 4. Compilers' characteristics.
76 #  a. Generic routines.
77 #  b. C
78 #  c. C++
79 #  d. Fortran 77
83 ## ----------------------- ##
84 ## 1. Language selection.  ##
85 ## ----------------------- ##
89 # -------------------------------- #
90 # 1a. Generic language selection.  #
91 # -------------------------------- #
93 # AC_LANG_CASE(LANG1, IF-LANG1, LANG2, IF-LANG2, ..., DEFAULT)
94 # ------------------------------------------------------------
95 # Expand into IF-LANG1 if the current language is LANG1 etc. else
96 # into default.
97 m4_define([AC_LANG_CASE],
98 [m4_case(_AC_LANG, $@)])
101 # _AC_LANG_DISPATCH(MACRO, LANG, ARGS)
102 # ------------------------------------
103 # Call the specialization of MACRO for LANG with ARGS.  Complain if
104 # unavailable.
105 m4_define([_AC_LANG_DISPATCH],
106 [m4_ifdef([$1($2)],
107        [m4_indir([$1($2)], m4_shiftn(2, $@))],
108        [AC_FATAL([$1: unknown language: $2])])])
111 # _AC_LANG_SET(OLD, NEW)
112 # ----------------------
113 # Output the shell code needed to switch from OLD language to NEW language.
114 # Do not try to optimize like this:
116 # m4_defun([_AC_LANG_SET],
117 # [m4_if([$1], [$2], [],
118 #        [_AC_LANG_DISPATCH([AC_LANG], [$2])])])
120 # as it can introduce differences between the sh-current language and the
121 # m4-current-language when m4_require is used.  Something more subtle
122 # might be possible, but at least for the time being, play it safe.
123 m4_defun([_AC_LANG_SET],
124 [_AC_LANG_DISPATCH([AC_LANG], [$2])])
127 # AC_LANG(LANG)
128 # -------------
129 # Set the current language to LANG.
130 m4_defun([AC_LANG],
131 [_AC_LANG_SET(m4_ifdef([_AC_LANG], [m4_defn([_AC_LANG])]),
132               [$1])dnl
133 m4_define([_AC_LANG], [$1])])
136 # AC_LANG_PUSH(LANG)
137 # ------------------
138 # Save the current language, and use LANG.
139 m4_defun([AC_LANG_PUSH],
140 [_AC_LANG_SET(m4_ifdef([_AC_LANG], [m4_defn([_AC_LANG])]),
141               [$1])dnl
142 m4_pushdef([_AC_LANG], [$1])])
145 # AC_LANG_POP([LANG])
146 # -------------------
147 # If given, check that the current language is LANG, and restore the
148 # previous language.
149 m4_defun([AC_LANG_POP],
150 [m4_ifval([$1],
151  [m4_if([$1], m4_defn([_AC_LANG]), [],
152   [m4_fatal([$0($1): unexpected current language: ]m4_defn([_AC_LANG]))])])dnl
153 m4_pushdef([$0 OLD], m4_defn([_AC_LANG]))dnl
154 m4_popdef([_AC_LANG])dnl
155 _AC_LANG_SET(m4_defn([$0 OLD]), m4_defn([_AC_LANG]))dnl
156 m4_popdef([$0 OLD])dnl
160 # AC_LANG_SAVE
161 # ------------
162 # Save the current language, but don't change language.
163 AU_DEFUN([AC_LANG_SAVE],
164 [[AC_LANG_SAVE]],
165 [Instead of using `AC_LANG', `AC_LANG_SAVE', and `AC_LANG_RESTORE',
166 you should use `AC_LANG_PUSH' and `AC_LANG_POP'.])
167 AC_DEFUN([AC_LANG_SAVE],
168 [m4_pushdef([_AC_LANG], _AC_LANG)dnl
169 AC_DIAGNOSE([obsolete], [The macro `AC_LANG_SAVE' is obsolete.
170 You should run autoupdate.])])
173 # AC_LANG_RESTORE
174 # ---------------
175 # Restore the current language from the stack.
176 AU_DEFUN([AC_LANG_RESTORE], [AC_LANG_POP($@)])
179 # _AC_LANG_ABBREV
180 # ---------------
181 # Return a short signature of _AC_LANG which can be used in shell
182 # variable names, or in M4 macro names.
183 m4_defun([_AC_LANG_ABBREV],
184 [_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
187 # _AC_LANG_PREFIX
188 # ---------------
189 # Return a short (upper case) signature of _AC_LANG that is used to
190 # prefix environment variables like FLAGS.
191 m4_defun([_AC_LANG_PREFIX],
192 [_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
195 # AC_LANG_ASSERT(LANG)
196 # --------------------
197 # Current language must be LANG.
198 m4_defun([AC_LANG_ASSERT],
199 [m4_if(_AC_LANG, $1, [],
200        [m4_fatal([$0: current language is not $1: ] _AC_LANG)])])
204 ## ---------------------- ##
205 ## 2.Producing programs.  ##
206 ## ---------------------- ##
209 # ---------------------- #
210 # 2a. Generic routines.  #
211 # ---------------------- #
214 # AC_LANG_CONFTEST(BODY)
215 # ----------------------
216 # Save the BODY in `conftest.$ac_ext'.  Add a trailing new line.
217 AC_DEFUN([AC_LANG_CONFTEST],
218 [cat >conftest.$ac_ext <<_ACEOF
220 _ACEOF])
223 # AC_LANG_SOURCE(BODY)
224 # --------------------
225 # Produce a valid source for the current language, which includes the
226 # BODY, and as much as possible `confdefs.h'.
227 AC_DEFUN([AC_LANG_SOURCE],
228 [_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
231 # AC_LANG_PROGRAM([PROLOGUE], [BODY])
232 # -----------------------------------
233 # Produce a valid source for the current language.  Prepend the
234 # PROLOGUE (typically CPP directives and/or declarations) to an
235 # execution the BODY (typically glued inside the `main' function, or
236 # equivalent).
237 AC_DEFUN([AC_LANG_PROGRAM],
238 [AC_LANG_SOURCE([_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])])
241 # AC_LANG_CALL(PROLOGUE, FUNCTION)
242 # --------------------------------
243 # Call the FUNCTION.
244 AC_DEFUN([AC_LANG_CALL],
245 [m4_ifval([$2], [], [m4_warn([syntax], [$0: no function given])])dnl
246 _AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
249 # AC_LANG_FUNC_LINK_TRY(FUNCTION)
250 # -------------------------------
251 # Produce a source which links correctly iff the FUNCTION exists.
252 AC_DEFUN([AC_LANG_FUNC_LINK_TRY],
253 [m4_ifval([$1], [], [m4_warn([syntax], [$0: no function given])])dnl
254 _AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
257 # AC_LANG_BOOL_COMPILE_TRY(PROLOGUE, EXPRESSION)
258 # ----------------------------------------------
259 # Produce a program that compiles with success iff the boolean EXPRESSION
260 # evaluates to true at compile time.
261 AC_DEFUN([AC_LANG_BOOL_COMPILE_TRY],
262 [_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
265 # AC_LANG_INT_SAVE(PROLOGUE, EXPRESSION)
266 # --------------------------------------
267 # Produce a program that saves the runtime evaluation of the integer
268 # EXPRESSION into `conftest.val'.
269 AC_DEFUN([AC_LANG_INT_SAVE],
270 [_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
273 ## -------------------------------------------- ##
274 ## 3. Looking for Compilers and Preprocessors.  ##
275 ## -------------------------------------------- ##
277 # ----------------------------------------------------- #
278 # 3a. Generic routines in compilers and preprocessors.  #
279 # ----------------------------------------------------- #
281 # AC_LANG_COMPILER
282 # ----------------
283 # Find a compiler for the current LANG.  Be sure to be run before
284 # AC_LANG_PREPROC.
286 # Note that because we might AC_REQUIRE `AC_LANG_COMPILER(C)' for
287 # instance, the latter must be AC_DEFUN'd, not just define'd.
288 m4_define([AC_LANG_COMPILER],
289 [AC_BEFORE([AC_LANG_COMPILER(]_AC_LANG[)],
290            [AC_LANG_PREPROC(]_AC_LANG[)])dnl
291 _AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
294 # AC_LANG_COMPILER_REQUIRE
295 # ------------------------
296 # Ensure we have a compiler for the current LANG.
297 AC_DEFUN([AC_LANG_COMPILER_REQUIRE],
298 [m4_require([AC_LANG_COMPILER(]_AC_LANG[)],
299             [AC_LANG_COMPILER])])
303 # _AC_LANG_COMPILER_GNU
304 # ---------------------
305 # Check whether the compiler for the current language is GNU.
307 # It doesn't seem necessary right now to have a different source
308 # according to the current language, since this works fine.  Some day
309 # it might be needed.  Nevertheless, pay attention to the fact that
310 # the position of `choke me' on the seventh column is meant: otherwise
311 # some Fortran compilers (e.g., SGI) might consider it's a
312 # continuation line, and warn instead of reporting an error.
313 m4_define([_AC_LANG_COMPILER_GNU],
314 [AC_CACHE_CHECK([whether we are using the GNU _AC_LANG compiler],
315                 [ac_cv_[]_AC_LANG_ABBREV[]_compiler_gnu],
316 [_AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[#ifndef __GNUC__
317        choke me
318 #endif
319 ]])],
320                    [ac_compiler_gnu=yes],
321                    [ac_compiler_gnu=no])
322 ac_cv_[]_AC_LANG_ABBREV[]_compiler_gnu=$ac_compiler_gnu
323 ])])# _AC_LANG_COMPILER_GNU
326 # AC_LANG_PREPROC
327 # ---------------
328 # Find a preprocessor for the current language.  Note that because we
329 # might AC_REQUIRE `AC_LANG_PREPROC(C)' for instance, the latter must
330 # be AC_DEFUN'd, not just define'd.  Since the preprocessor depends
331 # upon the compiler, look for the compiler.
332 m4_define([AC_LANG_PREPROC],
333 [AC_LANG_COMPILER_REQUIRE()dnl
334 _AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
337 # AC_LANG_PREPROC_REQUIRE
338 # -----------------------
339 # Ensure we have a preprocessor for the current language.
340 AC_DEFUN([AC_LANG_PREPROC_REQUIRE],
341 [m4_require([AC_LANG_PREPROC(]_AC_LANG[)],
342             [AC_LANG_PREPROC])])
345 # AC_REQUIRE_CPP
346 # --------------
347 # Require the preprocessor for the current language.
348 # FIXME: AU_ALIAS once AC_LANG is officially documented (2.51?).
349 AC_DEFUN([AC_REQUIRE_CPP],
350 [AC_LANG_PREPROC_REQUIRE])
354 # AC_NO_EXECUTABLES
355 # -----------------
356 # FIXME: The GCC team has specific needs which the current Autoconf
357 # framework cannot solve elegantly.  This macro implements a dirty
358 # hack until Autoconf is able to provide the services its users
359 # need.
361 # Several of the support libraries that are often built with GCC can't
362 # assume the tool-chain is already capable of linking a program: the
363 # compiler often expects to be able to link with some of such
364 # libraries.
366 # In several of these libraries, workarounds have been introduced to
367 # avoid the AC_PROG_CC_WORKS test, that would just abort their
368 # configuration.  The introduction of AC_EXEEXT, enabled either by
369 # libtool or by CVS autoconf, have just made matters worse.
371 # Unlike an earlier version of this macro, using AC_NO_EXECUTABLES does
372 # not disable link tests at autoconf time, but at configure time.
373 # This allows AC_NO_EXECUTABLES to be invoked conditionally.
374 AC_DEFUN_ONCE([AC_NO_EXECUTABLES],
375 [m4_divert_push([KILL])
376 m4_divert_text([DEFAULTS], [ac_no_link=no])
378 AC_BEFORE([$0], [_AC_COMPILER_EXEEXT])
379 AC_BEFORE([$0], [AC_LINK_IFELSE])
381 m4_define([_AC_COMPILER_EXEEXT],
382 [AC_LANG_CONFTEST([AC_LANG_PROGRAM()])
383 if _AC_DO_VAR(ac_link); then
384   ac_no_link=no
385   ]m4_defn([_AC_COMPILER_EXEEXT])[
386 else
387   ac_no_link=yes
388   # Setting cross_compile will disable run tests; it will
389   # also disable AC_CHECK_FILE but that's generally
390   # correct if we can't link.
391   cross_compiling=yes
392   EXEEXT=
393   _AC_COMPILER_EXEEXT_CROSS
397 m4_define([AC_LINK_IFELSE],
398 [if test x$ac_no_link = xyes; then
399   AC_MSG_ERROR([Link tests are not allowed after AC@&t@_NO_EXECUTABLES.])
401 ]m4_defn([AC_LINK_IFELSE]))
403 m4_divert_pop()dnl
404 ])# AC_NO_EXECUTABLES
408 # ----------------------------- #
409 # Computing EXEEXT and OBJEXT.  #
410 # ----------------------------- #
413 # Files to ignore
414 # ---------------
415 # Ignore .d files produced by CFLAGS=-MD.
417 # On UWIN (which uses a cc wrapper for MSVC), the compiler also generates
418 # a .pdb file
420 # When the w32 free Borland C++ command line compiler links a program
421 # (conftest.exe), it also produces a file named `conftest.tds' in
422 # addition to `conftest.obj'.
424 # - *.bb, *.bbg
425 #   Created per object by GCC when given -ftest-coverage.
427 # - *.xSYM
428 #   Created on BeOS.  Seems to be per executable.
430 # - *.map, *.inf
431 #   Created by the Green Hills compiler.
434 # _AC_COMPILER_OBJEXT_REJECT
435 # --------------------------
436 # Case/esac pattern matching the files to be ignored when looking for
437 # compiled object files.
438 m4_define([_AC_COMPILER_OBJEXT_REJECT],
439 [*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf])
442 # _AC_COMPILER_EXEEXT_REJECT
443 # --------------------------
444 # Case/esac pattern matching the files to be ignored when looking for
445 # compiled executables.
446 m4_define([_AC_COMPILER_EXEEXT_REJECT],
447 [_AC_COMPILER_OBJEXT_REJECT | *.o | *.obj])
450 # We must not AU define them, because autoupdate would then remove
451 # them, which is right, but Automake 1.4 would remove the support for
452 # $(EXEEXT) etc.
453 # FIXME: Remove this once Automake fixed.
454 AC_DEFUN([AC_EXEEXT],   [])
455 AC_DEFUN([AC_OBJEXT],   [])
458 # _AC_COMPILER_EXEEXT_DEFAULT
459 # ---------------------------
460 # Check for the extension used for the default name for executables.
462 # We do this in order to find out what is the extension we must add for
463 # creating executables (see _AC_COMPILER_EXEEXT's comments).
465 # Beware of `expr' that may return `0' or `'.  Since this macro is
466 # the first one in touch with the compiler, it should also check that
467 # it compiles properly.
469 # On OpenVMS 7.1 system, the DEC C 5.5 compiler when called through a
470 # GNV (gnv.sourceforge.net) cc wrapper, produces the output file named
471 # `a_out.exe'.
472 m4_define([_AC_COMPILER_EXEEXT_DEFAULT],
473 [# Try to create an executable without -o first, disregard a.out.
474 # It will help us diagnose broken compilers, and finding out an intuition
475 # of exeext.
476 AC_MSG_CHECKING([for _AC_LANG compiler default output file name])
477 ac_link_default=`echo "$ac_link" | sed ['s/ -o *conftest[^ ]*//']`
479 # List of possible output files, starting from the most likely.
480 # The algorithm is not robust to junk in `.', hence go to wildcards (a.*)
481 # only as a last resort.  b.out is created by i960 compilers.
482 ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out'
484 # The IRIX 6 linker writes into existing files which may not be
485 # executable, retaining their permissions.  Remove them first so a
486 # subsequent execution test works.
487 ac_rmfiles=
488 for ac_file in $ac_files
490   case $ac_file in
491     _AC_COMPILER_EXEEXT_REJECT ) ;;
492     * ) ac_rmfiles="$ac_rmfiles $ac_file";;
493   esac
494 done
495 rm -f $ac_rmfiles
497 AS_IF([_AC_DO_VAR(ac_link_default)],
498 [# Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
499 # So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
500 # in a Makefile.  We should not override ac_cv_exeext if it was cached,
501 # so that the user can short-circuit this test for compilers unknown to
502 # Autoconf.
503 for ac_file in $ac_files ''
505   test -f "$ac_file" || continue
506   case $ac_file in
507     _AC_COMPILER_EXEEXT_REJECT )
508         ;;
509     [[ab]].out )
510         # We found the default executable, but exeext='' is most
511         # certainly right.
512         break;;
513     *.* )
514         if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
515         then :; else
516            ac_cv_exeext=`expr "$ac_file" : ['[^.]*\(\..*\)']`
517         fi
518         # We set ac_cv_exeext here because the later test for it is not
519         # safe: cross compilers may not add the suffix if given an `-o'
520         # argument, so we may need to know it at that point already.
521         # Even if this section looks crufty: it has the advantage of
522         # actually working.
523         break;;
524     * )
525         break;;
526   esac
527 done
528 test "$ac_cv_exeext" = no && ac_cv_exeext=
530       [ac_file=''])
531 AC_MSG_RESULT([$ac_file])
532 AS_IF([test -z "$ac_file"],
533 [_AC_MSG_LOG_CONFTEST
534 AC_MSG_FAILURE([_AC_LANG compiler cannot create executables], 77)])
535 ac_exeext=$ac_cv_exeext
536 ])# _AC_COMPILER_EXEEXT_DEFAULT
539 # _AC_COMPILER_EXEEXT_WORKS
540 # -------------------------
541 m4_define([_AC_COMPILER_EXEEXT_WORKS],
542 [# Check that the compiler produces executables we can run.  If not, either
543 # the compiler is broken, or we cross compile.
544 AC_MSG_CHECKING([whether the _AC_LANG compiler works])
545 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0
546 # If not cross compiling, check that we can run a simple program.
547 if test "$cross_compiling" != yes; then
548   if _AC_DO_TOKENS([./$ac_file]); then
549     cross_compiling=no
550   else
551     if test "$cross_compiling" = maybe; then
552         cross_compiling=yes
553     else
554         AC_MSG_FAILURE([cannot run _AC_LANG compiled programs.
555 If you meant to cross compile, use `--host'.])
556     fi
557   fi
559 AC_MSG_RESULT([yes])
560 ])# _AC_COMPILER_EXEEXT_WORKS
563 # _AC_COMPILER_EXEEXT_CROSS
564 # -------------------------
565 m4_define([_AC_COMPILER_EXEEXT_CROSS],
566 [# Check that the compiler produces executables we can run.  If not, either
567 # the compiler is broken, or we cross compile.
568 AC_MSG_CHECKING([whether we are cross compiling])
569 AC_MSG_RESULT([$cross_compiling])
570 ])# _AC_COMPILER_EXEEXT_CROSS
573 # _AC_COMPILER_EXEEXT_O
574 # ---------------------
575 # Check for the extension used when `-o foo'.  Try to see if ac_cv_exeext,
576 # as computed by _AC_COMPILER_EXEEXT_DEFAULT is OK.
577 m4_define([_AC_COMPILER_EXEEXT_O],
578 [AC_MSG_CHECKING([for suffix of executables])
579 AS_IF([_AC_DO_VAR(ac_link)],
580 [# If both `conftest.exe' and `conftest' are `present' (well, observable)
581 # catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
582 # work properly (i.e., refer to `conftest.exe'), while it won't with
583 # `rm'.
584 for ac_file in conftest.exe conftest conftest.*; do
585   test -f "$ac_file" || continue
586   case $ac_file in
587     _AC_COMPILER_EXEEXT_REJECT ) ;;
588     *.* ) ac_cv_exeext=`expr "$ac_file" : ['[^.]*\(\..*\)']`
589           break;;
590     * ) break;;
591   esac
592 done],
593               [AC_MSG_FAILURE([cannot compute suffix of executables: cannot compile and link])])
594 rm -f conftest$ac_cv_exeext
595 AC_MSG_RESULT([$ac_cv_exeext])
596 ])# _AC_COMPILER_EXEEXT_O
599 # _AC_COMPILER_EXEEXT
600 # -------------------
601 # Check for the extension used for executables.  It compiles a test
602 # executable.  If this is called, the executable extensions will be
603 # automatically used by link commands run by the configure script.
605 # Note that some compilers (cross or not), strictly obey to `-o foo' while
606 # the host requires `foo.exe', so we should not depend upon `-o' to
607 # test EXEEXT.  But then, be sure not to destroy user files.
609 # Must be run before _AC_COMPILER_OBJEXT because _AC_COMPILER_EXEEXT_DEFAULT
610 # checks whether the compiler works.
611 m4_define([_AC_COMPILER_EXEEXT],
612 [AC_LANG_CONFTEST([AC_LANG_PROGRAM()])
613 ac_clean_files_save=$ac_clean_files
614 ac_clean_files="$ac_clean_files a.out a.exe b.out"
615 _AC_COMPILER_EXEEXT_DEFAULT
616 _AC_COMPILER_EXEEXT_WORKS
617 rm -f a.out a.exe conftest$ac_cv_exeext b.out
618 ac_clean_files=$ac_clean_files_save
619 _AC_COMPILER_EXEEXT_CROSS
620 _AC_COMPILER_EXEEXT_O
621 rm -f conftest.$ac_ext
622 AC_SUBST([EXEEXT], [$ac_cv_exeext])dnl
623 ac_exeext=$EXEEXT
624 ])# _AC_COMPILER_EXEEXT
627 # _AC_COMPILER_OBJEXT
628 # -------------------
629 # Check the object extension used by the compiler: typically `.o' or
630 # `.obj'.  If this is called, some other behavior will change,
631 # determined by ac_objext.
633 # This macro is called by AC_LANG_COMPILER, the latter being required
634 # by the AC_COMPILE_IFELSE macros, so use _AC_COMPILE_IFELSE.  And in fact,
635 # don't, since _AC_COMPILE_IFELSE needs to know ac_objext for the `test -s'
636 # it includes.  So do it by hand.
637 m4_define([_AC_COMPILER_OBJEXT],
638 [AC_CACHE_CHECK([for suffix of object files], ac_cv_objext,
639 [AC_LANG_CONFTEST([AC_LANG_PROGRAM()])
640 rm -f conftest.o conftest.obj
641 AS_IF([_AC_DO_VAR(ac_compile)],
642 [for ac_file in conftest.o conftest.obj conftest.*; do
643   test -f "$ac_file" || continue;
644   case $ac_file in
645     _AC_COMPILER_OBJEXT_REJECT ) ;;
646     *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
647        break;;
648   esac
649 done],
650       [_AC_MSG_LOG_CONFTEST
651 AC_MSG_FAILURE([cannot compute suffix of object files: cannot compile])])
652 rm -f conftest.$ac_cv_objext conftest.$ac_ext])
653 AC_SUBST([OBJEXT], [$ac_cv_objext])dnl
654 ac_objext=$OBJEXT
655 ])# _AC_COMPILER_OBJEXT
661 ## ------------------------------- ##
662 ## 4. Compilers' characteristics.  ##
663 ## ------------------------------- ##
665 # AC_LANG_WERROR
666 # ------------------
667 # Treat warnings from the current language's preprocessor, compiler, and
668 # linker as fatal errors.
669 AC_DEFUN([AC_LANG_WERROR],
670 [m4_divert_text([DEFAULTS], [ac_[]_AC_LANG_ABBREV[]_werror_flag=])
671 ac_[]_AC_LANG_ABBREV[]_werror_flag=yes])# AC_LANG_WERROR