1268899Sbaptdnl $Id: aclocal.m4,v 1.34 2014/04/06 19:16:18 tom Exp $ 2234949Sbaptdnl Macros for byacc configure script (Thomas E. Dickey) 3234949Sbaptdnl --------------------------------------------------------------------------- 4268899Sbaptdnl Copyright 2004-2013,2014 Thomas E. Dickey 5234949Sbaptdnl 6234949Sbaptdnl Permission is hereby granted, free of charge, to any person obtaining a 7234949Sbaptdnl copy of this software and associated documentation files (the 8234949Sbaptdnl "Software"), to deal in the Software without restriction, including 9234949Sbaptdnl without limitation the rights to use, copy, modify, merge, publish, 10234949Sbaptdnl distribute, distribute with modifications, sublicense, and/or sell 11234949Sbaptdnl copies of the Software, and to permit persons to whom the Software is 12234949Sbaptdnl furnished to do so, subject to the following conditions: 13234949Sbaptdnl 14234949Sbaptdnl The above copyright notice and this permission notice shall be included 15234949Sbaptdnl in all copies or portions of the Software. 16234949Sbaptdnl 17234949Sbaptdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 18234949Sbaptdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19234949Sbaptdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20234949Sbaptdnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 21234949Sbaptdnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 22234949Sbaptdnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR 23234949Sbaptdnl THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24234949Sbaptdnl 25234949Sbaptdnl Except as contained in this notice, the name(s) of the above copyright 26234949Sbaptdnl holders shall not be used in advertising or otherwise to promote the 27234949Sbaptdnl sale, use or other dealings in this Software without prior written 28234949Sbaptdnl authorization. 29234949Sbaptdnl --------------------------------------------------------------------------- 30234949Sbaptdnl --------------------------------------------------------------------------- 31251143Sbaptdnl CF_ACVERSION_CHECK version: 4 updated: 2013/03/04 19:52:56 32251143Sbaptdnl ------------------ 33251143Sbaptdnl Conditionally generate script according to whether we're using a given autoconf. 34251143Sbaptdnl 35251143Sbaptdnl $1 = version to compare against 36251143Sbaptdnl $2 = code to use if AC_ACVERSION is at least as high as $1. 37251143Sbaptdnl $3 = code to use if AC_ACVERSION is older than $1. 38251143Sbaptdefine([CF_ACVERSION_CHECK], 39251143Sbapt[ 40251143Sbaptifdef([AC_ACVERSION], ,[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])dnl 41251143Sbaptifdef([m4_version_compare], 42251143Sbapt[m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])], 43251143Sbapt[CF_ACVERSION_COMPARE( 44251143SbaptAC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])), 45251143SbaptAC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl 46251143Sbaptdnl --------------------------------------------------------------------------- 47251143Sbaptdnl CF_ACVERSION_COMPARE version: 3 updated: 2012/10/03 18:39:53 48251143Sbaptdnl -------------------- 49251143Sbaptdnl CF_ACVERSION_COMPARE(MAJOR1, MINOR1, TERNARY1, 50251143Sbaptdnl MAJOR2, MINOR2, TERNARY2, 51251143Sbaptdnl PRINTABLE2, not FOUND, FOUND) 52251143Sbaptdefine([CF_ACVERSION_COMPARE], 53251143Sbapt[ifelse(builtin([eval], [$2 < $5]), 1, 54251143Sbapt[ifelse([$8], , ,[$8])], 55251143Sbapt[ifelse([$9], , ,[$9])])])dnl 56251143Sbaptdnl --------------------------------------------------------------------------- 57234949Sbaptdnl CF_ADD_CFLAGS version: 10 updated: 2010/05/26 05:38:42 58234949Sbaptdnl ------------- 59234949Sbaptdnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS 60234949Sbaptdnl The second parameter if given makes this macro verbose. 61234949Sbaptdnl 62234949Sbaptdnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS, 63234949Sbaptdnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily 64234949Sbaptdnl confused by the quotes (which require backslashes to keep them usable). 65234949SbaptAC_DEFUN([CF_ADD_CFLAGS], 66234949Sbapt[ 67234949Sbaptcf_fix_cppflags=no 68234949Sbaptcf_new_cflags= 69234949Sbaptcf_new_cppflags= 70234949Sbaptcf_new_extra_cppflags= 71234949Sbapt 72234949Sbaptfor cf_add_cflags in $1 73234949Sbaptdo 74234949Sbaptcase $cf_fix_cppflags in 75234949Sbaptno) 76234949Sbapt case $cf_add_cflags in #(vi 77234949Sbapt -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi 78234949Sbapt case $cf_add_cflags in 79234949Sbapt -D*) 80234949Sbapt cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'` 81234949Sbapt 82234949Sbapt test "${cf_add_cflags}" != "${cf_tst_cflags}" \ 83234949Sbapt && test -z "${cf_tst_cflags}" \ 84234949Sbapt && cf_fix_cppflags=yes 85234949Sbapt 86234949Sbapt if test $cf_fix_cppflags = yes ; then 87234949Sbapt cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" 88234949Sbapt continue 89234949Sbapt elif test "${cf_tst_cflags}" = "\"'" ; then 90234949Sbapt cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" 91234949Sbapt continue 92234949Sbapt fi 93234949Sbapt ;; 94234949Sbapt esac 95234949Sbapt case "$CPPFLAGS" in 96234949Sbapt *$cf_add_cflags) #(vi 97234949Sbapt ;; 98234949Sbapt *) #(vi 99234949Sbapt case $cf_add_cflags in #(vi 100234949Sbapt -D*) 101234949Sbapt cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` 102234949Sbapt CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags) 103234949Sbapt ;; 104234949Sbapt esac 105234949Sbapt cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" 106234949Sbapt ;; 107234949Sbapt esac 108234949Sbapt ;; 109234949Sbapt *) 110234949Sbapt cf_new_cflags="$cf_new_cflags $cf_add_cflags" 111234949Sbapt ;; 112234949Sbapt esac 113234949Sbapt ;; 114234949Sbaptyes) 115234949Sbapt cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" 116234949Sbapt 117234949Sbapt cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'` 118234949Sbapt 119234949Sbapt test "${cf_add_cflags}" != "${cf_tst_cflags}" \ 120234949Sbapt && test -z "${cf_tst_cflags}" \ 121234949Sbapt && cf_fix_cppflags=no 122234949Sbapt ;; 123234949Sbaptesac 124234949Sbaptdone 125234949Sbapt 126234949Sbaptif test -n "$cf_new_cflags" ; then 127234949Sbapt ifelse([$2],,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)]) 128234949Sbapt CFLAGS="$CFLAGS $cf_new_cflags" 129234949Sbaptfi 130234949Sbapt 131234949Sbaptif test -n "$cf_new_cppflags" ; then 132234949Sbapt ifelse([$2],,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)]) 133234949Sbapt CPPFLAGS="$CPPFLAGS $cf_new_cppflags" 134234949Sbaptfi 135234949Sbapt 136234949Sbaptif test -n "$cf_new_extra_cppflags" ; then 137234949Sbapt ifelse([$2],,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)]) 138234949Sbapt EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" 139234949Sbaptfi 140234949Sbapt 141234949SbaptAC_SUBST(EXTRA_CPPFLAGS) 142234949Sbapt 143234949Sbapt])dnl 144234949Sbaptdnl --------------------------------------------------------------------------- 145234949Sbaptdnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31 146234949Sbaptdnl -------------- 147234949Sbaptdnl Allow user to disable a normally-on option. 148234949SbaptAC_DEFUN([CF_ARG_DISABLE], 149234949Sbapt[CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl 150234949Sbaptdnl --------------------------------------------------------------------------- 151234949Sbaptdnl CF_ARG_OPTION version: 4 updated: 2010/05/26 05:38:42 152234949Sbaptdnl ------------- 153234949Sbaptdnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus 154234949Sbaptdnl values. 155234949Sbaptdnl 156234949Sbaptdnl Parameters: 157234949Sbaptdnl $1 = option name 158234949Sbaptdnl $2 = help-string 159234949Sbaptdnl $3 = action to perform if option is not default 160234949Sbaptdnl $4 = action if perform if option is default 161234949Sbaptdnl $5 = default option value (either 'yes' or 'no') 162234949SbaptAC_DEFUN([CF_ARG_OPTION], 163234949Sbapt[AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes) 164234949Sbapt if test "$enableval" != "$5" ; then 165234949Sbaptifelse([$3],,[ :]dnl 166234949Sbapt,[ $3]) ifelse([$4],,,[ 167234949Sbapt else 168234949Sbapt $4]) 169234949Sbapt fi],[enableval=$5 ifelse([$4],,,[ 170234949Sbapt $4 171234949Sbapt])dnl 172234949Sbapt ])])dnl 173234949Sbaptdnl --------------------------------------------------------------------------- 174251143Sbaptdnl CF_CC_ENV_FLAGS version: 1 updated: 2012/10/03 05:25:49 175251143Sbaptdnl --------------- 176251143Sbaptdnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content 177251143Sbaptdnl into CC. This will not help with broken scripts that wrap the compiler with 178251143Sbaptdnl options, but eliminates a more common category of user confusion. 179251143SbaptAC_DEFUN([CF_CC_ENV_FLAGS], 180251143Sbapt[ 181251143Sbapt# This should have been defined by AC_PROG_CC 182251143Sbapt: ${CC:=cc} 183251143Sbapt 184251143SbaptAC_MSG_CHECKING(\$CC variable) 185251143Sbaptcase "$CC" in #(vi 186251143Sbapt*[[\ \ ]]-[[IUD]]*) 187251143Sbapt AC_MSG_RESULT(broken) 188251143Sbapt AC_MSG_WARN(your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options) 189251143Sbapt # humor him... 190251143Sbapt cf_flags=`echo "$CC" | sed -e 's/^[[^ ]]*[[ ]]//'` 191251143Sbapt CC=`echo "$CC" | sed -e 's/[[ ]].*//'` 192251143Sbapt CF_ADD_CFLAGS($cf_flags) 193251143Sbapt ;; 194251143Sbapt*) 195251143Sbapt AC_MSG_RESULT(ok) 196251143Sbapt ;; 197251143Sbaptesac 198251143Sbapt])dnl 199251143Sbaptdnl --------------------------------------------------------------------------- 200251143Sbaptdnl CF_CHECK_CACHE version: 12 updated: 2012/10/02 20:55:03 201234949Sbaptdnl -------------- 202234949Sbaptdnl Check if we're accidentally using a cache from a different machine. 203234949Sbaptdnl Derive the system name, as a check for reusing the autoconf cache. 204234949Sbaptdnl 205234949Sbaptdnl If we've packaged config.guess and config.sub, run that (since it does a 206234949Sbaptdnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow 207234949Sbaptdnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM 208234949Sbaptdnl which is useful in cross-compiles. 209234949Sbaptdnl 210234949Sbaptdnl Note: we would use $ac_config_sub, but that is one of the places where 211234949Sbaptdnl autoconf 2.5x broke compatibility with autoconf 2.13 212234949SbaptAC_DEFUN([CF_CHECK_CACHE], 213234949Sbapt[ 214234949Sbaptif test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then 215234949Sbapt ifelse([$1],,[AC_CANONICAL_HOST],[$1]) 216234949Sbapt system_name="$host_os" 217234949Sbaptelse 218234949Sbapt system_name="`(uname -s -r) 2>/dev/null`" 219234949Sbapt if test -z "$system_name" ; then 220234949Sbapt system_name="`(hostname) 2>/dev/null`" 221234949Sbapt fi 222234949Sbaptfi 223251143Sbapttest -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name",[Define to the system name.]) 224234949SbaptAC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"]) 225234949Sbapt 226234949Sbapttest -z "$system_name" && system_name="$cf_cv_system_name" 227234949Sbapttest -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name) 228234949Sbapt 229234949Sbaptif test ".$system_name" != ".$cf_cv_system_name" ; then 230234949Sbapt AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)) 231234949Sbapt AC_MSG_ERROR("Please remove config.cache and try again.") 232234949Sbaptfi 233234949Sbapt])dnl 234234949Sbaptdnl --------------------------------------------------------------------------- 235268899Sbaptdnl CF_CLANG_COMPILER version: 2 updated: 2013/11/19 19:23:35 236251143Sbaptdnl ----------------- 237251143Sbaptdnl Check if the given compiler is really clang. clang's C driver defines 238251143Sbaptdnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does 239251143Sbaptdnl not ignore some gcc options. 240251143Sbaptdnl 241251143Sbaptdnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to 242251143Sbaptdnl ensure that it is not mistaken for gcc/g++. It is normally invoked from 243251143Sbaptdnl the wrappers for gcc and g++ warnings. 244251143Sbaptdnl 245251143Sbaptdnl $1 = GCC (default) or GXX 246268899Sbaptdnl $2 = CLANG_COMPILER (default) 247251143Sbaptdnl $3 = CFLAGS (default) or CXXFLAGS 248251143SbaptAC_DEFUN([CF_CLANG_COMPILER],[ 249251143Sbaptifelse([$2],,CLANG_COMPILER,[$2])=no 250251143Sbapt 251251143Sbaptif test "$ifelse([$1],,[$1],GCC)" = yes ; then 252251143Sbapt AC_MSG_CHECKING(if this is really Clang ifelse([$1],GXX,C++,C) compiler) 253251143Sbapt cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" 254251143Sbapt ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -Qunused-arguments" 255251143Sbapt AC_TRY_COMPILE([],[ 256251143Sbapt#ifdef __clang__ 257251143Sbapt#else 258251143Sbaptmake an error 259251143Sbapt#endif 260251143Sbapt],[ifelse([$2],,CLANG_COMPILER,[$2])=yes 261251143Sbaptcf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments" 262251143Sbapt],[]) 263251143Sbapt ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" 264251143Sbapt AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2])) 265251143Sbaptfi 266251143Sbapt]) 267251143Sbaptdnl --------------------------------------------------------------------------- 268251143Sbaptdnl CF_DISABLE_ECHO version: 12 updated: 2012/10/06 16:30:28 269234949Sbaptdnl --------------- 270234949Sbaptdnl You can always use "make -n" to see the actual options, but it's hard to 271234949Sbaptdnl pick out/analyze warning messages when the compile-line is long. 272234949Sbaptdnl 273234949Sbaptdnl Sets: 274234949Sbaptdnl ECHO_LT - symbol to control if libtool is verbose 275234949Sbaptdnl ECHO_LD - symbol to prefix "cc -o" lines 276234949Sbaptdnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o) 277234949Sbaptdnl SHOW_CC - symbol to put before explicit "cc -c" lines 278234949Sbaptdnl ECHO_CC - symbol to put before any "cc" line 279234949Sbaptdnl 280234949SbaptAC_DEFUN([CF_DISABLE_ECHO],[ 281234949SbaptAC_MSG_CHECKING(if you want to see long compiling messages) 282234949SbaptCF_ARG_DISABLE(echo, 283251143Sbapt [ --disable-echo do not display "compiling" commands], 284234949Sbapt [ 285234949Sbapt ECHO_LT='--silent' 286234949Sbapt ECHO_LD='@echo linking [$]@;' 287234949Sbapt RULE_CC='@echo compiling [$]<' 288234949Sbapt SHOW_CC='@echo compiling [$]@' 289234949Sbapt ECHO_CC='@' 290234949Sbapt],[ 291234949Sbapt ECHO_LT='' 292234949Sbapt ECHO_LD='' 293234949Sbapt RULE_CC='' 294234949Sbapt SHOW_CC='' 295234949Sbapt ECHO_CC='' 296234949Sbapt]) 297234949SbaptAC_MSG_RESULT($enableval) 298234949SbaptAC_SUBST(ECHO_LT) 299234949SbaptAC_SUBST(ECHO_LD) 300234949SbaptAC_SUBST(RULE_CC) 301234949SbaptAC_SUBST(SHOW_CC) 302234949SbaptAC_SUBST(ECHO_CC) 303234949Sbapt])dnl 304234949Sbaptdnl --------------------------------------------------------------------------- 305251143Sbaptdnl CF_DISABLE_LEAKS version: 7 updated: 2012/10/02 20:55:03 306234949Sbaptdnl ---------------- 307234949Sbaptdnl Combine no-leak checks with the libraries or tools that are used for the 308234949Sbaptdnl checks. 309234949SbaptAC_DEFUN([CF_DISABLE_LEAKS],[ 310234949Sbapt 311234949SbaptAC_REQUIRE([CF_WITH_DMALLOC]) 312234949SbaptAC_REQUIRE([CF_WITH_DBMALLOC]) 313234949SbaptAC_REQUIRE([CF_WITH_VALGRIND]) 314234949Sbapt 315234949SbaptAC_MSG_CHECKING(if you want to perform memory-leak testing) 316234949SbaptAC_ARG_ENABLE(leaks, 317234949Sbapt [ --disable-leaks test: free permanent memory, analyze leaks], 318234949Sbapt [if test "x$enableval" = xno; then with_no_leaks=yes; else with_no_leaks=no; fi], 319234949Sbapt : ${with_no_leaks:=no}) 320234949SbaptAC_MSG_RESULT($with_no_leaks) 321234949Sbapt 322234949Sbaptif test "$with_no_leaks" = yes ; then 323251143Sbapt AC_DEFINE(NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.]) 324251143Sbapt AC_DEFINE(YY_NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.]) 325234949Sbaptfi 326234949Sbapt])dnl 327234949Sbaptdnl --------------------------------------------------------------------------- 328251143Sbaptdnl CF_GCC_ATTRIBUTES version: 16 updated: 2012/10/02 20:55:03 329234949Sbaptdnl ----------------- 330234949Sbaptdnl Test for availability of useful gcc __attribute__ directives to quiet 331234949Sbaptdnl compiler warnings. Though useful, not all are supported -- and contrary 332234949Sbaptdnl to documentation, unrecognized directives cause older compilers to barf. 333234949SbaptAC_DEFUN([CF_GCC_ATTRIBUTES], 334234949Sbapt[ 335234949Sbaptif test "$GCC" = yes 336234949Sbaptthen 337234949Sbaptcat > conftest.i <<EOF 338234949Sbapt#ifndef GCC_PRINTF 339234949Sbapt#define GCC_PRINTF 0 340234949Sbapt#endif 341234949Sbapt#ifndef GCC_SCANF 342234949Sbapt#define GCC_SCANF 0 343234949Sbapt#endif 344234949Sbapt#ifndef GCC_NORETURN 345234949Sbapt#define GCC_NORETURN /* nothing */ 346234949Sbapt#endif 347234949Sbapt#ifndef GCC_UNUSED 348234949Sbapt#define GCC_UNUSED /* nothing */ 349234949Sbapt#endif 350234949SbaptEOF 351234949Sbaptif test "$GCC" = yes 352234949Sbaptthen 353234949Sbapt AC_CHECKING([for $CC __attribute__ directives]) 354234949Sbaptcat > conftest.$ac_ext <<EOF 355234949Sbapt#line __oline__ "${as_me:-configure}" 356234949Sbapt#include "confdefs.h" 357234949Sbapt#include "conftest.h" 358234949Sbapt#include "conftest.i" 359234949Sbapt#if GCC_PRINTF 360234949Sbapt#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) 361234949Sbapt#else 362234949Sbapt#define GCC_PRINTFLIKE(fmt,var) /*nothing*/ 363234949Sbapt#endif 364234949Sbapt#if GCC_SCANF 365234949Sbapt#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) 366234949Sbapt#else 367234949Sbapt#define GCC_SCANFLIKE(fmt,var) /*nothing*/ 368234949Sbapt#endif 369234949Sbaptextern void wow(char *,...) GCC_SCANFLIKE(1,2); 370234949Sbaptextern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; 371234949Sbaptextern void foo(void) GCC_NORETURN; 372234949Sbaptint main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; } 373234949SbaptEOF 374234949Sbapt cf_printf_attribute=no 375234949Sbapt cf_scanf_attribute=no 376234949Sbapt for cf_attribute in scanf printf unused noreturn 377234949Sbapt do 378234949Sbapt CF_UPPER(cf_ATTRIBUTE,$cf_attribute) 379234949Sbapt cf_directive="__attribute__(($cf_attribute))" 380234949Sbapt echo "checking for $CC $cf_directive" 1>&AC_FD_CC 381234949Sbapt 382234949Sbapt case $cf_attribute in #(vi 383234949Sbapt printf) #(vi 384234949Sbapt cf_printf_attribute=yes 385234949Sbapt cat >conftest.h <<EOF 386234949Sbapt#define GCC_$cf_ATTRIBUTE 1 387234949SbaptEOF 388234949Sbapt ;; 389234949Sbapt scanf) #(vi 390234949Sbapt cf_scanf_attribute=yes 391234949Sbapt cat >conftest.h <<EOF 392234949Sbapt#define GCC_$cf_ATTRIBUTE 1 393234949SbaptEOF 394234949Sbapt ;; 395234949Sbapt *) #(vi 396234949Sbapt cat >conftest.h <<EOF 397234949Sbapt#define GCC_$cf_ATTRIBUTE $cf_directive 398234949SbaptEOF 399234949Sbapt ;; 400234949Sbapt esac 401234949Sbapt 402234949Sbapt if AC_TRY_EVAL(ac_compile); then 403234949Sbapt test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute) 404234949Sbapt cat conftest.h >>confdefs.h 405234949Sbapt case $cf_attribute in #(vi 406251143Sbapt noreturn) #(vi 407251143Sbapt AC_DEFINE_UNQUOTED(GCC_NORETURN,$cf_directive,[Define to noreturn-attribute for gcc]) 408251143Sbapt ;; 409234949Sbapt printf) #(vi 410251143Sbapt cf_value='/* nothing */' 411251143Sbapt if test "$cf_printf_attribute" != no ; then 412251143Sbapt cf_value='__attribute__((format(printf,fmt,var)))' 413251143Sbapt AC_DEFINE(GCC_PRINTF,1,[Define to 1 if the compiler supports gcc-like printf attribute.]) 414234949Sbapt fi 415251143Sbapt AC_DEFINE_UNQUOTED(GCC_PRINTFLIKE(fmt,var),$cf_value,[Define to printf-attribute for gcc]) 416234949Sbapt ;; 417234949Sbapt scanf) #(vi 418251143Sbapt cf_value='/* nothing */' 419251143Sbapt if test "$cf_scanf_attribute" != no ; then 420251143Sbapt cf_value='__attribute__((format(scanf,fmt,var)))' 421251143Sbapt AC_DEFINE(GCC_SCANF,1,[Define to 1 if the compiler supports gcc-like scanf attribute.]) 422234949Sbapt fi 423251143Sbapt AC_DEFINE_UNQUOTED(GCC_SCANFLIKE(fmt,var),$cf_value,[Define to sscanf-attribute for gcc]) 424234949Sbapt ;; 425251143Sbapt unused) #(vi 426251143Sbapt AC_DEFINE_UNQUOTED(GCC_UNUSED,$cf_directive,[Define to unused-attribute for gcc]) 427251143Sbapt ;; 428234949Sbapt esac 429234949Sbapt fi 430234949Sbapt done 431234949Sbaptelse 432234949Sbapt fgrep define conftest.i >>confdefs.h 433234949Sbaptfi 434234949Sbaptrm -rf conftest* 435234949Sbaptfi 436234949Sbapt])dnl 437234949Sbaptdnl --------------------------------------------------------------------------- 438251143Sbaptdnl CF_GCC_VERSION version: 7 updated: 2012/10/18 06:46:33 439234949Sbaptdnl -------------- 440234949Sbaptdnl Find version of gcc 441234949SbaptAC_DEFUN([CF_GCC_VERSION],[ 442234949SbaptAC_REQUIRE([AC_PROG_CC]) 443234949SbaptGCC_VERSION=none 444234949Sbaptif test "$GCC" = yes ; then 445234949Sbapt AC_MSG_CHECKING(version of $CC) 446251143Sbapt 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.]].*//'`" 447234949Sbapt test -z "$GCC_VERSION" && GCC_VERSION=unknown 448234949Sbapt AC_MSG_RESULT($GCC_VERSION) 449234949Sbaptfi 450234949Sbapt])dnl 451234949Sbaptdnl --------------------------------------------------------------------------- 452268899Sbaptdnl CF_GCC_WARNINGS version: 31 updated: 2013/11/19 19:23:35 453234949Sbaptdnl --------------- 454234949Sbaptdnl Check if the compiler supports useful warning options. There's a few that 455234949Sbaptdnl we don't use, simply because they're too noisy: 456234949Sbaptdnl 457234949Sbaptdnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x) 458234949Sbaptdnl -Wredundant-decls (system headers make this too noisy) 459234949Sbaptdnl -Wtraditional (combines too many unrelated messages, only a few useful) 460234949Sbaptdnl -Wwrite-strings (too noisy, but should review occasionally). This 461234949Sbaptdnl is enabled for ncurses using "--enable-const". 462234949Sbaptdnl -pedantic 463234949Sbaptdnl 464234949Sbaptdnl Parameter: 465234949Sbaptdnl $1 is an optional list of gcc warning flags that a particular 466234949Sbaptdnl application might want to use, e.g., "no-unused" for 467234949Sbaptdnl -Wno-unused 468234949Sbaptdnl Special: 469234949Sbaptdnl If $with_ext_const is "yes", add a check for -Wwrite-strings 470234949Sbaptdnl 471234949SbaptAC_DEFUN([CF_GCC_WARNINGS], 472234949Sbapt[ 473234949SbaptAC_REQUIRE([CF_GCC_VERSION]) 474234949SbaptCF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS) 475251143SbaptCF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS) 476234949Sbapt 477234949Sbaptcat > conftest.$ac_ext <<EOF 478234949Sbapt#line __oline__ "${as_me:-configure}" 479234949Sbaptint main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; } 480234949SbaptEOF 481234949Sbapt 482234949Sbaptif test "$INTEL_COMPILER" = yes 483234949Sbaptthen 484234949Sbapt# The "-wdXXX" options suppress warnings: 485234949Sbapt# remark #1419: external declaration in primary source file 486234949Sbapt# remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem) 487234949Sbapt# remark #1684: conversion from pointer to same-sized integral type (potential portability problem) 488234949Sbapt# remark #193: zero used for undefined preprocessing identifier 489234949Sbapt# remark #593: variable "curs_sb_left_arrow" was set but never used 490234949Sbapt# remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits 491234949Sbapt# remark #869: parameter "tw" was never referenced 492234949Sbapt# remark #981: operands are evaluated in unspecified order 493234949Sbapt# warning #279: controlling expression is constant 494234949Sbapt 495234949Sbapt AC_CHECKING([for $CC warning options]) 496234949Sbapt cf_save_CFLAGS="$CFLAGS" 497234949Sbapt EXTRA_CFLAGS="-Wall" 498234949Sbapt for cf_opt in \ 499234949Sbapt wd1419 \ 500234949Sbapt wd1683 \ 501234949Sbapt wd1684 \ 502234949Sbapt wd193 \ 503234949Sbapt wd593 \ 504234949Sbapt wd279 \ 505234949Sbapt wd810 \ 506234949Sbapt wd869 \ 507234949Sbapt wd981 508234949Sbapt do 509234949Sbapt CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" 510234949Sbapt if AC_TRY_EVAL(ac_compile); then 511234949Sbapt test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt) 512234949Sbapt EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" 513234949Sbapt fi 514234949Sbapt done 515234949Sbapt CFLAGS="$cf_save_CFLAGS" 516234949Sbapt 517234949Sbaptelif test "$GCC" = yes 518234949Sbaptthen 519234949Sbapt AC_CHECKING([for $CC warning options]) 520234949Sbapt cf_save_CFLAGS="$CFLAGS" 521234949Sbapt EXTRA_CFLAGS= 522234949Sbapt cf_warn_CONST="" 523234949Sbapt test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings" 524268899Sbapt cf_gcc_warnings="Wignored-qualifiers Wlogical-op Wvarargs" 525268899Sbapt test "x$CLANG_COMPILER" = xyes && cf_gcc_warnings= 526234949Sbapt for cf_opt in W Wall \ 527234949Sbapt Wbad-function-cast \ 528234949Sbapt Wcast-align \ 529234949Sbapt Wcast-qual \ 530268899Sbapt Wdeclaration-after-statement \ 531268899Sbapt Wextra \ 532234949Sbapt Winline \ 533234949Sbapt Wmissing-declarations \ 534234949Sbapt Wmissing-prototypes \ 535234949Sbapt Wnested-externs \ 536234949Sbapt Wpointer-arith \ 537234949Sbapt Wshadow \ 538234949Sbapt Wstrict-prototypes \ 539268899Sbapt Wundef $cf_gcc_warnings $cf_warn_CONST $1 540234949Sbapt do 541234949Sbapt CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" 542234949Sbapt if AC_TRY_EVAL(ac_compile); then 543234949Sbapt test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt) 544234949Sbapt case $cf_opt in #(vi 545234949Sbapt Wcast-qual) #(vi 546234949Sbapt CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES" 547234949Sbapt ;; 548234949Sbapt Winline) #(vi 549234949Sbapt case $GCC_VERSION in 550234949Sbapt [[34]].*) 551234949Sbapt CF_VERBOSE(feature is broken in gcc $GCC_VERSION) 552234949Sbapt continue;; 553234949Sbapt esac 554234949Sbapt ;; 555251143Sbapt Wpointer-arith) #(vi 556251143Sbapt case $GCC_VERSION in 557251143Sbapt [[12]].*) 558251143Sbapt CF_VERBOSE(feature is broken in gcc $GCC_VERSION) 559251143Sbapt continue;; 560251143Sbapt esac 561251143Sbapt ;; 562234949Sbapt esac 563234949Sbapt EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" 564234949Sbapt fi 565234949Sbapt done 566234949Sbapt CFLAGS="$cf_save_CFLAGS" 567234949Sbaptfi 568234949Sbaptrm -rf conftest* 569234949Sbapt 570234949SbaptAC_SUBST(EXTRA_CFLAGS) 571234949Sbapt])dnl 572234949Sbaptdnl --------------------------------------------------------------------------- 573234949Sbaptdnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07 574234949Sbaptdnl ------------- 575234949Sbaptdnl Check if we must define _GNU_SOURCE to get a reasonable value for 576234949Sbaptdnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect 577234949Sbaptdnl (or misfeature) of glibc2, which breaks portability of many applications, 578234949Sbaptdnl since it is interwoven with GNU extensions. 579234949Sbaptdnl 580234949Sbaptdnl Well, yes we could work around it... 581234949SbaptAC_DEFUN([CF_GNU_SOURCE], 582234949Sbapt[ 583234949SbaptAC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[ 584234949SbaptAC_TRY_COMPILE([#include <sys/types.h>],[ 585234949Sbapt#ifndef _XOPEN_SOURCE 586234949Sbaptmake an error 587234949Sbapt#endif], 588234949Sbapt [cf_cv_gnu_source=no], 589234949Sbapt [cf_save="$CPPFLAGS" 590234949Sbapt CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" 591234949Sbapt AC_TRY_COMPILE([#include <sys/types.h>],[ 592234949Sbapt#ifdef _XOPEN_SOURCE 593234949Sbaptmake an error 594234949Sbapt#endif], 595234949Sbapt [cf_cv_gnu_source=no], 596234949Sbapt [cf_cv_gnu_source=yes]) 597234949Sbapt CPPFLAGS="$cf_save" 598234949Sbapt ]) 599234949Sbapt]) 600234949Sbapttest "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" 601234949Sbapt])dnl 602234949Sbaptdnl --------------------------------------------------------------------------- 603268899Sbaptdnl CF_INTEL_COMPILER version: 6 updated: 2014/03/17 13:13:07 604234949Sbaptdnl ----------------- 605234949Sbaptdnl Check if the given compiler is really the Intel compiler for Linux. It 606234949Sbaptdnl tries to imitate gcc, but does not return an error when it finds a mismatch 607234949Sbaptdnl between prototypes, e.g., as exercised by CF_MISSING_CHECK. 608234949Sbaptdnl 609234949Sbaptdnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to 610234949Sbaptdnl ensure that it is not mistaken for gcc/g++. It is normally invoked from 611234949Sbaptdnl the wrappers for gcc and g++ warnings. 612234949Sbaptdnl 613234949Sbaptdnl $1 = GCC (default) or GXX 614234949Sbaptdnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS 615234949Sbaptdnl $3 = CFLAGS (default) or CXXFLAGS 616234949SbaptAC_DEFUN([CF_INTEL_COMPILER],[ 617251143SbaptAC_REQUIRE([AC_CANONICAL_HOST]) 618234949Sbaptifelse([$2],,INTEL_COMPILER,[$2])=no 619234949Sbapt 620234949Sbaptif test "$ifelse([$1],,[$1],GCC)" = yes ; then 621234949Sbapt case $host_os in 622234949Sbapt linux*|gnu*) 623234949Sbapt AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler) 624234949Sbapt cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" 625234949Sbapt ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc" 626234949Sbapt AC_TRY_COMPILE([],[ 627234949Sbapt#ifdef __INTEL_COMPILER 628234949Sbapt#else 629234949Sbaptmake an error 630234949Sbapt#endif 631234949Sbapt],[ifelse([$2],,INTEL_COMPILER,[$2])=yes 632268899Sbaptcf_save_CFLAGS="$cf_save_CFLAGS -we147" 633234949Sbapt],[]) 634234949Sbapt ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" 635234949Sbapt AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2])) 636234949Sbapt ;; 637234949Sbapt esac 638234949Sbaptfi 639234949Sbapt])dnl 640234949Sbaptdnl --------------------------------------------------------------------------- 641268899Sbaptdnl CF_MAKE_DOCS version: 3 updated: 2014/01/05 13:21:25 642268899Sbaptdnl ------------ 643268899Sbaptdnl $1 = name(s) to generate rules for 644268899Sbaptdnl $2 = suffix of corresponding manpages used as input. 645268899Sbaptdefine([CF_MAKE_DOCS],[ 646268899Sbapttest -z "$cf_make_docs" && cf_make_docs=0 647268899Sbapt 648268899Sbaptcf_output=makefile 649268899Sbapttest -f "$cf_output" || cf_output=Makefile 650268899Sbapt 651268899Sbaptif test "$cf_make_docs" = 0 652268899Sbaptthen 653268899Sbaptcat >>$cf_output <<"CF_EOF" 654268899Sbapt################################################################################ 655268899Sbapt.SUFFIXES : .html .$2 .man .ps .pdf .txt 656268899Sbapt 657268899Sbapt.$2.html : 658268899Sbapt GROFF_NO_SGR=stupid [$](SHELL) -c "tbl [$]*.$2 | groff -P -o0 -I$*_ -Thtml -man" >[$]@ 659268899Sbapt 660268899Sbapt.$2.ps : 661268899Sbapt [$](SHELL) -c "tbl [$]*.$2 | groff -man" >[$]@ 662268899Sbapt 663268899Sbapt.$2.txt : 664268899Sbapt GROFF_NO_SGR=stupid [$](SHELL) -c "tbl [$]*.$2 | nroff -Tascii -man | col -bx" >[$]@ 665268899Sbapt 666268899Sbapt.ps.pdf : 667268899Sbapt ps2pdf [$]*.ps 668268899Sbapt 669268899SbaptCF_EOF 670268899Sbapt cf_make_docs=1 671268899Sbaptfi 672268899Sbapt 673268899Sbaptfor cf_name in $1 674268899Sbaptdo 675268899Sbaptcat >>$cf_output <<CF_EOF 676268899Sbapt################################################################################ 677268899Sbaptdocs-$cf_name \\ 678268899Sbaptdocs :: $cf_name.html \\ 679268899Sbapt $cf_name.pdf \\ 680268899Sbapt $cf_name.ps \\ 681268899Sbapt $cf_name.txt 682268899Sbapt 683268899Sbaptclean \\ 684268899Sbaptdocs-clean :: 685268899Sbapt rm -f $cf_name.html $cf_name.pdf $cf_name.ps $cf_name.txt 686268899Sbapt 687268899Sbapt$cf_name.html : $cf_name.\$2 688268899Sbapt$cf_name.pdf : $cf_name.ps 689268899Sbapt$cf_name.ps : $cf_name.\$2 690268899Sbapt$cf_name.txt : $cf_name.\$2 691268899SbaptCF_EOF 692268899Sbaptdone 693268899Sbapt])dnl 694268899Sbaptdnl --------------------------------------------------------------------------- 695234949Sbaptdnl CF_MAKE_TAGS version: 6 updated: 2010/10/23 15:52:32 696234949Sbaptdnl ------------ 697234949Sbaptdnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have 698234949Sbaptdnl a monocase filesystem. 699234949SbaptAC_DEFUN([CF_MAKE_TAGS],[ 700234949SbaptAC_REQUIRE([CF_MIXEDCASE_FILENAMES]) 701234949Sbapt 702234949SbaptAC_CHECK_PROGS(CTAGS, exctags ctags) 703234949SbaptAC_CHECK_PROGS(ETAGS, exetags etags) 704234949Sbapt 705234949SbaptAC_CHECK_PROG(MAKE_LOWER_TAGS, ${CTAGS:-ctags}, yes, no) 706234949Sbapt 707234949Sbaptif test "$cf_cv_mixedcase" = yes ; then 708234949Sbapt AC_CHECK_PROG(MAKE_UPPER_TAGS, ${ETAGS:-etags}, yes, no) 709234949Sbaptelse 710234949Sbapt MAKE_UPPER_TAGS=no 711234949Sbaptfi 712234949Sbapt 713234949Sbaptif test "$MAKE_UPPER_TAGS" = yes ; then 714234949Sbapt MAKE_UPPER_TAGS= 715234949Sbaptelse 716234949Sbapt MAKE_UPPER_TAGS="#" 717234949Sbaptfi 718234949Sbapt 719234949Sbaptif test "$MAKE_LOWER_TAGS" = yes ; then 720234949Sbapt MAKE_LOWER_TAGS= 721234949Sbaptelse 722234949Sbapt MAKE_LOWER_TAGS="#" 723234949Sbaptfi 724234949Sbapt 725234949SbaptAC_SUBST(CTAGS) 726234949SbaptAC_SUBST(ETAGS) 727234949Sbapt 728234949SbaptAC_SUBST(MAKE_UPPER_TAGS) 729234949SbaptAC_SUBST(MAKE_LOWER_TAGS) 730234949Sbapt])dnl 731234949Sbaptdnl --------------------------------------------------------------------------- 732268899Sbaptdnl CF_MIXEDCASE_FILENAMES version: 6 updated: 2013/10/08 17:47:05 733234949Sbaptdnl ---------------------- 734234949Sbaptdnl Check if the file-system supports mixed-case filenames. If we're able to 735234949Sbaptdnl create a lowercase name and see it as uppercase, it doesn't support that. 736234949SbaptAC_DEFUN([CF_MIXEDCASE_FILENAMES], 737234949Sbapt[ 738234949SbaptAC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[ 739234949Sbaptif test "$cross_compiling" = yes ; then 740234949Sbapt case $target_alias in #(vi 741268899Sbapt *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw*|*-uwin*) #(vi 742234949Sbapt cf_cv_mixedcase=no 743234949Sbapt ;; 744234949Sbapt *) 745234949Sbapt cf_cv_mixedcase=yes 746234949Sbapt ;; 747234949Sbapt esac 748234949Sbaptelse 749234949Sbapt rm -f conftest CONFTEST 750234949Sbapt echo test >conftest 751234949Sbapt if test -f CONFTEST ; then 752234949Sbapt cf_cv_mixedcase=no 753234949Sbapt else 754234949Sbapt cf_cv_mixedcase=yes 755234949Sbapt fi 756234949Sbapt rm -f conftest CONFTEST 757234949Sbaptfi 758234949Sbapt]) 759251143Sbapttest "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if filesystem supports mixed-case filenames.]) 760234949Sbapt])dnl 761234949Sbaptdnl --------------------------------------------------------------------------- 762251143Sbaptdnl CF_MKSTEMP version: 9 updated: 2012/10/03 04:34:49 763234949Sbaptdnl ---------- 764234949Sbaptdnl Check for a working mkstemp. This creates two files, checks that they are 765234949Sbaptdnl successfully created and distinct (AmigaOS apparently fails on the last). 766234949SbaptAC_DEFUN([CF_MKSTEMP],[ 767234949SbaptAC_CACHE_CHECK(for working mkstemp, cf_cv_func_mkstemp,[ 768234949Sbaptrm -rf conftest* 769234949SbaptAC_TRY_RUN([ 770234949Sbapt#include <sys/types.h> 771234949Sbapt#include <stdlib.h> 772234949Sbapt#include <stdio.h> 773234949Sbapt#include <string.h> 774234949Sbapt#include <sys/stat.h> 775234949Sbaptint main() 776234949Sbapt{ 777234949Sbapt char *tmpl = "conftestXXXXXX"; 778234949Sbapt char name[2][80]; 779234949Sbapt int n; 780234949Sbapt int result = 0; 781234949Sbapt int fd; 782234949Sbapt struct stat sb; 783234949Sbapt 784234949Sbapt umask(077); 785234949Sbapt for (n = 0; n < 2; ++n) { 786234949Sbapt strcpy(name[n], tmpl); 787234949Sbapt if ((fd = mkstemp(name[n])) >= 0) { 788234949Sbapt if (!strcmp(name[n], tmpl) 789234949Sbapt || stat(name[n], &sb) != 0 790234949Sbapt || (sb.st_mode & S_IFMT) != S_IFREG 791234949Sbapt || (sb.st_mode & 077) != 0) { 792234949Sbapt result = 1; 793234949Sbapt } 794234949Sbapt close(fd); 795234949Sbapt } 796234949Sbapt } 797234949Sbapt if (result == 0 798234949Sbapt && !strcmp(name[0], name[1])) 799234949Sbapt result = 1; 800234949Sbapt ${cf_cv_main_return:-return}(result); 801234949Sbapt} 802234949Sbapt],[cf_cv_func_mkstemp=yes 803234949Sbapt],[cf_cv_func_mkstemp=no 804251143Sbapt],[cf_cv_func_mkstemp=maybe]) 805234949Sbapt]) 806251143Sbaptif test "x$cf_cv_func_mkstemp" = xmaybe ; then 807251143Sbapt AC_CHECK_FUNC(mkstemp) 808251143Sbaptfi 809234949Sbaptif test "x$cf_cv_func_mkstemp" = xyes || test "x$ac_cv_func_mkstemp" = xyes ; then 810251143Sbapt AC_DEFINE(HAVE_MKSTEMP,1,[Define to 1 if mkstemp() is available and working.]) 811234949Sbaptfi 812234949Sbapt])dnl 813234949Sbaptdnl --------------------------------------------------------------------------- 814234949Sbaptdnl CF_MSG_LOG version: 5 updated: 2010/10/23 15:52:32 815234949Sbaptdnl ---------- 816234949Sbaptdnl Write a debug message to config.log, along with the line number in the 817234949Sbaptdnl configure script. 818234949SbaptAC_DEFUN([CF_MSG_LOG],[ 819234949Sbaptecho "${as_me:-configure}:__oline__: testing $* ..." 1>&AC_FD_CC 820234949Sbapt])dnl 821234949Sbaptdnl --------------------------------------------------------------------------- 822251143Sbaptdnl CF_NO_LEAKS_OPTION version: 5 updated: 2012/10/02 20:55:03 823234949Sbaptdnl ------------------ 824234949Sbaptdnl see CF_WITH_NO_LEAKS 825234949SbaptAC_DEFUN([CF_NO_LEAKS_OPTION],[ 826234949SbaptAC_MSG_CHECKING(if you want to use $1 for testing) 827234949SbaptAC_ARG_WITH($1, 828234949Sbapt [$2], 829251143Sbapt [AC_DEFINE_UNQUOTED($3,1,"Define to 1 if you want to use $1 for testing.")ifelse([$4],,[ 830234949Sbapt $4 831234949Sbapt]) 832234949Sbapt : ${with_cflags:=-g} 833234949Sbapt : ${with_no_leaks:=yes} 834234949Sbapt with_$1=yes], 835234949Sbapt [with_$1=]) 836234949SbaptAC_MSG_RESULT(${with_$1:-no}) 837234949Sbapt 838234949Sbaptcase .$with_cflags in #(vi 839234949Sbapt.*-g*) 840234949Sbapt case .$CFLAGS in #(vi 841234949Sbapt .*-g*) #(vi 842234949Sbapt ;; 843234949Sbapt *) 844234949Sbapt CF_ADD_CFLAGS([-g]) 845234949Sbapt ;; 846234949Sbapt esac 847234949Sbapt ;; 848234949Sbaptesac 849234949Sbapt])dnl 850234949Sbaptdnl --------------------------------------------------------------------------- 851234949Sbaptdnl CF_POSIX_C_SOURCE version: 8 updated: 2010/05/26 05:38:42 852234949Sbaptdnl ----------------- 853234949Sbaptdnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed. 854234949Sbaptdnl 855234949Sbaptdnl POSIX.1-1990 _POSIX_SOURCE 856234949Sbaptdnl POSIX.1-1990 and _POSIX_SOURCE and 857234949Sbaptdnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2 858234949Sbaptdnl Bindings Option 859234949Sbaptdnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L 860234949Sbaptdnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L 861234949Sbaptdnl X/Open 2000 _POSIX_C_SOURCE=200112L 862234949Sbaptdnl 863234949Sbaptdnl Parameters: 864234949Sbaptdnl $1 is the nominal value for _POSIX_C_SOURCE 865234949SbaptAC_DEFUN([CF_POSIX_C_SOURCE], 866234949Sbapt[ 867234949Sbaptcf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1]) 868234949Sbapt 869234949Sbaptcf_save_CFLAGS="$CFLAGS" 870234949Sbaptcf_save_CPPFLAGS="$CPPFLAGS" 871234949Sbapt 872234949SbaptCF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE) 873234949SbaptCF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE) 874234949Sbapt 875234949SbaptAC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[ 876234949Sbapt CF_MSG_LOG(if the symbol is already defined go no further) 877234949Sbapt AC_TRY_COMPILE([#include <sys/types.h>],[ 878234949Sbapt#ifndef _POSIX_C_SOURCE 879234949Sbaptmake an error 880234949Sbapt#endif], 881234949Sbapt [cf_cv_posix_c_source=no], 882234949Sbapt [cf_want_posix_source=no 883234949Sbapt case .$cf_POSIX_C_SOURCE in #(vi 884234949Sbapt .[[12]]??*) #(vi 885234949Sbapt cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" 886234949Sbapt ;; 887234949Sbapt .2) #(vi 888234949Sbapt cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" 889234949Sbapt cf_want_posix_source=yes 890234949Sbapt ;; 891234949Sbapt .*) 892234949Sbapt cf_want_posix_source=yes 893234949Sbapt ;; 894234949Sbapt esac 895234949Sbapt if test "$cf_want_posix_source" = yes ; then 896234949Sbapt AC_TRY_COMPILE([#include <sys/types.h>],[ 897234949Sbapt#ifdef _POSIX_SOURCE 898234949Sbaptmake an error 899234949Sbapt#endif],[], 900234949Sbapt cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE") 901234949Sbapt fi 902234949Sbapt CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE) 903234949Sbapt CFLAGS="$cf_trim_CFLAGS" 904234949Sbapt CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source" 905234949Sbapt CF_MSG_LOG(if the second compile does not leave our definition intact error) 906234949Sbapt AC_TRY_COMPILE([#include <sys/types.h>],[ 907234949Sbapt#ifndef _POSIX_C_SOURCE 908234949Sbaptmake an error 909234949Sbapt#endif],, 910234949Sbapt [cf_cv_posix_c_source=no]) 911234949Sbapt CFLAGS="$cf_save_CFLAGS" 912234949Sbapt CPPFLAGS="$cf_save_CPPFLAGS" 913234949Sbapt ]) 914234949Sbapt]) 915234949Sbapt 916234949Sbaptif test "$cf_cv_posix_c_source" != no ; then 917234949Sbapt CFLAGS="$cf_trim_CFLAGS" 918234949Sbapt CPPFLAGS="$cf_trim_CPPFLAGS" 919234949Sbapt CF_ADD_CFLAGS($cf_cv_posix_c_source) 920234949Sbaptfi 921234949Sbapt 922234949Sbapt])dnl 923234949Sbaptdnl --------------------------------------------------------------------------- 924268899Sbaptdnl CF_PROG_AWK version: 1 updated: 2006/09/16 11:40:59 925268899Sbaptdnl ----------- 926268899Sbaptdnl Check for awk, ensure that the check found something. 927268899SbaptAC_DEFUN([CF_PROG_AWK], 928268899Sbapt[ 929268899SbaptAC_PROG_AWK 930268899Sbapttest -z "$AWK" && AC_MSG_ERROR(No awk program found) 931268899Sbapt])dnl 932268899Sbaptdnl --------------------------------------------------------------------------- 933251143Sbaptdnl CF_PROG_CC version: 3 updated: 2012/10/06 15:31:55 934251143Sbaptdnl ---------- 935251143Sbaptdnl standard check for CC, plus followup sanity checks 936251143Sbaptdnl $1 = optional parameter to pass to AC_PROG_CC to specify compiler name 937251143SbaptAC_DEFUN([CF_PROG_CC],[ 938251143Sbaptifelse($1,,[AC_PROG_CC],[AC_PROG_CC($1)]) 939251143SbaptCF_GCC_VERSION 940251143SbaptCF_ACVERSION_CHECK(2.52, 941251143Sbapt [AC_PROG_CC_STDC], 942251143Sbapt [CF_ANSI_CC_REQD]) 943251143SbaptCF_CC_ENV_FLAGS 944234949Sbapt])dnl 945234949Sbaptdnl --------------------------------------------------------------------------- 946234949Sbaptdnl CF_PROG_LINT version: 2 updated: 2009/08/12 04:43:14 947234949Sbaptdnl ------------ 948234949SbaptAC_DEFUN([CF_PROG_LINT], 949234949Sbapt[ 950234949SbaptAC_CHECK_PROGS(LINT, tdlint lint alint splint lclint) 951234949SbaptAC_SUBST(LINT_OPTS) 952234949Sbapt])dnl 953234949Sbaptdnl --------------------------------------------------------------------------- 954234949Sbaptdnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50 955234949Sbaptdnl ---------------- 956234949Sbaptdnl Remove all -U and -D options that refer to the given symbol from a list 957234949Sbaptdnl of C compiler options. This works around the problem that not all 958234949Sbaptdnl compilers process -U and -D options from left-to-right, so a -U option 959234949Sbaptdnl cannot be used to cancel the effect of a preceding -D option. 960234949Sbaptdnl 961234949Sbaptdnl $1 = target (which could be the same as the source variable) 962234949Sbaptdnl $2 = source (including '$') 963234949Sbaptdnl $3 = symbol to remove 964234949Sbaptdefine([CF_REMOVE_DEFINE], 965234949Sbapt[ 966234949Sbapt$1=`echo "$2" | \ 967234949Sbapt sed -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[[ ]]/ /g' \ 968234949Sbapt -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'` 969234949Sbapt])dnl 970234949Sbaptdnl --------------------------------------------------------------------------- 971234949Sbaptdnl CF_TRY_XOPEN_SOURCE version: 1 updated: 2011/10/30 17:09:50 972234949Sbaptdnl ------------------- 973234949Sbaptdnl If _XOPEN_SOURCE is not defined in the compile environment, check if we 974234949Sbaptdnl can define it successfully. 975234949SbaptAC_DEFUN([CF_TRY_XOPEN_SOURCE],[ 976234949SbaptAC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[ 977234949Sbapt AC_TRY_COMPILE([ 978234949Sbapt#include <stdlib.h> 979234949Sbapt#include <string.h> 980234949Sbapt#include <sys/types.h> 981234949Sbapt],[ 982234949Sbapt#ifndef _XOPEN_SOURCE 983234949Sbaptmake an error 984234949Sbapt#endif], 985234949Sbapt [cf_cv_xopen_source=no], 986234949Sbapt [cf_save="$CPPFLAGS" 987234949Sbapt CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" 988234949Sbapt AC_TRY_COMPILE([ 989234949Sbapt#include <stdlib.h> 990234949Sbapt#include <string.h> 991234949Sbapt#include <sys/types.h> 992234949Sbapt],[ 993234949Sbapt#ifdef _XOPEN_SOURCE 994234949Sbaptmake an error 995234949Sbapt#endif], 996234949Sbapt [cf_cv_xopen_source=no], 997234949Sbapt [cf_cv_xopen_source=$cf_XOPEN_SOURCE]) 998234949Sbapt CPPFLAGS="$cf_save" 999234949Sbapt ]) 1000234949Sbapt]) 1001234949Sbapt 1002234949Sbaptif test "$cf_cv_xopen_source" != no ; then 1003234949Sbapt CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE) 1004234949Sbapt CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE) 1005234949Sbapt cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" 1006234949Sbapt CF_ADD_CFLAGS($cf_temp_xopen_source) 1007234949Sbaptfi 1008234949Sbapt]) 1009234949Sbaptdnl --------------------------------------------------------------------------- 1010234949Sbaptdnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59 1011234949Sbaptdnl -------- 1012234949Sbaptdnl Make an uppercase version of a variable 1013234949Sbaptdnl $1=uppercase($2) 1014234949SbaptAC_DEFUN([CF_UPPER], 1015234949Sbapt[ 1016234949Sbapt$1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` 1017234949Sbapt])dnl 1018234949Sbaptdnl --------------------------------------------------------------------------- 1019234949Sbaptdnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12 1020234949Sbaptdnl ---------- 1021234949Sbaptdnl Use AC_VERBOSE w/o the warnings 1022234949SbaptAC_DEFUN([CF_VERBOSE], 1023234949Sbapt[test -n "$verbose" && echo " $1" 1>&AC_FD_MSG 1024234949SbaptCF_MSG_LOG([$1]) 1025234949Sbapt])dnl 1026234949Sbaptdnl --------------------------------------------------------------------------- 1027234949Sbaptdnl CF_WITH_DBMALLOC version: 7 updated: 2010/06/21 17:26:47 1028234949Sbaptdnl ---------------- 1029234949Sbaptdnl Configure-option for dbmalloc. The optional parameter is used to override 1030234949Sbaptdnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests. 1031234949SbaptAC_DEFUN([CF_WITH_DBMALLOC],[ 1032234949SbaptCF_NO_LEAKS_OPTION(dbmalloc, 1033234949Sbapt [ --with-dbmalloc test: use Conor Cahill's dbmalloc library], 1034234949Sbapt [USE_DBMALLOC]) 1035234949Sbapt 1036234949Sbaptif test "$with_dbmalloc" = yes ; then 1037234949Sbapt AC_CHECK_HEADER(dbmalloc.h, 1038234949Sbapt [AC_CHECK_LIB(dbmalloc,[debug_malloc]ifelse([$1],,[],[,$1]))]) 1039234949Sbaptfi 1040234949Sbapt])dnl 1041234949Sbaptdnl --------------------------------------------------------------------------- 1042234949Sbaptdnl CF_WITH_DMALLOC version: 7 updated: 2010/06/21 17:26:47 1043234949Sbaptdnl --------------- 1044234949Sbaptdnl Configure-option for dmalloc. The optional parameter is used to override 1045234949Sbaptdnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests. 1046234949SbaptAC_DEFUN([CF_WITH_DMALLOC],[ 1047234949SbaptCF_NO_LEAKS_OPTION(dmalloc, 1048234949Sbapt [ --with-dmalloc test: use Gray Watson's dmalloc library], 1049234949Sbapt [USE_DMALLOC]) 1050234949Sbapt 1051234949Sbaptif test "$with_dmalloc" = yes ; then 1052234949Sbapt AC_CHECK_HEADER(dmalloc.h, 1053234949Sbapt [AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse([$1],,[],[,$1]))]) 1054234949Sbaptfi 1055234949Sbapt])dnl 1056234949Sbaptdnl --------------------------------------------------------------------------- 1057234949Sbaptdnl CF_WITH_VALGRIND version: 1 updated: 2006/12/14 18:00:21 1058234949Sbaptdnl ---------------- 1059234949SbaptAC_DEFUN([CF_WITH_VALGRIND],[ 1060234949SbaptCF_NO_LEAKS_OPTION(valgrind, 1061234949Sbapt [ --with-valgrind test: use valgrind], 1062234949Sbapt [USE_VALGRIND]) 1063234949Sbapt])dnl 1064234949Sbaptdnl --------------------------------------------------------------------------- 1065234949Sbaptdnl CF_WITH_WARNINGS version: 5 updated: 2004/07/23 14:40:34 1066234949Sbaptdnl ---------------- 1067234949Sbaptdnl Combine the checks for gcc features into a configure-script option 1068234949Sbaptdnl 1069234949Sbaptdnl Parameters: 1070234949Sbaptdnl $1 - see CF_GCC_WARNINGS 1071234949SbaptAC_DEFUN([CF_WITH_WARNINGS], 1072234949Sbapt[ 1073234949Sbaptif ( test "$GCC" = yes || test "$GXX" = yes ) 1074234949Sbaptthen 1075234949SbaptAC_MSG_CHECKING(if you want to check for gcc warnings) 1076234949SbaptAC_ARG_WITH(warnings, 1077234949Sbapt [ --with-warnings test: turn on gcc warnings], 1078234949Sbapt [cf_opt_with_warnings=$withval], 1079234949Sbapt [cf_opt_with_warnings=no]) 1080234949SbaptAC_MSG_RESULT($cf_opt_with_warnings) 1081234949Sbaptif test "$cf_opt_with_warnings" != no ; then 1082234949Sbapt CF_GCC_ATTRIBUTES 1083234949Sbapt CF_GCC_WARNINGS([$1]) 1084234949Sbaptfi 1085234949Sbaptfi 1086234949Sbapt])dnl 1087234949Sbaptdnl --------------------------------------------------------------------------- 1088268899Sbaptdnl CF_XOPEN_SOURCE version: 46 updated: 2014/02/09 19:30:15 1089234949Sbaptdnl --------------- 1090234949Sbaptdnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions, 1091234949Sbaptdnl or adapt to the vendor's definitions to get equivalent functionality, 1092234949Sbaptdnl without losing the common non-POSIX features. 1093234949Sbaptdnl 1094234949Sbaptdnl Parameters: 1095234949Sbaptdnl $1 is the nominal value for _XOPEN_SOURCE 1096234949Sbaptdnl $2 is the nominal value for _POSIX_C_SOURCE 1097234949SbaptAC_DEFUN([CF_XOPEN_SOURCE],[ 1098251143SbaptAC_REQUIRE([AC_CANONICAL_HOST]) 1099234949Sbapt 1100234949Sbaptcf_XOPEN_SOURCE=ifelse([$1],,500,[$1]) 1101234949Sbaptcf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2]) 1102234949Sbaptcf_xopen_source= 1103234949Sbapt 1104234949Sbaptcase $host_os in #(vi 1105234949Sbaptaix[[4-7]]*) #(vi 1106234949Sbapt cf_xopen_source="-D_ALL_SOURCE" 1107234949Sbapt ;; 1108268899Sbaptcygwin|msys) #(vi 1109234949Sbapt cf_XOPEN_SOURCE=600 1110234949Sbapt ;; 1111234949Sbaptdarwin[[0-8]].*) #(vi 1112234949Sbapt cf_xopen_source="-D_APPLE_C_SOURCE" 1113234949Sbapt ;; 1114234949Sbaptdarwin*) #(vi 1115234949Sbapt cf_xopen_source="-D_DARWIN_C_SOURCE" 1116234949Sbapt cf_XOPEN_SOURCE= 1117234949Sbapt ;; 1118234949Sbaptfreebsd*|dragonfly*) #(vi 1119234949Sbapt # 5.x headers associate 1120234949Sbapt # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L 1121234949Sbapt # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L 1122234949Sbapt cf_POSIX_C_SOURCE=200112L 1123234949Sbapt cf_XOPEN_SOURCE=600 1124234949Sbapt cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" 1125234949Sbapt ;; 1126234949Sbapthpux11*) #(vi 1127234949Sbapt cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500" 1128234949Sbapt ;; 1129234949Sbapthpux*) #(vi 1130234949Sbapt cf_xopen_source="-D_HPUX_SOURCE" 1131234949Sbapt ;; 1132234949Sbaptirix[[56]].*) #(vi 1133234949Sbapt cf_xopen_source="-D_SGI_SOURCE" 1134234949Sbapt cf_XOPEN_SOURCE= 1135234949Sbapt ;; 1136234949Sbaptlinux*|gnu*|mint*|k*bsd*-gnu) #(vi 1137234949Sbapt CF_GNU_SOURCE 1138234949Sbapt ;; 1139234949Sbaptmirbsd*) #(vi 1140234949Sbapt # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <sys/select.h> and other headers which use u_int / u_short types 1141234949Sbapt cf_XOPEN_SOURCE= 1142234949Sbapt CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) 1143234949Sbapt ;; 1144234949Sbaptnetbsd*) #(vi 1145234949Sbapt cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw 1146234949Sbapt ;; 1147234949Sbaptopenbsd[[4-9]]*) #(vi 1148234949Sbapt # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw 1149234949Sbapt cf_xopen_source="-D_BSD_SOURCE" 1150234949Sbapt cf_XOPEN_SOURCE=600 1151234949Sbapt ;; 1152234949Sbaptopenbsd*) #(vi 1153234949Sbapt # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw 1154234949Sbapt ;; 1155234949Sbaptosf[[45]]*) #(vi 1156234949Sbapt cf_xopen_source="-D_OSF_SOURCE" 1157234949Sbapt ;; 1158234949Sbaptnto-qnx*) #(vi 1159234949Sbapt cf_xopen_source="-D_QNX_SOURCE" 1160234949Sbapt ;; 1161234949Sbaptsco*) #(vi 1162234949Sbapt # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer 1163234949Sbapt ;; 1164234949Sbaptsolaris2.*) #(vi 1165234949Sbapt cf_xopen_source="-D__EXTENSIONS__" 1166268899Sbapt cf_cv_xopen_source=broken 1167234949Sbapt ;; 1168234949Sbapt*) 1169234949Sbapt CF_TRY_XOPEN_SOURCE 1170234949Sbapt CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) 1171234949Sbapt ;; 1172234949Sbaptesac 1173234949Sbapt 1174234949Sbaptif test -n "$cf_xopen_source" ; then 1175234949Sbapt CF_ADD_CFLAGS($cf_xopen_source) 1176234949Sbaptfi 1177234949Sbapt 1178234949Sbaptdnl In anything but the default case, we may have system-specific setting 1179234949Sbaptdnl which is still not guaranteed to provide all of the entrypoints that 1180234949Sbaptdnl _XOPEN_SOURCE would yield. 1181234949Sbaptif test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then 1182234949Sbapt AC_MSG_CHECKING(if _XOPEN_SOURCE really is set) 1183234949Sbapt AC_TRY_COMPILE([#include <stdlib.h>],[ 1184234949Sbapt#ifndef _XOPEN_SOURCE 1185234949Sbaptmake an error 1186234949Sbapt#endif], 1187234949Sbapt [cf_XOPEN_SOURCE_set=yes], 1188234949Sbapt [cf_XOPEN_SOURCE_set=no]) 1189234949Sbapt AC_MSG_RESULT($cf_XOPEN_SOURCE_set) 1190234949Sbapt if test $cf_XOPEN_SOURCE_set = yes 1191234949Sbapt then 1192234949Sbapt AC_TRY_COMPILE([#include <stdlib.h>],[ 1193234949Sbapt#if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE 1194234949Sbaptmake an error 1195234949Sbapt#endif], 1196234949Sbapt [cf_XOPEN_SOURCE_set_ok=yes], 1197234949Sbapt [cf_XOPEN_SOURCE_set_ok=no]) 1198234949Sbapt if test $cf_XOPEN_SOURCE_set_ok = no 1199234949Sbapt then 1200234949Sbapt AC_MSG_WARN(_XOPEN_SOURCE is lower than requested) 1201234949Sbapt fi 1202234949Sbapt else 1203234949Sbapt CF_TRY_XOPEN_SOURCE 1204234949Sbapt fi 1205234949Sbaptfi 1206234949Sbapt]) 1207