aclocal.m4 revision 894e0ac8
1894e0ac8Smrgdnl $XTermId: aclocal.m4,v 1.373 2014/04/14 19:16:55 tom Exp $ 2d522f475Smrgdnl 3d522f475Smrgdnl --------------------------------------------------------------------------- 4d522f475Smrgdnl 5894e0ac8Smrgdnl Copyright 1997-2013,2014 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: 160bd37d32Smrgdnl 1720d2c4d2Smrgdnl The above copyright notice and this permission notice shall be included 1820d2c4d2Smrgdnl in all copies or substantial portions of the Software. 190bd37d32Smrgdnl 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. 270bd37d32Smrgdnl 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 --------------------------------------------------------------------------- 610bd37d32Smrgdnl CF_ACVERSION_CHECK version: 4 updated: 2013/03/04 19:52:56 62e39b573cSmrgdnl ------------------ 63e39b573cSmrgdnl Conditionally generate script according to whether we're using a given autoconf. 64e39b573cSmrgdnl 65e39b573cSmrgdnl $1 = version to compare against 66e39b573cSmrgdnl $2 = code to use if AC_ACVERSION is at least as high as $1. 67e39b573cSmrgdnl $3 = code to use if AC_ACVERSION is older than $1. 680bd37d32Smrgdefine([CF_ACVERSION_CHECK], 69e39b573cSmrg[ 700bd37d32Smrgifdef([AC_ACVERSION], ,[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])dnl 71e39b573cSmrgifdef([m4_version_compare], 72e39b573cSmrg[m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])], 73e39b573cSmrg[CF_ACVERSION_COMPARE( 74e39b573cSmrgAC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])), 75e39b573cSmrgAC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl 76e39b573cSmrgdnl --------------------------------------------------------------------------- 770bd37d32Smrgdnl CF_ACVERSION_COMPARE version: 3 updated: 2012/10/03 18:39:53 78e39b573cSmrgdnl -------------------- 79e39b573cSmrgdnl CF_ACVERSION_COMPARE(MAJOR1, MINOR1, TERNARY1, 80e39b573cSmrgdnl MAJOR2, MINOR2, TERNARY2, 81e39b573cSmrgdnl PRINTABLE2, not FOUND, FOUND) 820bd37d32Smrgdefine([CF_ACVERSION_COMPARE], 83e39b573cSmrg[ifelse(builtin([eval], [$2 < $5]), 1, 84e39b573cSmrg[ifelse([$8], , ,[$8])], 85e39b573cSmrg[ifelse([$9], , ,[$9])])])dnl 86e39b573cSmrgdnl --------------------------------------------------------------------------- 8720d2c4d2Smrgdnl CF_ADD_CFLAGS version: 10 updated: 2010/05/26 05:38:42 88d522f475Smrgdnl ------------- 89d522f475Smrgdnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS 90d522f475Smrgdnl The second parameter if given makes this macro verbose. 91d522f475Smrgdnl 92d522f475Smrgdnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS, 93d522f475Smrgdnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily 94d522f475Smrgdnl confused by the quotes (which require backslashes to keep them usable). 95d522f475SmrgAC_DEFUN([CF_ADD_CFLAGS], 96d522f475Smrg[ 97d522f475Smrgcf_fix_cppflags=no 98d522f475Smrgcf_new_cflags= 99d522f475Smrgcf_new_cppflags= 100d522f475Smrgcf_new_extra_cppflags= 101d522f475Smrg 102d522f475Smrgfor cf_add_cflags in $1 103d522f475Smrgdo 104d522f475Smrgcase $cf_fix_cppflags in 105d522f475Smrgno) 106d522f475Smrg case $cf_add_cflags in #(vi 107d522f475Smrg -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi 108d522f475Smrg case $cf_add_cflags in 109d522f475Smrg -D*) 110d522f475Smrg cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'` 111d522f475Smrg 112d522f475Smrg test "${cf_add_cflags}" != "${cf_tst_cflags}" \ 11320d2c4d2Smrg && test -z "${cf_tst_cflags}" \ 11420d2c4d2Smrg && cf_fix_cppflags=yes 115d522f475Smrg 116d522f475Smrg if test $cf_fix_cppflags = yes ; then 117d522f475Smrg cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" 118d522f475Smrg continue 119d522f475Smrg elif test "${cf_tst_cflags}" = "\"'" ; then 120d522f475Smrg cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" 121d522f475Smrg continue 122d522f475Smrg fi 123d522f475Smrg ;; 124d522f475Smrg esac 125d522f475Smrg case "$CPPFLAGS" in 126d522f475Smrg *$cf_add_cflags) #(vi 127d522f475Smrg ;; 128d522f475Smrg *) #(vi 12920d2c4d2Smrg case $cf_add_cflags in #(vi 13020d2c4d2Smrg -D*) 13120d2c4d2Smrg cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` 13220d2c4d2Smrg CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags) 13320d2c4d2Smrg ;; 13420d2c4d2Smrg esac 135d522f475Smrg cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" 136d522f475Smrg ;; 137d522f475Smrg esac 138d522f475Smrg ;; 139d522f475Smrg *) 140d522f475Smrg cf_new_cflags="$cf_new_cflags $cf_add_cflags" 141d522f475Smrg ;; 142d522f475Smrg esac 143d522f475Smrg ;; 144d522f475Smrgyes) 145d522f475Smrg cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" 146d522f475Smrg 147d522f475Smrg cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'` 148d522f475Smrg 149d522f475Smrg test "${cf_add_cflags}" != "${cf_tst_cflags}" \ 15020d2c4d2Smrg && test -z "${cf_tst_cflags}" \ 15120d2c4d2Smrg && cf_fix_cppflags=no 152d522f475Smrg ;; 153d522f475Smrgesac 154d522f475Smrgdone 155d522f475Smrg 156d522f475Smrgif test -n "$cf_new_cflags" ; then 15720d2c4d2Smrg ifelse([$2],,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)]) 158d522f475Smrg CFLAGS="$CFLAGS $cf_new_cflags" 159d522f475Smrgfi 160d522f475Smrg 161d522f475Smrgif test -n "$cf_new_cppflags" ; then 16220d2c4d2Smrg ifelse([$2],,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)]) 163956cc18dSsnj CPPFLAGS="$CPPFLAGS $cf_new_cppflags" 164d522f475Smrgfi 165d522f475Smrg 166d522f475Smrgif test -n "$cf_new_extra_cppflags" ; then 16720d2c4d2Smrg ifelse([$2],,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)]) 168d522f475Smrg EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" 169d522f475Smrgfi 170d522f475Smrg 171d522f475SmrgAC_SUBST(EXTRA_CPPFLAGS) 172d522f475Smrg 173d522f475Smrg])dnl 174d522f475Smrgdnl --------------------------------------------------------------------------- 17520d2c4d2Smrgdnl CF_ADD_LIB version: 2 updated: 2010/06/02 05:03:05 17620d2c4d2Smrgdnl ---------- 17720d2c4d2Smrgdnl Add a library, used to enforce consistency. 17820d2c4d2Smrgdnl 17920d2c4d2Smrgdnl $1 = library to add, without the "-l" 18020d2c4d2Smrgdnl $2 = variable to update (default $LIBS) 18120d2c4d2SmrgAC_DEFUN([CF_ADD_LIB],[CF_ADD_LIBS(-l$1,ifelse($2,,LIBS,[$2]))])dnl 18220d2c4d2Smrgdnl --------------------------------------------------------------------------- 18320d2c4d2Smrgdnl CF_ADD_LIBS version: 1 updated: 2010/06/02 05:03:05 18420d2c4d2Smrgdnl ----------- 18520d2c4d2Smrgdnl Add one or more libraries, used to enforce consistency. 18620d2c4d2Smrgdnl 18720d2c4d2Smrgdnl $1 = libraries to add, with the "-l", etc. 18820d2c4d2Smrgdnl $2 = variable to update (default $LIBS) 18920d2c4d2SmrgAC_DEFUN([CF_ADD_LIBS],[ifelse($2,,LIBS,[$2])="$1 [$]ifelse($2,,LIBS,[$2])"])dnl 19020d2c4d2Smrgdnl --------------------------------------------------------------------------- 191e0a2b6dfSmrgdnl CF_ADD_LIB_AFTER version: 3 updated: 2013/07/09 21:27:22 1926879286fSmrgdnl ---------------- 1936879286fSmrgdnl Add a given library after another, e.g., following the one it satisfies a 1946879286fSmrgdnl dependency for. 1956879286fSmrgdnl 1966879286fSmrgdnl $1 = the first library 1976879286fSmrgdnl $2 = its dependency 1986879286fSmrgAC_DEFUN([CF_ADD_LIB_AFTER],[ 1996879286fSmrgCF_VERBOSE(...before $LIBS) 200e0a2b6dfSmrgLIBS=`echo "$LIBS" | sed -e "s/[[ ]][[ ]]*/ /g" -e "s%$1 %$1 $2 %" -e 's% % %g'` 2016879286fSmrgCF_VERBOSE(...after $LIBS) 2026879286fSmrg])dnl 2036879286fSmrgdnl --------------------------------------------------------------------------- 204d522f475Smrgdnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31 205d522f475Smrgdnl -------------- 206d522f475Smrgdnl Allow user to disable a normally-on option. 207d522f475SmrgAC_DEFUN([CF_ARG_DISABLE], 208d522f475Smrg[CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl 209d522f475Smrgdnl --------------------------------------------------------------------------- 210d522f475Smrgdnl CF_ARG_ENABLE version: 3 updated: 1999/03/30 17:24:31 211d522f475Smrgdnl ------------- 212d522f475Smrgdnl Allow user to enable a normally-off option. 213d522f475SmrgAC_DEFUN([CF_ARG_ENABLE], 214d522f475Smrg[CF_ARG_OPTION($1,[$2],[$3],[$4],no)])dnl 215d522f475Smrgdnl --------------------------------------------------------------------------- 21620d2c4d2Smrgdnl CF_ARG_OPTION version: 4 updated: 2010/05/26 05:38:42 217d522f475Smrgdnl ------------- 218d522f475Smrgdnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus 219d522f475Smrgdnl values. 220d522f475Smrgdnl 221d522f475Smrgdnl Parameters: 222d522f475Smrgdnl $1 = option name 223d522f475Smrgdnl $2 = help-string 224d522f475Smrgdnl $3 = action to perform if option is not default 225d522f475Smrgdnl $4 = action if perform if option is default 226d522f475Smrgdnl $5 = default option value (either 'yes' or 'no') 227d522f475SmrgAC_DEFUN([CF_ARG_OPTION], 22820d2c4d2Smrg[AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes) 229d522f475Smrg if test "$enableval" != "$5" ; then 23020d2c4d2Smrgifelse([$3],,[ :]dnl 23120d2c4d2Smrg,[ $3]) ifelse([$4],,,[ 232d522f475Smrg else 233d522f475Smrg $4]) 23420d2c4d2Smrg fi],[enableval=$5 ifelse([$4],,,[ 235d522f475Smrg $4 236d522f475Smrg])dnl 237d522f475Smrg ])])dnl 238d522f475Smrgdnl --------------------------------------------------------------------------- 2390bd37d32Smrgdnl CF_CC_ENV_FLAGS version: 1 updated: 2012/10/03 05:25:49 2400bd37d32Smrgdnl --------------- 2410bd37d32Smrgdnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content 2420bd37d32Smrgdnl into CC. This will not help with broken scripts that wrap the compiler with 2430bd37d32Smrgdnl options, but eliminates a more common category of user confusion. 2440bd37d32SmrgAC_DEFUN([CF_CC_ENV_FLAGS], 2450bd37d32Smrg[ 2460bd37d32Smrg# This should have been defined by AC_PROG_CC 2470bd37d32Smrg: ${CC:=cc} 2480bd37d32Smrg 2490bd37d32SmrgAC_MSG_CHECKING(\$CC variable) 2500bd37d32Smrgcase "$CC" in #(vi 2510bd37d32Smrg*[[\ \ ]]-[[IUD]]*) 2520bd37d32Smrg AC_MSG_RESULT(broken) 2530bd37d32Smrg AC_MSG_WARN(your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options) 2540bd37d32Smrg # humor him... 2550bd37d32Smrg cf_flags=`echo "$CC" | sed -e 's/^[[^ ]]*[[ ]]//'` 2560bd37d32Smrg CC=`echo "$CC" | sed -e 's/[[ ]].*//'` 2570bd37d32Smrg CF_ADD_CFLAGS($cf_flags) 2580bd37d32Smrg ;; 2590bd37d32Smrg*) 2600bd37d32Smrg AC_MSG_RESULT(ok) 2610bd37d32Smrg ;; 2620bd37d32Smrgesac 2630bd37d32Smrg])dnl 2640bd37d32Smrgdnl --------------------------------------------------------------------------- 2650bd37d32Smrgdnl CF_CHECK_CACHE version: 12 updated: 2012/10/02 20:55:03 266d522f475Smrgdnl -------------- 267d522f475Smrgdnl Check if we're accidentally using a cache from a different machine. 268d522f475Smrgdnl Derive the system name, as a check for reusing the autoconf cache. 269d522f475Smrgdnl 270d522f475Smrgdnl If we've packaged config.guess and config.sub, run that (since it does a 271d522f475Smrgdnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow 272d522f475Smrgdnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM 273d522f475Smrgdnl which is useful in cross-compiles. 274d522f475Smrgdnl 275d522f475Smrgdnl Note: we would use $ac_config_sub, but that is one of the places where 276d522f475Smrgdnl autoconf 2.5x broke compatibility with autoconf 2.13 277d522f475SmrgAC_DEFUN([CF_CHECK_CACHE], 278d522f475Smrg[ 279d522f475Smrgif test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then 280d522f475Smrg ifelse([$1],,[AC_CANONICAL_HOST],[$1]) 281d522f475Smrg system_name="$host_os" 282d522f475Smrgelse 283d522f475Smrg system_name="`(uname -s -r) 2>/dev/null`" 284d522f475Smrg if test -z "$system_name" ; then 285d522f475Smrg system_name="`(hostname) 2>/dev/null`" 286d522f475Smrg fi 287d522f475Smrgfi 2880bd37d32Smrgtest -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name",[Define to the system name.]) 289d522f475SmrgAC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"]) 290d522f475Smrg 291d522f475Smrgtest -z "$system_name" && system_name="$cf_cv_system_name" 292d522f475Smrgtest -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name) 293d522f475Smrg 294d522f475Smrgif test ".$system_name" != ".$cf_cv_system_name" ; then 295d522f475Smrg AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)) 296d522f475Smrg AC_MSG_ERROR("Please remove config.cache and try again.") 297d522f475Smrgfi 298d522f475Smrg])dnl 299d522f475Smrgdnl --------------------------------------------------------------------------- 300d522f475Smrgdnl CF_CHECK_CFLAGS version: 2 updated: 2001/12/30 19:09:58 301d522f475Smrgdnl --------------- 302d522f475Smrgdnl Conditionally add to $CFLAGS and $CPPFLAGS values which are derived from 303d522f475Smrgdnl a build-configuration such as imake. These have the pitfall that they 304d522f475Smrgdnl often contain compiler-specific options which we cannot use, mixed with 305d522f475Smrgdnl preprocessor options that we usually can. 306d522f475SmrgAC_DEFUN([CF_CHECK_CFLAGS], 307d522f475Smrg[ 308d522f475SmrgCF_VERBOSE(checking additions to CFLAGS) 309d522f475Smrgcf_check_cflags="$CFLAGS" 310d522f475Smrgcf_check_cppflags="$CPPFLAGS" 311d522f475SmrgCF_ADD_CFLAGS($1,yes) 312d522f475Smrgif test "$cf_check_cflags" != "$CFLAGS" ; then 313d522f475SmrgAC_TRY_LINK([#include <stdio.h>],[printf("Hello world");],, 314d522f475Smrg [CF_VERBOSE(test-compile failed. Undoing change to \$CFLAGS) 315d522f475Smrg if test "$cf_check_cppflags" != "$CPPFLAGS" ; then 316d522f475Smrg CF_VERBOSE(but keeping change to \$CPPFLAGS) 317d522f475Smrg fi 318d522f475Smrg CFLAGS="$cf_check_flags"]) 319d522f475Smrgfi 320d522f475Smrg])dnl 321d522f475Smrgdnl --------------------------------------------------------------------------- 32220d2c4d2Smrgdnl CF_CHECK_ERRNO version: 11 updated: 2010/05/26 05:38:42 323d522f475Smrgdnl -------------- 324d522f475Smrgdnl Check for data that is usually declared in <stdio.h> or <errno.h>, e.g., 325d522f475Smrgdnl the 'errno' variable. Define a DECL_xxx symbol if we must declare it 326d522f475Smrgdnl ourselves. 327d522f475Smrgdnl 328d522f475Smrgdnl $1 = the name to check 3292eaa94a1Schristosdnl $2 = the assumed type 330d522f475SmrgAC_DEFUN([CF_CHECK_ERRNO], 331d522f475Smrg[ 332d522f475SmrgAC_CACHE_CHECK(if external $1 is declared, cf_cv_dcl_$1,[ 333d522f475Smrg AC_TRY_COMPILE([ 334d522f475Smrg#ifdef HAVE_STDLIB_H 335d522f475Smrg#include <stdlib.h> 336d522f475Smrg#endif 337d522f475Smrg#include <stdio.h> 338d522f475Smrg#include <sys/types.h> 339d522f475Smrg#include <errno.h> ], 34020d2c4d2Smrg ifelse([$2],,int,[$2]) x = (ifelse([$2],,int,[$2])) $1, 341d522f475Smrg [cf_cv_dcl_$1=yes], 342d522f475Smrg [cf_cv_dcl_$1=no]) 343d522f475Smrg]) 344d522f475Smrg 345d522f475Smrgif test "$cf_cv_dcl_$1" = no ; then 346d522f475Smrg CF_UPPER(cf_result,decl_$1) 347d522f475Smrg AC_DEFINE_UNQUOTED($cf_result) 348d522f475Smrgfi 349d522f475Smrg 350d522f475Smrg# It's possible (for near-UNIX clones) that the data doesn't exist 35120d2c4d2SmrgCF_CHECK_EXTERN_DATA($1,ifelse([$2],,int,[$2])) 352d522f475Smrg])dnl 353d522f475Smrgdnl --------------------------------------------------------------------------- 354d522f475Smrgdnl CF_CHECK_EXTERN_DATA version: 3 updated: 2001/12/30 18:03:23 355d522f475Smrgdnl -------------------- 356d522f475Smrgdnl Check for existence of external data in the current set of libraries. If 357d522f475Smrgdnl we can modify it, it's real enough. 358d522f475Smrgdnl $1 = the name to check 359d522f475Smrgdnl $2 = its type 360d522f475SmrgAC_DEFUN([CF_CHECK_EXTERN_DATA], 361d522f475Smrg[ 362d522f475SmrgAC_CACHE_CHECK(if external $1 exists, cf_cv_have_$1,[ 363d522f475Smrg AC_TRY_LINK([ 364d522f475Smrg#undef $1 365d522f475Smrgextern $2 $1; 366d522f475Smrg], 367d522f475Smrg [$1 = 2], 368d522f475Smrg [cf_cv_have_$1=yes], 369d522f475Smrg [cf_cv_have_$1=no]) 370d522f475Smrg]) 371d522f475Smrg 372d522f475Smrgif test "$cf_cv_have_$1" = yes ; then 373d522f475Smrg CF_UPPER(cf_result,have_$1) 374d522f475Smrg AC_DEFINE_UNQUOTED($cf_result) 375d522f475Smrgfi 376d522f475Smrg 377d522f475Smrg])dnl 378d522f475Smrgdnl --------------------------------------------------------------------------- 379e0a2b6dfSmrgdnl CF_CLANG_COMPILER version: 2 updated: 2013/11/19 19:23:35 3800bd37d32Smrgdnl ----------------- 3810bd37d32Smrgdnl Check if the given compiler is really clang. clang's C driver defines 3820bd37d32Smrgdnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does 3830bd37d32Smrgdnl not ignore some gcc options. 3840bd37d32Smrgdnl 3850bd37d32Smrgdnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to 3860bd37d32Smrgdnl ensure that it is not mistaken for gcc/g++. It is normally invoked from 3870bd37d32Smrgdnl the wrappers for gcc and g++ warnings. 3880bd37d32Smrgdnl 3890bd37d32Smrgdnl $1 = GCC (default) or GXX 390e0a2b6dfSmrgdnl $2 = CLANG_COMPILER (default) 3910bd37d32Smrgdnl $3 = CFLAGS (default) or CXXFLAGS 3920bd37d32SmrgAC_DEFUN([CF_CLANG_COMPILER],[ 3930bd37d32Smrgifelse([$2],,CLANG_COMPILER,[$2])=no 3940bd37d32Smrg 3950bd37d32Smrgif test "$ifelse([$1],,[$1],GCC)" = yes ; then 3960bd37d32Smrg AC_MSG_CHECKING(if this is really Clang ifelse([$1],GXX,C++,C) compiler) 3970bd37d32Smrg cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" 3980bd37d32Smrg ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -Qunused-arguments" 3990bd37d32Smrg AC_TRY_COMPILE([],[ 4000bd37d32Smrg#ifdef __clang__ 4010bd37d32Smrg#else 4020bd37d32Smrgmake an error 4030bd37d32Smrg#endif 4040bd37d32Smrg],[ifelse([$2],,CLANG_COMPILER,[$2])=yes 4050bd37d32Smrgcf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments" 4060bd37d32Smrg],[]) 4070bd37d32Smrg ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" 4080bd37d32Smrg AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2])) 4090bd37d32Smrgfi 4100bd37d32Smrg]) 4110bd37d32Smrgdnl --------------------------------------------------------------------------- 412e39b573cSmrgdnl CF_DISABLE_DESKTOP version: 2 updated: 2011/04/22 05:17:37 413e39b573cSmrgdnl ------------------ 414e39b573cSmrgdnl Handle a configure option "--disable-desktop", which sets a shell 415e39b573cSmrgdnl variable $desktop_utils to a "#" if the feature is not wanted, or to an 416e39b573cSmrgdnl empty string if enabled. The variable is used to substitute in front of 417e39b573cSmrgdnl corresponding makefile-rules. 418e39b573cSmrgdnl 419e39b573cSmrgdnl It also tells the configure script to substitute the environment variable 420e39b573cSmrgdnl $DESKTOP_FLAGS, which can be used by external scripts to customize the 421e39b573cSmrgdnl invocation of desktop-file-util. 422e39b573cSmrgdnl 423e39b573cSmrgdnl $1 = program name 424e39b573cSmrgAC_DEFUN([CF_DISABLE_DESKTOP],[ 425e39b573cSmrg# Comment-out the install-desktop rule if the desktop-utils are not found. 426e39b573cSmrgAC_MSG_CHECKING(if you want to install desktop files) 427e39b573cSmrgCF_ARG_OPTION(desktop, 428e39b573cSmrg [ --disable-desktop disable install of $1 desktop files], 429e39b573cSmrg [enable_desktop=$enableval], 430e39b573cSmrg [enable_desktop=$enableval],yes) 431e39b573cSmrgAC_MSG_RESULT($enable_desktop) 432e39b573cSmrg 433e39b573cSmrgdesktop_utils= 434e39b573cSmrgif test "$enable_desktop" = yes ; then 435e39b573cSmrgAC_CHECK_PROG(desktop_utils,desktop-file-install,yes,no) 436e39b573cSmrgfi 437e39b573cSmrg 438e39b573cSmrgtest "$desktop_utils" = yes && desktop_utils= || desktop_utils="#" 439e39b573cSmrgAC_SUBST(DESKTOP_FLAGS) 440e39b573cSmrg]) 441e39b573cSmrgdnl --------------------------------------------------------------------------- 4420bd37d32Smrgdnl CF_DISABLE_ECHO version: 12 updated: 2012/10/06 16:30:28 443d522f475Smrgdnl --------------- 444d522f475Smrgdnl You can always use "make -n" to see the actual options, but it's hard to 445d522f475Smrgdnl pick out/analyze warning messages when the compile-line is long. 446d522f475Smrgdnl 447d522f475Smrgdnl Sets: 448d522f475Smrgdnl ECHO_LT - symbol to control if libtool is verbose 449d522f475Smrgdnl ECHO_LD - symbol to prefix "cc -o" lines 450d522f475Smrgdnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o) 451d522f475Smrgdnl SHOW_CC - symbol to put before explicit "cc -c" lines 452d522f475Smrgdnl ECHO_CC - symbol to put before any "cc" line 453d522f475Smrgdnl 454d522f475SmrgAC_DEFUN([CF_DISABLE_ECHO],[ 455d522f475SmrgAC_MSG_CHECKING(if you want to see long compiling messages) 456d522f475SmrgCF_ARG_DISABLE(echo, 4570bd37d32Smrg [ --disable-echo do not display "compiling" commands], 458d522f475Smrg [ 459d522f475Smrg ECHO_LT='--silent' 460d522f475Smrg ECHO_LD='@echo linking [$]@;' 46120d2c4d2Smrg RULE_CC='@echo compiling [$]<' 46220d2c4d2Smrg SHOW_CC='@echo compiling [$]@' 463d522f475Smrg ECHO_CC='@' 464d522f475Smrg],[ 465d522f475Smrg ECHO_LT='' 466d522f475Smrg ECHO_LD='' 46720d2c4d2Smrg RULE_CC='' 46820d2c4d2Smrg SHOW_CC='' 469d522f475Smrg ECHO_CC='' 470d522f475Smrg]) 471d522f475SmrgAC_MSG_RESULT($enableval) 472d522f475SmrgAC_SUBST(ECHO_LT) 473d522f475SmrgAC_SUBST(ECHO_LD) 474d522f475SmrgAC_SUBST(RULE_CC) 475d522f475SmrgAC_SUBST(SHOW_CC) 476d522f475SmrgAC_SUBST(ECHO_CC) 477d522f475Smrg])dnl 478d522f475Smrgdnl --------------------------------------------------------------------------- 4790bd37d32Smrgdnl CF_DISABLE_LEAKS version: 7 updated: 2012/10/02 20:55:03 4800bd37d32Smrgdnl ---------------- 4810bd37d32Smrgdnl Combine no-leak checks with the libraries or tools that are used for the 4820bd37d32Smrgdnl checks. 4830bd37d32SmrgAC_DEFUN([CF_DISABLE_LEAKS],[ 4840bd37d32Smrg 4850bd37d32SmrgAC_REQUIRE([CF_WITH_DMALLOC]) 4860bd37d32SmrgAC_REQUIRE([CF_WITH_DBMALLOC]) 4870bd37d32SmrgAC_REQUIRE([CF_WITH_VALGRIND]) 4880bd37d32Smrg 4890bd37d32SmrgAC_MSG_CHECKING(if you want to perform memory-leak testing) 4900bd37d32SmrgAC_ARG_ENABLE(leaks, 4910bd37d32Smrg [ --disable-leaks test: free permanent memory, analyze leaks], 4920bd37d32Smrg [if test "x$enableval" = xno; then with_no_leaks=yes; else with_no_leaks=no; fi], 4930bd37d32Smrg : ${with_no_leaks:=no}) 4940bd37d32SmrgAC_MSG_RESULT($with_no_leaks) 4950bd37d32Smrg 4960bd37d32Smrgif test "$with_no_leaks" = yes ; then 4970bd37d32Smrg AC_DEFINE(NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.]) 4980bd37d32Smrg AC_DEFINE(YY_NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.]) 4990bd37d32Smrgfi 5000bd37d32Smrg])dnl 5010bd37d32Smrgdnl --------------------------------------------------------------------------- 502a1f3da82Smrgdnl CF_DISABLE_RPATH_HACK version: 2 updated: 2011/02/13 13:31:33 50320d2c4d2Smrgdnl --------------------- 50420d2c4d2Smrgdnl The rpath-hack makes it simpler to build programs, particularly with the 50520d2c4d2Smrgdnl *BSD ports which may have essential libraries in unusual places. But it 50620d2c4d2Smrgdnl can interfere with building an executable for the base system. Use this 50720d2c4d2Smrgdnl option in that case. 50820d2c4d2SmrgAC_DEFUN([CF_DISABLE_RPATH_HACK], 50920d2c4d2Smrg[ 510a1f3da82SmrgAC_MSG_CHECKING(if rpath-hack should be disabled) 51120d2c4d2SmrgCF_ARG_DISABLE(rpath-hack, 51220d2c4d2Smrg [ --disable-rpath-hack don't add rpath options for additional libraries], 51320d2c4d2Smrg [cf_disable_rpath_hack=yes], 51420d2c4d2Smrg [cf_disable_rpath_hack=no]) 51520d2c4d2SmrgAC_MSG_RESULT($cf_disable_rpath_hack) 51620d2c4d2Smrgif test "$cf_disable_rpath_hack" = no ; then 51720d2c4d2Smrg CF_RPATH_HACK 51820d2c4d2Smrgfi 51920d2c4d2Smrg]) 52020d2c4d2Smrgdnl --------------------------------------------------------------------------- 521d522f475Smrgdnl CF_ENABLE_NARROWPROTO version: 3 updated: 2006/02/12 17:46:00 522d522f475Smrgdnl --------------------- 523d522f475Smrgdnl If this is not set properly, Xaw's scrollbars will not work. 524d522f475Smrgdnl The so-called "modular" configuration for X.org omits most of the 525d522f475Smrgdnl configure checks that would be needed to provide compatibility with 526d522f475Smrgdnl older X builds. This one breaks things noticeably. 527d522f475SmrgAC_DEFUN([CF_ENABLE_NARROWPROTO], 528d522f475Smrg[ 529d522f475SmrgAC_MSG_CHECKING(if you want narrow prototypes for X libraries) 530d522f475Smrg 531d522f475Smrgcase `$ac_config_guess` in #(vi 532d522f475Smrg*cygwin*|*freebsd*|*gnu*|*irix5*|*irix6*|*linux-gnu*|*netbsd*|*openbsd*|*qnx*|*sco*|*sgi*) #(vi 533d522f475Smrg cf_default_narrowproto=yes 534d522f475Smrg ;; 535d522f475Smrg*) 536d522f475Smrg cf_default_narrowproto=no 537d522f475Smrg ;; 538d522f475Smrgesac 539d522f475Smrg 540d522f475SmrgCF_ARG_OPTION(narrowproto, 541d522f475Smrg [ --enable-narrowproto enable narrow prototypes for X libraries], 542d522f475Smrg [enable_narrowproto=$enableval], 543d522f475Smrg [enable_narrowproto=$cf_default_narrowproto], 544d522f475Smrg [$cf_default_narrowproto]) 545d522f475SmrgAC_MSG_RESULT($enable_narrowproto) 546d522f475Smrg]) 547d522f475Smrgdnl --------------------------------------------------------------------------- 548d522f475Smrgdnl CF_ERRNO version: 5 updated: 1997/11/30 12:44:39 549d522f475Smrgdnl -------- 550d522f475Smrgdnl Check if 'errno' is declared in <errno.h> 551d522f475SmrgAC_DEFUN([CF_ERRNO], 552d522f475Smrg[ 553d522f475SmrgCF_CHECK_ERRNO(errno) 554d522f475Smrg])dnl 555d522f475Smrgdnl --------------------------------------------------------------------------- 5560bd37d32Smrgdnl CF_FUNC_GRANTPT version: 10 updated: 2013/04/17 05:31:24 557d522f475Smrgdnl --------------- 5580bd37d32Smrgdnl Check for grantpt versus openpty, as well as functions that "should" be 5590bd37d32Smrgdnl available if grantpt is available. 5600bd37d32SmrgAC_DEFUN([CF_FUNC_GRANTPT],[ 5610bd37d32Smrg 5620bd37d32SmrgAC_CHECK_HEADERS( \ 5630bd37d32Smrgstropts.h \ 5640bd37d32Smrg) 5650bd37d32Smrg 5660bd37d32Smrgcf_func_grantpt="grantpt ptsname" 5670bd37d32Smrgcase $host_os in #(vi 5680bd37d32Smrgdarwin[[0-9]].*) #(vi 5690bd37d32Smrg ;; 5700bd37d32Smrg*) 5710bd37d32Smrg cf_func_grantpt="$cf_func_grantpt posix_openpt" 5720bd37d32Smrg ;; 5730bd37d32Smrgesac 5740bd37d32Smrg 5750bd37d32SmrgAC_CHECK_FUNCS($cf_func_grantpt) 5760bd37d32Smrg 5770bd37d32Smrgcf_grantpt_opts= 5780bd37d32Smrgif test "x$ac_cv_func_grantpt" = "xyes" ; then 5790bd37d32Smrg AC_MSG_CHECKING(if grantpt really works) 5800bd37d32Smrg AC_TRY_LINK(CF__GRANTPT_HEAD,CF__GRANTPT_BODY,[ 5810bd37d32Smrg AC_TRY_RUN(CF__GRANTPT_HEAD 5820bd37d32Smrgint main(void) 5830bd37d32Smrg{ 5840bd37d32SmrgCF__GRANTPT_BODY 585d522f475Smrg} 5860bd37d32Smrg, 5870bd37d32Smrg,ac_cv_func_grantpt=no 5880bd37d32Smrg,ac_cv_func_grantpt=maybe) 5890bd37d32Smrg ],ac_cv_func_grantpt=no) 5900bd37d32Smrg AC_MSG_RESULT($ac_cv_func_grantpt) 5910bd37d32Smrg 5920bd37d32Smrg if test "x$ac_cv_func_grantpt" != "xno" ; then 5930bd37d32Smrg 5940bd37d32Smrg if test "x$ac_cv_func_grantpt" = "xyes" ; then 5950bd37d32Smrg AC_MSG_CHECKING(for pty features) 5960bd37d32Smrgdnl if we have no stropts.h, skip the checks for streams modules 5970bd37d32Smrg if test "x$ac_cv_header_stropts_h" = xyes 5980bd37d32Smrg then 5990bd37d32Smrg cf_pty_this=0 6000bd37d32Smrg else 6010bd37d32Smrg cf_pty_this=3 6020bd37d32Smrg fi 6030bd37d32Smrg 6040bd37d32Smrg cf_pty_defines= 6050bd37d32Smrg while test $cf_pty_this != 6 6060bd37d32Smrg do 6070bd37d32Smrg 6080bd37d32Smrg cf_pty_feature= 6090bd37d32Smrg cf_pty_next=`expr $cf_pty_this + 1` 6100bd37d32Smrg CF_MSG_LOG(pty feature test $cf_pty_next:5) 6110bd37d32Smrg AC_TRY_RUN(#define CONFTEST $cf_pty_this 6120bd37d32Smrg$cf_pty_defines 6130bd37d32SmrgCF__GRANTPT_HEAD 6140bd37d32Smrgint main(void) 6150bd37d32Smrg{ 6160bd37d32SmrgCF__GRANTPT_BODY 6170bd37d32Smrg} 6180bd37d32Smrg, 6190bd37d32Smrg[ 6200bd37d32Smrg case $cf_pty_next in #(vi 6210bd37d32Smrg 1) #(vi - streams 6220bd37d32Smrg cf_pty_feature=ptem 6230bd37d32Smrg ;; 6240bd37d32Smrg 2) #(vi - streams 6250bd37d32Smrg cf_pty_feature=ldterm 6260bd37d32Smrg ;; 6270bd37d32Smrg 3) #(vi - streams 6280bd37d32Smrg cf_pty_feature=ttcompat 6290bd37d32Smrg ;; 6300bd37d32Smrg 4) #(vi 6310bd37d32Smrg cf_pty_feature=pty_isatty 6320bd37d32Smrg ;; 6330bd37d32Smrg 5) #(vi 6340bd37d32Smrg cf_pty_feature=pty_tcsetattr 6350bd37d32Smrg ;; 6360bd37d32Smrg 6) #(vi 6370bd37d32Smrg cf_pty_feature=tty_tcsetattr 6380bd37d32Smrg ;; 6390bd37d32Smrg esac 6400bd37d32Smrg],[ 6410bd37d32Smrg case $cf_pty_next in #(vi 6420bd37d32Smrg 1|2|3) 6430bd37d32Smrg CF_MSG_LOG(skipping remaining streams features $cf_pty_this..2) 6440bd37d32Smrg cf_pty_next=3 6450bd37d32Smrg ;; 6460bd37d32Smrg esac 6470bd37d32Smrg]) 6480bd37d32Smrg if test -n "$cf_pty_feature" 6490bd37d32Smrg then 6500bd37d32Smrg cf_pty_defines="$cf_pty_defines 6510bd37d32Smrg#define CONFTEST_$cf_pty_feature 1 6520bd37d32Smrg" 6530bd37d32Smrg cf_grantpt_opts="$cf_grantpt_opts $cf_pty_feature" 6540bd37d32Smrg fi 6550bd37d32Smrg 6560bd37d32Smrg cf_pty_this=$cf_pty_next 6570bd37d32Smrg done 6580bd37d32Smrg AC_MSG_RESULT($cf_grantpt_opts) 6590bd37d32Smrg cf_grantpt_opts=`echo "$cf_grantpt_opts" | sed -e 's/ isatty//'` 6600bd37d32Smrg fi 661d522f475Smrg fi 6620bd37d32Smrgfi 6630bd37d32Smrg 6640bd37d32Smrgdnl If we found grantpt, but no features, e.g., for streams or if we are not 6650bd37d32Smrgdnl able to use tcsetattr, then give openpty a try. In particular, Darwin 10.7 6660bd37d32Smrgdnl has a more functional openpty than posix_openpt. 6670bd37d32Smrgdnl 6680bd37d32Smrgdnl There is no configure run-test for openpty, since older implementations do 6690bd37d32Smrgdnl not always run properly as a non-root user. For that reason, we also allow 6700bd37d32Smrgdnl the configure script to suppress this check entirely with $disable_openpty. 6710bd37d32Smrgif test "x$disable_openpty" != "xyes" || test -z "$cf_grantpt_opts" ; then 6720bd37d32Smrg AC_CHECK_LIB(util, openpty, [cf_have_openpty=yes],[cf_have_openpty=no]) 6730bd37d32Smrg if test "$cf_have_openpty" = yes ; then 6740bd37d32Smrg ac_cv_func_grantpt=no 6750bd37d32Smrg LIBS="-lutil $LIBS" 6760bd37d32Smrg AC_DEFINE(HAVE_OPENPTY,1,[Define to 1 if you have the openpty function]) 6770bd37d32Smrg AC_CHECK_HEADERS( \ 6780bd37d32Smrg util.h \ 6790bd37d32Smrg libutil.h \ 6800bd37d32Smrg pty.h \ 6810bd37d32Smrg ) 6820bd37d32Smrg fi 6830bd37d32Smrgfi 6840bd37d32Smrg 6850bd37d32Smrgdnl If we did not settle on using openpty, fill in the definitions for grantpt. 6860bd37d32Smrgif test "x$ac_cv_func_grantpt" != xno 6870bd37d32Smrgthen 6880bd37d32Smrg CF_VERBOSE(will rely upon grantpt) 6890bd37d32Smrg AC_DEFINE(HAVE_WORKING_GRANTPT,1,[Define to 1 if the grantpt function seems to work]) 6900bd37d32Smrg for cf_feature in $cf_grantpt_opts 6910bd37d32Smrg do 6920bd37d32Smrg cf_feature=`echo "$cf_feature" | sed -e 's/ //g'` 6930bd37d32Smrg CF_UPPER(cf_FEATURE,$cf_feature) 6940bd37d32Smrg AC_DEFINE_UNQUOTED(HAVE_GRANTPT_$cf_FEATURE) 6950bd37d32Smrg done 6960bd37d32Smrgelif test "x$cf_have_openpty" = xno 6970bd37d32Smrgthen 6980bd37d32Smrg CF_VERBOSE(will rely upon BSD-pseudoterminals) 6990bd37d32Smrgelse 7000bd37d32Smrg CF_VERBOSE(will rely upon openpty) 7010bd37d32Smrgfi 7020bd37d32Smrg])dnl 703d522f475Smrgdnl --------------------------------------------------------------------------- 7040bd37d32Smrgdnl CF_FUNC_TGETENT version: 19 updated: 2012/10/04 20:12:20 705d522f475Smrgdnl --------------- 706d522f475Smrgdnl Check for tgetent function in termcap library. If we cannot find this, 707d522f475Smrgdnl we'll use the $LINES and $COLUMNS environment variables to pass screen 708d522f475Smrgdnl size information to subprocesses. (We cannot use terminfo's compatibility 709d522f475Smrgdnl function, since it cannot provide the termcap-format data). 710d522f475Smrgdnl 711d522f475Smrgdnl If the --disable-full-tgetent option is given, we'll settle for the first 712d522f475Smrgdnl tgetent function we find. Since the search list in that case does not 713d522f475Smrgdnl include the termcap library, that allows us to default to terminfo. 714d522f475SmrgAC_DEFUN([CF_FUNC_TGETENT], 715d522f475Smrg[ 716d522f475Smrg# compute a reasonable value for $TERM to give tgetent(), since we may be 717d522f475Smrg# running in 'screen', which sets $TERMCAP to a specific entry that is not 718d522f475Smrg# necessarily in /etc/termcap - unsetenv is not portable, so we cannot simply 719d522f475Smrg# discard $TERMCAP. 720d522f475Smrgcf_TERMVAR=vt100 721e39b573cSmrgif test -n "$TERMCAP" 722e39b573cSmrgthen 723e39b573cSmrg cf_TERMCAP=`echo "$TERMCAP" | tr '\n' ' ' | sed -e 's/^..|//' -e 's/|.*//'` 724e39b573cSmrg case "$cf_TERMCAP" in #(vi 725e39b573cSmrg screen*.*) #(vi 726e39b573cSmrg ;; 727e39b573cSmrg *) 728e39b573cSmrg cf_TERMVAR="$cf_TERMCAP" 729e39b573cSmrg ;; 730e39b573cSmrg esac 731e39b573cSmrgfi 732d522f475Smrgtest -z "$cf_TERMVAR" && cf_TERMVAR=vt100 733d522f475Smrg 734d522f475SmrgAC_MSG_CHECKING(if we want full tgetent function) 735d522f475SmrgCF_ARG_DISABLE(full-tgetent, 736d522f475Smrg [ --disable-full-tgetent disable check for full tgetent function], 737d522f475Smrg cf_full_tgetent=no, 738d522f475Smrg cf_full_tgetent=yes,yes) 739d522f475SmrgAC_MSG_RESULT($cf_full_tgetent) 740d522f475Smrg 741d522f475Smrgif test "$cf_full_tgetent" = yes ; then 742d522f475Smrg cf_test_message="full tgetent" 743d522f475Smrgelse 744d522f475Smrg cf_test_message="tgetent" 745d522f475Smrgfi 746d522f475Smrg 747d522f475SmrgAC_CACHE_CHECK(for $cf_test_message function,cf_cv_lib_tgetent,[ 748d522f475Smrgcf_save_LIBS="$LIBS" 749d522f475Smrgcf_cv_lib_tgetent=no 750d522f475Smrgif test "$cf_full_tgetent" = yes ; then 7510bd37d32Smrg cf_TERMLIB="otermcap termcap termlib ncurses curses" 752d522f475Smrg cf_TERMTST="buffer[[0]] == 0" 753d522f475Smrgelse 754d522f475Smrg cf_TERMLIB="termlib ncurses curses" 755d522f475Smrg cf_TERMTST="0" 756d522f475Smrgfi 757d522f475Smrgfor cf_termlib in '' $cf_TERMLIB ; do 758d522f475Smrg LIBS="$cf_save_LIBS" 75920d2c4d2Smrg test -n "$cf_termlib" && CF_ADD_LIB($cf_termlib) 760d522f475Smrg AC_TRY_RUN([ 761d522f475Smrg/* terminfo implementations ignore the buffer argument, making it useless for 762d522f475Smrg * the xterm application, which uses this information to make a new TERMCAP 763d522f475Smrg * environment variable. 764d522f475Smrg */ 765d522f475Smrgint main() 766d522f475Smrg{ 767d522f475Smrg char buffer[1024]; 768d522f475Smrg buffer[0] = 0; 769d522f475Smrg tgetent(buffer, "$cf_TERMVAR"); 770d522f475Smrg ${cf_cv_main_return:-return} ($cf_TERMTST); }], 771d522f475Smrg [echo "yes, there is a termcap/tgetent in $cf_termlib" 1>&AC_FD_CC 772d522f475Smrg if test -n "$cf_termlib" ; then 773d522f475Smrg cf_cv_lib_tgetent="-l$cf_termlib" 774d522f475Smrg else 775d522f475Smrg cf_cv_lib_tgetent=yes 776d522f475Smrg fi 777d522f475Smrg break], 778d522f475Smrg [echo "no, there is no termcap/tgetent in $cf_termlib" 1>&AC_FD_CC], 779d522f475Smrg [echo "cross-compiling, cannot verify if a termcap/tgetent is present in $cf_termlib" 1>&AC_FD_CC]) 780d522f475Smrgdone 781d522f475SmrgLIBS="$cf_save_LIBS" 782d522f475Smrg]) 783d522f475Smrg 784d522f475Smrg# If we found a working tgetent(), set LIBS and check for termcap.h. 785d522f475Smrg# (LIBS cannot be set inside AC_CACHE_CHECK; the commands there should 786d522f475Smrg# not have side effects other than setting the cache variable, because 787d522f475Smrg# they are not executed when a cached value exists.) 788e39b573cSmrgif test "x$cf_cv_lib_tgetent" != xno ; then 789e39b573cSmrg test "x$cf_cv_lib_tgetent" != xyes && CF_ADD_LIBS($cf_cv_lib_tgetent) 7900bd37d32Smrg AC_DEFINE(USE_TERMCAP,1,[Define 1 to indicate that working tgetent is found]) 79120d2c4d2Smrg if test "$cf_full_tgetent" = no ; then 79220d2c4d2Smrg AC_TRY_COMPILE([ 793d522f475Smrg#include <termcap.h>],[ 794d522f475Smrg#ifdef NCURSES_VERSION 795d522f475Smrgmake an error 796d522f475Smrg#endif],[AC_DEFINE(HAVE_TERMCAP_H)]) 79720d2c4d2Smrg else 79820d2c4d2Smrg AC_CHECK_HEADERS(termcap.h) 79920d2c4d2Smrg fi 800d522f475Smrgelse 801d522f475Smrg # If we didn't find a tgetent() that supports the buffer 802d522f475Smrg # argument, look again to see whether we can find even 803d522f475Smrg # a crippled one. A crippled tgetent() is still useful to 804d522f475Smrg # validate values for the TERM environment variable given to 805d522f475Smrg # child processes. 806d522f475Smrg AC_CACHE_CHECK(for partial tgetent function,cf_cv_lib_part_tgetent,[ 807d522f475Smrg cf_cv_lib_part_tgetent=no 808d522f475Smrg for cf_termlib in $cf_TERMLIB ; do 809d522f475Smrg LIBS="$cf_save_LIBS -l$cf_termlib" 810d522f475Smrg AC_TRY_LINK([],[tgetent(0, "$cf_TERMVAR")], 811d522f475Smrg [echo "there is a terminfo/tgetent in $cf_termlib" 1>&AC_FD_CC 812d522f475Smrg cf_cv_lib_part_tgetent="-l$cf_termlib" 813d522f475Smrg break]) 814d522f475Smrg done 815d522f475Smrg LIBS="$cf_save_LIBS" 816d522f475Smrg ]) 817d522f475Smrg 818d522f475Smrg if test "$cf_cv_lib_part_tgetent" != no ; then 81920d2c4d2Smrg CF_ADD_LIBS($cf_cv_lib_part_tgetent) 820d522f475Smrg AC_CHECK_HEADERS(termcap.h) 821d522f475Smrg 822d522f475Smrg # If this is linking against ncurses, we'll trigger the 823d522f475Smrg # ifdef in resize.c that turns the termcap stuff back off. 8240bd37d32Smrg AC_DEFINE(USE_TERMINFO,1,[Define to 1 to indicate that terminfo provides the tgetent interface]) 825d522f475Smrg fi 826d522f475Smrgfi 827d522f475Smrg])dnl 828d522f475Smrgdnl --------------------------------------------------------------------------- 8290bd37d32Smrgdnl CF_GCC_ATTRIBUTES version: 16 updated: 2012/10/02 20:55:03 830d522f475Smrgdnl ----------------- 831d522f475Smrgdnl Test for availability of useful gcc __attribute__ directives to quiet 832d522f475Smrgdnl compiler warnings. Though useful, not all are supported -- and contrary 833d522f475Smrgdnl to documentation, unrecognized directives cause older compilers to barf. 834d522f475SmrgAC_DEFUN([CF_GCC_ATTRIBUTES], 835d522f475Smrg[ 836d522f475Smrgif test "$GCC" = yes 837d522f475Smrgthen 838d522f475Smrgcat > conftest.i <<EOF 839d522f475Smrg#ifndef GCC_PRINTF 840d522f475Smrg#define GCC_PRINTF 0 841d522f475Smrg#endif 842d522f475Smrg#ifndef GCC_SCANF 843d522f475Smrg#define GCC_SCANF 0 844d522f475Smrg#endif 845d522f475Smrg#ifndef GCC_NORETURN 846d522f475Smrg#define GCC_NORETURN /* nothing */ 847d522f475Smrg#endif 848d522f475Smrg#ifndef GCC_UNUSED 849d522f475Smrg#define GCC_UNUSED /* nothing */ 850d522f475Smrg#endif 851d522f475SmrgEOF 852d522f475Smrgif test "$GCC" = yes 853d522f475Smrgthen 854d522f475Smrg AC_CHECKING([for $CC __attribute__ directives]) 855d522f475Smrgcat > conftest.$ac_ext <<EOF 8566879286fSmrg#line __oline__ "${as_me:-configure}" 857d522f475Smrg#include "confdefs.h" 858d522f475Smrg#include "conftest.h" 859d522f475Smrg#include "conftest.i" 860d522f475Smrg#if GCC_PRINTF 861d522f475Smrg#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) 862d522f475Smrg#else 863d522f475Smrg#define GCC_PRINTFLIKE(fmt,var) /*nothing*/ 864d522f475Smrg#endif 865d522f475Smrg#if GCC_SCANF 866d522f475Smrg#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) 867d522f475Smrg#else 868d522f475Smrg#define GCC_SCANFLIKE(fmt,var) /*nothing*/ 869d522f475Smrg#endif 870d522f475Smrgextern void wow(char *,...) GCC_SCANFLIKE(1,2); 871d522f475Smrgextern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; 872d522f475Smrgextern void foo(void) GCC_NORETURN; 873d522f475Smrgint main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; } 874d522f475SmrgEOF 87520d2c4d2Smrg cf_printf_attribute=no 87620d2c4d2Smrg cf_scanf_attribute=no 877d522f475Smrg for cf_attribute in scanf printf unused noreturn 878d522f475Smrg do 879d522f475Smrg CF_UPPER(cf_ATTRIBUTE,$cf_attribute) 880d522f475Smrg cf_directive="__attribute__(($cf_attribute))" 881d522f475Smrg echo "checking for $CC $cf_directive" 1>&AC_FD_CC 88220d2c4d2Smrg 88320d2c4d2Smrg case $cf_attribute in #(vi 88420d2c4d2Smrg printf) #(vi 88520d2c4d2Smrg cf_printf_attribute=yes 88620d2c4d2Smrg cat >conftest.h <<EOF 887d522f475Smrg#define GCC_$cf_ATTRIBUTE 1 888d522f475SmrgEOF 889d522f475Smrg ;; 89020d2c4d2Smrg scanf) #(vi 89120d2c4d2Smrg cf_scanf_attribute=yes 89220d2c4d2Smrg cat >conftest.h <<EOF 89320d2c4d2Smrg#define GCC_$cf_ATTRIBUTE 1 89420d2c4d2SmrgEOF 89520d2c4d2Smrg ;; 89620d2c4d2Smrg *) #(vi 89720d2c4d2Smrg cat >conftest.h <<EOF 898d522f475Smrg#define GCC_$cf_ATTRIBUTE $cf_directive 899d522f475SmrgEOF 900d522f475Smrg ;; 901d522f475Smrg esac 90220d2c4d2Smrg 903d522f475Smrg if AC_TRY_EVAL(ac_compile); then 904d522f475Smrg test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute) 905d522f475Smrg cat conftest.h >>confdefs.h 90620d2c4d2Smrg case $cf_attribute in #(vi 9070bd37d32Smrg noreturn) #(vi 9080bd37d32Smrg AC_DEFINE_UNQUOTED(GCC_NORETURN,$cf_directive,[Define to noreturn-attribute for gcc]) 9090bd37d32Smrg ;; 91020d2c4d2Smrg printf) #(vi 9110bd37d32Smrg cf_value='/* nothing */' 9120bd37d32Smrg if test "$cf_printf_attribute" != no ; then 9130bd37d32Smrg cf_value='__attribute__((format(printf,fmt,var)))' 9140bd37d32Smrg AC_DEFINE(GCC_PRINTF,1,[Define to 1 if the compiler supports gcc-like printf attribute.]) 91520d2c4d2Smrg fi 9160bd37d32Smrg AC_DEFINE_UNQUOTED(GCC_PRINTFLIKE(fmt,var),$cf_value,[Define to printf-attribute for gcc]) 91720d2c4d2Smrg ;; 91820d2c4d2Smrg scanf) #(vi 9190bd37d32Smrg cf_value='/* nothing */' 9200bd37d32Smrg if test "$cf_scanf_attribute" != no ; then 9210bd37d32Smrg cf_value='__attribute__((format(scanf,fmt,var)))' 9220bd37d32Smrg AC_DEFINE(GCC_SCANF,1,[Define to 1 if the compiler supports gcc-like scanf attribute.]) 92320d2c4d2Smrg fi 9240bd37d32Smrg AC_DEFINE_UNQUOTED(GCC_SCANFLIKE(fmt,var),$cf_value,[Define to sscanf-attribute for gcc]) 9250bd37d32Smrg ;; 9260bd37d32Smrg unused) #(vi 9270bd37d32Smrg AC_DEFINE_UNQUOTED(GCC_UNUSED,$cf_directive,[Define to unused-attribute for gcc]) 92820d2c4d2Smrg ;; 92920d2c4d2Smrg esac 930d522f475Smrg fi 931d522f475Smrg done 932d522f475Smrgelse 933d522f475Smrg fgrep define conftest.i >>confdefs.h 934d522f475Smrgfi 935d522f475Smrgrm -rf conftest* 936d522f475Smrgfi 937d522f475Smrg])dnl 938d522f475Smrgdnl --------------------------------------------------------------------------- 9390bd37d32Smrgdnl CF_GCC_VERSION version: 7 updated: 2012/10/18 06:46:33 940d522f475Smrgdnl -------------- 941d522f475Smrgdnl Find version of gcc 942d522f475SmrgAC_DEFUN([CF_GCC_VERSION],[ 943d522f475SmrgAC_REQUIRE([AC_PROG_CC]) 944d522f475SmrgGCC_VERSION=none 945d522f475Smrgif test "$GCC" = yes ; then 946d522f475Smrg AC_MSG_CHECKING(version of $CC) 9470bd37d32Smrg GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC[[^)]]*) //' -e 's/^.*(Debian[[^)]]*) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`" 948d522f475Smrg test -z "$GCC_VERSION" && GCC_VERSION=unknown 949d522f475Smrg AC_MSG_RESULT($GCC_VERSION) 950d522f475Smrgfi 951d522f475Smrg])dnl 952d522f475Smrgdnl --------------------------------------------------------------------------- 953e0a2b6dfSmrgdnl CF_GCC_WARNINGS version: 31 updated: 2013/11/19 19:23:35 954d522f475Smrgdnl --------------- 955d522f475Smrgdnl Check if the compiler supports useful warning options. There's a few that 956d522f475Smrgdnl we don't use, simply because they're too noisy: 957d522f475Smrgdnl 958d522f475Smrgdnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x) 959d522f475Smrgdnl -Wredundant-decls (system headers make this too noisy) 960d522f475Smrgdnl -Wtraditional (combines too many unrelated messages, only a few useful) 961d522f475Smrgdnl -Wwrite-strings (too noisy, but should review occasionally). This 962d522f475Smrgdnl is enabled for ncurses using "--enable-const". 963d522f475Smrgdnl -pedantic 964d522f475Smrgdnl 965d522f475Smrgdnl Parameter: 966d522f475Smrgdnl $1 is an optional list of gcc warning flags that a particular 967d522f475Smrgdnl application might want to use, e.g., "no-unused" for 968d522f475Smrgdnl -Wno-unused 969d522f475Smrgdnl Special: 970d522f475Smrgdnl If $with_ext_const is "yes", add a check for -Wwrite-strings 971d522f475Smrgdnl 972d522f475SmrgAC_DEFUN([CF_GCC_WARNINGS], 973d522f475Smrg[ 974d522f475SmrgAC_REQUIRE([CF_GCC_VERSION]) 975d522f475SmrgCF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS) 9760bd37d32SmrgCF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS) 977d522f475Smrg 978d522f475Smrgcat > conftest.$ac_ext <<EOF 9796879286fSmrg#line __oline__ "${as_me:-configure}" 980d522f475Smrgint main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; } 981d522f475SmrgEOF 982d522f475Smrg 983d522f475Smrgif test "$INTEL_COMPILER" = yes 984d522f475Smrgthen 985d522f475Smrg# The "-wdXXX" options suppress warnings: 986d522f475Smrg# remark #1419: external declaration in primary source file 987d522f475Smrg# remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem) 988d522f475Smrg# remark #1684: conversion from pointer to same-sized integral type (potential portability problem) 989d522f475Smrg# remark #193: zero used for undefined preprocessing identifier 990d522f475Smrg# remark #593: variable "curs_sb_left_arrow" was set but never used 991d522f475Smrg# remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits 992d522f475Smrg# remark #869: parameter "tw" was never referenced 993d522f475Smrg# remark #981: operands are evaluated in unspecified order 994956cc18dSsnj# warning #279: controlling expression is constant 995d522f475Smrg 996d522f475Smrg AC_CHECKING([for $CC warning options]) 997d522f475Smrg cf_save_CFLAGS="$CFLAGS" 998d522f475Smrg EXTRA_CFLAGS="-Wall" 999d522f475Smrg for cf_opt in \ 1000d522f475Smrg wd1419 \ 1001d522f475Smrg wd1683 \ 1002d522f475Smrg wd1684 \ 1003d522f475Smrg wd193 \ 1004d522f475Smrg wd593 \ 1005956cc18dSsnj wd279 \ 1006d522f475Smrg wd810 \ 1007d522f475Smrg wd869 \ 1008d522f475Smrg wd981 1009d522f475Smrg do 1010d522f475Smrg CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" 1011d522f475Smrg if AC_TRY_EVAL(ac_compile); then 1012d522f475Smrg test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt) 1013d522f475Smrg EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" 1014d522f475Smrg fi 1015d522f475Smrg done 1016d522f475Smrg CFLAGS="$cf_save_CFLAGS" 1017d522f475Smrg 1018d522f475Smrgelif test "$GCC" = yes 1019d522f475Smrgthen 1020d522f475Smrg AC_CHECKING([for $CC warning options]) 1021d522f475Smrg cf_save_CFLAGS="$CFLAGS" 102220d2c4d2Smrg EXTRA_CFLAGS= 1023d522f475Smrg cf_warn_CONST="" 1024d522f475Smrg test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings" 1025e0a2b6dfSmrg cf_gcc_warnings="Wignored-qualifiers Wlogical-op Wvarargs" 1026e0a2b6dfSmrg test "x$CLANG_COMPILER" = xyes && cf_gcc_warnings= 102720d2c4d2Smrg for cf_opt in W Wall \ 1028d522f475Smrg Wbad-function-cast \ 1029d522f475Smrg Wcast-align \ 1030d522f475Smrg Wcast-qual \ 1031e0a2b6dfSmrg Wdeclaration-after-statement \ 1032e0a2b6dfSmrg Wextra \ 1033d522f475Smrg Winline \ 1034d522f475Smrg Wmissing-declarations \ 1035d522f475Smrg Wmissing-prototypes \ 1036d522f475Smrg Wnested-externs \ 1037d522f475Smrg Wpointer-arith \ 1038d522f475Smrg Wshadow \ 1039d522f475Smrg Wstrict-prototypes \ 1040e0a2b6dfSmrg Wundef $cf_gcc_warnings $cf_warn_CONST $1 1041d522f475Smrg do 1042d522f475Smrg CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" 1043d522f475Smrg if AC_TRY_EVAL(ac_compile); then 1044d522f475Smrg test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt) 1045d522f475Smrg case $cf_opt in #(vi 1046d522f475Smrg Wcast-qual) #(vi 1047d522f475Smrg CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES" 1048d522f475Smrg ;; 1049d522f475Smrg Winline) #(vi 1050d522f475Smrg case $GCC_VERSION in 10512eaa94a1Schristos [[34]].*) 1052d522f475Smrg CF_VERBOSE(feature is broken in gcc $GCC_VERSION) 1053d522f475Smrg continue;; 1054d522f475Smrg esac 1055d522f475Smrg ;; 10560bd37d32Smrg Wpointer-arith) #(vi 10570bd37d32Smrg case $GCC_VERSION in 10580bd37d32Smrg [[12]].*) 10590bd37d32Smrg CF_VERBOSE(feature is broken in gcc $GCC_VERSION) 10600bd37d32Smrg continue;; 10610bd37d32Smrg esac 10620bd37d32Smrg ;; 1063d522f475Smrg esac 1064d522f475Smrg EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" 1065d522f475Smrg fi 1066d522f475Smrg done 1067d522f475Smrg CFLAGS="$cf_save_CFLAGS" 1068d522f475Smrgfi 10696879286fSmrgrm -rf conftest* 1070d522f475Smrg 1071d522f475SmrgAC_SUBST(EXTRA_CFLAGS) 1072d522f475Smrg])dnl 1073d522f475Smrgdnl --------------------------------------------------------------------------- 1074d522f475Smrgdnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07 1075d522f475Smrgdnl ------------- 1076d522f475Smrgdnl Check if we must define _GNU_SOURCE to get a reasonable value for 1077d522f475Smrgdnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect 1078d522f475Smrgdnl (or misfeature) of glibc2, which breaks portability of many applications, 1079d522f475Smrgdnl since it is interwoven with GNU extensions. 1080d522f475Smrgdnl 1081d522f475Smrgdnl Well, yes we could work around it... 1082d522f475SmrgAC_DEFUN([CF_GNU_SOURCE], 1083d522f475Smrg[ 1084d522f475SmrgAC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[ 1085d522f475SmrgAC_TRY_COMPILE([#include <sys/types.h>],[ 1086d522f475Smrg#ifndef _XOPEN_SOURCE 1087d522f475Smrgmake an error 1088d522f475Smrg#endif], 1089d522f475Smrg [cf_cv_gnu_source=no], 1090d522f475Smrg [cf_save="$CPPFLAGS" 1091d522f475Smrg CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" 1092d522f475Smrg AC_TRY_COMPILE([#include <sys/types.h>],[ 1093d522f475Smrg#ifdef _XOPEN_SOURCE 1094d522f475Smrgmake an error 1095d522f475Smrg#endif], 1096d522f475Smrg [cf_cv_gnu_source=no], 1097d522f475Smrg [cf_cv_gnu_source=yes]) 1098d522f475Smrg CPPFLAGS="$cf_save" 1099d522f475Smrg ]) 1100d522f475Smrg]) 1101d522f475Smrgtest "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" 1102d522f475Smrg])dnl 1103d522f475Smrgdnl --------------------------------------------------------------------------- 1104d522f475Smrgdnl CF_HELP_MESSAGE version: 3 updated: 1998/01/14 10:56:23 1105d522f475Smrgdnl --------------- 1106d522f475Smrgdnl Insert text into the help-message, for readability, from AC_ARG_WITH. 1107d522f475SmrgAC_DEFUN([CF_HELP_MESSAGE], 1108d522f475Smrg[AC_DIVERT_HELP([$1])dnl 1109d522f475Smrg])dnl 1110d522f475Smrgdnl --------------------------------------------------------------------------- 111120d2c4d2Smrgdnl CF_IMAKE_CFLAGS version: 31 updated: 2010/05/26 05:38:42 1112d522f475Smrgdnl --------------- 1113d522f475Smrgdnl Use imake to obtain compiler flags. We could, in principle, write tests to 1114d522f475Smrgdnl get these, but if imake is properly configured there is no point in doing 1115d522f475Smrgdnl this. 1116d522f475Smrgdnl 1117d522f475Smrgdnl Parameters (used in constructing a sample Imakefile): 1118d522f475Smrgdnl $1 = optional value to append to $IMAKE_CFLAGS 1119d522f475Smrgdnl $2 = optional value to append to $IMAKE_LOADFLAGS 1120d522f475SmrgAC_DEFUN([CF_IMAKE_CFLAGS], 1121d522f475Smrg[ 1122d522f475SmrgAC_PATH_PROGS(IMAKE,xmkmf imake) 1123d522f475Smrg 1124d522f475Smrgif test -n "$IMAKE" ; then 1125d522f475Smrg 1126d522f475Smrgcase $IMAKE in # (vi 1127d522f475Smrg*/imake) 1128d522f475Smrg cf_imake_opts="-DUseInstalled=YES" # (vi 1129d522f475Smrg ;; 1130d522f475Smrg*/util/xmkmf) 1131d522f475Smrg # A single parameter tells xmkmf where the config-files are: 1132d522f475Smrg cf_imake_opts="`echo $IMAKE|sed -e s,/config/util/xmkmf,,`" # (vi 1133d522f475Smrg ;; 1134d522f475Smrg*) 1135d522f475Smrg cf_imake_opts= 1136d522f475Smrg ;; 1137d522f475Smrgesac 1138d522f475Smrg 1139d522f475Smrg# If it's installed properly, imake (or its wrapper, xmkmf) will point to the 1140d522f475Smrg# config directory. 1141d522f475Smrgif mkdir conftestdir; then 1142d522f475Smrg CDPATH=; export CDPATH 1143d522f475Smrg cf_makefile=`cd $srcdir;pwd`/Imakefile 1144d522f475Smrg cd conftestdir 1145d522f475Smrg 1146d522f475Smrg cat >fix_cflags.sed <<'CF_EOF' 1147d522f475Smrgs/\\//g 1148d522f475Smrgs/[[ ]][[ ]]*/ /g 1149d522f475Smrgs/"//g 1150d522f475Smrg:pack 1151d522f475Smrgs/\(=[[^ ]][[^ ]]*\) \([[^-]]\)/\1 \2/g 1152d522f475Smrgt pack 1153d522f475Smrgs/\(-D[[a-zA-Z0-9_]][[a-zA-Z0-9_]]*\)=\([[^\'0-9 ]][[^ ]]*\)/\1='\\"\2\\"'/g 1154d522f475Smrgs/^IMAKE[[ ]]/IMAKE_CFLAGS="/ 1155d522f475Smrgs/ / /g 1156d522f475Smrgs/$/"/ 1157d522f475SmrgCF_EOF 1158d522f475Smrg 1159d522f475Smrg cat >fix_lflags.sed <<'CF_EOF' 1160d522f475Smrgs/^IMAKE[[ ]]*/IMAKE_LOADFLAGS="/ 1161d522f475Smrgs/$/"/ 1162d522f475SmrgCF_EOF 1163d522f475Smrg 1164d522f475Smrg echo >./Imakefile 1165d522f475Smrg test -f $cf_makefile && cat $cf_makefile >>./Imakefile 1166d522f475Smrg 1167d522f475Smrg cat >> ./Imakefile <<'CF_EOF' 1168d522f475Smrgfindstddefs: 116920d2c4d2Smrg @echo IMAKE ${ALLDEFINES}ifelse([$1],,,[ $1]) | sed -f fix_cflags.sed 117020d2c4d2Smrg @echo IMAKE ${EXTRA_LOAD_FLAGS}ifelse([$2],,,[ $2]) | sed -f fix_lflags.sed 1171d522f475SmrgCF_EOF 1172d522f475Smrg 1173d522f475Smrg if ( $IMAKE $cf_imake_opts 1>/dev/null 2>&AC_FD_CC && test -f Makefile) 1174d522f475Smrg then 1175d522f475Smrg CF_VERBOSE(Using $IMAKE $cf_imake_opts) 1176d522f475Smrg else 1177d522f475Smrg # sometimes imake doesn't have the config path compiled in. Find it. 1178d522f475Smrg cf_config= 1179d522f475Smrg for cf_libpath in $X_LIBS $LIBS ; do 1180d522f475Smrg case $cf_libpath in # (vi 1181d522f475Smrg -L*) 1182d522f475Smrg cf_libpath=`echo .$cf_libpath | sed -e 's/^...//'` 1183d522f475Smrg cf_libpath=$cf_libpath/X11/config 1184d522f475Smrg if test -d $cf_libpath ; then 1185d522f475Smrg cf_config=$cf_libpath 1186d522f475Smrg break 1187d522f475Smrg fi 1188d522f475Smrg ;; 1189d522f475Smrg esac 1190d522f475Smrg done 1191d522f475Smrg if test -z "$cf_config" ; then 1192d522f475Smrg AC_MSG_WARN(Could not find imake config-directory) 1193d522f475Smrg else 1194d522f475Smrg cf_imake_opts="$cf_imake_opts -I$cf_config" 1195d522f475Smrg if ( $IMAKE -v $cf_imake_opts 2>&AC_FD_CC) 1196d522f475Smrg then 1197d522f475Smrg CF_VERBOSE(Using $IMAKE $cf_config) 1198d522f475Smrg else 1199d522f475Smrg AC_MSG_WARN(Cannot run $IMAKE) 1200d522f475Smrg fi 1201d522f475Smrg fi 1202d522f475Smrg fi 1203d522f475Smrg 1204d522f475Smrg # GNU make sometimes prints "make[1]: Entering...", which 1205d522f475Smrg # would confuse us. 1206d522f475Smrg eval `make findstddefs 2>/dev/null | grep -v make` 1207d522f475Smrg 1208d522f475Smrg cd .. 1209d522f475Smrg rm -rf conftestdir 1210d522f475Smrg 1211d522f475Smrg # We use ${ALLDEFINES} rather than ${STD_DEFINES} because the former 1212d522f475Smrg # declares XTFUNCPROTO there. However, some vendors (e.g., SGI) have 1213d522f475Smrg # modified it to support site.cf, adding a kludge for the /usr/include 1214d522f475Smrg # directory. Try to filter that out, otherwise gcc won't find its 1215d522f475Smrg # headers. 1216d522f475Smrg if test -n "$GCC" ; then 1217d522f475Smrg if test -n "$IMAKE_CFLAGS" ; then 1218d522f475Smrg cf_nostdinc="" 1219d522f475Smrg cf_std_incl="" 1220d522f475Smrg cf_cpp_opts="" 1221d522f475Smrg for cf_opt in $IMAKE_CFLAGS 1222d522f475Smrg do 1223d522f475Smrg case "$cf_opt" in 1224d522f475Smrg -nostdinc) #(vi 1225d522f475Smrg cf_nostdinc="$cf_opt" 1226d522f475Smrg ;; 1227d522f475Smrg -I/usr/include) #(vi 1228d522f475Smrg cf_std_incl="$cf_opt" 1229d522f475Smrg ;; 1230d522f475Smrg *) #(vi 1231d522f475Smrg cf_cpp_opts="$cf_cpp_opts $cf_opt" 1232d522f475Smrg ;; 1233d522f475Smrg esac 1234d522f475Smrg done 1235d522f475Smrg if test -z "$cf_nostdinc" ; then 1236d522f475Smrg IMAKE_CFLAGS="$cf_cpp_opts $cf_std_incl" 1237d522f475Smrg elif test -z "$cf_std_incl" ; then 1238d522f475Smrg IMAKE_CFLAGS="$cf_cpp_opts $cf_nostdinc" 1239d522f475Smrg else 1240d522f475Smrg CF_VERBOSE(suppressed \"$cf_nostdinc\" and \"$cf_std_incl\") 1241d522f475Smrg IMAKE_CFLAGS="$cf_cpp_opts" 1242d522f475Smrg fi 1243d522f475Smrg fi 1244d522f475Smrg fi 1245d522f475Smrgfi 1246d522f475Smrg 1247d522f475Smrg# Some imake configurations define PROJECTROOT with an empty value. Remove 1248d522f475Smrg# the empty definition. 1249d522f475Smrgcase $IMAKE_CFLAGS in 1250d522f475Smrg*-DPROJECTROOT=/*) 1251d522f475Smrg ;; 1252d522f475Smrg*) 1253d522f475Smrg IMAKE_CFLAGS=`echo "$IMAKE_CFLAGS" |sed -e "s,-DPROJECTROOT=[[ ]], ,"` 1254d522f475Smrg ;; 1255d522f475Smrgesac 1256d522f475Smrg 1257d522f475Smrgfi 1258d522f475Smrg 1259d522f475SmrgCF_VERBOSE(IMAKE_CFLAGS $IMAKE_CFLAGS) 1260d522f475SmrgCF_VERBOSE(IMAKE_LOADFLAGS $IMAKE_LOADFLAGS) 1261d522f475Smrg 1262d522f475SmrgAC_SUBST(IMAKE_CFLAGS) 1263d522f475SmrgAC_SUBST(IMAKE_LOADFLAGS) 1264d522f475Smrg])dnl 1265d522f475Smrgdnl --------------------------------------------------------------------------- 1266d522f475Smrgdnl CF_INPUT_METHOD version: 3 updated: 2000/04/11 23:46:57 1267d522f475Smrgdnl --------------- 1268d522f475Smrgdnl Check if the X libraries support input-method 1269d522f475SmrgAC_DEFUN([CF_INPUT_METHOD], 1270d522f475Smrg[ 1271d522f475SmrgAC_CACHE_CHECK([if X libraries support input-method],cf_cv_input_method,[ 1272d522f475SmrgAC_TRY_LINK([ 1273d522f475Smrg#include <X11/IntrinsicP.h> 1274d522f475Smrg#include <X11/Xatom.h> 1275d522f475Smrg#include <X11/Xutil.h> 1276d522f475Smrg#include <X11/Xmu/Atoms.h> 1277d522f475Smrg#include <X11/Xmu/Converters.h> 1278d522f475Smrg#include <X11/Xaw/XawImP.h> 1279d522f475Smrg],[ 1280d522f475Smrg{ 1281d522f475Smrg XIM xim; 1282d522f475Smrg XIMStyles *xim_styles = 0; 1283d522f475Smrg XIMStyle input_style; 1284d522f475Smrg Widget w = 0; 1285d522f475Smrg 1286d522f475Smrg XSetLocaleModifiers("@im=none"); 1287d522f475Smrg xim = XOpenIM(XtDisplay(w), NULL, NULL, NULL); 1288d522f475Smrg XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL); 1289d522f475Smrg XCloseIM(xim); 1290d522f475Smrg input_style = (XIMPreeditNothing | XIMStatusNothing); 1291d522f475Smrg} 1292d522f475Smrg], 1293d522f475Smrg[cf_cv_input_method=yes], 1294d522f475Smrg[cf_cv_input_method=no])]) 1295d522f475Smrg])dnl 1296d522f475Smrgdnl --------------------------------------------------------------------------- 1297894e0ac8Smrgdnl CF_INTEL_COMPILER version: 6 updated: 2014/03/17 13:13:07 1298d522f475Smrgdnl ----------------- 1299d522f475Smrgdnl Check if the given compiler is really the Intel compiler for Linux. It 1300d522f475Smrgdnl tries to imitate gcc, but does not return an error when it finds a mismatch 1301d522f475Smrgdnl between prototypes, e.g., as exercised by CF_MISSING_CHECK. 1302d522f475Smrgdnl 1303d522f475Smrgdnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to 1304d522f475Smrgdnl ensure that it is not mistaken for gcc/g++. It is normally invoked from 1305d522f475Smrgdnl the wrappers for gcc and g++ warnings. 1306d522f475Smrgdnl 1307d522f475Smrgdnl $1 = GCC (default) or GXX 1308d522f475Smrgdnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS 1309d522f475Smrgdnl $3 = CFLAGS (default) or CXXFLAGS 1310d522f475SmrgAC_DEFUN([CF_INTEL_COMPILER],[ 13110bd37d32SmrgAC_REQUIRE([AC_CANONICAL_HOST]) 131220d2c4d2Smrgifelse([$2],,INTEL_COMPILER,[$2])=no 1313d522f475Smrg 131420d2c4d2Smrgif test "$ifelse([$1],,[$1],GCC)" = yes ; then 1315d522f475Smrg case $host_os in 1316d522f475Smrg linux*|gnu*) 131720d2c4d2Smrg AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler) 131820d2c4d2Smrg cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" 131920d2c4d2Smrg ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc" 1320d522f475Smrg AC_TRY_COMPILE([],[ 1321d522f475Smrg#ifdef __INTEL_COMPILER 1322d522f475Smrg#else 1323d522f475Smrgmake an error 1324d522f475Smrg#endif 132520d2c4d2Smrg],[ifelse([$2],,INTEL_COMPILER,[$2])=yes 1326894e0ac8Smrgcf_save_CFLAGS="$cf_save_CFLAGS -we147" 1327d522f475Smrg],[]) 132820d2c4d2Smrg ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" 132920d2c4d2Smrg AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2])) 1330d522f475Smrg ;; 1331d522f475Smrg esac 1332d522f475Smrgfi 1333d522f475Smrg])dnl 1334d522f475Smrgdnl --------------------------------------------------------------------------- 13350bd37d32Smrgdnl CF_LASTLOG version: 5 updated: 2012/10/04 20:12:20 1336d522f475Smrgdnl ---------- 1337d522f475Smrgdnl Check for header defining _PATH_LASTLOG, or failing that, see if the lastlog 1338d522f475Smrgdnl file exists. 1339d522f475SmrgAC_DEFUN([CF_LASTLOG], 1340d522f475Smrg[ 1341d522f475SmrgAC_CHECK_HEADERS(lastlog.h paths.h) 1342d522f475SmrgAC_CACHE_CHECK(for lastlog path,cf_cv_path_lastlog,[ 1343d522f475SmrgAC_TRY_COMPILE([ 1344d522f475Smrg#include <sys/types.h> 1345d522f475Smrg#ifdef HAVE_LASTLOG_H 1346d522f475Smrg#include <lastlog.h> 1347d522f475Smrg#else 1348d522f475Smrg#ifdef HAVE_PATHS_H 1349d522f475Smrg#include <paths.h> 1350d522f475Smrg#endif 1351d522f475Smrg#endif],[char *path = _PATH_LASTLOG], 1352d522f475Smrg [cf_cv_path_lastlog="_PATH_LASTLOG"], 1353d522f475Smrg [if test -f /usr/adm/lastlog ; then 1354d522f475Smrg cf_cv_path_lastlog=/usr/adm/lastlog 1355d522f475Smrg else 1356d522f475Smrg cf_cv_path_lastlog=no 1357d522f475Smrg fi]) 1358d522f475Smrg]) 13590bd37d32Smrgtest $cf_cv_path_lastlog != no && AC_DEFINE(USE_LASTLOG,1,[Define to 1 if we can define lastlog pathname]) 1360d522f475Smrg])dnl 1361d522f475Smrgdnl --------------------------------------------------------------------------- 13620bd37d32Smrgdnl CF_LD_RPATH_OPT version: 5 updated: 2011/07/17 14:48:41 136320d2c4d2Smrgdnl --------------- 136420d2c4d2Smrgdnl For the given system and compiler, find the compiler flags to pass to the 136520d2c4d2Smrgdnl loader to use the "rpath" feature. 136620d2c4d2SmrgAC_DEFUN([CF_LD_RPATH_OPT], 136720d2c4d2Smrg[ 136820d2c4d2SmrgAC_REQUIRE([CF_CHECK_CACHE]) 136920d2c4d2Smrg 137020d2c4d2SmrgLD_RPATH_OPT= 137120d2c4d2SmrgAC_MSG_CHECKING(for an rpath option) 137220d2c4d2Smrgcase $cf_cv_system_name in #(vi 137320d2c4d2Smrgirix*) #(vi 137420d2c4d2Smrg if test "$GCC" = yes; then 137520d2c4d2Smrg LD_RPATH_OPT="-Wl,-rpath," 137620d2c4d2Smrg else 137720d2c4d2Smrg LD_RPATH_OPT="-rpath " 137820d2c4d2Smrg fi 137920d2c4d2Smrg ;; 138020d2c4d2Smrglinux*|gnu*|k*bsd*-gnu) #(vi 138120d2c4d2Smrg LD_RPATH_OPT="-Wl,-rpath," 138220d2c4d2Smrg ;; 1383e39b573cSmrgopenbsd[[2-9]].*|mirbsd*) #(vi 138420d2c4d2Smrg LD_RPATH_OPT="-Wl,-rpath," 138520d2c4d2Smrg ;; 13860bd37d32Smrgdragonfly*|freebsd*) #(vi 138720d2c4d2Smrg LD_RPATH_OPT="-rpath " 138820d2c4d2Smrg ;; 138920d2c4d2Smrgnetbsd*) #(vi 139020d2c4d2Smrg LD_RPATH_OPT="-Wl,-rpath," 139120d2c4d2Smrg ;; 139220d2c4d2Smrgosf*|mls+*) #(vi 139320d2c4d2Smrg LD_RPATH_OPT="-rpath " 139420d2c4d2Smrg ;; 139520d2c4d2Smrgsolaris2*) #(vi 139620d2c4d2Smrg LD_RPATH_OPT="-R" 139720d2c4d2Smrg ;; 139820d2c4d2Smrg*) 139920d2c4d2Smrg ;; 140020d2c4d2Smrgesac 140120d2c4d2SmrgAC_MSG_RESULT($LD_RPATH_OPT) 140220d2c4d2Smrg 140320d2c4d2Smrgcase "x$LD_RPATH_OPT" in #(vi 140420d2c4d2Smrgx-R*) 140520d2c4d2Smrg AC_MSG_CHECKING(if we need a space after rpath option) 140620d2c4d2Smrg cf_save_LIBS="$LIBS" 140720d2c4d2Smrg CF_ADD_LIBS(${LD_RPATH_OPT}$libdir) 140820d2c4d2Smrg AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes) 140920d2c4d2Smrg LIBS="$cf_save_LIBS" 141020d2c4d2Smrg AC_MSG_RESULT($cf_rpath_space) 141120d2c4d2Smrg test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT " 141220d2c4d2Smrg ;; 141320d2c4d2Smrgesac 141420d2c4d2Smrg])dnl 141520d2c4d2Smrgdnl --------------------------------------------------------------------------- 14166879286fSmrgdnl CF_MAKE_TAGS version: 6 updated: 2010/10/23 15:52:32 141720d2c4d2Smrgdnl ------------ 141820d2c4d2Smrgdnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have 141920d2c4d2Smrgdnl a monocase filesystem. 142020d2c4d2SmrgAC_DEFUN([CF_MAKE_TAGS],[ 142120d2c4d2SmrgAC_REQUIRE([CF_MIXEDCASE_FILENAMES]) 142220d2c4d2Smrg 142320d2c4d2SmrgAC_CHECK_PROGS(CTAGS, exctags ctags) 142420d2c4d2SmrgAC_CHECK_PROGS(ETAGS, exetags etags) 142520d2c4d2Smrg 14266879286fSmrgAC_CHECK_PROG(MAKE_LOWER_TAGS, ${CTAGS:-ctags}, yes, no) 142720d2c4d2Smrg 142820d2c4d2Smrgif test "$cf_cv_mixedcase" = yes ; then 14296879286fSmrg AC_CHECK_PROG(MAKE_UPPER_TAGS, ${ETAGS:-etags}, yes, no) 143020d2c4d2Smrgelse 143120d2c4d2Smrg MAKE_UPPER_TAGS=no 143220d2c4d2Smrgfi 143320d2c4d2Smrg 143420d2c4d2Smrgif test "$MAKE_UPPER_TAGS" = yes ; then 143520d2c4d2Smrg MAKE_UPPER_TAGS= 143620d2c4d2Smrgelse 143720d2c4d2Smrg MAKE_UPPER_TAGS="#" 143820d2c4d2Smrgfi 143920d2c4d2Smrg 144020d2c4d2Smrgif test "$MAKE_LOWER_TAGS" = yes ; then 144120d2c4d2Smrg MAKE_LOWER_TAGS= 144220d2c4d2Smrgelse 144320d2c4d2Smrg MAKE_LOWER_TAGS="#" 144420d2c4d2Smrgfi 144520d2c4d2Smrg 144620d2c4d2SmrgAC_SUBST(CTAGS) 144720d2c4d2SmrgAC_SUBST(ETAGS) 144820d2c4d2Smrg 144920d2c4d2SmrgAC_SUBST(MAKE_UPPER_TAGS) 145020d2c4d2SmrgAC_SUBST(MAKE_LOWER_TAGS) 145120d2c4d2Smrg])dnl 145220d2c4d2Smrgdnl --------------------------------------------------------------------------- 1453894e0ac8Smrgdnl CF_MATH_LIB version: 8 updated: 2010/05/29 16:31:02 1454894e0ac8Smrgdnl ----------- 1455894e0ac8Smrgdnl Checks for libraries. At least one UNIX system, Apple Macintosh 1456894e0ac8Smrgdnl Rhapsody 5.5, does not have -lm. We cannot use the simpler 1457894e0ac8Smrgdnl AC_CHECK_LIB(m,sin), because that fails for C++. 1458894e0ac8SmrgAC_DEFUN([CF_MATH_LIB], 1459894e0ac8Smrg[ 1460894e0ac8SmrgAC_CACHE_CHECK(if -lm needed for math functions, 1461894e0ac8Smrg cf_cv_need_libm,[ 1462894e0ac8Smrg AC_TRY_LINK([ 1463894e0ac8Smrg #include <stdio.h> 1464894e0ac8Smrg #include <math.h> 1465894e0ac8Smrg ], 1466894e0ac8Smrg [double x = rand(); printf("result = %g\n", ]ifelse([$2],,sin(x),$2)[)], 1467894e0ac8Smrg [cf_cv_need_libm=no], 1468894e0ac8Smrg [cf_cv_need_libm=yes])]) 1469894e0ac8Smrgif test "$cf_cv_need_libm" = yes 1470894e0ac8Smrgthen 1471894e0ac8Smrgifelse($1,,[ 1472894e0ac8Smrg CF_ADD_LIB(m) 1473894e0ac8Smrg],[$1=-lm]) 1474894e0ac8Smrgfi 1475894e0ac8Smrg]) 1476894e0ac8Smrgdnl --------------------------------------------------------------------------- 1477e0a2b6dfSmrgdnl CF_MIXEDCASE_FILENAMES version: 6 updated: 2013/10/08 17:47:05 147820d2c4d2Smrgdnl ---------------------- 147920d2c4d2Smrgdnl Check if the file-system supports mixed-case filenames. If we're able to 148020d2c4d2Smrgdnl create a lowercase name and see it as uppercase, it doesn't support that. 148120d2c4d2SmrgAC_DEFUN([CF_MIXEDCASE_FILENAMES], 148220d2c4d2Smrg[ 148320d2c4d2SmrgAC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[ 148420d2c4d2Smrgif test "$cross_compiling" = yes ; then 148520d2c4d2Smrg case $target_alias in #(vi 1486e0a2b6dfSmrg *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw*|*-uwin*) #(vi 148720d2c4d2Smrg cf_cv_mixedcase=no 148820d2c4d2Smrg ;; 148920d2c4d2Smrg *) 149020d2c4d2Smrg cf_cv_mixedcase=yes 149120d2c4d2Smrg ;; 149220d2c4d2Smrg esac 149320d2c4d2Smrgelse 149420d2c4d2Smrg rm -f conftest CONFTEST 149520d2c4d2Smrg echo test >conftest 149620d2c4d2Smrg if test -f CONFTEST ; then 149720d2c4d2Smrg cf_cv_mixedcase=no 149820d2c4d2Smrg else 149920d2c4d2Smrg cf_cv_mixedcase=yes 150020d2c4d2Smrg fi 150120d2c4d2Smrg rm -f conftest CONFTEST 150220d2c4d2Smrgfi 150320d2c4d2Smrg]) 15040bd37d32Smrgtest "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if filesystem supports mixed-case filenames.]) 150520d2c4d2Smrg])dnl 150620d2c4d2Smrgdnl --------------------------------------------------------------------------- 15076879286fSmrgdnl CF_MSG_LOG version: 5 updated: 2010/10/23 15:52:32 1508d522f475Smrgdnl ---------- 1509d522f475Smrgdnl Write a debug message to config.log, along with the line number in the 1510d522f475Smrgdnl configure script. 1511d522f475SmrgAC_DEFUN([CF_MSG_LOG],[ 15126879286fSmrgecho "${as_me:-configure}:__oline__: testing $* ..." 1>&AC_FD_CC 1513d522f475Smrg])dnl 1514d522f475Smrgdnl --------------------------------------------------------------------------- 15150bd37d32Smrgdnl CF_NO_LEAKS_OPTION version: 5 updated: 2012/10/02 20:55:03 15160bd37d32Smrgdnl ------------------ 15170bd37d32Smrgdnl see CF_WITH_NO_LEAKS 15180bd37d32SmrgAC_DEFUN([CF_NO_LEAKS_OPTION],[ 15190bd37d32SmrgAC_MSG_CHECKING(if you want to use $1 for testing) 15200bd37d32SmrgAC_ARG_WITH($1, 15210bd37d32Smrg [$2], 15220bd37d32Smrg [AC_DEFINE_UNQUOTED($3,1,"Define to 1 if you want to use $1 for testing.")ifelse([$4],,[ 15230bd37d32Smrg $4 15240bd37d32Smrg]) 15250bd37d32Smrg : ${with_cflags:=-g} 15260bd37d32Smrg : ${with_no_leaks:=yes} 15270bd37d32Smrg with_$1=yes], 15280bd37d32Smrg [with_$1=]) 15290bd37d32SmrgAC_MSG_RESULT(${with_$1:-no}) 15300bd37d32Smrg 15310bd37d32Smrgcase .$with_cflags in #(vi 15320bd37d32Smrg.*-g*) 15330bd37d32Smrg case .$CFLAGS in #(vi 15340bd37d32Smrg .*-g*) #(vi 15350bd37d32Smrg ;; 15360bd37d32Smrg *) 15370bd37d32Smrg CF_ADD_CFLAGS([-g]) 15380bd37d32Smrg ;; 15390bd37d32Smrg esac 15400bd37d32Smrg ;; 15410bd37d32Smrgesac 15420bd37d32Smrg])dnl 15430bd37d32Smrgdnl --------------------------------------------------------------------------- 15440bd37d32Smrgdnl CF_PATHSEP version: 6 updated: 2012/09/29 18:38:12 1545956cc18dSsnjdnl ---------- 15460bd37d32Smrgdnl Provide a value for the $PATH and similar separator (or amend the value 15470bd37d32Smrgdnl as provided in autoconf 2.5x). 1548956cc18dSsnjAC_DEFUN([CF_PATHSEP], 1549956cc18dSsnj[ 15500bd37d32Smrg AC_MSG_CHECKING(for PATH separator) 1551956cc18dSsnj case $cf_cv_system_name in 1552956cc18dSsnj os2*) PATH_SEPARATOR=';' ;; 15530bd37d32Smrg *) ${PATH_SEPARATOR:=':'} ;; 1554956cc18dSsnj esac 155520d2c4d2Smrgifelse([$1],,,[$1=$PATH_SEPARATOR]) 1556956cc18dSsnj AC_SUBST(PATH_SEPARATOR) 15570bd37d32Smrg AC_MSG_RESULT($PATH_SEPARATOR) 1558956cc18dSsnj])dnl 1559956cc18dSsnjdnl --------------------------------------------------------------------------- 15600bd37d32Smrgdnl CF_PATH_PROG version: 9 updated: 2012/10/04 20:12:20 1561d522f475Smrgdnl ------------ 1562d522f475Smrgdnl Check for a given program, defining corresponding symbol. 1563d522f475Smrgdnl $1 = environment variable, which is suffixed by "_PATH" in the #define. 1564d522f475Smrgdnl $2 = program name to find. 1565d522f475Smrgdnl $3 = optional list of additional program names to test. 1566d522f475Smrgdnl 1567d522f475Smrgdnl If there is more than one token in the result, #define the remaining tokens 1568d522f475Smrgdnl to $1_ARGS. We need this for 'install' in particular. 1569d522f475Smrgdnl 1570d522f475Smrgdnl FIXME: we should allow this to be overridden by environment variables 1571d522f475Smrgdnl 1572d522f475SmrgAC_DEFUN([CF_PATH_PROG],[ 1573956cc18dSsnjAC_REQUIRE([CF_PATHSEP]) 1574d522f475Smrgtest -z "[$]$1" && $1=$2 1575d522f475SmrgAC_PATH_PROGS($1,[$]$1 $2 $3,[$]$1) 1576d522f475Smrg 1577d522f475Smrgcf_path_prog="" 1578d522f475Smrgcf_path_args="" 15796879286fSmrgIFS="${IFS:- }"; cf_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR" 1580d522f475Smrgfor cf_temp in $ac_cv_path_$1 1581d522f475Smrgdo 1582d522f475Smrg if test -z "$cf_path_prog" ; then 1583d522f475Smrg if test "$with_full_paths" = yes ; then 1584d522f475Smrg CF_PATH_SYNTAX(cf_temp,break) 1585d522f475Smrg cf_path_prog="$cf_temp" 1586d522f475Smrg else 1587d522f475Smrg cf_path_prog="`basename $cf_temp`" 1588d522f475Smrg fi 1589d522f475Smrg elif test -z "$cf_path_args" ; then 1590d522f475Smrg cf_path_args="$cf_temp" 1591d522f475Smrg else 1592d522f475Smrg cf_path_args="$cf_path_args $cf_temp" 1593d522f475Smrg fi 1594d522f475Smrgdone 1595d522f475SmrgIFS="$cf_save_ifs" 1596d522f475Smrg 1597d522f475Smrgif test -n "$cf_path_prog" ; then 1598d522f475Smrg CF_MSG_LOG(defining path for ${cf_path_prog}) 15990bd37d32Smrg AC_DEFINE_UNQUOTED($1_PATH,"$cf_path_prog",Define to pathname $1) 16000bd37d32Smrg test -n "$cf_path_args" && AC_DEFINE_UNQUOTED($1_ARGS,"$cf_path_args",Define to provide args for $1) 1601d522f475Smrgfi 1602d522f475Smrg])dnl 1603d522f475Smrgdnl --------------------------------------------------------------------------- 16040bd37d32Smrgdnl CF_PATH_SYNTAX version: 14 updated: 2012/06/19 20:58:54 1605d522f475Smrgdnl -------------- 1606d522f475Smrgdnl Check the argument to see that it looks like a pathname. Rewrite it if it 1607d522f475Smrgdnl begins with one of the prefix/exec_prefix variables, and then again if the 1608d522f475Smrgdnl result begins with 'NONE'. This is necessary to work around autoconf's 1609d522f475Smrgdnl delayed evaluation of those symbols. 1610d522f475SmrgAC_DEFUN([CF_PATH_SYNTAX],[ 1611d522f475Smrgif test "x$prefix" != xNONE; then 1612d522f475Smrg cf_path_syntax="$prefix" 1613d522f475Smrgelse 1614d522f475Smrg cf_path_syntax="$ac_default_prefix" 1615d522f475Smrgfi 1616d522f475Smrg 1617d522f475Smrgcase ".[$]$1" in #(vi 1618d522f475Smrg.\[$]\(*\)*|.\'*\'*) #(vi 1619d522f475Smrg ;; 1620d522f475Smrg..|./*|.\\*) #(vi 1621d522f475Smrg ;; 1622d522f475Smrg.[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX 1623d522f475Smrg ;; 16240bd37d32Smrg.\[$]{*prefix}*|.\[$]{*dir}*) #(vi 1625d522f475Smrg eval $1="[$]$1" 1626d522f475Smrg case ".[$]$1" in #(vi 1627d522f475Smrg .NONE/*) 1628d522f475Smrg $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%` 1629d522f475Smrg ;; 1630d522f475Smrg esac 1631d522f475Smrg ;; #(vi 1632d522f475Smrg.no|.NONE/*) 1633d522f475Smrg $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%` 1634d522f475Smrg ;; 1635d522f475Smrg*) 163620d2c4d2Smrg ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2) 1637d522f475Smrg ;; 1638d522f475Smrgesac 1639d522f475Smrg])dnl 1640d522f475Smrgdnl --------------------------------------------------------------------------- 1641e39b573cSmrgdnl CF_PKG_CONFIG version: 7 updated: 2011/04/29 04:53:22 1642956cc18dSsnjdnl ------------- 1643956cc18dSsnjdnl Check for the package-config program, unless disabled by command-line. 1644956cc18dSsnjAC_DEFUN([CF_PKG_CONFIG], 1645956cc18dSsnj[ 1646956cc18dSsnjAC_MSG_CHECKING(if you want to use pkg-config) 1647956cc18dSsnjAC_ARG_WITH(pkg-config, 1648956cc18dSsnj [ --with-pkg-config{=path} enable/disable use of pkg-config], 1649956cc18dSsnj [cf_pkg_config=$withval], 1650956cc18dSsnj [cf_pkg_config=yes]) 1651956cc18dSsnjAC_MSG_RESULT($cf_pkg_config) 1652956cc18dSsnj 1653956cc18dSsnjcase $cf_pkg_config in #(vi 1654956cc18dSsnjno) #(vi 1655956cc18dSsnj PKG_CONFIG=none 1656956cc18dSsnj ;; 1657956cc18dSsnjyes) #(vi 1658e39b573cSmrg CF_ACVERSION_CHECK(2.52, 1659e39b573cSmrg [AC_PATH_TOOL(PKG_CONFIG, pkg-config, none)], 1660e39b573cSmrg [AC_PATH_PROG(PKG_CONFIG, pkg-config, none)]) 1661956cc18dSsnj ;; 1662956cc18dSsnj*) 1663956cc18dSsnj PKG_CONFIG=$withval 1664956cc18dSsnj ;; 1665956cc18dSsnjesac 1666956cc18dSsnj 1667956cc18dSsnjtest -z "$PKG_CONFIG" && PKG_CONFIG=none 1668956cc18dSsnjif test "$PKG_CONFIG" != none ; then 1669956cc18dSsnj CF_PATH_SYNTAX(PKG_CONFIG) 1670956cc18dSsnjfi 1671956cc18dSsnj 1672956cc18dSsnjAC_SUBST(PKG_CONFIG) 1673956cc18dSsnj])dnl 1674956cc18dSsnjdnl --------------------------------------------------------------------------- 167520d2c4d2Smrgdnl CF_POSIX_C_SOURCE version: 8 updated: 2010/05/26 05:38:42 1676d522f475Smrgdnl ----------------- 1677d522f475Smrgdnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed. 1678d522f475Smrgdnl 1679d522f475Smrgdnl POSIX.1-1990 _POSIX_SOURCE 1680d522f475Smrgdnl POSIX.1-1990 and _POSIX_SOURCE and 1681d522f475Smrgdnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2 1682d522f475Smrgdnl Bindings Option 1683d522f475Smrgdnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L 1684d522f475Smrgdnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L 1685d522f475Smrgdnl X/Open 2000 _POSIX_C_SOURCE=200112L 1686d522f475Smrgdnl 1687d522f475Smrgdnl Parameters: 1688d522f475Smrgdnl $1 is the nominal value for _POSIX_C_SOURCE 1689d522f475SmrgAC_DEFUN([CF_POSIX_C_SOURCE], 1690d522f475Smrg[ 169120d2c4d2Smrgcf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1]) 1692d522f475Smrg 1693d522f475Smrgcf_save_CFLAGS="$CFLAGS" 1694d522f475Smrgcf_save_CPPFLAGS="$CPPFLAGS" 1695d522f475Smrg 1696d522f475SmrgCF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE) 1697d522f475SmrgCF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE) 1698d522f475Smrg 1699d522f475SmrgAC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[ 1700d522f475Smrg CF_MSG_LOG(if the symbol is already defined go no further) 1701d522f475Smrg AC_TRY_COMPILE([#include <sys/types.h>],[ 1702d522f475Smrg#ifndef _POSIX_C_SOURCE 1703d522f475Smrgmake an error 1704d522f475Smrg#endif], 1705d522f475Smrg [cf_cv_posix_c_source=no], 1706d522f475Smrg [cf_want_posix_source=no 1707d522f475Smrg case .$cf_POSIX_C_SOURCE in #(vi 1708d522f475Smrg .[[12]]??*) #(vi 1709d522f475Smrg cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" 1710d522f475Smrg ;; 1711d522f475Smrg .2) #(vi 1712d522f475Smrg cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" 1713d522f475Smrg cf_want_posix_source=yes 1714d522f475Smrg ;; 1715d522f475Smrg .*) 1716d522f475Smrg cf_want_posix_source=yes 1717d522f475Smrg ;; 1718d522f475Smrg esac 1719d522f475Smrg if test "$cf_want_posix_source" = yes ; then 1720d522f475Smrg AC_TRY_COMPILE([#include <sys/types.h>],[ 1721d522f475Smrg#ifdef _POSIX_SOURCE 1722d522f475Smrgmake an error 1723d522f475Smrg#endif],[], 1724d522f475Smrg cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE") 1725d522f475Smrg fi 1726d522f475Smrg CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE) 1727d522f475Smrg CFLAGS="$cf_trim_CFLAGS" 1728d522f475Smrg CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source" 1729d522f475Smrg CF_MSG_LOG(if the second compile does not leave our definition intact error) 1730d522f475Smrg AC_TRY_COMPILE([#include <sys/types.h>],[ 1731d522f475Smrg#ifndef _POSIX_C_SOURCE 1732d522f475Smrgmake an error 1733d522f475Smrg#endif],, 1734d522f475Smrg [cf_cv_posix_c_source=no]) 1735d522f475Smrg CFLAGS="$cf_save_CFLAGS" 1736d522f475Smrg CPPFLAGS="$cf_save_CPPFLAGS" 1737d522f475Smrg ]) 1738d522f475Smrg]) 1739d522f475Smrg 1740d522f475Smrgif test "$cf_cv_posix_c_source" != no ; then 1741d522f475Smrg CFLAGS="$cf_trim_CFLAGS" 1742d522f475Smrg CPPFLAGS="$cf_trim_CPPFLAGS" 174320d2c4d2Smrg CF_ADD_CFLAGS($cf_cv_posix_c_source) 1744d522f475Smrgfi 1745d522f475Smrg 1746d522f475Smrg])dnl 1747d522f475Smrgdnl --------------------------------------------------------------------------- 17480bd37d32Smrgdnl CF_POSIX_SAVED_IDS version: 8 updated: 2012/10/04 20:12:20 1749d522f475Smrgdnl ------------------ 1750d522f475Smrgdnl 1751d522f475Smrgdnl Check first if saved-ids are always supported. Some systems 1752d522f475Smrgdnl may require runtime checks. 1753d522f475SmrgAC_DEFUN([CF_POSIX_SAVED_IDS], 1754d522f475Smrg[ 1755d522f475SmrgAC_CHECK_HEADERS( \ 1756d522f475Smrgsys/param.h \ 1757d522f475Smrg) 1758d522f475Smrg 1759d522f475SmrgAC_CACHE_CHECK(if POSIX saved-ids are supported,cf_cv_posix_saved_ids,[ 1760d522f475SmrgAC_TRY_LINK( 1761d522f475Smrg[ 1762d522f475Smrg#include <unistd.h> 1763d522f475Smrg#ifdef HAVE_SYS_PARAM_H 1764d522f475Smrg#include <sys/param.h> /* this may define "BSD" */ 1765d522f475Smrg#endif 1766d522f475Smrg],[ 1767d522f475Smrg#if defined(_POSIX_SAVED_IDS) && (_POSIX_SAVED_IDS > 0) 1768d522f475Smrg void *p = (void *) seteuid; 1769d522f475Smrg int x = seteuid(geteuid()); 1770d522f475Smrg#elif defined(BSD) && (BSD >= 199103) 1771d522f475Smrg/* The BSD's may implement the runtime check - and it fails. 1772d522f475Smrg * However, saved-ids work almost like POSIX (close enough for most uses). 1773d522f475Smrg */ 1774d522f475Smrg#else 1775d522f475Smrgmake an error 1776d522f475Smrg#endif 1777d522f475Smrg],[cf_cv_posix_saved_ids=yes 1778d522f475Smrg],[ 1779d522f475SmrgAC_TRY_RUN([ 1780d522f475Smrg#ifdef HAVE_STDLIB_H 1781d522f475Smrg#include <stdlib.h> 1782d522f475Smrg#endif 1783d522f475Smrg#include <unistd.h> 1784d522f475Smrgint main() 1785d522f475Smrg{ 1786d522f475Smrg void *p = (void *) seteuid; 1787d522f475Smrg long code = sysconf(_SC_SAVED_IDS); 1788d522f475Smrg ${cf_cv_main_return:-return} ((code > 0) ? 0 : 1); 1789d522f475Smrg}], 1790d522f475Smrg cf_cv_posix_saved_ids=yes, 1791d522f475Smrg cf_cv_posix_saved_ids=no, 1792d522f475Smrg cf_cv_posix_saved_ids=unknown) 1793d522f475Smrg]) 1794d522f475Smrg]) 1795d522f475Smrg 17960bd37d32Smrgtest "$cf_cv_posix_saved_ids" = yes && AC_DEFINE(HAVE_POSIX_SAVED_IDS,1,[Define to 1 if POSIX saved-ids are supported]) 1797d522f475Smrg]) 1798d522f475Smrgdnl --------------------------------------------------------------------------- 17990bd37d32Smrgdnl CF_POSIX_WAIT version: 3 updated: 2012/10/04 20:12:20 1800d522f475Smrgdnl ------------- 1801d522f475Smrgdnl Check for POSIX wait support 1802d522f475SmrgAC_DEFUN([CF_POSIX_WAIT], 1803d522f475Smrg[ 1804d522f475SmrgAC_REQUIRE([AC_HEADER_SYS_WAIT]) 1805d522f475SmrgAC_CACHE_CHECK(for POSIX wait functions,cf_cv_posix_wait,[ 1806d522f475SmrgAC_TRY_LINK([ 1807d522f475Smrg#include <stdlib.h> 1808d522f475Smrg#include <stdio.h> 1809d522f475Smrg#include <sys/types.h> 1810d522f475Smrg#ifdef HAVE_SYS_WAIT_H 1811d522f475Smrg#include <sys/wait.h> 1812d522f475Smrg#endif 1813d522f475Smrg],[ 1814d522f475Smrg int stat_loc; 1815d522f475Smrg pid_t pid = waitpid(-1, &stat_loc, WNOHANG|WUNTRACED); 1816d522f475Smrg pid_t pid2 = wait(&stat_loc); 1817d522f475Smrg], 1818d522f475Smrg[cf_cv_posix_wait=yes], 1819d522f475Smrg[cf_cv_posix_wait=no]) 1820d522f475Smrg]) 18210bd37d32Smrgtest "$cf_cv_posix_wait" = yes && AC_DEFINE(USE_POSIX_WAIT,1,[Define to 1 if we have POSIX wait functions]) 1822d522f475Smrg])dnl 1823d522f475Smrgdnl --------------------------------------------------------------------------- 1824d522f475Smrgdnl CF_PROCFS_CWD version: 2 updated: 2007/03/12 20:39:04 1825d522f475Smrgdnl ------------- 1826d522f475Smrgdnl Find /proc tree (may be in a different place) which implements the "cwd" 1827d522f475Smrgdnl link. 1828d522f475SmrgAC_DEFUN([CF_PROCFS_CWD],[ 1829d522f475SmrgAC_CACHE_CHECK(for proc tree with cwd-support,cf_cv_procfs_cwd,[ 1830d522f475Smrgcf_cv_procfs_cwd=no 1831d522f475Smrgfor cf_path in /proc /compat/linux/proc /usr/compat/linux/proc 1832d522f475Smrgdo 1833d522f475Smrg if test -d $cf_path && \ 1834d522f475Smrg test -d $cf_path/$$ && \ 1835d522f475Smrg ( test -d $cf_path/$$/cwd || \ 1836d522f475Smrg test -L $cf_path/$$/cwd ); then 1837d522f475Smrg cf_cv_procfs_cwd=$cf_path 1838d522f475Smrg break 1839d522f475Smrg fi 1840d522f475Smrgdone 1841d522f475Smrg]) 1842d522f475Smrg])dnl 1843d522f475Smrgdnl --------------------------------------------------------------------------- 18440bd37d32Smrgdnl CF_PROG_CC version: 3 updated: 2012/10/06 15:31:55 18450bd37d32Smrgdnl ---------- 18460bd37d32Smrgdnl standard check for CC, plus followup sanity checks 18470bd37d32Smrgdnl $1 = optional parameter to pass to AC_PROG_CC to specify compiler name 18480bd37d32SmrgAC_DEFUN([CF_PROG_CC],[ 18490bd37d32Smrgifelse($1,,[AC_PROG_CC],[AC_PROG_CC($1)]) 18500bd37d32SmrgCF_GCC_VERSION 18510bd37d32SmrgCF_ACVERSION_CHECK(2.52, 18520bd37d32Smrg [AC_PROG_CC_STDC], 18530bd37d32Smrg [CF_ANSI_CC_REQD]) 18540bd37d32SmrgCF_CC_ENV_FLAGS 1855d522f475Smrg])dnl 1856d522f475Smrgdnl --------------------------------------------------------------------------- 18570bd37d32Smrgdnl CF_PROG_GROFF version: 1 updated: 2013/01/02 20:37:18 18580bd37d32Smrgdnl ------------- 18590bd37d32Smrgdnl Check if groff is available, for cases (such as html output) where nroff 18600bd37d32Smrgdnl is not enough. 18610bd37d32SmrgAC_DEFUN([CF_PROG_GROFF],[ 18620bd37d32SmrgAC_PATH_PROG(GROFF_PATH,groff,no) 18630bd37d32Smrgif test "x$GROFF_PATH" = xno 18640bd37d32Smrgthen 18650bd37d32Smrg NROFF_NOTE= 18660bd37d32Smrg GROFF_NOTE="#" 18670bd37d32Smrgelse 18680bd37d32Smrg NROFF_NOTE="#" 18690bd37d32Smrg GROFF_NOTE= 18700bd37d32Smrgfi 18710bd37d32SmrgAC_SUBST(GROFF_PATH) 18720bd37d32SmrgAC_SUBST(GROFF_NOTE) 18730bd37d32SmrgAC_SUBST(NROFF_NOTE) 1874d522f475Smrg])dnl 1875d522f475Smrgdnl --------------------------------------------------------------------------- 18760bd37d32Smrgdnl CF_REGEX version: 10 updated: 2012/10/04 20:12:20 1877d522f475Smrgdnl -------- 1878d522f475Smrgdnl Attempt to determine if we've got one of the flavors of regular-expression 1879d522f475Smrgdnl code that we can support. 1880d522f475SmrgAC_DEFUN([CF_REGEX], 1881d522f475Smrg[ 188220d2c4d2Smrg 188320d2c4d2Smrgcf_regex_func=no 188420d2c4d2Smrg 18856879286fSmrgcf_regex_libs="regex re" 18866879286fSmrgcase $host_os in #(vi 18876879286fSmrgmingw*) 18880bd37d32Smrg cf_regex_libs="gnurx $cf_regex_libs" 18896879286fSmrg ;; 18906879286fSmrgesac 18916879286fSmrg 189220d2c4d2SmrgAC_CHECK_FUNC(regcomp,[cf_regex_func=regcomp],[ 18936879286fSmrg for cf_regex_lib in $cf_regex_libs 189420d2c4d2Smrg do 189520d2c4d2Smrg AC_CHECK_LIB($cf_regex_lib,regcomp,[ 189620d2c4d2Smrg CF_ADD_LIB($cf_regex_lib) 189720d2c4d2Smrg cf_regex_func=regcomp 189820d2c4d2Smrg break]) 189920d2c4d2Smrg done 190020d2c4d2Smrg]) 190120d2c4d2Smrg 190220d2c4d2Smrgif test "$cf_regex_func" = no ; then 190320d2c4d2Smrg AC_CHECK_FUNC(compile,[cf_regex_func=compile],[ 190420d2c4d2Smrg AC_CHECK_LIB(gen,compile,[ 190520d2c4d2Smrg CF_ADD_LIB(gen) 190620d2c4d2Smrg cf_regex_func=compile])]) 190720d2c4d2Smrgfi 190820d2c4d2Smrg 190920d2c4d2Smrgif test "$cf_regex_func" = no ; then 191020d2c4d2Smrg AC_MSG_WARN(cannot find regular expression library) 191120d2c4d2Smrgfi 191220d2c4d2Smrg 191320d2c4d2SmrgAC_CACHE_CHECK(for regular-expression headers,cf_cv_regex_hdrs,[ 191420d2c4d2Smrg 191520d2c4d2Smrgcf_cv_regex_hdrs=no 191620d2c4d2Smrgcase $cf_regex_func in #(vi 191720d2c4d2Smrgcompile) #(vi 191820d2c4d2Smrg for cf_regex_hdr in regexp.h regexpr.h 191920d2c4d2Smrg do 192020d2c4d2Smrg AC_TRY_LINK([#include <$cf_regex_hdr>],[ 192120d2c4d2Smrg char *p = compile("", "", "", 0); 1922d522f475Smrg int x = step("", ""); 192320d2c4d2Smrg ],[ 192420d2c4d2Smrg cf_cv_regex_hdrs=$cf_regex_hdr 192520d2c4d2Smrg break 192620d2c4d2Smrg ]) 192720d2c4d2Smrg done 192820d2c4d2Smrg ;; 192920d2c4d2Smrg*) 193020d2c4d2Smrg for cf_regex_hdr in regex.h 193120d2c4d2Smrg do 193220d2c4d2Smrg AC_TRY_LINK([#include <sys/types.h> 193320d2c4d2Smrg#include <$cf_regex_hdr>],[ 193420d2c4d2Smrg regex_t *p; 193520d2c4d2Smrg int x = regcomp(p, "", 0); 193620d2c4d2Smrg int y = regexec(p, "", 0, 0, 0); 193720d2c4d2Smrg regfree(p); 193820d2c4d2Smrg ],[ 193920d2c4d2Smrg cf_cv_regex_hdrs=$cf_regex_hdr 194020d2c4d2Smrg break 194120d2c4d2Smrg ]) 194220d2c4d2Smrg done 194320d2c4d2Smrg ;; 194420d2c4d2Smrgesac 194520d2c4d2Smrg 1946d522f475Smrg]) 194720d2c4d2Smrg 194820d2c4d2Smrgcase $cf_cv_regex_hdrs in #(vi 194920d2c4d2Smrg no) AC_MSG_WARN(no regular expression header found) ;; #(vi 19500bd37d32Smrg regex.h) AC_DEFINE(HAVE_REGEX_H_FUNCS,1,[Define to 1 to include regex.h for regular expressions]) ;; #(vi 19510bd37d32Smrg regexp.h) AC_DEFINE(HAVE_REGEXP_H_FUNCS,1,[Define to 1 to include regexp.h for regular expressions]) ;; #(vi 19520bd37d32Smrg regexpr.h) AC_DEFINE(HAVE_REGEXPR_H_FUNCS,1,[Define to 1 to include regexpr.h for regular expressions]) ;; 1953d522f475Smrgesac 1954d522f475Smrg])dnl 1955d522f475Smrgdnl --------------------------------------------------------------------------- 195620d2c4d2Smrgdnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50 1957d522f475Smrgdnl ---------------- 1958d522f475Smrgdnl Remove all -U and -D options that refer to the given symbol from a list 1959d522f475Smrgdnl of C compiler options. This works around the problem that not all 1960d522f475Smrgdnl compilers process -U and -D options from left-to-right, so a -U option 1961d522f475Smrgdnl cannot be used to cancel the effect of a preceding -D option. 1962d522f475Smrgdnl 1963d522f475Smrgdnl $1 = target (which could be the same as the source variable) 1964d522f475Smrgdnl $2 = source (including '$') 1965d522f475Smrgdnl $3 = symbol to remove 1966d522f475Smrgdefine([CF_REMOVE_DEFINE], 1967d522f475Smrg[ 1968d522f475Smrg$1=`echo "$2" | \ 196920d2c4d2Smrg sed -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[[ ]]/ /g' \ 197020d2c4d2Smrg -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'` 197120d2c4d2Smrg])dnl 197220d2c4d2Smrgdnl --------------------------------------------------------------------------- 1973e0a2b6dfSmrgdnl CF_RPATH_HACK version: 11 updated: 2013/09/01 13:02:00 197420d2c4d2Smrgdnl ------------- 197520d2c4d2SmrgAC_DEFUN([CF_RPATH_HACK], 197620d2c4d2Smrg[ 197720d2c4d2SmrgAC_REQUIRE([CF_LD_RPATH_OPT]) 197820d2c4d2SmrgAC_MSG_CHECKING(for updated LDFLAGS) 197920d2c4d2Smrgif test -n "$LD_RPATH_OPT" ; then 198020d2c4d2Smrg AC_MSG_RESULT(maybe) 198120d2c4d2Smrg 198220d2c4d2Smrg AC_CHECK_PROGS(cf_ldd_prog,ldd,no) 198320d2c4d2Smrg cf_rpath_list="/usr/lib /lib" 198420d2c4d2Smrg if test "$cf_ldd_prog" != no 198520d2c4d2Smrg then 1986a1f3da82Smrg cf_rpath_oops= 1987a1f3da82Smrg 198820d2c4d2SmrgAC_TRY_LINK([#include <stdio.h>], 198920d2c4d2Smrg [printf("Hello");], 1990e0a2b6dfSmrg [cf_rpath_oops=`$cf_ldd_prog conftest$ac_exeext | fgrep ' not found' | sed -e 's% =>.*$%%' |sort | uniq` 1991e0a2b6dfSmrg cf_rpath_list=`$cf_ldd_prog conftest$ac_exeext | fgrep / | sed -e 's%^.*[[ ]]/%/%' -e 's%/[[^/]][[^/]]*$%%' |sort | uniq`]) 1992a1f3da82Smrg 1993a1f3da82Smrg # If we passed the link-test, but get a "not found" on a given library, 1994a1f3da82Smrg # this could be due to inept reconfiguration of gcc to make it only 1995a1f3da82Smrg # partly honor /usr/local/lib (or whatever). Sometimes this behavior 1996a1f3da82Smrg # is intentional, e.g., installing gcc in /usr/bin and suppressing the 1997a1f3da82Smrg # /usr/local libraries. 1998a1f3da82Smrg if test -n "$cf_rpath_oops" 1999a1f3da82Smrg then 2000a1f3da82Smrg for cf_rpath_src in $cf_rpath_oops 2001a1f3da82Smrg do 2002a1f3da82Smrg for cf_rpath_dir in \ 2003a1f3da82Smrg /usr/local \ 2004a1f3da82Smrg /usr/pkg \ 2005a1f3da82Smrg /opt/sfw 2006a1f3da82Smrg do 2007a1f3da82Smrg if test -f $cf_rpath_dir/lib/$cf_rpath_src 2008a1f3da82Smrg then 2009a1f3da82Smrg CF_VERBOSE(...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src) 2010a1f3da82Smrg LDFLAGS="$LDFLAGS -L$cf_rpath_dir/lib" 2011a1f3da82Smrg break 2012a1f3da82Smrg fi 2013a1f3da82Smrg done 2014a1f3da82Smrg done 2015a1f3da82Smrg fi 201620d2c4d2Smrg fi 201720d2c4d2Smrg 201820d2c4d2Smrg CF_VERBOSE(...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS) 201920d2c4d2Smrg 202020d2c4d2Smrg CF_RPATH_HACK_2(LDFLAGS) 202120d2c4d2Smrg CF_RPATH_HACK_2(LIBS) 202220d2c4d2Smrg 202320d2c4d2Smrg CF_VERBOSE(...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS) 2024e0a2b6dfSmrgelse 2025e0a2b6dfSmrg AC_MSG_RESULT(no) 202620d2c4d2Smrgfi 202720d2c4d2SmrgAC_SUBST(EXTRA_LDFLAGS) 202820d2c4d2Smrg])dnl 202920d2c4d2Smrgdnl --------------------------------------------------------------------------- 203020d2c4d2Smrgdnl CF_RPATH_HACK_2 version: 6 updated: 2010/04/17 16:31:24 203120d2c4d2Smrgdnl --------------- 203220d2c4d2Smrgdnl Do one set of substitutions for CF_RPATH_HACK, adding an rpath option to 203320d2c4d2Smrgdnl EXTRA_LDFLAGS for each -L option found. 203420d2c4d2Smrgdnl 203520d2c4d2Smrgdnl $cf_rpath_list contains a list of directories to ignore. 203620d2c4d2Smrgdnl 203720d2c4d2Smrgdnl $1 = variable name to update. The LDFLAGS variable should be the only one, 203820d2c4d2Smrgdnl but LIBS often has misplaced -L options. 203920d2c4d2SmrgAC_DEFUN([CF_RPATH_HACK_2], 204020d2c4d2Smrg[ 204120d2c4d2SmrgCF_VERBOSE(...checking $1 [$]$1) 204220d2c4d2Smrg 204320d2c4d2Smrgcf_rpath_dst= 204420d2c4d2Smrgfor cf_rpath_src in [$]$1 204520d2c4d2Smrgdo 204620d2c4d2Smrg case $cf_rpath_src in #(vi 204720d2c4d2Smrg -L*) #(vi 204820d2c4d2Smrg 204920d2c4d2Smrg # check if this refers to a directory which we will ignore 205020d2c4d2Smrg cf_rpath_skip=no 205120d2c4d2Smrg if test -n "$cf_rpath_list" 205220d2c4d2Smrg then 205320d2c4d2Smrg for cf_rpath_item in $cf_rpath_list 205420d2c4d2Smrg do 205520d2c4d2Smrg if test "x$cf_rpath_src" = "x-L$cf_rpath_item" 205620d2c4d2Smrg then 205720d2c4d2Smrg cf_rpath_skip=yes 205820d2c4d2Smrg break 205920d2c4d2Smrg fi 206020d2c4d2Smrg done 206120d2c4d2Smrg fi 206220d2c4d2Smrg 206320d2c4d2Smrg if test "$cf_rpath_skip" = no 206420d2c4d2Smrg then 206520d2c4d2Smrg # transform the option 206620d2c4d2Smrg if test "$LD_RPATH_OPT" = "-R " ; then 206720d2c4d2Smrg cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%-R %"` 206820d2c4d2Smrg else 206920d2c4d2Smrg cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%$LD_RPATH_OPT%"` 207020d2c4d2Smrg fi 207120d2c4d2Smrg 207220d2c4d2Smrg # if we have not already added this, add it now 207320d2c4d2Smrg cf_rpath_tst=`echo "$EXTRA_LDFLAGS" | sed -e "s%$cf_rpath_tmp %%"` 207420d2c4d2Smrg if test "x$cf_rpath_tst" = "x$EXTRA_LDFLAGS" 207520d2c4d2Smrg then 207620d2c4d2Smrg CF_VERBOSE(...Filter $cf_rpath_src ->$cf_rpath_tmp) 207720d2c4d2Smrg EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS" 207820d2c4d2Smrg fi 207920d2c4d2Smrg fi 208020d2c4d2Smrg ;; 208120d2c4d2Smrg esac 208220d2c4d2Smrg cf_rpath_dst="$cf_rpath_dst $cf_rpath_src" 208320d2c4d2Smrgdone 208420d2c4d2Smrg$1=$cf_rpath_dst 208520d2c4d2Smrg 208620d2c4d2SmrgCF_VERBOSE(...checked $1 [$]$1) 208720d2c4d2SmrgAC_SUBST(EXTRA_LDFLAGS) 2088d522f475Smrg])dnl 2089d522f475Smrgdnl --------------------------------------------------------------------------- 2090d522f475Smrgdnl CF_SIGWINCH version: 1 updated: 2006/04/02 16:41:09 2091d522f475Smrgdnl ----------- 2092d522f475Smrgdnl Use this macro after CF_XOPEN_SOURCE, but do not require it (not all 2093d522f475Smrgdnl programs need this test). 2094d522f475Smrgdnl 2095d522f475Smrgdnl This is really a MacOS X 10.4.3 workaround. Defining _POSIX_C_SOURCE 2096d522f475Smrgdnl forces SIGWINCH to be undefined (breaks xterm, ncurses). Oddly, the struct 2097d522f475Smrgdnl winsize declaration is left alone - we may revisit this if Apple choose to 2098d522f475Smrgdnl break that part of the interface as well. 2099d522f475SmrgAC_DEFUN([CF_SIGWINCH], 2100d522f475Smrg[ 2101d522f475SmrgAC_CACHE_CHECK(if SIGWINCH is defined,cf_cv_define_sigwinch,[ 2102d522f475Smrg AC_TRY_COMPILE([ 2103d522f475Smrg#include <sys/types.h> 2104d522f475Smrg#include <sys/signal.h> 2105d522f475Smrg],[int x = SIGWINCH], 2106d522f475Smrg [cf_cv_define_sigwinch=yes], 2107d522f475Smrg [AC_TRY_COMPILE([ 2108d522f475Smrg#undef _XOPEN_SOURCE 2109d522f475Smrg#undef _POSIX_SOURCE 2110d522f475Smrg#undef _POSIX_C_SOURCE 2111d522f475Smrg#include <sys/types.h> 2112d522f475Smrg#include <sys/signal.h> 2113d522f475Smrg],[int x = SIGWINCH], 2114d522f475Smrg [cf_cv_define_sigwinch=maybe], 2115d522f475Smrg [cf_cv_define_sigwinch=no]) 2116d522f475Smrg]) 2117d522f475Smrg]) 2118d522f475Smrg 2119d522f475Smrgif test "$cf_cv_define_sigwinch" = maybe ; then 2120d522f475SmrgAC_CACHE_CHECK(for actual SIGWINCH definition,cf_cv_fixup_sigwinch,[ 2121d522f475Smrgcf_cv_fixup_sigwinch=unknown 2122d522f475Smrgcf_sigwinch=32 2123d522f475Smrgwhile test $cf_sigwinch != 1 2124d522f475Smrgdo 2125d522f475Smrg AC_TRY_COMPILE([ 2126d522f475Smrg#undef _XOPEN_SOURCE 2127d522f475Smrg#undef _POSIX_SOURCE 2128d522f475Smrg#undef _POSIX_C_SOURCE 2129d522f475Smrg#include <sys/types.h> 2130d522f475Smrg#include <sys/signal.h> 2131d522f475Smrg],[ 2132d522f475Smrg#if SIGWINCH != $cf_sigwinch 2133d522f475Smrgmake an error 2134d522f475Smrg#endif 2135d522f475Smrgint x = SIGWINCH], 2136d522f475Smrg [cf_cv_fixup_sigwinch=$cf_sigwinch 2137d522f475Smrg break]) 2138d522f475Smrg 2139d522f475Smrgcf_sigwinch=`expr $cf_sigwinch - 1` 2140d522f475Smrgdone 2141d522f475Smrg]) 2142d522f475Smrg 2143d522f475Smrg if test "$cf_cv_fixup_sigwinch" != unknown ; then 2144d522f475Smrg CPPFLAGS="$CPPFLAGS -DSIGWINCH=$cf_cv_fixup_sigwinch" 2145d522f475Smrg fi 2146d522f475Smrgfi 2147d522f475Smrg])dnl 2148d522f475Smrgdnl --------------------------------------------------------------------------- 21490bd37d32Smrgdnl CF_SIG_ATOMIC_T version: 3 updated: 2012/10/04 20:12:20 2150d522f475Smrgdnl --------------- 2151d522f475Smrgdnl signal handler, but there are some gcc depedencies in that recommendation. 2152d522f475Smrgdnl Try anyway. 2153d522f475SmrgAC_DEFUN([CF_SIG_ATOMIC_T], 2154d522f475Smrg[ 2155d522f475SmrgAC_MSG_CHECKING(for signal global datatype) 2156d522f475SmrgAC_CACHE_VAL(cf_cv_sig_atomic_t,[ 2157d522f475Smrg for cf_type in \ 2158d522f475Smrg "volatile sig_atomic_t" \ 2159d522f475Smrg "sig_atomic_t" \ 2160d522f475Smrg "int" 2161d522f475Smrg do 2162d522f475Smrg AC_TRY_COMPILE([ 2163d522f475Smrg#include <sys/types.h> 2164d522f475Smrg#include <signal.h> 2165d522f475Smrg#include <stdio.h> 2166d522f475Smrg 2167d522f475Smrgextern $cf_type x; 2168d522f475Smrg$cf_type x; 2169d522f475Smrgstatic void handler(int sig) 2170d522f475Smrg{ 2171d522f475Smrg x = 5; 2172d522f475Smrg}], 2173d522f475Smrg [signal(SIGINT, handler); 2174d522f475Smrg x = 1], 2175d522f475Smrg [cf_cv_sig_atomic_t=$cf_type], 2176d522f475Smrg [cf_cv_sig_atomic_t=no]) 2177d522f475Smrg test "$cf_cv_sig_atomic_t" != no && break 2178d522f475Smrg done 2179d522f475Smrg ]) 2180d522f475SmrgAC_MSG_RESULT($cf_cv_sig_atomic_t) 21810bd37d32Smrgtest "$cf_cv_sig_atomic_t" != no && AC_DEFINE_UNQUOTED(SIG_ATOMIC_T, $cf_cv_sig_atomic_t,[Define to signal global datatype]) 2182d522f475Smrg])dnl 2183d522f475Smrgdnl --------------------------------------------------------------------------- 21840bd37d32Smrgdnl CF_STRUCT_LASTLOG version: 2 updated: 2012/10/04 20:12:20 2185d522f475Smrgdnl ----------------- 2186d522f475Smrgdnl Check for header defining struct lastlog, ensure that its .ll_time member 2187d522f475Smrgdnl is compatible with time(). 2188d522f475SmrgAC_DEFUN([CF_STRUCT_LASTLOG], 2189d522f475Smrg[ 2190d522f475SmrgAC_CHECK_HEADERS(lastlog.h) 2191d522f475SmrgAC_CACHE_CHECK(for struct lastlog,cf_cv_struct_lastlog,[ 2192d522f475SmrgAC_TRY_RUN([ 2193d522f475Smrg#include <sys/types.h> 2194d522f475Smrg#include <time.h> 2195d522f475Smrg#include <lastlog.h> 2196d522f475Smrg 2197d522f475Smrgint main() 2198d522f475Smrg{ 2199d522f475Smrg struct lastlog data; 2200d522f475Smrg return (sizeof(data.ll_time) != sizeof(time_t)); 2201d522f475Smrg}],[ 2202d522f475Smrgcf_cv_struct_lastlog=yes],[ 2203d522f475Smrgcf_cv_struct_lastlog=no],[ 2204d522f475Smrgcf_cv_struct_lastlog=unknown])]) 2205d522f475Smrg 22060bd37d32Smrgtest $cf_cv_struct_lastlog != no && AC_DEFINE(USE_STRUCT_LASTLOG,1,[Define to 1 if we have struct lastlog]) 2207d522f475Smrg])dnl 2208d522f475Smrgdnl --------------------------------------------------------------------------- 22090bd37d32Smrgdnl CF_SVR4 version: 5 updated: 2012/10/04 05:24:07 2210d522f475Smrgdnl ------- 2211d522f475Smrgdnl Check if this is an SVR4 system. We need the definition for xterm 2212d522f475SmrgAC_DEFUN([CF_SVR4], 2213d522f475Smrg[ 2214d522f475SmrgAC_CHECK_LIB(elf, elf_begin,[ 2215d522f475SmrgAC_CACHE_CHECK(if this is an SVR4 system, cf_cv_svr4,[ 2216d522f475SmrgAC_TRY_COMPILE([ 22170bd37d32Smrg#if defined(__CYGWIN__) 22180bd37d32Smrgmake an error 22190bd37d32Smrg#endif 2220d522f475Smrg#include <elf.h> 2221d522f475Smrg#include <sys/termio.h> 2222d522f475Smrg],[ 2223d522f475Smrgstatic struct termio d_tio; 2224d522f475Smrg d_tio.c_cc[VINTR] = 0; 2225d522f475Smrg d_tio.c_cc[VQUIT] = 0; 2226d522f475Smrg d_tio.c_cc[VERASE] = 0; 2227d522f475Smrg d_tio.c_cc[VKILL] = 0; 2228d522f475Smrg d_tio.c_cc[VEOF] = 0; 2229d522f475Smrg d_tio.c_cc[VEOL] = 0; 2230d522f475Smrg d_tio.c_cc[VMIN] = 0; 2231d522f475Smrg d_tio.c_cc[VTIME] = 0; 2232d522f475Smrg d_tio.c_cc[VLNEXT] = 0; 2233d522f475Smrg], 2234d522f475Smrg[cf_cv_svr4=yes], 2235d522f475Smrg[cf_cv_svr4=no]) 2236d522f475Smrg]) 2237d522f475Smrg]) 22380bd37d32Smrgtest "$cf_cv_svr4" = yes && AC_DEFINE(SVR4,1,[Define to 1 if this is an SVR4 system]) 2239d522f475Smrg])dnl 2240d522f475Smrgdnl --------------------------------------------------------------------------- 22410bd37d32Smrgdnl CF_SYSV version: 15 updated: 2012/10/04 05:24:07 2242d522f475Smrgdnl ------- 2243d522f475Smrgdnl Check if this is a SYSV platform, e.g., as used in <X11/Xos.h>, and whether 2244d522f475Smrgdnl defining it will be helpful. The following features are used to check: 2245d522f475Smrgdnl 2246d522f475Smrgdnl a) bona-fide SVSV doesn't use const for sys_errlist[]. Since this is a 2247d522f475Smrgdnl legacy (pre-ANSI) feature, const should not apply. Modern systems only 2248d522f475Smrgdnl declare strerror(). Xos.h declares the legacy form of str_errlist[], and 2249d522f475Smrgdnl a compile-time error will result from trying to assign to a const array. 2250d522f475Smrgdnl 2251d522f475Smrgdnl b) compile with headers that exist on SYSV hosts. 2252d522f475Smrgdnl 2253d522f475Smrgdnl c) compile with type definitions that differ on SYSV hosts from standard C. 2254d522f475SmrgAC_DEFUN([CF_SYSV], 2255d522f475Smrg[ 2256d522f475SmrgAC_CHECK_HEADERS( \ 2257d522f475Smrgtermios.h \ 2258d522f475Smrgstdlib.h \ 2259d522f475SmrgX11/Intrinsic.h \ 2260d522f475Smrg) 2261d522f475Smrg 2262d522f475SmrgAC_REQUIRE([CF_SYS_ERRLIST]) 2263d522f475Smrg 2264d522f475SmrgAC_CACHE_CHECK(if we should define SYSV,cf_cv_sysv,[ 2265d522f475SmrgAC_TRY_COMPILE([ 2266d522f475Smrg#undef SYSV 2267d522f475Smrg#define SYSV 1 /* get Xos.h to declare sys_errlist[] */ 2268d522f475Smrg#ifdef HAVE_STDLIB_H 2269d522f475Smrg#include <stdlib.h> /* look for wchar_t */ 2270d522f475Smrg#endif 2271d522f475Smrg#ifdef HAVE_X11_INTRINSIC_H 2272d522f475Smrg#include <X11/Intrinsic.h> /* Intrinsic.h has other traps... */ 2273d522f475Smrg#endif 22740bd37d32Smrg#ifdef HAVE_TERMIOS_H /* needed for HPUX 10.20 */ 22750bd37d32Smrg#include <termios.h> 22760bd37d32Smrg#define STRUCT_TERMIOS struct termios 22770bd37d32Smrg#else 22780bd37d32Smrg#define STRUCT_TERMIOS struct termio 22790bd37d32Smrg#endif 2280d522f475Smrg#include <curses.h> 2281d522f475Smrg#include <term.h> /* eliminate most BSD hacks */ 2282d522f475Smrg#include <errno.h> /* declare sys_errlist on older systems */ 2283d522f475Smrg#include <sys/termio.h> /* eliminate most of the remaining ones */ 2284d522f475Smrg],[ 2285d522f475Smrgstatic STRUCT_TERMIOS d_tio; 2286d522f475Smrg d_tio.c_cc[VINTR] = 0; 2287d522f475Smrg d_tio.c_cc[VQUIT] = 0; 2288d522f475Smrg d_tio.c_cc[VERASE] = 0; 2289d522f475Smrg d_tio.c_cc[VKILL] = 0; 2290d522f475Smrg d_tio.c_cc[VEOF] = 0; 2291d522f475Smrg d_tio.c_cc[VEOL] = 0; 2292d522f475Smrg d_tio.c_cc[VMIN] = 0; 2293d522f475Smrg d_tio.c_cc[VTIME] = 0; 2294d522f475Smrg#if defined(HAVE_SYS_ERRLIST) && !defined(DECL_SYS_ERRLIST) 2295d522f475Smrgsys_errlist[0] = ""; /* Cygwin mis-declares this */ 2296d522f475Smrg#endif 2297d522f475Smrg], 2298d522f475Smrg[cf_cv_sysv=yes], 2299d522f475Smrg[cf_cv_sysv=no]) 2300d522f475Smrg]) 23010bd37d32Smrgtest "$cf_cv_sysv" = yes && AC_DEFINE(SYSV,1,[Define to 1 if this is an SYSV system]) 2302d522f475Smrg])dnl 2303d522f475Smrgdnl --------------------------------------------------------------------------- 23040bd37d32Smrgdnl CF_SYSV_UTMP version: 6 updated: 2012/10/04 20:12:20 2305d522f475Smrgdnl ------------ 2306d522f475Smrgdnl Check if this is a SYSV flavor of UTMP 2307d522f475SmrgAC_DEFUN([CF_SYSV_UTMP], 2308d522f475Smrg[ 2309d522f475SmrgAC_CACHE_CHECK(if $cf_cv_have_utmp is SYSV flavor,cf_cv_sysv_utmp,[ 2310d522f475Smrgtest "$cf_cv_have_utmp" = "utmp" && cf_prefix="ut" || cf_prefix="utx" 2311d522f475SmrgAC_TRY_LINK([ 2312d522f475Smrg#include <sys/types.h> 2313d522f475Smrg#include <${cf_cv_have_utmp}.h>],[ 2314d522f475Smrgstruct $cf_cv_have_utmp x; 2315d522f475Smrg set${cf_prefix}ent (); 2316d522f475Smrg get${cf_prefix}id(&x); 2317d522f475Smrg put${cf_prefix}line(&x); 2318d522f475Smrg end${cf_prefix}ent();], 2319d522f475Smrg [cf_cv_sysv_utmp=yes], 2320d522f475Smrg [cf_cv_sysv_utmp=no]) 2321d522f475Smrg]) 23220bd37d32Smrgtest $cf_cv_sysv_utmp = yes && AC_DEFINE(USE_SYSV_UTMP,1,[Define to 1 if utmp is SYSV flavor]) 2323d522f475Smrg])dnl 2324d522f475Smrgdnl --------------------------------------------------------------------------- 2325d522f475Smrgdnl CF_SYS_ERRLIST version: 6 updated: 2001/12/30 13:03:23 2326d522f475Smrgdnl -------------- 2327d522f475Smrgdnl Check for declaration of sys_nerr and sys_errlist in one of stdio.h and 2328d522f475Smrgdnl errno.h. Declaration of sys_errlist on BSD4.4 interferes with our 2329d522f475Smrgdnl declaration. Reported by Keith Bostic. 2330d522f475SmrgAC_DEFUN([CF_SYS_ERRLIST], 2331d522f475Smrg[ 2332d522f475Smrg CF_CHECK_ERRNO(sys_nerr) 2333d522f475Smrg CF_CHECK_ERRNO(sys_errlist) 2334d522f475Smrg])dnl 2335d522f475Smrgdnl --------------------------------------------------------------------------- 23360bd37d32Smrgdnl CF_TERMIO_C_ISPEED version: 3 updated: 2012/10/04 20:12:20 2337d522f475Smrgdnl ------------------ 2338d522f475Smrgdnl Check for SGI's broken redefinition of baud rates introduced in IRIX 6.5 2339d522f475Smrgdnl (there doesn't appear to be a useful predefined symbol). 2340d522f475SmrgAC_DEFUN([CF_TERMIO_C_ISPEED], 2341d522f475Smrg[ 2342d522f475SmrgAC_CACHE_CHECK(for IRIX 6.5 baud-rate redefinitions,cf_cv_termio_c_ispeed,[ 2343d522f475SmrgAC_TRY_COMPILE([ 2344d522f475Smrg#include <sys/types.h> 2345d522f475Smrg#include <sys/termio.h>],[ 2346d522f475Smrgstruct termio foo; 2347d522f475Smrgfoo.c_ispeed = B38400; 2348d522f475Smrgfoo.c_ospeed = B9600; 2349d522f475Smrg],[cf_cv_termio_c_ispeed=yes 2350d522f475Smrg],[cf_cv_termio_c_ispeed=no]) 2351d522f475Smrg]) 23520bd37d32Smrgtest "$cf_cv_termio_c_ispeed" = yes && AC_DEFINE(HAVE_TERMIO_C_ISPEED,1,[define 1 if we have IRIX 6.5 baud-rate redefinitions]) 2353d522f475Smrg])dnl 2354d522f475Smrgdnl --------------------------------------------------------------------------- 2355e0a2b6dfSmrgdnl CF_TRIM_X_LIBS version: 2 updated: 2013/07/09 21:27:22 2356e0a2b6dfSmrgdnl -------------- 2357e0a2b6dfSmrgdnl Trim extra base X libraries added as a workaround for inconsistent library 2358e0a2b6dfSmrgdnl dependencies returned by "new" pkg-config files. 2359e0a2b6dfSmrgAC_DEFUN([CF_TRIM_X_LIBS],[ 2360e0a2b6dfSmrg for cf_trim_lib in Xmu Xt X11 2361e0a2b6dfSmrg do 2362e0a2b6dfSmrg case "$LIBS" in 2363e0a2b6dfSmrg *-l$cf_trim_lib\ *-l$cf_trim_lib*) 2364e0a2b6dfSmrg LIBS=`echo "$LIBS " | sed -e 's/ / /g' -e 's%-l'"$cf_trim_lib"' %%' -e 's/ $//'` 2365e0a2b6dfSmrg CF_VERBOSE(..trimmed $LIBS) 2366e0a2b6dfSmrg ;; 2367e0a2b6dfSmrg esac 2368e0a2b6dfSmrg done 2369e0a2b6dfSmrg]) 2370e0a2b6dfSmrgdnl --------------------------------------------------------------------------- 2371e0a2b6dfSmrgdnl CF_TRY_PKG_CONFIG version: 5 updated: 2013/07/06 21:27:06 237220d2c4d2Smrgdnl ----------------- 237320d2c4d2Smrgdnl This is a simple wrapper to use for pkg-config, for libraries which may be 237420d2c4d2Smrgdnl available in that form. 237520d2c4d2Smrgdnl 237620d2c4d2Smrgdnl $1 = package name 237720d2c4d2Smrgdnl $2 = extra logic to use, if any, after updating CFLAGS and LIBS 237820d2c4d2Smrgdnl $3 = logic to use if pkg-config does not have the package 237920d2c4d2SmrgAC_DEFUN([CF_TRY_PKG_CONFIG],[ 238020d2c4d2SmrgAC_REQUIRE([CF_PKG_CONFIG]) 238120d2c4d2Smrg 238220d2c4d2Smrgif test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists $1; then 238320d2c4d2Smrg CF_VERBOSE(found package $1) 238420d2c4d2Smrg cf_pkgconfig_incs="`$PKG_CONFIG --cflags $1 2>/dev/null`" 238520d2c4d2Smrg cf_pkgconfig_libs="`$PKG_CONFIG --libs $1 2>/dev/null`" 238620d2c4d2Smrg CF_VERBOSE(package $1 CFLAGS: $cf_pkgconfig_incs) 238720d2c4d2Smrg CF_VERBOSE(package $1 LIBS: $cf_pkgconfig_libs) 238820d2c4d2Smrg CF_ADD_CFLAGS($cf_pkgconfig_incs) 238920d2c4d2Smrg CF_ADD_LIBS($cf_pkgconfig_libs) 239020d2c4d2Smrg ifelse([$2],,:,[$2]) 239120d2c4d2Smrgelse 2392e0a2b6dfSmrg cf_pkgconfig_incs= 2393e0a2b6dfSmrg cf_pkgconfig_libs= 239420d2c4d2Smrg ifelse([$3],,:,[$3]) 239520d2c4d2Smrgfi 239620d2c4d2Smrg]) 239720d2c4d2Smrgdnl --------------------------------------------------------------------------- 23980bd37d32Smrgdnl CF_TRY_XOPEN_SOURCE version: 1 updated: 2011/10/30 17:09:50 23990bd37d32Smrgdnl ------------------- 24000bd37d32Smrgdnl If _XOPEN_SOURCE is not defined in the compile environment, check if we 24010bd37d32Smrgdnl can define it successfully. 24020bd37d32SmrgAC_DEFUN([CF_TRY_XOPEN_SOURCE],[ 24030bd37d32SmrgAC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[ 24040bd37d32Smrg AC_TRY_COMPILE([ 24050bd37d32Smrg#include <stdlib.h> 24060bd37d32Smrg#include <string.h> 24070bd37d32Smrg#include <sys/types.h> 24080bd37d32Smrg],[ 24090bd37d32Smrg#ifndef _XOPEN_SOURCE 24100bd37d32Smrgmake an error 24110bd37d32Smrg#endif], 24120bd37d32Smrg [cf_cv_xopen_source=no], 24130bd37d32Smrg [cf_save="$CPPFLAGS" 24140bd37d32Smrg CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" 24150bd37d32Smrg AC_TRY_COMPILE([ 24160bd37d32Smrg#include <stdlib.h> 24170bd37d32Smrg#include <string.h> 24180bd37d32Smrg#include <sys/types.h> 24190bd37d32Smrg],[ 24200bd37d32Smrg#ifdef _XOPEN_SOURCE 24210bd37d32Smrgmake an error 24220bd37d32Smrg#endif], 24230bd37d32Smrg [cf_cv_xopen_source=no], 24240bd37d32Smrg [cf_cv_xopen_source=$cf_XOPEN_SOURCE]) 24250bd37d32Smrg CPPFLAGS="$cf_save" 24260bd37d32Smrg ]) 24270bd37d32Smrg]) 24280bd37d32Smrg 24290bd37d32Smrgif test "$cf_cv_xopen_source" != no ; then 24300bd37d32Smrg CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE) 24310bd37d32Smrg CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE) 24320bd37d32Smrg cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" 24330bd37d32Smrg CF_ADD_CFLAGS($cf_temp_xopen_source) 24340bd37d32Smrgfi 24350bd37d32Smrg]) 24360bd37d32Smrgdnl --------------------------------------------------------------------------- 24370bd37d32Smrgdnl CF_TTY_GROUP version: 8 updated: 2012/10/04 20:12:20 2438d522f475Smrgdnl ------------ 2439d522f475Smrgdnl Check if the system has a tty-group defined. This is used in xterm when 2440d522f475Smrgdnl setting pty ownership. 2441d522f475SmrgAC_DEFUN([CF_TTY_GROUP], 2442d522f475Smrg[ 2443d522f475SmrgAC_MSG_CHECKING(for explicit tty group name) 2444d522f475SmrgAC_ARG_WITH(tty-group, 2445d522f475Smrg [ --with-tty-group=XXX use XXX for the tty-group], 2446d522f475Smrg [cf_tty_group=$withval], 2447d522f475Smrg [cf_tty_group=auto...]) 2448d522f475Smrgtest -z "$cf_tty_group" && cf_tty_group=auto... 2449d522f475Smrgtest "$cf_tty_group" = yes && cf_tty_group=auto... 2450d522f475SmrgAC_MSG_RESULT($cf_tty_group) 2451d522f475Smrg 2452d522f475Smrgif test "$cf_tty_group" = "auto..." ; then 2453d522f475SmrgAC_CACHE_CHECK(for tty group name,cf_cv_tty_group_name,[ 2454d522f475Smrg 2455d522f475Smrg# If we are configuring as root, it is hard to get a clue about the tty group. 2456d522f475Smrg# But we'll guess based on how our connection is set up - assuming it is done 2457d522f475Smrg# properly. 2458d522f475Smrg 2459d522f475Smrgcf_uid=`id | sed -e 's/^[^=]*=//' -e 's/(.*$//'` 2460d522f475Smrg# )vi 2461d522f475Smrgif test "$cf_uid" != 0 ; then 2462d522f475Smrgcf_cv_tty_group_name= 2463d522f475Smrgcf_tty_name=`tty` 2464d522f475Smrgtest "$cf_tty_name" = "not a tty" && cf_tty_name=/dev/tty 2465d522f475Smrgtest -z "$cf_tty_name" && cf_tty_name=/dev/tty 2466d522f475Smrgif test -c "$cf_tty_name" 2467d522f475Smrgthen 2468d522f475Smrg cf_option="-l -L" 2469d522f475Smrg 2470d522f475Smrg # Expect listing to have fields like this: 2471d522f475Smrg #-rwxrwxrwx 1 user group 34293 Jul 18 16:29 pathname 2472d522f475Smrg ls $cf_option $cf_tty_name >conftest.out 2473d522f475Smrg read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest <conftest.out 2474d522f475Smrg if test -z "$cf_rest" ; then 2475d522f475Smrg cf_option="$cf_option -g" 2476d522f475Smrg ls $cf_option $cf_tty_name >conftest.out 2477d522f475Smrg read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest <conftest.out 2478d522f475Smrg fi 2479d522f475Smrg rm -f conftest.out 2480d522f475Smrg cf_cv_tty_group_name=$cf_grp 2481d522f475Smrgfi 2482d522f475Smrgfi 2483d522f475Smrg 2484d522f475Smrg# If we cannot deduce the tty group, fall back on hardcoded cases 2485d522f475Smrg 2486d522f475Smrgif test -z "$cf_cv_tty_group_name" 2487d522f475Smrgthen 2488d522f475Smrgcase $host_os in #(vi 2489d522f475Smrgosf*) #(vi 2490d522f475Smrg cf_cv_tty_group_name="terminal" 2491d522f475Smrg ;; 2492d522f475Smrg*) 2493d522f475Smrg cf_cv_tty_group_name="unknown" 2494d522f475Smrg if ( egrep '^tty:' /etc/group 2>/dev/null 1>/dev/null ) then 2495d522f475Smrg cf_cv_tty_group_name="tty" 2496d522f475Smrg fi 2497d522f475Smrg ;; 2498d522f475Smrgesac 2499d522f475Smrgfi 2500d522f475Smrg]) 2501d522f475Smrgcf_tty_group="$cf_cv_tty_group_name" 2502d522f475Smrgelse 2503d522f475Smrg # if configure option, always do this 25040bd37d32Smrg AC_DEFINE(USE_TTY_GROUP,1,[Define to 1 if we have a tty groupname]) 2505d522f475Smrgfi 2506d522f475Smrg 25070bd37d32SmrgAC_DEFINE_UNQUOTED(TTY_GROUP_NAME,"$cf_tty_group",[Define to the name use for tty group]) 2508d522f475Smrg 2509d522f475Smrg# This is only a double-check that the group-name we obtained above really 2510d522f475Smrg# does apply to the device. We cannot perform this test if we are in batch 2511d522f475Smrg# mode, or if we are cross-compiling. 2512d522f475Smrg 2513d522f475SmrgAC_CACHE_CHECK(if we may use the $cf_tty_group group,cf_cv_tty_group,[ 2514d522f475Smrgcf_tty_name=`tty` 2515d522f475Smrgif test "$cf_tty_name" != "not a tty" 2516d522f475Smrgthen 2517d522f475SmrgAC_TRY_RUN([ 2518d522f475Smrg#include <unistd.h> 2519d522f475Smrg#include <sys/types.h> 2520d522f475Smrg#include <sys/stat.h> 2521d522f475Smrg#include <grp.h> 2522d522f475Smrgint main() 2523d522f475Smrg{ 2524d522f475Smrg struct stat sb; 2525d522f475Smrg struct group *ttygrp = getgrnam(TTY_GROUP_NAME); 2526d522f475Smrg char *name = ttyname(0); 2527d522f475Smrg 2528d522f475Smrg endgrent(); 2529d522f475Smrg if (ttygrp != 0 2530d522f475Smrg && name != 0 2531d522f475Smrg && stat(name, &sb) == 0 2532d522f475Smrg && sb.st_gid != getgid() 2533d522f475Smrg && sb.st_gid == ttygrp->gr_gid) { 2534d522f475Smrg ${cf_cv_main_return:-return} (0); 2535d522f475Smrg } 2536d522f475Smrg ${cf_cv_main_return:-return} (1); 2537d522f475Smrg} 2538d522f475Smrg ], 2539d522f475Smrg [cf_cv_tty_group=yes], 2540d522f475Smrg [cf_cv_tty_group=no], 2541d522f475Smrg [cf_cv_tty_group=unknown]) 2542d522f475Smrgelif test "$cross_compiling" = yes; then 2543d522f475Smrg cf_cv_tty_group=unknown 2544d522f475Smrgelse 2545d522f475Smrg cf_cv_tty_group=yes 2546d522f475Smrgfi 2547d522f475Smrg]) 2548d522f475Smrg 2549d522f475Smrgif test $cf_cv_tty_group = no ; then 2550d522f475Smrg AC_MSG_WARN(Cannot use $cf_tty_group group) 2551d522f475Smrgelse 2552d522f475Smrg AC_DEFINE(USE_TTY_GROUP) 2553d522f475Smrgfi 2554d522f475Smrg])dnl 2555d522f475Smrgdnl --------------------------------------------------------------------------- 25560bd37d32Smrgdnl CF_TYPE_CC_T version: 2 updated: 2012/10/04 20:12:20 25570bd37d32Smrgdnl ------------ 25580bd37d32Smrgdnl Check for cc_t type, used in termio. 25590bd37d32SmrgAC_DEFUN([CF_TYPE_CC_T], 25600bd37d32Smrg[ 25610bd37d32SmrgAC_MSG_CHECKING(for cc_t in <termios.h> or <termio.h>) 25620bd37d32SmrgAC_CACHE_VAL(cf_cv_type_cc_t,[ 25630bd37d32Smrg AC_TRY_COMPILE([ 25640bd37d32Smrg#include <sys/types.h> 25650bd37d32Smrg#if defined(HAVE_TERMIOS_H) 25660bd37d32Smrg#include <termios.h> 25670bd37d32Smrg#else 25680bd37d32Smrg#include <termio.h> 25690bd37d32Smrg#include <sys/ioctl.h> 25700bd37d32Smrg#endif 25710bd37d32Smrg], 25720bd37d32Smrg [cc_t x], 25730bd37d32Smrg [cf_cv_type_cc_t=yes], 25740bd37d32Smrg [cf_cv_type_cc_t=no]) 25750bd37d32Smrg ]) 25760bd37d32SmrgAC_MSG_RESULT($cf_cv_type_cc_t) 25770bd37d32Smrgtest $cf_cv_type_cc_t = no && AC_DEFINE(cc_t, unsigned char,[Define to cc_t type used in termio]) 25780bd37d32Smrg])dnl 25790bd37d32Smrgdnl --------------------------------------------------------------------------- 25800bd37d32Smrgdnl CF_TYPE_FD_MASK version: 3 updated: 2012/10/04 06:57:36 2581d522f475Smrgdnl --------------- 2582d522f475Smrgdnl Check for the declaration of fd_mask, which is like fd_set, associated 2583d522f475Smrgdnl with select(). The check for fd_set should have pulled in this as well, 2584d522f475Smrgdnl but there is a special case for Mac OS X, possibly other BSD-derived 2585d522f475Smrgdnl platforms. 2586d522f475SmrgAC_DEFUN([CF_TYPE_FD_MASK], 2587d522f475Smrg[ 2588d522f475SmrgAC_REQUIRE([CF_TYPE_FD_SET]) 2589d522f475Smrg 2590d522f475SmrgAC_CACHE_CHECK(for declaration of fd_mask,cf_cv_type_fd_mask,[ 2591d522f475Smrg if test x$cf_cv_type_fd_set = xX11/Xpoll.h ; then 2592d522f475Smrg AC_TRY_COMPILE([ 2593d522f475Smrg#include <X11/Xpoll.h>],[fd_mask x],, 2594d522f475Smrg [CF_MSG_LOG(if we must define CSRG_BASED) 2595d522f475Smrg# Xosdefs.h on Mac OS X may not define this (but it should). 2596d522f475Smrg AC_TRY_COMPILE([ 2597d522f475Smrg#define CSRG_BASED 2598d522f475Smrg#include <X11/Xpoll.h>],[fd_mask x], 2599d522f475Smrg cf_cv_type_fd_mask=CSRG_BASED)]) 2600d522f475Smrg else 2601d522f475Smrg cf_cv_type_fd_mask=$cf_cv_type_fd_set 2602d522f475Smrg fi 2603d522f475Smrg]) 2604d522f475Smrgif test x$cf_cv_type_fd_mask = xCSRG_BASED ; then 26050bd37d32Smrg AC_DEFINE(CSRG_BASED,1,[Define to 1 if needed for declaring fd_mask()]) 2606d522f475Smrgfi 2607d522f475Smrg])dnl 2608d522f475Smrgdnl --------------------------------------------------------------------------- 26090bd37d32Smrgdnl CF_TYPE_FD_SET version: 5 updated: 2012/10/04 20:12:20 2610d522f475Smrgdnl -------------- 2611d522f475Smrgdnl Check for the declaration of fd_set. Some platforms declare it in 2612d522f475Smrgdnl <sys/types.h>, and some in <sys/select.h>, which requires <sys/types.h>. 2613d522f475Smrgdnl Finally, if we are using this for an X application, Xpoll.h may include 2614d522f475Smrgdnl <sys/select.h>, so we don't want to do it twice. 2615d522f475SmrgAC_DEFUN([CF_TYPE_FD_SET], 2616d522f475Smrg[ 2617d522f475SmrgAC_CHECK_HEADERS(X11/Xpoll.h) 2618d522f475Smrg 2619d522f475SmrgAC_CACHE_CHECK(for declaration of fd_set,cf_cv_type_fd_set, 2620d522f475Smrg [CF_MSG_LOG(sys/types alone) 2621d522f475SmrgAC_TRY_COMPILE([ 2622d522f475Smrg#include <sys/types.h>], 2623d522f475Smrg [fd_set x], 2624d522f475Smrg [cf_cv_type_fd_set=sys/types.h], 2625d522f475Smrg [CF_MSG_LOG(X11/Xpoll.h) 2626d522f475SmrgAC_TRY_COMPILE([ 2627d522f475Smrg#ifdef HAVE_X11_XPOLL_H 2628d522f475Smrg#include <X11/Xpoll.h> 2629d522f475Smrg#endif], 2630d522f475Smrg [fd_set x], 2631d522f475Smrg [cf_cv_type_fd_set=X11/Xpoll.h], 2632d522f475Smrg [CF_MSG_LOG(sys/select.h) 2633d522f475SmrgAC_TRY_COMPILE([ 2634d522f475Smrg#include <sys/types.h> 2635d522f475Smrg#include <sys/select.h>], 2636d522f475Smrg [fd_set x], 2637d522f475Smrg [cf_cv_type_fd_set=sys/select.h], 2638d522f475Smrg [cf_cv_type_fd_set=unknown])])])]) 2639d522f475Smrgif test $cf_cv_type_fd_set = sys/select.h ; then 26400bd37d32Smrg AC_DEFINE(USE_SYS_SELECT_H,1,[Define to 1 to include sys/select.h to declare fd_set]) 2641d522f475Smrgfi 2642d522f475Smrg]) 2643d522f475Smrgdnl --------------------------------------------------------------------------- 2644e39b573cSmrgdnl CF_UNDO_CFLAGS version: 1 updated: 2011/07/02 09:27:51 2645e39b573cSmrgdnl -------------- 2646e39b573cSmrgdnl Remove flags from $CFLAGS or similar shell variable using sed. 2647e39b573cSmrgdnl $1 = variable 2648e39b573cSmrgdnl $2 = message 2649e39b573cSmrgdnl $3 = pattern to remove 2650e39b573cSmrgAC_DEFUN([CF_UNDO_CFLAGS], 2651e39b573cSmrg[ 2652e39b573cSmrg CF_VERBOSE(removing $2 flags from $1) 2653e39b573cSmrg $1=`echo "[$]$1" | sed -e 's/$3//'` 2654e39b573cSmrg CF_VERBOSE(...result [$]$1) 2655e39b573cSmrg])dnl 2656e39b573cSmrgdnl --------------------------------------------------------------------------- 2657d522f475Smrgdnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59 2658d522f475Smrgdnl -------- 2659d522f475Smrgdnl Make an uppercase version of a variable 2660d522f475Smrgdnl $1=uppercase($2) 2661d522f475SmrgAC_DEFUN([CF_UPPER], 2662d522f475Smrg[ 2663d522f475Smrg$1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` 2664d522f475Smrg])dnl 2665d522f475Smrgdnl --------------------------------------------------------------------------- 26660bd37d32Smrgdnl CF_UTEMPTER version: 4 updated: 2012/10/04 20:12:20 2667d522f475Smrgdnl ----------- 2668d522f475Smrgdnl Try to link with utempter library 2669d522f475SmrgAC_DEFUN([CF_UTEMPTER], 2670d522f475Smrg[ 2671d522f475SmrgAC_CACHE_CHECK(if we can link with utempter library,cf_cv_have_utempter,[ 2672d522f475Smrgcf_save_LIBS="$LIBS" 267320d2c4d2SmrgCF_ADD_LIB(utempter) 2674d522f475SmrgAC_TRY_LINK([ 2675d522f475Smrg#include <utempter.h> 2676d522f475Smrg],[ 2677d522f475Smrg addToUtmp("/dev/tty", 0, 1); 2678d522f475Smrg removeFromUtmp(); 2679d522f475Smrg],[ 2680d522f475Smrg cf_cv_have_utempter=yes],[ 2681d522f475Smrg cf_cv_have_utempter=no]) 2682d522f475SmrgLIBS="$cf_save_LIBS" 2683d522f475Smrg]) 2684d522f475Smrgif test "$cf_cv_have_utempter" = yes ; then 26850bd37d32Smrg AC_DEFINE(USE_UTEMPTER,1,[Define to 1 if we can/should link with utempter]) 268620d2c4d2Smrg CF_ADD_LIB(utempter) 2687d522f475Smrgfi 2688d522f475Smrg])dnl 2689d522f475Smrgdnl --------------------------------------------------------------------------- 26900bd37d32Smrgdnl CF_UTMP version: 10 updated: 2012/10/04 20:12:20 2691d522f475Smrgdnl ------- 2692d522f475Smrgdnl Check for UTMP/UTMPX headers 2693d522f475SmrgAC_DEFUN([CF_UTMP], 2694d522f475Smrg[ 2695d522f475SmrgAC_REQUIRE([CF_LASTLOG]) 2696d522f475Smrg 2697d522f475SmrgAC_CACHE_CHECK(for utmp implementation,cf_cv_have_utmp,[ 2698d522f475Smrg cf_cv_have_utmp=no 2699d522f475Smrgfor cf_header in utmpx utmp ; do 2700d522f475Smrgcf_utmp_includes=" 2701d522f475Smrg#include <sys/types.h> 2702d522f475Smrg#include <${cf_header}.h> 2703d522f475Smrg#define getutent getutxent 2704d522f475Smrg#ifdef USE_LASTLOG 2705d522f475Smrg#include <lastlog.h> /* may conflict with utmpx.h on Linux */ 2706d522f475Smrg#endif 2707d522f475Smrg" 2708d522f475Smrg AC_TRY_COMPILE([$cf_utmp_includes], 2709d522f475Smrg [struct $cf_header x; 2710d522f475Smrg char *name = x.ut_name; /* utmp.h and compatible definitions */ 2711d522f475Smrg ], 2712d522f475Smrg [cf_cv_have_utmp=$cf_header 2713d522f475Smrg break], 2714d522f475Smrg [ 2715d522f475Smrg AC_TRY_COMPILE([$cf_utmp_includes], 2716d522f475Smrg [struct $cf_header x; 2717d522f475Smrg char *name = x.ut_user; /* utmpx.h must declare this */ 2718d522f475Smrg ], 2719d522f475Smrg [cf_cv_have_utmp=$cf_header 2720d522f475Smrg break 2721d522f475Smrg ])]) 2722d522f475Smrgdone 2723d522f475Smrg]) 2724d522f475Smrg 2725d522f475Smrgif test $cf_cv_have_utmp != no ; then 27260bd37d32Smrg AC_DEFINE(HAVE_UTMP,1,[Define to 1 if the utmp interface is available]) 27270bd37d32Smrg test $cf_cv_have_utmp = utmpx && AC_DEFINE(UTMPX_FOR_UTMP,1,[Define if we have utmpx interface]) 2728d522f475Smrg CF_UTMP_UT_HOST 2729d522f475Smrg CF_UTMP_UT_SYSLEN 2730d522f475Smrg CF_UTMP_UT_NAME 2731d522f475Smrg CF_UTMP_UT_XSTATUS 2732d522f475Smrg CF_UTMP_UT_XTIME 2733d522f475Smrg CF_UTMP_UT_SESSION 2734d522f475Smrg CF_SYSV_UTMP 2735d522f475Smrgfi 2736d522f475Smrg])dnl 2737d522f475Smrgdnl --------------------------------------------------------------------------- 2738d522f475Smrgdnl CF_UTMP_GROUP version: 1 updated: 2005/10/06 20:29:29 2739d522f475Smrgdnl ------------- 2740d522f475Smrgdnl Find the utmp/utmpx file and determine its group to allow setgid programs 2741d522f475Smrgdnl to manipulate it, e.g., when there is no intermediary. 2742d522f475SmrgAC_DEFUN([CF_UTMP_GROUP],[ 2743d522f475SmrgAC_REQUIRE([CF_UTMP]) 2744d522f475Smrgif test $cf_cv_have_utmp != no ; then 2745d522f475SmrgAC_CACHE_CHECK(for utmp/utmpx group,cf_cv_utmp_group,[ 2746d522f475Smrgfor cf_utmp_path in /var/adm /var/run 2747d522f475Smrgdo 2748d522f475Smrg for cf_utmp_file in utmpx utmp 2749d522f475Smrg do 2750d522f475Smrg if test -f $cf_utmp_path/$cf_utmp_file 2751d522f475Smrg then 2752d522f475Smrg cf_cv_utmp_group=root 2753d522f475Smrg 2754d522f475Smrg cf_option="-l -L" 2755d522f475Smrg 2756d522f475Smrg # Expect listing to have fields like this: 2757d522f475Smrg #-r--r--r-- 1 user group 34293 Jul 18 16:29 pathname 2758d522f475Smrg ls $cf_option $cf_utmp_path/$cf_utmp_file >conftest 2759d522f475Smrg read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest <conftest 2760d522f475Smrg if test -z "$cf_rest" ; then 2761d522f475Smrg cf_option="$cf_option -g" 2762d522f475Smrg ls $cf_option $cf_utmp_path/$cf_utmp_file >conftest 2763d522f475Smrg read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest <conftest 2764d522f475Smrg fi 2765d522f475Smrg rm -f conftest 2766d522f475Smrg 2767d522f475Smrg # If we have a pathname, and the date fields look right, assume we've 2768d522f475Smrg # captured the group as well. 2769d522f475Smrg if test -n "$cf_rest" ; then 2770d522f475Smrg cf_test=`echo "${cf_date2}${cf_date3}" | sed -e 's/[[0-9:]]//g'` 2771d522f475Smrg if test -z "$cf_test" ; then 2772d522f475Smrg cf_cv_utmp_group=$cf_grp; 2773d522f475Smrg fi 2774d522f475Smrg fi 2775d522f475Smrg break 2776d522f475Smrg fi 2777d522f475Smrg done 2778d522f475Smrg test -n "$cf_cv_utmp_group" && break 2779d522f475Smrgdone 2780d522f475Smrg]) 2781d522f475Smrgelse 2782d522f475Smrg AC_MSG_ERROR(cannot find utmp group) 2783d522f475Smrgfi 2784d522f475Smrg])dnl 2785d522f475Smrgdnl --------------------------------------------------------------------------- 27860bd37d32Smrgdnl CF_UTMP_UT_HOST version: 8 updated: 2012/10/04 20:12:20 2787d522f475Smrgdnl --------------- 2788d522f475Smrgdnl Check if UTMP/UTMPX struct defines ut_host member 2789d522f475SmrgAC_DEFUN([CF_UTMP_UT_HOST], 2790d522f475Smrg[ 2791d522f475Smrgif test $cf_cv_have_utmp != no ; then 2792d522f475SmrgAC_MSG_CHECKING(if ${cf_cv_have_utmp}.ut_host is declared) 2793d522f475SmrgAC_CACHE_VAL(cf_cv_have_utmp_ut_host,[ 2794d522f475Smrg AC_TRY_COMPILE([ 2795d522f475Smrg#include <sys/types.h> 2796d522f475Smrg#include <${cf_cv_have_utmp}.h>], 2797d522f475Smrg [struct $cf_cv_have_utmp x; char *y = &x.ut_host[0]], 2798d522f475Smrg [cf_cv_have_utmp_ut_host=yes], 2799d522f475Smrg [cf_cv_have_utmp_ut_host=no]) 2800d522f475Smrg ]) 2801d522f475SmrgAC_MSG_RESULT($cf_cv_have_utmp_ut_host) 28020bd37d32Smrgtest $cf_cv_have_utmp_ut_host != no && AC_DEFINE(HAVE_UTMP_UT_HOST,1,[Define to 1 if UTMP/UTMPX struct defines ut_host member]) 2803d522f475Smrgfi 2804d522f475Smrg])dnl 2805d522f475Smrgdnl --------------------------------------------------------------------------- 28060bd37d32Smrgdnl CF_UTMP_UT_NAME version: 5 updated: 2012/10/04 20:12:20 2807d522f475Smrgdnl --------------- 2808d522f475Smrgdnl Check if UTMP/UTMPX struct defines ut_name member 2809d522f475SmrgAC_DEFUN([CF_UTMP_UT_NAME], 2810d522f475Smrg[ 2811d522f475Smrgif test $cf_cv_have_utmp != no ; then 2812d522f475SmrgAC_CACHE_CHECK(if ${cf_cv_have_utmp}.ut_name is declared,cf_cv_have_utmp_ut_name,[ 2813d522f475Smrg cf_cv_have_utmp_ut_name=no 2814d522f475Smrgcf_utmp_includes=" 2815d522f475Smrg#include <sys/types.h> 2816d522f475Smrg#include <${cf_cv_have_utmp}.h> 2817d522f475Smrg#define getutent getutxent 2818d522f475Smrg#ifdef USE_LASTLOG 2819d522f475Smrg#include <lastlog.h> /* may conflict with utmpx.h on Linux */ 2820d522f475Smrg#endif 2821d522f475Smrg" 2822d522f475Smrgfor cf_header in ut_name ut_user ; do 2823d522f475Smrg AC_TRY_COMPILE([$cf_utmp_includes], 2824d522f475Smrg [struct $cf_cv_have_utmp x; 2825d522f475Smrg char *name = x.$cf_header; 2826d522f475Smrg ], 2827d522f475Smrg [cf_cv_have_utmp_ut_name=$cf_header 2828d522f475Smrg break]) 2829d522f475Smrgdone 2830d522f475Smrg]) 2831d522f475Smrg 2832d522f475Smrgcase $cf_cv_have_utmp_ut_name in #(vi 2833d522f475Smrgno) #(vi 2834d522f475Smrg AC_MSG_ERROR(Cannot find declaration for ut.ut_name) 2835d522f475Smrg ;; 2836d522f475Smrgut_user) 28370bd37d32Smrg AC_DEFINE(ut_name,ut_user,[Define to rename UTMP/UTMPX struct ut_name member]) 2838d522f475Smrg ;; 2839d522f475Smrgesac 2840d522f475Smrgfi 2841d522f475Smrg])dnl 2842d522f475Smrgdnl --------------------------------------------------------------------------- 28430bd37d32Smrgdnl CF_UTMP_UT_SESSION version: 6 updated: 2012/10/04 20:12:20 2844d522f475Smrgdnl ------------------ 2845d522f475Smrgdnl Check if UTMP/UTMPX struct defines ut_session member 2846d522f475SmrgAC_DEFUN([CF_UTMP_UT_SESSION], 2847d522f475Smrg[ 2848d522f475Smrgif test $cf_cv_have_utmp != no ; then 2849d522f475SmrgAC_CACHE_CHECK(if ${cf_cv_have_utmp}.ut_session is declared, cf_cv_have_utmp_ut_session,[ 2850d522f475Smrg AC_TRY_COMPILE([ 2851d522f475Smrg#include <sys/types.h> 2852d522f475Smrg#include <${cf_cv_have_utmp}.h>], 2853d522f475Smrg [struct $cf_cv_have_utmp x; long y = x.ut_session], 2854d522f475Smrg [cf_cv_have_utmp_ut_session=yes], 2855d522f475Smrg [cf_cv_have_utmp_ut_session=no]) 2856d522f475Smrg]) 2857d522f475Smrgif test $cf_cv_have_utmp_ut_session != no ; then 28580bd37d32Smrg AC_DEFINE(HAVE_UTMP_UT_SESSION,1,[Define to 1 if UTMP/UTMPX struct defines ut_session member]) 2859d522f475Smrgfi 2860d522f475Smrgfi 2861d522f475Smrg])dnl 2862d522f475Smrgdnl --------------------------------------------------------------------------- 28630bd37d32Smrgdnl CF_UTMP_UT_SYSLEN version: 2 updated: 2012/10/04 20:12:20 2864d522f475Smrgdnl ----------------- 2865d522f475Smrgdnl Check if UTMP/UTMPX struct defines ut_syslen member 2866d522f475SmrgAC_DEFUN([CF_UTMP_UT_SYSLEN], 2867d522f475Smrg[ 2868d522f475Smrgif test $cf_cv_have_utmp != no ; then 2869d522f475SmrgAC_MSG_CHECKING(if ${cf_cv_have_utmp}.ut_syslen is declared) 2870d522f475SmrgAC_CACHE_VAL(cf_cv_have_utmp_ut_syslen,[ 2871d522f475Smrg AC_TRY_COMPILE([ 2872d522f475Smrg#include <sys/types.h> 2873d522f475Smrg#include <${cf_cv_have_utmp}.h>], 2874d522f475Smrg [struct $cf_cv_have_utmp x; int y = x.ut_syslen], 2875d522f475Smrg [cf_cv_have_utmp_ut_syslen=yes], 2876d522f475Smrg [cf_cv_have_utmp_ut_syslen=no]) 2877d522f475Smrg ]) 2878d522f475SmrgAC_MSG_RESULT($cf_cv_have_utmp_ut_syslen) 28790bd37d32Smrgtest $cf_cv_have_utmp_ut_syslen != no && AC_DEFINE(HAVE_UTMP_UT_SYSLEN,1,[Define to 1 if UTMP/UTMPX struct defines ut_syslen member]) 2880d522f475Smrgfi 2881d522f475Smrg])dnl 2882d522f475Smrgdnl --------------------------------------------------------------------------- 28830bd37d32Smrgdnl CF_UTMP_UT_XSTATUS version: 4 updated: 2012/10/04 20:12:20 2884d522f475Smrgdnl ------------------ 2885d522f475Smrgdnl Check for known variants on the UTMP/UTMPX struct's exit-status as reported 2886d522f475Smrgdnl by various people: 2887d522f475Smrgdnl 2888d522f475Smrgdnl ut_exit.__e_exit (HPUX 11 - David Ellement, also in glibc2) 2889d522f475Smrgdnl ut_exit.e_exit (SVR4) 2890d522f475Smrgdnl ut_exit.ut_e_exit (os390 - Greg Smith) 2891d522f475Smrgdnl ut_exit.ut_exit (Tru64 4.0f - Jeremie Petit, 4.0e - Tomas Vanhala) 2892d522f475Smrgdnl 2893d522f475Smrgdnl Note: utmp_xstatus is not a conventional compatibility definition in the 2894d522f475Smrgdnl system header files. 2895d522f475SmrgAC_DEFUN([CF_UTMP_UT_XSTATUS], 2896d522f475Smrg[ 2897d522f475Smrgif test $cf_cv_have_utmp != no ; then 2898d522f475SmrgAC_CACHE_CHECK(for exit-status in $cf_cv_have_utmp,cf_cv_have_utmp_ut_xstatus,[ 2899d522f475Smrgfor cf_result in \ 2900d522f475Smrg ut_exit.__e_exit \ 2901d522f475Smrg ut_exit.e_exit \ 2902d522f475Smrg ut_exit.ut_e_exit \ 2903d522f475Smrg ut_exit.ut_exit 2904d522f475Smrgdo 2905d522f475SmrgAC_TRY_COMPILE([ 2906d522f475Smrg#include <sys/types.h> 2907d522f475Smrg#include <${cf_cv_have_utmp}.h>], 2908d522f475Smrg [struct $cf_cv_have_utmp x; long y = x.$cf_result = 0], 2909d522f475Smrg [cf_cv_have_utmp_ut_xstatus=$cf_result 2910d522f475Smrg break], 2911d522f475Smrg [cf_cv_have_utmp_ut_xstatus=no]) 2912d522f475Smrgdone 2913d522f475Smrg]) 2914d522f475Smrgif test $cf_cv_have_utmp_ut_xstatus != no ; then 29150bd37d32Smrg AC_DEFINE(HAVE_UTMP_UT_XSTATUS,1,[Define to 1 if UTMP/UTMPX has exit-status member]) 29160bd37d32Smrg AC_DEFINE_UNQUOTED(ut_xstatus,$cf_cv_have_utmp_ut_xstatus,[Define if needed to rename member ut_xstatus of UTMP/UTMPX]) 2917d522f475Smrgfi 2918d522f475Smrgfi 2919d522f475Smrg])dnl 2920d522f475Smrgdnl --------------------------------------------------------------------------- 29210bd37d32Smrgdnl CF_UTMP_UT_XTIME version: 9 updated: 2012/10/04 20:12:20 2922d522f475Smrgdnl ---------------- 2923d522f475Smrgdnl Check if UTMP/UTMPX struct defines ut_xtime member 2924d522f475SmrgAC_DEFUN([CF_UTMP_UT_XTIME], 2925d522f475Smrg[ 2926d522f475Smrgif test $cf_cv_have_utmp != no ; then 2927d522f475SmrgAC_CACHE_CHECK(if ${cf_cv_have_utmp}.ut_xtime is declared, cf_cv_have_utmp_ut_xtime,[ 2928d522f475Smrg AC_TRY_COMPILE([ 2929d522f475Smrg#include <sys/types.h> 2930d522f475Smrg#include <${cf_cv_have_utmp}.h>], 2931d522f475Smrg [struct $cf_cv_have_utmp x; long y = x.ut_xtime = 0], 2932d522f475Smrg [cf_cv_have_utmp_ut_xtime=yes], 2933d522f475Smrg [AC_TRY_COMPILE([ 2934d522f475Smrg#include <sys/types.h> 2935d522f475Smrg#include <${cf_cv_have_utmp}.h>], 2936d522f475Smrg [struct $cf_cv_have_utmp x; long y = x.ut_tv.tv_sec], 2937d522f475Smrg [cf_cv_have_utmp_ut_xtime=define], 2938d522f475Smrg [cf_cv_have_utmp_ut_xtime=no]) 2939d522f475Smrg ]) 2940d522f475Smrg]) 2941d522f475Smrgif test $cf_cv_have_utmp_ut_xtime != no ; then 29420bd37d32Smrg AC_DEFINE(HAVE_UTMP_UT_XTIME,1,[Define to 1 if UTMP/UTMPX struct defines ut_xtime member]) 2943d522f475Smrg if test $cf_cv_have_utmp_ut_xtime = define ; then 29440bd37d32Smrg AC_DEFINE(ut_xtime,ut_tv.tv_sec,[Define if needed to alternate name for utmpx.ut_xtime member]) 2945d522f475Smrg fi 2946d522f475Smrgfi 2947d522f475Smrgfi 2948d522f475Smrg])dnl 2949d522f475Smrgdnl --------------------------------------------------------------------------- 2950d522f475Smrgdnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12 2951d522f475Smrgdnl ---------- 2952d522f475Smrgdnl Use AC_VERBOSE w/o the warnings 2953d522f475SmrgAC_DEFUN([CF_VERBOSE], 2954d522f475Smrg[test -n "$verbose" && echo " $1" 1>&AC_FD_MSG 2955d522f475SmrgCF_MSG_LOG([$1]) 2956d522f475Smrg])dnl 2957d522f475Smrgdnl --------------------------------------------------------------------------- 29580bd37d32Smrgdnl CF_WITH_APP_CLASS version: 2 updated: 2012/10/04 04:29:52 2959e39b573cSmrgdnl ----------------- 2960e39b573cSmrgdnl Handle configure option "--with-app-class", setting the $APP_CLASS 2961e39b573cSmrgdnl variable, used for X resources. 2962e39b573cSmrgdnl 2963e39b573cSmrgdnl $1 = default value. 29640bd37d32SmrgAC_DEFUN([CF_WITH_APP_CLASS],[ 2965e39b573cSmrgAC_MSG_CHECKING(for X applications class) 2966e39b573cSmrgAC_ARG_WITH(app-class, 2967e39b573cSmrg [ --with-app-class=XXX override X applications class (default $1)], 2968e39b573cSmrg [APP_CLASS=$withval], 2969e39b573cSmrg [APP_CLASS=$1]) 2970e39b573cSmrg 2971e39b573cSmrgcase x$APP_CLASS in #(vi 2972e39b573cSmrg*[[/@,%]]*) #(vi 2973e39b573cSmrg AC_MSG_WARN(X applications class cannot contain punctuation) 2974e39b573cSmrg APP_CLASS=$1 2975e39b573cSmrg ;; 2976e39b573cSmrgx[[A-Z]]*) #(vi 2977e39b573cSmrg ;; 2978e39b573cSmrg*) 2979e39b573cSmrg AC_MSG_WARN([X applications class must start with capital, ignoring $APP_CLASS]) 2980e39b573cSmrg APP_CLASS=$1 2981e39b573cSmrg ;; 2982e39b573cSmrgesac 2983e39b573cSmrg 2984e39b573cSmrgAC_MSG_RESULT($APP_CLASS) 2985e39b573cSmrg 2986e39b573cSmrgAC_SUBST(APP_CLASS) 2987e39b573cSmrg])dnl 2988e39b573cSmrgdnl --------------------------------------------------------------------------- 29890bd37d32Smrgdnl CF_WITH_APP_DEFAULTS version: 5 updated: 2012/10/04 04:29:52 2990e39b573cSmrgdnl -------------------- 2991e39b573cSmrgdnl Handle configure option "--with-app-defaults", setting these shell 2992e39b573cSmrgdnl variables: 29930bd37d32Smrgdnl 29940bd37d32Smrgdnl $APPSDIR is the option value, used for installing app-defaults files. 2995e39b573cSmrgdnl $no_appsdir is a "#" (comment) if "--without-app-defaults" is given. 29960bd37d32Smrgdnl 29970bd37d32Smrgdnl Most Linux's use this: 29980bd37d32Smrgdnl /usr/share/X11/app-defaults 29990bd37d32Smrgdnl Debian uses this: 30000bd37d32Smrgdnl /etc/X11/app-defaults 30010bd37d32Smrgdnl DragonFlyBSD ports uses this: 30020bd37d32Smrgdnl /usr/pkg/lib/X11/app-defaults 30030bd37d32Smrgdnl FreeBSD ports use these: 30040bd37d32Smrgdnl /usr/local/lib/X11/app-defaults 30050bd37d32Smrgdnl /usr/local/share/X11/app-defaults 30060bd37d32Smrgdnl Mandriva has these: 30070bd37d32Smrgdnl /usr/lib/X11/app-defaults 30080bd37d32Smrgdnl /usr/lib64/X11/app-defaults 30090bd37d32Smrgdnl NetBSD has these 30100bd37d32Smrgdnl /usr/X11R7/lib/X11/app-defaults 30110bd37d32Smrgdnl OpenSolaris uses 30120bd37d32Smrgdnl 32-bit: 30130bd37d32Smrgdnl /usr/X11/etc/X11/app-defaults 30140bd37d32Smrgdnl /usr/X11/share/X11/app-defaults 30150bd37d32Smrgdnl /usr/X11/lib/X11/app-defaults 30160bd37d32Smrgdnl 64-bit: 30170bd37d32Smrgdnl /usr/X11/etc/X11/app-defaults 30180bd37d32Smrgdnl /usr/X11/share/X11/app-defaults (I mkdir'd this) 30190bd37d32Smrgdnl /usr/X11/lib/amd64/X11/app-defaults 30200bd37d32Smrgdnl Solaris10 uses (in this order): 30210bd37d32Smrgdnl /usr/openwin/lib/X11/app-defaults 30220bd37d32Smrgdnl /usr/X11/lib/X11/app-defaults 30230bd37d32SmrgAC_DEFUN([CF_WITH_APP_DEFAULTS],[ 3024e39b573cSmrgAC_MSG_CHECKING(for directory to install resource files) 30250bd37d32SmrgAC_ARG_WITH(app-defaults, 30260bd37d32Smrg [ --with-app-defaults=DIR directory in which to install resource files (EPREFIX/lib/X11/app-defaults)], 30270bd37d32Smrg [APPSDIR=$withval], 30280bd37d32Smrg [APPSDIR='${exec_prefix}/lib/X11/app-defaults']) 30290bd37d32Smrg 30300bd37d32Smrgif test "x[$]APPSDIR" = xauto 30310bd37d32Smrgthen 30320bd37d32Smrg APPSDIR='${exec_prefix}/lib/X11/app-defaults' 30330bd37d32Smrg for cf_path in \ 30340bd37d32Smrg /usr/share/X11/app-defaults \ 30350bd37d32Smrg /usr/X11/share/X11/app-defaults \ 30360bd37d32Smrg /usr/X11/lib/X11/app-defaults \ 30370bd37d32Smrg /usr/lib/X11/app-defaults \ 30380bd37d32Smrg /etc/X11/app-defaults \ 30390bd37d32Smrg /usr/pkg/lib/X11/app-defaults \ 30400bd37d32Smrg /usr/X11R7/lib/X11/app-defaults \ 30410bd37d32Smrg /usr/X11R6/lib/X11/app-defaults \ 30420bd37d32Smrg /usr/X11R5/lib/X11/app-defaults \ 30430bd37d32Smrg /usr/X11R4/lib/X11/app-defaults \ 30440bd37d32Smrg /usr/local/lib/X11/app-defaults \ 30450bd37d32Smrg /usr/local/share/X11/app-defaults \ 30460bd37d32Smrg /usr/lib64/X11/app-defaults 30470bd37d32Smrg do 30480bd37d32Smrg if test -d "$cf_path" ; then 30490bd37d32Smrg APPSDIR="$cf_path" 30500bd37d32Smrg break 30510bd37d32Smrg fi 30520bd37d32Smrg done 30530bd37d32Smrgelse 30540bd37d32Smrg cf_path=$APPSDIR 30550bd37d32Smrg CF_PATH_SYNTAX(cf_path) 30560bd37d32Smrgfi 30570bd37d32Smrg 30580bd37d32SmrgAC_MSG_RESULT($APPSDIR) 30590bd37d32SmrgAC_SUBST(APPSDIR) 3060e39b573cSmrg 3061e39b573cSmrgno_appsdir= 30620bd37d32Smrgif test "$APPSDIR" = no 30630bd37d32Smrgthen 30640bd37d32Smrg no_appsdir="#" 30650bd37d32Smrgelse 30660bd37d32Smrg EXTRA_INSTALL_DIRS="$EXTRA_INSTALL_DIRS \$(APPSDIR)" 30670bd37d32Smrgfi 3068e39b573cSmrgAC_SUBST(no_appsdir) 3069e39b573cSmrg])dnl 3070e39b573cSmrgdnl --------------------------------------------------------------------------- 30710bd37d32Smrgdnl CF_WITH_DBMALLOC version: 7 updated: 2010/06/21 17:26:47 30720bd37d32Smrgdnl ---------------- 30730bd37d32Smrgdnl Configure-option for dbmalloc. The optional parameter is used to override 30740bd37d32Smrgdnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests. 30750bd37d32SmrgAC_DEFUN([CF_WITH_DBMALLOC],[ 30760bd37d32SmrgCF_NO_LEAKS_OPTION(dbmalloc, 30770bd37d32Smrg [ --with-dbmalloc test: use Conor Cahill's dbmalloc library], 30780bd37d32Smrg [USE_DBMALLOC]) 30790bd37d32Smrg 30800bd37d32Smrgif test "$with_dbmalloc" = yes ; then 30810bd37d32Smrg AC_CHECK_HEADER(dbmalloc.h, 30820bd37d32Smrg [AC_CHECK_LIB(dbmalloc,[debug_malloc]ifelse([$1],,[],[,$1]))]) 30830bd37d32Smrgfi 30840bd37d32Smrg])dnl 30850bd37d32Smrgdnl --------------------------------------------------------------------------- 30860bd37d32Smrgdnl CF_WITH_DESKTOP_CATEGORY version: 4 updated: 2013/01/01 10:50:14 3087e39b573cSmrgdnl ------------------------ 3088e39b573cSmrgdnl Taking into account the absence of standardization of desktop categories 3089e39b573cSmrgdnl take a look to see whether other applications on the current system are 3090e39b573cSmrgdnl assigned any/all of a set of suggested categories. 3091e39b573cSmrgdnl 3092e39b573cSmrgdnl $1 = program name 3093e39b573cSmrgdnl $2 = case-pattern to match comparable desktop files to obtain category 3094e39b573cSmrgdnl This pattern may contain wildcards. 3095e39b573cSmrgdnl $3 = suggested categories, also a case-pattern but without wildcards, 30960bd37d32Smrgdnl since it doubles as a default value for a shell case-statement. 30970bd37d32Smrgdnl $4 = categories to use if no match is found on the build-machine for the 30980bd37d32Smrgdnl --with-desktop-category "auto" setting. 3099e39b573cSmrgdnl 3100e39b573cSmrgdnl The macro tells the configure script to substitute the $DESKTOP_CATEGORY 3101e39b573cSmrgdnl value. 3102e39b573cSmrgAC_DEFUN([CF_WITH_DESKTOP_CATEGORY],[ 3103e39b573cSmrgAC_REQUIRE([CF_DISABLE_DESKTOP]) 3104e39b573cSmrg 3105e39b573cSmrgif test -z "$desktop_utils" 3106e39b573cSmrgthen 3107e39b573cSmrg AC_MSG_CHECKING(for requested desktop-category) 3108e39b573cSmrg AC_ARG_WITH(desktop-category, 3109e39b573cSmrg [ --with-desktop-category=XXX one or more desktop catgories or auto], 3110e39b573cSmrg [cf_desktop_want=$withval], 3111e39b573cSmrg [cf_desktop_want=auto]) 3112e39b573cSmrg AC_MSG_RESULT($cf_desktop_want) 3113e39b573cSmrg 3114e39b573cSmrg if test "$cf_desktop_want" = auto 3115e39b573cSmrg then 3116e39b573cSmrg rm -rf conftest* 3117e39b573cSmrg cf_desktop_also= 3118e39b573cSmrg for cf_desktop_dir in \ 3119e39b573cSmrg /usr/share/app-install \ 3120e39b573cSmrg /usr/share/applications 3121e39b573cSmrg do 3122e39b573cSmrg if test -d $cf_desktop_dir 3123e39b573cSmrg then 3124e39b573cSmrg find $cf_desktop_dir -name '*.desktop' | \ 3125e39b573cSmrg while true 3126e39b573cSmrg do 3127e39b573cSmrg read cf_desktop_path 3128e39b573cSmrg test -z "$cf_desktop_path" && break 3129e39b573cSmrg cf_desktop_name=`basename $cf_desktop_path .desktop` 3130e39b573cSmrg case $cf_desktop_name in #(vi 3131e39b573cSmrg $1|*-$1|$2) 3132e39b573cSmrg CF_VERBOSE(inspect $cf_desktop_path) 3133e39b573cSmrg egrep '^Categories=' $cf_desktop_path | \ 3134e39b573cSmrg tr ';' '\n' | \ 3135e39b573cSmrg sed -e 's%^.*=%%' -e '/^$/d' >>conftest.1 3136e39b573cSmrg ;; 3137e39b573cSmrg esac 3138e39b573cSmrg done 3139e39b573cSmrg fi 3140e39b573cSmrg done 3141e39b573cSmrg if test -s conftest.1 3142e39b573cSmrg then 3143e39b573cSmrg cf_desktop_last= 3144e39b573cSmrg sort conftest.1 | \ 3145e39b573cSmrg while true 3146e39b573cSmrg do 3147e39b573cSmrg read cf_desktop_this 3148e39b573cSmrg test -z "$cf_desktop_this" && break 3149e39b573cSmrg case $cf_desktop_this in #(vi 3150e39b573cSmrg Qt*|GTK*|KDE*|GNOME*|*XFCE*|*Xfce*) #(vi 3151e39b573cSmrg ;; 3152e39b573cSmrg $3) 3153e39b573cSmrg test "x$cf_desktop_last" != "x$cf_desktop_this" && echo $cf_desktop_this >>conftest.2 3154e39b573cSmrg ;; 3155e39b573cSmrg esac 3156e39b573cSmrg cf_desktop_last=$cf_desktop_this 3157e39b573cSmrg done 3158e39b573cSmrg cf_desktop_want=`cat conftest.2 | tr '\n' ';'` 3159e39b573cSmrg fi 31600bd37d32Smrg if test -n "$cf_desktop_want" 31610bd37d32Smrg then 31620bd37d32Smrg if test "$cf_desktop_want" = auto 31630bd37d32Smrg then 31640bd37d32Smrg cf_desktop_want= 31650bd37d32Smrg else 31660bd37d32Smrg # do a sanity check on the semicolon-separated list, ignore on failure 31670bd37d32Smrg cf_desktop_test=`echo "$cf_desktop_want" | sed -e 's/[[^;]]//g'` 31680bd37d32Smrg test -z "$cf_desktop_test" && cf_desktop_want= 31690bd37d32Smrg cf_desktop_test=`echo "$cf_desktop_want" | sed -e 's/^.*;$/./g'` 31700bd37d32Smrg test -z "$cf_desktop_test" && cf_desktop_want= 31710bd37d32Smrg fi 31720bd37d32Smrg fi 31730bd37d32Smrg if test -z "$cf_desktop_want" 31740bd37d32Smrg then 31750bd37d32Smrg cf_desktop_want="ifelse([$4],,ifelse([$3],,[Application;],[`echo "$3" | sed -e 's/\*//g' -e 's/|/;/g' -e 's/[[;]]*$/;/g'`]),[$4])" 31760bd37d32Smrg CF_VERBOSE(no usable value found for desktop category, using $cf_desktop_want) 31770bd37d32Smrg fi 3178e39b573cSmrg fi 3179e39b573cSmrg DESKTOP_CATEGORY=`echo "$cf_desktop_want" | sed -e 's/[[ ,]]/;/g'` 31800bd37d32Smrg CF_VERBOSE(will use Categories=$DESKTOP_CATEGORY) 3181e39b573cSmrg AC_SUBST(DESKTOP_CATEGORY) 3182e39b573cSmrgfi 3183e39b573cSmrg]) 3184e39b573cSmrgdnl --------------------------------------------------------------------------- 31850bd37d32Smrgdnl CF_WITH_DMALLOC version: 7 updated: 2010/06/21 17:26:47 3186e39b573cSmrgdnl --------------- 31870bd37d32Smrgdnl Configure-option for dmalloc. The optional parameter is used to override 31880bd37d32Smrgdnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests. 31890bd37d32SmrgAC_DEFUN([CF_WITH_DMALLOC],[ 31900bd37d32SmrgCF_NO_LEAKS_OPTION(dmalloc, 31910bd37d32Smrg [ --with-dmalloc test: use Gray Watson's dmalloc library], 31920bd37d32Smrg [USE_DMALLOC]) 31930bd37d32Smrg 31940bd37d32Smrgif test "$with_dmalloc" = yes ; then 31950bd37d32Smrg AC_CHECK_HEADER(dmalloc.h, 31960bd37d32Smrg [AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse([$1],,[],[,$1]))]) 31970bd37d32Smrgfi 31980bd37d32Smrg])dnl 31990bd37d32Smrgdnl --------------------------------------------------------------------------- 32000bd37d32Smrgdnl CF_WITH_ICONDIR version: 5 updated: 2012/07/22 09:18:02 32010bd37d32Smrgdnl --------------- 32020bd37d32Smrgdnl Handle configure option "--with-icondir", setting these shell variables: 32030bd37d32Smrgdnl 32040bd37d32Smrgdnl $ICONDIR is the option value, used for installing icon files. 3205e39b573cSmrgdnl $no_icondir is a "#" (comment) if "--without-icondir" is given. 3206e39b573cSmrgAC_DEFUN([CF_WITH_ICONDIR],[ 3207e39b573cSmrgAC_MSG_CHECKING(for directory to install icons) 32080bd37d32SmrgAC_ARG_WITH(icondir, 32090bd37d32Smrg [ --with-icondir=DIR directory in which to install icons for desktop], 32100bd37d32Smrg [ICONDIR=$withval], 32110bd37d32Smrg [test -z "$ICONDIR" && ICONDIR=no]) 32120bd37d32Smrg 32130bd37d32Smrgif test "x[$]ICONDIR" = xauto 32140bd37d32Smrgthen 32150bd37d32Smrg ICONDIR='${datadir}/icons' 32160bd37d32Smrg for cf_path in \ 32170bd37d32Smrg /usr/share/icons \ 32180bd37d32Smrg /usr/X11R6/share/icons 32190bd37d32Smrg do 32200bd37d32Smrg if test -d "$cf_path" ; then 32210bd37d32Smrg ICONDIR="$cf_path" 32220bd37d32Smrg break 32230bd37d32Smrg fi 32240bd37d32Smrg done 32250bd37d32Smrgelse 32260bd37d32Smrg cf_path=$ICONDIR 32270bd37d32Smrg CF_PATH_SYNTAX(cf_path) 32280bd37d32Smrgfi 32290bd37d32SmrgAC_MSG_RESULT($ICONDIR) 32300bd37d32SmrgAC_SUBST(ICONDIR) 3231e39b573cSmrg 3232e39b573cSmrgno_icondir= 32330bd37d32Smrgif test "$ICONDIR" = no 32340bd37d32Smrgthen 32350bd37d32Smrg no_icondir="#" 32360bd37d32Smrgelse 32370bd37d32Smrg EXTRA_INSTALL_DIRS="$EXTRA_INSTALL_DIRS \$(ICONDIR)" 32380bd37d32Smrgfi 3239e39b573cSmrgAC_SUBST(no_icondir) 3240e39b573cSmrg])dnl 3241e39b573cSmrgdnl --------------------------------------------------------------------------- 32420bd37d32Smrgdnl CF_WITH_ICON_NAME version: 2 updated: 2013/05/27 18:34:42 32430bd37d32Smrgdnl ----------------- 32440bd37d32Smrgdnl Allow a default icon-name to be overridden. 32450bd37d32Smrgdnl $1 = default icon name 32460bd37d32SmrgAC_DEFUN([CF_WITH_ICON_NAME],[ 32470bd37d32SmrgAC_MSG_CHECKING(for the icon name) 32480bd37d32SmrgAC_ARG_WITH(icon-name, 32490bd37d32Smrg [ --with-icon-name=XXXX override icon name (default: $1)], 32500bd37d32Smrg [ICON_NAME="$withval"], 32510bd37d32Smrg [ICON_NAME=$1]) 32520bd37d32Smrgcase "x$ICON_NAME" in 32530bd37d32Smrgxyes|xno|x) 32540bd37d32Smrg ICON_NAME=$1 32550bd37d32Smrg ;; 32560bd37d32Smrgesac 32570bd37d32SmrgAC_SUBST(ICON_NAME) 32580bd37d32SmrgAC_MSG_RESULT($ICON_NAME) 32590bd37d32Smrg])dnl 32600bd37d32Smrgdnl --------------------------------------------------------------------------- 32610bd37d32Smrgdnl CF_WITH_ICON_SYMLINK version: 1 updated: 2013/05/27 18:34:42 32620bd37d32Smrgdnl -------------------- 32630bd37d32Smrgdnl Workaround for systems which are (mis)configured to map all icon references 32640bd37d32Smrgdnl for xterm into "xterm" name. For instance, recent (2013) KDE ignores both 32650bd37d32Smrgdnl the name given in the .desktop file (xterm-color) and the application name 32660bd37d32Smrgdnl (xterm-dev). 32670bd37d32Smrgdnl 32680bd37d32Smrgdnl $1 = default icon name to use if symlink is wanted 32690bd37d32SmrgAC_DEFUN([CF_WITH_ICON_SYMLINK],[ 32700bd37d32SmrgAC_MSG_CHECKING(for icon symlink to use) 32710bd37d32SmrgAC_ARG_WITH(icon-symlink, 32720bd37d32Smrg [ --with-icon-symlink=XXX make symbolic link for icon name (default: $1)], 32730bd37d32Smrg [ICON_SYMLINK="$withval"], 32740bd37d32Smrg [ICON_SYMLINK=NONE]) 32750bd37d32Smrgcase "x$ICON_SYMLINK" in 32760bd37d32Smrgxyes) 32770bd37d32Smrg ICON_SYMLINK=$1 32780bd37d32Smrg ;; 32790bd37d32Smrgxno|x) 32800bd37d32Smrg ICON_SYMLINK=NONE 32810bd37d32Smrg ;; 32820bd37d32Smrgesac 32830bd37d32SmrgAC_SUBST(ICON_SYMLINK) 32840bd37d32SmrgAC_MSG_RESULT($ICON_SYMLINK) 32850bd37d32Smrg])dnl 32860bd37d32Smrgdnl --------------------------------------------------------------------------- 32870bd37d32Smrgdnl CF_WITH_ICON_THEME version: 9 updated: 2013/04/17 05:31:24 32880bd37d32Smrgdnl ------------------ 32890bd37d32Smrgdnl If asked, check for prerequisites and setup symbols to permit installing 32900bd37d32Smrgdnl one or more application icons in the Red Hat icon-theme directory 32910bd37d32Smrgdnl hierarchy. 32920bd37d32Smrgdnl 32930bd37d32Smrgdnl If the prerequisites are missing, give a warning and revert to the long- 32940bd37d32Smrgdnl standing pixmaps directory. 32950bd37d32Smrgdnl 32960bd37d32Smrgdnl Parameters: 32970bd37d32Smrgdnl 32980bd37d32Smrgdnl $1 = application icon. This can be a list, and is not optional. 32990bd37d32Smrgdnl $2 = default theme (defaults to hicolor) 33000bd37d32Smrgdnl $3 = formats (defaults to list [.svg .png .xpm]) 33010bd37d32Smrgdnl $4 = alternate icon if no theme is used (defaults to $1). 33020bd37d32Smrgdnl 33030bd37d32Smrgdnl Result: 33040bd37d32Smrgdnl ICON_NAME = basename of first item in $1 33050bd37d32Smrgdnl ICON_LIST = reprocessed $1 33060bd37d32Smrgdnl ICON_THEME = reprocessed $2 33070bd37d32Smrgdnl ICON_FORMAT = reprocessed $3 33080bd37d32SmrgAC_DEFUN([CF_WITH_ICON_THEME], 33090bd37d32Smrg[ 33100bd37d32Smrgifelse([$1],,[ 33110bd37d32Smrg AC_MSG_ERROR([macro [CF_WITH_ICON_THEME] requires application-icon name]) 33120bd37d32Smrg],[ 33130bd37d32Smrg 33140bd37d32SmrgCF_WITH_PIXMAPDIR 33150bd37d32SmrgCF_WITH_ICONDIR 33160bd37d32Smrg 33170bd37d32SmrgAC_MSG_CHECKING(if icon theme should be used) 33180bd37d32SmrgAC_ARG_WITH(icon-theme, 33190bd37d32Smrg [ --with-icon-theme=XXX install icons into desktop theme (hicolor)], 33200bd37d32Smrg [ICON_THEME=$withval], 33210bd37d32Smrg [ICON_THEME=no]) 33220bd37d32Smrg 33230bd37d32Smrgcase "x$ICON_THEME" in #(vi 33240bd37d32Smrgxno) #(vi 33250bd37d32Smrg ;; 33260bd37d32Smrgx|xyes) 33270bd37d32Smrg ICON_THEME=ifelse([$2],,hicolor,$2) 33280bd37d32Smrg ;; 33290bd37d32Smrgesac 33300bd37d32SmrgAC_MSG_RESULT($ICON_THEME) 33310bd37d32Smrg 33320bd37d32Smrgif test "x$ICON_THEME" = xno 33330bd37d32Smrgthen 33340bd37d32Smrg if test "x$ICONDIR" != xno 33350bd37d32Smrg then 33360bd37d32Smrg CF_VERBOSE(ignoring icondir without theme) 33370bd37d32Smrg no_icondir="#" 33380bd37d32Smrg fi 33390bd37d32Smrgelse 33400bd37d32Smrg if test "x$ICONDIR" = xno 33410bd37d32Smrg then 33420bd37d32Smrg AC_MSG_ERROR(icondir must be set for icon theme) 33430bd37d32Smrg fi 33440bd37d32Smrgfi 33450bd37d32Smrg 33460bd37d32Smrg: ${ICON_FORMAT:=ifelse([$3],,[".svg .png .xpm"],[$3])} 33470bd37d32Smrg 33480bd37d32Smrg# ICON_NAME= 33490bd37d32SmrgICON_LIST= 33500bd37d32Smrg 33510bd37d32Smrgifelse([$4],,[cf_icon_list=$1],[ 33520bd37d32Smrgif test "x$ICON_THEME" != xno 33530bd37d32Smrgthen 33540bd37d32Smrg cf_icon_list="$1" 33550bd37d32Smrgelse 33560bd37d32Smrg cf_icon_list="$4" 33570bd37d32Smrgfi 33580bd37d32Smrg]) 33590bd37d32Smrg 33600bd37d32SmrgAC_MSG_CHECKING([for icon(s) to install]) 33610bd37d32Smrgfor cf_name in $cf_icon_list 33620bd37d32Smrgdo 33630bd37d32Smrg CF_VERBOSE(using $ICON_FORMAT) 33640bd37d32Smrg for cf_suffix in $ICON_FORMAT 33650bd37d32Smrg do 33660bd37d32Smrg cf_icon="${cf_name}${cf_suffix}" 33670bd37d32Smrg cf_left=`echo "$cf_icon" | sed -e 's/:.*//'` 33680bd37d32Smrg if test ! -f "${cf_left}" 33690bd37d32Smrg then 33700bd37d32Smrg if test "x$srcdir" != "x." 33710bd37d32Smrg then 33720bd37d32Smrg cf_icon="${srcdir}/${cf_left}" 33730bd37d32Smrg cf_left=`echo "$cf_icon" | sed -e 's/:.*//'` 33740bd37d32Smrg if test ! -f "${cf_left}" 33750bd37d32Smrg then 33760bd37d32Smrg continue 33770bd37d32Smrg fi 33780bd37d32Smrg else 33790bd37d32Smrg continue 33800bd37d32Smrg fi 33810bd37d32Smrg fi 33820bd37d32Smrg if test "x$ICON_THEME" != xno 33830bd37d32Smrg then 33840bd37d32Smrg cf_base=`basename $cf_left` 33850bd37d32Smrg cf_trim=`echo "$cf_base" | sed -e 's/_[[0-9]][[0-9]]x[[0-9]][[0-9]]\././'` 33860bd37d32Smrg case "x${cf_base}" in #(vi 33870bd37d32Smrg *:*) #(vi 33880bd37d32Smrg cf_next=$cf_base 33890bd37d32Smrg # user-defined mapping 33900bd37d32Smrg ;; 33910bd37d32Smrg *.png) #(vi 33920bd37d32Smrg cf_size=`file "$cf_left"|sed -e 's/^[[^:]]*://' -e 's/^.*[[^0-9]]\([[0-9]][[0-9]]* x [[0-9]][[0-9]]*\)[[^0-9]].*$/\1/' -e 's/ //g'` 33930bd37d32Smrg if test -z "$cf_size" 33940bd37d32Smrg then 33950bd37d32Smrg AC_MSG_WARN(cannot determine size of $cf_left) 33960bd37d32Smrg continue 33970bd37d32Smrg fi 33980bd37d32Smrg cf_next="$cf_size/apps/$cf_trim" 33990bd37d32Smrg ;; 34000bd37d32Smrg *.svg) #(vi 34010bd37d32Smrg cf_next="scalable/apps/$cf_trim" 34020bd37d32Smrg ;; 34030bd37d32Smrg *.xpm) 34040bd37d32Smrg CF_VERBOSE(ignored XPM file in icon theme) 34050bd37d32Smrg continue 34060bd37d32Smrg ;; 34070bd37d32Smrg *_[[0-9]][[0-9]]*x[[0-9]][[0-9]]*.*) #(vi 34080bd37d32Smrg cf_size=`echo "$cf_left"|sed -e 's/^.*_\([[0-9]][[0-9]]*x[[0-9]][[0-9]]*\)\..*$/\1/'` 34090bd37d32Smrg cf_left=`echo "$cf_left"|sed -e 's/^\(.*\)_\([[0-9]][[0-9]]*x[[0-9]][[0-9]]*\)\(\..*\)$/\1\3/'` 34100bd37d32Smrg cf_next="$cf_size/apps/$cf_base" 34110bd37d32Smrg ;; 34120bd37d32Smrg esac 34130bd37d32Smrg CF_VERBOSE(adding $cf_next) 34140bd37d32Smrg cf_icon="${cf_icon}:${cf_next}" 34150bd37d32Smrg fi 34160bd37d32Smrg test -n "$ICON_LIST" && ICON_LIST="$ICON_LIST " 34170bd37d32Smrg ICON_LIST="$ICON_LIST${cf_icon}" 34180bd37d32Smrg if test -z "$ICON_NAME" 34190bd37d32Smrg then 34200bd37d32Smrg ICON_NAME=`basename $cf_icon | sed -e 's/[[.:]].*//'` 34210bd37d32Smrg fi 34220bd37d32Smrg done 34230bd37d32Smrgdone 34240bd37d32Smrg 34250bd37d32Smrgif test -n "$verbose" 34260bd37d32Smrgthen 34270bd37d32Smrg AC_MSG_CHECKING(result) 34280bd37d32Smrgfi 34290bd37d32SmrgAC_MSG_RESULT($ICON_LIST) 34300bd37d32Smrg 34310bd37d32Smrgif test -z "$ICON_LIST" 34320bd37d32Smrgthen 34330bd37d32Smrg AC_MSG_ERROR(no icons found) 34340bd37d32Smrgfi 34350bd37d32Smrg]) 34360bd37d32Smrg 34370bd37d32SmrgAC_MSG_CHECKING(for icon name) 34380bd37d32SmrgAC_MSG_RESULT($ICON_NAME) 34390bd37d32Smrg 34400bd37d32SmrgAC_SUBST(ICON_FORMAT) 34410bd37d32SmrgAC_SUBST(ICON_THEME) 34420bd37d32SmrgAC_SUBST(ICON_LIST) 34430bd37d32SmrgAC_SUBST(ICON_NAME) 34440bd37d32Smrg])dnl 34450bd37d32Smrgdnl --------------------------------------------------------------------------- 344620d2c4d2Smrgdnl CF_WITH_IMAKE_CFLAGS version: 9 updated: 2010/05/26 05:38:42 3447d522f475Smrgdnl -------------------- 3448d522f475Smrgdnl xterm and similar programs build more readily when propped up with imake's 3449d522f475Smrgdnl hand-tuned definitions. If we do not use imake, provide fallbacks for the 3450d522f475Smrgdnl most common definitions that we're not likely to do by autoconf tests. 3451d522f475SmrgAC_DEFUN([CF_WITH_IMAKE_CFLAGS],[ 3452d522f475SmrgAC_REQUIRE([CF_ENABLE_NARROWPROTO]) 3453d522f475Smrg 3454d522f475SmrgAC_MSG_CHECKING(if we should use imake to help) 3455d522f475SmrgCF_ARG_DISABLE(imake, 3456d522f475Smrg [ --disable-imake disable use of imake for definitions], 3457d522f475Smrg [enable_imake=no], 3458d522f475Smrg [enable_imake=yes]) 3459d522f475SmrgAC_MSG_RESULT($enable_imake) 3460d522f475Smrg 3461d522f475Smrgif test "$enable_imake" = yes ; then 346220d2c4d2Smrg CF_IMAKE_CFLAGS(ifelse([$1],,,[$1])) 3463d522f475Smrgfi 3464d522f475Smrg 3465d522f475Smrgif test -n "$IMAKE" && test -n "$IMAKE_CFLAGS" ; then 3466d522f475Smrg CF_ADD_CFLAGS($IMAKE_CFLAGS) 3467d522f475Smrgelse 3468d522f475Smrg IMAKE_CFLAGS= 3469d522f475Smrg IMAKE_LOADFLAGS= 3470d522f475Smrg CF_VERBOSE(make fallback definitions) 3471d522f475Smrg 3472d522f475Smrg # We prefer config.guess' values when we can get them, to avoid 3473d522f475Smrg # inconsistent results with uname (AIX for instance). However, 3474d522f475Smrg # config.guess is not always consistent either. 3475d522f475Smrg case $host_os in 3476d522f475Smrg *[[0-9]].[[0-9]]*) 3477d522f475Smrg UNAME_RELEASE="$host_os" 3478d522f475Smrg ;; 3479d522f475Smrg *) 3480d522f475Smrg UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown 3481d522f475Smrg ;; 3482d522f475Smrg esac 3483d522f475Smrg 3484d522f475Smrg case .$UNAME_RELEASE in 3485d522f475Smrg *[[0-9]].[[0-9]]*) 3486d522f475Smrg OSMAJORVERSION=`echo "$UNAME_RELEASE" |sed -e 's/^[[^0-9]]*//' -e 's/\..*//'` 3487d522f475Smrg OSMINORVERSION=`echo "$UNAME_RELEASE" |sed -e 's/^[[^0-9]]*//' -e 's/^[[^.]]*\.//' -e 's/\..*//' -e 's/[[^0-9]].*//' ` 3488d522f475Smrg test -z "$OSMAJORVERSION" && OSMAJORVERSION=1 3489d522f475Smrg test -z "$OSMINORVERSION" && OSMINORVERSION=0 3490d522f475Smrg IMAKE_CFLAGS="-DOSMAJORVERSION=$OSMAJORVERSION -DOSMINORVERSION=$OSMINORVERSION $IMAKE_CFLAGS" 3491d522f475Smrg ;; 3492d522f475Smrg esac 3493d522f475Smrg 3494d522f475Smrg # FUNCPROTO is standard with X11R6, but XFree86 drops it, leaving some 3495d522f475Smrg # fallback/fragments for NeedPrototypes, etc. 3496d522f475Smrg IMAKE_CFLAGS="-DFUNCPROTO=15 $IMAKE_CFLAGS" 3497d522f475Smrg 3498d522f475Smrg # If this is not set properly, Xaw's scrollbars will not work 3499d522f475Smrg if test "$enable_narrowproto" = yes ; then 3500d522f475Smrg IMAKE_CFLAGS="-DNARROWPROTO=1 $IMAKE_CFLAGS" 3501d522f475Smrg fi 3502d522f475Smrg 3503d522f475Smrg # Other special definitions: 3504d522f475Smrg case $host_os in 3505d522f475Smrg aix*) 3506d522f475Smrg # imake on AIX 5.1 defines AIXV3. really. 3507d522f475Smrg IMAKE_CFLAGS="-DAIXV3 -DAIXV4 $IMAKE_CFLAGS" 3508d522f475Smrg ;; 3509d522f475Smrg irix[[56]].*) #(vi 3510d522f475Smrg # these are needed to make SIGWINCH work in xterm 3511d522f475Smrg IMAKE_CFLAGS="-DSYSV -DSVR4 $IMAKE_CFLAGS" 3512d522f475Smrg ;; 3513d522f475Smrg esac 3514d522f475Smrg 3515d522f475Smrg CF_ADD_CFLAGS($IMAKE_CFLAGS) 3516d522f475Smrg 3517d522f475Smrg AC_SUBST(IMAKE_CFLAGS) 3518d522f475Smrg AC_SUBST(IMAKE_LOADFLAGS) 3519d522f475Smrgfi 3520d522f475Smrg])dnl 3521d522f475Smrgdnl --------------------------------------------------------------------------- 35220bd37d32Smrgdnl CF_WITH_PCRE version: 10 updated: 2012/10/04 20:12:20 3523d522f475Smrgdnl ------------ 3524d522f475Smrgdnl Add PCRE (Perl-compatible regular expressions) to the build if it is 3525d522f475Smrgdnl available and the user requests it. Assume the application will otherwise 3526d522f475Smrgdnl use the POSIX interface. 3527d522f475Smrgdnl 3528d522f475Smrgdnl TODO allow $withval to specify package location 3529d522f475SmrgAC_DEFUN([CF_WITH_PCRE], 3530d522f475Smrg[ 353120d2c4d2SmrgAC_REQUIRE([CF_PKG_CONFIG]) 353220d2c4d2Smrg 3533d522f475SmrgAC_MSG_CHECKING(if you want to use PCRE for regular-expressions) 3534d522f475SmrgAC_ARG_WITH(pcre, 3535d522f475Smrg [ --with-pcre use PCRE for regular-expressions]) 3536d522f475Smrgtest -z "$with_pcre" && with_pcre=no 3537d522f475SmrgAC_MSG_RESULT($with_pcre) 3538d522f475Smrg 3539d522f475Smrgif test "$with_pcre" != no ; then 354020d2c4d2Smrg CF_TRY_PKG_CONFIG(libpcre,,[ 354120d2c4d2Smrg AC_CHECK_LIB(pcre,pcre_compile,, 354220d2c4d2Smrg AC_MSG_ERROR(Cannot find PCRE library))]) 354320d2c4d2Smrg 35440bd37d32Smrg AC_DEFINE(HAVE_LIB_PCRE,1,[Define to 1 if we can/should compile with the PCRE library]) 354520d2c4d2Smrg 354620d2c4d2Smrg case $LIBS in #(vi 354720d2c4d2Smrg *pcreposix*) #(vi 354820d2c4d2Smrg ;; 354920d2c4d2Smrg *) 355020d2c4d2Smrg AC_CHECK_LIB(pcreposix,pcreposix_regcomp, 35510bd37d32Smrg [AC_DEFINE(HAVE_PCREPOSIX_H,1,[Define to 1 if we should include pcreposix.h]) 355220d2c4d2Smrg CF_ADD_LIB(pcreposix)], 355320d2c4d2Smrg [AC_CHECK_LIB(pcreposix,regcomp,[ 35540bd37d32Smrg AC_DEFINE(HAVE_PCREPOSIX_H,1,[Define to 1 if we should include pcreposix.h]) 355520d2c4d2Smrg CF_ADD_LIB(pcreposix)], 355620d2c4d2Smrg AC_MSG_ERROR(Cannot find PCRE POSIX library)])) 355720d2c4d2Smrg ;; 355820d2c4d2Smrg esac 3559d522f475Smrgfi 3560d522f475Smrg])dnl 3561d522f475Smrgdnl --------------------------------------------------------------------------- 35620bd37d32Smrgdnl CF_WITH_PIXMAPDIR version: 3 updated: 2012/07/22 09:18:02 35630bd37d32Smrgdnl ----------------- 35640bd37d32Smrgdnl Handle configure option "--with-pixmapdir", setting these shell variables: 35650bd37d32Smrgdnl 35660bd37d32Smrgdnl $PIXMAPDIR is the option value, used for installing pixmap files. 35670bd37d32Smrgdnl $no_pixmapdir is a "#" (comment) if "--without-pixmapdir" is given. 35680bd37d32SmrgAC_DEFUN([CF_WITH_PIXMAPDIR],[ 35690bd37d32SmrgAC_MSG_CHECKING(for directory to install pixmaps) 35700bd37d32SmrgAC_ARG_WITH(pixmapdir, 35710bd37d32Smrg [ --with-pixmapdir=DIR directory in which to install pixmaps (DATADIR/pixmaps)], 35720bd37d32Smrg [PIXMAPDIR=$withval], 35730bd37d32Smrg [test -z "$PIXMAPDIR" && PIXMAPDIR='${datadir}/pixmaps']) 35740bd37d32Smrg 35750bd37d32Smrgif test "x[$]PIXMAPDIR" = xauto 35760bd37d32Smrgthen 35770bd37d32Smrg PIXMAPDIR='${datadir}/pixmaps' 35780bd37d32Smrg for cf_path in \ 35790bd37d32Smrg /usr/share/pixmaps \ 35800bd37d32Smrg /usr/X11R6/share/pixmaps 35810bd37d32Smrg do 35820bd37d32Smrg if test -d "$cf_path" ; then 35830bd37d32Smrg PIXMAPDIR="$cf_path" 35840bd37d32Smrg break 35850bd37d32Smrg fi 35860bd37d32Smrg done 35870bd37d32Smrgelse 35880bd37d32Smrg cf_path=$PIXMAPDIR 35890bd37d32Smrg CF_PATH_SYNTAX(cf_path) 35900bd37d32Smrgfi 35910bd37d32SmrgAC_MSG_RESULT($PIXMAPDIR) 35920bd37d32SmrgAC_SUBST(PIXMAPDIR) 35930bd37d32Smrg 35940bd37d32Smrgno_pixmapdir= 35950bd37d32Smrgif test "$PIXMAPDIR" = no 35960bd37d32Smrgthen 35970bd37d32Smrg no_pixmapdir="#" 35980bd37d32Smrgelse 35990bd37d32Smrg EXTRA_INSTALL_DIRS="$EXTRA_INSTALL_DIRS \$(PIXMAPDIR)" 36000bd37d32Smrgfi 36010bd37d32SmrgAC_SUBST(no_pixmapdir) 36020bd37d32Smrg])dnl 36030bd37d32Smrgdnl --------------------------------------------------------------------------- 36040bd37d32Smrgdnl CF_WITH_VALGRIND version: 1 updated: 2006/12/14 18:00:21 36050bd37d32Smrgdnl ---------------- 36060bd37d32SmrgAC_DEFUN([CF_WITH_VALGRIND],[ 36070bd37d32SmrgCF_NO_LEAKS_OPTION(valgrind, 36080bd37d32Smrg [ --with-valgrind test: use valgrind], 36090bd37d32Smrg [USE_VALGRIND]) 36100bd37d32Smrg])dnl 36110bd37d32Smrgdnl --------------------------------------------------------------------------- 36120bd37d32Smrgdnl CF_WITH_XPM version: 3 updated: 2012/10/04 06:57:36 36130bd37d32Smrgdnl ----------- 36140bd37d32Smrgdnl Test for Xpm library, update compiler/loader flags if it is wanted and 36150bd37d32Smrgdnl found. 36160bd37d32Smrgdnl 36170bd37d32Smrgdnl Also sets ICON_SUFFIX 36180bd37d32SmrgAC_DEFUN([CF_WITH_XPM], 36190bd37d32Smrg[ 36200bd37d32SmrgICON_SUFFIX=.xbm 36210bd37d32Smrg 36220bd37d32Smrgcf_save_cppflags="${CPPFLAGS}" 36230bd37d32Smrgcf_save_ldflags="${LDFLAGS}" 36240bd37d32Smrg 36250bd37d32SmrgAC_MSG_CHECKING(if you want to use the Xpm library for colored icon) 36260bd37d32SmrgAC_ARG_WITH(xpm, 36270bd37d32Smrg[ --with-xpm=DIR use Xpm library for colored icon, may specify path], 36280bd37d32Smrg [cf_Xpm_library="$withval"], 36290bd37d32Smrg [cf_Xpm_library=yes]) 36300bd37d32SmrgAC_MSG_RESULT($cf_Xpm_library) 36310bd37d32Smrg 36320bd37d32Smrgif test "$cf_Xpm_library" != no ; then 36330bd37d32Smrg if test "$cf_Xpm_library" != yes ; then 36340bd37d32Smrg CPPFLAGS="$CPPFLAGS -I$withval/include" 36350bd37d32Smrg LDFLAGS="$LDFLAGS -L$withval/lib" 36360bd37d32Smrg fi 36370bd37d32Smrg AC_CHECK_HEADER(X11/xpm.h,[ 36380bd37d32Smrg AC_CHECK_LIB(Xpm, XpmCreatePixmapFromData,[ 36390bd37d32Smrg AC_DEFINE(HAVE_LIBXPM,1,[Define to 1 if we should use Xpm library]) 36400bd37d32Smrg ICON_SUFFIX=.xpm 36410bd37d32Smrg LIBS="-lXpm $LIBS"], 36420bd37d32Smrg [CPPFLAGS="${cf_save_cppflags}" LDFLAGS="${cf_save_ldflags}"], 36430bd37d32Smrg [-lX11 $X_LIBS])], 36440bd37d32Smrg [CPPFLAGS="${cf_save_cppflags}" LDFLAGS="${cf_save_ldflags}"]) 36450bd37d32Smrgfi 36460bd37d32Smrg 36470bd37d32SmrgAC_SUBST(ICON_SUFFIX) 36480bd37d32Smrg])dnl 36490bd37d32Smrgdnl --------------------------------------------------------------------------- 36500bd37d32Smrgdnl CF_XBOOL_RESULT version: 2 updated: 2012/10/04 06:57:36 36510bd37d32Smrgdnl --------------- 36520bd37d32Smrgdnl Translate an autoconf boolean yes/no into X11's booleans, e.g., True/False. 36530bd37d32Smrgdnl Allow for more than two values, e.g., "maybe", still using the same leading 36540bd37d32Smrgdnl capital convention. 36550bd37d32Smrgdnl 36560bd37d32Smrgdnl $1 = symbol to define 36570bd37d32Smrgdnl $2 = symbol holding value 36580bd37d32Smrgdnl $3 = description 36590bd37d32Smrgdefine([CF_XBOOL_RESULT],[ 36600bd37d32SmrgAC_MSG_RESULT([$]$2) 36610bd37d32Smrgcase [$]$2 in #(vi 36620bd37d32Smrgyes) #(vi 36630bd37d32Smrg $2=true 36640bd37d32Smrg ;; 36650bd37d32Smrgno) #(vi 36660bd37d32Smrg $2=false 36670bd37d32Smrg ;; 36680bd37d32Smrgesac 36690bd37d32Smrgcf_xbool1=`echo "[$]$2"|sed -e 's/^\(.\).*/\1/'` 36700bd37d32SmrgCF_UPPER(cf_xbool1,$cf_xbool1) 36710bd37d32Smrgcf_xbool2=`echo "[$]$2"|sed -e 's/^.//'` 36720bd37d32Smrg$2=${cf_xbool1}${cf_xbool2} 36730bd37d32SmrgAC_DEFINE_UNQUOTED($1,[$]$2,$3) 36740bd37d32SmrgAC_SUBST($2) 36750bd37d32Smrg]) 36760bd37d32Smrgdnl --------------------------------------------------------------------------- 36770bd37d32Smrgdnl CF_XKB_BELL_EXT version: 4 updated: 2012/10/04 20:12:20 3678d522f475Smrgdnl --------------- 3679d522f475Smrgdnl Check for XKB bell extension 3680d522f475SmrgAC_DEFUN([CF_XKB_BELL_EXT],[ 3681d522f475SmrgAC_CACHE_CHECK(for XKB Bell extension, cf_cv_xkb_bell_ext,[ 3682d522f475SmrgAC_TRY_LINK([ 3683956cc18dSsnj#include <X11/Intrinsic.h> 3684d522f475Smrg#include <X11/XKBlib.h> /* has the prototype */ 3685d522f475Smrg#include <X11/extensions/XKBbells.h> /* has the XkbBI_xxx definitions */ 3686d522f475Smrg],[ 3687956cc18dSsnj int x = (XkbBI_Info |XkbBI_MinorError |XkbBI_MajorError |XkbBI_TerminalBell |XkbBI_MarginBell); 3688956cc18dSsnj Atom y; 3689956cc18dSsnj XkbBell((Display *)0, (Widget)0, 0, y); 3690d522f475Smrg],[cf_cv_xkb_bell_ext=yes],[cf_cv_xkb_bell_ext=no]) 3691d522f475Smrg]) 36920bd37d32Smrgtest "$cf_cv_xkb_bell_ext" = yes && AC_DEFINE(HAVE_XKB_BELL_EXT,1,[Define 1 if we have XKB Bell extension]) 36930bd37d32Smrg]) 36940bd37d32Smrgdnl --------------------------------------------------------------------------- 36950bd37d32Smrgdnl CF_XKB_KEYCODE_TO_KEYSYM version: 2 updated: 2012/09/28 20:23:33 36960bd37d32Smrgdnl ------------------------ 36970bd37d32Smrgdnl Some older vendor-unix systems made a practice of delivering fragments of 36980bd37d32Smrgdnl Xkb, requiring test-compiles. 36990bd37d32SmrgAC_DEFUN([CF_XKB_KEYCODE_TO_KEYSYM],[ 37000bd37d32SmrgAC_CACHE_CHECK(if we can use XkbKeycodeToKeysym, cf_cv_xkb_keycode_to_keysym,[ 37010bd37d32SmrgAC_TRY_COMPILE([ 37020bd37d32Smrg#include <X11/Xlib.h> 37030bd37d32Smrg#include <X11/XKBlib.h> 37040bd37d32Smrg],[ 37050bd37d32Smrg KeySym keysym = XkbKeycodeToKeysym((Display *)0, 0, 0, 0); 37060bd37d32Smrg],[ 37070bd37d32Smrgcf_cv_xkb_keycode_to_keysym=yes 37080bd37d32Smrg],[ 37090bd37d32Smrgcf_cv_xkb_keycode_to_keysym=no 37100bd37d32Smrg]) 37110bd37d32Smrg]) 37120bd37d32Smrg 37130bd37d32Smrgif test $cf_cv_xkb_keycode_to_keysym = yes 37140bd37d32Smrgthen 37150bd37d32Smrg AC_CHECK_FUNCS(XkbKeycodeToKeysym) 37160bd37d32Smrgfi 37170bd37d32Smrg]) 37180bd37d32Smrgdnl --------------------------------------------------------------------------- 37190bd37d32Smrgdnl CF_XKB_QUERY_EXTENSION version: 2 updated: 2012/09/28 20:23:46 37200bd37d32Smrgdnl ---------------------- 37210bd37d32Smrgdnl see ifdef in scrollbar.c - iron out here 37220bd37d32SmrgAC_DEFUN([CF_XKB_QUERY_EXTENSION],[ 37230bd37d32SmrgAC_CACHE_CHECK(if we can use XkbQueryExtension, cf_cv_xkb_query_extension,[ 37240bd37d32SmrgAC_TRY_COMPILE([ 37250bd37d32Smrg#include <X11/Xlib.h> 37260bd37d32Smrg#include <X11/extensions/XKB.h> 37270bd37d32Smrg#include <X11/XKBlib.h> 37280bd37d32Smrg],[ 37290bd37d32Smrg int xkbmajor = XkbMajorVersion; 37300bd37d32Smrg int xkbminor = XkbMinorVersion; 37310bd37d32Smrg int xkbopcode, xkbevent, xkberror; 37320bd37d32Smrg 37330bd37d32Smrg if (XkbLibraryVersion(&xkbmajor, &xkbminor) 37340bd37d32Smrg && XkbQueryExtension((Display *)0, 37350bd37d32Smrg &xkbopcode, 37360bd37d32Smrg &xkbevent, 37370bd37d32Smrg &xkberror, 37380bd37d32Smrg &xkbmajor, 37390bd37d32Smrg &xkbminor)) 37400bd37d32Smrg return 0; 37410bd37d32Smrg],[ 37420bd37d32Smrgcf_cv_xkb_query_extension=yes 37430bd37d32Smrg],[ 37440bd37d32Smrgcf_cv_xkb_query_extension=no 37450bd37d32Smrg]) 37460bd37d32Smrg]) 37470bd37d32Smrg 37480bd37d32Smrgif test $cf_cv_xkb_query_extension = yes 37490bd37d32Smrgthen 37500bd37d32Smrg AC_CHECK_FUNCS(XkbQueryExtension) 37510bd37d32Smrgfi 3752d522f475Smrg]) 3753d522f475Smrgdnl --------------------------------------------------------------------------- 3754894e0ac8Smrgdnl CF_XOPEN_SOURCE version: 46 updated: 2014/02/09 19:30:15 3755d522f475Smrgdnl --------------- 3756d522f475Smrgdnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions, 3757d522f475Smrgdnl or adapt to the vendor's definitions to get equivalent functionality, 3758d522f475Smrgdnl without losing the common non-POSIX features. 3759d522f475Smrgdnl 3760d522f475Smrgdnl Parameters: 3761d522f475Smrgdnl $1 is the nominal value for _XOPEN_SOURCE 3762d522f475Smrgdnl $2 is the nominal value for _POSIX_C_SOURCE 3763d522f475SmrgAC_DEFUN([CF_XOPEN_SOURCE],[ 37640bd37d32SmrgAC_REQUIRE([AC_CANONICAL_HOST]) 3765d522f475Smrg 376620d2c4d2Smrgcf_XOPEN_SOURCE=ifelse([$1],,500,[$1]) 376720d2c4d2Smrgcf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2]) 376820d2c4d2Smrgcf_xopen_source= 3769d522f475Smrg 3770d522f475Smrgcase $host_os in #(vi 3771e39b573cSmrgaix[[4-7]]*) #(vi 377220d2c4d2Smrg cf_xopen_source="-D_ALL_SOURCE" 377320d2c4d2Smrg ;; 3774e0a2b6dfSmrgcygwin|msys) #(vi 3775e39b573cSmrg cf_XOPEN_SOURCE=600 3776e39b573cSmrg ;; 377720d2c4d2Smrgdarwin[[0-8]].*) #(vi 377820d2c4d2Smrg cf_xopen_source="-D_APPLE_C_SOURCE" 377920d2c4d2Smrg ;; 378020d2c4d2Smrgdarwin*) #(vi 378120d2c4d2Smrg cf_xopen_source="-D_DARWIN_C_SOURCE" 37820bd37d32Smrg cf_XOPEN_SOURCE= 3783d522f475Smrg ;; 37842eaa94a1Schristosfreebsd*|dragonfly*) #(vi 3785d522f475Smrg # 5.x headers associate 3786d522f475Smrg # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L 3787d522f475Smrg # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L 3788d522f475Smrg cf_POSIX_C_SOURCE=200112L 3789d522f475Smrg cf_XOPEN_SOURCE=600 379020d2c4d2Smrg cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" 379120d2c4d2Smrg ;; 379220d2c4d2Smrghpux11*) #(vi 379320d2c4d2Smrg cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500" 3794d522f475Smrg ;; 3795d522f475Smrghpux*) #(vi 379620d2c4d2Smrg cf_xopen_source="-D_HPUX_SOURCE" 3797d522f475Smrg ;; 3798d522f475Smrgirix[[56]].*) #(vi 379920d2c4d2Smrg cf_xopen_source="-D_SGI_SOURCE" 38000bd37d32Smrg cf_XOPEN_SOURCE= 3801d522f475Smrg ;; 38022eaa94a1Schristoslinux*|gnu*|mint*|k*bsd*-gnu) #(vi 3803d522f475Smrg CF_GNU_SOURCE 3804d522f475Smrg ;; 3805d522f475Smrgmirbsd*) #(vi 38060bd37d32Smrg # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <sys/select.h> and other headers which use u_int / u_short types 38070bd37d32Smrg cf_XOPEN_SOURCE= 38080bd37d32Smrg CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) 3809d522f475Smrg ;; 3810d522f475Smrgnetbsd*) #(vi 38110bd37d32Smrg cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw 38120bd37d32Smrg ;; 38130bd37d32Smrgopenbsd[[4-9]]*) #(vi 38140bd37d32Smrg # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw 38150bd37d32Smrg cf_xopen_source="-D_BSD_SOURCE" 38160bd37d32Smrg cf_XOPEN_SOURCE=600 3817d522f475Smrg ;; 3818d522f475Smrgopenbsd*) #(vi 3819d522f475Smrg # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw 3820d522f475Smrg ;; 3821d522f475Smrgosf[[45]]*) #(vi 382220d2c4d2Smrg cf_xopen_source="-D_OSF_SOURCE" 3823d522f475Smrg ;; 3824d522f475Smrgnto-qnx*) #(vi 382520d2c4d2Smrg cf_xopen_source="-D_QNX_SOURCE" 3826d522f475Smrg ;; 3827d522f475Smrgsco*) #(vi 3828d522f475Smrg # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer 3829d522f475Smrg ;; 38300bd37d32Smrgsolaris2.*) #(vi 383120d2c4d2Smrg cf_xopen_source="-D__EXTENSIONS__" 3832894e0ac8Smrg cf_cv_xopen_source=broken 3833d522f475Smrg ;; 3834d522f475Smrg*) 38350bd37d32Smrg CF_TRY_XOPEN_SOURCE 3836d522f475Smrg CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) 3837d522f475Smrg ;; 3838d522f475Smrgesac 383920d2c4d2Smrg 384020d2c4d2Smrgif test -n "$cf_xopen_source" ; then 384120d2c4d2Smrg CF_ADD_CFLAGS($cf_xopen_source) 384220d2c4d2Smrgfi 38430bd37d32Smrg 38440bd37d32Smrgdnl In anything but the default case, we may have system-specific setting 38450bd37d32Smrgdnl which is still not guaranteed to provide all of the entrypoints that 38460bd37d32Smrgdnl _XOPEN_SOURCE would yield. 38470bd37d32Smrgif test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then 38480bd37d32Smrg AC_MSG_CHECKING(if _XOPEN_SOURCE really is set) 38490bd37d32Smrg AC_TRY_COMPILE([#include <stdlib.h>],[ 38500bd37d32Smrg#ifndef _XOPEN_SOURCE 38510bd37d32Smrgmake an error 38520bd37d32Smrg#endif], 38530bd37d32Smrg [cf_XOPEN_SOURCE_set=yes], 38540bd37d32Smrg [cf_XOPEN_SOURCE_set=no]) 38550bd37d32Smrg AC_MSG_RESULT($cf_XOPEN_SOURCE_set) 38560bd37d32Smrg if test $cf_XOPEN_SOURCE_set = yes 38570bd37d32Smrg then 38580bd37d32Smrg AC_TRY_COMPILE([#include <stdlib.h>],[ 38590bd37d32Smrg#if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE 38600bd37d32Smrgmake an error 38610bd37d32Smrg#endif], 38620bd37d32Smrg [cf_XOPEN_SOURCE_set_ok=yes], 38630bd37d32Smrg [cf_XOPEN_SOURCE_set_ok=no]) 38640bd37d32Smrg if test $cf_XOPEN_SOURCE_set_ok = no 38650bd37d32Smrg then 38660bd37d32Smrg AC_MSG_WARN(_XOPEN_SOURCE is lower than requested) 38670bd37d32Smrg fi 38680bd37d32Smrg else 38690bd37d32Smrg CF_TRY_XOPEN_SOURCE 38700bd37d32Smrg fi 38710bd37d32Smrgfi 3872d522f475Smrg]) 3873d522f475Smrgdnl --------------------------------------------------------------------------- 3874e0a2b6dfSmrgdnl CF_X_ATHENA version: 21 updated: 2013/07/06 21:27:06 3875d522f475Smrgdnl ----------- 3876d522f475Smrgdnl Check for Xaw (Athena) libraries 3877d522f475Smrgdnl 3878d522f475Smrgdnl Sets $cf_x_athena according to the flavor of Xaw which is used. 3879d522f475SmrgAC_DEFUN([CF_X_ATHENA], 388020d2c4d2Smrg[ 38816879286fSmrgcf_x_athena=${cf_x_athena:-Xaw} 3882d522f475Smrg 3883d522f475SmrgAC_MSG_CHECKING(if you want to link with Xaw 3d library) 3884d522f475Smrgwithval= 3885d522f475SmrgAC_ARG_WITH(Xaw3d, 3886d522f475Smrg [ --with-Xaw3d link with Xaw 3d library]) 3887d522f475Smrgif test "$withval" = yes ; then 3888d522f475Smrg cf_x_athena=Xaw3d 3889d522f475Smrg AC_MSG_RESULT(yes) 3890d522f475Smrgelse 3891d522f475Smrg AC_MSG_RESULT(no) 3892d522f475Smrgfi 3893d522f475Smrg 3894d522f475SmrgAC_MSG_CHECKING(if you want to link with neXT Athena library) 3895d522f475Smrgwithval= 3896d522f475SmrgAC_ARG_WITH(neXtaw, 3897d522f475Smrg [ --with-neXtaw link with neXT Athena library]) 3898d522f475Smrgif test "$withval" = yes ; then 3899d522f475Smrg cf_x_athena=neXtaw 3900d522f475Smrg AC_MSG_RESULT(yes) 3901d522f475Smrgelse 3902d522f475Smrg AC_MSG_RESULT(no) 3903d522f475Smrgfi 3904d522f475Smrg 3905d522f475SmrgAC_MSG_CHECKING(if you want to link with Athena-Plus library) 3906d522f475Smrgwithval= 3907d522f475SmrgAC_ARG_WITH(XawPlus, 3908d522f475Smrg [ --with-XawPlus link with Athena-Plus library]) 3909d522f475Smrgif test "$withval" = yes ; then 3910d522f475Smrg cf_x_athena=XawPlus 3911d522f475Smrg AC_MSG_RESULT(yes) 3912d522f475Smrgelse 3913d522f475Smrg AC_MSG_RESULT(no) 3914d522f475Smrgfi 3915d522f475Smrg 3916d522f475Smrgcf_x_athena_lib="" 3917d522f475Smrg 391820d2c4d2Smrgif test "$PKG_CONFIG" != none ; then 391920d2c4d2Smrg cf_athena_list= 392020d2c4d2Smrg test "$cf_x_athena" = Xaw && cf_athena_list="xaw8 xaw7 xaw6" 392120d2c4d2Smrg for cf_athena_pkg in \ 392220d2c4d2Smrg $cf_athena_list \ 392320d2c4d2Smrg ${cf_x_athena} \ 392420d2c4d2Smrg ${cf_x_athena}-devel \ 392520d2c4d2Smrg lib${cf_x_athena} \ 392620d2c4d2Smrg lib${cf_x_athena}-devel 392720d2c4d2Smrg do 392820d2c4d2Smrg CF_TRY_PKG_CONFIG($cf_athena_pkg,[ 392920d2c4d2Smrg cf_x_athena_lib="$cf_pkgconfig_libs" 393020d2c4d2Smrg CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena) 393120d2c4d2Smrg AC_DEFINE_UNQUOTED($cf_x_athena_LIBS) 39326879286fSmrg 3933e0a2b6dfSmrg CF_TRIM_X_LIBS 3934e0a2b6dfSmrg 39356879286fSmrgAC_CACHE_CHECK(for usable $cf_x_athena/Xmu package,cf_cv_xaw_compat,[ 39366879286fSmrgAC_TRY_LINK([ 39376879286fSmrg#include <X11/Xmu/CharSet.h> 39386879286fSmrg],[ 39396879286fSmrgint check = XmuCompareISOLatin1("big", "small") 39406879286fSmrg],[cf_cv_xaw_compat=yes],[cf_cv_xaw_compat=no])]) 39416879286fSmrg 39426879286fSmrg if test "$cf_cv_xaw_compat" = no 39436879286fSmrg then 39446879286fSmrg # workaround for broken ".pc" files... 39456879286fSmrg case "$cf_x_athena_lib" in #(vi 39466879286fSmrg *-lXmu*) #(vi 39476879286fSmrg ;; 39486879286fSmrg *) 39496879286fSmrg CF_VERBOSE(work around broken package) 3950e0a2b6dfSmrg cf_save_xmu="$LIBS" 3951e0a2b6dfSmrg cf_first_lib=`echo "$cf_save_xmu" | sed -e 's/^[ ][ ]*//' -e 's/ .*//'` 3952e0a2b6dfSmrg CF_TRY_PKG_CONFIG(xmu,[ 3953e0a2b6dfSmrg LIBS="$cf_save_xmu" 3954e0a2b6dfSmrg CF_ADD_LIB_AFTER($cf_first_lib,$cf_pkgconfig_libs) 3955e0a2b6dfSmrg ],[ 3956e0a2b6dfSmrg CF_ADD_LIB_AFTER($cf_first_lib,-lXmu) 3957e0a2b6dfSmrg ]) 3958e0a2b6dfSmrg CF_TRIM_X_LIBS 39596879286fSmrg ;; 39606879286fSmrg esac 39616879286fSmrg fi 39626879286fSmrg 396320d2c4d2Smrg break]) 396420d2c4d2Smrg done 396520d2c4d2Smrgfi 396620d2c4d2Smrg 396720d2c4d2Smrgif test -z "$cf_x_athena_lib" ; then 396820d2c4d2Smrg CF_X_EXT 396920d2c4d2Smrg CF_X_TOOLKIT 397020d2c4d2Smrg CF_X_ATHENA_CPPFLAGS($cf_x_athena) 397120d2c4d2Smrg CF_X_ATHENA_LIBS($cf_x_athena) 397220d2c4d2Smrgfi 3973d522f475Smrg])dnl 3974d522f475Smrgdnl --------------------------------------------------------------------------- 397520d2c4d2Smrgdnl CF_X_ATHENA_CPPFLAGS version: 5 updated: 2010/05/26 17:35:30 3976d522f475Smrgdnl -------------------- 3977d522f475Smrgdnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of 3978d522f475Smrgdnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw. 3979d522f475SmrgAC_DEFUN([CF_X_ATHENA_CPPFLAGS], 3980d522f475Smrg[ 398120d2c4d2Smrgcf_x_athena_root=ifelse([$1],,Xaw,[$1]) 398220d2c4d2Smrgcf_x_athena_inc="" 3983d522f475Smrg 3984d522f475Smrgfor cf_path in default \ 3985d522f475Smrg /usr/contrib/X11R6 \ 3986d522f475Smrg /usr/contrib/X11R5 \ 3987d522f475Smrg /usr/lib/X11R5 \ 3988d522f475Smrg /usr/local 3989d522f475Smrgdo 399020d2c4d2Smrg if test -z "$cf_x_athena_inc" ; then 3991d522f475Smrg cf_save="$CPPFLAGS" 3992d522f475Smrg cf_test=X11/$cf_x_athena_root/SimpleMenu.h 3993d522f475Smrg if test $cf_path != default ; then 3994956cc18dSsnj CPPFLAGS="$cf_save -I$cf_path/include" 3995d522f475Smrg AC_MSG_CHECKING(for $cf_test in $cf_path) 3996d522f475Smrg else 3997d522f475Smrg AC_MSG_CHECKING(for $cf_test) 3998d522f475Smrg fi 3999d522f475Smrg AC_TRY_COMPILE([ 4000d522f475Smrg#include <X11/Intrinsic.h> 4001d522f475Smrg#include <$cf_test>],[], 4002d522f475Smrg [cf_result=yes], 4003d522f475Smrg [cf_result=no]) 4004d522f475Smrg AC_MSG_RESULT($cf_result) 4005d522f475Smrg if test "$cf_result" = yes ; then 400620d2c4d2Smrg cf_x_athena_inc=$cf_path 4007d522f475Smrg break 4008d522f475Smrg else 4009d522f475Smrg CPPFLAGS="$cf_save" 4010d522f475Smrg fi 4011d522f475Smrg fi 4012d522f475Smrgdone 4013d522f475Smrg 401420d2c4d2Smrgif test -z "$cf_x_athena_inc" ; then 4015d522f475Smrg AC_MSG_WARN( 4016d522f475Smrg[Unable to successfully find Athena header files with test program]) 401720d2c4d2Smrgelif test "$cf_x_athena_inc" != default ; then 401820d2c4d2Smrg CPPFLAGS="$CPPFLAGS -I$cf_x_athena_inc" 4019d522f475Smrgfi 4020d522f475Smrg]) 4021d522f475Smrgdnl --------------------------------------------------------------------------- 40220bd37d32Smrgdnl CF_X_ATHENA_LIBS version: 12 updated: 2011/07/17 19:55:02 4023d522f475Smrgdnl ---------------- 4024d522f475Smrgdnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of 4025d522f475Smrgdnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw. 4026d522f475SmrgAC_DEFUN([CF_X_ATHENA_LIBS], 4027d522f475Smrg[AC_REQUIRE([CF_X_TOOLKIT]) 402820d2c4d2Smrgcf_x_athena_root=ifelse([$1],,Xaw,[$1]) 4029d522f475Smrgcf_x_athena_lib="" 4030d522f475Smrg 4031d522f475Smrgfor cf_path in default \ 4032d522f475Smrg /usr/contrib/X11R6 \ 4033d522f475Smrg /usr/contrib/X11R5 \ 4034d522f475Smrg /usr/lib/X11R5 \ 4035d522f475Smrg /usr/local 4036d522f475Smrgdo 4037d522f475Smrg for cf_lib in \ 40380bd37d32Smrg ${cf_x_athena_root} \ 40390bd37d32Smrg ${cf_x_athena_root}7 \ 40400bd37d32Smrg ${cf_x_athena_root}6 40410bd37d32Smrg do 40420bd37d32Smrg for cf_libs in \ 40430bd37d32Smrg "-l$cf_lib -lXmu" \ 40440bd37d32Smrg "-l$cf_lib -lXpm -lXmu" \ 40450bd37d32Smrg "-l${cf_lib}_s -lXmu_s" 4046d522f475Smrg do 4047d522f475Smrg if test -z "$cf_x_athena_lib" ; then 4048d522f475Smrg cf_save="$LIBS" 4049d522f475Smrg cf_test=XawSimpleMenuAddGlobalActions 4050d522f475Smrg if test $cf_path != default ; then 40510bd37d32Smrg CF_ADD_LIBS(-L$cf_path/lib $cf_libs) 40520bd37d32Smrg AC_MSG_CHECKING(for $cf_libs in $cf_path) 4053d522f475Smrg else 40540bd37d32Smrg CF_ADD_LIBS($cf_libs) 40550bd37d32Smrg AC_MSG_CHECKING(for $cf_test in $cf_libs) 4056d522f475Smrg fi 4057a1f3da82Smrg AC_TRY_LINK([ 4058a1f3da82Smrg#include <X11/Intrinsic.h> 4059a1f3da82Smrg#include <X11/$cf_x_athena_root/SimpleMenu.h> 4060a1f3da82Smrg],[ 4061a1f3da82Smrg$cf_test((XtAppContext) 0)], 4062d522f475Smrg [cf_result=yes], 4063d522f475Smrg [cf_result=no]) 4064d522f475Smrg AC_MSG_RESULT($cf_result) 4065d522f475Smrg if test "$cf_result" = yes ; then 40660bd37d32Smrg cf_x_athena_lib="$cf_libs" 4067d522f475Smrg break 4068d522f475Smrg fi 4069d522f475Smrg LIBS="$cf_save" 4070d522f475Smrg fi 40710bd37d32Smrg done # cf_libs 40720bd37d32Smrg test -n "$cf_x_athena_lib" && break 40730bd37d32Smrg done # cf_lib 4074d522f475Smrgdone 4075d522f475Smrg 4076d522f475Smrgif test -z "$cf_x_athena_lib" ; then 4077d522f475Smrg AC_MSG_ERROR( 4078d522f475Smrg[Unable to successfully link Athena library (-l$cf_x_athena_root) with test program]) 4079d522f475Smrgfi 4080d522f475Smrg 4081d522f475SmrgCF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena) 4082d522f475SmrgAC_DEFINE_UNQUOTED($cf_x_athena_LIBS) 4083d522f475Smrg]) 4084d522f475Smrgdnl --------------------------------------------------------------------------- 408520d2c4d2Smrgdnl CF_X_EXT version: 3 updated: 2010/06/02 05:03:05 408620d2c4d2Smrgdnl -------- 408720d2c4d2SmrgAC_DEFUN([CF_X_EXT],[ 408820d2c4d2SmrgCF_TRY_PKG_CONFIG(Xext,,[ 408920d2c4d2Smrg AC_CHECK_LIB(Xext,XextCreateExtension, 409020d2c4d2Smrg [CF_ADD_LIB(Xext)])]) 409120d2c4d2Smrg])dnl 409220d2c4d2Smrgdnl --------------------------------------------------------------------------- 4093e0a2b6dfSmrgdnl CF_X_FONTCONFIG version: 5 updated: 2013/07/06 21:27:06 40946879286fSmrgdnl --------------- 40956879286fSmrgdnl Check for fontconfig library, a dependency of the X FreeType library. 40966879286fSmrgAC_DEFUN([CF_X_FONTCONFIG], 40976879286fSmrg[ 40986879286fSmrgAC_REQUIRE([CF_X_FREETYPE]) 40996879286fSmrg 4100e39b573cSmrgif test "$cf_cv_found_freetype" = yes ; then 41016879286fSmrgAC_CACHE_CHECK(for usable Xft/fontconfig package,cf_cv_xft_compat,[ 41026879286fSmrgAC_TRY_LINK([ 41036879286fSmrg#include <X11/Xft/Xft.h> 41046879286fSmrg],[ 41056879286fSmrg XftPattern *pat; 41066879286fSmrg XftPatternBuild(pat, 41076879286fSmrg XFT_FAMILY, XftTypeString, "mono", 41086879286fSmrg (void *) 0); 41096879286fSmrg],[cf_cv_xft_compat=yes],[cf_cv_xft_compat=no]) 41106879286fSmrg]) 41116879286fSmrg 41126879286fSmrgif test "$cf_cv_xft_compat" = no 41136879286fSmrgthen 41146879286fSmrg # workaround for broken ".pc" files used for Xft. 41156879286fSmrg case "$cf_cv_x_freetype_libs" in #(vi 41166879286fSmrg *-lfontconfig*) #(vi 41176879286fSmrg ;; 41186879286fSmrg *) 41196879286fSmrg CF_VERBOSE(work around broken package) 4120e0a2b6dfSmrg cf_save_fontconfig="$LIBS" 4121e0a2b6dfSmrg CF_TRY_PKG_CONFIG(fontconfig,[ 4122e0a2b6dfSmrg CF_ADD_CFLAGS($cf_pkgconfig_incs) 4123e0a2b6dfSmrg LIBS="$cf_save_fontconfig" 4124e0a2b6dfSmrg CF_ADD_LIB_AFTER(-lXft,$cf_pkgconfig_libs) 4125e0a2b6dfSmrg ],[ 4126e0a2b6dfSmrg CF_ADD_LIB_AFTER(-lXft,-lfontconfig) 4127e0a2b6dfSmrg ]) 41286879286fSmrg ;; 41296879286fSmrg esac 41306879286fSmrgfi 4131e39b573cSmrgfi 41326879286fSmrg])dnl 41336879286fSmrgdnl --------------------------------------------------------------------------- 41340bd37d32Smrgdnl CF_X_FREETYPE version: 26 updated: 2012/10/04 20:12:20 4135d522f475Smrgdnl ------------- 4136d522f475Smrgdnl Check for X FreeType headers and libraries (XFree86 4.x, etc). 4137d522f475Smrgdnl 4138d522f475Smrgdnl First check for the appropriate config program, since the developers for 4139d522f475Smrgdnl these libraries change their configuration (and config program) more or 4140d522f475Smrgdnl less randomly. If we cannot find the config program, do not bother trying 4141d522f475Smrgdnl to guess the latest variation of include/lib directories. 4142d522f475Smrgdnl 4143d522f475Smrgdnl If either or both of these configure-script options are not given, rely on 4144d522f475Smrgdnl the output of the config program to provide the cflags/libs options: 4145d522f475Smrgdnl --with-freetype-cflags 4146d522f475Smrgdnl --with-freetype-libs 4147d522f475SmrgAC_DEFUN([CF_X_FREETYPE], 4148d522f475Smrg[ 4149956cc18dSsnjAC_REQUIRE([CF_PKG_CONFIG]) 4150956cc18dSsnj 41510bd37d32Smrgcf_cv_x_freetype_incs=no 41520bd37d32Smrgcf_cv_x_freetype_libs=no 4153d522f475Smrgcf_extra_freetype_libs= 4154956cc18dSsnjFREETYPE_CONFIG=none 4155d522f475SmrgFREETYPE_PARAMS= 4156d522f475Smrg 41570bd37d32SmrgAC_MSG_CHECKING(for FreeType configuration script) 41580bd37d32SmrgAC_ARG_WITH(freetype-config, 41590bd37d32Smrg [ --with-freetype-config configure script to use for FreeType], 41600bd37d32Smrg [cf_cv_x_freetype_cfgs="$withval"], 41610bd37d32Smrg [cf_cv_x_freetype_cfgs=auto]) 41620bd37d32Smrgtest -z $cf_cv_x_freetype_cfgs && cf_cv_x_freetype_cfgs=auto 41630bd37d32Smrgtest $cf_cv_x_freetype_cfgs = no && cf_cv_x_freetype_cfgs=none 41640bd37d32SmrgAC_MSG_RESULT($cf_cv_x_freetype_cfgs) 41650bd37d32Smrg 41660bd37d32Smrgcase $cf_cv_x_freetype_cfgs in 41670bd37d32Smrgnone) #(vi 41680bd37d32Smrg AC_MSG_CHECKING(if you specified -D/-I options for FreeType) 41690bd37d32Smrg AC_ARG_WITH(freetype-cflags, 41700bd37d32Smrg [ --with-freetype-cflags -D/-I options for compiling with FreeType], 41710bd37d32Smrg [cf_cv_x_freetype_incs="$with_freetype_cflags"], 41720bd37d32Smrg [cf_cv_x_freetype_incs=no]) 41730bd37d32Smrg AC_MSG_RESULT($cf_cv_x_freetype_incs) 41740bd37d32Smrg 41750bd37d32Smrg AC_MSG_CHECKING(if you specified -L/-l options for FreeType) 41760bd37d32Smrg AC_ARG_WITH(freetype-libs, 41770bd37d32Smrg [ --with-freetype-libs -L/-l options to link FreeType], 41780bd37d32Smrg [cf_cv_x_freetype_libs="$with_freetype_libs"], 41790bd37d32Smrg [cf_cv_x_freetype_libs=no]) 41800bd37d32Smrg AC_MSG_RESULT($cf_cv_x_freetype_libs) 41810bd37d32Smrg ;; 41820bd37d32Smrgauto) #(vi 41830bd37d32Smrg if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists xft; then 41840bd37d32Smrg FREETYPE_CONFIG=$PKG_CONFIG 41850bd37d32Smrg FREETYPE_PARAMS=xft 41860bd37d32Smrg else 41870bd37d32Smrg AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, none) 41880bd37d32Smrg if test "$FREETYPE_CONFIG" != none; then 41890bd37d32Smrg FREETYPE_CONFIG=$FREETYPE_CONFIG 41900bd37d32Smrg cf_extra_freetype_libs="-lXft" 41910bd37d32Smrg else 41920bd37d32Smrg AC_PATH_PROG(FREETYPE_OLD_CONFIG, xft-config, none) 41930bd37d32Smrg if test "$FREETYPE_OLD_CONFIG" != none; then 41940bd37d32Smrg FREETYPE_CONFIG=$FREETYPE_OLD_CONFIG 41950bd37d32Smrg fi 41960bd37d32Smrg fi 41970bd37d32Smrg fi 41980bd37d32Smrg ;; 41990bd37d32Smrgpkg*) #(vi 42000bd37d32Smrg if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists xft; then 42010bd37d32Smrg FREETYPE_CONFIG=$cf_cv_x_freetype_cfgs 42020bd37d32Smrg FREETYPE_PARAMS=xft 42030bd37d32Smrg else 42040bd37d32Smrg AC_MSG_WARN(cannot find pkg-config for Xft) 42050bd37d32Smrg fi 42060bd37d32Smrg ;; 42070bd37d32Smrg*) #(vi 42080bd37d32Smrg AC_PATH_PROG(FREETYPE_XFT_CONFIG, $cf_cv_x_freetype_cfgs, none) 4209d522f475Smrg if test "$FREETYPE_XFT_CONFIG" != none; then 4210d522f475Smrg FREETYPE_CONFIG=$FREETYPE_XFT_CONFIG 4211d522f475Smrg else 42120bd37d32Smrg AC_MSG_WARN(cannot find config script for Xft) 4213d522f475Smrg fi 42140bd37d32Smrg ;; 42150bd37d32Smrgesac 4216d522f475Smrg 4217956cc18dSsnjif test "$FREETYPE_CONFIG" != none ; then 42180bd37d32Smrg AC_MSG_CHECKING(for FreeType config) 42190bd37d32Smrg AC_MSG_RESULT($FREETYPE_CONFIG $FREETYPE_PARAMS) 4220d522f475Smrg 4221956cc18dSsnj if test "$cf_cv_x_freetype_incs" = no ; then 4222956cc18dSsnj AC_MSG_CHECKING(for $FREETYPE_CONFIG cflags) 4223956cc18dSsnj cf_cv_x_freetype_incs="`$FREETYPE_CONFIG $FREETYPE_PARAMS --cflags 2>/dev/null`" 4224956cc18dSsnj AC_MSG_RESULT($cf_cv_x_freetype_incs) 4225956cc18dSsnj fi 4226d522f475Smrg 4227956cc18dSsnj if test "$cf_cv_x_freetype_libs" = no ; then 4228956cc18dSsnj AC_MSG_CHECKING(for $FREETYPE_CONFIG libs) 4229956cc18dSsnj cf_cv_x_freetype_libs="$cf_extra_freetype_libs `$FREETYPE_CONFIG $FREETYPE_PARAMS --libs 2>/dev/null`" 4230956cc18dSsnj AC_MSG_RESULT($cf_cv_x_freetype_libs) 4231956cc18dSsnj fi 4232d522f475Smrgfi 4233d522f475Smrg 4234d522f475Smrgif test "$cf_cv_x_freetype_incs" = no ; then 4235d522f475Smrg cf_cv_x_freetype_incs= 4236d522f475Smrgfi 4237d522f475Smrg 4238d522f475Smrgif test "$cf_cv_x_freetype_libs" = no ; then 4239d522f475Smrg cf_cv_x_freetype_libs=-lXft 4240d522f475Smrgfi 4241d522f475Smrg 4242d522f475SmrgAC_MSG_CHECKING(if we can link with FreeType libraries) 4243d522f475Smrg 4244d522f475Smrgcf_save_LIBS="$LIBS" 4245d522f475Smrgcf_save_INCS="$CPPFLAGS" 4246d522f475Smrg 424720d2c4d2SmrgCF_ADD_LIBS($cf_cv_x_freetype_libs) 4248956cc18dSsnjCPPFLAGS="$CPPFLAGS $cf_cv_x_freetype_incs" 4249d522f475Smrg 4250d522f475SmrgAC_TRY_LINK([ 4251d522f475Smrg#include <X11/Xlib.h> 4252d522f475Smrg#include <X11/extensions/Xrender.h> 4253d522f475Smrg#include <X11/Xft/Xft.h>],[ 4254d522f475Smrg XftPattern *pat = XftNameParse ("name");], 4255d522f475Smrg [cf_cv_found_freetype=yes], 4256d522f475Smrg [cf_cv_found_freetype=no]) 4257d522f475SmrgAC_MSG_RESULT($cf_cv_found_freetype) 4258d522f475Smrg 4259d522f475SmrgLIBS="$cf_save_LIBS" 4260d522f475SmrgCPPFLAGS="$cf_save_INCS" 4261d522f475Smrg 4262d522f475Smrgif test "$cf_cv_found_freetype" = yes ; then 426320d2c4d2Smrg CF_ADD_LIBS($cf_cv_x_freetype_libs) 4264d522f475Smrg CF_ADD_CFLAGS($cf_cv_x_freetype_incs) 42650bd37d32Smrg AC_DEFINE(XRENDERFONT,1,[Define to 1 if we can/should link with FreeType libraries]) 4266d522f475Smrg 4267d522f475SmrgAC_CHECK_FUNCS( \ 4268d522f475Smrg XftDrawCharSpec \ 4269d522f475Smrg XftDrawSetClip \ 4270d522f475Smrg XftDrawSetClipRectangles \ 4271d522f475Smrg) 4272d522f475Smrg 4273d522f475Smrgelse 4274d522f475Smrg AC_MSG_WARN(No libraries found for FreeType) 4275d522f475Smrg CPPFLAGS=`echo "$CPPFLAGS" | sed -e s/-DXRENDERFONT//` 4276d522f475Smrgfi 4277d522f475Smrg 4278d522f475Smrg# FIXME: revisit this if needed 4279d522f475SmrgAC_SUBST(HAVE_TYPE_FCCHAR32) 4280d522f475SmrgAC_SUBST(HAVE_TYPE_XFTCHARSPEC) 4281d522f475Smrg]) 4282d522f475Smrgdnl --------------------------------------------------------------------------- 42830bd37d32Smrgdnl CF_X_TOOLKIT version: 21 updated: 2012/10/04 06:57:36 4284d522f475Smrgdnl ------------ 4285d522f475Smrgdnl Check for X Toolkit libraries 4286d522f475Smrgdnl 4287d522f475SmrgAC_DEFUN([CF_X_TOOLKIT], 4288d522f475Smrg[ 4289d522f475SmrgAC_REQUIRE([AC_PATH_XTRA]) 4290d522f475SmrgAC_REQUIRE([CF_CHECK_CACHE]) 4291d522f475Smrg 4292d522f475Smrgcf_have_X_LIBS=no 4293d522f475Smrg 429420d2c4d2SmrgCF_TRY_PKG_CONFIG(xt,[ 429520d2c4d2Smrg 42966879286fSmrg case "x$LIBS" in #(vi 42976879286fSmrg *-lX11*) #(vi 42986879286fSmrg ;; 42996879286fSmrg *) 43006879286fSmrg# we have an "xt" package, but it may omit Xt's dependency on X11 43016879286fSmrgAC_CACHE_CHECK(for usable X dependency,cf_cv_xt_x11_compat,[ 43026879286fSmrgAC_TRY_LINK([ 43036879286fSmrg#include <X11/Xlib.h> 43046879286fSmrg],[ 43056879286fSmrg int rc1 = XDrawLine((Display*) 0, (Drawable) 0, (GC) 0, 0, 0, 0, 0); 43066879286fSmrg int rc2 = XClearWindow((Display*) 0, (Window) 0); 43076879286fSmrg int rc3 = XMoveWindow((Display*) 0, (Window) 0, 0, 0); 43086879286fSmrg int rc4 = XMoveResizeWindow((Display*)0, (Window)0, 0, 0, 0, 0); 43096879286fSmrg],[cf_cv_xt_x11_compat=yes],[cf_cv_xt_x11_compat=no])]) 43106879286fSmrg if test "$cf_cv_xt_x11_compat" = no 43116879286fSmrg then 43126879286fSmrg CF_VERBOSE(work around broken X11 dependency) 43136879286fSmrg # 2010/11/19 - good enough until a working Xt on Xcb is delivered. 43146879286fSmrg CF_TRY_PKG_CONFIG(x11,,[CF_ADD_LIB_AFTER(-lXt,-lX11)]) 43156879286fSmrg fi 431620d2c4d2Smrg ;; 431720d2c4d2Smrg esac 431820d2c4d2Smrg 43196879286fSmrgAC_CACHE_CHECK(for usable X Toolkit package,cf_cv_xt_ice_compat,[ 43206879286fSmrgAC_TRY_LINK([ 43216879286fSmrg#include <X11/Shell.h> 43226879286fSmrg],[int num = IceConnectionNumber(0) 43236879286fSmrg],[cf_cv_xt_ice_compat=yes],[cf_cv_xt_ice_compat=no])]) 43246879286fSmrg 43256879286fSmrg if test "$cf_cv_xt_ice_compat" = no 43266879286fSmrg then 43276879286fSmrg # workaround for broken ".pc" files used for X Toolkit. 43286879286fSmrg case "x$X_PRE_LIBS" in #(vi 43296879286fSmrg *-lICE*) 43306879286fSmrg case "x$LIBS" in #(vi 43316879286fSmrg *-lICE*) #(vi 43326879286fSmrg ;; 43336879286fSmrg *) 43346879286fSmrg CF_VERBOSE(work around broken ICE dependency) 43356879286fSmrg CF_TRY_PKG_CONFIG(ice, 43366879286fSmrg [CF_TRY_PKG_CONFIG(sm)], 43376879286fSmrg [CF_ADD_LIB_AFTER(-lXt,$X_PRE_LIBS)]) 43386879286fSmrg ;; 43396879286fSmrg esac 43406879286fSmrg ;; 43416879286fSmrg esac 43426879286fSmrg fi 43436879286fSmrg 434420d2c4d2Smrg cf_have_X_LIBS=yes 434520d2c4d2Smrg],[ 434620d2c4d2Smrg 434720d2c4d2Smrg LDFLAGS="$X_LIBS $LDFLAGS" 434820d2c4d2Smrg CF_CHECK_CFLAGS($X_CFLAGS) 4349d522f475Smrg 435020d2c4d2Smrg AC_CHECK_FUNC(XOpenDisplay,,[ 435120d2c4d2Smrg AC_CHECK_LIB(X11,XOpenDisplay, 435220d2c4d2Smrg [CF_ADD_LIB(X11)],, 435320d2c4d2Smrg [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])]) 4354d522f475Smrg 435520d2c4d2Smrg AC_CHECK_FUNC(XtAppInitialize,,[ 435620d2c4d2Smrg AC_CHECK_LIB(Xt, XtAppInitialize, 43570bd37d32Smrg [AC_DEFINE(HAVE_LIBXT,1,[Define to 1 if we can compile with the Xt library]) 435820d2c4d2Smrg cf_have_X_LIBS=Xt 435920d2c4d2Smrg LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS"],, 436020d2c4d2Smrg [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])]) 436120d2c4d2Smrg]) 4362d522f475Smrg 4363d522f475Smrgif test $cf_have_X_LIBS = no ; then 4364d522f475Smrg AC_MSG_WARN( 4365d522f475Smrg[Unable to successfully link X Toolkit library (-lXt) with 4366d522f475Smrgtest program. You will have to check and add the proper libraries by hand 4367d522f475Smrgto makefile.]) 4368d522f475Smrgfi 4369d522f475Smrg])dnl 43700bd37d32Smrgdnl --------------------------------------------------------------------------- 43710bd37d32Smrgdnl CF__GRANTPT_BODY version: 4 updated: 2012/05/07 19:39:45 43720bd37d32Smrgdnl ---------------- 43730bd37d32Smrgdnl Body for workability check of grantpt. 43740bd37d32Smrgdefine([CF__GRANTPT_BODY],[ 43750bd37d32Smrg int code = 0; 43760bd37d32Smrg int rc; 43770bd37d32Smrg int pty; 43780bd37d32Smrg int tty; 43790bd37d32Smrg char *slave; 43800bd37d32Smrg struct termios tio; 43810bd37d32Smrg 43820bd37d32Smrg signal(SIGALRM, my_timeout); 43830bd37d32Smrg 43840bd37d32Smrg if (alarm(2) == 9) 43850bd37d32Smrg failed(9); 43860bd37d32Smrg else if ((pty = posix_openpt(O_RDWR)) < 0) 43870bd37d32Smrg failed(1); 43880bd37d32Smrg else if ((rc = grantpt(pty)) < 0) 43890bd37d32Smrg failed(2); 43900bd37d32Smrg else if ((rc = unlockpt(pty)) < 0) 43910bd37d32Smrg failed(3); 43920bd37d32Smrg else if ((slave = ptsname(pty)) == 0) 43930bd37d32Smrg failed(4); 43940bd37d32Smrg#if (CONFTEST == 3) || defined(CONFTEST_isatty) 43950bd37d32Smrg else if (!isatty(pty)) 43960bd37d32Smrg failed(4); 43970bd37d32Smrg#endif 43980bd37d32Smrg#if CONFTEST >= 4 43990bd37d32Smrg else if ((rc = tcgetattr(pty, &tio)) < 0) 44000bd37d32Smrg failed(20); 44010bd37d32Smrg else if ((rc = tcsetattr(pty, TCSAFLUSH, &tio)) < 0) 44020bd37d32Smrg failed(21); 44030bd37d32Smrg#endif 44040bd37d32Smrg /* BSD posix_openpt does not treat pty as a terminal until slave is opened. 44050bd37d32Smrg * Linux does treat it that way. 44060bd37d32Smrg */ 44070bd37d32Smrg else if ((tty = open(slave, O_RDWR)) < 0) 44080bd37d32Smrg failed(5); 44090bd37d32Smrg#ifdef CONFTEST 44100bd37d32Smrg#ifdef I_PUSH 44110bd37d32Smrg#if (CONFTEST == 0) || defined(CONFTEST_ptem) 44120bd37d32Smrg else if ((rc = ioctl(tty, I_PUSH, "ptem")) < 0) 44130bd37d32Smrg failed(10); 44140bd37d32Smrg#endif 44150bd37d32Smrg#if (CONFTEST == 1) || defined(CONFTEST_ldterm) 44160bd37d32Smrg else if ((rc = ioctl(tty, I_PUSH, "ldterm")) < 0) 44170bd37d32Smrg failed(11); 44180bd37d32Smrg#endif 44190bd37d32Smrg#if (CONFTEST == 2) || defined(CONFTEST_ttcompat) 44200bd37d32Smrg else if ((rc = ioctl(tty, I_PUSH, "ttcompat")) < 0) 44210bd37d32Smrg failed(12); 44220bd37d32Smrg#endif 44230bd37d32Smrg#endif /* I_PUSH */ 44240bd37d32Smrg#if CONFTEST >= 5 44250bd37d32Smrg else if ((rc = tcgetattr(tty, &tio)) < 0) 44260bd37d32Smrg failed(30); 44270bd37d32Smrg else if ((rc = tcsetattr(tty, TCSAFLUSH, &tio)) < 0) 44280bd37d32Smrg failed(31); 44290bd37d32Smrg#endif 44300bd37d32Smrg#endif /* CONFTEST */ 44310bd37d32Smrg 44320bd37d32Smrg ${cf_cv_main_return:-return}(code); 44330bd37d32Smrg]) 44340bd37d32Smrgdnl --------------------------------------------------------------------------- 44350bd37d32Smrgdnl CF__GRANTPT_HEAD version: 3 updated: 2012/01/29 17:13:14 44360bd37d32Smrgdnl ---------------- 44370bd37d32Smrgdnl Headers for workability check of grantpt. 44380bd37d32Smrgdefine([CF__GRANTPT_HEAD],[ 44390bd37d32Smrg#include <stdlib.h> 44400bd37d32Smrg#include <termios.h> 44410bd37d32Smrg#include <unistd.h> 44420bd37d32Smrg#include <signal.h> 44430bd37d32Smrg#include <fcntl.h> 44440bd37d32Smrg#include <errno.h> 44450bd37d32Smrg 44460bd37d32Smrg#ifndef HAVE_POSIX_OPENPT 44470bd37d32Smrg#undef posix_openpt 44480bd37d32Smrg#define posix_openpt(mode) open("/dev/ptmx", mode) 44490bd37d32Smrg#endif 44500bd37d32Smrg 44510bd37d32Smrg#ifdef HAVE_STROPTS_H 44520bd37d32Smrg#include <stropts.h> 44530bd37d32Smrg#endif 44540bd37d32Smrg 44550bd37d32Smrgstatic void failed(int code) 44560bd37d32Smrg{ 44570bd37d32Smrg perror("conftest"); 44580bd37d32Smrg exit(code); 44590bd37d32Smrg} 44600bd37d32Smrg 44610bd37d32Smrgstatic void my_timeout(int sig) 44620bd37d32Smrg{ 44630bd37d32Smrg exit(99); 44640bd37d32Smrg} 44650bd37d32Smrg]) 4466