Imported Upstream version 20100216
[platform/upstream/byacc.git] / aclocal.m4
1 dnl $Id: aclocal.m4,v 1.10 2010/02/16 09:59:33 tom Exp $
2 dnl
3 dnl Macros for byacc configure script (Thomas E. Dickey)
4 dnl ---------------------------------------------------------------------------
5 dnl ---------------------------------------------------------------------------
6 dnl CF_ADD_CFLAGS version: 9 updated: 2010/01/09 11:05:50
7 dnl -------------
8 dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS
9 dnl The second parameter if given makes this macro verbose.
10 dnl
11 dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS,
12 dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily
13 dnl confused by the quotes (which require backslashes to keep them usable).
14 AC_DEFUN([CF_ADD_CFLAGS],
15 [
16 cf_fix_cppflags=no
17 cf_new_cflags=
18 cf_new_cppflags=
19 cf_new_extra_cppflags=
20
21 for cf_add_cflags in $1
22 do
23 case $cf_fix_cppflags in
24 no)
25         case $cf_add_cflags in #(vi
26         -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
27                 case $cf_add_cflags in
28                 -D*)
29                         cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'`
30
31                         test "${cf_add_cflags}" != "${cf_tst_cflags}" \
32                                 && test -z "${cf_tst_cflags}" \
33                                 && cf_fix_cppflags=yes
34
35                         if test $cf_fix_cppflags = yes ; then
36                                 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
37                                 continue
38                         elif test "${cf_tst_cflags}" = "\"'" ; then
39                                 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
40                                 continue
41                         fi
42                         ;;
43                 esac
44                 case "$CPPFLAGS" in
45                 *$cf_add_cflags) #(vi
46                         ;;
47                 *) #(vi
48                         case $cf_add_cflags in #(vi
49                         -D*)
50                                 cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
51                                 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags)
52                                 ;;
53                         esac
54                         cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
55                         ;;
56                 esac
57                 ;;
58         *)
59                 cf_new_cflags="$cf_new_cflags $cf_add_cflags"
60                 ;;
61         esac
62         ;;
63 yes)
64         cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
65
66         cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'`
67
68         test "${cf_add_cflags}" != "${cf_tst_cflags}" \
69                 && test -z "${cf_tst_cflags}" \
70                 && cf_fix_cppflags=no
71         ;;
72 esac
73 done
74
75 if test -n "$cf_new_cflags" ; then
76         ifelse($2,,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)])
77         CFLAGS="$CFLAGS $cf_new_cflags"
78 fi
79
80 if test -n "$cf_new_cppflags" ; then
81         ifelse($2,,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)])
82         CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
83 fi
84
85 if test -n "$cf_new_extra_cppflags" ; then
86         ifelse($2,,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)])
87         EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
88 fi
89
90 AC_SUBST(EXTRA_CPPFLAGS)
91
92 ])dnl
93 dnl ---------------------------------------------------------------------------
94 dnl CF_ANSI_CC_CHECK version: 9 updated: 2001/12/30 17:53:34
95 dnl ----------------
96 dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES'
97 dnl in the sharutils 4.2 distribution.
98 AC_DEFUN([CF_ANSI_CC_CHECK],
99 [
100 AC_CACHE_CHECK(for ${CC-cc} option to accept ANSI C, cf_cv_ansi_cc,[
101 cf_cv_ansi_cc=no
102 cf_save_CFLAGS="$CFLAGS"
103 cf_save_CPPFLAGS="$CPPFLAGS"
104 # Don't try gcc -ansi; that turns off useful extensions and
105 # breaks some systems' header files.
106 # AIX                   -qlanglvl=ansi
107 # Ultrix and OSF/1      -std1
108 # HP-UX                 -Aa -D_HPUX_SOURCE
109 # SVR4                  -Xc
110 # UnixWare 1.2          (cannot use -Xc, since ANSI/POSIX clashes)
111 for cf_arg in "-DCC_HAS_PROTOS" \
112         "" \
113         -qlanglvl=ansi \
114         -std1 \
115         -Ae \
116         "-Aa -D_HPUX_SOURCE" \
117         -Xc
118 do
119         CF_ADD_CFLAGS($cf_arg)
120         AC_TRY_COMPILE(
121 [
122 #ifndef CC_HAS_PROTOS
123 #if !defined(__STDC__) || (__STDC__ != 1)
124 choke me
125 #endif
126 #endif
127 ],[
128         int test (int i, double x);
129         struct s1 {int (*f) (int a);};
130         struct s2 {int (*f) (double a);};],
131         [cf_cv_ansi_cc="$cf_arg"; break])
132 done
133 CFLAGS="$cf_save_CFLAGS"
134 CPPFLAGS="$cf_save_CPPFLAGS"
135 ])
136
137 if test "$cf_cv_ansi_cc" != "no"; then
138 if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then
139         CF_ADD_CFLAGS($cf_cv_ansi_cc)
140 else
141         AC_DEFINE(CC_HAS_PROTOS)
142 fi
143 fi
144 ])dnl
145 dnl ---------------------------------------------------------------------------
146 dnl CF_ANSI_CC_REQD version: 4 updated: 2008/03/23 14:48:54
147 dnl ---------------
148 dnl For programs that must use an ANSI compiler, obtain compiler options that
149 dnl will make it recognize prototypes.  We'll do preprocessor checks in other
150 dnl macros, since tools such as unproto can fake prototypes, but only part of
151 dnl the preprocessor.
152 AC_DEFUN([CF_ANSI_CC_REQD],
153 [AC_REQUIRE([CF_ANSI_CC_CHECK])
154 if test "$cf_cv_ansi_cc" = "no"; then
155         AC_MSG_ERROR(
156 [Your compiler does not appear to recognize prototypes.
157 You have the following choices:
158         a. adjust your compiler options
159         b. get an up-to-date compiler
160         c. use a wrapper such as unproto])
161 fi
162 ])dnl
163 dnl ---------------------------------------------------------------------------
164 dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31
165 dnl --------------
166 dnl Allow user to disable a normally-on option.
167 AC_DEFUN([CF_ARG_DISABLE],
168 [CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl
169 dnl ---------------------------------------------------------------------------
170 dnl CF_ARG_OPTION version: 3 updated: 1997/10/18 14:42:41
171 dnl -------------
172 dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus
173 dnl values.
174 dnl
175 dnl Parameters:
176 dnl $1 = option name
177 dnl $2 = help-string
178 dnl $3 = action to perform if option is not default
179 dnl $4 = action if perform if option is default
180 dnl $5 = default option value (either 'yes' or 'no')
181 AC_DEFUN([CF_ARG_OPTION],
182 [AC_ARG_ENABLE($1,[$2],[test "$enableval" != ifelse($5,no,yes,no) && enableval=ifelse($5,no,no,yes)
183   if test "$enableval" != "$5" ; then
184 ifelse($3,,[    :]dnl
185 ,[    $3]) ifelse($4,,,[
186   else
187     $4])
188   fi],[enableval=$5 ifelse($4,,,[
189   $4
190 ])dnl
191   ])])dnl
192 dnl ---------------------------------------------------------------------------
193 dnl CF_CHECK_CACHE version: 11 updated: 2008/03/23 14:45:59
194 dnl --------------
195 dnl Check if we're accidentally using a cache from a different machine.
196 dnl Derive the system name, as a check for reusing the autoconf cache.
197 dnl
198 dnl If we've packaged config.guess and config.sub, run that (since it does a
199 dnl better job than uname).  Normally we'll use AC_CANONICAL_HOST, but allow
200 dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM
201 dnl which is useful in cross-compiles.
202 dnl
203 dnl Note: we would use $ac_config_sub, but that is one of the places where
204 dnl autoconf 2.5x broke compatibility with autoconf 2.13
205 AC_DEFUN([CF_CHECK_CACHE],
206 [
207 if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then
208         ifelse([$1],,[AC_CANONICAL_HOST],[$1])
209         system_name="$host_os"
210 else
211         system_name="`(uname -s -r) 2>/dev/null`"
212         if test -z "$system_name" ; then
213                 system_name="`(hostname) 2>/dev/null`"
214         fi
215 fi
216 test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name")
217 AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
218
219 test -z "$system_name" && system_name="$cf_cv_system_name"
220 test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name)
221
222 if test ".$system_name" != ".$cf_cv_system_name" ; then
223         AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name))
224         AC_MSG_ERROR("Please remove config.cache and try again.")
225 fi
226 ])dnl
227 dnl ---------------------------------------------------------------------------
228 dnl CF_DISABLE_ECHO version: 11 updated: 2009/12/13 13:16:57
229 dnl ---------------
230 dnl You can always use "make -n" to see the actual options, but it's hard to
231 dnl pick out/analyze warning messages when the compile-line is long.
232 dnl
233 dnl Sets:
234 dnl     ECHO_LT - symbol to control if libtool is verbose
235 dnl     ECHO_LD - symbol to prefix "cc -o" lines
236 dnl     RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o)
237 dnl     SHOW_CC - symbol to put before explicit "cc -c" lines
238 dnl     ECHO_CC - symbol to put before any "cc" line
239 dnl
240 AC_DEFUN([CF_DISABLE_ECHO],[
241 AC_MSG_CHECKING(if you want to see long compiling messages)
242 CF_ARG_DISABLE(echo,
243         [  --disable-echo          display "compiling" commands],
244         [
245     ECHO_LT='--silent'
246     ECHO_LD='@echo linking [$]@;'
247     RULE_CC='@echo compiling [$]<'
248     SHOW_CC='@echo compiling [$]@'
249     ECHO_CC='@'
250 ],[
251     ECHO_LT=''
252     ECHO_LD=''
253     RULE_CC=''
254     SHOW_CC=''
255     ECHO_CC=''
256 ])
257 AC_MSG_RESULT($enableval)
258 AC_SUBST(ECHO_LT)
259 AC_SUBST(ECHO_LD)
260 AC_SUBST(RULE_CC)
261 AC_SUBST(SHOW_CC)
262 AC_SUBST(ECHO_CC)
263 ])dnl
264 dnl ---------------------------------------------------------------------------
265 dnl CF_DISABLE_LEAKS version: 4 updated: 2006/12/16 15:10:42
266 dnl ----------------
267 dnl Combine no-leak checks with the libraries or tools that are used for the
268 dnl checks.
269 AC_DEFUN([CF_DISABLE_LEAKS],[
270
271 AC_REQUIRE([CF_WITH_DMALLOC])
272 AC_REQUIRE([CF_WITH_DBMALLOC])
273 AC_REQUIRE([CF_WITH_VALGRIND])
274
275 AC_MSG_CHECKING(if you want to perform memory-leak testing)
276 AC_ARG_ENABLE(leaks,
277         [  --disable-leaks         test: free permanent memory, analyze leaks],
278         [with_no_leaks=yes],
279         : ${with_no_leaks:=no})
280 AC_MSG_RESULT($with_no_leaks)
281
282 if test "$with_no_leaks" = yes ; then
283         AC_DEFINE(NO_LEAKS)
284 fi
285 ])dnl
286 dnl ---------------------------------------------------------------------------
287 dnl CF_GCC_ATTRIBUTES version: 13 updated: 2009/08/11 20:19:56
288 dnl -----------------
289 dnl Test for availability of useful gcc __attribute__ directives to quiet
290 dnl compiler warnings.  Though useful, not all are supported -- and contrary
291 dnl to documentation, unrecognized directives cause older compilers to barf.
292 AC_DEFUN([CF_GCC_ATTRIBUTES],
293 [
294 if test "$GCC" = yes
295 then
296 cat > conftest.i <<EOF
297 #ifndef GCC_PRINTF
298 #define GCC_PRINTF 0
299 #endif
300 #ifndef GCC_SCANF
301 #define GCC_SCANF 0
302 #endif
303 #ifndef GCC_NORETURN
304 #define GCC_NORETURN /* nothing */
305 #endif
306 #ifndef GCC_UNUSED
307 #define GCC_UNUSED /* nothing */
308 #endif
309 EOF
310 if test "$GCC" = yes
311 then
312         AC_CHECKING([for $CC __attribute__ directives])
313 cat > conftest.$ac_ext <<EOF
314 #line __oline__ "${as_me-configure}"
315 #include "confdefs.h"
316 #include "conftest.h"
317 #include "conftest.i"
318 #if     GCC_PRINTF
319 #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
320 #else
321 #define GCC_PRINTFLIKE(fmt,var) /*nothing*/
322 #endif
323 #if     GCC_SCANF
324 #define GCC_SCANFLIKE(fmt,var)  __attribute__((format(scanf,fmt,var)))
325 #else
326 #define GCC_SCANFLIKE(fmt,var)  /*nothing*/
327 #endif
328 extern void wow(char *,...) GCC_SCANFLIKE(1,2);
329 extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
330 extern void foo(void) GCC_NORETURN;
331 int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; }
332 EOF
333         cf_printf_attribute=no
334         cf_scanf_attribute=no
335         for cf_attribute in scanf printf unused noreturn
336         do
337                 CF_UPPER(cf_ATTRIBUTE,$cf_attribute)
338                 cf_directive="__attribute__(($cf_attribute))"
339                 echo "checking for $CC $cf_directive" 1>&AC_FD_CC
340
341                 case $cf_attribute in #(vi
342                 printf) #(vi
343                         cf_printf_attribute=yes
344                         cat >conftest.h <<EOF
345 #define GCC_$cf_ATTRIBUTE 1
346 EOF
347                         ;;
348                 scanf) #(vi
349                         cf_scanf_attribute=yes
350                         cat >conftest.h <<EOF
351 #define GCC_$cf_ATTRIBUTE 1
352 EOF
353                         ;;
354                 *) #(vi
355                         cat >conftest.h <<EOF
356 #define GCC_$cf_ATTRIBUTE $cf_directive
357 EOF
358                         ;;
359                 esac
360
361                 if AC_TRY_EVAL(ac_compile); then
362                         test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute)
363                         cat conftest.h >>confdefs.h
364                         case $cf_attribute in #(vi
365                         printf) #(vi
366                                 if test "$cf_printf_attribute" = no ; then
367                                         cat >>confdefs.h <<EOF
368 #define GCC_PRINTFLIKE(fmt,var) /* nothing */
369 EOF
370                                 else
371                                         cat >>confdefs.h <<EOF
372 #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
373 EOF
374                                 fi
375                                 ;;
376                         scanf) #(vi
377                                 if test "$cf_scanf_attribute" = no ; then
378                                         cat >>confdefs.h <<EOF
379 #define GCC_SCANFLIKE(fmt,var) /* nothing */
380 EOF
381                                 else
382                                         cat >>confdefs.h <<EOF
383 #define GCC_SCANFLIKE(fmt,var)  __attribute__((format(scanf,fmt,var)))
384 EOF
385                                 fi
386                                 ;;
387                         esac
388                 fi
389         done
390 else
391         fgrep define conftest.i >>confdefs.h
392 fi
393 rm -rf conftest*
394 fi
395 ])dnl
396 dnl ---------------------------------------------------------------------------
397 dnl CF_GCC_VERSION version: 4 updated: 2005/08/27 09:53:42
398 dnl --------------
399 dnl Find version of gcc
400 AC_DEFUN([CF_GCC_VERSION],[
401 AC_REQUIRE([AC_PROG_CC])
402 GCC_VERSION=none
403 if test "$GCC" = yes ; then
404         AC_MSG_CHECKING(version of $CC)
405         GCC_VERSION="`${CC} --version| sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
406         test -z "$GCC_VERSION" && GCC_VERSION=unknown
407         AC_MSG_RESULT($GCC_VERSION)
408 fi
409 ])dnl
410 dnl ---------------------------------------------------------------------------
411 dnl CF_GCC_WARNINGS version: 24 updated: 2009/02/01 15:21:00
412 dnl ---------------
413 dnl Check if the compiler supports useful warning options.  There's a few that
414 dnl we don't use, simply because they're too noisy:
415 dnl
416 dnl     -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x)
417 dnl     -Wredundant-decls (system headers make this too noisy)
418 dnl     -Wtraditional (combines too many unrelated messages, only a few useful)
419 dnl     -Wwrite-strings (too noisy, but should review occasionally).  This
420 dnl             is enabled for ncurses using "--enable-const".
421 dnl     -pedantic
422 dnl
423 dnl Parameter:
424 dnl     $1 is an optional list of gcc warning flags that a particular
425 dnl             application might want to use, e.g., "no-unused" for
426 dnl             -Wno-unused
427 dnl Special:
428 dnl     If $with_ext_const is "yes", add a check for -Wwrite-strings
429 dnl
430 AC_DEFUN([CF_GCC_WARNINGS],
431 [
432 AC_REQUIRE([CF_GCC_VERSION])
433 CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)
434
435 cat > conftest.$ac_ext <<EOF
436 #line __oline__ "${as_me-configure}"
437 int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
438 EOF
439
440 if test "$INTEL_COMPILER" = yes
441 then
442 # The "-wdXXX" options suppress warnings:
443 # remark #1419: external declaration in primary source file
444 # remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
445 # remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
446 # remark #193: zero used for undefined preprocessing identifier
447 # remark #593: variable "curs_sb_left_arrow" was set but never used
448 # remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
449 # remark #869: parameter "tw" was never referenced
450 # remark #981: operands are evaluated in unspecified order
451 # warning #279: controlling expression is constant
452
453         AC_CHECKING([for $CC warning options])
454         cf_save_CFLAGS="$CFLAGS"
455         EXTRA_CFLAGS="-Wall"
456         for cf_opt in \
457                 wd1419 \
458                 wd1683 \
459                 wd1684 \
460                 wd193 \
461                 wd593 \
462                 wd279 \
463                 wd810 \
464                 wd869 \
465                 wd981
466         do
467                 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
468                 if AC_TRY_EVAL(ac_compile); then
469                         test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
470                         EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
471                 fi
472         done
473         CFLAGS="$cf_save_CFLAGS"
474
475 elif test "$GCC" = yes
476 then
477         AC_CHECKING([for $CC warning options])
478         cf_save_CFLAGS="$CFLAGS"
479         EXTRA_CFLAGS="-W -Wall"
480         cf_warn_CONST=""
481         test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
482         for cf_opt in \
483                 Wbad-function-cast \
484                 Wcast-align \
485                 Wcast-qual \
486                 Winline \
487                 Wmissing-declarations \
488                 Wmissing-prototypes \
489                 Wnested-externs \
490                 Wpointer-arith \
491                 Wshadow \
492                 Wstrict-prototypes \
493                 Wundef $cf_warn_CONST $1
494         do
495                 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
496                 if AC_TRY_EVAL(ac_compile); then
497                         test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
498                         case $cf_opt in #(vi
499                         Wcast-qual) #(vi
500                                 CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES"
501                                 ;;
502                         Winline) #(vi
503                                 case $GCC_VERSION in
504                                 [[34]].*)
505                                         CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
506                                         continue;;
507                                 esac
508                                 ;;
509                         esac
510                         EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
511                 fi
512         done
513         CFLAGS="$cf_save_CFLAGS"
514 fi
515 rm -f conftest*
516
517 AC_SUBST(EXTRA_CFLAGS)
518 ])dnl
519 dnl ---------------------------------------------------------------------------
520 dnl CF_INTEL_COMPILER version: 3 updated: 2005/08/06 18:37:29
521 dnl -----------------
522 dnl Check if the given compiler is really the Intel compiler for Linux.  It
523 dnl tries to imitate gcc, but does not return an error when it finds a mismatch
524 dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK.
525 dnl
526 dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
527 dnl ensure that it is not mistaken for gcc/g++.  It is normally invoked from
528 dnl the wrappers for gcc and g++ warnings.
529 dnl
530 dnl $1 = GCC (default) or GXX
531 dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
532 dnl $3 = CFLAGS (default) or CXXFLAGS
533 AC_DEFUN([CF_INTEL_COMPILER],[
534 ifelse($2,,INTEL_COMPILER,[$2])=no
535
536 if test "$ifelse($1,,[$1],GCC)" = yes ; then
537         case $host_os in
538         linux*|gnu*)
539                 AC_MSG_CHECKING(if this is really Intel ifelse($1,GXX,C++,C) compiler)
540                 cf_save_CFLAGS="$ifelse($3,,CFLAGS,[$3])"
541                 ifelse($3,,CFLAGS,[$3])="$ifelse($3,,CFLAGS,[$3]) -no-gcc"
542                 AC_TRY_COMPILE([],[
543 #ifdef __INTEL_COMPILER
544 #else
545 make an error
546 #endif
547 ],[ifelse($2,,INTEL_COMPILER,[$2])=yes
548 cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc"
549 ],[])
550                 ifelse($3,,CFLAGS,[$3])="$cf_save_CFLAGS"
551                 AC_MSG_RESULT($ifelse($2,,INTEL_COMPILER,[$2]))
552                 ;;
553         esac
554 fi
555 ])dnl
556 dnl ---------------------------------------------------------------------------
557 dnl CF_MSG_LOG version: 4 updated: 2007/07/29 09:55:12
558 dnl ----------
559 dnl Write a debug message to config.log, along with the line number in the
560 dnl configure script.
561 AC_DEFUN([CF_MSG_LOG],[
562 echo "${as_me-configure}:__oline__: testing $* ..." 1>&AC_FD_CC
563 ])dnl
564 dnl ---------------------------------------------------------------------------
565 dnl CF_NO_LEAKS_OPTION version: 4 updated: 2006/12/16 14:24:05
566 dnl ------------------
567 dnl see CF_WITH_NO_LEAKS
568 AC_DEFUN([CF_NO_LEAKS_OPTION],[
569 AC_MSG_CHECKING(if you want to use $1 for testing)
570 AC_ARG_WITH($1,
571         [$2],
572         [AC_DEFINE($3)ifelse([$4],,[
573          $4
574 ])
575         : ${with_cflags:=-g}
576         : ${with_no_leaks:=yes}
577          with_$1=yes],
578         [with_$1=])
579 AC_MSG_RESULT(${with_$1:-no})
580
581 case .$with_cflags in #(vi
582 .*-g*)
583         case .$CFLAGS in #(vi
584         .*-g*) #(vi
585                 ;;
586         *)
587                 CF_ADD_CFLAGS([-g])
588                 ;;
589         esac
590         ;;
591 esac
592 ])dnl
593 dnl ---------------------------------------------------------------------------
594 dnl CF_PROG_EXT version: 10 updated: 2004/01/03 19:28:18
595 dnl -----------
596 dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX.
597 AC_DEFUN([CF_PROG_EXT],
598 [
599 AC_REQUIRE([CF_CHECK_CACHE])
600 case $cf_cv_system_name in
601 os2*)
602     CFLAGS="$CFLAGS -Zmt"
603     CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__"
604     CXXFLAGS="$CXXFLAGS -Zmt"
605     # autoconf's macro sets -Zexe and suffix both, which conflict:w
606     LDFLAGS="$LDFLAGS -Zmt -Zcrtdll"
607     ac_cv_exeext=.exe
608     ;;
609 esac
610
611 AC_EXEEXT
612 AC_OBJEXT
613
614 PROG_EXT="$EXEEXT"
615 AC_SUBST(PROG_EXT)
616 test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT")
617 ])dnl
618 dnl ---------------------------------------------------------------------------
619 dnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50
620 dnl ----------------
621 dnl Remove all -U and -D options that refer to the given symbol from a list
622 dnl of C compiler options.  This works around the problem that not all
623 dnl compilers process -U and -D options from left-to-right, so a -U option
624 dnl cannot be used to cancel the effect of a preceding -D option.
625 dnl
626 dnl $1 = target (which could be the same as the source variable)
627 dnl $2 = source (including '$')
628 dnl $3 = symbol to remove
629 define([CF_REMOVE_DEFINE],
630 [
631 $1=`echo "$2" | \
632         sed     -e 's/-[[UD]]'"$3"'\(=[[^       ]]*\)\?[[       ]]/ /g' \
633                 -e 's/-[[UD]]'"$3"'\(=[[^       ]]*\)\?[$]//g'`
634 ])dnl
635 dnl ---------------------------------------------------------------------------
636 dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59
637 dnl --------
638 dnl Make an uppercase version of a variable
639 dnl $1=uppercase($2)
640 AC_DEFUN([CF_UPPER],
641 [
642 $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
643 ])dnl
644 dnl ---------------------------------------------------------------------------
645 dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12
646 dnl ----------
647 dnl Use AC_VERBOSE w/o the warnings
648 AC_DEFUN([CF_VERBOSE],
649 [test -n "$verbose" && echo "   $1" 1>&AC_FD_MSG
650 CF_MSG_LOG([$1])
651 ])dnl
652 dnl ---------------------------------------------------------------------------
653 dnl CF_WITH_DBMALLOC version: 6 updated: 2006/12/16 14:24:05
654 dnl ----------------
655 dnl Configure-option for dbmalloc.  The optional parameter is used to override
656 dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests.
657 AC_DEFUN([CF_WITH_DBMALLOC],[
658 CF_NO_LEAKS_OPTION(dbmalloc,
659         [  --with-dbmalloc         test: use Conor Cahill's dbmalloc library],
660         [USE_DBMALLOC])
661
662 if test "$with_dbmalloc" = yes ; then
663         AC_CHECK_HEADER(dbmalloc.h,
664                 [AC_CHECK_LIB(dbmalloc,[debug_malloc]ifelse($1,,[],[,$1]))])
665 fi
666 ])dnl
667 dnl ---------------------------------------------------------------------------
668 dnl CF_WITH_DMALLOC version: 6 updated: 2006/12/16 14:24:05
669 dnl ---------------
670 dnl Configure-option for dmalloc.  The optional parameter is used to override
671 dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests.
672 AC_DEFUN([CF_WITH_DMALLOC],[
673 CF_NO_LEAKS_OPTION(dmalloc,
674         [  --with-dmalloc          test: use Gray Watson's dmalloc library],
675         [USE_DMALLOC])
676
677 if test "$with_dmalloc" = yes ; then
678         AC_CHECK_HEADER(dmalloc.h,
679                 [AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse($1,,[],[,$1]))])
680 fi
681 ])dnl
682 dnl ---------------------------------------------------------------------------
683 dnl CF_WITH_VALGRIND version: 1 updated: 2006/12/14 18:00:21
684 dnl ----------------
685 AC_DEFUN([CF_WITH_VALGRIND],[
686 CF_NO_LEAKS_OPTION(valgrind,
687         [  --with-valgrind         test: use valgrind],
688         [USE_VALGRIND])
689 ])dnl
690 dnl ---------------------------------------------------------------------------
691 dnl CF_WITH_WARNINGS version: 5 updated: 2004/07/23 14:40:34
692 dnl ----------------
693 dnl Combine the checks for gcc features into a configure-script option
694 dnl
695 dnl Parameters:
696 dnl     $1 - see CF_GCC_WARNINGS
697 AC_DEFUN([CF_WITH_WARNINGS],
698 [
699 if ( test "$GCC" = yes || test "$GXX" = yes )
700 then
701 AC_MSG_CHECKING(if you want to check for gcc warnings)
702 AC_ARG_WITH(warnings,
703         [  --with-warnings         test: turn on gcc warnings],
704         [cf_opt_with_warnings=$withval],
705         [cf_opt_with_warnings=no])
706 AC_MSG_RESULT($cf_opt_with_warnings)
707 if test "$cf_opt_with_warnings" != no ; then
708         CF_GCC_ATTRIBUTES
709         CF_GCC_WARNINGS([$1])
710 fi
711 fi
712 ])dnl