aclocal.m4 revision 0bd37d32
10bd37d32Smrgdnl $XTermId: aclocal.m4,v 1.365 2013/05/27 22:36:25 tom Exp $ 2d522f475Smrgdnl 3d522f475Smrgdnl --------------------------------------------------------------------------- 4d522f475Smrgdnl 50bd37d32Smrgdnl Copyright 1997-2012,2013 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 --------------------------------------------------------------------------- 1916879286fSmrgdnl CF_ADD_LIB_AFTER version: 2 updated: 2010/11/08 20:33:46 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) 2006879286fSmrgLIBS=`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 --------------------------------------------------------------------------- 3790bd37d32Smrgdnl CF_CLANG_COMPILER version: 1 updated: 2012/06/16 14:55:39 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 3900bd37d32Smrgdnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS 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 --------------------------------------------------------------------------- 9530bd37d32Smrgdnl CF_GCC_WARNINGS version: 29 updated: 2012/06/16 14:55:39 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" 102520d2c4d2Smrg for cf_opt in W Wall \ 1026d522f475Smrg Wbad-function-cast \ 1027d522f475Smrg Wcast-align \ 1028d522f475Smrg Wcast-qual \ 1029d522f475Smrg Winline \ 1030d522f475Smrg Wmissing-declarations \ 1031d522f475Smrg Wmissing-prototypes \ 1032d522f475Smrg Wnested-externs \ 1033d522f475Smrg Wpointer-arith \ 1034d522f475Smrg Wshadow \ 1035d522f475Smrg Wstrict-prototypes \ 1036d522f475Smrg Wundef $cf_warn_CONST $1 1037d522f475Smrg do 1038d522f475Smrg CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" 1039d522f475Smrg if AC_TRY_EVAL(ac_compile); then 1040d522f475Smrg test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt) 1041d522f475Smrg case $cf_opt in #(vi 1042d522f475Smrg Wcast-qual) #(vi 1043d522f475Smrg CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES" 1044d522f475Smrg ;; 1045d522f475Smrg Winline) #(vi 1046d522f475Smrg case $GCC_VERSION in 10472eaa94a1Schristos [[34]].*) 1048d522f475Smrg CF_VERBOSE(feature is broken in gcc $GCC_VERSION) 1049d522f475Smrg continue;; 1050d522f475Smrg esac 1051d522f475Smrg ;; 10520bd37d32Smrg Wpointer-arith) #(vi 10530bd37d32Smrg case $GCC_VERSION in 10540bd37d32Smrg [[12]].*) 10550bd37d32Smrg CF_VERBOSE(feature is broken in gcc $GCC_VERSION) 10560bd37d32Smrg continue;; 10570bd37d32Smrg esac 10580bd37d32Smrg ;; 1059d522f475Smrg esac 1060d522f475Smrg EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" 1061d522f475Smrg fi 1062d522f475Smrg done 1063d522f475Smrg CFLAGS="$cf_save_CFLAGS" 1064d522f475Smrgfi 10656879286fSmrgrm -rf conftest* 1066d522f475Smrg 1067d522f475SmrgAC_SUBST(EXTRA_CFLAGS) 1068d522f475Smrg])dnl 1069d522f475Smrgdnl --------------------------------------------------------------------------- 1070d522f475Smrgdnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07 1071d522f475Smrgdnl ------------- 1072d522f475Smrgdnl Check if we must define _GNU_SOURCE to get a reasonable value for 1073d522f475Smrgdnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect 1074d522f475Smrgdnl (or misfeature) of glibc2, which breaks portability of many applications, 1075d522f475Smrgdnl since it is interwoven with GNU extensions. 1076d522f475Smrgdnl 1077d522f475Smrgdnl Well, yes we could work around it... 1078d522f475SmrgAC_DEFUN([CF_GNU_SOURCE], 1079d522f475Smrg[ 1080d522f475SmrgAC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[ 1081d522f475SmrgAC_TRY_COMPILE([#include <sys/types.h>],[ 1082d522f475Smrg#ifndef _XOPEN_SOURCE 1083d522f475Smrgmake an error 1084d522f475Smrg#endif], 1085d522f475Smrg [cf_cv_gnu_source=no], 1086d522f475Smrg [cf_save="$CPPFLAGS" 1087d522f475Smrg CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" 1088d522f475Smrg AC_TRY_COMPILE([#include <sys/types.h>],[ 1089d522f475Smrg#ifdef _XOPEN_SOURCE 1090d522f475Smrgmake an error 1091d522f475Smrg#endif], 1092d522f475Smrg [cf_cv_gnu_source=no], 1093d522f475Smrg [cf_cv_gnu_source=yes]) 1094d522f475Smrg CPPFLAGS="$cf_save" 1095d522f475Smrg ]) 1096d522f475Smrg]) 1097d522f475Smrgtest "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" 1098d522f475Smrg])dnl 1099d522f475Smrgdnl --------------------------------------------------------------------------- 1100d522f475Smrgdnl CF_HELP_MESSAGE version: 3 updated: 1998/01/14 10:56:23 1101d522f475Smrgdnl --------------- 1102d522f475Smrgdnl Insert text into the help-message, for readability, from AC_ARG_WITH. 1103d522f475SmrgAC_DEFUN([CF_HELP_MESSAGE], 1104d522f475Smrg[AC_DIVERT_HELP([$1])dnl 1105d522f475Smrg])dnl 1106d522f475Smrgdnl --------------------------------------------------------------------------- 110720d2c4d2Smrgdnl CF_IMAKE_CFLAGS version: 31 updated: 2010/05/26 05:38:42 1108d522f475Smrgdnl --------------- 1109d522f475Smrgdnl Use imake to obtain compiler flags. We could, in principle, write tests to 1110d522f475Smrgdnl get these, but if imake is properly configured there is no point in doing 1111d522f475Smrgdnl this. 1112d522f475Smrgdnl 1113d522f475Smrgdnl Parameters (used in constructing a sample Imakefile): 1114d522f475Smrgdnl $1 = optional value to append to $IMAKE_CFLAGS 1115d522f475Smrgdnl $2 = optional value to append to $IMAKE_LOADFLAGS 1116d522f475SmrgAC_DEFUN([CF_IMAKE_CFLAGS], 1117d522f475Smrg[ 1118d522f475SmrgAC_PATH_PROGS(IMAKE,xmkmf imake) 1119d522f475Smrg 1120d522f475Smrgif test -n "$IMAKE" ; then 1121d522f475Smrg 1122d522f475Smrgcase $IMAKE in # (vi 1123d522f475Smrg*/imake) 1124d522f475Smrg cf_imake_opts="-DUseInstalled=YES" # (vi 1125d522f475Smrg ;; 1126d522f475Smrg*/util/xmkmf) 1127d522f475Smrg # A single parameter tells xmkmf where the config-files are: 1128d522f475Smrg cf_imake_opts="`echo $IMAKE|sed -e s,/config/util/xmkmf,,`" # (vi 1129d522f475Smrg ;; 1130d522f475Smrg*) 1131d522f475Smrg cf_imake_opts= 1132d522f475Smrg ;; 1133d522f475Smrgesac 1134d522f475Smrg 1135d522f475Smrg# If it's installed properly, imake (or its wrapper, xmkmf) will point to the 1136d522f475Smrg# config directory. 1137d522f475Smrgif mkdir conftestdir; then 1138d522f475Smrg CDPATH=; export CDPATH 1139d522f475Smrg cf_makefile=`cd $srcdir;pwd`/Imakefile 1140d522f475Smrg cd conftestdir 1141d522f475Smrg 1142d522f475Smrg cat >fix_cflags.sed <<'CF_EOF' 1143d522f475Smrgs/\\//g 1144d522f475Smrgs/[[ ]][[ ]]*/ /g 1145d522f475Smrgs/"//g 1146d522f475Smrg:pack 1147d522f475Smrgs/\(=[[^ ]][[^ ]]*\) \([[^-]]\)/\1 \2/g 1148d522f475Smrgt pack 1149d522f475Smrgs/\(-D[[a-zA-Z0-9_]][[a-zA-Z0-9_]]*\)=\([[^\'0-9 ]][[^ ]]*\)/\1='\\"\2\\"'/g 1150d522f475Smrgs/^IMAKE[[ ]]/IMAKE_CFLAGS="/ 1151d522f475Smrgs/ / /g 1152d522f475Smrgs/$/"/ 1153d522f475SmrgCF_EOF 1154d522f475Smrg 1155d522f475Smrg cat >fix_lflags.sed <<'CF_EOF' 1156d522f475Smrgs/^IMAKE[[ ]]*/IMAKE_LOADFLAGS="/ 1157d522f475Smrgs/$/"/ 1158d522f475SmrgCF_EOF 1159d522f475Smrg 1160d522f475Smrg echo >./Imakefile 1161d522f475Smrg test -f $cf_makefile && cat $cf_makefile >>./Imakefile 1162d522f475Smrg 1163d522f475Smrg cat >> ./Imakefile <<'CF_EOF' 1164d522f475Smrgfindstddefs: 116520d2c4d2Smrg @echo IMAKE ${ALLDEFINES}ifelse([$1],,,[ $1]) | sed -f fix_cflags.sed 116620d2c4d2Smrg @echo IMAKE ${EXTRA_LOAD_FLAGS}ifelse([$2],,,[ $2]) | sed -f fix_lflags.sed 1167d522f475SmrgCF_EOF 1168d522f475Smrg 1169d522f475Smrg if ( $IMAKE $cf_imake_opts 1>/dev/null 2>&AC_FD_CC && test -f Makefile) 1170d522f475Smrg then 1171d522f475Smrg CF_VERBOSE(Using $IMAKE $cf_imake_opts) 1172d522f475Smrg else 1173d522f475Smrg # sometimes imake doesn't have the config path compiled in. Find it. 1174d522f475Smrg cf_config= 1175d522f475Smrg for cf_libpath in $X_LIBS $LIBS ; do 1176d522f475Smrg case $cf_libpath in # (vi 1177d522f475Smrg -L*) 1178d522f475Smrg cf_libpath=`echo .$cf_libpath | sed -e 's/^...//'` 1179d522f475Smrg cf_libpath=$cf_libpath/X11/config 1180d522f475Smrg if test -d $cf_libpath ; then 1181d522f475Smrg cf_config=$cf_libpath 1182d522f475Smrg break 1183d522f475Smrg fi 1184d522f475Smrg ;; 1185d522f475Smrg esac 1186d522f475Smrg done 1187d522f475Smrg if test -z "$cf_config" ; then 1188d522f475Smrg AC_MSG_WARN(Could not find imake config-directory) 1189d522f475Smrg else 1190d522f475Smrg cf_imake_opts="$cf_imake_opts -I$cf_config" 1191d522f475Smrg if ( $IMAKE -v $cf_imake_opts 2>&AC_FD_CC) 1192d522f475Smrg then 1193d522f475Smrg CF_VERBOSE(Using $IMAKE $cf_config) 1194d522f475Smrg else 1195d522f475Smrg AC_MSG_WARN(Cannot run $IMAKE) 1196d522f475Smrg fi 1197d522f475Smrg fi 1198d522f475Smrg fi 1199d522f475Smrg 1200d522f475Smrg # GNU make sometimes prints "make[1]: Entering...", which 1201d522f475Smrg # would confuse us. 1202d522f475Smrg eval `make findstddefs 2>/dev/null | grep -v make` 1203d522f475Smrg 1204d522f475Smrg cd .. 1205d522f475Smrg rm -rf conftestdir 1206d522f475Smrg 1207d522f475Smrg # We use ${ALLDEFINES} rather than ${STD_DEFINES} because the former 1208d522f475Smrg # declares XTFUNCPROTO there. However, some vendors (e.g., SGI) have 1209d522f475Smrg # modified it to support site.cf, adding a kludge for the /usr/include 1210d522f475Smrg # directory. Try to filter that out, otherwise gcc won't find its 1211d522f475Smrg # headers. 1212d522f475Smrg if test -n "$GCC" ; then 1213d522f475Smrg if test -n "$IMAKE_CFLAGS" ; then 1214d522f475Smrg cf_nostdinc="" 1215d522f475Smrg cf_std_incl="" 1216d522f475Smrg cf_cpp_opts="" 1217d522f475Smrg for cf_opt in $IMAKE_CFLAGS 1218d522f475Smrg do 1219d522f475Smrg case "$cf_opt" in 1220d522f475Smrg -nostdinc) #(vi 1221d522f475Smrg cf_nostdinc="$cf_opt" 1222d522f475Smrg ;; 1223d522f475Smrg -I/usr/include) #(vi 1224d522f475Smrg cf_std_incl="$cf_opt" 1225d522f475Smrg ;; 1226d522f475Smrg *) #(vi 1227d522f475Smrg cf_cpp_opts="$cf_cpp_opts $cf_opt" 1228d522f475Smrg ;; 1229d522f475Smrg esac 1230d522f475Smrg done 1231d522f475Smrg if test -z "$cf_nostdinc" ; then 1232d522f475Smrg IMAKE_CFLAGS="$cf_cpp_opts $cf_std_incl" 1233d522f475Smrg elif test -z "$cf_std_incl" ; then 1234d522f475Smrg IMAKE_CFLAGS="$cf_cpp_opts $cf_nostdinc" 1235d522f475Smrg else 1236d522f475Smrg CF_VERBOSE(suppressed \"$cf_nostdinc\" and \"$cf_std_incl\") 1237d522f475Smrg IMAKE_CFLAGS="$cf_cpp_opts" 1238d522f475Smrg fi 1239d522f475Smrg fi 1240d522f475Smrg fi 1241d522f475Smrgfi 1242d522f475Smrg 1243d522f475Smrg# Some imake configurations define PROJECTROOT with an empty value. Remove 1244d522f475Smrg# the empty definition. 1245d522f475Smrgcase $IMAKE_CFLAGS in 1246d522f475Smrg*-DPROJECTROOT=/*) 1247d522f475Smrg ;; 1248d522f475Smrg*) 1249d522f475Smrg IMAKE_CFLAGS=`echo "$IMAKE_CFLAGS" |sed -e "s,-DPROJECTROOT=[[ ]], ,"` 1250d522f475Smrg ;; 1251d522f475Smrgesac 1252d522f475Smrg 1253d522f475Smrgfi 1254d522f475Smrg 1255d522f475SmrgCF_VERBOSE(IMAKE_CFLAGS $IMAKE_CFLAGS) 1256d522f475SmrgCF_VERBOSE(IMAKE_LOADFLAGS $IMAKE_LOADFLAGS) 1257d522f475Smrg 1258d522f475SmrgAC_SUBST(IMAKE_CFLAGS) 1259d522f475SmrgAC_SUBST(IMAKE_LOADFLAGS) 1260d522f475Smrg])dnl 1261d522f475Smrgdnl --------------------------------------------------------------------------- 1262d522f475Smrgdnl CF_INPUT_METHOD version: 3 updated: 2000/04/11 23:46:57 1263d522f475Smrgdnl --------------- 1264d522f475Smrgdnl Check if the X libraries support input-method 1265d522f475SmrgAC_DEFUN([CF_INPUT_METHOD], 1266d522f475Smrg[ 1267d522f475SmrgAC_CACHE_CHECK([if X libraries support input-method],cf_cv_input_method,[ 1268d522f475SmrgAC_TRY_LINK([ 1269d522f475Smrg#include <X11/IntrinsicP.h> 1270d522f475Smrg#include <X11/Xatom.h> 1271d522f475Smrg#include <X11/Xutil.h> 1272d522f475Smrg#include <X11/Xmu/Atoms.h> 1273d522f475Smrg#include <X11/Xmu/Converters.h> 1274d522f475Smrg#include <X11/Xaw/XawImP.h> 1275d522f475Smrg],[ 1276d522f475Smrg{ 1277d522f475Smrg XIM xim; 1278d522f475Smrg XIMStyles *xim_styles = 0; 1279d522f475Smrg XIMStyle input_style; 1280d522f475Smrg Widget w = 0; 1281d522f475Smrg 1282d522f475Smrg XSetLocaleModifiers("@im=none"); 1283d522f475Smrg xim = XOpenIM(XtDisplay(w), NULL, NULL, NULL); 1284d522f475Smrg XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL); 1285d522f475Smrg XCloseIM(xim); 1286d522f475Smrg input_style = (XIMPreeditNothing | XIMStatusNothing); 1287d522f475Smrg} 1288d522f475Smrg], 1289d522f475Smrg[cf_cv_input_method=yes], 1290d522f475Smrg[cf_cv_input_method=no])]) 1291d522f475Smrg])dnl 1292d522f475Smrgdnl --------------------------------------------------------------------------- 12930bd37d32Smrgdnl CF_INTEL_COMPILER version: 5 updated: 2013/02/10 10:41:05 1294d522f475Smrgdnl ----------------- 1295d522f475Smrgdnl Check if the given compiler is really the Intel compiler for Linux. It 1296d522f475Smrgdnl tries to imitate gcc, but does not return an error when it finds a mismatch 1297d522f475Smrgdnl between prototypes, e.g., as exercised by CF_MISSING_CHECK. 1298d522f475Smrgdnl 1299d522f475Smrgdnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to 1300d522f475Smrgdnl ensure that it is not mistaken for gcc/g++. It is normally invoked from 1301d522f475Smrgdnl the wrappers for gcc and g++ warnings. 1302d522f475Smrgdnl 1303d522f475Smrgdnl $1 = GCC (default) or GXX 1304d522f475Smrgdnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS 1305d522f475Smrgdnl $3 = CFLAGS (default) or CXXFLAGS 1306d522f475SmrgAC_DEFUN([CF_INTEL_COMPILER],[ 13070bd37d32SmrgAC_REQUIRE([AC_CANONICAL_HOST]) 130820d2c4d2Smrgifelse([$2],,INTEL_COMPILER,[$2])=no 1309d522f475Smrg 131020d2c4d2Smrgif test "$ifelse([$1],,[$1],GCC)" = yes ; then 1311d522f475Smrg case $host_os in 1312d522f475Smrg linux*|gnu*) 131320d2c4d2Smrg AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler) 131420d2c4d2Smrg cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" 131520d2c4d2Smrg ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc" 1316d522f475Smrg AC_TRY_COMPILE([],[ 1317d522f475Smrg#ifdef __INTEL_COMPILER 1318d522f475Smrg#else 1319d522f475Smrgmake an error 1320d522f475Smrg#endif 132120d2c4d2Smrg],[ifelse([$2],,INTEL_COMPILER,[$2])=yes 1322d522f475Smrgcf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc" 1323d522f475Smrg],[]) 132420d2c4d2Smrg ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" 132520d2c4d2Smrg AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2])) 1326d522f475Smrg ;; 1327d522f475Smrg esac 1328d522f475Smrgfi 1329d522f475Smrg])dnl 1330d522f475Smrgdnl --------------------------------------------------------------------------- 13310bd37d32Smrgdnl CF_LASTLOG version: 5 updated: 2012/10/04 20:12:20 1332d522f475Smrgdnl ---------- 1333d522f475Smrgdnl Check for header defining _PATH_LASTLOG, or failing that, see if the lastlog 1334d522f475Smrgdnl file exists. 1335d522f475SmrgAC_DEFUN([CF_LASTLOG], 1336d522f475Smrg[ 1337d522f475SmrgAC_CHECK_HEADERS(lastlog.h paths.h) 1338d522f475SmrgAC_CACHE_CHECK(for lastlog path,cf_cv_path_lastlog,[ 1339d522f475SmrgAC_TRY_COMPILE([ 1340d522f475Smrg#include <sys/types.h> 1341d522f475Smrg#ifdef HAVE_LASTLOG_H 1342d522f475Smrg#include <lastlog.h> 1343d522f475Smrg#else 1344d522f475Smrg#ifdef HAVE_PATHS_H 1345d522f475Smrg#include <paths.h> 1346d522f475Smrg#endif 1347d522f475Smrg#endif],[char *path = _PATH_LASTLOG], 1348d522f475Smrg [cf_cv_path_lastlog="_PATH_LASTLOG"], 1349d522f475Smrg [if test -f /usr/adm/lastlog ; then 1350d522f475Smrg cf_cv_path_lastlog=/usr/adm/lastlog 1351d522f475Smrg else 1352d522f475Smrg cf_cv_path_lastlog=no 1353d522f475Smrg fi]) 1354d522f475Smrg]) 13550bd37d32Smrgtest $cf_cv_path_lastlog != no && AC_DEFINE(USE_LASTLOG,1,[Define to 1 if we can define lastlog pathname]) 1356d522f475Smrg])dnl 1357d522f475Smrgdnl --------------------------------------------------------------------------- 13580bd37d32Smrgdnl CF_LD_RPATH_OPT version: 5 updated: 2011/07/17 14:48:41 135920d2c4d2Smrgdnl --------------- 136020d2c4d2Smrgdnl For the given system and compiler, find the compiler flags to pass to the 136120d2c4d2Smrgdnl loader to use the "rpath" feature. 136220d2c4d2SmrgAC_DEFUN([CF_LD_RPATH_OPT], 136320d2c4d2Smrg[ 136420d2c4d2SmrgAC_REQUIRE([CF_CHECK_CACHE]) 136520d2c4d2Smrg 136620d2c4d2SmrgLD_RPATH_OPT= 136720d2c4d2SmrgAC_MSG_CHECKING(for an rpath option) 136820d2c4d2Smrgcase $cf_cv_system_name in #(vi 136920d2c4d2Smrgirix*) #(vi 137020d2c4d2Smrg if test "$GCC" = yes; then 137120d2c4d2Smrg LD_RPATH_OPT="-Wl,-rpath," 137220d2c4d2Smrg else 137320d2c4d2Smrg LD_RPATH_OPT="-rpath " 137420d2c4d2Smrg fi 137520d2c4d2Smrg ;; 137620d2c4d2Smrglinux*|gnu*|k*bsd*-gnu) #(vi 137720d2c4d2Smrg LD_RPATH_OPT="-Wl,-rpath," 137820d2c4d2Smrg ;; 1379e39b573cSmrgopenbsd[[2-9]].*|mirbsd*) #(vi 138020d2c4d2Smrg LD_RPATH_OPT="-Wl,-rpath," 138120d2c4d2Smrg ;; 13820bd37d32Smrgdragonfly*|freebsd*) #(vi 138320d2c4d2Smrg LD_RPATH_OPT="-rpath " 138420d2c4d2Smrg ;; 138520d2c4d2Smrgnetbsd*) #(vi 138620d2c4d2Smrg LD_RPATH_OPT="-Wl,-rpath," 138720d2c4d2Smrg ;; 138820d2c4d2Smrgosf*|mls+*) #(vi 138920d2c4d2Smrg LD_RPATH_OPT="-rpath " 139020d2c4d2Smrg ;; 139120d2c4d2Smrgsolaris2*) #(vi 139220d2c4d2Smrg LD_RPATH_OPT="-R" 139320d2c4d2Smrg ;; 139420d2c4d2Smrg*) 139520d2c4d2Smrg ;; 139620d2c4d2Smrgesac 139720d2c4d2SmrgAC_MSG_RESULT($LD_RPATH_OPT) 139820d2c4d2Smrg 139920d2c4d2Smrgcase "x$LD_RPATH_OPT" in #(vi 140020d2c4d2Smrgx-R*) 140120d2c4d2Smrg AC_MSG_CHECKING(if we need a space after rpath option) 140220d2c4d2Smrg cf_save_LIBS="$LIBS" 140320d2c4d2Smrg CF_ADD_LIBS(${LD_RPATH_OPT}$libdir) 140420d2c4d2Smrg AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes) 140520d2c4d2Smrg LIBS="$cf_save_LIBS" 140620d2c4d2Smrg AC_MSG_RESULT($cf_rpath_space) 140720d2c4d2Smrg test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT " 140820d2c4d2Smrg ;; 140920d2c4d2Smrgesac 141020d2c4d2Smrg])dnl 141120d2c4d2Smrgdnl --------------------------------------------------------------------------- 14126879286fSmrgdnl CF_MAKE_TAGS version: 6 updated: 2010/10/23 15:52:32 141320d2c4d2Smrgdnl ------------ 141420d2c4d2Smrgdnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have 141520d2c4d2Smrgdnl a monocase filesystem. 141620d2c4d2SmrgAC_DEFUN([CF_MAKE_TAGS],[ 141720d2c4d2SmrgAC_REQUIRE([CF_MIXEDCASE_FILENAMES]) 141820d2c4d2Smrg 141920d2c4d2SmrgAC_CHECK_PROGS(CTAGS, exctags ctags) 142020d2c4d2SmrgAC_CHECK_PROGS(ETAGS, exetags etags) 142120d2c4d2Smrg 14226879286fSmrgAC_CHECK_PROG(MAKE_LOWER_TAGS, ${CTAGS:-ctags}, yes, no) 142320d2c4d2Smrg 142420d2c4d2Smrgif test "$cf_cv_mixedcase" = yes ; then 14256879286fSmrg AC_CHECK_PROG(MAKE_UPPER_TAGS, ${ETAGS:-etags}, yes, no) 142620d2c4d2Smrgelse 142720d2c4d2Smrg MAKE_UPPER_TAGS=no 142820d2c4d2Smrgfi 142920d2c4d2Smrg 143020d2c4d2Smrgif test "$MAKE_UPPER_TAGS" = yes ; then 143120d2c4d2Smrg MAKE_UPPER_TAGS= 143220d2c4d2Smrgelse 143320d2c4d2Smrg MAKE_UPPER_TAGS="#" 143420d2c4d2Smrgfi 143520d2c4d2Smrg 143620d2c4d2Smrgif test "$MAKE_LOWER_TAGS" = yes ; then 143720d2c4d2Smrg MAKE_LOWER_TAGS= 143820d2c4d2Smrgelse 143920d2c4d2Smrg MAKE_LOWER_TAGS="#" 144020d2c4d2Smrgfi 144120d2c4d2Smrg 144220d2c4d2SmrgAC_SUBST(CTAGS) 144320d2c4d2SmrgAC_SUBST(ETAGS) 144420d2c4d2Smrg 144520d2c4d2SmrgAC_SUBST(MAKE_UPPER_TAGS) 144620d2c4d2SmrgAC_SUBST(MAKE_LOWER_TAGS) 144720d2c4d2Smrg])dnl 144820d2c4d2Smrgdnl --------------------------------------------------------------------------- 14490bd37d32Smrgdnl CF_MIXEDCASE_FILENAMES version: 4 updated: 2012/10/02 20:55:03 145020d2c4d2Smrgdnl ---------------------- 145120d2c4d2Smrgdnl Check if the file-system supports mixed-case filenames. If we're able to 145220d2c4d2Smrgdnl create a lowercase name and see it as uppercase, it doesn't support that. 145320d2c4d2SmrgAC_DEFUN([CF_MIXEDCASE_FILENAMES], 145420d2c4d2Smrg[ 145520d2c4d2SmrgAC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[ 145620d2c4d2Smrgif test "$cross_compiling" = yes ; then 145720d2c4d2Smrg case $target_alias in #(vi 145820d2c4d2Smrg *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-mingw32*|*-uwin*) #(vi 145920d2c4d2Smrg cf_cv_mixedcase=no 146020d2c4d2Smrg ;; 146120d2c4d2Smrg *) 146220d2c4d2Smrg cf_cv_mixedcase=yes 146320d2c4d2Smrg ;; 146420d2c4d2Smrg esac 146520d2c4d2Smrgelse 146620d2c4d2Smrg rm -f conftest CONFTEST 146720d2c4d2Smrg echo test >conftest 146820d2c4d2Smrg if test -f CONFTEST ; then 146920d2c4d2Smrg cf_cv_mixedcase=no 147020d2c4d2Smrg else 147120d2c4d2Smrg cf_cv_mixedcase=yes 147220d2c4d2Smrg fi 147320d2c4d2Smrg rm -f conftest CONFTEST 147420d2c4d2Smrgfi 147520d2c4d2Smrg]) 14760bd37d32Smrgtest "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if filesystem supports mixed-case filenames.]) 147720d2c4d2Smrg])dnl 147820d2c4d2Smrgdnl --------------------------------------------------------------------------- 14796879286fSmrgdnl CF_MSG_LOG version: 5 updated: 2010/10/23 15:52:32 1480d522f475Smrgdnl ---------- 1481d522f475Smrgdnl Write a debug message to config.log, along with the line number in the 1482d522f475Smrgdnl configure script. 1483d522f475SmrgAC_DEFUN([CF_MSG_LOG],[ 14846879286fSmrgecho "${as_me:-configure}:__oline__: testing $* ..." 1>&AC_FD_CC 1485d522f475Smrg])dnl 1486d522f475Smrgdnl --------------------------------------------------------------------------- 14870bd37d32Smrgdnl CF_NO_LEAKS_OPTION version: 5 updated: 2012/10/02 20:55:03 14880bd37d32Smrgdnl ------------------ 14890bd37d32Smrgdnl see CF_WITH_NO_LEAKS 14900bd37d32SmrgAC_DEFUN([CF_NO_LEAKS_OPTION],[ 14910bd37d32SmrgAC_MSG_CHECKING(if you want to use $1 for testing) 14920bd37d32SmrgAC_ARG_WITH($1, 14930bd37d32Smrg [$2], 14940bd37d32Smrg [AC_DEFINE_UNQUOTED($3,1,"Define to 1 if you want to use $1 for testing.")ifelse([$4],,[ 14950bd37d32Smrg $4 14960bd37d32Smrg]) 14970bd37d32Smrg : ${with_cflags:=-g} 14980bd37d32Smrg : ${with_no_leaks:=yes} 14990bd37d32Smrg with_$1=yes], 15000bd37d32Smrg [with_$1=]) 15010bd37d32SmrgAC_MSG_RESULT(${with_$1:-no}) 15020bd37d32Smrg 15030bd37d32Smrgcase .$with_cflags in #(vi 15040bd37d32Smrg.*-g*) 15050bd37d32Smrg case .$CFLAGS in #(vi 15060bd37d32Smrg .*-g*) #(vi 15070bd37d32Smrg ;; 15080bd37d32Smrg *) 15090bd37d32Smrg CF_ADD_CFLAGS([-g]) 15100bd37d32Smrg ;; 15110bd37d32Smrg esac 15120bd37d32Smrg ;; 15130bd37d32Smrgesac 15140bd37d32Smrg])dnl 15150bd37d32Smrgdnl --------------------------------------------------------------------------- 15160bd37d32Smrgdnl CF_PATHSEP version: 6 updated: 2012/09/29 18:38:12 1517956cc18dSsnjdnl ---------- 15180bd37d32Smrgdnl Provide a value for the $PATH and similar separator (or amend the value 15190bd37d32Smrgdnl as provided in autoconf 2.5x). 1520956cc18dSsnjAC_DEFUN([CF_PATHSEP], 1521956cc18dSsnj[ 15220bd37d32Smrg AC_MSG_CHECKING(for PATH separator) 1523956cc18dSsnj case $cf_cv_system_name in 1524956cc18dSsnj os2*) PATH_SEPARATOR=';' ;; 15250bd37d32Smrg *) ${PATH_SEPARATOR:=':'} ;; 1526956cc18dSsnj esac 152720d2c4d2Smrgifelse([$1],,,[$1=$PATH_SEPARATOR]) 1528956cc18dSsnj AC_SUBST(PATH_SEPARATOR) 15290bd37d32Smrg AC_MSG_RESULT($PATH_SEPARATOR) 1530956cc18dSsnj])dnl 1531956cc18dSsnjdnl --------------------------------------------------------------------------- 15320bd37d32Smrgdnl CF_PATH_PROG version: 9 updated: 2012/10/04 20:12:20 1533d522f475Smrgdnl ------------ 1534d522f475Smrgdnl Check for a given program, defining corresponding symbol. 1535d522f475Smrgdnl $1 = environment variable, which is suffixed by "_PATH" in the #define. 1536d522f475Smrgdnl $2 = program name to find. 1537d522f475Smrgdnl $3 = optional list of additional program names to test. 1538d522f475Smrgdnl 1539d522f475Smrgdnl If there is more than one token in the result, #define the remaining tokens 1540d522f475Smrgdnl to $1_ARGS. We need this for 'install' in particular. 1541d522f475Smrgdnl 1542d522f475Smrgdnl FIXME: we should allow this to be overridden by environment variables 1543d522f475Smrgdnl 1544d522f475SmrgAC_DEFUN([CF_PATH_PROG],[ 1545956cc18dSsnjAC_REQUIRE([CF_PATHSEP]) 1546d522f475Smrgtest -z "[$]$1" && $1=$2 1547d522f475SmrgAC_PATH_PROGS($1,[$]$1 $2 $3,[$]$1) 1548d522f475Smrg 1549d522f475Smrgcf_path_prog="" 1550d522f475Smrgcf_path_args="" 15516879286fSmrgIFS="${IFS:- }"; cf_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR" 1552d522f475Smrgfor cf_temp in $ac_cv_path_$1 1553d522f475Smrgdo 1554d522f475Smrg if test -z "$cf_path_prog" ; then 1555d522f475Smrg if test "$with_full_paths" = yes ; then 1556d522f475Smrg CF_PATH_SYNTAX(cf_temp,break) 1557d522f475Smrg cf_path_prog="$cf_temp" 1558d522f475Smrg else 1559d522f475Smrg cf_path_prog="`basename $cf_temp`" 1560d522f475Smrg fi 1561d522f475Smrg elif test -z "$cf_path_args" ; then 1562d522f475Smrg cf_path_args="$cf_temp" 1563d522f475Smrg else 1564d522f475Smrg cf_path_args="$cf_path_args $cf_temp" 1565d522f475Smrg fi 1566d522f475Smrgdone 1567d522f475SmrgIFS="$cf_save_ifs" 1568d522f475Smrg 1569d522f475Smrgif test -n "$cf_path_prog" ; then 1570d522f475Smrg CF_MSG_LOG(defining path for ${cf_path_prog}) 15710bd37d32Smrg AC_DEFINE_UNQUOTED($1_PATH,"$cf_path_prog",Define to pathname $1) 15720bd37d32Smrg test -n "$cf_path_args" && AC_DEFINE_UNQUOTED($1_ARGS,"$cf_path_args",Define to provide args for $1) 1573d522f475Smrgfi 1574d522f475Smrg])dnl 1575d522f475Smrgdnl --------------------------------------------------------------------------- 15760bd37d32Smrgdnl CF_PATH_SYNTAX version: 14 updated: 2012/06/19 20:58:54 1577d522f475Smrgdnl -------------- 1578d522f475Smrgdnl Check the argument to see that it looks like a pathname. Rewrite it if it 1579d522f475Smrgdnl begins with one of the prefix/exec_prefix variables, and then again if the 1580d522f475Smrgdnl result begins with 'NONE'. This is necessary to work around autoconf's 1581d522f475Smrgdnl delayed evaluation of those symbols. 1582d522f475SmrgAC_DEFUN([CF_PATH_SYNTAX],[ 1583d522f475Smrgif test "x$prefix" != xNONE; then 1584d522f475Smrg cf_path_syntax="$prefix" 1585d522f475Smrgelse 1586d522f475Smrg cf_path_syntax="$ac_default_prefix" 1587d522f475Smrgfi 1588d522f475Smrg 1589d522f475Smrgcase ".[$]$1" in #(vi 1590d522f475Smrg.\[$]\(*\)*|.\'*\'*) #(vi 1591d522f475Smrg ;; 1592d522f475Smrg..|./*|.\\*) #(vi 1593d522f475Smrg ;; 1594d522f475Smrg.[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX 1595d522f475Smrg ;; 15960bd37d32Smrg.\[$]{*prefix}*|.\[$]{*dir}*) #(vi 1597d522f475Smrg eval $1="[$]$1" 1598d522f475Smrg case ".[$]$1" in #(vi 1599d522f475Smrg .NONE/*) 1600d522f475Smrg $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%` 1601d522f475Smrg ;; 1602d522f475Smrg esac 1603d522f475Smrg ;; #(vi 1604d522f475Smrg.no|.NONE/*) 1605d522f475Smrg $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%` 1606d522f475Smrg ;; 1607d522f475Smrg*) 160820d2c4d2Smrg ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2) 1609d522f475Smrg ;; 1610d522f475Smrgesac 1611d522f475Smrg])dnl 1612d522f475Smrgdnl --------------------------------------------------------------------------- 1613e39b573cSmrgdnl CF_PKG_CONFIG version: 7 updated: 2011/04/29 04:53:22 1614956cc18dSsnjdnl ------------- 1615956cc18dSsnjdnl Check for the package-config program, unless disabled by command-line. 1616956cc18dSsnjAC_DEFUN([CF_PKG_CONFIG], 1617956cc18dSsnj[ 1618956cc18dSsnjAC_MSG_CHECKING(if you want to use pkg-config) 1619956cc18dSsnjAC_ARG_WITH(pkg-config, 1620956cc18dSsnj [ --with-pkg-config{=path} enable/disable use of pkg-config], 1621956cc18dSsnj [cf_pkg_config=$withval], 1622956cc18dSsnj [cf_pkg_config=yes]) 1623956cc18dSsnjAC_MSG_RESULT($cf_pkg_config) 1624956cc18dSsnj 1625956cc18dSsnjcase $cf_pkg_config in #(vi 1626956cc18dSsnjno) #(vi 1627956cc18dSsnj PKG_CONFIG=none 1628956cc18dSsnj ;; 1629956cc18dSsnjyes) #(vi 1630e39b573cSmrg CF_ACVERSION_CHECK(2.52, 1631e39b573cSmrg [AC_PATH_TOOL(PKG_CONFIG, pkg-config, none)], 1632e39b573cSmrg [AC_PATH_PROG(PKG_CONFIG, pkg-config, none)]) 1633956cc18dSsnj ;; 1634956cc18dSsnj*) 1635956cc18dSsnj PKG_CONFIG=$withval 1636956cc18dSsnj ;; 1637956cc18dSsnjesac 1638956cc18dSsnj 1639956cc18dSsnjtest -z "$PKG_CONFIG" && PKG_CONFIG=none 1640956cc18dSsnjif test "$PKG_CONFIG" != none ; then 1641956cc18dSsnj CF_PATH_SYNTAX(PKG_CONFIG) 1642956cc18dSsnjfi 1643956cc18dSsnj 1644956cc18dSsnjAC_SUBST(PKG_CONFIG) 1645956cc18dSsnj])dnl 1646956cc18dSsnjdnl --------------------------------------------------------------------------- 164720d2c4d2Smrgdnl CF_POSIX_C_SOURCE version: 8 updated: 2010/05/26 05:38:42 1648d522f475Smrgdnl ----------------- 1649d522f475Smrgdnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed. 1650d522f475Smrgdnl 1651d522f475Smrgdnl POSIX.1-1990 _POSIX_SOURCE 1652d522f475Smrgdnl POSIX.1-1990 and _POSIX_SOURCE and 1653d522f475Smrgdnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2 1654d522f475Smrgdnl Bindings Option 1655d522f475Smrgdnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L 1656d522f475Smrgdnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L 1657d522f475Smrgdnl X/Open 2000 _POSIX_C_SOURCE=200112L 1658d522f475Smrgdnl 1659d522f475Smrgdnl Parameters: 1660d522f475Smrgdnl $1 is the nominal value for _POSIX_C_SOURCE 1661d522f475SmrgAC_DEFUN([CF_POSIX_C_SOURCE], 1662d522f475Smrg[ 166320d2c4d2Smrgcf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1]) 1664d522f475Smrg 1665d522f475Smrgcf_save_CFLAGS="$CFLAGS" 1666d522f475Smrgcf_save_CPPFLAGS="$CPPFLAGS" 1667d522f475Smrg 1668d522f475SmrgCF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE) 1669d522f475SmrgCF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE) 1670d522f475Smrg 1671d522f475SmrgAC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[ 1672d522f475Smrg CF_MSG_LOG(if the symbol is already defined go no further) 1673d522f475Smrg AC_TRY_COMPILE([#include <sys/types.h>],[ 1674d522f475Smrg#ifndef _POSIX_C_SOURCE 1675d522f475Smrgmake an error 1676d522f475Smrg#endif], 1677d522f475Smrg [cf_cv_posix_c_source=no], 1678d522f475Smrg [cf_want_posix_source=no 1679d522f475Smrg case .$cf_POSIX_C_SOURCE in #(vi 1680d522f475Smrg .[[12]]??*) #(vi 1681d522f475Smrg cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" 1682d522f475Smrg ;; 1683d522f475Smrg .2) #(vi 1684d522f475Smrg cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" 1685d522f475Smrg cf_want_posix_source=yes 1686d522f475Smrg ;; 1687d522f475Smrg .*) 1688d522f475Smrg cf_want_posix_source=yes 1689d522f475Smrg ;; 1690d522f475Smrg esac 1691d522f475Smrg if test "$cf_want_posix_source" = yes ; then 1692d522f475Smrg AC_TRY_COMPILE([#include <sys/types.h>],[ 1693d522f475Smrg#ifdef _POSIX_SOURCE 1694d522f475Smrgmake an error 1695d522f475Smrg#endif],[], 1696d522f475Smrg cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE") 1697d522f475Smrg fi 1698d522f475Smrg CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE) 1699d522f475Smrg CFLAGS="$cf_trim_CFLAGS" 1700d522f475Smrg CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source" 1701d522f475Smrg CF_MSG_LOG(if the second compile does not leave our definition intact error) 1702d522f475Smrg AC_TRY_COMPILE([#include <sys/types.h>],[ 1703d522f475Smrg#ifndef _POSIX_C_SOURCE 1704d522f475Smrgmake an error 1705d522f475Smrg#endif],, 1706d522f475Smrg [cf_cv_posix_c_source=no]) 1707d522f475Smrg CFLAGS="$cf_save_CFLAGS" 1708d522f475Smrg CPPFLAGS="$cf_save_CPPFLAGS" 1709d522f475Smrg ]) 1710d522f475Smrg]) 1711d522f475Smrg 1712d522f475Smrgif test "$cf_cv_posix_c_source" != no ; then 1713d522f475Smrg CFLAGS="$cf_trim_CFLAGS" 1714d522f475Smrg CPPFLAGS="$cf_trim_CPPFLAGS" 171520d2c4d2Smrg CF_ADD_CFLAGS($cf_cv_posix_c_source) 1716d522f475Smrgfi 1717d522f475Smrg 1718d522f475Smrg])dnl 1719d522f475Smrgdnl --------------------------------------------------------------------------- 17200bd37d32Smrgdnl CF_POSIX_SAVED_IDS version: 8 updated: 2012/10/04 20:12:20 1721d522f475Smrgdnl ------------------ 1722d522f475Smrgdnl 1723d522f475Smrgdnl Check first if saved-ids are always supported. Some systems 1724d522f475Smrgdnl may require runtime checks. 1725d522f475SmrgAC_DEFUN([CF_POSIX_SAVED_IDS], 1726d522f475Smrg[ 1727d522f475SmrgAC_CHECK_HEADERS( \ 1728d522f475Smrgsys/param.h \ 1729d522f475Smrg) 1730d522f475Smrg 1731d522f475SmrgAC_CACHE_CHECK(if POSIX saved-ids are supported,cf_cv_posix_saved_ids,[ 1732d522f475SmrgAC_TRY_LINK( 1733d522f475Smrg[ 1734d522f475Smrg#include <unistd.h> 1735d522f475Smrg#ifdef HAVE_SYS_PARAM_H 1736d522f475Smrg#include <sys/param.h> /* this may define "BSD" */ 1737d522f475Smrg#endif 1738d522f475Smrg],[ 1739d522f475Smrg#if defined(_POSIX_SAVED_IDS) && (_POSIX_SAVED_IDS > 0) 1740d522f475Smrg void *p = (void *) seteuid; 1741d522f475Smrg int x = seteuid(geteuid()); 1742d522f475Smrg#elif defined(BSD) && (BSD >= 199103) 1743d522f475Smrg/* The BSD's may implement the runtime check - and it fails. 1744d522f475Smrg * However, saved-ids work almost like POSIX (close enough for most uses). 1745d522f475Smrg */ 1746d522f475Smrg#else 1747d522f475Smrgmake an error 1748d522f475Smrg#endif 1749d522f475Smrg],[cf_cv_posix_saved_ids=yes 1750d522f475Smrg],[ 1751d522f475SmrgAC_TRY_RUN([ 1752d522f475Smrg#ifdef HAVE_STDLIB_H 1753d522f475Smrg#include <stdlib.h> 1754d522f475Smrg#endif 1755d522f475Smrg#include <unistd.h> 1756d522f475Smrgint main() 1757d522f475Smrg{ 1758d522f475Smrg void *p = (void *) seteuid; 1759d522f475Smrg long code = sysconf(_SC_SAVED_IDS); 1760d522f475Smrg ${cf_cv_main_return:-return} ((code > 0) ? 0 : 1); 1761d522f475Smrg}], 1762d522f475Smrg cf_cv_posix_saved_ids=yes, 1763d522f475Smrg cf_cv_posix_saved_ids=no, 1764d522f475Smrg cf_cv_posix_saved_ids=unknown) 1765d522f475Smrg]) 1766d522f475Smrg]) 1767d522f475Smrg 17680bd37d32Smrgtest "$cf_cv_posix_saved_ids" = yes && AC_DEFINE(HAVE_POSIX_SAVED_IDS,1,[Define to 1 if POSIX saved-ids are supported]) 1769d522f475Smrg]) 1770d522f475Smrgdnl --------------------------------------------------------------------------- 17710bd37d32Smrgdnl CF_POSIX_WAIT version: 3 updated: 2012/10/04 20:12:20 1772d522f475Smrgdnl ------------- 1773d522f475Smrgdnl Check for POSIX wait support 1774d522f475SmrgAC_DEFUN([CF_POSIX_WAIT], 1775d522f475Smrg[ 1776d522f475SmrgAC_REQUIRE([AC_HEADER_SYS_WAIT]) 1777d522f475SmrgAC_CACHE_CHECK(for POSIX wait functions,cf_cv_posix_wait,[ 1778d522f475SmrgAC_TRY_LINK([ 1779d522f475Smrg#include <stdlib.h> 1780d522f475Smrg#include <stdio.h> 1781d522f475Smrg#include <sys/types.h> 1782d522f475Smrg#ifdef HAVE_SYS_WAIT_H 1783d522f475Smrg#include <sys/wait.h> 1784d522f475Smrg#endif 1785d522f475Smrg],[ 1786d522f475Smrg int stat_loc; 1787d522f475Smrg pid_t pid = waitpid(-1, &stat_loc, WNOHANG|WUNTRACED); 1788d522f475Smrg pid_t pid2 = wait(&stat_loc); 1789d522f475Smrg], 1790d522f475Smrg[cf_cv_posix_wait=yes], 1791d522f475Smrg[cf_cv_posix_wait=no]) 1792d522f475Smrg]) 17930bd37d32Smrgtest "$cf_cv_posix_wait" = yes && AC_DEFINE(USE_POSIX_WAIT,1,[Define to 1 if we have POSIX wait functions]) 1794d522f475Smrg])dnl 1795d522f475Smrgdnl --------------------------------------------------------------------------- 1796d522f475Smrgdnl CF_PROCFS_CWD version: 2 updated: 2007/03/12 20:39:04 1797d522f475Smrgdnl ------------- 1798d522f475Smrgdnl Find /proc tree (may be in a different place) which implements the "cwd" 1799d522f475Smrgdnl link. 1800d522f475SmrgAC_DEFUN([CF_PROCFS_CWD],[ 1801d522f475SmrgAC_CACHE_CHECK(for proc tree with cwd-support,cf_cv_procfs_cwd,[ 1802d522f475Smrgcf_cv_procfs_cwd=no 1803d522f475Smrgfor cf_path in /proc /compat/linux/proc /usr/compat/linux/proc 1804d522f475Smrgdo 1805d522f475Smrg if test -d $cf_path && \ 1806d522f475Smrg test -d $cf_path/$$ && \ 1807d522f475Smrg ( test -d $cf_path/$$/cwd || \ 1808d522f475Smrg test -L $cf_path/$$/cwd ); then 1809d522f475Smrg cf_cv_procfs_cwd=$cf_path 1810d522f475Smrg break 1811d522f475Smrg fi 1812d522f475Smrgdone 1813d522f475Smrg]) 1814d522f475Smrg])dnl 1815d522f475Smrgdnl --------------------------------------------------------------------------- 18160bd37d32Smrgdnl CF_PROG_CC version: 3 updated: 2012/10/06 15:31:55 18170bd37d32Smrgdnl ---------- 18180bd37d32Smrgdnl standard check for CC, plus followup sanity checks 18190bd37d32Smrgdnl $1 = optional parameter to pass to AC_PROG_CC to specify compiler name 18200bd37d32SmrgAC_DEFUN([CF_PROG_CC],[ 18210bd37d32Smrgifelse($1,,[AC_PROG_CC],[AC_PROG_CC($1)]) 18220bd37d32SmrgCF_GCC_VERSION 18230bd37d32SmrgCF_ACVERSION_CHECK(2.52, 18240bd37d32Smrg [AC_PROG_CC_STDC], 18250bd37d32Smrg [CF_ANSI_CC_REQD]) 18260bd37d32SmrgCF_CC_ENV_FLAGS 1827d522f475Smrg])dnl 1828d522f475Smrgdnl --------------------------------------------------------------------------- 18290bd37d32Smrgdnl CF_PROG_GROFF version: 1 updated: 2013/01/02 20:37:18 18300bd37d32Smrgdnl ------------- 18310bd37d32Smrgdnl Check if groff is available, for cases (such as html output) where nroff 18320bd37d32Smrgdnl is not enough. 18330bd37d32SmrgAC_DEFUN([CF_PROG_GROFF],[ 18340bd37d32SmrgAC_PATH_PROG(GROFF_PATH,groff,no) 18350bd37d32Smrgif test "x$GROFF_PATH" = xno 18360bd37d32Smrgthen 18370bd37d32Smrg NROFF_NOTE= 18380bd37d32Smrg GROFF_NOTE="#" 18390bd37d32Smrgelse 18400bd37d32Smrg NROFF_NOTE="#" 18410bd37d32Smrg GROFF_NOTE= 18420bd37d32Smrgfi 18430bd37d32SmrgAC_SUBST(GROFF_PATH) 18440bd37d32SmrgAC_SUBST(GROFF_NOTE) 18450bd37d32SmrgAC_SUBST(NROFF_NOTE) 1846d522f475Smrg])dnl 1847d522f475Smrgdnl --------------------------------------------------------------------------- 18480bd37d32Smrgdnl CF_REGEX version: 10 updated: 2012/10/04 20:12:20 1849d522f475Smrgdnl -------- 1850d522f475Smrgdnl Attempt to determine if we've got one of the flavors of regular-expression 1851d522f475Smrgdnl code that we can support. 1852d522f475SmrgAC_DEFUN([CF_REGEX], 1853d522f475Smrg[ 185420d2c4d2Smrg 185520d2c4d2Smrgcf_regex_func=no 185620d2c4d2Smrg 18576879286fSmrgcf_regex_libs="regex re" 18586879286fSmrgcase $host_os in #(vi 18596879286fSmrgmingw*) 18600bd37d32Smrg cf_regex_libs="gnurx $cf_regex_libs" 18616879286fSmrg ;; 18626879286fSmrgesac 18636879286fSmrg 186420d2c4d2SmrgAC_CHECK_FUNC(regcomp,[cf_regex_func=regcomp],[ 18656879286fSmrg for cf_regex_lib in $cf_regex_libs 186620d2c4d2Smrg do 186720d2c4d2Smrg AC_CHECK_LIB($cf_regex_lib,regcomp,[ 186820d2c4d2Smrg CF_ADD_LIB($cf_regex_lib) 186920d2c4d2Smrg cf_regex_func=regcomp 187020d2c4d2Smrg break]) 187120d2c4d2Smrg done 187220d2c4d2Smrg]) 187320d2c4d2Smrg 187420d2c4d2Smrgif test "$cf_regex_func" = no ; then 187520d2c4d2Smrg AC_CHECK_FUNC(compile,[cf_regex_func=compile],[ 187620d2c4d2Smrg AC_CHECK_LIB(gen,compile,[ 187720d2c4d2Smrg CF_ADD_LIB(gen) 187820d2c4d2Smrg cf_regex_func=compile])]) 187920d2c4d2Smrgfi 188020d2c4d2Smrg 188120d2c4d2Smrgif test "$cf_regex_func" = no ; then 188220d2c4d2Smrg AC_MSG_WARN(cannot find regular expression library) 188320d2c4d2Smrgfi 188420d2c4d2Smrg 188520d2c4d2SmrgAC_CACHE_CHECK(for regular-expression headers,cf_cv_regex_hdrs,[ 188620d2c4d2Smrg 188720d2c4d2Smrgcf_cv_regex_hdrs=no 188820d2c4d2Smrgcase $cf_regex_func in #(vi 188920d2c4d2Smrgcompile) #(vi 189020d2c4d2Smrg for cf_regex_hdr in regexp.h regexpr.h 189120d2c4d2Smrg do 189220d2c4d2Smrg AC_TRY_LINK([#include <$cf_regex_hdr>],[ 189320d2c4d2Smrg char *p = compile("", "", "", 0); 1894d522f475Smrg int x = step("", ""); 189520d2c4d2Smrg ],[ 189620d2c4d2Smrg cf_cv_regex_hdrs=$cf_regex_hdr 189720d2c4d2Smrg break 189820d2c4d2Smrg ]) 189920d2c4d2Smrg done 190020d2c4d2Smrg ;; 190120d2c4d2Smrg*) 190220d2c4d2Smrg for cf_regex_hdr in regex.h 190320d2c4d2Smrg do 190420d2c4d2Smrg AC_TRY_LINK([#include <sys/types.h> 190520d2c4d2Smrg#include <$cf_regex_hdr>],[ 190620d2c4d2Smrg regex_t *p; 190720d2c4d2Smrg int x = regcomp(p, "", 0); 190820d2c4d2Smrg int y = regexec(p, "", 0, 0, 0); 190920d2c4d2Smrg regfree(p); 191020d2c4d2Smrg ],[ 191120d2c4d2Smrg cf_cv_regex_hdrs=$cf_regex_hdr 191220d2c4d2Smrg break 191320d2c4d2Smrg ]) 191420d2c4d2Smrg done 191520d2c4d2Smrg ;; 191620d2c4d2Smrgesac 191720d2c4d2Smrg 1918d522f475Smrg]) 191920d2c4d2Smrg 192020d2c4d2Smrgcase $cf_cv_regex_hdrs in #(vi 192120d2c4d2Smrg no) AC_MSG_WARN(no regular expression header found) ;; #(vi 19220bd37d32Smrg regex.h) AC_DEFINE(HAVE_REGEX_H_FUNCS,1,[Define to 1 to include regex.h for regular expressions]) ;; #(vi 19230bd37d32Smrg regexp.h) AC_DEFINE(HAVE_REGEXP_H_FUNCS,1,[Define to 1 to include regexp.h for regular expressions]) ;; #(vi 19240bd37d32Smrg regexpr.h) AC_DEFINE(HAVE_REGEXPR_H_FUNCS,1,[Define to 1 to include regexpr.h for regular expressions]) ;; 1925d522f475Smrgesac 1926d522f475Smrg])dnl 1927d522f475Smrgdnl --------------------------------------------------------------------------- 192820d2c4d2Smrgdnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50 1929d522f475Smrgdnl ---------------- 1930d522f475Smrgdnl Remove all -U and -D options that refer to the given symbol from a list 1931d522f475Smrgdnl of C compiler options. This works around the problem that not all 1932d522f475Smrgdnl compilers process -U and -D options from left-to-right, so a -U option 1933d522f475Smrgdnl cannot be used to cancel the effect of a preceding -D option. 1934d522f475Smrgdnl 1935d522f475Smrgdnl $1 = target (which could be the same as the source variable) 1936d522f475Smrgdnl $2 = source (including '$') 1937d522f475Smrgdnl $3 = symbol to remove 1938d522f475Smrgdefine([CF_REMOVE_DEFINE], 1939d522f475Smrg[ 1940d522f475Smrg$1=`echo "$2" | \ 194120d2c4d2Smrg sed -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[[ ]]/ /g' \ 194220d2c4d2Smrg -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'` 194320d2c4d2Smrg])dnl 194420d2c4d2Smrgdnl --------------------------------------------------------------------------- 1945a1f3da82Smrgdnl CF_RPATH_HACK version: 9 updated: 2011/02/13 13:31:33 194620d2c4d2Smrgdnl ------------- 194720d2c4d2SmrgAC_DEFUN([CF_RPATH_HACK], 194820d2c4d2Smrg[ 194920d2c4d2SmrgAC_REQUIRE([CF_LD_RPATH_OPT]) 195020d2c4d2SmrgAC_MSG_CHECKING(for updated LDFLAGS) 195120d2c4d2Smrgif test -n "$LD_RPATH_OPT" ; then 195220d2c4d2Smrg AC_MSG_RESULT(maybe) 195320d2c4d2Smrg 195420d2c4d2Smrg AC_CHECK_PROGS(cf_ldd_prog,ldd,no) 195520d2c4d2Smrg cf_rpath_list="/usr/lib /lib" 195620d2c4d2Smrg if test "$cf_ldd_prog" != no 195720d2c4d2Smrg then 1958a1f3da82Smrg cf_rpath_oops= 1959a1f3da82Smrg 196020d2c4d2SmrgAC_TRY_LINK([#include <stdio.h>], 196120d2c4d2Smrg [printf("Hello");], 1962a1f3da82Smrg [cf_rpath_oops=`$cf_ldd_prog conftest$ac_exeext | fgrep ' not found' | sed -e 's% =>.*$%%' |sort -u` 1963a1f3da82Smrg cf_rpath_list=`$cf_ldd_prog conftest$ac_exeext | fgrep / | sed -e 's%^.*[[ ]]/%/%' -e 's%/[[^/]][[^/]]*$%%' |sort -u`]) 1964a1f3da82Smrg 1965a1f3da82Smrg # If we passed the link-test, but get a "not found" on a given library, 1966a1f3da82Smrg # this could be due to inept reconfiguration of gcc to make it only 1967a1f3da82Smrg # partly honor /usr/local/lib (or whatever). Sometimes this behavior 1968a1f3da82Smrg # is intentional, e.g., installing gcc in /usr/bin and suppressing the 1969a1f3da82Smrg # /usr/local libraries. 1970a1f3da82Smrg if test -n "$cf_rpath_oops" 1971a1f3da82Smrg then 1972a1f3da82Smrg for cf_rpath_src in $cf_rpath_oops 1973a1f3da82Smrg do 1974a1f3da82Smrg for cf_rpath_dir in \ 1975a1f3da82Smrg /usr/local \ 1976a1f3da82Smrg /usr/pkg \ 1977a1f3da82Smrg /opt/sfw 1978a1f3da82Smrg do 1979a1f3da82Smrg if test -f $cf_rpath_dir/lib/$cf_rpath_src 1980a1f3da82Smrg then 1981a1f3da82Smrg CF_VERBOSE(...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src) 1982a1f3da82Smrg LDFLAGS="$LDFLAGS -L$cf_rpath_dir/lib" 1983a1f3da82Smrg break 1984a1f3da82Smrg fi 1985a1f3da82Smrg done 1986a1f3da82Smrg done 1987a1f3da82Smrg fi 198820d2c4d2Smrg fi 198920d2c4d2Smrg 199020d2c4d2Smrg CF_VERBOSE(...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS) 199120d2c4d2Smrg 199220d2c4d2Smrg CF_RPATH_HACK_2(LDFLAGS) 199320d2c4d2Smrg CF_RPATH_HACK_2(LIBS) 199420d2c4d2Smrg 199520d2c4d2Smrg CF_VERBOSE(...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS) 199620d2c4d2Smrgfi 199720d2c4d2SmrgAC_SUBST(EXTRA_LDFLAGS) 199820d2c4d2Smrg])dnl 199920d2c4d2Smrgdnl --------------------------------------------------------------------------- 200020d2c4d2Smrgdnl CF_RPATH_HACK_2 version: 6 updated: 2010/04/17 16:31:24 200120d2c4d2Smrgdnl --------------- 200220d2c4d2Smrgdnl Do one set of substitutions for CF_RPATH_HACK, adding an rpath option to 200320d2c4d2Smrgdnl EXTRA_LDFLAGS for each -L option found. 200420d2c4d2Smrgdnl 200520d2c4d2Smrgdnl $cf_rpath_list contains a list of directories to ignore. 200620d2c4d2Smrgdnl 200720d2c4d2Smrgdnl $1 = variable name to update. The LDFLAGS variable should be the only one, 200820d2c4d2Smrgdnl but LIBS often has misplaced -L options. 200920d2c4d2SmrgAC_DEFUN([CF_RPATH_HACK_2], 201020d2c4d2Smrg[ 201120d2c4d2SmrgCF_VERBOSE(...checking $1 [$]$1) 201220d2c4d2Smrg 201320d2c4d2Smrgcf_rpath_dst= 201420d2c4d2Smrgfor cf_rpath_src in [$]$1 201520d2c4d2Smrgdo 201620d2c4d2Smrg case $cf_rpath_src in #(vi 201720d2c4d2Smrg -L*) #(vi 201820d2c4d2Smrg 201920d2c4d2Smrg # check if this refers to a directory which we will ignore 202020d2c4d2Smrg cf_rpath_skip=no 202120d2c4d2Smrg if test -n "$cf_rpath_list" 202220d2c4d2Smrg then 202320d2c4d2Smrg for cf_rpath_item in $cf_rpath_list 202420d2c4d2Smrg do 202520d2c4d2Smrg if test "x$cf_rpath_src" = "x-L$cf_rpath_item" 202620d2c4d2Smrg then 202720d2c4d2Smrg cf_rpath_skip=yes 202820d2c4d2Smrg break 202920d2c4d2Smrg fi 203020d2c4d2Smrg done 203120d2c4d2Smrg fi 203220d2c4d2Smrg 203320d2c4d2Smrg if test "$cf_rpath_skip" = no 203420d2c4d2Smrg then 203520d2c4d2Smrg # transform the option 203620d2c4d2Smrg if test "$LD_RPATH_OPT" = "-R " ; then 203720d2c4d2Smrg cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%-R %"` 203820d2c4d2Smrg else 203920d2c4d2Smrg cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%$LD_RPATH_OPT%"` 204020d2c4d2Smrg fi 204120d2c4d2Smrg 204220d2c4d2Smrg # if we have not already added this, add it now 204320d2c4d2Smrg cf_rpath_tst=`echo "$EXTRA_LDFLAGS" | sed -e "s%$cf_rpath_tmp %%"` 204420d2c4d2Smrg if test "x$cf_rpath_tst" = "x$EXTRA_LDFLAGS" 204520d2c4d2Smrg then 204620d2c4d2Smrg CF_VERBOSE(...Filter $cf_rpath_src ->$cf_rpath_tmp) 204720d2c4d2Smrg EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS" 204820d2c4d2Smrg fi 204920d2c4d2Smrg fi 205020d2c4d2Smrg ;; 205120d2c4d2Smrg esac 205220d2c4d2Smrg cf_rpath_dst="$cf_rpath_dst $cf_rpath_src" 205320d2c4d2Smrgdone 205420d2c4d2Smrg$1=$cf_rpath_dst 205520d2c4d2Smrg 205620d2c4d2SmrgCF_VERBOSE(...checked $1 [$]$1) 205720d2c4d2SmrgAC_SUBST(EXTRA_LDFLAGS) 2058d522f475Smrg])dnl 2059d522f475Smrgdnl --------------------------------------------------------------------------- 2060d522f475Smrgdnl CF_SIGWINCH version: 1 updated: 2006/04/02 16:41:09 2061d522f475Smrgdnl ----------- 2062d522f475Smrgdnl Use this macro after CF_XOPEN_SOURCE, but do not require it (not all 2063d522f475Smrgdnl programs need this test). 2064d522f475Smrgdnl 2065d522f475Smrgdnl This is really a MacOS X 10.4.3 workaround. Defining _POSIX_C_SOURCE 2066d522f475Smrgdnl forces SIGWINCH to be undefined (breaks xterm, ncurses). Oddly, the struct 2067d522f475Smrgdnl winsize declaration is left alone - we may revisit this if Apple choose to 2068d522f475Smrgdnl break that part of the interface as well. 2069d522f475SmrgAC_DEFUN([CF_SIGWINCH], 2070d522f475Smrg[ 2071d522f475SmrgAC_CACHE_CHECK(if SIGWINCH is defined,cf_cv_define_sigwinch,[ 2072d522f475Smrg AC_TRY_COMPILE([ 2073d522f475Smrg#include <sys/types.h> 2074d522f475Smrg#include <sys/signal.h> 2075d522f475Smrg],[int x = SIGWINCH], 2076d522f475Smrg [cf_cv_define_sigwinch=yes], 2077d522f475Smrg [AC_TRY_COMPILE([ 2078d522f475Smrg#undef _XOPEN_SOURCE 2079d522f475Smrg#undef _POSIX_SOURCE 2080d522f475Smrg#undef _POSIX_C_SOURCE 2081d522f475Smrg#include <sys/types.h> 2082d522f475Smrg#include <sys/signal.h> 2083d522f475Smrg],[int x = SIGWINCH], 2084d522f475Smrg [cf_cv_define_sigwinch=maybe], 2085d522f475Smrg [cf_cv_define_sigwinch=no]) 2086d522f475Smrg]) 2087d522f475Smrg]) 2088d522f475Smrg 2089d522f475Smrgif test "$cf_cv_define_sigwinch" = maybe ; then 2090d522f475SmrgAC_CACHE_CHECK(for actual SIGWINCH definition,cf_cv_fixup_sigwinch,[ 2091d522f475Smrgcf_cv_fixup_sigwinch=unknown 2092d522f475Smrgcf_sigwinch=32 2093d522f475Smrgwhile test $cf_sigwinch != 1 2094d522f475Smrgdo 2095d522f475Smrg AC_TRY_COMPILE([ 2096d522f475Smrg#undef _XOPEN_SOURCE 2097d522f475Smrg#undef _POSIX_SOURCE 2098d522f475Smrg#undef _POSIX_C_SOURCE 2099d522f475Smrg#include <sys/types.h> 2100d522f475Smrg#include <sys/signal.h> 2101d522f475Smrg],[ 2102d522f475Smrg#if SIGWINCH != $cf_sigwinch 2103d522f475Smrgmake an error 2104d522f475Smrg#endif 2105d522f475Smrgint x = SIGWINCH], 2106d522f475Smrg [cf_cv_fixup_sigwinch=$cf_sigwinch 2107d522f475Smrg break]) 2108d522f475Smrg 2109d522f475Smrgcf_sigwinch=`expr $cf_sigwinch - 1` 2110d522f475Smrgdone 2111d522f475Smrg]) 2112d522f475Smrg 2113d522f475Smrg if test "$cf_cv_fixup_sigwinch" != unknown ; then 2114d522f475Smrg CPPFLAGS="$CPPFLAGS -DSIGWINCH=$cf_cv_fixup_sigwinch" 2115d522f475Smrg fi 2116d522f475Smrgfi 2117d522f475Smrg])dnl 2118d522f475Smrgdnl --------------------------------------------------------------------------- 21190bd37d32Smrgdnl CF_SIG_ATOMIC_T version: 3 updated: 2012/10/04 20:12:20 2120d522f475Smrgdnl --------------- 2121d522f475Smrgdnl signal handler, but there are some gcc depedencies in that recommendation. 2122d522f475Smrgdnl Try anyway. 2123d522f475SmrgAC_DEFUN([CF_SIG_ATOMIC_T], 2124d522f475Smrg[ 2125d522f475SmrgAC_MSG_CHECKING(for signal global datatype) 2126d522f475SmrgAC_CACHE_VAL(cf_cv_sig_atomic_t,[ 2127d522f475Smrg for cf_type in \ 2128d522f475Smrg "volatile sig_atomic_t" \ 2129d522f475Smrg "sig_atomic_t" \ 2130d522f475Smrg "int" 2131d522f475Smrg do 2132d522f475Smrg AC_TRY_COMPILE([ 2133d522f475Smrg#include <sys/types.h> 2134d522f475Smrg#include <signal.h> 2135d522f475Smrg#include <stdio.h> 2136d522f475Smrg 2137d522f475Smrgextern $cf_type x; 2138d522f475Smrg$cf_type x; 2139d522f475Smrgstatic void handler(int sig) 2140d522f475Smrg{ 2141d522f475Smrg x = 5; 2142d522f475Smrg}], 2143d522f475Smrg [signal(SIGINT, handler); 2144d522f475Smrg x = 1], 2145d522f475Smrg [cf_cv_sig_atomic_t=$cf_type], 2146d522f475Smrg [cf_cv_sig_atomic_t=no]) 2147d522f475Smrg test "$cf_cv_sig_atomic_t" != no && break 2148d522f475Smrg done 2149d522f475Smrg ]) 2150d522f475SmrgAC_MSG_RESULT($cf_cv_sig_atomic_t) 21510bd37d32Smrgtest "$cf_cv_sig_atomic_t" != no && AC_DEFINE_UNQUOTED(SIG_ATOMIC_T, $cf_cv_sig_atomic_t,[Define to signal global datatype]) 2152d522f475Smrg])dnl 2153d522f475Smrgdnl --------------------------------------------------------------------------- 21540bd37d32Smrgdnl CF_STRUCT_LASTLOG version: 2 updated: 2012/10/04 20:12:20 2155d522f475Smrgdnl ----------------- 2156d522f475Smrgdnl Check for header defining struct lastlog, ensure that its .ll_time member 2157d522f475Smrgdnl is compatible with time(). 2158d522f475SmrgAC_DEFUN([CF_STRUCT_LASTLOG], 2159d522f475Smrg[ 2160d522f475SmrgAC_CHECK_HEADERS(lastlog.h) 2161d522f475SmrgAC_CACHE_CHECK(for struct lastlog,cf_cv_struct_lastlog,[ 2162d522f475SmrgAC_TRY_RUN([ 2163d522f475Smrg#include <sys/types.h> 2164d522f475Smrg#include <time.h> 2165d522f475Smrg#include <lastlog.h> 2166d522f475Smrg 2167d522f475Smrgint main() 2168d522f475Smrg{ 2169d522f475Smrg struct lastlog data; 2170d522f475Smrg return (sizeof(data.ll_time) != sizeof(time_t)); 2171d522f475Smrg}],[ 2172d522f475Smrgcf_cv_struct_lastlog=yes],[ 2173d522f475Smrgcf_cv_struct_lastlog=no],[ 2174d522f475Smrgcf_cv_struct_lastlog=unknown])]) 2175d522f475Smrg 21760bd37d32Smrgtest $cf_cv_struct_lastlog != no && AC_DEFINE(USE_STRUCT_LASTLOG,1,[Define to 1 if we have struct lastlog]) 2177d522f475Smrg])dnl 2178d522f475Smrgdnl --------------------------------------------------------------------------- 21790bd37d32Smrgdnl CF_SVR4 version: 5 updated: 2012/10/04 05:24:07 2180d522f475Smrgdnl ------- 2181d522f475Smrgdnl Check if this is an SVR4 system. We need the definition for xterm 2182d522f475SmrgAC_DEFUN([CF_SVR4], 2183d522f475Smrg[ 2184d522f475SmrgAC_CHECK_LIB(elf, elf_begin,[ 2185d522f475SmrgAC_CACHE_CHECK(if this is an SVR4 system, cf_cv_svr4,[ 2186d522f475SmrgAC_TRY_COMPILE([ 21870bd37d32Smrg#if defined(__CYGWIN__) 21880bd37d32Smrgmake an error 21890bd37d32Smrg#endif 2190d522f475Smrg#include <elf.h> 2191d522f475Smrg#include <sys/termio.h> 2192d522f475Smrg],[ 2193d522f475Smrgstatic struct termio d_tio; 2194d522f475Smrg d_tio.c_cc[VINTR] = 0; 2195d522f475Smrg d_tio.c_cc[VQUIT] = 0; 2196d522f475Smrg d_tio.c_cc[VERASE] = 0; 2197d522f475Smrg d_tio.c_cc[VKILL] = 0; 2198d522f475Smrg d_tio.c_cc[VEOF] = 0; 2199d522f475Smrg d_tio.c_cc[VEOL] = 0; 2200d522f475Smrg d_tio.c_cc[VMIN] = 0; 2201d522f475Smrg d_tio.c_cc[VTIME] = 0; 2202d522f475Smrg d_tio.c_cc[VLNEXT] = 0; 2203d522f475Smrg], 2204d522f475Smrg[cf_cv_svr4=yes], 2205d522f475Smrg[cf_cv_svr4=no]) 2206d522f475Smrg]) 2207d522f475Smrg]) 22080bd37d32Smrgtest "$cf_cv_svr4" = yes && AC_DEFINE(SVR4,1,[Define to 1 if this is an SVR4 system]) 2209d522f475Smrg])dnl 2210d522f475Smrgdnl --------------------------------------------------------------------------- 22110bd37d32Smrgdnl CF_SYSV version: 15 updated: 2012/10/04 05:24:07 2212d522f475Smrgdnl ------- 2213d522f475Smrgdnl Check if this is a SYSV platform, e.g., as used in <X11/Xos.h>, and whether 2214d522f475Smrgdnl defining it will be helpful. The following features are used to check: 2215d522f475Smrgdnl 2216d522f475Smrgdnl a) bona-fide SVSV doesn't use const for sys_errlist[]. Since this is a 2217d522f475Smrgdnl legacy (pre-ANSI) feature, const should not apply. Modern systems only 2218d522f475Smrgdnl declare strerror(). Xos.h declares the legacy form of str_errlist[], and 2219d522f475Smrgdnl a compile-time error will result from trying to assign to a const array. 2220d522f475Smrgdnl 2221d522f475Smrgdnl b) compile with headers that exist on SYSV hosts. 2222d522f475Smrgdnl 2223d522f475Smrgdnl c) compile with type definitions that differ on SYSV hosts from standard C. 2224d522f475SmrgAC_DEFUN([CF_SYSV], 2225d522f475Smrg[ 2226d522f475SmrgAC_CHECK_HEADERS( \ 2227d522f475Smrgtermios.h \ 2228d522f475Smrgstdlib.h \ 2229d522f475SmrgX11/Intrinsic.h \ 2230d522f475Smrg) 2231d522f475Smrg 2232d522f475SmrgAC_REQUIRE([CF_SYS_ERRLIST]) 2233d522f475Smrg 2234d522f475SmrgAC_CACHE_CHECK(if we should define SYSV,cf_cv_sysv,[ 2235d522f475SmrgAC_TRY_COMPILE([ 2236d522f475Smrg#undef SYSV 2237d522f475Smrg#define SYSV 1 /* get Xos.h to declare sys_errlist[] */ 2238d522f475Smrg#ifdef HAVE_STDLIB_H 2239d522f475Smrg#include <stdlib.h> /* look for wchar_t */ 2240d522f475Smrg#endif 2241d522f475Smrg#ifdef HAVE_X11_INTRINSIC_H 2242d522f475Smrg#include <X11/Intrinsic.h> /* Intrinsic.h has other traps... */ 2243d522f475Smrg#endif 22440bd37d32Smrg#ifdef HAVE_TERMIOS_H /* needed for HPUX 10.20 */ 22450bd37d32Smrg#include <termios.h> 22460bd37d32Smrg#define STRUCT_TERMIOS struct termios 22470bd37d32Smrg#else 22480bd37d32Smrg#define STRUCT_TERMIOS struct termio 22490bd37d32Smrg#endif 2250d522f475Smrg#include <curses.h> 2251d522f475Smrg#include <term.h> /* eliminate most BSD hacks */ 2252d522f475Smrg#include <errno.h> /* declare sys_errlist on older systems */ 2253d522f475Smrg#include <sys/termio.h> /* eliminate most of the remaining ones */ 2254d522f475Smrg],[ 2255d522f475Smrgstatic STRUCT_TERMIOS d_tio; 2256d522f475Smrg d_tio.c_cc[VINTR] = 0; 2257d522f475Smrg d_tio.c_cc[VQUIT] = 0; 2258d522f475Smrg d_tio.c_cc[VERASE] = 0; 2259d522f475Smrg d_tio.c_cc[VKILL] = 0; 2260d522f475Smrg d_tio.c_cc[VEOF] = 0; 2261d522f475Smrg d_tio.c_cc[VEOL] = 0; 2262d522f475Smrg d_tio.c_cc[VMIN] = 0; 2263d522f475Smrg d_tio.c_cc[VTIME] = 0; 2264d522f475Smrg#if defined(HAVE_SYS_ERRLIST) && !defined(DECL_SYS_ERRLIST) 2265d522f475Smrgsys_errlist[0] = ""; /* Cygwin mis-declares this */ 2266d522f475Smrg#endif 2267d522f475Smrg], 2268d522f475Smrg[cf_cv_sysv=yes], 2269d522f475Smrg[cf_cv_sysv=no]) 2270d522f475Smrg]) 22710bd37d32Smrgtest "$cf_cv_sysv" = yes && AC_DEFINE(SYSV,1,[Define to 1 if this is an SYSV system]) 2272d522f475Smrg])dnl 2273d522f475Smrgdnl --------------------------------------------------------------------------- 22740bd37d32Smrgdnl CF_SYSV_UTMP version: 6 updated: 2012/10/04 20:12:20 2275d522f475Smrgdnl ------------ 2276d522f475Smrgdnl Check if this is a SYSV flavor of UTMP 2277d522f475SmrgAC_DEFUN([CF_SYSV_UTMP], 2278d522f475Smrg[ 2279d522f475SmrgAC_CACHE_CHECK(if $cf_cv_have_utmp is SYSV flavor,cf_cv_sysv_utmp,[ 2280d522f475Smrgtest "$cf_cv_have_utmp" = "utmp" && cf_prefix="ut" || cf_prefix="utx" 2281d522f475SmrgAC_TRY_LINK([ 2282d522f475Smrg#include <sys/types.h> 2283d522f475Smrg#include <${cf_cv_have_utmp}.h>],[ 2284d522f475Smrgstruct $cf_cv_have_utmp x; 2285d522f475Smrg set${cf_prefix}ent (); 2286d522f475Smrg get${cf_prefix}id(&x); 2287d522f475Smrg put${cf_prefix}line(&x); 2288d522f475Smrg end${cf_prefix}ent();], 2289d522f475Smrg [cf_cv_sysv_utmp=yes], 2290d522f475Smrg [cf_cv_sysv_utmp=no]) 2291d522f475Smrg]) 22920bd37d32Smrgtest $cf_cv_sysv_utmp = yes && AC_DEFINE(USE_SYSV_UTMP,1,[Define to 1 if utmp is SYSV flavor]) 2293d522f475Smrg])dnl 2294d522f475Smrgdnl --------------------------------------------------------------------------- 2295d522f475Smrgdnl CF_SYS_ERRLIST version: 6 updated: 2001/12/30 13:03:23 2296d522f475Smrgdnl -------------- 2297d522f475Smrgdnl Check for declaration of sys_nerr and sys_errlist in one of stdio.h and 2298d522f475Smrgdnl errno.h. Declaration of sys_errlist on BSD4.4 interferes with our 2299d522f475Smrgdnl declaration. Reported by Keith Bostic. 2300d522f475SmrgAC_DEFUN([CF_SYS_ERRLIST], 2301d522f475Smrg[ 2302d522f475Smrg CF_CHECK_ERRNO(sys_nerr) 2303d522f475Smrg CF_CHECK_ERRNO(sys_errlist) 2304d522f475Smrg])dnl 2305d522f475Smrgdnl --------------------------------------------------------------------------- 23060bd37d32Smrgdnl CF_TERMIO_C_ISPEED version: 3 updated: 2012/10/04 20:12:20 2307d522f475Smrgdnl ------------------ 2308d522f475Smrgdnl Check for SGI's broken redefinition of baud rates introduced in IRIX 6.5 2309d522f475Smrgdnl (there doesn't appear to be a useful predefined symbol). 2310d522f475SmrgAC_DEFUN([CF_TERMIO_C_ISPEED], 2311d522f475Smrg[ 2312d522f475SmrgAC_CACHE_CHECK(for IRIX 6.5 baud-rate redefinitions,cf_cv_termio_c_ispeed,[ 2313d522f475SmrgAC_TRY_COMPILE([ 2314d522f475Smrg#include <sys/types.h> 2315d522f475Smrg#include <sys/termio.h>],[ 2316d522f475Smrgstruct termio foo; 2317d522f475Smrgfoo.c_ispeed = B38400; 2318d522f475Smrgfoo.c_ospeed = B9600; 2319d522f475Smrg],[cf_cv_termio_c_ispeed=yes 2320d522f475Smrg],[cf_cv_termio_c_ispeed=no]) 2321d522f475Smrg]) 23220bd37d32Smrgtest "$cf_cv_termio_c_ispeed" = yes && AC_DEFINE(HAVE_TERMIO_C_ISPEED,1,[define 1 if we have IRIX 6.5 baud-rate redefinitions]) 2323d522f475Smrg])dnl 2324d522f475Smrgdnl --------------------------------------------------------------------------- 232520d2c4d2Smrgdnl CF_TRY_PKG_CONFIG version: 4 updated: 2010/06/14 17:42:30 232620d2c4d2Smrgdnl ----------------- 232720d2c4d2Smrgdnl This is a simple wrapper to use for pkg-config, for libraries which may be 232820d2c4d2Smrgdnl available in that form. 232920d2c4d2Smrgdnl 233020d2c4d2Smrgdnl $1 = package name 233120d2c4d2Smrgdnl $2 = extra logic to use, if any, after updating CFLAGS and LIBS 233220d2c4d2Smrgdnl $3 = logic to use if pkg-config does not have the package 233320d2c4d2SmrgAC_DEFUN([CF_TRY_PKG_CONFIG],[ 233420d2c4d2SmrgAC_REQUIRE([CF_PKG_CONFIG]) 233520d2c4d2Smrg 233620d2c4d2Smrgif test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists $1; then 233720d2c4d2Smrg CF_VERBOSE(found package $1) 233820d2c4d2Smrg cf_pkgconfig_incs="`$PKG_CONFIG --cflags $1 2>/dev/null`" 233920d2c4d2Smrg cf_pkgconfig_libs="`$PKG_CONFIG --libs $1 2>/dev/null`" 234020d2c4d2Smrg CF_VERBOSE(package $1 CFLAGS: $cf_pkgconfig_incs) 234120d2c4d2Smrg CF_VERBOSE(package $1 LIBS: $cf_pkgconfig_libs) 234220d2c4d2Smrg CF_ADD_CFLAGS($cf_pkgconfig_incs) 234320d2c4d2Smrg CF_ADD_LIBS($cf_pkgconfig_libs) 234420d2c4d2Smrg ifelse([$2],,:,[$2]) 234520d2c4d2Smrgelse 234620d2c4d2Smrg ifelse([$3],,:,[$3]) 234720d2c4d2Smrgfi 234820d2c4d2Smrg]) 234920d2c4d2Smrgdnl --------------------------------------------------------------------------- 23500bd37d32Smrgdnl CF_TRY_XOPEN_SOURCE version: 1 updated: 2011/10/30 17:09:50 23510bd37d32Smrgdnl ------------------- 23520bd37d32Smrgdnl If _XOPEN_SOURCE is not defined in the compile environment, check if we 23530bd37d32Smrgdnl can define it successfully. 23540bd37d32SmrgAC_DEFUN([CF_TRY_XOPEN_SOURCE],[ 23550bd37d32SmrgAC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[ 23560bd37d32Smrg AC_TRY_COMPILE([ 23570bd37d32Smrg#include <stdlib.h> 23580bd37d32Smrg#include <string.h> 23590bd37d32Smrg#include <sys/types.h> 23600bd37d32Smrg],[ 23610bd37d32Smrg#ifndef _XOPEN_SOURCE 23620bd37d32Smrgmake an error 23630bd37d32Smrg#endif], 23640bd37d32Smrg [cf_cv_xopen_source=no], 23650bd37d32Smrg [cf_save="$CPPFLAGS" 23660bd37d32Smrg CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" 23670bd37d32Smrg AC_TRY_COMPILE([ 23680bd37d32Smrg#include <stdlib.h> 23690bd37d32Smrg#include <string.h> 23700bd37d32Smrg#include <sys/types.h> 23710bd37d32Smrg],[ 23720bd37d32Smrg#ifdef _XOPEN_SOURCE 23730bd37d32Smrgmake an error 23740bd37d32Smrg#endif], 23750bd37d32Smrg [cf_cv_xopen_source=no], 23760bd37d32Smrg [cf_cv_xopen_source=$cf_XOPEN_SOURCE]) 23770bd37d32Smrg CPPFLAGS="$cf_save" 23780bd37d32Smrg ]) 23790bd37d32Smrg]) 23800bd37d32Smrg 23810bd37d32Smrgif test "$cf_cv_xopen_source" != no ; then 23820bd37d32Smrg CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE) 23830bd37d32Smrg CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE) 23840bd37d32Smrg cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" 23850bd37d32Smrg CF_ADD_CFLAGS($cf_temp_xopen_source) 23860bd37d32Smrgfi 23870bd37d32Smrg]) 23880bd37d32Smrgdnl --------------------------------------------------------------------------- 23890bd37d32Smrgdnl CF_TTY_GROUP version: 8 updated: 2012/10/04 20:12:20 2390d522f475Smrgdnl ------------ 2391d522f475Smrgdnl Check if the system has a tty-group defined. This is used in xterm when 2392d522f475Smrgdnl setting pty ownership. 2393d522f475SmrgAC_DEFUN([CF_TTY_GROUP], 2394d522f475Smrg[ 2395d522f475SmrgAC_MSG_CHECKING(for explicit tty group name) 2396d522f475SmrgAC_ARG_WITH(tty-group, 2397d522f475Smrg [ --with-tty-group=XXX use XXX for the tty-group], 2398d522f475Smrg [cf_tty_group=$withval], 2399d522f475Smrg [cf_tty_group=auto...]) 2400d522f475Smrgtest -z "$cf_tty_group" && cf_tty_group=auto... 2401d522f475Smrgtest "$cf_tty_group" = yes && cf_tty_group=auto... 2402d522f475SmrgAC_MSG_RESULT($cf_tty_group) 2403d522f475Smrg 2404d522f475Smrgif test "$cf_tty_group" = "auto..." ; then 2405d522f475SmrgAC_CACHE_CHECK(for tty group name,cf_cv_tty_group_name,[ 2406d522f475Smrg 2407d522f475Smrg# If we are configuring as root, it is hard to get a clue about the tty group. 2408d522f475Smrg# But we'll guess based on how our connection is set up - assuming it is done 2409d522f475Smrg# properly. 2410d522f475Smrg 2411d522f475Smrgcf_uid=`id | sed -e 's/^[^=]*=//' -e 's/(.*$//'` 2412d522f475Smrg# )vi 2413d522f475Smrgif test "$cf_uid" != 0 ; then 2414d522f475Smrgcf_cv_tty_group_name= 2415d522f475Smrgcf_tty_name=`tty` 2416d522f475Smrgtest "$cf_tty_name" = "not a tty" && cf_tty_name=/dev/tty 2417d522f475Smrgtest -z "$cf_tty_name" && cf_tty_name=/dev/tty 2418d522f475Smrgif test -c "$cf_tty_name" 2419d522f475Smrgthen 2420d522f475Smrg cf_option="-l -L" 2421d522f475Smrg 2422d522f475Smrg # Expect listing to have fields like this: 2423d522f475Smrg #-rwxrwxrwx 1 user group 34293 Jul 18 16:29 pathname 2424d522f475Smrg ls $cf_option $cf_tty_name >conftest.out 2425d522f475Smrg read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest <conftest.out 2426d522f475Smrg if test -z "$cf_rest" ; then 2427d522f475Smrg cf_option="$cf_option -g" 2428d522f475Smrg ls $cf_option $cf_tty_name >conftest.out 2429d522f475Smrg read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest <conftest.out 2430d522f475Smrg fi 2431d522f475Smrg rm -f conftest.out 2432d522f475Smrg cf_cv_tty_group_name=$cf_grp 2433d522f475Smrgfi 2434d522f475Smrgfi 2435d522f475Smrg 2436d522f475Smrg# If we cannot deduce the tty group, fall back on hardcoded cases 2437d522f475Smrg 2438d522f475Smrgif test -z "$cf_cv_tty_group_name" 2439d522f475Smrgthen 2440d522f475Smrgcase $host_os in #(vi 2441d522f475Smrgosf*) #(vi 2442d522f475Smrg cf_cv_tty_group_name="terminal" 2443d522f475Smrg ;; 2444d522f475Smrg*) 2445d522f475Smrg cf_cv_tty_group_name="unknown" 2446d522f475Smrg if ( egrep '^tty:' /etc/group 2>/dev/null 1>/dev/null ) then 2447d522f475Smrg cf_cv_tty_group_name="tty" 2448d522f475Smrg fi 2449d522f475Smrg ;; 2450d522f475Smrgesac 2451d522f475Smrgfi 2452d522f475Smrg]) 2453d522f475Smrgcf_tty_group="$cf_cv_tty_group_name" 2454d522f475Smrgelse 2455d522f475Smrg # if configure option, always do this 24560bd37d32Smrg AC_DEFINE(USE_TTY_GROUP,1,[Define to 1 if we have a tty groupname]) 2457d522f475Smrgfi 2458d522f475Smrg 24590bd37d32SmrgAC_DEFINE_UNQUOTED(TTY_GROUP_NAME,"$cf_tty_group",[Define to the name use for tty group]) 2460d522f475Smrg 2461d522f475Smrg# This is only a double-check that the group-name we obtained above really 2462d522f475Smrg# does apply to the device. We cannot perform this test if we are in batch 2463d522f475Smrg# mode, or if we are cross-compiling. 2464d522f475Smrg 2465d522f475SmrgAC_CACHE_CHECK(if we may use the $cf_tty_group group,cf_cv_tty_group,[ 2466d522f475Smrgcf_tty_name=`tty` 2467d522f475Smrgif test "$cf_tty_name" != "not a tty" 2468d522f475Smrgthen 2469d522f475SmrgAC_TRY_RUN([ 2470d522f475Smrg#include <unistd.h> 2471d522f475Smrg#include <sys/types.h> 2472d522f475Smrg#include <sys/stat.h> 2473d522f475Smrg#include <grp.h> 2474d522f475Smrgint main() 2475d522f475Smrg{ 2476d522f475Smrg struct stat sb; 2477d522f475Smrg struct group *ttygrp = getgrnam(TTY_GROUP_NAME); 2478d522f475Smrg char *name = ttyname(0); 2479d522f475Smrg 2480d522f475Smrg endgrent(); 2481d522f475Smrg if (ttygrp != 0 2482d522f475Smrg && name != 0 2483d522f475Smrg && stat(name, &sb) == 0 2484d522f475Smrg && sb.st_gid != getgid() 2485d522f475Smrg && sb.st_gid == ttygrp->gr_gid) { 2486d522f475Smrg ${cf_cv_main_return:-return} (0); 2487d522f475Smrg } 2488d522f475Smrg ${cf_cv_main_return:-return} (1); 2489d522f475Smrg} 2490d522f475Smrg ], 2491d522f475Smrg [cf_cv_tty_group=yes], 2492d522f475Smrg [cf_cv_tty_group=no], 2493d522f475Smrg [cf_cv_tty_group=unknown]) 2494d522f475Smrgelif test "$cross_compiling" = yes; then 2495d522f475Smrg cf_cv_tty_group=unknown 2496d522f475Smrgelse 2497d522f475Smrg cf_cv_tty_group=yes 2498d522f475Smrgfi 2499d522f475Smrg]) 2500d522f475Smrg 2501d522f475Smrgif test $cf_cv_tty_group = no ; then 2502d522f475Smrg AC_MSG_WARN(Cannot use $cf_tty_group group) 2503d522f475Smrgelse 2504d522f475Smrg AC_DEFINE(USE_TTY_GROUP) 2505d522f475Smrgfi 2506d522f475Smrg])dnl 2507d522f475Smrgdnl --------------------------------------------------------------------------- 25080bd37d32Smrgdnl CF_TYPE_CC_T version: 2 updated: 2012/10/04 20:12:20 25090bd37d32Smrgdnl ------------ 25100bd37d32Smrgdnl Check for cc_t type, used in termio. 25110bd37d32SmrgAC_DEFUN([CF_TYPE_CC_T], 25120bd37d32Smrg[ 25130bd37d32SmrgAC_MSG_CHECKING(for cc_t in <termios.h> or <termio.h>) 25140bd37d32SmrgAC_CACHE_VAL(cf_cv_type_cc_t,[ 25150bd37d32Smrg AC_TRY_COMPILE([ 25160bd37d32Smrg#include <sys/types.h> 25170bd37d32Smrg#if defined(HAVE_TERMIOS_H) 25180bd37d32Smrg#include <termios.h> 25190bd37d32Smrg#else 25200bd37d32Smrg#include <termio.h> 25210bd37d32Smrg#include <sys/ioctl.h> 25220bd37d32Smrg#endif 25230bd37d32Smrg], 25240bd37d32Smrg [cc_t x], 25250bd37d32Smrg [cf_cv_type_cc_t=yes], 25260bd37d32Smrg [cf_cv_type_cc_t=no]) 25270bd37d32Smrg ]) 25280bd37d32SmrgAC_MSG_RESULT($cf_cv_type_cc_t) 25290bd37d32Smrgtest $cf_cv_type_cc_t = no && AC_DEFINE(cc_t, unsigned char,[Define to cc_t type used in termio]) 25300bd37d32Smrg])dnl 25310bd37d32Smrgdnl --------------------------------------------------------------------------- 25320bd37d32Smrgdnl CF_TYPE_FD_MASK version: 3 updated: 2012/10/04 06:57:36 2533d522f475Smrgdnl --------------- 2534d522f475Smrgdnl Check for the declaration of fd_mask, which is like fd_set, associated 2535d522f475Smrgdnl with select(). The check for fd_set should have pulled in this as well, 2536d522f475Smrgdnl but there is a special case for Mac OS X, possibly other BSD-derived 2537d522f475Smrgdnl platforms. 2538d522f475SmrgAC_DEFUN([CF_TYPE_FD_MASK], 2539d522f475Smrg[ 2540d522f475SmrgAC_REQUIRE([CF_TYPE_FD_SET]) 2541d522f475Smrg 2542d522f475SmrgAC_CACHE_CHECK(for declaration of fd_mask,cf_cv_type_fd_mask,[ 2543d522f475Smrg if test x$cf_cv_type_fd_set = xX11/Xpoll.h ; then 2544d522f475Smrg AC_TRY_COMPILE([ 2545d522f475Smrg#include <X11/Xpoll.h>],[fd_mask x],, 2546d522f475Smrg [CF_MSG_LOG(if we must define CSRG_BASED) 2547d522f475Smrg# Xosdefs.h on Mac OS X may not define this (but it should). 2548d522f475Smrg AC_TRY_COMPILE([ 2549d522f475Smrg#define CSRG_BASED 2550d522f475Smrg#include <X11/Xpoll.h>],[fd_mask x], 2551d522f475Smrg cf_cv_type_fd_mask=CSRG_BASED)]) 2552d522f475Smrg else 2553d522f475Smrg cf_cv_type_fd_mask=$cf_cv_type_fd_set 2554d522f475Smrg fi 2555d522f475Smrg]) 2556d522f475Smrgif test x$cf_cv_type_fd_mask = xCSRG_BASED ; then 25570bd37d32Smrg AC_DEFINE(CSRG_BASED,1,[Define to 1 if needed for declaring fd_mask()]) 2558d522f475Smrgfi 2559d522f475Smrg])dnl 2560d522f475Smrgdnl --------------------------------------------------------------------------- 25610bd37d32Smrgdnl CF_TYPE_FD_SET version: 5 updated: 2012/10/04 20:12:20 2562d522f475Smrgdnl -------------- 2563d522f475Smrgdnl Check for the declaration of fd_set. Some platforms declare it in 2564d522f475Smrgdnl <sys/types.h>, and some in <sys/select.h>, which requires <sys/types.h>. 2565d522f475Smrgdnl Finally, if we are using this for an X application, Xpoll.h may include 2566d522f475Smrgdnl <sys/select.h>, so we don't want to do it twice. 2567d522f475SmrgAC_DEFUN([CF_TYPE_FD_SET], 2568d522f475Smrg[ 2569d522f475SmrgAC_CHECK_HEADERS(X11/Xpoll.h) 2570d522f475Smrg 2571d522f475SmrgAC_CACHE_CHECK(for declaration of fd_set,cf_cv_type_fd_set, 2572d522f475Smrg [CF_MSG_LOG(sys/types alone) 2573d522f475SmrgAC_TRY_COMPILE([ 2574d522f475Smrg#include <sys/types.h>], 2575d522f475Smrg [fd_set x], 2576d522f475Smrg [cf_cv_type_fd_set=sys/types.h], 2577d522f475Smrg [CF_MSG_LOG(X11/Xpoll.h) 2578d522f475SmrgAC_TRY_COMPILE([ 2579d522f475Smrg#ifdef HAVE_X11_XPOLL_H 2580d522f475Smrg#include <X11/Xpoll.h> 2581d522f475Smrg#endif], 2582d522f475Smrg [fd_set x], 2583d522f475Smrg [cf_cv_type_fd_set=X11/Xpoll.h], 2584d522f475Smrg [CF_MSG_LOG(sys/select.h) 2585d522f475SmrgAC_TRY_COMPILE([ 2586d522f475Smrg#include <sys/types.h> 2587d522f475Smrg#include <sys/select.h>], 2588d522f475Smrg [fd_set x], 2589d522f475Smrg [cf_cv_type_fd_set=sys/select.h], 2590d522f475Smrg [cf_cv_type_fd_set=unknown])])])]) 2591d522f475Smrgif test $cf_cv_type_fd_set = sys/select.h ; then 25920bd37d32Smrg AC_DEFINE(USE_SYS_SELECT_H,1,[Define to 1 to include sys/select.h to declare fd_set]) 2593d522f475Smrgfi 2594d522f475Smrg]) 2595d522f475Smrgdnl --------------------------------------------------------------------------- 2596e39b573cSmrgdnl CF_UNDO_CFLAGS version: 1 updated: 2011/07/02 09:27:51 2597e39b573cSmrgdnl -------------- 2598e39b573cSmrgdnl Remove flags from $CFLAGS or similar shell variable using sed. 2599e39b573cSmrgdnl $1 = variable 2600e39b573cSmrgdnl $2 = message 2601e39b573cSmrgdnl $3 = pattern to remove 2602e39b573cSmrgAC_DEFUN([CF_UNDO_CFLAGS], 2603e39b573cSmrg[ 2604e39b573cSmrg CF_VERBOSE(removing $2 flags from $1) 2605e39b573cSmrg $1=`echo "[$]$1" | sed -e 's/$3//'` 2606e39b573cSmrg CF_VERBOSE(...result [$]$1) 2607e39b573cSmrg])dnl 2608e39b573cSmrgdnl --------------------------------------------------------------------------- 2609d522f475Smrgdnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59 2610d522f475Smrgdnl -------- 2611d522f475Smrgdnl Make an uppercase version of a variable 2612d522f475Smrgdnl $1=uppercase($2) 2613d522f475SmrgAC_DEFUN([CF_UPPER], 2614d522f475Smrg[ 2615d522f475Smrg$1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` 2616d522f475Smrg])dnl 2617d522f475Smrgdnl --------------------------------------------------------------------------- 26180bd37d32Smrgdnl CF_UTEMPTER version: 4 updated: 2012/10/04 20:12:20 2619d522f475Smrgdnl ----------- 2620d522f475Smrgdnl Try to link with utempter library 2621d522f475SmrgAC_DEFUN([CF_UTEMPTER], 2622d522f475Smrg[ 2623d522f475SmrgAC_CACHE_CHECK(if we can link with utempter library,cf_cv_have_utempter,[ 2624d522f475Smrgcf_save_LIBS="$LIBS" 262520d2c4d2SmrgCF_ADD_LIB(utempter) 2626d522f475SmrgAC_TRY_LINK([ 2627d522f475Smrg#include <utempter.h> 2628d522f475Smrg],[ 2629d522f475Smrg addToUtmp("/dev/tty", 0, 1); 2630d522f475Smrg removeFromUtmp(); 2631d522f475Smrg],[ 2632d522f475Smrg cf_cv_have_utempter=yes],[ 2633d522f475Smrg cf_cv_have_utempter=no]) 2634d522f475SmrgLIBS="$cf_save_LIBS" 2635d522f475Smrg]) 2636d522f475Smrgif test "$cf_cv_have_utempter" = yes ; then 26370bd37d32Smrg AC_DEFINE(USE_UTEMPTER,1,[Define to 1 if we can/should link with utempter]) 263820d2c4d2Smrg CF_ADD_LIB(utempter) 2639d522f475Smrgfi 2640d522f475Smrg])dnl 2641d522f475Smrgdnl --------------------------------------------------------------------------- 26420bd37d32Smrgdnl CF_UTMP version: 10 updated: 2012/10/04 20:12:20 2643d522f475Smrgdnl ------- 2644d522f475Smrgdnl Check for UTMP/UTMPX headers 2645d522f475SmrgAC_DEFUN([CF_UTMP], 2646d522f475Smrg[ 2647d522f475SmrgAC_REQUIRE([CF_LASTLOG]) 2648d522f475Smrg 2649d522f475SmrgAC_CACHE_CHECK(for utmp implementation,cf_cv_have_utmp,[ 2650d522f475Smrg cf_cv_have_utmp=no 2651d522f475Smrgfor cf_header in utmpx utmp ; do 2652d522f475Smrgcf_utmp_includes=" 2653d522f475Smrg#include <sys/types.h> 2654d522f475Smrg#include <${cf_header}.h> 2655d522f475Smrg#define getutent getutxent 2656d522f475Smrg#ifdef USE_LASTLOG 2657d522f475Smrg#include <lastlog.h> /* may conflict with utmpx.h on Linux */ 2658d522f475Smrg#endif 2659d522f475Smrg" 2660d522f475Smrg AC_TRY_COMPILE([$cf_utmp_includes], 2661d522f475Smrg [struct $cf_header x; 2662d522f475Smrg char *name = x.ut_name; /* utmp.h and compatible definitions */ 2663d522f475Smrg ], 2664d522f475Smrg [cf_cv_have_utmp=$cf_header 2665d522f475Smrg break], 2666d522f475Smrg [ 2667d522f475Smrg AC_TRY_COMPILE([$cf_utmp_includes], 2668d522f475Smrg [struct $cf_header x; 2669d522f475Smrg char *name = x.ut_user; /* utmpx.h must declare this */ 2670d522f475Smrg ], 2671d522f475Smrg [cf_cv_have_utmp=$cf_header 2672d522f475Smrg break 2673d522f475Smrg ])]) 2674d522f475Smrgdone 2675d522f475Smrg]) 2676d522f475Smrg 2677d522f475Smrgif test $cf_cv_have_utmp != no ; then 26780bd37d32Smrg AC_DEFINE(HAVE_UTMP,1,[Define to 1 if the utmp interface is available]) 26790bd37d32Smrg test $cf_cv_have_utmp = utmpx && AC_DEFINE(UTMPX_FOR_UTMP,1,[Define if we have utmpx interface]) 2680d522f475Smrg CF_UTMP_UT_HOST 2681d522f475Smrg CF_UTMP_UT_SYSLEN 2682d522f475Smrg CF_UTMP_UT_NAME 2683d522f475Smrg CF_UTMP_UT_XSTATUS 2684d522f475Smrg CF_UTMP_UT_XTIME 2685d522f475Smrg CF_UTMP_UT_SESSION 2686d522f475Smrg CF_SYSV_UTMP 2687d522f475Smrgfi 2688d522f475Smrg])dnl 2689d522f475Smrgdnl --------------------------------------------------------------------------- 2690d522f475Smrgdnl CF_UTMP_GROUP version: 1 updated: 2005/10/06 20:29:29 2691d522f475Smrgdnl ------------- 2692d522f475Smrgdnl Find the utmp/utmpx file and determine its group to allow setgid programs 2693d522f475Smrgdnl to manipulate it, e.g., when there is no intermediary. 2694d522f475SmrgAC_DEFUN([CF_UTMP_GROUP],[ 2695d522f475SmrgAC_REQUIRE([CF_UTMP]) 2696d522f475Smrgif test $cf_cv_have_utmp != no ; then 2697d522f475SmrgAC_CACHE_CHECK(for utmp/utmpx group,cf_cv_utmp_group,[ 2698d522f475Smrgfor cf_utmp_path in /var/adm /var/run 2699d522f475Smrgdo 2700d522f475Smrg for cf_utmp_file in utmpx utmp 2701d522f475Smrg do 2702d522f475Smrg if test -f $cf_utmp_path/$cf_utmp_file 2703d522f475Smrg then 2704d522f475Smrg cf_cv_utmp_group=root 2705d522f475Smrg 2706d522f475Smrg cf_option="-l -L" 2707d522f475Smrg 2708d522f475Smrg # Expect listing to have fields like this: 2709d522f475Smrg #-r--r--r-- 1 user group 34293 Jul 18 16:29 pathname 2710d522f475Smrg ls $cf_option $cf_utmp_path/$cf_utmp_file >conftest 2711d522f475Smrg read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest <conftest 2712d522f475Smrg if test -z "$cf_rest" ; then 2713d522f475Smrg cf_option="$cf_option -g" 2714d522f475Smrg ls $cf_option $cf_utmp_path/$cf_utmp_file >conftest 2715d522f475Smrg read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest <conftest 2716d522f475Smrg fi 2717d522f475Smrg rm -f conftest 2718d522f475Smrg 2719d522f475Smrg # If we have a pathname, and the date fields look right, assume we've 2720d522f475Smrg # captured the group as well. 2721d522f475Smrg if test -n "$cf_rest" ; then 2722d522f475Smrg cf_test=`echo "${cf_date2}${cf_date3}" | sed -e 's/[[0-9:]]//g'` 2723d522f475Smrg if test -z "$cf_test" ; then 2724d522f475Smrg cf_cv_utmp_group=$cf_grp; 2725d522f475Smrg fi 2726d522f475Smrg fi 2727d522f475Smrg break 2728d522f475Smrg fi 2729d522f475Smrg done 2730d522f475Smrg test -n "$cf_cv_utmp_group" && break 2731d522f475Smrgdone 2732d522f475Smrg]) 2733d522f475Smrgelse 2734d522f475Smrg AC_MSG_ERROR(cannot find utmp group) 2735d522f475Smrgfi 2736d522f475Smrg])dnl 2737d522f475Smrgdnl --------------------------------------------------------------------------- 27380bd37d32Smrgdnl CF_UTMP_UT_HOST version: 8 updated: 2012/10/04 20:12:20 2739d522f475Smrgdnl --------------- 2740d522f475Smrgdnl Check if UTMP/UTMPX struct defines ut_host member 2741d522f475SmrgAC_DEFUN([CF_UTMP_UT_HOST], 2742d522f475Smrg[ 2743d522f475Smrgif test $cf_cv_have_utmp != no ; then 2744d522f475SmrgAC_MSG_CHECKING(if ${cf_cv_have_utmp}.ut_host is declared) 2745d522f475SmrgAC_CACHE_VAL(cf_cv_have_utmp_ut_host,[ 2746d522f475Smrg AC_TRY_COMPILE([ 2747d522f475Smrg#include <sys/types.h> 2748d522f475Smrg#include <${cf_cv_have_utmp}.h>], 2749d522f475Smrg [struct $cf_cv_have_utmp x; char *y = &x.ut_host[0]], 2750d522f475Smrg [cf_cv_have_utmp_ut_host=yes], 2751d522f475Smrg [cf_cv_have_utmp_ut_host=no]) 2752d522f475Smrg ]) 2753d522f475SmrgAC_MSG_RESULT($cf_cv_have_utmp_ut_host) 27540bd37d32Smrgtest $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]) 2755d522f475Smrgfi 2756d522f475Smrg])dnl 2757d522f475Smrgdnl --------------------------------------------------------------------------- 27580bd37d32Smrgdnl CF_UTMP_UT_NAME version: 5 updated: 2012/10/04 20:12:20 2759d522f475Smrgdnl --------------- 2760d522f475Smrgdnl Check if UTMP/UTMPX struct defines ut_name member 2761d522f475SmrgAC_DEFUN([CF_UTMP_UT_NAME], 2762d522f475Smrg[ 2763d522f475Smrgif test $cf_cv_have_utmp != no ; then 2764d522f475SmrgAC_CACHE_CHECK(if ${cf_cv_have_utmp}.ut_name is declared,cf_cv_have_utmp_ut_name,[ 2765d522f475Smrg cf_cv_have_utmp_ut_name=no 2766d522f475Smrgcf_utmp_includes=" 2767d522f475Smrg#include <sys/types.h> 2768d522f475Smrg#include <${cf_cv_have_utmp}.h> 2769d522f475Smrg#define getutent getutxent 2770d522f475Smrg#ifdef USE_LASTLOG 2771d522f475Smrg#include <lastlog.h> /* may conflict with utmpx.h on Linux */ 2772d522f475Smrg#endif 2773d522f475Smrg" 2774d522f475Smrgfor cf_header in ut_name ut_user ; do 2775d522f475Smrg AC_TRY_COMPILE([$cf_utmp_includes], 2776d522f475Smrg [struct $cf_cv_have_utmp x; 2777d522f475Smrg char *name = x.$cf_header; 2778d522f475Smrg ], 2779d522f475Smrg [cf_cv_have_utmp_ut_name=$cf_header 2780d522f475Smrg break]) 2781d522f475Smrgdone 2782d522f475Smrg]) 2783d522f475Smrg 2784d522f475Smrgcase $cf_cv_have_utmp_ut_name in #(vi 2785d522f475Smrgno) #(vi 2786d522f475Smrg AC_MSG_ERROR(Cannot find declaration for ut.ut_name) 2787d522f475Smrg ;; 2788d522f475Smrgut_user) 27890bd37d32Smrg AC_DEFINE(ut_name,ut_user,[Define to rename UTMP/UTMPX struct ut_name member]) 2790d522f475Smrg ;; 2791d522f475Smrgesac 2792d522f475Smrgfi 2793d522f475Smrg])dnl 2794d522f475Smrgdnl --------------------------------------------------------------------------- 27950bd37d32Smrgdnl CF_UTMP_UT_SESSION version: 6 updated: 2012/10/04 20:12:20 2796d522f475Smrgdnl ------------------ 2797d522f475Smrgdnl Check if UTMP/UTMPX struct defines ut_session member 2798d522f475SmrgAC_DEFUN([CF_UTMP_UT_SESSION], 2799d522f475Smrg[ 2800d522f475Smrgif test $cf_cv_have_utmp != no ; then 2801d522f475SmrgAC_CACHE_CHECK(if ${cf_cv_have_utmp}.ut_session is declared, cf_cv_have_utmp_ut_session,[ 2802d522f475Smrg AC_TRY_COMPILE([ 2803d522f475Smrg#include <sys/types.h> 2804d522f475Smrg#include <${cf_cv_have_utmp}.h>], 2805d522f475Smrg [struct $cf_cv_have_utmp x; long y = x.ut_session], 2806d522f475Smrg [cf_cv_have_utmp_ut_session=yes], 2807d522f475Smrg [cf_cv_have_utmp_ut_session=no]) 2808d522f475Smrg]) 2809d522f475Smrgif test $cf_cv_have_utmp_ut_session != no ; then 28100bd37d32Smrg AC_DEFINE(HAVE_UTMP_UT_SESSION,1,[Define to 1 if UTMP/UTMPX struct defines ut_session member]) 2811d522f475Smrgfi 2812d522f475Smrgfi 2813d522f475Smrg])dnl 2814d522f475Smrgdnl --------------------------------------------------------------------------- 28150bd37d32Smrgdnl CF_UTMP_UT_SYSLEN version: 2 updated: 2012/10/04 20:12:20 2816d522f475Smrgdnl ----------------- 2817d522f475Smrgdnl Check if UTMP/UTMPX struct defines ut_syslen member 2818d522f475SmrgAC_DEFUN([CF_UTMP_UT_SYSLEN], 2819d522f475Smrg[ 2820d522f475Smrgif test $cf_cv_have_utmp != no ; then 2821d522f475SmrgAC_MSG_CHECKING(if ${cf_cv_have_utmp}.ut_syslen is declared) 2822d522f475SmrgAC_CACHE_VAL(cf_cv_have_utmp_ut_syslen,[ 2823d522f475Smrg AC_TRY_COMPILE([ 2824d522f475Smrg#include <sys/types.h> 2825d522f475Smrg#include <${cf_cv_have_utmp}.h>], 2826d522f475Smrg [struct $cf_cv_have_utmp x; int y = x.ut_syslen], 2827d522f475Smrg [cf_cv_have_utmp_ut_syslen=yes], 2828d522f475Smrg [cf_cv_have_utmp_ut_syslen=no]) 2829d522f475Smrg ]) 2830d522f475SmrgAC_MSG_RESULT($cf_cv_have_utmp_ut_syslen) 28310bd37d32Smrgtest $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]) 2832d522f475Smrgfi 2833d522f475Smrg])dnl 2834d522f475Smrgdnl --------------------------------------------------------------------------- 28350bd37d32Smrgdnl CF_UTMP_UT_XSTATUS version: 4 updated: 2012/10/04 20:12:20 2836d522f475Smrgdnl ------------------ 2837d522f475Smrgdnl Check for known variants on the UTMP/UTMPX struct's exit-status as reported 2838d522f475Smrgdnl by various people: 2839d522f475Smrgdnl 2840d522f475Smrgdnl ut_exit.__e_exit (HPUX 11 - David Ellement, also in glibc2) 2841d522f475Smrgdnl ut_exit.e_exit (SVR4) 2842d522f475Smrgdnl ut_exit.ut_e_exit (os390 - Greg Smith) 2843d522f475Smrgdnl ut_exit.ut_exit (Tru64 4.0f - Jeremie Petit, 4.0e - Tomas Vanhala) 2844d522f475Smrgdnl 2845d522f475Smrgdnl Note: utmp_xstatus is not a conventional compatibility definition in the 2846d522f475Smrgdnl system header files. 2847d522f475SmrgAC_DEFUN([CF_UTMP_UT_XSTATUS], 2848d522f475Smrg[ 2849d522f475Smrgif test $cf_cv_have_utmp != no ; then 2850d522f475SmrgAC_CACHE_CHECK(for exit-status in $cf_cv_have_utmp,cf_cv_have_utmp_ut_xstatus,[ 2851d522f475Smrgfor cf_result in \ 2852d522f475Smrg ut_exit.__e_exit \ 2853d522f475Smrg ut_exit.e_exit \ 2854d522f475Smrg ut_exit.ut_e_exit \ 2855d522f475Smrg ut_exit.ut_exit 2856d522f475Smrgdo 2857d522f475SmrgAC_TRY_COMPILE([ 2858d522f475Smrg#include <sys/types.h> 2859d522f475Smrg#include <${cf_cv_have_utmp}.h>], 2860d522f475Smrg [struct $cf_cv_have_utmp x; long y = x.$cf_result = 0], 2861d522f475Smrg [cf_cv_have_utmp_ut_xstatus=$cf_result 2862d522f475Smrg break], 2863d522f475Smrg [cf_cv_have_utmp_ut_xstatus=no]) 2864d522f475Smrgdone 2865d522f475Smrg]) 2866d522f475Smrgif test $cf_cv_have_utmp_ut_xstatus != no ; then 28670bd37d32Smrg AC_DEFINE(HAVE_UTMP_UT_XSTATUS,1,[Define to 1 if UTMP/UTMPX has exit-status member]) 28680bd37d32Smrg AC_DEFINE_UNQUOTED(ut_xstatus,$cf_cv_have_utmp_ut_xstatus,[Define if needed to rename member ut_xstatus of UTMP/UTMPX]) 2869d522f475Smrgfi 2870d522f475Smrgfi 2871d522f475Smrg])dnl 2872d522f475Smrgdnl --------------------------------------------------------------------------- 28730bd37d32Smrgdnl CF_UTMP_UT_XTIME version: 9 updated: 2012/10/04 20:12:20 2874d522f475Smrgdnl ---------------- 2875d522f475Smrgdnl Check if UTMP/UTMPX struct defines ut_xtime member 2876d522f475SmrgAC_DEFUN([CF_UTMP_UT_XTIME], 2877d522f475Smrg[ 2878d522f475Smrgif test $cf_cv_have_utmp != no ; then 2879d522f475SmrgAC_CACHE_CHECK(if ${cf_cv_have_utmp}.ut_xtime is declared, cf_cv_have_utmp_ut_xtime,[ 2880d522f475Smrg AC_TRY_COMPILE([ 2881d522f475Smrg#include <sys/types.h> 2882d522f475Smrg#include <${cf_cv_have_utmp}.h>], 2883d522f475Smrg [struct $cf_cv_have_utmp x; long y = x.ut_xtime = 0], 2884d522f475Smrg [cf_cv_have_utmp_ut_xtime=yes], 2885d522f475Smrg [AC_TRY_COMPILE([ 2886d522f475Smrg#include <sys/types.h> 2887d522f475Smrg#include <${cf_cv_have_utmp}.h>], 2888d522f475Smrg [struct $cf_cv_have_utmp x; long y = x.ut_tv.tv_sec], 2889d522f475Smrg [cf_cv_have_utmp_ut_xtime=define], 2890d522f475Smrg [cf_cv_have_utmp_ut_xtime=no]) 2891d522f475Smrg ]) 2892d522f475Smrg]) 2893d522f475Smrgif test $cf_cv_have_utmp_ut_xtime != no ; then 28940bd37d32Smrg AC_DEFINE(HAVE_UTMP_UT_XTIME,1,[Define to 1 if UTMP/UTMPX struct defines ut_xtime member]) 2895d522f475Smrg if test $cf_cv_have_utmp_ut_xtime = define ; then 28960bd37d32Smrg AC_DEFINE(ut_xtime,ut_tv.tv_sec,[Define if needed to alternate name for utmpx.ut_xtime member]) 2897d522f475Smrg fi 2898d522f475Smrgfi 2899d522f475Smrgfi 2900d522f475Smrg])dnl 2901d522f475Smrgdnl --------------------------------------------------------------------------- 2902d522f475Smrgdnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12 2903d522f475Smrgdnl ---------- 2904d522f475Smrgdnl Use AC_VERBOSE w/o the warnings 2905d522f475SmrgAC_DEFUN([CF_VERBOSE], 2906d522f475Smrg[test -n "$verbose" && echo " $1" 1>&AC_FD_MSG 2907d522f475SmrgCF_MSG_LOG([$1]) 2908d522f475Smrg])dnl 2909d522f475Smrgdnl --------------------------------------------------------------------------- 29100bd37d32Smrgdnl CF_WITH_APP_CLASS version: 2 updated: 2012/10/04 04:29:52 2911e39b573cSmrgdnl ----------------- 2912e39b573cSmrgdnl Handle configure option "--with-app-class", setting the $APP_CLASS 2913e39b573cSmrgdnl variable, used for X resources. 2914e39b573cSmrgdnl 2915e39b573cSmrgdnl $1 = default value. 29160bd37d32SmrgAC_DEFUN([CF_WITH_APP_CLASS],[ 2917e39b573cSmrgAC_MSG_CHECKING(for X applications class) 2918e39b573cSmrgAC_ARG_WITH(app-class, 2919e39b573cSmrg [ --with-app-class=XXX override X applications class (default $1)], 2920e39b573cSmrg [APP_CLASS=$withval], 2921e39b573cSmrg [APP_CLASS=$1]) 2922e39b573cSmrg 2923e39b573cSmrgcase x$APP_CLASS in #(vi 2924e39b573cSmrg*[[/@,%]]*) #(vi 2925e39b573cSmrg AC_MSG_WARN(X applications class cannot contain punctuation) 2926e39b573cSmrg APP_CLASS=$1 2927e39b573cSmrg ;; 2928e39b573cSmrgx[[A-Z]]*) #(vi 2929e39b573cSmrg ;; 2930e39b573cSmrg*) 2931e39b573cSmrg AC_MSG_WARN([X applications class must start with capital, ignoring $APP_CLASS]) 2932e39b573cSmrg APP_CLASS=$1 2933e39b573cSmrg ;; 2934e39b573cSmrgesac 2935e39b573cSmrg 2936e39b573cSmrgAC_MSG_RESULT($APP_CLASS) 2937e39b573cSmrg 2938e39b573cSmrgAC_SUBST(APP_CLASS) 2939e39b573cSmrg])dnl 2940e39b573cSmrgdnl --------------------------------------------------------------------------- 29410bd37d32Smrgdnl CF_WITH_APP_DEFAULTS version: 5 updated: 2012/10/04 04:29:52 2942e39b573cSmrgdnl -------------------- 2943e39b573cSmrgdnl Handle configure option "--with-app-defaults", setting these shell 2944e39b573cSmrgdnl variables: 29450bd37d32Smrgdnl 29460bd37d32Smrgdnl $APPSDIR is the option value, used for installing app-defaults files. 2947e39b573cSmrgdnl $no_appsdir is a "#" (comment) if "--without-app-defaults" is given. 29480bd37d32Smrgdnl 29490bd37d32Smrgdnl Most Linux's use this: 29500bd37d32Smrgdnl /usr/share/X11/app-defaults 29510bd37d32Smrgdnl Debian uses this: 29520bd37d32Smrgdnl /etc/X11/app-defaults 29530bd37d32Smrgdnl DragonFlyBSD ports uses this: 29540bd37d32Smrgdnl /usr/pkg/lib/X11/app-defaults 29550bd37d32Smrgdnl FreeBSD ports use these: 29560bd37d32Smrgdnl /usr/local/lib/X11/app-defaults 29570bd37d32Smrgdnl /usr/local/share/X11/app-defaults 29580bd37d32Smrgdnl Mandriva has these: 29590bd37d32Smrgdnl /usr/lib/X11/app-defaults 29600bd37d32Smrgdnl /usr/lib64/X11/app-defaults 29610bd37d32Smrgdnl NetBSD has these 29620bd37d32Smrgdnl /usr/X11R7/lib/X11/app-defaults 29630bd37d32Smrgdnl OpenSolaris uses 29640bd37d32Smrgdnl 32-bit: 29650bd37d32Smrgdnl /usr/X11/etc/X11/app-defaults 29660bd37d32Smrgdnl /usr/X11/share/X11/app-defaults 29670bd37d32Smrgdnl /usr/X11/lib/X11/app-defaults 29680bd37d32Smrgdnl 64-bit: 29690bd37d32Smrgdnl /usr/X11/etc/X11/app-defaults 29700bd37d32Smrgdnl /usr/X11/share/X11/app-defaults (I mkdir'd this) 29710bd37d32Smrgdnl /usr/X11/lib/amd64/X11/app-defaults 29720bd37d32Smrgdnl Solaris10 uses (in this order): 29730bd37d32Smrgdnl /usr/openwin/lib/X11/app-defaults 29740bd37d32Smrgdnl /usr/X11/lib/X11/app-defaults 29750bd37d32SmrgAC_DEFUN([CF_WITH_APP_DEFAULTS],[ 2976e39b573cSmrgAC_MSG_CHECKING(for directory to install resource files) 29770bd37d32SmrgAC_ARG_WITH(app-defaults, 29780bd37d32Smrg [ --with-app-defaults=DIR directory in which to install resource files (EPREFIX/lib/X11/app-defaults)], 29790bd37d32Smrg [APPSDIR=$withval], 29800bd37d32Smrg [APPSDIR='${exec_prefix}/lib/X11/app-defaults']) 29810bd37d32Smrg 29820bd37d32Smrgif test "x[$]APPSDIR" = xauto 29830bd37d32Smrgthen 29840bd37d32Smrg APPSDIR='${exec_prefix}/lib/X11/app-defaults' 29850bd37d32Smrg for cf_path in \ 29860bd37d32Smrg /usr/share/X11/app-defaults \ 29870bd37d32Smrg /usr/X11/share/X11/app-defaults \ 29880bd37d32Smrg /usr/X11/lib/X11/app-defaults \ 29890bd37d32Smrg /usr/lib/X11/app-defaults \ 29900bd37d32Smrg /etc/X11/app-defaults \ 29910bd37d32Smrg /usr/pkg/lib/X11/app-defaults \ 29920bd37d32Smrg /usr/X11R7/lib/X11/app-defaults \ 29930bd37d32Smrg /usr/X11R6/lib/X11/app-defaults \ 29940bd37d32Smrg /usr/X11R5/lib/X11/app-defaults \ 29950bd37d32Smrg /usr/X11R4/lib/X11/app-defaults \ 29960bd37d32Smrg /usr/local/lib/X11/app-defaults \ 29970bd37d32Smrg /usr/local/share/X11/app-defaults \ 29980bd37d32Smrg /usr/lib64/X11/app-defaults 29990bd37d32Smrg do 30000bd37d32Smrg if test -d "$cf_path" ; then 30010bd37d32Smrg APPSDIR="$cf_path" 30020bd37d32Smrg break 30030bd37d32Smrg fi 30040bd37d32Smrg done 30050bd37d32Smrgelse 30060bd37d32Smrg cf_path=$APPSDIR 30070bd37d32Smrg CF_PATH_SYNTAX(cf_path) 30080bd37d32Smrgfi 30090bd37d32Smrg 30100bd37d32SmrgAC_MSG_RESULT($APPSDIR) 30110bd37d32SmrgAC_SUBST(APPSDIR) 3012e39b573cSmrg 3013e39b573cSmrgno_appsdir= 30140bd37d32Smrgif test "$APPSDIR" = no 30150bd37d32Smrgthen 30160bd37d32Smrg no_appsdir="#" 30170bd37d32Smrgelse 30180bd37d32Smrg EXTRA_INSTALL_DIRS="$EXTRA_INSTALL_DIRS \$(APPSDIR)" 30190bd37d32Smrgfi 3020e39b573cSmrgAC_SUBST(no_appsdir) 3021e39b573cSmrg])dnl 3022e39b573cSmrgdnl --------------------------------------------------------------------------- 30230bd37d32Smrgdnl CF_WITH_DBMALLOC version: 7 updated: 2010/06/21 17:26:47 30240bd37d32Smrgdnl ---------------- 30250bd37d32Smrgdnl Configure-option for dbmalloc. The optional parameter is used to override 30260bd37d32Smrgdnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests. 30270bd37d32SmrgAC_DEFUN([CF_WITH_DBMALLOC],[ 30280bd37d32SmrgCF_NO_LEAKS_OPTION(dbmalloc, 30290bd37d32Smrg [ --with-dbmalloc test: use Conor Cahill's dbmalloc library], 30300bd37d32Smrg [USE_DBMALLOC]) 30310bd37d32Smrg 30320bd37d32Smrgif test "$with_dbmalloc" = yes ; then 30330bd37d32Smrg AC_CHECK_HEADER(dbmalloc.h, 30340bd37d32Smrg [AC_CHECK_LIB(dbmalloc,[debug_malloc]ifelse([$1],,[],[,$1]))]) 30350bd37d32Smrgfi 30360bd37d32Smrg])dnl 30370bd37d32Smrgdnl --------------------------------------------------------------------------- 30380bd37d32Smrgdnl CF_WITH_DESKTOP_CATEGORY version: 4 updated: 2013/01/01 10:50:14 3039e39b573cSmrgdnl ------------------------ 3040e39b573cSmrgdnl Taking into account the absence of standardization of desktop categories 3041e39b573cSmrgdnl take a look to see whether other applications on the current system are 3042e39b573cSmrgdnl assigned any/all of a set of suggested categories. 3043e39b573cSmrgdnl 3044e39b573cSmrgdnl $1 = program name 3045e39b573cSmrgdnl $2 = case-pattern to match comparable desktop files to obtain category 3046e39b573cSmrgdnl This pattern may contain wildcards. 3047e39b573cSmrgdnl $3 = suggested categories, also a case-pattern but without wildcards, 30480bd37d32Smrgdnl since it doubles as a default value for a shell case-statement. 30490bd37d32Smrgdnl $4 = categories to use if no match is found on the build-machine for the 30500bd37d32Smrgdnl --with-desktop-category "auto" setting. 3051e39b573cSmrgdnl 3052e39b573cSmrgdnl The macro tells the configure script to substitute the $DESKTOP_CATEGORY 3053e39b573cSmrgdnl value. 3054e39b573cSmrgAC_DEFUN([CF_WITH_DESKTOP_CATEGORY],[ 3055e39b573cSmrgAC_REQUIRE([CF_DISABLE_DESKTOP]) 3056e39b573cSmrg 3057e39b573cSmrgif test -z "$desktop_utils" 3058e39b573cSmrgthen 3059e39b573cSmrg AC_MSG_CHECKING(for requested desktop-category) 3060e39b573cSmrg AC_ARG_WITH(desktop-category, 3061e39b573cSmrg [ --with-desktop-category=XXX one or more desktop catgories or auto], 3062e39b573cSmrg [cf_desktop_want=$withval], 3063e39b573cSmrg [cf_desktop_want=auto]) 3064e39b573cSmrg AC_MSG_RESULT($cf_desktop_want) 3065e39b573cSmrg 3066e39b573cSmrg if test "$cf_desktop_want" = auto 3067e39b573cSmrg then 3068e39b573cSmrg rm -rf conftest* 3069e39b573cSmrg cf_desktop_also= 3070e39b573cSmrg for cf_desktop_dir in \ 3071e39b573cSmrg /usr/share/app-install \ 3072e39b573cSmrg /usr/share/applications 3073e39b573cSmrg do 3074e39b573cSmrg if test -d $cf_desktop_dir 3075e39b573cSmrg then 3076e39b573cSmrg find $cf_desktop_dir -name '*.desktop' | \ 3077e39b573cSmrg while true 3078e39b573cSmrg do 3079e39b573cSmrg read cf_desktop_path 3080e39b573cSmrg test -z "$cf_desktop_path" && break 3081e39b573cSmrg cf_desktop_name=`basename $cf_desktop_path .desktop` 3082e39b573cSmrg case $cf_desktop_name in #(vi 3083e39b573cSmrg $1|*-$1|$2) 3084e39b573cSmrg CF_VERBOSE(inspect $cf_desktop_path) 3085e39b573cSmrg egrep '^Categories=' $cf_desktop_path | \ 3086e39b573cSmrg tr ';' '\n' | \ 3087e39b573cSmrg sed -e 's%^.*=%%' -e '/^$/d' >>conftest.1 3088e39b573cSmrg ;; 3089e39b573cSmrg esac 3090e39b573cSmrg done 3091e39b573cSmrg fi 3092e39b573cSmrg done 3093e39b573cSmrg if test -s conftest.1 3094e39b573cSmrg then 3095e39b573cSmrg cf_desktop_last= 3096e39b573cSmrg sort conftest.1 | \ 3097e39b573cSmrg while true 3098e39b573cSmrg do 3099e39b573cSmrg read cf_desktop_this 3100e39b573cSmrg test -z "$cf_desktop_this" && break 3101e39b573cSmrg case $cf_desktop_this in #(vi 3102e39b573cSmrg Qt*|GTK*|KDE*|GNOME*|*XFCE*|*Xfce*) #(vi 3103e39b573cSmrg ;; 3104e39b573cSmrg $3) 3105e39b573cSmrg test "x$cf_desktop_last" != "x$cf_desktop_this" && echo $cf_desktop_this >>conftest.2 3106e39b573cSmrg ;; 3107e39b573cSmrg esac 3108e39b573cSmrg cf_desktop_last=$cf_desktop_this 3109e39b573cSmrg done 3110e39b573cSmrg cf_desktop_want=`cat conftest.2 | tr '\n' ';'` 3111e39b573cSmrg fi 31120bd37d32Smrg if test -n "$cf_desktop_want" 31130bd37d32Smrg then 31140bd37d32Smrg if test "$cf_desktop_want" = auto 31150bd37d32Smrg then 31160bd37d32Smrg cf_desktop_want= 31170bd37d32Smrg else 31180bd37d32Smrg # do a sanity check on the semicolon-separated list, ignore on failure 31190bd37d32Smrg cf_desktop_test=`echo "$cf_desktop_want" | sed -e 's/[[^;]]//g'` 31200bd37d32Smrg test -z "$cf_desktop_test" && cf_desktop_want= 31210bd37d32Smrg cf_desktop_test=`echo "$cf_desktop_want" | sed -e 's/^.*;$/./g'` 31220bd37d32Smrg test -z "$cf_desktop_test" && cf_desktop_want= 31230bd37d32Smrg fi 31240bd37d32Smrg fi 31250bd37d32Smrg if test -z "$cf_desktop_want" 31260bd37d32Smrg then 31270bd37d32Smrg cf_desktop_want="ifelse([$4],,ifelse([$3],,[Application;],[`echo "$3" | sed -e 's/\*//g' -e 's/|/;/g' -e 's/[[;]]*$/;/g'`]),[$4])" 31280bd37d32Smrg CF_VERBOSE(no usable value found for desktop category, using $cf_desktop_want) 31290bd37d32Smrg fi 3130e39b573cSmrg fi 3131e39b573cSmrg DESKTOP_CATEGORY=`echo "$cf_desktop_want" | sed -e 's/[[ ,]]/;/g'` 31320bd37d32Smrg CF_VERBOSE(will use Categories=$DESKTOP_CATEGORY) 3133e39b573cSmrg AC_SUBST(DESKTOP_CATEGORY) 3134e39b573cSmrgfi 3135e39b573cSmrg]) 3136e39b573cSmrgdnl --------------------------------------------------------------------------- 31370bd37d32Smrgdnl CF_WITH_DMALLOC version: 7 updated: 2010/06/21 17:26:47 3138e39b573cSmrgdnl --------------- 31390bd37d32Smrgdnl Configure-option for dmalloc. The optional parameter is used to override 31400bd37d32Smrgdnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests. 31410bd37d32SmrgAC_DEFUN([CF_WITH_DMALLOC],[ 31420bd37d32SmrgCF_NO_LEAKS_OPTION(dmalloc, 31430bd37d32Smrg [ --with-dmalloc test: use Gray Watson's dmalloc library], 31440bd37d32Smrg [USE_DMALLOC]) 31450bd37d32Smrg 31460bd37d32Smrgif test "$with_dmalloc" = yes ; then 31470bd37d32Smrg AC_CHECK_HEADER(dmalloc.h, 31480bd37d32Smrg [AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse([$1],,[],[,$1]))]) 31490bd37d32Smrgfi 31500bd37d32Smrg])dnl 31510bd37d32Smrgdnl --------------------------------------------------------------------------- 31520bd37d32Smrgdnl CF_WITH_ICONDIR version: 5 updated: 2012/07/22 09:18:02 31530bd37d32Smrgdnl --------------- 31540bd37d32Smrgdnl Handle configure option "--with-icondir", setting these shell variables: 31550bd37d32Smrgdnl 31560bd37d32Smrgdnl $ICONDIR is the option value, used for installing icon files. 3157e39b573cSmrgdnl $no_icondir is a "#" (comment) if "--without-icondir" is given. 3158e39b573cSmrgAC_DEFUN([CF_WITH_ICONDIR],[ 3159e39b573cSmrgAC_MSG_CHECKING(for directory to install icons) 31600bd37d32SmrgAC_ARG_WITH(icondir, 31610bd37d32Smrg [ --with-icondir=DIR directory in which to install icons for desktop], 31620bd37d32Smrg [ICONDIR=$withval], 31630bd37d32Smrg [test -z "$ICONDIR" && ICONDIR=no]) 31640bd37d32Smrg 31650bd37d32Smrgif test "x[$]ICONDIR" = xauto 31660bd37d32Smrgthen 31670bd37d32Smrg ICONDIR='${datadir}/icons' 31680bd37d32Smrg for cf_path in \ 31690bd37d32Smrg /usr/share/icons \ 31700bd37d32Smrg /usr/X11R6/share/icons 31710bd37d32Smrg do 31720bd37d32Smrg if test -d "$cf_path" ; then 31730bd37d32Smrg ICONDIR="$cf_path" 31740bd37d32Smrg break 31750bd37d32Smrg fi 31760bd37d32Smrg done 31770bd37d32Smrgelse 31780bd37d32Smrg cf_path=$ICONDIR 31790bd37d32Smrg CF_PATH_SYNTAX(cf_path) 31800bd37d32Smrgfi 31810bd37d32SmrgAC_MSG_RESULT($ICONDIR) 31820bd37d32SmrgAC_SUBST(ICONDIR) 3183e39b573cSmrg 3184e39b573cSmrgno_icondir= 31850bd37d32Smrgif test "$ICONDIR" = no 31860bd37d32Smrgthen 31870bd37d32Smrg no_icondir="#" 31880bd37d32Smrgelse 31890bd37d32Smrg EXTRA_INSTALL_DIRS="$EXTRA_INSTALL_DIRS \$(ICONDIR)" 31900bd37d32Smrgfi 3191e39b573cSmrgAC_SUBST(no_icondir) 3192e39b573cSmrg])dnl 3193e39b573cSmrgdnl --------------------------------------------------------------------------- 31940bd37d32Smrgdnl CF_WITH_ICON_NAME version: 2 updated: 2013/05/27 18:34:42 31950bd37d32Smrgdnl ----------------- 31960bd37d32Smrgdnl Allow a default icon-name to be overridden. 31970bd37d32Smrgdnl $1 = default icon name 31980bd37d32SmrgAC_DEFUN([CF_WITH_ICON_NAME],[ 31990bd37d32SmrgAC_MSG_CHECKING(for the icon name) 32000bd37d32SmrgAC_ARG_WITH(icon-name, 32010bd37d32Smrg [ --with-icon-name=XXXX override icon name (default: $1)], 32020bd37d32Smrg [ICON_NAME="$withval"], 32030bd37d32Smrg [ICON_NAME=$1]) 32040bd37d32Smrgcase "x$ICON_NAME" in 32050bd37d32Smrgxyes|xno|x) 32060bd37d32Smrg ICON_NAME=$1 32070bd37d32Smrg ;; 32080bd37d32Smrgesac 32090bd37d32SmrgAC_SUBST(ICON_NAME) 32100bd37d32SmrgAC_MSG_RESULT($ICON_NAME) 32110bd37d32Smrg])dnl 32120bd37d32Smrgdnl --------------------------------------------------------------------------- 32130bd37d32Smrgdnl CF_WITH_ICON_SYMLINK version: 1 updated: 2013/05/27 18:34:42 32140bd37d32Smrgdnl -------------------- 32150bd37d32Smrgdnl Workaround for systems which are (mis)configured to map all icon references 32160bd37d32Smrgdnl for xterm into "xterm" name. For instance, recent (2013) KDE ignores both 32170bd37d32Smrgdnl the name given in the .desktop file (xterm-color) and the application name 32180bd37d32Smrgdnl (xterm-dev). 32190bd37d32Smrgdnl 32200bd37d32Smrgdnl $1 = default icon name to use if symlink is wanted 32210bd37d32SmrgAC_DEFUN([CF_WITH_ICON_SYMLINK],[ 32220bd37d32SmrgAC_MSG_CHECKING(for icon symlink to use) 32230bd37d32SmrgAC_ARG_WITH(icon-symlink, 32240bd37d32Smrg [ --with-icon-symlink=XXX make symbolic link for icon name (default: $1)], 32250bd37d32Smrg [ICON_SYMLINK="$withval"], 32260bd37d32Smrg [ICON_SYMLINK=NONE]) 32270bd37d32Smrgcase "x$ICON_SYMLINK" in 32280bd37d32Smrgxyes) 32290bd37d32Smrg ICON_SYMLINK=$1 32300bd37d32Smrg ;; 32310bd37d32Smrgxno|x) 32320bd37d32Smrg ICON_SYMLINK=NONE 32330bd37d32Smrg ;; 32340bd37d32Smrgesac 32350bd37d32SmrgAC_SUBST(ICON_SYMLINK) 32360bd37d32SmrgAC_MSG_RESULT($ICON_SYMLINK) 32370bd37d32Smrg])dnl 32380bd37d32Smrgdnl --------------------------------------------------------------------------- 32390bd37d32Smrgdnl CF_WITH_ICON_THEME version: 9 updated: 2013/04/17 05:31:24 32400bd37d32Smrgdnl ------------------ 32410bd37d32Smrgdnl If asked, check for prerequisites and setup symbols to permit installing 32420bd37d32Smrgdnl one or more application icons in the Red Hat icon-theme directory 32430bd37d32Smrgdnl hierarchy. 32440bd37d32Smrgdnl 32450bd37d32Smrgdnl If the prerequisites are missing, give a warning and revert to the long- 32460bd37d32Smrgdnl standing pixmaps directory. 32470bd37d32Smrgdnl 32480bd37d32Smrgdnl Parameters: 32490bd37d32Smrgdnl 32500bd37d32Smrgdnl $1 = application icon. This can be a list, and is not optional. 32510bd37d32Smrgdnl $2 = default theme (defaults to hicolor) 32520bd37d32Smrgdnl $3 = formats (defaults to list [.svg .png .xpm]) 32530bd37d32Smrgdnl $4 = alternate icon if no theme is used (defaults to $1). 32540bd37d32Smrgdnl 32550bd37d32Smrgdnl Result: 32560bd37d32Smrgdnl ICON_NAME = basename of first item in $1 32570bd37d32Smrgdnl ICON_LIST = reprocessed $1 32580bd37d32Smrgdnl ICON_THEME = reprocessed $2 32590bd37d32Smrgdnl ICON_FORMAT = reprocessed $3 32600bd37d32SmrgAC_DEFUN([CF_WITH_ICON_THEME], 32610bd37d32Smrg[ 32620bd37d32Smrgifelse([$1],,[ 32630bd37d32Smrg AC_MSG_ERROR([macro [CF_WITH_ICON_THEME] requires application-icon name]) 32640bd37d32Smrg],[ 32650bd37d32Smrg 32660bd37d32SmrgCF_WITH_PIXMAPDIR 32670bd37d32SmrgCF_WITH_ICONDIR 32680bd37d32Smrg 32690bd37d32SmrgAC_MSG_CHECKING(if icon theme should be used) 32700bd37d32SmrgAC_ARG_WITH(icon-theme, 32710bd37d32Smrg [ --with-icon-theme=XXX install icons into desktop theme (hicolor)], 32720bd37d32Smrg [ICON_THEME=$withval], 32730bd37d32Smrg [ICON_THEME=no]) 32740bd37d32Smrg 32750bd37d32Smrgcase "x$ICON_THEME" in #(vi 32760bd37d32Smrgxno) #(vi 32770bd37d32Smrg ;; 32780bd37d32Smrgx|xyes) 32790bd37d32Smrg ICON_THEME=ifelse([$2],,hicolor,$2) 32800bd37d32Smrg ;; 32810bd37d32Smrgesac 32820bd37d32SmrgAC_MSG_RESULT($ICON_THEME) 32830bd37d32Smrg 32840bd37d32Smrgif test "x$ICON_THEME" = xno 32850bd37d32Smrgthen 32860bd37d32Smrg if test "x$ICONDIR" != xno 32870bd37d32Smrg then 32880bd37d32Smrg CF_VERBOSE(ignoring icondir without theme) 32890bd37d32Smrg no_icondir="#" 32900bd37d32Smrg fi 32910bd37d32Smrgelse 32920bd37d32Smrg if test "x$ICONDIR" = xno 32930bd37d32Smrg then 32940bd37d32Smrg AC_MSG_ERROR(icondir must be set for icon theme) 32950bd37d32Smrg fi 32960bd37d32Smrgfi 32970bd37d32Smrg 32980bd37d32Smrg: ${ICON_FORMAT:=ifelse([$3],,[".svg .png .xpm"],[$3])} 32990bd37d32Smrg 33000bd37d32Smrg# ICON_NAME= 33010bd37d32SmrgICON_LIST= 33020bd37d32Smrg 33030bd37d32Smrgifelse([$4],,[cf_icon_list=$1],[ 33040bd37d32Smrgif test "x$ICON_THEME" != xno 33050bd37d32Smrgthen 33060bd37d32Smrg cf_icon_list="$1" 33070bd37d32Smrgelse 33080bd37d32Smrg cf_icon_list="$4" 33090bd37d32Smrgfi 33100bd37d32Smrg]) 33110bd37d32Smrg 33120bd37d32SmrgAC_MSG_CHECKING([for icon(s) to install]) 33130bd37d32Smrgfor cf_name in $cf_icon_list 33140bd37d32Smrgdo 33150bd37d32Smrg CF_VERBOSE(using $ICON_FORMAT) 33160bd37d32Smrg for cf_suffix in $ICON_FORMAT 33170bd37d32Smrg do 33180bd37d32Smrg cf_icon="${cf_name}${cf_suffix}" 33190bd37d32Smrg cf_left=`echo "$cf_icon" | sed -e 's/:.*//'` 33200bd37d32Smrg if test ! -f "${cf_left}" 33210bd37d32Smrg then 33220bd37d32Smrg if test "x$srcdir" != "x." 33230bd37d32Smrg then 33240bd37d32Smrg cf_icon="${srcdir}/${cf_left}" 33250bd37d32Smrg cf_left=`echo "$cf_icon" | sed -e 's/:.*//'` 33260bd37d32Smrg if test ! -f "${cf_left}" 33270bd37d32Smrg then 33280bd37d32Smrg continue 33290bd37d32Smrg fi 33300bd37d32Smrg else 33310bd37d32Smrg continue 33320bd37d32Smrg fi 33330bd37d32Smrg fi 33340bd37d32Smrg if test "x$ICON_THEME" != xno 33350bd37d32Smrg then 33360bd37d32Smrg cf_base=`basename $cf_left` 33370bd37d32Smrg cf_trim=`echo "$cf_base" | sed -e 's/_[[0-9]][[0-9]]x[[0-9]][[0-9]]\././'` 33380bd37d32Smrg case "x${cf_base}" in #(vi 33390bd37d32Smrg *:*) #(vi 33400bd37d32Smrg cf_next=$cf_base 33410bd37d32Smrg # user-defined mapping 33420bd37d32Smrg ;; 33430bd37d32Smrg *.png) #(vi 33440bd37d32Smrg 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'` 33450bd37d32Smrg if test -z "$cf_size" 33460bd37d32Smrg then 33470bd37d32Smrg AC_MSG_WARN(cannot determine size of $cf_left) 33480bd37d32Smrg continue 33490bd37d32Smrg fi 33500bd37d32Smrg cf_next="$cf_size/apps/$cf_trim" 33510bd37d32Smrg ;; 33520bd37d32Smrg *.svg) #(vi 33530bd37d32Smrg cf_next="scalable/apps/$cf_trim" 33540bd37d32Smrg ;; 33550bd37d32Smrg *.xpm) 33560bd37d32Smrg CF_VERBOSE(ignored XPM file in icon theme) 33570bd37d32Smrg continue 33580bd37d32Smrg ;; 33590bd37d32Smrg *_[[0-9]][[0-9]]*x[[0-9]][[0-9]]*.*) #(vi 33600bd37d32Smrg cf_size=`echo "$cf_left"|sed -e 's/^.*_\([[0-9]][[0-9]]*x[[0-9]][[0-9]]*\)\..*$/\1/'` 33610bd37d32Smrg cf_left=`echo "$cf_left"|sed -e 's/^\(.*\)_\([[0-9]][[0-9]]*x[[0-9]][[0-9]]*\)\(\..*\)$/\1\3/'` 33620bd37d32Smrg cf_next="$cf_size/apps/$cf_base" 33630bd37d32Smrg ;; 33640bd37d32Smrg esac 33650bd37d32Smrg CF_VERBOSE(adding $cf_next) 33660bd37d32Smrg cf_icon="${cf_icon}:${cf_next}" 33670bd37d32Smrg fi 33680bd37d32Smrg test -n "$ICON_LIST" && ICON_LIST="$ICON_LIST " 33690bd37d32Smrg ICON_LIST="$ICON_LIST${cf_icon}" 33700bd37d32Smrg if test -z "$ICON_NAME" 33710bd37d32Smrg then 33720bd37d32Smrg ICON_NAME=`basename $cf_icon | sed -e 's/[[.:]].*//'` 33730bd37d32Smrg fi 33740bd37d32Smrg done 33750bd37d32Smrgdone 33760bd37d32Smrg 33770bd37d32Smrgif test -n "$verbose" 33780bd37d32Smrgthen 33790bd37d32Smrg AC_MSG_CHECKING(result) 33800bd37d32Smrgfi 33810bd37d32SmrgAC_MSG_RESULT($ICON_LIST) 33820bd37d32Smrg 33830bd37d32Smrgif test -z "$ICON_LIST" 33840bd37d32Smrgthen 33850bd37d32Smrg AC_MSG_ERROR(no icons found) 33860bd37d32Smrgfi 33870bd37d32Smrg]) 33880bd37d32Smrg 33890bd37d32SmrgAC_MSG_CHECKING(for icon name) 33900bd37d32SmrgAC_MSG_RESULT($ICON_NAME) 33910bd37d32Smrg 33920bd37d32SmrgAC_SUBST(ICON_FORMAT) 33930bd37d32SmrgAC_SUBST(ICON_THEME) 33940bd37d32SmrgAC_SUBST(ICON_LIST) 33950bd37d32SmrgAC_SUBST(ICON_NAME) 33960bd37d32Smrg])dnl 33970bd37d32Smrgdnl --------------------------------------------------------------------------- 339820d2c4d2Smrgdnl CF_WITH_IMAKE_CFLAGS version: 9 updated: 2010/05/26 05:38:42 3399d522f475Smrgdnl -------------------- 3400d522f475Smrgdnl xterm and similar programs build more readily when propped up with imake's 3401d522f475Smrgdnl hand-tuned definitions. If we do not use imake, provide fallbacks for the 3402d522f475Smrgdnl most common definitions that we're not likely to do by autoconf tests. 3403d522f475SmrgAC_DEFUN([CF_WITH_IMAKE_CFLAGS],[ 3404d522f475SmrgAC_REQUIRE([CF_ENABLE_NARROWPROTO]) 3405d522f475Smrg 3406d522f475SmrgAC_MSG_CHECKING(if we should use imake to help) 3407d522f475SmrgCF_ARG_DISABLE(imake, 3408d522f475Smrg [ --disable-imake disable use of imake for definitions], 3409d522f475Smrg [enable_imake=no], 3410d522f475Smrg [enable_imake=yes]) 3411d522f475SmrgAC_MSG_RESULT($enable_imake) 3412d522f475Smrg 3413d522f475Smrgif test "$enable_imake" = yes ; then 341420d2c4d2Smrg CF_IMAKE_CFLAGS(ifelse([$1],,,[$1])) 3415d522f475Smrgfi 3416d522f475Smrg 3417d522f475Smrgif test -n "$IMAKE" && test -n "$IMAKE_CFLAGS" ; then 3418d522f475Smrg CF_ADD_CFLAGS($IMAKE_CFLAGS) 3419d522f475Smrgelse 3420d522f475Smrg IMAKE_CFLAGS= 3421d522f475Smrg IMAKE_LOADFLAGS= 3422d522f475Smrg CF_VERBOSE(make fallback definitions) 3423d522f475Smrg 3424d522f475Smrg # We prefer config.guess' values when we can get them, to avoid 3425d522f475Smrg # inconsistent results with uname (AIX for instance). However, 3426d522f475Smrg # config.guess is not always consistent either. 3427d522f475Smrg case $host_os in 3428d522f475Smrg *[[0-9]].[[0-9]]*) 3429d522f475Smrg UNAME_RELEASE="$host_os" 3430d522f475Smrg ;; 3431d522f475Smrg *) 3432d522f475Smrg UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown 3433d522f475Smrg ;; 3434d522f475Smrg esac 3435d522f475Smrg 3436d522f475Smrg case .$UNAME_RELEASE in 3437d522f475Smrg *[[0-9]].[[0-9]]*) 3438d522f475Smrg OSMAJORVERSION=`echo "$UNAME_RELEASE" |sed -e 's/^[[^0-9]]*//' -e 's/\..*//'` 3439d522f475Smrg OSMINORVERSION=`echo "$UNAME_RELEASE" |sed -e 's/^[[^0-9]]*//' -e 's/^[[^.]]*\.//' -e 's/\..*//' -e 's/[[^0-9]].*//' ` 3440d522f475Smrg test -z "$OSMAJORVERSION" && OSMAJORVERSION=1 3441d522f475Smrg test -z "$OSMINORVERSION" && OSMINORVERSION=0 3442d522f475Smrg IMAKE_CFLAGS="-DOSMAJORVERSION=$OSMAJORVERSION -DOSMINORVERSION=$OSMINORVERSION $IMAKE_CFLAGS" 3443d522f475Smrg ;; 3444d522f475Smrg esac 3445d522f475Smrg 3446d522f475Smrg # FUNCPROTO is standard with X11R6, but XFree86 drops it, leaving some 3447d522f475Smrg # fallback/fragments for NeedPrototypes, etc. 3448d522f475Smrg IMAKE_CFLAGS="-DFUNCPROTO=15 $IMAKE_CFLAGS" 3449d522f475Smrg 3450d522f475Smrg # If this is not set properly, Xaw's scrollbars will not work 3451d522f475Smrg if test "$enable_narrowproto" = yes ; then 3452d522f475Smrg IMAKE_CFLAGS="-DNARROWPROTO=1 $IMAKE_CFLAGS" 3453d522f475Smrg fi 3454d522f475Smrg 3455d522f475Smrg # Other special definitions: 3456d522f475Smrg case $host_os in 3457d522f475Smrg aix*) 3458d522f475Smrg # imake on AIX 5.1 defines AIXV3. really. 3459d522f475Smrg IMAKE_CFLAGS="-DAIXV3 -DAIXV4 $IMAKE_CFLAGS" 3460d522f475Smrg ;; 3461d522f475Smrg irix[[56]].*) #(vi 3462d522f475Smrg # these are needed to make SIGWINCH work in xterm 3463d522f475Smrg IMAKE_CFLAGS="-DSYSV -DSVR4 $IMAKE_CFLAGS" 3464d522f475Smrg ;; 3465d522f475Smrg esac 3466d522f475Smrg 3467d522f475Smrg CF_ADD_CFLAGS($IMAKE_CFLAGS) 3468d522f475Smrg 3469d522f475Smrg AC_SUBST(IMAKE_CFLAGS) 3470d522f475Smrg AC_SUBST(IMAKE_LOADFLAGS) 3471d522f475Smrgfi 3472d522f475Smrg])dnl 3473d522f475Smrgdnl --------------------------------------------------------------------------- 34740bd37d32Smrgdnl CF_WITH_PCRE version: 10 updated: 2012/10/04 20:12:20 3475d522f475Smrgdnl ------------ 3476d522f475Smrgdnl Add PCRE (Perl-compatible regular expressions) to the build if it is 3477d522f475Smrgdnl available and the user requests it. Assume the application will otherwise 3478d522f475Smrgdnl use the POSIX interface. 3479d522f475Smrgdnl 3480d522f475Smrgdnl TODO allow $withval to specify package location 3481d522f475SmrgAC_DEFUN([CF_WITH_PCRE], 3482d522f475Smrg[ 348320d2c4d2SmrgAC_REQUIRE([CF_PKG_CONFIG]) 348420d2c4d2Smrg 3485d522f475SmrgAC_MSG_CHECKING(if you want to use PCRE for regular-expressions) 3486d522f475SmrgAC_ARG_WITH(pcre, 3487d522f475Smrg [ --with-pcre use PCRE for regular-expressions]) 3488d522f475Smrgtest -z "$with_pcre" && with_pcre=no 3489d522f475SmrgAC_MSG_RESULT($with_pcre) 3490d522f475Smrg 3491d522f475Smrgif test "$with_pcre" != no ; then 349220d2c4d2Smrg CF_TRY_PKG_CONFIG(libpcre,,[ 349320d2c4d2Smrg AC_CHECK_LIB(pcre,pcre_compile,, 349420d2c4d2Smrg AC_MSG_ERROR(Cannot find PCRE library))]) 349520d2c4d2Smrg 34960bd37d32Smrg AC_DEFINE(HAVE_LIB_PCRE,1,[Define to 1 if we can/should compile with the PCRE library]) 349720d2c4d2Smrg 349820d2c4d2Smrg case $LIBS in #(vi 349920d2c4d2Smrg *pcreposix*) #(vi 350020d2c4d2Smrg ;; 350120d2c4d2Smrg *) 350220d2c4d2Smrg AC_CHECK_LIB(pcreposix,pcreposix_regcomp, 35030bd37d32Smrg [AC_DEFINE(HAVE_PCREPOSIX_H,1,[Define to 1 if we should include pcreposix.h]) 350420d2c4d2Smrg CF_ADD_LIB(pcreposix)], 350520d2c4d2Smrg [AC_CHECK_LIB(pcreposix,regcomp,[ 35060bd37d32Smrg AC_DEFINE(HAVE_PCREPOSIX_H,1,[Define to 1 if we should include pcreposix.h]) 350720d2c4d2Smrg CF_ADD_LIB(pcreposix)], 350820d2c4d2Smrg AC_MSG_ERROR(Cannot find PCRE POSIX library)])) 350920d2c4d2Smrg ;; 351020d2c4d2Smrg esac 3511d522f475Smrgfi 3512d522f475Smrg])dnl 3513d522f475Smrgdnl --------------------------------------------------------------------------- 35140bd37d32Smrgdnl CF_WITH_PIXMAPDIR version: 3 updated: 2012/07/22 09:18:02 35150bd37d32Smrgdnl ----------------- 35160bd37d32Smrgdnl Handle configure option "--with-pixmapdir", setting these shell variables: 35170bd37d32Smrgdnl 35180bd37d32Smrgdnl $PIXMAPDIR is the option value, used for installing pixmap files. 35190bd37d32Smrgdnl $no_pixmapdir is a "#" (comment) if "--without-pixmapdir" is given. 35200bd37d32SmrgAC_DEFUN([CF_WITH_PIXMAPDIR],[ 35210bd37d32SmrgAC_MSG_CHECKING(for directory to install pixmaps) 35220bd37d32SmrgAC_ARG_WITH(pixmapdir, 35230bd37d32Smrg [ --with-pixmapdir=DIR directory in which to install pixmaps (DATADIR/pixmaps)], 35240bd37d32Smrg [PIXMAPDIR=$withval], 35250bd37d32Smrg [test -z "$PIXMAPDIR" && PIXMAPDIR='${datadir}/pixmaps']) 35260bd37d32Smrg 35270bd37d32Smrgif test "x[$]PIXMAPDIR" = xauto 35280bd37d32Smrgthen 35290bd37d32Smrg PIXMAPDIR='${datadir}/pixmaps' 35300bd37d32Smrg for cf_path in \ 35310bd37d32Smrg /usr/share/pixmaps \ 35320bd37d32Smrg /usr/X11R6/share/pixmaps 35330bd37d32Smrg do 35340bd37d32Smrg if test -d "$cf_path" ; then 35350bd37d32Smrg PIXMAPDIR="$cf_path" 35360bd37d32Smrg break 35370bd37d32Smrg fi 35380bd37d32Smrg done 35390bd37d32Smrgelse 35400bd37d32Smrg cf_path=$PIXMAPDIR 35410bd37d32Smrg CF_PATH_SYNTAX(cf_path) 35420bd37d32Smrgfi 35430bd37d32SmrgAC_MSG_RESULT($PIXMAPDIR) 35440bd37d32SmrgAC_SUBST(PIXMAPDIR) 35450bd37d32Smrg 35460bd37d32Smrgno_pixmapdir= 35470bd37d32Smrgif test "$PIXMAPDIR" = no 35480bd37d32Smrgthen 35490bd37d32Smrg no_pixmapdir="#" 35500bd37d32Smrgelse 35510bd37d32Smrg EXTRA_INSTALL_DIRS="$EXTRA_INSTALL_DIRS \$(PIXMAPDIR)" 35520bd37d32Smrgfi 35530bd37d32SmrgAC_SUBST(no_pixmapdir) 35540bd37d32Smrg])dnl 35550bd37d32Smrgdnl --------------------------------------------------------------------------- 35560bd37d32Smrgdnl CF_WITH_VALGRIND version: 1 updated: 2006/12/14 18:00:21 35570bd37d32Smrgdnl ---------------- 35580bd37d32SmrgAC_DEFUN([CF_WITH_VALGRIND],[ 35590bd37d32SmrgCF_NO_LEAKS_OPTION(valgrind, 35600bd37d32Smrg [ --with-valgrind test: use valgrind], 35610bd37d32Smrg [USE_VALGRIND]) 35620bd37d32Smrg])dnl 35630bd37d32Smrgdnl --------------------------------------------------------------------------- 35640bd37d32Smrgdnl CF_WITH_XPM version: 3 updated: 2012/10/04 06:57:36 35650bd37d32Smrgdnl ----------- 35660bd37d32Smrgdnl Test for Xpm library, update compiler/loader flags if it is wanted and 35670bd37d32Smrgdnl found. 35680bd37d32Smrgdnl 35690bd37d32Smrgdnl Also sets ICON_SUFFIX 35700bd37d32SmrgAC_DEFUN([CF_WITH_XPM], 35710bd37d32Smrg[ 35720bd37d32SmrgICON_SUFFIX=.xbm 35730bd37d32Smrg 35740bd37d32Smrgcf_save_cppflags="${CPPFLAGS}" 35750bd37d32Smrgcf_save_ldflags="${LDFLAGS}" 35760bd37d32Smrg 35770bd37d32SmrgAC_MSG_CHECKING(if you want to use the Xpm library for colored icon) 35780bd37d32SmrgAC_ARG_WITH(xpm, 35790bd37d32Smrg[ --with-xpm=DIR use Xpm library for colored icon, may specify path], 35800bd37d32Smrg [cf_Xpm_library="$withval"], 35810bd37d32Smrg [cf_Xpm_library=yes]) 35820bd37d32SmrgAC_MSG_RESULT($cf_Xpm_library) 35830bd37d32Smrg 35840bd37d32Smrgif test "$cf_Xpm_library" != no ; then 35850bd37d32Smrg if test "$cf_Xpm_library" != yes ; then 35860bd37d32Smrg CPPFLAGS="$CPPFLAGS -I$withval/include" 35870bd37d32Smrg LDFLAGS="$LDFLAGS -L$withval/lib" 35880bd37d32Smrg fi 35890bd37d32Smrg AC_CHECK_HEADER(X11/xpm.h,[ 35900bd37d32Smrg AC_CHECK_LIB(Xpm, XpmCreatePixmapFromData,[ 35910bd37d32Smrg AC_DEFINE(HAVE_LIBXPM,1,[Define to 1 if we should use Xpm library]) 35920bd37d32Smrg ICON_SUFFIX=.xpm 35930bd37d32Smrg LIBS="-lXpm $LIBS"], 35940bd37d32Smrg [CPPFLAGS="${cf_save_cppflags}" LDFLAGS="${cf_save_ldflags}"], 35950bd37d32Smrg [-lX11 $X_LIBS])], 35960bd37d32Smrg [CPPFLAGS="${cf_save_cppflags}" LDFLAGS="${cf_save_ldflags}"]) 35970bd37d32Smrgfi 35980bd37d32Smrg 35990bd37d32SmrgAC_SUBST(ICON_SUFFIX) 36000bd37d32Smrg])dnl 36010bd37d32Smrgdnl --------------------------------------------------------------------------- 36020bd37d32Smrgdnl CF_XBOOL_RESULT version: 2 updated: 2012/10/04 06:57:36 36030bd37d32Smrgdnl --------------- 36040bd37d32Smrgdnl Translate an autoconf boolean yes/no into X11's booleans, e.g., True/False. 36050bd37d32Smrgdnl Allow for more than two values, e.g., "maybe", still using the same leading 36060bd37d32Smrgdnl capital convention. 36070bd37d32Smrgdnl 36080bd37d32Smrgdnl $1 = symbol to define 36090bd37d32Smrgdnl $2 = symbol holding value 36100bd37d32Smrgdnl $3 = description 36110bd37d32Smrgdefine([CF_XBOOL_RESULT],[ 36120bd37d32SmrgAC_MSG_RESULT([$]$2) 36130bd37d32Smrgcase [$]$2 in #(vi 36140bd37d32Smrgyes) #(vi 36150bd37d32Smrg $2=true 36160bd37d32Smrg ;; 36170bd37d32Smrgno) #(vi 36180bd37d32Smrg $2=false 36190bd37d32Smrg ;; 36200bd37d32Smrgesac 36210bd37d32Smrgcf_xbool1=`echo "[$]$2"|sed -e 's/^\(.\).*/\1/'` 36220bd37d32SmrgCF_UPPER(cf_xbool1,$cf_xbool1) 36230bd37d32Smrgcf_xbool2=`echo "[$]$2"|sed -e 's/^.//'` 36240bd37d32Smrg$2=${cf_xbool1}${cf_xbool2} 36250bd37d32SmrgAC_DEFINE_UNQUOTED($1,[$]$2,$3) 36260bd37d32SmrgAC_SUBST($2) 36270bd37d32Smrg]) 36280bd37d32Smrgdnl --------------------------------------------------------------------------- 36290bd37d32Smrgdnl CF_XKB_BELL_EXT version: 4 updated: 2012/10/04 20:12:20 3630d522f475Smrgdnl --------------- 3631d522f475Smrgdnl Check for XKB bell extension 3632d522f475SmrgAC_DEFUN([CF_XKB_BELL_EXT],[ 3633d522f475SmrgAC_CACHE_CHECK(for XKB Bell extension, cf_cv_xkb_bell_ext,[ 3634d522f475SmrgAC_TRY_LINK([ 3635956cc18dSsnj#include <X11/Intrinsic.h> 3636d522f475Smrg#include <X11/XKBlib.h> /* has the prototype */ 3637d522f475Smrg#include <X11/extensions/XKBbells.h> /* has the XkbBI_xxx definitions */ 3638d522f475Smrg],[ 3639956cc18dSsnj int x = (XkbBI_Info |XkbBI_MinorError |XkbBI_MajorError |XkbBI_TerminalBell |XkbBI_MarginBell); 3640956cc18dSsnj Atom y; 3641956cc18dSsnj XkbBell((Display *)0, (Widget)0, 0, y); 3642d522f475Smrg],[cf_cv_xkb_bell_ext=yes],[cf_cv_xkb_bell_ext=no]) 3643d522f475Smrg]) 36440bd37d32Smrgtest "$cf_cv_xkb_bell_ext" = yes && AC_DEFINE(HAVE_XKB_BELL_EXT,1,[Define 1 if we have XKB Bell extension]) 36450bd37d32Smrg]) 36460bd37d32Smrgdnl --------------------------------------------------------------------------- 36470bd37d32Smrgdnl CF_XKB_KEYCODE_TO_KEYSYM version: 2 updated: 2012/09/28 20:23:33 36480bd37d32Smrgdnl ------------------------ 36490bd37d32Smrgdnl Some older vendor-unix systems made a practice of delivering fragments of 36500bd37d32Smrgdnl Xkb, requiring test-compiles. 36510bd37d32SmrgAC_DEFUN([CF_XKB_KEYCODE_TO_KEYSYM],[ 36520bd37d32SmrgAC_CACHE_CHECK(if we can use XkbKeycodeToKeysym, cf_cv_xkb_keycode_to_keysym,[ 36530bd37d32SmrgAC_TRY_COMPILE([ 36540bd37d32Smrg#include <X11/Xlib.h> 36550bd37d32Smrg#include <X11/XKBlib.h> 36560bd37d32Smrg],[ 36570bd37d32Smrg KeySym keysym = XkbKeycodeToKeysym((Display *)0, 0, 0, 0); 36580bd37d32Smrg],[ 36590bd37d32Smrgcf_cv_xkb_keycode_to_keysym=yes 36600bd37d32Smrg],[ 36610bd37d32Smrgcf_cv_xkb_keycode_to_keysym=no 36620bd37d32Smrg]) 36630bd37d32Smrg]) 36640bd37d32Smrg 36650bd37d32Smrgif test $cf_cv_xkb_keycode_to_keysym = yes 36660bd37d32Smrgthen 36670bd37d32Smrg AC_CHECK_FUNCS(XkbKeycodeToKeysym) 36680bd37d32Smrgfi 36690bd37d32Smrg]) 36700bd37d32Smrgdnl --------------------------------------------------------------------------- 36710bd37d32Smrgdnl CF_XKB_QUERY_EXTENSION version: 2 updated: 2012/09/28 20:23:46 36720bd37d32Smrgdnl ---------------------- 36730bd37d32Smrgdnl see ifdef in scrollbar.c - iron out here 36740bd37d32SmrgAC_DEFUN([CF_XKB_QUERY_EXTENSION],[ 36750bd37d32SmrgAC_CACHE_CHECK(if we can use XkbQueryExtension, cf_cv_xkb_query_extension,[ 36760bd37d32SmrgAC_TRY_COMPILE([ 36770bd37d32Smrg#include <X11/Xlib.h> 36780bd37d32Smrg#include <X11/extensions/XKB.h> 36790bd37d32Smrg#include <X11/XKBlib.h> 36800bd37d32Smrg],[ 36810bd37d32Smrg int xkbmajor = XkbMajorVersion; 36820bd37d32Smrg int xkbminor = XkbMinorVersion; 36830bd37d32Smrg int xkbopcode, xkbevent, xkberror; 36840bd37d32Smrg 36850bd37d32Smrg if (XkbLibraryVersion(&xkbmajor, &xkbminor) 36860bd37d32Smrg && XkbQueryExtension((Display *)0, 36870bd37d32Smrg &xkbopcode, 36880bd37d32Smrg &xkbevent, 36890bd37d32Smrg &xkberror, 36900bd37d32Smrg &xkbmajor, 36910bd37d32Smrg &xkbminor)) 36920bd37d32Smrg return 0; 36930bd37d32Smrg],[ 36940bd37d32Smrgcf_cv_xkb_query_extension=yes 36950bd37d32Smrg],[ 36960bd37d32Smrgcf_cv_xkb_query_extension=no 36970bd37d32Smrg]) 36980bd37d32Smrg]) 36990bd37d32Smrg 37000bd37d32Smrgif test $cf_cv_xkb_query_extension = yes 37010bd37d32Smrgthen 37020bd37d32Smrg AC_CHECK_FUNCS(XkbQueryExtension) 37030bd37d32Smrgfi 3704d522f475Smrg]) 3705d522f475Smrgdnl --------------------------------------------------------------------------- 37060bd37d32Smrgdnl CF_XOPEN_SOURCE version: 43 updated: 2013/02/10 10:41:05 3707d522f475Smrgdnl --------------- 3708d522f475Smrgdnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions, 3709d522f475Smrgdnl or adapt to the vendor's definitions to get equivalent functionality, 3710d522f475Smrgdnl without losing the common non-POSIX features. 3711d522f475Smrgdnl 3712d522f475Smrgdnl Parameters: 3713d522f475Smrgdnl $1 is the nominal value for _XOPEN_SOURCE 3714d522f475Smrgdnl $2 is the nominal value for _POSIX_C_SOURCE 3715d522f475SmrgAC_DEFUN([CF_XOPEN_SOURCE],[ 37160bd37d32SmrgAC_REQUIRE([AC_CANONICAL_HOST]) 3717d522f475Smrg 371820d2c4d2Smrgcf_XOPEN_SOURCE=ifelse([$1],,500,[$1]) 371920d2c4d2Smrgcf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2]) 372020d2c4d2Smrgcf_xopen_source= 3721d522f475Smrg 3722d522f475Smrgcase $host_os in #(vi 3723e39b573cSmrgaix[[4-7]]*) #(vi 372420d2c4d2Smrg cf_xopen_source="-D_ALL_SOURCE" 372520d2c4d2Smrg ;; 3726e39b573cSmrgcygwin) #(vi 3727e39b573cSmrg cf_XOPEN_SOURCE=600 3728e39b573cSmrg ;; 372920d2c4d2Smrgdarwin[[0-8]].*) #(vi 373020d2c4d2Smrg cf_xopen_source="-D_APPLE_C_SOURCE" 373120d2c4d2Smrg ;; 373220d2c4d2Smrgdarwin*) #(vi 373320d2c4d2Smrg cf_xopen_source="-D_DARWIN_C_SOURCE" 37340bd37d32Smrg cf_XOPEN_SOURCE= 3735d522f475Smrg ;; 37362eaa94a1Schristosfreebsd*|dragonfly*) #(vi 3737d522f475Smrg # 5.x headers associate 3738d522f475Smrg # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L 3739d522f475Smrg # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L 3740d522f475Smrg cf_POSIX_C_SOURCE=200112L 3741d522f475Smrg cf_XOPEN_SOURCE=600 374220d2c4d2Smrg cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" 374320d2c4d2Smrg ;; 374420d2c4d2Smrghpux11*) #(vi 374520d2c4d2Smrg cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500" 3746d522f475Smrg ;; 3747d522f475Smrghpux*) #(vi 374820d2c4d2Smrg cf_xopen_source="-D_HPUX_SOURCE" 3749d522f475Smrg ;; 3750d522f475Smrgirix[[56]].*) #(vi 375120d2c4d2Smrg cf_xopen_source="-D_SGI_SOURCE" 37520bd37d32Smrg cf_XOPEN_SOURCE= 3753d522f475Smrg ;; 37542eaa94a1Schristoslinux*|gnu*|mint*|k*bsd*-gnu) #(vi 3755d522f475Smrg CF_GNU_SOURCE 3756d522f475Smrg ;; 3757d522f475Smrgmirbsd*) #(vi 37580bd37d32Smrg # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <sys/select.h> and other headers which use u_int / u_short types 37590bd37d32Smrg cf_XOPEN_SOURCE= 37600bd37d32Smrg CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) 3761d522f475Smrg ;; 3762d522f475Smrgnetbsd*) #(vi 37630bd37d32Smrg cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw 37640bd37d32Smrg ;; 37650bd37d32Smrgopenbsd[[4-9]]*) #(vi 37660bd37d32Smrg # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw 37670bd37d32Smrg cf_xopen_source="-D_BSD_SOURCE" 37680bd37d32Smrg cf_XOPEN_SOURCE=600 3769d522f475Smrg ;; 3770d522f475Smrgopenbsd*) #(vi 3771d522f475Smrg # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw 3772d522f475Smrg ;; 3773d522f475Smrgosf[[45]]*) #(vi 377420d2c4d2Smrg cf_xopen_source="-D_OSF_SOURCE" 3775d522f475Smrg ;; 3776d522f475Smrgnto-qnx*) #(vi 377720d2c4d2Smrg cf_xopen_source="-D_QNX_SOURCE" 3778d522f475Smrg ;; 3779d522f475Smrgsco*) #(vi 3780d522f475Smrg # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer 3781d522f475Smrg ;; 37820bd37d32Smrgsolaris2.*) #(vi 378320d2c4d2Smrg cf_xopen_source="-D__EXTENSIONS__" 3784d522f475Smrg ;; 3785d522f475Smrg*) 37860bd37d32Smrg CF_TRY_XOPEN_SOURCE 3787d522f475Smrg CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) 3788d522f475Smrg ;; 3789d522f475Smrgesac 379020d2c4d2Smrg 379120d2c4d2Smrgif test -n "$cf_xopen_source" ; then 379220d2c4d2Smrg CF_ADD_CFLAGS($cf_xopen_source) 379320d2c4d2Smrgfi 37940bd37d32Smrg 37950bd37d32Smrgdnl In anything but the default case, we may have system-specific setting 37960bd37d32Smrgdnl which is still not guaranteed to provide all of the entrypoints that 37970bd37d32Smrgdnl _XOPEN_SOURCE would yield. 37980bd37d32Smrgif test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then 37990bd37d32Smrg AC_MSG_CHECKING(if _XOPEN_SOURCE really is set) 38000bd37d32Smrg AC_TRY_COMPILE([#include <stdlib.h>],[ 38010bd37d32Smrg#ifndef _XOPEN_SOURCE 38020bd37d32Smrgmake an error 38030bd37d32Smrg#endif], 38040bd37d32Smrg [cf_XOPEN_SOURCE_set=yes], 38050bd37d32Smrg [cf_XOPEN_SOURCE_set=no]) 38060bd37d32Smrg AC_MSG_RESULT($cf_XOPEN_SOURCE_set) 38070bd37d32Smrg if test $cf_XOPEN_SOURCE_set = yes 38080bd37d32Smrg then 38090bd37d32Smrg AC_TRY_COMPILE([#include <stdlib.h>],[ 38100bd37d32Smrg#if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE 38110bd37d32Smrgmake an error 38120bd37d32Smrg#endif], 38130bd37d32Smrg [cf_XOPEN_SOURCE_set_ok=yes], 38140bd37d32Smrg [cf_XOPEN_SOURCE_set_ok=no]) 38150bd37d32Smrg if test $cf_XOPEN_SOURCE_set_ok = no 38160bd37d32Smrg then 38170bd37d32Smrg AC_MSG_WARN(_XOPEN_SOURCE is lower than requested) 38180bd37d32Smrg fi 38190bd37d32Smrg else 38200bd37d32Smrg CF_TRY_XOPEN_SOURCE 38210bd37d32Smrg fi 38220bd37d32Smrgfi 3823d522f475Smrg]) 3824d522f475Smrgdnl --------------------------------------------------------------------------- 38256879286fSmrgdnl CF_X_ATHENA version: 20 updated: 2010/11/09 05:18:02 3826d522f475Smrgdnl ----------- 3827d522f475Smrgdnl Check for Xaw (Athena) libraries 3828d522f475Smrgdnl 3829d522f475Smrgdnl Sets $cf_x_athena according to the flavor of Xaw which is used. 3830d522f475SmrgAC_DEFUN([CF_X_ATHENA], 383120d2c4d2Smrg[ 38326879286fSmrgcf_x_athena=${cf_x_athena:-Xaw} 3833d522f475Smrg 3834d522f475SmrgAC_MSG_CHECKING(if you want to link with Xaw 3d library) 3835d522f475Smrgwithval= 3836d522f475SmrgAC_ARG_WITH(Xaw3d, 3837d522f475Smrg [ --with-Xaw3d link with Xaw 3d library]) 3838d522f475Smrgif test "$withval" = yes ; then 3839d522f475Smrg cf_x_athena=Xaw3d 3840d522f475Smrg AC_MSG_RESULT(yes) 3841d522f475Smrgelse 3842d522f475Smrg AC_MSG_RESULT(no) 3843d522f475Smrgfi 3844d522f475Smrg 3845d522f475SmrgAC_MSG_CHECKING(if you want to link with neXT Athena library) 3846d522f475Smrgwithval= 3847d522f475SmrgAC_ARG_WITH(neXtaw, 3848d522f475Smrg [ --with-neXtaw link with neXT Athena library]) 3849d522f475Smrgif test "$withval" = yes ; then 3850d522f475Smrg cf_x_athena=neXtaw 3851d522f475Smrg AC_MSG_RESULT(yes) 3852d522f475Smrgelse 3853d522f475Smrg AC_MSG_RESULT(no) 3854d522f475Smrgfi 3855d522f475Smrg 3856d522f475SmrgAC_MSG_CHECKING(if you want to link with Athena-Plus library) 3857d522f475Smrgwithval= 3858d522f475SmrgAC_ARG_WITH(XawPlus, 3859d522f475Smrg [ --with-XawPlus link with Athena-Plus library]) 3860d522f475Smrgif test "$withval" = yes ; then 3861d522f475Smrg cf_x_athena=XawPlus 3862d522f475Smrg AC_MSG_RESULT(yes) 3863d522f475Smrgelse 3864d522f475Smrg AC_MSG_RESULT(no) 3865d522f475Smrgfi 3866d522f475Smrg 3867d522f475Smrgcf_x_athena_lib="" 3868d522f475Smrg 386920d2c4d2Smrgif test "$PKG_CONFIG" != none ; then 387020d2c4d2Smrg cf_athena_list= 387120d2c4d2Smrg test "$cf_x_athena" = Xaw && cf_athena_list="xaw8 xaw7 xaw6" 387220d2c4d2Smrg for cf_athena_pkg in \ 387320d2c4d2Smrg $cf_athena_list \ 387420d2c4d2Smrg ${cf_x_athena} \ 387520d2c4d2Smrg ${cf_x_athena}-devel \ 387620d2c4d2Smrg lib${cf_x_athena} \ 387720d2c4d2Smrg lib${cf_x_athena}-devel 387820d2c4d2Smrg do 387920d2c4d2Smrg CF_TRY_PKG_CONFIG($cf_athena_pkg,[ 388020d2c4d2Smrg cf_x_athena_lib="$cf_pkgconfig_libs" 388120d2c4d2Smrg CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena) 388220d2c4d2Smrg AC_DEFINE_UNQUOTED($cf_x_athena_LIBS) 38836879286fSmrg 38846879286fSmrgAC_CACHE_CHECK(for usable $cf_x_athena/Xmu package,cf_cv_xaw_compat,[ 38856879286fSmrgAC_TRY_LINK([ 38866879286fSmrg#include <X11/Xmu/CharSet.h> 38876879286fSmrg],[ 38886879286fSmrgint check = XmuCompareISOLatin1("big", "small") 38896879286fSmrg],[cf_cv_xaw_compat=yes],[cf_cv_xaw_compat=no])]) 38906879286fSmrg 38916879286fSmrg if test "$cf_cv_xaw_compat" = no 38926879286fSmrg then 38936879286fSmrg # workaround for broken ".pc" files... 38946879286fSmrg case "$cf_x_athena_lib" in #(vi 38956879286fSmrg *-lXmu*) #(vi 38966879286fSmrg ;; 38976879286fSmrg *) 38986879286fSmrg CF_VERBOSE(work around broken package) 38996879286fSmrg CF_TRY_PKG_CONFIG(xmu,,[CF_ADD_LIB_AFTER(-lXt,-lXmu)]) 39006879286fSmrg ;; 39016879286fSmrg esac 39026879286fSmrg fi 39036879286fSmrg 390420d2c4d2Smrg break]) 390520d2c4d2Smrg done 390620d2c4d2Smrgfi 390720d2c4d2Smrg 390820d2c4d2Smrgif test -z "$cf_x_athena_lib" ; then 390920d2c4d2Smrg CF_X_EXT 391020d2c4d2Smrg CF_X_TOOLKIT 391120d2c4d2Smrg CF_X_ATHENA_CPPFLAGS($cf_x_athena) 391220d2c4d2Smrg CF_X_ATHENA_LIBS($cf_x_athena) 391320d2c4d2Smrgfi 3914d522f475Smrg])dnl 3915d522f475Smrgdnl --------------------------------------------------------------------------- 391620d2c4d2Smrgdnl CF_X_ATHENA_CPPFLAGS version: 5 updated: 2010/05/26 17:35:30 3917d522f475Smrgdnl -------------------- 3918d522f475Smrgdnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of 3919d522f475Smrgdnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw. 3920d522f475SmrgAC_DEFUN([CF_X_ATHENA_CPPFLAGS], 3921d522f475Smrg[ 392220d2c4d2Smrgcf_x_athena_root=ifelse([$1],,Xaw,[$1]) 392320d2c4d2Smrgcf_x_athena_inc="" 3924d522f475Smrg 3925d522f475Smrgfor cf_path in default \ 3926d522f475Smrg /usr/contrib/X11R6 \ 3927d522f475Smrg /usr/contrib/X11R5 \ 3928d522f475Smrg /usr/lib/X11R5 \ 3929d522f475Smrg /usr/local 3930d522f475Smrgdo 393120d2c4d2Smrg if test -z "$cf_x_athena_inc" ; then 3932d522f475Smrg cf_save="$CPPFLAGS" 3933d522f475Smrg cf_test=X11/$cf_x_athena_root/SimpleMenu.h 3934d522f475Smrg if test $cf_path != default ; then 3935956cc18dSsnj CPPFLAGS="$cf_save -I$cf_path/include" 3936d522f475Smrg AC_MSG_CHECKING(for $cf_test in $cf_path) 3937d522f475Smrg else 3938d522f475Smrg AC_MSG_CHECKING(for $cf_test) 3939d522f475Smrg fi 3940d522f475Smrg AC_TRY_COMPILE([ 3941d522f475Smrg#include <X11/Intrinsic.h> 3942d522f475Smrg#include <$cf_test>],[], 3943d522f475Smrg [cf_result=yes], 3944d522f475Smrg [cf_result=no]) 3945d522f475Smrg AC_MSG_RESULT($cf_result) 3946d522f475Smrg if test "$cf_result" = yes ; then 394720d2c4d2Smrg cf_x_athena_inc=$cf_path 3948d522f475Smrg break 3949d522f475Smrg else 3950d522f475Smrg CPPFLAGS="$cf_save" 3951d522f475Smrg fi 3952d522f475Smrg fi 3953d522f475Smrgdone 3954d522f475Smrg 395520d2c4d2Smrgif test -z "$cf_x_athena_inc" ; then 3956d522f475Smrg AC_MSG_WARN( 3957d522f475Smrg[Unable to successfully find Athena header files with test program]) 395820d2c4d2Smrgelif test "$cf_x_athena_inc" != default ; then 395920d2c4d2Smrg CPPFLAGS="$CPPFLAGS -I$cf_x_athena_inc" 3960d522f475Smrgfi 3961d522f475Smrg]) 3962d522f475Smrgdnl --------------------------------------------------------------------------- 39630bd37d32Smrgdnl CF_X_ATHENA_LIBS version: 12 updated: 2011/07/17 19:55:02 3964d522f475Smrgdnl ---------------- 3965d522f475Smrgdnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of 3966d522f475Smrgdnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw. 3967d522f475SmrgAC_DEFUN([CF_X_ATHENA_LIBS], 3968d522f475Smrg[AC_REQUIRE([CF_X_TOOLKIT]) 396920d2c4d2Smrgcf_x_athena_root=ifelse([$1],,Xaw,[$1]) 3970d522f475Smrgcf_x_athena_lib="" 3971d522f475Smrg 3972d522f475Smrgfor cf_path in default \ 3973d522f475Smrg /usr/contrib/X11R6 \ 3974d522f475Smrg /usr/contrib/X11R5 \ 3975d522f475Smrg /usr/lib/X11R5 \ 3976d522f475Smrg /usr/local 3977d522f475Smrgdo 3978d522f475Smrg for cf_lib in \ 39790bd37d32Smrg ${cf_x_athena_root} \ 39800bd37d32Smrg ${cf_x_athena_root}7 \ 39810bd37d32Smrg ${cf_x_athena_root}6 39820bd37d32Smrg do 39830bd37d32Smrg for cf_libs in \ 39840bd37d32Smrg "-l$cf_lib -lXmu" \ 39850bd37d32Smrg "-l$cf_lib -lXpm -lXmu" \ 39860bd37d32Smrg "-l${cf_lib}_s -lXmu_s" 3987d522f475Smrg do 3988d522f475Smrg if test -z "$cf_x_athena_lib" ; then 3989d522f475Smrg cf_save="$LIBS" 3990d522f475Smrg cf_test=XawSimpleMenuAddGlobalActions 3991d522f475Smrg if test $cf_path != default ; then 39920bd37d32Smrg CF_ADD_LIBS(-L$cf_path/lib $cf_libs) 39930bd37d32Smrg AC_MSG_CHECKING(for $cf_libs in $cf_path) 3994d522f475Smrg else 39950bd37d32Smrg CF_ADD_LIBS($cf_libs) 39960bd37d32Smrg AC_MSG_CHECKING(for $cf_test in $cf_libs) 3997d522f475Smrg fi 3998a1f3da82Smrg AC_TRY_LINK([ 3999a1f3da82Smrg#include <X11/Intrinsic.h> 4000a1f3da82Smrg#include <X11/$cf_x_athena_root/SimpleMenu.h> 4001a1f3da82Smrg],[ 4002a1f3da82Smrg$cf_test((XtAppContext) 0)], 4003d522f475Smrg [cf_result=yes], 4004d522f475Smrg [cf_result=no]) 4005d522f475Smrg AC_MSG_RESULT($cf_result) 4006d522f475Smrg if test "$cf_result" = yes ; then 40070bd37d32Smrg cf_x_athena_lib="$cf_libs" 4008d522f475Smrg break 4009d522f475Smrg fi 4010d522f475Smrg LIBS="$cf_save" 4011d522f475Smrg fi 40120bd37d32Smrg done # cf_libs 40130bd37d32Smrg test -n "$cf_x_athena_lib" && break 40140bd37d32Smrg done # cf_lib 4015d522f475Smrgdone 4016d522f475Smrg 4017d522f475Smrgif test -z "$cf_x_athena_lib" ; then 4018d522f475Smrg AC_MSG_ERROR( 4019d522f475Smrg[Unable to successfully link Athena library (-l$cf_x_athena_root) with test program]) 4020d522f475Smrgfi 4021d522f475Smrg 4022d522f475SmrgCF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena) 4023d522f475SmrgAC_DEFINE_UNQUOTED($cf_x_athena_LIBS) 4024d522f475Smrg]) 4025d522f475Smrgdnl --------------------------------------------------------------------------- 402620d2c4d2Smrgdnl CF_X_EXT version: 3 updated: 2010/06/02 05:03:05 402720d2c4d2Smrgdnl -------- 402820d2c4d2SmrgAC_DEFUN([CF_X_EXT],[ 402920d2c4d2SmrgCF_TRY_PKG_CONFIG(Xext,,[ 403020d2c4d2Smrg AC_CHECK_LIB(Xext,XextCreateExtension, 403120d2c4d2Smrg [CF_ADD_LIB(Xext)])]) 403220d2c4d2Smrg])dnl 403320d2c4d2Smrgdnl --------------------------------------------------------------------------- 4034e39b573cSmrgdnl CF_X_FONTCONFIG version: 4 updated: 2011/07/04 10:01:31 40356879286fSmrgdnl --------------- 40366879286fSmrgdnl Check for fontconfig library, a dependency of the X FreeType library. 40376879286fSmrgAC_DEFUN([CF_X_FONTCONFIG], 40386879286fSmrg[ 40396879286fSmrgAC_REQUIRE([CF_X_FREETYPE]) 40406879286fSmrg 4041e39b573cSmrgif test "$cf_cv_found_freetype" = yes ; then 40426879286fSmrgAC_CACHE_CHECK(for usable Xft/fontconfig package,cf_cv_xft_compat,[ 40436879286fSmrgAC_TRY_LINK([ 40446879286fSmrg#include <X11/Xft/Xft.h> 40456879286fSmrg],[ 40466879286fSmrg XftPattern *pat; 40476879286fSmrg XftPatternBuild(pat, 40486879286fSmrg XFT_FAMILY, XftTypeString, "mono", 40496879286fSmrg (void *) 0); 40506879286fSmrg],[cf_cv_xft_compat=yes],[cf_cv_xft_compat=no]) 40516879286fSmrg]) 40526879286fSmrg 40536879286fSmrgif test "$cf_cv_xft_compat" = no 40546879286fSmrgthen 40556879286fSmrg # workaround for broken ".pc" files used for Xft. 40566879286fSmrg case "$cf_cv_x_freetype_libs" in #(vi 40576879286fSmrg *-lfontconfig*) #(vi 40586879286fSmrg ;; 40596879286fSmrg *) 40606879286fSmrg CF_VERBOSE(work around broken package) 40616879286fSmrg CF_TRY_PKG_CONFIG(fontconfig,,[CF_ADD_LIB_AFTER(-lXft,-lfontconfig)]) 40626879286fSmrg ;; 40636879286fSmrg esac 40646879286fSmrgfi 4065e39b573cSmrgfi 40666879286fSmrg])dnl 40676879286fSmrgdnl --------------------------------------------------------------------------- 40680bd37d32Smrgdnl CF_X_FREETYPE version: 26 updated: 2012/10/04 20:12:20 4069d522f475Smrgdnl ------------- 4070d522f475Smrgdnl Check for X FreeType headers and libraries (XFree86 4.x, etc). 4071d522f475Smrgdnl 4072d522f475Smrgdnl First check for the appropriate config program, since the developers for 4073d522f475Smrgdnl these libraries change their configuration (and config program) more or 4074d522f475Smrgdnl less randomly. If we cannot find the config program, do not bother trying 4075d522f475Smrgdnl to guess the latest variation of include/lib directories. 4076d522f475Smrgdnl 4077d522f475Smrgdnl If either or both of these configure-script options are not given, rely on 4078d522f475Smrgdnl the output of the config program to provide the cflags/libs options: 4079d522f475Smrgdnl --with-freetype-cflags 4080d522f475Smrgdnl --with-freetype-libs 4081d522f475SmrgAC_DEFUN([CF_X_FREETYPE], 4082d522f475Smrg[ 4083956cc18dSsnjAC_REQUIRE([CF_PKG_CONFIG]) 4084956cc18dSsnj 40850bd37d32Smrgcf_cv_x_freetype_incs=no 40860bd37d32Smrgcf_cv_x_freetype_libs=no 4087d522f475Smrgcf_extra_freetype_libs= 4088956cc18dSsnjFREETYPE_CONFIG=none 4089d522f475SmrgFREETYPE_PARAMS= 4090d522f475Smrg 40910bd37d32SmrgAC_MSG_CHECKING(for FreeType configuration script) 40920bd37d32SmrgAC_ARG_WITH(freetype-config, 40930bd37d32Smrg [ --with-freetype-config configure script to use for FreeType], 40940bd37d32Smrg [cf_cv_x_freetype_cfgs="$withval"], 40950bd37d32Smrg [cf_cv_x_freetype_cfgs=auto]) 40960bd37d32Smrgtest -z $cf_cv_x_freetype_cfgs && cf_cv_x_freetype_cfgs=auto 40970bd37d32Smrgtest $cf_cv_x_freetype_cfgs = no && cf_cv_x_freetype_cfgs=none 40980bd37d32SmrgAC_MSG_RESULT($cf_cv_x_freetype_cfgs) 40990bd37d32Smrg 41000bd37d32Smrgcase $cf_cv_x_freetype_cfgs in 41010bd37d32Smrgnone) #(vi 41020bd37d32Smrg AC_MSG_CHECKING(if you specified -D/-I options for FreeType) 41030bd37d32Smrg AC_ARG_WITH(freetype-cflags, 41040bd37d32Smrg [ --with-freetype-cflags -D/-I options for compiling with FreeType], 41050bd37d32Smrg [cf_cv_x_freetype_incs="$with_freetype_cflags"], 41060bd37d32Smrg [cf_cv_x_freetype_incs=no]) 41070bd37d32Smrg AC_MSG_RESULT($cf_cv_x_freetype_incs) 41080bd37d32Smrg 41090bd37d32Smrg AC_MSG_CHECKING(if you specified -L/-l options for FreeType) 41100bd37d32Smrg AC_ARG_WITH(freetype-libs, 41110bd37d32Smrg [ --with-freetype-libs -L/-l options to link FreeType], 41120bd37d32Smrg [cf_cv_x_freetype_libs="$with_freetype_libs"], 41130bd37d32Smrg [cf_cv_x_freetype_libs=no]) 41140bd37d32Smrg AC_MSG_RESULT($cf_cv_x_freetype_libs) 41150bd37d32Smrg ;; 41160bd37d32Smrgauto) #(vi 41170bd37d32Smrg if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists xft; then 41180bd37d32Smrg FREETYPE_CONFIG=$PKG_CONFIG 41190bd37d32Smrg FREETYPE_PARAMS=xft 41200bd37d32Smrg else 41210bd37d32Smrg AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, none) 41220bd37d32Smrg if test "$FREETYPE_CONFIG" != none; then 41230bd37d32Smrg FREETYPE_CONFIG=$FREETYPE_CONFIG 41240bd37d32Smrg cf_extra_freetype_libs="-lXft" 41250bd37d32Smrg else 41260bd37d32Smrg AC_PATH_PROG(FREETYPE_OLD_CONFIG, xft-config, none) 41270bd37d32Smrg if test "$FREETYPE_OLD_CONFIG" != none; then 41280bd37d32Smrg FREETYPE_CONFIG=$FREETYPE_OLD_CONFIG 41290bd37d32Smrg fi 41300bd37d32Smrg fi 41310bd37d32Smrg fi 41320bd37d32Smrg ;; 41330bd37d32Smrgpkg*) #(vi 41340bd37d32Smrg if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists xft; then 41350bd37d32Smrg FREETYPE_CONFIG=$cf_cv_x_freetype_cfgs 41360bd37d32Smrg FREETYPE_PARAMS=xft 41370bd37d32Smrg else 41380bd37d32Smrg AC_MSG_WARN(cannot find pkg-config for Xft) 41390bd37d32Smrg fi 41400bd37d32Smrg ;; 41410bd37d32Smrg*) #(vi 41420bd37d32Smrg AC_PATH_PROG(FREETYPE_XFT_CONFIG, $cf_cv_x_freetype_cfgs, none) 4143d522f475Smrg if test "$FREETYPE_XFT_CONFIG" != none; then 4144d522f475Smrg FREETYPE_CONFIG=$FREETYPE_XFT_CONFIG 4145d522f475Smrg else 41460bd37d32Smrg AC_MSG_WARN(cannot find config script for Xft) 4147d522f475Smrg fi 41480bd37d32Smrg ;; 41490bd37d32Smrgesac 4150d522f475Smrg 4151956cc18dSsnjif test "$FREETYPE_CONFIG" != none ; then 41520bd37d32Smrg AC_MSG_CHECKING(for FreeType config) 41530bd37d32Smrg AC_MSG_RESULT($FREETYPE_CONFIG $FREETYPE_PARAMS) 4154d522f475Smrg 4155956cc18dSsnj if test "$cf_cv_x_freetype_incs" = no ; then 4156956cc18dSsnj AC_MSG_CHECKING(for $FREETYPE_CONFIG cflags) 4157956cc18dSsnj cf_cv_x_freetype_incs="`$FREETYPE_CONFIG $FREETYPE_PARAMS --cflags 2>/dev/null`" 4158956cc18dSsnj AC_MSG_RESULT($cf_cv_x_freetype_incs) 4159956cc18dSsnj fi 4160d522f475Smrg 4161956cc18dSsnj if test "$cf_cv_x_freetype_libs" = no ; then 4162956cc18dSsnj AC_MSG_CHECKING(for $FREETYPE_CONFIG libs) 4163956cc18dSsnj cf_cv_x_freetype_libs="$cf_extra_freetype_libs `$FREETYPE_CONFIG $FREETYPE_PARAMS --libs 2>/dev/null`" 4164956cc18dSsnj AC_MSG_RESULT($cf_cv_x_freetype_libs) 4165956cc18dSsnj fi 4166d522f475Smrgfi 4167d522f475Smrg 4168d522f475Smrgif test "$cf_cv_x_freetype_incs" = no ; then 4169d522f475Smrg cf_cv_x_freetype_incs= 4170d522f475Smrgfi 4171d522f475Smrg 4172d522f475Smrgif test "$cf_cv_x_freetype_libs" = no ; then 4173d522f475Smrg cf_cv_x_freetype_libs=-lXft 4174d522f475Smrgfi 4175d522f475Smrg 4176d522f475SmrgAC_MSG_CHECKING(if we can link with FreeType libraries) 4177d522f475Smrg 4178d522f475Smrgcf_save_LIBS="$LIBS" 4179d522f475Smrgcf_save_INCS="$CPPFLAGS" 4180d522f475Smrg 418120d2c4d2SmrgCF_ADD_LIBS($cf_cv_x_freetype_libs) 4182956cc18dSsnjCPPFLAGS="$CPPFLAGS $cf_cv_x_freetype_incs" 4183d522f475Smrg 4184d522f475SmrgAC_TRY_LINK([ 4185d522f475Smrg#include <X11/Xlib.h> 4186d522f475Smrg#include <X11/extensions/Xrender.h> 4187d522f475Smrg#include <X11/Xft/Xft.h>],[ 4188d522f475Smrg XftPattern *pat = XftNameParse ("name");], 4189d522f475Smrg [cf_cv_found_freetype=yes], 4190d522f475Smrg [cf_cv_found_freetype=no]) 4191d522f475SmrgAC_MSG_RESULT($cf_cv_found_freetype) 4192d522f475Smrg 4193d522f475SmrgLIBS="$cf_save_LIBS" 4194d522f475SmrgCPPFLAGS="$cf_save_INCS" 4195d522f475Smrg 4196d522f475Smrgif test "$cf_cv_found_freetype" = yes ; then 419720d2c4d2Smrg CF_ADD_LIBS($cf_cv_x_freetype_libs) 4198d522f475Smrg CF_ADD_CFLAGS($cf_cv_x_freetype_incs) 41990bd37d32Smrg AC_DEFINE(XRENDERFONT,1,[Define to 1 if we can/should link with FreeType libraries]) 4200d522f475Smrg 4201d522f475SmrgAC_CHECK_FUNCS( \ 4202d522f475Smrg XftDrawCharSpec \ 4203d522f475Smrg XftDrawSetClip \ 4204d522f475Smrg XftDrawSetClipRectangles \ 4205d522f475Smrg) 4206d522f475Smrg 4207d522f475Smrgelse 4208d522f475Smrg AC_MSG_WARN(No libraries found for FreeType) 4209d522f475Smrg CPPFLAGS=`echo "$CPPFLAGS" | sed -e s/-DXRENDERFONT//` 4210d522f475Smrgfi 4211d522f475Smrg 4212d522f475Smrg# FIXME: revisit this if needed 4213d522f475SmrgAC_SUBST(HAVE_TYPE_FCCHAR32) 4214d522f475SmrgAC_SUBST(HAVE_TYPE_XFTCHARSPEC) 4215d522f475Smrg]) 4216d522f475Smrgdnl --------------------------------------------------------------------------- 42170bd37d32Smrgdnl CF_X_TOOLKIT version: 21 updated: 2012/10/04 06:57:36 4218d522f475Smrgdnl ------------ 4219d522f475Smrgdnl Check for X Toolkit libraries 4220d522f475Smrgdnl 4221d522f475SmrgAC_DEFUN([CF_X_TOOLKIT], 4222d522f475Smrg[ 4223d522f475SmrgAC_REQUIRE([AC_PATH_XTRA]) 4224d522f475SmrgAC_REQUIRE([CF_CHECK_CACHE]) 4225d522f475Smrg 4226d522f475Smrgcf_have_X_LIBS=no 4227d522f475Smrg 422820d2c4d2SmrgCF_TRY_PKG_CONFIG(xt,[ 422920d2c4d2Smrg 42306879286fSmrg case "x$LIBS" in #(vi 42316879286fSmrg *-lX11*) #(vi 42326879286fSmrg ;; 42336879286fSmrg *) 42346879286fSmrg# we have an "xt" package, but it may omit Xt's dependency on X11 42356879286fSmrgAC_CACHE_CHECK(for usable X dependency,cf_cv_xt_x11_compat,[ 42366879286fSmrgAC_TRY_LINK([ 42376879286fSmrg#include <X11/Xlib.h> 42386879286fSmrg],[ 42396879286fSmrg int rc1 = XDrawLine((Display*) 0, (Drawable) 0, (GC) 0, 0, 0, 0, 0); 42406879286fSmrg int rc2 = XClearWindow((Display*) 0, (Window) 0); 42416879286fSmrg int rc3 = XMoveWindow((Display*) 0, (Window) 0, 0, 0); 42426879286fSmrg int rc4 = XMoveResizeWindow((Display*)0, (Window)0, 0, 0, 0, 0); 42436879286fSmrg],[cf_cv_xt_x11_compat=yes],[cf_cv_xt_x11_compat=no])]) 42446879286fSmrg if test "$cf_cv_xt_x11_compat" = no 42456879286fSmrg then 42466879286fSmrg CF_VERBOSE(work around broken X11 dependency) 42476879286fSmrg # 2010/11/19 - good enough until a working Xt on Xcb is delivered. 42486879286fSmrg CF_TRY_PKG_CONFIG(x11,,[CF_ADD_LIB_AFTER(-lXt,-lX11)]) 42496879286fSmrg fi 425020d2c4d2Smrg ;; 425120d2c4d2Smrg esac 425220d2c4d2Smrg 42536879286fSmrgAC_CACHE_CHECK(for usable X Toolkit package,cf_cv_xt_ice_compat,[ 42546879286fSmrgAC_TRY_LINK([ 42556879286fSmrg#include <X11/Shell.h> 42566879286fSmrg],[int num = IceConnectionNumber(0) 42576879286fSmrg],[cf_cv_xt_ice_compat=yes],[cf_cv_xt_ice_compat=no])]) 42586879286fSmrg 42596879286fSmrg if test "$cf_cv_xt_ice_compat" = no 42606879286fSmrg then 42616879286fSmrg # workaround for broken ".pc" files used for X Toolkit. 42626879286fSmrg case "x$X_PRE_LIBS" in #(vi 42636879286fSmrg *-lICE*) 42646879286fSmrg case "x$LIBS" in #(vi 42656879286fSmrg *-lICE*) #(vi 42666879286fSmrg ;; 42676879286fSmrg *) 42686879286fSmrg CF_VERBOSE(work around broken ICE dependency) 42696879286fSmrg CF_TRY_PKG_CONFIG(ice, 42706879286fSmrg [CF_TRY_PKG_CONFIG(sm)], 42716879286fSmrg [CF_ADD_LIB_AFTER(-lXt,$X_PRE_LIBS)]) 42726879286fSmrg ;; 42736879286fSmrg esac 42746879286fSmrg ;; 42756879286fSmrg esac 42766879286fSmrg fi 42776879286fSmrg 427820d2c4d2Smrg cf_have_X_LIBS=yes 427920d2c4d2Smrg],[ 428020d2c4d2Smrg 428120d2c4d2Smrg LDFLAGS="$X_LIBS $LDFLAGS" 428220d2c4d2Smrg CF_CHECK_CFLAGS($X_CFLAGS) 4283d522f475Smrg 428420d2c4d2Smrg AC_CHECK_FUNC(XOpenDisplay,,[ 428520d2c4d2Smrg AC_CHECK_LIB(X11,XOpenDisplay, 428620d2c4d2Smrg [CF_ADD_LIB(X11)],, 428720d2c4d2Smrg [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])]) 4288d522f475Smrg 428920d2c4d2Smrg AC_CHECK_FUNC(XtAppInitialize,,[ 429020d2c4d2Smrg AC_CHECK_LIB(Xt, XtAppInitialize, 42910bd37d32Smrg [AC_DEFINE(HAVE_LIBXT,1,[Define to 1 if we can compile with the Xt library]) 429220d2c4d2Smrg cf_have_X_LIBS=Xt 429320d2c4d2Smrg LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS"],, 429420d2c4d2Smrg [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])]) 429520d2c4d2Smrg]) 4296d522f475Smrg 4297d522f475Smrgif test $cf_have_X_LIBS = no ; then 4298d522f475Smrg AC_MSG_WARN( 4299d522f475Smrg[Unable to successfully link X Toolkit library (-lXt) with 4300d522f475Smrgtest program. You will have to check and add the proper libraries by hand 4301d522f475Smrgto makefile.]) 4302d522f475Smrgfi 4303d522f475Smrg])dnl 43040bd37d32Smrgdnl --------------------------------------------------------------------------- 43050bd37d32Smrgdnl CF__GRANTPT_BODY version: 4 updated: 2012/05/07 19:39:45 43060bd37d32Smrgdnl ---------------- 43070bd37d32Smrgdnl Body for workability check of grantpt. 43080bd37d32Smrgdefine([CF__GRANTPT_BODY],[ 43090bd37d32Smrg int code = 0; 43100bd37d32Smrg int rc; 43110bd37d32Smrg int pty; 43120bd37d32Smrg int tty; 43130bd37d32Smrg char *slave; 43140bd37d32Smrg struct termios tio; 43150bd37d32Smrg 43160bd37d32Smrg signal(SIGALRM, my_timeout); 43170bd37d32Smrg 43180bd37d32Smrg if (alarm(2) == 9) 43190bd37d32Smrg failed(9); 43200bd37d32Smrg else if ((pty = posix_openpt(O_RDWR)) < 0) 43210bd37d32Smrg failed(1); 43220bd37d32Smrg else if ((rc = grantpt(pty)) < 0) 43230bd37d32Smrg failed(2); 43240bd37d32Smrg else if ((rc = unlockpt(pty)) < 0) 43250bd37d32Smrg failed(3); 43260bd37d32Smrg else if ((slave = ptsname(pty)) == 0) 43270bd37d32Smrg failed(4); 43280bd37d32Smrg#if (CONFTEST == 3) || defined(CONFTEST_isatty) 43290bd37d32Smrg else if (!isatty(pty)) 43300bd37d32Smrg failed(4); 43310bd37d32Smrg#endif 43320bd37d32Smrg#if CONFTEST >= 4 43330bd37d32Smrg else if ((rc = tcgetattr(pty, &tio)) < 0) 43340bd37d32Smrg failed(20); 43350bd37d32Smrg else if ((rc = tcsetattr(pty, TCSAFLUSH, &tio)) < 0) 43360bd37d32Smrg failed(21); 43370bd37d32Smrg#endif 43380bd37d32Smrg /* BSD posix_openpt does not treat pty as a terminal until slave is opened. 43390bd37d32Smrg * Linux does treat it that way. 43400bd37d32Smrg */ 43410bd37d32Smrg else if ((tty = open(slave, O_RDWR)) < 0) 43420bd37d32Smrg failed(5); 43430bd37d32Smrg#ifdef CONFTEST 43440bd37d32Smrg#ifdef I_PUSH 43450bd37d32Smrg#if (CONFTEST == 0) || defined(CONFTEST_ptem) 43460bd37d32Smrg else if ((rc = ioctl(tty, I_PUSH, "ptem")) < 0) 43470bd37d32Smrg failed(10); 43480bd37d32Smrg#endif 43490bd37d32Smrg#if (CONFTEST == 1) || defined(CONFTEST_ldterm) 43500bd37d32Smrg else if ((rc = ioctl(tty, I_PUSH, "ldterm")) < 0) 43510bd37d32Smrg failed(11); 43520bd37d32Smrg#endif 43530bd37d32Smrg#if (CONFTEST == 2) || defined(CONFTEST_ttcompat) 43540bd37d32Smrg else if ((rc = ioctl(tty, I_PUSH, "ttcompat")) < 0) 43550bd37d32Smrg failed(12); 43560bd37d32Smrg#endif 43570bd37d32Smrg#endif /* I_PUSH */ 43580bd37d32Smrg#if CONFTEST >= 5 43590bd37d32Smrg else if ((rc = tcgetattr(tty, &tio)) < 0) 43600bd37d32Smrg failed(30); 43610bd37d32Smrg else if ((rc = tcsetattr(tty, TCSAFLUSH, &tio)) < 0) 43620bd37d32Smrg failed(31); 43630bd37d32Smrg#endif 43640bd37d32Smrg#endif /* CONFTEST */ 43650bd37d32Smrg 43660bd37d32Smrg ${cf_cv_main_return:-return}(code); 43670bd37d32Smrg]) 43680bd37d32Smrgdnl --------------------------------------------------------------------------- 43690bd37d32Smrgdnl CF__GRANTPT_HEAD version: 3 updated: 2012/01/29 17:13:14 43700bd37d32Smrgdnl ---------------- 43710bd37d32Smrgdnl Headers for workability check of grantpt. 43720bd37d32Smrgdefine([CF__GRANTPT_HEAD],[ 43730bd37d32Smrg#include <stdlib.h> 43740bd37d32Smrg#include <termios.h> 43750bd37d32Smrg#include <unistd.h> 43760bd37d32Smrg#include <signal.h> 43770bd37d32Smrg#include <fcntl.h> 43780bd37d32Smrg#include <errno.h> 43790bd37d32Smrg 43800bd37d32Smrg#ifndef HAVE_POSIX_OPENPT 43810bd37d32Smrg#undef posix_openpt 43820bd37d32Smrg#define posix_openpt(mode) open("/dev/ptmx", mode) 43830bd37d32Smrg#endif 43840bd37d32Smrg 43850bd37d32Smrg#ifdef HAVE_STROPTS_H 43860bd37d32Smrg#include <stropts.h> 43870bd37d32Smrg#endif 43880bd37d32Smrg 43890bd37d32Smrgstatic void failed(int code) 43900bd37d32Smrg{ 43910bd37d32Smrg perror("conftest"); 43920bd37d32Smrg exit(code); 43930bd37d32Smrg} 43940bd37d32Smrg 43950bd37d32Smrgstatic void my_timeout(int sig) 43960bd37d32Smrg{ 43970bd37d32Smrg exit(99); 43980bd37d32Smrg} 43990bd37d32Smrg]) 4400