aclocal.m4 revision 20d2c4d2
120d2c4d2Smrgdnl $XTermId: aclocal.m4,v 1.285 2010/06/14 21:44:02 tom Exp $ 2d522f475Smrgdnl 3d522f475Smrgdnl --------------------------------------------------------------------------- 4d522f475Smrgdnl 520d2c4d2Smrgdnl Copyright 1997-2009,2010 by Thomas E. Dickey 6d522f475Smrgdnl 7d522f475Smrgdnl All Rights Reserved 8d522f475Smrgdnl 920d2c4d2Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a 1020d2c4d2Smrgdnl copy of this software and associated documentation files (the 1120d2c4d2Smrgdnl "Software"), to deal in the Software without restriction, including 1220d2c4d2Smrgdnl without limitation the rights to use, copy, modify, merge, publish, 1320d2c4d2Smrgdnl distribute, sublicense, and/or sell copies of the Software, and to 1420d2c4d2Smrgdnl permit persons to whom the Software is furnished to do so, subject to 1520d2c4d2Smrgdnl the following conditions: 1620d2c4d2Smrgdnl 1720d2c4d2Smrgdnl The above copyright notice and this permission notice shall be included 1820d2c4d2Smrgdnl in all copies or substantial portions of the Software. 1920d2c4d2Smrgdnl 2020d2c4d2Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 2120d2c4d2Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 2220d2c4d2Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 2320d2c4d2Smrgdnl IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY 2420d2c4d2Smrgdnl CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 2520d2c4d2Smrgdnl TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 2620d2c4d2Smrgdnl SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 2720d2c4d2Smrgdnl 2820d2c4d2Smrgdnl Except as contained in this notice, the name(s) of the above copyright 2920d2c4d2Smrgdnl holders shall not be used in advertising or otherwise to promote the 3020d2c4d2Smrgdnl sale, use or other dealings in this Software without prior written 3120d2c4d2Smrgdnl authorization. 32d522f475Smrgdnl 33d522f475Smrgdnl --------------------------------------------------------------------------- 3420d2c4d2Smrgdnl See 3520d2c4d2Smrgdnl http://invisible-island.net/autoconf/autoconf.html 3620d2c4d2Smrgdnl --------------------------------------------------------------------------- 37d522f475Smrgdnl --------------------------------------------------------------------------- 38d522f475Smrgdnl AM_LANGINFO_CODESET version: 3 updated: 2002/10/27 23:21:42 39d522f475Smrgdnl ------------------- 40d522f475Smrgdnl Inserted as requested by gettext 0.10.40 41d522f475Smrgdnl File from /usr/share/aclocal 42d522f475Smrgdnl codeset.m4 43d522f475Smrgdnl ==================== 44d522f475Smrgdnl serial AM1 45d522f475Smrgdnl 46d522f475Smrgdnl From Bruno Haible. 47d522f475SmrgAC_DEFUN([AM_LANGINFO_CODESET], 48d522f475Smrg[ 49d522f475Smrg AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, 50d522f475Smrg [AC_TRY_LINK([#include <langinfo.h>], 51d522f475Smrg [char* cs = nl_langinfo(CODESET);], 52d522f475Smrg am_cv_langinfo_codeset=yes, 53d522f475Smrg am_cv_langinfo_codeset=no) 54d522f475Smrg ]) 55d522f475Smrg if test $am_cv_langinfo_codeset = yes; then 56d522f475Smrg AC_DEFINE(HAVE_LANGINFO_CODESET, 1, 57d522f475Smrg [Define if you have <langinfo.h> and nl_langinfo(CODESET).]) 58d522f475Smrg fi 59d522f475Smrg])dnl 60d522f475Smrgdnl --------------------------------------------------------------------------- 6120d2c4d2Smrgdnl CF_ADD_CFLAGS version: 10 updated: 2010/05/26 05:38:42 62d522f475Smrgdnl ------------- 63d522f475Smrgdnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS 64d522f475Smrgdnl The second parameter if given makes this macro verbose. 65d522f475Smrgdnl 66d522f475Smrgdnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS, 67d522f475Smrgdnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily 68d522f475Smrgdnl confused by the quotes (which require backslashes to keep them usable). 69d522f475SmrgAC_DEFUN([CF_ADD_CFLAGS], 70d522f475Smrg[ 71d522f475Smrgcf_fix_cppflags=no 72d522f475Smrgcf_new_cflags= 73d522f475Smrgcf_new_cppflags= 74d522f475Smrgcf_new_extra_cppflags= 75d522f475Smrg 76d522f475Smrgfor cf_add_cflags in $1 77d522f475Smrgdo 78d522f475Smrgcase $cf_fix_cppflags in 79d522f475Smrgno) 80d522f475Smrg case $cf_add_cflags in #(vi 81d522f475Smrg -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi 82d522f475Smrg case $cf_add_cflags in 83d522f475Smrg -D*) 84d522f475Smrg cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'` 85d522f475Smrg 86d522f475Smrg test "${cf_add_cflags}" != "${cf_tst_cflags}" \ 8720d2c4d2Smrg && test -z "${cf_tst_cflags}" \ 8820d2c4d2Smrg && cf_fix_cppflags=yes 89d522f475Smrg 90d522f475Smrg if test $cf_fix_cppflags = yes ; then 91d522f475Smrg cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" 92d522f475Smrg continue 93d522f475Smrg elif test "${cf_tst_cflags}" = "\"'" ; then 94d522f475Smrg cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" 95d522f475Smrg continue 96d522f475Smrg fi 97d522f475Smrg ;; 98d522f475Smrg esac 99d522f475Smrg case "$CPPFLAGS" in 100d522f475Smrg *$cf_add_cflags) #(vi 101d522f475Smrg ;; 102d522f475Smrg *) #(vi 10320d2c4d2Smrg case $cf_add_cflags in #(vi 10420d2c4d2Smrg -D*) 10520d2c4d2Smrg cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` 10620d2c4d2Smrg CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags) 10720d2c4d2Smrg ;; 10820d2c4d2Smrg esac 109d522f475Smrg cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" 110d522f475Smrg ;; 111d522f475Smrg esac 112d522f475Smrg ;; 113d522f475Smrg *) 114d522f475Smrg cf_new_cflags="$cf_new_cflags $cf_add_cflags" 115d522f475Smrg ;; 116d522f475Smrg esac 117d522f475Smrg ;; 118d522f475Smrgyes) 119d522f475Smrg cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" 120d522f475Smrg 121d522f475Smrg cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'` 122d522f475Smrg 123d522f475Smrg test "${cf_add_cflags}" != "${cf_tst_cflags}" \ 12420d2c4d2Smrg && test -z "${cf_tst_cflags}" \ 12520d2c4d2Smrg && cf_fix_cppflags=no 126d522f475Smrg ;; 127d522f475Smrgesac 128d522f475Smrgdone 129d522f475Smrg 130d522f475Smrgif test -n "$cf_new_cflags" ; then 13120d2c4d2Smrg ifelse([$2],,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)]) 132d522f475Smrg CFLAGS="$CFLAGS $cf_new_cflags" 133d522f475Smrgfi 134d522f475Smrg 135d522f475Smrgif test -n "$cf_new_cppflags" ; then 13620d2c4d2Smrg ifelse([$2],,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)]) 137956cc18dSsnj CPPFLAGS="$CPPFLAGS $cf_new_cppflags" 138d522f475Smrgfi 139d522f475Smrg 140d522f475Smrgif test -n "$cf_new_extra_cppflags" ; then 14120d2c4d2Smrg ifelse([$2],,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)]) 142d522f475Smrg EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" 143d522f475Smrgfi 144d522f475Smrg 145d522f475SmrgAC_SUBST(EXTRA_CPPFLAGS) 146d522f475Smrg 147d522f475Smrg])dnl 148d522f475Smrgdnl --------------------------------------------------------------------------- 14920d2c4d2Smrgdnl CF_ADD_LIB version: 2 updated: 2010/06/02 05:03:05 15020d2c4d2Smrgdnl ---------- 15120d2c4d2Smrgdnl Add a library, used to enforce consistency. 15220d2c4d2Smrgdnl 15320d2c4d2Smrgdnl $1 = library to add, without the "-l" 15420d2c4d2Smrgdnl $2 = variable to update (default $LIBS) 15520d2c4d2SmrgAC_DEFUN([CF_ADD_LIB],[CF_ADD_LIBS(-l$1,ifelse($2,,LIBS,[$2]))])dnl 15620d2c4d2Smrgdnl --------------------------------------------------------------------------- 15720d2c4d2Smrgdnl CF_ADD_LIBS version: 1 updated: 2010/06/02 05:03:05 15820d2c4d2Smrgdnl ----------- 15920d2c4d2Smrgdnl Add one or more libraries, used to enforce consistency. 16020d2c4d2Smrgdnl 16120d2c4d2Smrgdnl $1 = libraries to add, with the "-l", etc. 16220d2c4d2Smrgdnl $2 = variable to update (default $LIBS) 16320d2c4d2SmrgAC_DEFUN([CF_ADD_LIBS],[ifelse($2,,LIBS,[$2])="$1 [$]ifelse($2,,LIBS,[$2])"])dnl 16420d2c4d2Smrgdnl --------------------------------------------------------------------------- 165d522f475Smrgdnl CF_ANSI_CC_CHECK version: 9 updated: 2001/12/30 17:53:34 166d522f475Smrgdnl ---------------- 167d522f475Smrgdnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES' 168d522f475Smrgdnl in the sharutils 4.2 distribution. 169d522f475SmrgAC_DEFUN([CF_ANSI_CC_CHECK], 170d522f475Smrg[ 171d522f475SmrgAC_CACHE_CHECK(for ${CC-cc} option to accept ANSI C, cf_cv_ansi_cc,[ 172d522f475Smrgcf_cv_ansi_cc=no 173d522f475Smrgcf_save_CFLAGS="$CFLAGS" 174d522f475Smrgcf_save_CPPFLAGS="$CPPFLAGS" 175d522f475Smrg# Don't try gcc -ansi; that turns off useful extensions and 176d522f475Smrg# breaks some systems' header files. 177d522f475Smrg# AIX -qlanglvl=ansi 178d522f475Smrg# Ultrix and OSF/1 -std1 179d522f475Smrg# HP-UX -Aa -D_HPUX_SOURCE 180d522f475Smrg# SVR4 -Xc 181d522f475Smrg# UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes) 182d522f475Smrgfor cf_arg in "-DCC_HAS_PROTOS" \ 183d522f475Smrg "" \ 184d522f475Smrg -qlanglvl=ansi \ 185d522f475Smrg -std1 \ 186d522f475Smrg -Ae \ 187d522f475Smrg "-Aa -D_HPUX_SOURCE" \ 188d522f475Smrg -Xc 189d522f475Smrgdo 190d522f475Smrg CF_ADD_CFLAGS($cf_arg) 191d522f475Smrg AC_TRY_COMPILE( 192d522f475Smrg[ 193d522f475Smrg#ifndef CC_HAS_PROTOS 194d522f475Smrg#if !defined(__STDC__) || (__STDC__ != 1) 195d522f475Smrgchoke me 196d522f475Smrg#endif 197d522f475Smrg#endif 198d522f475Smrg],[ 199d522f475Smrg int test (int i, double x); 200d522f475Smrg struct s1 {int (*f) (int a);}; 201d522f475Smrg struct s2 {int (*f) (double a);};], 202d522f475Smrg [cf_cv_ansi_cc="$cf_arg"; break]) 203d522f475Smrgdone 204d522f475SmrgCFLAGS="$cf_save_CFLAGS" 205d522f475SmrgCPPFLAGS="$cf_save_CPPFLAGS" 206d522f475Smrg]) 207d522f475Smrg 208d522f475Smrgif test "$cf_cv_ansi_cc" != "no"; then 209d522f475Smrgif test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then 210d522f475Smrg CF_ADD_CFLAGS($cf_cv_ansi_cc) 211d522f475Smrgelse 212d522f475Smrg AC_DEFINE(CC_HAS_PROTOS) 213d522f475Smrgfi 214d522f475Smrgfi 215d522f475Smrg])dnl 216d522f475Smrgdnl --------------------------------------------------------------------------- 217d522f475Smrgdnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31 218d522f475Smrgdnl -------------- 219d522f475Smrgdnl Allow user to disable a normally-on option. 220d522f475SmrgAC_DEFUN([CF_ARG_DISABLE], 221d522f475Smrg[CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl 222d522f475Smrgdnl --------------------------------------------------------------------------- 223d522f475Smrgdnl CF_ARG_ENABLE version: 3 updated: 1999/03/30 17:24:31 224d522f475Smrgdnl ------------- 225d522f475Smrgdnl Allow user to enable a normally-off option. 226d522f475SmrgAC_DEFUN([CF_ARG_ENABLE], 227d522f475Smrg[CF_ARG_OPTION($1,[$2],[$3],[$4],no)])dnl 228d522f475Smrgdnl --------------------------------------------------------------------------- 22920d2c4d2Smrgdnl CF_ARG_OPTION version: 4 updated: 2010/05/26 05:38:42 230d522f475Smrgdnl ------------- 231d522f475Smrgdnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus 232d522f475Smrgdnl values. 233d522f475Smrgdnl 234d522f475Smrgdnl Parameters: 235d522f475Smrgdnl $1 = option name 236d522f475Smrgdnl $2 = help-string 237d522f475Smrgdnl $3 = action to perform if option is not default 238d522f475Smrgdnl $4 = action if perform if option is default 239d522f475Smrgdnl $5 = default option value (either 'yes' or 'no') 240d522f475SmrgAC_DEFUN([CF_ARG_OPTION], 24120d2c4d2Smrg[AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes) 242d522f475Smrg if test "$enableval" != "$5" ; then 24320d2c4d2Smrgifelse([$3],,[ :]dnl 24420d2c4d2Smrg,[ $3]) ifelse([$4],,,[ 245d522f475Smrg else 246d522f475Smrg $4]) 24720d2c4d2Smrg fi],[enableval=$5 ifelse([$4],,,[ 248d522f475Smrg $4 249d522f475Smrg])dnl 250d522f475Smrg ])])dnl 251d522f475Smrgdnl --------------------------------------------------------------------------- 252d522f475Smrgdnl CF_CHECK_CACHE version: 11 updated: 2008/03/23 14:45:59 253d522f475Smrgdnl -------------- 254d522f475Smrgdnl Check if we're accidentally using a cache from a different machine. 255d522f475Smrgdnl Derive the system name, as a check for reusing the autoconf cache. 256d522f475Smrgdnl 257d522f475Smrgdnl If we've packaged config.guess and config.sub, run that (since it does a 258d522f475Smrgdnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow 259d522f475Smrgdnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM 260d522f475Smrgdnl which is useful in cross-compiles. 261d522f475Smrgdnl 262d522f475Smrgdnl Note: we would use $ac_config_sub, but that is one of the places where 263d522f475Smrgdnl autoconf 2.5x broke compatibility with autoconf 2.13 264d522f475SmrgAC_DEFUN([CF_CHECK_CACHE], 265d522f475Smrg[ 266d522f475Smrgif test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then 267d522f475Smrg ifelse([$1],,[AC_CANONICAL_HOST],[$1]) 268d522f475Smrg system_name="$host_os" 269d522f475Smrgelse 270d522f475Smrg system_name="`(uname -s -r) 2>/dev/null`" 271d522f475Smrg if test -z "$system_name" ; then 272d522f475Smrg system_name="`(hostname) 2>/dev/null`" 273d522f475Smrg fi 274d522f475Smrgfi 275d522f475Smrgtest -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name") 276d522f475SmrgAC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"]) 277d522f475Smrg 278d522f475Smrgtest -z "$system_name" && system_name="$cf_cv_system_name" 279d522f475Smrgtest -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name) 280d522f475Smrg 281d522f475Smrgif test ".$system_name" != ".$cf_cv_system_name" ; then 282d522f475Smrg AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)) 283d522f475Smrg AC_MSG_ERROR("Please remove config.cache and try again.") 284d522f475Smrgfi 285d522f475Smrg])dnl 286d522f475Smrgdnl --------------------------------------------------------------------------- 287d522f475Smrgdnl CF_CHECK_CFLAGS version: 2 updated: 2001/12/30 19:09:58 288d522f475Smrgdnl --------------- 289d522f475Smrgdnl Conditionally add to $CFLAGS and $CPPFLAGS values which are derived from 290d522f475Smrgdnl a build-configuration such as imake. These have the pitfall that they 291d522f475Smrgdnl often contain compiler-specific options which we cannot use, mixed with 292d522f475Smrgdnl preprocessor options that we usually can. 293d522f475SmrgAC_DEFUN([CF_CHECK_CFLAGS], 294d522f475Smrg[ 295d522f475SmrgCF_VERBOSE(checking additions to CFLAGS) 296d522f475Smrgcf_check_cflags="$CFLAGS" 297d522f475Smrgcf_check_cppflags="$CPPFLAGS" 298d522f475SmrgCF_ADD_CFLAGS($1,yes) 299d522f475Smrgif test "$cf_check_cflags" != "$CFLAGS" ; then 300d522f475SmrgAC_TRY_LINK([#include <stdio.h>],[printf("Hello world");],, 301d522f475Smrg [CF_VERBOSE(test-compile failed. Undoing change to \$CFLAGS) 302d522f475Smrg if test "$cf_check_cppflags" != "$CPPFLAGS" ; then 303d522f475Smrg CF_VERBOSE(but keeping change to \$CPPFLAGS) 304d522f475Smrg fi 305d522f475Smrg CFLAGS="$cf_check_flags"]) 306d522f475Smrgfi 307d522f475Smrg])dnl 308d522f475Smrgdnl --------------------------------------------------------------------------- 30920d2c4d2Smrgdnl CF_CHECK_ERRNO version: 11 updated: 2010/05/26 05:38:42 310d522f475Smrgdnl -------------- 311d522f475Smrgdnl Check for data that is usually declared in <stdio.h> or <errno.h>, e.g., 312d522f475Smrgdnl the 'errno' variable. Define a DECL_xxx symbol if we must declare it 313d522f475Smrgdnl ourselves. 314d522f475Smrgdnl 315d522f475Smrgdnl $1 = the name to check 3162eaa94a1Schristosdnl $2 = the assumed type 317d522f475SmrgAC_DEFUN([CF_CHECK_ERRNO], 318d522f475Smrg[ 319d522f475SmrgAC_CACHE_CHECK(if external $1 is declared, cf_cv_dcl_$1,[ 320d522f475Smrg AC_TRY_COMPILE([ 321d522f475Smrg#ifdef HAVE_STDLIB_H 322d522f475Smrg#include <stdlib.h> 323d522f475Smrg#endif 324d522f475Smrg#include <stdio.h> 325d522f475Smrg#include <sys/types.h> 326d522f475Smrg#include <errno.h> ], 32720d2c4d2Smrg ifelse([$2],,int,[$2]) x = (ifelse([$2],,int,[$2])) $1, 328d522f475Smrg [cf_cv_dcl_$1=yes], 329d522f475Smrg [cf_cv_dcl_$1=no]) 330d522f475Smrg]) 331d522f475Smrg 332d522f475Smrgif test "$cf_cv_dcl_$1" = no ; then 333d522f475Smrg CF_UPPER(cf_result,decl_$1) 334d522f475Smrg AC_DEFINE_UNQUOTED($cf_result) 335d522f475Smrgfi 336d522f475Smrg 337d522f475Smrg# It's possible (for near-UNIX clones) that the data doesn't exist 33820d2c4d2SmrgCF_CHECK_EXTERN_DATA($1,ifelse([$2],,int,[$2])) 339d522f475Smrg])dnl 340d522f475Smrgdnl --------------------------------------------------------------------------- 341d522f475Smrgdnl CF_CHECK_EXTERN_DATA version: 3 updated: 2001/12/30 18:03:23 342d522f475Smrgdnl -------------------- 343d522f475Smrgdnl Check for existence of external data in the current set of libraries. If 344d522f475Smrgdnl we can modify it, it's real enough. 345d522f475Smrgdnl $1 = the name to check 346d522f475Smrgdnl $2 = its type 347d522f475SmrgAC_DEFUN([CF_CHECK_EXTERN_DATA], 348d522f475Smrg[ 349d522f475SmrgAC_CACHE_CHECK(if external $1 exists, cf_cv_have_$1,[ 350d522f475Smrg AC_TRY_LINK([ 351d522f475Smrg#undef $1 352d522f475Smrgextern $2 $1; 353d522f475Smrg], 354d522f475Smrg [$1 = 2], 355d522f475Smrg [cf_cv_have_$1=yes], 356d522f475Smrg [cf_cv_have_$1=no]) 357d522f475Smrg]) 358d522f475Smrg 359d522f475Smrgif test "$cf_cv_have_$1" = yes ; then 360d522f475Smrg CF_UPPER(cf_result,have_$1) 361d522f475Smrg AC_DEFINE_UNQUOTED($cf_result) 362d522f475Smrgfi 363d522f475Smrg 364d522f475Smrg])dnl 365d522f475Smrgdnl --------------------------------------------------------------------------- 36620d2c4d2Smrgdnl CF_DISABLE_ECHO version: 11 updated: 2009/12/13 13:16:57 367d522f475Smrgdnl --------------- 368d522f475Smrgdnl You can always use "make -n" to see the actual options, but it's hard to 369d522f475Smrgdnl pick out/analyze warning messages when the compile-line is long. 370d522f475Smrgdnl 371d522f475Smrgdnl Sets: 372d522f475Smrgdnl ECHO_LT - symbol to control if libtool is verbose 373d522f475Smrgdnl ECHO_LD - symbol to prefix "cc -o" lines 374d522f475Smrgdnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o) 375d522f475Smrgdnl SHOW_CC - symbol to put before explicit "cc -c" lines 376d522f475Smrgdnl ECHO_CC - symbol to put before any "cc" line 377d522f475Smrgdnl 378d522f475SmrgAC_DEFUN([CF_DISABLE_ECHO],[ 379d522f475SmrgAC_MSG_CHECKING(if you want to see long compiling messages) 380d522f475SmrgCF_ARG_DISABLE(echo, 381d522f475Smrg [ --disable-echo display "compiling" commands], 382d522f475Smrg [ 383d522f475Smrg ECHO_LT='--silent' 384d522f475Smrg ECHO_LD='@echo linking [$]@;' 38520d2c4d2Smrg RULE_CC='@echo compiling [$]<' 38620d2c4d2Smrg SHOW_CC='@echo compiling [$]@' 387d522f475Smrg ECHO_CC='@' 388d522f475Smrg],[ 389d522f475Smrg ECHO_LT='' 390d522f475Smrg ECHO_LD='' 39120d2c4d2Smrg RULE_CC='' 39220d2c4d2Smrg SHOW_CC='' 393d522f475Smrg ECHO_CC='' 394d522f475Smrg]) 395d522f475SmrgAC_MSG_RESULT($enableval) 396d522f475SmrgAC_SUBST(ECHO_LT) 397d522f475SmrgAC_SUBST(ECHO_LD) 398d522f475SmrgAC_SUBST(RULE_CC) 399d522f475SmrgAC_SUBST(SHOW_CC) 400d522f475SmrgAC_SUBST(ECHO_CC) 401d522f475Smrg])dnl 402d522f475Smrgdnl --------------------------------------------------------------------------- 40320d2c4d2Smrgdnl CF_DISABLE_RPATH_HACK version: 1 updated: 2010/04/11 10:54:00 40420d2c4d2Smrgdnl --------------------- 40520d2c4d2Smrgdnl The rpath-hack makes it simpler to build programs, particularly with the 40620d2c4d2Smrgdnl *BSD ports which may have essential libraries in unusual places. But it 40720d2c4d2Smrgdnl can interfere with building an executable for the base system. Use this 40820d2c4d2Smrgdnl option in that case. 40920d2c4d2SmrgAC_DEFUN([CF_DISABLE_RPATH_HACK], 41020d2c4d2Smrg[ 41120d2c4d2SmrgAC_MSG_CHECKING(if rpath should be not be set) 41220d2c4d2SmrgCF_ARG_DISABLE(rpath-hack, 41320d2c4d2Smrg [ --disable-rpath-hack don't add rpath options for additional libraries], 41420d2c4d2Smrg [cf_disable_rpath_hack=yes], 41520d2c4d2Smrg [cf_disable_rpath_hack=no]) 41620d2c4d2SmrgAC_MSG_RESULT($cf_disable_rpath_hack) 41720d2c4d2Smrgif test "$cf_disable_rpath_hack" = no ; then 41820d2c4d2Smrg CF_RPATH_HACK 41920d2c4d2Smrgfi 42020d2c4d2Smrg]) 42120d2c4d2Smrgdnl --------------------------------------------------------------------------- 422d522f475Smrgdnl CF_ENABLE_NARROWPROTO version: 3 updated: 2006/02/12 17:46:00 423d522f475Smrgdnl --------------------- 424d522f475Smrgdnl If this is not set properly, Xaw's scrollbars will not work. 425d522f475Smrgdnl The so-called "modular" configuration for X.org omits most of the 426d522f475Smrgdnl configure checks that would be needed to provide compatibility with 427d522f475Smrgdnl older X builds. This one breaks things noticeably. 428d522f475SmrgAC_DEFUN([CF_ENABLE_NARROWPROTO], 429d522f475Smrg[ 430d522f475SmrgAC_MSG_CHECKING(if you want narrow prototypes for X libraries) 431d522f475Smrg 432d522f475Smrgcase `$ac_config_guess` in #(vi 433d522f475Smrg*cygwin*|*freebsd*|*gnu*|*irix5*|*irix6*|*linux-gnu*|*netbsd*|*openbsd*|*qnx*|*sco*|*sgi*) #(vi 434d522f475Smrg cf_default_narrowproto=yes 435d522f475Smrg ;; 436d522f475Smrg*) 437d522f475Smrg cf_default_narrowproto=no 438d522f475Smrg ;; 439d522f475Smrgesac 440d522f475Smrg 441d522f475SmrgCF_ARG_OPTION(narrowproto, 442d522f475Smrg [ --enable-narrowproto enable narrow prototypes for X libraries], 443d522f475Smrg [enable_narrowproto=$enableval], 444d522f475Smrg [enable_narrowproto=$cf_default_narrowproto], 445d522f475Smrg [$cf_default_narrowproto]) 446d522f475SmrgAC_MSG_RESULT($enable_narrowproto) 447d522f475Smrg]) 448d522f475Smrgdnl --------------------------------------------------------------------------- 449d522f475Smrgdnl CF_ERRNO version: 5 updated: 1997/11/30 12:44:39 450d522f475Smrgdnl -------- 451d522f475Smrgdnl Check if 'errno' is declared in <errno.h> 452d522f475SmrgAC_DEFUN([CF_ERRNO], 453d522f475Smrg[ 454d522f475SmrgCF_CHECK_ERRNO(errno) 455d522f475Smrg])dnl 456d522f475Smrgdnl --------------------------------------------------------------------------- 457d522f475Smrgdnl CF_FUNC_MEMMOVE version: 7 updated: 2006/12/16 12:33:30 458d522f475Smrgdnl --------------- 459d522f475Smrgdnl Check for memmove, or a bcopy that can handle overlapping copy. If neither 460d522f475Smrgdnl is found, add our own version of memmove to the list of objects. 461d522f475SmrgAC_DEFUN([CF_FUNC_MEMMOVE], 462d522f475Smrg[ 463d522f475SmrgAC_CHECK_FUNC(memmove,,[ 464d522f475SmrgAC_CHECK_FUNC(bcopy,[ 465d522f475Smrg AC_CACHE_CHECK(if bcopy does overlapping moves,cf_cv_good_bcopy,[ 466d522f475Smrg AC_TRY_RUN([ 467d522f475Smrgint main() { 468d522f475Smrg static char data[] = "abcdefghijklmnopqrstuwwxyz"; 469d522f475Smrg char temp[40]; 470d522f475Smrg bcopy(data, temp, sizeof(data)); 471d522f475Smrg bcopy(temp+10, temp, 15); 472d522f475Smrg bcopy(temp+5, temp+15, 10); 473d522f475Smrg ${cf_cv_main_return:-return} (strcmp(temp, "klmnopqrstuwwxypqrstuwwxyz")); 474d522f475Smrg} 475d522f475Smrg ], 476d522f475Smrg [cf_cv_good_bcopy=yes], 477d522f475Smrg [cf_cv_good_bcopy=no], 478d522f475Smrg [cf_cv_good_bcopy=unknown]) 479d522f475Smrg ]) 480d522f475Smrg ],[cf_cv_good_bcopy=no]) 481d522f475Smrg if test "$cf_cv_good_bcopy" = yes ; then 482d522f475Smrg AC_DEFINE(USE_OK_BCOPY) 483d522f475Smrg else 484d522f475Smrg AC_DEFINE(USE_MY_MEMMOVE) 485d522f475Smrg fi 486d522f475Smrg])])dnl 487d522f475Smrgdnl --------------------------------------------------------------------------- 48820d2c4d2Smrgdnl CF_FUNC_TGETENT version: 15 updated: 2010/06/04 20:54:56 489d522f475Smrgdnl --------------- 490d522f475Smrgdnl Check for tgetent function in termcap library. If we cannot find this, 491d522f475Smrgdnl we'll use the $LINES and $COLUMNS environment variables to pass screen 492d522f475Smrgdnl size information to subprocesses. (We cannot use terminfo's compatibility 493d522f475Smrgdnl function, since it cannot provide the termcap-format data). 494d522f475Smrgdnl 495d522f475Smrgdnl If the --disable-full-tgetent option is given, we'll settle for the first 496d522f475Smrgdnl tgetent function we find. Since the search list in that case does not 497d522f475Smrgdnl include the termcap library, that allows us to default to terminfo. 498d522f475SmrgAC_DEFUN([CF_FUNC_TGETENT], 499d522f475Smrg[ 500d522f475Smrg# compute a reasonable value for $TERM to give tgetent(), since we may be 501d522f475Smrg# running in 'screen', which sets $TERMCAP to a specific entry that is not 502d522f475Smrg# necessarily in /etc/termcap - unsetenv is not portable, so we cannot simply 503d522f475Smrg# discard $TERMCAP. 504d522f475Smrgcf_TERMVAR=vt100 505d522f475Smrgtest -n "$TERMCAP" && cf_TERMVAR="$TERM" 506d522f475Smrgtest -z "$cf_TERMVAR" && cf_TERMVAR=vt100 507d522f475Smrg 508d522f475SmrgAC_MSG_CHECKING(if we want full tgetent function) 509d522f475SmrgCF_ARG_DISABLE(full-tgetent, 510d522f475Smrg [ --disable-full-tgetent disable check for full tgetent function], 511d522f475Smrg cf_full_tgetent=no, 512d522f475Smrg cf_full_tgetent=yes,yes) 513d522f475SmrgAC_MSG_RESULT($cf_full_tgetent) 514d522f475Smrg 515d522f475Smrgif test "$cf_full_tgetent" = yes ; then 516d522f475Smrg cf_test_message="full tgetent" 517d522f475Smrgelse 518d522f475Smrg cf_test_message="tgetent" 519d522f475Smrgfi 520d522f475Smrg 521d522f475SmrgAC_CACHE_CHECK(for $cf_test_message function,cf_cv_lib_tgetent,[ 522d522f475Smrgcf_save_LIBS="$LIBS" 523d522f475Smrgcf_cv_lib_tgetent=no 524d522f475Smrgif test "$cf_full_tgetent" = yes ; then 525d522f475Smrg cf_TERMLIB="termcap termlib ncurses curses" 526d522f475Smrg cf_TERMTST="buffer[[0]] == 0" 527d522f475Smrgelse 528d522f475Smrg cf_TERMLIB="termlib ncurses curses" 529d522f475Smrg cf_TERMTST="0" 530d522f475Smrgfi 531d522f475Smrgfor cf_termlib in '' $cf_TERMLIB ; do 532d522f475Smrg LIBS="$cf_save_LIBS" 53320d2c4d2Smrg test -n "$cf_termlib" && CF_ADD_LIB($cf_termlib) 534d522f475Smrg AC_TRY_RUN([ 535d522f475Smrg/* terminfo implementations ignore the buffer argument, making it useless for 536d522f475Smrg * the xterm application, which uses this information to make a new TERMCAP 537d522f475Smrg * environment variable. 538d522f475Smrg */ 539d522f475Smrgint main() 540d522f475Smrg{ 541d522f475Smrg char buffer[1024]; 542d522f475Smrg buffer[0] = 0; 543d522f475Smrg tgetent(buffer, "$cf_TERMVAR"); 544d522f475Smrg ${cf_cv_main_return:-return} ($cf_TERMTST); }], 545d522f475Smrg [echo "yes, there is a termcap/tgetent in $cf_termlib" 1>&AC_FD_CC 546d522f475Smrg if test -n "$cf_termlib" ; then 547d522f475Smrg cf_cv_lib_tgetent="-l$cf_termlib" 548d522f475Smrg else 549d522f475Smrg cf_cv_lib_tgetent=yes 550d522f475Smrg fi 551d522f475Smrg break], 552d522f475Smrg [echo "no, there is no termcap/tgetent in $cf_termlib" 1>&AC_FD_CC], 553d522f475Smrg [echo "cross-compiling, cannot verify if a termcap/tgetent is present in $cf_termlib" 1>&AC_FD_CC]) 554d522f475Smrgdone 555d522f475SmrgLIBS="$cf_save_LIBS" 556d522f475Smrg]) 557d522f475Smrg 558d522f475Smrg# If we found a working tgetent(), set LIBS and check for termcap.h. 559d522f475Smrg# (LIBS cannot be set inside AC_CACHE_CHECK; the commands there should 560d522f475Smrg# not have side effects other than setting the cache variable, because 561d522f475Smrg# they are not executed when a cached value exists.) 562d522f475Smrgif test "$cf_cv_lib_tgetent" != no ; then 56320d2c4d2Smrg test "$cf_cv_lib_tgetent" != yes && CF_ADD_LIBS($cf_cv_lib_tgetent) 564d522f475Smrg AC_DEFINE(USE_TERMCAP) 56520d2c4d2Smrg if test "$cf_full_tgetent" = no ; then 56620d2c4d2Smrg AC_TRY_COMPILE([ 567d522f475Smrg#include <termcap.h>],[ 568d522f475Smrg#ifdef NCURSES_VERSION 569d522f475Smrgmake an error 570d522f475Smrg#endif],[AC_DEFINE(HAVE_TERMCAP_H)]) 57120d2c4d2Smrg else 57220d2c4d2Smrg AC_CHECK_HEADERS(termcap.h) 57320d2c4d2Smrg fi 574d522f475Smrgelse 575d522f475Smrg # If we didn't find a tgetent() that supports the buffer 576d522f475Smrg # argument, look again to see whether we can find even 577d522f475Smrg # a crippled one. A crippled tgetent() is still useful to 578d522f475Smrg # validate values for the TERM environment variable given to 579d522f475Smrg # child processes. 580d522f475Smrg AC_CACHE_CHECK(for partial tgetent function,cf_cv_lib_part_tgetent,[ 581d522f475Smrg cf_cv_lib_part_tgetent=no 582d522f475Smrg for cf_termlib in $cf_TERMLIB ; do 583d522f475Smrg LIBS="$cf_save_LIBS -l$cf_termlib" 584d522f475Smrg AC_TRY_LINK([],[tgetent(0, "$cf_TERMVAR")], 585d522f475Smrg [echo "there is a terminfo/tgetent in $cf_termlib" 1>&AC_FD_CC 586d522f475Smrg cf_cv_lib_part_tgetent="-l$cf_termlib" 587d522f475Smrg break]) 588d522f475Smrg done 589d522f475Smrg LIBS="$cf_save_LIBS" 590d522f475Smrg ]) 591d522f475Smrg 592d522f475Smrg if test "$cf_cv_lib_part_tgetent" != no ; then 59320d2c4d2Smrg CF_ADD_LIBS($cf_cv_lib_part_tgetent) 594d522f475Smrg AC_CHECK_HEADERS(termcap.h) 595d522f475Smrg 596d522f475Smrg # If this is linking against ncurses, we'll trigger the 597d522f475Smrg # ifdef in resize.c that turns the termcap stuff back off. 598d522f475Smrg AC_DEFINE(USE_TERMINFO) 599d522f475Smrg fi 600d522f475Smrgfi 601d522f475Smrg])dnl 602d522f475Smrgdnl --------------------------------------------------------------------------- 60320d2c4d2Smrgdnl CF_GCC_ATTRIBUTES version: 13 updated: 2009/08/11 20:19:56 604d522f475Smrgdnl ----------------- 605d522f475Smrgdnl Test for availability of useful gcc __attribute__ directives to quiet 606d522f475Smrgdnl compiler warnings. Though useful, not all are supported -- and contrary 607d522f475Smrgdnl to documentation, unrecognized directives cause older compilers to barf. 608d522f475SmrgAC_DEFUN([CF_GCC_ATTRIBUTES], 609d522f475Smrg[ 610d522f475Smrgif test "$GCC" = yes 611d522f475Smrgthen 612d522f475Smrgcat > conftest.i <<EOF 613d522f475Smrg#ifndef GCC_PRINTF 614d522f475Smrg#define GCC_PRINTF 0 615d522f475Smrg#endif 616d522f475Smrg#ifndef GCC_SCANF 617d522f475Smrg#define GCC_SCANF 0 618d522f475Smrg#endif 619d522f475Smrg#ifndef GCC_NORETURN 620d522f475Smrg#define GCC_NORETURN /* nothing */ 621d522f475Smrg#endif 622d522f475Smrg#ifndef GCC_UNUSED 623d522f475Smrg#define GCC_UNUSED /* nothing */ 624d522f475Smrg#endif 625d522f475SmrgEOF 626d522f475Smrgif test "$GCC" = yes 627d522f475Smrgthen 628d522f475Smrg AC_CHECKING([for $CC __attribute__ directives]) 629d522f475Smrgcat > conftest.$ac_ext <<EOF 630d522f475Smrg#line __oline__ "${as_me-configure}" 631d522f475Smrg#include "confdefs.h" 632d522f475Smrg#include "conftest.h" 633d522f475Smrg#include "conftest.i" 634d522f475Smrg#if GCC_PRINTF 635d522f475Smrg#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) 636d522f475Smrg#else 637d522f475Smrg#define GCC_PRINTFLIKE(fmt,var) /*nothing*/ 638d522f475Smrg#endif 639d522f475Smrg#if GCC_SCANF 640d522f475Smrg#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) 641d522f475Smrg#else 642d522f475Smrg#define GCC_SCANFLIKE(fmt,var) /*nothing*/ 643d522f475Smrg#endif 644d522f475Smrgextern void wow(char *,...) GCC_SCANFLIKE(1,2); 645d522f475Smrgextern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; 646d522f475Smrgextern void foo(void) GCC_NORETURN; 647d522f475Smrgint main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; } 648d522f475SmrgEOF 64920d2c4d2Smrg cf_printf_attribute=no 65020d2c4d2Smrg cf_scanf_attribute=no 651d522f475Smrg for cf_attribute in scanf printf unused noreturn 652d522f475Smrg do 653d522f475Smrg CF_UPPER(cf_ATTRIBUTE,$cf_attribute) 654d522f475Smrg cf_directive="__attribute__(($cf_attribute))" 655d522f475Smrg echo "checking for $CC $cf_directive" 1>&AC_FD_CC 65620d2c4d2Smrg 65720d2c4d2Smrg case $cf_attribute in #(vi 65820d2c4d2Smrg printf) #(vi 65920d2c4d2Smrg cf_printf_attribute=yes 66020d2c4d2Smrg cat >conftest.h <<EOF 661d522f475Smrg#define GCC_$cf_ATTRIBUTE 1 662d522f475SmrgEOF 663d522f475Smrg ;; 66420d2c4d2Smrg scanf) #(vi 66520d2c4d2Smrg cf_scanf_attribute=yes 66620d2c4d2Smrg cat >conftest.h <<EOF 66720d2c4d2Smrg#define GCC_$cf_ATTRIBUTE 1 66820d2c4d2SmrgEOF 66920d2c4d2Smrg ;; 67020d2c4d2Smrg *) #(vi 67120d2c4d2Smrg cat >conftest.h <<EOF 672d522f475Smrg#define GCC_$cf_ATTRIBUTE $cf_directive 673d522f475SmrgEOF 674d522f475Smrg ;; 675d522f475Smrg esac 67620d2c4d2Smrg 677d522f475Smrg if AC_TRY_EVAL(ac_compile); then 678d522f475Smrg test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute) 679d522f475Smrg cat conftest.h >>confdefs.h 68020d2c4d2Smrg case $cf_attribute in #(vi 68120d2c4d2Smrg printf) #(vi 68220d2c4d2Smrg if test "$cf_printf_attribute" = no ; then 68320d2c4d2Smrg cat >>confdefs.h <<EOF 68420d2c4d2Smrg#define GCC_PRINTFLIKE(fmt,var) /* nothing */ 68520d2c4d2SmrgEOF 68620d2c4d2Smrg else 68720d2c4d2Smrg cat >>confdefs.h <<EOF 68820d2c4d2Smrg#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) 68920d2c4d2SmrgEOF 69020d2c4d2Smrg fi 69120d2c4d2Smrg ;; 69220d2c4d2Smrg scanf) #(vi 69320d2c4d2Smrg if test "$cf_scanf_attribute" = no ; then 69420d2c4d2Smrg cat >>confdefs.h <<EOF 69520d2c4d2Smrg#define GCC_SCANFLIKE(fmt,var) /* nothing */ 69620d2c4d2SmrgEOF 69720d2c4d2Smrg else 69820d2c4d2Smrg cat >>confdefs.h <<EOF 69920d2c4d2Smrg#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) 70020d2c4d2SmrgEOF 70120d2c4d2Smrg fi 70220d2c4d2Smrg ;; 70320d2c4d2Smrg esac 704d522f475Smrg fi 705d522f475Smrg done 706d522f475Smrgelse 707d522f475Smrg fgrep define conftest.i >>confdefs.h 708d522f475Smrgfi 709d522f475Smrgrm -rf conftest* 710d522f475Smrgfi 711d522f475Smrg])dnl 712d522f475Smrgdnl --------------------------------------------------------------------------- 71320d2c4d2Smrgdnl CF_GCC_VERSION version: 5 updated: 2010/04/24 11:02:31 714d522f475Smrgdnl -------------- 715d522f475Smrgdnl Find version of gcc 716d522f475SmrgAC_DEFUN([CF_GCC_VERSION],[ 717d522f475SmrgAC_REQUIRE([AC_PROG_CC]) 718d522f475SmrgGCC_VERSION=none 719d522f475Smrgif test "$GCC" = yes ; then 720d522f475Smrg AC_MSG_CHECKING(version of $CC) 72120d2c4d2Smrg GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`" 722d522f475Smrg test -z "$GCC_VERSION" && GCC_VERSION=unknown 723d522f475Smrg AC_MSG_RESULT($GCC_VERSION) 724d522f475Smrgfi 725d522f475Smrg])dnl 726d522f475Smrgdnl --------------------------------------------------------------------------- 72720d2c4d2Smrgdnl CF_GCC_WARNINGS version: 25 updated: 2010/04/24 11:03:31 728d522f475Smrgdnl --------------- 729d522f475Smrgdnl Check if the compiler supports useful warning options. There's a few that 730d522f475Smrgdnl we don't use, simply because they're too noisy: 731d522f475Smrgdnl 732d522f475Smrgdnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x) 733d522f475Smrgdnl -Wredundant-decls (system headers make this too noisy) 734d522f475Smrgdnl -Wtraditional (combines too many unrelated messages, only a few useful) 735d522f475Smrgdnl -Wwrite-strings (too noisy, but should review occasionally). This 736d522f475Smrgdnl is enabled for ncurses using "--enable-const". 737d522f475Smrgdnl -pedantic 738d522f475Smrgdnl 739d522f475Smrgdnl Parameter: 740d522f475Smrgdnl $1 is an optional list of gcc warning flags that a particular 741d522f475Smrgdnl application might want to use, e.g., "no-unused" for 742d522f475Smrgdnl -Wno-unused 743d522f475Smrgdnl Special: 744d522f475Smrgdnl If $with_ext_const is "yes", add a check for -Wwrite-strings 745d522f475Smrgdnl 746d522f475SmrgAC_DEFUN([CF_GCC_WARNINGS], 747d522f475Smrg[ 748d522f475SmrgAC_REQUIRE([CF_GCC_VERSION]) 749d522f475SmrgCF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS) 750d522f475Smrg 751d522f475Smrgcat > conftest.$ac_ext <<EOF 752d522f475Smrg#line __oline__ "${as_me-configure}" 753d522f475Smrgint main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; } 754d522f475SmrgEOF 755d522f475Smrg 756d522f475Smrgif test "$INTEL_COMPILER" = yes 757d522f475Smrgthen 758d522f475Smrg# The "-wdXXX" options suppress warnings: 759d522f475Smrg# remark #1419: external declaration in primary source file 760d522f475Smrg# remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem) 761d522f475Smrg# remark #1684: conversion from pointer to same-sized integral type (potential portability problem) 762d522f475Smrg# remark #193: zero used for undefined preprocessing identifier 763d522f475Smrg# remark #593: variable "curs_sb_left_arrow" was set but never used 764d522f475Smrg# remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits 765d522f475Smrg# remark #869: parameter "tw" was never referenced 766d522f475Smrg# remark #981: operands are evaluated in unspecified order 767956cc18dSsnj# warning #279: controlling expression is constant 768d522f475Smrg 769d522f475Smrg AC_CHECKING([for $CC warning options]) 770d522f475Smrg cf_save_CFLAGS="$CFLAGS" 771d522f475Smrg EXTRA_CFLAGS="-Wall" 772d522f475Smrg for cf_opt in \ 773d522f475Smrg wd1419 \ 774d522f475Smrg wd1683 \ 775d522f475Smrg wd1684 \ 776d522f475Smrg wd193 \ 777d522f475Smrg wd593 \ 778956cc18dSsnj wd279 \ 779d522f475Smrg wd810 \ 780d522f475Smrg wd869 \ 781d522f475Smrg wd981 782d522f475Smrg do 783d522f475Smrg CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" 784d522f475Smrg if AC_TRY_EVAL(ac_compile); then 785d522f475Smrg test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt) 786d522f475Smrg EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" 787d522f475Smrg fi 788d522f475Smrg done 789d522f475Smrg CFLAGS="$cf_save_CFLAGS" 790d522f475Smrg 791d522f475Smrgelif test "$GCC" = yes 792d522f475Smrgthen 793d522f475Smrg AC_CHECKING([for $CC warning options]) 794d522f475Smrg cf_save_CFLAGS="$CFLAGS" 79520d2c4d2Smrg EXTRA_CFLAGS= 796d522f475Smrg cf_warn_CONST="" 797d522f475Smrg test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings" 79820d2c4d2Smrg for cf_opt in W Wall \ 799d522f475Smrg Wbad-function-cast \ 800d522f475Smrg Wcast-align \ 801d522f475Smrg Wcast-qual \ 802d522f475Smrg Winline \ 803d522f475Smrg Wmissing-declarations \ 804d522f475Smrg Wmissing-prototypes \ 805d522f475Smrg Wnested-externs \ 806d522f475Smrg Wpointer-arith \ 807d522f475Smrg Wshadow \ 808d522f475Smrg Wstrict-prototypes \ 809d522f475Smrg Wundef $cf_warn_CONST $1 810d522f475Smrg do 811d522f475Smrg CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" 812d522f475Smrg if AC_TRY_EVAL(ac_compile); then 813d522f475Smrg test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt) 814d522f475Smrg case $cf_opt in #(vi 815d522f475Smrg Wcast-qual) #(vi 816d522f475Smrg CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES" 817d522f475Smrg ;; 818d522f475Smrg Winline) #(vi 819d522f475Smrg case $GCC_VERSION in 8202eaa94a1Schristos [[34]].*) 821d522f475Smrg CF_VERBOSE(feature is broken in gcc $GCC_VERSION) 822d522f475Smrg continue;; 823d522f475Smrg esac 824d522f475Smrg ;; 825d522f475Smrg esac 826d522f475Smrg EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" 827d522f475Smrg fi 828d522f475Smrg done 829d522f475Smrg CFLAGS="$cf_save_CFLAGS" 830d522f475Smrgfi 831d522f475Smrgrm -f conftest* 832d522f475Smrg 833d522f475SmrgAC_SUBST(EXTRA_CFLAGS) 834d522f475Smrg])dnl 835d522f475Smrgdnl --------------------------------------------------------------------------- 836d522f475Smrgdnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07 837d522f475Smrgdnl ------------- 838d522f475Smrgdnl Check if we must define _GNU_SOURCE to get a reasonable value for 839d522f475Smrgdnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect 840d522f475Smrgdnl (or misfeature) of glibc2, which breaks portability of many applications, 841d522f475Smrgdnl since it is interwoven with GNU extensions. 842d522f475Smrgdnl 843d522f475Smrgdnl Well, yes we could work around it... 844d522f475SmrgAC_DEFUN([CF_GNU_SOURCE], 845d522f475Smrg[ 846d522f475SmrgAC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[ 847d522f475SmrgAC_TRY_COMPILE([#include <sys/types.h>],[ 848d522f475Smrg#ifndef _XOPEN_SOURCE 849d522f475Smrgmake an error 850d522f475Smrg#endif], 851d522f475Smrg [cf_cv_gnu_source=no], 852d522f475Smrg [cf_save="$CPPFLAGS" 853d522f475Smrg CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" 854d522f475Smrg AC_TRY_COMPILE([#include <sys/types.h>],[ 855d522f475Smrg#ifdef _XOPEN_SOURCE 856d522f475Smrgmake an error 857d522f475Smrg#endif], 858d522f475Smrg [cf_cv_gnu_source=no], 859d522f475Smrg [cf_cv_gnu_source=yes]) 860d522f475Smrg CPPFLAGS="$cf_save" 861d522f475Smrg ]) 862d522f475Smrg]) 863d522f475Smrgtest "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" 864d522f475Smrg])dnl 865d522f475Smrgdnl --------------------------------------------------------------------------- 866d522f475Smrgdnl CF_HELP_MESSAGE version: 3 updated: 1998/01/14 10:56:23 867d522f475Smrgdnl --------------- 868d522f475Smrgdnl Insert text into the help-message, for readability, from AC_ARG_WITH. 869d522f475SmrgAC_DEFUN([CF_HELP_MESSAGE], 870d522f475Smrg[AC_DIVERT_HELP([$1])dnl 871d522f475Smrg])dnl 872d522f475Smrgdnl --------------------------------------------------------------------------- 87320d2c4d2Smrgdnl CF_IMAKE_CFLAGS version: 31 updated: 2010/05/26 05:38:42 874d522f475Smrgdnl --------------- 875d522f475Smrgdnl Use imake to obtain compiler flags. We could, in principle, write tests to 876d522f475Smrgdnl get these, but if imake is properly configured there is no point in doing 877d522f475Smrgdnl this. 878d522f475Smrgdnl 879d522f475Smrgdnl Parameters (used in constructing a sample Imakefile): 880d522f475Smrgdnl $1 = optional value to append to $IMAKE_CFLAGS 881d522f475Smrgdnl $2 = optional value to append to $IMAKE_LOADFLAGS 882d522f475SmrgAC_DEFUN([CF_IMAKE_CFLAGS], 883d522f475Smrg[ 884d522f475SmrgAC_PATH_PROGS(IMAKE,xmkmf imake) 885d522f475Smrg 886d522f475Smrgif test -n "$IMAKE" ; then 887d522f475Smrg 888d522f475Smrgcase $IMAKE in # (vi 889d522f475Smrg*/imake) 890d522f475Smrg cf_imake_opts="-DUseInstalled=YES" # (vi 891d522f475Smrg ;; 892d522f475Smrg*/util/xmkmf) 893d522f475Smrg # A single parameter tells xmkmf where the config-files are: 894d522f475Smrg cf_imake_opts="`echo $IMAKE|sed -e s,/config/util/xmkmf,,`" # (vi 895d522f475Smrg ;; 896d522f475Smrg*) 897d522f475Smrg cf_imake_opts= 898d522f475Smrg ;; 899d522f475Smrgesac 900d522f475Smrg 901d522f475Smrg# If it's installed properly, imake (or its wrapper, xmkmf) will point to the 902d522f475Smrg# config directory. 903d522f475Smrgif mkdir conftestdir; then 904d522f475Smrg CDPATH=; export CDPATH 905d522f475Smrg cf_makefile=`cd $srcdir;pwd`/Imakefile 906d522f475Smrg cd conftestdir 907d522f475Smrg 908d522f475Smrg cat >fix_cflags.sed <<'CF_EOF' 909d522f475Smrgs/\\//g 910d522f475Smrgs/[[ ]][[ ]]*/ /g 911d522f475Smrgs/"//g 912d522f475Smrg:pack 913d522f475Smrgs/\(=[[^ ]][[^ ]]*\) \([[^-]]\)/\1 \2/g 914d522f475Smrgt pack 915d522f475Smrgs/\(-D[[a-zA-Z0-9_]][[a-zA-Z0-9_]]*\)=\([[^\'0-9 ]][[^ ]]*\)/\1='\\"\2\\"'/g 916d522f475Smrgs/^IMAKE[[ ]]/IMAKE_CFLAGS="/ 917d522f475Smrgs/ / /g 918d522f475Smrgs/$/"/ 919d522f475SmrgCF_EOF 920d522f475Smrg 921d522f475Smrg cat >fix_lflags.sed <<'CF_EOF' 922d522f475Smrgs/^IMAKE[[ ]]*/IMAKE_LOADFLAGS="/ 923d522f475Smrgs/$/"/ 924d522f475SmrgCF_EOF 925d522f475Smrg 926d522f475Smrg echo >./Imakefile 927d522f475Smrg test -f $cf_makefile && cat $cf_makefile >>./Imakefile 928d522f475Smrg 929d522f475Smrg cat >> ./Imakefile <<'CF_EOF' 930d522f475Smrgfindstddefs: 93120d2c4d2Smrg @echo IMAKE ${ALLDEFINES}ifelse([$1],,,[ $1]) | sed -f fix_cflags.sed 93220d2c4d2Smrg @echo IMAKE ${EXTRA_LOAD_FLAGS}ifelse([$2],,,[ $2]) | sed -f fix_lflags.sed 933d522f475SmrgCF_EOF 934d522f475Smrg 935d522f475Smrg if ( $IMAKE $cf_imake_opts 1>/dev/null 2>&AC_FD_CC && test -f Makefile) 936d522f475Smrg then 937d522f475Smrg CF_VERBOSE(Using $IMAKE $cf_imake_opts) 938d522f475Smrg else 939d522f475Smrg # sometimes imake doesn't have the config path compiled in. Find it. 940d522f475Smrg cf_config= 941d522f475Smrg for cf_libpath in $X_LIBS $LIBS ; do 942d522f475Smrg case $cf_libpath in # (vi 943d522f475Smrg -L*) 944d522f475Smrg cf_libpath=`echo .$cf_libpath | sed -e 's/^...//'` 945d522f475Smrg cf_libpath=$cf_libpath/X11/config 946d522f475Smrg if test -d $cf_libpath ; then 947d522f475Smrg cf_config=$cf_libpath 948d522f475Smrg break 949d522f475Smrg fi 950d522f475Smrg ;; 951d522f475Smrg esac 952d522f475Smrg done 953d522f475Smrg if test -z "$cf_config" ; then 954d522f475Smrg AC_MSG_WARN(Could not find imake config-directory) 955d522f475Smrg else 956d522f475Smrg cf_imake_opts="$cf_imake_opts -I$cf_config" 957d522f475Smrg if ( $IMAKE -v $cf_imake_opts 2>&AC_FD_CC) 958d522f475Smrg then 959d522f475Smrg CF_VERBOSE(Using $IMAKE $cf_config) 960d522f475Smrg else 961d522f475Smrg AC_MSG_WARN(Cannot run $IMAKE) 962d522f475Smrg fi 963d522f475Smrg fi 964d522f475Smrg fi 965d522f475Smrg 966d522f475Smrg # GNU make sometimes prints "make[1]: Entering...", which 967d522f475Smrg # would confuse us. 968d522f475Smrg eval `make findstddefs 2>/dev/null | grep -v make` 969d522f475Smrg 970d522f475Smrg cd .. 971d522f475Smrg rm -rf conftestdir 972d522f475Smrg 973d522f475Smrg # We use ${ALLDEFINES} rather than ${STD_DEFINES} because the former 974d522f475Smrg # declares XTFUNCPROTO there. However, some vendors (e.g., SGI) have 975d522f475Smrg # modified it to support site.cf, adding a kludge for the /usr/include 976d522f475Smrg # directory. Try to filter that out, otherwise gcc won't find its 977d522f475Smrg # headers. 978d522f475Smrg if test -n "$GCC" ; then 979d522f475Smrg if test -n "$IMAKE_CFLAGS" ; then 980d522f475Smrg cf_nostdinc="" 981d522f475Smrg cf_std_incl="" 982d522f475Smrg cf_cpp_opts="" 983d522f475Smrg for cf_opt in $IMAKE_CFLAGS 984d522f475Smrg do 985d522f475Smrg case "$cf_opt" in 986d522f475Smrg -nostdinc) #(vi 987d522f475Smrg cf_nostdinc="$cf_opt" 988d522f475Smrg ;; 989d522f475Smrg -I/usr/include) #(vi 990d522f475Smrg cf_std_incl="$cf_opt" 991d522f475Smrg ;; 992d522f475Smrg *) #(vi 993d522f475Smrg cf_cpp_opts="$cf_cpp_opts $cf_opt" 994d522f475Smrg ;; 995d522f475Smrg esac 996d522f475Smrg done 997d522f475Smrg if test -z "$cf_nostdinc" ; then 998d522f475Smrg IMAKE_CFLAGS="$cf_cpp_opts $cf_std_incl" 999d522f475Smrg elif test -z "$cf_std_incl" ; then 1000d522f475Smrg IMAKE_CFLAGS="$cf_cpp_opts $cf_nostdinc" 1001d522f475Smrg else 1002d522f475Smrg CF_VERBOSE(suppressed \"$cf_nostdinc\" and \"$cf_std_incl\") 1003d522f475Smrg IMAKE_CFLAGS="$cf_cpp_opts" 1004d522f475Smrg fi 1005d522f475Smrg fi 1006d522f475Smrg fi 1007d522f475Smrgfi 1008d522f475Smrg 1009d522f475Smrg# Some imake configurations define PROJECTROOT with an empty value. Remove 1010d522f475Smrg# the empty definition. 1011d522f475Smrgcase $IMAKE_CFLAGS in 1012d522f475Smrg*-DPROJECTROOT=/*) 1013d522f475Smrg ;; 1014d522f475Smrg*) 1015d522f475Smrg IMAKE_CFLAGS=`echo "$IMAKE_CFLAGS" |sed -e "s,-DPROJECTROOT=[[ ]], ,"` 1016d522f475Smrg ;; 1017d522f475Smrgesac 1018d522f475Smrg 1019d522f475Smrgfi 1020d522f475Smrg 1021d522f475SmrgCF_VERBOSE(IMAKE_CFLAGS $IMAKE_CFLAGS) 1022d522f475SmrgCF_VERBOSE(IMAKE_LOADFLAGS $IMAKE_LOADFLAGS) 1023d522f475Smrg 1024d522f475SmrgAC_SUBST(IMAKE_CFLAGS) 1025d522f475SmrgAC_SUBST(IMAKE_LOADFLAGS) 1026d522f475Smrg])dnl 1027d522f475Smrgdnl --------------------------------------------------------------------------- 1028d522f475Smrgdnl CF_INPUT_METHOD version: 3 updated: 2000/04/11 23:46:57 1029d522f475Smrgdnl --------------- 1030d522f475Smrgdnl Check if the X libraries support input-method 1031d522f475SmrgAC_DEFUN([CF_INPUT_METHOD], 1032d522f475Smrg[ 1033d522f475SmrgAC_CACHE_CHECK([if X libraries support input-method],cf_cv_input_method,[ 1034d522f475SmrgAC_TRY_LINK([ 1035d522f475Smrg#include <X11/IntrinsicP.h> 1036d522f475Smrg#include <X11/Xatom.h> 1037d522f475Smrg#include <X11/Xutil.h> 1038d522f475Smrg#include <X11/Xmu/Atoms.h> 1039d522f475Smrg#include <X11/Xmu/Converters.h> 1040d522f475Smrg#include <X11/Xaw/XawImP.h> 1041d522f475Smrg],[ 1042d522f475Smrg{ 1043d522f475Smrg XIM xim; 1044d522f475Smrg XIMStyles *xim_styles = 0; 1045d522f475Smrg XIMStyle input_style; 1046d522f475Smrg Widget w = 0; 1047d522f475Smrg 1048d522f475Smrg XSetLocaleModifiers("@im=none"); 1049d522f475Smrg xim = XOpenIM(XtDisplay(w), NULL, NULL, NULL); 1050d522f475Smrg XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL); 1051d522f475Smrg XCloseIM(xim); 1052d522f475Smrg input_style = (XIMPreeditNothing | XIMStatusNothing); 1053d522f475Smrg} 1054d522f475Smrg], 1055d522f475Smrg[cf_cv_input_method=yes], 1056d522f475Smrg[cf_cv_input_method=no])]) 1057d522f475Smrg])dnl 1058d522f475Smrgdnl --------------------------------------------------------------------------- 105920d2c4d2Smrgdnl CF_INTEL_COMPILER version: 4 updated: 2010/05/26 05:38:42 1060d522f475Smrgdnl ----------------- 1061d522f475Smrgdnl Check if the given compiler is really the Intel compiler for Linux. It 1062d522f475Smrgdnl tries to imitate gcc, but does not return an error when it finds a mismatch 1063d522f475Smrgdnl between prototypes, e.g., as exercised by CF_MISSING_CHECK. 1064d522f475Smrgdnl 1065d522f475Smrgdnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to 1066d522f475Smrgdnl ensure that it is not mistaken for gcc/g++. It is normally invoked from 1067d522f475Smrgdnl the wrappers for gcc and g++ warnings. 1068d522f475Smrgdnl 1069d522f475Smrgdnl $1 = GCC (default) or GXX 1070d522f475Smrgdnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS 1071d522f475Smrgdnl $3 = CFLAGS (default) or CXXFLAGS 1072d522f475SmrgAC_DEFUN([CF_INTEL_COMPILER],[ 107320d2c4d2Smrgifelse([$2],,INTEL_COMPILER,[$2])=no 1074d522f475Smrg 107520d2c4d2Smrgif test "$ifelse([$1],,[$1],GCC)" = yes ; then 1076d522f475Smrg case $host_os in 1077d522f475Smrg linux*|gnu*) 107820d2c4d2Smrg AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler) 107920d2c4d2Smrg cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" 108020d2c4d2Smrg ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc" 1081d522f475Smrg AC_TRY_COMPILE([],[ 1082d522f475Smrg#ifdef __INTEL_COMPILER 1083d522f475Smrg#else 1084d522f475Smrgmake an error 1085d522f475Smrg#endif 108620d2c4d2Smrg],[ifelse([$2],,INTEL_COMPILER,[$2])=yes 1087d522f475Smrgcf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc" 1088d522f475Smrg],[]) 108920d2c4d2Smrg ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" 109020d2c4d2Smrg AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2])) 1091d522f475Smrg ;; 1092d522f475Smrg esac 1093d522f475Smrgfi 1094d522f475Smrg])dnl 1095d522f475Smrgdnl --------------------------------------------------------------------------- 1096d522f475Smrgdnl CF_LASTLOG version: 4 updated: 2002/10/27 23:21:42 1097d522f475Smrgdnl ---------- 1098d522f475Smrgdnl Check for header defining _PATH_LASTLOG, or failing that, see if the lastlog 1099d522f475Smrgdnl file exists. 1100d522f475SmrgAC_DEFUN([CF_LASTLOG], 1101d522f475Smrg[ 1102d522f475SmrgAC_CHECK_HEADERS(lastlog.h paths.h) 1103d522f475SmrgAC_CACHE_CHECK(for lastlog path,cf_cv_path_lastlog,[ 1104d522f475SmrgAC_TRY_COMPILE([ 1105d522f475Smrg#include <sys/types.h> 1106d522f475Smrg#ifdef HAVE_LASTLOG_H 1107d522f475Smrg#include <lastlog.h> 1108d522f475Smrg#else 1109d522f475Smrg#ifdef HAVE_PATHS_H 1110d522f475Smrg#include <paths.h> 1111d522f475Smrg#endif 1112d522f475Smrg#endif],[char *path = _PATH_LASTLOG], 1113d522f475Smrg [cf_cv_path_lastlog="_PATH_LASTLOG"], 1114d522f475Smrg [if test -f /usr/adm/lastlog ; then 1115d522f475Smrg cf_cv_path_lastlog=/usr/adm/lastlog 1116d522f475Smrg else 1117d522f475Smrg cf_cv_path_lastlog=no 1118d522f475Smrg fi]) 1119d522f475Smrg]) 1120d522f475Smrgtest $cf_cv_path_lastlog != no && AC_DEFINE(USE_LASTLOG) 1121d522f475Smrg])dnl 1122d522f475Smrgdnl --------------------------------------------------------------------------- 112320d2c4d2Smrgdnl CF_LD_RPATH_OPT version: 3 updated: 2010/06/02 05:03:05 112420d2c4d2Smrgdnl --------------- 112520d2c4d2Smrgdnl For the given system and compiler, find the compiler flags to pass to the 112620d2c4d2Smrgdnl loader to use the "rpath" feature. 112720d2c4d2SmrgAC_DEFUN([CF_LD_RPATH_OPT], 112820d2c4d2Smrg[ 112920d2c4d2SmrgAC_REQUIRE([CF_CHECK_CACHE]) 113020d2c4d2Smrg 113120d2c4d2SmrgLD_RPATH_OPT= 113220d2c4d2SmrgAC_MSG_CHECKING(for an rpath option) 113320d2c4d2Smrgcase $cf_cv_system_name in #(vi 113420d2c4d2Smrgirix*) #(vi 113520d2c4d2Smrg if test "$GCC" = yes; then 113620d2c4d2Smrg LD_RPATH_OPT="-Wl,-rpath," 113720d2c4d2Smrg else 113820d2c4d2Smrg LD_RPATH_OPT="-rpath " 113920d2c4d2Smrg fi 114020d2c4d2Smrg ;; 114120d2c4d2Smrglinux*|gnu*|k*bsd*-gnu) #(vi 114220d2c4d2Smrg LD_RPATH_OPT="-Wl,-rpath," 114320d2c4d2Smrg ;; 114420d2c4d2Smrgopenbsd[[2-9]].*) #(vi 114520d2c4d2Smrg LD_RPATH_OPT="-Wl,-rpath," 114620d2c4d2Smrg ;; 114720d2c4d2Smrgfreebsd*) #(vi 114820d2c4d2Smrg LD_RPATH_OPT="-rpath " 114920d2c4d2Smrg ;; 115020d2c4d2Smrgnetbsd*) #(vi 115120d2c4d2Smrg LD_RPATH_OPT="-Wl,-rpath," 115220d2c4d2Smrg ;; 115320d2c4d2Smrgosf*|mls+*) #(vi 115420d2c4d2Smrg LD_RPATH_OPT="-rpath " 115520d2c4d2Smrg ;; 115620d2c4d2Smrgsolaris2*) #(vi 115720d2c4d2Smrg LD_RPATH_OPT="-R" 115820d2c4d2Smrg ;; 115920d2c4d2Smrg*) 116020d2c4d2Smrg ;; 116120d2c4d2Smrgesac 116220d2c4d2SmrgAC_MSG_RESULT($LD_RPATH_OPT) 116320d2c4d2Smrg 116420d2c4d2Smrgcase "x$LD_RPATH_OPT" in #(vi 116520d2c4d2Smrgx-R*) 116620d2c4d2Smrg AC_MSG_CHECKING(if we need a space after rpath option) 116720d2c4d2Smrg cf_save_LIBS="$LIBS" 116820d2c4d2Smrg CF_ADD_LIBS(${LD_RPATH_OPT}$libdir) 116920d2c4d2Smrg AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes) 117020d2c4d2Smrg LIBS="$cf_save_LIBS" 117120d2c4d2Smrg AC_MSG_RESULT($cf_rpath_space) 117220d2c4d2Smrg test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT " 117320d2c4d2Smrg ;; 117420d2c4d2Smrgesac 117520d2c4d2Smrg])dnl 117620d2c4d2Smrgdnl --------------------------------------------------------------------------- 117720d2c4d2Smrgdnl CF_MAKE_TAGS version: 5 updated: 2010/04/03 20:07:32 117820d2c4d2Smrgdnl ------------ 117920d2c4d2Smrgdnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have 118020d2c4d2Smrgdnl a monocase filesystem. 118120d2c4d2SmrgAC_DEFUN([CF_MAKE_TAGS],[ 118220d2c4d2SmrgAC_REQUIRE([CF_MIXEDCASE_FILENAMES]) 118320d2c4d2Smrg 118420d2c4d2SmrgAC_CHECK_PROGS(CTAGS, exctags ctags) 118520d2c4d2SmrgAC_CHECK_PROGS(ETAGS, exetags etags) 118620d2c4d2Smrg 118720d2c4d2SmrgAC_CHECK_PROG(MAKE_LOWER_TAGS, ${CTAGS-ctags}, yes, no) 118820d2c4d2Smrg 118920d2c4d2Smrgif test "$cf_cv_mixedcase" = yes ; then 119020d2c4d2Smrg AC_CHECK_PROG(MAKE_UPPER_TAGS, ${ETAGS-etags}, yes, no) 119120d2c4d2Smrgelse 119220d2c4d2Smrg MAKE_UPPER_TAGS=no 119320d2c4d2Smrgfi 119420d2c4d2Smrg 119520d2c4d2Smrgif test "$MAKE_UPPER_TAGS" = yes ; then 119620d2c4d2Smrg MAKE_UPPER_TAGS= 119720d2c4d2Smrgelse 119820d2c4d2Smrg MAKE_UPPER_TAGS="#" 119920d2c4d2Smrgfi 120020d2c4d2Smrg 120120d2c4d2Smrgif test "$MAKE_LOWER_TAGS" = yes ; then 120220d2c4d2Smrg MAKE_LOWER_TAGS= 120320d2c4d2Smrgelse 120420d2c4d2Smrg MAKE_LOWER_TAGS="#" 120520d2c4d2Smrgfi 120620d2c4d2Smrg 120720d2c4d2SmrgAC_SUBST(CTAGS) 120820d2c4d2SmrgAC_SUBST(ETAGS) 120920d2c4d2Smrg 121020d2c4d2SmrgAC_SUBST(MAKE_UPPER_TAGS) 121120d2c4d2SmrgAC_SUBST(MAKE_LOWER_TAGS) 121220d2c4d2Smrg])dnl 121320d2c4d2Smrgdnl --------------------------------------------------------------------------- 121420d2c4d2Smrgdnl CF_MIXEDCASE_FILENAMES version: 3 updated: 2003/09/20 17:07:55 121520d2c4d2Smrgdnl ---------------------- 121620d2c4d2Smrgdnl Check if the file-system supports mixed-case filenames. If we're able to 121720d2c4d2Smrgdnl create a lowercase name and see it as uppercase, it doesn't support that. 121820d2c4d2SmrgAC_DEFUN([CF_MIXEDCASE_FILENAMES], 121920d2c4d2Smrg[ 122020d2c4d2SmrgAC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[ 122120d2c4d2Smrgif test "$cross_compiling" = yes ; then 122220d2c4d2Smrg case $target_alias in #(vi 122320d2c4d2Smrg *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-mingw32*|*-uwin*) #(vi 122420d2c4d2Smrg cf_cv_mixedcase=no 122520d2c4d2Smrg ;; 122620d2c4d2Smrg *) 122720d2c4d2Smrg cf_cv_mixedcase=yes 122820d2c4d2Smrg ;; 122920d2c4d2Smrg esac 123020d2c4d2Smrgelse 123120d2c4d2Smrg rm -f conftest CONFTEST 123220d2c4d2Smrg echo test >conftest 123320d2c4d2Smrg if test -f CONFTEST ; then 123420d2c4d2Smrg cf_cv_mixedcase=no 123520d2c4d2Smrg else 123620d2c4d2Smrg cf_cv_mixedcase=yes 123720d2c4d2Smrg fi 123820d2c4d2Smrg rm -f conftest CONFTEST 123920d2c4d2Smrgfi 124020d2c4d2Smrg]) 124120d2c4d2Smrgtest "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES) 124220d2c4d2Smrg])dnl 124320d2c4d2Smrgdnl --------------------------------------------------------------------------- 1244d522f475Smrgdnl CF_MSG_LOG version: 4 updated: 2007/07/29 09:55:12 1245d522f475Smrgdnl ---------- 1246d522f475Smrgdnl Write a debug message to config.log, along with the line number in the 1247d522f475Smrgdnl configure script. 1248d522f475SmrgAC_DEFUN([CF_MSG_LOG],[ 1249d522f475Smrgecho "${as_me-configure}:__oline__: testing $* ..." 1>&AC_FD_CC 1250d522f475Smrg])dnl 1251d522f475Smrgdnl --------------------------------------------------------------------------- 125220d2c4d2Smrgdnl CF_PATHSEP version: 5 updated: 2010/05/26 05:38:42 1253956cc18dSsnjdnl ---------- 1254956cc18dSsnjdnl Provide a value for the $PATH and similar separator 1255956cc18dSsnjAC_DEFUN([CF_PATHSEP], 1256956cc18dSsnj[ 1257956cc18dSsnj case $cf_cv_system_name in 1258956cc18dSsnj os2*) PATH_SEPARATOR=';' ;; 1259956cc18dSsnj *) PATH_SEPARATOR=':' ;; 1260956cc18dSsnj esac 126120d2c4d2Smrgifelse([$1],,,[$1=$PATH_SEPARATOR]) 1262956cc18dSsnj AC_SUBST(PATH_SEPARATOR) 1263956cc18dSsnj])dnl 1264956cc18dSsnjdnl --------------------------------------------------------------------------- 1265956cc18dSsnjdnl CF_PATH_PROG version: 7 updated: 2009/01/11 20:34:16 1266d522f475Smrgdnl ------------ 1267d522f475Smrgdnl Check for a given program, defining corresponding symbol. 1268d522f475Smrgdnl $1 = environment variable, which is suffixed by "_PATH" in the #define. 1269d522f475Smrgdnl $2 = program name to find. 1270d522f475Smrgdnl $3 = optional list of additional program names to test. 1271d522f475Smrgdnl 1272d522f475Smrgdnl If there is more than one token in the result, #define the remaining tokens 1273d522f475Smrgdnl to $1_ARGS. We need this for 'install' in particular. 1274d522f475Smrgdnl 1275d522f475Smrgdnl FIXME: we should allow this to be overridden by environment variables 1276d522f475Smrgdnl 1277d522f475SmrgAC_DEFUN([CF_PATH_PROG],[ 1278956cc18dSsnjAC_REQUIRE([CF_PATHSEP]) 1279d522f475Smrgtest -z "[$]$1" && $1=$2 1280d522f475SmrgAC_PATH_PROGS($1,[$]$1 $2 $3,[$]$1) 1281d522f475Smrg 1282d522f475Smrgcf_path_prog="" 1283d522f475Smrgcf_path_args="" 1284956cc18dSsnjIFS="${IFS= }"; cf_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR" 1285d522f475Smrgfor cf_temp in $ac_cv_path_$1 1286d522f475Smrgdo 1287d522f475Smrg if test -z "$cf_path_prog" ; then 1288d522f475Smrg if test "$with_full_paths" = yes ; then 1289d522f475Smrg CF_PATH_SYNTAX(cf_temp,break) 1290d522f475Smrg cf_path_prog="$cf_temp" 1291d522f475Smrg else 1292d522f475Smrg cf_path_prog="`basename $cf_temp`" 1293d522f475Smrg fi 1294d522f475Smrg elif test -z "$cf_path_args" ; then 1295d522f475Smrg cf_path_args="$cf_temp" 1296d522f475Smrg else 1297d522f475Smrg cf_path_args="$cf_path_args $cf_temp" 1298d522f475Smrg fi 1299d522f475Smrgdone 1300d522f475SmrgIFS="$cf_save_ifs" 1301d522f475Smrg 1302d522f475Smrgif test -n "$cf_path_prog" ; then 1303d522f475Smrg CF_MSG_LOG(defining path for ${cf_path_prog}) 1304d522f475Smrg AC_DEFINE_UNQUOTED($1_PATH,"$cf_path_prog") 1305d522f475Smrg test -n "$cf_path_args" && AC_DEFINE_UNQUOTED($1_ARGS,"$cf_path_args") 1306d522f475Smrgfi 1307d522f475Smrg])dnl 1308d522f475Smrgdnl --------------------------------------------------------------------------- 130920d2c4d2Smrgdnl CF_PATH_SYNTAX version: 13 updated: 2010/05/26 05:38:42 1310d522f475Smrgdnl -------------- 1311d522f475Smrgdnl Check the argument to see that it looks like a pathname. Rewrite it if it 1312d522f475Smrgdnl begins with one of the prefix/exec_prefix variables, and then again if the 1313d522f475Smrgdnl result begins with 'NONE'. This is necessary to work around autoconf's 1314d522f475Smrgdnl delayed evaluation of those symbols. 1315d522f475SmrgAC_DEFUN([CF_PATH_SYNTAX],[ 1316d522f475Smrgif test "x$prefix" != xNONE; then 1317d522f475Smrg cf_path_syntax="$prefix" 1318d522f475Smrgelse 1319d522f475Smrg cf_path_syntax="$ac_default_prefix" 1320d522f475Smrgfi 1321d522f475Smrg 1322d522f475Smrgcase ".[$]$1" in #(vi 1323d522f475Smrg.\[$]\(*\)*|.\'*\'*) #(vi 1324d522f475Smrg ;; 1325d522f475Smrg..|./*|.\\*) #(vi 1326d522f475Smrg ;; 1327d522f475Smrg.[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX 1328d522f475Smrg ;; 1329d522f475Smrg.\[$]{*prefix}*) #(vi 1330d522f475Smrg eval $1="[$]$1" 1331d522f475Smrg case ".[$]$1" in #(vi 1332d522f475Smrg .NONE/*) 1333d522f475Smrg $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%` 1334d522f475Smrg ;; 1335d522f475Smrg esac 1336d522f475Smrg ;; #(vi 1337d522f475Smrg.no|.NONE/*) 1338d522f475Smrg $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%` 1339d522f475Smrg ;; 1340d522f475Smrg*) 134120d2c4d2Smrg ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2) 1342d522f475Smrg ;; 1343d522f475Smrgesac 1344d522f475Smrg])dnl 1345d522f475Smrgdnl --------------------------------------------------------------------------- 1346956cc18dSsnjdnl CF_PKG_CONFIG version: 3 updated: 2009/01/25 10:55:09 1347956cc18dSsnjdnl ------------- 1348956cc18dSsnjdnl Check for the package-config program, unless disabled by command-line. 1349956cc18dSsnjAC_DEFUN([CF_PKG_CONFIG], 1350956cc18dSsnj[ 1351956cc18dSsnjAC_MSG_CHECKING(if you want to use pkg-config) 1352956cc18dSsnjAC_ARG_WITH(pkg-config, 1353956cc18dSsnj [ --with-pkg-config{=path} enable/disable use of pkg-config], 1354956cc18dSsnj [cf_pkg_config=$withval], 1355956cc18dSsnj [cf_pkg_config=yes]) 1356956cc18dSsnjAC_MSG_RESULT($cf_pkg_config) 1357956cc18dSsnj 1358956cc18dSsnjcase $cf_pkg_config in #(vi 1359956cc18dSsnjno) #(vi 1360956cc18dSsnj PKG_CONFIG=none 1361956cc18dSsnj ;; 1362956cc18dSsnjyes) #(vi 1363956cc18dSsnj AC_PATH_PROG(PKG_CONFIG, pkg-config, none) 1364956cc18dSsnj ;; 1365956cc18dSsnj*) 1366956cc18dSsnj PKG_CONFIG=$withval 1367956cc18dSsnj ;; 1368956cc18dSsnjesac 1369956cc18dSsnj 1370956cc18dSsnjtest -z "$PKG_CONFIG" && PKG_CONFIG=none 1371956cc18dSsnjif test "$PKG_CONFIG" != none ; then 1372956cc18dSsnj CF_PATH_SYNTAX(PKG_CONFIG) 1373956cc18dSsnjfi 1374956cc18dSsnj 1375956cc18dSsnjAC_SUBST(PKG_CONFIG) 1376956cc18dSsnj])dnl 1377956cc18dSsnjdnl --------------------------------------------------------------------------- 137820d2c4d2Smrgdnl CF_POSIX_C_SOURCE version: 8 updated: 2010/05/26 05:38:42 1379d522f475Smrgdnl ----------------- 1380d522f475Smrgdnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed. 1381d522f475Smrgdnl 1382d522f475Smrgdnl POSIX.1-1990 _POSIX_SOURCE 1383d522f475Smrgdnl POSIX.1-1990 and _POSIX_SOURCE and 1384d522f475Smrgdnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2 1385d522f475Smrgdnl Bindings Option 1386d522f475Smrgdnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L 1387d522f475Smrgdnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L 1388d522f475Smrgdnl X/Open 2000 _POSIX_C_SOURCE=200112L 1389d522f475Smrgdnl 1390d522f475Smrgdnl Parameters: 1391d522f475Smrgdnl $1 is the nominal value for _POSIX_C_SOURCE 1392d522f475SmrgAC_DEFUN([CF_POSIX_C_SOURCE], 1393d522f475Smrg[ 139420d2c4d2Smrgcf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1]) 1395d522f475Smrg 1396d522f475Smrgcf_save_CFLAGS="$CFLAGS" 1397d522f475Smrgcf_save_CPPFLAGS="$CPPFLAGS" 1398d522f475Smrg 1399d522f475SmrgCF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE) 1400d522f475SmrgCF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE) 1401d522f475Smrg 1402d522f475SmrgAC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[ 1403d522f475Smrg CF_MSG_LOG(if the symbol is already defined go no further) 1404d522f475Smrg AC_TRY_COMPILE([#include <sys/types.h>],[ 1405d522f475Smrg#ifndef _POSIX_C_SOURCE 1406d522f475Smrgmake an error 1407d522f475Smrg#endif], 1408d522f475Smrg [cf_cv_posix_c_source=no], 1409d522f475Smrg [cf_want_posix_source=no 1410d522f475Smrg case .$cf_POSIX_C_SOURCE in #(vi 1411d522f475Smrg .[[12]]??*) #(vi 1412d522f475Smrg cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" 1413d522f475Smrg ;; 1414d522f475Smrg .2) #(vi 1415d522f475Smrg cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" 1416d522f475Smrg cf_want_posix_source=yes 1417d522f475Smrg ;; 1418d522f475Smrg .*) 1419d522f475Smrg cf_want_posix_source=yes 1420d522f475Smrg ;; 1421d522f475Smrg esac 1422d522f475Smrg if test "$cf_want_posix_source" = yes ; then 1423d522f475Smrg AC_TRY_COMPILE([#include <sys/types.h>],[ 1424d522f475Smrg#ifdef _POSIX_SOURCE 1425d522f475Smrgmake an error 1426d522f475Smrg#endif],[], 1427d522f475Smrg cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE") 1428d522f475Smrg fi 1429d522f475Smrg CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE) 1430d522f475Smrg CFLAGS="$cf_trim_CFLAGS" 1431d522f475Smrg CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source" 1432d522f475Smrg CF_MSG_LOG(if the second compile does not leave our definition intact error) 1433d522f475Smrg AC_TRY_COMPILE([#include <sys/types.h>],[ 1434d522f475Smrg#ifndef _POSIX_C_SOURCE 1435d522f475Smrgmake an error 1436d522f475Smrg#endif],, 1437d522f475Smrg [cf_cv_posix_c_source=no]) 1438d522f475Smrg CFLAGS="$cf_save_CFLAGS" 1439d522f475Smrg CPPFLAGS="$cf_save_CPPFLAGS" 1440d522f475Smrg ]) 1441d522f475Smrg]) 1442d522f475Smrg 1443d522f475Smrgif test "$cf_cv_posix_c_source" != no ; then 1444d522f475Smrg CFLAGS="$cf_trim_CFLAGS" 1445d522f475Smrg CPPFLAGS="$cf_trim_CPPFLAGS" 144620d2c4d2Smrg CF_ADD_CFLAGS($cf_cv_posix_c_source) 1447d522f475Smrgfi 1448d522f475Smrg 1449d522f475Smrg])dnl 1450d522f475Smrgdnl --------------------------------------------------------------------------- 1451d522f475Smrgdnl CF_POSIX_SAVED_IDS version: 7 updated: 2007/03/14 16:43:53 1452d522f475Smrgdnl ------------------ 1453d522f475Smrgdnl 1454d522f475Smrgdnl Check first if saved-ids are always supported. Some systems 1455d522f475Smrgdnl may require runtime checks. 1456d522f475SmrgAC_DEFUN([CF_POSIX_SAVED_IDS], 1457d522f475Smrg[ 1458d522f475SmrgAC_CHECK_HEADERS( \ 1459d522f475Smrgsys/param.h \ 1460d522f475Smrg) 1461d522f475Smrg 1462d522f475SmrgAC_CACHE_CHECK(if POSIX saved-ids are supported,cf_cv_posix_saved_ids,[ 1463d522f475SmrgAC_TRY_LINK( 1464d522f475Smrg[ 1465d522f475Smrg#include <unistd.h> 1466d522f475Smrg#ifdef HAVE_SYS_PARAM_H 1467d522f475Smrg#include <sys/param.h> /* this may define "BSD" */ 1468d522f475Smrg#endif 1469d522f475Smrg],[ 1470d522f475Smrg#if defined(_POSIX_SAVED_IDS) && (_POSIX_SAVED_IDS > 0) 1471d522f475Smrg void *p = (void *) seteuid; 1472d522f475Smrg int x = seteuid(geteuid()); 1473d522f475Smrg#elif defined(BSD) && (BSD >= 199103) 1474d522f475Smrg/* The BSD's may implement the runtime check - and it fails. 1475d522f475Smrg * However, saved-ids work almost like POSIX (close enough for most uses). 1476d522f475Smrg */ 1477d522f475Smrg#else 1478d522f475Smrgmake an error 1479d522f475Smrg#endif 1480d522f475Smrg],[cf_cv_posix_saved_ids=yes 1481d522f475Smrg],[ 1482d522f475SmrgAC_TRY_RUN([ 1483d522f475Smrg#ifdef HAVE_STDLIB_H 1484d522f475Smrg#include <stdlib.h> 1485d522f475Smrg#endif 1486d522f475Smrg#include <unistd.h> 1487d522f475Smrgint main() 1488d522f475Smrg{ 1489d522f475Smrg void *p = (void *) seteuid; 1490d522f475Smrg long code = sysconf(_SC_SAVED_IDS); 1491d522f475Smrg ${cf_cv_main_return:-return} ((code > 0) ? 0 : 1); 1492d522f475Smrg}], 1493d522f475Smrg cf_cv_posix_saved_ids=yes, 1494d522f475Smrg cf_cv_posix_saved_ids=no, 1495d522f475Smrg cf_cv_posix_saved_ids=unknown) 1496d522f475Smrg]) 1497d522f475Smrg]) 1498d522f475Smrg 1499d522f475Smrgtest "$cf_cv_posix_saved_ids" = yes && AC_DEFINE(HAVE_POSIX_SAVED_IDS) 1500d522f475Smrg]) 1501d522f475Smrgdnl --------------------------------------------------------------------------- 1502d522f475Smrgdnl CF_POSIX_WAIT version: 2 updated: 2000/05/29 16:16:04 1503d522f475Smrgdnl ------------- 1504d522f475Smrgdnl Check for POSIX wait support 1505d522f475SmrgAC_DEFUN([CF_POSIX_WAIT], 1506d522f475Smrg[ 1507d522f475SmrgAC_REQUIRE([AC_HEADER_SYS_WAIT]) 1508d522f475SmrgAC_CACHE_CHECK(for POSIX wait functions,cf_cv_posix_wait,[ 1509d522f475SmrgAC_TRY_LINK([ 1510d522f475Smrg#include <stdlib.h> 1511d522f475Smrg#include <stdio.h> 1512d522f475Smrg#include <sys/types.h> 1513d522f475Smrg#ifdef HAVE_SYS_WAIT_H 1514d522f475Smrg#include <sys/wait.h> 1515d522f475Smrg#endif 1516d522f475Smrg],[ 1517d522f475Smrg int stat_loc; 1518d522f475Smrg pid_t pid = waitpid(-1, &stat_loc, WNOHANG|WUNTRACED); 1519d522f475Smrg pid_t pid2 = wait(&stat_loc); 1520d522f475Smrg], 1521d522f475Smrg[cf_cv_posix_wait=yes], 1522d522f475Smrg[cf_cv_posix_wait=no]) 1523d522f475Smrg]) 1524d522f475Smrgtest "$cf_cv_posix_wait" = yes && AC_DEFINE(USE_POSIX_WAIT) 1525d522f475Smrg])dnl 1526d522f475Smrgdnl --------------------------------------------------------------------------- 1527d522f475Smrgdnl CF_PROCFS_CWD version: 2 updated: 2007/03/12 20:39:04 1528d522f475Smrgdnl ------------- 1529d522f475Smrgdnl Find /proc tree (may be in a different place) which implements the "cwd" 1530d522f475Smrgdnl link. 1531d522f475SmrgAC_DEFUN([CF_PROCFS_CWD],[ 1532d522f475SmrgAC_CACHE_CHECK(for proc tree with cwd-support,cf_cv_procfs_cwd,[ 1533d522f475Smrgcf_cv_procfs_cwd=no 1534d522f475Smrgfor cf_path in /proc /compat/linux/proc /usr/compat/linux/proc 1535d522f475Smrgdo 1536d522f475Smrg if test -d $cf_path && \ 1537d522f475Smrg test -d $cf_path/$$ && \ 1538d522f475Smrg ( test -d $cf_path/$$/cwd || \ 1539d522f475Smrg test -L $cf_path/$$/cwd ); then 1540d522f475Smrg cf_cv_procfs_cwd=$cf_path 1541d522f475Smrg break 1542d522f475Smrg fi 1543d522f475Smrgdone 1544d522f475Smrg]) 1545d522f475Smrg])dnl 1546d522f475Smrgdnl --------------------------------------------------------------------------- 1547d522f475Smrgdnl CF_PROG_CC_U_D version: 1 updated: 2005/07/14 16:59:30 1548d522f475Smrgdnl -------------- 1549d522f475Smrgdnl Check if C (preprocessor) -U and -D options are processed in the order 1550d522f475Smrgdnl given rather than by type of option. Some compilers insist on apply all 1551d522f475Smrgdnl of the -U options after all of the -D options. Others allow mixing them, 1552d522f475Smrgdnl and may predefine symbols that conflict with those we define. 1553d522f475SmrgAC_DEFUN([CF_PROG_CC_U_D], 1554d522f475Smrg[ 1555d522f475SmrgAC_CACHE_CHECK(if $CC -U and -D options work together,cf_cv_cc_u_d_options,[ 1556d522f475Smrg cf_save_CPPFLAGS="$CPPFLAGS" 1557d522f475Smrg CPPFLAGS="-UU_D_OPTIONS -DU_D_OPTIONS -DD_U_OPTIONS -UD_U_OPTIONS" 1558d522f475Smrg AC_TRY_COMPILE([],[ 1559d522f475Smrg#ifndef U_D_OPTIONS 1560d522f475Smrgmake an undefined-error 1561d522f475Smrg#endif 1562d522f475Smrg#ifdef D_U_OPTIONS 1563d522f475Smrgmake a defined-error 1564d522f475Smrg#endif 1565d522f475Smrg ],[ 1566d522f475Smrg cf_cv_cc_u_d_options=yes],[ 1567d522f475Smrg cf_cv_cc_u_d_options=no]) 1568d522f475Smrg CPPFLAGS="$cf_save_CPPFLAGS" 1569d522f475Smrg]) 1570d522f475Smrg])dnl 1571d522f475Smrgdnl --------------------------------------------------------------------------- 1572d522f475Smrgdnl CF_PROG_EXT version: 10 updated: 2004/01/03 19:28:18 1573d522f475Smrgdnl ----------- 1574d522f475Smrgdnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX. 1575d522f475SmrgAC_DEFUN([CF_PROG_EXT], 1576d522f475Smrg[ 1577d522f475SmrgAC_REQUIRE([CF_CHECK_CACHE]) 1578d522f475Smrgcase $cf_cv_system_name in 1579d522f475Smrgos2*) 1580d522f475Smrg CFLAGS="$CFLAGS -Zmt" 1581d522f475Smrg CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__" 1582d522f475Smrg CXXFLAGS="$CXXFLAGS -Zmt" 1583d522f475Smrg # autoconf's macro sets -Zexe and suffix both, which conflict:w 1584d522f475Smrg LDFLAGS="$LDFLAGS -Zmt -Zcrtdll" 1585d522f475Smrg ac_cv_exeext=.exe 1586d522f475Smrg ;; 1587d522f475Smrgesac 1588d522f475Smrg 1589d522f475SmrgAC_EXEEXT 1590d522f475SmrgAC_OBJEXT 1591d522f475Smrg 1592d522f475SmrgPROG_EXT="$EXEEXT" 1593d522f475SmrgAC_SUBST(PROG_EXT) 1594d522f475Smrgtest -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT") 1595d522f475Smrg])dnl 1596d522f475Smrgdnl --------------------------------------------------------------------------- 159720d2c4d2Smrgdnl CF_REGEX version: 7 updated: 2010/05/29 16:31:02 1598d522f475Smrgdnl -------- 1599d522f475Smrgdnl Attempt to determine if we've got one of the flavors of regular-expression 1600d522f475Smrgdnl code that we can support. 1601d522f475SmrgAC_DEFUN([CF_REGEX], 1602d522f475Smrg[ 160320d2c4d2Smrg 160420d2c4d2Smrgcf_regex_func=no 160520d2c4d2Smrg 160620d2c4d2SmrgAC_CHECK_FUNC(regcomp,[cf_regex_func=regcomp],[ 160720d2c4d2Smrg for cf_regex_lib in regex re 160820d2c4d2Smrg do 160920d2c4d2Smrg AC_CHECK_LIB($cf_regex_lib,regcomp,[ 161020d2c4d2Smrg CF_ADD_LIB($cf_regex_lib) 161120d2c4d2Smrg cf_regex_func=regcomp 161220d2c4d2Smrg break]) 161320d2c4d2Smrg done 161420d2c4d2Smrg]) 161520d2c4d2Smrg 161620d2c4d2Smrgif test "$cf_regex_func" = no ; then 161720d2c4d2Smrg AC_CHECK_FUNC(compile,[cf_regex_func=compile],[ 161820d2c4d2Smrg AC_CHECK_LIB(gen,compile,[ 161920d2c4d2Smrg CF_ADD_LIB(gen) 162020d2c4d2Smrg cf_regex_func=compile])]) 162120d2c4d2Smrgfi 162220d2c4d2Smrg 162320d2c4d2Smrgif test "$cf_regex_func" = no ; then 162420d2c4d2Smrg AC_MSG_WARN(cannot find regular expression library) 162520d2c4d2Smrgfi 162620d2c4d2Smrg 162720d2c4d2SmrgAC_CACHE_CHECK(for regular-expression headers,cf_cv_regex_hdrs,[ 162820d2c4d2Smrg 162920d2c4d2Smrgcf_cv_regex_hdrs=no 163020d2c4d2Smrgcase $cf_regex_func in #(vi 163120d2c4d2Smrgcompile) #(vi 163220d2c4d2Smrg for cf_regex_hdr in regexp.h regexpr.h 163320d2c4d2Smrg do 163420d2c4d2Smrg AC_TRY_LINK([#include <$cf_regex_hdr>],[ 163520d2c4d2Smrg char *p = compile("", "", "", 0); 1636d522f475Smrg int x = step("", ""); 163720d2c4d2Smrg ],[ 163820d2c4d2Smrg cf_cv_regex_hdrs=$cf_regex_hdr 163920d2c4d2Smrg break 164020d2c4d2Smrg ]) 164120d2c4d2Smrg done 164220d2c4d2Smrg ;; 164320d2c4d2Smrg*) 164420d2c4d2Smrg for cf_regex_hdr in regex.h 164520d2c4d2Smrg do 164620d2c4d2Smrg AC_TRY_LINK([#include <sys/types.h> 164720d2c4d2Smrg#include <$cf_regex_hdr>],[ 164820d2c4d2Smrg regex_t *p; 164920d2c4d2Smrg int x = regcomp(p, "", 0); 165020d2c4d2Smrg int y = regexec(p, "", 0, 0, 0); 165120d2c4d2Smrg regfree(p); 165220d2c4d2Smrg ],[ 165320d2c4d2Smrg cf_cv_regex_hdrs=$cf_regex_hdr 165420d2c4d2Smrg break 165520d2c4d2Smrg ]) 165620d2c4d2Smrg done 165720d2c4d2Smrg ;; 165820d2c4d2Smrgesac 165920d2c4d2Smrg 1660d522f475Smrg]) 166120d2c4d2Smrg 166220d2c4d2Smrgcase $cf_cv_regex_hdrs in #(vi 166320d2c4d2Smrg no) AC_MSG_WARN(no regular expression header found) ;; #(vi 166420d2c4d2Smrg regex.h) AC_DEFINE(HAVE_REGEX_H_FUNCS) ;; #(vi 166520d2c4d2Smrg regexp.h) AC_DEFINE(HAVE_REGEXP_H_FUNCS) ;; #(vi 166620d2c4d2Smrg regexpr.h) AC_DEFINE(HAVE_REGEXPR_H_FUNCS) ;; 1667d522f475Smrgesac 1668d522f475Smrg])dnl 1669d522f475Smrgdnl --------------------------------------------------------------------------- 167020d2c4d2Smrgdnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50 1671d522f475Smrgdnl ---------------- 1672d522f475Smrgdnl Remove all -U and -D options that refer to the given symbol from a list 1673d522f475Smrgdnl of C compiler options. This works around the problem that not all 1674d522f475Smrgdnl compilers process -U and -D options from left-to-right, so a -U option 1675d522f475Smrgdnl cannot be used to cancel the effect of a preceding -D option. 1676d522f475Smrgdnl 1677d522f475Smrgdnl $1 = target (which could be the same as the source variable) 1678d522f475Smrgdnl $2 = source (including '$') 1679d522f475Smrgdnl $3 = symbol to remove 1680d522f475Smrgdefine([CF_REMOVE_DEFINE], 1681d522f475Smrg[ 1682d522f475Smrg$1=`echo "$2" | \ 168320d2c4d2Smrg sed -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[[ ]]/ /g' \ 168420d2c4d2Smrg -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'` 168520d2c4d2Smrg])dnl 168620d2c4d2Smrgdnl --------------------------------------------------------------------------- 168720d2c4d2Smrgdnl CF_RPATH_HACK version: 8 updated: 2010/04/17 15:38:58 168820d2c4d2Smrgdnl ------------- 168920d2c4d2SmrgAC_DEFUN([CF_RPATH_HACK], 169020d2c4d2Smrg[ 169120d2c4d2SmrgAC_REQUIRE([CF_LD_RPATH_OPT]) 169220d2c4d2SmrgAC_MSG_CHECKING(for updated LDFLAGS) 169320d2c4d2Smrgif test -n "$LD_RPATH_OPT" ; then 169420d2c4d2Smrg AC_MSG_RESULT(maybe) 169520d2c4d2Smrg 169620d2c4d2Smrg AC_CHECK_PROGS(cf_ldd_prog,ldd,no) 169720d2c4d2Smrg cf_rpath_list="/usr/lib /lib" 169820d2c4d2Smrg if test "$cf_ldd_prog" != no 169920d2c4d2Smrg then 170020d2c4d2SmrgAC_TRY_LINK([#include <stdio.h>], 170120d2c4d2Smrg [printf("Hello");], 170220d2c4d2Smrg [cf_rpath_list=`$cf_ldd_prog conftest$ac_exeext | fgrep / | sed -e 's%^.*[[ ]]/%/%' -e 's%/[[^/]][[^/]]*$%%' |sort -u`]) 170320d2c4d2Smrg fi 170420d2c4d2Smrg 170520d2c4d2Smrg CF_VERBOSE(...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS) 170620d2c4d2Smrg 170720d2c4d2Smrg CF_RPATH_HACK_2(LDFLAGS) 170820d2c4d2Smrg CF_RPATH_HACK_2(LIBS) 170920d2c4d2Smrg 171020d2c4d2Smrg CF_VERBOSE(...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS) 171120d2c4d2Smrgfi 171220d2c4d2SmrgAC_SUBST(EXTRA_LDFLAGS) 171320d2c4d2Smrg])dnl 171420d2c4d2Smrgdnl --------------------------------------------------------------------------- 171520d2c4d2Smrgdnl CF_RPATH_HACK_2 version: 6 updated: 2010/04/17 16:31:24 171620d2c4d2Smrgdnl --------------- 171720d2c4d2Smrgdnl Do one set of substitutions for CF_RPATH_HACK, adding an rpath option to 171820d2c4d2Smrgdnl EXTRA_LDFLAGS for each -L option found. 171920d2c4d2Smrgdnl 172020d2c4d2Smrgdnl $cf_rpath_list contains a list of directories to ignore. 172120d2c4d2Smrgdnl 172220d2c4d2Smrgdnl $1 = variable name to update. The LDFLAGS variable should be the only one, 172320d2c4d2Smrgdnl but LIBS often has misplaced -L options. 172420d2c4d2SmrgAC_DEFUN([CF_RPATH_HACK_2], 172520d2c4d2Smrg[ 172620d2c4d2SmrgCF_VERBOSE(...checking $1 [$]$1) 172720d2c4d2Smrg 172820d2c4d2Smrgcf_rpath_dst= 172920d2c4d2Smrgfor cf_rpath_src in [$]$1 173020d2c4d2Smrgdo 173120d2c4d2Smrg case $cf_rpath_src in #(vi 173220d2c4d2Smrg -L*) #(vi 173320d2c4d2Smrg 173420d2c4d2Smrg # check if this refers to a directory which we will ignore 173520d2c4d2Smrg cf_rpath_skip=no 173620d2c4d2Smrg if test -n "$cf_rpath_list" 173720d2c4d2Smrg then 173820d2c4d2Smrg for cf_rpath_item in $cf_rpath_list 173920d2c4d2Smrg do 174020d2c4d2Smrg if test "x$cf_rpath_src" = "x-L$cf_rpath_item" 174120d2c4d2Smrg then 174220d2c4d2Smrg cf_rpath_skip=yes 174320d2c4d2Smrg break 174420d2c4d2Smrg fi 174520d2c4d2Smrg done 174620d2c4d2Smrg fi 174720d2c4d2Smrg 174820d2c4d2Smrg if test "$cf_rpath_skip" = no 174920d2c4d2Smrg then 175020d2c4d2Smrg # transform the option 175120d2c4d2Smrg if test "$LD_RPATH_OPT" = "-R " ; then 175220d2c4d2Smrg cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%-R %"` 175320d2c4d2Smrg else 175420d2c4d2Smrg cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%$LD_RPATH_OPT%"` 175520d2c4d2Smrg fi 175620d2c4d2Smrg 175720d2c4d2Smrg # if we have not already added this, add it now 175820d2c4d2Smrg cf_rpath_tst=`echo "$EXTRA_LDFLAGS" | sed -e "s%$cf_rpath_tmp %%"` 175920d2c4d2Smrg if test "x$cf_rpath_tst" = "x$EXTRA_LDFLAGS" 176020d2c4d2Smrg then 176120d2c4d2Smrg CF_VERBOSE(...Filter $cf_rpath_src ->$cf_rpath_tmp) 176220d2c4d2Smrg EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS" 176320d2c4d2Smrg fi 176420d2c4d2Smrg fi 176520d2c4d2Smrg ;; 176620d2c4d2Smrg esac 176720d2c4d2Smrg cf_rpath_dst="$cf_rpath_dst $cf_rpath_src" 176820d2c4d2Smrgdone 176920d2c4d2Smrg$1=$cf_rpath_dst 177020d2c4d2Smrg 177120d2c4d2SmrgCF_VERBOSE(...checked $1 [$]$1) 177220d2c4d2SmrgAC_SUBST(EXTRA_LDFLAGS) 1773d522f475Smrg])dnl 1774d522f475Smrgdnl --------------------------------------------------------------------------- 1775d522f475Smrgdnl CF_SIGWINCH version: 1 updated: 2006/04/02 16:41:09 1776d522f475Smrgdnl ----------- 1777d522f475Smrgdnl Use this macro after CF_XOPEN_SOURCE, but do not require it (not all 1778d522f475Smrgdnl programs need this test). 1779d522f475Smrgdnl 1780d522f475Smrgdnl This is really a MacOS X 10.4.3 workaround. Defining _POSIX_C_SOURCE 1781d522f475Smrgdnl forces SIGWINCH to be undefined (breaks xterm, ncurses). Oddly, the struct 1782d522f475Smrgdnl winsize declaration is left alone - we may revisit this if Apple choose to 1783d522f475Smrgdnl break that part of the interface as well. 1784d522f475SmrgAC_DEFUN([CF_SIGWINCH], 1785d522f475Smrg[ 1786d522f475SmrgAC_CACHE_CHECK(if SIGWINCH is defined,cf_cv_define_sigwinch,[ 1787d522f475Smrg AC_TRY_COMPILE([ 1788d522f475Smrg#include <sys/types.h> 1789d522f475Smrg#include <sys/signal.h> 1790d522f475Smrg],[int x = SIGWINCH], 1791d522f475Smrg [cf_cv_define_sigwinch=yes], 1792d522f475Smrg [AC_TRY_COMPILE([ 1793d522f475Smrg#undef _XOPEN_SOURCE 1794d522f475Smrg#undef _POSIX_SOURCE 1795d522f475Smrg#undef _POSIX_C_SOURCE 1796d522f475Smrg#include <sys/types.h> 1797d522f475Smrg#include <sys/signal.h> 1798d522f475Smrg],[int x = SIGWINCH], 1799d522f475Smrg [cf_cv_define_sigwinch=maybe], 1800d522f475Smrg [cf_cv_define_sigwinch=no]) 1801d522f475Smrg]) 1802d522f475Smrg]) 1803d522f475Smrg 1804d522f475Smrgif test "$cf_cv_define_sigwinch" = maybe ; then 1805d522f475SmrgAC_CACHE_CHECK(for actual SIGWINCH definition,cf_cv_fixup_sigwinch,[ 1806d522f475Smrgcf_cv_fixup_sigwinch=unknown 1807d522f475Smrgcf_sigwinch=32 1808d522f475Smrgwhile test $cf_sigwinch != 1 1809d522f475Smrgdo 1810d522f475Smrg AC_TRY_COMPILE([ 1811d522f475Smrg#undef _XOPEN_SOURCE 1812d522f475Smrg#undef _POSIX_SOURCE 1813d522f475Smrg#undef _POSIX_C_SOURCE 1814d522f475Smrg#include <sys/types.h> 1815d522f475Smrg#include <sys/signal.h> 1816d522f475Smrg],[ 1817d522f475Smrg#if SIGWINCH != $cf_sigwinch 1818d522f475Smrgmake an error 1819d522f475Smrg#endif 1820d522f475Smrgint x = SIGWINCH], 1821d522f475Smrg [cf_cv_fixup_sigwinch=$cf_sigwinch 1822d522f475Smrg break]) 1823d522f475Smrg 1824d522f475Smrgcf_sigwinch=`expr $cf_sigwinch - 1` 1825d522f475Smrgdone 1826d522f475Smrg]) 1827d522f475Smrg 1828d522f475Smrg if test "$cf_cv_fixup_sigwinch" != unknown ; then 1829d522f475Smrg CPPFLAGS="$CPPFLAGS -DSIGWINCH=$cf_cv_fixup_sigwinch" 1830d522f475Smrg fi 1831d522f475Smrgfi 1832d522f475Smrg])dnl 1833d522f475Smrgdnl --------------------------------------------------------------------------- 1834d522f475Smrgdnl CF_SIG_ATOMIC_T version: 2 updated: 2005/09/18 17:27:12 1835d522f475Smrgdnl --------------- 1836d522f475Smrgdnl signal handler, but there are some gcc depedencies in that recommendation. 1837d522f475Smrgdnl Try anyway. 1838d522f475SmrgAC_DEFUN([CF_SIG_ATOMIC_T], 1839d522f475Smrg[ 1840d522f475SmrgAC_MSG_CHECKING(for signal global datatype) 1841d522f475SmrgAC_CACHE_VAL(cf_cv_sig_atomic_t,[ 1842d522f475Smrg for cf_type in \ 1843d522f475Smrg "volatile sig_atomic_t" \ 1844d522f475Smrg "sig_atomic_t" \ 1845d522f475Smrg "int" 1846d522f475Smrg do 1847d522f475Smrg AC_TRY_COMPILE([ 1848d522f475Smrg#include <sys/types.h> 1849d522f475Smrg#include <signal.h> 1850d522f475Smrg#include <stdio.h> 1851d522f475Smrg 1852d522f475Smrgextern $cf_type x; 1853d522f475Smrg$cf_type x; 1854d522f475Smrgstatic void handler(int sig) 1855d522f475Smrg{ 1856d522f475Smrg x = 5; 1857d522f475Smrg}], 1858d522f475Smrg [signal(SIGINT, handler); 1859d522f475Smrg x = 1], 1860d522f475Smrg [cf_cv_sig_atomic_t=$cf_type], 1861d522f475Smrg [cf_cv_sig_atomic_t=no]) 1862d522f475Smrg test "$cf_cv_sig_atomic_t" != no && break 1863d522f475Smrg done 1864d522f475Smrg ]) 1865d522f475SmrgAC_MSG_RESULT($cf_cv_sig_atomic_t) 1866d522f475Smrgtest "$cf_cv_sig_atomic_t" != no && AC_DEFINE_UNQUOTED(SIG_ATOMIC_T, $cf_cv_sig_atomic_t) 1867d522f475Smrg])dnl 1868d522f475Smrgdnl --------------------------------------------------------------------------- 1869d522f475Smrgdnl CF_SIZE_T version: 4 updated: 2000/01/22 00:19:54 1870d522f475Smrgdnl --------- 1871d522f475Smrgdnl On both Ultrix and CLIX, I find size_t defined in <stdio.h> 1872d522f475SmrgAC_DEFUN([CF_SIZE_T], 1873d522f475Smrg[ 1874d522f475SmrgAC_MSG_CHECKING(for size_t in <sys/types.h> or <stdio.h>) 1875d522f475SmrgAC_CACHE_VAL(cf_cv_type_size_t,[ 1876d522f475Smrg AC_TRY_COMPILE([ 1877d522f475Smrg#include <sys/types.h> 1878d522f475Smrg#ifdef STDC_HEADERS 1879d522f475Smrg#include <stdlib.h> 1880d522f475Smrg#include <stddef.h> 1881d522f475Smrg#endif 1882d522f475Smrg#include <stdio.h>], 1883d522f475Smrg [size_t x], 1884d522f475Smrg [cf_cv_type_size_t=yes], 1885d522f475Smrg [cf_cv_type_size_t=no]) 1886d522f475Smrg ]) 1887d522f475SmrgAC_MSG_RESULT($cf_cv_type_size_t) 1888d522f475Smrgtest $cf_cv_type_size_t = no && AC_DEFINE(size_t, unsigned) 1889d522f475Smrg])dnl 1890d522f475Smrgdnl --------------------------------------------------------------------------- 1891d522f475Smrgdnl CF_STRUCT_LASTLOG version: 1 updated: 2006/03/12 17:46:43 1892d522f475Smrgdnl ----------------- 1893d522f475Smrgdnl Check for header defining struct lastlog, ensure that its .ll_time member 1894d522f475Smrgdnl is compatible with time(). 1895d522f475SmrgAC_DEFUN([CF_STRUCT_LASTLOG], 1896d522f475Smrg[ 1897d522f475SmrgAC_CHECK_HEADERS(lastlog.h) 1898d522f475SmrgAC_CACHE_CHECK(for struct lastlog,cf_cv_struct_lastlog,[ 1899d522f475SmrgAC_TRY_RUN([ 1900d522f475Smrg#include <sys/types.h> 1901d522f475Smrg#include <time.h> 1902d522f475Smrg#include <lastlog.h> 1903d522f475Smrg 1904d522f475Smrgint main() 1905d522f475Smrg{ 1906d522f475Smrg struct lastlog data; 1907d522f475Smrg return (sizeof(data.ll_time) != sizeof(time_t)); 1908d522f475Smrg}],[ 1909d522f475Smrgcf_cv_struct_lastlog=yes],[ 1910d522f475Smrgcf_cv_struct_lastlog=no],[ 1911d522f475Smrgcf_cv_struct_lastlog=unknown])]) 1912d522f475Smrg 1913d522f475Smrgtest $cf_cv_struct_lastlog != no && AC_DEFINE(USE_STRUCT_LASTLOG) 1914d522f475Smrg])dnl 1915d522f475Smrgdnl --------------------------------------------------------------------------- 1916d522f475Smrgdnl CF_SVR4 version: 3 updated: 2000/05/31 10:16:52 1917d522f475Smrgdnl ------- 1918d522f475Smrgdnl Check if this is an SVR4 system. We need the definition for xterm 1919d522f475SmrgAC_DEFUN([CF_SVR4], 1920d522f475Smrg[ 1921d522f475SmrgAC_CHECK_LIB(elf, elf_begin,[ 1922d522f475SmrgAC_CACHE_CHECK(if this is an SVR4 system, cf_cv_svr4,[ 1923d522f475SmrgAC_TRY_COMPILE([ 1924d522f475Smrg#include <elf.h> 1925d522f475Smrg#include <sys/termio.h> 1926d522f475Smrg],[ 1927d522f475Smrgstatic struct termio d_tio; 1928d522f475Smrg d_tio.c_cc[VINTR] = 0; 1929d522f475Smrg d_tio.c_cc[VQUIT] = 0; 1930d522f475Smrg d_tio.c_cc[VERASE] = 0; 1931d522f475Smrg d_tio.c_cc[VKILL] = 0; 1932d522f475Smrg d_tio.c_cc[VEOF] = 0; 1933d522f475Smrg d_tio.c_cc[VEOL] = 0; 1934d522f475Smrg d_tio.c_cc[VMIN] = 0; 1935d522f475Smrg d_tio.c_cc[VTIME] = 0; 1936d522f475Smrg d_tio.c_cc[VLNEXT] = 0; 1937d522f475Smrg], 1938d522f475Smrg[cf_cv_svr4=yes], 1939d522f475Smrg[cf_cv_svr4=no]) 1940d522f475Smrg]) 1941d522f475Smrg]) 1942d522f475Smrgtest "$cf_cv_svr4" = yes && AC_DEFINE(SVR4) 1943d522f475Smrg])dnl 1944d522f475Smrgdnl --------------------------------------------------------------------------- 1945d522f475Smrgdnl CF_SYSV version: 13 updated: 2006/08/20 14:55:37 1946d522f475Smrgdnl ------- 1947d522f475Smrgdnl Check if this is a SYSV platform, e.g., as used in <X11/Xos.h>, and whether 1948d522f475Smrgdnl defining it will be helpful. The following features are used to check: 1949d522f475Smrgdnl 1950d522f475Smrgdnl a) bona-fide SVSV doesn't use const for sys_errlist[]. Since this is a 1951d522f475Smrgdnl legacy (pre-ANSI) feature, const should not apply. Modern systems only 1952d522f475Smrgdnl declare strerror(). Xos.h declares the legacy form of str_errlist[], and 1953d522f475Smrgdnl a compile-time error will result from trying to assign to a const array. 1954d522f475Smrgdnl 1955d522f475Smrgdnl b) compile with headers that exist on SYSV hosts. 1956d522f475Smrgdnl 1957d522f475Smrgdnl c) compile with type definitions that differ on SYSV hosts from standard C. 1958d522f475SmrgAC_DEFUN([CF_SYSV], 1959d522f475Smrg[ 1960d522f475SmrgAC_CHECK_HEADERS( \ 1961d522f475Smrgtermios.h \ 1962d522f475Smrgstdlib.h \ 1963d522f475SmrgX11/Intrinsic.h \ 1964d522f475Smrg) 1965d522f475Smrg 1966d522f475SmrgAC_REQUIRE([CF_SYS_ERRLIST]) 1967d522f475Smrg 1968d522f475SmrgAC_CACHE_CHECK(if we should define SYSV,cf_cv_sysv,[ 1969d522f475SmrgAC_TRY_COMPILE([ 1970d522f475Smrg#undef SYSV 1971d522f475Smrg#define SYSV 1 /* get Xos.h to declare sys_errlist[] */ 1972d522f475Smrg#ifdef HAVE_STDLIB_H 1973d522f475Smrg#include <stdlib.h> /* look for wchar_t */ 1974d522f475Smrg#endif 1975d522f475Smrg#ifdef HAVE_X11_INTRINSIC_H 1976d522f475Smrg#include <X11/Intrinsic.h> /* Intrinsic.h has other traps... */ 1977d522f475Smrg#endif 1978d522f475Smrg#ifdef HAVE_TERMIOS_H /* needed for HPUX 10.20 */ 1979d522f475Smrg#include <termios.h> 1980d522f475Smrg#define STRUCT_TERMIOS struct termios 1981d522f475Smrg#else 1982d522f475Smrg#define STRUCT_TERMIOS struct termio 1983d522f475Smrg#endif 1984d522f475Smrg#include <curses.h> 1985d522f475Smrg#include <term.h> /* eliminate most BSD hacks */ 1986d522f475Smrg#include <errno.h> /* declare sys_errlist on older systems */ 1987d522f475Smrg#include <sys/termio.h> /* eliminate most of the remaining ones */ 1988d522f475Smrg],[ 1989d522f475Smrgstatic STRUCT_TERMIOS d_tio; 1990d522f475Smrg d_tio.c_cc[VINTR] = 0; 1991d522f475Smrg d_tio.c_cc[VQUIT] = 0; 1992d522f475Smrg d_tio.c_cc[VERASE] = 0; 1993d522f475Smrg d_tio.c_cc[VKILL] = 0; 1994d522f475Smrg d_tio.c_cc[VEOF] = 0; 1995d522f475Smrg d_tio.c_cc[VEOL] = 0; 1996d522f475Smrg d_tio.c_cc[VMIN] = 0; 1997d522f475Smrg d_tio.c_cc[VTIME] = 0; 1998d522f475Smrg#if defined(HAVE_SYS_ERRLIST) && !defined(DECL_SYS_ERRLIST) 1999d522f475Smrgsys_errlist[0] = ""; /* Cygwin mis-declares this */ 2000d522f475Smrg#endif 2001d522f475Smrg], 2002d522f475Smrg[cf_cv_sysv=yes], 2003d522f475Smrg[cf_cv_sysv=no]) 2004d522f475Smrg]) 2005d522f475Smrgtest "$cf_cv_sysv" = yes && AC_DEFINE(SYSV) 2006d522f475Smrg])dnl 2007d522f475Smrgdnl --------------------------------------------------------------------------- 2008d522f475Smrgdnl CF_SYSV_UTMP version: 5 updated: 2001/12/27 12:55:07 2009d522f475Smrgdnl ------------ 2010d522f475Smrgdnl Check if this is a SYSV flavor of UTMP 2011d522f475SmrgAC_DEFUN([CF_SYSV_UTMP], 2012d522f475Smrg[ 2013d522f475SmrgAC_CACHE_CHECK(if $cf_cv_have_utmp is SYSV flavor,cf_cv_sysv_utmp,[ 2014d522f475Smrgtest "$cf_cv_have_utmp" = "utmp" && cf_prefix="ut" || cf_prefix="utx" 2015d522f475SmrgAC_TRY_LINK([ 2016d522f475Smrg#include <sys/types.h> 2017d522f475Smrg#include <${cf_cv_have_utmp}.h>],[ 2018d522f475Smrgstruct $cf_cv_have_utmp x; 2019d522f475Smrg set${cf_prefix}ent (); 2020d522f475Smrg get${cf_prefix}id(&x); 2021d522f475Smrg put${cf_prefix}line(&x); 2022d522f475Smrg end${cf_prefix}ent();], 2023d522f475Smrg [cf_cv_sysv_utmp=yes], 2024d522f475Smrg [cf_cv_sysv_utmp=no]) 2025d522f475Smrg]) 2026d522f475Smrgtest $cf_cv_sysv_utmp = yes && AC_DEFINE(USE_SYSV_UTMP) 2027d522f475Smrg])dnl 2028d522f475Smrgdnl --------------------------------------------------------------------------- 2029d522f475Smrgdnl CF_SYS_ERRLIST version: 6 updated: 2001/12/30 13:03:23 2030d522f475Smrgdnl -------------- 2031d522f475Smrgdnl Check for declaration of sys_nerr and sys_errlist in one of stdio.h and 2032d522f475Smrgdnl errno.h. Declaration of sys_errlist on BSD4.4 interferes with our 2033d522f475Smrgdnl declaration. Reported by Keith Bostic. 2034d522f475SmrgAC_DEFUN([CF_SYS_ERRLIST], 2035d522f475Smrg[ 2036d522f475Smrg CF_CHECK_ERRNO(sys_nerr) 2037d522f475Smrg CF_CHECK_ERRNO(sys_errlist) 2038d522f475Smrg])dnl 2039d522f475Smrgdnl --------------------------------------------------------------------------- 2040d522f475Smrgdnl CF_TERMIO_C_ISPEED version: 2 updated: 2000/05/29 16:16:04 2041d522f475Smrgdnl ------------------ 2042d522f475Smrgdnl Check for SGI's broken redefinition of baud rates introduced in IRIX 6.5 2043d522f475Smrgdnl (there doesn't appear to be a useful predefined symbol). 2044d522f475SmrgAC_DEFUN([CF_TERMIO_C_ISPEED], 2045d522f475Smrg[ 2046d522f475SmrgAC_CACHE_CHECK(for IRIX 6.5 baud-rate redefinitions,cf_cv_termio_c_ispeed,[ 2047d522f475SmrgAC_TRY_COMPILE([ 2048d522f475Smrg#include <sys/types.h> 2049d522f475Smrg#include <sys/termio.h>],[ 2050d522f475Smrgstruct termio foo; 2051d522f475Smrgfoo.c_ispeed = B38400; 2052d522f475Smrgfoo.c_ospeed = B9600; 2053d522f475Smrg],[cf_cv_termio_c_ispeed=yes 2054d522f475Smrg],[cf_cv_termio_c_ispeed=no]) 2055d522f475Smrg]) 2056d522f475Smrgtest "$cf_cv_termio_c_ispeed" = yes && AC_DEFINE(HAVE_TERMIO_C_ISPEED) 2057d522f475Smrg])dnl 2058d522f475Smrgdnl --------------------------------------------------------------------------- 205920d2c4d2Smrgdnl CF_TRY_PKG_CONFIG version: 4 updated: 2010/06/14 17:42:30 206020d2c4d2Smrgdnl ----------------- 206120d2c4d2Smrgdnl This is a simple wrapper to use for pkg-config, for libraries which may be 206220d2c4d2Smrgdnl available in that form. 206320d2c4d2Smrgdnl 206420d2c4d2Smrgdnl $1 = package name 206520d2c4d2Smrgdnl $2 = extra logic to use, if any, after updating CFLAGS and LIBS 206620d2c4d2Smrgdnl $3 = logic to use if pkg-config does not have the package 206720d2c4d2SmrgAC_DEFUN([CF_TRY_PKG_CONFIG],[ 206820d2c4d2SmrgAC_REQUIRE([CF_PKG_CONFIG]) 206920d2c4d2Smrg 207020d2c4d2Smrgif test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists $1; then 207120d2c4d2Smrg CF_VERBOSE(found package $1) 207220d2c4d2Smrg cf_pkgconfig_incs="`$PKG_CONFIG --cflags $1 2>/dev/null`" 207320d2c4d2Smrg cf_pkgconfig_libs="`$PKG_CONFIG --libs $1 2>/dev/null`" 207420d2c4d2Smrg CF_VERBOSE(package $1 CFLAGS: $cf_pkgconfig_incs) 207520d2c4d2Smrg CF_VERBOSE(package $1 LIBS: $cf_pkgconfig_libs) 207620d2c4d2Smrg CF_ADD_CFLAGS($cf_pkgconfig_incs) 207720d2c4d2Smrg CF_ADD_LIBS($cf_pkgconfig_libs) 207820d2c4d2Smrg ifelse([$2],,:,[$2]) 207920d2c4d2Smrgelse 208020d2c4d2Smrg ifelse([$3],,:,[$3]) 208120d2c4d2Smrgfi 208220d2c4d2Smrg]) 208320d2c4d2Smrgdnl --------------------------------------------------------------------------- 2084d522f475Smrgdnl CF_TTY_GROUP version: 7 updated: 2007/03/14 16:43:59 2085d522f475Smrgdnl ------------ 2086d522f475Smrgdnl Check if the system has a tty-group defined. This is used in xterm when 2087d522f475Smrgdnl setting pty ownership. 2088d522f475SmrgAC_DEFUN([CF_TTY_GROUP], 2089d522f475Smrg[ 2090d522f475SmrgAC_MSG_CHECKING(for explicit tty group name) 2091d522f475SmrgAC_ARG_WITH(tty-group, 2092d522f475Smrg [ --with-tty-group=XXX use XXX for the tty-group], 2093d522f475Smrg [cf_tty_group=$withval], 2094d522f475Smrg [cf_tty_group=auto...]) 2095d522f475Smrgtest -z "$cf_tty_group" && cf_tty_group=auto... 2096d522f475Smrgtest "$cf_tty_group" = yes && cf_tty_group=auto... 2097d522f475SmrgAC_MSG_RESULT($cf_tty_group) 2098d522f475Smrg 2099d522f475Smrgif test "$cf_tty_group" = "auto..." ; then 2100d522f475SmrgAC_CACHE_CHECK(for tty group name,cf_cv_tty_group_name,[ 2101d522f475Smrg 2102d522f475Smrg# If we are configuring as root, it is hard to get a clue about the tty group. 2103d522f475Smrg# But we'll guess based on how our connection is set up - assuming it is done 2104d522f475Smrg# properly. 2105d522f475Smrg 2106d522f475Smrgcf_uid=`id | sed -e 's/^[^=]*=//' -e 's/(.*$//'` 2107d522f475Smrg# )vi 2108d522f475Smrgif test "$cf_uid" != 0 ; then 2109d522f475Smrgcf_cv_tty_group_name= 2110d522f475Smrgcf_tty_name=`tty` 2111d522f475Smrgtest "$cf_tty_name" = "not a tty" && cf_tty_name=/dev/tty 2112d522f475Smrgtest -z "$cf_tty_name" && cf_tty_name=/dev/tty 2113d522f475Smrgif test -c "$cf_tty_name" 2114d522f475Smrgthen 2115d522f475Smrg cf_option="-l -L" 2116d522f475Smrg 2117d522f475Smrg # Expect listing to have fields like this: 2118d522f475Smrg #-rwxrwxrwx 1 user group 34293 Jul 18 16:29 pathname 2119d522f475Smrg ls $cf_option $cf_tty_name >conftest.out 2120d522f475Smrg read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest <conftest.out 2121d522f475Smrg if test -z "$cf_rest" ; then 2122d522f475Smrg cf_option="$cf_option -g" 2123d522f475Smrg ls $cf_option $cf_tty_name >conftest.out 2124d522f475Smrg read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest <conftest.out 2125d522f475Smrg fi 2126d522f475Smrg rm -f conftest.out 2127d522f475Smrg cf_cv_tty_group_name=$cf_grp 2128d522f475Smrgfi 2129d522f475Smrgfi 2130d522f475Smrg 2131d522f475Smrg# If we cannot deduce the tty group, fall back on hardcoded cases 2132d522f475Smrg 2133d522f475Smrgif test -z "$cf_cv_tty_group_name" 2134d522f475Smrgthen 2135d522f475Smrgcase $host_os in #(vi 2136d522f475Smrgosf*) #(vi 2137d522f475Smrg cf_cv_tty_group_name="terminal" 2138d522f475Smrg ;; 2139d522f475Smrg*) 2140d522f475Smrg cf_cv_tty_group_name="unknown" 2141d522f475Smrg if ( egrep '^tty:' /etc/group 2>/dev/null 1>/dev/null ) then 2142d522f475Smrg cf_cv_tty_group_name="tty" 2143d522f475Smrg fi 2144d522f475Smrg ;; 2145d522f475Smrgesac 2146d522f475Smrgfi 2147d522f475Smrg]) 2148d522f475Smrgcf_tty_group="$cf_cv_tty_group_name" 2149d522f475Smrgelse 2150d522f475Smrg # if configure option, always do this 2151d522f475Smrg AC_DEFINE(USE_TTY_GROUP) 2152d522f475Smrgfi 2153d522f475Smrg 2154d522f475SmrgAC_DEFINE_UNQUOTED(TTY_GROUP_NAME,"$cf_tty_group") 2155d522f475Smrg 2156d522f475Smrg# This is only a double-check that the group-name we obtained above really 2157d522f475Smrg# does apply to the device. We cannot perform this test if we are in batch 2158d522f475Smrg# mode, or if we are cross-compiling. 2159d522f475Smrg 2160d522f475SmrgAC_CACHE_CHECK(if we may use the $cf_tty_group group,cf_cv_tty_group,[ 2161d522f475Smrgcf_tty_name=`tty` 2162d522f475Smrgif test "$cf_tty_name" != "not a tty" 2163d522f475Smrgthen 2164d522f475SmrgAC_TRY_RUN([ 2165d522f475Smrg#include <unistd.h> 2166d522f475Smrg#include <sys/types.h> 2167d522f475Smrg#include <sys/stat.h> 2168d522f475Smrg#include <grp.h> 2169d522f475Smrgint main() 2170d522f475Smrg{ 2171d522f475Smrg struct stat sb; 2172d522f475Smrg struct group *ttygrp = getgrnam(TTY_GROUP_NAME); 2173d522f475Smrg char *name = ttyname(0); 2174d522f475Smrg 2175d522f475Smrg endgrent(); 2176d522f475Smrg if (ttygrp != 0 2177d522f475Smrg && name != 0 2178d522f475Smrg && stat(name, &sb) == 0 2179d522f475Smrg && sb.st_gid != getgid() 2180d522f475Smrg && sb.st_gid == ttygrp->gr_gid) { 2181d522f475Smrg ${cf_cv_main_return:-return} (0); 2182d522f475Smrg } 2183d522f475Smrg ${cf_cv_main_return:-return} (1); 2184d522f475Smrg} 2185d522f475Smrg ], 2186d522f475Smrg [cf_cv_tty_group=yes], 2187d522f475Smrg [cf_cv_tty_group=no], 2188d522f475Smrg [cf_cv_tty_group=unknown]) 2189d522f475Smrgelif test "$cross_compiling" = yes; then 2190d522f475Smrg cf_cv_tty_group=unknown 2191d522f475Smrgelse 2192d522f475Smrg cf_cv_tty_group=yes 2193d522f475Smrgfi 2194d522f475Smrg]) 2195d522f475Smrg 2196d522f475Smrgif test $cf_cv_tty_group = no ; then 2197d522f475Smrg AC_MSG_WARN(Cannot use $cf_tty_group group) 2198d522f475Smrgelse 2199d522f475Smrg AC_DEFINE(USE_TTY_GROUP) 2200d522f475Smrgfi 2201d522f475Smrg])dnl 2202d522f475Smrgdnl --------------------------------------------------------------------------- 22032eaa94a1Schristosdnl CF_TYPE_FD_MASK version: 2 updated: 2008/03/25 20:59:57 2204d522f475Smrgdnl --------------- 2205d522f475Smrgdnl Check for the declaration of fd_mask, which is like fd_set, associated 2206d522f475Smrgdnl with select(). The check for fd_set should have pulled in this as well, 2207d522f475Smrgdnl but there is a special case for Mac OS X, possibly other BSD-derived 2208d522f475Smrgdnl platforms. 2209d522f475SmrgAC_DEFUN([CF_TYPE_FD_MASK], 2210d522f475Smrg[ 2211d522f475SmrgAC_REQUIRE([CF_TYPE_FD_SET]) 2212d522f475Smrg 2213d522f475SmrgAC_CACHE_CHECK(for declaration of fd_mask,cf_cv_type_fd_mask,[ 2214d522f475Smrg if test x$cf_cv_type_fd_set = xX11/Xpoll.h ; then 2215d522f475Smrg AC_TRY_COMPILE([ 2216d522f475Smrg#include <X11/Xpoll.h>],[fd_mask x],, 2217d522f475Smrg [CF_MSG_LOG(if we must define CSRG_BASED) 2218d522f475Smrg# Xosdefs.h on Mac OS X may not define this (but it should). 2219d522f475Smrg AC_TRY_COMPILE([ 2220d522f475Smrg#define CSRG_BASED 2221d522f475Smrg#include <X11/Xpoll.h>],[fd_mask x], 2222d522f475Smrg cf_cv_type_fd_mask=CSRG_BASED)]) 2223d522f475Smrg else 2224d522f475Smrg cf_cv_type_fd_mask=$cf_cv_type_fd_set 2225d522f475Smrg fi 2226d522f475Smrg]) 2227d522f475Smrgif test x$cf_cv_type_fd_mask = xCSRG_BASED ; then 2228d522f475Smrg AC_DEFINE(CSRG_BASED) 2229d522f475Smrgfi 2230d522f475Smrg])dnl 2231d522f475Smrgdnl --------------------------------------------------------------------------- 2232d522f475Smrgdnl CF_TYPE_FD_SET version: 4 updated: 2008/03/25 20:56:03 2233d522f475Smrgdnl -------------- 2234d522f475Smrgdnl Check for the declaration of fd_set. Some platforms declare it in 2235d522f475Smrgdnl <sys/types.h>, and some in <sys/select.h>, which requires <sys/types.h>. 2236d522f475Smrgdnl Finally, if we are using this for an X application, Xpoll.h may include 2237d522f475Smrgdnl <sys/select.h>, so we don't want to do it twice. 2238d522f475SmrgAC_DEFUN([CF_TYPE_FD_SET], 2239d522f475Smrg[ 2240d522f475SmrgAC_CHECK_HEADERS(X11/Xpoll.h) 2241d522f475Smrg 2242d522f475SmrgAC_CACHE_CHECK(for declaration of fd_set,cf_cv_type_fd_set, 2243d522f475Smrg [CF_MSG_LOG(sys/types alone) 2244d522f475SmrgAC_TRY_COMPILE([ 2245d522f475Smrg#include <sys/types.h>], 2246d522f475Smrg [fd_set x], 2247d522f475Smrg [cf_cv_type_fd_set=sys/types.h], 2248d522f475Smrg [CF_MSG_LOG(X11/Xpoll.h) 2249d522f475SmrgAC_TRY_COMPILE([ 2250d522f475Smrg#ifdef HAVE_X11_XPOLL_H 2251d522f475Smrg#include <X11/Xpoll.h> 2252d522f475Smrg#endif], 2253d522f475Smrg [fd_set x], 2254d522f475Smrg [cf_cv_type_fd_set=X11/Xpoll.h], 2255d522f475Smrg [CF_MSG_LOG(sys/select.h) 2256d522f475SmrgAC_TRY_COMPILE([ 2257d522f475Smrg#include <sys/types.h> 2258d522f475Smrg#include <sys/select.h>], 2259d522f475Smrg [fd_set x], 2260d522f475Smrg [cf_cv_type_fd_set=sys/select.h], 2261d522f475Smrg [cf_cv_type_fd_set=unknown])])])]) 2262d522f475Smrgif test $cf_cv_type_fd_set = sys/select.h ; then 2263d522f475Smrg AC_DEFINE(USE_SYS_SELECT_H) 2264d522f475Smrgfi 2265d522f475Smrg]) 2266d522f475Smrgdnl --------------------------------------------------------------------------- 2267d522f475Smrgdnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59 2268d522f475Smrgdnl -------- 2269d522f475Smrgdnl Make an uppercase version of a variable 2270d522f475Smrgdnl $1=uppercase($2) 2271d522f475SmrgAC_DEFUN([CF_UPPER], 2272d522f475Smrg[ 2273d522f475Smrg$1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` 2274d522f475Smrg])dnl 2275d522f475Smrgdnl --------------------------------------------------------------------------- 227620d2c4d2Smrgdnl CF_UTEMPTER version: 3 updated: 2010/06/02 05:03:05 2277d522f475Smrgdnl ----------- 2278d522f475Smrgdnl Try to link with utempter library 2279d522f475SmrgAC_DEFUN([CF_UTEMPTER], 2280d522f475Smrg[ 2281d522f475SmrgAC_CACHE_CHECK(if we can link with utempter library,cf_cv_have_utempter,[ 2282d522f475Smrgcf_save_LIBS="$LIBS" 228320d2c4d2SmrgCF_ADD_LIB(utempter) 2284d522f475SmrgAC_TRY_LINK([ 2285d522f475Smrg#include <utempter.h> 2286d522f475Smrg],[ 2287d522f475Smrg addToUtmp("/dev/tty", 0, 1); 2288d522f475Smrg removeFromUtmp(); 2289d522f475Smrg],[ 2290d522f475Smrg cf_cv_have_utempter=yes],[ 2291d522f475Smrg cf_cv_have_utempter=no]) 2292d522f475SmrgLIBS="$cf_save_LIBS" 2293d522f475Smrg]) 2294d522f475Smrgif test "$cf_cv_have_utempter" = yes ; then 2295d522f475Smrg AC_DEFINE(USE_UTEMPTER) 229620d2c4d2Smrg CF_ADD_LIB(utempter) 2297d522f475Smrgfi 2298d522f475Smrg])dnl 2299d522f475Smrgdnl --------------------------------------------------------------------------- 2300d522f475Smrgdnl CF_UTMP version: 9 updated: 2008/01/25 17:18:00 2301d522f475Smrgdnl ------- 2302d522f475Smrgdnl Check for UTMP/UTMPX headers 2303d522f475SmrgAC_DEFUN([CF_UTMP], 2304d522f475Smrg[ 2305d522f475SmrgAC_REQUIRE([CF_LASTLOG]) 2306d522f475Smrg 2307d522f475SmrgAC_CACHE_CHECK(for utmp implementation,cf_cv_have_utmp,[ 2308d522f475Smrg cf_cv_have_utmp=no 2309d522f475Smrgfor cf_header in utmpx utmp ; do 2310d522f475Smrgcf_utmp_includes=" 2311d522f475Smrg#include <sys/types.h> 2312d522f475Smrg#include <${cf_header}.h> 2313d522f475Smrg#define getutent getutxent 2314d522f475Smrg#ifdef USE_LASTLOG 2315d522f475Smrg#include <lastlog.h> /* may conflict with utmpx.h on Linux */ 2316d522f475Smrg#endif 2317d522f475Smrg" 2318d522f475Smrg AC_TRY_COMPILE([$cf_utmp_includes], 2319d522f475Smrg [struct $cf_header x; 2320d522f475Smrg char *name = x.ut_name; /* utmp.h and compatible definitions */ 2321d522f475Smrg ], 2322d522f475Smrg [cf_cv_have_utmp=$cf_header 2323d522f475Smrg break], 2324d522f475Smrg [ 2325d522f475Smrg AC_TRY_COMPILE([$cf_utmp_includes], 2326d522f475Smrg [struct $cf_header x; 2327d522f475Smrg char *name = x.ut_user; /* utmpx.h must declare this */ 2328d522f475Smrg ], 2329d522f475Smrg [cf_cv_have_utmp=$cf_header 2330d522f475Smrg break 2331d522f475Smrg ])]) 2332d522f475Smrgdone 2333d522f475Smrg]) 2334d522f475Smrg 2335d522f475Smrgif test $cf_cv_have_utmp != no ; then 2336d522f475Smrg AC_DEFINE(HAVE_UTMP) 2337d522f475Smrg test $cf_cv_have_utmp = utmpx && AC_DEFINE(UTMPX_FOR_UTMP) 2338d522f475Smrg CF_UTMP_UT_HOST 2339d522f475Smrg CF_UTMP_UT_SYSLEN 2340d522f475Smrg CF_UTMP_UT_NAME 2341d522f475Smrg CF_UTMP_UT_XSTATUS 2342d522f475Smrg CF_UTMP_UT_XTIME 2343d522f475Smrg CF_UTMP_UT_SESSION 2344d522f475Smrg CF_SYSV_UTMP 2345d522f475Smrgfi 2346d522f475Smrg])dnl 2347d522f475Smrgdnl --------------------------------------------------------------------------- 2348d522f475Smrgdnl CF_UTMP_GROUP version: 1 updated: 2005/10/06 20:29:29 2349d522f475Smrgdnl ------------- 2350d522f475Smrgdnl Find the utmp/utmpx file and determine its group to allow setgid programs 2351d522f475Smrgdnl to manipulate it, e.g., when there is no intermediary. 2352d522f475SmrgAC_DEFUN([CF_UTMP_GROUP],[ 2353d522f475SmrgAC_REQUIRE([CF_UTMP]) 2354d522f475Smrgif test $cf_cv_have_utmp != no ; then 2355d522f475SmrgAC_CACHE_CHECK(for utmp/utmpx group,cf_cv_utmp_group,[ 2356d522f475Smrgfor cf_utmp_path in /var/adm /var/run 2357d522f475Smrgdo 2358d522f475Smrg for cf_utmp_file in utmpx utmp 2359d522f475Smrg do 2360d522f475Smrg if test -f $cf_utmp_path/$cf_utmp_file 2361d522f475Smrg then 2362d522f475Smrg cf_cv_utmp_group=root 2363d522f475Smrg 2364d522f475Smrg cf_option="-l -L" 2365d522f475Smrg 2366d522f475Smrg # Expect listing to have fields like this: 2367d522f475Smrg #-r--r--r-- 1 user group 34293 Jul 18 16:29 pathname 2368d522f475Smrg ls $cf_option $cf_utmp_path/$cf_utmp_file >conftest 2369d522f475Smrg read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest <conftest 2370d522f475Smrg if test -z "$cf_rest" ; then 2371d522f475Smrg cf_option="$cf_option -g" 2372d522f475Smrg ls $cf_option $cf_utmp_path/$cf_utmp_file >conftest 2373d522f475Smrg read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest <conftest 2374d522f475Smrg fi 2375d522f475Smrg rm -f conftest 2376d522f475Smrg 2377d522f475Smrg # If we have a pathname, and the date fields look right, assume we've 2378d522f475Smrg # captured the group as well. 2379d522f475Smrg if test -n "$cf_rest" ; then 2380d522f475Smrg cf_test=`echo "${cf_date2}${cf_date3}" | sed -e 's/[[0-9:]]//g'` 2381d522f475Smrg if test -z "$cf_test" ; then 2382d522f475Smrg cf_cv_utmp_group=$cf_grp; 2383d522f475Smrg fi 2384d522f475Smrg fi 2385d522f475Smrg break 2386d522f475Smrg fi 2387d522f475Smrg done 2388d522f475Smrg test -n "$cf_cv_utmp_group" && break 2389d522f475Smrgdone 2390d522f475Smrg]) 2391d522f475Smrgelse 2392d522f475Smrg AC_MSG_ERROR(cannot find utmp group) 2393d522f475Smrgfi 2394d522f475Smrg])dnl 2395d522f475Smrgdnl --------------------------------------------------------------------------- 2396d522f475Smrgdnl CF_UTMP_UT_HOST version: 7 updated: 2007/03/13 19:17:11 2397d522f475Smrgdnl --------------- 2398d522f475Smrgdnl Check if UTMP/UTMPX struct defines ut_host member 2399d522f475SmrgAC_DEFUN([CF_UTMP_UT_HOST], 2400d522f475Smrg[ 2401d522f475Smrgif test $cf_cv_have_utmp != no ; then 2402d522f475SmrgAC_MSG_CHECKING(if ${cf_cv_have_utmp}.ut_host is declared) 2403d522f475SmrgAC_CACHE_VAL(cf_cv_have_utmp_ut_host,[ 2404d522f475Smrg AC_TRY_COMPILE([ 2405d522f475Smrg#include <sys/types.h> 2406d522f475Smrg#include <${cf_cv_have_utmp}.h>], 2407d522f475Smrg [struct $cf_cv_have_utmp x; char *y = &x.ut_host[0]], 2408d522f475Smrg [cf_cv_have_utmp_ut_host=yes], 2409d522f475Smrg [cf_cv_have_utmp_ut_host=no]) 2410d522f475Smrg ]) 2411d522f475SmrgAC_MSG_RESULT($cf_cv_have_utmp_ut_host) 2412d522f475Smrgtest $cf_cv_have_utmp_ut_host != no && AC_DEFINE(HAVE_UTMP_UT_HOST) 2413d522f475Smrgfi 2414d522f475Smrg])dnl 2415d522f475Smrgdnl --------------------------------------------------------------------------- 2416d522f475Smrgdnl CF_UTMP_UT_NAME version: 4 updated: 2007/03/13 19:17:11 2417d522f475Smrgdnl --------------- 2418d522f475Smrgdnl Check if UTMP/UTMPX struct defines ut_name member 2419d522f475SmrgAC_DEFUN([CF_UTMP_UT_NAME], 2420d522f475Smrg[ 2421d522f475Smrgif test $cf_cv_have_utmp != no ; then 2422d522f475SmrgAC_CACHE_CHECK(if ${cf_cv_have_utmp}.ut_name is declared,cf_cv_have_utmp_ut_name,[ 2423d522f475Smrg cf_cv_have_utmp_ut_name=no 2424d522f475Smrgcf_utmp_includes=" 2425d522f475Smrg#include <sys/types.h> 2426d522f475Smrg#include <${cf_cv_have_utmp}.h> 2427d522f475Smrg#define getutent getutxent 2428d522f475Smrg#ifdef USE_LASTLOG 2429d522f475Smrg#include <lastlog.h> /* may conflict with utmpx.h on Linux */ 2430d522f475Smrg#endif 2431d522f475Smrg" 2432d522f475Smrgfor cf_header in ut_name ut_user ; do 2433d522f475Smrg AC_TRY_COMPILE([$cf_utmp_includes], 2434d522f475Smrg [struct $cf_cv_have_utmp x; 2435d522f475Smrg char *name = x.$cf_header; 2436d522f475Smrg ], 2437d522f475Smrg [cf_cv_have_utmp_ut_name=$cf_header 2438d522f475Smrg break]) 2439d522f475Smrgdone 2440d522f475Smrg]) 2441d522f475Smrg 2442d522f475Smrgcase $cf_cv_have_utmp_ut_name in #(vi 2443d522f475Smrgno) #(vi 2444d522f475Smrg AC_MSG_ERROR(Cannot find declaration for ut.ut_name) 2445d522f475Smrg ;; 2446d522f475Smrgut_user) 2447d522f475Smrg AC_DEFINE(ut_name,ut_user) 2448d522f475Smrg ;; 2449d522f475Smrgesac 2450d522f475Smrgfi 2451d522f475Smrg])dnl 2452d522f475Smrgdnl --------------------------------------------------------------------------- 2453d522f475Smrgdnl CF_UTMP_UT_SESSION version: 5 updated: 2007/03/13 19:17:11 2454d522f475Smrgdnl ------------------ 2455d522f475Smrgdnl Check if UTMP/UTMPX struct defines ut_session member 2456d522f475SmrgAC_DEFUN([CF_UTMP_UT_SESSION], 2457d522f475Smrg[ 2458d522f475Smrgif test $cf_cv_have_utmp != no ; then 2459d522f475SmrgAC_CACHE_CHECK(if ${cf_cv_have_utmp}.ut_session is declared, cf_cv_have_utmp_ut_session,[ 2460d522f475Smrg AC_TRY_COMPILE([ 2461d522f475Smrg#include <sys/types.h> 2462d522f475Smrg#include <${cf_cv_have_utmp}.h>], 2463d522f475Smrg [struct $cf_cv_have_utmp x; long y = x.ut_session], 2464d522f475Smrg [cf_cv_have_utmp_ut_session=yes], 2465d522f475Smrg [cf_cv_have_utmp_ut_session=no]) 2466d522f475Smrg]) 2467d522f475Smrgif test $cf_cv_have_utmp_ut_session != no ; then 2468d522f475Smrg AC_DEFINE(HAVE_UTMP_UT_SESSION) 2469d522f475Smrgfi 2470d522f475Smrgfi 2471d522f475Smrg])dnl 2472d522f475Smrgdnl --------------------------------------------------------------------------- 2473d522f475Smrgdnl CF_UTMP_UT_SYSLEN version: 1 updated: 2008/01/25 17:18:00 2474d522f475Smrgdnl ----------------- 2475d522f475Smrgdnl Check if UTMP/UTMPX struct defines ut_syslen member 2476d522f475SmrgAC_DEFUN([CF_UTMP_UT_SYSLEN], 2477d522f475Smrg[ 2478d522f475Smrgif test $cf_cv_have_utmp != no ; then 2479d522f475SmrgAC_MSG_CHECKING(if ${cf_cv_have_utmp}.ut_syslen is declared) 2480d522f475SmrgAC_CACHE_VAL(cf_cv_have_utmp_ut_syslen,[ 2481d522f475Smrg AC_TRY_COMPILE([ 2482d522f475Smrg#include <sys/types.h> 2483d522f475Smrg#include <${cf_cv_have_utmp}.h>], 2484d522f475Smrg [struct $cf_cv_have_utmp x; int y = x.ut_syslen], 2485d522f475Smrg [cf_cv_have_utmp_ut_syslen=yes], 2486d522f475Smrg [cf_cv_have_utmp_ut_syslen=no]) 2487d522f475Smrg ]) 2488d522f475SmrgAC_MSG_RESULT($cf_cv_have_utmp_ut_syslen) 2489d522f475Smrgtest $cf_cv_have_utmp_ut_syslen != no && AC_DEFINE(HAVE_UTMP_UT_SYSLEN) 2490d522f475Smrgfi 2491d522f475Smrg])dnl 2492d522f475Smrgdnl --------------------------------------------------------------------------- 2493d522f475Smrgdnl CF_UTMP_UT_XSTATUS version: 3 updated: 2001/12/27 12:55:07 2494d522f475Smrgdnl ------------------ 2495d522f475Smrgdnl Check for known variants on the UTMP/UTMPX struct's exit-status as reported 2496d522f475Smrgdnl by various people: 2497d522f475Smrgdnl 2498d522f475Smrgdnl ut_exit.__e_exit (HPUX 11 - David Ellement, also in glibc2) 2499d522f475Smrgdnl ut_exit.e_exit (SVR4) 2500d522f475Smrgdnl ut_exit.ut_e_exit (os390 - Greg Smith) 2501d522f475Smrgdnl ut_exit.ut_exit (Tru64 4.0f - Jeremie Petit, 4.0e - Tomas Vanhala) 2502d522f475Smrgdnl 2503d522f475Smrgdnl Note: utmp_xstatus is not a conventional compatibility definition in the 2504d522f475Smrgdnl system header files. 2505d522f475SmrgAC_DEFUN([CF_UTMP_UT_XSTATUS], 2506d522f475Smrg[ 2507d522f475Smrgif test $cf_cv_have_utmp != no ; then 2508d522f475SmrgAC_CACHE_CHECK(for exit-status in $cf_cv_have_utmp,cf_cv_have_utmp_ut_xstatus,[ 2509d522f475Smrgfor cf_result in \ 2510d522f475Smrg ut_exit.__e_exit \ 2511d522f475Smrg ut_exit.e_exit \ 2512d522f475Smrg ut_exit.ut_e_exit \ 2513d522f475Smrg ut_exit.ut_exit 2514d522f475Smrgdo 2515d522f475SmrgAC_TRY_COMPILE([ 2516d522f475Smrg#include <sys/types.h> 2517d522f475Smrg#include <${cf_cv_have_utmp}.h>], 2518d522f475Smrg [struct $cf_cv_have_utmp x; long y = x.$cf_result = 0], 2519d522f475Smrg [cf_cv_have_utmp_ut_xstatus=$cf_result 2520d522f475Smrg break], 2521d522f475Smrg [cf_cv_have_utmp_ut_xstatus=no]) 2522d522f475Smrgdone 2523d522f475Smrg]) 2524d522f475Smrgif test $cf_cv_have_utmp_ut_xstatus != no ; then 2525d522f475Smrg AC_DEFINE(HAVE_UTMP_UT_XSTATUS) 2526d522f475Smrg AC_DEFINE_UNQUOTED(ut_xstatus,$cf_cv_have_utmp_ut_xstatus) 2527d522f475Smrgfi 2528d522f475Smrgfi 2529d522f475Smrg])dnl 2530d522f475Smrgdnl --------------------------------------------------------------------------- 2531d522f475Smrgdnl CF_UTMP_UT_XTIME version: 7 updated: 2007/03/13 19:17:11 2532d522f475Smrgdnl ---------------- 2533d522f475Smrgdnl Check if UTMP/UTMPX struct defines ut_xtime member 2534d522f475SmrgAC_DEFUN([CF_UTMP_UT_XTIME], 2535d522f475Smrg[ 2536d522f475Smrgif test $cf_cv_have_utmp != no ; then 2537d522f475SmrgAC_CACHE_CHECK(if ${cf_cv_have_utmp}.ut_xtime is declared, cf_cv_have_utmp_ut_xtime,[ 2538d522f475Smrg AC_TRY_COMPILE([ 2539d522f475Smrg#include <sys/types.h> 2540d522f475Smrg#include <${cf_cv_have_utmp}.h>], 2541d522f475Smrg [struct $cf_cv_have_utmp x; long y = x.ut_xtime = 0], 2542d522f475Smrg [cf_cv_have_utmp_ut_xtime=yes], 2543d522f475Smrg [AC_TRY_COMPILE([ 2544d522f475Smrg#include <sys/types.h> 2545d522f475Smrg#include <${cf_cv_have_utmp}.h>], 2546d522f475Smrg [struct $cf_cv_have_utmp x; long y = x.ut_tv.tv_sec], 2547d522f475Smrg [cf_cv_have_utmp_ut_xtime=define], 2548d522f475Smrg [cf_cv_have_utmp_ut_xtime=no]) 2549d522f475Smrg ]) 2550d522f475Smrg]) 2551d522f475Smrgif test $cf_cv_have_utmp_ut_xtime != no ; then 2552d522f475Smrg AC_DEFINE(HAVE_UTMP_UT_XTIME) 2553d522f475Smrg if test $cf_cv_have_utmp_ut_xtime = define ; then 2554d522f475Smrg AC_DEFINE(ut_xtime,ut_tv.tv_sec) 2555d522f475Smrg fi 2556d522f475Smrgfi 2557d522f475Smrgfi 2558d522f475Smrg])dnl 2559d522f475Smrgdnl --------------------------------------------------------------------------- 2560d522f475Smrgdnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12 2561d522f475Smrgdnl ---------- 2562d522f475Smrgdnl Use AC_VERBOSE w/o the warnings 2563d522f475SmrgAC_DEFUN([CF_VERBOSE], 2564d522f475Smrg[test -n "$verbose" && echo " $1" 1>&AC_FD_MSG 2565d522f475SmrgCF_MSG_LOG([$1]) 2566d522f475Smrg])dnl 2567d522f475Smrgdnl --------------------------------------------------------------------------- 256820d2c4d2Smrgdnl CF_WITH_IMAKE_CFLAGS version: 9 updated: 2010/05/26 05:38:42 2569d522f475Smrgdnl -------------------- 2570d522f475Smrgdnl xterm and similar programs build more readily when propped up with imake's 2571d522f475Smrgdnl hand-tuned definitions. If we do not use imake, provide fallbacks for the 2572d522f475Smrgdnl most common definitions that we're not likely to do by autoconf tests. 2573d522f475SmrgAC_DEFUN([CF_WITH_IMAKE_CFLAGS],[ 2574d522f475SmrgAC_REQUIRE([CF_ENABLE_NARROWPROTO]) 2575d522f475Smrg 2576d522f475SmrgAC_MSG_CHECKING(if we should use imake to help) 2577d522f475SmrgCF_ARG_DISABLE(imake, 2578d522f475Smrg [ --disable-imake disable use of imake for definitions], 2579d522f475Smrg [enable_imake=no], 2580d522f475Smrg [enable_imake=yes]) 2581d522f475SmrgAC_MSG_RESULT($enable_imake) 2582d522f475Smrg 2583d522f475Smrgif test "$enable_imake" = yes ; then 258420d2c4d2Smrg CF_IMAKE_CFLAGS(ifelse([$1],,,[$1])) 2585d522f475Smrgfi 2586d522f475Smrg 2587d522f475Smrgif test -n "$IMAKE" && test -n "$IMAKE_CFLAGS" ; then 2588d522f475Smrg CF_ADD_CFLAGS($IMAKE_CFLAGS) 2589d522f475Smrgelse 2590d522f475Smrg IMAKE_CFLAGS= 2591d522f475Smrg IMAKE_LOADFLAGS= 2592d522f475Smrg CF_VERBOSE(make fallback definitions) 2593d522f475Smrg 2594d522f475Smrg # We prefer config.guess' values when we can get them, to avoid 2595d522f475Smrg # inconsistent results with uname (AIX for instance). However, 2596d522f475Smrg # config.guess is not always consistent either. 2597d522f475Smrg case $host_os in 2598d522f475Smrg *[[0-9]].[[0-9]]*) 2599d522f475Smrg UNAME_RELEASE="$host_os" 2600d522f475Smrg ;; 2601d522f475Smrg *) 2602d522f475Smrg UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown 2603d522f475Smrg ;; 2604d522f475Smrg esac 2605d522f475Smrg 2606d522f475Smrg case .$UNAME_RELEASE in 2607d522f475Smrg *[[0-9]].[[0-9]]*) 2608d522f475Smrg OSMAJORVERSION=`echo "$UNAME_RELEASE" |sed -e 's/^[[^0-9]]*//' -e 's/\..*//'` 2609d522f475Smrg OSMINORVERSION=`echo "$UNAME_RELEASE" |sed -e 's/^[[^0-9]]*//' -e 's/^[[^.]]*\.//' -e 's/\..*//' -e 's/[[^0-9]].*//' ` 2610d522f475Smrg test -z "$OSMAJORVERSION" && OSMAJORVERSION=1 2611d522f475Smrg test -z "$OSMINORVERSION" && OSMINORVERSION=0 2612d522f475Smrg IMAKE_CFLAGS="-DOSMAJORVERSION=$OSMAJORVERSION -DOSMINORVERSION=$OSMINORVERSION $IMAKE_CFLAGS" 2613d522f475Smrg ;; 2614d522f475Smrg esac 2615d522f475Smrg 2616d522f475Smrg # FUNCPROTO is standard with X11R6, but XFree86 drops it, leaving some 2617d522f475Smrg # fallback/fragments for NeedPrototypes, etc. 2618d522f475Smrg IMAKE_CFLAGS="-DFUNCPROTO=15 $IMAKE_CFLAGS" 2619d522f475Smrg 2620d522f475Smrg # If this is not set properly, Xaw's scrollbars will not work 2621d522f475Smrg if test "$enable_narrowproto" = yes ; then 2622d522f475Smrg IMAKE_CFLAGS="-DNARROWPROTO=1 $IMAKE_CFLAGS" 2623d522f475Smrg fi 2624d522f475Smrg 2625d522f475Smrg # Other special definitions: 2626d522f475Smrg case $host_os in 2627d522f475Smrg aix*) 2628d522f475Smrg # imake on AIX 5.1 defines AIXV3. really. 2629d522f475Smrg IMAKE_CFLAGS="-DAIXV3 -DAIXV4 $IMAKE_CFLAGS" 2630d522f475Smrg ;; 2631d522f475Smrg irix[[56]].*) #(vi 2632d522f475Smrg # these are needed to make SIGWINCH work in xterm 2633d522f475Smrg IMAKE_CFLAGS="-DSYSV -DSVR4 $IMAKE_CFLAGS" 2634d522f475Smrg ;; 2635d522f475Smrg esac 2636d522f475Smrg 2637d522f475Smrg CF_ADD_CFLAGS($IMAKE_CFLAGS) 2638d522f475Smrg 2639d522f475Smrg AC_SUBST(IMAKE_CFLAGS) 2640d522f475Smrg AC_SUBST(IMAKE_LOADFLAGS) 2641d522f475Smrgfi 2642d522f475Smrg])dnl 2643d522f475Smrgdnl --------------------------------------------------------------------------- 264420d2c4d2Smrgdnl CF_WITH_PATH version: 9 updated: 2010/05/26 05:38:42 2645d522f475Smrgdnl ------------ 2646d522f475Smrgdnl Wrapper for AC_ARG_WITH to ensure that user supplies a pathname, not just 2647d522f475Smrgdnl defaulting to yes/no. 2648d522f475Smrgdnl 2649d522f475Smrgdnl $1 = option name 2650d522f475Smrgdnl $2 = help-text 2651d522f475Smrgdnl $3 = environment variable to set 2652d522f475Smrgdnl $4 = default value, shown in the help-message, must be a constant 2653d522f475Smrgdnl $5 = default value, if it's an expression & cannot be in the help-message 2654d522f475Smrgdnl 2655d522f475SmrgAC_DEFUN([CF_WITH_PATH], 265620d2c4d2Smrg[AC_ARG_WITH($1,[$2 ](default: ifelse([$4],,empty,[$4])),, 265720d2c4d2Smrgifelse([$4],,[withval="${$3}"],[withval="${$3-ifelse([$5],,[$4],[$5])}"]))dnl 265820d2c4d2Smrgif ifelse([$5],,true,[test -n "$5"]) ; then 2659d522f475SmrgCF_PATH_SYNTAX(withval) 2660d522f475Smrgfi 2661d522f475Smrg$3="$withval" 2662d522f475SmrgAC_SUBST($3)dnl 2663d522f475Smrg])dnl 2664d522f475Smrgdnl --------------------------------------------------------------------------- 266520d2c4d2Smrgdnl CF_WITH_PCRE version: 8 updated: 2010/06/05 11:30:21 2666d522f475Smrgdnl ------------ 2667d522f475Smrgdnl Add PCRE (Perl-compatible regular expressions) to the build if it is 2668d522f475Smrgdnl available and the user requests it. Assume the application will otherwise 2669d522f475Smrgdnl use the POSIX interface. 2670d522f475Smrgdnl 2671d522f475Smrgdnl TODO allow $withval to specify package location 2672d522f475SmrgAC_DEFUN([CF_WITH_PCRE], 2673d522f475Smrg[ 267420d2c4d2SmrgAC_REQUIRE([CF_PKG_CONFIG]) 267520d2c4d2Smrg 2676d522f475SmrgAC_MSG_CHECKING(if you want to use PCRE for regular-expressions) 2677d522f475SmrgAC_ARG_WITH(pcre, 2678d522f475Smrg [ --with-pcre use PCRE for regular-expressions]) 2679d522f475Smrgtest -z "$with_pcre" && with_pcre=no 2680d522f475SmrgAC_MSG_RESULT($with_pcre) 2681d522f475Smrg 2682d522f475Smrgif test "$with_pcre" != no ; then 268320d2c4d2Smrg CF_TRY_PKG_CONFIG(libpcre,,[ 268420d2c4d2Smrg AC_CHECK_LIB(pcre,pcre_compile,, 268520d2c4d2Smrg AC_MSG_ERROR(Cannot find PCRE library))]) 268620d2c4d2Smrg 268720d2c4d2Smrg AC_DEFINE(HAVE_LIB_PCRE) 268820d2c4d2Smrg 268920d2c4d2Smrg case $LIBS in #(vi 269020d2c4d2Smrg *pcreposix*) #(vi 269120d2c4d2Smrg ;; 269220d2c4d2Smrg *) 269320d2c4d2Smrg AC_CHECK_LIB(pcreposix,pcreposix_regcomp, 269420d2c4d2Smrg [AC_DEFINE(HAVE_PCREPOSIX_H) 269520d2c4d2Smrg CF_ADD_LIB(pcreposix)], 269620d2c4d2Smrg [AC_CHECK_LIB(pcreposix,regcomp,[ 269720d2c4d2Smrg AC_DEFINE(HAVE_PCREPOSIX_H) 269820d2c4d2Smrg CF_ADD_LIB(pcreposix)], 269920d2c4d2Smrg AC_MSG_ERROR(Cannot find PCRE POSIX library)])) 270020d2c4d2Smrg ;; 270120d2c4d2Smrg esac 2702d522f475Smrgfi 2703d522f475Smrg])dnl 2704d522f475Smrgdnl --------------------------------------------------------------------------- 2705956cc18dSsnjdnl CF_XKB_BELL_EXT version: 3 updated: 2009/02/13 16:00:39 2706d522f475Smrgdnl --------------- 2707d522f475Smrgdnl Check for XKB bell extension 2708d522f475SmrgAC_DEFUN([CF_XKB_BELL_EXT],[ 2709d522f475SmrgAC_CACHE_CHECK(for XKB Bell extension, cf_cv_xkb_bell_ext,[ 2710d522f475SmrgAC_TRY_LINK([ 2711956cc18dSsnj#include <X11/Intrinsic.h> 2712d522f475Smrg#include <X11/XKBlib.h> /* has the prototype */ 2713d522f475Smrg#include <X11/extensions/XKBbells.h> /* has the XkbBI_xxx definitions */ 2714d522f475Smrg],[ 2715956cc18dSsnj int x = (XkbBI_Info |XkbBI_MinorError |XkbBI_MajorError |XkbBI_TerminalBell |XkbBI_MarginBell); 2716956cc18dSsnj Atom y; 2717956cc18dSsnj XkbBell((Display *)0, (Widget)0, 0, y); 2718d522f475Smrg],[cf_cv_xkb_bell_ext=yes],[cf_cv_xkb_bell_ext=no]) 2719d522f475Smrg]) 2720d522f475Smrgtest "$cf_cv_xkb_bell_ext" = yes && AC_DEFINE(HAVE_XKB_BELL_EXT) 2721d522f475Smrg]) 2722d522f475Smrgdnl --------------------------------------------------------------------------- 272320d2c4d2Smrgdnl CF_XOPEN_SOURCE version: 34 updated: 2010/05/26 05:38:42 2724d522f475Smrgdnl --------------- 2725d522f475Smrgdnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions, 2726d522f475Smrgdnl or adapt to the vendor's definitions to get equivalent functionality, 2727d522f475Smrgdnl without losing the common non-POSIX features. 2728d522f475Smrgdnl 2729d522f475Smrgdnl Parameters: 2730d522f475Smrgdnl $1 is the nominal value for _XOPEN_SOURCE 2731d522f475Smrgdnl $2 is the nominal value for _POSIX_C_SOURCE 2732d522f475SmrgAC_DEFUN([CF_XOPEN_SOURCE],[ 2733d522f475Smrg 273420d2c4d2Smrgcf_XOPEN_SOURCE=ifelse([$1],,500,[$1]) 273520d2c4d2Smrgcf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2]) 273620d2c4d2Smrgcf_xopen_source= 2737d522f475Smrg 2738d522f475Smrgcase $host_os in #(vi 27392eaa94a1Schristosaix[[456]]*) #(vi 274020d2c4d2Smrg cf_xopen_source="-D_ALL_SOURCE" 274120d2c4d2Smrg ;; 274220d2c4d2Smrgdarwin[[0-8]].*) #(vi 274320d2c4d2Smrg cf_xopen_source="-D_APPLE_C_SOURCE" 274420d2c4d2Smrg ;; 274520d2c4d2Smrgdarwin*) #(vi 274620d2c4d2Smrg cf_xopen_source="-D_DARWIN_C_SOURCE" 2747d522f475Smrg ;; 27482eaa94a1Schristosfreebsd*|dragonfly*) #(vi 2749d522f475Smrg # 5.x headers associate 2750d522f475Smrg # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L 2751d522f475Smrg # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L 2752d522f475Smrg cf_POSIX_C_SOURCE=200112L 2753d522f475Smrg cf_XOPEN_SOURCE=600 275420d2c4d2Smrg cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" 275520d2c4d2Smrg ;; 275620d2c4d2Smrghpux11*) #(vi 275720d2c4d2Smrg cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500" 2758d522f475Smrg ;; 2759d522f475Smrghpux*) #(vi 276020d2c4d2Smrg cf_xopen_source="-D_HPUX_SOURCE" 2761d522f475Smrg ;; 2762d522f475Smrgirix[[56]].*) #(vi 276320d2c4d2Smrg cf_xopen_source="-D_SGI_SOURCE" 2764d522f475Smrg ;; 27652eaa94a1Schristoslinux*|gnu*|mint*|k*bsd*-gnu) #(vi 2766d522f475Smrg CF_GNU_SOURCE 2767d522f475Smrg ;; 2768d522f475Smrgmirbsd*) #(vi 2769d522f475Smrg # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h> 2770d522f475Smrg ;; 2771d522f475Smrgnetbsd*) #(vi 2772d522f475Smrg # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw 2773d522f475Smrg ;; 2774d522f475Smrgopenbsd*) #(vi 2775d522f475Smrg # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw 2776d522f475Smrg ;; 2777d522f475Smrgosf[[45]]*) #(vi 277820d2c4d2Smrg cf_xopen_source="-D_OSF_SOURCE" 2779d522f475Smrg ;; 2780d522f475Smrgnto-qnx*) #(vi 278120d2c4d2Smrg cf_xopen_source="-D_QNX_SOURCE" 2782d522f475Smrg ;; 2783d522f475Smrgsco*) #(vi 2784d522f475Smrg # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer 2785d522f475Smrg ;; 278620d2c4d2Smrgsolaris2.1[[0-9]]) #(vi 278720d2c4d2Smrg cf_xopen_source="-D__EXTENSIONS__ -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" 278820d2c4d2Smrg ;; 278920d2c4d2Smrgsolaris2.[[1-9]]) #(vi 279020d2c4d2Smrg cf_xopen_source="-D__EXTENSIONS__" 2791d522f475Smrg ;; 2792d522f475Smrg*) 2793d522f475Smrg AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[ 2794d522f475Smrg AC_TRY_COMPILE([#include <sys/types.h>],[ 2795d522f475Smrg#ifndef _XOPEN_SOURCE 2796d522f475Smrgmake an error 2797d522f475Smrg#endif], 2798d522f475Smrg [cf_cv_xopen_source=no], 2799d522f475Smrg [cf_save="$CPPFLAGS" 2800d522f475Smrg CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" 2801d522f475Smrg AC_TRY_COMPILE([#include <sys/types.h>],[ 2802d522f475Smrg#ifdef _XOPEN_SOURCE 2803d522f475Smrgmake an error 2804d522f475Smrg#endif], 2805d522f475Smrg [cf_cv_xopen_source=no], 2806d522f475Smrg [cf_cv_xopen_source=$cf_XOPEN_SOURCE]) 2807d522f475Smrg CPPFLAGS="$cf_save" 2808d522f475Smrg ]) 2809d522f475Smrg]) 2810d522f475Smrg if test "$cf_cv_xopen_source" != no ; then 2811d522f475Smrg CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE) 2812d522f475Smrg CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE) 281320d2c4d2Smrg cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" 281420d2c4d2Smrg CF_ADD_CFLAGS($cf_temp_xopen_source) 2815d522f475Smrg fi 2816d522f475Smrg CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) 2817d522f475Smrg ;; 2818d522f475Smrgesac 281920d2c4d2Smrg 282020d2c4d2Smrgif test -n "$cf_xopen_source" ; then 282120d2c4d2Smrg CF_ADD_CFLAGS($cf_xopen_source) 282220d2c4d2Smrgfi 2823d522f475Smrg]) 2824d522f475Smrgdnl --------------------------------------------------------------------------- 282520d2c4d2Smrgdnl CF_X_ATHENA version: 16 updated: 2010/06/14 17:42:30 2826d522f475Smrgdnl ----------- 2827d522f475Smrgdnl Check for Xaw (Athena) libraries 2828d522f475Smrgdnl 2829d522f475Smrgdnl Sets $cf_x_athena according to the flavor of Xaw which is used. 2830d522f475SmrgAC_DEFUN([CF_X_ATHENA], 283120d2c4d2Smrg[ 2832d522f475Smrgcf_x_athena=${cf_x_athena-Xaw} 2833d522f475Smrg 2834d522f475SmrgAC_MSG_CHECKING(if you want to link with Xaw 3d library) 2835d522f475Smrgwithval= 2836d522f475SmrgAC_ARG_WITH(Xaw3d, 2837d522f475Smrg [ --with-Xaw3d link with Xaw 3d library]) 2838d522f475Smrgif test "$withval" = yes ; then 2839d522f475Smrg cf_x_athena=Xaw3d 2840d522f475Smrg AC_MSG_RESULT(yes) 2841d522f475Smrgelse 2842d522f475Smrg AC_MSG_RESULT(no) 2843d522f475Smrgfi 2844d522f475Smrg 2845d522f475SmrgAC_MSG_CHECKING(if you want to link with neXT Athena library) 2846d522f475Smrgwithval= 2847d522f475SmrgAC_ARG_WITH(neXtaw, 2848d522f475Smrg [ --with-neXtaw link with neXT Athena library]) 2849d522f475Smrgif test "$withval" = yes ; then 2850d522f475Smrg cf_x_athena=neXtaw 2851d522f475Smrg AC_MSG_RESULT(yes) 2852d522f475Smrgelse 2853d522f475Smrg AC_MSG_RESULT(no) 2854d522f475Smrgfi 2855d522f475Smrg 2856d522f475SmrgAC_MSG_CHECKING(if you want to link with Athena-Plus library) 2857d522f475Smrgwithval= 2858d522f475SmrgAC_ARG_WITH(XawPlus, 2859d522f475Smrg [ --with-XawPlus link with Athena-Plus library]) 2860d522f475Smrgif test "$withval" = yes ; then 2861d522f475Smrg cf_x_athena=XawPlus 2862d522f475Smrg AC_MSG_RESULT(yes) 2863d522f475Smrgelse 2864d522f475Smrg AC_MSG_RESULT(no) 2865d522f475Smrgfi 2866d522f475Smrg 2867d522f475Smrgcf_x_athena_lib="" 2868d522f475Smrg 286920d2c4d2Smrgif test "$PKG_CONFIG" != none ; then 287020d2c4d2Smrg cf_athena_list= 287120d2c4d2Smrg test "$cf_x_athena" = Xaw && cf_athena_list="xaw8 xaw7 xaw6" 287220d2c4d2Smrg for cf_athena_pkg in \ 287320d2c4d2Smrg $cf_athena_list \ 287420d2c4d2Smrg ${cf_x_athena} \ 287520d2c4d2Smrg ${cf_x_athena}-devel \ 287620d2c4d2Smrg lib${cf_x_athena} \ 287720d2c4d2Smrg lib${cf_x_athena}-devel 287820d2c4d2Smrg do 287920d2c4d2Smrg CF_TRY_PKG_CONFIG($cf_athena_pkg,[ 288020d2c4d2Smrg cf_x_athena_lib="$cf_pkgconfig_libs" 288120d2c4d2Smrg CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena) 288220d2c4d2Smrg AC_DEFINE_UNQUOTED($cf_x_athena_LIBS) 288320d2c4d2Smrg break]) 288420d2c4d2Smrg done 288520d2c4d2Smrgfi 288620d2c4d2Smrg 288720d2c4d2Smrgif test -z "$cf_x_athena_lib" ; then 288820d2c4d2Smrg CF_X_EXT 288920d2c4d2Smrg CF_X_TOOLKIT 289020d2c4d2Smrg CF_X_ATHENA_CPPFLAGS($cf_x_athena) 289120d2c4d2Smrg CF_X_ATHENA_LIBS($cf_x_athena) 289220d2c4d2Smrgfi 2893d522f475Smrg])dnl 2894d522f475Smrgdnl --------------------------------------------------------------------------- 289520d2c4d2Smrgdnl CF_X_ATHENA_CPPFLAGS version: 5 updated: 2010/05/26 17:35:30 2896d522f475Smrgdnl -------------------- 2897d522f475Smrgdnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of 2898d522f475Smrgdnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw. 2899d522f475SmrgAC_DEFUN([CF_X_ATHENA_CPPFLAGS], 2900d522f475Smrg[ 290120d2c4d2Smrgcf_x_athena_root=ifelse([$1],,Xaw,[$1]) 290220d2c4d2Smrgcf_x_athena_inc="" 2903d522f475Smrg 2904d522f475Smrgfor cf_path in default \ 2905d522f475Smrg /usr/contrib/X11R6 \ 2906d522f475Smrg /usr/contrib/X11R5 \ 2907d522f475Smrg /usr/lib/X11R5 \ 2908d522f475Smrg /usr/local 2909d522f475Smrgdo 291020d2c4d2Smrg if test -z "$cf_x_athena_inc" ; then 2911d522f475Smrg cf_save="$CPPFLAGS" 2912d522f475Smrg cf_test=X11/$cf_x_athena_root/SimpleMenu.h 2913d522f475Smrg if test $cf_path != default ; then 2914956cc18dSsnj CPPFLAGS="$cf_save -I$cf_path/include" 2915d522f475Smrg AC_MSG_CHECKING(for $cf_test in $cf_path) 2916d522f475Smrg else 2917d522f475Smrg AC_MSG_CHECKING(for $cf_test) 2918d522f475Smrg fi 2919d522f475Smrg AC_TRY_COMPILE([ 2920d522f475Smrg#include <X11/Intrinsic.h> 2921d522f475Smrg#include <$cf_test>],[], 2922d522f475Smrg [cf_result=yes], 2923d522f475Smrg [cf_result=no]) 2924d522f475Smrg AC_MSG_RESULT($cf_result) 2925d522f475Smrg if test "$cf_result" = yes ; then 292620d2c4d2Smrg cf_x_athena_inc=$cf_path 2927d522f475Smrg break 2928d522f475Smrg else 2929d522f475Smrg CPPFLAGS="$cf_save" 2930d522f475Smrg fi 2931d522f475Smrg fi 2932d522f475Smrgdone 2933d522f475Smrg 293420d2c4d2Smrgif test -z "$cf_x_athena_inc" ; then 2935d522f475Smrg AC_MSG_WARN( 2936d522f475Smrg[Unable to successfully find Athena header files with test program]) 293720d2c4d2Smrgelif test "$cf_x_athena_inc" != default ; then 293820d2c4d2Smrg CPPFLAGS="$CPPFLAGS -I$cf_x_athena_inc" 2939d522f475Smrgfi 2940d522f475Smrg]) 2941d522f475Smrgdnl --------------------------------------------------------------------------- 294220d2c4d2Smrgdnl CF_X_ATHENA_LIBS version: 9 updated: 2010/06/02 05:03:05 2943d522f475Smrgdnl ---------------- 2944d522f475Smrgdnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of 2945d522f475Smrgdnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw. 2946d522f475SmrgAC_DEFUN([CF_X_ATHENA_LIBS], 2947d522f475Smrg[AC_REQUIRE([CF_X_TOOLKIT]) 294820d2c4d2Smrgcf_x_athena_root=ifelse([$1],,Xaw,[$1]) 2949d522f475Smrgcf_x_athena_lib="" 2950d522f475Smrg 2951d522f475Smrgfor cf_path in default \ 2952d522f475Smrg /usr/contrib/X11R6 \ 2953d522f475Smrg /usr/contrib/X11R5 \ 2954d522f475Smrg /usr/lib/X11R5 \ 2955d522f475Smrg /usr/local 2956d522f475Smrgdo 2957d522f475Smrg for cf_lib in \ 2958d522f475Smrg "-l$cf_x_athena_root -lXmu" \ 2959d522f475Smrg "-l$cf_x_athena_root -lXpm -lXmu" \ 2960d522f475Smrg "-l${cf_x_athena_root}_s -lXmu_s" 2961d522f475Smrg do 2962d522f475Smrg if test -z "$cf_x_athena_lib" ; then 2963d522f475Smrg cf_save="$LIBS" 2964d522f475Smrg cf_test=XawSimpleMenuAddGlobalActions 2965d522f475Smrg if test $cf_path != default ; then 296620d2c4d2Smrg CF_ADD_LIBS(-L$cf_path/lib $cf_lib) 2967d522f475Smrg AC_MSG_CHECKING(for $cf_lib in $cf_path) 2968d522f475Smrg else 296920d2c4d2Smrg CF_ADD_LIBS($cf_lib) 2970d522f475Smrg AC_MSG_CHECKING(for $cf_test in $cf_lib) 2971d522f475Smrg fi 2972d522f475Smrg AC_TRY_LINK([],[$cf_test()], 2973d522f475Smrg [cf_result=yes], 2974d522f475Smrg [cf_result=no]) 2975d522f475Smrg AC_MSG_RESULT($cf_result) 2976d522f475Smrg if test "$cf_result" = yes ; then 2977d522f475Smrg cf_x_athena_lib="$cf_lib" 2978d522f475Smrg break 2979d522f475Smrg fi 2980d522f475Smrg LIBS="$cf_save" 2981d522f475Smrg fi 2982d522f475Smrg done 2983d522f475Smrgdone 2984d522f475Smrg 2985d522f475Smrgif test -z "$cf_x_athena_lib" ; then 2986d522f475Smrg AC_MSG_ERROR( 2987d522f475Smrg[Unable to successfully link Athena library (-l$cf_x_athena_root) with test program]) 2988d522f475Smrgfi 2989d522f475Smrg 2990d522f475SmrgCF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena) 2991d522f475SmrgAC_DEFINE_UNQUOTED($cf_x_athena_LIBS) 2992d522f475Smrg]) 2993d522f475Smrgdnl --------------------------------------------------------------------------- 299420d2c4d2Smrgdnl CF_X_EXT version: 3 updated: 2010/06/02 05:03:05 299520d2c4d2Smrgdnl -------- 299620d2c4d2SmrgAC_DEFUN([CF_X_EXT],[ 299720d2c4d2SmrgCF_TRY_PKG_CONFIG(Xext,,[ 299820d2c4d2Smrg AC_CHECK_LIB(Xext,XextCreateExtension, 299920d2c4d2Smrg [CF_ADD_LIB(Xext)])]) 300020d2c4d2Smrg])dnl 300120d2c4d2Smrgdnl --------------------------------------------------------------------------- 300220d2c4d2Smrgdnl CF_X_FREETYPE version: 22 updated: 2010/06/02 05:03:05 3003d522f475Smrgdnl ------------- 3004d522f475Smrgdnl Check for X FreeType headers and libraries (XFree86 4.x, etc). 3005d522f475Smrgdnl 3006d522f475Smrgdnl First check for the appropriate config program, since the developers for 3007d522f475Smrgdnl these libraries change their configuration (and config program) more or 3008d522f475Smrgdnl less randomly. If we cannot find the config program, do not bother trying 3009d522f475Smrgdnl to guess the latest variation of include/lib directories. 3010d522f475Smrgdnl 3011d522f475Smrgdnl If either or both of these configure-script options are not given, rely on 3012d522f475Smrgdnl the output of the config program to provide the cflags/libs options: 3013d522f475Smrgdnl --with-freetype-cflags 3014d522f475Smrgdnl --with-freetype-libs 3015d522f475SmrgAC_DEFUN([CF_X_FREETYPE], 3016d522f475Smrg[ 3017956cc18dSsnjAC_REQUIRE([CF_PKG_CONFIG]) 3018956cc18dSsnj 3019d522f475Smrgcf_extra_freetype_libs= 3020956cc18dSsnjFREETYPE_CONFIG=none 3021d522f475SmrgFREETYPE_PARAMS= 3022d522f475Smrg 3023d522f475SmrgAC_MSG_CHECKING(if you specified -D/-I options for FreeType) 3024d522f475SmrgAC_ARG_WITH(freetype-cflags, 3025d522f475Smrg [ --with-freetype-cflags -D/-I options for compiling with FreeType], 3026956cc18dSsnj [cf_cv_x_freetype_incs="$with_freetype_cflags"], 3027956cc18dSsnj [cf_cv_x_freetype_incs=no]) 3028d522f475SmrgAC_MSG_RESULT($cf_cv_x_freetype_incs) 3029d522f475Smrg 3030d522f475Smrg 3031d522f475SmrgAC_MSG_CHECKING(if you specified -L/-l options for FreeType) 3032d522f475SmrgAC_ARG_WITH(freetype-libs, 3033d522f475Smrg [ --with-freetype-libs -L/-l options to link FreeType], 3034956cc18dSsnj [cf_cv_x_freetype_libs="$with_freetype_libs"], 3035956cc18dSsnj [cf_cv_x_freetype_libs=no]) 3036d522f475SmrgAC_MSG_RESULT($cf_cv_x_freetype_libs) 3037d522f475Smrg 3038956cc18dSsnjif test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists xft; then 3039956cc18dSsnj FREETYPE_CONFIG=$PKG_CONFIG 3040d522f475Smrg FREETYPE_PARAMS=xft 3041d522f475Smrgelse 3042d522f475Smrg AC_PATH_PROG(FREETYPE_XFT_CONFIG, xft-config, none) 3043d522f475Smrg if test "$FREETYPE_XFT_CONFIG" != none; then 3044d522f475Smrg FREETYPE_CONFIG=$FREETYPE_XFT_CONFIG 3045d522f475Smrg else 3046d522f475Smrg cf_extra_freetype_libs="-lXft" 3047d522f475Smrg AC_PATH_PROG(FREETYPE_OLD_CONFIG, freetype-config, none) 3048d522f475Smrg if test "$FREETYPE_OLD_CONFIG" != none; then 3049d522f475Smrg FREETYPE_CONFIG=$FREETYPE_OLD_CONFIG 3050d522f475Smrg fi 3051d522f475Smrg fi 3052d522f475Smrgfi 3053956cc18dSsnjAC_MSG_CHECKING(for FreeType config) 3054956cc18dSsnjAC_MSG_RESULT($FREETYPE_CONFIG $FREETYPE_PARAMS) 3055d522f475Smrg 3056956cc18dSsnjif test "$FREETYPE_CONFIG" != none ; then 3057d522f475Smrg 3058956cc18dSsnj if test "$cf_cv_x_freetype_incs" = no ; then 3059956cc18dSsnj AC_MSG_CHECKING(for $FREETYPE_CONFIG cflags) 3060956cc18dSsnj cf_cv_x_freetype_incs="`$FREETYPE_CONFIG $FREETYPE_PARAMS --cflags 2>/dev/null`" 3061956cc18dSsnj AC_MSG_RESULT($cf_cv_x_freetype_incs) 3062956cc18dSsnj fi 3063d522f475Smrg 3064956cc18dSsnj if test "$cf_cv_x_freetype_libs" = no ; then 3065956cc18dSsnj AC_MSG_CHECKING(for $FREETYPE_CONFIG libs) 3066956cc18dSsnj cf_cv_x_freetype_libs="$cf_extra_freetype_libs `$FREETYPE_CONFIG $FREETYPE_PARAMS --libs 2>/dev/null`" 3067956cc18dSsnj AC_MSG_RESULT($cf_cv_x_freetype_libs) 3068956cc18dSsnj fi 3069d522f475Smrg 3070d522f475Smrgfi 3071d522f475Smrg 3072d522f475Smrgif test "$cf_cv_x_freetype_incs" = no ; then 3073d522f475Smrg cf_cv_x_freetype_incs= 3074d522f475Smrgfi 3075d522f475Smrg 3076d522f475Smrgif test "$cf_cv_x_freetype_libs" = no ; then 3077d522f475Smrg cf_cv_x_freetype_libs=-lXft 3078d522f475Smrgfi 3079d522f475Smrg 3080d522f475SmrgAC_MSG_CHECKING(if we can link with FreeType libraries) 3081d522f475Smrg 3082d522f475Smrgcf_save_LIBS="$LIBS" 3083d522f475Smrgcf_save_INCS="$CPPFLAGS" 3084d522f475Smrg 308520d2c4d2SmrgCF_ADD_LIBS($cf_cv_x_freetype_libs) 3086956cc18dSsnjCPPFLAGS="$CPPFLAGS $cf_cv_x_freetype_incs" 3087d522f475Smrg 3088d522f475SmrgAC_TRY_LINK([ 3089d522f475Smrg#include <X11/Xlib.h> 3090d522f475Smrg#include <X11/extensions/Xrender.h> 3091d522f475Smrg#include <X11/Xft/Xft.h>],[ 3092d522f475Smrg XftPattern *pat = XftNameParse ("name");], 3093d522f475Smrg [cf_cv_found_freetype=yes], 3094d522f475Smrg [cf_cv_found_freetype=no]) 3095d522f475SmrgAC_MSG_RESULT($cf_cv_found_freetype) 3096d522f475Smrg 3097d522f475SmrgLIBS="$cf_save_LIBS" 3098d522f475SmrgCPPFLAGS="$cf_save_INCS" 3099d522f475Smrg 3100d522f475Smrgif test "$cf_cv_found_freetype" = yes ; then 310120d2c4d2Smrg CF_ADD_LIBS($cf_cv_x_freetype_libs) 3102d522f475Smrg CF_ADD_CFLAGS($cf_cv_x_freetype_incs) 3103d522f475Smrg AC_DEFINE(XRENDERFONT) 3104d522f475Smrg 3105d522f475SmrgAC_CHECK_FUNCS( \ 3106d522f475Smrg XftDrawCharSpec \ 3107d522f475Smrg XftDrawSetClip \ 3108d522f475Smrg XftDrawSetClipRectangles \ 3109d522f475Smrg) 3110d522f475Smrg 3111d522f475Smrgelse 3112d522f475Smrg AC_MSG_WARN(No libraries found for FreeType) 3113d522f475Smrg CPPFLAGS=`echo "$CPPFLAGS" | sed -e s/-DXRENDERFONT//` 3114d522f475Smrgfi 3115d522f475Smrg 3116d522f475Smrg# FIXME: revisit this if needed 3117d522f475SmrgAC_SUBST(XRENDERFONT) 3118d522f475SmrgAC_SUBST(HAVE_TYPE_FCCHAR32) 3119d522f475SmrgAC_SUBST(HAVE_TYPE_XFTCHARSPEC) 3120d522f475Smrg]) 3121d522f475Smrgdnl --------------------------------------------------------------------------- 312220d2c4d2Smrgdnl CF_X_TOOLKIT version: 15 updated: 2010/06/14 17:42:30 3123d522f475Smrgdnl ------------ 3124d522f475Smrgdnl Check for X Toolkit libraries 3125d522f475Smrgdnl 3126d522f475SmrgAC_DEFUN([CF_X_TOOLKIT], 3127d522f475Smrg[ 3128d522f475SmrgAC_REQUIRE([AC_PATH_XTRA]) 3129d522f475SmrgAC_REQUIRE([CF_CHECK_CACHE]) 3130d522f475Smrg 3131d522f475Smrgcf_have_X_LIBS=no 3132d522f475Smrg 313320d2c4d2SmrgCF_TRY_PKG_CONFIG(xt,[ 313420d2c4d2Smrg 313520d2c4d2Smrg # workaround for broken ".pc" files used for X Toolkit. 313620d2c4d2Smrg case "x$X_PRE_LIBS" in #(vi 313720d2c4d2Smrg *-lICE*) 313820d2c4d2Smrg case "x$LIBS" in #(vi 313920d2c4d2Smrg *-lICE*) #(vi 314020d2c4d2Smrg ;; 314120d2c4d2Smrg *) 314220d2c4d2Smrg CF_VERBOSE(work around broken package) 314320d2c4d2Smrg CF_VERBOSE(...before $LIBS) 314420d2c4d2Smrg LIBS=`echo "$LIBS" | sed -e "s/[[ ]][[ ]]*/ /g" -e "s,-lXt ,-lXt $X_PRE_LIBS ," -e 's/ / /g'` 314520d2c4d2Smrg CF_VERBOSE(...after $LIBS) 314620d2c4d2Smrg ;; 314720d2c4d2Smrg esac 314820d2c4d2Smrg ;; 314920d2c4d2Smrg esac 315020d2c4d2Smrg 315120d2c4d2Smrg cf_have_X_LIBS=yes 315220d2c4d2Smrg],[ 315320d2c4d2Smrg 315420d2c4d2Smrg LDFLAGS="$X_LIBS $LDFLAGS" 315520d2c4d2Smrg CF_CHECK_CFLAGS($X_CFLAGS) 3156d522f475Smrg 315720d2c4d2Smrg AC_CHECK_FUNC(XOpenDisplay,,[ 315820d2c4d2Smrg AC_CHECK_LIB(X11,XOpenDisplay, 315920d2c4d2Smrg [CF_ADD_LIB(X11)],, 316020d2c4d2Smrg [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])]) 3161d522f475Smrg 316220d2c4d2Smrg AC_CHECK_FUNC(XtAppInitialize,,[ 316320d2c4d2Smrg AC_CHECK_LIB(Xt, XtAppInitialize, 316420d2c4d2Smrg [AC_DEFINE(HAVE_LIBXT) 316520d2c4d2Smrg cf_have_X_LIBS=Xt 316620d2c4d2Smrg LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS"],, 316720d2c4d2Smrg [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])]) 316820d2c4d2Smrg]) 3169d522f475Smrg 3170d522f475Smrgif test $cf_have_X_LIBS = no ; then 3171d522f475Smrg AC_MSG_WARN( 3172d522f475Smrg[Unable to successfully link X Toolkit library (-lXt) with 3173d522f475Smrgtest program. You will have to check and add the proper libraries by hand 3174d522f475Smrgto makefile.]) 3175d522f475Smrgfi 3176d522f475Smrg])dnl 3177