aclocal.m4 revision 20d2c4d2
1dnl $XTermId: aclocal.m4,v 1.285 2010/06/14 21:44:02 tom Exp $ 2dnl 3dnl --------------------------------------------------------------------------- 4dnl 5dnl Copyright 1997-2009,2010 by Thomas E. Dickey 6dnl 7dnl All Rights Reserved 8dnl 9dnl Permission is hereby granted, free of charge, to any person obtaining a 10dnl copy of this software and associated documentation files (the 11dnl "Software"), to deal in the Software without restriction, including 12dnl without limitation the rights to use, copy, modify, merge, publish, 13dnl distribute, sublicense, and/or sell copies of the Software, and to 14dnl permit persons to whom the Software is furnished to do so, subject to 15dnl the following conditions: 16dnl 17dnl The above copyright notice and this permission notice shall be included 18dnl in all copies or substantial portions of the Software. 19dnl 20dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 21dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 23dnl IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY 24dnl CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 25dnl TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 26dnl SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27dnl 28dnl Except as contained in this notice, the name(s) of the above copyright 29dnl holders shall not be used in advertising or otherwise to promote the 30dnl sale, use or other dealings in this Software without prior written 31dnl authorization. 32dnl 33dnl --------------------------------------------------------------------------- 34dnl See 35dnl http://invisible-island.net/autoconf/autoconf.html 36dnl --------------------------------------------------------------------------- 37dnl --------------------------------------------------------------------------- 38dnl AM_LANGINFO_CODESET version: 3 updated: 2002/10/27 23:21:42 39dnl ------------------- 40dnl Inserted as requested by gettext 0.10.40 41dnl File from /usr/share/aclocal 42dnl codeset.m4 43dnl ==================== 44dnl serial AM1 45dnl 46dnl From Bruno Haible. 47AC_DEFUN([AM_LANGINFO_CODESET], 48[ 49 AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, 50 [AC_TRY_LINK([#include <langinfo.h>], 51 [char* cs = nl_langinfo(CODESET);], 52 am_cv_langinfo_codeset=yes, 53 am_cv_langinfo_codeset=no) 54 ]) 55 if test $am_cv_langinfo_codeset = yes; then 56 AC_DEFINE(HAVE_LANGINFO_CODESET, 1, 57 [Define if you have <langinfo.h> and nl_langinfo(CODESET).]) 58 fi 59])dnl 60dnl --------------------------------------------------------------------------- 61dnl CF_ADD_CFLAGS version: 10 updated: 2010/05/26 05:38:42 62dnl ------------- 63dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS 64dnl The second parameter if given makes this macro verbose. 65dnl 66dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS, 67dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily 68dnl confused by the quotes (which require backslashes to keep them usable). 69AC_DEFUN([CF_ADD_CFLAGS], 70[ 71cf_fix_cppflags=no 72cf_new_cflags= 73cf_new_cppflags= 74cf_new_extra_cppflags= 75 76for cf_add_cflags in $1 77do 78case $cf_fix_cppflags in 79no) 80 case $cf_add_cflags in #(vi 81 -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi 82 case $cf_add_cflags in 83 -D*) 84 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'` 85 86 test "${cf_add_cflags}" != "${cf_tst_cflags}" \ 87 && test -z "${cf_tst_cflags}" \ 88 && cf_fix_cppflags=yes 89 90 if test $cf_fix_cppflags = yes ; then 91 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" 92 continue 93 elif test "${cf_tst_cflags}" = "\"'" ; then 94 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" 95 continue 96 fi 97 ;; 98 esac 99 case "$CPPFLAGS" in 100 *$cf_add_cflags) #(vi 101 ;; 102 *) #(vi 103 case $cf_add_cflags in #(vi 104 -D*) 105 cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` 106 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags) 107 ;; 108 esac 109 cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" 110 ;; 111 esac 112 ;; 113 *) 114 cf_new_cflags="$cf_new_cflags $cf_add_cflags" 115 ;; 116 esac 117 ;; 118yes) 119 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" 120 121 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'` 122 123 test "${cf_add_cflags}" != "${cf_tst_cflags}" \ 124 && test -z "${cf_tst_cflags}" \ 125 && cf_fix_cppflags=no 126 ;; 127esac 128done 129 130if test -n "$cf_new_cflags" ; then 131 ifelse([$2],,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)]) 132 CFLAGS="$CFLAGS $cf_new_cflags" 133fi 134 135if test -n "$cf_new_cppflags" ; then 136 ifelse([$2],,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)]) 137 CPPFLAGS="$CPPFLAGS $cf_new_cppflags" 138fi 139 140if test -n "$cf_new_extra_cppflags" ; then 141 ifelse([$2],,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)]) 142 EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" 143fi 144 145AC_SUBST(EXTRA_CPPFLAGS) 146 147])dnl 148dnl --------------------------------------------------------------------------- 149dnl CF_ADD_LIB version: 2 updated: 2010/06/02 05:03:05 150dnl ---------- 151dnl Add a library, used to enforce consistency. 152dnl 153dnl $1 = library to add, without the "-l" 154dnl $2 = variable to update (default $LIBS) 155AC_DEFUN([CF_ADD_LIB],[CF_ADD_LIBS(-l$1,ifelse($2,,LIBS,[$2]))])dnl 156dnl --------------------------------------------------------------------------- 157dnl CF_ADD_LIBS version: 1 updated: 2010/06/02 05:03:05 158dnl ----------- 159dnl Add one or more libraries, used to enforce consistency. 160dnl 161dnl $1 = libraries to add, with the "-l", etc. 162dnl $2 = variable to update (default $LIBS) 163AC_DEFUN([CF_ADD_LIBS],[ifelse($2,,LIBS,[$2])="$1 [$]ifelse($2,,LIBS,[$2])"])dnl 164dnl --------------------------------------------------------------------------- 165dnl CF_ANSI_CC_CHECK version: 9 updated: 2001/12/30 17:53:34 166dnl ---------------- 167dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES' 168dnl in the sharutils 4.2 distribution. 169AC_DEFUN([CF_ANSI_CC_CHECK], 170[ 171AC_CACHE_CHECK(for ${CC-cc} option to accept ANSI C, cf_cv_ansi_cc,[ 172cf_cv_ansi_cc=no 173cf_save_CFLAGS="$CFLAGS" 174cf_save_CPPFLAGS="$CPPFLAGS" 175# Don't try gcc -ansi; that turns off useful extensions and 176# breaks some systems' header files. 177# AIX -qlanglvl=ansi 178# Ultrix and OSF/1 -std1 179# HP-UX -Aa -D_HPUX_SOURCE 180# SVR4 -Xc 181# UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes) 182for cf_arg in "-DCC_HAS_PROTOS" \ 183 "" \ 184 -qlanglvl=ansi \ 185 -std1 \ 186 -Ae \ 187 "-Aa -D_HPUX_SOURCE" \ 188 -Xc 189do 190 CF_ADD_CFLAGS($cf_arg) 191 AC_TRY_COMPILE( 192[ 193#ifndef CC_HAS_PROTOS 194#if !defined(__STDC__) || (__STDC__ != 1) 195choke me 196#endif 197#endif 198],[ 199 int test (int i, double x); 200 struct s1 {int (*f) (int a);}; 201 struct s2 {int (*f) (double a);};], 202 [cf_cv_ansi_cc="$cf_arg"; break]) 203done 204CFLAGS="$cf_save_CFLAGS" 205CPPFLAGS="$cf_save_CPPFLAGS" 206]) 207 208if test "$cf_cv_ansi_cc" != "no"; then 209if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then 210 CF_ADD_CFLAGS($cf_cv_ansi_cc) 211else 212 AC_DEFINE(CC_HAS_PROTOS) 213fi 214fi 215])dnl 216dnl --------------------------------------------------------------------------- 217dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31 218dnl -------------- 219dnl Allow user to disable a normally-on option. 220AC_DEFUN([CF_ARG_DISABLE], 221[CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl 222dnl --------------------------------------------------------------------------- 223dnl CF_ARG_ENABLE version: 3 updated: 1999/03/30 17:24:31 224dnl ------------- 225dnl Allow user to enable a normally-off option. 226AC_DEFUN([CF_ARG_ENABLE], 227[CF_ARG_OPTION($1,[$2],[$3],[$4],no)])dnl 228dnl --------------------------------------------------------------------------- 229dnl CF_ARG_OPTION version: 4 updated: 2010/05/26 05:38:42 230dnl ------------- 231dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus 232dnl values. 233dnl 234dnl Parameters: 235dnl $1 = option name 236dnl $2 = help-string 237dnl $3 = action to perform if option is not default 238dnl $4 = action if perform if option is default 239dnl $5 = default option value (either 'yes' or 'no') 240AC_DEFUN([CF_ARG_OPTION], 241[AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes) 242 if test "$enableval" != "$5" ; then 243ifelse([$3],,[ :]dnl 244,[ $3]) ifelse([$4],,,[ 245 else 246 $4]) 247 fi],[enableval=$5 ifelse([$4],,,[ 248 $4 249])dnl 250 ])])dnl 251dnl --------------------------------------------------------------------------- 252dnl CF_CHECK_CACHE version: 11 updated: 2008/03/23 14:45:59 253dnl -------------- 254dnl Check if we're accidentally using a cache from a different machine. 255dnl Derive the system name, as a check for reusing the autoconf cache. 256dnl 257dnl If we've packaged config.guess and config.sub, run that (since it does a 258dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow 259dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM 260dnl which is useful in cross-compiles. 261dnl 262dnl Note: we would use $ac_config_sub, but that is one of the places where 263dnl autoconf 2.5x broke compatibility with autoconf 2.13 264AC_DEFUN([CF_CHECK_CACHE], 265[ 266if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then 267 ifelse([$1],,[AC_CANONICAL_HOST],[$1]) 268 system_name="$host_os" 269else 270 system_name="`(uname -s -r) 2>/dev/null`" 271 if test -z "$system_name" ; then 272 system_name="`(hostname) 2>/dev/null`" 273 fi 274fi 275test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name") 276AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"]) 277 278test -z "$system_name" && system_name="$cf_cv_system_name" 279test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name) 280 281if test ".$system_name" != ".$cf_cv_system_name" ; then 282 AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)) 283 AC_MSG_ERROR("Please remove config.cache and try again.") 284fi 285])dnl 286dnl --------------------------------------------------------------------------- 287dnl CF_CHECK_CFLAGS version: 2 updated: 2001/12/30 19:09:58 288dnl --------------- 289dnl Conditionally add to $CFLAGS and $CPPFLAGS values which are derived from 290dnl a build-configuration such as imake. These have the pitfall that they 291dnl often contain compiler-specific options which we cannot use, mixed with 292dnl preprocessor options that we usually can. 293AC_DEFUN([CF_CHECK_CFLAGS], 294[ 295CF_VERBOSE(checking additions to CFLAGS) 296cf_check_cflags="$CFLAGS" 297cf_check_cppflags="$CPPFLAGS" 298CF_ADD_CFLAGS($1,yes) 299if test "$cf_check_cflags" != "$CFLAGS" ; then 300AC_TRY_LINK([#include <stdio.h>],[printf("Hello world");],, 301 [CF_VERBOSE(test-compile failed. Undoing change to \$CFLAGS) 302 if test "$cf_check_cppflags" != "$CPPFLAGS" ; then 303 CF_VERBOSE(but keeping change to \$CPPFLAGS) 304 fi 305 CFLAGS="$cf_check_flags"]) 306fi 307])dnl 308dnl --------------------------------------------------------------------------- 309dnl CF_CHECK_ERRNO version: 11 updated: 2010/05/26 05:38:42 310dnl -------------- 311dnl Check for data that is usually declared in <stdio.h> or <errno.h>, e.g., 312dnl the 'errno' variable. Define a DECL_xxx symbol if we must declare it 313dnl ourselves. 314dnl 315dnl $1 = the name to check 316dnl $2 = the assumed type 317AC_DEFUN([CF_CHECK_ERRNO], 318[ 319AC_CACHE_CHECK(if external $1 is declared, cf_cv_dcl_$1,[ 320 AC_TRY_COMPILE([ 321#ifdef HAVE_STDLIB_H 322#include <stdlib.h> 323#endif 324#include <stdio.h> 325#include <sys/types.h> 326#include <errno.h> ], 327 ifelse([$2],,int,[$2]) x = (ifelse([$2],,int,[$2])) $1, 328 [cf_cv_dcl_$1=yes], 329 [cf_cv_dcl_$1=no]) 330]) 331 332if test "$cf_cv_dcl_$1" = no ; then 333 CF_UPPER(cf_result,decl_$1) 334 AC_DEFINE_UNQUOTED($cf_result) 335fi 336 337# It's possible (for near-UNIX clones) that the data doesn't exist 338CF_CHECK_EXTERN_DATA($1,ifelse([$2],,int,[$2])) 339])dnl 340dnl --------------------------------------------------------------------------- 341dnl CF_CHECK_EXTERN_DATA version: 3 updated: 2001/12/30 18:03:23 342dnl -------------------- 343dnl Check for existence of external data in the current set of libraries. If 344dnl we can modify it, it's real enough. 345dnl $1 = the name to check 346dnl $2 = its type 347AC_DEFUN([CF_CHECK_EXTERN_DATA], 348[ 349AC_CACHE_CHECK(if external $1 exists, cf_cv_have_$1,[ 350 AC_TRY_LINK([ 351#undef $1 352extern $2 $1; 353], 354 [$1 = 2], 355 [cf_cv_have_$1=yes], 356 [cf_cv_have_$1=no]) 357]) 358 359if test "$cf_cv_have_$1" = yes ; then 360 CF_UPPER(cf_result,have_$1) 361 AC_DEFINE_UNQUOTED($cf_result) 362fi 363 364])dnl 365dnl --------------------------------------------------------------------------- 366dnl CF_DISABLE_ECHO version: 11 updated: 2009/12/13 13:16:57 367dnl --------------- 368dnl You can always use "make -n" to see the actual options, but it's hard to 369dnl pick out/analyze warning messages when the compile-line is long. 370dnl 371dnl Sets: 372dnl ECHO_LT - symbol to control if libtool is verbose 373dnl ECHO_LD - symbol to prefix "cc -o" lines 374dnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o) 375dnl SHOW_CC - symbol to put before explicit "cc -c" lines 376dnl ECHO_CC - symbol to put before any "cc" line 377dnl 378AC_DEFUN([CF_DISABLE_ECHO],[ 379AC_MSG_CHECKING(if you want to see long compiling messages) 380CF_ARG_DISABLE(echo, 381 [ --disable-echo display "compiling" commands], 382 [ 383 ECHO_LT='--silent' 384 ECHO_LD='@echo linking [$]@;' 385 RULE_CC='@echo compiling [$]<' 386 SHOW_CC='@echo compiling [$]@' 387 ECHO_CC='@' 388],[ 389 ECHO_LT='' 390 ECHO_LD='' 391 RULE_CC='' 392 SHOW_CC='' 393 ECHO_CC='' 394]) 395AC_MSG_RESULT($enableval) 396AC_SUBST(ECHO_LT) 397AC_SUBST(ECHO_LD) 398AC_SUBST(RULE_CC) 399AC_SUBST(SHOW_CC) 400AC_SUBST(ECHO_CC) 401])dnl 402dnl --------------------------------------------------------------------------- 403dnl CF_DISABLE_RPATH_HACK version: 1 updated: 2010/04/11 10:54:00 404dnl --------------------- 405dnl The rpath-hack makes it simpler to build programs, particularly with the 406dnl *BSD ports which may have essential libraries in unusual places. But it 407dnl can interfere with building an executable for the base system. Use this 408dnl option in that case. 409AC_DEFUN([CF_DISABLE_RPATH_HACK], 410[ 411AC_MSG_CHECKING(if rpath should be not be set) 412CF_ARG_DISABLE(rpath-hack, 413 [ --disable-rpath-hack don't add rpath options for additional libraries], 414 [cf_disable_rpath_hack=yes], 415 [cf_disable_rpath_hack=no]) 416AC_MSG_RESULT($cf_disable_rpath_hack) 417if test "$cf_disable_rpath_hack" = no ; then 418 CF_RPATH_HACK 419fi 420]) 421dnl --------------------------------------------------------------------------- 422dnl CF_ENABLE_NARROWPROTO version: 3 updated: 2006/02/12 17:46:00 423dnl --------------------- 424dnl If this is not set properly, Xaw's scrollbars will not work. 425dnl The so-called "modular" configuration for X.org omits most of the 426dnl configure checks that would be needed to provide compatibility with 427dnl older X builds. This one breaks things noticeably. 428AC_DEFUN([CF_ENABLE_NARROWPROTO], 429[ 430AC_MSG_CHECKING(if you want narrow prototypes for X libraries) 431 432case `$ac_config_guess` in #(vi 433*cygwin*|*freebsd*|*gnu*|*irix5*|*irix6*|*linux-gnu*|*netbsd*|*openbsd*|*qnx*|*sco*|*sgi*) #(vi 434 cf_default_narrowproto=yes 435 ;; 436*) 437 cf_default_narrowproto=no 438 ;; 439esac 440 441CF_ARG_OPTION(narrowproto, 442 [ --enable-narrowproto enable narrow prototypes for X libraries], 443 [enable_narrowproto=$enableval], 444 [enable_narrowproto=$cf_default_narrowproto], 445 [$cf_default_narrowproto]) 446AC_MSG_RESULT($enable_narrowproto) 447]) 448dnl --------------------------------------------------------------------------- 449dnl CF_ERRNO version: 5 updated: 1997/11/30 12:44:39 450dnl -------- 451dnl Check if 'errno' is declared in <errno.h> 452AC_DEFUN([CF_ERRNO], 453[ 454CF_CHECK_ERRNO(errno) 455])dnl 456dnl --------------------------------------------------------------------------- 457dnl CF_FUNC_MEMMOVE version: 7 updated: 2006/12/16 12:33:30 458dnl --------------- 459dnl Check for memmove, or a bcopy that can handle overlapping copy. If neither 460dnl is found, add our own version of memmove to the list of objects. 461AC_DEFUN([CF_FUNC_MEMMOVE], 462[ 463AC_CHECK_FUNC(memmove,,[ 464AC_CHECK_FUNC(bcopy,[ 465 AC_CACHE_CHECK(if bcopy does overlapping moves,cf_cv_good_bcopy,[ 466 AC_TRY_RUN([ 467int main() { 468 static char data[] = "abcdefghijklmnopqrstuwwxyz"; 469 char temp[40]; 470 bcopy(data, temp, sizeof(data)); 471 bcopy(temp+10, temp, 15); 472 bcopy(temp+5, temp+15, 10); 473 ${cf_cv_main_return:-return} (strcmp(temp, "klmnopqrstuwwxypqrstuwwxyz")); 474} 475 ], 476 [cf_cv_good_bcopy=yes], 477 [cf_cv_good_bcopy=no], 478 [cf_cv_good_bcopy=unknown]) 479 ]) 480 ],[cf_cv_good_bcopy=no]) 481 if test "$cf_cv_good_bcopy" = yes ; then 482 AC_DEFINE(USE_OK_BCOPY) 483 else 484 AC_DEFINE(USE_MY_MEMMOVE) 485 fi 486])])dnl 487dnl --------------------------------------------------------------------------- 488dnl CF_FUNC_TGETENT version: 15 updated: 2010/06/04 20:54:56 489dnl --------------- 490dnl Check for tgetent function in termcap library. If we cannot find this, 491dnl we'll use the $LINES and $COLUMNS environment variables to pass screen 492dnl size information to subprocesses. (We cannot use terminfo's compatibility 493dnl function, since it cannot provide the termcap-format data). 494dnl 495dnl If the --disable-full-tgetent option is given, we'll settle for the first 496dnl tgetent function we find. Since the search list in that case does not 497dnl include the termcap library, that allows us to default to terminfo. 498AC_DEFUN([CF_FUNC_TGETENT], 499[ 500# compute a reasonable value for $TERM to give tgetent(), since we may be 501# running in 'screen', which sets $TERMCAP to a specific entry that is not 502# necessarily in /etc/termcap - unsetenv is not portable, so we cannot simply 503# discard $TERMCAP. 504cf_TERMVAR=vt100 505test -n "$TERMCAP" && cf_TERMVAR="$TERM" 506test -z "$cf_TERMVAR" && cf_TERMVAR=vt100 507 508AC_MSG_CHECKING(if we want full tgetent function) 509CF_ARG_DISABLE(full-tgetent, 510 [ --disable-full-tgetent disable check for full tgetent function], 511 cf_full_tgetent=no, 512 cf_full_tgetent=yes,yes) 513AC_MSG_RESULT($cf_full_tgetent) 514 515if test "$cf_full_tgetent" = yes ; then 516 cf_test_message="full tgetent" 517else 518 cf_test_message="tgetent" 519fi 520 521AC_CACHE_CHECK(for $cf_test_message function,cf_cv_lib_tgetent,[ 522cf_save_LIBS="$LIBS" 523cf_cv_lib_tgetent=no 524if test "$cf_full_tgetent" = yes ; then 525 cf_TERMLIB="termcap termlib ncurses curses" 526 cf_TERMTST="buffer[[0]] == 0" 527else 528 cf_TERMLIB="termlib ncurses curses" 529 cf_TERMTST="0" 530fi 531for cf_termlib in '' $cf_TERMLIB ; do 532 LIBS="$cf_save_LIBS" 533 test -n "$cf_termlib" && CF_ADD_LIB($cf_termlib) 534 AC_TRY_RUN([ 535/* terminfo implementations ignore the buffer argument, making it useless for 536 * the xterm application, which uses this information to make a new TERMCAP 537 * environment variable. 538 */ 539int main() 540{ 541 char buffer[1024]; 542 buffer[0] = 0; 543 tgetent(buffer, "$cf_TERMVAR"); 544 ${cf_cv_main_return:-return} ($cf_TERMTST); }], 545 [echo "yes, there is a termcap/tgetent in $cf_termlib" 1>&AC_FD_CC 546 if test -n "$cf_termlib" ; then 547 cf_cv_lib_tgetent="-l$cf_termlib" 548 else 549 cf_cv_lib_tgetent=yes 550 fi 551 break], 552 [echo "no, there is no termcap/tgetent in $cf_termlib" 1>&AC_FD_CC], 553 [echo "cross-compiling, cannot verify if a termcap/tgetent is present in $cf_termlib" 1>&AC_FD_CC]) 554done 555LIBS="$cf_save_LIBS" 556]) 557 558# If we found a working tgetent(), set LIBS and check for termcap.h. 559# (LIBS cannot be set inside AC_CACHE_CHECK; the commands there should 560# not have side effects other than setting the cache variable, because 561# they are not executed when a cached value exists.) 562if test "$cf_cv_lib_tgetent" != no ; then 563 test "$cf_cv_lib_tgetent" != yes && CF_ADD_LIBS($cf_cv_lib_tgetent) 564 AC_DEFINE(USE_TERMCAP) 565 if test "$cf_full_tgetent" = no ; then 566 AC_TRY_COMPILE([ 567#include <termcap.h>],[ 568#ifdef NCURSES_VERSION 569make an error 570#endif],[AC_DEFINE(HAVE_TERMCAP_H)]) 571 else 572 AC_CHECK_HEADERS(termcap.h) 573 fi 574else 575 # If we didn't find a tgetent() that supports the buffer 576 # argument, look again to see whether we can find even 577 # a crippled one. A crippled tgetent() is still useful to 578 # validate values for the TERM environment variable given to 579 # child processes. 580 AC_CACHE_CHECK(for partial tgetent function,cf_cv_lib_part_tgetent,[ 581 cf_cv_lib_part_tgetent=no 582 for cf_termlib in $cf_TERMLIB ; do 583 LIBS="$cf_save_LIBS -l$cf_termlib" 584 AC_TRY_LINK([],[tgetent(0, "$cf_TERMVAR")], 585 [echo "there is a terminfo/tgetent in $cf_termlib" 1>&AC_FD_CC 586 cf_cv_lib_part_tgetent="-l$cf_termlib" 587 break]) 588 done 589 LIBS="$cf_save_LIBS" 590 ]) 591 592 if test "$cf_cv_lib_part_tgetent" != no ; then 593 CF_ADD_LIBS($cf_cv_lib_part_tgetent) 594 AC_CHECK_HEADERS(termcap.h) 595 596 # If this is linking against ncurses, we'll trigger the 597 # ifdef in resize.c that turns the termcap stuff back off. 598 AC_DEFINE(USE_TERMINFO) 599 fi 600fi 601])dnl 602dnl --------------------------------------------------------------------------- 603dnl CF_GCC_ATTRIBUTES version: 13 updated: 2009/08/11 20:19:56 604dnl ----------------- 605dnl Test for availability of useful gcc __attribute__ directives to quiet 606dnl compiler warnings. Though useful, not all are supported -- and contrary 607dnl to documentation, unrecognized directives cause older compilers to barf. 608AC_DEFUN([CF_GCC_ATTRIBUTES], 609[ 610if test "$GCC" = yes 611then 612cat > conftest.i <<EOF 613#ifndef GCC_PRINTF 614#define GCC_PRINTF 0 615#endif 616#ifndef GCC_SCANF 617#define GCC_SCANF 0 618#endif 619#ifndef GCC_NORETURN 620#define GCC_NORETURN /* nothing */ 621#endif 622#ifndef GCC_UNUSED 623#define GCC_UNUSED /* nothing */ 624#endif 625EOF 626if test "$GCC" = yes 627then 628 AC_CHECKING([for $CC __attribute__ directives]) 629cat > conftest.$ac_ext <<EOF 630#line __oline__ "${as_me-configure}" 631#include "confdefs.h" 632#include "conftest.h" 633#include "conftest.i" 634#if GCC_PRINTF 635#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) 636#else 637#define GCC_PRINTFLIKE(fmt,var) /*nothing*/ 638#endif 639#if GCC_SCANF 640#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) 641#else 642#define GCC_SCANFLIKE(fmt,var) /*nothing*/ 643#endif 644extern void wow(char *,...) GCC_SCANFLIKE(1,2); 645extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; 646extern void foo(void) GCC_NORETURN; 647int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; } 648EOF 649 cf_printf_attribute=no 650 cf_scanf_attribute=no 651 for cf_attribute in scanf printf unused noreturn 652 do 653 CF_UPPER(cf_ATTRIBUTE,$cf_attribute) 654 cf_directive="__attribute__(($cf_attribute))" 655 echo "checking for $CC $cf_directive" 1>&AC_FD_CC 656 657 case $cf_attribute in #(vi 658 printf) #(vi 659 cf_printf_attribute=yes 660 cat >conftest.h <<EOF 661#define GCC_$cf_ATTRIBUTE 1 662EOF 663 ;; 664 scanf) #(vi 665 cf_scanf_attribute=yes 666 cat >conftest.h <<EOF 667#define GCC_$cf_ATTRIBUTE 1 668EOF 669 ;; 670 *) #(vi 671 cat >conftest.h <<EOF 672#define GCC_$cf_ATTRIBUTE $cf_directive 673EOF 674 ;; 675 esac 676 677 if AC_TRY_EVAL(ac_compile); then 678 test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute) 679 cat conftest.h >>confdefs.h 680 case $cf_attribute in #(vi 681 printf) #(vi 682 if test "$cf_printf_attribute" = no ; then 683 cat >>confdefs.h <<EOF 684#define GCC_PRINTFLIKE(fmt,var) /* nothing */ 685EOF 686 else 687 cat >>confdefs.h <<EOF 688#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) 689EOF 690 fi 691 ;; 692 scanf) #(vi 693 if test "$cf_scanf_attribute" = no ; then 694 cat >>confdefs.h <<EOF 695#define GCC_SCANFLIKE(fmt,var) /* nothing */ 696EOF 697 else 698 cat >>confdefs.h <<EOF 699#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) 700EOF 701 fi 702 ;; 703 esac 704 fi 705 done 706else 707 fgrep define conftest.i >>confdefs.h 708fi 709rm -rf conftest* 710fi 711])dnl 712dnl --------------------------------------------------------------------------- 713dnl CF_GCC_VERSION version: 5 updated: 2010/04/24 11:02:31 714dnl -------------- 715dnl Find version of gcc 716AC_DEFUN([CF_GCC_VERSION],[ 717AC_REQUIRE([AC_PROG_CC]) 718GCC_VERSION=none 719if test "$GCC" = yes ; then 720 AC_MSG_CHECKING(version of $CC) 721 GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`" 722 test -z "$GCC_VERSION" && GCC_VERSION=unknown 723 AC_MSG_RESULT($GCC_VERSION) 724fi 725])dnl 726dnl --------------------------------------------------------------------------- 727dnl CF_GCC_WARNINGS version: 25 updated: 2010/04/24 11:03:31 728dnl --------------- 729dnl Check if the compiler supports useful warning options. There's a few that 730dnl we don't use, simply because they're too noisy: 731dnl 732dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x) 733dnl -Wredundant-decls (system headers make this too noisy) 734dnl -Wtraditional (combines too many unrelated messages, only a few useful) 735dnl -Wwrite-strings (too noisy, but should review occasionally). This 736dnl is enabled for ncurses using "--enable-const". 737dnl -pedantic 738dnl 739dnl Parameter: 740dnl $1 is an optional list of gcc warning flags that a particular 741dnl application might want to use, e.g., "no-unused" for 742dnl -Wno-unused 743dnl Special: 744dnl If $with_ext_const is "yes", add a check for -Wwrite-strings 745dnl 746AC_DEFUN([CF_GCC_WARNINGS], 747[ 748AC_REQUIRE([CF_GCC_VERSION]) 749CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS) 750 751cat > conftest.$ac_ext <<EOF 752#line __oline__ "${as_me-configure}" 753int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; } 754EOF 755 756if test "$INTEL_COMPILER" = yes 757then 758# The "-wdXXX" options suppress warnings: 759# remark #1419: external declaration in primary source file 760# remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem) 761# remark #1684: conversion from pointer to same-sized integral type (potential portability problem) 762# remark #193: zero used for undefined preprocessing identifier 763# remark #593: variable "curs_sb_left_arrow" was set but never used 764# remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits 765# remark #869: parameter "tw" was never referenced 766# remark #981: operands are evaluated in unspecified order 767# warning #279: controlling expression is constant 768 769 AC_CHECKING([for $CC warning options]) 770 cf_save_CFLAGS="$CFLAGS" 771 EXTRA_CFLAGS="-Wall" 772 for cf_opt in \ 773 wd1419 \ 774 wd1683 \ 775 wd1684 \ 776 wd193 \ 777 wd593 \ 778 wd279 \ 779 wd810 \ 780 wd869 \ 781 wd981 782 do 783 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" 784 if AC_TRY_EVAL(ac_compile); then 785 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt) 786 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" 787 fi 788 done 789 CFLAGS="$cf_save_CFLAGS" 790 791elif test "$GCC" = yes 792then 793 AC_CHECKING([for $CC warning options]) 794 cf_save_CFLAGS="$CFLAGS" 795 EXTRA_CFLAGS= 796 cf_warn_CONST="" 797 test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings" 798 for cf_opt in W Wall \ 799 Wbad-function-cast \ 800 Wcast-align \ 801 Wcast-qual \ 802 Winline \ 803 Wmissing-declarations \ 804 Wmissing-prototypes \ 805 Wnested-externs \ 806 Wpointer-arith \ 807 Wshadow \ 808 Wstrict-prototypes \ 809 Wundef $cf_warn_CONST $1 810 do 811 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" 812 if AC_TRY_EVAL(ac_compile); then 813 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt) 814 case $cf_opt in #(vi 815 Wcast-qual) #(vi 816 CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES" 817 ;; 818 Winline) #(vi 819 case $GCC_VERSION in 820 [[34]].*) 821 CF_VERBOSE(feature is broken in gcc $GCC_VERSION) 822 continue;; 823 esac 824 ;; 825 esac 826 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" 827 fi 828 done 829 CFLAGS="$cf_save_CFLAGS" 830fi 831rm -f conftest* 832 833AC_SUBST(EXTRA_CFLAGS) 834])dnl 835dnl --------------------------------------------------------------------------- 836dnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07 837dnl ------------- 838dnl Check if we must define _GNU_SOURCE to get a reasonable value for 839dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect 840dnl (or misfeature) of glibc2, which breaks portability of many applications, 841dnl since it is interwoven with GNU extensions. 842dnl 843dnl Well, yes we could work around it... 844AC_DEFUN([CF_GNU_SOURCE], 845[ 846AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[ 847AC_TRY_COMPILE([#include <sys/types.h>],[ 848#ifndef _XOPEN_SOURCE 849make an error 850#endif], 851 [cf_cv_gnu_source=no], 852 [cf_save="$CPPFLAGS" 853 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" 854 AC_TRY_COMPILE([#include <sys/types.h>],[ 855#ifdef _XOPEN_SOURCE 856make an error 857#endif], 858 [cf_cv_gnu_source=no], 859 [cf_cv_gnu_source=yes]) 860 CPPFLAGS="$cf_save" 861 ]) 862]) 863test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" 864])dnl 865dnl --------------------------------------------------------------------------- 866dnl CF_HELP_MESSAGE version: 3 updated: 1998/01/14 10:56:23 867dnl --------------- 868dnl Insert text into the help-message, for readability, from AC_ARG_WITH. 869AC_DEFUN([CF_HELP_MESSAGE], 870[AC_DIVERT_HELP([$1])dnl 871])dnl 872dnl --------------------------------------------------------------------------- 873dnl CF_IMAKE_CFLAGS version: 31 updated: 2010/05/26 05:38:42 874dnl --------------- 875dnl Use imake to obtain compiler flags. We could, in principle, write tests to 876dnl get these, but if imake is properly configured there is no point in doing 877dnl this. 878dnl 879dnl Parameters (used in constructing a sample Imakefile): 880dnl $1 = optional value to append to $IMAKE_CFLAGS 881dnl $2 = optional value to append to $IMAKE_LOADFLAGS 882AC_DEFUN([CF_IMAKE_CFLAGS], 883[ 884AC_PATH_PROGS(IMAKE,xmkmf imake) 885 886if test -n "$IMAKE" ; then 887 888case $IMAKE in # (vi 889*/imake) 890 cf_imake_opts="-DUseInstalled=YES" # (vi 891 ;; 892*/util/xmkmf) 893 # A single parameter tells xmkmf where the config-files are: 894 cf_imake_opts="`echo $IMAKE|sed -e s,/config/util/xmkmf,,`" # (vi 895 ;; 896*) 897 cf_imake_opts= 898 ;; 899esac 900 901# If it's installed properly, imake (or its wrapper, xmkmf) will point to the 902# config directory. 903if mkdir conftestdir; then 904 CDPATH=; export CDPATH 905 cf_makefile=`cd $srcdir;pwd`/Imakefile 906 cd conftestdir 907 908 cat >fix_cflags.sed <<'CF_EOF' 909s/\\//g 910s/[[ ]][[ ]]*/ /g 911s/"//g 912:pack 913s/\(=[[^ ]][[^ ]]*\) \([[^-]]\)/\1 \2/g 914t pack 915s/\(-D[[a-zA-Z0-9_]][[a-zA-Z0-9_]]*\)=\([[^\'0-9 ]][[^ ]]*\)/\1='\\"\2\\"'/g 916s/^IMAKE[[ ]]/IMAKE_CFLAGS="/ 917s/ / /g 918s/$/"/ 919CF_EOF 920 921 cat >fix_lflags.sed <<'CF_EOF' 922s/^IMAKE[[ ]]*/IMAKE_LOADFLAGS="/ 923s/$/"/ 924CF_EOF 925 926 echo >./Imakefile 927 test -f $cf_makefile && cat $cf_makefile >>./Imakefile 928 929 cat >> ./Imakefile <<'CF_EOF' 930findstddefs: 931 @echo IMAKE ${ALLDEFINES}ifelse([$1],,,[ $1]) | sed -f fix_cflags.sed 932 @echo IMAKE ${EXTRA_LOAD_FLAGS}ifelse([$2],,,[ $2]) | sed -f fix_lflags.sed 933CF_EOF 934 935 if ( $IMAKE $cf_imake_opts 1>/dev/null 2>&AC_FD_CC && test -f Makefile) 936 then 937 CF_VERBOSE(Using $IMAKE $cf_imake_opts) 938 else 939 # sometimes imake doesn't have the config path compiled in. Find it. 940 cf_config= 941 for cf_libpath in $X_LIBS $LIBS ; do 942 case $cf_libpath in # (vi 943 -L*) 944 cf_libpath=`echo .$cf_libpath | sed -e 's/^...//'` 945 cf_libpath=$cf_libpath/X11/config 946 if test -d $cf_libpath ; then 947 cf_config=$cf_libpath 948 break 949 fi 950 ;; 951 esac 952 done 953 if test -z "$cf_config" ; then 954 AC_MSG_WARN(Could not find imake config-directory) 955 else 956 cf_imake_opts="$cf_imake_opts -I$cf_config" 957 if ( $IMAKE -v $cf_imake_opts 2>&AC_FD_CC) 958 then 959 CF_VERBOSE(Using $IMAKE $cf_config) 960 else 961 AC_MSG_WARN(Cannot run $IMAKE) 962 fi 963 fi 964 fi 965 966 # GNU make sometimes prints "make[1]: Entering...", which 967 # would confuse us. 968 eval `make findstddefs 2>/dev/null | grep -v make` 969 970 cd .. 971 rm -rf conftestdir 972 973 # We use ${ALLDEFINES} rather than ${STD_DEFINES} because the former 974 # declares XTFUNCPROTO there. However, some vendors (e.g., SGI) have 975 # modified it to support site.cf, adding a kludge for the /usr/include 976 # directory. Try to filter that out, otherwise gcc won't find its 977 # headers. 978 if test -n "$GCC" ; then 979 if test -n "$IMAKE_CFLAGS" ; then 980 cf_nostdinc="" 981 cf_std_incl="" 982 cf_cpp_opts="" 983 for cf_opt in $IMAKE_CFLAGS 984 do 985 case "$cf_opt" in 986 -nostdinc) #(vi 987 cf_nostdinc="$cf_opt" 988 ;; 989 -I/usr/include) #(vi 990 cf_std_incl="$cf_opt" 991 ;; 992 *) #(vi 993 cf_cpp_opts="$cf_cpp_opts $cf_opt" 994 ;; 995 esac 996 done 997 if test -z "$cf_nostdinc" ; then 998 IMAKE_CFLAGS="$cf_cpp_opts $cf_std_incl" 999 elif test -z "$cf_std_incl" ; then 1000 IMAKE_CFLAGS="$cf_cpp_opts $cf_nostdinc" 1001 else 1002 CF_VERBOSE(suppressed \"$cf_nostdinc\" and \"$cf_std_incl\") 1003 IMAKE_CFLAGS="$cf_cpp_opts" 1004 fi 1005 fi 1006 fi 1007fi 1008 1009# Some imake configurations define PROJECTROOT with an empty value. Remove 1010# the empty definition. 1011case $IMAKE_CFLAGS in 1012*-DPROJECTROOT=/*) 1013 ;; 1014*) 1015 IMAKE_CFLAGS=`echo "$IMAKE_CFLAGS" |sed -e "s,-DPROJECTROOT=[[ ]], ,"` 1016 ;; 1017esac 1018 1019fi 1020 1021CF_VERBOSE(IMAKE_CFLAGS $IMAKE_CFLAGS) 1022CF_VERBOSE(IMAKE_LOADFLAGS $IMAKE_LOADFLAGS) 1023 1024AC_SUBST(IMAKE_CFLAGS) 1025AC_SUBST(IMAKE_LOADFLAGS) 1026])dnl 1027dnl --------------------------------------------------------------------------- 1028dnl CF_INPUT_METHOD version: 3 updated: 2000/04/11 23:46:57 1029dnl --------------- 1030dnl Check if the X libraries support input-method 1031AC_DEFUN([CF_INPUT_METHOD], 1032[ 1033AC_CACHE_CHECK([if X libraries support input-method],cf_cv_input_method,[ 1034AC_TRY_LINK([ 1035#include <X11/IntrinsicP.h> 1036#include <X11/Xatom.h> 1037#include <X11/Xutil.h> 1038#include <X11/Xmu/Atoms.h> 1039#include <X11/Xmu/Converters.h> 1040#include <X11/Xaw/XawImP.h> 1041],[ 1042{ 1043 XIM xim; 1044 XIMStyles *xim_styles = 0; 1045 XIMStyle input_style; 1046 Widget w = 0; 1047 1048 XSetLocaleModifiers("@im=none"); 1049 xim = XOpenIM(XtDisplay(w), NULL, NULL, NULL); 1050 XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL); 1051 XCloseIM(xim); 1052 input_style = (XIMPreeditNothing | XIMStatusNothing); 1053} 1054], 1055[cf_cv_input_method=yes], 1056[cf_cv_input_method=no])]) 1057])dnl 1058dnl --------------------------------------------------------------------------- 1059dnl CF_INTEL_COMPILER version: 4 updated: 2010/05/26 05:38:42 1060dnl ----------------- 1061dnl Check if the given compiler is really the Intel compiler for Linux. It 1062dnl tries to imitate gcc, but does not return an error when it finds a mismatch 1063dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK. 1064dnl 1065dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to 1066dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from 1067dnl the wrappers for gcc and g++ warnings. 1068dnl 1069dnl $1 = GCC (default) or GXX 1070dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS 1071dnl $3 = CFLAGS (default) or CXXFLAGS 1072AC_DEFUN([CF_INTEL_COMPILER],[ 1073ifelse([$2],,INTEL_COMPILER,[$2])=no 1074 1075if test "$ifelse([$1],,[$1],GCC)" = yes ; then 1076 case $host_os in 1077 linux*|gnu*) 1078 AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler) 1079 cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" 1080 ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc" 1081 AC_TRY_COMPILE([],[ 1082#ifdef __INTEL_COMPILER 1083#else 1084make an error 1085#endif 1086],[ifelse([$2],,INTEL_COMPILER,[$2])=yes 1087cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc" 1088],[]) 1089 ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" 1090 AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2])) 1091 ;; 1092 esac 1093fi 1094])dnl 1095dnl --------------------------------------------------------------------------- 1096dnl CF_LASTLOG version: 4 updated: 2002/10/27 23:21:42 1097dnl ---------- 1098dnl Check for header defining _PATH_LASTLOG, or failing that, see if the lastlog 1099dnl file exists. 1100AC_DEFUN([CF_LASTLOG], 1101[ 1102AC_CHECK_HEADERS(lastlog.h paths.h) 1103AC_CACHE_CHECK(for lastlog path,cf_cv_path_lastlog,[ 1104AC_TRY_COMPILE([ 1105#include <sys/types.h> 1106#ifdef HAVE_LASTLOG_H 1107#include <lastlog.h> 1108#else 1109#ifdef HAVE_PATHS_H 1110#include <paths.h> 1111#endif 1112#endif],[char *path = _PATH_LASTLOG], 1113 [cf_cv_path_lastlog="_PATH_LASTLOG"], 1114 [if test -f /usr/adm/lastlog ; then 1115 cf_cv_path_lastlog=/usr/adm/lastlog 1116 else 1117 cf_cv_path_lastlog=no 1118 fi]) 1119]) 1120test $cf_cv_path_lastlog != no && AC_DEFINE(USE_LASTLOG) 1121])dnl 1122dnl --------------------------------------------------------------------------- 1123dnl CF_LD_RPATH_OPT version: 3 updated: 2010/06/02 05:03:05 1124dnl --------------- 1125dnl For the given system and compiler, find the compiler flags to pass to the 1126dnl loader to use the "rpath" feature. 1127AC_DEFUN([CF_LD_RPATH_OPT], 1128[ 1129AC_REQUIRE([CF_CHECK_CACHE]) 1130 1131LD_RPATH_OPT= 1132AC_MSG_CHECKING(for an rpath option) 1133case $cf_cv_system_name in #(vi 1134irix*) #(vi 1135 if test "$GCC" = yes; then 1136 LD_RPATH_OPT="-Wl,-rpath," 1137 else 1138 LD_RPATH_OPT="-rpath " 1139 fi 1140 ;; 1141linux*|gnu*|k*bsd*-gnu) #(vi 1142 LD_RPATH_OPT="-Wl,-rpath," 1143 ;; 1144openbsd[[2-9]].*) #(vi 1145 LD_RPATH_OPT="-Wl,-rpath," 1146 ;; 1147freebsd*) #(vi 1148 LD_RPATH_OPT="-rpath " 1149 ;; 1150netbsd*) #(vi 1151 LD_RPATH_OPT="-Wl,-rpath," 1152 ;; 1153osf*|mls+*) #(vi 1154 LD_RPATH_OPT="-rpath " 1155 ;; 1156solaris2*) #(vi 1157 LD_RPATH_OPT="-R" 1158 ;; 1159*) 1160 ;; 1161esac 1162AC_MSG_RESULT($LD_RPATH_OPT) 1163 1164case "x$LD_RPATH_OPT" in #(vi 1165x-R*) 1166 AC_MSG_CHECKING(if we need a space after rpath option) 1167 cf_save_LIBS="$LIBS" 1168 CF_ADD_LIBS(${LD_RPATH_OPT}$libdir) 1169 AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes) 1170 LIBS="$cf_save_LIBS" 1171 AC_MSG_RESULT($cf_rpath_space) 1172 test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT " 1173 ;; 1174esac 1175])dnl 1176dnl --------------------------------------------------------------------------- 1177dnl CF_MAKE_TAGS version: 5 updated: 2010/04/03 20:07:32 1178dnl ------------ 1179dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have 1180dnl a monocase filesystem. 1181AC_DEFUN([CF_MAKE_TAGS],[ 1182AC_REQUIRE([CF_MIXEDCASE_FILENAMES]) 1183 1184AC_CHECK_PROGS(CTAGS, exctags ctags) 1185AC_CHECK_PROGS(ETAGS, exetags etags) 1186 1187AC_CHECK_PROG(MAKE_LOWER_TAGS, ${CTAGS-ctags}, yes, no) 1188 1189if test "$cf_cv_mixedcase" = yes ; then 1190 AC_CHECK_PROG(MAKE_UPPER_TAGS, ${ETAGS-etags}, yes, no) 1191else 1192 MAKE_UPPER_TAGS=no 1193fi 1194 1195if test "$MAKE_UPPER_TAGS" = yes ; then 1196 MAKE_UPPER_TAGS= 1197else 1198 MAKE_UPPER_TAGS="#" 1199fi 1200 1201if test "$MAKE_LOWER_TAGS" = yes ; then 1202 MAKE_LOWER_TAGS= 1203else 1204 MAKE_LOWER_TAGS="#" 1205fi 1206 1207AC_SUBST(CTAGS) 1208AC_SUBST(ETAGS) 1209 1210AC_SUBST(MAKE_UPPER_TAGS) 1211AC_SUBST(MAKE_LOWER_TAGS) 1212])dnl 1213dnl --------------------------------------------------------------------------- 1214dnl CF_MIXEDCASE_FILENAMES version: 3 updated: 2003/09/20 17:07:55 1215dnl ---------------------- 1216dnl Check if the file-system supports mixed-case filenames. If we're able to 1217dnl create a lowercase name and see it as uppercase, it doesn't support that. 1218AC_DEFUN([CF_MIXEDCASE_FILENAMES], 1219[ 1220AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[ 1221if test "$cross_compiling" = yes ; then 1222 case $target_alias in #(vi 1223 *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-mingw32*|*-uwin*) #(vi 1224 cf_cv_mixedcase=no 1225 ;; 1226 *) 1227 cf_cv_mixedcase=yes 1228 ;; 1229 esac 1230else 1231 rm -f conftest CONFTEST 1232 echo test >conftest 1233 if test -f CONFTEST ; then 1234 cf_cv_mixedcase=no 1235 else 1236 cf_cv_mixedcase=yes 1237 fi 1238 rm -f conftest CONFTEST 1239fi 1240]) 1241test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES) 1242])dnl 1243dnl --------------------------------------------------------------------------- 1244dnl CF_MSG_LOG version: 4 updated: 2007/07/29 09:55:12 1245dnl ---------- 1246dnl Write a debug message to config.log, along with the line number in the 1247dnl configure script. 1248AC_DEFUN([CF_MSG_LOG],[ 1249echo "${as_me-configure}:__oline__: testing $* ..." 1>&AC_FD_CC 1250])dnl 1251dnl --------------------------------------------------------------------------- 1252dnl CF_PATHSEP version: 5 updated: 2010/05/26 05:38:42 1253dnl ---------- 1254dnl Provide a value for the $PATH and similar separator 1255AC_DEFUN([CF_PATHSEP], 1256[ 1257 case $cf_cv_system_name in 1258 os2*) PATH_SEPARATOR=';' ;; 1259 *) PATH_SEPARATOR=':' ;; 1260 esac 1261ifelse([$1],,,[$1=$PATH_SEPARATOR]) 1262 AC_SUBST(PATH_SEPARATOR) 1263])dnl 1264dnl --------------------------------------------------------------------------- 1265dnl CF_PATH_PROG version: 7 updated: 2009/01/11 20:34:16 1266dnl ------------ 1267dnl Check for a given program, defining corresponding symbol. 1268dnl $1 = environment variable, which is suffixed by "_PATH" in the #define. 1269dnl $2 = program name to find. 1270dnl $3 = optional list of additional program names to test. 1271dnl 1272dnl If there is more than one token in the result, #define the remaining tokens 1273dnl to $1_ARGS. We need this for 'install' in particular. 1274dnl 1275dnl FIXME: we should allow this to be overridden by environment variables 1276dnl 1277AC_DEFUN([CF_PATH_PROG],[ 1278AC_REQUIRE([CF_PATHSEP]) 1279test -z "[$]$1" && $1=$2 1280AC_PATH_PROGS($1,[$]$1 $2 $3,[$]$1) 1281 1282cf_path_prog="" 1283cf_path_args="" 1284IFS="${IFS= }"; cf_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR" 1285for cf_temp in $ac_cv_path_$1 1286do 1287 if test -z "$cf_path_prog" ; then 1288 if test "$with_full_paths" = yes ; then 1289 CF_PATH_SYNTAX(cf_temp,break) 1290 cf_path_prog="$cf_temp" 1291 else 1292 cf_path_prog="`basename $cf_temp`" 1293 fi 1294 elif test -z "$cf_path_args" ; then 1295 cf_path_args="$cf_temp" 1296 else 1297 cf_path_args="$cf_path_args $cf_temp" 1298 fi 1299done 1300IFS="$cf_save_ifs" 1301 1302if test -n "$cf_path_prog" ; then 1303 CF_MSG_LOG(defining path for ${cf_path_prog}) 1304 AC_DEFINE_UNQUOTED($1_PATH,"$cf_path_prog") 1305 test -n "$cf_path_args" && AC_DEFINE_UNQUOTED($1_ARGS,"$cf_path_args") 1306fi 1307])dnl 1308dnl --------------------------------------------------------------------------- 1309dnl CF_PATH_SYNTAX version: 13 updated: 2010/05/26 05:38:42 1310dnl -------------- 1311dnl Check the argument to see that it looks like a pathname. Rewrite it if it 1312dnl begins with one of the prefix/exec_prefix variables, and then again if the 1313dnl result begins with 'NONE'. This is necessary to work around autoconf's 1314dnl delayed evaluation of those symbols. 1315AC_DEFUN([CF_PATH_SYNTAX],[ 1316if test "x$prefix" != xNONE; then 1317 cf_path_syntax="$prefix" 1318else 1319 cf_path_syntax="$ac_default_prefix" 1320fi 1321 1322case ".[$]$1" in #(vi 1323.\[$]\(*\)*|.\'*\'*) #(vi 1324 ;; 1325..|./*|.\\*) #(vi 1326 ;; 1327.[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX 1328 ;; 1329.\[$]{*prefix}*) #(vi 1330 eval $1="[$]$1" 1331 case ".[$]$1" in #(vi 1332 .NONE/*) 1333 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%` 1334 ;; 1335 esac 1336 ;; #(vi 1337.no|.NONE/*) 1338 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%` 1339 ;; 1340*) 1341 ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2) 1342 ;; 1343esac 1344])dnl 1345dnl --------------------------------------------------------------------------- 1346dnl CF_PKG_CONFIG version: 3 updated: 2009/01/25 10:55:09 1347dnl ------------- 1348dnl Check for the package-config program, unless disabled by command-line. 1349AC_DEFUN([CF_PKG_CONFIG], 1350[ 1351AC_MSG_CHECKING(if you want to use pkg-config) 1352AC_ARG_WITH(pkg-config, 1353 [ --with-pkg-config{=path} enable/disable use of pkg-config], 1354 [cf_pkg_config=$withval], 1355 [cf_pkg_config=yes]) 1356AC_MSG_RESULT($cf_pkg_config) 1357 1358case $cf_pkg_config in #(vi 1359no) #(vi 1360 PKG_CONFIG=none 1361 ;; 1362yes) #(vi 1363 AC_PATH_PROG(PKG_CONFIG, pkg-config, none) 1364 ;; 1365*) 1366 PKG_CONFIG=$withval 1367 ;; 1368esac 1369 1370test -z "$PKG_CONFIG" && PKG_CONFIG=none 1371if test "$PKG_CONFIG" != none ; then 1372 CF_PATH_SYNTAX(PKG_CONFIG) 1373fi 1374 1375AC_SUBST(PKG_CONFIG) 1376])dnl 1377dnl --------------------------------------------------------------------------- 1378dnl CF_POSIX_C_SOURCE version: 8 updated: 2010/05/26 05:38:42 1379dnl ----------------- 1380dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed. 1381dnl 1382dnl POSIX.1-1990 _POSIX_SOURCE 1383dnl POSIX.1-1990 and _POSIX_SOURCE and 1384dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2 1385dnl Bindings Option 1386dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L 1387dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L 1388dnl X/Open 2000 _POSIX_C_SOURCE=200112L 1389dnl 1390dnl Parameters: 1391dnl $1 is the nominal value for _POSIX_C_SOURCE 1392AC_DEFUN([CF_POSIX_C_SOURCE], 1393[ 1394cf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1]) 1395 1396cf_save_CFLAGS="$CFLAGS" 1397cf_save_CPPFLAGS="$CPPFLAGS" 1398 1399CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE) 1400CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE) 1401 1402AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[ 1403 CF_MSG_LOG(if the symbol is already defined go no further) 1404 AC_TRY_COMPILE([#include <sys/types.h>],[ 1405#ifndef _POSIX_C_SOURCE 1406make an error 1407#endif], 1408 [cf_cv_posix_c_source=no], 1409 [cf_want_posix_source=no 1410 case .$cf_POSIX_C_SOURCE in #(vi 1411 .[[12]]??*) #(vi 1412 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" 1413 ;; 1414 .2) #(vi 1415 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" 1416 cf_want_posix_source=yes 1417 ;; 1418 .*) 1419 cf_want_posix_source=yes 1420 ;; 1421 esac 1422 if test "$cf_want_posix_source" = yes ; then 1423 AC_TRY_COMPILE([#include <sys/types.h>],[ 1424#ifdef _POSIX_SOURCE 1425make an error 1426#endif],[], 1427 cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE") 1428 fi 1429 CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE) 1430 CFLAGS="$cf_trim_CFLAGS" 1431 CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source" 1432 CF_MSG_LOG(if the second compile does not leave our definition intact error) 1433 AC_TRY_COMPILE([#include <sys/types.h>],[ 1434#ifndef _POSIX_C_SOURCE 1435make an error 1436#endif],, 1437 [cf_cv_posix_c_source=no]) 1438 CFLAGS="$cf_save_CFLAGS" 1439 CPPFLAGS="$cf_save_CPPFLAGS" 1440 ]) 1441]) 1442 1443if test "$cf_cv_posix_c_source" != no ; then 1444 CFLAGS="$cf_trim_CFLAGS" 1445 CPPFLAGS="$cf_trim_CPPFLAGS" 1446 CF_ADD_CFLAGS($cf_cv_posix_c_source) 1447fi 1448 1449])dnl 1450dnl --------------------------------------------------------------------------- 1451dnl CF_POSIX_SAVED_IDS version: 7 updated: 2007/03/14 16:43:53 1452dnl ------------------ 1453dnl 1454dnl Check first if saved-ids are always supported. Some systems 1455dnl may require runtime checks. 1456AC_DEFUN([CF_POSIX_SAVED_IDS], 1457[ 1458AC_CHECK_HEADERS( \ 1459sys/param.h \ 1460) 1461 1462AC_CACHE_CHECK(if POSIX saved-ids are supported,cf_cv_posix_saved_ids,[ 1463AC_TRY_LINK( 1464[ 1465#include <unistd.h> 1466#ifdef HAVE_SYS_PARAM_H 1467#include <sys/param.h> /* this may define "BSD" */ 1468#endif 1469],[ 1470#if defined(_POSIX_SAVED_IDS) && (_POSIX_SAVED_IDS > 0) 1471 void *p = (void *) seteuid; 1472 int x = seteuid(geteuid()); 1473#elif defined(BSD) && (BSD >= 199103) 1474/* The BSD's may implement the runtime check - and it fails. 1475 * However, saved-ids work almost like POSIX (close enough for most uses). 1476 */ 1477#else 1478make an error 1479#endif 1480],[cf_cv_posix_saved_ids=yes 1481],[ 1482AC_TRY_RUN([ 1483#ifdef HAVE_STDLIB_H 1484#include <stdlib.h> 1485#endif 1486#include <unistd.h> 1487int main() 1488{ 1489 void *p = (void *) seteuid; 1490 long code = sysconf(_SC_SAVED_IDS); 1491 ${cf_cv_main_return:-return} ((code > 0) ? 0 : 1); 1492}], 1493 cf_cv_posix_saved_ids=yes, 1494 cf_cv_posix_saved_ids=no, 1495 cf_cv_posix_saved_ids=unknown) 1496]) 1497]) 1498 1499test "$cf_cv_posix_saved_ids" = yes && AC_DEFINE(HAVE_POSIX_SAVED_IDS) 1500]) 1501dnl --------------------------------------------------------------------------- 1502dnl CF_POSIX_WAIT version: 2 updated: 2000/05/29 16:16:04 1503dnl ------------- 1504dnl Check for POSIX wait support 1505AC_DEFUN([CF_POSIX_WAIT], 1506[ 1507AC_REQUIRE([AC_HEADER_SYS_WAIT]) 1508AC_CACHE_CHECK(for POSIX wait functions,cf_cv_posix_wait,[ 1509AC_TRY_LINK([ 1510#include <stdlib.h> 1511#include <stdio.h> 1512#include <sys/types.h> 1513#ifdef HAVE_SYS_WAIT_H 1514#include <sys/wait.h> 1515#endif 1516],[ 1517 int stat_loc; 1518 pid_t pid = waitpid(-1, &stat_loc, WNOHANG|WUNTRACED); 1519 pid_t pid2 = wait(&stat_loc); 1520], 1521[cf_cv_posix_wait=yes], 1522[cf_cv_posix_wait=no]) 1523]) 1524test "$cf_cv_posix_wait" = yes && AC_DEFINE(USE_POSIX_WAIT) 1525])dnl 1526dnl --------------------------------------------------------------------------- 1527dnl CF_PROCFS_CWD version: 2 updated: 2007/03/12 20:39:04 1528dnl ------------- 1529dnl Find /proc tree (may be in a different place) which implements the "cwd" 1530dnl link. 1531AC_DEFUN([CF_PROCFS_CWD],[ 1532AC_CACHE_CHECK(for proc tree with cwd-support,cf_cv_procfs_cwd,[ 1533cf_cv_procfs_cwd=no 1534for cf_path in /proc /compat/linux/proc /usr/compat/linux/proc 1535do 1536 if test -d $cf_path && \ 1537 test -d $cf_path/$$ && \ 1538 ( test -d $cf_path/$$/cwd || \ 1539 test -L $cf_path/$$/cwd ); then 1540 cf_cv_procfs_cwd=$cf_path 1541 break 1542 fi 1543done 1544]) 1545])dnl 1546dnl --------------------------------------------------------------------------- 1547dnl CF_PROG_CC_U_D version: 1 updated: 2005/07/14 16:59:30 1548dnl -------------- 1549dnl Check if C (preprocessor) -U and -D options are processed in the order 1550dnl given rather than by type of option. Some compilers insist on apply all 1551dnl of the -U options after all of the -D options. Others allow mixing them, 1552dnl and may predefine symbols that conflict with those we define. 1553AC_DEFUN([CF_PROG_CC_U_D], 1554[ 1555AC_CACHE_CHECK(if $CC -U and -D options work together,cf_cv_cc_u_d_options,[ 1556 cf_save_CPPFLAGS="$CPPFLAGS" 1557 CPPFLAGS="-UU_D_OPTIONS -DU_D_OPTIONS -DD_U_OPTIONS -UD_U_OPTIONS" 1558 AC_TRY_COMPILE([],[ 1559#ifndef U_D_OPTIONS 1560make an undefined-error 1561#endif 1562#ifdef D_U_OPTIONS 1563make a defined-error 1564#endif 1565 ],[ 1566 cf_cv_cc_u_d_options=yes],[ 1567 cf_cv_cc_u_d_options=no]) 1568 CPPFLAGS="$cf_save_CPPFLAGS" 1569]) 1570])dnl 1571dnl --------------------------------------------------------------------------- 1572dnl CF_PROG_EXT version: 10 updated: 2004/01/03 19:28:18 1573dnl ----------- 1574dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX. 1575AC_DEFUN([CF_PROG_EXT], 1576[ 1577AC_REQUIRE([CF_CHECK_CACHE]) 1578case $cf_cv_system_name in 1579os2*) 1580 CFLAGS="$CFLAGS -Zmt" 1581 CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__" 1582 CXXFLAGS="$CXXFLAGS -Zmt" 1583 # autoconf's macro sets -Zexe and suffix both, which conflict:w 1584 LDFLAGS="$LDFLAGS -Zmt -Zcrtdll" 1585 ac_cv_exeext=.exe 1586 ;; 1587esac 1588 1589AC_EXEEXT 1590AC_OBJEXT 1591 1592PROG_EXT="$EXEEXT" 1593AC_SUBST(PROG_EXT) 1594test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT") 1595])dnl 1596dnl --------------------------------------------------------------------------- 1597dnl CF_REGEX version: 7 updated: 2010/05/29 16:31:02 1598dnl -------- 1599dnl Attempt to determine if we've got one of the flavors of regular-expression 1600dnl code that we can support. 1601AC_DEFUN([CF_REGEX], 1602[ 1603 1604cf_regex_func=no 1605 1606AC_CHECK_FUNC(regcomp,[cf_regex_func=regcomp],[ 1607 for cf_regex_lib in regex re 1608 do 1609 AC_CHECK_LIB($cf_regex_lib,regcomp,[ 1610 CF_ADD_LIB($cf_regex_lib) 1611 cf_regex_func=regcomp 1612 break]) 1613 done 1614]) 1615 1616if test "$cf_regex_func" = no ; then 1617 AC_CHECK_FUNC(compile,[cf_regex_func=compile],[ 1618 AC_CHECK_LIB(gen,compile,[ 1619 CF_ADD_LIB(gen) 1620 cf_regex_func=compile])]) 1621fi 1622 1623if test "$cf_regex_func" = no ; then 1624 AC_MSG_WARN(cannot find regular expression library) 1625fi 1626 1627AC_CACHE_CHECK(for regular-expression headers,cf_cv_regex_hdrs,[ 1628 1629cf_cv_regex_hdrs=no 1630case $cf_regex_func in #(vi 1631compile) #(vi 1632 for cf_regex_hdr in regexp.h regexpr.h 1633 do 1634 AC_TRY_LINK([#include <$cf_regex_hdr>],[ 1635 char *p = compile("", "", "", 0); 1636 int x = step("", ""); 1637 ],[ 1638 cf_cv_regex_hdrs=$cf_regex_hdr 1639 break 1640 ]) 1641 done 1642 ;; 1643*) 1644 for cf_regex_hdr in regex.h 1645 do 1646 AC_TRY_LINK([#include <sys/types.h> 1647#include <$cf_regex_hdr>],[ 1648 regex_t *p; 1649 int x = regcomp(p, "", 0); 1650 int y = regexec(p, "", 0, 0, 0); 1651 regfree(p); 1652 ],[ 1653 cf_cv_regex_hdrs=$cf_regex_hdr 1654 break 1655 ]) 1656 done 1657 ;; 1658esac 1659 1660]) 1661 1662case $cf_cv_regex_hdrs in #(vi 1663 no) AC_MSG_WARN(no regular expression header found) ;; #(vi 1664 regex.h) AC_DEFINE(HAVE_REGEX_H_FUNCS) ;; #(vi 1665 regexp.h) AC_DEFINE(HAVE_REGEXP_H_FUNCS) ;; #(vi 1666 regexpr.h) AC_DEFINE(HAVE_REGEXPR_H_FUNCS) ;; 1667esac 1668])dnl 1669dnl --------------------------------------------------------------------------- 1670dnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50 1671dnl ---------------- 1672dnl Remove all -U and -D options that refer to the given symbol from a list 1673dnl of C compiler options. This works around the problem that not all 1674dnl compilers process -U and -D options from left-to-right, so a -U option 1675dnl cannot be used to cancel the effect of a preceding -D option. 1676dnl 1677dnl $1 = target (which could be the same as the source variable) 1678dnl $2 = source (including '$') 1679dnl $3 = symbol to remove 1680define([CF_REMOVE_DEFINE], 1681[ 1682$1=`echo "$2" | \ 1683 sed -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[[ ]]/ /g' \ 1684 -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'` 1685])dnl 1686dnl --------------------------------------------------------------------------- 1687dnl CF_RPATH_HACK version: 8 updated: 2010/04/17 15:38:58 1688dnl ------------- 1689AC_DEFUN([CF_RPATH_HACK], 1690[ 1691AC_REQUIRE([CF_LD_RPATH_OPT]) 1692AC_MSG_CHECKING(for updated LDFLAGS) 1693if test -n "$LD_RPATH_OPT" ; then 1694 AC_MSG_RESULT(maybe) 1695 1696 AC_CHECK_PROGS(cf_ldd_prog,ldd,no) 1697 cf_rpath_list="/usr/lib /lib" 1698 if test "$cf_ldd_prog" != no 1699 then 1700AC_TRY_LINK([#include <stdio.h>], 1701 [printf("Hello");], 1702 [cf_rpath_list=`$cf_ldd_prog conftest$ac_exeext | fgrep / | sed -e 's%^.*[[ ]]/%/%' -e 's%/[[^/]][[^/]]*$%%' |sort -u`]) 1703 fi 1704 1705 CF_VERBOSE(...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS) 1706 1707 CF_RPATH_HACK_2(LDFLAGS) 1708 CF_RPATH_HACK_2(LIBS) 1709 1710 CF_VERBOSE(...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS) 1711fi 1712AC_SUBST(EXTRA_LDFLAGS) 1713])dnl 1714dnl --------------------------------------------------------------------------- 1715dnl CF_RPATH_HACK_2 version: 6 updated: 2010/04/17 16:31:24 1716dnl --------------- 1717dnl Do one set of substitutions for CF_RPATH_HACK, adding an rpath option to 1718dnl EXTRA_LDFLAGS for each -L option found. 1719dnl 1720dnl $cf_rpath_list contains a list of directories to ignore. 1721dnl 1722dnl $1 = variable name to update. The LDFLAGS variable should be the only one, 1723dnl but LIBS often has misplaced -L options. 1724AC_DEFUN([CF_RPATH_HACK_2], 1725[ 1726CF_VERBOSE(...checking $1 [$]$1) 1727 1728cf_rpath_dst= 1729for cf_rpath_src in [$]$1 1730do 1731 case $cf_rpath_src in #(vi 1732 -L*) #(vi 1733 1734 # check if this refers to a directory which we will ignore 1735 cf_rpath_skip=no 1736 if test -n "$cf_rpath_list" 1737 then 1738 for cf_rpath_item in $cf_rpath_list 1739 do 1740 if test "x$cf_rpath_src" = "x-L$cf_rpath_item" 1741 then 1742 cf_rpath_skip=yes 1743 break 1744 fi 1745 done 1746 fi 1747 1748 if test "$cf_rpath_skip" = no 1749 then 1750 # transform the option 1751 if test "$LD_RPATH_OPT" = "-R " ; then 1752 cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%-R %"` 1753 else 1754 cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%$LD_RPATH_OPT%"` 1755 fi 1756 1757 # if we have not already added this, add it now 1758 cf_rpath_tst=`echo "$EXTRA_LDFLAGS" | sed -e "s%$cf_rpath_tmp %%"` 1759 if test "x$cf_rpath_tst" = "x$EXTRA_LDFLAGS" 1760 then 1761 CF_VERBOSE(...Filter $cf_rpath_src ->$cf_rpath_tmp) 1762 EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS" 1763 fi 1764 fi 1765 ;; 1766 esac 1767 cf_rpath_dst="$cf_rpath_dst $cf_rpath_src" 1768done 1769$1=$cf_rpath_dst 1770 1771CF_VERBOSE(...checked $1 [$]$1) 1772AC_SUBST(EXTRA_LDFLAGS) 1773])dnl 1774dnl --------------------------------------------------------------------------- 1775dnl CF_SIGWINCH version: 1 updated: 2006/04/02 16:41:09 1776dnl ----------- 1777dnl Use this macro after CF_XOPEN_SOURCE, but do not require it (not all 1778dnl programs need this test). 1779dnl 1780dnl This is really a MacOS X 10.4.3 workaround. Defining _POSIX_C_SOURCE 1781dnl forces SIGWINCH to be undefined (breaks xterm, ncurses). Oddly, the struct 1782dnl winsize declaration is left alone - we may revisit this if Apple choose to 1783dnl break that part of the interface as well. 1784AC_DEFUN([CF_SIGWINCH], 1785[ 1786AC_CACHE_CHECK(if SIGWINCH is defined,cf_cv_define_sigwinch,[ 1787 AC_TRY_COMPILE([ 1788#include <sys/types.h> 1789#include <sys/signal.h> 1790],[int x = SIGWINCH], 1791 [cf_cv_define_sigwinch=yes], 1792 [AC_TRY_COMPILE([ 1793#undef _XOPEN_SOURCE 1794#undef _POSIX_SOURCE 1795#undef _POSIX_C_SOURCE 1796#include <sys/types.h> 1797#include <sys/signal.h> 1798],[int x = SIGWINCH], 1799 [cf_cv_define_sigwinch=maybe], 1800 [cf_cv_define_sigwinch=no]) 1801]) 1802]) 1803 1804if test "$cf_cv_define_sigwinch" = maybe ; then 1805AC_CACHE_CHECK(for actual SIGWINCH definition,cf_cv_fixup_sigwinch,[ 1806cf_cv_fixup_sigwinch=unknown 1807cf_sigwinch=32 1808while test $cf_sigwinch != 1 1809do 1810 AC_TRY_COMPILE([ 1811#undef _XOPEN_SOURCE 1812#undef _POSIX_SOURCE 1813#undef _POSIX_C_SOURCE 1814#include <sys/types.h> 1815#include <sys/signal.h> 1816],[ 1817#if SIGWINCH != $cf_sigwinch 1818make an error 1819#endif 1820int x = SIGWINCH], 1821 [cf_cv_fixup_sigwinch=$cf_sigwinch 1822 break]) 1823 1824cf_sigwinch=`expr $cf_sigwinch - 1` 1825done 1826]) 1827 1828 if test "$cf_cv_fixup_sigwinch" != unknown ; then 1829 CPPFLAGS="$CPPFLAGS -DSIGWINCH=$cf_cv_fixup_sigwinch" 1830 fi 1831fi 1832])dnl 1833dnl --------------------------------------------------------------------------- 1834dnl CF_SIG_ATOMIC_T version: 2 updated: 2005/09/18 17:27:12 1835dnl --------------- 1836dnl signal handler, but there are some gcc depedencies in that recommendation. 1837dnl Try anyway. 1838AC_DEFUN([CF_SIG_ATOMIC_T], 1839[ 1840AC_MSG_CHECKING(for signal global datatype) 1841AC_CACHE_VAL(cf_cv_sig_atomic_t,[ 1842 for cf_type in \ 1843 "volatile sig_atomic_t" \ 1844 "sig_atomic_t" \ 1845 "int" 1846 do 1847 AC_TRY_COMPILE([ 1848#include <sys/types.h> 1849#include <signal.h> 1850#include <stdio.h> 1851 1852extern $cf_type x; 1853$cf_type x; 1854static void handler(int sig) 1855{ 1856 x = 5; 1857}], 1858 [signal(SIGINT, handler); 1859 x = 1], 1860 [cf_cv_sig_atomic_t=$cf_type], 1861 [cf_cv_sig_atomic_t=no]) 1862 test "$cf_cv_sig_atomic_t" != no && break 1863 done 1864 ]) 1865AC_MSG_RESULT($cf_cv_sig_atomic_t) 1866test "$cf_cv_sig_atomic_t" != no && AC_DEFINE_UNQUOTED(SIG_ATOMIC_T, $cf_cv_sig_atomic_t) 1867])dnl 1868dnl --------------------------------------------------------------------------- 1869dnl CF_SIZE_T version: 4 updated: 2000/01/22 00:19:54 1870dnl --------- 1871dnl On both Ultrix and CLIX, I find size_t defined in <stdio.h> 1872AC_DEFUN([CF_SIZE_T], 1873[ 1874AC_MSG_CHECKING(for size_t in <sys/types.h> or <stdio.h>) 1875AC_CACHE_VAL(cf_cv_type_size_t,[ 1876 AC_TRY_COMPILE([ 1877#include <sys/types.h> 1878#ifdef STDC_HEADERS 1879#include <stdlib.h> 1880#include <stddef.h> 1881#endif 1882#include <stdio.h>], 1883 [size_t x], 1884 [cf_cv_type_size_t=yes], 1885 [cf_cv_type_size_t=no]) 1886 ]) 1887AC_MSG_RESULT($cf_cv_type_size_t) 1888test $cf_cv_type_size_t = no && AC_DEFINE(size_t, unsigned) 1889])dnl 1890dnl --------------------------------------------------------------------------- 1891dnl CF_STRUCT_LASTLOG version: 1 updated: 2006/03/12 17:46:43 1892dnl ----------------- 1893dnl Check for header defining struct lastlog, ensure that its .ll_time member 1894dnl is compatible with time(). 1895AC_DEFUN([CF_STRUCT_LASTLOG], 1896[ 1897AC_CHECK_HEADERS(lastlog.h) 1898AC_CACHE_CHECK(for struct lastlog,cf_cv_struct_lastlog,[ 1899AC_TRY_RUN([ 1900#include <sys/types.h> 1901#include <time.h> 1902#include <lastlog.h> 1903 1904int main() 1905{ 1906 struct lastlog data; 1907 return (sizeof(data.ll_time) != sizeof(time_t)); 1908}],[ 1909cf_cv_struct_lastlog=yes],[ 1910cf_cv_struct_lastlog=no],[ 1911cf_cv_struct_lastlog=unknown])]) 1912 1913test $cf_cv_struct_lastlog != no && AC_DEFINE(USE_STRUCT_LASTLOG) 1914])dnl 1915dnl --------------------------------------------------------------------------- 1916dnl CF_SVR4 version: 3 updated: 2000/05/31 10:16:52 1917dnl ------- 1918dnl Check if this is an SVR4 system. We need the definition for xterm 1919AC_DEFUN([CF_SVR4], 1920[ 1921AC_CHECK_LIB(elf, elf_begin,[ 1922AC_CACHE_CHECK(if this is an SVR4 system, cf_cv_svr4,[ 1923AC_TRY_COMPILE([ 1924#include <elf.h> 1925#include <sys/termio.h> 1926],[ 1927static struct termio d_tio; 1928 d_tio.c_cc[VINTR] = 0; 1929 d_tio.c_cc[VQUIT] = 0; 1930 d_tio.c_cc[VERASE] = 0; 1931 d_tio.c_cc[VKILL] = 0; 1932 d_tio.c_cc[VEOF] = 0; 1933 d_tio.c_cc[VEOL] = 0; 1934 d_tio.c_cc[VMIN] = 0; 1935 d_tio.c_cc[VTIME] = 0; 1936 d_tio.c_cc[VLNEXT] = 0; 1937], 1938[cf_cv_svr4=yes], 1939[cf_cv_svr4=no]) 1940]) 1941]) 1942test "$cf_cv_svr4" = yes && AC_DEFINE(SVR4) 1943])dnl 1944dnl --------------------------------------------------------------------------- 1945dnl CF_SYSV version: 13 updated: 2006/08/20 14:55:37 1946dnl ------- 1947dnl Check if this is a SYSV platform, e.g., as used in <X11/Xos.h>, and whether 1948dnl defining it will be helpful. The following features are used to check: 1949dnl 1950dnl a) bona-fide SVSV doesn't use const for sys_errlist[]. Since this is a 1951dnl legacy (pre-ANSI) feature, const should not apply. Modern systems only 1952dnl declare strerror(). Xos.h declares the legacy form of str_errlist[], and 1953dnl a compile-time error will result from trying to assign to a const array. 1954dnl 1955dnl b) compile with headers that exist on SYSV hosts. 1956dnl 1957dnl c) compile with type definitions that differ on SYSV hosts from standard C. 1958AC_DEFUN([CF_SYSV], 1959[ 1960AC_CHECK_HEADERS( \ 1961termios.h \ 1962stdlib.h \ 1963X11/Intrinsic.h \ 1964) 1965 1966AC_REQUIRE([CF_SYS_ERRLIST]) 1967 1968AC_CACHE_CHECK(if we should define SYSV,cf_cv_sysv,[ 1969AC_TRY_COMPILE([ 1970#undef SYSV 1971#define SYSV 1 /* get Xos.h to declare sys_errlist[] */ 1972#ifdef HAVE_STDLIB_H 1973#include <stdlib.h> /* look for wchar_t */ 1974#endif 1975#ifdef HAVE_X11_INTRINSIC_H 1976#include <X11/Intrinsic.h> /* Intrinsic.h has other traps... */ 1977#endif 1978#ifdef HAVE_TERMIOS_H /* needed for HPUX 10.20 */ 1979#include <termios.h> 1980#define STRUCT_TERMIOS struct termios 1981#else 1982#define STRUCT_TERMIOS struct termio 1983#endif 1984#include <curses.h> 1985#include <term.h> /* eliminate most BSD hacks */ 1986#include <errno.h> /* declare sys_errlist on older systems */ 1987#include <sys/termio.h> /* eliminate most of the remaining ones */ 1988],[ 1989static STRUCT_TERMIOS d_tio; 1990 d_tio.c_cc[VINTR] = 0; 1991 d_tio.c_cc[VQUIT] = 0; 1992 d_tio.c_cc[VERASE] = 0; 1993 d_tio.c_cc[VKILL] = 0; 1994 d_tio.c_cc[VEOF] = 0; 1995 d_tio.c_cc[VEOL] = 0; 1996 d_tio.c_cc[VMIN] = 0; 1997 d_tio.c_cc[VTIME] = 0; 1998#if defined(HAVE_SYS_ERRLIST) && !defined(DECL_SYS_ERRLIST) 1999sys_errlist[0] = ""; /* Cygwin mis-declares this */ 2000#endif 2001], 2002[cf_cv_sysv=yes], 2003[cf_cv_sysv=no]) 2004]) 2005test "$cf_cv_sysv" = yes && AC_DEFINE(SYSV) 2006])dnl 2007dnl --------------------------------------------------------------------------- 2008dnl CF_SYSV_UTMP version: 5 updated: 2001/12/27 12:55:07 2009dnl ------------ 2010dnl Check if this is a SYSV flavor of UTMP 2011AC_DEFUN([CF_SYSV_UTMP], 2012[ 2013AC_CACHE_CHECK(if $cf_cv_have_utmp is SYSV flavor,cf_cv_sysv_utmp,[ 2014test "$cf_cv_have_utmp" = "utmp" && cf_prefix="ut" || cf_prefix="utx" 2015AC_TRY_LINK([ 2016#include <sys/types.h> 2017#include <${cf_cv_have_utmp}.h>],[ 2018struct $cf_cv_have_utmp x; 2019 set${cf_prefix}ent (); 2020 get${cf_prefix}id(&x); 2021 put${cf_prefix}line(&x); 2022 end${cf_prefix}ent();], 2023 [cf_cv_sysv_utmp=yes], 2024 [cf_cv_sysv_utmp=no]) 2025]) 2026test $cf_cv_sysv_utmp = yes && AC_DEFINE(USE_SYSV_UTMP) 2027])dnl 2028dnl --------------------------------------------------------------------------- 2029dnl CF_SYS_ERRLIST version: 6 updated: 2001/12/30 13:03:23 2030dnl -------------- 2031dnl Check for declaration of sys_nerr and sys_errlist in one of stdio.h and 2032dnl errno.h. Declaration of sys_errlist on BSD4.4 interferes with our 2033dnl declaration. Reported by Keith Bostic. 2034AC_DEFUN([CF_SYS_ERRLIST], 2035[ 2036 CF_CHECK_ERRNO(sys_nerr) 2037 CF_CHECK_ERRNO(sys_errlist) 2038])dnl 2039dnl --------------------------------------------------------------------------- 2040dnl CF_TERMIO_C_ISPEED version: 2 updated: 2000/05/29 16:16:04 2041dnl ------------------ 2042dnl Check for SGI's broken redefinition of baud rates introduced in IRIX 6.5 2043dnl (there doesn't appear to be a useful predefined symbol). 2044AC_DEFUN([CF_TERMIO_C_ISPEED], 2045[ 2046AC_CACHE_CHECK(for IRIX 6.5 baud-rate redefinitions,cf_cv_termio_c_ispeed,[ 2047AC_TRY_COMPILE([ 2048#include <sys/types.h> 2049#include <sys/termio.h>],[ 2050struct termio foo; 2051foo.c_ispeed = B38400; 2052foo.c_ospeed = B9600; 2053],[cf_cv_termio_c_ispeed=yes 2054],[cf_cv_termio_c_ispeed=no]) 2055]) 2056test "$cf_cv_termio_c_ispeed" = yes && AC_DEFINE(HAVE_TERMIO_C_ISPEED) 2057])dnl 2058dnl --------------------------------------------------------------------------- 2059dnl CF_TRY_PKG_CONFIG version: 4 updated: 2010/06/14 17:42:30 2060dnl ----------------- 2061dnl This is a simple wrapper to use for pkg-config, for libraries which may be 2062dnl available in that form. 2063dnl 2064dnl $1 = package name 2065dnl $2 = extra logic to use, if any, after updating CFLAGS and LIBS 2066dnl $3 = logic to use if pkg-config does not have the package 2067AC_DEFUN([CF_TRY_PKG_CONFIG],[ 2068AC_REQUIRE([CF_PKG_CONFIG]) 2069 2070if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists $1; then 2071 CF_VERBOSE(found package $1) 2072 cf_pkgconfig_incs="`$PKG_CONFIG --cflags $1 2>/dev/null`" 2073 cf_pkgconfig_libs="`$PKG_CONFIG --libs $1 2>/dev/null`" 2074 CF_VERBOSE(package $1 CFLAGS: $cf_pkgconfig_incs) 2075 CF_VERBOSE(package $1 LIBS: $cf_pkgconfig_libs) 2076 CF_ADD_CFLAGS($cf_pkgconfig_incs) 2077 CF_ADD_LIBS($cf_pkgconfig_libs) 2078 ifelse([$2],,:,[$2]) 2079else 2080 ifelse([$3],,:,[$3]) 2081fi 2082]) 2083dnl --------------------------------------------------------------------------- 2084dnl CF_TTY_GROUP version: 7 updated: 2007/03/14 16:43:59 2085dnl ------------ 2086dnl Check if the system has a tty-group defined. This is used in xterm when 2087dnl setting pty ownership. 2088AC_DEFUN([CF_TTY_GROUP], 2089[ 2090AC_MSG_CHECKING(for explicit tty group name) 2091AC_ARG_WITH(tty-group, 2092 [ --with-tty-group=XXX use XXX for the tty-group], 2093 [cf_tty_group=$withval], 2094 [cf_tty_group=auto...]) 2095test -z "$cf_tty_group" && cf_tty_group=auto... 2096test "$cf_tty_group" = yes && cf_tty_group=auto... 2097AC_MSG_RESULT($cf_tty_group) 2098 2099if test "$cf_tty_group" = "auto..." ; then 2100AC_CACHE_CHECK(for tty group name,cf_cv_tty_group_name,[ 2101 2102# If we are configuring as root, it is hard to get a clue about the tty group. 2103# But we'll guess based on how our connection is set up - assuming it is done 2104# properly. 2105 2106cf_uid=`id | sed -e 's/^[^=]*=//' -e 's/(.*$//'` 2107# )vi 2108if test "$cf_uid" != 0 ; then 2109cf_cv_tty_group_name= 2110cf_tty_name=`tty` 2111test "$cf_tty_name" = "not a tty" && cf_tty_name=/dev/tty 2112test -z "$cf_tty_name" && cf_tty_name=/dev/tty 2113if test -c "$cf_tty_name" 2114then 2115 cf_option="-l -L" 2116 2117 # Expect listing to have fields like this: 2118 #-rwxrwxrwx 1 user group 34293 Jul 18 16:29 pathname 2119 ls $cf_option $cf_tty_name >conftest.out 2120 read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest <conftest.out 2121 if test -z "$cf_rest" ; then 2122 cf_option="$cf_option -g" 2123 ls $cf_option $cf_tty_name >conftest.out 2124 read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest <conftest.out 2125 fi 2126 rm -f conftest.out 2127 cf_cv_tty_group_name=$cf_grp 2128fi 2129fi 2130 2131# If we cannot deduce the tty group, fall back on hardcoded cases 2132 2133if test -z "$cf_cv_tty_group_name" 2134then 2135case $host_os in #(vi 2136osf*) #(vi 2137 cf_cv_tty_group_name="terminal" 2138 ;; 2139*) 2140 cf_cv_tty_group_name="unknown" 2141 if ( egrep '^tty:' /etc/group 2>/dev/null 1>/dev/null ) then 2142 cf_cv_tty_group_name="tty" 2143 fi 2144 ;; 2145esac 2146fi 2147]) 2148cf_tty_group="$cf_cv_tty_group_name" 2149else 2150 # if configure option, always do this 2151 AC_DEFINE(USE_TTY_GROUP) 2152fi 2153 2154AC_DEFINE_UNQUOTED(TTY_GROUP_NAME,"$cf_tty_group") 2155 2156# This is only a double-check that the group-name we obtained above really 2157# does apply to the device. We cannot perform this test if we are in batch 2158# mode, or if we are cross-compiling. 2159 2160AC_CACHE_CHECK(if we may use the $cf_tty_group group,cf_cv_tty_group,[ 2161cf_tty_name=`tty` 2162if test "$cf_tty_name" != "not a tty" 2163then 2164AC_TRY_RUN([ 2165#include <unistd.h> 2166#include <sys/types.h> 2167#include <sys/stat.h> 2168#include <grp.h> 2169int main() 2170{ 2171 struct stat sb; 2172 struct group *ttygrp = getgrnam(TTY_GROUP_NAME); 2173 char *name = ttyname(0); 2174 2175 endgrent(); 2176 if (ttygrp != 0 2177 && name != 0 2178 && stat(name, &sb) == 0 2179 && sb.st_gid != getgid() 2180 && sb.st_gid == ttygrp->gr_gid) { 2181 ${cf_cv_main_return:-return} (0); 2182 } 2183 ${cf_cv_main_return:-return} (1); 2184} 2185 ], 2186 [cf_cv_tty_group=yes], 2187 [cf_cv_tty_group=no], 2188 [cf_cv_tty_group=unknown]) 2189elif test "$cross_compiling" = yes; then 2190 cf_cv_tty_group=unknown 2191else 2192 cf_cv_tty_group=yes 2193fi 2194]) 2195 2196if test $cf_cv_tty_group = no ; then 2197 AC_MSG_WARN(Cannot use $cf_tty_group group) 2198else 2199 AC_DEFINE(USE_TTY_GROUP) 2200fi 2201])dnl 2202dnl --------------------------------------------------------------------------- 2203dnl CF_TYPE_FD_MASK version: 2 updated: 2008/03/25 20:59:57 2204dnl --------------- 2205dnl Check for the declaration of fd_mask, which is like fd_set, associated 2206dnl with select(). The check for fd_set should have pulled in this as well, 2207dnl but there is a special case for Mac OS X, possibly other BSD-derived 2208dnl platforms. 2209AC_DEFUN([CF_TYPE_FD_MASK], 2210[ 2211AC_REQUIRE([CF_TYPE_FD_SET]) 2212 2213AC_CACHE_CHECK(for declaration of fd_mask,cf_cv_type_fd_mask,[ 2214 if test x$cf_cv_type_fd_set = xX11/Xpoll.h ; then 2215 AC_TRY_COMPILE([ 2216#include <X11/Xpoll.h>],[fd_mask x],, 2217 [CF_MSG_LOG(if we must define CSRG_BASED) 2218# Xosdefs.h on Mac OS X may not define this (but it should). 2219 AC_TRY_COMPILE([ 2220#define CSRG_BASED 2221#include <X11/Xpoll.h>],[fd_mask x], 2222 cf_cv_type_fd_mask=CSRG_BASED)]) 2223 else 2224 cf_cv_type_fd_mask=$cf_cv_type_fd_set 2225 fi 2226]) 2227if test x$cf_cv_type_fd_mask = xCSRG_BASED ; then 2228 AC_DEFINE(CSRG_BASED) 2229fi 2230])dnl 2231dnl --------------------------------------------------------------------------- 2232dnl CF_TYPE_FD_SET version: 4 updated: 2008/03/25 20:56:03 2233dnl -------------- 2234dnl Check for the declaration of fd_set. Some platforms declare it in 2235dnl <sys/types.h>, and some in <sys/select.h>, which requires <sys/types.h>. 2236dnl Finally, if we are using this for an X application, Xpoll.h may include 2237dnl <sys/select.h>, so we don't want to do it twice. 2238AC_DEFUN([CF_TYPE_FD_SET], 2239[ 2240AC_CHECK_HEADERS(X11/Xpoll.h) 2241 2242AC_CACHE_CHECK(for declaration of fd_set,cf_cv_type_fd_set, 2243 [CF_MSG_LOG(sys/types alone) 2244AC_TRY_COMPILE([ 2245#include <sys/types.h>], 2246 [fd_set x], 2247 [cf_cv_type_fd_set=sys/types.h], 2248 [CF_MSG_LOG(X11/Xpoll.h) 2249AC_TRY_COMPILE([ 2250#ifdef HAVE_X11_XPOLL_H 2251#include <X11/Xpoll.h> 2252#endif], 2253 [fd_set x], 2254 [cf_cv_type_fd_set=X11/Xpoll.h], 2255 [CF_MSG_LOG(sys/select.h) 2256AC_TRY_COMPILE([ 2257#include <sys/types.h> 2258#include <sys/select.h>], 2259 [fd_set x], 2260 [cf_cv_type_fd_set=sys/select.h], 2261 [cf_cv_type_fd_set=unknown])])])]) 2262if test $cf_cv_type_fd_set = sys/select.h ; then 2263 AC_DEFINE(USE_SYS_SELECT_H) 2264fi 2265]) 2266dnl --------------------------------------------------------------------------- 2267dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59 2268dnl -------- 2269dnl Make an uppercase version of a variable 2270dnl $1=uppercase($2) 2271AC_DEFUN([CF_UPPER], 2272[ 2273$1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` 2274])dnl 2275dnl --------------------------------------------------------------------------- 2276dnl CF_UTEMPTER version: 3 updated: 2010/06/02 05:03:05 2277dnl ----------- 2278dnl Try to link with utempter library 2279AC_DEFUN([CF_UTEMPTER], 2280[ 2281AC_CACHE_CHECK(if we can link with utempter library,cf_cv_have_utempter,[ 2282cf_save_LIBS="$LIBS" 2283CF_ADD_LIB(utempter) 2284AC_TRY_LINK([ 2285#include <utempter.h> 2286],[ 2287 addToUtmp("/dev/tty", 0, 1); 2288 removeFromUtmp(); 2289],[ 2290 cf_cv_have_utempter=yes],[ 2291 cf_cv_have_utempter=no]) 2292LIBS="$cf_save_LIBS" 2293]) 2294if test "$cf_cv_have_utempter" = yes ; then 2295 AC_DEFINE(USE_UTEMPTER) 2296 CF_ADD_LIB(utempter) 2297fi 2298])dnl 2299dnl --------------------------------------------------------------------------- 2300dnl CF_UTMP version: 9 updated: 2008/01/25 17:18:00 2301dnl ------- 2302dnl Check for UTMP/UTMPX headers 2303AC_DEFUN([CF_UTMP], 2304[ 2305AC_REQUIRE([CF_LASTLOG]) 2306 2307AC_CACHE_CHECK(for utmp implementation,cf_cv_have_utmp,[ 2308 cf_cv_have_utmp=no 2309for cf_header in utmpx utmp ; do 2310cf_utmp_includes=" 2311#include <sys/types.h> 2312#include <${cf_header}.h> 2313#define getutent getutxent 2314#ifdef USE_LASTLOG 2315#include <lastlog.h> /* may conflict with utmpx.h on Linux */ 2316#endif 2317" 2318 AC_TRY_COMPILE([$cf_utmp_includes], 2319 [struct $cf_header x; 2320 char *name = x.ut_name; /* utmp.h and compatible definitions */ 2321 ], 2322 [cf_cv_have_utmp=$cf_header 2323 break], 2324 [ 2325 AC_TRY_COMPILE([$cf_utmp_includes], 2326 [struct $cf_header x; 2327 char *name = x.ut_user; /* utmpx.h must declare this */ 2328 ], 2329 [cf_cv_have_utmp=$cf_header 2330 break 2331 ])]) 2332done 2333]) 2334 2335if test $cf_cv_have_utmp != no ; then 2336 AC_DEFINE(HAVE_UTMP) 2337 test $cf_cv_have_utmp = utmpx && AC_DEFINE(UTMPX_FOR_UTMP) 2338 CF_UTMP_UT_HOST 2339 CF_UTMP_UT_SYSLEN 2340 CF_UTMP_UT_NAME 2341 CF_UTMP_UT_XSTATUS 2342 CF_UTMP_UT_XTIME 2343 CF_UTMP_UT_SESSION 2344 CF_SYSV_UTMP 2345fi 2346])dnl 2347dnl --------------------------------------------------------------------------- 2348dnl CF_UTMP_GROUP version: 1 updated: 2005/10/06 20:29:29 2349dnl ------------- 2350dnl Find the utmp/utmpx file and determine its group to allow setgid programs 2351dnl to manipulate it, e.g., when there is no intermediary. 2352AC_DEFUN([CF_UTMP_GROUP],[ 2353AC_REQUIRE([CF_UTMP]) 2354if test $cf_cv_have_utmp != no ; then 2355AC_CACHE_CHECK(for utmp/utmpx group,cf_cv_utmp_group,[ 2356for cf_utmp_path in /var/adm /var/run 2357do 2358 for cf_utmp_file in utmpx utmp 2359 do 2360 if test -f $cf_utmp_path/$cf_utmp_file 2361 then 2362 cf_cv_utmp_group=root 2363 2364 cf_option="-l -L" 2365 2366 # Expect listing to have fields like this: 2367 #-r--r--r-- 1 user group 34293 Jul 18 16:29 pathname 2368 ls $cf_option $cf_utmp_path/$cf_utmp_file >conftest 2369 read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest <conftest 2370 if test -z "$cf_rest" ; then 2371 cf_option="$cf_option -g" 2372 ls $cf_option $cf_utmp_path/$cf_utmp_file >conftest 2373 read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest <conftest 2374 fi 2375 rm -f conftest 2376 2377 # If we have a pathname, and the date fields look right, assume we've 2378 # captured the group as well. 2379 if test -n "$cf_rest" ; then 2380 cf_test=`echo "${cf_date2}${cf_date3}" | sed -e 's/[[0-9:]]//g'` 2381 if test -z "$cf_test" ; then 2382 cf_cv_utmp_group=$cf_grp; 2383 fi 2384 fi 2385 break 2386 fi 2387 done 2388 test -n "$cf_cv_utmp_group" && break 2389done 2390]) 2391else 2392 AC_MSG_ERROR(cannot find utmp group) 2393fi 2394])dnl 2395dnl --------------------------------------------------------------------------- 2396dnl CF_UTMP_UT_HOST version: 7 updated: 2007/03/13 19:17:11 2397dnl --------------- 2398dnl Check if UTMP/UTMPX struct defines ut_host member 2399AC_DEFUN([CF_UTMP_UT_HOST], 2400[ 2401if test $cf_cv_have_utmp != no ; then 2402AC_MSG_CHECKING(if ${cf_cv_have_utmp}.ut_host is declared) 2403AC_CACHE_VAL(cf_cv_have_utmp_ut_host,[ 2404 AC_TRY_COMPILE([ 2405#include <sys/types.h> 2406#include <${cf_cv_have_utmp}.h>], 2407 [struct $cf_cv_have_utmp x; char *y = &x.ut_host[0]], 2408 [cf_cv_have_utmp_ut_host=yes], 2409 [cf_cv_have_utmp_ut_host=no]) 2410 ]) 2411AC_MSG_RESULT($cf_cv_have_utmp_ut_host) 2412test $cf_cv_have_utmp_ut_host != no && AC_DEFINE(HAVE_UTMP_UT_HOST) 2413fi 2414])dnl 2415dnl --------------------------------------------------------------------------- 2416dnl CF_UTMP_UT_NAME version: 4 updated: 2007/03/13 19:17:11 2417dnl --------------- 2418dnl Check if UTMP/UTMPX struct defines ut_name member 2419AC_DEFUN([CF_UTMP_UT_NAME], 2420[ 2421if test $cf_cv_have_utmp != no ; then 2422AC_CACHE_CHECK(if ${cf_cv_have_utmp}.ut_name is declared,cf_cv_have_utmp_ut_name,[ 2423 cf_cv_have_utmp_ut_name=no 2424cf_utmp_includes=" 2425#include <sys/types.h> 2426#include <${cf_cv_have_utmp}.h> 2427#define getutent getutxent 2428#ifdef USE_LASTLOG 2429#include <lastlog.h> /* may conflict with utmpx.h on Linux */ 2430#endif 2431" 2432for cf_header in ut_name ut_user ; do 2433 AC_TRY_COMPILE([$cf_utmp_includes], 2434 [struct $cf_cv_have_utmp x; 2435 char *name = x.$cf_header; 2436 ], 2437 [cf_cv_have_utmp_ut_name=$cf_header 2438 break]) 2439done 2440]) 2441 2442case $cf_cv_have_utmp_ut_name in #(vi 2443no) #(vi 2444 AC_MSG_ERROR(Cannot find declaration for ut.ut_name) 2445 ;; 2446ut_user) 2447 AC_DEFINE(ut_name,ut_user) 2448 ;; 2449esac 2450fi 2451])dnl 2452dnl --------------------------------------------------------------------------- 2453dnl CF_UTMP_UT_SESSION version: 5 updated: 2007/03/13 19:17:11 2454dnl ------------------ 2455dnl Check if UTMP/UTMPX struct defines ut_session member 2456AC_DEFUN([CF_UTMP_UT_SESSION], 2457[ 2458if test $cf_cv_have_utmp != no ; then 2459AC_CACHE_CHECK(if ${cf_cv_have_utmp}.ut_session is declared, cf_cv_have_utmp_ut_session,[ 2460 AC_TRY_COMPILE([ 2461#include <sys/types.h> 2462#include <${cf_cv_have_utmp}.h>], 2463 [struct $cf_cv_have_utmp x; long y = x.ut_session], 2464 [cf_cv_have_utmp_ut_session=yes], 2465 [cf_cv_have_utmp_ut_session=no]) 2466]) 2467if test $cf_cv_have_utmp_ut_session != no ; then 2468 AC_DEFINE(HAVE_UTMP_UT_SESSION) 2469fi 2470fi 2471])dnl 2472dnl --------------------------------------------------------------------------- 2473dnl CF_UTMP_UT_SYSLEN version: 1 updated: 2008/01/25 17:18:00 2474dnl ----------------- 2475dnl Check if UTMP/UTMPX struct defines ut_syslen member 2476AC_DEFUN([CF_UTMP_UT_SYSLEN], 2477[ 2478if test $cf_cv_have_utmp != no ; then 2479AC_MSG_CHECKING(if ${cf_cv_have_utmp}.ut_syslen is declared) 2480AC_CACHE_VAL(cf_cv_have_utmp_ut_syslen,[ 2481 AC_TRY_COMPILE([ 2482#include <sys/types.h> 2483#include <${cf_cv_have_utmp}.h>], 2484 [struct $cf_cv_have_utmp x; int y = x.ut_syslen], 2485 [cf_cv_have_utmp_ut_syslen=yes], 2486 [cf_cv_have_utmp_ut_syslen=no]) 2487 ]) 2488AC_MSG_RESULT($cf_cv_have_utmp_ut_syslen) 2489test $cf_cv_have_utmp_ut_syslen != no && AC_DEFINE(HAVE_UTMP_UT_SYSLEN) 2490fi 2491])dnl 2492dnl --------------------------------------------------------------------------- 2493dnl CF_UTMP_UT_XSTATUS version: 3 updated: 2001/12/27 12:55:07 2494dnl ------------------ 2495dnl Check for known variants on the UTMP/UTMPX struct's exit-status as reported 2496dnl by various people: 2497dnl 2498dnl ut_exit.__e_exit (HPUX 11 - David Ellement, also in glibc2) 2499dnl ut_exit.e_exit (SVR4) 2500dnl ut_exit.ut_e_exit (os390 - Greg Smith) 2501dnl ut_exit.ut_exit (Tru64 4.0f - Jeremie Petit, 4.0e - Tomas Vanhala) 2502dnl 2503dnl Note: utmp_xstatus is not a conventional compatibility definition in the 2504dnl system header files. 2505AC_DEFUN([CF_UTMP_UT_XSTATUS], 2506[ 2507if test $cf_cv_have_utmp != no ; then 2508AC_CACHE_CHECK(for exit-status in $cf_cv_have_utmp,cf_cv_have_utmp_ut_xstatus,[ 2509for cf_result in \ 2510 ut_exit.__e_exit \ 2511 ut_exit.e_exit \ 2512 ut_exit.ut_e_exit \ 2513 ut_exit.ut_exit 2514do 2515AC_TRY_COMPILE([ 2516#include <sys/types.h> 2517#include <${cf_cv_have_utmp}.h>], 2518 [struct $cf_cv_have_utmp x; long y = x.$cf_result = 0], 2519 [cf_cv_have_utmp_ut_xstatus=$cf_result 2520 break], 2521 [cf_cv_have_utmp_ut_xstatus=no]) 2522done 2523]) 2524if test $cf_cv_have_utmp_ut_xstatus != no ; then 2525 AC_DEFINE(HAVE_UTMP_UT_XSTATUS) 2526 AC_DEFINE_UNQUOTED(ut_xstatus,$cf_cv_have_utmp_ut_xstatus) 2527fi 2528fi 2529])dnl 2530dnl --------------------------------------------------------------------------- 2531dnl CF_UTMP_UT_XTIME version: 7 updated: 2007/03/13 19:17:11 2532dnl ---------------- 2533dnl Check if UTMP/UTMPX struct defines ut_xtime member 2534AC_DEFUN([CF_UTMP_UT_XTIME], 2535[ 2536if test $cf_cv_have_utmp != no ; then 2537AC_CACHE_CHECK(if ${cf_cv_have_utmp}.ut_xtime is declared, cf_cv_have_utmp_ut_xtime,[ 2538 AC_TRY_COMPILE([ 2539#include <sys/types.h> 2540#include <${cf_cv_have_utmp}.h>], 2541 [struct $cf_cv_have_utmp x; long y = x.ut_xtime = 0], 2542 [cf_cv_have_utmp_ut_xtime=yes], 2543 [AC_TRY_COMPILE([ 2544#include <sys/types.h> 2545#include <${cf_cv_have_utmp}.h>], 2546 [struct $cf_cv_have_utmp x; long y = x.ut_tv.tv_sec], 2547 [cf_cv_have_utmp_ut_xtime=define], 2548 [cf_cv_have_utmp_ut_xtime=no]) 2549 ]) 2550]) 2551if test $cf_cv_have_utmp_ut_xtime != no ; then 2552 AC_DEFINE(HAVE_UTMP_UT_XTIME) 2553 if test $cf_cv_have_utmp_ut_xtime = define ; then 2554 AC_DEFINE(ut_xtime,ut_tv.tv_sec) 2555 fi 2556fi 2557fi 2558])dnl 2559dnl --------------------------------------------------------------------------- 2560dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12 2561dnl ---------- 2562dnl Use AC_VERBOSE w/o the warnings 2563AC_DEFUN([CF_VERBOSE], 2564[test -n "$verbose" && echo " $1" 1>&AC_FD_MSG 2565CF_MSG_LOG([$1]) 2566])dnl 2567dnl --------------------------------------------------------------------------- 2568dnl CF_WITH_IMAKE_CFLAGS version: 9 updated: 2010/05/26 05:38:42 2569dnl -------------------- 2570dnl xterm and similar programs build more readily when propped up with imake's 2571dnl hand-tuned definitions. If we do not use imake, provide fallbacks for the 2572dnl most common definitions that we're not likely to do by autoconf tests. 2573AC_DEFUN([CF_WITH_IMAKE_CFLAGS],[ 2574AC_REQUIRE([CF_ENABLE_NARROWPROTO]) 2575 2576AC_MSG_CHECKING(if we should use imake to help) 2577CF_ARG_DISABLE(imake, 2578 [ --disable-imake disable use of imake for definitions], 2579 [enable_imake=no], 2580 [enable_imake=yes]) 2581AC_MSG_RESULT($enable_imake) 2582 2583if test "$enable_imake" = yes ; then 2584 CF_IMAKE_CFLAGS(ifelse([$1],,,[$1])) 2585fi 2586 2587if test -n "$IMAKE" && test -n "$IMAKE_CFLAGS" ; then 2588 CF_ADD_CFLAGS($IMAKE_CFLAGS) 2589else 2590 IMAKE_CFLAGS= 2591 IMAKE_LOADFLAGS= 2592 CF_VERBOSE(make fallback definitions) 2593 2594 # We prefer config.guess' values when we can get them, to avoid 2595 # inconsistent results with uname (AIX for instance). However, 2596 # config.guess is not always consistent either. 2597 case $host_os in 2598 *[[0-9]].[[0-9]]*) 2599 UNAME_RELEASE="$host_os" 2600 ;; 2601 *) 2602 UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown 2603 ;; 2604 esac 2605 2606 case .$UNAME_RELEASE in 2607 *[[0-9]].[[0-9]]*) 2608 OSMAJORVERSION=`echo "$UNAME_RELEASE" |sed -e 's/^[[^0-9]]*//' -e 's/\..*//'` 2609 OSMINORVERSION=`echo "$UNAME_RELEASE" |sed -e 's/^[[^0-9]]*//' -e 's/^[[^.]]*\.//' -e 's/\..*//' -e 's/[[^0-9]].*//' ` 2610 test -z "$OSMAJORVERSION" && OSMAJORVERSION=1 2611 test -z "$OSMINORVERSION" && OSMINORVERSION=0 2612 IMAKE_CFLAGS="-DOSMAJORVERSION=$OSMAJORVERSION -DOSMINORVERSION=$OSMINORVERSION $IMAKE_CFLAGS" 2613 ;; 2614 esac 2615 2616 # FUNCPROTO is standard with X11R6, but XFree86 drops it, leaving some 2617 # fallback/fragments for NeedPrototypes, etc. 2618 IMAKE_CFLAGS="-DFUNCPROTO=15 $IMAKE_CFLAGS" 2619 2620 # If this is not set properly, Xaw's scrollbars will not work 2621 if test "$enable_narrowproto" = yes ; then 2622 IMAKE_CFLAGS="-DNARROWPROTO=1 $IMAKE_CFLAGS" 2623 fi 2624 2625 # Other special definitions: 2626 case $host_os in 2627 aix*) 2628 # imake on AIX 5.1 defines AIXV3. really. 2629 IMAKE_CFLAGS="-DAIXV3 -DAIXV4 $IMAKE_CFLAGS" 2630 ;; 2631 irix[[56]].*) #(vi 2632 # these are needed to make SIGWINCH work in xterm 2633 IMAKE_CFLAGS="-DSYSV -DSVR4 $IMAKE_CFLAGS" 2634 ;; 2635 esac 2636 2637 CF_ADD_CFLAGS($IMAKE_CFLAGS) 2638 2639 AC_SUBST(IMAKE_CFLAGS) 2640 AC_SUBST(IMAKE_LOADFLAGS) 2641fi 2642])dnl 2643dnl --------------------------------------------------------------------------- 2644dnl CF_WITH_PATH version: 9 updated: 2010/05/26 05:38:42 2645dnl ------------ 2646dnl Wrapper for AC_ARG_WITH to ensure that user supplies a pathname, not just 2647dnl defaulting to yes/no. 2648dnl 2649dnl $1 = option name 2650dnl $2 = help-text 2651dnl $3 = environment variable to set 2652dnl $4 = default value, shown in the help-message, must be a constant 2653dnl $5 = default value, if it's an expression & cannot be in the help-message 2654dnl 2655AC_DEFUN([CF_WITH_PATH], 2656[AC_ARG_WITH($1,[$2 ](default: ifelse([$4],,empty,[$4])),, 2657ifelse([$4],,[withval="${$3}"],[withval="${$3-ifelse([$5],,[$4],[$5])}"]))dnl 2658if ifelse([$5],,true,[test -n "$5"]) ; then 2659CF_PATH_SYNTAX(withval) 2660fi 2661$3="$withval" 2662AC_SUBST($3)dnl 2663])dnl 2664dnl --------------------------------------------------------------------------- 2665dnl CF_WITH_PCRE version: 8 updated: 2010/06/05 11:30:21 2666dnl ------------ 2667dnl Add PCRE (Perl-compatible regular expressions) to the build if it is 2668dnl available and the user requests it. Assume the application will otherwise 2669dnl use the POSIX interface. 2670dnl 2671dnl TODO allow $withval to specify package location 2672AC_DEFUN([CF_WITH_PCRE], 2673[ 2674AC_REQUIRE([CF_PKG_CONFIG]) 2675 2676AC_MSG_CHECKING(if you want to use PCRE for regular-expressions) 2677AC_ARG_WITH(pcre, 2678 [ --with-pcre use PCRE for regular-expressions]) 2679test -z "$with_pcre" && with_pcre=no 2680AC_MSG_RESULT($with_pcre) 2681 2682if test "$with_pcre" != no ; then 2683 CF_TRY_PKG_CONFIG(libpcre,,[ 2684 AC_CHECK_LIB(pcre,pcre_compile,, 2685 AC_MSG_ERROR(Cannot find PCRE library))]) 2686 2687 AC_DEFINE(HAVE_LIB_PCRE) 2688 2689 case $LIBS in #(vi 2690 *pcreposix*) #(vi 2691 ;; 2692 *) 2693 AC_CHECK_LIB(pcreposix,pcreposix_regcomp, 2694 [AC_DEFINE(HAVE_PCREPOSIX_H) 2695 CF_ADD_LIB(pcreposix)], 2696 [AC_CHECK_LIB(pcreposix,regcomp,[ 2697 AC_DEFINE(HAVE_PCREPOSIX_H) 2698 CF_ADD_LIB(pcreposix)], 2699 AC_MSG_ERROR(Cannot find PCRE POSIX library)])) 2700 ;; 2701 esac 2702fi 2703])dnl 2704dnl --------------------------------------------------------------------------- 2705dnl CF_XKB_BELL_EXT version: 3 updated: 2009/02/13 16:00:39 2706dnl --------------- 2707dnl Check for XKB bell extension 2708AC_DEFUN([CF_XKB_BELL_EXT],[ 2709AC_CACHE_CHECK(for XKB Bell extension, cf_cv_xkb_bell_ext,[ 2710AC_TRY_LINK([ 2711#include <X11/Intrinsic.h> 2712#include <X11/XKBlib.h> /* has the prototype */ 2713#include <X11/extensions/XKBbells.h> /* has the XkbBI_xxx definitions */ 2714],[ 2715 int x = (XkbBI_Info |XkbBI_MinorError |XkbBI_MajorError |XkbBI_TerminalBell |XkbBI_MarginBell); 2716 Atom y; 2717 XkbBell((Display *)0, (Widget)0, 0, y); 2718],[cf_cv_xkb_bell_ext=yes],[cf_cv_xkb_bell_ext=no]) 2719]) 2720test "$cf_cv_xkb_bell_ext" = yes && AC_DEFINE(HAVE_XKB_BELL_EXT) 2721]) 2722dnl --------------------------------------------------------------------------- 2723dnl CF_XOPEN_SOURCE version: 34 updated: 2010/05/26 05:38:42 2724dnl --------------- 2725dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions, 2726dnl or adapt to the vendor's definitions to get equivalent functionality, 2727dnl without losing the common non-POSIX features. 2728dnl 2729dnl Parameters: 2730dnl $1 is the nominal value for _XOPEN_SOURCE 2731dnl $2 is the nominal value for _POSIX_C_SOURCE 2732AC_DEFUN([CF_XOPEN_SOURCE],[ 2733 2734cf_XOPEN_SOURCE=ifelse([$1],,500,[$1]) 2735cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2]) 2736cf_xopen_source= 2737 2738case $host_os in #(vi 2739aix[[456]]*) #(vi 2740 cf_xopen_source="-D_ALL_SOURCE" 2741 ;; 2742darwin[[0-8]].*) #(vi 2743 cf_xopen_source="-D_APPLE_C_SOURCE" 2744 ;; 2745darwin*) #(vi 2746 cf_xopen_source="-D_DARWIN_C_SOURCE" 2747 ;; 2748freebsd*|dragonfly*) #(vi 2749 # 5.x headers associate 2750 # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L 2751 # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L 2752 cf_POSIX_C_SOURCE=200112L 2753 cf_XOPEN_SOURCE=600 2754 cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" 2755 ;; 2756hpux11*) #(vi 2757 cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500" 2758 ;; 2759hpux*) #(vi 2760 cf_xopen_source="-D_HPUX_SOURCE" 2761 ;; 2762irix[[56]].*) #(vi 2763 cf_xopen_source="-D_SGI_SOURCE" 2764 ;; 2765linux*|gnu*|mint*|k*bsd*-gnu) #(vi 2766 CF_GNU_SOURCE 2767 ;; 2768mirbsd*) #(vi 2769 # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h> 2770 ;; 2771netbsd*) #(vi 2772 # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw 2773 ;; 2774openbsd*) #(vi 2775 # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw 2776 ;; 2777osf[[45]]*) #(vi 2778 cf_xopen_source="-D_OSF_SOURCE" 2779 ;; 2780nto-qnx*) #(vi 2781 cf_xopen_source="-D_QNX_SOURCE" 2782 ;; 2783sco*) #(vi 2784 # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer 2785 ;; 2786solaris2.1[[0-9]]) #(vi 2787 cf_xopen_source="-D__EXTENSIONS__ -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" 2788 ;; 2789solaris2.[[1-9]]) #(vi 2790 cf_xopen_source="-D__EXTENSIONS__" 2791 ;; 2792*) 2793 AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[ 2794 AC_TRY_COMPILE([#include <sys/types.h>],[ 2795#ifndef _XOPEN_SOURCE 2796make an error 2797#endif], 2798 [cf_cv_xopen_source=no], 2799 [cf_save="$CPPFLAGS" 2800 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" 2801 AC_TRY_COMPILE([#include <sys/types.h>],[ 2802#ifdef _XOPEN_SOURCE 2803make an error 2804#endif], 2805 [cf_cv_xopen_source=no], 2806 [cf_cv_xopen_source=$cf_XOPEN_SOURCE]) 2807 CPPFLAGS="$cf_save" 2808 ]) 2809]) 2810 if test "$cf_cv_xopen_source" != no ; then 2811 CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE) 2812 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE) 2813 cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" 2814 CF_ADD_CFLAGS($cf_temp_xopen_source) 2815 fi 2816 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) 2817 ;; 2818esac 2819 2820if test -n "$cf_xopen_source" ; then 2821 CF_ADD_CFLAGS($cf_xopen_source) 2822fi 2823]) 2824dnl --------------------------------------------------------------------------- 2825dnl CF_X_ATHENA version: 16 updated: 2010/06/14 17:42:30 2826dnl ----------- 2827dnl Check for Xaw (Athena) libraries 2828dnl 2829dnl Sets $cf_x_athena according to the flavor of Xaw which is used. 2830AC_DEFUN([CF_X_ATHENA], 2831[ 2832cf_x_athena=${cf_x_athena-Xaw} 2833 2834AC_MSG_CHECKING(if you want to link with Xaw 3d library) 2835withval= 2836AC_ARG_WITH(Xaw3d, 2837 [ --with-Xaw3d link with Xaw 3d library]) 2838if test "$withval" = yes ; then 2839 cf_x_athena=Xaw3d 2840 AC_MSG_RESULT(yes) 2841else 2842 AC_MSG_RESULT(no) 2843fi 2844 2845AC_MSG_CHECKING(if you want to link with neXT Athena library) 2846withval= 2847AC_ARG_WITH(neXtaw, 2848 [ --with-neXtaw link with neXT Athena library]) 2849if test "$withval" = yes ; then 2850 cf_x_athena=neXtaw 2851 AC_MSG_RESULT(yes) 2852else 2853 AC_MSG_RESULT(no) 2854fi 2855 2856AC_MSG_CHECKING(if you want to link with Athena-Plus library) 2857withval= 2858AC_ARG_WITH(XawPlus, 2859 [ --with-XawPlus link with Athena-Plus library]) 2860if test "$withval" = yes ; then 2861 cf_x_athena=XawPlus 2862 AC_MSG_RESULT(yes) 2863else 2864 AC_MSG_RESULT(no) 2865fi 2866 2867cf_x_athena_lib="" 2868 2869if test "$PKG_CONFIG" != none ; then 2870 cf_athena_list= 2871 test "$cf_x_athena" = Xaw && cf_athena_list="xaw8 xaw7 xaw6" 2872 for cf_athena_pkg in \ 2873 $cf_athena_list \ 2874 ${cf_x_athena} \ 2875 ${cf_x_athena}-devel \ 2876 lib${cf_x_athena} \ 2877 lib${cf_x_athena}-devel 2878 do 2879 CF_TRY_PKG_CONFIG($cf_athena_pkg,[ 2880 cf_x_athena_lib="$cf_pkgconfig_libs" 2881 CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena) 2882 AC_DEFINE_UNQUOTED($cf_x_athena_LIBS) 2883 break]) 2884 done 2885fi 2886 2887if test -z "$cf_x_athena_lib" ; then 2888 CF_X_EXT 2889 CF_X_TOOLKIT 2890 CF_X_ATHENA_CPPFLAGS($cf_x_athena) 2891 CF_X_ATHENA_LIBS($cf_x_athena) 2892fi 2893])dnl 2894dnl --------------------------------------------------------------------------- 2895dnl CF_X_ATHENA_CPPFLAGS version: 5 updated: 2010/05/26 17:35:30 2896dnl -------------------- 2897dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of 2898dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw. 2899AC_DEFUN([CF_X_ATHENA_CPPFLAGS], 2900[ 2901cf_x_athena_root=ifelse([$1],,Xaw,[$1]) 2902cf_x_athena_inc="" 2903 2904for cf_path in default \ 2905 /usr/contrib/X11R6 \ 2906 /usr/contrib/X11R5 \ 2907 /usr/lib/X11R5 \ 2908 /usr/local 2909do 2910 if test -z "$cf_x_athena_inc" ; then 2911 cf_save="$CPPFLAGS" 2912 cf_test=X11/$cf_x_athena_root/SimpleMenu.h 2913 if test $cf_path != default ; then 2914 CPPFLAGS="$cf_save -I$cf_path/include" 2915 AC_MSG_CHECKING(for $cf_test in $cf_path) 2916 else 2917 AC_MSG_CHECKING(for $cf_test) 2918 fi 2919 AC_TRY_COMPILE([ 2920#include <X11/Intrinsic.h> 2921#include <$cf_test>],[], 2922 [cf_result=yes], 2923 [cf_result=no]) 2924 AC_MSG_RESULT($cf_result) 2925 if test "$cf_result" = yes ; then 2926 cf_x_athena_inc=$cf_path 2927 break 2928 else 2929 CPPFLAGS="$cf_save" 2930 fi 2931 fi 2932done 2933 2934if test -z "$cf_x_athena_inc" ; then 2935 AC_MSG_WARN( 2936[Unable to successfully find Athena header files with test program]) 2937elif test "$cf_x_athena_inc" != default ; then 2938 CPPFLAGS="$CPPFLAGS -I$cf_x_athena_inc" 2939fi 2940]) 2941dnl --------------------------------------------------------------------------- 2942dnl CF_X_ATHENA_LIBS version: 9 updated: 2010/06/02 05:03:05 2943dnl ---------------- 2944dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of 2945dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw. 2946AC_DEFUN([CF_X_ATHENA_LIBS], 2947[AC_REQUIRE([CF_X_TOOLKIT]) 2948cf_x_athena_root=ifelse([$1],,Xaw,[$1]) 2949cf_x_athena_lib="" 2950 2951for cf_path in default \ 2952 /usr/contrib/X11R6 \ 2953 /usr/contrib/X11R5 \ 2954 /usr/lib/X11R5 \ 2955 /usr/local 2956do 2957 for cf_lib in \ 2958 "-l$cf_x_athena_root -lXmu" \ 2959 "-l$cf_x_athena_root -lXpm -lXmu" \ 2960 "-l${cf_x_athena_root}_s -lXmu_s" 2961 do 2962 if test -z "$cf_x_athena_lib" ; then 2963 cf_save="$LIBS" 2964 cf_test=XawSimpleMenuAddGlobalActions 2965 if test $cf_path != default ; then 2966 CF_ADD_LIBS(-L$cf_path/lib $cf_lib) 2967 AC_MSG_CHECKING(for $cf_lib in $cf_path) 2968 else 2969 CF_ADD_LIBS($cf_lib) 2970 AC_MSG_CHECKING(for $cf_test in $cf_lib) 2971 fi 2972 AC_TRY_LINK([],[$cf_test()], 2973 [cf_result=yes], 2974 [cf_result=no]) 2975 AC_MSG_RESULT($cf_result) 2976 if test "$cf_result" = yes ; then 2977 cf_x_athena_lib="$cf_lib" 2978 break 2979 fi 2980 LIBS="$cf_save" 2981 fi 2982 done 2983done 2984 2985if test -z "$cf_x_athena_lib" ; then 2986 AC_MSG_ERROR( 2987[Unable to successfully link Athena library (-l$cf_x_athena_root) with test program]) 2988fi 2989 2990CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena) 2991AC_DEFINE_UNQUOTED($cf_x_athena_LIBS) 2992]) 2993dnl --------------------------------------------------------------------------- 2994dnl CF_X_EXT version: 3 updated: 2010/06/02 05:03:05 2995dnl -------- 2996AC_DEFUN([CF_X_EXT],[ 2997CF_TRY_PKG_CONFIG(Xext,,[ 2998 AC_CHECK_LIB(Xext,XextCreateExtension, 2999 [CF_ADD_LIB(Xext)])]) 3000])dnl 3001dnl --------------------------------------------------------------------------- 3002dnl CF_X_FREETYPE version: 22 updated: 2010/06/02 05:03:05 3003dnl ------------- 3004dnl Check for X FreeType headers and libraries (XFree86 4.x, etc). 3005dnl 3006dnl First check for the appropriate config program, since the developers for 3007dnl these libraries change their configuration (and config program) more or 3008dnl less randomly. If we cannot find the config program, do not bother trying 3009dnl to guess the latest variation of include/lib directories. 3010dnl 3011dnl If either or both of these configure-script options are not given, rely on 3012dnl the output of the config program to provide the cflags/libs options: 3013dnl --with-freetype-cflags 3014dnl --with-freetype-libs 3015AC_DEFUN([CF_X_FREETYPE], 3016[ 3017AC_REQUIRE([CF_PKG_CONFIG]) 3018 3019cf_extra_freetype_libs= 3020FREETYPE_CONFIG=none 3021FREETYPE_PARAMS= 3022 3023AC_MSG_CHECKING(if you specified -D/-I options for FreeType) 3024AC_ARG_WITH(freetype-cflags, 3025 [ --with-freetype-cflags -D/-I options for compiling with FreeType], 3026 [cf_cv_x_freetype_incs="$with_freetype_cflags"], 3027 [cf_cv_x_freetype_incs=no]) 3028AC_MSG_RESULT($cf_cv_x_freetype_incs) 3029 3030 3031AC_MSG_CHECKING(if you specified -L/-l options for FreeType) 3032AC_ARG_WITH(freetype-libs, 3033 [ --with-freetype-libs -L/-l options to link FreeType], 3034 [cf_cv_x_freetype_libs="$with_freetype_libs"], 3035 [cf_cv_x_freetype_libs=no]) 3036AC_MSG_RESULT($cf_cv_x_freetype_libs) 3037 3038if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists xft; then 3039 FREETYPE_CONFIG=$PKG_CONFIG 3040 FREETYPE_PARAMS=xft 3041else 3042 AC_PATH_PROG(FREETYPE_XFT_CONFIG, xft-config, none) 3043 if test "$FREETYPE_XFT_CONFIG" != none; then 3044 FREETYPE_CONFIG=$FREETYPE_XFT_CONFIG 3045 else 3046 cf_extra_freetype_libs="-lXft" 3047 AC_PATH_PROG(FREETYPE_OLD_CONFIG, freetype-config, none) 3048 if test "$FREETYPE_OLD_CONFIG" != none; then 3049 FREETYPE_CONFIG=$FREETYPE_OLD_CONFIG 3050 fi 3051 fi 3052fi 3053AC_MSG_CHECKING(for FreeType config) 3054AC_MSG_RESULT($FREETYPE_CONFIG $FREETYPE_PARAMS) 3055 3056if test "$FREETYPE_CONFIG" != none ; then 3057 3058 if test "$cf_cv_x_freetype_incs" = no ; then 3059 AC_MSG_CHECKING(for $FREETYPE_CONFIG cflags) 3060 cf_cv_x_freetype_incs="`$FREETYPE_CONFIG $FREETYPE_PARAMS --cflags 2>/dev/null`" 3061 AC_MSG_RESULT($cf_cv_x_freetype_incs) 3062 fi 3063 3064 if test "$cf_cv_x_freetype_libs" = no ; then 3065 AC_MSG_CHECKING(for $FREETYPE_CONFIG libs) 3066 cf_cv_x_freetype_libs="$cf_extra_freetype_libs `$FREETYPE_CONFIG $FREETYPE_PARAMS --libs 2>/dev/null`" 3067 AC_MSG_RESULT($cf_cv_x_freetype_libs) 3068 fi 3069 3070fi 3071 3072if test "$cf_cv_x_freetype_incs" = no ; then 3073 cf_cv_x_freetype_incs= 3074fi 3075 3076if test "$cf_cv_x_freetype_libs" = no ; then 3077 cf_cv_x_freetype_libs=-lXft 3078fi 3079 3080AC_MSG_CHECKING(if we can link with FreeType libraries) 3081 3082cf_save_LIBS="$LIBS" 3083cf_save_INCS="$CPPFLAGS" 3084 3085CF_ADD_LIBS($cf_cv_x_freetype_libs) 3086CPPFLAGS="$CPPFLAGS $cf_cv_x_freetype_incs" 3087 3088AC_TRY_LINK([ 3089#include <X11/Xlib.h> 3090#include <X11/extensions/Xrender.h> 3091#include <X11/Xft/Xft.h>],[ 3092 XftPattern *pat = XftNameParse ("name");], 3093 [cf_cv_found_freetype=yes], 3094 [cf_cv_found_freetype=no]) 3095AC_MSG_RESULT($cf_cv_found_freetype) 3096 3097LIBS="$cf_save_LIBS" 3098CPPFLAGS="$cf_save_INCS" 3099 3100if test "$cf_cv_found_freetype" = yes ; then 3101 CF_ADD_LIBS($cf_cv_x_freetype_libs) 3102 CF_ADD_CFLAGS($cf_cv_x_freetype_incs) 3103 AC_DEFINE(XRENDERFONT) 3104 3105AC_CHECK_FUNCS( \ 3106 XftDrawCharSpec \ 3107 XftDrawSetClip \ 3108 XftDrawSetClipRectangles \ 3109) 3110 3111else 3112 AC_MSG_WARN(No libraries found for FreeType) 3113 CPPFLAGS=`echo "$CPPFLAGS" | sed -e s/-DXRENDERFONT//` 3114fi 3115 3116# FIXME: revisit this if needed 3117AC_SUBST(XRENDERFONT) 3118AC_SUBST(HAVE_TYPE_FCCHAR32) 3119AC_SUBST(HAVE_TYPE_XFTCHARSPEC) 3120]) 3121dnl --------------------------------------------------------------------------- 3122dnl CF_X_TOOLKIT version: 15 updated: 2010/06/14 17:42:30 3123dnl ------------ 3124dnl Check for X Toolkit libraries 3125dnl 3126AC_DEFUN([CF_X_TOOLKIT], 3127[ 3128AC_REQUIRE([AC_PATH_XTRA]) 3129AC_REQUIRE([CF_CHECK_CACHE]) 3130 3131cf_have_X_LIBS=no 3132 3133CF_TRY_PKG_CONFIG(xt,[ 3134 3135 # workaround for broken ".pc" files used for X Toolkit. 3136 case "x$X_PRE_LIBS" in #(vi 3137 *-lICE*) 3138 case "x$LIBS" in #(vi 3139 *-lICE*) #(vi 3140 ;; 3141 *) 3142 CF_VERBOSE(work around broken package) 3143 CF_VERBOSE(...before $LIBS) 3144 LIBS=`echo "$LIBS" | sed -e "s/[[ ]][[ ]]*/ /g" -e "s,-lXt ,-lXt $X_PRE_LIBS ," -e 's/ / /g'` 3145 CF_VERBOSE(...after $LIBS) 3146 ;; 3147 esac 3148 ;; 3149 esac 3150 3151 cf_have_X_LIBS=yes 3152],[ 3153 3154 LDFLAGS="$X_LIBS $LDFLAGS" 3155 CF_CHECK_CFLAGS($X_CFLAGS) 3156 3157 AC_CHECK_FUNC(XOpenDisplay,,[ 3158 AC_CHECK_LIB(X11,XOpenDisplay, 3159 [CF_ADD_LIB(X11)],, 3160 [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])]) 3161 3162 AC_CHECK_FUNC(XtAppInitialize,,[ 3163 AC_CHECK_LIB(Xt, XtAppInitialize, 3164 [AC_DEFINE(HAVE_LIBXT) 3165 cf_have_X_LIBS=Xt 3166 LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS"],, 3167 [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])]) 3168]) 3169 3170if test $cf_have_X_LIBS = no ; then 3171 AC_MSG_WARN( 3172[Unable to successfully link X Toolkit library (-lXt) with 3173test program. You will have to check and add the proper libraries by hand 3174to makefile.]) 3175fi 3176])dnl 3177