1dnl $Id: aclocal.m4,v 1.98 2016/11/20 15:18:17 tom Exp $ 2dnl macros used for CDK configure script 3dnl --------------------------------------------------------------------------- 4dnl Copyright 1999-2015,2016 Thomas E. Dickey 5dnl 6dnl Permission is hereby granted, free of charge, to any person obtaining a 7dnl copy of this software and associated documentation files (the "Software"), 8dnl to deal in the Software without restriction, including without limitation 9dnl the rights to use, copy, modify, merge, publish, distribute, distribute 10dnl with modifications, sublicense, and/or sell copies of the Software, and to 11dnl permit persons to whom the Software is furnished to do so, subject to the 12dnl following conditions: 13dnl 14dnl The above copyright notice and this permission notice shall be included in 15dnl all copies or substantial portions of the Software. 16dnl 17dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20dnl THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23dnl DEALINGS IN THE SOFTWARE. 24dnl 25dnl Except as contained in this notice, the name(s) of the above copyright 26dnl holders shall not be used in advertising or otherwise to promote the sale, 27dnl use or other dealings in this Software without prior written 28dnl authorization. 29dnl --------------------------------------------------------------------------- 30dnl --------------------------------------------------------------------------- 31dnl CF_ACVERSION_CHECK version: 5 updated: 2014/06/04 19:11:49 32dnl ------------------ 33dnl Conditionally generate script according to whether we're using a given autoconf. 34dnl 35dnl $1 = version to compare against 36dnl $2 = code to use if AC_ACVERSION is at least as high as $1. 37dnl $3 = code to use if AC_ACVERSION is older than $1. 38define([CF_ACVERSION_CHECK], 39[ 40ifdef([AC_ACVERSION], ,[ifdef([AC_AUTOCONF_VERSION],[m4_copy([AC_AUTOCONF_VERSION],[AC_ACVERSION])],[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])])dnl 41ifdef([m4_version_compare], 42[m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])], 43[CF_ACVERSION_COMPARE( 44AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])), 45AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl 46dnl --------------------------------------------------------------------------- 47dnl CF_ACVERSION_COMPARE version: 3 updated: 2012/10/03 18:39:53 48dnl -------------------- 49dnl CF_ACVERSION_COMPARE(MAJOR1, MINOR1, TERNARY1, 50dnl MAJOR2, MINOR2, TERNARY2, 51dnl PRINTABLE2, not FOUND, FOUND) 52define([CF_ACVERSION_COMPARE], 53[ifelse(builtin([eval], [$2 < $5]), 1, 54[ifelse([$8], , ,[$8])], 55[ifelse([$9], , ,[$9])])])dnl 56dnl --------------------------------------------------------------------------- 57dnl CF_ADD_CFLAGS version: 12 updated: 2015/04/12 15:39:00 58dnl ------------- 59dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS 60dnl The second parameter if given makes this macro verbose. 61dnl 62dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS, 63dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily 64dnl confused by the quotes (which require backslashes to keep them usable). 65AC_DEFUN([CF_ADD_CFLAGS], 66[ 67cf_fix_cppflags=no 68cf_new_cflags= 69cf_new_cppflags= 70cf_new_extra_cppflags= 71 72for cf_add_cflags in $1 73do 74case $cf_fix_cppflags in 75(no) 76 case $cf_add_cflags in 77 (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) 78 case $cf_add_cflags in 79 (-D*) 80 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'` 81 82 test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ 83 && test -z "${cf_tst_cflags}" \ 84 && cf_fix_cppflags=yes 85 86 if test $cf_fix_cppflags = yes ; then 87 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" 88 continue 89 elif test "${cf_tst_cflags}" = "\"'" ; then 90 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" 91 continue 92 fi 93 ;; 94 esac 95 case "$CPPFLAGS" in 96 (*$cf_add_cflags) 97 ;; 98 (*) 99 case $cf_add_cflags in 100 (-D*) 101 cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` 102 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags) 103 ;; 104 esac 105 cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" 106 ;; 107 esac 108 ;; 109 (*) 110 cf_new_cflags="$cf_new_cflags $cf_add_cflags" 111 ;; 112 esac 113 ;; 114(yes) 115 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" 116 117 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'` 118 119 test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ 120 && test -z "${cf_tst_cflags}" \ 121 && cf_fix_cppflags=no 122 ;; 123esac 124done 125 126if test -n "$cf_new_cflags" ; then 127 ifelse([$2],,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)]) 128 CFLAGS="$CFLAGS $cf_new_cflags" 129fi 130 131if test -n "$cf_new_cppflags" ; then 132 ifelse([$2],,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)]) 133 CPPFLAGS="$CPPFLAGS $cf_new_cppflags" 134fi 135 136if test -n "$cf_new_extra_cppflags" ; then 137 ifelse([$2],,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)]) 138 EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" 139fi 140 141AC_SUBST(EXTRA_CPPFLAGS) 142 143])dnl 144dnl --------------------------------------------------------------------------- 145dnl CF_ADD_INCDIR version: 14 updated: 2015/05/25 20:53:04 146dnl ------------- 147dnl Add an include-directory to $CPPFLAGS. Don't add /usr/include, since it's 148dnl redundant. We don't normally need to add -I/usr/local/include for gcc, 149dnl but old versions (and some misinstalled ones) need that. To make things 150dnl worse, gcc 3.x may give error messages if -I/usr/local/include is added to 151dnl the include-path). 152AC_DEFUN([CF_ADD_INCDIR], 153[ 154if test -n "$1" ; then 155 for cf_add_incdir in $1 156 do 157 while test $cf_add_incdir != /usr/include 158 do 159 if test -d $cf_add_incdir 160 then 161 cf_have_incdir=no 162 if test -n "$CFLAGS$CPPFLAGS" ; then 163 # a loop is needed to ensure we can add subdirs of existing dirs 164 for cf_test_incdir in $CFLAGS $CPPFLAGS ; do 165 if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then 166 cf_have_incdir=yes; break 167 fi 168 done 169 fi 170 171 if test "$cf_have_incdir" = no ; then 172 if test "$cf_add_incdir" = /usr/local/include ; then 173 if test "$GCC" = yes 174 then 175 cf_save_CPPFLAGS=$CPPFLAGS 176 CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" 177 AC_TRY_COMPILE([#include <stdio.h>], 178 [printf("Hello")], 179 [], 180 [cf_have_incdir=yes]) 181 CPPFLAGS=$cf_save_CPPFLAGS 182 fi 183 fi 184 fi 185 186 if test "$cf_have_incdir" = no ; then 187 CF_VERBOSE(adding $cf_add_incdir to include-path) 188 ifelse([$2],,CPPFLAGS,[$2])="$ifelse([$2],,CPPFLAGS,[$2]) -I$cf_add_incdir" 189 190 cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` 191 test "$cf_top_incdir" = "$cf_add_incdir" && break 192 cf_add_incdir="$cf_top_incdir" 193 else 194 break 195 fi 196 else 197 break 198 fi 199 done 200 done 201fi 202])dnl 203dnl --------------------------------------------------------------------------- 204dnl CF_ADD_LIB version: 2 updated: 2010/06/02 05:03:05 205dnl ---------- 206dnl Add a library, used to enforce consistency. 207dnl 208dnl $1 = library to add, without the "-l" 209dnl $2 = variable to update (default $LIBS) 210AC_DEFUN([CF_ADD_LIB],[CF_ADD_LIBS(-l$1,ifelse($2,,LIBS,[$2]))])dnl 211dnl --------------------------------------------------------------------------- 212dnl CF_ADD_LIBDIR version: 10 updated: 2015/04/18 08:56:57 213dnl ------------- 214dnl Adds to the library-path 215dnl 216dnl Some machines have trouble with multiple -L options. 217dnl 218dnl $1 is the (list of) directory(s) to add 219dnl $2 is the optional name of the variable to update (default LDFLAGS) 220dnl 221AC_DEFUN([CF_ADD_LIBDIR], 222[ 223if test -n "$1" ; then 224 for cf_add_libdir in $1 225 do 226 if test $cf_add_libdir = /usr/lib ; then 227 : 228 elif test -d $cf_add_libdir 229 then 230 cf_have_libdir=no 231 if test -n "$LDFLAGS$LIBS" ; then 232 # a loop is needed to ensure we can add subdirs of existing dirs 233 for cf_test_libdir in $LDFLAGS $LIBS ; do 234 if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then 235 cf_have_libdir=yes; break 236 fi 237 done 238 fi 239 if test "$cf_have_libdir" = no ; then 240 CF_VERBOSE(adding $cf_add_libdir to library-path) 241 ifelse([$2],,LDFLAGS,[$2])="-L$cf_add_libdir $ifelse([$2],,LDFLAGS,[$2])" 242 fi 243 fi 244 done 245fi 246])dnl 247dnl --------------------------------------------------------------------------- 248dnl CF_ADD_LIBS version: 2 updated: 2014/07/13 14:33:27 249dnl ----------- 250dnl Add one or more libraries, used to enforce consistency. Libraries are 251dnl prepended to an existing list, since their dependencies are assumed to 252dnl already exist in the list. 253dnl 254dnl $1 = libraries to add, with the "-l", etc. 255dnl $2 = variable to update (default $LIBS) 256AC_DEFUN([CF_ADD_LIBS],[ 257cf_add_libs="$1" 258# Filter out duplicates - this happens with badly-designed ".pc" files... 259for cf_add_1lib in [$]ifelse($2,,LIBS,[$2]) 260do 261 for cf_add_2lib in $cf_add_libs 262 do 263 if test "x$cf_add_1lib" = "x$cf_add_2lib" 264 then 265 cf_add_1lib= 266 break 267 fi 268 done 269 test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib" 270done 271ifelse($2,,LIBS,[$2])="$cf_add_libs" 272])dnl 273dnl --------------------------------------------------------------------------- 274dnl CF_ADD_LIB_AFTER version: 3 updated: 2013/07/09 21:27:22 275dnl ---------------- 276dnl Add a given library after another, e.g., following the one it satisfies a 277dnl dependency for. 278dnl 279dnl $1 = the first library 280dnl $2 = its dependency 281AC_DEFUN([CF_ADD_LIB_AFTER],[ 282CF_VERBOSE(...before $LIBS) 283LIBS=`echo "$LIBS" | sed -e "s/[[ ]][[ ]]*/ /g" -e "s%$1 %$1 $2 %" -e 's% % %g'` 284CF_VERBOSE(...after $LIBS) 285])dnl 286dnl --------------------------------------------------------------------------- 287dnl CF_ADD_SUBDIR_PATH version: 4 updated: 2013/10/08 17:47:05 288dnl ------------------ 289dnl Append to a search-list for a nonstandard header/lib-file 290dnl $1 = the variable to return as result 291dnl $2 = the package name 292dnl $3 = the subdirectory, e.g., bin, include or lib 293dnl $4 = the directory under which we will test for subdirectories 294dnl $5 = a directory that we do not want $4 to match 295AC_DEFUN([CF_ADD_SUBDIR_PATH], 296[ 297test "x$4" != "x$5" && \ 298test -d "$4" && \ 299ifelse([$5],NONE,,[(test -z "$5" || test x$5 = xNONE || test "x$4" != "x$5") &&]) { 300 test -n "$verbose" && echo " ... testing for $3-directories under $4" 301 test -d $4/$3 && $1="[$]$1 $4/$3" 302 test -d $4/$3/$2 && $1="[$]$1 $4/$3/$2" 303 test -d $4/$3/$2/$3 && $1="[$]$1 $4/$3/$2/$3" 304 test -d $4/$2/$3 && $1="[$]$1 $4/$2/$3" 305 test -d $4/$2/$3/$2 && $1="[$]$1 $4/$2/$3/$2" 306} 307])dnl 308dnl --------------------------------------------------------------------------- 309dnl CF_ANSI_CC_CHECK version: 13 updated: 2012/10/06 11:17:15 310dnl ---------------- 311dnl This was originally adapted from the macros 'fp_PROG_CC_STDC' and 312dnl 'fp_C_PROTOTYPES' in the sharutils 4.2 distribution. 313AC_DEFUN([CF_ANSI_CC_CHECK], 314[ 315CF_CC_ENV_FLAGS 316 317AC_CACHE_CHECK(for ${CC:-cc} option to accept ANSI C, cf_cv_ansi_cc,[ 318cf_cv_ansi_cc=no 319cf_save_CFLAGS="$CFLAGS" 320cf_save_CPPFLAGS="$CPPFLAGS" 321# Don't try gcc -ansi; that turns off useful extensions and 322# breaks some systems' header files. 323# AIX -qlanglvl=ansi 324# Ultrix and OSF/1 -std1 325# HP-UX -Aa -D_HPUX_SOURCE 326# SVR4 -Xc 327# UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes) 328for cf_arg in "-DCC_HAS_PROTOS" \ 329 "" \ 330 -qlanglvl=ansi \ 331 -std1 \ 332 -Ae \ 333 "-Aa -D_HPUX_SOURCE" \ 334 -Xc 335do 336 CF_ADD_CFLAGS($cf_arg) 337 AC_TRY_COMPILE( 338[ 339#ifndef CC_HAS_PROTOS 340#if !defined(__STDC__) || (__STDC__ != 1) 341choke me 342#endif 343#endif 344],[ 345 int test (int i, double x); 346 struct s1 {int (*f) (int a);}; 347 struct s2 {int (*f) (double a);};], 348 [cf_cv_ansi_cc="$cf_arg"; break]) 349done 350CFLAGS="$cf_save_CFLAGS" 351CPPFLAGS="$cf_save_CPPFLAGS" 352]) 353 354if test "$cf_cv_ansi_cc" != "no"; then 355if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then 356 CF_ADD_CFLAGS($cf_cv_ansi_cc) 357else 358 AC_DEFINE(CC_HAS_PROTOS,1,[Define to 1 if C compiler supports prototypes]) 359fi 360fi 361])dnl 362dnl --------------------------------------------------------------------------- 363dnl CF_ANSI_CC_REQD version: 4 updated: 2008/03/23 14:48:54 364dnl --------------- 365dnl For programs that must use an ANSI compiler, obtain compiler options that 366dnl will make it recognize prototypes. We'll do preprocessor checks in other 367dnl macros, since tools such as unproto can fake prototypes, but only part of 368dnl the preprocessor. 369AC_DEFUN([CF_ANSI_CC_REQD], 370[AC_REQUIRE([CF_ANSI_CC_CHECK]) 371if test "$cf_cv_ansi_cc" = "no"; then 372 AC_MSG_ERROR( 373[Your compiler does not appear to recognize prototypes. 374You have the following choices: 375 a. adjust your compiler options 376 b. get an up-to-date compiler 377 c. use a wrapper such as unproto]) 378fi 379])dnl 380dnl --------------------------------------------------------------------------- 381dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31 382dnl -------------- 383dnl Allow user to disable a normally-on option. 384AC_DEFUN([CF_ARG_DISABLE], 385[CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl 386dnl --------------------------------------------------------------------------- 387dnl CF_ARG_OPTION version: 5 updated: 2015/05/10 19:52:14 388dnl ------------- 389dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus 390dnl values. 391dnl 392dnl Parameters: 393dnl $1 = option name 394dnl $2 = help-string 395dnl $3 = action to perform if option is not default 396dnl $4 = action if perform if option is default 397dnl $5 = default option value (either 'yes' or 'no') 398AC_DEFUN([CF_ARG_OPTION], 399[AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes) 400 if test "$enableval" != "$5" ; then 401ifelse([$3],,[ :]dnl 402,[ $3]) ifelse([$4],,,[ 403 else 404 $4]) 405 fi],[enableval=$5 ifelse([$4],,,[ 406 $4 407])dnl 408])])dnl 409dnl --------------------------------------------------------------------------- 410dnl CF_CC_ENV_FLAGS version: 6 updated: 2016/08/29 20:57:00 411dnl --------------- 412dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content 413dnl into CC. This will not help with broken scripts that wrap the compiler 414dnl with options, but eliminates a more common category of user confusion. 415dnl 416dnl In particular, it addresses the problem of being able to run the C 417dnl preprocessor in a consistent manner. 418dnl 419dnl Caveat: this also disallows blanks in the pathname for the compiler, but 420dnl the nuisance of having inconsistent settings for compiler and preprocessor 421dnl outweighs that limitation. 422AC_DEFUN([CF_CC_ENV_FLAGS], 423[ 424# This should have been defined by AC_PROG_CC 425: ${CC:=cc} 426 427AC_MSG_CHECKING(\$CC variable) 428case "$CC" in 429(*[[\ \ ]]-*) 430 AC_MSG_RESULT(broken) 431 AC_MSG_WARN(your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options) 432 # humor him... 433 cf_flags=`echo "$CC" | sed -e 's/^.*[[ ]]\(-[[^ ]]\)/\1/'` 434 CC=`echo "$CC " | sed -e 's/[[ ]]-[[^ ]].*$//' -e 's/[[ ]]*$//'` 435 for cf_arg in $cf_flags 436 do 437 case "x$cf_arg" in 438 (x-[[IUDfgOW]]*) 439 CF_ADD_CFLAGS($cf_flags) 440 ;; 441 (*) 442 CC="$CC $cf_arg" 443 ;; 444 esac 445 done 446 CF_VERBOSE(resulting CC: '$CC') 447 CF_VERBOSE(resulting CFLAGS: '$CFLAGS') 448 CF_VERBOSE(resulting CPPFLAGS: '$CPPFLAGS') 449 ;; 450(*) 451 AC_MSG_RESULT(ok) 452 ;; 453esac 454])dnl 455dnl --------------------------------------------------------------------------- 456dnl CF_CHECK_CACHE version: 12 updated: 2012/10/02 20:55:03 457dnl -------------- 458dnl Check if we're accidentally using a cache from a different machine. 459dnl Derive the system name, as a check for reusing the autoconf cache. 460dnl 461dnl If we've packaged config.guess and config.sub, run that (since it does a 462dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow 463dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM 464dnl which is useful in cross-compiles. 465dnl 466dnl Note: we would use $ac_config_sub, but that is one of the places where 467dnl autoconf 2.5x broke compatibility with autoconf 2.13 468AC_DEFUN([CF_CHECK_CACHE], 469[ 470if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then 471 ifelse([$1],,[AC_CANONICAL_HOST],[$1]) 472 system_name="$host_os" 473else 474 system_name="`(uname -s -r) 2>/dev/null`" 475 if test -z "$system_name" ; then 476 system_name="`(hostname) 2>/dev/null`" 477 fi 478fi 479test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name",[Define to the system name.]) 480AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"]) 481 482test -z "$system_name" && system_name="$cf_cv_system_name" 483test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name) 484 485if test ".$system_name" != ".$cf_cv_system_name" ; then 486 AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)) 487 AC_MSG_ERROR("Please remove config.cache and try again.") 488fi 489])dnl 490dnl --------------------------------------------------------------------------- 491dnl CF_CHECK_CFLAGS version: 3 updated: 2014/07/22 05:32:57 492dnl --------------- 493dnl Conditionally add to $CFLAGS and $CPPFLAGS values which are derived from 494dnl a build-configuration such as imake. These have the pitfall that they 495dnl often contain compiler-specific options which we cannot use, mixed with 496dnl preprocessor options that we usually can. 497AC_DEFUN([CF_CHECK_CFLAGS], 498[ 499CF_VERBOSE(checking additions to CFLAGS) 500cf_check_cflags="$CFLAGS" 501cf_check_cppflags="$CPPFLAGS" 502CF_ADD_CFLAGS($1,yes) 503if test "x$cf_check_cflags" != "x$CFLAGS" ; then 504AC_TRY_LINK([#include <stdio.h>],[printf("Hello world");],, 505 [CF_VERBOSE(test-compile failed. Undoing change to \$CFLAGS) 506 if test "x$cf_check_cppflags" != "x$CPPFLAGS" ; then 507 CF_VERBOSE(but keeping change to \$CPPFLAGS) 508 fi 509 CFLAGS="$cf_check_flags"]) 510fi 511])dnl 512dnl --------------------------------------------------------------------------- 513dnl CF_CHECK_LIBTOOL_VERSION version: 1 updated: 2013/04/06 18:03:09 514dnl ------------------------ 515dnl Show the version of libtool 516dnl 517dnl Save the version in a cache variable - this is not entirely a good thing, 518dnl but the version string from libtool is very ugly, and for bug reports it 519dnl might be useful to have the original string. 520AC_DEFUN([CF_CHECK_LIBTOOL_VERSION],[ 521if test -n "$LIBTOOL" && test "$LIBTOOL" != none 522then 523 AC_MSG_CHECKING(version of $LIBTOOL) 524 CF_LIBTOOL_VERSION 525 AC_MSG_RESULT($cf_cv_libtool_version) 526 if test -z "$cf_cv_libtool_version" ; then 527 AC_MSG_ERROR(This is not GNU libtool) 528 fi 529else 530 AC_MSG_ERROR(GNU libtool has not been found) 531fi 532])dnl 533dnl --------------------------------------------------------------------------- 534dnl CF_CLANG_COMPILER version: 2 updated: 2013/11/19 19:23:35 535dnl ----------------- 536dnl Check if the given compiler is really clang. clang's C driver defines 537dnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does 538dnl not ignore some gcc options. 539dnl 540dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to 541dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from 542dnl the wrappers for gcc and g++ warnings. 543dnl 544dnl $1 = GCC (default) or GXX 545dnl $2 = CLANG_COMPILER (default) 546dnl $3 = CFLAGS (default) or CXXFLAGS 547AC_DEFUN([CF_CLANG_COMPILER],[ 548ifelse([$2],,CLANG_COMPILER,[$2])=no 549 550if test "$ifelse([$1],,[$1],GCC)" = yes ; then 551 AC_MSG_CHECKING(if this is really Clang ifelse([$1],GXX,C++,C) compiler) 552 cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" 553 ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -Qunused-arguments" 554 AC_TRY_COMPILE([],[ 555#ifdef __clang__ 556#else 557make an error 558#endif 559],[ifelse([$2],,CLANG_COMPILER,[$2])=yes 560cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments" 561],[]) 562 ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" 563 AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2])) 564fi 565]) 566dnl --------------------------------------------------------------------------- 567dnl CF_CURSES_CHTYPE version: 8 updated: 2012/10/06 08:57:51 568dnl ---------------- 569dnl Test if curses defines 'chtype' (usually a 'long' type for SysV curses). 570AC_DEFUN([CF_CURSES_CHTYPE], 571[ 572AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl 573AC_CACHE_CHECK(for chtype typedef,cf_cv_chtype_decl,[ 574 AC_TRY_COMPILE([#include <${cf_cv_ncurses_header:-curses.h}>], 575 [chtype foo], 576 [cf_cv_chtype_decl=yes], 577 [cf_cv_chtype_decl=no])]) 578if test $cf_cv_chtype_decl = yes ; then 579 AC_DEFINE(HAVE_TYPE_CHTYPE,1,[Define to 1 if chtype is declared]) 580 AC_CACHE_CHECK(if chtype is scalar or struct,cf_cv_chtype_type,[ 581 AC_TRY_COMPILE([#include <${cf_cv_ncurses_header:-curses.h}>], 582 [chtype foo; long x = foo], 583 [cf_cv_chtype_type=scalar], 584 [cf_cv_chtype_type=struct])]) 585 if test $cf_cv_chtype_type = scalar ; then 586 AC_DEFINE(TYPE_CHTYPE_IS_SCALAR,1,[Define to 1 if chtype is a scaler/integer]) 587 fi 588fi 589])dnl 590dnl --------------------------------------------------------------------------- 591dnl CF_CURSES_CONFIG version: 2 updated: 2006/10/29 11:06:27 592dnl ---------------- 593dnl Tie together the configure-script macros for curses. It may be ncurses, 594dnl but unless asked, we do not make a special search for ncurses. However, 595dnl still check for the ncurses version number, for use in other macros. 596AC_DEFUN([CF_CURSES_CONFIG], 597[ 598CF_CURSES_CPPFLAGS 599CF_NCURSES_VERSION 600CF_CURSES_LIBS 601])dnl 602dnl --------------------------------------------------------------------------- 603dnl CF_CURSES_CPPFLAGS version: 12 updated: 2015/04/15 19:08:48 604dnl ------------------ 605dnl Look for the curses headers. 606AC_DEFUN([CF_CURSES_CPPFLAGS],[ 607 608AC_CACHE_CHECK(for extra include directories,cf_cv_curses_incdir,[ 609cf_cv_curses_incdir=no 610case $host_os in 611(hpux10.*) 612 if test "x$cf_cv_screen" = "xcurses_colr" 613 then 614 test -d /usr/include/curses_colr && \ 615 cf_cv_curses_incdir="-I/usr/include/curses_colr" 616 fi 617 ;; 618(sunos3*|sunos4*) 619 if test "x$cf_cv_screen" = "xcurses_5lib" 620 then 621 test -d /usr/5lib && \ 622 test -d /usr/5include && \ 623 cf_cv_curses_incdir="-I/usr/5include" 624 fi 625 ;; 626esac 627]) 628test "$cf_cv_curses_incdir" != no && CPPFLAGS="$CPPFLAGS $cf_cv_curses_incdir" 629 630CF_CURSES_HEADER 631CF_TERM_HEADER 632])dnl 633dnl --------------------------------------------------------------------------- 634dnl CF_CURSES_FUNCS version: 18 updated: 2014/07/19 18:44:41 635dnl --------------- 636dnl Curses-functions are a little complicated, since a lot of them are macros. 637AC_DEFUN([CF_CURSES_FUNCS], 638[ 639AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl 640AC_REQUIRE([CF_XOPEN_CURSES]) 641AC_REQUIRE([CF_CURSES_TERM_H]) 642AC_REQUIRE([CF_CURSES_UNCTRL_H]) 643for cf_func in $1 644do 645 CF_UPPER(cf_tr_func,$cf_func) 646 AC_MSG_CHECKING(for ${cf_func}) 647 CF_MSG_LOG(${cf_func}) 648 AC_CACHE_VAL(cf_cv_func_$cf_func,[ 649 eval cf_result='$ac_cv_func_'$cf_func 650 if test ".$cf_result" != ".no"; then 651 AC_TRY_LINK(CF__CURSES_HEAD, 652 [ 653#ifndef ${cf_func} 654long foo = (long)(&${cf_func}); 655fprintf(stderr, "testing linkage of $cf_func:%p\n", foo); 656if (foo + 1234 > 5678) 657 ${cf_cv_main_return:-return}(foo); 658#endif 659 ], 660 [cf_result=yes], 661 [cf_result=no]) 662 fi 663 eval 'cf_cv_func_'$cf_func'=$cf_result' 664 ]) 665 # use the computed/retrieved cache-value: 666 eval 'cf_result=$cf_cv_func_'$cf_func 667 AC_MSG_RESULT($cf_result) 668 if test $cf_result != no; then 669 AC_DEFINE_UNQUOTED(HAVE_${cf_tr_func}) 670 fi 671done 672])dnl 673dnl --------------------------------------------------------------------------- 674dnl CF_CURSES_HEADER version: 5 updated: 2015/04/23 20:35:30 675dnl ---------------- 676dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common 677dnl variations of ncurses' installs. 678dnl 679dnl $1 = ncurses when looking for ncurses, or is empty 680AC_DEFUN([CF_CURSES_HEADER],[ 681AC_CACHE_CHECK(if we have identified curses headers,cf_cv_ncurses_header,[ 682cf_cv_ncurses_header=none 683for cf_header in \ 684 ncurses.h ifelse($1,,,[$1/ncurses.h]) \ 685 curses.h ifelse($1,,,[$1/curses.h]) ifelse($1,,[ncurses/ncurses.h ncurses/curses.h]) 686do 687AC_TRY_COMPILE([#include <${cf_header}>], 688 [initscr(); tgoto("?", 0,0)], 689 [cf_cv_ncurses_header=$cf_header; break],[]) 690done 691]) 692 693if test "$cf_cv_ncurses_header" = none ; then 694 AC_MSG_ERROR(No curses header-files found) 695fi 696 697# cheat, to get the right #define's for HAVE_NCURSES_H, etc. 698AC_CHECK_HEADERS($cf_cv_ncurses_header) 699])dnl 700dnl --------------------------------------------------------------------------- 701dnl CF_CURSES_LIBS version: 39 updated: 2015/05/10 19:52:14 702dnl -------------- 703dnl Look for the curses libraries. Older curses implementations may require 704dnl termcap/termlib to be linked as well. Call CF_CURSES_CPPFLAGS first. 705AC_DEFUN([CF_CURSES_LIBS],[ 706 707AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl 708AC_MSG_CHECKING(if we have identified curses libraries) 709AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], 710 [initscr(); tgoto("?", 0,0)], 711 cf_result=yes, 712 cf_result=no) 713AC_MSG_RESULT($cf_result) 714 715if test "$cf_result" = no ; then 716case $host_os in 717(freebsd*) 718 AC_CHECK_LIB(mytinfo,tgoto,[CF_ADD_LIBS(-lmytinfo)]) 719 ;; 720(hpux10.*) 721 # Looking at HPUX 10.20, the Hcurses library is the oldest (1997), cur_colr 722 # next (1998), and xcurses "newer" (2000). There is no header file for 723 # Hcurses; the subdirectory curses_colr has the headers (curses.h and 724 # term.h) for cur_colr 725 if test "x$cf_cv_screen" = "xcurses_colr" 726 then 727 AC_CHECK_LIB(cur_colr,initscr,[ 728 CF_ADD_LIBS(-lcur_colr) 729 ac_cv_func_initscr=yes 730 ],[ 731 AC_CHECK_LIB(Hcurses,initscr,[ 732 # HP's header uses __HP_CURSES, but user claims _HP_CURSES. 733 CF_ADD_LIBS(-lHcurses) 734 CPPFLAGS="$CPPFLAGS -D__HP_CURSES -D_HP_CURSES" 735 ac_cv_func_initscr=yes 736 ])]) 737 fi 738 ;; 739(linux*) 740 case `arch 2>/dev/null` in 741 (x86_64) 742 if test -d /lib64 743 then 744 CF_ADD_LIBDIR(/lib64) 745 else 746 CF_ADD_LIBDIR(/lib) 747 fi 748 ;; 749 (*) 750 CF_ADD_LIBDIR(/lib) 751 ;; 752 esac 753 ;; 754(sunos3*|sunos4*) 755 if test "x$cf_cv_screen" = "xcurses_5lib" 756 then 757 if test -d /usr/5lib ; then 758 CF_ADD_LIBDIR(/usr/5lib) 759 CF_ADD_LIBS(-lcurses -ltermcap) 760 fi 761 fi 762 ac_cv_func_initscr=yes 763 ;; 764esac 765 766if test ".$ac_cv_func_initscr" != .yes ; then 767 cf_save_LIBS="$LIBS" 768 769 if test ".${cf_cv_ncurses_version:-no}" != .no 770 then 771 cf_check_list="ncurses curses cursesX" 772 else 773 cf_check_list="cursesX curses ncurses" 774 fi 775 776 # Check for library containing tgoto. Do this before curses library 777 # because it may be needed to link the test-case for initscr. 778 if test "x$cf_term_lib" = x 779 then 780 AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[ 781 for cf_term_lib in $cf_check_list otermcap termcap tinfo termlib unknown 782 do 783 AC_CHECK_LIB($cf_term_lib,tgoto,[break]) 784 done 785 ]) 786 fi 787 788 # Check for library containing initscr 789 test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS" 790 if test "x$cf_curs_lib" = x 791 then 792 for cf_curs_lib in $cf_check_list xcurses jcurses pdcurses unknown 793 do 794 AC_CHECK_LIB($cf_curs_lib,initscr,[break]) 795 done 796 fi 797 test $cf_curs_lib = unknown && AC_MSG_ERROR(no curses library found) 798 799 LIBS="-l$cf_curs_lib $cf_save_LIBS" 800 if test "$cf_term_lib" = unknown ; then 801 AC_MSG_CHECKING(if we can link with $cf_curs_lib library) 802 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], 803 [initscr()], 804 [cf_result=yes], 805 [cf_result=no]) 806 AC_MSG_RESULT($cf_result) 807 test $cf_result = no && AC_MSG_ERROR(Cannot link curses library) 808 elif test "$cf_curs_lib" = "$cf_term_lib" ; then 809 : 810 elif test "$cf_term_lib" != predefined ; then 811 AC_MSG_CHECKING(if we need both $cf_curs_lib and $cf_term_lib libraries) 812 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], 813 [initscr(); tgoto((char *)0, 0, 0);], 814 [cf_result=no], 815 [ 816 LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS" 817 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], 818 [initscr()], 819 [cf_result=yes], 820 [cf_result=error]) 821 ]) 822 AC_MSG_RESULT($cf_result) 823 fi 824fi 825fi 826 827])dnl 828dnl --------------------------------------------------------------------------- 829dnl CF_CURSES_SETBEGYX version: 3 updated: 2013/06/15 11:12:27 830dnl ------------------ 831dnl See if we can define a function to set a window's beginning y/x coordinates. 832AC_DEFUN([CF_CURSES_SETBEGYX],[ 833AC_MSG_CHECKING(how to define setbegyx) 834cf_result=ERR 835for cf_check in \ 836 '((win)->_begy = (y), (win)->_begx = (x), OK)' 837do 838 AC_TRY_COMPILE([ 839#include <${cf_cv_ncurses_header:-curses.h}> 840],[ 841WINDOW *win = 0; 842#define setbegyx(win,y,x) $cf_check 843setbegyx(win, 2, 3); 844],[cf_result=$cf_check; break]) 845done 846AC_MSG_RESULT("$cf_result") 847AC_DEFINE_UNQUOTED(setbegyx(win,y,x),$cf_result,[Define to function for setting window's y/x coordinates]) 848])dnl 849dnl --------------------------------------------------------------------------- 850dnl CF_CURSES_TERM_H version: 11 updated: 2015/04/15 19:08:48 851dnl ---------------- 852dnl SVr4 curses should have term.h as well (where it puts the definitions of 853dnl the low-level interface). This may not be true in old/broken implementations, 854dnl as well as in misconfigured systems (e.g., gcc configured for Solaris 2.4 855dnl running with Solaris 2.5.1). 856AC_DEFUN([CF_CURSES_TERM_H], 857[ 858AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl 859 860AC_CACHE_CHECK(for term.h, cf_cv_term_header,[ 861 862# If we found <ncurses/curses.h>, look for <ncurses/term.h>, but always look 863# for <term.h> if we do not find the variant. 864 865cf_header_list="term.h ncurses/term.h ncursesw/term.h" 866 867case ${cf_cv_ncurses_header:-curses.h} in 868(*/*) 869 cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`term.h 870 cf_header_list="$cf_header_item $cf_header_list" 871 ;; 872esac 873 874for cf_header in $cf_header_list 875do 876 AC_TRY_COMPILE([ 877#include <${cf_cv_ncurses_header:-curses.h}> 878#include <${cf_header}>], 879 [WINDOW *x], 880 [cf_cv_term_header=$cf_header 881 break], 882 [cf_cv_term_header=no]) 883done 884 885case $cf_cv_term_header in 886(no) 887 # If curses is ncurses, some packagers still mess it up by trying to make 888 # us use GNU termcap. This handles the most common case. 889 for cf_header in ncurses/term.h ncursesw/term.h 890 do 891 AC_TRY_COMPILE([ 892#include <${cf_cv_ncurses_header:-curses.h}> 893#ifdef NCURSES_VERSION 894#include <${cf_header}> 895#else 896make an error 897#endif], 898 [WINDOW *x], 899 [cf_cv_term_header=$cf_header 900 break], 901 [cf_cv_term_header=no]) 902 done 903 ;; 904esac 905]) 906 907case $cf_cv_term_header in 908(term.h) 909 AC_DEFINE(HAVE_TERM_H,1,[Define to 1 if we have term.h]) 910 ;; 911(ncurses/term.h) 912 AC_DEFINE(HAVE_NCURSES_TERM_H,1,[Define to 1 if we have ncurses/term.h]) 913 ;; 914(ncursesw/term.h) 915 AC_DEFINE(HAVE_NCURSESW_TERM_H,1,[Define to 1 if we have ncursesw/term.h]) 916 ;; 917esac 918])dnl 919dnl --------------------------------------------------------------------------- 920dnl CF_CURSES_UNCTRL_H version: 4 updated: 2015/04/15 19:08:48 921dnl ------------------ 922dnl Any X/Open curses implementation must have unctrl.h, but ncurses packages 923dnl may put it in a subdirectory (along with ncurses' other headers, of 924dnl course). Packages which put the headers in inconsistent locations are 925dnl broken). 926AC_DEFUN([CF_CURSES_UNCTRL_H], 927[ 928AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl 929 930AC_CACHE_CHECK(for unctrl.h, cf_cv_unctrl_header,[ 931 932# If we found <ncurses/curses.h>, look for <ncurses/unctrl.h>, but always look 933# for <unctrl.h> if we do not find the variant. 934 935cf_header_list="unctrl.h ncurses/unctrl.h ncursesw/unctrl.h" 936 937case ${cf_cv_ncurses_header:-curses.h} in 938(*/*) 939 cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`unctrl.h 940 cf_header_list="$cf_header_item $cf_header_list" 941 ;; 942esac 943 944for cf_header in $cf_header_list 945do 946 AC_TRY_COMPILE([ 947#include <${cf_cv_ncurses_header:-curses.h}> 948#include <${cf_header}>], 949 [WINDOW *x], 950 [cf_cv_unctrl_header=$cf_header 951 break], 952 [cf_cv_unctrl_header=no]) 953done 954]) 955 956case $cf_cv_unctrl_header in 957(no) 958 AC_MSG_WARN(unctrl.h header not found) 959 ;; 960esac 961 962case $cf_cv_unctrl_header in 963(unctrl.h) 964 AC_DEFINE(HAVE_UNCTRL_H,1,[Define to 1 if we have unctrl.h]) 965 ;; 966(ncurses/unctrl.h) 967 AC_DEFINE(HAVE_NCURSES_UNCTRL_H,1,[Define to 1 if we have ncurses/unctrl.h]) 968 ;; 969(ncursesw/unctrl.h) 970 AC_DEFINE(HAVE_NCURSESW_UNCTRL_H,1,[Define to 1 if we have ncursesw/unctrl.h]) 971 ;; 972esac 973])dnl 974dnl --------------------------------------------------------------------------- 975dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52 976dnl ---------- 977dnl "dirname" is not portable, so we fake it with a shell script. 978AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl 979dnl --------------------------------------------------------------------------- 980dnl CF_DISABLE_ECHO version: 13 updated: 2015/04/18 08:56:57 981dnl --------------- 982dnl You can always use "make -n" to see the actual options, but it's hard to 983dnl pick out/analyze warning messages when the compile-line is long. 984dnl 985dnl Sets: 986dnl ECHO_LT - symbol to control if libtool is verbose 987dnl ECHO_LD - symbol to prefix "cc -o" lines 988dnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o) 989dnl SHOW_CC - symbol to put before explicit "cc -c" lines 990dnl ECHO_CC - symbol to put before any "cc" line 991dnl 992AC_DEFUN([CF_DISABLE_ECHO],[ 993AC_MSG_CHECKING(if you want to see long compiling messages) 994CF_ARG_DISABLE(echo, 995 [ --disable-echo do not display "compiling" commands], 996 [ 997 ECHO_LT='--silent' 998 ECHO_LD='@echo linking [$]@;' 999 RULE_CC='@echo compiling [$]<' 1000 SHOW_CC='@echo compiling [$]@' 1001 ECHO_CC='@' 1002],[ 1003 ECHO_LT='' 1004 ECHO_LD='' 1005 RULE_CC='' 1006 SHOW_CC='' 1007 ECHO_CC='' 1008]) 1009AC_MSG_RESULT($enableval) 1010AC_SUBST(ECHO_LT) 1011AC_SUBST(ECHO_LD) 1012AC_SUBST(RULE_CC) 1013AC_SUBST(SHOW_CC) 1014AC_SUBST(ECHO_CC) 1015])dnl 1016dnl --------------------------------------------------------------------------- 1017dnl CF_DISABLE_LEAKS version: 7 updated: 2012/10/02 20:55:03 1018dnl ---------------- 1019dnl Combine no-leak checks with the libraries or tools that are used for the 1020dnl checks. 1021AC_DEFUN([CF_DISABLE_LEAKS],[ 1022 1023AC_REQUIRE([CF_WITH_DMALLOC]) 1024AC_REQUIRE([CF_WITH_DBMALLOC]) 1025AC_REQUIRE([CF_WITH_VALGRIND]) 1026 1027AC_MSG_CHECKING(if you want to perform memory-leak testing) 1028AC_ARG_ENABLE(leaks, 1029 [ --disable-leaks test: free permanent memory, analyze leaks], 1030 [if test "x$enableval" = xno; then with_no_leaks=yes; else with_no_leaks=no; fi], 1031 : ${with_no_leaks:=no}) 1032AC_MSG_RESULT($with_no_leaks) 1033 1034if test "$with_no_leaks" = yes ; then 1035 AC_DEFINE(NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.]) 1036 AC_DEFINE(YY_NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.]) 1037fi 1038])dnl 1039dnl --------------------------------------------------------------------------- 1040dnl CF_DISABLE_LIBTOOL_VERSION version: 3 updated: 2015/04/17 21:13:04 1041dnl -------------------------- 1042dnl Check if we should use the libtool 1.5 feature "-version-number" instead of 1043dnl the older "-version-info" feature. The newer feature allows us to use 1044dnl version numbering on shared libraries which make them compatible with 1045dnl various systems. 1046AC_DEFUN([CF_DISABLE_LIBTOOL_VERSION], 1047[ 1048AC_MSG_CHECKING(if libtool -version-number should be used) 1049CF_ARG_DISABLE(libtool-version, 1050 [ --disable-libtool-version enable to use libtool's incompatible naming scheme], 1051 [cf_libtool_version=no], 1052 [cf_libtool_version=yes]) 1053AC_MSG_RESULT($cf_libtool_version) 1054 1055if test "$cf_libtool_version" = yes ; then 1056 LIBTOOL_VERSION="-version-number" 1057else 1058 LIBTOOL_VERSION="-version-info" 1059 case "x$VERSION" in 1060 (x) 1061 AC_MSG_WARN(VERSION was not set) 1062 ;; 1063 (x*.*.*) 1064 ABI_VERSION="$VERSION" 1065 CF_VERBOSE(ABI_VERSION: $ABI_VERSION) 1066 ;; 1067 (x*:*:*) 1068 ABI_VERSION=`echo "$VERSION" | sed -e 's/:/./g'` 1069 CF_VERBOSE(ABI_VERSION: $ABI_VERSION) 1070 ;; 1071 (*) 1072 AC_MSG_WARN(unexpected VERSION value: $VERSION) 1073 ;; 1074 esac 1075fi 1076 1077AC_SUBST(ABI_VERSION) 1078AC_SUBST(LIBTOOL_VERSION) 1079])dnl 1080dnl --------------------------------------------------------------------------- 1081dnl CF_DISABLE_RPATH_HACK version: 2 updated: 2011/02/13 13:31:33 1082dnl --------------------- 1083dnl The rpath-hack makes it simpler to build programs, particularly with the 1084dnl *BSD ports which may have essential libraries in unusual places. But it 1085dnl can interfere with building an executable for the base system. Use this 1086dnl option in that case. 1087AC_DEFUN([CF_DISABLE_RPATH_HACK], 1088[ 1089AC_MSG_CHECKING(if rpath-hack should be disabled) 1090CF_ARG_DISABLE(rpath-hack, 1091 [ --disable-rpath-hack don't add rpath options for additional libraries], 1092 [cf_disable_rpath_hack=yes], 1093 [cf_disable_rpath_hack=no]) 1094AC_MSG_RESULT($cf_disable_rpath_hack) 1095if test "$cf_disable_rpath_hack" = no ; then 1096 CF_RPATH_HACK 1097fi 1098]) 1099dnl --------------------------------------------------------------------------- 1100dnl CF_ENABLE_RPATH version: 2 updated: 2010/03/27 18:39:42 1101dnl --------------- 1102dnl Check if the rpath option should be used, setting cache variable 1103dnl cf_cv_enable_rpath if so. 1104AC_DEFUN([CF_ENABLE_RPATH], 1105[ 1106AC_MSG_CHECKING(if rpath option should be used) 1107AC_ARG_ENABLE(rpath, 1108[ --enable-rpath use rpath option when generating shared libraries], 1109[cf_cv_enable_rpath=$enableval], 1110[cf_cv_enable_rpath=no]) 1111AC_MSG_RESULT($cf_cv_enable_rpath) 1112])dnl 1113dnl --------------------------------------------------------------------------- 1114dnl CF_FIND_LIBRARY version: 9 updated: 2008/03/23 14:48:54 1115dnl --------------- 1116dnl Look for a non-standard library, given parameters for AC_TRY_LINK. We 1117dnl prefer a standard location, and use -L options only if we do not find the 1118dnl library in the standard library location(s). 1119dnl $1 = library name 1120dnl $2 = library class, usually the same as library name 1121dnl $3 = includes 1122dnl $4 = code fragment to compile/link 1123dnl $5 = corresponding function-name 1124dnl $6 = flag, nonnull if failure should not cause an error-exit 1125dnl 1126dnl Sets the variable "$cf_libdir" as a side-effect, so we can see if we had 1127dnl to use a -L option. 1128AC_DEFUN([CF_FIND_LIBRARY], 1129[ 1130 eval 'cf_cv_have_lib_'$1'=no' 1131 cf_libdir="" 1132 AC_CHECK_FUNC($5, 1133 eval 'cf_cv_have_lib_'$1'=yes',[ 1134 cf_save_LIBS="$LIBS" 1135 AC_MSG_CHECKING(for $5 in -l$1) 1136 LIBS="-l$1 $LIBS" 1137 AC_TRY_LINK([$3],[$4], 1138 [AC_MSG_RESULT(yes) 1139 eval 'cf_cv_have_lib_'$1'=yes' 1140 ], 1141 [AC_MSG_RESULT(no) 1142 CF_LIBRARY_PATH(cf_search,$2) 1143 for cf_libdir in $cf_search 1144 do 1145 AC_MSG_CHECKING(for -l$1 in $cf_libdir) 1146 LIBS="-L$cf_libdir -l$1 $cf_save_LIBS" 1147 AC_TRY_LINK([$3],[$4], 1148 [AC_MSG_RESULT(yes) 1149 eval 'cf_cv_have_lib_'$1'=yes' 1150 break], 1151 [AC_MSG_RESULT(no) 1152 LIBS="$cf_save_LIBS"]) 1153 done 1154 ]) 1155 ]) 1156eval 'cf_found_library=[$]cf_cv_have_lib_'$1 1157ifelse($6,,[ 1158if test $cf_found_library = no ; then 1159 AC_MSG_ERROR(Cannot link $1 library) 1160fi 1161]) 1162])dnl 1163dnl --------------------------------------------------------------------------- 1164dnl CF_FIND_LINKAGE version: 20 updated: 2015/04/18 08:56:57 1165dnl --------------- 1166dnl Find a library (specifically the linkage used in the code fragment), 1167dnl searching for it if it is not already in the library path. 1168dnl See also CF_ADD_SEARCHPATH. 1169dnl 1170dnl Parameters (4-on are optional): 1171dnl $1 = headers for library entrypoint 1172dnl $2 = code fragment for library entrypoint 1173dnl $3 = the library name without the "-l" option or ".so" suffix. 1174dnl $4 = action to perform if successful (default: update CPPFLAGS, etc) 1175dnl $5 = action to perform if not successful 1176dnl $6 = module name, if not the same as the library name 1177dnl $7 = extra libraries 1178dnl 1179dnl Sets these variables: 1180dnl $cf_cv_find_linkage_$3 - yes/no according to whether linkage is found 1181dnl $cf_cv_header_path_$3 - include-directory if needed 1182dnl $cf_cv_library_path_$3 - library-directory if needed 1183dnl $cf_cv_library_file_$3 - library-file if needed, e.g., -l$3 1184AC_DEFUN([CF_FIND_LINKAGE],[ 1185 1186# If the linkage is not already in the $CPPFLAGS/$LDFLAGS configuration, these 1187# will be set on completion of the AC_TRY_LINK below. 1188cf_cv_header_path_$3= 1189cf_cv_library_path_$3= 1190 1191CF_MSG_LOG([Starting [FIND_LINKAGE]($3,$6)]) 1192 1193cf_save_LIBS="$LIBS" 1194 1195AC_TRY_LINK([$1],[$2],[ 1196 cf_cv_find_linkage_$3=yes 1197 cf_cv_header_path_$3=/usr/include 1198 cf_cv_library_path_$3=/usr/lib 1199],[ 1200 1201LIBS="-l$3 $7 $cf_save_LIBS" 1202 1203AC_TRY_LINK([$1],[$2],[ 1204 cf_cv_find_linkage_$3=yes 1205 cf_cv_header_path_$3=/usr/include 1206 cf_cv_library_path_$3=/usr/lib 1207 cf_cv_library_file_$3="-l$3" 1208],[ 1209 cf_cv_find_linkage_$3=no 1210 LIBS="$cf_save_LIBS" 1211 1212 CF_VERBOSE(find linkage for $3 library) 1213 CF_MSG_LOG([Searching for headers in [FIND_LINKAGE]($3,$6)]) 1214 1215 cf_save_CPPFLAGS="$CPPFLAGS" 1216 cf_test_CPPFLAGS="$CPPFLAGS" 1217 1218 CF_HEADER_PATH(cf_search,ifelse([$6],,[$3],[$6])) 1219 for cf_cv_header_path_$3 in $cf_search 1220 do 1221 if test -d $cf_cv_header_path_$3 ; then 1222 CF_VERBOSE(... testing $cf_cv_header_path_$3) 1223 CPPFLAGS="$cf_save_CPPFLAGS -I$cf_cv_header_path_$3" 1224 AC_TRY_COMPILE([$1],[$2],[ 1225 CF_VERBOSE(... found $3 headers in $cf_cv_header_path_$3) 1226 cf_cv_find_linkage_$3=maybe 1227 cf_test_CPPFLAGS="$CPPFLAGS" 1228 break],[ 1229 CPPFLAGS="$cf_save_CPPFLAGS" 1230 ]) 1231 fi 1232 done 1233 1234 if test "$cf_cv_find_linkage_$3" = maybe ; then 1235 1236 CF_MSG_LOG([Searching for $3 library in [FIND_LINKAGE]($3,$6)]) 1237 1238 cf_save_LIBS="$LIBS" 1239 cf_save_LDFLAGS="$LDFLAGS" 1240 1241 ifelse([$6],,,[ 1242 CPPFLAGS="$cf_test_CPPFLAGS" 1243 LIBS="-l$3 $7 $cf_save_LIBS" 1244 AC_TRY_LINK([$1],[$2],[ 1245 CF_VERBOSE(... found $3 library in system) 1246 cf_cv_find_linkage_$3=yes]) 1247 CPPFLAGS="$cf_save_CPPFLAGS" 1248 LIBS="$cf_save_LIBS" 1249 ]) 1250 1251 if test "$cf_cv_find_linkage_$3" != yes ; then 1252 CF_LIBRARY_PATH(cf_search,$3) 1253 for cf_cv_library_path_$3 in $cf_search 1254 do 1255 if test -d $cf_cv_library_path_$3 ; then 1256 CF_VERBOSE(... testing $cf_cv_library_path_$3) 1257 CPPFLAGS="$cf_test_CPPFLAGS" 1258 LIBS="-l$3 $7 $cf_save_LIBS" 1259 LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_$3" 1260 AC_TRY_LINK([$1],[$2],[ 1261 CF_VERBOSE(... found $3 library in $cf_cv_library_path_$3) 1262 cf_cv_find_linkage_$3=yes 1263 cf_cv_library_file_$3="-l$3" 1264 break],[ 1265 CPPFLAGS="$cf_save_CPPFLAGS" 1266 LIBS="$cf_save_LIBS" 1267 LDFLAGS="$cf_save_LDFLAGS" 1268 ]) 1269 fi 1270 done 1271 CPPFLAGS="$cf_save_CPPFLAGS" 1272 LDFLAGS="$cf_save_LDFLAGS" 1273 fi 1274 1275 else 1276 cf_cv_find_linkage_$3=no 1277 fi 1278 ],$7) 1279]) 1280 1281LIBS="$cf_save_LIBS" 1282 1283if test "$cf_cv_find_linkage_$3" = yes ; then 1284ifelse([$4],,[ 1285 CF_ADD_INCDIR($cf_cv_header_path_$3) 1286 CF_ADD_LIBDIR($cf_cv_library_path_$3) 1287 CF_ADD_LIB($3) 1288],[$4]) 1289else 1290ifelse([$5],,AC_MSG_WARN(Cannot find $3 library),[$5]) 1291fi 1292])dnl 1293dnl --------------------------------------------------------------------------- 1294dnl CF_FORGET_TOOL version: 1 updated: 2013/04/06 18:03:09 1295dnl -------------- 1296dnl Forget that we saw the given tool. 1297AC_DEFUN([CF_FORGET_TOOL],[ 1298unset ac_cv_prog_ac_ct_$1 1299unset ac_ct_$1 1300unset $1 1301])dnl 1302dnl --------------------------------------------------------------------------- 1303dnl CF_FUNC_LSTAT version: 3 updated: 2012/11/08 20:57:52 1304dnl ------------- 1305dnl A conventional existence-check for 'lstat' won't work with the Linux 1306dnl version of gcc 2.7.0, since the symbol is defined only within <sys/stat.h> 1307dnl as an inline function. 1308dnl 1309dnl So much for portability. 1310AC_DEFUN([CF_FUNC_LSTAT], 1311[ 1312AC_MSG_CHECKING(for lstat) 1313AC_CACHE_VAL(ac_cv_func_lstat,[ 1314AC_TRY_LINK([ 1315#include <sys/types.h> 1316#include <sys/stat.h>], 1317 [lstat(".", (struct stat *)0)], 1318 [ac_cv_func_lstat=yes], 1319 [ac_cv_func_lstat=no]) 1320 ]) 1321AC_MSG_RESULT($ac_cv_func_lstat ) 1322if test $ac_cv_func_lstat = yes; then 1323 AC_DEFINE(HAVE_LSTAT,1,[Define to 1 if we have lstat]) 1324fi 1325])dnl 1326dnl --------------------------------------------------------------------------- 1327dnl CF_GCC_ATTRIBUTES version: 17 updated: 2015/04/12 15:39:00 1328dnl ----------------- 1329dnl Test for availability of useful gcc __attribute__ directives to quiet 1330dnl compiler warnings. Though useful, not all are supported -- and contrary 1331dnl to documentation, unrecognized directives cause older compilers to barf. 1332AC_DEFUN([CF_GCC_ATTRIBUTES], 1333[ 1334if test "$GCC" = yes 1335then 1336cat > conftest.i <<EOF 1337#ifndef GCC_PRINTF 1338#define GCC_PRINTF 0 1339#endif 1340#ifndef GCC_SCANF 1341#define GCC_SCANF 0 1342#endif 1343#ifndef GCC_NORETURN 1344#define GCC_NORETURN /* nothing */ 1345#endif 1346#ifndef GCC_UNUSED 1347#define GCC_UNUSED /* nothing */ 1348#endif 1349EOF 1350if test "$GCC" = yes 1351then 1352 AC_CHECKING([for $CC __attribute__ directives]) 1353cat > conftest.$ac_ext <<EOF 1354#line __oline__ "${as_me:-configure}" 1355#include "confdefs.h" 1356#include "conftest.h" 1357#include "conftest.i" 1358#if GCC_PRINTF 1359#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) 1360#else 1361#define GCC_PRINTFLIKE(fmt,var) /*nothing*/ 1362#endif 1363#if GCC_SCANF 1364#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) 1365#else 1366#define GCC_SCANFLIKE(fmt,var) /*nothing*/ 1367#endif 1368extern void wow(char *,...) GCC_SCANFLIKE(1,2); 1369extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; 1370extern void foo(void) GCC_NORETURN; 1371int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; } 1372EOF 1373 cf_printf_attribute=no 1374 cf_scanf_attribute=no 1375 for cf_attribute in scanf printf unused noreturn 1376 do 1377 CF_UPPER(cf_ATTRIBUTE,$cf_attribute) 1378 cf_directive="__attribute__(($cf_attribute))" 1379 echo "checking for $CC $cf_directive" 1>&AC_FD_CC 1380 1381 case $cf_attribute in 1382 (printf) 1383 cf_printf_attribute=yes 1384 cat >conftest.h <<EOF 1385#define GCC_$cf_ATTRIBUTE 1 1386EOF 1387 ;; 1388 (scanf) 1389 cf_scanf_attribute=yes 1390 cat >conftest.h <<EOF 1391#define GCC_$cf_ATTRIBUTE 1 1392EOF 1393 ;; 1394 (*) 1395 cat >conftest.h <<EOF 1396#define GCC_$cf_ATTRIBUTE $cf_directive 1397EOF 1398 ;; 1399 esac 1400 1401 if AC_TRY_EVAL(ac_compile); then 1402 test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute) 1403 cat conftest.h >>confdefs.h 1404 case $cf_attribute in 1405 (noreturn) 1406 AC_DEFINE_UNQUOTED(GCC_NORETURN,$cf_directive,[Define to noreturn-attribute for gcc]) 1407 ;; 1408 (printf) 1409 cf_value='/* nothing */' 1410 if test "$cf_printf_attribute" != no ; then 1411 cf_value='__attribute__((format(printf,fmt,var)))' 1412 AC_DEFINE(GCC_PRINTF,1,[Define to 1 if the compiler supports gcc-like printf attribute.]) 1413 fi 1414 AC_DEFINE_UNQUOTED(GCC_PRINTFLIKE(fmt,var),$cf_value,[Define to printf-attribute for gcc]) 1415 ;; 1416 (scanf) 1417 cf_value='/* nothing */' 1418 if test "$cf_scanf_attribute" != no ; then 1419 cf_value='__attribute__((format(scanf,fmt,var)))' 1420 AC_DEFINE(GCC_SCANF,1,[Define to 1 if the compiler supports gcc-like scanf attribute.]) 1421 fi 1422 AC_DEFINE_UNQUOTED(GCC_SCANFLIKE(fmt,var),$cf_value,[Define to sscanf-attribute for gcc]) 1423 ;; 1424 (unused) 1425 AC_DEFINE_UNQUOTED(GCC_UNUSED,$cf_directive,[Define to unused-attribute for gcc]) 1426 ;; 1427 esac 1428 fi 1429 done 1430else 1431 fgrep define conftest.i >>confdefs.h 1432fi 1433rm -rf conftest* 1434fi 1435])dnl 1436dnl --------------------------------------------------------------------------- 1437dnl CF_GCC_VERSION version: 7 updated: 2012/10/18 06:46:33 1438dnl -------------- 1439dnl Find version of gcc 1440AC_DEFUN([CF_GCC_VERSION],[ 1441AC_REQUIRE([AC_PROG_CC]) 1442GCC_VERSION=none 1443if test "$GCC" = yes ; then 1444 AC_MSG_CHECKING(version of $CC) 1445 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.]].*//'`" 1446 test -z "$GCC_VERSION" && GCC_VERSION=unknown 1447 AC_MSG_RESULT($GCC_VERSION) 1448fi 1449])dnl 1450dnl --------------------------------------------------------------------------- 1451dnl CF_GCC_WARNINGS version: 32 updated: 2015/04/12 15:39:00 1452dnl --------------- 1453dnl Check if the compiler supports useful warning options. There's a few that 1454dnl we don't use, simply because they're too noisy: 1455dnl 1456dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x) 1457dnl -Wredundant-decls (system headers make this too noisy) 1458dnl -Wtraditional (combines too many unrelated messages, only a few useful) 1459dnl -Wwrite-strings (too noisy, but should review occasionally). This 1460dnl is enabled for ncurses using "--enable-const". 1461dnl -pedantic 1462dnl 1463dnl Parameter: 1464dnl $1 is an optional list of gcc warning flags that a particular 1465dnl application might want to use, e.g., "no-unused" for 1466dnl -Wno-unused 1467dnl Special: 1468dnl If $with_ext_const is "yes", add a check for -Wwrite-strings 1469dnl 1470AC_DEFUN([CF_GCC_WARNINGS], 1471[ 1472AC_REQUIRE([CF_GCC_VERSION]) 1473CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS) 1474CF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS) 1475 1476cat > conftest.$ac_ext <<EOF 1477#line __oline__ "${as_me:-configure}" 1478int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; } 1479EOF 1480 1481if test "$INTEL_COMPILER" = yes 1482then 1483# The "-wdXXX" options suppress warnings: 1484# remark #1419: external declaration in primary source file 1485# remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem) 1486# remark #1684: conversion from pointer to same-sized integral type (potential portability problem) 1487# remark #193: zero used for undefined preprocessing identifier 1488# remark #593: variable "curs_sb_left_arrow" was set but never used 1489# remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits 1490# remark #869: parameter "tw" was never referenced 1491# remark #981: operands are evaluated in unspecified order 1492# warning #279: controlling expression is constant 1493 1494 AC_CHECKING([for $CC warning options]) 1495 cf_save_CFLAGS="$CFLAGS" 1496 EXTRA_CFLAGS="-Wall" 1497 for cf_opt in \ 1498 wd1419 \ 1499 wd1683 \ 1500 wd1684 \ 1501 wd193 \ 1502 wd593 \ 1503 wd279 \ 1504 wd810 \ 1505 wd869 \ 1506 wd981 1507 do 1508 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" 1509 if AC_TRY_EVAL(ac_compile); then 1510 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt) 1511 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" 1512 fi 1513 done 1514 CFLAGS="$cf_save_CFLAGS" 1515 1516elif test "$GCC" = yes 1517then 1518 AC_CHECKING([for $CC warning options]) 1519 cf_save_CFLAGS="$CFLAGS" 1520 EXTRA_CFLAGS= 1521 cf_warn_CONST="" 1522 test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings" 1523 cf_gcc_warnings="Wignored-qualifiers Wlogical-op Wvarargs" 1524 test "x$CLANG_COMPILER" = xyes && cf_gcc_warnings= 1525 for cf_opt in W Wall \ 1526 Wbad-function-cast \ 1527 Wcast-align \ 1528 Wcast-qual \ 1529 Wdeclaration-after-statement \ 1530 Wextra \ 1531 Winline \ 1532 Wmissing-declarations \ 1533 Wmissing-prototypes \ 1534 Wnested-externs \ 1535 Wpointer-arith \ 1536 Wshadow \ 1537 Wstrict-prototypes \ 1538 Wundef $cf_gcc_warnings $cf_warn_CONST $1 1539 do 1540 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" 1541 if AC_TRY_EVAL(ac_compile); then 1542 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt) 1543 case $cf_opt in 1544 (Wcast-qual) 1545 CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES" 1546 ;; 1547 (Winline) 1548 case $GCC_VERSION in 1549 ([[34]].*) 1550 CF_VERBOSE(feature is broken in gcc $GCC_VERSION) 1551 continue;; 1552 esac 1553 ;; 1554 (Wpointer-arith) 1555 case $GCC_VERSION in 1556 ([[12]].*) 1557 CF_VERBOSE(feature is broken in gcc $GCC_VERSION) 1558 continue;; 1559 esac 1560 ;; 1561 esac 1562 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" 1563 fi 1564 done 1565 CFLAGS="$cf_save_CFLAGS" 1566fi 1567rm -rf conftest* 1568 1569AC_SUBST(EXTRA_CFLAGS) 1570])dnl 1571dnl --------------------------------------------------------------------------- 1572dnl CF_GETOPT_HEADER version: 6 updated: 2014/07/22 14:45:54 1573dnl ---------------- 1574dnl Check for getopt's variables which are commonly defined in stdlib.h, 1575dnl unistd.h or (nonstandard) in getopt.h 1576AC_DEFUN([CF_GETOPT_HEADER], 1577[ 1578AC_HAVE_HEADERS(unistd.h getopt.h) 1579AC_CACHE_CHECK(for header declaring getopt variables,cf_cv_getopt_header,[ 1580cf_cv_getopt_header=none 1581for cf_header in stdio.h stdlib.h unistd.h getopt.h 1582do 1583AC_TRY_COMPILE([ 1584#include <$cf_header>], 1585[int x = optind; char *y = optarg], 1586[cf_cv_getopt_header=$cf_header 1587 break]) 1588done 1589]) 1590if test $cf_cv_getopt_header != none ; then 1591 AC_DEFINE(HAVE_GETOPT_HEADER,1,[Define to 1 if getopt variables are declared in header]) 1592fi 1593if test $cf_cv_getopt_header = getopt.h ; then 1594 AC_DEFINE(NEED_GETOPT_H,1,[Define to 1 if we must include getopt.h]) 1595fi 1596])dnl 1597dnl --------------------------------------------------------------------------- 1598dnl CF_GNU_SOURCE version: 7 updated: 2016/08/05 05:15:37 1599dnl ------------- 1600dnl Check if we must define _GNU_SOURCE to get a reasonable value for 1601dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect 1602dnl (or misfeature) of glibc2, which breaks portability of many applications, 1603dnl since it is interwoven with GNU extensions. 1604dnl 1605dnl Well, yes we could work around it... 1606AC_DEFUN([CF_GNU_SOURCE], 1607[ 1608AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[ 1609AC_TRY_COMPILE([#include <sys/types.h>],[ 1610#ifndef _XOPEN_SOURCE 1611make an error 1612#endif], 1613 [cf_cv_gnu_source=no], 1614 [cf_save="$CPPFLAGS" 1615 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" 1616 AC_TRY_COMPILE([#include <sys/types.h>],[ 1617#ifdef _XOPEN_SOURCE 1618make an error 1619#endif], 1620 [cf_cv_gnu_source=no], 1621 [cf_cv_gnu_source=yes]) 1622 CPPFLAGS="$cf_save" 1623 ]) 1624]) 1625 1626if test "$cf_cv_gnu_source" = yes 1627then 1628AC_CACHE_CHECK(if we should also define _DEFAULT_SOURCE,cf_cv_default_source,[ 1629CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" 1630 AC_TRY_COMPILE([#include <sys/types.h>],[ 1631#ifdef _DEFAULT_SOURCE 1632make an error 1633#endif], 1634 [cf_cv_default_source=no], 1635 [cf_cv_default_source=yes]) 1636 ]) 1637test "$cf_cv_default_source" = yes && CPPFLAGS="$CPPFLAGS -D_DEFAULT_SOURCE" 1638fi 1639])dnl 1640dnl --------------------------------------------------------------------------- 1641dnl CF_HEADER_PATH version: 13 updated: 2015/04/15 19:08:48 1642dnl -------------- 1643dnl Construct a search-list of directories for a nonstandard header-file 1644dnl 1645dnl Parameters 1646dnl $1 = the variable to return as result 1647dnl $2 = the package name 1648AC_DEFUN([CF_HEADER_PATH], 1649[ 1650$1= 1651 1652# collect the current set of include-directories from compiler flags 1653cf_header_path_list="" 1654if test -n "${CFLAGS}${CPPFLAGS}" ; then 1655 for cf_header_path in $CPPFLAGS $CFLAGS 1656 do 1657 case $cf_header_path in 1658 (-I*) 1659 cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'` 1660 CF_ADD_SUBDIR_PATH($1,$2,include,$cf_header_path,NONE) 1661 cf_header_path_list="$cf_header_path_list [$]$1" 1662 ;; 1663 esac 1664 done 1665fi 1666 1667# add the variations for the package we are looking for 1668CF_SUBDIR_PATH($1,$2,include) 1669 1670test "$includedir" != NONE && \ 1671test "$includedir" != "/usr/include" && \ 1672test -d "$includedir" && { 1673 test -d $includedir && $1="[$]$1 $includedir" 1674 test -d $includedir/$2 && $1="[$]$1 $includedir/$2" 1675} 1676 1677test "$oldincludedir" != NONE && \ 1678test "$oldincludedir" != "/usr/include" && \ 1679test -d "$oldincludedir" && { 1680 test -d $oldincludedir && $1="[$]$1 $oldincludedir" 1681 test -d $oldincludedir/$2 && $1="[$]$1 $oldincludedir/$2" 1682} 1683 1684$1="[$]$1 $cf_header_path_list" 1685])dnl 1686dnl --------------------------------------------------------------------------- 1687dnl CF_INTEL_COMPILER version: 7 updated: 2015/04/12 15:39:00 1688dnl ----------------- 1689dnl Check if the given compiler is really the Intel compiler for Linux. It 1690dnl tries to imitate gcc, but does not return an error when it finds a mismatch 1691dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK. 1692dnl 1693dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to 1694dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from 1695dnl the wrappers for gcc and g++ warnings. 1696dnl 1697dnl $1 = GCC (default) or GXX 1698dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS 1699dnl $3 = CFLAGS (default) or CXXFLAGS 1700AC_DEFUN([CF_INTEL_COMPILER],[ 1701AC_REQUIRE([AC_CANONICAL_HOST]) 1702ifelse([$2],,INTEL_COMPILER,[$2])=no 1703 1704if test "$ifelse([$1],,[$1],GCC)" = yes ; then 1705 case $host_os in 1706 (linux*|gnu*) 1707 AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler) 1708 cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" 1709 ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc" 1710 AC_TRY_COMPILE([],[ 1711#ifdef __INTEL_COMPILER 1712#else 1713make an error 1714#endif 1715],[ifelse([$2],,INTEL_COMPILER,[$2])=yes 1716cf_save_CFLAGS="$cf_save_CFLAGS -we147" 1717],[]) 1718 ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" 1719 AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2])) 1720 ;; 1721 esac 1722fi 1723])dnl 1724dnl --------------------------------------------------------------------------- 1725dnl CF_LD_RPATH_OPT version: 7 updated: 2016/02/20 18:01:19 1726dnl --------------- 1727dnl For the given system and compiler, find the compiler flags to pass to the 1728dnl loader to use the "rpath" feature. 1729AC_DEFUN([CF_LD_RPATH_OPT], 1730[ 1731AC_REQUIRE([CF_CHECK_CACHE]) 1732 1733LD_RPATH_OPT= 1734AC_MSG_CHECKING(for an rpath option) 1735case $cf_cv_system_name in 1736(irix*) 1737 if test "$GCC" = yes; then 1738 LD_RPATH_OPT="-Wl,-rpath," 1739 else 1740 LD_RPATH_OPT="-rpath " 1741 fi 1742 ;; 1743(linux*|gnu*|k*bsd*-gnu|freebsd*) 1744 LD_RPATH_OPT="-Wl,-rpath," 1745 ;; 1746(openbsd[[2-9]].*|mirbsd*) 1747 LD_RPATH_OPT="-Wl,-rpath," 1748 ;; 1749(dragonfly*) 1750 LD_RPATH_OPT="-rpath " 1751 ;; 1752(netbsd*) 1753 LD_RPATH_OPT="-Wl,-rpath," 1754 ;; 1755(osf*|mls+*) 1756 LD_RPATH_OPT="-rpath " 1757 ;; 1758(solaris2*) 1759 LD_RPATH_OPT="-R" 1760 ;; 1761(*) 1762 ;; 1763esac 1764AC_MSG_RESULT($LD_RPATH_OPT) 1765 1766case "x$LD_RPATH_OPT" in 1767(x-R*) 1768 AC_MSG_CHECKING(if we need a space after rpath option) 1769 cf_save_LIBS="$LIBS" 1770 CF_ADD_LIBS(${LD_RPATH_OPT}$libdir) 1771 AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes) 1772 LIBS="$cf_save_LIBS" 1773 AC_MSG_RESULT($cf_rpath_space) 1774 test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT " 1775 ;; 1776esac 1777])dnl 1778dnl --------------------------------------------------------------------------- 1779dnl CF_LIBRARY_PATH version: 10 updated: 2015/04/15 19:08:48 1780dnl --------------- 1781dnl Construct a search-list of directories for a nonstandard library-file 1782dnl 1783dnl Parameters 1784dnl $1 = the variable to return as result 1785dnl $2 = the package name 1786AC_DEFUN([CF_LIBRARY_PATH], 1787[ 1788$1= 1789cf_library_path_list="" 1790if test -n "${LDFLAGS}${LIBS}" ; then 1791 for cf_library_path in $LDFLAGS $LIBS 1792 do 1793 case $cf_library_path in 1794 (-L*) 1795 cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'` 1796 CF_ADD_SUBDIR_PATH($1,$2,lib,$cf_library_path,NONE) 1797 cf_library_path_list="$cf_library_path_list [$]$1" 1798 ;; 1799 esac 1800 done 1801fi 1802 1803CF_SUBDIR_PATH($1,$2,lib) 1804 1805$1="$cf_library_path_list [$]$1" 1806])dnl 1807dnl --------------------------------------------------------------------------- 1808dnl CF_LIBTOOL_VERSION version: 1 updated: 2013/04/06 18:03:09 1809dnl ------------------ 1810AC_DEFUN([CF_LIBTOOL_VERSION],[ 1811if test -n "$LIBTOOL" && test "$LIBTOOL" != none 1812then 1813 cf_cv_libtool_version=`$LIBTOOL --version 2>&1 | sed -e '/^$/d' |sed -e '2,$d' -e 's/([[^)]]*)//g' -e 's/^[[^1-9]]*//' -e 's/[[^0-9.]].*//'` 1814else 1815 cf_cv_libtool_version= 1816fi 1817test -z "$cf_cv_libtool_version" && unset cf_cv_libtool_version 1818])dnl 1819dnl --------------------------------------------------------------------------- 1820dnl CF_LIB_PREFIX version: 12 updated: 2015/10/17 19:03:33 1821dnl ------------- 1822dnl Compute the library-prefix for the given host system 1823dnl $1 = variable to set 1824define([CF_LIB_PREFIX], 1825[ 1826 case $cf_cv_system_name in 1827 (OS/2*|os2*) 1828 if test "$DFT_LWR_MODEL" = libtool; then 1829 LIB_PREFIX='lib' 1830 else 1831 LIB_PREFIX='' 1832 fi 1833 ;; 1834 (*) LIB_PREFIX='lib' 1835 ;; 1836 esac 1837ifelse($1,,,[$1=$LIB_PREFIX]) 1838 AC_SUBST(LIB_PREFIX) 1839])dnl 1840dnl --------------------------------------------------------------------------- 1841dnl CF_LIB_SUFFIX version: 25 updated: 2015/04/17 21:13:04 1842dnl ------------- 1843dnl Compute the library file-suffix from the given model name 1844dnl $1 = model name 1845dnl $2 = variable to set (the nominal library suffix) 1846dnl $3 = dependency variable to set (actual filename) 1847dnl The variable $LIB_SUFFIX, if set, prepends the variable to set. 1848AC_DEFUN([CF_LIB_SUFFIX], 1849[ 1850 case X$1 in 1851 (Xlibtool) 1852 $2='.la' 1853 $3=[$]$2 1854 ;; 1855 (Xdebug) 1856 $2='_g.a' 1857 $3=[$]$2 1858 ;; 1859 (Xprofile) 1860 $2='_p.a' 1861 $3=[$]$2 1862 ;; 1863 (Xshared) 1864 case $cf_cv_system_name in 1865 (aix[[5-7]]*) 1866 $2='.so' 1867 $3=[$]$2 1868 ;; 1869 (cygwin*|msys*|mingw*) 1870 $2='.dll' 1871 $3='.dll.a' 1872 ;; 1873 (darwin*) 1874 $2='.dylib' 1875 $3=[$]$2 1876 ;; 1877 (hpux*) 1878 case $target in 1879 (ia64*) 1880 $2='.so' 1881 $3=[$]$2 1882 ;; 1883 (*) 1884 $2='.sl' 1885 $3=[$]$2 1886 ;; 1887 esac 1888 ;; 1889 (*) 1890 $2='.so' 1891 $3=[$]$2 1892 ;; 1893 esac 1894 ;; 1895 (*) 1896 $2='.a' 1897 $3=[$]$2 1898 ;; 1899 esac 1900 if test -n "${LIB_SUFFIX}${EXTRA_SUFFIX}" 1901 then 1902 $2="${LIB_SUFFIX}${EXTRA_SUFFIX}[$]{$2}" 1903 $3="${LIB_SUFFIX}${EXTRA_SUFFIX}[$]{$3}" 1904 fi 1905])dnl 1906dnl --------------------------------------------------------------------------- 1907dnl CF_LOCALE version: 5 updated: 2012/10/06 11:17:15 1908dnl --------- 1909dnl Check if we have setlocale() and its header, <locale.h> 1910dnl The optional parameter $1 tells what to do if we do have locale support. 1911AC_DEFUN([CF_LOCALE], 1912[ 1913AC_MSG_CHECKING(for setlocale()) 1914AC_CACHE_VAL(cf_cv_locale,[ 1915AC_TRY_LINK([#include <locale.h>], 1916 [setlocale(LC_ALL, "")], 1917 [cf_cv_locale=yes], 1918 [cf_cv_locale=no]) 1919 ]) 1920AC_MSG_RESULT($cf_cv_locale) 1921test $cf_cv_locale = yes && { ifelse($1,,AC_DEFINE(LOCALE,1,[Define to 1 if we have locale support]),[$1]) } 1922])dnl 1923dnl --------------------------------------------------------------------------- 1924dnl CF_MAKEFLAGS version: 17 updated: 2015/08/05 20:44:28 1925dnl ------------ 1926dnl Some 'make' programs support ${MAKEFLAGS}, some ${MFLAGS}, to pass 'make' 1927dnl options to lower-levels. It's very useful for "make -n" -- if we have it. 1928dnl (GNU 'make' does both, something POSIX 'make', which happens to make the 1929dnl ${MAKEFLAGS} variable incompatible because it adds the assignments :-) 1930AC_DEFUN([CF_MAKEFLAGS], 1931[ 1932AC_CACHE_CHECK(for makeflags variable, cf_cv_makeflags,[ 1933 cf_cv_makeflags='' 1934 for cf_option in '-${MAKEFLAGS}' '${MFLAGS}' 1935 do 1936 cat >cf_makeflags.tmp <<CF_EOF 1937SHELL = $SHELL 1938all : 1939 @ echo '.$cf_option' 1940CF_EOF 1941 cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp 2>/dev/null | fgrep -v "ing directory" | sed -e 's,[[ ]]*$,,'` 1942 case "$cf_result" in 1943 (.*k|.*kw) 1944 cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp CC=cc 2>/dev/null` 1945 case "$cf_result" in 1946 (.*CC=*) cf_cv_makeflags= 1947 ;; 1948 (*) cf_cv_makeflags=$cf_option 1949 ;; 1950 esac 1951 break 1952 ;; 1953 (.-) ;; 1954 (*) echo "given option \"$cf_option\", no match \"$cf_result\"" 1955 ;; 1956 esac 1957 done 1958 rm -f cf_makeflags.tmp 1959]) 1960 1961AC_SUBST(cf_cv_makeflags) 1962])dnl 1963dnl --------------------------------------------------------------------------- 1964dnl CF_MAKE_TAGS version: 6 updated: 2010/10/23 15:52:32 1965dnl ------------ 1966dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have 1967dnl a monocase filesystem. 1968AC_DEFUN([CF_MAKE_TAGS],[ 1969AC_REQUIRE([CF_MIXEDCASE_FILENAMES]) 1970 1971AC_CHECK_PROGS(CTAGS, exctags ctags) 1972AC_CHECK_PROGS(ETAGS, exetags etags) 1973 1974AC_CHECK_PROG(MAKE_LOWER_TAGS, ${CTAGS:-ctags}, yes, no) 1975 1976if test "$cf_cv_mixedcase" = yes ; then 1977 AC_CHECK_PROG(MAKE_UPPER_TAGS, ${ETAGS:-etags}, yes, no) 1978else 1979 MAKE_UPPER_TAGS=no 1980fi 1981 1982if test "$MAKE_UPPER_TAGS" = yes ; then 1983 MAKE_UPPER_TAGS= 1984else 1985 MAKE_UPPER_TAGS="#" 1986fi 1987 1988if test "$MAKE_LOWER_TAGS" = yes ; then 1989 MAKE_LOWER_TAGS= 1990else 1991 MAKE_LOWER_TAGS="#" 1992fi 1993 1994AC_SUBST(CTAGS) 1995AC_SUBST(ETAGS) 1996 1997AC_SUBST(MAKE_UPPER_TAGS) 1998AC_SUBST(MAKE_LOWER_TAGS) 1999])dnl 2000dnl --------------------------------------------------------------------------- 2001dnl CF_MIXEDCASE_FILENAMES version: 7 updated: 2015/04/12 15:39:00 2002dnl ---------------------- 2003dnl Check if the file-system supports mixed-case filenames. If we're able to 2004dnl create a lowercase name and see it as uppercase, it doesn't support that. 2005AC_DEFUN([CF_MIXEDCASE_FILENAMES], 2006[ 2007AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[ 2008if test "$cross_compiling" = yes ; then 2009 case $target_alias in 2010 (*-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw*|*-uwin*) 2011 cf_cv_mixedcase=no 2012 ;; 2013 (*) 2014 cf_cv_mixedcase=yes 2015 ;; 2016 esac 2017else 2018 rm -f conftest CONFTEST 2019 echo test >conftest 2020 if test -f CONFTEST ; then 2021 cf_cv_mixedcase=no 2022 else 2023 cf_cv_mixedcase=yes 2024 fi 2025 rm -f conftest CONFTEST 2026fi 2027]) 2028test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if filesystem supports mixed-case filenames.]) 2029])dnl 2030dnl --------------------------------------------------------------------------- 2031dnl CF_MSG_LOG version: 5 updated: 2010/10/23 15:52:32 2032dnl ---------- 2033dnl Write a debug message to config.log, along with the line number in the 2034dnl configure script. 2035AC_DEFUN([CF_MSG_LOG],[ 2036echo "${as_me:-configure}:__oline__: testing $* ..." 1>&AC_FD_CC 2037])dnl 2038dnl --------------------------------------------------------------------------- 2039dnl CF_NCURSES_CC_CHECK version: 4 updated: 2007/07/29 10:39:05 2040dnl ------------------- 2041dnl Check if we can compile with ncurses' header file 2042dnl $1 is the cache variable to set 2043dnl $2 is the header-file to include 2044dnl $3 is the root name (ncurses or ncursesw) 2045AC_DEFUN([CF_NCURSES_CC_CHECK],[ 2046 AC_TRY_COMPILE([ 2047]ifelse($3,ncursesw,[ 2048#define _XOPEN_SOURCE_EXTENDED 2049#undef HAVE_LIBUTF8_H /* in case we used CF_UTF8_LIB */ 2050#define HAVE_LIBUTF8_H /* to force ncurses' header file to use cchar_t */ 2051])[ 2052#include <$2>],[ 2053#ifdef NCURSES_VERSION 2054]ifelse($3,ncursesw,[ 2055#ifndef WACS_BSSB 2056 make an error 2057#endif 2058])[ 2059printf("%s\n", NCURSES_VERSION); 2060#else 2061#ifdef __NCURSES_H 2062printf("old\n"); 2063#else 2064 make an error 2065#endif 2066#endif 2067 ] 2068 ,[$1=$2] 2069 ,[$1=no]) 2070])dnl 2071dnl --------------------------------------------------------------------------- 2072dnl CF_NCURSES_CONFIG version: 17 updated: 2015/07/07 04:22:07 2073dnl ----------------- 2074dnl Tie together the configure-script macros for ncurses, preferring these in 2075dnl order: 2076dnl a) ".pc" files for pkg-config, using $NCURSES_CONFIG_PKG 2077dnl b) the "-config" script from ncurses, using $NCURSES_CONFIG 2078dnl c) just plain libraries 2079dnl 2080dnl $1 is the root library name (default: "ncurses") 2081AC_DEFUN([CF_NCURSES_CONFIG],[ 2082AC_REQUIRE([CF_PKG_CONFIG]) 2083cf_ncuconfig_root=ifelse($1,,ncurses,$1) 2084cf_have_ncuconfig=no 2085 2086if test "x${PKG_CONFIG:=none}" != xnone; then 2087 AC_MSG_CHECKING(pkg-config for $cf_ncuconfig_root) 2088 if "$PKG_CONFIG" --exists $cf_ncuconfig_root ; then 2089 AC_MSG_RESULT(yes) 2090 2091 AC_MSG_CHECKING(if the $cf_ncuconfig_root package files work) 2092 cf_have_ncuconfig=unknown 2093 2094 cf_save_CPPFLAGS="$CPPFLAGS" 2095 cf_save_LIBS="$LIBS" 2096 2097 CPPFLAGS="$CPPFLAGS `$PKG_CONFIG --cflags $cf_ncuconfig_root`" 2098 CF_ADD_LIBS(`$PKG_CONFIG --libs $cf_ncuconfig_root`) 2099 2100 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], 2101 [initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);], 2102 [AC_TRY_RUN([#include <${cf_cv_ncurses_header:-curses.h}> 2103 int main(void) 2104 { char *xx = curses_version(); return (xx == 0); }], 2105 [cf_have_ncuconfig=yes], 2106 [cf_have_ncuconfig=no], 2107 [cf_have_ncuconfig=maybe])], 2108 [cf_have_ncuconfig=no]) 2109 AC_MSG_RESULT($cf_have_ncuconfig) 2110 test "$cf_have_ncuconfig" = maybe && cf_have_ncuconfig=yes 2111 if test "$cf_have_ncuconfig" != "yes" 2112 then 2113 CPPFLAGS="$cf_save_CPPFLAGS" 2114 LIBS="$cf_save_LIBS" 2115 NCURSES_CONFIG_PKG=none 2116 else 2117 AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries]) 2118 NCURSES_CONFIG_PKG=$cf_ncuconfig_root 2119 fi 2120 2121 else 2122 AC_MSG_RESULT(no) 2123 NCURSES_CONFIG_PKG=none 2124 fi 2125else 2126 NCURSES_CONFIG_PKG=none 2127fi 2128 2129if test "x$cf_have_ncuconfig" = "xno"; then 2130 echo "Looking for ${cf_ncuconfig_root}-config" 2131 2132 CF_ACVERSION_CHECK(2.52, 2133 [AC_CHECK_TOOLS(NCURSES_CONFIG, ${cf_ncuconfig_root}-config ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)], 2134 [AC_PATH_PROGS(NCURSES_CONFIG, ${cf_ncuconfig_root}-config ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)]) 2135 2136 if test "$NCURSES_CONFIG" != none ; then 2137 2138 CPPFLAGS="$CPPFLAGS `$NCURSES_CONFIG --cflags`" 2139 CF_ADD_LIBS(`$NCURSES_CONFIG --libs`) 2140 2141 # even with config script, some packages use no-override for curses.h 2142 CF_CURSES_HEADER(ifelse($1,,ncurses,$1)) 2143 2144 dnl like CF_NCURSES_CPPFLAGS 2145 AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries]) 2146 2147 dnl like CF_NCURSES_LIBS 2148 CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_ncuconfig_root) 2149 AC_DEFINE_UNQUOTED($cf_nculib_ROOT) 2150 2151 dnl like CF_NCURSES_VERSION 2152 cf_cv_ncurses_version=`$NCURSES_CONFIG --version` 2153 2154 else 2155 2156 CF_NCURSES_CPPFLAGS(ifelse($1,,ncurses,$1)) 2157 CF_NCURSES_LIBS(ifelse($1,,ncurses,$1)) 2158 2159 fi 2160else 2161 NCURSES_CONFIG=none 2162fi 2163])dnl 2164dnl --------------------------------------------------------------------------- 2165dnl CF_NCURSES_CPPFLAGS version: 21 updated: 2012/10/06 08:57:51 2166dnl ------------------- 2167dnl Look for the SVr4 curses clone 'ncurses' in the standard places, adjusting 2168dnl the CPPFLAGS variable so we can include its header. 2169dnl 2170dnl The header files may be installed as either curses.h, or ncurses.h (would 2171dnl be obsolete, except that some packagers prefer this name to distinguish it 2172dnl from a "native" curses implementation). If not installed for overwrite, 2173dnl the curses.h file would be in an ncurses subdirectory (e.g., 2174dnl /usr/include/ncurses), but someone may have installed overwriting the 2175dnl vendor's curses. Only very old versions (pre-1.9.2d, the first autoconf'd 2176dnl version) of ncurses don't define either __NCURSES_H or NCURSES_VERSION in 2177dnl the header. 2178dnl 2179dnl If the installer has set $CFLAGS or $CPPFLAGS so that the ncurses header 2180dnl is already in the include-path, don't even bother with this, since we cannot 2181dnl easily determine which file it is. In this case, it has to be <curses.h>. 2182dnl 2183dnl The optional parameter gives the root name of the library, in case it is 2184dnl not installed as the default curses library. That is how the 2185dnl wide-character version of ncurses is installed. 2186AC_DEFUN([CF_NCURSES_CPPFLAGS], 2187[AC_REQUIRE([CF_WITH_CURSES_DIR]) 2188 2189AC_PROVIDE([CF_CURSES_CPPFLAGS])dnl 2190cf_ncuhdr_root=ifelse($1,,ncurses,$1) 2191 2192test -n "$cf_cv_curses_dir" && \ 2193test "$cf_cv_curses_dir" != "no" && { \ 2194 CF_ADD_INCDIR($cf_cv_curses_dir/include/$cf_ncuhdr_root) 2195} 2196 2197AC_CACHE_CHECK(for $cf_ncuhdr_root header in include-path, cf_cv_ncurses_h,[ 2198 cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h" 2199 ( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h" 2200 for cf_header in $cf_header_list 2201 do 2202 CF_NCURSES_CC_CHECK(cf_cv_ncurses_h,$cf_header,$1) 2203 test "$cf_cv_ncurses_h" != no && break 2204 done 2205]) 2206 2207CF_NCURSES_HEADER 2208CF_TERM_HEADER 2209 2210# some applications need this, but should check for NCURSES_VERSION 2211AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries]) 2212 2213CF_NCURSES_VERSION 2214])dnl 2215dnl --------------------------------------------------------------------------- 2216dnl CF_NCURSES_HEADER version: 4 updated: 2015/04/15 19:08:48 2217dnl ----------------- 2218dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common 2219dnl variations of ncurses' installs. 2220dnl 2221dnl See also CF_CURSES_HEADER, which sets the same cache variable. 2222AC_DEFUN([CF_NCURSES_HEADER],[ 2223 2224if test "$cf_cv_ncurses_h" != no ; then 2225 cf_cv_ncurses_header=$cf_cv_ncurses_h 2226else 2227 2228AC_CACHE_CHECK(for $cf_ncuhdr_root include-path, cf_cv_ncurses_h2,[ 2229 test -n "$verbose" && echo 2230 CF_HEADER_PATH(cf_search,$cf_ncuhdr_root) 2231 test -n "$verbose" && echo search path $cf_search 2232 cf_save2_CPPFLAGS="$CPPFLAGS" 2233 for cf_incdir in $cf_search 2234 do 2235 CF_ADD_INCDIR($cf_incdir) 2236 for cf_header in \ 2237 ncurses.h \ 2238 curses.h 2239 do 2240 CF_NCURSES_CC_CHECK(cf_cv_ncurses_h2,$cf_header,$1) 2241 if test "$cf_cv_ncurses_h2" != no ; then 2242 cf_cv_ncurses_h2=$cf_incdir/$cf_header 2243 test -n "$verbose" && echo $ac_n " ... found $ac_c" 1>&AC_FD_MSG 2244 break 2245 fi 2246 test -n "$verbose" && echo " ... tested $cf_incdir/$cf_header" 1>&AC_FD_MSG 2247 done 2248 CPPFLAGS="$cf_save2_CPPFLAGS" 2249 test "$cf_cv_ncurses_h2" != no && break 2250 done 2251 test "$cf_cv_ncurses_h2" = no && AC_MSG_ERROR(not found) 2252 ]) 2253 2254 CF_DIRNAME(cf_1st_incdir,$cf_cv_ncurses_h2) 2255 cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2` 2256 if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then 2257 cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header 2258 fi 2259 CF_ADD_INCDIR($cf_1st_incdir) 2260 2261fi 2262 2263# Set definitions to allow ifdef'ing for ncurses.h 2264 2265case $cf_cv_ncurses_header in 2266(*ncurses.h) 2267 AC_DEFINE(HAVE_NCURSES_H,1,[Define to 1 if we have ncurses.h]) 2268 ;; 2269esac 2270 2271case $cf_cv_ncurses_header in 2272(ncurses/curses.h|ncurses/ncurses.h) 2273 AC_DEFINE(HAVE_NCURSES_NCURSES_H,1,[Define to 1 if we have ncurses/ncurses.h]) 2274 ;; 2275(ncursesw/curses.h|ncursesw/ncurses.h) 2276 AC_DEFINE(HAVE_NCURSESW_NCURSES_H,1,[Define to 1 if we have ncursesw/ncurses.h]) 2277 ;; 2278esac 2279 2280])dnl 2281dnl --------------------------------------------------------------------------- 2282dnl CF_NCURSES_LIBS version: 17 updated: 2015/04/15 19:08:48 2283dnl --------------- 2284dnl Look for the ncurses library. This is a little complicated on Linux, 2285dnl because it may be linked with the gpm (general purpose mouse) library. 2286dnl Some distributions have gpm linked with (bsd) curses, which makes it 2287dnl unusable with ncurses. However, we don't want to link with gpm unless 2288dnl ncurses has a dependency, since gpm is normally set up as a shared library, 2289dnl and the linker will record a dependency. 2290dnl 2291dnl The optional parameter gives the root name of the library, in case it is 2292dnl not installed as the default curses library. That is how the 2293dnl wide-character version of ncurses is installed. 2294AC_DEFUN([CF_NCURSES_LIBS], 2295[AC_REQUIRE([CF_NCURSES_CPPFLAGS]) 2296 2297cf_nculib_root=ifelse($1,,ncurses,$1) 2298 # This works, except for the special case where we find gpm, but 2299 # ncurses is in a nonstandard location via $LIBS, and we really want 2300 # to link gpm. 2301cf_ncurses_LIBS="" 2302cf_ncurses_SAVE="$LIBS" 2303AC_CHECK_LIB(gpm,Gpm_Open, 2304 [AC_CHECK_LIB(gpm,initscr, 2305 [LIBS="$cf_ncurses_SAVE"], 2306 [cf_ncurses_LIBS="-lgpm"])]) 2307 2308case $host_os in 2309(freebsd*) 2310 # This is only necessary if you are linking against an obsolete 2311 # version of ncurses (but it should do no harm, since it's static). 2312 if test "$cf_nculib_root" = ncurses ; then 2313 AC_CHECK_LIB(mytinfo,tgoto,[cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS"]) 2314 fi 2315 ;; 2316esac 2317 2318CF_ADD_LIBS($cf_ncurses_LIBS) 2319 2320if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" ) 2321then 2322 CF_ADD_LIBS(-l$cf_nculib_root) 2323else 2324 CF_FIND_LIBRARY($cf_nculib_root,$cf_nculib_root, 2325 [#include <${cf_cv_ncurses_header:-curses.h}>], 2326 [initscr()], 2327 initscr) 2328fi 2329 2330if test -n "$cf_ncurses_LIBS" ; then 2331 AC_MSG_CHECKING(if we can link $cf_nculib_root without $cf_ncurses_LIBS) 2332 cf_ncurses_SAVE="$LIBS" 2333 for p in $cf_ncurses_LIBS ; do 2334 q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"` 2335 if test "$q" != "$LIBS" ; then 2336 LIBS="$q" 2337 fi 2338 done 2339 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], 2340 [initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);], 2341 [AC_MSG_RESULT(yes)], 2342 [AC_MSG_RESULT(no) 2343 LIBS="$cf_ncurses_SAVE"]) 2344fi 2345 2346CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_nculib_root) 2347AC_DEFINE_UNQUOTED($cf_nculib_ROOT) 2348])dnl 2349dnl --------------------------------------------------------------------------- 2350dnl CF_NCURSES_PTHREADS version: 2 updated: 2016/04/22 05:07:41 2351dnl ------------------- 2352dnl Use this followup check to ensure that we link with pthreads if ncurses 2353dnl uses it. 2354AC_DEFUN([CF_NCURSES_PTHREADS],[ 2355: ${cf_nculib_root:=ifelse($1,,ncurses,$1)} 2356AC_CHECK_LIB($cf_nculib_root,_nc_init_pthreads, 2357 cf_cv_ncurses_pthreads=yes, 2358 cf_cv_ncurses_pthreads=no) 2359if test "$cf_cv_ncurses_pthreads" = yes 2360then 2361 CF_ADD_LIBS(-lpthread) 2362fi 2363])dnl 2364dnl --------------------------------------------------------------------------- 2365dnl CF_NCURSES_VERSION version: 14 updated: 2012/10/06 08:57:51 2366dnl ------------------ 2367dnl Check for the version of ncurses, to aid in reporting bugs, etc. 2368dnl Call CF_CURSES_CPPFLAGS first, or CF_NCURSES_CPPFLAGS. We don't use 2369dnl AC_REQUIRE since that does not work with the shell's if/then/else/fi. 2370AC_DEFUN([CF_NCURSES_VERSION], 2371[ 2372AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl 2373AC_CACHE_CHECK(for ncurses version, cf_cv_ncurses_version,[ 2374 cf_cv_ncurses_version=no 2375 cf_tempfile=out$$ 2376 rm -f $cf_tempfile 2377 AC_TRY_RUN([ 2378#include <${cf_cv_ncurses_header:-curses.h}> 2379#include <stdio.h> 2380int main() 2381{ 2382 FILE *fp = fopen("$cf_tempfile", "w"); 2383#ifdef NCURSES_VERSION 2384# ifdef NCURSES_VERSION_PATCH 2385 fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH); 2386# else 2387 fprintf(fp, "%s\n", NCURSES_VERSION); 2388# endif 2389#else 2390# ifdef __NCURSES_H 2391 fprintf(fp, "old\n"); 2392# else 2393 make an error 2394# endif 2395#endif 2396 ${cf_cv_main_return:-return}(0); 2397}],[ 2398 cf_cv_ncurses_version=`cat $cf_tempfile`],,[ 2399 2400 # This will not work if the preprocessor splits the line after the 2401 # Autoconf token. The 'unproto' program does that. 2402 cat > conftest.$ac_ext <<EOF 2403#include <${cf_cv_ncurses_header:-curses.h}> 2404#undef Autoconf 2405#ifdef NCURSES_VERSION 2406Autoconf NCURSES_VERSION 2407#else 2408#ifdef __NCURSES_H 2409Autoconf "old" 2410#endif 2411; 2412#endif 2413EOF 2414 cf_try="$ac_cpp conftest.$ac_ext 2>&AC_FD_CC | grep '^Autoconf ' >conftest.out" 2415 AC_TRY_EVAL(cf_try) 2416 if test -f conftest.out ; then 2417 cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[[^"]]*"%%' -e 's%".*%%'` 2418 test -n "$cf_out" && cf_cv_ncurses_version="$cf_out" 2419 rm -f conftest.out 2420 fi 2421]) 2422 rm -f $cf_tempfile 2423]) 2424test "$cf_cv_ncurses_version" = no || AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries]) 2425])dnl 2426dnl --------------------------------------------------------------------------- 2427dnl CF_NO_LEAKS_OPTION version: 6 updated: 2015/04/12 15:39:00 2428dnl ------------------ 2429dnl see CF_WITH_NO_LEAKS 2430AC_DEFUN([CF_NO_LEAKS_OPTION],[ 2431AC_MSG_CHECKING(if you want to use $1 for testing) 2432AC_ARG_WITH($1, 2433 [$2], 2434 [AC_DEFINE_UNQUOTED($3,1,"Define to 1 if you want to use $1 for testing.")ifelse([$4],,[ 2435 $4 2436]) 2437 : ${with_cflags:=-g} 2438 : ${with_no_leaks:=yes} 2439 with_$1=yes], 2440 [with_$1=]) 2441AC_MSG_RESULT(${with_$1:-no}) 2442 2443case .$with_cflags in 2444(.*-g*) 2445 case .$CFLAGS in 2446 (.*-g*) 2447 ;; 2448 (*) 2449 CF_ADD_CFLAGS([-g]) 2450 ;; 2451 esac 2452 ;; 2453esac 2454])dnl 2455dnl --------------------------------------------------------------------------- 2456dnl CF_NUMBER_SYNTAX version: 2 updated: 2015/04/17 21:13:04 2457dnl ---------------- 2458dnl Check if the given variable is a number. If not, report an error. 2459dnl $1 is the variable 2460dnl $2 is the message 2461AC_DEFUN([CF_NUMBER_SYNTAX],[ 2462if test -n "$1" ; then 2463 case $1 in 2464 ([[0-9]]*) 2465 ;; 2466 (*) 2467 AC_MSG_ERROR($2 is not a number: $1) 2468 ;; 2469 esac 2470else 2471 AC_MSG_ERROR($2 value is empty) 2472fi 2473])dnl 2474dnl --------------------------------------------------------------------------- 2475dnl CF_PATH_SYNTAX version: 16 updated: 2015/04/18 08:56:57 2476dnl -------------- 2477dnl Check the argument to see that it looks like a pathname. Rewrite it if it 2478dnl begins with one of the prefix/exec_prefix variables, and then again if the 2479dnl result begins with 'NONE'. This is necessary to work around autoconf's 2480dnl delayed evaluation of those symbols. 2481AC_DEFUN([CF_PATH_SYNTAX],[ 2482if test "x$prefix" != xNONE; then 2483 cf_path_syntax="$prefix" 2484else 2485 cf_path_syntax="$ac_default_prefix" 2486fi 2487 2488case ".[$]$1" in 2489(.\[$]\(*\)*|.\'*\'*) 2490 ;; 2491(..|./*|.\\*) 2492 ;; 2493(.[[a-zA-Z]]:[[\\/]]*) # OS/2 EMX 2494 ;; 2495(.\[$]{*prefix}*|.\[$]{*dir}*) 2496 eval $1="[$]$1" 2497 case ".[$]$1" in 2498 (.NONE/*) 2499 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%` 2500 ;; 2501 esac 2502 ;; 2503(.no|.NONE/*) 2504 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%` 2505 ;; 2506(*) 2507 ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2) 2508 ;; 2509esac 2510])dnl 2511dnl --------------------------------------------------------------------------- 2512dnl CF_PDCURSES_X11 version: 13 updated: 2012/10/06 16:39:58 2513dnl --------------- 2514dnl Configure for PDCurses' X11 library 2515AC_DEFUN([CF_PDCURSES_X11],[ 2516AC_REQUIRE([CF_X_ATHENA]) 2517 2518CF_ACVERSION_CHECK(2.52, 2519 [AC_CHECK_TOOLS(XCURSES_CONFIG, xcurses-config, none)], 2520 [AC_PATH_PROGS(XCURSES_CONFIG, xcurses-config, none)]) 2521 2522if test "$XCURSES_CONFIG" != none ; then 2523 2524CPPFLAGS="$CPPFLAGS `$XCURSES_CONFIG --cflags`" 2525CF_ADD_LIBS(`$XCURSES_CONFIG --libs`) 2526 2527cf_cv_lib_XCurses=yes 2528 2529else 2530 2531LDFLAGS="$LDFLAGS $X_LIBS" 2532CF_CHECK_CFLAGS($X_CFLAGS) 2533AC_CHECK_LIB(X11,XOpenDisplay, 2534 [CF_ADD_LIBS(-lX11)],, 2535 [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS]) 2536AC_CACHE_CHECK(for XCurses library,cf_cv_lib_XCurses,[ 2537CF_ADD_LIBS(-lXCurses) 2538AC_TRY_LINK([ 2539#include <xcurses.h> 2540char *XCursesProgramName = "test"; 2541],[XCursesExit();], 2542[cf_cv_lib_XCurses=yes], 2543[cf_cv_lib_XCurses=no]) 2544]) 2545 2546fi 2547 2548if test $cf_cv_lib_XCurses = yes ; then 2549 AC_DEFINE(UNIX,1,[Define to 1 if using PDCurses on Unix]) 2550 AC_DEFINE(XCURSES,1,[Define to 1 if using PDCurses on Unix]) 2551 AC_CHECK_HEADER(xcurses.h, AC_DEFINE(HAVE_XCURSES,1,[Define to 1 if using PDCurses on Unix])) 2552else 2553 AC_MSG_ERROR(Cannot link with XCurses) 2554fi 2555])dnl 2556dnl --------------------------------------------------------------------------- 2557dnl CF_PKG_CONFIG version: 10 updated: 2015/04/26 18:06:58 2558dnl ------------- 2559dnl Check for the package-config program, unless disabled by command-line. 2560AC_DEFUN([CF_PKG_CONFIG], 2561[ 2562AC_MSG_CHECKING(if you want to use pkg-config) 2563AC_ARG_WITH(pkg-config, 2564 [ --with-pkg-config{=path} enable/disable use of pkg-config], 2565 [cf_pkg_config=$withval], 2566 [cf_pkg_config=yes]) 2567AC_MSG_RESULT($cf_pkg_config) 2568 2569case $cf_pkg_config in 2570(no) 2571 PKG_CONFIG=none 2572 ;; 2573(yes) 2574 CF_ACVERSION_CHECK(2.52, 2575 [AC_PATH_TOOL(PKG_CONFIG, pkg-config, none)], 2576 [AC_PATH_PROG(PKG_CONFIG, pkg-config, none)]) 2577 ;; 2578(*) 2579 PKG_CONFIG=$withval 2580 ;; 2581esac 2582 2583test -z "$PKG_CONFIG" && PKG_CONFIG=none 2584if test "$PKG_CONFIG" != none ; then 2585 CF_PATH_SYNTAX(PKG_CONFIG) 2586elif test "x$cf_pkg_config" != xno ; then 2587 AC_MSG_WARN(pkg-config is not installed) 2588fi 2589 2590AC_SUBST(PKG_CONFIG) 2591])dnl 2592dnl --------------------------------------------------------------------------- 2593dnl CF_POSIX_C_SOURCE version: 9 updated: 2015/04/12 15:39:00 2594dnl ----------------- 2595dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed. 2596dnl 2597dnl POSIX.1-1990 _POSIX_SOURCE 2598dnl POSIX.1-1990 and _POSIX_SOURCE and 2599dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2 2600dnl Bindings Option 2601dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L 2602dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L 2603dnl X/Open 2000 _POSIX_C_SOURCE=200112L 2604dnl 2605dnl Parameters: 2606dnl $1 is the nominal value for _POSIX_C_SOURCE 2607AC_DEFUN([CF_POSIX_C_SOURCE], 2608[ 2609cf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1]) 2610 2611cf_save_CFLAGS="$CFLAGS" 2612cf_save_CPPFLAGS="$CPPFLAGS" 2613 2614CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE) 2615CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE) 2616 2617AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[ 2618 CF_MSG_LOG(if the symbol is already defined go no further) 2619 AC_TRY_COMPILE([#include <sys/types.h>],[ 2620#ifndef _POSIX_C_SOURCE 2621make an error 2622#endif], 2623 [cf_cv_posix_c_source=no], 2624 [cf_want_posix_source=no 2625 case .$cf_POSIX_C_SOURCE in 2626 (.[[12]]??*) 2627 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" 2628 ;; 2629 (.2) 2630 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" 2631 cf_want_posix_source=yes 2632 ;; 2633 (.*) 2634 cf_want_posix_source=yes 2635 ;; 2636 esac 2637 if test "$cf_want_posix_source" = yes ; then 2638 AC_TRY_COMPILE([#include <sys/types.h>],[ 2639#ifdef _POSIX_SOURCE 2640make an error 2641#endif],[], 2642 cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE") 2643 fi 2644 CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE) 2645 CFLAGS="$cf_trim_CFLAGS" 2646 CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source" 2647 CF_MSG_LOG(if the second compile does not leave our definition intact error) 2648 AC_TRY_COMPILE([#include <sys/types.h>],[ 2649#ifndef _POSIX_C_SOURCE 2650make an error 2651#endif],, 2652 [cf_cv_posix_c_source=no]) 2653 CFLAGS="$cf_save_CFLAGS" 2654 CPPFLAGS="$cf_save_CPPFLAGS" 2655 ]) 2656]) 2657 2658if test "$cf_cv_posix_c_source" != no ; then 2659 CFLAGS="$cf_trim_CFLAGS" 2660 CPPFLAGS="$cf_trim_CPPFLAGS" 2661 CF_ADD_CFLAGS($cf_cv_posix_c_source) 2662fi 2663 2664])dnl 2665dnl --------------------------------------------------------------------------- 2666dnl CF_PROG_CC version: 4 updated: 2014/07/12 18:57:58 2667dnl ---------- 2668dnl standard check for CC, plus followup sanity checks 2669dnl $1 = optional parameter to pass to AC_PROG_CC to specify compiler name 2670AC_DEFUN([CF_PROG_CC],[ 2671ifelse($1,,[AC_PROG_CC],[AC_PROG_CC($1)]) 2672CF_GCC_VERSION 2673CF_ACVERSION_CHECK(2.52, 2674 [AC_PROG_CC_STDC], 2675 [CF_ANSI_CC_REQD]) 2676CF_CC_ENV_FLAGS 2677])dnl 2678dnl --------------------------------------------------------------------------- 2679dnl CF_PROG_EXT version: 13 updated: 2015/04/18 09:03:58 2680dnl ----------- 2681dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX. 2682AC_DEFUN([CF_PROG_EXT], 2683[ 2684AC_REQUIRE([CF_CHECK_CACHE]) 2685case $cf_cv_system_name in 2686(os2*) 2687 CFLAGS="$CFLAGS -Zmt" 2688 CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__" 2689 CXXFLAGS="$CXXFLAGS -Zmt" 2690 # autoconf's macro sets -Zexe and suffix both, which conflict:w 2691 LDFLAGS="$LDFLAGS -Zmt -Zcrtdll" 2692 ac_cv_exeext=.exe 2693 ;; 2694esac 2695 2696AC_EXEEXT 2697AC_OBJEXT 2698 2699PROG_EXT="$EXEEXT" 2700AC_SUBST(PROG_EXT) 2701test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT",[Define to the program extension (normally blank)]) 2702])dnl 2703dnl --------------------------------------------------------------------------- 2704dnl CF_PROG_LINT version: 3 updated: 2016/05/22 15:25:54 2705dnl ------------ 2706AC_DEFUN([CF_PROG_LINT], 2707[ 2708AC_CHECK_PROGS(LINT, lint cppcheck splint) 2709AC_SUBST(LINT_OPTS) 2710])dnl 2711dnl --------------------------------------------------------------------------- 2712dnl CF_PROG_LN_S version: 2 updated: 2010/08/14 18:25:37 2713dnl ------------ 2714dnl Combine checks for "ln -s" and "ln -sf", updating $LN_S to include "-f" 2715dnl option if it is supported. 2716AC_DEFUN([CF_PROG_LN_S],[ 2717AC_PROG_LN_S 2718AC_MSG_CHECKING(if $LN_S -f options work) 2719 2720rm -f conf$$.src conf$$dst 2721echo >conf$$.dst 2722echo first >conf$$.src 2723if $LN_S -f conf$$.src conf$$.dst 2>/dev/null; then 2724 cf_prog_ln_sf=yes 2725else 2726 cf_prog_ln_sf=no 2727fi 2728rm -f conf$$.dst conf$$src 2729AC_MSG_RESULT($cf_prog_ln_sf) 2730 2731test "$cf_prog_ln_sf" = yes && LN_S="$LN_S -f" 2732])dnl 2733dnl --------------------------------------------------------------------------- 2734dnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50 2735dnl ---------------- 2736dnl Remove all -U and -D options that refer to the given symbol from a list 2737dnl of C compiler options. This works around the problem that not all 2738dnl compilers process -U and -D options from left-to-right, so a -U option 2739dnl cannot be used to cancel the effect of a preceding -D option. 2740dnl 2741dnl $1 = target (which could be the same as the source variable) 2742dnl $2 = source (including '$') 2743dnl $3 = symbol to remove 2744define([CF_REMOVE_DEFINE], 2745[ 2746$1=`echo "$2" | \ 2747 sed -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[[ ]]/ /g' \ 2748 -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'` 2749])dnl 2750dnl --------------------------------------------------------------------------- 2751dnl CF_RPATH_HACK version: 11 updated: 2013/09/01 13:02:00 2752dnl ------------- 2753AC_DEFUN([CF_RPATH_HACK], 2754[ 2755AC_REQUIRE([CF_LD_RPATH_OPT]) 2756AC_MSG_CHECKING(for updated LDFLAGS) 2757if test -n "$LD_RPATH_OPT" ; then 2758 AC_MSG_RESULT(maybe) 2759 2760 AC_CHECK_PROGS(cf_ldd_prog,ldd,no) 2761 cf_rpath_list="/usr/lib /lib" 2762 if test "$cf_ldd_prog" != no 2763 then 2764 cf_rpath_oops= 2765 2766AC_TRY_LINK([#include <stdio.h>], 2767 [printf("Hello");], 2768 [cf_rpath_oops=`$cf_ldd_prog conftest$ac_exeext | fgrep ' not found' | sed -e 's% =>.*$%%' |sort | uniq` 2769 cf_rpath_list=`$cf_ldd_prog conftest$ac_exeext | fgrep / | sed -e 's%^.*[[ ]]/%/%' -e 's%/[[^/]][[^/]]*$%%' |sort | uniq`]) 2770 2771 # If we passed the link-test, but get a "not found" on a given library, 2772 # this could be due to inept reconfiguration of gcc to make it only 2773 # partly honor /usr/local/lib (or whatever). Sometimes this behavior 2774 # is intentional, e.g., installing gcc in /usr/bin and suppressing the 2775 # /usr/local libraries. 2776 if test -n "$cf_rpath_oops" 2777 then 2778 for cf_rpath_src in $cf_rpath_oops 2779 do 2780 for cf_rpath_dir in \ 2781 /usr/local \ 2782 /usr/pkg \ 2783 /opt/sfw 2784 do 2785 if test -f $cf_rpath_dir/lib/$cf_rpath_src 2786 then 2787 CF_VERBOSE(...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src) 2788 LDFLAGS="$LDFLAGS -L$cf_rpath_dir/lib" 2789 break 2790 fi 2791 done 2792 done 2793 fi 2794 fi 2795 2796 CF_VERBOSE(...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS) 2797 2798 CF_RPATH_HACK_2(LDFLAGS) 2799 CF_RPATH_HACK_2(LIBS) 2800 2801 CF_VERBOSE(...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS) 2802else 2803 AC_MSG_RESULT(no) 2804fi 2805AC_SUBST(EXTRA_LDFLAGS) 2806])dnl 2807dnl --------------------------------------------------------------------------- 2808dnl CF_RPATH_HACK_2 version: 7 updated: 2015/04/12 15:39:00 2809dnl --------------- 2810dnl Do one set of substitutions for CF_RPATH_HACK, adding an rpath option to 2811dnl EXTRA_LDFLAGS for each -L option found. 2812dnl 2813dnl $cf_rpath_list contains a list of directories to ignore. 2814dnl 2815dnl $1 = variable name to update. The LDFLAGS variable should be the only one, 2816dnl but LIBS often has misplaced -L options. 2817AC_DEFUN([CF_RPATH_HACK_2], 2818[ 2819CF_VERBOSE(...checking $1 [$]$1) 2820 2821cf_rpath_dst= 2822for cf_rpath_src in [$]$1 2823do 2824 case $cf_rpath_src in 2825 (-L*) 2826 2827 # check if this refers to a directory which we will ignore 2828 cf_rpath_skip=no 2829 if test -n "$cf_rpath_list" 2830 then 2831 for cf_rpath_item in $cf_rpath_list 2832 do 2833 if test "x$cf_rpath_src" = "x-L$cf_rpath_item" 2834 then 2835 cf_rpath_skip=yes 2836 break 2837 fi 2838 done 2839 fi 2840 2841 if test "$cf_rpath_skip" = no 2842 then 2843 # transform the option 2844 if test "$LD_RPATH_OPT" = "-R " ; then 2845 cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%-R %"` 2846 else 2847 cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%$LD_RPATH_OPT%"` 2848 fi 2849 2850 # if we have not already added this, add it now 2851 cf_rpath_tst=`echo "$EXTRA_LDFLAGS" | sed -e "s%$cf_rpath_tmp %%"` 2852 if test "x$cf_rpath_tst" = "x$EXTRA_LDFLAGS" 2853 then 2854 CF_VERBOSE(...Filter $cf_rpath_src ->$cf_rpath_tmp) 2855 EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS" 2856 fi 2857 fi 2858 ;; 2859 esac 2860 cf_rpath_dst="$cf_rpath_dst $cf_rpath_src" 2861done 2862$1=$cf_rpath_dst 2863 2864CF_VERBOSE(...checked $1 [$]$1) 2865AC_SUBST(EXTRA_LDFLAGS) 2866])dnl 2867dnl --------------------------------------------------------------------------- 2868dnl CF_SHARED_OPTS version: 89 updated: 2015/08/15 18:38:59 2869dnl -------------- 2870dnl -------------- 2871dnl Attempt to determine the appropriate CC/LD options for creating a shared 2872dnl library. 2873dnl 2874dnl Notes: 2875dnl a) ${LOCAL_LDFLAGS} is used to link executables that will run within 2876dnl the build-tree, i.e., by making use of the libraries that are compiled in 2877dnl $rel_builddir/lib We avoid compiling-in a $rel_builddir/lib path for the 2878dnl shared library since that can lead to unexpected results at runtime. 2879dnl b) ${LOCAL_LDFLAGS2} has the same intention but assumes that the shared 2880dnl libraries are compiled in ../../lib 2881dnl 2882dnl The variable 'cf_cv_do_symlinks' is used to control whether we configure 2883dnl to install symbolic links to the rel/abi versions of shared libraries. 2884dnl 2885dnl The variable 'cf_cv_shlib_version' controls whether we use the rel or abi 2886dnl version when making symbolic links. 2887dnl 2888dnl The variable 'cf_cv_shlib_version_infix' controls whether shared library 2889dnl version numbers are infix (ex: libncurses.<ver>.dylib) or postfix 2890dnl (ex: libncurses.so.<ver>). 2891dnl 2892dnl Some loaders leave 'so_locations' lying around. It's nice to clean up. 2893AC_DEFUN([CF_SHARED_OPTS], 2894[ 2895 AC_REQUIRE([CF_LD_RPATH_OPT]) 2896 RM_SHARED_OPTS= 2897 LOCAL_LDFLAGS= 2898 LOCAL_LDFLAGS2= 2899 LD_SHARED_OPTS= 2900 INSTALL_LIB="-m 644" 2901 : ${rel_builddir:=.} 2902 2903 shlibdir=$libdir 2904 AC_SUBST(shlibdir) 2905 2906 MAKE_DLLS="#" 2907 AC_SUBST(MAKE_DLLS) 2908 2909 cf_cv_do_symlinks=no 2910 cf_ld_rpath_opt= 2911 test "$cf_cv_enable_rpath" = yes && cf_ld_rpath_opt="$LD_RPATH_OPT" 2912 2913 AC_MSG_CHECKING(if release/abi version should be used for shared libs) 2914 AC_ARG_WITH(shlib-version, 2915 [ --with-shlib-version=X Specify rel or abi version for shared libs], 2916 [test -z "$withval" && withval=auto 2917 case $withval in 2918 (yes) 2919 cf_cv_shlib_version=auto 2920 ;; 2921 (rel|abi|auto) 2922 cf_cv_shlib_version=$withval 2923 ;; 2924 (*) 2925 AC_MSG_RESULT($withval) 2926 AC_MSG_ERROR([option value must be one of: rel, abi, or auto]) 2927 ;; 2928 esac 2929 ],[cf_cv_shlib_version=auto]) 2930 AC_MSG_RESULT($cf_cv_shlib_version) 2931 2932 cf_cv_rm_so_locs=no 2933 cf_try_cflags= 2934 2935 # Some less-capable ports of gcc support only -fpic 2936 CC_SHARED_OPTS= 2937 if test "$GCC" = yes 2938 then 2939 AC_MSG_CHECKING(which $CC option to use) 2940 cf_save_CFLAGS="$CFLAGS" 2941 for CC_SHARED_OPTS in -fPIC -fpic '' 2942 do 2943 CFLAGS="$cf_save_CFLAGS $CC_SHARED_OPTS" 2944 AC_TRY_COMPILE([#include <stdio.h>],[int x = 1],[break],[]) 2945 done 2946 AC_MSG_RESULT($CC_SHARED_OPTS) 2947 CFLAGS="$cf_save_CFLAGS" 2948 fi 2949 2950 cf_cv_shlib_version_infix=no 2951 2952 case $cf_cv_system_name in 2953 (aix4.[3-9]*|aix[[5-7]]*) 2954 if test "$GCC" = yes; then 2955 CC_SHARED_OPTS='-Wl,-brtl' 2956 MK_SHARED_LIB='${CC} -shared -Wl,-brtl -Wl,-blibpath:${RPATH_LIST}:/usr/lib -o [$]@' 2957 else 2958 CC_SHARED_OPTS='-brtl' 2959 # as well as '-qpic=large -G' or perhaps "-bM:SRE -bnoentry -bexpall" 2960 MK_SHARED_LIB='${CC} -G -Wl,-brtl -Wl,-blibpath:${RPATH_LIST}:/usr/lib -o [$]@' 2961 fi 2962 ;; 2963 (beos*) 2964 MK_SHARED_LIB='${CC} ${CFLAGS} -o $[@] -Xlinker -soname=`basename $[@]` -nostart -e 0' 2965 ;; 2966 (cygwin*) 2967 CC_SHARED_OPTS= 2968 MK_SHARED_LIB=$SHELL' '$rel_builddir'/mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}' 2969 RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a" 2970 cf_cv_shlib_version=cygdll 2971 cf_cv_shlib_version_infix=cygdll 2972 shlibdir=$bindir 2973 MAKE_DLLS= 2974 cat >mk_shared_lib.sh <<-CF_EOF 2975 #!$SHELL 2976 SHARED_LIB=\[$]1 2977 IMPORT_LIB=\`echo "\[$]1" | sed -e 's/cyg/lib/' -e 's/[[0-9]]*\.dll[$]/.dll.a/'\` 2978 shift 2979 cat <<-EOF 2980 Linking shared library 2981 ** SHARED_LIB \[$]SHARED_LIB 2982 ** IMPORT_LIB \[$]IMPORT_LIB 2983EOF 2984 exec \[$]* -shared -Wl,--out-implib=\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o \[$]{SHARED_LIB} 2985CF_EOF 2986 chmod +x mk_shared_lib.sh 2987 ;; 2988 (msys*) 2989 CC_SHARED_OPTS= 2990 MK_SHARED_LIB=$SHELL' '$rel_builddir'/mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}' 2991 RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a" 2992 cf_cv_shlib_version=msysdll 2993 cf_cv_shlib_version_infix=msysdll 2994 shlibdir=$bindir 2995 MAKE_DLLS= 2996 cat >mk_shared_lib.sh <<-CF_EOF 2997 #!$SHELL 2998 SHARED_LIB=\[$]1 2999 IMPORT_LIB=\`echo "\[$]1" | sed -e 's/msys-/lib/' -e 's/[[0-9]]*\.dll[$]/.dll.a/'\` 3000 shift 3001 cat <<-EOF 3002 Linking shared library 3003 ** SHARED_LIB \[$]SHARED_LIB 3004 ** IMPORT_LIB \[$]IMPORT_LIB 3005EOF 3006 exec \[$]* -shared -Wl,--out-implib=\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o \[$]{SHARED_LIB} 3007CF_EOF 3008 chmod +x mk_shared_lib.sh 3009 ;; 3010 (darwin*) 3011 cf_try_cflags="no-cpp-precomp" 3012 CC_SHARED_OPTS="-dynamic" 3013 MK_SHARED_LIB='${CC} ${CFLAGS} -dynamiclib -install_name ${libdir}/`basename $[@]` -compatibility_version ${ABI_VERSION} -current_version ${ABI_VERSION} -o $[@]' 3014 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=abi 3015 cf_cv_shlib_version_infix=yes 3016 AC_CACHE_CHECK([if ld -search_paths_first works], cf_cv_ldflags_search_paths_first, [ 3017 cf_save_LDFLAGS=$LDFLAGS 3018 LDFLAGS="$LDFLAGS -Wl,-search_paths_first" 3019 AC_TRY_LINK(, [int i;], cf_cv_ldflags_search_paths_first=yes, cf_cv_ldflags_search_paths_first=no) 3020 LDFLAGS=$cf_save_LDFLAGS]) 3021 if test $cf_cv_ldflags_search_paths_first = yes; then 3022 LDFLAGS="$LDFLAGS -Wl,-search_paths_first" 3023 fi 3024 ;; 3025 (hpux[[7-8]]*) 3026 # HP-UX 8.07 ld lacks "+b" option used for libdir search-list 3027 if test "$GCC" != yes; then 3028 CC_SHARED_OPTS='+Z' 3029 fi 3030 MK_SHARED_LIB='${LD} -b -o $[@]' 3031 INSTALL_LIB="-m 555" 3032 ;; 3033 (hpux*) 3034 # (tested with gcc 2.7.2 -- I don't have c89) 3035 if test "$GCC" = yes; then 3036 LD_SHARED_OPTS='-Xlinker +b -Xlinker ${libdir}' 3037 else 3038 CC_SHARED_OPTS='+Z' 3039 LD_SHARED_OPTS='-Wl,+b,${libdir}' 3040 fi 3041 MK_SHARED_LIB='${LD} +b ${libdir} -b -o $[@]' 3042 # HP-UX shared libraries must be executable, and should be 3043 # readonly to exploit a quirk in the memory manager. 3044 INSTALL_LIB="-m 555" 3045 ;; 3046 (interix*) 3047 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel 3048 if test "$cf_cv_shlib_version" = rel; then 3049 cf_shared_soname='`basename $@ .${REL_VERSION}`.${ABI_VERSION}' 3050 else 3051 cf_shared_soname='`basename $@`' 3052 fi 3053 CC_SHARED_OPTS= 3054 MK_SHARED_LIB='${CC} -shared -Wl,-rpath,${RPATH_LIST} -Wl,-h,'$cf_shared_soname' -o $@' 3055 ;; 3056 (irix*) 3057 if test "$cf_cv_enable_rpath" = yes ; then 3058 EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS" 3059 fi 3060 # tested with IRIX 5.2 and 'cc'. 3061 if test "$GCC" != yes; then 3062 CC_SHARED_OPTS='-KPIC' 3063 MK_SHARED_LIB='${CC} -shared -rdata_shared -soname `basename $[@]` -o $[@]' 3064 else 3065 MK_SHARED_LIB='${CC} -shared -Wl,-soname,`basename $[@]` -o $[@]' 3066 fi 3067 cf_cv_rm_so_locs=yes 3068 ;; 3069 (linux*|gnu*|k*bsd*-gnu) 3070 if test "$DFT_LWR_MODEL" = "shared" ; then 3071 LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)" 3072 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" 3073 fi 3074 if test "$cf_cv_enable_rpath" = yes ; then 3075 EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS" 3076 fi 3077 CF_SHARED_SONAME 3078 MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]' 3079 ;; 3080 (mingw*) 3081 cf_cv_shlib_version=mingw 3082 cf_cv_shlib_version_infix=mingw 3083 shlibdir=$bindir 3084 MAKE_DLLS= 3085 if test "$DFT_LWR_MODEL" = "shared" ; then 3086 LOCAL_LDFLAGS="-Wl,--enable-auto-import" 3087 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" 3088 EXTRA_LDFLAGS="-Wl,--enable-auto-import $EXTRA_LDFLAGS" 3089 fi 3090 CC_SHARED_OPTS= 3091 MK_SHARED_LIB=$SHELL' '$rel_builddir'/mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}' 3092 RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a" 3093 cat >mk_shared_lib.sh <<-CF_EOF 3094 #!$SHELL 3095 SHARED_LIB=\[$]1 3096 IMPORT_LIB=\`echo "\[$]1" | sed -e 's/[[0-9]]*\.dll[$]/.dll.a/'\` 3097 shift 3098 cat <<-EOF 3099 Linking shared library 3100 ** SHARED_LIB \[$]SHARED_LIB 3101 ** IMPORT_LIB \[$]IMPORT_LIB 3102EOF 3103 exec \[$]* -shared -Wl,--enable-auto-import,--out-implib=\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o \[$]{SHARED_LIB} 3104CF_EOF 3105 chmod +x mk_shared_lib.sh 3106 ;; 3107 (openbsd[[2-9]].*|mirbsd*) 3108 if test "$DFT_LWR_MODEL" = "shared" ; then 3109 LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)" 3110 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" 3111 fi 3112 if test "$cf_cv_enable_rpath" = yes ; then 3113 EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS" 3114 fi 3115 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC" 3116 CF_SHARED_SONAME 3117 MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-Bshareable,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]' 3118 ;; 3119 (nto-qnx*|openbsd*|freebsd[[12]].*) 3120 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC" 3121 MK_SHARED_LIB='${LD} -Bshareable -o $[@]' 3122 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel 3123 ;; 3124 (dragonfly*|freebsd*) 3125 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC" 3126 if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then 3127 LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)" 3128 LOCAL_LDFLAGS2="${cf_ld_rpath_opt}\${RPATH_LIST} $LOCAL_LDFLAGS" 3129 EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS" 3130 fi 3131 CF_SHARED_SONAME 3132 MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]' 3133 ;; 3134 (netbsd*) 3135 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC" 3136 if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then 3137 LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)" 3138 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" 3139 EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS" 3140 if test "$cf_cv_shlib_version" = auto; then 3141 if test -f /usr/libexec/ld.elf_so; then 3142 cf_cv_shlib_version=abi 3143 else 3144 cf_cv_shlib_version=rel 3145 fi 3146 fi 3147 CF_SHARED_SONAME 3148 MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname' -o $[@]' 3149 else 3150 MK_SHARED_LIB='${CC} -Wl,-shared -Wl,-Bshareable -o $[@]' 3151 fi 3152 ;; 3153 (osf*|mls+*) 3154 # tested with OSF/1 V3.2 and 'cc' 3155 # tested with OSF/1 V3.2 and gcc 2.6.3 (but the c++ demo didn't 3156 # link with shared libs). 3157 MK_SHARED_LIB='${LD} -set_version ${REL_VERSION}:${ABI_VERSION} -expect_unresolved "*" -shared -soname `basename $[@]`' 3158 case $host_os in 3159 (osf4*) 3160 MK_SHARED_LIB="${MK_SHARED_LIB} -msym" 3161 ;; 3162 esac 3163 MK_SHARED_LIB="${MK_SHARED_LIB}"' -o $[@]' 3164 if test "$DFT_LWR_MODEL" = "shared" ; then 3165 LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)" 3166 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" 3167 fi 3168 cf_cv_rm_so_locs=yes 3169 ;; 3170 (sco3.2v5*) # also uw2* and UW7: hops 13-Apr-98 3171 # tested with osr5.0.5 3172 if test "$GCC" != yes; then 3173 CC_SHARED_OPTS='-belf -KPIC' 3174 fi 3175 MK_SHARED_LIB='${LD} -dy -G -h `basename $[@] .${REL_VERSION}`.${ABI_VERSION} -o [$]@' 3176 if test "$cf_cv_enable_rpath" = yes ; then 3177 # only way is to set LD_RUN_PATH but no switch for it 3178 RUN_PATH=$libdir 3179 fi 3180 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel 3181 LINK_PROGS='LD_RUN_PATH=${libdir}' 3182 LINK_TESTS='Pwd=`pwd`;LD_RUN_PATH=`dirname $${Pwd}`/lib' 3183 ;; 3184 (sunos4*) 3185 # tested with SunOS 4.1.1 and gcc 2.7.0 3186 if test "$GCC" != yes; then 3187 CC_SHARED_OPTS='-KPIC' 3188 fi 3189 MK_SHARED_LIB='${LD} -assert pure-text -o $[@]' 3190 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel 3191 ;; 3192 (solaris2*) 3193 # tested with SunOS 5.5.1 (solaris 2.5.1) and gcc 2.7.2 3194 # tested with SunOS 5.10 (solaris 10) and gcc 3.4.3 3195 if test "$DFT_LWR_MODEL" = "shared" ; then 3196 LOCAL_LDFLAGS="-R \$(LOCAL_LIBDIR):\${libdir}" 3197 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" 3198 fi 3199 if test "$cf_cv_enable_rpath" = yes ; then 3200 EXTRA_LDFLAGS="-R \${libdir} $EXTRA_LDFLAGS" 3201 fi 3202 CF_SHARED_SONAME 3203 if test "$GCC" != yes; then 3204 cf_save_CFLAGS="$CFLAGS" 3205 for cf_shared_opts in -xcode=pic32 -xcode=pic13 -KPIC -Kpic -O 3206 do 3207 CFLAGS="$cf_shared_opts $cf_save_CFLAGS" 3208 AC_TRY_COMPILE([#include <stdio.h>],[printf("Hello\n");],[break]) 3209 done 3210 CFLAGS="$cf_save_CFLAGS" 3211 CC_SHARED_OPTS=$cf_shared_opts 3212 MK_SHARED_LIB='${CC} -dy -G -h '$cf_cv_shared_soname' -o $[@]' 3213 else 3214 MK_SHARED_LIB='${CC} -shared -dy -G -h '$cf_cv_shared_soname' -o $[@]' 3215 fi 3216 ;; 3217 (sysv5uw7*|unix_sv*) 3218 # tested with UnixWare 7.1.0 (gcc 2.95.2 and cc) 3219 if test "$GCC" != yes; then 3220 CC_SHARED_OPTS='-KPIC' 3221 fi 3222 MK_SHARED_LIB='${LD} -d y -G -o [$]@' 3223 ;; 3224 (*) 3225 CC_SHARED_OPTS='unknown' 3226 MK_SHARED_LIB='echo unknown' 3227 ;; 3228 esac 3229 3230 # This works if the last tokens in $MK_SHARED_LIB are the -o target. 3231 case "$cf_cv_shlib_version" in 3232 (rel|abi) 3233 case "$MK_SHARED_LIB" in 3234 (*'-o $[@]') 3235 test "$cf_cv_do_symlinks" = no && cf_cv_do_symlinks=yes 3236 ;; 3237 (*) 3238 AC_MSG_WARN(ignored --with-shlib-version) 3239 ;; 3240 esac 3241 ;; 3242 esac 3243 3244 if test -n "$cf_try_cflags" 3245 then 3246cat > conftest.$ac_ext <<EOF 3247#line __oline__ "${as_me:-configure}" 3248#include <stdio.h> 3249int main(int argc, char *argv[[]]) 3250{ 3251 printf("hello\n"); 3252 return (argv[[argc-1]] == 0) ; 3253} 3254EOF 3255 cf_save_CFLAGS="$CFLAGS" 3256 for cf_opt in $cf_try_cflags 3257 do 3258 CFLAGS="$cf_save_CFLAGS -$cf_opt" 3259 AC_MSG_CHECKING(if CFLAGS option -$cf_opt works) 3260 if AC_TRY_EVAL(ac_compile); then 3261 AC_MSG_RESULT(yes) 3262 cf_save_CFLAGS="$CFLAGS" 3263 else 3264 AC_MSG_RESULT(no) 3265 fi 3266 done 3267 CFLAGS="$cf_save_CFLAGS" 3268 fi 3269 3270 3271 # RPATH_LIST is a colon-separated list of directories 3272 test -n "$cf_ld_rpath_opt" && MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\${RPATH_LIST}" 3273 test -z "$RPATH_LIST" && RPATH_LIST="\${libdir}" 3274 3275 test $cf_cv_rm_so_locs = yes && RM_SHARED_OPTS="$RM_SHARED_OPTS so_locations" 3276 3277 CF_VERBOSE(CC_SHARED_OPTS: $CC_SHARED_OPTS) 3278 CF_VERBOSE(MK_SHARED_LIB: $MK_SHARED_LIB) 3279 3280 AC_SUBST(CC_SHARED_OPTS) 3281 AC_SUBST(LD_RPATH_OPT) 3282 AC_SUBST(LD_SHARED_OPTS) 3283 AC_SUBST(MK_SHARED_LIB) 3284 AC_SUBST(RM_SHARED_OPTS) 3285 3286 AC_SUBST(LINK_PROGS) 3287 AC_SUBST(LINK_TESTS) 3288 3289 AC_SUBST(EXTRA_LDFLAGS) 3290 AC_SUBST(LOCAL_LDFLAGS) 3291 AC_SUBST(LOCAL_LDFLAGS2) 3292 3293 AC_SUBST(INSTALL_LIB) 3294 AC_SUBST(RPATH_LIST) 3295])dnl 3296dnl --------------------------------------------------------------------------- 3297dnl CF_SHARED_SONAME version: 3 updated: 2008/09/08 18:34:43 3298dnl ---------------- 3299dnl utility macro for CF_SHARED_OPTS, constructs "$cf_cv_shared_soname" for 3300dnl substitution into MK_SHARED_LIB string for the "-soname" (or similar) 3301dnl option. 3302dnl 3303dnl $1 is the default that should be used for "$cf_cv_shlib_version". 3304dnl If missing, use "rel". 3305define([CF_SHARED_SONAME], 3306[ 3307 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=ifelse($1,,rel,$1) 3308 if test "$cf_cv_shlib_version" = rel; then 3309 cf_cv_shared_soname='`basename $[@] .${REL_VERSION}`.${ABI_VERSION}' 3310 else 3311 cf_cv_shared_soname='`basename $[@]`' 3312 fi 3313]) 3314dnl --------------------------------------------------------------------------- 3315dnl CF_SUBDIR_PATH version: 7 updated: 2014/12/04 04:33:06 3316dnl -------------- 3317dnl Construct a search-list for a nonstandard header/lib-file 3318dnl $1 = the variable to return as result 3319dnl $2 = the package name 3320dnl $3 = the subdirectory, e.g., bin, include or lib 3321AC_DEFUN([CF_SUBDIR_PATH], 3322[ 3323$1= 3324 3325CF_ADD_SUBDIR_PATH($1,$2,$3,$prefix,NONE) 3326 3327for cf_subdir_prefix in \ 3328 /usr \ 3329 /usr/local \ 3330 /usr/pkg \ 3331 /opt \ 3332 /opt/local \ 3333 [$]HOME 3334do 3335 CF_ADD_SUBDIR_PATH($1,$2,$3,$cf_subdir_prefix,$prefix) 3336done 3337])dnl 3338dnl --------------------------------------------------------------------------- 3339dnl CF_TERM_HEADER version: 4 updated: 2015/04/15 19:08:48 3340dnl -------------- 3341dnl Look for term.h, which is part of X/Open curses. It defines the interface 3342dnl to terminfo database. Usually it is in the same include-path as curses.h, 3343dnl but some packagers change this, breaking various applications. 3344AC_DEFUN([CF_TERM_HEADER],[ 3345AC_CACHE_CHECK(for terminfo header, cf_cv_term_header,[ 3346case ${cf_cv_ncurses_header} in 3347(*/ncurses.h|*/ncursesw.h) 3348 cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[[^.]]*\.h$%term.h%'` 3349 ;; 3350(*) 3351 cf_term_header=term.h 3352 ;; 3353esac 3354 3355for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h" 3356do 3357AC_TRY_COMPILE([#include <stdio.h> 3358#include <${cf_cv_ncurses_header:-curses.h}> 3359#include <$cf_test> 3360],[int x = auto_left_margin],[ 3361 cf_cv_term_header="$cf_test"],[ 3362 cf_cv_term_header=unknown 3363 ]) 3364 test "$cf_cv_term_header" != unknown && break 3365done 3366]) 3367 3368# Set definitions to allow ifdef'ing to accommodate subdirectories 3369 3370case $cf_cv_term_header in 3371(*term.h) 3372 AC_DEFINE(HAVE_TERM_H,1,[Define to 1 if we have term.h]) 3373 ;; 3374esac 3375 3376case $cf_cv_term_header in 3377(ncurses/term.h) 3378 AC_DEFINE(HAVE_NCURSES_TERM_H,1,[Define to 1 if we have ncurses/term.h]) 3379 ;; 3380(ncursesw/term.h) 3381 AC_DEFINE(HAVE_NCURSESW_TERM_H,1,[Define to 1 if we have ncursesw/term.h]) 3382 ;; 3383esac 3384])dnl 3385dnl --------------------------------------------------------------------------- 3386dnl CF_TOP_BUILDDIR version: 2 updated: 2013/07/27 17:38:32 3387dnl --------------- 3388dnl Define a top_builddir symbol, for applications that need an absolute path. 3389AC_DEFUN([CF_TOP_BUILDDIR], 3390[ 3391top_builddir=ifelse($1,,`pwd`,$1) 3392AC_SUBST(top_builddir) 3393])dnl 3394dnl --------------------------------------------------------------------------- 3395dnl CF_TRIM_X_LIBS version: 3 updated: 2015/04/12 15:39:00 3396dnl -------------- 3397dnl Trim extra base X libraries added as a workaround for inconsistent library 3398dnl dependencies returned by "new" pkg-config files. 3399AC_DEFUN([CF_TRIM_X_LIBS],[ 3400 for cf_trim_lib in Xmu Xt X11 3401 do 3402 case "$LIBS" in 3403 (*-l$cf_trim_lib\ *-l$cf_trim_lib*) 3404 LIBS=`echo "$LIBS " | sed -e 's/ / /g' -e 's%-l'"$cf_trim_lib"' %%' -e 's/ $//'` 3405 CF_VERBOSE(..trimmed $LIBS) 3406 ;; 3407 esac 3408 done 3409]) 3410dnl --------------------------------------------------------------------------- 3411dnl CF_TRY_PKG_CONFIG version: 5 updated: 2013/07/06 21:27:06 3412dnl ----------------- 3413dnl This is a simple wrapper to use for pkg-config, for libraries which may be 3414dnl available in that form. 3415dnl 3416dnl $1 = package name 3417dnl $2 = extra logic to use, if any, after updating CFLAGS and LIBS 3418dnl $3 = logic to use if pkg-config does not have the package 3419AC_DEFUN([CF_TRY_PKG_CONFIG],[ 3420AC_REQUIRE([CF_PKG_CONFIG]) 3421 3422if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists $1; then 3423 CF_VERBOSE(found package $1) 3424 cf_pkgconfig_incs="`$PKG_CONFIG --cflags $1 2>/dev/null`" 3425 cf_pkgconfig_libs="`$PKG_CONFIG --libs $1 2>/dev/null`" 3426 CF_VERBOSE(package $1 CFLAGS: $cf_pkgconfig_incs) 3427 CF_VERBOSE(package $1 LIBS: $cf_pkgconfig_libs) 3428 CF_ADD_CFLAGS($cf_pkgconfig_incs) 3429 CF_ADD_LIBS($cf_pkgconfig_libs) 3430 ifelse([$2],,:,[$2]) 3431else 3432 cf_pkgconfig_incs= 3433 cf_pkgconfig_libs= 3434 ifelse([$3],,:,[$3]) 3435fi 3436]) 3437dnl --------------------------------------------------------------------------- 3438dnl CF_TRY_XOPEN_SOURCE version: 1 updated: 2011/10/30 17:09:50 3439dnl ------------------- 3440dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we 3441dnl can define it successfully. 3442AC_DEFUN([CF_TRY_XOPEN_SOURCE],[ 3443AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[ 3444 AC_TRY_COMPILE([ 3445#include <stdlib.h> 3446#include <string.h> 3447#include <sys/types.h> 3448],[ 3449#ifndef _XOPEN_SOURCE 3450make an error 3451#endif], 3452 [cf_cv_xopen_source=no], 3453 [cf_save="$CPPFLAGS" 3454 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" 3455 AC_TRY_COMPILE([ 3456#include <stdlib.h> 3457#include <string.h> 3458#include <sys/types.h> 3459],[ 3460#ifdef _XOPEN_SOURCE 3461make an error 3462#endif], 3463 [cf_cv_xopen_source=no], 3464 [cf_cv_xopen_source=$cf_XOPEN_SOURCE]) 3465 CPPFLAGS="$cf_save" 3466 ]) 3467]) 3468 3469if test "$cf_cv_xopen_source" != no ; then 3470 CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE) 3471 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE) 3472 cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" 3473 CF_ADD_CFLAGS($cf_temp_xopen_source) 3474fi 3475]) 3476dnl --------------------------------------------------------------------------- 3477dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59 3478dnl -------- 3479dnl Make an uppercase version of a variable 3480dnl $1=uppercase($2) 3481AC_DEFUN([CF_UPPER], 3482[ 3483$1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` 3484])dnl 3485dnl --------------------------------------------------------------------------- 3486dnl CF_UTF8_LIB version: 8 updated: 2012/10/06 08:57:51 3487dnl ----------- 3488dnl Check for multibyte support, and if not found, utf8 compatibility library 3489AC_DEFUN([CF_UTF8_LIB], 3490[ 3491AC_CACHE_CHECK(for multibyte character support,cf_cv_utf8_lib,[ 3492 cf_save_LIBS="$LIBS" 3493 AC_TRY_LINK([ 3494#include <stdlib.h>],[putwc(0,0);], 3495 [cf_cv_utf8_lib=yes], 3496 [CF_FIND_LINKAGE([ 3497#include <libutf8.h>],[putwc(0,0);],utf8, 3498 [cf_cv_utf8_lib=add-on], 3499 [cf_cv_utf8_lib=no]) 3500])]) 3501 3502# HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between 3503# ncurses/ncursesw: 3504if test "$cf_cv_utf8_lib" = "add-on" ; then 3505 AC_DEFINE(HAVE_LIBUTF8_H,1,[Define to 1 if we should include libutf8.h]) 3506 CF_ADD_INCDIR($cf_cv_header_path_utf8) 3507 CF_ADD_LIBDIR($cf_cv_library_path_utf8) 3508 CF_ADD_LIBS($cf_cv_library_file_utf8) 3509fi 3510])dnl 3511dnl --------------------------------------------------------------------------- 3512dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12 3513dnl ---------- 3514dnl Use AC_VERBOSE w/o the warnings 3515AC_DEFUN([CF_VERBOSE], 3516[test -n "$verbose" && echo " $1" 1>&AC_FD_MSG 3517CF_MSG_LOG([$1]) 3518])dnl 3519dnl --------------------------------------------------------------------------- 3520dnl CF_VERSION_INFO version: 7 updated: 2015/04/17 21:13:04 3521dnl --------------- 3522dnl Define several useful symbols derived from the VERSION file. A separate 3523dnl file is preferred to embedding the version numbers in various scripts. 3524dnl (automake is a textbook-example of why the latter is a bad idea, but there 3525dnl are others). 3526dnl 3527dnl The file contents are: 3528dnl libtool-version release-version patch-version 3529dnl or 3530dnl release-version 3531dnl where 3532dnl libtool-version (see ?) consists of 3 integers separated by '.' 3533dnl release-version consists of a major version and minor version 3534dnl separated by '.', optionally followed by a patch-version 3535dnl separated by '-'. The minor version need not be an 3536dnl integer (but it is preferred). 3537dnl patch-version is an integer in the form yyyymmdd, so ifdef's and 3538dnl scripts can easily compare versions. 3539dnl 3540dnl If libtool is used, the first form is required, since CF_WITH_LIBTOOL 3541dnl simply extracts the first field using 'cut -f1'. 3542dnl 3543dnl Optional parameters: 3544dnl $1 = internal name for package 3545dnl $2 = external name for package 3546AC_DEFUN([CF_VERSION_INFO], 3547[ 3548if test -f $srcdir/VERSION ; then 3549 AC_MSG_CHECKING(for package version) 3550 3551 # if there are not enough fields, cut returns the last one... 3552 cf_field1=`sed -e '2,$d' $srcdir/VERSION|cut -f1` 3553 cf_field2=`sed -e '2,$d' $srcdir/VERSION|cut -f2` 3554 cf_field3=`sed -e '2,$d' $srcdir/VERSION|cut -f3` 3555 3556 # this is how CF_BUNDLED_INTL uses $VERSION: 3557 VERSION="$cf_field1" 3558 3559 VERSION_MAJOR=`echo "$cf_field2" | sed -e 's/\..*//'` 3560 test -z "$VERSION_MAJOR" && AC_MSG_ERROR(missing major-version) 3561 3562 VERSION_MINOR=`echo "$cf_field2" | sed -e 's/^[[^.]]*\.//' -e 's/-.*//'` 3563 test -z "$VERSION_MINOR" && AC_MSG_ERROR(missing minor-version) 3564 3565 AC_MSG_RESULT(${VERSION_MAJOR}.${VERSION_MINOR}) 3566 3567 AC_MSG_CHECKING(for package patch date) 3568 VERSION_PATCH=`echo "$cf_field3" | sed -e 's/^[[^-]]*-//'` 3569 case .$VERSION_PATCH in 3570 (.) 3571 AC_MSG_ERROR(missing patch-date $VERSION_PATCH) 3572 ;; 3573 (.[[0-9]][[0-9]][[0-9]][[0-9]][[0-9]][[0-9]][[0-9]][[0-9]]) 3574 ;; 3575 (*) 3576 AC_MSG_ERROR(illegal patch-date $VERSION_PATCH) 3577 ;; 3578 esac 3579 AC_MSG_RESULT($VERSION_PATCH) 3580else 3581 AC_MSG_ERROR(did not find $srcdir/VERSION) 3582fi 3583 3584# show the actual data that we have for versions: 3585CF_VERBOSE(ABI VERSION $VERSION) 3586CF_VERBOSE(VERSION_MAJOR $VERSION_MAJOR) 3587CF_VERBOSE(VERSION_MINOR $VERSION_MINOR) 3588CF_VERBOSE(VERSION_PATCH $VERSION_PATCH) 3589 3590AC_SUBST(VERSION) 3591AC_SUBST(VERSION_MAJOR) 3592AC_SUBST(VERSION_MINOR) 3593AC_SUBST(VERSION_PATCH) 3594 3595dnl if a package name is given, define its corresponding version info. We 3596dnl need the package name to ensure that the defined symbols are unique. 3597ifelse($1,,,[ 3598 cf_PACKAGE=$1 3599 PACKAGE=ifelse($2,,$1,$2) 3600 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE",[Define to the package-name]) 3601 AC_SUBST(PACKAGE) 3602 CF_UPPER(cf_PACKAGE,$cf_PACKAGE) 3603 AC_DEFINE_UNQUOTED(${cf_PACKAGE}_VERSION,"${VERSION_MAJOR}.${VERSION_MINOR}") 3604 AC_DEFINE_UNQUOTED(${cf_PACKAGE}_PATCHDATE,${VERSION_PATCH}) 3605]) 3606])dnl 3607dnl --------------------------------------------------------------------------- 3608dnl CF_WITH_ABI_VERSION version: 3 updated: 2015/06/06 16:10:11 3609dnl ------------------- 3610dnl Allow library's ABI to be overridden. Generally this happens when a 3611dnl packager has incremented the ABI past that used in the original package, 3612dnl and wishes to keep doing this. 3613dnl 3614dnl $1 is the package name, if any, to derive a corresponding {package}_ABI 3615dnl symbol. 3616AC_DEFUN([CF_WITH_ABI_VERSION],[ 3617test -z "$cf_cv_abi_version" && cf_cv_abi_version=0 3618AC_ARG_WITH(abi-version, 3619[ --with-abi-version=XXX override derived ABI version],[ 3620 if test "x$cf_cv_abi_version" != "x$withval" 3621 then 3622 AC_MSG_WARN(overriding ABI version $cf_cv_abi_version to $withval) 3623 case $cf_cv_rel_version in 3624 (5.*) 3625 cf_cv_rel_version=$withval.0 3626 ;; 3627 (6.*) 3628 cf_cv_rel_version=$withval.9 # FIXME: should be 10 as of 6.0 release 3629 ;; 3630 esac 3631 fi 3632 cf_cv_abi_version=$withval]) 3633 CF_NUMBER_SYNTAX($cf_cv_abi_version,ABI version) 3634ifelse($1,,,[ 3635$1_ABI=$cf_cv_abi_version 3636]) 3637])dnl 3638dnl --------------------------------------------------------------------------- 3639dnl CF_WITH_CURSES_DIR version: 3 updated: 2010/11/20 17:02:38 3640dnl ------------------ 3641dnl Wrapper for AC_ARG_WITH to specify directory under which to look for curses 3642dnl libraries. 3643AC_DEFUN([CF_WITH_CURSES_DIR],[ 3644 3645AC_MSG_CHECKING(for specific curses-directory) 3646AC_ARG_WITH(curses-dir, 3647 [ --with-curses-dir=DIR directory in which (n)curses is installed], 3648 [cf_cv_curses_dir=$withval], 3649 [cf_cv_curses_dir=no]) 3650AC_MSG_RESULT($cf_cv_curses_dir) 3651 3652if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" ) 3653then 3654 CF_PATH_SYNTAX(withval) 3655 if test -d "$cf_cv_curses_dir" 3656 then 3657 CF_ADD_INCDIR($cf_cv_curses_dir/include) 3658 CF_ADD_LIBDIR($cf_cv_curses_dir/lib) 3659 fi 3660fi 3661])dnl 3662dnl --------------------------------------------------------------------------- 3663dnl CF_WITH_DBMALLOC version: 7 updated: 2010/06/21 17:26:47 3664dnl ---------------- 3665dnl Configure-option for dbmalloc. The optional parameter is used to override 3666dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests. 3667AC_DEFUN([CF_WITH_DBMALLOC],[ 3668CF_NO_LEAKS_OPTION(dbmalloc, 3669 [ --with-dbmalloc test: use Conor Cahill's dbmalloc library], 3670 [USE_DBMALLOC]) 3671 3672if test "$with_dbmalloc" = yes ; then 3673 AC_CHECK_HEADER(dbmalloc.h, 3674 [AC_CHECK_LIB(dbmalloc,[debug_malloc]ifelse([$1],,[],[,$1]))]) 3675fi 3676])dnl 3677dnl --------------------------------------------------------------------------- 3678dnl CF_WITH_DMALLOC version: 7 updated: 2010/06/21 17:26:47 3679dnl --------------- 3680dnl Configure-option for dmalloc. The optional parameter is used to override 3681dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests. 3682AC_DEFUN([CF_WITH_DMALLOC],[ 3683CF_NO_LEAKS_OPTION(dmalloc, 3684 [ --with-dmalloc test: use Gray Watson's dmalloc library], 3685 [USE_DMALLOC]) 3686 3687if test "$with_dmalloc" = yes ; then 3688 AC_CHECK_HEADER(dmalloc.h, 3689 [AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse([$1],,[],[,$1]))]) 3690fi 3691])dnl 3692dnl --------------------------------------------------------------------------- 3693dnl CF_WITH_EXPORT_SYMS version: 3 updated: 2014/12/20 19:16:08 3694dnl ------------------- 3695dnl Use this with libtool to specify the list of symbols that may be exported. 3696dnl The input file contains one symbol per line; comments work with "#". 3697dnl 3698dnl $1 = basename of the ".sym" file (default $PACKAGE) 3699AC_DEFUN([CF_WITH_EXPORT_SYMS], 3700[ 3701AC_MSG_CHECKING(if exported-symbols file should be used) 3702AC_ARG_WITH(export-syms, 3703 [ --with-export-syms=XXX limit exported symbols using libtool], 3704 [with_export_syms=$withval], 3705 [with_export_syms=no]) 3706if test "x$with_export_syms" = xyes 3707then 3708 with_export_syms='${top_srcdir}/package/ifelse($1,,${PACKAGE},[$1]).sym' 3709 AC_SUBST(PACKAGE) 3710fi 3711AC_MSG_RESULT($with_export_syms) 3712if test "x$with_export_syms" != xno 3713then 3714 EXPORT_SYMS="-export-symbols $with_export_syms" 3715 AC_SUBST(EXPORT_SYMS) 3716fi 3717])dnl 3718dnl --------------------------------------------------------------------------- 3719dnl CF_WITH_LIBTOOL version: 33 updated: 2015/10/17 19:03:33 3720dnl --------------- 3721dnl Provide a configure option to incorporate libtool. Define several useful 3722dnl symbols for the makefile rules. 3723dnl 3724dnl The reference to AC_PROG_LIBTOOL does not normally work, since it uses 3725dnl macros from libtool.m4 which is in the aclocal directory of automake. 3726dnl Following is a simple script which turns on the AC_PROG_LIBTOOL macro. 3727dnl But that still does not work properly since the macro is expanded outside 3728dnl the CF_WITH_LIBTOOL macro: 3729dnl 3730dnl #!/bin/sh 3731dnl ACLOCAL=`aclocal --print-ac-dir` 3732dnl if test -z "$ACLOCAL" ; then 3733dnl echo cannot find aclocal directory 3734dnl exit 1 3735dnl elif test ! -f $ACLOCAL/libtool.m4 ; then 3736dnl echo cannot find libtool.m4 file 3737dnl exit 1 3738dnl fi 3739dnl 3740dnl LOCAL=aclocal.m4 3741dnl ORIG=aclocal.m4.orig 3742dnl 3743dnl trap "mv $ORIG $LOCAL" 0 1 2 5 15 3744dnl rm -f $ORIG 3745dnl mv $LOCAL $ORIG 3746dnl 3747dnl # sed the LIBTOOL= assignment to omit the current directory? 3748dnl sed -e 's/^LIBTOOL=.*/LIBTOOL=${LIBTOOL:-libtool}/' $ACLOCAL/libtool.m4 >>$LOCAL 3749dnl cat $ORIG >>$LOCAL 3750dnl 3751dnl autoconf-257 $* 3752dnl 3753AC_DEFUN([CF_WITH_LIBTOOL], 3754[ 3755AC_REQUIRE([CF_DISABLE_LIBTOOL_VERSION]) 3756ifdef([AC_PROG_LIBTOOL],,[ 3757LIBTOOL= 3758]) 3759# common library maintenance symbols that are convenient for libtool scripts: 3760LIB_CREATE='${AR} -cr' 3761LIB_OBJECT='${OBJECTS}' 3762LIB_SUFFIX=.a 3763LIB_PREP="$RANLIB" 3764 3765# symbols used to prop libtool up to enable it to determine what it should be 3766# doing: 3767LIB_CLEAN= 3768LIB_COMPILE= 3769LIB_LINK='${CC}' 3770LIB_INSTALL= 3771LIB_UNINSTALL= 3772 3773AC_MSG_CHECKING(if you want to build libraries with libtool) 3774AC_ARG_WITH(libtool, 3775 [ --with-libtool generate libraries with libtool], 3776 [with_libtool=$withval], 3777 [with_libtool=no]) 3778AC_MSG_RESULT($with_libtool) 3779if test "$with_libtool" != "no"; then 3780ifdef([AC_PROG_LIBTOOL],[ 3781 # missing_content_AC_PROG_LIBTOOL{{ 3782 AC_PROG_LIBTOOL 3783 # missing_content_AC_PROG_LIBTOOL}} 3784],[ 3785 if test "$with_libtool" != "yes" ; then 3786 CF_PATH_SYNTAX(with_libtool) 3787 LIBTOOL=$with_libtool 3788 else 3789 AC_CHECK_TOOLS(LIBTOOL,[libtool glibtool],none) 3790 CF_LIBTOOL_VERSION 3791 if test -z "$cf_cv_libtool_version" && test "$LIBTOOL" = libtool 3792 then 3793 CF_FORGET_TOOL(LIBTOOL) 3794 AC_CHECK_TOOLS(LIBTOOL,[glibtool],none) 3795 CF_LIBTOOL_VERSION 3796 fi 3797 fi 3798 if test -z "$LIBTOOL" ; then 3799 AC_MSG_ERROR(Cannot find libtool) 3800 fi 3801])dnl 3802 LIB_CREATE='${LIBTOOL} --mode=link ${CC} -rpath ${DESTDIR}${libdir} ${LIBTOOL_VERSION} `cut -f1 ${top_srcdir}/VERSION` ${LIBTOOL_OPTS} ${LT_UNDEF} $(LIBS) -o' 3803 LIB_OBJECT='${OBJECTS:.o=.lo}' 3804 LIB_SUFFIX=.la 3805 LIB_CLEAN='${LIBTOOL} --mode=clean' 3806 LIB_COMPILE='${LIBTOOL} --mode=compile' 3807 LIB_LINK='${LIBTOOL} --mode=link ${CC} ${LIBTOOL_OPTS}' 3808 LIB_INSTALL='${LIBTOOL} --mode=install' 3809 LIB_UNINSTALL='${LIBTOOL} --mode=uninstall' 3810 LIB_PREP=: 3811 3812 CF_CHECK_LIBTOOL_VERSION 3813 3814 # special hack to add -no-undefined (which libtool should do for itself) 3815 LT_UNDEF= 3816 case "$cf_cv_system_name" in 3817 (cygwin*|msys*|mingw32*|os2*|uwin*|aix[[4-7]]) 3818 LT_UNDEF=-no-undefined 3819 ;; 3820 esac 3821 AC_SUBST([LT_UNDEF]) 3822 3823 # special hack to add --tag option for C++ compiler 3824 case $cf_cv_libtool_version in 3825 (1.[[5-9]]*|[[2-9]].[[0-9.a-z]]*) 3826 LIBTOOL_CXX="$LIBTOOL --tag=CXX" 3827 LIBTOOL="$LIBTOOL --tag=CC" 3828 ;; 3829 (*) 3830 LIBTOOL_CXX="$LIBTOOL" 3831 ;; 3832 esac 3833else 3834 LIBTOOL="" 3835 LIBTOOL_CXX="" 3836fi 3837 3838test -z "$LIBTOOL" && ECHO_LT= 3839 3840AC_SUBST(LIBTOOL) 3841AC_SUBST(LIBTOOL_CXX) 3842AC_SUBST(LIBTOOL_OPTS) 3843 3844AC_SUBST(LIB_CREATE) 3845AC_SUBST(LIB_OBJECT) 3846AC_SUBST(LIB_SUFFIX) 3847AC_SUBST(LIB_PREP) 3848 3849AC_SUBST(LIB_CLEAN) 3850AC_SUBST(LIB_COMPILE) 3851AC_SUBST(LIB_LINK) 3852AC_SUBST(LIB_INSTALL) 3853AC_SUBST(LIB_UNINSTALL) 3854 3855])dnl 3856dnl --------------------------------------------------------------------------- 3857dnl CF_WITH_LIBTOOL_OPTS version: 4 updated: 2015/04/17 21:13:04 3858dnl -------------------- 3859dnl Allow user to pass additional libtool options into the library creation 3860dnl and link steps. The main use for this is to do something like 3861dnl ./configure --with-libtool-opts=-static 3862dnl to get the same behavior as automake-flavored 3863dnl ./configure --enable-static 3864AC_DEFUN([CF_WITH_LIBTOOL_OPTS],[ 3865AC_MSG_CHECKING(for additional libtool options) 3866AC_ARG_WITH(libtool-opts, 3867 [ --with-libtool-opts=XXX specify additional libtool options], 3868 [with_libtool_opts=$withval], 3869 [with_libtool_opts=no]) 3870AC_MSG_RESULT($with_libtool_opts) 3871 3872case .$with_libtool_opts in 3873(.yes|.no|.) 3874 ;; 3875(*) 3876 LIBTOOL_OPTS="$LIBTOOL_OPTS $with_libtool_opts" 3877 ;; 3878esac 3879 3880AC_SUBST(LIBTOOL_OPTS) 3881])dnl 3882dnl --------------------------------------------------------------------------- 3883dnl CF_WITH_NCURSES_ETC version: 5 updated: 2016/02/20 19:23:20 3884dnl ------------------- 3885dnl Use this macro for programs which use any variant of "curses", e.g., 3886dnl "ncurses", and "PDCurses". Programs that can use curses and some unrelated 3887dnl library (such as slang) should use a "--with-screen=XXX" option. 3888dnl 3889dnl This does not use AC_DEFUN, because that would tell autoconf to run each 3890dnl of the macros inside this one - before this macro. 3891define([CF_WITH_NCURSES_ETC],[ 3892CF_WITH_CURSES_DIR 3893 3894cf_cv_screen=curses 3895 3896AC_MSG_CHECKING(for specified curses library type) 3897AC_ARG_WITH(screen, 3898 [ --with-screen=XXX use specified curses-libraries], 3899 [cf_cv_screen=$withval],[ 3900 3901AC_ARG_WITH(ncursesw, 3902 [ --with-ncursesw use wide ncurses-libraries], 3903 [cf_cv_screen=ncursesw],[ 3904 3905AC_ARG_WITH(ncurses, 3906 [ --with-ncurses use ncurses-libraries], 3907 [cf_cv_screen=ncurses],[ 3908 3909AC_ARG_WITH(pdcurses, 3910 [ --with-pdcurses compile/link with pdcurses X11 library], 3911 [cf_cv_screen=pdcurses],[ 3912 3913AC_ARG_WITH(curses-colr, 3914 [ --with-curses-colr compile/link with HPUX 10.x color-curses], 3915 [cf_cv_screen=curses_colr],[ 3916 3917AC_ARG_WITH(curses-5lib, 3918 [ --with-curses-5lib compile/link with SunOS 5lib curses], 3919 [cf_cv_screen=curses_5lib])])])])])]) 3920 3921AC_MSG_RESULT($cf_cv_screen) 3922 3923case $cf_cv_screen in 3924(curses|curses_*) 3925 CF_CURSES_CONFIG 3926 ;; 3927(ncursesw*) 3928 CF_UTF8_LIB 3929 CF_NCURSES_CONFIG($cf_cv_screen) 3930 ;; 3931(ncurses*) 3932 CF_NCURSES_CONFIG($cf_cv_screen) 3933 ;; 3934(pdcurses) 3935 CF_PDCURSES_X11 3936 ;; 3937(*) 3938 AC_MSG_ERROR(unexpected screen-value: $cf_cv_screen) 3939 ;; 3940esac 3941 3942CF_NCURSES_PTHREADS($cf_cv_screen) 3943 3944])dnl 3945dnl --------------------------------------------------------------------------- 3946dnl CF_WITH_NC_ALLOC_H version: 4 updated: 2008/11/01 12:44:02 3947dnl ------------------ 3948dnl Applications that use ncurses can provide better leak-checking if they 3949dnl call ncurses' functions to free its memory on exit. That is normally not 3950dnl configured (--disable-leaks), but is useful in a debugging library. 3951dnl 3952dnl Use this after checking for ncurses/ncursesw libraries. 3953AC_DEFUN([CF_WITH_NC_ALLOC_H], 3954[ 3955AC_REQUIRE([CF_DISABLE_LEAKS]) 3956 3957case $LIBS in #(vi 3958*ncurses*) 3959 3960if test "$with_no_leaks" = yes ; then 3961 AC_CHECK_HEADER(nc_alloc.h) 3962 AC_CHECK_FUNCS(_nc_free_and_exit) 3963fi 3964;; 3965esac 3966])dnl 3967dnl --------------------------------------------------------------------------- 3968dnl CF_WITH_REL_VERSION version: 1 updated: 2003/09/20 18:12:49 3969dnl ------------------- 3970dnl Allow library's release-version to be overridden. Generally this happens when a 3971dnl packager has incremented the release-version past that used in the original package, 3972dnl and wishes to keep doing this. 3973dnl 3974dnl $1 is the package name, if any, to derive corresponding {package}_MAJOR 3975dnl and {package}_MINOR symbols 3976dnl symbol. 3977AC_DEFUN([CF_WITH_REL_VERSION],[ 3978test -z "$cf_cv_rel_version" && cf_cv_rel_version=0.0 3979AC_ARG_WITH(rel-version, 3980[ --with-rel-version=XXX override derived release version], 3981[AC_MSG_WARN(overriding release version $cf_cv_rel_version to $withval) 3982 cf_cv_rel_version=$withval]) 3983ifelse($1,,[ 3984 CF_NUMBER_SYNTAX($cf_cv_rel_version,Release version) 3985],[ 3986 $1_MAJOR=`echo "$cf_cv_rel_version" | sed -e 's/\..*//'` 3987 $1_MINOR=`echo "$cf_cv_rel_version" | sed -e 's/^[[^.]]*//' -e 's/^\.//' -e 's/\..*//'` 3988 CF_NUMBER_SYNTAX([$]$1_MAJOR,Release major-version) 3989 CF_NUMBER_SYNTAX([$]$1_MINOR,Release minor-version) 3990]) 3991])dnl 3992dnl --------------------------------------------------------------------------- 3993dnl CF_WITH_SHARED_OR_LIBTOOL version: 7 updated: 2014/11/02 16:11:49 3994dnl ------------------------- 3995dnl Provide shared libraries using either autoconf macros (--with-shared) or 3996dnl using the external libtool script (--with-libtool). 3997dnl 3998dnl $1 = program name (all caps preferred) 3999dnl $1 = release version 4000dnl $2 = ABI version 4001define([CF_WITH_SHARED_OR_LIBTOOL],[ 4002 4003REL_VERSION=$2 4004ABI_VERSION=$3 4005cf_cv_rel_version=$REL_VERSION 4006AC_SUBST(ABI_VERSION) 4007AC_SUBST(REL_VERSION) 4008 4009CF_WITH_REL_VERSION($1) 4010CF_WITH_ABI_VERSION 4011 4012LIB_MODEL=static 4013DFT_LWR_MODEL=$LIB_MODEL 4014LIBTOOL_MAKE="#" 4015 4016# use to comment-out makefile lines 4017MAKE_NORMAL= 4018MAKE_STATIC= 4019MAKE_SHARED="#" 4020MAKE_DLLS="#" 4021 4022shlibdir=$libdir 4023AC_SUBST(shlibdir) 4024 4025CF_WITH_LIBTOOL 4026 4027LIB_CREATE="$LIB_CREATE \[$]@" 4028 4029if test "$with_libtool" = "yes" ; then 4030 OBJEXT="lo" 4031 LIB_MODEL=libtool 4032 DFT_LWR_MODEL=$LIB_MODEL 4033 LIBTOOL_MAKE= 4034 CF_WITH_LIBTOOL_OPTS 4035 CF_WITH_EXPORT_SYMS 4036 MAKE_NORMAL="#" 4037 MAKE_STATIC="#" 4038 MAKE_SHARED= 4039else 4040 AC_MSG_CHECKING(if you want to build shared libraries) 4041 AC_ARG_WITH(shared, 4042 [ --with-shared generate shared-libraries], 4043 [with_shared=$withval], 4044 [with_shared=no]) 4045 AC_MSG_RESULT($with_shared) 4046 if test "$with_shared" = "yes" ; then 4047 LIB_MODEL=shared 4048 DFT_LWR_MODEL=$LIB_MODEL 4049 CF_SHARED_OPTS 4050 CF_WITH_VERSIONED_SYMS 4051 LIB_PREP=: 4052 LIB_CREATE="[$]MK_SHARED_LIB" 4053 CFLAGS="$CFLAGS $CC_SHARED_OPTS" 4054 MAKE_NORMAL="#" 4055 MAKE_STATIC="#" 4056 MAKE_SHARED= 4057 fi 4058fi 4059 4060LIB_SUFFIX= 4061CF_LIB_SUFFIX($LIB_MODEL, DFT_LIB_SUFFIX, DFT_DEP_SUFFIX) 4062LIB_SUFFIX=$DFT_LIB_SUFFIX 4063 4064AC_SUBST(DFT_LWR_MODEL) 4065AC_SUBST(DFT_LIB_SUFFIX) 4066AC_SUBST(DFT_DEP_SUFFIX) 4067AC_SUBST(LIB_MODEL) 4068 4069AC_SUBST(LIBTOOL_MAKE) 4070 4071AC_SUBST(MAKE_DLLS) 4072AC_SUBST(MAKE_NORMAL) 4073AC_SUBST(MAKE_SHARED) 4074AC_SUBST(MAKE_STATIC) 4075])dnl 4076dnl --------------------------------------------------------------------------- 4077dnl CF_WITH_VALGRIND version: 1 updated: 2006/12/14 18:00:21 4078dnl ---------------- 4079AC_DEFUN([CF_WITH_VALGRIND],[ 4080CF_NO_LEAKS_OPTION(valgrind, 4081 [ --with-valgrind test: use valgrind], 4082 [USE_VALGRIND]) 4083])dnl 4084dnl --------------------------------------------------------------------------- 4085dnl CF_WITH_VERSIONED_SYMS version: 7 updated: 2015/10/24 20:50:26 4086dnl ---------------------- 4087dnl Use this when building shared library with ELF, to markup symbols with the 4088dnl version identifier from the given input file. Generally that identifier is 4089dnl the same as the SONAME at which the symbol was first introduced. 4090dnl 4091dnl $1 = basename of the ".map" file (default $PACKAGE) 4092AC_DEFUN([CF_WITH_VERSIONED_SYMS], 4093[ 4094AC_MSG_CHECKING(if versioned-symbols file should be used) 4095AC_ARG_WITH(versioned-syms, 4096 [ --with-versioned-syms=X markup versioned symbols using ld], 4097 [with_versioned_syms=$withval], 4098 [with_versioned_syms=no]) 4099if test "x$with_versioned_syms" = xyes 4100then 4101 with_versioned_syms='${top_srcdir}/package/ifelse($1,,${PACKAGE},[$1]).map' 4102 AC_SUBST(PACKAGE) 4103fi 4104AC_MSG_RESULT($with_versioned_syms) 4105 4106RESULTING_SYMS= 4107VERSIONED_SYMS= 4108WILDCARD_SYMS= 4109 4110if test "x$with_versioned_syms" != xno 4111then 4112 RESULTING_SYMS=$with_versioned_syms 4113 case "x$MK_SHARED_LIB" in 4114 (*-Wl,*) 4115 VERSIONED_SYMS="-Wl,--version-script,\${RESULTING_SYMS}" 4116 MK_SHARED_LIB=`echo "$MK_SHARED_LIB" | sed -e "s%-Wl,%\\[$]{VERSIONED_SYMS} -Wl,%"` 4117 CF_VERBOSE(MK_SHARED_LIB: $MK_SHARED_LIB) 4118 ;; 4119 (*-dy\ *) 4120 VERSIONED_SYMS="-Wl,-M,\${RESULTING_SYMS}" 4121 MK_SHARED_LIB=`echo "$MK_SHARED_LIB" | sed -e "s%-dy%\\[$]{VERSIONED_SYMS} -dy%"` 4122 CF_VERBOSE(MK_SHARED_LIB: $MK_SHARED_LIB) 4123 ;; 4124 (*) 4125 AC_MSG_WARN(this system does not support versioned-symbols) 4126 ;; 4127 esac 4128 4129 # Linux ld can selectively override scope, e.g., of symbols beginning with 4130 # "_" by first declaring some as global, and then using a wildcard to 4131 # declare the others as local. Some other loaders cannot do this. Check 4132 # by constructing a (very) simple shared library and inspecting its 4133 # symbols. 4134 if test "x$VERSIONED_SYMS" != "x" 4135 then 4136 AC_MSG_CHECKING(if wildcards can be used to selectively omit symbols) 4137 WILDCARD_SYMS=no 4138 4139 # make sources 4140 rm -f conftest.* 4141 4142 cat >conftest.ver <<EOF 4143module_1.0 { 4144global: 4145 globalf1; 4146local: 4147 localf1; 4148}; 4149module_2.0 { 4150global: 4151 globalf2; 4152local: 4153 localf2; 4154 _*; 4155} module_1.0; 4156submodule_1.0 { 4157global: 4158 subglobalf1; 4159 _ismissing; 4160local: 4161 sublocalf1; 4162}; 4163submodule_2.0 { 4164global: 4165 subglobalf2; 4166local: 4167 sublocalf2; 4168 _*; 4169} submodule_1.0; 4170EOF 4171 cat >conftest.$ac_ext <<EOF 4172#line __oline__ "configure" 4173int _ismissing(void) { return 1; } 4174int _localf1(void) { return 1; } 4175int _localf2(void) { return 2; } 4176int globalf1(void) { return 1; } 4177int globalf2(void) { return 2; } 4178int _sublocalf1(void) { return 1; } 4179int _sublocalf2(void) { return 2; } 4180int subglobalf1(void) { return 1; } 4181int subglobalf2(void) { return 2; } 4182EOF 4183 cat >conftest.mk <<EOF 4184CC=${CC} 4185CFLAGS=${CFLAGS} 4186CPPFLAGS=${CPPFLAGS} 4187LDFLAGS=${LDFLAGS} 4188LIBS=${LIBS} 4189VERSIONED_SYMS=${VERSIONED_SYMS} 4190RESULTING_SYMS=conftest.ver 4191MK_SHARED_LIB=${MK_SHARED_LIB} 4192conftest.so: conftest.$ac_cv_objext 4193 \$(MK_SHARED_LIB) conftest.$ac_cv_objext 4194EOF 4195 4196 # compile source, make library 4197 if make -f conftest.mk 2>&AC_FD_CC >/dev/null 4198 then 4199 # test for missing symbol in either Data or Text section 4200 cf_missing=`nm -P conftest.so 2>&AC_FD_CC |fgrep _ismissing | egrep '[[ ]][[DT]][[ ]]'` 4201 test -n "$cf_missing" && WILDCARD_SYMS=yes 4202 fi 4203 AC_MSG_RESULT($WILDCARD_SYMS) 4204 rm -f conftest.* 4205 fi 4206fi 4207AC_SUBST(RESULTING_SYMS) 4208AC_SUBST(VERSIONED_SYMS) 4209AC_SUBST(WILDCARD_SYMS) 4210])dnl 4211dnl --------------------------------------------------------------------------- 4212dnl CF_WITH_WARNINGS version: 5 updated: 2004/07/23 14:40:34 4213dnl ---------------- 4214dnl Combine the checks for gcc features into a configure-script option 4215dnl 4216dnl Parameters: 4217dnl $1 - see CF_GCC_WARNINGS 4218AC_DEFUN([CF_WITH_WARNINGS], 4219[ 4220if ( test "$GCC" = yes || test "$GXX" = yes ) 4221then 4222AC_MSG_CHECKING(if you want to check for gcc warnings) 4223AC_ARG_WITH(warnings, 4224 [ --with-warnings test: turn on gcc warnings], 4225 [cf_opt_with_warnings=$withval], 4226 [cf_opt_with_warnings=no]) 4227AC_MSG_RESULT($cf_opt_with_warnings) 4228if test "$cf_opt_with_warnings" != no ; then 4229 CF_GCC_ATTRIBUTES 4230 CF_GCC_WARNINGS([$1]) 4231fi 4232fi 4233])dnl 4234dnl --------------------------------------------------------------------------- 4235dnl CF_XOPEN_CURSES version: 13 updated: 2015/12/12 20:59:52 4236dnl --------------- 4237dnl Test if we should define X/Open source for curses, needed on Digital Unix 4238dnl 4.x, to see the extended functions, but breaks on IRIX 6.x. 4239dnl 4240dnl The getbegyx() check is needed for HPUX, which omits legacy macros such 4241dnl as getbegy(). The latter is better design, but the former is standard. 4242AC_DEFUN([CF_XOPEN_CURSES], 4243[ 4244AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl 4245AC_CACHE_CHECK(definition to turn on extended curses functions,cf_cv_need_xopen_extension,[ 4246cf_cv_need_xopen_extension=unknown 4247AC_TRY_LINK([ 4248#include <stdlib.h> 4249#include <${cf_cv_ncurses_header:-curses.h}>],[ 4250#if defined(NCURSES_VERSION_PATCH) 4251#if (NCURSES_VERSION_PATCH < 20100501) && (NCURSES_VERSION_PATCH >= 20100403) 4252 make an error 4253#endif 4254#endif 4255#ifdef NCURSES_VERSION 4256 cchar_t check; 4257 int check2 = curs_set((int)sizeof(check)); 4258#endif 4259 long x = winnstr(stdscr, "", 0); 4260 int x1, y1; 4261 getbegyx(stdscr, y1, x1)], 4262 [cf_cv_need_xopen_extension=none], 4263 [ 4264 for cf_try_xopen_extension in _XOPEN_SOURCE_EXTENDED NCURSES_WIDECHAR 4265 do 4266 AC_TRY_LINK([ 4267#define $cf_try_xopen_extension 1 4268#include <stdlib.h> 4269#include <${cf_cv_ncurses_header:-curses.h}>],[ 4270#ifdef NCURSES_VERSION 4271 cchar_t check; 4272 int check2 = curs_set((int)sizeof(check)); 4273#endif 4274 long x = winnstr(stdscr, "", 0); 4275 int x1, y1; 4276 getbegyx(stdscr, y1, x1)], 4277 [cf_cv_need_xopen_extension=$cf_try_xopen_extension; break]) 4278 done 4279 ]) 4280]) 4281 4282case $cf_cv_need_xopen_extension in 4283(*_*) 4284 CPPFLAGS="$CPPFLAGS -D$cf_cv_need_xopen_extension" 4285 ;; 4286esac 4287 4288])dnl 4289dnl --------------------------------------------------------------------------- 4290dnl CF_XOPEN_SOURCE version: 52 updated: 2016/08/27 12:21:42 4291dnl --------------- 4292dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions, 4293dnl or adapt to the vendor's definitions to get equivalent functionality, 4294dnl without losing the common non-POSIX features. 4295dnl 4296dnl Parameters: 4297dnl $1 is the nominal value for _XOPEN_SOURCE 4298dnl $2 is the nominal value for _POSIX_C_SOURCE 4299AC_DEFUN([CF_XOPEN_SOURCE],[ 4300AC_REQUIRE([AC_CANONICAL_HOST]) 4301 4302cf_XOPEN_SOURCE=ifelse([$1],,500,[$1]) 4303cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2]) 4304cf_xopen_source= 4305 4306case $host_os in 4307(aix[[4-7]]*) 4308 cf_xopen_source="-D_ALL_SOURCE" 4309 ;; 4310(msys) 4311 cf_XOPEN_SOURCE=600 4312 ;; 4313(darwin[[0-8]].*) 4314 cf_xopen_source="-D_APPLE_C_SOURCE" 4315 ;; 4316(darwin*) 4317 cf_xopen_source="-D_DARWIN_C_SOURCE" 4318 cf_XOPEN_SOURCE= 4319 ;; 4320(freebsd*|dragonfly*) 4321 # 5.x headers associate 4322 # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L 4323 # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L 4324 cf_POSIX_C_SOURCE=200112L 4325 cf_XOPEN_SOURCE=600 4326 cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" 4327 ;; 4328(hpux11*) 4329 cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500" 4330 ;; 4331(hpux*) 4332 cf_xopen_source="-D_HPUX_SOURCE" 4333 ;; 4334(irix[[56]].*) 4335 cf_xopen_source="-D_SGI_SOURCE" 4336 cf_XOPEN_SOURCE= 4337 ;; 4338(linux*|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin) 4339 CF_GNU_SOURCE 4340 ;; 4341(minix*) 4342 cf_xopen_source="-D_NETBSD_SOURCE" # POSIX.1-2001 features are ifdef'd with this... 4343 ;; 4344(mirbsd*) 4345 # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <sys/select.h> and other headers which use u_int / u_short types 4346 cf_XOPEN_SOURCE= 4347 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) 4348 ;; 4349(netbsd*) 4350 cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw 4351 ;; 4352(openbsd[[4-9]]*) 4353 # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw 4354 cf_xopen_source="-D_BSD_SOURCE" 4355 cf_XOPEN_SOURCE=600 4356 ;; 4357(openbsd*) 4358 # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw 4359 ;; 4360(osf[[45]]*) 4361 cf_xopen_source="-D_OSF_SOURCE" 4362 ;; 4363(nto-qnx*) 4364 cf_xopen_source="-D_QNX_SOURCE" 4365 ;; 4366(sco*) 4367 # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer 4368 ;; 4369(solaris2.*) 4370 cf_xopen_source="-D__EXTENSIONS__" 4371 cf_cv_xopen_source=broken 4372 ;; 4373(sysv4.2uw2.*) # Novell/SCO UnixWare 2.x (tested on 2.1.2) 4374 cf_XOPEN_SOURCE= 4375 cf_POSIX_C_SOURCE= 4376 ;; 4377(*) 4378 CF_TRY_XOPEN_SOURCE 4379 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) 4380 ;; 4381esac 4382 4383if test -n "$cf_xopen_source" ; then 4384 CF_ADD_CFLAGS($cf_xopen_source,true) 4385fi 4386 4387dnl In anything but the default case, we may have system-specific setting 4388dnl which is still not guaranteed to provide all of the entrypoints that 4389dnl _XOPEN_SOURCE would yield. 4390if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then 4391 AC_MSG_CHECKING(if _XOPEN_SOURCE really is set) 4392 AC_TRY_COMPILE([#include <stdlib.h>],[ 4393#ifndef _XOPEN_SOURCE 4394make an error 4395#endif], 4396 [cf_XOPEN_SOURCE_set=yes], 4397 [cf_XOPEN_SOURCE_set=no]) 4398 AC_MSG_RESULT($cf_XOPEN_SOURCE_set) 4399 if test $cf_XOPEN_SOURCE_set = yes 4400 then 4401 AC_TRY_COMPILE([#include <stdlib.h>],[ 4402#if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE 4403make an error 4404#endif], 4405 [cf_XOPEN_SOURCE_set_ok=yes], 4406 [cf_XOPEN_SOURCE_set_ok=no]) 4407 if test $cf_XOPEN_SOURCE_set_ok = no 4408 then 4409 AC_MSG_WARN(_XOPEN_SOURCE is lower than requested) 4410 fi 4411 else 4412 CF_TRY_XOPEN_SOURCE 4413 fi 4414fi 4415]) 4416dnl --------------------------------------------------------------------------- 4417dnl CF_X_ATHENA version: 23 updated: 2015/04/12 15:39:00 4418dnl ----------- 4419dnl Check for Xaw (Athena) libraries 4420dnl 4421dnl Sets $cf_x_athena according to the flavor of Xaw which is used. 4422AC_DEFUN([CF_X_ATHENA], 4423[ 4424cf_x_athena=${cf_x_athena:-Xaw} 4425 4426AC_MSG_CHECKING(if you want to link with Xaw 3d library) 4427withval= 4428AC_ARG_WITH(Xaw3d, 4429 [ --with-Xaw3d link with Xaw 3d library]) 4430if test "$withval" = yes ; then 4431 cf_x_athena=Xaw3d 4432 AC_MSG_RESULT(yes) 4433else 4434 AC_MSG_RESULT(no) 4435fi 4436 4437AC_MSG_CHECKING(if you want to link with Xaw 3d xft library) 4438withval= 4439AC_ARG_WITH(Xaw3dxft, 4440 [ --with-Xaw3dxft link with Xaw 3d xft library]) 4441if test "$withval" = yes ; then 4442 cf_x_athena=Xaw3dxft 4443 AC_MSG_RESULT(yes) 4444else 4445 AC_MSG_RESULT(no) 4446fi 4447 4448AC_MSG_CHECKING(if you want to link with neXT Athena library) 4449withval= 4450AC_ARG_WITH(neXtaw, 4451 [ --with-neXtaw link with neXT Athena library]) 4452if test "$withval" = yes ; then 4453 cf_x_athena=neXtaw 4454 AC_MSG_RESULT(yes) 4455else 4456 AC_MSG_RESULT(no) 4457fi 4458 4459AC_MSG_CHECKING(if you want to link with Athena-Plus library) 4460withval= 4461AC_ARG_WITH(XawPlus, 4462 [ --with-XawPlus link with Athena-Plus library]) 4463if test "$withval" = yes ; then 4464 cf_x_athena=XawPlus 4465 AC_MSG_RESULT(yes) 4466else 4467 AC_MSG_RESULT(no) 4468fi 4469 4470cf_x_athena_lib="" 4471 4472if test "$PKG_CONFIG" != none ; then 4473 cf_athena_list= 4474 test "$cf_x_athena" = Xaw && cf_athena_list="xaw8 xaw7 xaw6" 4475 for cf_athena_pkg in \ 4476 $cf_athena_list \ 4477 ${cf_x_athena} \ 4478 ${cf_x_athena}-devel \ 4479 lib${cf_x_athena} \ 4480 lib${cf_x_athena}-devel 4481 do 4482 CF_TRY_PKG_CONFIG($cf_athena_pkg,[ 4483 cf_x_athena_lib="$cf_pkgconfig_libs" 4484 CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena) 4485 AC_DEFINE_UNQUOTED($cf_x_athena_LIBS) 4486 4487 CF_TRIM_X_LIBS 4488 4489AC_CACHE_CHECK(for usable $cf_x_athena/Xmu package,cf_cv_xaw_compat,[ 4490AC_TRY_LINK([ 4491#include <X11/Xmu/CharSet.h> 4492],[ 4493int check = XmuCompareISOLatin1("big", "small") 4494],[cf_cv_xaw_compat=yes],[cf_cv_xaw_compat=no])]) 4495 4496 if test "$cf_cv_xaw_compat" = no 4497 then 4498 # workaround for broken ".pc" files... 4499 case "$cf_x_athena_lib" in 4500 (*-lXmu*) 4501 ;; 4502 (*) 4503 CF_VERBOSE(work around broken package) 4504 cf_save_xmu="$LIBS" 4505 cf_first_lib=`echo "$cf_save_xmu" | sed -e 's/^[ ][ ]*//' -e 's/ .*//'` 4506 CF_TRY_PKG_CONFIG(xmu,[ 4507 LIBS="$cf_save_xmu" 4508 CF_ADD_LIB_AFTER($cf_first_lib,$cf_pkgconfig_libs) 4509 ],[ 4510 CF_ADD_LIB_AFTER($cf_first_lib,-lXmu) 4511 ]) 4512 CF_TRIM_X_LIBS 4513 ;; 4514 esac 4515 fi 4516 4517 break]) 4518 done 4519fi 4520 4521if test -z "$cf_x_athena_lib" ; then 4522 CF_X_EXT 4523 CF_X_TOOLKIT 4524 CF_X_ATHENA_CPPFLAGS($cf_x_athena) 4525 CF_X_ATHENA_LIBS($cf_x_athena) 4526fi 4527])dnl 4528dnl --------------------------------------------------------------------------- 4529dnl CF_X_ATHENA_CPPFLAGS version: 5 updated: 2010/05/26 17:35:30 4530dnl -------------------- 4531dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of 4532dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw. 4533AC_DEFUN([CF_X_ATHENA_CPPFLAGS], 4534[ 4535cf_x_athena_root=ifelse([$1],,Xaw,[$1]) 4536cf_x_athena_inc="" 4537 4538for cf_path in default \ 4539 /usr/contrib/X11R6 \ 4540 /usr/contrib/X11R5 \ 4541 /usr/lib/X11R5 \ 4542 /usr/local 4543do 4544 if test -z "$cf_x_athena_inc" ; then 4545 cf_save="$CPPFLAGS" 4546 cf_test=X11/$cf_x_athena_root/SimpleMenu.h 4547 if test $cf_path != default ; then 4548 CPPFLAGS="$cf_save -I$cf_path/include" 4549 AC_MSG_CHECKING(for $cf_test in $cf_path) 4550 else 4551 AC_MSG_CHECKING(for $cf_test) 4552 fi 4553 AC_TRY_COMPILE([ 4554#include <X11/Intrinsic.h> 4555#include <$cf_test>],[], 4556 [cf_result=yes], 4557 [cf_result=no]) 4558 AC_MSG_RESULT($cf_result) 4559 if test "$cf_result" = yes ; then 4560 cf_x_athena_inc=$cf_path 4561 break 4562 else 4563 CPPFLAGS="$cf_save" 4564 fi 4565 fi 4566done 4567 4568if test -z "$cf_x_athena_inc" ; then 4569 AC_MSG_WARN( 4570[Unable to successfully find Athena header files with test program]) 4571elif test "$cf_x_athena_inc" != default ; then 4572 CPPFLAGS="$CPPFLAGS -I$cf_x_athena_inc" 4573fi 4574]) 4575dnl --------------------------------------------------------------------------- 4576dnl CF_X_ATHENA_LIBS version: 12 updated: 2011/07/17 19:55:02 4577dnl ---------------- 4578dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of 4579dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw. 4580AC_DEFUN([CF_X_ATHENA_LIBS], 4581[AC_REQUIRE([CF_X_TOOLKIT]) 4582cf_x_athena_root=ifelse([$1],,Xaw,[$1]) 4583cf_x_athena_lib="" 4584 4585for cf_path in default \ 4586 /usr/contrib/X11R6 \ 4587 /usr/contrib/X11R5 \ 4588 /usr/lib/X11R5 \ 4589 /usr/local 4590do 4591 for cf_lib in \ 4592 ${cf_x_athena_root} \ 4593 ${cf_x_athena_root}7 \ 4594 ${cf_x_athena_root}6 4595 do 4596 for cf_libs in \ 4597 "-l$cf_lib -lXmu" \ 4598 "-l$cf_lib -lXpm -lXmu" \ 4599 "-l${cf_lib}_s -lXmu_s" 4600 do 4601 if test -z "$cf_x_athena_lib" ; then 4602 cf_save="$LIBS" 4603 cf_test=XawSimpleMenuAddGlobalActions 4604 if test $cf_path != default ; then 4605 CF_ADD_LIBS(-L$cf_path/lib $cf_libs) 4606 AC_MSG_CHECKING(for $cf_libs in $cf_path) 4607 else 4608 CF_ADD_LIBS($cf_libs) 4609 AC_MSG_CHECKING(for $cf_test in $cf_libs) 4610 fi 4611 AC_TRY_LINK([ 4612#include <X11/Intrinsic.h> 4613#include <X11/$cf_x_athena_root/SimpleMenu.h> 4614],[ 4615$cf_test((XtAppContext) 0)], 4616 [cf_result=yes], 4617 [cf_result=no]) 4618 AC_MSG_RESULT($cf_result) 4619 if test "$cf_result" = yes ; then 4620 cf_x_athena_lib="$cf_libs" 4621 break 4622 fi 4623 LIBS="$cf_save" 4624 fi 4625 done # cf_libs 4626 test -n "$cf_x_athena_lib" && break 4627 done # cf_lib 4628done 4629 4630if test -z "$cf_x_athena_lib" ; then 4631 AC_MSG_ERROR( 4632[Unable to successfully link Athena library (-l$cf_x_athena_root) with test program]) 4633fi 4634 4635CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena) 4636AC_DEFINE_UNQUOTED($cf_x_athena_LIBS) 4637]) 4638dnl --------------------------------------------------------------------------- 4639dnl CF_X_EXT version: 3 updated: 2010/06/02 05:03:05 4640dnl -------- 4641AC_DEFUN([CF_X_EXT],[ 4642CF_TRY_PKG_CONFIG(Xext,,[ 4643 AC_CHECK_LIB(Xext,XextCreateExtension, 4644 [CF_ADD_LIB(Xext)])]) 4645])dnl 4646dnl --------------------------------------------------------------------------- 4647dnl CF_X_TOOLKIT version: 23 updated: 2015/04/12 15:39:00 4648dnl ------------ 4649dnl Check for X Toolkit libraries 4650AC_DEFUN([CF_X_TOOLKIT], 4651[ 4652AC_REQUIRE([AC_PATH_XTRA]) 4653AC_REQUIRE([CF_CHECK_CACHE]) 4654 4655# OSX is schizoid about who owns /usr/X11 (old) versus /opt/X11 (new), and (and 4656# in some cases has installed dummy files in the former, other cases replaced 4657# it with a link to the new location). This complicates the configure script. 4658# Check for that pitfall, and recover using pkg-config 4659# 4660# If none of these are set, the configuration is almost certainly broken. 4661if test -z "${X_CFLAGS}${X_PRE_LIBS}${X_LIBS}${X_EXTRA_LIBS}" 4662then 4663 CF_TRY_PKG_CONFIG(x11,,[AC_MSG_WARN(unable to find X11 library)]) 4664 CF_TRY_PKG_CONFIG(ice,,[AC_MSG_WARN(unable to find ICE library)]) 4665 CF_TRY_PKG_CONFIG(sm,,[AC_MSG_WARN(unable to find SM library)]) 4666 CF_TRY_PKG_CONFIG(xt,,[AC_MSG_WARN(unable to find Xt library)]) 4667fi 4668 4669cf_have_X_LIBS=no 4670 4671CF_TRY_PKG_CONFIG(xt,[ 4672 4673 case "x$LIBS" in 4674 (*-lX11*) 4675 ;; 4676 (*) 4677# we have an "xt" package, but it may omit Xt's dependency on X11 4678AC_CACHE_CHECK(for usable X dependency,cf_cv_xt_x11_compat,[ 4679AC_TRY_LINK([ 4680#include <X11/Xlib.h> 4681],[ 4682 int rc1 = XDrawLine((Display*) 0, (Drawable) 0, (GC) 0, 0, 0, 0, 0); 4683 int rc2 = XClearWindow((Display*) 0, (Window) 0); 4684 int rc3 = XMoveWindow((Display*) 0, (Window) 0, 0, 0); 4685 int rc4 = XMoveResizeWindow((Display*)0, (Window)0, 0, 0, 0, 0); 4686],[cf_cv_xt_x11_compat=yes],[cf_cv_xt_x11_compat=no])]) 4687 if test "$cf_cv_xt_x11_compat" = no 4688 then 4689 CF_VERBOSE(work around broken X11 dependency) 4690 # 2010/11/19 - good enough until a working Xt on Xcb is delivered. 4691 CF_TRY_PKG_CONFIG(x11,,[CF_ADD_LIB_AFTER(-lXt,-lX11)]) 4692 fi 4693 ;; 4694 esac 4695 4696AC_CACHE_CHECK(for usable X Toolkit package,cf_cv_xt_ice_compat,[ 4697AC_TRY_LINK([ 4698#include <X11/Shell.h> 4699],[int num = IceConnectionNumber(0) 4700],[cf_cv_xt_ice_compat=yes],[cf_cv_xt_ice_compat=no])]) 4701 4702 if test "$cf_cv_xt_ice_compat" = no 4703 then 4704 # workaround for broken ".pc" files used for X Toolkit. 4705 case "x$X_PRE_LIBS" in 4706 (*-lICE*) 4707 case "x$LIBS" in 4708 (*-lICE*) 4709 ;; 4710 (*) 4711 CF_VERBOSE(work around broken ICE dependency) 4712 CF_TRY_PKG_CONFIG(ice, 4713 [CF_TRY_PKG_CONFIG(sm)], 4714 [CF_ADD_LIB_AFTER(-lXt,$X_PRE_LIBS)]) 4715 ;; 4716 esac 4717 ;; 4718 esac 4719 fi 4720 4721 cf_have_X_LIBS=yes 4722],[ 4723 4724 LDFLAGS="$X_LIBS $LDFLAGS" 4725 CF_CHECK_CFLAGS($X_CFLAGS) 4726 4727 AC_CHECK_FUNC(XOpenDisplay,,[ 4728 AC_CHECK_LIB(X11,XOpenDisplay, 4729 [CF_ADD_LIB(X11)],, 4730 [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])]) 4731 4732 AC_CHECK_FUNC(XtAppInitialize,,[ 4733 AC_CHECK_LIB(Xt, XtAppInitialize, 4734 [AC_DEFINE(HAVE_LIBXT,1,[Define to 1 if we can compile with the Xt library]) 4735 cf_have_X_LIBS=Xt 4736 LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS"],, 4737 [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])]) 4738]) 4739 4740if test $cf_have_X_LIBS = no ; then 4741 AC_MSG_WARN( 4742[Unable to successfully link X Toolkit library (-lXt) with 4743test program. You will have to check and add the proper libraries by hand 4744to makefile.]) 4745fi 4746])dnl 4747dnl --------------------------------------------------------------------------- 4748dnl CF__ADD_SHLIB_RULES version: 6 updated: 2016/04/21 21:07:50 4749dnl ------------------- 4750dnl Append rules for creating, installing, uninstalling and cleaning library. 4751dnl In particular, this is needed for shared libraries since there are symbolic 4752dnl links which depend on configuration choices. 4753dnl 4754dnl The logic is controlled by these cache variables: 4755dnl $cf_cv_do_symlinks 4756dnl $cf_cv_shlib_version 4757dnl 4758dnl The macro uses variables set by CF__DEFINE_SHLIB_VARS 4759dnl 4760dnl $1 = makefile to append to 4761dnl $2 = model (static, shared, libtool) 4762dnl $3 = objects (dependencies) 4763dnl $4 = additional libraries needed to link the shared library 4764define([CF__ADD_SHLIB_RULES],[ 4765 4766CF__DEFINE_LIB_TARGET 4767 4768case x$2 in 4769(xlibtool|xshared) 4770 cf_libdeps="ifelse($4,,,[$4])" 4771 ;; 4772(x*) 4773 cf_libdeps= 4774 ;; 4775esac 4776 4777cat >>$1 <<CF_EOF 4778 4779# generated by CF__ADD_SHLIB_RULES 4780# libmodel: $2 4781# symlinks: $cf_cv_do_symlinks 4782# shlibver: $cf_cv_shlib_version 4783 4784CF_EOF 4785 4786cat >>$1 <<CF_EOF 4787$cf_libname :: \\ 4788CF_EOF 4789 4790cat >>$1 <<CF_EOF 4791 $3 4792 @echo linking \[$]@ 4793 \$(LIBTOOL_CREATE) $3 $cf_libdeps 4794CF_EOF 4795 4796if test "x$cf_cv_do_symlinks" = xyes 4797then 4798cat >>$1 <<CF_EOF 4799 \$(LN_S) $cf_libname $cf_liblink 4800 \$(LN_S) $cf_liblink $cf_libroot 4801CF_EOF 4802fi 4803 4804cat >>$1 <<CF_EOF 4805 4806install \\ 4807install.libs :: \$(DESTDIR)\$(libdir)/$cf_libname 4808 4809\$(DESTDIR)\$(libdir)/$cf_libname :: \\ 4810 \$(DESTDIR)\$(libdir) \\ 4811 $3 4812 @echo linking \[$]@ 4813 \$(LIBTOOL_CREATE) $3 $cf_libdeps 4814CF_EOF 4815 4816if test "x$cf_cv_do_symlinks" = xyes 4817then 4818cat >>$1 <<CF_EOF 4819 cd \$(DESTDIR)\$(libdir) && (\$(LN_S) $cf_libname $cf_liblink; \$(LN_S) $cf_liblink $cf_libroot; ) 4820CF_EOF 4821fi 4822 4823if test x$2 = xshared 4824then 4825cat >>$1 <<CF_EOF 4826 - \$(SHELL) -c "if test -z "\$(DESTDIR)" ; then /sbin/ldconfig; fi" 4827CF_EOF 4828fi 4829 4830cat >>$1 <<CF_EOF 4831 4832uninstall \\ 4833uninstall.libs :: 4834 @echo uninstalling \$(DESTDIR)\$(libdir)/$cf_libname 4835CF_EOF 4836 4837if test "x$cf_cv_do_symlinks" = xyes 4838then 4839cat >>$1 <<CF_EOF 4840 -rm -f \$(DESTDIR)\$(libdir)/$cf_libroot 4841 -rm -f \$(DESTDIR)\$(libdir)/$cf_liblink 4842CF_EOF 4843fi 4844 4845cat >>$1 <<CF_EOF 4846 -rm -f \$(DESTDIR)\$(libdir)/$cf_libname 4847 4848clean \\ 4849clean.libs :: 4850CF_EOF 4851 4852if test "x$cf_cv_do_symlinks" = xyes 4853then 4854cat >>$1 <<CF_EOF 4855 -rm -f $cf_libroot 4856 -rm -f $cf_liblink 4857CF_EOF 4858fi 4859 4860cat >>$1 <<CF_EOF 4861 -rm -f $cf_libname 4862 4863mostlyclean:: 4864 -rm -f $3 4865# end generated by CF__ADD_SHLIB_RULES 4866CF_EOF 4867])dnl 4868dnl --------------------------------------------------------------------------- 4869dnl CF__CURSES_HEAD version: 2 updated: 2010/10/23 15:54:49 4870dnl --------------- 4871dnl Define a reusable chunk which includes <curses.h> and <term.h> when they 4872dnl are both available. 4873define([CF__CURSES_HEAD],[ 4874#ifdef HAVE_XCURSES 4875#include <xcurses.h> 4876char * XCursesProgramName = "test"; 4877#else 4878#include <${cf_cv_ncurses_header:-curses.h}> 4879#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H) 4880#include <ncursesw/term.h> 4881#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H) 4882#include <ncurses/term.h> 4883#elif defined(HAVE_TERM_H) 4884#include <term.h> 4885#endif 4886#endif 4887]) 4888dnl --------------------------------------------------------------------------- 4889dnl CF__DEFINE_LIB_TARGET version: 2 updated: 2015/05/10 19:52:14 4890dnl --------------------- 4891define([CF__DEFINE_LIB_TARGET],[ 4892cf_libname=\${LIB_BASENAME} 4893cf_liblink=$cf_libname 4894cf_libroot=$cf_libname 4895 4896if test "x$cf_cv_do_symlinks" = xyes 4897then 4898 case "x$cf_cv_shlib_version" in 4899 (xrel) 4900 cf_liblink="\${LIB_ABI_NAME}" 4901 cf_libname="\${LIB_REL_NAME}" 4902 ;; 4903 (xabi) 4904 cf_liblink="\${LIB_REL_NAME}" 4905 cf_libname="\${LIB_ABI_NAME}" 4906 ;; 4907 esac 4908fi 4909LIB_TARGET=$cf_libname 4910])dnl 4911dnl --------------------------------------------------------------------------- 4912dnl CF__DEFINE_SHLIB_VARS version: 4 updated: 2015/09/28 17:49:10 4913dnl --------------------- 4914dnl Substitute makefile variables useful for CF__ADD_SHLIB_RULES. 4915dnl 4916dnl The substitution requires these variables: 4917dnl LIB_PREFIX - "lib" 4918dnl LIB_ROOTNAME - "foo" 4919dnl LIB_SUFFIX - ".so" 4920dnl REL_VERSION - "5.0" 4921dnl ABI_VERSION - "4.2.4" 4922define([CF__DEFINE_SHLIB_VARS],[ 4923CF__DEFINE_LIB_TARGET 4924SET_SHLIB_VARS="# begin CF__DEFINE_SHLIB_VARS\\ 4925LIB_BASENAME = \${LIB_PREFIX}\${LIB_ROOTNAME}\${LIB_SUFFIX}\\ 4926LIB_REL_NAME = \${LIB_BASENAME}.\${REL_VERSION}\\ 4927LIB_ABI_NAME = \${LIB_BASENAME}.\${ABI_VERSION}\\ 4928LIB_TARGET = $LIB_TARGET\\ 4929RM_SHARED_OPTS = $RM_SHARED_OPTS\\ 4930# end CF__DEFINE_SHLIB_VARS" 4931AC_SUBST(SET_SHLIB_VARS) 4932AC_SUBST(LIB_TARGET) 4933])dnl 4934dnl --------------------------------------------------------------------------- 4935dnl CF__INIT_SHLIB_RULES version: 2 updated: 2013/07/27 17:38:32 4936dnl -------------------- 4937dnl The third parameter to AC_OUTPUT, used to pass variables needed for 4938dnl CF__ADD_SHLIB_RULES. 4939define([CF__INIT_SHLIB_RULES],[ 4940ABI_VERSION="$ABI_VERSION" 4941REL_VERSION="$REL_VERSION" 4942LIB_MODEL="$LIB_MODEL" 4943LIB_PREFIX="$LIB_PREFIX" 4944LIB_ROOTNAME="$LIB_ROOTNAME" 4945DFT_DEP_SUFFIX="$DFT_DEP_SUFFIX" 4946RM_SHARED_OPTS="$RM_SHARED_OPTS" 4947cf_cv_do_symlinks="$cf_cv_do_symlinks" 4948cf_cv_shlib_version="$cf_cv_shlib_version" 4949]) 4950