1dnl $Id: aclocal.m4,v 1.21 2012/01/03 09:37:14 tom Exp $ 2dnl autoconf macros for 'diffstat' 3dnl 4dnl Copyright 2003-2010,2012 Thomas E. Dickey 5dnl 6dnl See also 7dnl http://invisible-island.net/autoconf/ 8dnl 9dnl --------------------------------------------------------------------------- 10dnl --------------------------------------------------------------------------- 11dnl CF_ADD_CFLAGS version: 10 updated: 2010/05/26 05:38:42 12dnl ------------- 13dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS 14dnl The second parameter if given makes this macro verbose. 15dnl 16dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS, 17dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily 18dnl confused by the quotes (which require backslashes to keep them usable). 19AC_DEFUN([CF_ADD_CFLAGS], 20[ 21cf_fix_cppflags=no 22cf_new_cflags= 23cf_new_cppflags= 24cf_new_extra_cppflags= 25 26for cf_add_cflags in $1 27do 28case $cf_fix_cppflags in 29no) 30 case $cf_add_cflags in #(vi 31 -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi 32 case $cf_add_cflags in 33 -D*) 34 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'` 35 36 test "${cf_add_cflags}" != "${cf_tst_cflags}" \ 37 && test -z "${cf_tst_cflags}" \ 38 && cf_fix_cppflags=yes 39 40 if test $cf_fix_cppflags = yes ; then 41 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" 42 continue 43 elif test "${cf_tst_cflags}" = "\"'" ; then 44 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" 45 continue 46 fi 47 ;; 48 esac 49 case "$CPPFLAGS" in 50 *$cf_add_cflags) #(vi 51 ;; 52 *) #(vi 53 case $cf_add_cflags in #(vi 54 -D*) 55 cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` 56 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags) 57 ;; 58 esac 59 cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" 60 ;; 61 esac 62 ;; 63 *) 64 cf_new_cflags="$cf_new_cflags $cf_add_cflags" 65 ;; 66 esac 67 ;; 68yes) 69 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" 70 71 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'` 72 73 test "${cf_add_cflags}" != "${cf_tst_cflags}" \ 74 && test -z "${cf_tst_cflags}" \ 75 && cf_fix_cppflags=no 76 ;; 77esac 78done 79 80if test -n "$cf_new_cflags" ; then 81 ifelse([$2],,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)]) 82 CFLAGS="$CFLAGS $cf_new_cflags" 83fi 84 85if test -n "$cf_new_cppflags" ; then 86 ifelse([$2],,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)]) 87 CPPFLAGS="$CPPFLAGS $cf_new_cppflags" 88fi 89 90if test -n "$cf_new_extra_cppflags" ; then 91 ifelse([$2],,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)]) 92 EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" 93fi 94 95AC_SUBST(EXTRA_CPPFLAGS) 96 97])dnl 98dnl --------------------------------------------------------------------------- 99dnl CF_ANSI_CC_CHECK version: 11 updated: 2011/07/01 19:47:45 100dnl ---------------- 101dnl This was originally adapted from the macros 'fp_PROG_CC_STDC' and 102dnl 'fp_C_PROTOTYPES' in the sharutils 4.2 distribution. 103AC_DEFUN([CF_ANSI_CC_CHECK], 104[ 105# This should have been defined by AC_PROG_CC 106: ${CC:=cc} 107 108# Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content 109# into CC. This will not help with broken scripts that wrap the compiler with 110# options, but eliminates a more common category of user confusion. 111AC_MSG_CHECKING(\$CC variable) 112case "$CC" in #(vi 113*[[\ \ ]]-[[IUD]]*) 114 AC_MSG_RESULT(broken) 115 AC_MSG_WARN(your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options) 116 # humor him... 117 cf_flags=`echo "$CC" | sed -e 's/^[[^ ]]*[[ ]]//'` 118 CC=`echo "$CC" | sed -e 's/[[ ]].*//'` 119 CF_ADD_CFLAGS($cf_flags) 120 ;; 121*) 122 AC_MSG_RESULT(ok) 123 ;; 124esac 125 126AC_CACHE_CHECK(for ${CC:-cc} option to accept ANSI C, cf_cv_ansi_cc,[ 127cf_cv_ansi_cc=no 128cf_save_CFLAGS="$CFLAGS" 129cf_save_CPPFLAGS="$CPPFLAGS" 130# Don't try gcc -ansi; that turns off useful extensions and 131# breaks some systems' header files. 132# AIX -qlanglvl=ansi 133# Ultrix and OSF/1 -std1 134# HP-UX -Aa -D_HPUX_SOURCE 135# SVR4 -Xc 136# UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes) 137for cf_arg in "-DCC_HAS_PROTOS" \ 138 "" \ 139 -qlanglvl=ansi \ 140 -std1 \ 141 -Ae \ 142 "-Aa -D_HPUX_SOURCE" \ 143 -Xc 144do 145 CF_ADD_CFLAGS($cf_arg) 146 AC_TRY_COMPILE( 147[ 148#ifndef CC_HAS_PROTOS 149#if !defined(__STDC__) || (__STDC__ != 1) 150choke me 151#endif 152#endif 153],[ 154 int test (int i, double x); 155 struct s1 {int (*f) (int a);}; 156 struct s2 {int (*f) (double a);};], 157 [cf_cv_ansi_cc="$cf_arg"; break]) 158done 159CFLAGS="$cf_save_CFLAGS" 160CPPFLAGS="$cf_save_CPPFLAGS" 161]) 162 163if test "$cf_cv_ansi_cc" != "no"; then 164if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then 165 CF_ADD_CFLAGS($cf_cv_ansi_cc) 166else 167 AC_DEFINE(CC_HAS_PROTOS) 168fi 169fi 170])dnl 171dnl --------------------------------------------------------------------------- 172dnl CF_ANSI_CC_REQD version: 4 updated: 2008/03/23 14:48:54 173dnl --------------- 174dnl For programs that must use an ANSI compiler, obtain compiler options that 175dnl will make it recognize prototypes. We'll do preprocessor checks in other 176dnl macros, since tools such as unproto can fake prototypes, but only part of 177dnl the preprocessor. 178AC_DEFUN([CF_ANSI_CC_REQD], 179[AC_REQUIRE([CF_ANSI_CC_CHECK]) 180if test "$cf_cv_ansi_cc" = "no"; then 181 AC_MSG_ERROR( 182[Your compiler does not appear to recognize prototypes. 183You have the following choices: 184 a. adjust your compiler options 185 b. get an up-to-date compiler 186 c. use a wrapper such as unproto]) 187fi 188])dnl 189dnl --------------------------------------------------------------------------- 190dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31 191dnl -------------- 192dnl Allow user to disable a normally-on option. 193AC_DEFUN([CF_ARG_DISABLE], 194[CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl 195dnl --------------------------------------------------------------------------- 196dnl CF_ARG_OPTION version: 4 updated: 2010/05/26 05:38:42 197dnl ------------- 198dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus 199dnl values. 200dnl 201dnl Parameters: 202dnl $1 = option name 203dnl $2 = help-string 204dnl $3 = action to perform if option is not default 205dnl $4 = action if perform if option is default 206dnl $5 = default option value (either 'yes' or 'no') 207AC_DEFUN([CF_ARG_OPTION], 208[AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes) 209 if test "$enableval" != "$5" ; then 210ifelse([$3],,[ :]dnl 211,[ $3]) ifelse([$4],,,[ 212 else 213 $4]) 214 fi],[enableval=$5 ifelse([$4],,,[ 215 $4 216])dnl 217 ])])dnl 218dnl --------------------------------------------------------------------------- 219dnl CF_CHECK_CACHE version: 11 updated: 2008/03/23 14:45:59 220dnl -------------- 221dnl Check if we're accidentally using a cache from a different machine. 222dnl Derive the system name, as a check for reusing the autoconf cache. 223dnl 224dnl If we've packaged config.guess and config.sub, run that (since it does a 225dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow 226dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM 227dnl which is useful in cross-compiles. 228dnl 229dnl Note: we would use $ac_config_sub, but that is one of the places where 230dnl autoconf 2.5x broke compatibility with autoconf 2.13 231AC_DEFUN([CF_CHECK_CACHE], 232[ 233if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then 234 ifelse([$1],,[AC_CANONICAL_HOST],[$1]) 235 system_name="$host_os" 236else 237 system_name="`(uname -s -r) 2>/dev/null`" 238 if test -z "$system_name" ; then 239 system_name="`(hostname) 2>/dev/null`" 240 fi 241fi 242test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name") 243AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"]) 244 245test -z "$system_name" && system_name="$cf_cv_system_name" 246test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name) 247 248if test ".$system_name" != ".$cf_cv_system_name" ; then 249 AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)) 250 AC_MSG_ERROR("Please remove config.cache and try again.") 251fi 252])dnl 253dnl --------------------------------------------------------------------------- 254dnl CF_DISABLE_ECHO version: 11 updated: 2009/12/13 13:16:57 255dnl --------------- 256dnl You can always use "make -n" to see the actual options, but it's hard to 257dnl pick out/analyze warning messages when the compile-line is long. 258dnl 259dnl Sets: 260dnl ECHO_LT - symbol to control if libtool is verbose 261dnl ECHO_LD - symbol to prefix "cc -o" lines 262dnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o) 263dnl SHOW_CC - symbol to put before explicit "cc -c" lines 264dnl ECHO_CC - symbol to put before any "cc" line 265dnl 266AC_DEFUN([CF_DISABLE_ECHO],[ 267AC_MSG_CHECKING(if you want to see long compiling messages) 268CF_ARG_DISABLE(echo, 269 [ --disable-echo display "compiling" commands], 270 [ 271 ECHO_LT='--silent' 272 ECHO_LD='@echo linking [$]@;' 273 RULE_CC='@echo compiling [$]<' 274 SHOW_CC='@echo compiling [$]@' 275 ECHO_CC='@' 276],[ 277 ECHO_LT='' 278 ECHO_LD='' 279 RULE_CC='' 280 SHOW_CC='' 281 ECHO_CC='' 282]) 283AC_MSG_RESULT($enableval) 284AC_SUBST(ECHO_LT) 285AC_SUBST(ECHO_LD) 286AC_SUBST(RULE_CC) 287AC_SUBST(SHOW_CC) 288AC_SUBST(ECHO_CC) 289])dnl 290dnl --------------------------------------------------------------------------- 291dnl CF_DISABLE_LEAKS version: 6 updated: 2010/07/23 04:14:32 292dnl ---------------- 293dnl Combine no-leak checks with the libraries or tools that are used for the 294dnl checks. 295AC_DEFUN([CF_DISABLE_LEAKS],[ 296 297AC_REQUIRE([CF_WITH_DMALLOC]) 298AC_REQUIRE([CF_WITH_DBMALLOC]) 299AC_REQUIRE([CF_WITH_VALGRIND]) 300 301AC_MSG_CHECKING(if you want to perform memory-leak testing) 302AC_ARG_ENABLE(leaks, 303 [ --disable-leaks test: free permanent memory, analyze leaks], 304 [if test "x$enableval" = xno; then with_no_leaks=yes; else with_no_leaks=no; fi], 305 : ${with_no_leaks:=no}) 306AC_MSG_RESULT($with_no_leaks) 307 308if test "$with_no_leaks" = yes ; then 309 AC_DEFINE(NO_LEAKS) 310 AC_DEFINE(YY_NO_LEAKS) 311fi 312])dnl 313dnl --------------------------------------------------------------------------- 314dnl CF_GCC_ATTRIBUTES version: 14 updated: 2010/10/23 15:52:32 315dnl ----------------- 316dnl Test for availability of useful gcc __attribute__ directives to quiet 317dnl compiler warnings. Though useful, not all are supported -- and contrary 318dnl to documentation, unrecognized directives cause older compilers to barf. 319AC_DEFUN([CF_GCC_ATTRIBUTES], 320[ 321if test "$GCC" = yes 322then 323cat > conftest.i <<EOF 324#ifndef GCC_PRINTF 325#define GCC_PRINTF 0 326#endif 327#ifndef GCC_SCANF 328#define GCC_SCANF 0 329#endif 330#ifndef GCC_NORETURN 331#define GCC_NORETURN /* nothing */ 332#endif 333#ifndef GCC_UNUSED 334#define GCC_UNUSED /* nothing */ 335#endif 336EOF 337if test "$GCC" = yes 338then 339 AC_CHECKING([for $CC __attribute__ directives]) 340cat > conftest.$ac_ext <<EOF 341#line __oline__ "${as_me:-configure}" 342#include "confdefs.h" 343#include "conftest.h" 344#include "conftest.i" 345#if GCC_PRINTF 346#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) 347#else 348#define GCC_PRINTFLIKE(fmt,var) /*nothing*/ 349#endif 350#if GCC_SCANF 351#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) 352#else 353#define GCC_SCANFLIKE(fmt,var) /*nothing*/ 354#endif 355extern void wow(char *,...) GCC_SCANFLIKE(1,2); 356extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; 357extern void foo(void) GCC_NORETURN; 358int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; } 359EOF 360 cf_printf_attribute=no 361 cf_scanf_attribute=no 362 for cf_attribute in scanf printf unused noreturn 363 do 364 CF_UPPER(cf_ATTRIBUTE,$cf_attribute) 365 cf_directive="__attribute__(($cf_attribute))" 366 echo "checking for $CC $cf_directive" 1>&AC_FD_CC 367 368 case $cf_attribute in #(vi 369 printf) #(vi 370 cf_printf_attribute=yes 371 cat >conftest.h <<EOF 372#define GCC_$cf_ATTRIBUTE 1 373EOF 374 ;; 375 scanf) #(vi 376 cf_scanf_attribute=yes 377 cat >conftest.h <<EOF 378#define GCC_$cf_ATTRIBUTE 1 379EOF 380 ;; 381 *) #(vi 382 cat >conftest.h <<EOF 383#define GCC_$cf_ATTRIBUTE $cf_directive 384EOF 385 ;; 386 esac 387 388 if AC_TRY_EVAL(ac_compile); then 389 test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute) 390 cat conftest.h >>confdefs.h 391 case $cf_attribute in #(vi 392 printf) #(vi 393 if test "$cf_printf_attribute" = no ; then 394 cat >>confdefs.h <<EOF 395#define GCC_PRINTFLIKE(fmt,var) /* nothing */ 396EOF 397 else 398 cat >>confdefs.h <<EOF 399#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) 400EOF 401 fi 402 ;; 403 scanf) #(vi 404 if test "$cf_scanf_attribute" = no ; then 405 cat >>confdefs.h <<EOF 406#define GCC_SCANFLIKE(fmt,var) /* nothing */ 407EOF 408 else 409 cat >>confdefs.h <<EOF 410#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) 411EOF 412 fi 413 ;; 414 esac 415 fi 416 done 417else 418 fgrep define conftest.i >>confdefs.h 419fi 420rm -rf conftest* 421fi 422])dnl 423dnl --------------------------------------------------------------------------- 424dnl CF_GCC_VERSION version: 5 updated: 2010/04/24 11:02:31 425dnl -------------- 426dnl Find version of gcc 427AC_DEFUN([CF_GCC_VERSION],[ 428AC_REQUIRE([AC_PROG_CC]) 429GCC_VERSION=none 430if test "$GCC" = yes ; then 431 AC_MSG_CHECKING(version of $CC) 432 GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`" 433 test -z "$GCC_VERSION" && GCC_VERSION=unknown 434 AC_MSG_RESULT($GCC_VERSION) 435fi 436])dnl 437dnl --------------------------------------------------------------------------- 438dnl CF_GCC_WARNINGS version: 27 updated: 2010/10/23 15:52:32 439dnl --------------- 440dnl Check if the compiler supports useful warning options. There's a few that 441dnl we don't use, simply because they're too noisy: 442dnl 443dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x) 444dnl -Wredundant-decls (system headers make this too noisy) 445dnl -Wtraditional (combines too many unrelated messages, only a few useful) 446dnl -Wwrite-strings (too noisy, but should review occasionally). This 447dnl is enabled for ncurses using "--enable-const". 448dnl -pedantic 449dnl 450dnl Parameter: 451dnl $1 is an optional list of gcc warning flags that a particular 452dnl application might want to use, e.g., "no-unused" for 453dnl -Wno-unused 454dnl Special: 455dnl If $with_ext_const is "yes", add a check for -Wwrite-strings 456dnl 457AC_DEFUN([CF_GCC_WARNINGS], 458[ 459AC_REQUIRE([CF_GCC_VERSION]) 460CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS) 461 462cat > conftest.$ac_ext <<EOF 463#line __oline__ "${as_me:-configure}" 464int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; } 465EOF 466 467if test "$INTEL_COMPILER" = yes 468then 469# The "-wdXXX" options suppress warnings: 470# remark #1419: external declaration in primary source file 471# remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem) 472# remark #1684: conversion from pointer to same-sized integral type (potential portability problem) 473# remark #193: zero used for undefined preprocessing identifier 474# remark #593: variable "curs_sb_left_arrow" was set but never used 475# remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits 476# remark #869: parameter "tw" was never referenced 477# remark #981: operands are evaluated in unspecified order 478# warning #279: controlling expression is constant 479 480 AC_CHECKING([for $CC warning options]) 481 cf_save_CFLAGS="$CFLAGS" 482 EXTRA_CFLAGS="-Wall" 483 for cf_opt in \ 484 wd1419 \ 485 wd1683 \ 486 wd1684 \ 487 wd193 \ 488 wd593 \ 489 wd279 \ 490 wd810 \ 491 wd869 \ 492 wd981 493 do 494 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" 495 if AC_TRY_EVAL(ac_compile); then 496 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt) 497 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" 498 fi 499 done 500 CFLAGS="$cf_save_CFLAGS" 501 502elif test "$GCC" = yes 503then 504 AC_CHECKING([for $CC warning options]) 505 cf_save_CFLAGS="$CFLAGS" 506 EXTRA_CFLAGS= 507 cf_warn_CONST="" 508 test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings" 509 for cf_opt in W Wall \ 510 Wbad-function-cast \ 511 Wcast-align \ 512 Wcast-qual \ 513 Winline \ 514 Wmissing-declarations \ 515 Wmissing-prototypes \ 516 Wnested-externs \ 517 Wpointer-arith \ 518 Wshadow \ 519 Wstrict-prototypes \ 520 Wundef $cf_warn_CONST $1 521 do 522 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" 523 if AC_TRY_EVAL(ac_compile); then 524 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt) 525 case $cf_opt in #(vi 526 Wcast-qual) #(vi 527 CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES" 528 ;; 529 Winline) #(vi 530 case $GCC_VERSION in 531 [[34]].*) 532 CF_VERBOSE(feature is broken in gcc $GCC_VERSION) 533 continue;; 534 esac 535 ;; 536 esac 537 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" 538 fi 539 done 540 CFLAGS="$cf_save_CFLAGS" 541fi 542rm -rf conftest* 543 544AC_SUBST(EXTRA_CFLAGS) 545])dnl 546dnl --------------------------------------------------------------------------- 547dnl CF_GETOPT_HEADER version: 4 updated: 2009/08/31 20:07:52 548dnl ---------------- 549dnl Check for getopt's variables which are commonly defined in stdlib.h, 550dnl unistd.h or (nonstandard) in getopt.h 551AC_DEFUN([CF_GETOPT_HEADER], 552[ 553AC_HAVE_HEADERS(unistd.h getopt.h) 554AC_CACHE_CHECK(for header declaring getopt variables,cf_cv_getopt_header,[ 555cf_cv_getopt_header=none 556for cf_header in stdio.h stdlib.h unistd.h getopt.h 557do 558AC_TRY_COMPILE([ 559#include <$cf_header>], 560[int x = optind; char *y = optarg], 561[cf_cv_getopt_header=$cf_header 562 break]) 563done 564]) 565if test $cf_cv_getopt_header != none ; then 566 AC_DEFINE(HAVE_GETOPT_HEADER) 567fi 568])dnl 569dnl --------------------------------------------------------------------------- 570dnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07 571dnl ------------- 572dnl Check if we must define _GNU_SOURCE to get a reasonable value for 573dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect 574dnl (or misfeature) of glibc2, which breaks portability of many applications, 575dnl since it is interwoven with GNU extensions. 576dnl 577dnl Well, yes we could work around it... 578AC_DEFUN([CF_GNU_SOURCE], 579[ 580AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[ 581AC_TRY_COMPILE([#include <sys/types.h>],[ 582#ifndef _XOPEN_SOURCE 583make an error 584#endif], 585 [cf_cv_gnu_source=no], 586 [cf_save="$CPPFLAGS" 587 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" 588 AC_TRY_COMPILE([#include <sys/types.h>],[ 589#ifdef _XOPEN_SOURCE 590make an error 591#endif], 592 [cf_cv_gnu_source=no], 593 [cf_cv_gnu_source=yes]) 594 CPPFLAGS="$cf_save" 595 ]) 596]) 597test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" 598])dnl 599dnl --------------------------------------------------------------------------- 600dnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07 601dnl ------------- 602dnl Check if we must define _GNU_SOURCE to get a reasonable value for 603dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect 604dnl (or misfeature) of glibc2, which breaks portability of many applications, 605dnl since it is interwoven with GNU extensions. 606dnl 607dnl Well, yes we could work around it... 608AC_DEFUN([CF_GNU_SOURCE], 609[ 610AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[ 611AC_TRY_COMPILE([#include <sys/types.h>],[ 612#ifndef _XOPEN_SOURCE 613make an error 614#endif], 615 [cf_cv_gnu_source=no], 616 [cf_save="$CPPFLAGS" 617 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" 618 AC_TRY_COMPILE([#include <sys/types.h>],[ 619#ifdef _XOPEN_SOURCE 620make an error 621#endif], 622 [cf_cv_gnu_source=no], 623 [cf_cv_gnu_source=yes]) 624 CPPFLAGS="$cf_save" 625 ]) 626]) 627test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" 628])dnl 629dnl --------------------------------------------------------------------------- 630dnl CF_INTEL_COMPILER version: 4 updated: 2010/05/26 05:38:42 631dnl ----------------- 632dnl Check if the given compiler is really the Intel compiler for Linux. It 633dnl tries to imitate gcc, but does not return an error when it finds a mismatch 634dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK. 635dnl 636dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to 637dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from 638dnl the wrappers for gcc and g++ warnings. 639dnl 640dnl $1 = GCC (default) or GXX 641dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS 642dnl $3 = CFLAGS (default) or CXXFLAGS 643AC_DEFUN([CF_INTEL_COMPILER],[ 644ifelse([$2],,INTEL_COMPILER,[$2])=no 645 646if test "$ifelse([$1],,[$1],GCC)" = yes ; then 647 case $host_os in 648 linux*|gnu*) 649 AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler) 650 cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" 651 ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc" 652 AC_TRY_COMPILE([],[ 653#ifdef __INTEL_COMPILER 654#else 655make an error 656#endif 657],[ifelse([$2],,INTEL_COMPILER,[$2])=yes 658cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc" 659],[]) 660 ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" 661 AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2])) 662 ;; 663 esac 664fi 665])dnl 666dnl --------------------------------------------------------------------------- 667dnl CF_MAKE_TAGS version: 6 updated: 2010/10/23 15:52:32 668dnl ------------ 669dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have 670dnl a monocase filesystem. 671AC_DEFUN([CF_MAKE_TAGS],[ 672AC_REQUIRE([CF_MIXEDCASE_FILENAMES]) 673 674AC_CHECK_PROGS(CTAGS, exctags ctags) 675AC_CHECK_PROGS(ETAGS, exetags etags) 676 677AC_CHECK_PROG(MAKE_LOWER_TAGS, ${CTAGS:-ctags}, yes, no) 678 679if test "$cf_cv_mixedcase" = yes ; then 680 AC_CHECK_PROG(MAKE_UPPER_TAGS, ${ETAGS:-etags}, yes, no) 681else 682 MAKE_UPPER_TAGS=no 683fi 684 685if test "$MAKE_UPPER_TAGS" = yes ; then 686 MAKE_UPPER_TAGS= 687else 688 MAKE_UPPER_TAGS="#" 689fi 690 691if test "$MAKE_LOWER_TAGS" = yes ; then 692 MAKE_LOWER_TAGS= 693else 694 MAKE_LOWER_TAGS="#" 695fi 696 697AC_SUBST(CTAGS) 698AC_SUBST(ETAGS) 699 700AC_SUBST(MAKE_UPPER_TAGS) 701AC_SUBST(MAKE_LOWER_TAGS) 702])dnl 703dnl --------------------------------------------------------------------------- 704dnl CF_MIXEDCASE_FILENAMES version: 3 updated: 2003/09/20 17:07:55 705dnl ---------------------- 706dnl Check if the file-system supports mixed-case filenames. If we're able to 707dnl create a lowercase name and see it as uppercase, it doesn't support that. 708AC_DEFUN([CF_MIXEDCASE_FILENAMES], 709[ 710AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[ 711if test "$cross_compiling" = yes ; then 712 case $target_alias in #(vi 713 *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-mingw32*|*-uwin*) #(vi 714 cf_cv_mixedcase=no 715 ;; 716 *) 717 cf_cv_mixedcase=yes 718 ;; 719 esac 720else 721 rm -f conftest CONFTEST 722 echo test >conftest 723 if test -f CONFTEST ; then 724 cf_cv_mixedcase=no 725 else 726 cf_cv_mixedcase=yes 727 fi 728 rm -f conftest CONFTEST 729fi 730]) 731test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES) 732])dnl 733dnl --------------------------------------------------------------------------- 734dnl CF_MSG_LOG version: 5 updated: 2010/10/23 15:52:32 735dnl ---------- 736dnl Write a debug message to config.log, along with the line number in the 737dnl configure script. 738AC_DEFUN([CF_MSG_LOG],[ 739echo "${as_me:-configure}:__oline__: testing $* ..." 1>&AC_FD_CC 740])dnl 741dnl --------------------------------------------------------------------------- 742dnl CF_NO_LEAKS_OPTION version: 4 updated: 2006/12/16 14:24:05 743dnl ------------------ 744dnl see CF_WITH_NO_LEAKS 745AC_DEFUN([CF_NO_LEAKS_OPTION],[ 746AC_MSG_CHECKING(if you want to use $1 for testing) 747AC_ARG_WITH($1, 748 [$2], 749 [AC_DEFINE($3)ifelse([$4],,[ 750 $4 751]) 752 : ${with_cflags:=-g} 753 : ${with_no_leaks:=yes} 754 with_$1=yes], 755 [with_$1=]) 756AC_MSG_RESULT(${with_$1:-no}) 757 758case .$with_cflags in #(vi 759.*-g*) 760 case .$CFLAGS in #(vi 761 .*-g*) #(vi 762 ;; 763 *) 764 CF_ADD_CFLAGS([-g]) 765 ;; 766 esac 767 ;; 768esac 769])dnl 770dnl --------------------------------------------------------------------------- 771dnl CF_PATHSEP version: 5 updated: 2010/05/26 05:38:42 772dnl ---------- 773dnl Provide a value for the $PATH and similar separator 774AC_DEFUN([CF_PATHSEP], 775[ 776 case $cf_cv_system_name in 777 os2*) PATH_SEPARATOR=';' ;; 778 *) PATH_SEPARATOR=':' ;; 779 esac 780ifelse([$1],,,[$1=$PATH_SEPARATOR]) 781 AC_SUBST(PATH_SEPARATOR) 782])dnl 783dnl --------------------------------------------------------------------------- 784dnl CF_PATH_PROG version: 8 updated: 2010/10/23 16:12:25 785dnl ------------ 786dnl Check for a given program, defining corresponding symbol. 787dnl $1 = environment variable, which is suffixed by "_PATH" in the #define. 788dnl $2 = program name to find. 789dnl $3 = optional list of additional program names to test. 790dnl 791dnl If there is more than one token in the result, #define the remaining tokens 792dnl to $1_ARGS. We need this for 'install' in particular. 793dnl 794dnl FIXME: we should allow this to be overridden by environment variables 795dnl 796AC_DEFUN([CF_PATH_PROG],[ 797AC_REQUIRE([CF_PATHSEP]) 798test -z "[$]$1" && $1=$2 799AC_PATH_PROGS($1,[$]$1 $2 $3,[$]$1) 800 801cf_path_prog="" 802cf_path_args="" 803IFS="${IFS:- }"; cf_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR" 804for cf_temp in $ac_cv_path_$1 805do 806 if test -z "$cf_path_prog" ; then 807 if test "$with_full_paths" = yes ; then 808 CF_PATH_SYNTAX(cf_temp,break) 809 cf_path_prog="$cf_temp" 810 else 811 cf_path_prog="`basename $cf_temp`" 812 fi 813 elif test -z "$cf_path_args" ; then 814 cf_path_args="$cf_temp" 815 else 816 cf_path_args="$cf_path_args $cf_temp" 817 fi 818done 819IFS="$cf_save_ifs" 820 821if test -n "$cf_path_prog" ; then 822 CF_MSG_LOG(defining path for ${cf_path_prog}) 823 AC_DEFINE_UNQUOTED($1_PATH,"$cf_path_prog") 824 test -n "$cf_path_args" && AC_DEFINE_UNQUOTED($1_ARGS,"$cf_path_args") 825fi 826])dnl 827dnl --------------------------------------------------------------------------- 828dnl CF_PATH_SYNTAX version: 13 updated: 2010/05/26 05:38:42 829dnl -------------- 830dnl Check the argument to see that it looks like a pathname. Rewrite it if it 831dnl begins with one of the prefix/exec_prefix variables, and then again if the 832dnl result begins with 'NONE'. This is necessary to work around autoconf's 833dnl delayed evaluation of those symbols. 834AC_DEFUN([CF_PATH_SYNTAX],[ 835if test "x$prefix" != xNONE; then 836 cf_path_syntax="$prefix" 837else 838 cf_path_syntax="$ac_default_prefix" 839fi 840 841case ".[$]$1" in #(vi 842.\[$]\(*\)*|.\'*\'*) #(vi 843 ;; 844..|./*|.\\*) #(vi 845 ;; 846.[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX 847 ;; 848.\[$]{*prefix}*) #(vi 849 eval $1="[$]$1" 850 case ".[$]$1" in #(vi 851 .NONE/*) 852 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%` 853 ;; 854 esac 855 ;; #(vi 856.no|.NONE/*) 857 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%` 858 ;; 859*) 860 ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2) 861 ;; 862esac 863])dnl 864dnl --------------------------------------------------------------------------- 865dnl CF_POSIX_C_SOURCE version: 8 updated: 2010/05/26 05:38:42 866dnl ----------------- 867dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed. 868dnl 869dnl POSIX.1-1990 _POSIX_SOURCE 870dnl POSIX.1-1990 and _POSIX_SOURCE and 871dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2 872dnl Bindings Option 873dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L 874dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L 875dnl X/Open 2000 _POSIX_C_SOURCE=200112L 876dnl 877dnl Parameters: 878dnl $1 is the nominal value for _POSIX_C_SOURCE 879AC_DEFUN([CF_POSIX_C_SOURCE], 880[ 881cf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1]) 882 883cf_save_CFLAGS="$CFLAGS" 884cf_save_CPPFLAGS="$CPPFLAGS" 885 886CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE) 887CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE) 888 889AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[ 890 CF_MSG_LOG(if the symbol is already defined go no further) 891 AC_TRY_COMPILE([#include <sys/types.h>],[ 892#ifndef _POSIX_C_SOURCE 893make an error 894#endif], 895 [cf_cv_posix_c_source=no], 896 [cf_want_posix_source=no 897 case .$cf_POSIX_C_SOURCE in #(vi 898 .[[12]]??*) #(vi 899 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" 900 ;; 901 .2) #(vi 902 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" 903 cf_want_posix_source=yes 904 ;; 905 .*) 906 cf_want_posix_source=yes 907 ;; 908 esac 909 if test "$cf_want_posix_source" = yes ; then 910 AC_TRY_COMPILE([#include <sys/types.h>],[ 911#ifdef _POSIX_SOURCE 912make an error 913#endif],[], 914 cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE") 915 fi 916 CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE) 917 CFLAGS="$cf_trim_CFLAGS" 918 CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source" 919 CF_MSG_LOG(if the second compile does not leave our definition intact error) 920 AC_TRY_COMPILE([#include <sys/types.h>],[ 921#ifndef _POSIX_C_SOURCE 922make an error 923#endif],, 924 [cf_cv_posix_c_source=no]) 925 CFLAGS="$cf_save_CFLAGS" 926 CPPFLAGS="$cf_save_CPPFLAGS" 927 ]) 928]) 929 930if test "$cf_cv_posix_c_source" != no ; then 931 CFLAGS="$cf_trim_CFLAGS" 932 CPPFLAGS="$cf_trim_CPPFLAGS" 933 CF_ADD_CFLAGS($cf_cv_posix_c_source) 934fi 935 936])dnl 937dnl --------------------------------------------------------------------------- 938dnl CF_PROG_CC_U_D version: 1 updated: 2005/07/14 16:59:30 939dnl -------------- 940dnl Check if C (preprocessor) -U and -D options are processed in the order 941dnl given rather than by type of option. Some compilers insist on apply all 942dnl of the -U options after all of the -D options. Others allow mixing them, 943dnl and may predefine symbols that conflict with those we define. 944AC_DEFUN([CF_PROG_CC_U_D], 945[ 946AC_CACHE_CHECK(if $CC -U and -D options work together,cf_cv_cc_u_d_options,[ 947 cf_save_CPPFLAGS="$CPPFLAGS" 948 CPPFLAGS="-UU_D_OPTIONS -DU_D_OPTIONS -DD_U_OPTIONS -UD_U_OPTIONS" 949 AC_TRY_COMPILE([],[ 950#ifndef U_D_OPTIONS 951make an undefined-error 952#endif 953#ifdef D_U_OPTIONS 954make a defined-error 955#endif 956 ],[ 957 cf_cv_cc_u_d_options=yes],[ 958 cf_cv_cc_u_d_options=no]) 959 CPPFLAGS="$cf_save_CPPFLAGS" 960]) 961])dnl 962dnl --------------------------------------------------------------------------- 963dnl CF_PROG_EXT version: 10 updated: 2004/01/03 19:28:18 964dnl ----------- 965dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX. 966AC_DEFUN([CF_PROG_EXT], 967[ 968AC_REQUIRE([CF_CHECK_CACHE]) 969case $cf_cv_system_name in 970os2*) 971 CFLAGS="$CFLAGS -Zmt" 972 CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__" 973 CXXFLAGS="$CXXFLAGS -Zmt" 974 # autoconf's macro sets -Zexe and suffix both, which conflict:w 975 LDFLAGS="$LDFLAGS -Zmt -Zcrtdll" 976 ac_cv_exeext=.exe 977 ;; 978esac 979 980AC_EXEEXT 981AC_OBJEXT 982 983PROG_EXT="$EXEEXT" 984AC_SUBST(PROG_EXT) 985test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT") 986])dnl 987dnl --------------------------------------------------------------------------- 988dnl CF_PROG_LINT version: 2 updated: 2009/08/12 04:43:14 989dnl ------------ 990AC_DEFUN([CF_PROG_LINT], 991[ 992AC_CHECK_PROGS(LINT, tdlint lint alint splint lclint) 993AC_SUBST(LINT_OPTS) 994])dnl 995dnl --------------------------------------------------------------------------- 996dnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50 997dnl ---------------- 998dnl Remove all -U and -D options that refer to the given symbol from a list 999dnl of C compiler options. This works around the problem that not all 1000dnl compilers process -U and -D options from left-to-right, so a -U option 1001dnl cannot be used to cancel the effect of a preceding -D option. 1002dnl 1003dnl $1 = target (which could be the same as the source variable) 1004dnl $2 = source (including '$') 1005dnl $3 = symbol to remove 1006define([CF_REMOVE_DEFINE], 1007[ 1008$1=`echo "$2" | \ 1009 sed -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[[ ]]/ /g' \ 1010 -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'` 1011])dnl 1012dnl --------------------------------------------------------------------------- 1013dnl CF_STDIO_UNLOCKED version: 3 updated: 2009/10/06 19:54:39 1014dnl ----------------- 1015dnl The four functions getc_unlocked(), getchar_unlocked(), putc_unlocked(), 1016dnl putchar_unlocked() are in POSIX.1-2001. 1017dnl 1018dnl Test for one or more of the "unlocked" stdio getc/putc functions, and (if 1019dnl the system requires it to declare the prototype) define _REENTRANT 1020dnl 1021dnl $1 = one or more stdio functions to check for existence and prototype. 1022AC_DEFUN([CF_STDIO_UNLOCKED], 1023[ 1024cf_stdio_unlocked=no 1025AC_CHECK_FUNCS(ifelse([$1],,[getc_unlocked putc_unlocked],[$1]), 1026 [cf_stdio_unlocked=$ac_func]) 1027if test "$cf_stdio_unlocked" != no ; then 1028 case "$CPPFLAGS" in #(vi 1029 *-D_REENTRANT*) #(vi 1030 ;; 1031 *) 1032 AC_CACHE_CHECK(if we should define _REENTRANT,cf_cv_stdio_unlocked,[ 1033 AC_TRY_COMPILE([#include <stdio.h>],[ 1034 extern void *$cf_stdio_unlocked(void *); 1035 void *dummy = $cf_stdio_unlocked(0)], 1036 [cf_cv_stdio_unlocked=yes], 1037 [cf_cv_stdio_unlocked=no])]) 1038 if test "$cf_cv_stdio_unlocked" = yes ; then 1039 AC_DEFINE(_REENTRANT) 1040 fi 1041 ;; 1042 esac 1043fi 1044]) 1045dnl --------------------------------------------------------------------------- 1046dnl CF_TRY_XOPEN_SOURCE version: 1 updated: 2011/10/30 17:09:50 1047dnl ------------------- 1048dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we 1049dnl can define it successfully. 1050AC_DEFUN([CF_TRY_XOPEN_SOURCE],[ 1051AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[ 1052 AC_TRY_COMPILE([ 1053#include <stdlib.h> 1054#include <string.h> 1055#include <sys/types.h> 1056],[ 1057#ifndef _XOPEN_SOURCE 1058make an error 1059#endif], 1060 [cf_cv_xopen_source=no], 1061 [cf_save="$CPPFLAGS" 1062 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" 1063 AC_TRY_COMPILE([ 1064#include <stdlib.h> 1065#include <string.h> 1066#include <sys/types.h> 1067],[ 1068#ifdef _XOPEN_SOURCE 1069make an error 1070#endif], 1071 [cf_cv_xopen_source=no], 1072 [cf_cv_xopen_source=$cf_XOPEN_SOURCE]) 1073 CPPFLAGS="$cf_save" 1074 ]) 1075]) 1076 1077if test "$cf_cv_xopen_source" != no ; then 1078 CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE) 1079 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE) 1080 cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" 1081 CF_ADD_CFLAGS($cf_temp_xopen_source) 1082fi 1083]) 1084dnl --------------------------------------------------------------------------- 1085dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59 1086dnl -------- 1087dnl Make an uppercase version of a variable 1088dnl $1=uppercase($2) 1089AC_DEFUN([CF_UPPER], 1090[ 1091$1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` 1092])dnl 1093dnl --------------------------------------------------------------------------- 1094dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12 1095dnl ---------- 1096dnl Use AC_VERBOSE w/o the warnings 1097AC_DEFUN([CF_VERBOSE], 1098[test -n "$verbose" && echo " $1" 1>&AC_FD_MSG 1099CF_MSG_LOG([$1]) 1100])dnl 1101dnl --------------------------------------------------------------------------- 1102dnl CF_WITH_DBMALLOC version: 7 updated: 2010/06/21 17:26:47 1103dnl ---------------- 1104dnl Configure-option for dbmalloc. The optional parameter is used to override 1105dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests. 1106AC_DEFUN([CF_WITH_DBMALLOC],[ 1107CF_NO_LEAKS_OPTION(dbmalloc, 1108 [ --with-dbmalloc test: use Conor Cahill's dbmalloc library], 1109 [USE_DBMALLOC]) 1110 1111if test "$with_dbmalloc" = yes ; then 1112 AC_CHECK_HEADER(dbmalloc.h, 1113 [AC_CHECK_LIB(dbmalloc,[debug_malloc]ifelse([$1],,[],[,$1]))]) 1114fi 1115])dnl 1116dnl --------------------------------------------------------------------------- 1117dnl CF_WITH_DMALLOC version: 7 updated: 2010/06/21 17:26:47 1118dnl --------------- 1119dnl Configure-option for dmalloc. The optional parameter is used to override 1120dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests. 1121AC_DEFUN([CF_WITH_DMALLOC],[ 1122CF_NO_LEAKS_OPTION(dmalloc, 1123 [ --with-dmalloc test: use Gray Watson's dmalloc library], 1124 [USE_DMALLOC]) 1125 1126if test "$with_dmalloc" = yes ; then 1127 AC_CHECK_HEADER(dmalloc.h, 1128 [AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse([$1],,[],[,$1]))]) 1129fi 1130])dnl 1131dnl --------------------------------------------------------------------------- 1132dnl CF_WITH_INSTALL_PREFIX version: 4 updated: 2010/10/23 15:52:32 1133dnl ---------------------- 1134dnl Configure-script option to give a default value for the poorly-chosen name 1135dnl $(DESTDIR). 1136AC_DEFUN([CF_WITH_INSTALL_PREFIX], 1137[ 1138AC_MSG_CHECKING(for install-prefix) 1139AC_ARG_WITH(install-prefix, 1140 [ --with-install-prefix=XXX sets DESTDIR, useful for packaging], 1141 [cf_opt_with_install_prefix=$withval], 1142 [cf_opt_with_install_prefix=${DESTDIR:-no}]) 1143AC_MSG_RESULT($cf_opt_with_install_prefix) 1144if test "$cf_opt_with_install_prefix" != no ; then 1145 CF_PATH_SYNTAX(cf_opt_with_install_prefix) 1146 DESTDIR=$cf_opt_with_install_prefix 1147fi 1148AC_SUBST(DESTDIR) 1149])dnl 1150dnl --------------------------------------------------------------------------- 1151dnl CF_WITH_PURIFY version: 2 updated: 2006/12/14 18:43:43 1152dnl -------------- 1153AC_DEFUN([CF_WITH_PURIFY],[ 1154CF_NO_LEAKS_OPTION(purify, 1155 [ --with-purify test: use Purify], 1156 [USE_PURIFY], 1157 [LINK_PREFIX="$LINK_PREFIX purify"]) 1158AC_SUBST(LINK_PREFIX) 1159])dnl 1160dnl --------------------------------------------------------------------------- 1161dnl CF_WITH_VALGRIND version: 1 updated: 2006/12/14 18:00:21 1162dnl ---------------- 1163AC_DEFUN([CF_WITH_VALGRIND],[ 1164CF_NO_LEAKS_OPTION(valgrind, 1165 [ --with-valgrind test: use valgrind], 1166 [USE_VALGRIND]) 1167])dnl 1168dnl --------------------------------------------------------------------------- 1169dnl CF_WITH_WARNINGS version: 5 updated: 2004/07/23 14:40:34 1170dnl ---------------- 1171dnl Combine the checks for gcc features into a configure-script option 1172dnl 1173dnl Parameters: 1174dnl $1 - see CF_GCC_WARNINGS 1175AC_DEFUN([CF_WITH_WARNINGS], 1176[ 1177if ( test "$GCC" = yes || test "$GXX" = yes ) 1178then 1179AC_MSG_CHECKING(if you want to check for gcc warnings) 1180AC_ARG_WITH(warnings, 1181 [ --with-warnings test: turn on gcc warnings], 1182 [cf_opt_with_warnings=$withval], 1183 [cf_opt_with_warnings=no]) 1184AC_MSG_RESULT($cf_opt_with_warnings) 1185if test "$cf_opt_with_warnings" != no ; then 1186 CF_GCC_ATTRIBUTES 1187 CF_GCC_WARNINGS([$1]) 1188fi 1189fi 1190])dnl 1191dnl --------------------------------------------------------------------------- 1192dnl CF_XOPEN_SOURCE version: 41 updated: 2011/12/10 18:58:47 1193dnl --------------- 1194dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions, 1195dnl or adapt to the vendor's definitions to get equivalent functionality, 1196dnl without losing the common non-POSIX features. 1197dnl 1198dnl Parameters: 1199dnl $1 is the nominal value for _XOPEN_SOURCE 1200dnl $2 is the nominal value for _POSIX_C_SOURCE 1201AC_DEFUN([CF_XOPEN_SOURCE],[ 1202 1203cf_XOPEN_SOURCE=ifelse([$1],,500,[$1]) 1204cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2]) 1205cf_xopen_source= 1206 1207case $host_os in #(vi 1208aix[[4-7]]*) #(vi 1209 cf_xopen_source="-D_ALL_SOURCE" 1210 ;; 1211cygwin) #(vi 1212 cf_XOPEN_SOURCE=600 1213 ;; 1214darwin[[0-8]].*) #(vi 1215 cf_xopen_source="-D_APPLE_C_SOURCE" 1216 ;; 1217darwin*) #(vi 1218 cf_xopen_source="-D_DARWIN_C_SOURCE" 1219 ;; 1220freebsd*|dragonfly*) #(vi 1221 # 5.x headers associate 1222 # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L 1223 # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L 1224 cf_POSIX_C_SOURCE=200112L 1225 cf_XOPEN_SOURCE=600 1226 cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" 1227 ;; 1228hpux11*) #(vi 1229 cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500" 1230 ;; 1231hpux*) #(vi 1232 cf_xopen_source="-D_HPUX_SOURCE" 1233 ;; 1234irix[[56]].*) #(vi 1235 cf_xopen_source="-D_SGI_SOURCE" 1236 cf_XOPEN_SOURCE= 1237 ;; 1238linux*|gnu*|mint*|k*bsd*-gnu) #(vi 1239 CF_GNU_SOURCE 1240 ;; 1241mirbsd*) #(vi 1242 # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <sys/select.h> and other headers which use u_int / u_short types 1243 cf_XOPEN_SOURCE= 1244 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) 1245 ;; 1246netbsd*) #(vi 1247 cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw 1248 ;; 1249openbsd[[4-9]]*) #(vi 1250 # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw 1251 cf_XOPEN_SOURCE=600 1252 ;; 1253openbsd*) #(vi 1254 # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw 1255 ;; 1256osf[[45]]*) #(vi 1257 cf_xopen_source="-D_OSF_SOURCE" 1258 ;; 1259nto-qnx*) #(vi 1260 cf_xopen_source="-D_QNX_SOURCE" 1261 ;; 1262sco*) #(vi 1263 # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer 1264 ;; 1265solaris2.*) #(vi 1266 cf_xopen_source="-D__EXTENSIONS__" 1267 ;; 1268*) 1269 CF_TRY_XOPEN_SOURCE 1270 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) 1271 ;; 1272esac 1273 1274if test -n "$cf_xopen_source" ; then 1275 CF_ADD_CFLAGS($cf_xopen_source) 1276fi 1277 1278dnl In anything but the default case, we may have system-specific setting 1279dnl which is still not guaranteed to provide all of the entrypoints that 1280dnl _XOPEN_SOURCE would yield. 1281if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then 1282 AC_MSG_CHECKING(if _XOPEN_SOURCE really is set) 1283 AC_TRY_COMPILE([#include <stdlib.h>],[ 1284#ifndef _XOPEN_SOURCE 1285make an error 1286#endif], 1287 [cf_XOPEN_SOURCE_set=yes], 1288 [cf_XOPEN_SOURCE_set=no]) 1289 AC_MSG_RESULT($cf_XOPEN_SOURCE_set) 1290 if test $cf_XOPEN_SOURCE_set = yes 1291 then 1292 AC_TRY_COMPILE([#include <stdlib.h>],[ 1293#if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE 1294make an error 1295#endif], 1296 [cf_XOPEN_SOURCE_set_ok=yes], 1297 [cf_XOPEN_SOURCE_set_ok=no]) 1298 if test $cf_XOPEN_SOURCE_set_ok = no 1299 then 1300 AC_MSG_WARN(_XOPEN_SOURCE is lower than requested) 1301 fi 1302 else 1303 CF_TRY_XOPEN_SOURCE 1304 fi 1305fi 1306]) 1307