1dnl macros used for DIALOG configure script 2dnl $Id: aclocal.m4,v 1.80 2011/01/18 23:17:01 tom Exp $ 3dnl --------------------------------------------------------------------------- 4dnl Copyright 1999-2010,2011 -- Thomas E. Dickey 5dnl 6dnl Permission is hereby granted, free of charge, to any person obtaining a 7dnl copy of this software and associated documentation files (the 8dnl "Software"), to deal in the Software without restriction, including 9dnl without limitation the rights to use, copy, modify, merge, publish, 10dnl distribute, distribute with modifications, sublicense, and/or sell 11dnl copies of the Software, and to permit persons to whom the Software is 12dnl furnished to do so, subject to the following conditions: 13dnl 14dnl The above copyright notice and this permission notice shall be included 15dnl in all copies or portions of the Software. 16dnl 17dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 18dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20dnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 21dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 22dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR 23dnl THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24dnl 25dnl Except as contained in this notice, the name(s) of the above copyright 26dnl holders shall not be used in advertising or otherwise to promote the 27dnl sale, use or other dealings in this Software without prior written 28dnl authorization. 29dnl 30dnl see 31dnl http://invisible-island.net/autoconf/ 32dnl --------------------------------------------------------------------------- 33dnl --------------------------------------------------------------------------- 34dnl AM_GNU_GETTEXT version: 12 updated: 2010/06/19 07:02:11 35dnl -------------- 36dnl Usage: Just like AM_WITH_NLS, which see. 37AC_DEFUN([AM_GNU_GETTEXT], 38 [AC_REQUIRE([AC_PROG_MAKE_SET])dnl 39 AC_REQUIRE([AC_PROG_CC])dnl 40 AC_REQUIRE([AC_CANONICAL_HOST])dnl 41 AC_REQUIRE([AC_PROG_RANLIB])dnl 42 AC_REQUIRE([AC_ISC_POSIX])dnl 43 AC_REQUIRE([AC_HEADER_STDC])dnl 44 AC_REQUIRE([AC_C_CONST])dnl 45 AC_REQUIRE([AC_C_INLINE])dnl 46 AC_REQUIRE([AC_TYPE_OFF_T])dnl 47 AC_REQUIRE([AC_TYPE_SIZE_T])dnl 48 AC_REQUIRE([AC_FUNC_ALLOCA])dnl 49 AC_REQUIRE([AC_FUNC_MMAP])dnl 50 AC_REQUIRE([jm_GLIBC21])dnl 51 52 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ 53stdlib.h string.h unistd.h sys/param.h]) 54 AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \ 55getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \ 56strdup strtoul tsearch __argz_count __argz_stringify __argz_next]) 57 58 AM_ICONV 59 AM_LANGINFO_CODESET 60 AM_LC_MESSAGES 61 AM_WITH_NLS([$1],[$2],[$3],[$4]) 62 63 if test "x$CATOBJEXT" != "x"; then 64 if test "x$ALL_LINGUAS" = "x"; then 65 LINGUAS= 66 else 67 AC_MSG_CHECKING(for catalogs to be installed) 68 NEW_LINGUAS= 69 for presentlang in $ALL_LINGUAS; do 70 useit=no 71 for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do 72 # Use the presentlang catalog if desiredlang is 73 # a. equal to presentlang, or 74 # b. a variant of presentlang (because in this case, 75 # presentlang can be used as a fallback for messages 76 # which are not translated in the desiredlang catalog). 77 case "$desiredlang" in 78 "$presentlang"*) useit=yes;; 79 esac 80 done 81 if test $useit = yes; then 82 NEW_LINGUAS="$NEW_LINGUAS $presentlang" 83 fi 84 done 85 LINGUAS=$NEW_LINGUAS 86 AC_MSG_RESULT($LINGUAS) 87 fi 88 89 dnl Construct list of names of catalog files to be constructed. 90 if test -n "$LINGUAS"; then 91 for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done 92 fi 93 fi 94 95 dnl Enable libtool support if the surrounding package wishes it. 96 INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], []) 97 AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) 98])dnl 99dnl --------------------------------------------------------------------------- 100dnl AM_ICONV version: 12 updated: 2007/07/30 19:12:03 101dnl -------- 102dnl Inserted as requested by gettext 0.10.40 103dnl File from /usr/share/aclocal 104dnl iconv.m4 105dnl ==================== 106dnl serial AM2 107dnl 108dnl From Bruno Haible. 109dnl 110dnl ==================== 111dnl Modified to use CF_FIND_LINKAGE and CF_ADD_SEARCHPATH, to broaden the 112dnl range of locations searched. Retain the same cache-variable naming to 113dnl allow reuse with the other gettext macros -Thomas E Dickey 114AC_DEFUN([AM_ICONV], 115[ 116 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and 117 dnl those with the standalone portable GNU libiconv installed). 118 119 AC_ARG_WITH([libiconv-prefix], 120[ --with-libiconv-prefix=DIR 121 search for libiconv in DIR/include and DIR/lib], [ 122 CF_ADD_OPTIONAL_PATH($withval, libiconv) 123 ]) 124 125 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ 126 CF_FIND_LINKAGE(CF__ICONV_HEAD, 127 CF__ICONV_BODY, 128 iconv, 129 am_cv_func_iconv=yes, 130 am_cv_func_iconv=["no, consider installing GNU libiconv"])]) 131 132 if test "$am_cv_func_iconv" = yes; then 133 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) 134 135 AC_CACHE_CHECK([if the declaration of iconv() needs const.], 136 am_cv_proto_iconv_const,[ 137 AC_TRY_COMPILE(CF__ICONV_HEAD [ 138extern 139#ifdef __cplusplus 140"C" 141#endif 142#if defined(__STDC__) || defined(__cplusplus) 143size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); 144#else 145size_t iconv(); 146#endif 147],[], am_cv_proto_iconv_const=no, 148 am_cv_proto_iconv_const=yes)]) 149 150 if test "$am_cv_proto_iconv_const" = yes ; then 151 am_cv_proto_iconv_arg1="const" 152 else 153 am_cv_proto_iconv_arg1="" 154 fi 155 156 AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, 157 [Define as const if the declaration of iconv() needs const.]) 158 fi 159 160 LIBICONV= 161 if test "$cf_cv_find_linkage_iconv" = yes; then 162 CF_ADD_INCDIR($cf_cv_header_path_iconv) 163 if test -n "$cf_cv_library_file_iconv" ; then 164 LIBICONV="-liconv" 165 CF_ADD_LIBDIR($cf_cv_library_path_iconv) 166 fi 167 fi 168 169 AC_SUBST(LIBICONV) 170])dnl 171dnl --------------------------------------------------------------------------- 172dnl AM_LANGINFO_CODESET version: 3 updated: 2002/10/27 23:21:42 173dnl ------------------- 174dnl Inserted as requested by gettext 0.10.40 175dnl File from /usr/share/aclocal 176dnl codeset.m4 177dnl ==================== 178dnl serial AM1 179dnl 180dnl From Bruno Haible. 181AC_DEFUN([AM_LANGINFO_CODESET], 182[ 183 AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, 184 [AC_TRY_LINK([#include <langinfo.h>], 185 [char* cs = nl_langinfo(CODESET);], 186 am_cv_langinfo_codeset=yes, 187 am_cv_langinfo_codeset=no) 188 ]) 189 if test $am_cv_langinfo_codeset = yes; then 190 AC_DEFINE(HAVE_LANGINFO_CODESET, 1, 191 [Define if you have <langinfo.h> and nl_langinfo(CODESET).]) 192 fi 193])dnl 194dnl --------------------------------------------------------------------------- 195dnl AM_LC_MESSAGES version: 4 updated: 2002/10/27 23:21:42 196dnl -------------- 197dnl Inserted as requested by gettext 0.10.40 198dnl File from /usr/share/aclocal 199dnl lcmessage.m4 200dnl ==================== 201dnl Check whether LC_MESSAGES is available in <locale.h>. 202dnl Ulrich Drepper <drepper@cygnus.com>, 1995. 203dnl 204dnl This file can be copied and used freely without restrictions. It can 205dnl be used in projects which are not available under the GNU General Public 206dnl License or the GNU Library General Public License but which still want 207dnl to provide support for the GNU gettext functionality. 208dnl Please note that the actual code of the GNU gettext library is covered 209dnl by the GNU Library General Public License, and the rest of the GNU 210dnl gettext package package is covered by the GNU General Public License. 211dnl They are *not* in the public domain. 212dnl 213dnl serial 2 214dnl 215AC_DEFUN([AM_LC_MESSAGES], 216 [if test $ac_cv_header_locale_h = yes; then 217 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, 218 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES], 219 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) 220 if test $am_cv_val_LC_MESSAGES = yes; then 221 AC_DEFINE(HAVE_LC_MESSAGES, 1, 222 [Define if your <locale.h> file defines LC_MESSAGES.]) 223 fi 224 fi])dnl 225dnl --------------------------------------------------------------------------- 226dnl AM_PATH_PROG_WITH_TEST version: 8 updated: 2009/01/11 20:31:12 227dnl ---------------------- 228dnl Inserted as requested by gettext 0.10.40 229dnl File from /usr/share/aclocal 230dnl progtest.m4 231dnl ==================== 232dnl Search path for a program which passes the given test. 233dnl Ulrich Drepper <drepper@cygnus.com>, 1996. 234dnl 235dnl This file can be copied and used freely without restrictions. It can 236dnl be used in projects which are not available under the GNU General Public 237dnl License or the GNU Library General Public License but which still want 238dnl to provide support for the GNU gettext functionality. 239dnl Please note that the actual code of the GNU gettext library is covered 240dnl by the GNU Library General Public License, and the rest of the GNU 241dnl gettext package package is covered by the GNU General Public License. 242dnl They are *not* in the public domain. 243dnl 244dnl serial 2 245dnl 246dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, 247dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) 248AC_DEFUN([AM_PATH_PROG_WITH_TEST], 249[# Extract the first word of "$2", so it can be a program name with args. 250AC_REQUIRE([CF_PATHSEP]) 251set dummy $2; ac_word=[$]2 252AC_MSG_CHECKING([for $ac_word]) 253AC_CACHE_VAL(ac_cv_path_$1, 254[case "[$]$1" in 255 [[\\/]*|?:[\\/]]*) 256 ac_cv_path_$1="[$]$1" # Let the user override the test with a path. 257 ;; 258 *) 259 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" 260 for ac_dir in ifelse([$5], , $PATH, [$5]); do 261 test -z "$ac_dir" && ac_dir=. 262 if test -f $ac_dir/$ac_word$ac_exeext; then 263 if [$3]; then 264 ac_cv_path_$1="$ac_dir/$ac_word$ac_exeext" 265 break 266 fi 267 fi 268 done 269 IFS="$ac_save_ifs" 270dnl If no 4th arg is given, leave the cache variable unset, 271dnl so AC_PATH_PROGS will keep looking. 272ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" 273])dnl 274 ;; 275esac])dnl 276$1="$ac_cv_path_$1" 277if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then 278 AC_MSG_RESULT([$]$1) 279else 280 AC_MSG_RESULT(no) 281fi 282AC_SUBST($1)dnl 283])dnl 284dnl --------------------------------------------------------------------------- 285dnl AM_WITH_NLS version: 24 updated: 2010/06/20 09:24:28 286dnl ----------- 287dnl Inserted as requested by gettext 0.10.40 288dnl File from /usr/share/aclocal 289dnl gettext.m4 290dnl ==================== 291dnl Macro to add for using GNU gettext. 292dnl Ulrich Drepper <drepper@cygnus.com>, 1995. 293dnl ==================== 294dnl Modified to use CF_FIND_LINKAGE and CF_ADD_SEARCHPATH, to broaden the 295dnl range of locations searched. Retain the same cache-variable naming to 296dnl allow reuse with the other gettext macros -Thomas E Dickey 297dnl ==================== 298dnl 299dnl This file can be copied and used freely without restrictions. It can 300dnl be used in projects which are not available under the GNU General Public 301dnl License or the GNU Library General Public License but which still want 302dnl to provide support for the GNU gettext functionality. 303dnl Please note that the actual code of the GNU gettext library is covered 304dnl by the GNU Library General Public License, and the rest of the GNU 305dnl gettext package package is covered by the GNU General Public License. 306dnl They are *not* in the public domain. 307dnl 308dnl serial 10 309dnl 310dnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR], [ENABLED]). 311dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library 312dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static, 313dnl depending on --{enable,disable}-{shared,static} and on the presence of 314dnl AM-DISABLE-SHARED). Otherwise, a static library 315dnl $(top_builddir)/intl/libintl.a will be created. 316dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext 317dnl implementations (in libc or libintl) without the ngettext() function 318dnl will be ignored. 319dnl LIBDIR is used to find the intl libraries. If empty, 320dnl the value `$(top_builddir)/intl/' is used. 321dnl ENABLED is used to control the default for the related --enable-nls, since 322dnl not all application developers want this feature by default, e.g., lynx. 323dnl 324dnl The result of the configuration is one of three cases: 325dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled 326dnl and used. 327dnl Catalog format: GNU --> install in $(datadir) 328dnl Catalog extension: .mo after installation, .gmo in source tree 329dnl 2) GNU gettext has been found in the system's C library. 330dnl Catalog format: GNU --> install in $(datadir) 331dnl Catalog extension: .mo after installation, .gmo in source tree 332dnl 3) No internationalization, always use English msgid. 333dnl Catalog format: none 334dnl Catalog extension: none 335dnl The use of .gmo is historical (it was needed to avoid overwriting the 336dnl GNU format catalogs when building on a platform with an X/Open gettext), 337dnl but we keep it in order not to force irrelevant filename changes on the 338dnl maintainers. 339dnl 340AC_DEFUN([AM_WITH_NLS], 341[AC_MSG_CHECKING([whether NLS is requested]) 342 dnl Default is enabled NLS 343 ifelse([$4],,[ 344 AC_ARG_ENABLE(nls, 345 [ --disable-nls do not use Native Language Support], 346 USE_NLS=$enableval, USE_NLS=yes)],[ 347 AC_ARG_ENABLE(nls, 348 [ --enable-nls use Native Language Support], 349 USE_NLS=$enableval, USE_NLS=no)]) 350 AC_MSG_RESULT($USE_NLS) 351 AC_SUBST(USE_NLS) 352 353 BUILD_INCLUDED_LIBINTL=no 354 USE_INCLUDED_LIBINTL=no 355 INTLLIBS= 356 357 dnl If we use NLS figure out what method 358 if test "$USE_NLS" = "yes"; then 359 AC_DEFINE(ENABLE_NLS, 1, 360 [Define to 1 if translation of program messages to the user's native language 361 is requested.]) 362 AC_MSG_CHECKING([whether included gettext is requested]) 363 AC_ARG_WITH(included-gettext, 364 [ --with-included-gettext use the GNU gettext library included here], 365 nls_cv_force_use_gnu_gettext=$withval, 366 nls_cv_force_use_gnu_gettext=no) 367 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) 368 369 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" 370 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then 371 dnl User does not insist on using GNU NLS library. Figure out what 372 dnl to use. If GNU gettext is available we use this. Else we have 373 dnl to fall back to GNU NLS library. 374 CATOBJEXT=NONE 375 376 cf_save_LIBS_1="$LIBS" 377 CF_ADD_LIBS($LIBICONV) 378 AC_CACHE_CHECK([for libintl.h and gettext()], cf_cv_func_gettext,[ 379 CF_FIND_LINKAGE(CF__INTL_HEAD, 380 CF__INTL_BODY, 381 intl, 382 cf_cv_func_gettext=yes, 383 cf_cv_func_gettext=no) 384 ]) 385 LIBS="$cf_save_LIBS_1" 386 387 if test "$cf_cv_func_gettext" = yes ; then 388 AC_DEFINE(HAVE_LIBINTL_H) 389 390 dnl If an already present or preinstalled GNU gettext() is found, 391 dnl use it. But if this macro is used in GNU gettext, and GNU 392 dnl gettext is already preinstalled in libintl, we update this 393 dnl libintl. (Cf. the install rule in intl/Makefile.in.) 394 if test "$PACKAGE" != gettext; then 395 AC_DEFINE(HAVE_GETTEXT, 1, 396 [Define if the GNU gettext() function is already present or preinstalled.]) 397 398 CF_ADD_INCDIR($cf_cv_header_path_intl) 399 400 if test -n "$cf_cv_library_file_intl" ; then 401 dnl If iconv() is in a separate libiconv library, then anyone 402 dnl linking with libintl{.a,.so} also needs to link with 403 dnl libiconv. 404 INTLLIBS="$cf_cv_library_file_intl $LIBICONV" 405 CF_ADD_LIBDIR($cf_cv_library_path_intl,INTLLIBS) 406 fi 407 408 gt_save_LIBS="$LIBS" 409 LIBS="$LIBS $INTLLIBS" 410 AC_CHECK_FUNCS(dcgettext) 411 LIBS="$gt_save_LIBS" 412 413 dnl Search for GNU msgfmt in the PATH. 414 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, 415 [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :) 416 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) 417 418 dnl Search for GNU xgettext in the PATH. 419 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, 420 [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :) 421 422 CATOBJEXT=.gmo 423 fi 424 fi 425 426 if test "$CATOBJEXT" = "NONE"; then 427 dnl GNU gettext is not found in the C library. 428 dnl Fall back on GNU gettext library. 429 nls_cv_use_gnu_gettext=yes 430 fi 431 fi 432 433 if test "$nls_cv_use_gnu_gettext" = "yes"; then 434 if test ! -d $srcdir/intl ; then 435 AC_MSG_ERROR(no NLS library is packaged with this application) 436 fi 437 dnl Mark actions used to generate GNU NLS library. 438 INTLOBJS="\$(GETTOBJS)" 439 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, 440 [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :) 441 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) 442 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, 443 [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :) 444 AC_SUBST(MSGFMT) 445 BUILD_INCLUDED_LIBINTL=yes 446 USE_INCLUDED_LIBINTL=yes 447 CATOBJEXT=.gmo 448 INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV" 449 LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` 450 fi 451 452 dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. 453 dnl Test whether we really found GNU msgfmt. 454 if test "$GMSGFMT" != ":"; then 455 dnl If it is no GNU msgfmt we define it as : so that the 456 dnl Makefiles still can work. 457 if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then 458 : ; 459 else 460 AC_MSG_RESULT( 461 [found msgfmt program is not GNU msgfmt; ignore it]) 462 GMSGFMT=":" 463 fi 464 fi 465 466 dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. 467 dnl Test whether we really found GNU xgettext. 468 if test "$XGETTEXT" != ":"; then 469 dnl If it is no GNU xgettext we define it as : so that the 470 dnl Makefiles still can work. 471 if $XGETTEXT --omit-header /dev/null >/dev/null 2>&1; then 472 : ; 473 else 474 AC_MSG_RESULT( 475 [found xgettext program is not GNU xgettext; ignore it]) 476 XGETTEXT=":" 477 fi 478 fi 479 480 dnl We need to process the po/ directory. 481 POSUB=po 482 fi 483 484 AC_OUTPUT_COMMANDS( 485 [for ac_file in $CONFIG_FILES; do 486 487 # Support "outfile[:infile[:infile...]]" 488 case "$ac_file" in 489 *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; 490 esac 491 492 # PO directories have a Makefile.in generated from Makefile.inn. 493 case "$ac_file" in */[Mm]akefile.in) 494 # Adjust a relative srcdir. 495 ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` 496 ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" 497 ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` 498 ac_base=`basename $ac_file .in` 499 # In autoconf-2.13 it is called $ac_given_srcdir. 500 # In autoconf-2.50 it is called $srcdir. 501 test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" 502 503 case "$ac_given_srcdir" in 504 .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; 505 /*) top_srcdir="$ac_given_srcdir" ;; 506 *) top_srcdir="$ac_dots$ac_given_srcdir" ;; 507 esac 508 509 if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then 510 rm -f "$ac_dir/POTFILES" 511 test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" 512 sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES" 513 test -n "$as_me" && echo "$as_me: creating $ac_dir/$ac_base" || echo "creating $ac_dir/$ac_base" 514 sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/$ac_base.in" > "$ac_dir/$ac_base" 515 fi 516 ;; 517 esac 518 done]) 519 520 dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL 521 dnl to 'yes' because some of the testsuite requires it. 522 if test "$PACKAGE" = gettext; then 523 BUILD_INCLUDED_LIBINTL=yes 524 fi 525 526 dnl intl/plural.c is generated from intl/plural.y. It requires bison, 527 dnl because plural.y uses bison specific features. It requires at least 528 dnl bison-1.26 because earlier versions generate a plural.c that doesn't 529 dnl compile. 530 dnl bison is only needed for the maintainer (who touches plural.y). But in 531 dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put 532 dnl the rule in general Makefile. Now, some people carelessly touch the 533 dnl files or have a broken "make" program, hence the plural.c rule will 534 dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not 535 dnl present or too old. 536 if test "$nls_cv_use_gnu_gettext" = "yes"; then 537 AC_CHECK_PROGS([INTLBISON], [bison]) 538 if test -z "$INTLBISON"; then 539 ac_verc_fail=yes 540 else 541 dnl Found it, now check the version. 542 AC_MSG_CHECKING([version of bison]) 543changequote(<<,>>)dnl 544 ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` 545 case $ac_prog_version in 546 '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; 547 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) 548changequote([,])dnl 549 ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; 550 *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; 551 esac 552 AC_MSG_RESULT([$ac_prog_version]) 553 fi 554 if test $ac_verc_fail = yes; then 555 INTLBISON=: 556 fi 557 fi 558 559 dnl These rules are solely for the distribution goal. While doing this 560 dnl we only have to keep exactly one list of the available catalogs 561 dnl in configure.in. 562 for lang in $ALL_LINGUAS; do 563 GMOFILES="$GMOFILES $lang.gmo" 564 POFILES="$POFILES $lang.po" 565 done 566 567 dnl Make all variables we use known to autoconf. 568 AC_SUBST(BUILD_INCLUDED_LIBINTL) 569 AC_SUBST(USE_INCLUDED_LIBINTL) 570 AC_SUBST(CATALOGS) 571 AC_SUBST(CATOBJEXT) 572 AC_SUBST(GMOFILES) 573 AC_SUBST(INTLLIBS) 574 AC_SUBST(INTLOBJS) 575 AC_SUBST(POFILES) 576 AC_SUBST(POSUB) 577 578 dnl For backward compatibility. Some configure.ins may be using this. 579 nls_cv_header_intl= 580 nls_cv_header_libgt= 581 582 dnl For backward compatibility. Some Makefiles may be using this. 583 DATADIRNAME=share 584 AC_SUBST(DATADIRNAME) 585 586 dnl For backward compatibility. Some Makefiles may be using this. 587 INSTOBJEXT=.mo 588 AC_SUBST(INSTOBJEXT) 589 590 dnl For backward compatibility. Some Makefiles may be using this. 591 GENCAT=gencat 592 AC_SUBST(GENCAT) 593])dnl 594dnl --------------------------------------------------------------------------- 595dnl CF_AC_PREREQ version: 2 updated: 1997/09/06 13:24:56 596dnl ------------ 597dnl Conditionally generate script according to whether we're using the release 598dnl version of autoconf, or a patched version (using the ternary component as 599dnl the patch-version). 600define(CF_AC_PREREQ, 601[CF_PREREQ_COMPARE( 602AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), 603AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])), [$1], [$2], [$3])])dnl 604dnl --------------------------------------------------------------------------- 605dnl CF_ADD_CFLAGS version: 10 updated: 2010/05/26 05:38:42 606dnl ------------- 607dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS 608dnl The second parameter if given makes this macro verbose. 609dnl 610dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS, 611dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily 612dnl confused by the quotes (which require backslashes to keep them usable). 613AC_DEFUN([CF_ADD_CFLAGS], 614[ 615cf_fix_cppflags=no 616cf_new_cflags= 617cf_new_cppflags= 618cf_new_extra_cppflags= 619 620for cf_add_cflags in $1 621do 622case $cf_fix_cppflags in 623no) 624 case $cf_add_cflags in #(vi 625 -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi 626 case $cf_add_cflags in 627 -D*) 628 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'` 629 630 test "${cf_add_cflags}" != "${cf_tst_cflags}" \ 631 && test -z "${cf_tst_cflags}" \ 632 && cf_fix_cppflags=yes 633 634 if test $cf_fix_cppflags = yes ; then 635 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" 636 continue 637 elif test "${cf_tst_cflags}" = "\"'" ; then 638 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" 639 continue 640 fi 641 ;; 642 esac 643 case "$CPPFLAGS" in 644 *$cf_add_cflags) #(vi 645 ;; 646 *) #(vi 647 case $cf_add_cflags in #(vi 648 -D*) 649 cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` 650 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags) 651 ;; 652 esac 653 cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" 654 ;; 655 esac 656 ;; 657 *) 658 cf_new_cflags="$cf_new_cflags $cf_add_cflags" 659 ;; 660 esac 661 ;; 662yes) 663 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" 664 665 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'` 666 667 test "${cf_add_cflags}" != "${cf_tst_cflags}" \ 668 && test -z "${cf_tst_cflags}" \ 669 && cf_fix_cppflags=no 670 ;; 671esac 672done 673 674if test -n "$cf_new_cflags" ; then 675 ifelse([$2],,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)]) 676 CFLAGS="$CFLAGS $cf_new_cflags" 677fi 678 679if test -n "$cf_new_cppflags" ; then 680 ifelse([$2],,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)]) 681 CPPFLAGS="$CPPFLAGS $cf_new_cppflags" 682fi 683 684if test -n "$cf_new_extra_cppflags" ; then 685 ifelse([$2],,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)]) 686 EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" 687fi 688 689AC_SUBST(EXTRA_CPPFLAGS) 690 691])dnl 692dnl --------------------------------------------------------------------------- 693dnl CF_ADD_INCDIR version: 13 updated: 2010/05/26 16:44:57 694dnl ------------- 695dnl Add an include-directory to $CPPFLAGS. Don't add /usr/include, since it's 696dnl redundant. We don't normally need to add -I/usr/local/include for gcc, 697dnl but old versions (and some misinstalled ones) need that. To make things 698dnl worse, gcc 3.x may give error messages if -I/usr/local/include is added to 699dnl the include-path). 700AC_DEFUN([CF_ADD_INCDIR], 701[ 702if test -n "$1" ; then 703 for cf_add_incdir in $1 704 do 705 while test $cf_add_incdir != /usr/include 706 do 707 if test -d $cf_add_incdir 708 then 709 cf_have_incdir=no 710 if test -n "$CFLAGS$CPPFLAGS" ; then 711 # a loop is needed to ensure we can add subdirs of existing dirs 712 for cf_test_incdir in $CFLAGS $CPPFLAGS ; do 713 if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then 714 cf_have_incdir=yes; break 715 fi 716 done 717 fi 718 719 if test "$cf_have_incdir" = no ; then 720 if test "$cf_add_incdir" = /usr/local/include ; then 721 if test "$GCC" = yes 722 then 723 cf_save_CPPFLAGS=$CPPFLAGS 724 CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" 725 AC_TRY_COMPILE([#include <stdio.h>], 726 [printf("Hello")], 727 [], 728 [cf_have_incdir=yes]) 729 CPPFLAGS=$cf_save_CPPFLAGS 730 fi 731 fi 732 fi 733 734 if test "$cf_have_incdir" = no ; then 735 CF_VERBOSE(adding $cf_add_incdir to include-path) 736 ifelse([$2],,CPPFLAGS,[$2])="$ifelse([$2],,CPPFLAGS,[$2]) -I$cf_add_incdir" 737 738 cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` 739 test "$cf_top_incdir" = "$cf_add_incdir" && break 740 cf_add_incdir="$cf_top_incdir" 741 else 742 break 743 fi 744 fi 745 done 746 done 747fi 748])dnl 749dnl --------------------------------------------------------------------------- 750dnl CF_ADD_LIB version: 2 updated: 2010/06/02 05:03:05 751dnl ---------- 752dnl Add a library, used to enforce consistency. 753dnl 754dnl $1 = library to add, without the "-l" 755dnl $2 = variable to update (default $LIBS) 756AC_DEFUN([CF_ADD_LIB],[CF_ADD_LIBS(-l$1,ifelse($2,,LIBS,[$2]))])dnl 757dnl --------------------------------------------------------------------------- 758dnl CF_ADD_LIBDIR version: 9 updated: 2010/05/26 16:44:57 759dnl ------------- 760dnl Adds to the library-path 761dnl 762dnl Some machines have trouble with multiple -L options. 763dnl 764dnl $1 is the (list of) directory(s) to add 765dnl $2 is the optional name of the variable to update (default LDFLAGS) 766dnl 767AC_DEFUN([CF_ADD_LIBDIR], 768[ 769if test -n "$1" ; then 770 for cf_add_libdir in $1 771 do 772 if test $cf_add_libdir = /usr/lib ; then 773 : 774 elif test -d $cf_add_libdir 775 then 776 cf_have_libdir=no 777 if test -n "$LDFLAGS$LIBS" ; then 778 # a loop is needed to ensure we can add subdirs of existing dirs 779 for cf_test_libdir in $LDFLAGS $LIBS ; do 780 if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then 781 cf_have_libdir=yes; break 782 fi 783 done 784 fi 785 if test "$cf_have_libdir" = no ; then 786 CF_VERBOSE(adding $cf_add_libdir to library-path) 787 ifelse([$2],,LDFLAGS,[$2])="-L$cf_add_libdir $ifelse([$2],,LDFLAGS,[$2])" 788 fi 789 fi 790 done 791fi 792])dnl 793dnl --------------------------------------------------------------------------- 794dnl CF_ADD_LIBS version: 1 updated: 2010/06/02 05:03:05 795dnl ----------- 796dnl Add one or more libraries, used to enforce consistency. 797dnl 798dnl $1 = libraries to add, with the "-l", etc. 799dnl $2 = variable to update (default $LIBS) 800AC_DEFUN([CF_ADD_LIBS],[ifelse($2,,LIBS,[$2])="$1 [$]ifelse($2,,LIBS,[$2])"])dnl 801dnl --------------------------------------------------------------------------- 802dnl CF_ADD_OPTIONAL_PATH version: 1 updated: 2007/07/29 12:33:33 803dnl -------------------- 804dnl Add an optional search-path to the compile/link variables. 805dnl See CF_WITH_PATH 806dnl 807dnl $1 = shell variable containing the result of --with-XXX=[DIR] 808dnl $2 = module to look for. 809AC_DEFUN([CF_ADD_OPTIONAL_PATH],[ 810 case "$1" in #(vi 811 no) #(vi 812 ;; 813 yes) #(vi 814 ;; 815 *) 816 CF_ADD_SEARCHPATH([$1], [AC_MSG_ERROR(cannot find $2 under $1)]) 817 ;; 818 esac 819])dnl 820dnl --------------------------------------------------------------------------- 821dnl CF_ADD_SEARCHPATH version: 5 updated: 2009/01/11 20:40:21 822dnl ----------------- 823dnl Set $CPPFLAGS and $LDFLAGS with the directories given via the parameter. 824dnl They can be either the common root of include- and lib-directories, or the 825dnl lib-directory (to allow for things like lib64 directories). 826dnl See also CF_FIND_LINKAGE. 827dnl 828dnl $1 is the list of colon-separated directory names to search. 829dnl $2 is the action to take if a parameter does not yield a directory. 830AC_DEFUN([CF_ADD_SEARCHPATH], 831[ 832AC_REQUIRE([CF_PATHSEP]) 833for cf_searchpath in `echo "$1" | tr $PATH_SEPARATOR ' '`; do 834 if test -d $cf_searchpath/include; then 835 CF_ADD_INCDIR($cf_searchpath/include) 836 elif test -d $cf_searchpath/../include ; then 837 CF_ADD_INCDIR($cf_searchpath/../include) 838 ifelse([$2],,,[else 839$2]) 840 fi 841 if test -d $cf_searchpath/lib; then 842 CF_ADD_LIBDIR($cf_searchpath/lib) 843 elif test -d $cf_searchpath ; then 844 CF_ADD_LIBDIR($cf_searchpath) 845 ifelse([$2],,,[else 846$2]) 847 fi 848done 849]) 850dnl --------------------------------------------------------------------------- 851dnl CF_ADD_SUBDIR_PATH version: 3 updated: 2010/07/03 20:58:12 852dnl ------------------ 853dnl Append to a search-list for a nonstandard header/lib-file 854dnl $1 = the variable to return as result 855dnl $2 = the package name 856dnl $3 = the subdirectory, e.g., bin, include or lib 857dnl $4 = the directory under which we will test for subdirectories 858dnl $5 = a directory that we do not want $4 to match 859AC_DEFUN([CF_ADD_SUBDIR_PATH], 860[ 861test "$4" != "$5" && \ 862test -d "$4" && \ 863ifelse([$5],NONE,,[(test $5 = NONE || test "$4" != "$5") &&]) { 864 test -n "$verbose" && echo " ... testing for $3-directories under $4" 865 test -d $4/$3 && $1="[$]$1 $4/$3" 866 test -d $4/$3/$2 && $1="[$]$1 $4/$3/$2" 867 test -d $4/$3/$2/$3 && $1="[$]$1 $4/$3/$2/$3" 868 test -d $4/$2/$3 && $1="[$]$1 $4/$2/$3" 869 test -d $4/$2/$3/$2 && $1="[$]$1 $4/$2/$3/$2" 870} 871])dnl 872dnl --------------------------------------------------------------------------- 873dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31 874dnl -------------- 875dnl Allow user to disable a normally-on option. 876AC_DEFUN([CF_ARG_DISABLE], 877[CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl 878dnl --------------------------------------------------------------------------- 879dnl CF_ARG_ENABLE version: 3 updated: 1999/03/30 17:24:31 880dnl ------------- 881dnl Allow user to enable a normally-off option. 882AC_DEFUN([CF_ARG_ENABLE], 883[CF_ARG_OPTION($1,[$2],[$3],[$4],no)])dnl 884dnl --------------------------------------------------------------------------- 885dnl CF_ARG_MSG_ENABLE version: 2 updated: 2000/07/29 19:32:03 886dnl ----------------- 887dnl Verbose form of AC_ARG_ENABLE: 888dnl 889dnl Parameters: 890dnl $1 = message 891dnl $2 = option name 892dnl $3 = help-string 893dnl $4 = action to perform if option is enabled 894dnl $5 = action if perform if option is disabled 895dnl $6 = default option value (either 'yes' or 'no') 896AC_DEFUN([CF_ARG_MSG_ENABLE],[ 897AC_MSG_CHECKING($1) 898AC_ARG_ENABLE($2,[$3],,enableval=ifelse($6,,no,$6)) 899AC_MSG_RESULT($enableval) 900if test "$enableval" != no ; then 901ifelse($4,,[ :],$4) 902else 903ifelse($5,,[ :],$5) 904fi 905])dnl 906dnl --------------------------------------------------------------------------- 907dnl CF_ARG_OPTION version: 4 updated: 2010/05/26 05:38:42 908dnl ------------- 909dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus 910dnl values. 911dnl 912dnl Parameters: 913dnl $1 = option name 914dnl $2 = help-string 915dnl $3 = action to perform if option is not default 916dnl $4 = action if perform if option is default 917dnl $5 = default option value (either 'yes' or 'no') 918AC_DEFUN([CF_ARG_OPTION], 919[AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes) 920 if test "$enableval" != "$5" ; then 921ifelse([$3],,[ :]dnl 922,[ $3]) ifelse([$4],,,[ 923 else 924 $4]) 925 fi],[enableval=$5 ifelse([$4],,,[ 926 $4 927])dnl 928 ])])dnl 929dnl --------------------------------------------------------------------------- 930dnl CF_BUNDLED_INTL version: 16 updated: 2010/10/23 15:55:05 931dnl --------------- 932dnl Top-level macro for configuring an application with a bundled copy of 933dnl the intl and po directories for gettext. 934dnl 935dnl $1 specifies either Makefile or makefile, defaulting to the former. 936dnl $2 if nonempty sets the option to --enable-nls rather than to --disable-nls 937dnl 938dnl Sets variables which can be used to substitute in makefiles: 939dnl GT_YES - "#" comment unless building intl library, otherwise empty 940dnl GT_NO - "#" comment if building intl library, otherwise empty 941dnl INTLDIR_MAKE - to make ./intl directory 942dnl MSG_DIR_MAKE - to make ./po directory 943dnl SUB_MAKEFILE - list of makefiles in ./intl, ./po directories 944dnl 945dnl Defines: 946dnl HAVE_LIBGETTEXT_H if we're using ./intl 947dnl NLS_TEXTDOMAIN 948dnl 949dnl Environment: 950dnl ALL_LINGUAS if set, lists the root names of the ".po" files. 951dnl CONFIG_H assumed to be "config.h" 952dnl PACKAGE must be set, used as default for textdomain 953dnl VERSION may be set, otherwise extract from "VERSION" file. 954dnl 955AC_DEFUN([CF_BUNDLED_INTL],[ 956cf_makefile=ifelse($1,,Makefile,$1) 957 958dnl Set of available languages (based on source distribution). Note that 959dnl setting $LINGUAS overrides $ALL_LINGUAS. Some environments set $LINGUAS 960dnl rather than $LC_ALL 961test -z "$ALL_LINGUAS" && ALL_LINGUAS=`test -d $srcdir/po && cd $srcdir/po && echo *.po|sed -e 's/\.po//g' -e 's/*//'` 962 963# Allow override of "config.h" definition: 964: ${CONFIG_H:=config.h} 965AC_SUBST(CONFIG_H) 966 967if test -z "$PACKAGE" ; then 968 AC_MSG_ERROR([[CF_BUNDLED_INTL] used without setting [PACKAGE] variable]) 969fi 970 971if test -z "$VERSION" ; then 972if test -f $srcdir/VERSION ; then 973 VERSION=`sed -e '2,$d' $srcdir/VERSION|cut -f1` 974else 975 VERSION=unknown 976fi 977fi 978AC_SUBST(VERSION) 979 980AM_GNU_GETTEXT(,,,[$2]) 981 982if test "$USE_NLS" = yes ; then 983 AC_ARG_WITH(textdomain, 984 [ --with-textdomain=PKG NLS text-domain (default is package name)], 985 [NLS_TEXTDOMAIN=$withval], 986 [NLS_TEXTDOMAIN=$PACKAGE]) 987 AC_DEFINE_UNQUOTED(NLS_TEXTDOMAIN,"$NLS_TEXTDOMAIN") 988 AC_SUBST(NLS_TEXTDOMAIN) 989fi 990 991INTLDIR_MAKE= 992MSG_DIR_MAKE= 993SUB_MAKEFILE= 994 995dnl this updates SUB_MAKEFILE and MSG_DIR_MAKE: 996CF_OUR_MESSAGES($1) 997 998if test "$USE_INCLUDED_LIBINTL" = yes ; then 999 if test "$nls_cv_force_use_gnu_gettext" = yes ; then 1000 : 1001 elif test "$nls_cv_use_gnu_gettext" = yes ; then 1002 : 1003 else 1004 INTLDIR_MAKE="#" 1005 fi 1006 if test -z "$INTLDIR_MAKE"; then 1007 AC_DEFINE(HAVE_LIBGETTEXT_H) 1008 for cf_makefile in \ 1009 $srcdir/intl/Makefile.in \ 1010 $srcdir/intl/makefile.in 1011 do 1012 if test -f "$cf_makefile" ; then 1013 SUB_MAKEFILE="$SUB_MAKEFILE `echo \"${cf_makefile}\"|sed -e 's,^'$srcdir/',,' -e 's/\.in$//'`:${cf_makefile}" 1014 break 1015 fi 1016 done 1017 fi 1018else 1019 INTLDIR_MAKE="#" 1020 if test "$USE_NLS" = yes ; then 1021 AC_CHECK_HEADERS(libintl.h) 1022 fi 1023fi 1024 1025if test -z "$INTLDIR_MAKE" ; then 1026 CPPFLAGS="$CPPFLAGS -I../intl" 1027fi 1028 1029dnl FIXME: we use this in lynx (the alternative is a spurious dependency upon 1030dnl GNU make) 1031if test "$BUILD_INCLUDED_LIBINTL" = yes ; then 1032 GT_YES="#" 1033 GT_NO= 1034else 1035 GT_YES= 1036 GT_NO="#" 1037fi 1038 1039AC_SUBST(INTLDIR_MAKE) 1040AC_SUBST(MSG_DIR_MAKE) 1041AC_SUBST(GT_YES) 1042AC_SUBST(GT_NO) 1043 1044dnl FIXME: the underlying AM_GNU_GETTEXT macro either needs some fixes or a 1045dnl little documentation. It doesn't define anything so that we can ifdef our 1046dnl own code, except ENABLE_NLS, which is too vague to be of any use. 1047 1048if test "$USE_INCLUDED_LIBINTL" = yes ; then 1049 if test "$nls_cv_force_use_gnu_gettext" = yes ; then 1050 AC_DEFINE(HAVE_GETTEXT) 1051 elif test "$nls_cv_use_gnu_gettext" = yes ; then 1052 AC_DEFINE(HAVE_GETTEXT) 1053 fi 1054 if test -n "$nls_cv_header_intl" ; then 1055 AC_DEFINE(HAVE_LIBINTL_H) 1056 fi 1057fi 1058])dnl 1059dnl --------------------------------------------------------------------------- 1060dnl CF_CHECK_CACHE version: 11 updated: 2008/03/23 14:45:59 1061dnl -------------- 1062dnl Check if we're accidentally using a cache from a different machine. 1063dnl Derive the system name, as a check for reusing the autoconf cache. 1064dnl 1065dnl If we've packaged config.guess and config.sub, run that (since it does a 1066dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow 1067dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM 1068dnl which is useful in cross-compiles. 1069dnl 1070dnl Note: we would use $ac_config_sub, but that is one of the places where 1071dnl autoconf 2.5x broke compatibility with autoconf 2.13 1072AC_DEFUN([CF_CHECK_CACHE], 1073[ 1074if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then 1075 ifelse([$1],,[AC_CANONICAL_HOST],[$1]) 1076 system_name="$host_os" 1077else 1078 system_name="`(uname -s -r) 2>/dev/null`" 1079 if test -z "$system_name" ; then 1080 system_name="`(hostname) 2>/dev/null`" 1081 fi 1082fi 1083test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name") 1084AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"]) 1085 1086test -z "$system_name" && system_name="$cf_cv_system_name" 1087test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name) 1088 1089if test ".$system_name" != ".$cf_cv_system_name" ; then 1090 AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)) 1091 AC_MSG_ERROR("Please remove config.cache and try again.") 1092fi 1093])dnl 1094dnl --------------------------------------------------------------------------- 1095dnl CF_CURSES_CHTYPE version: 7 updated: 2010/10/23 15:54:49 1096dnl ---------------- 1097dnl Test if curses defines 'chtype' (usually a 'long' type for SysV curses). 1098AC_DEFUN([CF_CURSES_CHTYPE], 1099[ 1100AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl 1101AC_CACHE_CHECK(for chtype typedef,cf_cv_chtype_decl,[ 1102 AC_TRY_COMPILE([#include <${cf_cv_ncurses_header:-curses.h}>], 1103 [chtype foo], 1104 [cf_cv_chtype_decl=yes], 1105 [cf_cv_chtype_decl=no])]) 1106if test $cf_cv_chtype_decl = yes ; then 1107 AC_DEFINE(HAVE_TYPE_CHTYPE) 1108 AC_CACHE_CHECK(if chtype is scalar or struct,cf_cv_chtype_type,[ 1109 AC_TRY_COMPILE([#include <${cf_cv_ncurses_header:-curses.h}>], 1110 [chtype foo; long x = foo], 1111 [cf_cv_chtype_type=scalar], 1112 [cf_cv_chtype_type=struct])]) 1113 if test $cf_cv_chtype_type = scalar ; then 1114 AC_DEFINE(TYPE_CHTYPE_IS_SCALAR) 1115 fi 1116fi 1117])dnl 1118dnl --------------------------------------------------------------------------- 1119dnl CF_CURSES_CONFIG version: 2 updated: 2006/10/29 11:06:27 1120dnl ---------------- 1121dnl Tie together the configure-script macros for curses. It may be ncurses, 1122dnl but unless asked, we do not make a special search for ncurses. However, 1123dnl still check for the ncurses version number, for use in other macros. 1124AC_DEFUN([CF_CURSES_CONFIG], 1125[ 1126CF_CURSES_CPPFLAGS 1127CF_NCURSES_VERSION 1128CF_CURSES_LIBS 1129])dnl 1130dnl --------------------------------------------------------------------------- 1131dnl CF_CURSES_CPPFLAGS version: 10 updated: 2009/01/06 19:34:11 1132dnl ------------------ 1133dnl Look for the curses headers. 1134AC_DEFUN([CF_CURSES_CPPFLAGS],[ 1135 1136AC_CACHE_CHECK(for extra include directories,cf_cv_curses_incdir,[ 1137cf_cv_curses_incdir=no 1138case $host_os in #(vi 1139hpux10.*) #(vi 1140 test -d /usr/include/curses_colr && \ 1141 cf_cv_curses_incdir="-I/usr/include/curses_colr" 1142 ;; 1143sunos3*|sunos4*) 1144 test -d /usr/5lib && \ 1145 test -d /usr/5include && \ 1146 cf_cv_curses_incdir="-I/usr/5include" 1147 ;; 1148esac 1149]) 1150test "$cf_cv_curses_incdir" != no && CPPFLAGS="$CPPFLAGS $cf_cv_curses_incdir" 1151 1152CF_CURSES_HEADER 1153CF_TERM_HEADER 1154])dnl 1155dnl --------------------------------------------------------------------------- 1156dnl CF_CURSES_FUNCS version: 15 updated: 2010/10/23 15:52:32 1157dnl --------------- 1158dnl Curses-functions are a little complicated, since a lot of them are macros. 1159AC_DEFUN([CF_CURSES_FUNCS], 1160[ 1161AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl 1162AC_REQUIRE([CF_XOPEN_CURSES]) 1163AC_REQUIRE([CF_CURSES_TERM_H]) 1164for cf_func in $1 1165do 1166 CF_UPPER(cf_tr_func,$cf_func) 1167 AC_MSG_CHECKING(for ${cf_func}) 1168 CF_MSG_LOG(${cf_func}) 1169 AC_CACHE_VAL(cf_cv_func_$cf_func,[ 1170 eval cf_result='$ac_cv_func_'$cf_func 1171 if test ".$cf_result" != ".no"; then 1172 AC_TRY_LINK(CF__CURSES_HEAD, 1173 [ 1174#ifndef ${cf_func} 1175long foo = (long)(&${cf_func}); 1176${cf_cv_main_return:-return}(foo == 0); 1177#endif 1178 ], 1179 [cf_result=yes], 1180 [cf_result=no]) 1181 fi 1182 eval 'cf_cv_func_'$cf_func'=$cf_result' 1183 ]) 1184 # use the computed/retrieved cache-value: 1185 eval 'cf_result=$cf_cv_func_'$cf_func 1186 AC_MSG_RESULT($cf_result) 1187 if test $cf_result != no; then 1188 AC_DEFINE_UNQUOTED(HAVE_${cf_tr_func}) 1189 fi 1190done 1191])dnl 1192dnl --------------------------------------------------------------------------- 1193dnl CF_CURSES_HEADER version: 2 updated: 2010/04/28 06:02:16 1194dnl ---------------- 1195dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common 1196dnl variations of ncurses' installs. 1197dnl 1198dnl $1 = ncurses when looking for ncurses, or is empty 1199AC_DEFUN([CF_CURSES_HEADER],[ 1200AC_CACHE_CHECK(if we have identified curses headers,cf_cv_ncurses_header,[ 1201cf_cv_ncurses_header=none 1202for cf_header in ifelse($1,,,[ \ 1203 $1/curses.h \ 1204 $1/ncurses.h]) \ 1205 curses.h \ 1206 ncurses.h ifelse($1,,[ncurses/curses.h ncurses/ncurses.h]) 1207do 1208AC_TRY_COMPILE([#include <${cf_header}>], 1209 [initscr(); tgoto("?", 0,0)], 1210 [cf_cv_ncurses_header=$cf_header; break],[]) 1211done 1212]) 1213 1214if test "$cf_cv_ncurses_header" = none ; then 1215 AC_MSG_ERROR(No curses header-files found) 1216fi 1217 1218# cheat, to get the right #define's for HAVE_NCURSES_H, etc. 1219AC_CHECK_HEADERS($cf_cv_ncurses_header) 1220])dnl 1221dnl --------------------------------------------------------------------------- 1222dnl CF_CURSES_LIBS version: 32 updated: 2011/01/16 17:43:15 1223dnl -------------- 1224dnl Look for the curses libraries. Older curses implementations may require 1225dnl termcap/termlib to be linked as well. Call CF_CURSES_CPPFLAGS first. 1226AC_DEFUN([CF_CURSES_LIBS],[ 1227 1228AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl 1229AC_MSG_CHECKING(if we have identified curses libraries) 1230AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], 1231 [initscr(); tgoto("?", 0,0)], 1232 cf_result=yes, 1233 cf_result=no) 1234AC_MSG_RESULT($cf_result) 1235 1236if test "$cf_result" = no ; then 1237case $host_os in #(vi 1238freebsd*) #(vi 1239 AC_CHECK_LIB(mytinfo,tgoto,[CF_ADD_LIBS(-lmytinfo)]) 1240 ;; 1241hpux10.*) #(vi 1242 AC_CHECK_LIB(cur_colr,initscr,[ 1243 CF_ADD_LIBS(-lcur_colr) 1244 ac_cv_func_initscr=yes 1245 ],[ 1246 AC_CHECK_LIB(Hcurses,initscr,[ 1247 # HP's header uses __HP_CURSES, but user claims _HP_CURSES. 1248 CF_ADD_LIBS(-lHcurses) 1249 CPPFLAGS="$CPPFLAGS -D__HP_CURSES -D_HP_CURSES" 1250 ac_cv_func_initscr=yes 1251 ])]) 1252 ;; 1253linux*) 1254 case `arch` in 1255 x86_64) 1256 if test -d /lib64 1257 then 1258 CF_ADD_LIBDIR(/lib64) 1259 else 1260 CF_ADD_LIBDIR(/lib) 1261 fi 1262 ;; 1263 *) 1264 CF_ADD_LIBDIR(/lib) 1265 ;; 1266 esac 1267 ;; 1268sunos3*|sunos4*) 1269 if test -d /usr/5lib ; then 1270 CF_ADD_LIBDIR(/usr/5lib) 1271 CF_ADD_LIBS(-lcurses -ltermcap) 1272 fi 1273 ac_cv_func_initscr=yes 1274 ;; 1275esac 1276 1277if test ".$ac_cv_func_initscr" != .yes ; then 1278 cf_save_LIBS="$LIBS" 1279 cf_term_lib="" 1280 cf_curs_lib="" 1281 1282 if test ".${cf_cv_ncurses_version:-no}" != .no 1283 then 1284 cf_check_list="ncurses curses cursesX" 1285 else 1286 cf_check_list="cursesX curses ncurses" 1287 fi 1288 1289 # Check for library containing tgoto. Do this before curses library 1290 # because it may be needed to link the test-case for initscr. 1291 AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[ 1292 for cf_term_lib in $cf_check_list termcap termlib unknown 1293 do 1294 AC_CHECK_LIB($cf_term_lib,tgoto,[break]) 1295 done 1296 ]) 1297 1298 # Check for library containing initscr 1299 test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS" 1300 for cf_curs_lib in $cf_check_list xcurses jcurses pdcurses unknown 1301 do 1302 AC_CHECK_LIB($cf_curs_lib,initscr,[break]) 1303 done 1304 test $cf_curs_lib = unknown && AC_MSG_ERROR(no curses library found) 1305 1306 LIBS="-l$cf_curs_lib $cf_save_LIBS" 1307 if test "$cf_term_lib" = unknown ; then 1308 AC_MSG_CHECKING(if we can link with $cf_curs_lib library) 1309 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], 1310 [initscr()], 1311 [cf_result=yes], 1312 [cf_result=no]) 1313 AC_MSG_RESULT($cf_result) 1314 test $cf_result = no && AC_MSG_ERROR(Cannot link curses library) 1315 elif test "$cf_curs_lib" = "$cf_term_lib" ; then 1316 : 1317 elif test "$cf_term_lib" != predefined ; then 1318 AC_MSG_CHECKING(if we need both $cf_curs_lib and $cf_term_lib libraries) 1319 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], 1320 [initscr(); tgoto((char *)0, 0, 0);], 1321 [cf_result=no], 1322 [ 1323 LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS" 1324 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], 1325 [initscr()], 1326 [cf_result=yes], 1327 [cf_result=error]) 1328 ]) 1329 AC_MSG_RESULT($cf_result) 1330 fi 1331fi 1332fi 1333 1334])dnl 1335dnl --------------------------------------------------------------------------- 1336dnl CF_CURSES_TERM_H version: 8 updated: 2010/10/23 15:54:49 1337dnl ---------------- 1338dnl SVr4 curses should have term.h as well (where it puts the definitions of 1339dnl the low-level interface). This may not be true in old/broken implementations, 1340dnl as well as in misconfigured systems (e.g., gcc configured for Solaris 2.4 1341dnl running with Solaris 2.5.1). 1342AC_DEFUN([CF_CURSES_TERM_H], 1343[ 1344AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl 1345 1346AC_CACHE_CHECK(for term.h, cf_cv_term_header,[ 1347 1348# If we found <ncurses/curses.h>, look for <ncurses/term.h>, but always look 1349# for <term.h> if we do not find the variant. 1350for cf_header in \ 1351 `echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%/.*%/%'`term.h \ 1352 term.h 1353do 1354 AC_TRY_COMPILE([ 1355#include <${cf_cv_ncurses_header:-curses.h}> 1356#include <${cf_header}>], 1357 [WINDOW *x], 1358 [cf_cv_term_header=$cf_header 1359 break], 1360 [cf_cv_term_header=no]) 1361done 1362 1363case $cf_cv_term_header in #(vi 1364no) 1365 # If curses is ncurses, some packagers still mess it up by trying to make 1366 # us use GNU termcap. This handles the most common case. 1367 for cf_header in ncurses/term.h ncursesw/term.h 1368 do 1369 AC_TRY_COMPILE([ 1370#include <${cf_cv_ncurses_header:-curses.h}> 1371#ifdef NCURSES_VERSION 1372#include <${cf_header}> 1373#else 1374make an error 1375#endif], 1376 [WINDOW *x], 1377 [cf_cv_term_header=$cf_header 1378 break], 1379 [cf_cv_term_header=no]) 1380 done 1381 ;; 1382esac 1383]) 1384 1385case $cf_cv_term_header in #(vi 1386term.h) #(vi 1387 AC_DEFINE(HAVE_TERM_H) 1388 ;; 1389ncurses/term.h) #(vi 1390 AC_DEFINE(HAVE_NCURSES_TERM_H) 1391 ;; 1392ncursesw/term.h) 1393 AC_DEFINE(HAVE_NCURSESW_TERM_H) 1394 ;; 1395esac 1396])dnl 1397dnl --------------------------------------------------------------------------- 1398dnl CF_CURSES_WACS_MAP version: 5 updated: 2011/01/15 11:28:59 1399dnl ------------------ 1400dnl Check for likely values of wacs_map[]. 1401AC_DEFUN([CF_CURSES_WACS_MAP], 1402[ 1403AC_CACHE_CHECK(for wide alternate character set array, cf_cv_curses_wacs_map,[ 1404 cf_cv_curses_wacs_map=unknown 1405 for name in wacs_map _wacs_map __wacs_map _nc_wacs _wacs_char 1406 do 1407 AC_TRY_LINK([ 1408#ifndef _XOPEN_SOURCE_EXTENDED 1409#define _XOPEN_SOURCE_EXTENDED 1410#endif 1411#include <${cf_cv_ncurses_header:-curses.h}>], 1412 [void *foo = &($name['k'])], 1413 [cf_cv_curses_wacs_map=$name 1414 break]) 1415 done]) 1416 1417test "$cf_cv_curses_wacs_map" != unknown && AC_DEFINE_UNQUOTED(CURSES_WACS_ARRAY,$cf_cv_curses_wacs_map) 1418])dnl 1419dnl --------------------------------------------------------------------------- 1420dnl CF_CURSES_WACS_SYMBOLS version: 1 updated: 2011/01/15 11:28:59 1421dnl ---------------------- 1422dnl Do a check to see if the WACS_xxx constants are defined compatibly with 1423dnl X/Open Curses. In particular, NetBSD's implementation of the WACS_xxx 1424dnl constants is broken since those constants do not point to cchar_t's. 1425AC_DEFUN([CF_CURSES_WACS_SYMBOLS], 1426[ 1427AC_REQUIRE([CF_CURSES_WACS_MAP]) 1428 1429AC_CACHE_CHECK(for wide alternate character constants, cf_cv_curses_wacs_symbols,[ 1430cf_cv_curses_wacs_symbols=no 1431if test "$cf_cv_curses_wacs_map" != unknown 1432then 1433 AC_TRY_LINK([ 1434#ifndef _XOPEN_SOURCE_EXTENDED 1435#define _XOPEN_SOURCE_EXTENDED 1436#endif 1437#include <${cf_cv_ncurses_header:-curses.h}>], 1438 [cchar_t *foo = WACS_PLUS; 1439 $cf_cv_curses_wacs_map['k'] = *WACS_PLUS], 1440 [cf_cv_curses_wacs_symbols=yes]) 1441else 1442 AC_TRY_LINK([ 1443#ifndef _XOPEN_SOURCE_EXTENDED 1444#define _XOPEN_SOURCE_EXTENDED 1445#endif 1446#include <${cf_cv_ncurses_header:-curses.h}>], 1447 [cchar_t *foo = WACS_PLUS], 1448 [cf_cv_curses_wacs_symbols=yes]) 1449fi 1450]) 1451 1452test "$cf_cv_curses_wacs_symbols" != no && AC_DEFINE(CURSES_WACS_SYMBOLS) 1453])dnl 1454dnl --------------------------------------------------------------------------- 1455dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52 1456dnl ---------- 1457dnl "dirname" is not portable, so we fake it with a shell script. 1458AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl 1459dnl --------------------------------------------------------------------------- 1460dnl CF_DISABLE_ECHO version: 11 updated: 2009/12/13 13:16:57 1461dnl --------------- 1462dnl You can always use "make -n" to see the actual options, but it's hard to 1463dnl pick out/analyze warning messages when the compile-line is long. 1464dnl 1465dnl Sets: 1466dnl ECHO_LT - symbol to control if libtool is verbose 1467dnl ECHO_LD - symbol to prefix "cc -o" lines 1468dnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o) 1469dnl SHOW_CC - symbol to put before explicit "cc -c" lines 1470dnl ECHO_CC - symbol to put before any "cc" line 1471dnl 1472AC_DEFUN([CF_DISABLE_ECHO],[ 1473AC_MSG_CHECKING(if you want to see long compiling messages) 1474CF_ARG_DISABLE(echo, 1475 [ --disable-echo display "compiling" commands], 1476 [ 1477 ECHO_LT='--silent' 1478 ECHO_LD='@echo linking [$]@;' 1479 RULE_CC='@echo compiling [$]<' 1480 SHOW_CC='@echo compiling [$]@' 1481 ECHO_CC='@' 1482],[ 1483 ECHO_LT='' 1484 ECHO_LD='' 1485 RULE_CC='' 1486 SHOW_CC='' 1487 ECHO_CC='' 1488]) 1489AC_MSG_RESULT($enableval) 1490AC_SUBST(ECHO_LT) 1491AC_SUBST(ECHO_LD) 1492AC_SUBST(RULE_CC) 1493AC_SUBST(SHOW_CC) 1494AC_SUBST(ECHO_CC) 1495])dnl 1496dnl --------------------------------------------------------------------------- 1497dnl CF_DISABLE_LIBTOOL_VERSION version: 1 updated: 2010/05/15 15:45:59 1498dnl -------------------------- 1499dnl Check if we should use the libtool 1.5 feature "-version-number" instead of 1500dnl the older "-version-info" feature. The newer feature allows us to use 1501dnl version numbering on shared libraries which make them compatible with 1502dnl various systems. 1503AC_DEFUN([CF_DISABLE_LIBTOOL_VERSION], 1504[ 1505AC_MSG_CHECKING(if libtool -version-number should be used) 1506CF_ARG_DISABLE(libtool-version, 1507 [ --disable-libtool-version enable to use libtool's incompatible naming scheme], 1508 [cf_libtool_version=no], 1509 [cf_libtool_version=yes]) 1510AC_MSG_RESULT($cf_libtool_version) 1511 1512if test "$cf_libtool_version" = yes ; then 1513 LIBTOOL_VERSION="-version-number" 1514else 1515 LIBTOOL_VERSION="-version-info" 1516fi 1517 1518AC_SUBST(LIBTOOL_VERSION) 1519])dnl 1520dnl --------------------------------------------------------------------------- 1521dnl CF_DISABLE_RPATH_HACK version: 1 updated: 2010/04/11 10:54:00 1522dnl --------------------- 1523dnl The rpath-hack makes it simpler to build programs, particularly with the 1524dnl *BSD ports which may have essential libraries in unusual places. But it 1525dnl can interfere with building an executable for the base system. Use this 1526dnl option in that case. 1527AC_DEFUN([CF_DISABLE_RPATH_HACK], 1528[ 1529AC_MSG_CHECKING(if rpath should be not be set) 1530CF_ARG_DISABLE(rpath-hack, 1531 [ --disable-rpath-hack don't add rpath options for additional libraries], 1532 [cf_disable_rpath_hack=yes], 1533 [cf_disable_rpath_hack=no]) 1534AC_MSG_RESULT($cf_disable_rpath_hack) 1535if test "$cf_disable_rpath_hack" = no ; then 1536 CF_RPATH_HACK 1537fi 1538]) 1539dnl --------------------------------------------------------------------------- 1540dnl CF_FIND_HEADER version: 2 updated: 2007/07/29 11:32:00 1541dnl -------------- 1542dnl Find a header file, searching for it if it is not already in the include 1543dnl path. 1544dnl 1545dnl $1 = the header filename 1546dnl $2 = the package name 1547dnl $3 = action to perform if successful 1548dnl $4 = action to perform if not successful 1549AC_DEFUN([CF_FIND_HEADER],[ 1550AC_CHECK_HEADER([$1], 1551 cf_find_header=yes,[ 1552 cf_find_header=no 1553CF_HEADER_PATH(cf_search,$2) 1554for cf_incdir in $cf_search 1555do 1556 if test -f $cf_incdir/$1 ; then 1557 CF_ADD_INCDIR($cf_incdir) 1558 CF_VERBOSE(... found in $cf_incdir) 1559 cf_find_header=yes 1560 break 1561 fi 1562 CF_VERBOSE(... tested $cf_incdir) 1563done 1564]) 1565if test "$cf_find_header" = yes ; then 1566ifelse([$3],,:,[$3]) 1567ifelse([$4],,,[else 1568$4]) 1569fi 1570])dnl 1571dnl --------------------------------------------------------------------------- 1572dnl CF_FIND_LIBRARY version: 9 updated: 2008/03/23 14:48:54 1573dnl --------------- 1574dnl Look for a non-standard library, given parameters for AC_TRY_LINK. We 1575dnl prefer a standard location, and use -L options only if we do not find the 1576dnl library in the standard library location(s). 1577dnl $1 = library name 1578dnl $2 = library class, usually the same as library name 1579dnl $3 = includes 1580dnl $4 = code fragment to compile/link 1581dnl $5 = corresponding function-name 1582dnl $6 = flag, nonnull if failure should not cause an error-exit 1583dnl 1584dnl Sets the variable "$cf_libdir" as a side-effect, so we can see if we had 1585dnl to use a -L option. 1586AC_DEFUN([CF_FIND_LIBRARY], 1587[ 1588 eval 'cf_cv_have_lib_'$1'=no' 1589 cf_libdir="" 1590 AC_CHECK_FUNC($5, 1591 eval 'cf_cv_have_lib_'$1'=yes',[ 1592 cf_save_LIBS="$LIBS" 1593 AC_MSG_CHECKING(for $5 in -l$1) 1594 LIBS="-l$1 $LIBS" 1595 AC_TRY_LINK([$3],[$4], 1596 [AC_MSG_RESULT(yes) 1597 eval 'cf_cv_have_lib_'$1'=yes' 1598 ], 1599 [AC_MSG_RESULT(no) 1600 CF_LIBRARY_PATH(cf_search,$2) 1601 for cf_libdir in $cf_search 1602 do 1603 AC_MSG_CHECKING(for -l$1 in $cf_libdir) 1604 LIBS="-L$cf_libdir -l$1 $cf_save_LIBS" 1605 AC_TRY_LINK([$3],[$4], 1606 [AC_MSG_RESULT(yes) 1607 eval 'cf_cv_have_lib_'$1'=yes' 1608 break], 1609 [AC_MSG_RESULT(no) 1610 LIBS="$cf_save_LIBS"]) 1611 done 1612 ]) 1613 ]) 1614eval 'cf_found_library=[$]cf_cv_have_lib_'$1 1615ifelse($6,,[ 1616if test $cf_found_library = no ; then 1617 AC_MSG_ERROR(Cannot link $1 library) 1618fi 1619]) 1620])dnl 1621dnl --------------------------------------------------------------------------- 1622dnl CF_FIND_LINKAGE version: 19 updated: 2010/05/29 16:31:02 1623dnl --------------- 1624dnl Find a library (specifically the linkage used in the code fragment), 1625dnl searching for it if it is not already in the library path. 1626dnl See also CF_ADD_SEARCHPATH. 1627dnl 1628dnl Parameters (4-on are optional): 1629dnl $1 = headers for library entrypoint 1630dnl $2 = code fragment for library entrypoint 1631dnl $3 = the library name without the "-l" option or ".so" suffix. 1632dnl $4 = action to perform if successful (default: update CPPFLAGS, etc) 1633dnl $5 = action to perform if not successful 1634dnl $6 = module name, if not the same as the library name 1635dnl $7 = extra libraries 1636dnl 1637dnl Sets these variables: 1638dnl $cf_cv_find_linkage_$3 - yes/no according to whether linkage is found 1639dnl $cf_cv_header_path_$3 - include-directory if needed 1640dnl $cf_cv_library_path_$3 - library-directory if needed 1641dnl $cf_cv_library_file_$3 - library-file if needed, e.g., -l$3 1642AC_DEFUN([CF_FIND_LINKAGE],[ 1643 1644# If the linkage is not already in the $CPPFLAGS/$LDFLAGS configuration, these 1645# will be set on completion of the AC_TRY_LINK below. 1646cf_cv_header_path_$3= 1647cf_cv_library_path_$3= 1648 1649CF_MSG_LOG([Starting [FIND_LINKAGE]($3,$6)]) 1650 1651cf_save_LIBS="$LIBS" 1652 1653AC_TRY_LINK([$1],[$2],[ 1654 cf_cv_find_linkage_$3=yes 1655 cf_cv_header_path_$3=/usr/include 1656 cf_cv_library_path_$3=/usr/lib 1657],[ 1658 1659LIBS="-l$3 $7 $cf_save_LIBS" 1660 1661AC_TRY_LINK([$1],[$2],[ 1662 cf_cv_find_linkage_$3=yes 1663 cf_cv_header_path_$3=/usr/include 1664 cf_cv_library_path_$3=/usr/lib 1665 cf_cv_library_file_$3="-l$3" 1666],[ 1667 cf_cv_find_linkage_$3=no 1668 LIBS="$cf_save_LIBS" 1669 1670 CF_VERBOSE(find linkage for $3 library) 1671 CF_MSG_LOG([Searching for headers in [FIND_LINKAGE]($3,$6)]) 1672 1673 cf_save_CPPFLAGS="$CPPFLAGS" 1674 cf_test_CPPFLAGS="$CPPFLAGS" 1675 1676 CF_HEADER_PATH(cf_search,ifelse([$6],,[$3],[$6])) 1677 for cf_cv_header_path_$3 in $cf_search 1678 do 1679 if test -d $cf_cv_header_path_$3 ; then 1680 CF_VERBOSE(... testing $cf_cv_header_path_$3) 1681 CPPFLAGS="$cf_save_CPPFLAGS -I$cf_cv_header_path_$3" 1682 AC_TRY_COMPILE([$1],[$2],[ 1683 CF_VERBOSE(... found $3 headers in $cf_cv_header_path_$3) 1684 cf_cv_find_linkage_$3=maybe 1685 cf_test_CPPFLAGS="$CPPFLAGS" 1686 break],[ 1687 CPPFLAGS="$cf_save_CPPFLAGS" 1688 ]) 1689 fi 1690 done 1691 1692 if test "$cf_cv_find_linkage_$3" = maybe ; then 1693 1694 CF_MSG_LOG([Searching for $3 library in [FIND_LINKAGE]($3,$6)]) 1695 1696 cf_save_LIBS="$LIBS" 1697 cf_save_LDFLAGS="$LDFLAGS" 1698 1699 ifelse([$6],,,[ 1700 CPPFLAGS="$cf_test_CPPFLAGS" 1701 LIBS="-l$3 $7 $cf_save_LIBS" 1702 AC_TRY_LINK([$1],[$2],[ 1703 CF_VERBOSE(... found $3 library in system) 1704 cf_cv_find_linkage_$3=yes]) 1705 CPPFLAGS="$cf_save_CPPFLAGS" 1706 LIBS="$cf_save_LIBS" 1707 ]) 1708 1709 if test "$cf_cv_find_linkage_$3" != yes ; then 1710 CF_LIBRARY_PATH(cf_search,$3) 1711 for cf_cv_library_path_$3 in $cf_search 1712 do 1713 if test -d $cf_cv_library_path_$3 ; then 1714 CF_VERBOSE(... testing $cf_cv_library_path_$3) 1715 CPPFLAGS="$cf_test_CPPFLAGS" 1716 LIBS="-l$3 $7 $cf_save_LIBS" 1717 LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_$3" 1718 AC_TRY_LINK([$1],[$2],[ 1719 CF_VERBOSE(... found $3 library in $cf_cv_library_path_$3) 1720 cf_cv_find_linkage_$3=yes 1721 cf_cv_library_file_$3="-l$3" 1722 break],[ 1723 CPPFLAGS="$cf_save_CPPFLAGS" 1724 LIBS="$cf_save_LIBS" 1725 LDFLAGS="$cf_save_LDFLAGS" 1726 ]) 1727 fi 1728 done 1729 CPPFLAGS="$cf_save_CPPFLAGS" 1730 LDFLAGS="$cf_save_LDFLAGS" 1731 fi 1732 1733 else 1734 cf_cv_find_linkage_$3=no 1735 fi 1736 ],$7) 1737]) 1738 1739LIBS="$cf_save_LIBS" 1740 1741if test "$cf_cv_find_linkage_$3" = yes ; then 1742ifelse([$4],,[ 1743 CF_ADD_INCDIR($cf_cv_header_path_$3) 1744 CF_ADD_LIBDIR($cf_cv_library_path_$3) 1745 CF_ADD_LIB($3) 1746],[$4]) 1747else 1748ifelse([$5],,AC_MSG_WARN(Cannot find $3 library),[$5]) 1749fi 1750])dnl 1751dnl --------------------------------------------------------------------------- 1752dnl CF_FUNC_WAIT version: 2 updated: 1997/10/21 19:45:33 1753dnl ------------ 1754dnl Test for the presence of <sys/wait.h>, 'union wait', arg-type of 'wait()' 1755dnl and/or 'waitpid()'. 1756dnl 1757dnl Note that we cannot simply grep for 'union wait' in the wait.h file, 1758dnl because some Posix systems turn this on only when a BSD variable is 1759dnl defined. 1760dnl 1761dnl I don't use AC_HEADER_SYS_WAIT, because it defines HAVE_SYS_WAIT_H, which 1762dnl would conflict with an attempt to test that header directly. 1763dnl 1764AC_DEFUN([CF_FUNC_WAIT], 1765[ 1766AC_REQUIRE([CF_UNION_WAIT]) 1767if test $cf_cv_type_unionwait = yes; then 1768 1769 AC_MSG_CHECKING(if union wait can be used as wait-arg) 1770 AC_CACHE_VAL(cf_cv_arg_union_wait,[ 1771 AC_TRY_COMPILE($cf_wait_headers, 1772 [union wait x; wait(&x)], 1773 [cf_cv_arg_union_wait=yes], 1774 [cf_cv_arg_union_wait=no]) 1775 ]) 1776 AC_MSG_RESULT($cf_cv_arg_union_wait) 1777 test $cf_cv_arg_union_wait = yes && AC_DEFINE(WAIT_USES_UNION) 1778 1779 AC_MSG_CHECKING(if union wait can be used as waitpid-arg) 1780 AC_CACHE_VAL(cf_cv_arg_union_waitpid,[ 1781 AC_TRY_COMPILE($cf_wait_headers, 1782 [union wait x; waitpid(0, &x, 0)], 1783 [cf_cv_arg_union_waitpid=yes], 1784 [cf_cv_arg_union_waitpid=no]) 1785 ]) 1786 AC_MSG_RESULT($cf_cv_arg_union_waitpid) 1787 test $cf_cv_arg_union_waitpid = yes && AC_DEFINE(WAITPID_USES_UNION) 1788 1789fi 1790])dnl 1791dnl --------------------------------------------------------------------------- 1792dnl CF_GCC_ATTRIBUTES version: 14 updated: 2010/10/23 15:52:32 1793dnl ----------------- 1794dnl Test for availability of useful gcc __attribute__ directives to quiet 1795dnl compiler warnings. Though useful, not all are supported -- and contrary 1796dnl to documentation, unrecognized directives cause older compilers to barf. 1797AC_DEFUN([CF_GCC_ATTRIBUTES], 1798[ 1799if test "$GCC" = yes 1800then 1801cat > conftest.i <<EOF 1802#ifndef GCC_PRINTF 1803#define GCC_PRINTF 0 1804#endif 1805#ifndef GCC_SCANF 1806#define GCC_SCANF 0 1807#endif 1808#ifndef GCC_NORETURN 1809#define GCC_NORETURN /* nothing */ 1810#endif 1811#ifndef GCC_UNUSED 1812#define GCC_UNUSED /* nothing */ 1813#endif 1814EOF 1815if test "$GCC" = yes 1816then 1817 AC_CHECKING([for $CC __attribute__ directives]) 1818cat > conftest.$ac_ext <<EOF 1819#line __oline__ "${as_me:-configure}" 1820#include "confdefs.h" 1821#include "conftest.h" 1822#include "conftest.i" 1823#if GCC_PRINTF 1824#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) 1825#else 1826#define GCC_PRINTFLIKE(fmt,var) /*nothing*/ 1827#endif 1828#if GCC_SCANF 1829#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) 1830#else 1831#define GCC_SCANFLIKE(fmt,var) /*nothing*/ 1832#endif 1833extern void wow(char *,...) GCC_SCANFLIKE(1,2); 1834extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; 1835extern void foo(void) GCC_NORETURN; 1836int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; } 1837EOF 1838 cf_printf_attribute=no 1839 cf_scanf_attribute=no 1840 for cf_attribute in scanf printf unused noreturn 1841 do 1842 CF_UPPER(cf_ATTRIBUTE,$cf_attribute) 1843 cf_directive="__attribute__(($cf_attribute))" 1844 echo "checking for $CC $cf_directive" 1>&AC_FD_CC 1845 1846 case $cf_attribute in #(vi 1847 printf) #(vi 1848 cf_printf_attribute=yes 1849 cat >conftest.h <<EOF 1850#define GCC_$cf_ATTRIBUTE 1 1851EOF 1852 ;; 1853 scanf) #(vi 1854 cf_scanf_attribute=yes 1855 cat >conftest.h <<EOF 1856#define GCC_$cf_ATTRIBUTE 1 1857EOF 1858 ;; 1859 *) #(vi 1860 cat >conftest.h <<EOF 1861#define GCC_$cf_ATTRIBUTE $cf_directive 1862EOF 1863 ;; 1864 esac 1865 1866 if AC_TRY_EVAL(ac_compile); then 1867 test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute) 1868 cat conftest.h >>confdefs.h 1869 case $cf_attribute in #(vi 1870 printf) #(vi 1871 if test "$cf_printf_attribute" = no ; then 1872 cat >>confdefs.h <<EOF 1873#define GCC_PRINTFLIKE(fmt,var) /* nothing */ 1874EOF 1875 else 1876 cat >>confdefs.h <<EOF 1877#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) 1878EOF 1879 fi 1880 ;; 1881 scanf) #(vi 1882 if test "$cf_scanf_attribute" = no ; then 1883 cat >>confdefs.h <<EOF 1884#define GCC_SCANFLIKE(fmt,var) /* nothing */ 1885EOF 1886 else 1887 cat >>confdefs.h <<EOF 1888#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) 1889EOF 1890 fi 1891 ;; 1892 esac 1893 fi 1894 done 1895else 1896 fgrep define conftest.i >>confdefs.h 1897fi 1898rm -rf conftest* 1899fi 1900])dnl 1901dnl --------------------------------------------------------------------------- 1902dnl CF_GCC_VERSION version: 5 updated: 2010/04/24 11:02:31 1903dnl -------------- 1904dnl Find version of gcc 1905AC_DEFUN([CF_GCC_VERSION],[ 1906AC_REQUIRE([AC_PROG_CC]) 1907GCC_VERSION=none 1908if test "$GCC" = yes ; then 1909 AC_MSG_CHECKING(version of $CC) 1910 GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`" 1911 test -z "$GCC_VERSION" && GCC_VERSION=unknown 1912 AC_MSG_RESULT($GCC_VERSION) 1913fi 1914])dnl 1915dnl --------------------------------------------------------------------------- 1916dnl CF_GCC_WARNINGS version: 27 updated: 2010/10/23 15:52:32 1917dnl --------------- 1918dnl Check if the compiler supports useful warning options. There's a few that 1919dnl we don't use, simply because they're too noisy: 1920dnl 1921dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x) 1922dnl -Wredundant-decls (system headers make this too noisy) 1923dnl -Wtraditional (combines too many unrelated messages, only a few useful) 1924dnl -Wwrite-strings (too noisy, but should review occasionally). This 1925dnl is enabled for ncurses using "--enable-const". 1926dnl -pedantic 1927dnl 1928dnl Parameter: 1929dnl $1 is an optional list of gcc warning flags that a particular 1930dnl application might want to use, e.g., "no-unused" for 1931dnl -Wno-unused 1932dnl Special: 1933dnl If $with_ext_const is "yes", add a check for -Wwrite-strings 1934dnl 1935AC_DEFUN([CF_GCC_WARNINGS], 1936[ 1937AC_REQUIRE([CF_GCC_VERSION]) 1938CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS) 1939 1940cat > conftest.$ac_ext <<EOF 1941#line __oline__ "${as_me:-configure}" 1942int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; } 1943EOF 1944 1945if test "$INTEL_COMPILER" = yes 1946then 1947# The "-wdXXX" options suppress warnings: 1948# remark #1419: external declaration in primary source file 1949# remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem) 1950# remark #1684: conversion from pointer to same-sized integral type (potential portability problem) 1951# remark #193: zero used for undefined preprocessing identifier 1952# remark #593: variable "curs_sb_left_arrow" was set but never used 1953# remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits 1954# remark #869: parameter "tw" was never referenced 1955# remark #981: operands are evaluated in unspecified order 1956# warning #279: controlling expression is constant 1957 1958 AC_CHECKING([for $CC warning options]) 1959 cf_save_CFLAGS="$CFLAGS" 1960 EXTRA_CFLAGS="-Wall" 1961 for cf_opt in \ 1962 wd1419 \ 1963 wd1683 \ 1964 wd1684 \ 1965 wd193 \ 1966 wd593 \ 1967 wd279 \ 1968 wd810 \ 1969 wd869 \ 1970 wd981 1971 do 1972 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" 1973 if AC_TRY_EVAL(ac_compile); then 1974 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt) 1975 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" 1976 fi 1977 done 1978 CFLAGS="$cf_save_CFLAGS" 1979 1980elif test "$GCC" = yes 1981then 1982 AC_CHECKING([for $CC warning options]) 1983 cf_save_CFLAGS="$CFLAGS" 1984 EXTRA_CFLAGS= 1985 cf_warn_CONST="" 1986 test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings" 1987 for cf_opt in W Wall \ 1988 Wbad-function-cast \ 1989 Wcast-align \ 1990 Wcast-qual \ 1991 Winline \ 1992 Wmissing-declarations \ 1993 Wmissing-prototypes \ 1994 Wnested-externs \ 1995 Wpointer-arith \ 1996 Wshadow \ 1997 Wstrict-prototypes \ 1998 Wundef $cf_warn_CONST $1 1999 do 2000 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" 2001 if AC_TRY_EVAL(ac_compile); then 2002 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt) 2003 case $cf_opt in #(vi 2004 Wcast-qual) #(vi 2005 CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES" 2006 ;; 2007 Winline) #(vi 2008 case $GCC_VERSION in 2009 [[34]].*) 2010 CF_VERBOSE(feature is broken in gcc $GCC_VERSION) 2011 continue;; 2012 esac 2013 ;; 2014 esac 2015 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" 2016 fi 2017 done 2018 CFLAGS="$cf_save_CFLAGS" 2019fi 2020rm -rf conftest* 2021 2022AC_SUBST(EXTRA_CFLAGS) 2023])dnl 2024dnl --------------------------------------------------------------------------- 2025dnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07 2026dnl ------------- 2027dnl Check if we must define _GNU_SOURCE to get a reasonable value for 2028dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect 2029dnl (or misfeature) of glibc2, which breaks portability of many applications, 2030dnl since it is interwoven with GNU extensions. 2031dnl 2032dnl Well, yes we could work around it... 2033AC_DEFUN([CF_GNU_SOURCE], 2034[ 2035AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[ 2036AC_TRY_COMPILE([#include <sys/types.h>],[ 2037#ifndef _XOPEN_SOURCE 2038make an error 2039#endif], 2040 [cf_cv_gnu_source=no], 2041 [cf_save="$CPPFLAGS" 2042 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" 2043 AC_TRY_COMPILE([#include <sys/types.h>],[ 2044#ifdef _XOPEN_SOURCE 2045make an error 2046#endif], 2047 [cf_cv_gnu_source=no], 2048 [cf_cv_gnu_source=yes]) 2049 CPPFLAGS="$cf_save" 2050 ]) 2051]) 2052test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" 2053])dnl 2054dnl --------------------------------------------------------------------------- 2055dnl CF_HEADERS_SH version: 1 updated: 2007/07/04 15:37:05 2056dnl ------------- 2057dnl Setup variables needed to construct headers-sh 2058AC_DEFUN([CF_HEADERS_SH],[ 2059PACKAGE_PREFIX=$1 2060PACKAGE_CONFIG=$2 2061AC_SUBST(PACKAGE_PREFIX) 2062AC_SUBST(PACKAGE_CONFIG) 2063EXTRA_OUTPUT="$EXTRA_OUTPUT headers-sh:$srcdir/headers-sh.in" 2064]) 2065dnl --------------------------------------------------------------------------- 2066dnl CF_HEADER_PATH version: 12 updated: 2010/05/05 05:22:40 2067dnl -------------- 2068dnl Construct a search-list of directories for a nonstandard header-file 2069dnl 2070dnl Parameters 2071dnl $1 = the variable to return as result 2072dnl $2 = the package name 2073AC_DEFUN([CF_HEADER_PATH], 2074[ 2075$1= 2076 2077# collect the current set of include-directories from compiler flags 2078cf_header_path_list="" 2079if test -n "${CFLAGS}${CPPFLAGS}" ; then 2080 for cf_header_path in $CPPFLAGS $CFLAGS 2081 do 2082 case $cf_header_path in #(vi 2083 -I*) 2084 cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'` 2085 CF_ADD_SUBDIR_PATH($1,$2,include,$cf_header_path,NONE) 2086 cf_header_path_list="$cf_header_path_list [$]$1" 2087 ;; 2088 esac 2089 done 2090fi 2091 2092# add the variations for the package we are looking for 2093CF_SUBDIR_PATH($1,$2,include) 2094 2095test "$includedir" != NONE && \ 2096test "$includedir" != "/usr/include" && \ 2097test -d "$includedir" && { 2098 test -d $includedir && $1="[$]$1 $includedir" 2099 test -d $includedir/$2 && $1="[$]$1 $includedir/$2" 2100} 2101 2102test "$oldincludedir" != NONE && \ 2103test "$oldincludedir" != "/usr/include" && \ 2104test -d "$oldincludedir" && { 2105 test -d $oldincludedir && $1="[$]$1 $oldincludedir" 2106 test -d $oldincludedir/$2 && $1="[$]$1 $oldincludedir/$2" 2107} 2108 2109$1="[$]$1 $cf_header_path_list" 2110])dnl 2111dnl --------------------------------------------------------------------------- 2112dnl CF_HELP_MESSAGE version: 3 updated: 1998/01/14 10:56:23 2113dnl --------------- 2114dnl Insert text into the help-message, for readability, from AC_ARG_WITH. 2115AC_DEFUN([CF_HELP_MESSAGE], 2116[AC_DIVERT_HELP([$1])dnl 2117])dnl 2118dnl --------------------------------------------------------------------------- 2119dnl CF_INCLUDE_DIRS version: 6 updated: 2009/01/06 19:37:40 2120dnl --------------- 2121dnl Construct the list of include-options according to whether we're building 2122dnl in the source directory or using '--srcdir=DIR' option. If we're building 2123dnl with gcc, don't append the includedir if it happens to be /usr/include, 2124dnl since that usually breaks gcc's shadow-includes. 2125AC_DEFUN([CF_INCLUDE_DIRS], 2126[ 2127CPPFLAGS="$CPPFLAGS -I. -I../include" 2128if test "$srcdir" != "."; then 2129 CPPFLAGS="$CPPFLAGS -I\${srcdir}/../include" 2130fi 2131if test "$GCC" != yes; then 2132 CPPFLAGS="$CPPFLAGS -I\${includedir}" 2133elif test "$includedir" != "/usr/include"; then 2134 if test "$includedir" = '${prefix}/include' ; then 2135 if test $prefix != /usr ; then 2136 CPPFLAGS="$CPPFLAGS -I\${includedir}" 2137 fi 2138 else 2139 CPPFLAGS="$CPPFLAGS -I\${includedir}" 2140 fi 2141fi 2142AC_SUBST(CPPFLAGS) 2143])dnl 2144dnl --------------------------------------------------------------------------- 2145dnl CF_INCLUDE_PATH version: 5 updated: 2010/01/17 20:36:17 2146dnl --------------- 2147dnl Adds to the include-path 2148dnl 2149dnl Autoconf 1.11 should have provided a way to add include path options to 2150dnl the cpp-tests. 2151dnl 2152AC_DEFUN([CF_INCLUDE_PATH], 2153[ 2154$1= 2155for cf_path in $1 2156do 2157 cf_result="no" 2158 AC_MSG_CHECKING(for directory $cf_path) 2159 if test -d $cf_path 2160 then 2161 INCLUDES="$INCLUDES -I$cf_path" 2162 ac_cpp="${ac_cpp} -I$cf_path" 2163 CFLAGS="$CFLAGS -I$cf_path" 2164 cf_result="yes" 2165 case $cf_path in 2166 /usr/include|/usr/include/*) 2167 ;; 2168 *) 2169 CF_DIRNAME(cf_temp,$cf_path) 2170 case $cf_temp in 2171 */include) 2172 INCLUDES="$INCLUDES -I$cf_temp" 2173 ac_cpp="${ac_cpp} -I$cf_temp" 2174 CFLAGS="$CFLAGS -I$cf_temp" 2175 ;; 2176 esac 2177 esac 2178 fi 2179 AC_MSG_RESULT($cf_result) 2180done 2181])dnl 2182dnl --------------------------------------------------------------------------- 2183dnl CF_INTEL_COMPILER version: 4 updated: 2010/05/26 05:38:42 2184dnl ----------------- 2185dnl Check if the given compiler is really the Intel compiler for Linux. It 2186dnl tries to imitate gcc, but does not return an error when it finds a mismatch 2187dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK. 2188dnl 2189dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to 2190dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from 2191dnl the wrappers for gcc and g++ warnings. 2192dnl 2193dnl $1 = GCC (default) or GXX 2194dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS 2195dnl $3 = CFLAGS (default) or CXXFLAGS 2196AC_DEFUN([CF_INTEL_COMPILER],[ 2197ifelse([$2],,INTEL_COMPILER,[$2])=no 2198 2199if test "$ifelse([$1],,[$1],GCC)" = yes ; then 2200 case $host_os in 2201 linux*|gnu*) 2202 AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler) 2203 cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" 2204 ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc" 2205 AC_TRY_COMPILE([],[ 2206#ifdef __INTEL_COMPILER 2207#else 2208make an error 2209#endif 2210],[ifelse([$2],,INTEL_COMPILER,[$2])=yes 2211cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc" 2212],[]) 2213 ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" 2214 AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2])) 2215 ;; 2216 esac 2217fi 2218])dnl 2219dnl --------------------------------------------------------------------------- 2220dnl CF_LARGEFILE version: 7 updated: 2007/06/02 11:58:50 2221dnl ------------ 2222dnl Add checks for large file support. 2223AC_DEFUN([CF_LARGEFILE],[ 2224ifdef([AC_FUNC_FSEEKO],[ 2225 AC_SYS_LARGEFILE 2226 if test "$enable_largefile" != no ; then 2227 AC_FUNC_FSEEKO 2228 2229 # Normally we would collect these definitions in the config.h, 2230 # but (like _XOPEN_SOURCE), some environments rely on having these 2231 # defined before any of the system headers are included. Another 2232 # case comes up with C++, e.g., on AIX the compiler compiles the 2233 # header files by themselves before looking at the body files it is 2234 # told to compile. For ncurses, those header files do not include 2235 # the config.h 2236 test "$ac_cv_sys_large_files" != no && CPPFLAGS="$CPPFLAGS -D_LARGE_FILES " 2237 test "$ac_cv_sys_largefile_source" != no && CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE " 2238 test "$ac_cv_sys_file_offset_bits" != no && CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits " 2239 2240 AC_CACHE_CHECK(whether to use struct dirent64, cf_cv_struct_dirent64,[ 2241 AC_TRY_COMPILE([ 2242#include <sys/types.h> 2243#include <dirent.h> 2244 ],[ 2245 /* if transitional largefile support is setup, this is true */ 2246 extern struct dirent64 * readdir(DIR *); 2247 struct dirent64 *x = readdir((DIR *)0); 2248 struct dirent *y = readdir((DIR *)0); 2249 int z = x - y; 2250 ], 2251 [cf_cv_struct_dirent64=yes], 2252 [cf_cv_struct_dirent64=no]) 2253 ]) 2254 test "$cf_cv_struct_dirent64" = yes && AC_DEFINE(HAVE_STRUCT_DIRENT64) 2255 fi 2256]) 2257]) 2258dnl --------------------------------------------------------------------------- 2259dnl CF_LD_RPATH_OPT version: 3 updated: 2010/06/02 05:03:05 2260dnl --------------- 2261dnl For the given system and compiler, find the compiler flags to pass to the 2262dnl loader to use the "rpath" feature. 2263AC_DEFUN([CF_LD_RPATH_OPT], 2264[ 2265AC_REQUIRE([CF_CHECK_CACHE]) 2266 2267LD_RPATH_OPT= 2268AC_MSG_CHECKING(for an rpath option) 2269case $cf_cv_system_name in #(vi 2270irix*) #(vi 2271 if test "$GCC" = yes; then 2272 LD_RPATH_OPT="-Wl,-rpath," 2273 else 2274 LD_RPATH_OPT="-rpath " 2275 fi 2276 ;; 2277linux*|gnu*|k*bsd*-gnu) #(vi 2278 LD_RPATH_OPT="-Wl,-rpath," 2279 ;; 2280openbsd[[2-9]].*) #(vi 2281 LD_RPATH_OPT="-Wl,-rpath," 2282 ;; 2283freebsd*) #(vi 2284 LD_RPATH_OPT="-rpath " 2285 ;; 2286netbsd*) #(vi 2287 LD_RPATH_OPT="-Wl,-rpath," 2288 ;; 2289osf*|mls+*) #(vi 2290 LD_RPATH_OPT="-rpath " 2291 ;; 2292solaris2*) #(vi 2293 LD_RPATH_OPT="-R" 2294 ;; 2295*) 2296 ;; 2297esac 2298AC_MSG_RESULT($LD_RPATH_OPT) 2299 2300case "x$LD_RPATH_OPT" in #(vi 2301x-R*) 2302 AC_MSG_CHECKING(if we need a space after rpath option) 2303 cf_save_LIBS="$LIBS" 2304 CF_ADD_LIBS(${LD_RPATH_OPT}$libdir) 2305 AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes) 2306 LIBS="$cf_save_LIBS" 2307 AC_MSG_RESULT($cf_rpath_space) 2308 test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT " 2309 ;; 2310esac 2311])dnl 2312dnl --------------------------------------------------------------------------- 2313dnl CF_LIBRARY_PATH version: 9 updated: 2010/03/28 12:52:50 2314dnl --------------- 2315dnl Construct a search-list of directories for a nonstandard library-file 2316dnl 2317dnl Parameters 2318dnl $1 = the variable to return as result 2319dnl $2 = the package name 2320AC_DEFUN([CF_LIBRARY_PATH], 2321[ 2322$1= 2323cf_library_path_list="" 2324if test -n "${LDFLAGS}${LIBS}" ; then 2325 for cf_library_path in $LDFLAGS $LIBS 2326 do 2327 case $cf_library_path in #(vi 2328 -L*) 2329 cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'` 2330 CF_ADD_SUBDIR_PATH($1,$2,lib,$cf_library_path,NONE) 2331 cf_library_path_list="$cf_library_path_list [$]$1" 2332 ;; 2333 esac 2334 done 2335fi 2336 2337CF_SUBDIR_PATH($1,$2,lib) 2338 2339$1="$cf_library_path_list [$]$1" 2340])dnl 2341dnl --------------------------------------------------------------------------- 2342dnl CF_LIB_PREFIX version: 8 updated: 2008/09/13 11:34:16 2343dnl ------------- 2344dnl Compute the library-prefix for the given host system 2345dnl $1 = variable to set 2346AC_DEFUN([CF_LIB_PREFIX], 2347[ 2348 case $cf_cv_system_name in #(vi 2349 OS/2*|os2*) #(vi 2350 LIB_PREFIX='' 2351 ;; 2352 *) LIB_PREFIX='lib' 2353 ;; 2354 esac 2355ifelse($1,,,[$1=$LIB_PREFIX]) 2356 AC_SUBST(LIB_PREFIX) 2357])dnl 2358dnl --------------------------------------------------------------------------- 2359dnl CF_MAKEFLAGS version: 13 updated: 2010/10/23 15:52:32 2360dnl ------------ 2361dnl Some 'make' programs support ${MAKEFLAGS}, some ${MFLAGS}, to pass 'make' 2362dnl options to lower-levels. It's very useful for "make -n" -- if we have it. 2363dnl (GNU 'make' does both, something POSIX 'make', which happens to make the 2364dnl ${MAKEFLAGS} variable incompatible because it adds the assignments :-) 2365AC_DEFUN([CF_MAKEFLAGS], 2366[ 2367AC_CACHE_CHECK(for makeflags variable, cf_cv_makeflags,[ 2368 cf_cv_makeflags='' 2369 for cf_option in '-${MAKEFLAGS}' '${MFLAGS}' 2370 do 2371 cat >cf_makeflags.tmp <<CF_EOF 2372SHELL = /bin/sh 2373all : 2374 @ echo '.$cf_option' 2375CF_EOF 2376 cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp 2>/dev/null | sed -e 's,[[ ]]*$,,'` 2377 case "$cf_result" in 2378 .*k) 2379 cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp CC=cc 2>/dev/null` 2380 case "$cf_result" in 2381 .*CC=*) cf_cv_makeflags= 2382 ;; 2383 *) cf_cv_makeflags=$cf_option 2384 ;; 2385 esac 2386 break 2387 ;; 2388 .-) ;; 2389 *) echo "given option \"$cf_option\", no match \"$cf_result\"" 2390 ;; 2391 esac 2392 done 2393 rm -f cf_makeflags.tmp 2394]) 2395 2396AC_SUBST(cf_cv_makeflags) 2397])dnl 2398dnl --------------------------------------------------------------------------- 2399dnl CF_MAKE_TAGS version: 6 updated: 2010/10/23 15:52:32 2400dnl ------------ 2401dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have 2402dnl a monocase filesystem. 2403AC_DEFUN([CF_MAKE_TAGS],[ 2404AC_REQUIRE([CF_MIXEDCASE_FILENAMES]) 2405 2406AC_CHECK_PROGS(CTAGS, exctags ctags) 2407AC_CHECK_PROGS(ETAGS, exetags etags) 2408 2409AC_CHECK_PROG(MAKE_LOWER_TAGS, ${CTAGS:-ctags}, yes, no) 2410 2411if test "$cf_cv_mixedcase" = yes ; then 2412 AC_CHECK_PROG(MAKE_UPPER_TAGS, ${ETAGS:-etags}, yes, no) 2413else 2414 MAKE_UPPER_TAGS=no 2415fi 2416 2417if test "$MAKE_UPPER_TAGS" = yes ; then 2418 MAKE_UPPER_TAGS= 2419else 2420 MAKE_UPPER_TAGS="#" 2421fi 2422 2423if test "$MAKE_LOWER_TAGS" = yes ; then 2424 MAKE_LOWER_TAGS= 2425else 2426 MAKE_LOWER_TAGS="#" 2427fi 2428 2429AC_SUBST(CTAGS) 2430AC_SUBST(ETAGS) 2431 2432AC_SUBST(MAKE_UPPER_TAGS) 2433AC_SUBST(MAKE_LOWER_TAGS) 2434])dnl 2435dnl --------------------------------------------------------------------------- 2436dnl CF_MATH_LIB version: 8 updated: 2010/05/29 16:31:02 2437dnl ----------- 2438dnl Checks for libraries. At least one UNIX system, Apple Macintosh 2439dnl Rhapsody 5.5, does not have -lm. We cannot use the simpler 2440dnl AC_CHECK_LIB(m,sin), because that fails for C++. 2441AC_DEFUN([CF_MATH_LIB], 2442[ 2443AC_CACHE_CHECK(if -lm needed for math functions, 2444 cf_cv_need_libm,[ 2445 AC_TRY_LINK([ 2446 #include <stdio.h> 2447 #include <math.h> 2448 ], 2449 [double x = rand(); printf("result = %g\n", ]ifelse([$2],,sin(x),$2)[)], 2450 [cf_cv_need_libm=no], 2451 [cf_cv_need_libm=yes])]) 2452if test "$cf_cv_need_libm" = yes 2453then 2454ifelse($1,,[ 2455 CF_ADD_LIB(m) 2456],[$1=-lm]) 2457fi 2458]) 2459dnl --------------------------------------------------------------------------- 2460dnl CF_MBSTATE_T version: 3 updated: 2007/03/25 15:55:36 2461dnl ------------ 2462dnl Check if mbstate_t is declared, and if so, which header file. 2463dnl This (including wchar.h) is needed on Tru64 5.0 to declare mbstate_t, 2464dnl as well as include stdio.h to work around a misuse of varargs in wchar.h 2465AC_DEFUN([CF_MBSTATE_T], 2466[ 2467AC_CACHE_CHECK(if we must include wchar.h to declare mbstate_t,cf_cv_mbstate_t,[ 2468AC_TRY_COMPILE([ 2469#include <stdlib.h> 2470#include <stdio.h> 2471#ifdef HAVE_LIBUTF8_H 2472#include <libutf8.h> 2473#endif], 2474 [mbstate_t state], 2475 [cf_cv_mbstate_t=no], 2476 [AC_TRY_COMPILE([ 2477#include <stdlib.h> 2478#include <stdio.h> 2479#include <wchar.h> 2480#ifdef HAVE_LIBUTF8_H 2481#include <libutf8.h> 2482#endif], 2483 [mbstate_t value], 2484 [cf_cv_mbstate_t=yes], 2485 [cf_cv_mbstate_t=unknown])])]) 2486 2487if test "$cf_cv_mbstate_t" = yes ; then 2488 AC_DEFINE(NEED_WCHAR_H) 2489fi 2490 2491if test "$cf_cv_mbstate_t" != unknown ; then 2492 AC_DEFINE(HAVE_MBSTATE_T) 2493fi 2494])dnl 2495dnl --------------------------------------------------------------------------- 2496dnl CF_MIXEDCASE_FILENAMES version: 3 updated: 2003/09/20 17:07:55 2497dnl ---------------------- 2498dnl Check if the file-system supports mixed-case filenames. If we're able to 2499dnl create a lowercase name and see it as uppercase, it doesn't support that. 2500AC_DEFUN([CF_MIXEDCASE_FILENAMES], 2501[ 2502AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[ 2503if test "$cross_compiling" = yes ; then 2504 case $target_alias in #(vi 2505 *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-mingw32*|*-uwin*) #(vi 2506 cf_cv_mixedcase=no 2507 ;; 2508 *) 2509 cf_cv_mixedcase=yes 2510 ;; 2511 esac 2512else 2513 rm -f conftest CONFTEST 2514 echo test >conftest 2515 if test -f CONFTEST ; then 2516 cf_cv_mixedcase=no 2517 else 2518 cf_cv_mixedcase=yes 2519 fi 2520 rm -f conftest CONFTEST 2521fi 2522]) 2523test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES) 2524])dnl 2525dnl --------------------------------------------------------------------------- 2526dnl CF_MSG_LOG version: 5 updated: 2010/10/23 15:52:32 2527dnl ---------- 2528dnl Write a debug message to config.log, along with the line number in the 2529dnl configure script. 2530AC_DEFUN([CF_MSG_LOG],[ 2531echo "${as_me:-configure}:__oline__: testing $* ..." 1>&AC_FD_CC 2532])dnl 2533dnl --------------------------------------------------------------------------- 2534dnl CF_NCURSES_CC_CHECK version: 4 updated: 2007/07/29 10:39:05 2535dnl ------------------- 2536dnl Check if we can compile with ncurses' header file 2537dnl $1 is the cache variable to set 2538dnl $2 is the header-file to include 2539dnl $3 is the root name (ncurses or ncursesw) 2540AC_DEFUN([CF_NCURSES_CC_CHECK],[ 2541 AC_TRY_COMPILE([ 2542]ifelse($3,ncursesw,[ 2543#define _XOPEN_SOURCE_EXTENDED 2544#undef HAVE_LIBUTF8_H /* in case we used CF_UTF8_LIB */ 2545#define HAVE_LIBUTF8_H /* to force ncurses' header file to use cchar_t */ 2546])[ 2547#include <$2>],[ 2548#ifdef NCURSES_VERSION 2549]ifelse($3,ncursesw,[ 2550#ifndef WACS_BSSB 2551 make an error 2552#endif 2553])[ 2554printf("%s\n", NCURSES_VERSION); 2555#else 2556#ifdef __NCURSES_H 2557printf("old\n"); 2558#else 2559 make an error 2560#endif 2561#endif 2562 ] 2563 ,[$1=$2] 2564 ,[$1=no]) 2565])dnl 2566dnl --------------------------------------------------------------------------- 2567dnl CF_NCURSES_CONFIG version: 8 updated: 2010/07/08 05:17:30 2568dnl ----------------- 2569dnl Tie together the configure-script macros for ncurses. 2570dnl Prefer the "-config" script from ncurses 6.x, to simplify analysis. 2571dnl Allow that to be overridden using the $NCURSES_CONFIG environment variable. 2572dnl 2573dnl $1 is the root library name (default: "ncurses") 2574AC_DEFUN([CF_NCURSES_CONFIG], 2575[ 2576cf_ncuconfig_root=ifelse($1,,ncurses,$1) 2577 2578echo "Looking for ${cf_ncuconfig_root}-config" 2579AC_PATH_PROGS(NCURSES_CONFIG,${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config,none) 2580 2581if test "$NCURSES_CONFIG" != none ; then 2582 2583CPPFLAGS="$CPPFLAGS `$NCURSES_CONFIG --cflags`" 2584CF_ADD_LIBS(`$NCURSES_CONFIG --libs`) 2585 2586# even with config script, some packages use no-override for curses.h 2587CF_CURSES_HEADER(ifelse($1,,ncurses,$1)) 2588 2589dnl like CF_NCURSES_CPPFLAGS 2590AC_DEFINE(NCURSES) 2591 2592dnl like CF_NCURSES_LIBS 2593CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_ncuconfig_root) 2594AC_DEFINE_UNQUOTED($cf_nculib_ROOT) 2595 2596dnl like CF_NCURSES_VERSION 2597cf_cv_ncurses_version=`$NCURSES_CONFIG --version` 2598 2599else 2600 2601CF_NCURSES_CPPFLAGS(ifelse($1,,ncurses,$1)) 2602CF_NCURSES_LIBS(ifelse($1,,ncurses,$1)) 2603 2604fi 2605])dnl 2606dnl --------------------------------------------------------------------------- 2607dnl CF_NCURSES_CPPFLAGS version: 20 updated: 2010/11/20 17:02:38 2608dnl ------------------- 2609dnl Look for the SVr4 curses clone 'ncurses' in the standard places, adjusting 2610dnl the CPPFLAGS variable so we can include its header. 2611dnl 2612dnl The header files may be installed as either curses.h, or ncurses.h (would 2613dnl be obsolete, except that some packagers prefer this name to distinguish it 2614dnl from a "native" curses implementation). If not installed for overwrite, 2615dnl the curses.h file would be in an ncurses subdirectory (e.g., 2616dnl /usr/include/ncurses), but someone may have installed overwriting the 2617dnl vendor's curses. Only very old versions (pre-1.9.2d, the first autoconf'd 2618dnl version) of ncurses don't define either __NCURSES_H or NCURSES_VERSION in 2619dnl the header. 2620dnl 2621dnl If the installer has set $CFLAGS or $CPPFLAGS so that the ncurses header 2622dnl is already in the include-path, don't even bother with this, since we cannot 2623dnl easily determine which file it is. In this case, it has to be <curses.h>. 2624dnl 2625dnl The optional parameter gives the root name of the library, in case it is 2626dnl not installed as the default curses library. That is how the 2627dnl wide-character version of ncurses is installed. 2628AC_DEFUN([CF_NCURSES_CPPFLAGS], 2629[AC_REQUIRE([CF_WITH_CURSES_DIR]) 2630 2631AC_PROVIDE([CF_CURSES_CPPFLAGS])dnl 2632cf_ncuhdr_root=ifelse($1,,ncurses,$1) 2633 2634test -n "$cf_cv_curses_dir" && \ 2635test "$cf_cv_curses_dir" != "no" && { \ 2636 CF_ADD_INCDIR($cf_cv_curses_dir/include/$cf_ncuhdr_root) 2637} 2638 2639AC_CACHE_CHECK(for $cf_ncuhdr_root header in include-path, cf_cv_ncurses_h,[ 2640 cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h" 2641 ( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h" 2642 for cf_header in $cf_header_list 2643 do 2644 CF_NCURSES_CC_CHECK(cf_cv_ncurses_h,$cf_header,$1) 2645 test "$cf_cv_ncurses_h" != no && break 2646 done 2647]) 2648 2649CF_NCURSES_HEADER 2650CF_TERM_HEADER 2651 2652# some applications need this, but should check for NCURSES_VERSION 2653AC_DEFINE(NCURSES) 2654 2655CF_NCURSES_VERSION 2656])dnl 2657dnl --------------------------------------------------------------------------- 2658dnl CF_NCURSES_HEADER version: 2 updated: 2008/03/23 14:48:54 2659dnl ----------------- 2660dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common 2661dnl variations of ncurses' installs. 2662dnl 2663dnl See also CF_CURSES_HEADER, which sets the same cache variable. 2664AC_DEFUN([CF_NCURSES_HEADER],[ 2665 2666if test "$cf_cv_ncurses_h" != no ; then 2667 cf_cv_ncurses_header=$cf_cv_ncurses_h 2668else 2669 2670AC_CACHE_CHECK(for $cf_ncuhdr_root include-path, cf_cv_ncurses_h2,[ 2671 test -n "$verbose" && echo 2672 CF_HEADER_PATH(cf_search,$cf_ncuhdr_root) 2673 test -n "$verbose" && echo search path $cf_search 2674 cf_save2_CPPFLAGS="$CPPFLAGS" 2675 for cf_incdir in $cf_search 2676 do 2677 CF_ADD_INCDIR($cf_incdir) 2678 for cf_header in \ 2679 ncurses.h \ 2680 curses.h 2681 do 2682 CF_NCURSES_CC_CHECK(cf_cv_ncurses_h2,$cf_header,$1) 2683 if test "$cf_cv_ncurses_h2" != no ; then 2684 cf_cv_ncurses_h2=$cf_incdir/$cf_header 2685 test -n "$verbose" && echo $ac_n " ... found $ac_c" 1>&AC_FD_MSG 2686 break 2687 fi 2688 test -n "$verbose" && echo " ... tested $cf_incdir/$cf_header" 1>&AC_FD_MSG 2689 done 2690 CPPFLAGS="$cf_save2_CPPFLAGS" 2691 test "$cf_cv_ncurses_h2" != no && break 2692 done 2693 test "$cf_cv_ncurses_h2" = no && AC_MSG_ERROR(not found) 2694 ]) 2695 2696 CF_DIRNAME(cf_1st_incdir,$cf_cv_ncurses_h2) 2697 cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2` 2698 if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then 2699 cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header 2700 fi 2701 CF_ADD_INCDIR($cf_1st_incdir) 2702 2703fi 2704 2705# Set definitions to allow ifdef'ing for ncurses.h 2706 2707case $cf_cv_ncurses_header in # (vi 2708*ncurses.h) 2709 AC_DEFINE(HAVE_NCURSES_H) 2710 ;; 2711esac 2712 2713case $cf_cv_ncurses_header in # (vi 2714ncurses/curses.h|ncurses/ncurses.h) 2715 AC_DEFINE(HAVE_NCURSES_NCURSES_H) 2716 ;; 2717ncursesw/curses.h|ncursesw/ncurses.h) 2718 AC_DEFINE(HAVE_NCURSESW_NCURSES_H) 2719 ;; 2720esac 2721 2722])dnl 2723dnl --------------------------------------------------------------------------- 2724dnl CF_NCURSES_LIBS version: 16 updated: 2010/11/20 17:02:38 2725dnl --------------- 2726dnl Look for the ncurses library. This is a little complicated on Linux, 2727dnl because it may be linked with the gpm (general purpose mouse) library. 2728dnl Some distributions have gpm linked with (bsd) curses, which makes it 2729dnl unusable with ncurses. However, we don't want to link with gpm unless 2730dnl ncurses has a dependency, since gpm is normally set up as a shared library, 2731dnl and the linker will record a dependency. 2732dnl 2733dnl The optional parameter gives the root name of the library, in case it is 2734dnl not installed as the default curses library. That is how the 2735dnl wide-character version of ncurses is installed. 2736AC_DEFUN([CF_NCURSES_LIBS], 2737[AC_REQUIRE([CF_NCURSES_CPPFLAGS]) 2738 2739cf_nculib_root=ifelse($1,,ncurses,$1) 2740 # This works, except for the special case where we find gpm, but 2741 # ncurses is in a nonstandard location via $LIBS, and we really want 2742 # to link gpm. 2743cf_ncurses_LIBS="" 2744cf_ncurses_SAVE="$LIBS" 2745AC_CHECK_LIB(gpm,Gpm_Open, 2746 [AC_CHECK_LIB(gpm,initscr, 2747 [LIBS="$cf_ncurses_SAVE"], 2748 [cf_ncurses_LIBS="-lgpm"])]) 2749 2750case $host_os in #(vi 2751freebsd*) 2752 # This is only necessary if you are linking against an obsolete 2753 # version of ncurses (but it should do no harm, since it's static). 2754 if test "$cf_nculib_root" = ncurses ; then 2755 AC_CHECK_LIB(mytinfo,tgoto,[cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS"]) 2756 fi 2757 ;; 2758esac 2759 2760CF_ADD_LIBS($cf_ncurses_LIBS) 2761 2762if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" ) 2763then 2764 CF_ADD_LIBS(-l$cf_nculib_root) 2765else 2766 CF_FIND_LIBRARY($cf_nculib_root,$cf_nculib_root, 2767 [#include <${cf_cv_ncurses_header:-curses.h}>], 2768 [initscr()], 2769 initscr) 2770fi 2771 2772if test -n "$cf_ncurses_LIBS" ; then 2773 AC_MSG_CHECKING(if we can link $cf_nculib_root without $cf_ncurses_LIBS) 2774 cf_ncurses_SAVE="$LIBS" 2775 for p in $cf_ncurses_LIBS ; do 2776 q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"` 2777 if test "$q" != "$LIBS" ; then 2778 LIBS="$q" 2779 fi 2780 done 2781 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], 2782 [initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);], 2783 [AC_MSG_RESULT(yes)], 2784 [AC_MSG_RESULT(no) 2785 LIBS="$cf_ncurses_SAVE"]) 2786fi 2787 2788CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_nculib_root) 2789AC_DEFINE_UNQUOTED($cf_nculib_ROOT) 2790])dnl 2791dnl --------------------------------------------------------------------------- 2792dnl CF_NCURSES_VERSION version: 13 updated: 2010/10/23 15:54:49 2793dnl ------------------ 2794dnl Check for the version of ncurses, to aid in reporting bugs, etc. 2795dnl Call CF_CURSES_CPPFLAGS first, or CF_NCURSES_CPPFLAGS. We don't use 2796dnl AC_REQUIRE since that does not work with the shell's if/then/else/fi. 2797AC_DEFUN([CF_NCURSES_VERSION], 2798[ 2799AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl 2800AC_CACHE_CHECK(for ncurses version, cf_cv_ncurses_version,[ 2801 cf_cv_ncurses_version=no 2802 cf_tempfile=out$$ 2803 rm -f $cf_tempfile 2804 AC_TRY_RUN([ 2805#include <${cf_cv_ncurses_header:-curses.h}> 2806#include <stdio.h> 2807int main() 2808{ 2809 FILE *fp = fopen("$cf_tempfile", "w"); 2810#ifdef NCURSES_VERSION 2811# ifdef NCURSES_VERSION_PATCH 2812 fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH); 2813# else 2814 fprintf(fp, "%s\n", NCURSES_VERSION); 2815# endif 2816#else 2817# ifdef __NCURSES_H 2818 fprintf(fp, "old\n"); 2819# else 2820 make an error 2821# endif 2822#endif 2823 ${cf_cv_main_return:-return}(0); 2824}],[ 2825 cf_cv_ncurses_version=`cat $cf_tempfile`],,[ 2826 2827 # This will not work if the preprocessor splits the line after the 2828 # Autoconf token. The 'unproto' program does that. 2829 cat > conftest.$ac_ext <<EOF 2830#include <${cf_cv_ncurses_header:-curses.h}> 2831#undef Autoconf 2832#ifdef NCURSES_VERSION 2833Autoconf NCURSES_VERSION 2834#else 2835#ifdef __NCURSES_H 2836Autoconf "old" 2837#endif 2838; 2839#endif 2840EOF 2841 cf_try="$ac_cpp conftest.$ac_ext 2>&AC_FD_CC | grep '^Autoconf ' >conftest.out" 2842 AC_TRY_EVAL(cf_try) 2843 if test -f conftest.out ; then 2844 cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[[^"]]*"%%' -e 's%".*%%'` 2845 test -n "$cf_out" && cf_cv_ncurses_version="$cf_out" 2846 rm -f conftest.out 2847 fi 2848]) 2849 rm -f $cf_tempfile 2850]) 2851test "$cf_cv_ncurses_version" = no || AC_DEFINE(NCURSES) 2852])dnl 2853dnl --------------------------------------------------------------------------- 2854dnl CF_NO_LEAKS_OPTION version: 4 updated: 2006/12/16 14:24:05 2855dnl ------------------ 2856dnl see CF_WITH_NO_LEAKS 2857AC_DEFUN([CF_NO_LEAKS_OPTION],[ 2858AC_MSG_CHECKING(if you want to use $1 for testing) 2859AC_ARG_WITH($1, 2860 [$2], 2861 [AC_DEFINE($3)ifelse([$4],,[ 2862 $4 2863]) 2864 : ${with_cflags:=-g} 2865 : ${with_no_leaks:=yes} 2866 with_$1=yes], 2867 [with_$1=]) 2868AC_MSG_RESULT(${with_$1:-no}) 2869 2870case .$with_cflags in #(vi 2871.*-g*) 2872 case .$CFLAGS in #(vi 2873 .*-g*) #(vi 2874 ;; 2875 *) 2876 CF_ADD_CFLAGS([-g]) 2877 ;; 2878 esac 2879 ;; 2880esac 2881])dnl 2882dnl --------------------------------------------------------------------------- 2883dnl CF_OUR_MESSAGES version: 7 updated: 2004/09/12 19:45:55 2884dnl --------------- 2885dnl Check if we use the messages included with this program 2886dnl 2887dnl $1 specifies either Makefile or makefile, defaulting to the former. 2888dnl 2889dnl Sets variables which can be used to substitute in makefiles: 2890dnl MSG_DIR_MAKE - to make ./po directory 2891dnl SUB_MAKEFILE - makefile in ./po directory (see CF_BUNDLED_INTL) 2892dnl 2893AC_DEFUN([CF_OUR_MESSAGES], 2894[ 2895cf_makefile=ifelse($1,,Makefile,$1) 2896 2897use_our_messages=no 2898if test "$USE_NLS" = yes ; then 2899if test -d $srcdir/po ; then 2900AC_MSG_CHECKING(if we should use included message-library) 2901 AC_ARG_ENABLE(included-msgs, 2902 [ --disable-included-msgs use included messages, for i18n support], 2903 [use_our_messages=$enableval], 2904 [use_our_messages=yes]) 2905fi 2906AC_MSG_RESULT($use_our_messages) 2907fi 2908 2909MSG_DIR_MAKE="#" 2910if test "$use_our_messages" = yes 2911then 2912 SUB_MAKEFILE="$SUB_MAKEFILE po/$cf_makefile.in:$srcdir/po/$cf_makefile.inn" 2913 MSG_DIR_MAKE= 2914fi 2915 2916AC_SUBST(MSG_DIR_MAKE) 2917AC_SUBST(SUB_MAKEFILE) 2918])dnl 2919dnl --------------------------------------------------------------------------- 2920dnl CF_PATHSEP version: 5 updated: 2010/05/26 05:38:42 2921dnl ---------- 2922dnl Provide a value for the $PATH and similar separator 2923AC_DEFUN([CF_PATHSEP], 2924[ 2925 case $cf_cv_system_name in 2926 os2*) PATH_SEPARATOR=';' ;; 2927 *) PATH_SEPARATOR=':' ;; 2928 esac 2929ifelse([$1],,,[$1=$PATH_SEPARATOR]) 2930 AC_SUBST(PATH_SEPARATOR) 2931])dnl 2932dnl --------------------------------------------------------------------------- 2933dnl CF_PATH_SYNTAX version: 13 updated: 2010/05/26 05:38:42 2934dnl -------------- 2935dnl Check the argument to see that it looks like a pathname. Rewrite it if it 2936dnl begins with one of the prefix/exec_prefix variables, and then again if the 2937dnl result begins with 'NONE'. This is necessary to work around autoconf's 2938dnl delayed evaluation of those symbols. 2939AC_DEFUN([CF_PATH_SYNTAX],[ 2940if test "x$prefix" != xNONE; then 2941 cf_path_syntax="$prefix" 2942else 2943 cf_path_syntax="$ac_default_prefix" 2944fi 2945 2946case ".[$]$1" in #(vi 2947.\[$]\(*\)*|.\'*\'*) #(vi 2948 ;; 2949..|./*|.\\*) #(vi 2950 ;; 2951.[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX 2952 ;; 2953.\[$]{*prefix}*) #(vi 2954 eval $1="[$]$1" 2955 case ".[$]$1" in #(vi 2956 .NONE/*) 2957 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%` 2958 ;; 2959 esac 2960 ;; #(vi 2961.no|.NONE/*) 2962 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%` 2963 ;; 2964*) 2965 ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2) 2966 ;; 2967esac 2968])dnl 2969dnl --------------------------------------------------------------------------- 2970dnl CF_POSIX_C_SOURCE version: 8 updated: 2010/05/26 05:38:42 2971dnl ----------------- 2972dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed. 2973dnl 2974dnl POSIX.1-1990 _POSIX_SOURCE 2975dnl POSIX.1-1990 and _POSIX_SOURCE and 2976dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2 2977dnl Bindings Option 2978dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L 2979dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L 2980dnl X/Open 2000 _POSIX_C_SOURCE=200112L 2981dnl 2982dnl Parameters: 2983dnl $1 is the nominal value for _POSIX_C_SOURCE 2984AC_DEFUN([CF_POSIX_C_SOURCE], 2985[ 2986cf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1]) 2987 2988cf_save_CFLAGS="$CFLAGS" 2989cf_save_CPPFLAGS="$CPPFLAGS" 2990 2991CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE) 2992CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE) 2993 2994AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[ 2995 CF_MSG_LOG(if the symbol is already defined go no further) 2996 AC_TRY_COMPILE([#include <sys/types.h>],[ 2997#ifndef _POSIX_C_SOURCE 2998make an error 2999#endif], 3000 [cf_cv_posix_c_source=no], 3001 [cf_want_posix_source=no 3002 case .$cf_POSIX_C_SOURCE in #(vi 3003 .[[12]]??*) #(vi 3004 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" 3005 ;; 3006 .2) #(vi 3007 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" 3008 cf_want_posix_source=yes 3009 ;; 3010 .*) 3011 cf_want_posix_source=yes 3012 ;; 3013 esac 3014 if test "$cf_want_posix_source" = yes ; then 3015 AC_TRY_COMPILE([#include <sys/types.h>],[ 3016#ifdef _POSIX_SOURCE 3017make an error 3018#endif],[], 3019 cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE") 3020 fi 3021 CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE) 3022 CFLAGS="$cf_trim_CFLAGS" 3023 CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source" 3024 CF_MSG_LOG(if the second compile does not leave our definition intact error) 3025 AC_TRY_COMPILE([#include <sys/types.h>],[ 3026#ifndef _POSIX_C_SOURCE 3027make an error 3028#endif],, 3029 [cf_cv_posix_c_source=no]) 3030 CFLAGS="$cf_save_CFLAGS" 3031 CPPFLAGS="$cf_save_CPPFLAGS" 3032 ]) 3033]) 3034 3035if test "$cf_cv_posix_c_source" != no ; then 3036 CFLAGS="$cf_trim_CFLAGS" 3037 CPPFLAGS="$cf_trim_CPPFLAGS" 3038 CF_ADD_CFLAGS($cf_cv_posix_c_source) 3039fi 3040 3041])dnl 3042dnl --------------------------------------------------------------------------- 3043dnl CF_PROG_CC_U_D version: 1 updated: 2005/07/14 16:59:30 3044dnl -------------- 3045dnl Check if C (preprocessor) -U and -D options are processed in the order 3046dnl given rather than by type of option. Some compilers insist on apply all 3047dnl of the -U options after all of the -D options. Others allow mixing them, 3048dnl and may predefine symbols that conflict with those we define. 3049AC_DEFUN([CF_PROG_CC_U_D], 3050[ 3051AC_CACHE_CHECK(if $CC -U and -D options work together,cf_cv_cc_u_d_options,[ 3052 cf_save_CPPFLAGS="$CPPFLAGS" 3053 CPPFLAGS="-UU_D_OPTIONS -DU_D_OPTIONS -DD_U_OPTIONS -UD_U_OPTIONS" 3054 AC_TRY_COMPILE([],[ 3055#ifndef U_D_OPTIONS 3056make an undefined-error 3057#endif 3058#ifdef D_U_OPTIONS 3059make a defined-error 3060#endif 3061 ],[ 3062 cf_cv_cc_u_d_options=yes],[ 3063 cf_cv_cc_u_d_options=no]) 3064 CPPFLAGS="$cf_save_CPPFLAGS" 3065]) 3066])dnl 3067dnl --------------------------------------------------------------------------- 3068dnl CF_PROG_EXT version: 10 updated: 2004/01/03 19:28:18 3069dnl ----------- 3070dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX. 3071AC_DEFUN([CF_PROG_EXT], 3072[ 3073AC_REQUIRE([CF_CHECK_CACHE]) 3074case $cf_cv_system_name in 3075os2*) 3076 CFLAGS="$CFLAGS -Zmt" 3077 CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__" 3078 CXXFLAGS="$CXXFLAGS -Zmt" 3079 # autoconf's macro sets -Zexe and suffix both, which conflict:w 3080 LDFLAGS="$LDFLAGS -Zmt -Zcrtdll" 3081 ac_cv_exeext=.exe 3082 ;; 3083esac 3084 3085AC_EXEEXT 3086AC_OBJEXT 3087 3088PROG_EXT="$EXEEXT" 3089AC_SUBST(PROG_EXT) 3090test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT") 3091])dnl 3092dnl --------------------------------------------------------------------------- 3093dnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50 3094dnl ---------------- 3095dnl Remove all -U and -D options that refer to the given symbol from a list 3096dnl of C compiler options. This works around the problem that not all 3097dnl compilers process -U and -D options from left-to-right, so a -U option 3098dnl cannot be used to cancel the effect of a preceding -D option. 3099dnl 3100dnl $1 = target (which could be the same as the source variable) 3101dnl $2 = source (including '$') 3102dnl $3 = symbol to remove 3103define([CF_REMOVE_DEFINE], 3104[ 3105$1=`echo "$2" | \ 3106 sed -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[[ ]]/ /g' \ 3107 -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'` 3108])dnl 3109dnl --------------------------------------------------------------------------- 3110dnl CF_RPATH_HACK version: 8 updated: 2010/04/17 15:38:58 3111dnl ------------- 3112AC_DEFUN([CF_RPATH_HACK], 3113[ 3114AC_REQUIRE([CF_LD_RPATH_OPT]) 3115AC_MSG_CHECKING(for updated LDFLAGS) 3116if test -n "$LD_RPATH_OPT" ; then 3117 AC_MSG_RESULT(maybe) 3118 3119 AC_CHECK_PROGS(cf_ldd_prog,ldd,no) 3120 cf_rpath_list="/usr/lib /lib" 3121 if test "$cf_ldd_prog" != no 3122 then 3123AC_TRY_LINK([#include <stdio.h>], 3124 [printf("Hello");], 3125 [cf_rpath_list=`$cf_ldd_prog conftest$ac_exeext | fgrep / | sed -e 's%^.*[[ ]]/%/%' -e 's%/[[^/]][[^/]]*$%%' |sort -u`]) 3126 fi 3127 3128 CF_VERBOSE(...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS) 3129 3130 CF_RPATH_HACK_2(LDFLAGS) 3131 CF_RPATH_HACK_2(LIBS) 3132 3133 CF_VERBOSE(...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS) 3134fi 3135AC_SUBST(EXTRA_LDFLAGS) 3136])dnl 3137dnl --------------------------------------------------------------------------- 3138dnl CF_RPATH_HACK_2 version: 6 updated: 2010/04/17 16:31:24 3139dnl --------------- 3140dnl Do one set of substitutions for CF_RPATH_HACK, adding an rpath option to 3141dnl EXTRA_LDFLAGS for each -L option found. 3142dnl 3143dnl $cf_rpath_list contains a list of directories to ignore. 3144dnl 3145dnl $1 = variable name to update. The LDFLAGS variable should be the only one, 3146dnl but LIBS often has misplaced -L options. 3147AC_DEFUN([CF_RPATH_HACK_2], 3148[ 3149CF_VERBOSE(...checking $1 [$]$1) 3150 3151cf_rpath_dst= 3152for cf_rpath_src in [$]$1 3153do 3154 case $cf_rpath_src in #(vi 3155 -L*) #(vi 3156 3157 # check if this refers to a directory which we will ignore 3158 cf_rpath_skip=no 3159 if test -n "$cf_rpath_list" 3160 then 3161 for cf_rpath_item in $cf_rpath_list 3162 do 3163 if test "x$cf_rpath_src" = "x-L$cf_rpath_item" 3164 then 3165 cf_rpath_skip=yes 3166 break 3167 fi 3168 done 3169 fi 3170 3171 if test "$cf_rpath_skip" = no 3172 then 3173 # transform the option 3174 if test "$LD_RPATH_OPT" = "-R " ; then 3175 cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%-R %"` 3176 else 3177 cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%$LD_RPATH_OPT%"` 3178 fi 3179 3180 # if we have not already added this, add it now 3181 cf_rpath_tst=`echo "$EXTRA_LDFLAGS" | sed -e "s%$cf_rpath_tmp %%"` 3182 if test "x$cf_rpath_tst" = "x$EXTRA_LDFLAGS" 3183 then 3184 CF_VERBOSE(...Filter $cf_rpath_src ->$cf_rpath_tmp) 3185 EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS" 3186 fi 3187 fi 3188 ;; 3189 esac 3190 cf_rpath_dst="$cf_rpath_dst $cf_rpath_src" 3191done 3192$1=$cf_rpath_dst 3193 3194CF_VERBOSE(...checked $1 [$]$1) 3195AC_SUBST(EXTRA_LDFLAGS) 3196])dnl 3197dnl --------------------------------------------------------------------------- 3198dnl CF_SUBDIR_PATH version: 6 updated: 2010/04/21 06:20:50 3199dnl -------------- 3200dnl Construct a search-list for a nonstandard header/lib-file 3201dnl $1 = the variable to return as result 3202dnl $2 = the package name 3203dnl $3 = the subdirectory, e.g., bin, include or lib 3204AC_DEFUN([CF_SUBDIR_PATH], 3205[ 3206$1= 3207 3208CF_ADD_SUBDIR_PATH($1,$2,$3,/usr,$prefix) 3209CF_ADD_SUBDIR_PATH($1,$2,$3,$prefix,NONE) 3210CF_ADD_SUBDIR_PATH($1,$2,$3,/usr/local,$prefix) 3211CF_ADD_SUBDIR_PATH($1,$2,$3,/opt,$prefix) 3212CF_ADD_SUBDIR_PATH($1,$2,$3,[$]HOME,$prefix) 3213])dnl 3214dnl --------------------------------------------------------------------------- 3215dnl CF_SUBST version: 4 updated: 2006/06/17 12:33:03 3216dnl -------- 3217dnl Shorthand macro for substituting things that the user may override 3218dnl with an environment variable. 3219dnl 3220dnl $1 = long/descriptive name 3221dnl $2 = environment variable 3222dnl $3 = default value 3223AC_DEFUN([CF_SUBST], 3224[AC_CACHE_VAL(cf_cv_subst_$2,[ 3225AC_MSG_CHECKING(for $1 (symbol $2)) 3226CF_SUBST_IF([-z "[$]$2"], [$2], [$3]) 3227cf_cv_subst_$2=[$]$2 3228AC_MSG_RESULT([$]$2) 3229]) 3230])dnl 3231dnl --------------------------------------------------------------------------- 3232dnl CF_SYSTYPE version: 3 updated: 2001/02/03 00:14:59 3233dnl ---------- 3234dnl Derive the system-type (our main clue to the method of building shared 3235dnl libraries). 3236AC_DEFUN([CF_SYSTYPE], 3237[ 3238AC_MSG_CHECKING(for system type) 3239AC_CACHE_VAL(cf_cv_systype,[ 3240AC_ARG_WITH(system-type, 3241[ --with-system-type=XXX test: override derived host system-type], 3242[cf_cv_systype=$withval], 3243[ 3244cf_cv_systype="`(uname -s || hostname || echo unknown) 2>/dev/null |sed -e s'/[[:\/.-]]/_/'g | sed 1q`" 3245if test -z "$cf_cv_systype"; then cf_cv_systype=unknown;fi 3246])]) 3247AC_MSG_RESULT($cf_cv_systype) 3248])dnl 3249dnl --------------------------------------------------------------------------- 3250dnl CF_SYS_NAME version: 3 updated: 2008/03/23 14:48:54 3251dnl ----------- 3252dnl Derive the system name, as a check for reusing the autoconf cache 3253AC_DEFUN([CF_SYS_NAME], 3254[ 3255SYS_NAME=`(uname -s -r || uname -a || hostname) 2>/dev/null | sed 1q` 3256test -z "$SYS_NAME" && SYS_NAME=unknown 3257AC_DEFINE_UNQUOTED(SYS_NAME,"$SYS_NAME") 3258 3259AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$SYS_NAME"]) 3260 3261if test ".$SYS_NAME" != ".$cf_cv_system_name" ; then 3262 AC_MSG_RESULT("Cached system name does not agree with actual") 3263 AC_MSG_ERROR("Please remove config.cache and try again.") 3264fi]) 3265dnl --------------------------------------------------------------------------- 3266dnl CF_TERM_HEADER version: 2 updated: 2010/10/23 15:54:49 3267dnl -------------- 3268dnl Look for term.h, which is part of X/Open curses. It defines the interface 3269dnl to terminfo database. Usually it is in the same include-path as curses.h, 3270dnl but some packagers change this, breaking various applications. 3271AC_DEFUN([CF_TERM_HEADER],[ 3272AC_CACHE_CHECK(for terminfo header, cf_cv_term_header,[ 3273case ${cf_cv_ncurses_header} in #(vi 3274*/ncurses.h|*/ncursesw.h) #(vi 3275 cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[[^.]]*\.h$%term.h%'` 3276 ;; 3277*) 3278 cf_term_header=term.h 3279 ;; 3280esac 3281 3282for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h" 3283do 3284AC_TRY_COMPILE([#include <stdio.h> 3285#include <${cf_cv_ncurses_header:-curses.h}> 3286#include <$cf_test> 3287],[int x = auto_left_margin],[ 3288 cf_cv_term_header="$cf_test"],[ 3289 cf_cv_term_header=unknown 3290 ]) 3291 test "$cf_cv_term_header" != unknown && break 3292done 3293]) 3294 3295# Set definitions to allow ifdef'ing to accommodate subdirectories 3296 3297case $cf_cv_term_header in # (vi 3298*term.h) 3299 AC_DEFINE(HAVE_TERM_H) 3300 ;; 3301esac 3302 3303case $cf_cv_term_header in # (vi 3304ncurses/term.h) #(vi 3305 AC_DEFINE(HAVE_NCURSES_TERM_H) 3306 ;; 3307ncursesw/term.h) 3308 AC_DEFINE(HAVE_NCURSESW_TERM_H) 3309 ;; 3310esac 3311])dnl 3312dnl --------------------------------------------------------------------------- 3313dnl CF_UNION_WAIT version: 5 updated: 1997/11/23 14:49:44 3314dnl ------------- 3315dnl Check to see if the BSD-style union wait is declared. Some platforms may 3316dnl use this, though it is deprecated in favor of the 'int' type in Posix. 3317dnl Some vendors provide a bogus implementation that declares union wait, but 3318dnl uses the 'int' type instead; we try to spot these by checking for the 3319dnl associated macros. 3320dnl 3321dnl Ahem. Some implementers cast the status value to an int*, as an attempt to 3322dnl use the macros for either union wait or int. So we do a check compile to 3323dnl see if the macros are defined and apply to an int. 3324dnl 3325dnl Sets: $cf_cv_type_unionwait 3326dnl Defines: HAVE_TYPE_UNIONWAIT 3327AC_DEFUN([CF_UNION_WAIT], 3328[ 3329AC_REQUIRE([CF_WAIT_HEADERS]) 3330AC_MSG_CHECKING([for union wait]) 3331AC_CACHE_VAL(cf_cv_type_unionwait,[ 3332 AC_TRY_LINK($cf_wait_headers, 3333 [int x; 3334 int y = WEXITSTATUS(x); 3335 int z = WTERMSIG(x); 3336 wait(&x); 3337 ], 3338 [cf_cv_type_unionwait=no 3339 echo compiles ok w/o union wait 1>&AC_FD_CC 3340 ],[ 3341 AC_TRY_LINK($cf_wait_headers, 3342 [union wait x; 3343#ifdef WEXITSTATUS 3344 int y = WEXITSTATUS(x); 3345#endif 3346#ifdef WTERMSIG 3347 int z = WTERMSIG(x); 3348#endif 3349 wait(&x); 3350 ], 3351 [cf_cv_type_unionwait=yes 3352 echo compiles ok with union wait and possibly macros too 1>&AC_FD_CC 3353 ], 3354 [cf_cv_type_unionwait=no])])]) 3355AC_MSG_RESULT($cf_cv_type_unionwait) 3356test $cf_cv_type_unionwait = yes && AC_DEFINE(HAVE_TYPE_UNIONWAIT) 3357])dnl 3358dnl --------------------------------------------------------------------------- 3359dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59 3360dnl -------- 3361dnl Make an uppercase version of a variable 3362dnl $1=uppercase($2) 3363AC_DEFUN([CF_UPPER], 3364[ 3365$1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` 3366])dnl 3367dnl --------------------------------------------------------------------------- 3368dnl CF_UTF8_LIB version: 7 updated: 2010/06/20 09:24:28 3369dnl ----------- 3370dnl Check for multibyte support, and if not found, utf8 compatibility library 3371AC_DEFUN([CF_UTF8_LIB], 3372[ 3373AC_CACHE_CHECK(for multibyte character support,cf_cv_utf8_lib,[ 3374 cf_save_LIBS="$LIBS" 3375 AC_TRY_LINK([ 3376#include <stdlib.h>],[putwc(0,0);], 3377 [cf_cv_utf8_lib=yes], 3378 [CF_FIND_LINKAGE([ 3379#include <libutf8.h>],[putwc(0,0);],utf8, 3380 [cf_cv_utf8_lib=add-on], 3381 [cf_cv_utf8_lib=no]) 3382])]) 3383 3384# HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between 3385# ncurses/ncursesw: 3386if test "$cf_cv_utf8_lib" = "add-on" ; then 3387 AC_DEFINE(HAVE_LIBUTF8_H) 3388 CF_ADD_INCDIR($cf_cv_header_path_utf8) 3389 CF_ADD_LIBDIR($cf_cv_library_path_utf8) 3390 CF_ADD_LIBS($cf_cv_library_file_utf8) 3391fi 3392])dnl 3393dnl --------------------------------------------------------------------------- 3394dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12 3395dnl ---------- 3396dnl Use AC_VERBOSE w/o the warnings 3397AC_DEFUN([CF_VERBOSE], 3398[test -n "$verbose" && echo " $1" 1>&AC_FD_MSG 3399CF_MSG_LOG([$1]) 3400])dnl 3401dnl --------------------------------------------------------------------------- 3402dnl CF_VERSION_INFO version: 4 updated: 2011/01/02 19:09:47 3403dnl --------------- 3404dnl Define several useful symbols derived from the VERSION file. A separate 3405dnl file is preferred to embedding the version numbers in various scripts. 3406dnl (automake is a textbook-example of why the latter is a bad idea, but there 3407dnl are others). 3408dnl 3409dnl The file contents are: 3410dnl libtool-version release-version patch-version 3411dnl or 3412dnl release-version 3413dnl where 3414dnl libtool-version (see ?) consists of 3 integers separated by '.' 3415dnl release-version consists of a major version and minor version 3416dnl separated by '.', optionally followed by a patch-version 3417dnl separated by '-'. The minor version need not be an 3418dnl integer (but it is preferred). 3419dnl patch-version is an integer in the form yyyymmdd, so ifdef's and 3420dnl scripts can easily compare versions. 3421dnl 3422dnl If libtool is used, the first form is required, since CF_WITH_LIBTOOL 3423dnl simply extracts the first field using 'cut -f1'. 3424dnl 3425dnl Optional parameters: 3426dnl $1 = internal name for package 3427dnl $2 = external name for package 3428AC_DEFUN([CF_VERSION_INFO], 3429[ 3430if test -f $srcdir/VERSION ; then 3431 AC_MSG_CHECKING(for package version) 3432 3433 # if there are not enough fields, cut returns the last one... 3434 cf_field1=`sed -e '2,$d' $srcdir/VERSION|cut -f1` 3435 cf_field2=`sed -e '2,$d' $srcdir/VERSION|cut -f2` 3436 cf_field3=`sed -e '2,$d' $srcdir/VERSION|cut -f3` 3437 3438 # this is how CF_BUNDLED_INTL uses $VERSION: 3439 VERSION="$cf_field1" 3440 3441 VERSION_MAJOR=`echo "$cf_field2" | sed -e 's/\..*//'` 3442 test -z "$VERSION_MAJOR" && AC_MSG_ERROR(missing major-version) 3443 3444 VERSION_MINOR=`echo "$cf_field2" | sed -e 's/^[[^.]]*\.//' -e 's/-.*//'` 3445 test -z "$VERSION_MINOR" && AC_MSG_ERROR(missing minor-version) 3446 3447 AC_MSG_RESULT(${VERSION_MAJOR}.${VERSION_MINOR}) 3448 3449 AC_MSG_CHECKING(for package patch date) 3450 VERSION_PATCH=`echo "$cf_field3" | sed -e 's/^[[^-]]*-//'` 3451 case .$VERSION_PATCH in 3452 .) 3453 AC_MSG_ERROR(missing patch-date $VERSION_PATCH) 3454 ;; 3455 .[[0-9]][[0-9]][[0-9]][[0-9]][[0-9]][[0-9]][[0-9]][[0-9]]) 3456 ;; 3457 *) 3458 AC_MSG_ERROR(illegal patch-date $VERSION_PATCH) 3459 ;; 3460 esac 3461 AC_MSG_RESULT($VERSION_PATCH) 3462else 3463 AC_MSG_ERROR(did not find $srcdir/VERSION) 3464fi 3465 3466# show the actual data that we have for versions: 3467CF_VERBOSE(VERSION $VERSION) 3468CF_VERBOSE(VERSION_MAJOR $VERSION_MAJOR) 3469CF_VERBOSE(VERSION_MINOR $VERSION_MINOR) 3470CF_VERBOSE(VERSION_PATCH $VERSION_PATCH) 3471 3472AC_SUBST(VERSION) 3473AC_SUBST(VERSION_MAJOR) 3474AC_SUBST(VERSION_MINOR) 3475AC_SUBST(VERSION_PATCH) 3476 3477dnl if a package name is given, define its corresponding version info. We 3478dnl need the package name to ensure that the defined symbols are unique. 3479ifelse($1,,,[ 3480 cf_PACKAGE=$1 3481 PACKAGE=ifelse($2,,$1,$2) 3482 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE") 3483 AC_SUBST(PACKAGE) 3484 CF_UPPER(cf_PACKAGE,$cf_PACKAGE) 3485 AC_DEFINE_UNQUOTED(${cf_PACKAGE}_VERSION,"${VERSION_MAJOR}.${VERSION_MINOR}") 3486 AC_DEFINE_UNQUOTED(${cf_PACKAGE}_PATCHDATE,${VERSION_PATCH}) 3487]) 3488])dnl 3489dnl --------------------------------------------------------------------------- 3490dnl CF_WAIT_HEADERS version: 2 updated: 1997/10/21 19:45:33 3491dnl --------------- 3492dnl Build up an expression $cf_wait_headers with the header files needed to 3493dnl compile against the prototypes for 'wait()', 'waitpid()', etc. Assume it's 3494dnl Posix, which uses <sys/types.h> and <sys/wait.h>, but allow SVr4 variation 3495dnl with <wait.h>. 3496AC_DEFUN([CF_WAIT_HEADERS], 3497[ 3498AC_HAVE_HEADERS(sys/wait.h) 3499cf_wait_headers="#include <sys/types.h> 3500" 3501if test $ac_cv_header_sys_wait_h = yes; then 3502cf_wait_headers="$cf_wait_headers 3503#include <sys/wait.h> 3504" 3505else 3506AC_HAVE_HEADERS(wait.h) 3507AC_HAVE_HEADERS(waitstatus.h) 3508if test $ac_cv_header_wait_h = yes; then 3509cf_wait_headers="$cf_wait_headers 3510#include <wait.h> 3511" 3512fi 3513if test $ac_cv_header_waitstatus_h = yes; then 3514cf_wait_headers="$cf_wait_headers 3515#include <waitstatus.h> 3516" 3517fi 3518fi 3519])dnl 3520dnl --------------------------------------------------------------------------- 3521dnl CF_WITH_CURSES_DIR version: 3 updated: 2010/11/20 17:02:38 3522dnl ------------------ 3523dnl Wrapper for AC_ARG_WITH to specify directory under which to look for curses 3524dnl libraries. 3525AC_DEFUN([CF_WITH_CURSES_DIR],[ 3526 3527AC_MSG_CHECKING(for specific curses-directory) 3528AC_ARG_WITH(curses-dir, 3529 [ --with-curses-dir=DIR directory in which (n)curses is installed], 3530 [cf_cv_curses_dir=$withval], 3531 [cf_cv_curses_dir=no]) 3532AC_MSG_RESULT($cf_cv_curses_dir) 3533 3534if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" ) 3535then 3536 CF_PATH_SYNTAX(withval) 3537 if test -d "$cf_cv_curses_dir" 3538 then 3539 CF_ADD_INCDIR($cf_cv_curses_dir/include) 3540 CF_ADD_LIBDIR($cf_cv_curses_dir/lib) 3541 fi 3542fi 3543])dnl 3544dnl --------------------------------------------------------------------------- 3545dnl CF_WITH_DBMALLOC version: 7 updated: 2010/06/21 17:26:47 3546dnl ---------------- 3547dnl Configure-option for dbmalloc. The optional parameter is used to override 3548dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests. 3549AC_DEFUN([CF_WITH_DBMALLOC],[ 3550CF_NO_LEAKS_OPTION(dbmalloc, 3551 [ --with-dbmalloc test: use Conor Cahill's dbmalloc library], 3552 [USE_DBMALLOC]) 3553 3554if test "$with_dbmalloc" = yes ; then 3555 AC_CHECK_HEADER(dbmalloc.h, 3556 [AC_CHECK_LIB(dbmalloc,[debug_malloc]ifelse([$1],,[],[,$1]))]) 3557fi 3558])dnl 3559dnl --------------------------------------------------------------------------- 3560dnl CF_WITH_DMALLOC version: 7 updated: 2010/06/21 17:26:47 3561dnl --------------- 3562dnl Configure-option for dmalloc. The optional parameter is used to override 3563dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests. 3564AC_DEFUN([CF_WITH_DMALLOC],[ 3565CF_NO_LEAKS_OPTION(dmalloc, 3566 [ --with-dmalloc test: use Gray Watson's dmalloc library], 3567 [USE_DMALLOC]) 3568 3569if test "$with_dmalloc" = yes ; then 3570 AC_CHECK_HEADER(dmalloc.h, 3571 [AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse([$1],,[],[,$1]))]) 3572fi 3573])dnl 3574dnl --------------------------------------------------------------------------- 3575dnl CF_WITH_LIBTOOL version: 26 updated: 2010/10/23 15:55:24 3576dnl --------------- 3577dnl Provide a configure option to incorporate libtool. Define several useful 3578dnl symbols for the makefile rules. 3579dnl 3580dnl The reference to AC_PROG_LIBTOOL does not normally work, since it uses 3581dnl macros from libtool.m4 which is in the aclocal directory of automake. 3582dnl Following is a simple script which turns on the AC_PROG_LIBTOOL macro. 3583dnl But that still does not work properly since the macro is expanded outside 3584dnl the CF_WITH_LIBTOOL macro: 3585dnl 3586dnl #!/bin/sh 3587dnl ACLOCAL=`aclocal --print-ac-dir` 3588dnl if test -z "$ACLOCAL" ; then 3589dnl echo cannot find aclocal directory 3590dnl exit 1 3591dnl elif test ! -f $ACLOCAL/libtool.m4 ; then 3592dnl echo cannot find libtool.m4 file 3593dnl exit 1 3594dnl fi 3595dnl 3596dnl LOCAL=aclocal.m4 3597dnl ORIG=aclocal.m4.orig 3598dnl 3599dnl trap "mv $ORIG $LOCAL" 0 1 2 5 15 3600dnl rm -f $ORIG 3601dnl mv $LOCAL $ORIG 3602dnl 3603dnl # sed the LIBTOOL= assignment to omit the current directory? 3604dnl sed -e 's/^LIBTOOL=.*/LIBTOOL=${LIBTOOL:-libtool}/' $ACLOCAL/libtool.m4 >>$LOCAL 3605dnl cat $ORIG >>$LOCAL 3606dnl 3607dnl autoconf-257 $* 3608dnl 3609AC_DEFUN([CF_WITH_LIBTOOL], 3610[ 3611AC_REQUIRE([CF_DISABLE_LIBTOOL_VERSION]) 3612ifdef([AC_PROG_LIBTOOL],,[ 3613LIBTOOL= 3614]) 3615# common library maintenance symbols that are convenient for libtool scripts: 3616LIB_CREATE='${AR} -cr' 3617LIB_OBJECT='${OBJECTS}' 3618LIB_SUFFIX=.a 3619LIB_PREP="$RANLIB" 3620 3621# symbols used to prop libtool up to enable it to determine what it should be 3622# doing: 3623LIB_CLEAN= 3624LIB_COMPILE= 3625LIB_LINK='${CC}' 3626LIB_INSTALL= 3627LIB_UNINSTALL= 3628 3629AC_MSG_CHECKING(if you want to build libraries with libtool) 3630AC_ARG_WITH(libtool, 3631 [ --with-libtool generate libraries with libtool], 3632 [with_libtool=$withval], 3633 [with_libtool=no]) 3634AC_MSG_RESULT($with_libtool) 3635if test "$with_libtool" != "no"; then 3636ifdef([AC_PROG_LIBTOOL],[ 3637 # missing_content_AC_PROG_LIBTOOL{{ 3638 AC_PROG_LIBTOOL 3639 # missing_content_AC_PROG_LIBTOOL}} 3640],[ 3641 if test "$with_libtool" != "yes" ; then 3642 CF_PATH_SYNTAX(with_libtool) 3643 LIBTOOL=$with_libtool 3644 else 3645 AC_PATH_PROG(LIBTOOL,libtool) 3646 fi 3647 if test -z "$LIBTOOL" ; then 3648 AC_MSG_ERROR(Cannot find libtool) 3649 fi 3650])dnl 3651 LIB_CREATE='${LIBTOOL} --mode=link ${CC} -rpath ${DESTDIR}${libdir} ${LIBTOOL_VERSION} `cut -f1 ${srcdir}/VERSION` ${LIBTOOL_OPTS} ${LT_UNDEF} -o' 3652 LIB_OBJECT='${OBJECTS:.o=.lo}' 3653 LIB_SUFFIX=.la 3654 LIB_CLEAN='${LIBTOOL} --mode=clean' 3655 LIB_COMPILE='${LIBTOOL} --mode=compile' 3656 LIB_LINK='${LIBTOOL} --mode=link ${CC} ${LIBTOOL_OPTS}' 3657 LIB_INSTALL='${LIBTOOL} --mode=install' 3658 LIB_UNINSTALL='${LIBTOOL} --mode=uninstall' 3659 LIB_PREP=: 3660 3661 # Show the version of libtool 3662 AC_MSG_CHECKING(version of libtool) 3663 3664 # Save the version in a cache variable - this is not entirely a good 3665 # thing, but the version string from libtool is very ugly, and for 3666 # bug reports it might be useful to have the original string. "(" 3667 cf_cv_libtool_version=`$LIBTOOL --version 2>&1 | sed -e '/^$/d' |sed -e '2,$d' -e 's/([[^)]]*)//g' -e 's/^[[^1-9]]*//' -e 's/[[^0-9.]].*//'` 3668 AC_MSG_RESULT($cf_cv_libtool_version) 3669 if test -z "$cf_cv_libtool_version" ; then 3670 AC_MSG_ERROR(This is not GNU libtool) 3671 fi 3672 3673 # special hack to add -no-undefined (which libtool should do for itself) 3674 LT_UNDEF= 3675 case "$cf_cv_system_name" in #(vi 3676 cygwin*|mingw32*|uwin*|aix[[456]]) #(vi 3677 LT_UNDEF=-no-undefined 3678 ;; 3679 esac 3680 AC_SUBST([LT_UNDEF]) 3681 3682 # special hack to add --tag option for C++ compiler 3683 case $cf_cv_libtool_version in #(vi 3684 1.[[5-9]]*|[[2-9]].[[0-9.a-z]]*) #(vi 3685 LIBTOOL_CXX="$LIBTOOL --tag=CXX" 3686 LIBTOOL="$LIBTOOL --tag=CC" 3687 ;; 3688 *) 3689 LIBTOOL_CXX="$LIBTOOL" 3690 ;; 3691 esac 3692else 3693 LIBTOOL="" 3694 LIBTOOL_CXX="" 3695fi 3696 3697test -z "$LIBTOOL" && ECHO_LT= 3698 3699AC_SUBST(LIBTOOL) 3700AC_SUBST(LIBTOOL_CXX) 3701AC_SUBST(LIBTOOL_OPTS) 3702 3703AC_SUBST(LIB_CREATE) 3704AC_SUBST(LIB_OBJECT) 3705AC_SUBST(LIB_SUFFIX) 3706AC_SUBST(LIB_PREP) 3707 3708AC_SUBST(LIB_CLEAN) 3709AC_SUBST(LIB_COMPILE) 3710AC_SUBST(LIB_LINK) 3711AC_SUBST(LIB_INSTALL) 3712AC_SUBST(LIB_UNINSTALL) 3713 3714])dnl 3715dnl --------------------------------------------------------------------------- 3716dnl CF_WITH_LIBTOOL_OPTS version: 2 updated: 2007/04/08 18:14:54 3717dnl -------------------- 3718dnl Allow user to pass additional libtool options into the library creation 3719dnl and link steps. The main use for this is to do something like 3720dnl ./configure --with-libtool-opts=-static 3721dnl to get the same behavior as automake-flavored 3722dnl ./configure --enable-static 3723AC_DEFUN([CF_WITH_LIBTOOL_OPTS],[ 3724AC_MSG_CHECKING(for additional libtool options) 3725AC_ARG_WITH(libtool-opts, 3726 [ --with-libtool-opts=XXX specify additional libtool options], 3727 [with_libtool_opts=$withval], 3728 [with_libtool_opts=no]) 3729AC_MSG_RESULT($with_libtool_opts) 3730 3731case .$with_libtool_opts in 3732.yes|.no|.) 3733 ;; 3734*) 3735 LIBTOOL_OPTS=$with_libtool_opts 3736 ;; 3737esac 3738 3739AC_SUBST(LIBTOOL_OPTS) 3740])dnl 3741dnl --------------------------------------------------------------------------- 3742dnl CF_WITH_NO_LEAKS version: 1 updated: 2006/12/14 18:00:21 3743dnl ---------------- 3744AC_DEFUN([CF_WITH_NO_LEAKS],[ 3745 3746AC_REQUIRE([CF_WITH_DMALLOC]) 3747AC_REQUIRE([CF_WITH_DBMALLOC]) 3748AC_REQUIRE([CF_WITH_PURIFY]) 3749AC_REQUIRE([CF_WITH_VALGRIND]) 3750 3751AC_MSG_CHECKING(if you want to perform memory-leak testing) 3752AC_ARG_WITH(no-leaks, 3753 [ --with-no-leaks test: free permanent memory, analyze leaks], 3754 [AC_DEFINE(NO_LEAKS) 3755 cf_doalloc=".${with_dmalloc}${with_dbmalloc}${with_purify}${with_valgrind}" 3756 case ${cf_doalloc} in #(vi 3757 *yes*) ;; 3758 *) AC_DEFINE(DOALLOC,10000) ;; 3759 esac 3760 with_no_leaks=yes], 3761 [with_no_leaks=]) 3762AC_MSG_RESULT($with_no_leaks) 3763])dnl 3764dnl --------------------------------------------------------------------------- 3765dnl CF_WITH_PURIFY version: 2 updated: 2006/12/14 18:43:43 3766dnl -------------- 3767AC_DEFUN([CF_WITH_PURIFY],[ 3768CF_NO_LEAKS_OPTION(purify, 3769 [ --with-purify test: use Purify], 3770 [USE_PURIFY], 3771 [LINK_PREFIX="$LINK_PREFIX purify"]) 3772AC_SUBST(LINK_PREFIX) 3773])dnl 3774dnl --------------------------------------------------------------------------- 3775dnl CF_WITH_VALGRIND version: 1 updated: 2006/12/14 18:00:21 3776dnl ---------------- 3777AC_DEFUN([CF_WITH_VALGRIND],[ 3778CF_NO_LEAKS_OPTION(valgrind, 3779 [ --with-valgrind test: use valgrind], 3780 [USE_VALGRIND]) 3781])dnl 3782dnl --------------------------------------------------------------------------- 3783dnl CF_WITH_WARNINGS version: 5 updated: 2004/07/23 14:40:34 3784dnl ---------------- 3785dnl Combine the checks for gcc features into a configure-script option 3786dnl 3787dnl Parameters: 3788dnl $1 - see CF_GCC_WARNINGS 3789AC_DEFUN([CF_WITH_WARNINGS], 3790[ 3791if ( test "$GCC" = yes || test "$GXX" = yes ) 3792then 3793AC_MSG_CHECKING(if you want to check for gcc warnings) 3794AC_ARG_WITH(warnings, 3795 [ --with-warnings test: turn on gcc warnings], 3796 [cf_opt_with_warnings=$withval], 3797 [cf_opt_with_warnings=no]) 3798AC_MSG_RESULT($cf_opt_with_warnings) 3799if test "$cf_opt_with_warnings" != no ; then 3800 CF_GCC_ATTRIBUTES 3801 CF_GCC_WARNINGS([$1]) 3802fi 3803fi 3804])dnl 3805dnl --------------------------------------------------------------------------- 3806dnl CF_XOPEN_CURSES version: 11 updated: 2011/01/18 18:15:30 3807dnl --------------- 3808dnl Test if we should define X/Open source for curses, needed on Digital Unix 3809dnl 4.x, to see the extended functions, but breaks on IRIX 6.x. 3810dnl 3811dnl The getbegyx() check is needed for HPUX, which omits legacy macros such 3812dnl as getbegy(). The latter is better design, but the former is standard. 3813AC_DEFUN([CF_XOPEN_CURSES], 3814[ 3815AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl 3816AC_CACHE_CHECK(if we must define _XOPEN_SOURCE_EXTENDED,cf_cv_need_xopen_extension,[ 3817AC_TRY_LINK([ 3818#include <stdlib.h> 3819#include <${cf_cv_ncurses_header:-curses.h}>],[ 3820#if defined(NCURSES_VERSION_PATCH) 3821#if (NCURSES_VERSION_PATCH < 20100501) && (NCURSES_VERSION_PATCH >= 20100403) 3822 make an error 3823#endif 3824#endif 3825 long x = winnstr(stdscr, "", 0); 3826 int x1, y1; 3827 getbegyx(stdscr, y1, x1)], 3828 [cf_cv_need_xopen_extension=no], 3829 [AC_TRY_LINK([ 3830#define _XOPEN_SOURCE_EXTENDED 3831#include <stdlib.h> 3832#include <${cf_cv_ncurses_header:-curses.h}>],[ 3833#ifdef NCURSES_VERSION 3834 cchar_t check; 3835 int check2 = curs_set((int)sizeof(check)); 3836#endif 3837 long x = winnstr(stdscr, "", 0); 3838 int x1, y1; 3839 getbegyx(stdscr, y1, x1)], 3840 [cf_cv_need_xopen_extension=yes], 3841 [cf_cv_need_xopen_extension=unknown])])]) 3842test $cf_cv_need_xopen_extension = yes && CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED" 3843])dnl 3844dnl --------------------------------------------------------------------------- 3845dnl CF_XOPEN_SOURCE version: 34 updated: 2010/05/26 05:38:42 3846dnl --------------- 3847dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions, 3848dnl or adapt to the vendor's definitions to get equivalent functionality, 3849dnl without losing the common non-POSIX features. 3850dnl 3851dnl Parameters: 3852dnl $1 is the nominal value for _XOPEN_SOURCE 3853dnl $2 is the nominal value for _POSIX_C_SOURCE 3854AC_DEFUN([CF_XOPEN_SOURCE],[ 3855 3856cf_XOPEN_SOURCE=ifelse([$1],,500,[$1]) 3857cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2]) 3858cf_xopen_source= 3859 3860case $host_os in #(vi 3861aix[[456]]*) #(vi 3862 cf_xopen_source="-D_ALL_SOURCE" 3863 ;; 3864darwin[[0-8]].*) #(vi 3865 cf_xopen_source="-D_APPLE_C_SOURCE" 3866 ;; 3867darwin*) #(vi 3868 cf_xopen_source="-D_DARWIN_C_SOURCE" 3869 ;; 3870freebsd*|dragonfly*) #(vi 3871 # 5.x headers associate 3872 # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L 3873 # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L 3874 cf_POSIX_C_SOURCE=200112L 3875 cf_XOPEN_SOURCE=600 3876 cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" 3877 ;; 3878hpux11*) #(vi 3879 cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500" 3880 ;; 3881hpux*) #(vi 3882 cf_xopen_source="-D_HPUX_SOURCE" 3883 ;; 3884irix[[56]].*) #(vi 3885 cf_xopen_source="-D_SGI_SOURCE" 3886 ;; 3887linux*|gnu*|mint*|k*bsd*-gnu) #(vi 3888 CF_GNU_SOURCE 3889 ;; 3890mirbsd*) #(vi 3891 # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h> 3892 ;; 3893netbsd*) #(vi 3894 # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw 3895 ;; 3896openbsd*) #(vi 3897 # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw 3898 ;; 3899osf[[45]]*) #(vi 3900 cf_xopen_source="-D_OSF_SOURCE" 3901 ;; 3902nto-qnx*) #(vi 3903 cf_xopen_source="-D_QNX_SOURCE" 3904 ;; 3905sco*) #(vi 3906 # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer 3907 ;; 3908solaris2.1[[0-9]]) #(vi 3909 cf_xopen_source="-D__EXTENSIONS__ -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" 3910 ;; 3911solaris2.[[1-9]]) #(vi 3912 cf_xopen_source="-D__EXTENSIONS__" 3913 ;; 3914*) 3915 AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[ 3916 AC_TRY_COMPILE([#include <sys/types.h>],[ 3917#ifndef _XOPEN_SOURCE 3918make an error 3919#endif], 3920 [cf_cv_xopen_source=no], 3921 [cf_save="$CPPFLAGS" 3922 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" 3923 AC_TRY_COMPILE([#include <sys/types.h>],[ 3924#ifdef _XOPEN_SOURCE 3925make an error 3926#endif], 3927 [cf_cv_xopen_source=no], 3928 [cf_cv_xopen_source=$cf_XOPEN_SOURCE]) 3929 CPPFLAGS="$cf_save" 3930 ]) 3931]) 3932 if test "$cf_cv_xopen_source" != no ; then 3933 CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE) 3934 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE) 3935 cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" 3936 CF_ADD_CFLAGS($cf_temp_xopen_source) 3937 fi 3938 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) 3939 ;; 3940esac 3941 3942if test -n "$cf_xopen_source" ; then 3943 CF_ADD_CFLAGS($cf_xopen_source) 3944fi 3945]) 3946dnl --------------------------------------------------------------------------- 3947dnl CF__CURSES_HEAD version: 2 updated: 2010/10/23 15:54:49 3948dnl --------------- 3949dnl Define a reusable chunk which includes <curses.h> and <term.h> when they 3950dnl are both available. 3951define([CF__CURSES_HEAD],[ 3952#ifdef HAVE_XCURSES 3953#include <xcurses.h> 3954char * XCursesProgramName = "test"; 3955#else 3956#include <${cf_cv_ncurses_header:-curses.h}> 3957#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H) 3958#include <ncursesw/term.h> 3959#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H) 3960#include <ncurses/term.h> 3961#elif defined(HAVE_TERM_H) 3962#include <term.h> 3963#endif 3964#endif 3965]) 3966dnl --------------------------------------------------------------------------- 3967dnl CF__ICONV_BODY version: 2 updated: 2007/07/26 17:35:47 3968dnl -------------- 3969dnl Test-code needed for iconv compile-checks 3970define([CF__ICONV_BODY],[ 3971 iconv_t cd = iconv_open("",""); 3972 iconv(cd,NULL,NULL,NULL,NULL); 3973 iconv_close(cd);] 3974)dnl 3975dnl --------------------------------------------------------------------------- 3976dnl CF__ICONV_HEAD version: 1 updated: 2007/07/26 15:57:03 3977dnl -------------- 3978dnl Header-files needed for iconv compile-checks 3979define([CF__ICONV_HEAD],[ 3980#include <stdlib.h> 3981#include <iconv.h>] 3982)dnl 3983dnl --------------------------------------------------------------------------- 3984dnl CF__INTL_BODY version: 1 updated: 2007/07/26 17:35:47 3985dnl ------------- 3986dnl Test-code needed for libintl compile-checks 3987dnl $1 = parameter 2 from AM_WITH_NLS 3988define([CF__INTL_BODY],[ 3989 bindtextdomain ("", ""); 3990 return (int) gettext ("") 3991 ifelse([$1], need-ngettext, [ + (int) ngettext ("", "", 0)], []) 3992 [ + _nl_msg_cat_cntr] 3993]) 3994dnl --------------------------------------------------------------------------- 3995dnl CF__INTL_HEAD version: 1 updated: 2007/07/26 17:35:47 3996dnl ------------- 3997dnl Header-files needed for libintl compile-checks 3998define([CF__INTL_HEAD],[ 3999#include <libintl.h> 4000extern int _nl_msg_cat_cntr; 4001])dnl 4002dnl --------------------------------------------------------------------------- 4003dnl jm_GLIBC21 version: 3 updated: 2002/10/27 23:21:42 4004dnl ---------- 4005dnl Inserted as requested by gettext 0.10.40 4006dnl File from /usr/share/aclocal 4007dnl glibc21.m4 4008dnl ==================== 4009dnl serial 2 4010dnl 4011dnl Test for the GNU C Library, version 2.1 or newer. 4012dnl From Bruno Haible. 4013AC_DEFUN([jm_GLIBC21], 4014 [ 4015 AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer, 4016 ac_cv_gnu_library_2_1, 4017 [AC_EGREP_CPP([Lucky GNU user], 4018 [ 4019#include <features.h> 4020#ifdef __GNU_LIBRARY__ 4021 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) 4022 Lucky GNU user 4023 #endif 4024#endif 4025 ], 4026 ac_cv_gnu_library_2_1=yes, 4027 ac_cv_gnu_library_2_1=no) 4028 ] 4029 ) 4030 AC_SUBST(GLIBC21) 4031 GLIBC21="$ac_cv_gnu_library_2_1" 4032 ] 4033) 4034