aclocal.m4 revision 224014
1217309Snwhitehorndnl macros used for DIALOG configure script 2224014Snwhitehorndnl $Id: aclocal.m4,v 1.82 2011/06/28 22:48:31 tom Exp $ 3220749Snwhitehorndnl --------------------------------------------------------------------------- 4220749Snwhitehorndnl Copyright 1999-2010,2011 -- Thomas E. Dickey 5217309Snwhitehorndnl 6220749Snwhitehorndnl Permission is hereby granted, free of charge, to any person obtaining a 7220749Snwhitehorndnl copy of this software and associated documentation files (the 8220749Snwhitehorndnl "Software"), to deal in the Software without restriction, including 9220749Snwhitehorndnl without limitation the rights to use, copy, modify, merge, publish, 10220749Snwhitehorndnl distribute, distribute with modifications, sublicense, and/or sell 11220749Snwhitehorndnl copies of the Software, and to permit persons to whom the Software is 12220749Snwhitehorndnl furnished to do so, subject to the following conditions: 13220749Snwhitehorndnl 14220749Snwhitehorndnl The above copyright notice and this permission notice shall be included 15220749Snwhitehorndnl in all copies or portions of the Software. 16220749Snwhitehorndnl 17220749Snwhitehorndnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 18220749Snwhitehorndnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19220749Snwhitehorndnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20220749Snwhitehorndnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 21220749Snwhitehorndnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 22220749Snwhitehorndnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR 23220749Snwhitehorndnl THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24220749Snwhitehorndnl 25220749Snwhitehorndnl Except as contained in this notice, the name(s) of the above copyright 26220749Snwhitehorndnl holders shall not be used in advertising or otherwise to promote the 27220749Snwhitehorndnl sale, use or other dealings in this Software without prior written 28220749Snwhitehorndnl authorization. 29220749Snwhitehorndnl 30217309Snwhitehorndnl see 31217309Snwhitehorndnl http://invisible-island.net/autoconf/ 32217309Snwhitehorndnl --------------------------------------------------------------------------- 33217309Snwhitehorndnl --------------------------------------------------------------------------- 34220749Snwhitehorndnl AM_GNU_GETTEXT version: 12 updated: 2010/06/19 07:02:11 35217309Snwhitehorndnl -------------- 36217309Snwhitehorndnl Usage: Just like AM_WITH_NLS, which see. 37217309SnwhitehornAC_DEFUN([AM_GNU_GETTEXT], 38217309Snwhitehorn [AC_REQUIRE([AC_PROG_MAKE_SET])dnl 39217309Snwhitehorn AC_REQUIRE([AC_PROG_CC])dnl 40217309Snwhitehorn AC_REQUIRE([AC_CANONICAL_HOST])dnl 41217309Snwhitehorn AC_REQUIRE([AC_PROG_RANLIB])dnl 42217309Snwhitehorn AC_REQUIRE([AC_ISC_POSIX])dnl 43217309Snwhitehorn AC_REQUIRE([AC_HEADER_STDC])dnl 44217309Snwhitehorn AC_REQUIRE([AC_C_CONST])dnl 45217309Snwhitehorn AC_REQUIRE([AC_C_INLINE])dnl 46217309Snwhitehorn AC_REQUIRE([AC_TYPE_OFF_T])dnl 47217309Snwhitehorn AC_REQUIRE([AC_TYPE_SIZE_T])dnl 48217309Snwhitehorn AC_REQUIRE([AC_FUNC_ALLOCA])dnl 49217309Snwhitehorn AC_REQUIRE([AC_FUNC_MMAP])dnl 50217309Snwhitehorn AC_REQUIRE([jm_GLIBC21])dnl 51217309Snwhitehorn 52217309Snwhitehorn AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ 53217309Snwhitehornstdlib.h string.h unistd.h sys/param.h]) 54217309Snwhitehorn AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \ 55217309Snwhitehorngetgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \ 56217309Snwhitehornstrdup strtoul tsearch __argz_count __argz_stringify __argz_next]) 57217309Snwhitehorn 58217309Snwhitehorn AM_ICONV 59217309Snwhitehorn AM_LANGINFO_CODESET 60217309Snwhitehorn AM_LC_MESSAGES 61217309Snwhitehorn AM_WITH_NLS([$1],[$2],[$3],[$4]) 62217309Snwhitehorn 63217309Snwhitehorn if test "x$CATOBJEXT" != "x"; then 64217309Snwhitehorn if test "x$ALL_LINGUAS" = "x"; then 65217309Snwhitehorn LINGUAS= 66217309Snwhitehorn else 67217309Snwhitehorn AC_MSG_CHECKING(for catalogs to be installed) 68217309Snwhitehorn NEW_LINGUAS= 69217309Snwhitehorn for presentlang in $ALL_LINGUAS; do 70217309Snwhitehorn useit=no 71217309Snwhitehorn for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do 72217309Snwhitehorn # Use the presentlang catalog if desiredlang is 73217309Snwhitehorn # a. equal to presentlang, or 74217309Snwhitehorn # b. a variant of presentlang (because in this case, 75217309Snwhitehorn # presentlang can be used as a fallback for messages 76217309Snwhitehorn # which are not translated in the desiredlang catalog). 77217309Snwhitehorn case "$desiredlang" in 78217309Snwhitehorn "$presentlang"*) useit=yes;; 79217309Snwhitehorn esac 80217309Snwhitehorn done 81217309Snwhitehorn if test $useit = yes; then 82217309Snwhitehorn NEW_LINGUAS="$NEW_LINGUAS $presentlang" 83217309Snwhitehorn fi 84217309Snwhitehorn done 85217309Snwhitehorn LINGUAS=$NEW_LINGUAS 86217309Snwhitehorn AC_MSG_RESULT($LINGUAS) 87217309Snwhitehorn fi 88217309Snwhitehorn 89217309Snwhitehorn dnl Construct list of names of catalog files to be constructed. 90217309Snwhitehorn if test -n "$LINGUAS"; then 91217309Snwhitehorn for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done 92217309Snwhitehorn fi 93217309Snwhitehorn fi 94217309Snwhitehorn 95217309Snwhitehorn dnl Enable libtool support if the surrounding package wishes it. 96217309Snwhitehorn INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], []) 97217309Snwhitehorn AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) 98217309Snwhitehorn])dnl 99217309Snwhitehorndnl --------------------------------------------------------------------------- 100217309Snwhitehorndnl AM_ICONV version: 12 updated: 2007/07/30 19:12:03 101217309Snwhitehorndnl -------- 102217309Snwhitehorndnl Inserted as requested by gettext 0.10.40 103217309Snwhitehorndnl File from /usr/share/aclocal 104217309Snwhitehorndnl iconv.m4 105217309Snwhitehorndnl ==================== 106217309Snwhitehorndnl serial AM2 107217309Snwhitehorndnl 108217309Snwhitehorndnl From Bruno Haible. 109217309Snwhitehorndnl 110217309Snwhitehorndnl ==================== 111217309Snwhitehorndnl Modified to use CF_FIND_LINKAGE and CF_ADD_SEARCHPATH, to broaden the 112217309Snwhitehorndnl range of locations searched. Retain the same cache-variable naming to 113217309Snwhitehorndnl allow reuse with the other gettext macros -Thomas E Dickey 114217309SnwhitehornAC_DEFUN([AM_ICONV], 115217309Snwhitehorn[ 116217309Snwhitehorn dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and 117217309Snwhitehorn dnl those with the standalone portable GNU libiconv installed). 118217309Snwhitehorn 119217309Snwhitehorn AC_ARG_WITH([libiconv-prefix], 120217309Snwhitehorn[ --with-libiconv-prefix=DIR 121217309Snwhitehorn search for libiconv in DIR/include and DIR/lib], [ 122217309Snwhitehorn CF_ADD_OPTIONAL_PATH($withval, libiconv) 123217309Snwhitehorn ]) 124217309Snwhitehorn 125217309Snwhitehorn AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ 126217309Snwhitehorn CF_FIND_LINKAGE(CF__ICONV_HEAD, 127217309Snwhitehorn CF__ICONV_BODY, 128217309Snwhitehorn iconv, 129217309Snwhitehorn am_cv_func_iconv=yes, 130217309Snwhitehorn am_cv_func_iconv=["no, consider installing GNU libiconv"])]) 131217309Snwhitehorn 132217309Snwhitehorn if test "$am_cv_func_iconv" = yes; then 133217309Snwhitehorn AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) 134217309Snwhitehorn 135217309Snwhitehorn AC_CACHE_CHECK([if the declaration of iconv() needs const.], 136217309Snwhitehorn am_cv_proto_iconv_const,[ 137217309Snwhitehorn AC_TRY_COMPILE(CF__ICONV_HEAD [ 138217309Snwhitehornextern 139217309Snwhitehorn#ifdef __cplusplus 140217309Snwhitehorn"C" 141217309Snwhitehorn#endif 142217309Snwhitehorn#if defined(__STDC__) || defined(__cplusplus) 143217309Snwhitehornsize_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); 144217309Snwhitehorn#else 145217309Snwhitehornsize_t iconv(); 146217309Snwhitehorn#endif 147217309Snwhitehorn],[], am_cv_proto_iconv_const=no, 148217309Snwhitehorn am_cv_proto_iconv_const=yes)]) 149217309Snwhitehorn 150217309Snwhitehorn if test "$am_cv_proto_iconv_const" = yes ; then 151217309Snwhitehorn am_cv_proto_iconv_arg1="const" 152217309Snwhitehorn else 153217309Snwhitehorn am_cv_proto_iconv_arg1="" 154217309Snwhitehorn fi 155217309Snwhitehorn 156217309Snwhitehorn AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, 157217309Snwhitehorn [Define as const if the declaration of iconv() needs const.]) 158217309Snwhitehorn fi 159217309Snwhitehorn 160217309Snwhitehorn LIBICONV= 161217309Snwhitehorn if test "$cf_cv_find_linkage_iconv" = yes; then 162217309Snwhitehorn CF_ADD_INCDIR($cf_cv_header_path_iconv) 163217309Snwhitehorn if test -n "$cf_cv_library_file_iconv" ; then 164217309Snwhitehorn LIBICONV="-liconv" 165217309Snwhitehorn CF_ADD_LIBDIR($cf_cv_library_path_iconv) 166217309Snwhitehorn fi 167217309Snwhitehorn fi 168217309Snwhitehorn 169217309Snwhitehorn AC_SUBST(LIBICONV) 170217309Snwhitehorn])dnl 171217309Snwhitehorndnl --------------------------------------------------------------------------- 172217309Snwhitehorndnl AM_LANGINFO_CODESET version: 3 updated: 2002/10/27 23:21:42 173217309Snwhitehorndnl ------------------- 174217309Snwhitehorndnl Inserted as requested by gettext 0.10.40 175217309Snwhitehorndnl File from /usr/share/aclocal 176217309Snwhitehorndnl codeset.m4 177217309Snwhitehorndnl ==================== 178217309Snwhitehorndnl serial AM1 179217309Snwhitehorndnl 180217309Snwhitehorndnl From Bruno Haible. 181217309SnwhitehornAC_DEFUN([AM_LANGINFO_CODESET], 182217309Snwhitehorn[ 183217309Snwhitehorn AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, 184217309Snwhitehorn [AC_TRY_LINK([#include <langinfo.h>], 185217309Snwhitehorn [char* cs = nl_langinfo(CODESET);], 186217309Snwhitehorn am_cv_langinfo_codeset=yes, 187217309Snwhitehorn am_cv_langinfo_codeset=no) 188217309Snwhitehorn ]) 189217309Snwhitehorn if test $am_cv_langinfo_codeset = yes; then 190217309Snwhitehorn AC_DEFINE(HAVE_LANGINFO_CODESET, 1, 191217309Snwhitehorn [Define if you have <langinfo.h> and nl_langinfo(CODESET).]) 192217309Snwhitehorn fi 193217309Snwhitehorn])dnl 194217309Snwhitehorndnl --------------------------------------------------------------------------- 195217309Snwhitehorndnl AM_LC_MESSAGES version: 4 updated: 2002/10/27 23:21:42 196217309Snwhitehorndnl -------------- 197217309Snwhitehorndnl Inserted as requested by gettext 0.10.40 198217309Snwhitehorndnl File from /usr/share/aclocal 199217309Snwhitehorndnl lcmessage.m4 200217309Snwhitehorndnl ==================== 201217309Snwhitehorndnl Check whether LC_MESSAGES is available in <locale.h>. 202217309Snwhitehorndnl Ulrich Drepper <drepper@cygnus.com>, 1995. 203217309Snwhitehorndnl 204217309Snwhitehorndnl This file can be copied and used freely without restrictions. It can 205217309Snwhitehorndnl be used in projects which are not available under the GNU General Public 206217309Snwhitehorndnl License or the GNU Library General Public License but which still want 207217309Snwhitehorndnl to provide support for the GNU gettext functionality. 208217309Snwhitehorndnl Please note that the actual code of the GNU gettext library is covered 209217309Snwhitehorndnl by the GNU Library General Public License, and the rest of the GNU 210217309Snwhitehorndnl gettext package package is covered by the GNU General Public License. 211217309Snwhitehorndnl They are *not* in the public domain. 212217309Snwhitehorndnl 213217309Snwhitehorndnl serial 2 214217309Snwhitehorndnl 215217309SnwhitehornAC_DEFUN([AM_LC_MESSAGES], 216217309Snwhitehorn [if test $ac_cv_header_locale_h = yes; then 217217309Snwhitehorn AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, 218217309Snwhitehorn [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES], 219217309Snwhitehorn am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) 220217309Snwhitehorn if test $am_cv_val_LC_MESSAGES = yes; then 221217309Snwhitehorn AC_DEFINE(HAVE_LC_MESSAGES, 1, 222217309Snwhitehorn [Define if your <locale.h> file defines LC_MESSAGES.]) 223217309Snwhitehorn fi 224217309Snwhitehorn fi])dnl 225217309Snwhitehorndnl --------------------------------------------------------------------------- 226217309Snwhitehorndnl AM_PATH_PROG_WITH_TEST version: 8 updated: 2009/01/11 20:31:12 227217309Snwhitehorndnl ---------------------- 228217309Snwhitehorndnl Inserted as requested by gettext 0.10.40 229217309Snwhitehorndnl File from /usr/share/aclocal 230217309Snwhitehorndnl progtest.m4 231217309Snwhitehorndnl ==================== 232217309Snwhitehorndnl Search path for a program which passes the given test. 233217309Snwhitehorndnl Ulrich Drepper <drepper@cygnus.com>, 1996. 234217309Snwhitehorndnl 235217309Snwhitehorndnl This file can be copied and used freely without restrictions. It can 236217309Snwhitehorndnl be used in projects which are not available under the GNU General Public 237217309Snwhitehorndnl License or the GNU Library General Public License but which still want 238217309Snwhitehorndnl to provide support for the GNU gettext functionality. 239217309Snwhitehorndnl Please note that the actual code of the GNU gettext library is covered 240217309Snwhitehorndnl by the GNU Library General Public License, and the rest of the GNU 241217309Snwhitehorndnl gettext package package is covered by the GNU General Public License. 242217309Snwhitehorndnl They are *not* in the public domain. 243217309Snwhitehorndnl 244217309Snwhitehorndnl serial 2 245217309Snwhitehorndnl 246217309Snwhitehorndnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, 247217309Snwhitehorndnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) 248217309SnwhitehornAC_DEFUN([AM_PATH_PROG_WITH_TEST], 249217309Snwhitehorn[# Extract the first word of "$2", so it can be a program name with args. 250217309SnwhitehornAC_REQUIRE([CF_PATHSEP]) 251217309Snwhitehornset dummy $2; ac_word=[$]2 252217309SnwhitehornAC_MSG_CHECKING([for $ac_word]) 253217309SnwhitehornAC_CACHE_VAL(ac_cv_path_$1, 254217309Snwhitehorn[case "[$]$1" in 255217309Snwhitehorn [[\\/]*|?:[\\/]]*) 256217309Snwhitehorn ac_cv_path_$1="[$]$1" # Let the user override the test with a path. 257217309Snwhitehorn ;; 258217309Snwhitehorn *) 259217309Snwhitehorn IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" 260217309Snwhitehorn for ac_dir in ifelse([$5], , $PATH, [$5]); do 261217309Snwhitehorn test -z "$ac_dir" && ac_dir=. 262217309Snwhitehorn if test -f $ac_dir/$ac_word$ac_exeext; then 263217309Snwhitehorn if [$3]; then 264217309Snwhitehorn ac_cv_path_$1="$ac_dir/$ac_word$ac_exeext" 265217309Snwhitehorn break 266217309Snwhitehorn fi 267217309Snwhitehorn fi 268217309Snwhitehorn done 269217309Snwhitehorn IFS="$ac_save_ifs" 270217309Snwhitehorndnl If no 4th arg is given, leave the cache variable unset, 271217309Snwhitehorndnl so AC_PATH_PROGS will keep looking. 272217309Snwhitehornifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" 273217309Snwhitehorn])dnl 274217309Snwhitehorn ;; 275217309Snwhitehornesac])dnl 276217309Snwhitehorn$1="$ac_cv_path_$1" 277217309Snwhitehornif test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then 278217309Snwhitehorn AC_MSG_RESULT([$]$1) 279217309Snwhitehornelse 280217309Snwhitehorn AC_MSG_RESULT(no) 281217309Snwhitehornfi 282217309SnwhitehornAC_SUBST($1)dnl 283217309Snwhitehorn])dnl 284217309Snwhitehorndnl --------------------------------------------------------------------------- 285220749Snwhitehorndnl AM_WITH_NLS version: 24 updated: 2010/06/20 09:24:28 286217309Snwhitehorndnl ----------- 287217309Snwhitehorndnl Inserted as requested by gettext 0.10.40 288217309Snwhitehorndnl File from /usr/share/aclocal 289217309Snwhitehorndnl gettext.m4 290217309Snwhitehorndnl ==================== 291217309Snwhitehorndnl Macro to add for using GNU gettext. 292217309Snwhitehorndnl Ulrich Drepper <drepper@cygnus.com>, 1995. 293217309Snwhitehorndnl ==================== 294217309Snwhitehorndnl Modified to use CF_FIND_LINKAGE and CF_ADD_SEARCHPATH, to broaden the 295217309Snwhitehorndnl range of locations searched. Retain the same cache-variable naming to 296217309Snwhitehorndnl allow reuse with the other gettext macros -Thomas E Dickey 297217309Snwhitehorndnl ==================== 298217309Snwhitehorndnl 299217309Snwhitehorndnl This file can be copied and used freely without restrictions. It can 300217309Snwhitehorndnl be used in projects which are not available under the GNU General Public 301217309Snwhitehorndnl License or the GNU Library General Public License but which still want 302217309Snwhitehorndnl to provide support for the GNU gettext functionality. 303217309Snwhitehorndnl Please note that the actual code of the GNU gettext library is covered 304217309Snwhitehorndnl by the GNU Library General Public License, and the rest of the GNU 305217309Snwhitehorndnl gettext package package is covered by the GNU General Public License. 306217309Snwhitehorndnl They are *not* in the public domain. 307217309Snwhitehorndnl 308217309Snwhitehorndnl serial 10 309217309Snwhitehorndnl 310217309Snwhitehorndnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR], [ENABLED]). 311217309Snwhitehorndnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library 312217309Snwhitehorndnl $(top_builddir)/intl/libintl.la will be created (shared and/or static, 313217309Snwhitehorndnl depending on --{enable,disable}-{shared,static} and on the presence of 314217309Snwhitehorndnl AM-DISABLE-SHARED). Otherwise, a static library 315217309Snwhitehorndnl $(top_builddir)/intl/libintl.a will be created. 316217309Snwhitehorndnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext 317217309Snwhitehorndnl implementations (in libc or libintl) without the ngettext() function 318217309Snwhitehorndnl will be ignored. 319217309Snwhitehorndnl LIBDIR is used to find the intl libraries. If empty, 320217309Snwhitehorndnl the value `$(top_builddir)/intl/' is used. 321217309Snwhitehorndnl ENABLED is used to control the default for the related --enable-nls, since 322217309Snwhitehorndnl not all application developers want this feature by default, e.g., lynx. 323217309Snwhitehorndnl 324217309Snwhitehorndnl The result of the configuration is one of three cases: 325217309Snwhitehorndnl 1) GNU gettext, as included in the intl subdirectory, will be compiled 326217309Snwhitehorndnl and used. 327217309Snwhitehorndnl Catalog format: GNU --> install in $(datadir) 328217309Snwhitehorndnl Catalog extension: .mo after installation, .gmo in source tree 329217309Snwhitehorndnl 2) GNU gettext has been found in the system's C library. 330217309Snwhitehorndnl Catalog format: GNU --> install in $(datadir) 331217309Snwhitehorndnl Catalog extension: .mo after installation, .gmo in source tree 332217309Snwhitehorndnl 3) No internationalization, always use English msgid. 333217309Snwhitehorndnl Catalog format: none 334217309Snwhitehorndnl Catalog extension: none 335217309Snwhitehorndnl The use of .gmo is historical (it was needed to avoid overwriting the 336217309Snwhitehorndnl GNU format catalogs when building on a platform with an X/Open gettext), 337217309Snwhitehorndnl but we keep it in order not to force irrelevant filename changes on the 338217309Snwhitehorndnl maintainers. 339217309Snwhitehorndnl 340217309SnwhitehornAC_DEFUN([AM_WITH_NLS], 341217309Snwhitehorn[AC_MSG_CHECKING([whether NLS is requested]) 342217309Snwhitehorn dnl Default is enabled NLS 343217309Snwhitehorn ifelse([$4],,[ 344217309Snwhitehorn AC_ARG_ENABLE(nls, 345217309Snwhitehorn [ --disable-nls do not use Native Language Support], 346217309Snwhitehorn USE_NLS=$enableval, USE_NLS=yes)],[ 347217309Snwhitehorn AC_ARG_ENABLE(nls, 348217309Snwhitehorn [ --enable-nls use Native Language Support], 349217309Snwhitehorn USE_NLS=$enableval, USE_NLS=no)]) 350217309Snwhitehorn AC_MSG_RESULT($USE_NLS) 351217309Snwhitehorn AC_SUBST(USE_NLS) 352217309Snwhitehorn 353217309Snwhitehorn BUILD_INCLUDED_LIBINTL=no 354217309Snwhitehorn USE_INCLUDED_LIBINTL=no 355217309Snwhitehorn INTLLIBS= 356217309Snwhitehorn 357217309Snwhitehorn dnl If we use NLS figure out what method 358217309Snwhitehorn if test "$USE_NLS" = "yes"; then 359217309Snwhitehorn AC_DEFINE(ENABLE_NLS, 1, 360217309Snwhitehorn [Define to 1 if translation of program messages to the user's native language 361217309Snwhitehorn is requested.]) 362217309Snwhitehorn AC_MSG_CHECKING([whether included gettext is requested]) 363217309Snwhitehorn AC_ARG_WITH(included-gettext, 364217309Snwhitehorn [ --with-included-gettext use the GNU gettext library included here], 365217309Snwhitehorn nls_cv_force_use_gnu_gettext=$withval, 366217309Snwhitehorn nls_cv_force_use_gnu_gettext=no) 367217309Snwhitehorn AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) 368217309Snwhitehorn 369217309Snwhitehorn nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" 370217309Snwhitehorn if test "$nls_cv_force_use_gnu_gettext" != "yes"; then 371217309Snwhitehorn dnl User does not insist on using GNU NLS library. Figure out what 372217309Snwhitehorn dnl to use. If GNU gettext is available we use this. Else we have 373217309Snwhitehorn dnl to fall back to GNU NLS library. 374217309Snwhitehorn CATOBJEXT=NONE 375217309Snwhitehorn 376217309Snwhitehorn cf_save_LIBS_1="$LIBS" 377220749Snwhitehorn CF_ADD_LIBS($LIBICONV) 378217309Snwhitehorn AC_CACHE_CHECK([for libintl.h and gettext()], cf_cv_func_gettext,[ 379217309Snwhitehorn CF_FIND_LINKAGE(CF__INTL_HEAD, 380217309Snwhitehorn CF__INTL_BODY, 381217309Snwhitehorn intl, 382217309Snwhitehorn cf_cv_func_gettext=yes, 383217309Snwhitehorn cf_cv_func_gettext=no) 384217309Snwhitehorn ]) 385217309Snwhitehorn LIBS="$cf_save_LIBS_1" 386217309Snwhitehorn 387217309Snwhitehorn if test "$cf_cv_func_gettext" = yes ; then 388217309Snwhitehorn AC_DEFINE(HAVE_LIBINTL_H) 389217309Snwhitehorn 390217309Snwhitehorn dnl If an already present or preinstalled GNU gettext() is found, 391217309Snwhitehorn dnl use it. But if this macro is used in GNU gettext, and GNU 392217309Snwhitehorn dnl gettext is already preinstalled in libintl, we update this 393217309Snwhitehorn dnl libintl. (Cf. the install rule in intl/Makefile.in.) 394217309Snwhitehorn if test "$PACKAGE" != gettext; then 395217309Snwhitehorn AC_DEFINE(HAVE_GETTEXT, 1, 396217309Snwhitehorn [Define if the GNU gettext() function is already present or preinstalled.]) 397217309Snwhitehorn 398217309Snwhitehorn CF_ADD_INCDIR($cf_cv_header_path_intl) 399217309Snwhitehorn 400217309Snwhitehorn if test -n "$cf_cv_library_file_intl" ; then 401217309Snwhitehorn dnl If iconv() is in a separate libiconv library, then anyone 402217309Snwhitehorn dnl linking with libintl{.a,.so} also needs to link with 403217309Snwhitehorn dnl libiconv. 404217309Snwhitehorn INTLLIBS="$cf_cv_library_file_intl $LIBICONV" 405217309Snwhitehorn CF_ADD_LIBDIR($cf_cv_library_path_intl,INTLLIBS) 406217309Snwhitehorn fi 407217309Snwhitehorn 408217309Snwhitehorn gt_save_LIBS="$LIBS" 409217309Snwhitehorn LIBS="$LIBS $INTLLIBS" 410217309Snwhitehorn AC_CHECK_FUNCS(dcgettext) 411217309Snwhitehorn LIBS="$gt_save_LIBS" 412217309Snwhitehorn 413217309Snwhitehorn dnl Search for GNU msgfmt in the PATH. 414217309Snwhitehorn AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, 415217309Snwhitehorn [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :) 416217309Snwhitehorn AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) 417217309Snwhitehorn 418217309Snwhitehorn dnl Search for GNU xgettext in the PATH. 419217309Snwhitehorn AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, 420217309Snwhitehorn [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :) 421217309Snwhitehorn 422217309Snwhitehorn CATOBJEXT=.gmo 423217309Snwhitehorn fi 424217309Snwhitehorn fi 425217309Snwhitehorn 426217309Snwhitehorn if test "$CATOBJEXT" = "NONE"; then 427217309Snwhitehorn dnl GNU gettext is not found in the C library. 428217309Snwhitehorn dnl Fall back on GNU gettext library. 429217309Snwhitehorn nls_cv_use_gnu_gettext=yes 430217309Snwhitehorn fi 431217309Snwhitehorn fi 432217309Snwhitehorn 433217309Snwhitehorn if test "$nls_cv_use_gnu_gettext" = "yes"; then 434217309Snwhitehorn if test ! -d $srcdir/intl ; then 435217309Snwhitehorn AC_MSG_ERROR(no NLS library is packaged with this application) 436217309Snwhitehorn fi 437217309Snwhitehorn dnl Mark actions used to generate GNU NLS library. 438217309Snwhitehorn INTLOBJS="\$(GETTOBJS)" 439217309Snwhitehorn AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, 440217309Snwhitehorn [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :) 441217309Snwhitehorn AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) 442217309Snwhitehorn AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, 443217309Snwhitehorn [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :) 444217309Snwhitehorn AC_SUBST(MSGFMT) 445217309Snwhitehorn BUILD_INCLUDED_LIBINTL=yes 446217309Snwhitehorn USE_INCLUDED_LIBINTL=yes 447217309Snwhitehorn CATOBJEXT=.gmo 448217309Snwhitehorn INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV" 449217309Snwhitehorn LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` 450217309Snwhitehorn fi 451217309Snwhitehorn 452217309Snwhitehorn dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. 453217309Snwhitehorn dnl Test whether we really found GNU msgfmt. 454217309Snwhitehorn if test "$GMSGFMT" != ":"; then 455217309Snwhitehorn dnl If it is no GNU msgfmt we define it as : so that the 456217309Snwhitehorn dnl Makefiles still can work. 457217309Snwhitehorn if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then 458217309Snwhitehorn : ; 459217309Snwhitehorn else 460217309Snwhitehorn AC_MSG_RESULT( 461217309Snwhitehorn [found msgfmt program is not GNU msgfmt; ignore it]) 462217309Snwhitehorn GMSGFMT=":" 463217309Snwhitehorn fi 464217309Snwhitehorn fi 465217309Snwhitehorn 466217309Snwhitehorn dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. 467217309Snwhitehorn dnl Test whether we really found GNU xgettext. 468217309Snwhitehorn if test "$XGETTEXT" != ":"; then 469217309Snwhitehorn dnl If it is no GNU xgettext we define it as : so that the 470217309Snwhitehorn dnl Makefiles still can work. 471217309Snwhitehorn if $XGETTEXT --omit-header /dev/null >/dev/null 2>&1; then 472217309Snwhitehorn : ; 473217309Snwhitehorn else 474217309Snwhitehorn AC_MSG_RESULT( 475217309Snwhitehorn [found xgettext program is not GNU xgettext; ignore it]) 476217309Snwhitehorn XGETTEXT=":" 477217309Snwhitehorn fi 478217309Snwhitehorn fi 479217309Snwhitehorn 480217309Snwhitehorn dnl We need to process the po/ directory. 481217309Snwhitehorn POSUB=po 482217309Snwhitehorn fi 483217309Snwhitehorn 484217309Snwhitehorn AC_OUTPUT_COMMANDS( 485217309Snwhitehorn [for ac_file in $CONFIG_FILES; do 486217309Snwhitehorn 487217309Snwhitehorn # Support "outfile[:infile[:infile...]]" 488217309Snwhitehorn case "$ac_file" in 489217309Snwhitehorn *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; 490217309Snwhitehorn esac 491217309Snwhitehorn 492217309Snwhitehorn # PO directories have a Makefile.in generated from Makefile.inn. 493217309Snwhitehorn case "$ac_file" in */[Mm]akefile.in) 494217309Snwhitehorn # Adjust a relative srcdir. 495217309Snwhitehorn ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` 496217309Snwhitehorn ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" 497217309Snwhitehorn ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` 498217309Snwhitehorn ac_base=`basename $ac_file .in` 499217309Snwhitehorn # In autoconf-2.13 it is called $ac_given_srcdir. 500217309Snwhitehorn # In autoconf-2.50 it is called $srcdir. 501217309Snwhitehorn test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" 502217309Snwhitehorn 503217309Snwhitehorn case "$ac_given_srcdir" in 504217309Snwhitehorn .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; 505217309Snwhitehorn /*) top_srcdir="$ac_given_srcdir" ;; 506217309Snwhitehorn *) top_srcdir="$ac_dots$ac_given_srcdir" ;; 507217309Snwhitehorn esac 508217309Snwhitehorn 509217309Snwhitehorn if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then 510217309Snwhitehorn rm -f "$ac_dir/POTFILES" 511217309Snwhitehorn test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" 512217309Snwhitehorn sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES" 513217309Snwhitehorn test -n "$as_me" && echo "$as_me: creating $ac_dir/$ac_base" || echo "creating $ac_dir/$ac_base" 514217309Snwhitehorn sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/$ac_base.in" > "$ac_dir/$ac_base" 515217309Snwhitehorn fi 516217309Snwhitehorn ;; 517217309Snwhitehorn esac 518217309Snwhitehorn done]) 519217309Snwhitehorn 520217309Snwhitehorn dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL 521217309Snwhitehorn dnl to 'yes' because some of the testsuite requires it. 522217309Snwhitehorn if test "$PACKAGE" = gettext; then 523217309Snwhitehorn BUILD_INCLUDED_LIBINTL=yes 524217309Snwhitehorn fi 525217309Snwhitehorn 526217309Snwhitehorn dnl intl/plural.c is generated from intl/plural.y. It requires bison, 527217309Snwhitehorn dnl because plural.y uses bison specific features. It requires at least 528217309Snwhitehorn dnl bison-1.26 because earlier versions generate a plural.c that doesn't 529217309Snwhitehorn dnl compile. 530217309Snwhitehorn dnl bison is only needed for the maintainer (who touches plural.y). But in 531217309Snwhitehorn dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put 532217309Snwhitehorn dnl the rule in general Makefile. Now, some people carelessly touch the 533217309Snwhitehorn dnl files or have a broken "make" program, hence the plural.c rule will 534217309Snwhitehorn dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not 535217309Snwhitehorn dnl present or too old. 536217309Snwhitehorn if test "$nls_cv_use_gnu_gettext" = "yes"; then 537217309Snwhitehorn AC_CHECK_PROGS([INTLBISON], [bison]) 538217309Snwhitehorn if test -z "$INTLBISON"; then 539217309Snwhitehorn ac_verc_fail=yes 540217309Snwhitehorn else 541217309Snwhitehorn dnl Found it, now check the version. 542217309Snwhitehorn AC_MSG_CHECKING([version of bison]) 543217309Snwhitehornchangequote(<<,>>)dnl 544217309Snwhitehorn ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` 545217309Snwhitehorn case $ac_prog_version in 546217309Snwhitehorn '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; 547217309Snwhitehorn 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) 548217309Snwhitehornchangequote([,])dnl 549217309Snwhitehorn ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; 550217309Snwhitehorn *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; 551217309Snwhitehorn esac 552217309Snwhitehorn AC_MSG_RESULT([$ac_prog_version]) 553217309Snwhitehorn fi 554217309Snwhitehorn if test $ac_verc_fail = yes; then 555217309Snwhitehorn INTLBISON=: 556217309Snwhitehorn fi 557217309Snwhitehorn fi 558217309Snwhitehorn 559217309Snwhitehorn dnl These rules are solely for the distribution goal. While doing this 560217309Snwhitehorn dnl we only have to keep exactly one list of the available catalogs 561217309Snwhitehorn dnl in configure.in. 562217309Snwhitehorn for lang in $ALL_LINGUAS; do 563217309Snwhitehorn GMOFILES="$GMOFILES $lang.gmo" 564217309Snwhitehorn POFILES="$POFILES $lang.po" 565217309Snwhitehorn done 566217309Snwhitehorn 567217309Snwhitehorn dnl Make all variables we use known to autoconf. 568217309Snwhitehorn AC_SUBST(BUILD_INCLUDED_LIBINTL) 569217309Snwhitehorn AC_SUBST(USE_INCLUDED_LIBINTL) 570217309Snwhitehorn AC_SUBST(CATALOGS) 571217309Snwhitehorn AC_SUBST(CATOBJEXT) 572217309Snwhitehorn AC_SUBST(GMOFILES) 573217309Snwhitehorn AC_SUBST(INTLLIBS) 574217309Snwhitehorn AC_SUBST(INTLOBJS) 575217309Snwhitehorn AC_SUBST(POFILES) 576217309Snwhitehorn AC_SUBST(POSUB) 577217309Snwhitehorn 578217309Snwhitehorn dnl For backward compatibility. Some configure.ins may be using this. 579217309Snwhitehorn nls_cv_header_intl= 580217309Snwhitehorn nls_cv_header_libgt= 581217309Snwhitehorn 582217309Snwhitehorn dnl For backward compatibility. Some Makefiles may be using this. 583217309Snwhitehorn DATADIRNAME=share 584217309Snwhitehorn AC_SUBST(DATADIRNAME) 585217309Snwhitehorn 586217309Snwhitehorn dnl For backward compatibility. Some Makefiles may be using this. 587217309Snwhitehorn INSTOBJEXT=.mo 588217309Snwhitehorn AC_SUBST(INSTOBJEXT) 589217309Snwhitehorn 590217309Snwhitehorn dnl For backward compatibility. Some Makefiles may be using this. 591217309Snwhitehorn GENCAT=gencat 592217309Snwhitehorn AC_SUBST(GENCAT) 593217309Snwhitehorn])dnl 594217309Snwhitehorndnl --------------------------------------------------------------------------- 595217309Snwhitehorndnl CF_AC_PREREQ version: 2 updated: 1997/09/06 13:24:56 596217309Snwhitehorndnl ------------ 597217309Snwhitehorndnl Conditionally generate script according to whether we're using the release 598217309Snwhitehorndnl version of autoconf, or a patched version (using the ternary component as 599217309Snwhitehorndnl the patch-version). 600217309Snwhitehorndefine(CF_AC_PREREQ, 601217309Snwhitehorn[CF_PREREQ_COMPARE( 602217309SnwhitehornAC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), 603217309SnwhitehornAC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])), [$1], [$2], [$3])])dnl 604217309Snwhitehorndnl --------------------------------------------------------------------------- 605220749Snwhitehorndnl CF_ADD_CFLAGS version: 10 updated: 2010/05/26 05:38:42 606217309Snwhitehorndnl ------------- 607217309Snwhitehorndnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS 608217309Snwhitehorndnl The second parameter if given makes this macro verbose. 609217309Snwhitehorndnl 610217309Snwhitehorndnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS, 611217309Snwhitehorndnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily 612217309Snwhitehorndnl confused by the quotes (which require backslashes to keep them usable). 613217309SnwhitehornAC_DEFUN([CF_ADD_CFLAGS], 614217309Snwhitehorn[ 615217309Snwhitehorncf_fix_cppflags=no 616217309Snwhitehorncf_new_cflags= 617217309Snwhitehorncf_new_cppflags= 618217309Snwhitehorncf_new_extra_cppflags= 619217309Snwhitehorn 620217309Snwhitehornfor cf_add_cflags in $1 621217309Snwhitehorndo 622217309Snwhitehorncase $cf_fix_cppflags in 623217309Snwhitehornno) 624217309Snwhitehorn case $cf_add_cflags in #(vi 625217309Snwhitehorn -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi 626217309Snwhitehorn case $cf_add_cflags in 627217309Snwhitehorn -D*) 628217309Snwhitehorn cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'` 629217309Snwhitehorn 630217309Snwhitehorn test "${cf_add_cflags}" != "${cf_tst_cflags}" \ 631217309Snwhitehorn && test -z "${cf_tst_cflags}" \ 632217309Snwhitehorn && cf_fix_cppflags=yes 633217309Snwhitehorn 634217309Snwhitehorn if test $cf_fix_cppflags = yes ; then 635217309Snwhitehorn cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" 636217309Snwhitehorn continue 637217309Snwhitehorn elif test "${cf_tst_cflags}" = "\"'" ; then 638217309Snwhitehorn cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" 639217309Snwhitehorn continue 640217309Snwhitehorn fi 641217309Snwhitehorn ;; 642217309Snwhitehorn esac 643217309Snwhitehorn case "$CPPFLAGS" in 644217309Snwhitehorn *$cf_add_cflags) #(vi 645217309Snwhitehorn ;; 646217309Snwhitehorn *) #(vi 647217309Snwhitehorn case $cf_add_cflags in #(vi 648217309Snwhitehorn -D*) 649217309Snwhitehorn cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` 650217309Snwhitehorn CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags) 651217309Snwhitehorn ;; 652217309Snwhitehorn esac 653217309Snwhitehorn cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" 654217309Snwhitehorn ;; 655217309Snwhitehorn esac 656217309Snwhitehorn ;; 657217309Snwhitehorn *) 658217309Snwhitehorn cf_new_cflags="$cf_new_cflags $cf_add_cflags" 659217309Snwhitehorn ;; 660217309Snwhitehorn esac 661217309Snwhitehorn ;; 662217309Snwhitehornyes) 663217309Snwhitehorn cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" 664217309Snwhitehorn 665217309Snwhitehorn cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'` 666217309Snwhitehorn 667217309Snwhitehorn test "${cf_add_cflags}" != "${cf_tst_cflags}" \ 668217309Snwhitehorn && test -z "${cf_tst_cflags}" \ 669217309Snwhitehorn && cf_fix_cppflags=no 670217309Snwhitehorn ;; 671217309Snwhitehornesac 672217309Snwhitehorndone 673217309Snwhitehorn 674217309Snwhitehornif test -n "$cf_new_cflags" ; then 675220749Snwhitehorn ifelse([$2],,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)]) 676217309Snwhitehorn CFLAGS="$CFLAGS $cf_new_cflags" 677217309Snwhitehornfi 678217309Snwhitehorn 679217309Snwhitehornif test -n "$cf_new_cppflags" ; then 680220749Snwhitehorn ifelse([$2],,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)]) 681217309Snwhitehorn CPPFLAGS="$CPPFLAGS $cf_new_cppflags" 682217309Snwhitehornfi 683217309Snwhitehorn 684217309Snwhitehornif test -n "$cf_new_extra_cppflags" ; then 685220749Snwhitehorn ifelse([$2],,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)]) 686217309Snwhitehorn EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" 687217309Snwhitehornfi 688217309Snwhitehorn 689217309SnwhitehornAC_SUBST(EXTRA_CPPFLAGS) 690217309Snwhitehorn 691217309Snwhitehorn])dnl 692217309Snwhitehorndnl --------------------------------------------------------------------------- 693220749Snwhitehorndnl CF_ADD_INCDIR version: 13 updated: 2010/05/26 16:44:57 694217309Snwhitehorndnl ------------- 695217309Snwhitehorndnl Add an include-directory to $CPPFLAGS. Don't add /usr/include, since it's 696217309Snwhitehorndnl redundant. We don't normally need to add -I/usr/local/include for gcc, 697217309Snwhitehorndnl but old versions (and some misinstalled ones) need that. To make things 698217309Snwhitehorndnl worse, gcc 3.x may give error messages if -I/usr/local/include is added to 699217309Snwhitehorndnl the include-path). 700217309SnwhitehornAC_DEFUN([CF_ADD_INCDIR], 701217309Snwhitehorn[ 702217309Snwhitehornif test -n "$1" ; then 703217309Snwhitehorn for cf_add_incdir in $1 704217309Snwhitehorn do 705217309Snwhitehorn while test $cf_add_incdir != /usr/include 706217309Snwhitehorn do 707217309Snwhitehorn if test -d $cf_add_incdir 708217309Snwhitehorn then 709217309Snwhitehorn cf_have_incdir=no 710217309Snwhitehorn if test -n "$CFLAGS$CPPFLAGS" ; then 711217309Snwhitehorn # a loop is needed to ensure we can add subdirs of existing dirs 712217309Snwhitehorn for cf_test_incdir in $CFLAGS $CPPFLAGS ; do 713217309Snwhitehorn if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then 714217309Snwhitehorn cf_have_incdir=yes; break 715217309Snwhitehorn fi 716217309Snwhitehorn done 717217309Snwhitehorn fi 718217309Snwhitehorn 719217309Snwhitehorn if test "$cf_have_incdir" = no ; then 720217309Snwhitehorn if test "$cf_add_incdir" = /usr/local/include ; then 721217309Snwhitehorn if test "$GCC" = yes 722217309Snwhitehorn then 723217309Snwhitehorn cf_save_CPPFLAGS=$CPPFLAGS 724217309Snwhitehorn CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" 725217309Snwhitehorn AC_TRY_COMPILE([#include <stdio.h>], 726217309Snwhitehorn [printf("Hello")], 727217309Snwhitehorn [], 728217309Snwhitehorn [cf_have_incdir=yes]) 729217309Snwhitehorn CPPFLAGS=$cf_save_CPPFLAGS 730217309Snwhitehorn fi 731217309Snwhitehorn fi 732217309Snwhitehorn fi 733217309Snwhitehorn 734217309Snwhitehorn if test "$cf_have_incdir" = no ; then 735217309Snwhitehorn CF_VERBOSE(adding $cf_add_incdir to include-path) 736220749Snwhitehorn ifelse([$2],,CPPFLAGS,[$2])="$ifelse([$2],,CPPFLAGS,[$2]) -I$cf_add_incdir" 737217309Snwhitehorn 738217309Snwhitehorn cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` 739217309Snwhitehorn test "$cf_top_incdir" = "$cf_add_incdir" && break 740217309Snwhitehorn cf_add_incdir="$cf_top_incdir" 741217309Snwhitehorn else 742217309Snwhitehorn break 743217309Snwhitehorn fi 744217309Snwhitehorn fi 745217309Snwhitehorn done 746217309Snwhitehorn done 747217309Snwhitehornfi 748217309Snwhitehorn])dnl 749217309Snwhitehorndnl --------------------------------------------------------------------------- 750220749Snwhitehorndnl CF_ADD_LIB version: 2 updated: 2010/06/02 05:03:05 751220749Snwhitehorndnl ---------- 752220749Snwhitehorndnl Add a library, used to enforce consistency. 753220749Snwhitehorndnl 754220749Snwhitehorndnl $1 = library to add, without the "-l" 755220749Snwhitehorndnl $2 = variable to update (default $LIBS) 756220749SnwhitehornAC_DEFUN([CF_ADD_LIB],[CF_ADD_LIBS(-l$1,ifelse($2,,LIBS,[$2]))])dnl 757220749Snwhitehorndnl --------------------------------------------------------------------------- 758220749Snwhitehorndnl CF_ADD_LIBDIR version: 9 updated: 2010/05/26 16:44:57 759217309Snwhitehorndnl ------------- 760217309Snwhitehorndnl Adds to the library-path 761217309Snwhitehorndnl 762217309Snwhitehorndnl Some machines have trouble with multiple -L options. 763217309Snwhitehorndnl 764217309Snwhitehorndnl $1 is the (list of) directory(s) to add 765217309Snwhitehorndnl $2 is the optional name of the variable to update (default LDFLAGS) 766217309Snwhitehorndnl 767217309SnwhitehornAC_DEFUN([CF_ADD_LIBDIR], 768217309Snwhitehorn[ 769217309Snwhitehornif test -n "$1" ; then 770217309Snwhitehorn for cf_add_libdir in $1 771217309Snwhitehorn do 772217309Snwhitehorn if test $cf_add_libdir = /usr/lib ; then 773217309Snwhitehorn : 774217309Snwhitehorn elif test -d $cf_add_libdir 775217309Snwhitehorn then 776217309Snwhitehorn cf_have_libdir=no 777217309Snwhitehorn if test -n "$LDFLAGS$LIBS" ; then 778217309Snwhitehorn # a loop is needed to ensure we can add subdirs of existing dirs 779217309Snwhitehorn for cf_test_libdir in $LDFLAGS $LIBS ; do 780217309Snwhitehorn if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then 781217309Snwhitehorn cf_have_libdir=yes; break 782217309Snwhitehorn fi 783217309Snwhitehorn done 784217309Snwhitehorn fi 785217309Snwhitehorn if test "$cf_have_libdir" = no ; then 786217309Snwhitehorn CF_VERBOSE(adding $cf_add_libdir to library-path) 787220749Snwhitehorn ifelse([$2],,LDFLAGS,[$2])="-L$cf_add_libdir $ifelse([$2],,LDFLAGS,[$2])" 788217309Snwhitehorn fi 789217309Snwhitehorn fi 790217309Snwhitehorn done 791217309Snwhitehornfi 792217309Snwhitehorn])dnl 793217309Snwhitehorndnl --------------------------------------------------------------------------- 794220749Snwhitehorndnl CF_ADD_LIBS version: 1 updated: 2010/06/02 05:03:05 795220749Snwhitehorndnl ----------- 796220749Snwhitehorndnl Add one or more libraries, used to enforce consistency. 797220749Snwhitehorndnl 798220749Snwhitehorndnl $1 = libraries to add, with the "-l", etc. 799220749Snwhitehorndnl $2 = variable to update (default $LIBS) 800220749SnwhitehornAC_DEFUN([CF_ADD_LIBS],[ifelse($2,,LIBS,[$2])="$1 [$]ifelse($2,,LIBS,[$2])"])dnl 801220749Snwhitehorndnl --------------------------------------------------------------------------- 802217309Snwhitehorndnl CF_ADD_OPTIONAL_PATH version: 1 updated: 2007/07/29 12:33:33 803217309Snwhitehorndnl -------------------- 804217309Snwhitehorndnl Add an optional search-path to the compile/link variables. 805217309Snwhitehorndnl See CF_WITH_PATH 806217309Snwhitehorndnl 807217309Snwhitehorndnl $1 = shell variable containing the result of --with-XXX=[DIR] 808217309Snwhitehorndnl $2 = module to look for. 809217309SnwhitehornAC_DEFUN([CF_ADD_OPTIONAL_PATH],[ 810217309Snwhitehorn case "$1" in #(vi 811217309Snwhitehorn no) #(vi 812217309Snwhitehorn ;; 813217309Snwhitehorn yes) #(vi 814217309Snwhitehorn ;; 815217309Snwhitehorn *) 816217309Snwhitehorn CF_ADD_SEARCHPATH([$1], [AC_MSG_ERROR(cannot find $2 under $1)]) 817217309Snwhitehorn ;; 818217309Snwhitehorn esac 819217309Snwhitehorn])dnl 820217309Snwhitehorndnl --------------------------------------------------------------------------- 821217309Snwhitehorndnl CF_ADD_SEARCHPATH version: 5 updated: 2009/01/11 20:40:21 822217309Snwhitehorndnl ----------------- 823217309Snwhitehorndnl Set $CPPFLAGS and $LDFLAGS with the directories given via the parameter. 824217309Snwhitehorndnl They can be either the common root of include- and lib-directories, or the 825217309Snwhitehorndnl lib-directory (to allow for things like lib64 directories). 826217309Snwhitehorndnl See also CF_FIND_LINKAGE. 827217309Snwhitehorndnl 828217309Snwhitehorndnl $1 is the list of colon-separated directory names to search. 829217309Snwhitehorndnl $2 is the action to take if a parameter does not yield a directory. 830217309SnwhitehornAC_DEFUN([CF_ADD_SEARCHPATH], 831217309Snwhitehorn[ 832217309SnwhitehornAC_REQUIRE([CF_PATHSEP]) 833217309Snwhitehornfor cf_searchpath in `echo "$1" | tr $PATH_SEPARATOR ' '`; do 834217309Snwhitehorn if test -d $cf_searchpath/include; then 835217309Snwhitehorn CF_ADD_INCDIR($cf_searchpath/include) 836217309Snwhitehorn elif test -d $cf_searchpath/../include ; then 837217309Snwhitehorn CF_ADD_INCDIR($cf_searchpath/../include) 838217309Snwhitehorn ifelse([$2],,,[else 839217309Snwhitehorn$2]) 840217309Snwhitehorn fi 841217309Snwhitehorn if test -d $cf_searchpath/lib; then 842217309Snwhitehorn CF_ADD_LIBDIR($cf_searchpath/lib) 843217309Snwhitehorn elif test -d $cf_searchpath ; then 844217309Snwhitehorn CF_ADD_LIBDIR($cf_searchpath) 845217309Snwhitehorn ifelse([$2],,,[else 846217309Snwhitehorn$2]) 847217309Snwhitehorn fi 848217309Snwhitehorndone 849217309Snwhitehorn]) 850217309Snwhitehorndnl --------------------------------------------------------------------------- 851220749Snwhitehorndnl CF_ADD_SUBDIR_PATH version: 3 updated: 2010/07/03 20:58:12 852217309Snwhitehorndnl ------------------ 853217309Snwhitehorndnl Append to a search-list for a nonstandard header/lib-file 854217309Snwhitehorndnl $1 = the variable to return as result 855217309Snwhitehorndnl $2 = the package name 856217309Snwhitehorndnl $3 = the subdirectory, e.g., bin, include or lib 857217309Snwhitehorndnl $4 = the directory under which we will test for subdirectories 858217309Snwhitehorndnl $5 = a directory that we do not want $4 to match 859217309SnwhitehornAC_DEFUN([CF_ADD_SUBDIR_PATH], 860217309Snwhitehorn[ 861217309Snwhitehorntest "$4" != "$5" && \ 862217309Snwhitehorntest -d "$4" && \ 863220749Snwhitehornifelse([$5],NONE,,[(test $5 = NONE || test "$4" != "$5") &&]) { 864217309Snwhitehorn test -n "$verbose" && echo " ... testing for $3-directories under $4" 865217309Snwhitehorn test -d $4/$3 && $1="[$]$1 $4/$3" 866217309Snwhitehorn test -d $4/$3/$2 && $1="[$]$1 $4/$3/$2" 867217309Snwhitehorn test -d $4/$3/$2/$3 && $1="[$]$1 $4/$3/$2/$3" 868217309Snwhitehorn test -d $4/$2/$3 && $1="[$]$1 $4/$2/$3" 869217309Snwhitehorn test -d $4/$2/$3/$2 && $1="[$]$1 $4/$2/$3/$2" 870217309Snwhitehorn} 871217309Snwhitehorn])dnl 872217309Snwhitehorndnl --------------------------------------------------------------------------- 873217309Snwhitehorndnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31 874217309Snwhitehorndnl -------------- 875217309Snwhitehorndnl Allow user to disable a normally-on option. 876217309SnwhitehornAC_DEFUN([CF_ARG_DISABLE], 877217309Snwhitehorn[CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl 878217309Snwhitehorndnl --------------------------------------------------------------------------- 879217309Snwhitehorndnl CF_ARG_ENABLE version: 3 updated: 1999/03/30 17:24:31 880217309Snwhitehorndnl ------------- 881217309Snwhitehorndnl Allow user to enable a normally-off option. 882217309SnwhitehornAC_DEFUN([CF_ARG_ENABLE], 883217309Snwhitehorn[CF_ARG_OPTION($1,[$2],[$3],[$4],no)])dnl 884217309Snwhitehorndnl --------------------------------------------------------------------------- 885217309Snwhitehorndnl CF_ARG_MSG_ENABLE version: 2 updated: 2000/07/29 19:32:03 886217309Snwhitehorndnl ----------------- 887217309Snwhitehorndnl Verbose form of AC_ARG_ENABLE: 888217309Snwhitehorndnl 889217309Snwhitehorndnl Parameters: 890217309Snwhitehorndnl $1 = message 891217309Snwhitehorndnl $2 = option name 892217309Snwhitehorndnl $3 = help-string 893217309Snwhitehorndnl $4 = action to perform if option is enabled 894217309Snwhitehorndnl $5 = action if perform if option is disabled 895217309Snwhitehorndnl $6 = default option value (either 'yes' or 'no') 896217309SnwhitehornAC_DEFUN([CF_ARG_MSG_ENABLE],[ 897217309SnwhitehornAC_MSG_CHECKING($1) 898217309SnwhitehornAC_ARG_ENABLE($2,[$3],,enableval=ifelse($6,,no,$6)) 899217309SnwhitehornAC_MSG_RESULT($enableval) 900217309Snwhitehornif test "$enableval" != no ; then 901217309Snwhitehornifelse($4,,[ :],$4) 902217309Snwhitehornelse 903217309Snwhitehornifelse($5,,[ :],$5) 904217309Snwhitehornfi 905217309Snwhitehorn])dnl 906217309Snwhitehorndnl --------------------------------------------------------------------------- 907220749Snwhitehorndnl CF_ARG_OPTION version: 4 updated: 2010/05/26 05:38:42 908217309Snwhitehorndnl ------------- 909217309Snwhitehorndnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus 910217309Snwhitehorndnl values. 911217309Snwhitehorndnl 912217309Snwhitehorndnl Parameters: 913217309Snwhitehorndnl $1 = option name 914217309Snwhitehorndnl $2 = help-string 915217309Snwhitehorndnl $3 = action to perform if option is not default 916217309Snwhitehorndnl $4 = action if perform if option is default 917217309Snwhitehorndnl $5 = default option value (either 'yes' or 'no') 918217309SnwhitehornAC_DEFUN([CF_ARG_OPTION], 919220749Snwhitehorn[AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes) 920217309Snwhitehorn if test "$enableval" != "$5" ; then 921220749Snwhitehornifelse([$3],,[ :]dnl 922220749Snwhitehorn,[ $3]) ifelse([$4],,,[ 923217309Snwhitehorn else 924217309Snwhitehorn $4]) 925220749Snwhitehorn fi],[enableval=$5 ifelse([$4],,,[ 926217309Snwhitehorn $4 927217309Snwhitehorn])dnl 928217309Snwhitehorn ])])dnl 929217309Snwhitehorndnl --------------------------------------------------------------------------- 930220749Snwhitehorndnl CF_BUNDLED_INTL version: 16 updated: 2010/10/23 15:55:05 931217309Snwhitehorndnl --------------- 932217309Snwhitehorndnl Top-level macro for configuring an application with a bundled copy of 933217309Snwhitehorndnl the intl and po directories for gettext. 934217309Snwhitehorndnl 935217309Snwhitehorndnl $1 specifies either Makefile or makefile, defaulting to the former. 936217309Snwhitehorndnl $2 if nonempty sets the option to --enable-nls rather than to --disable-nls 937217309Snwhitehorndnl 938217309Snwhitehorndnl Sets variables which can be used to substitute in makefiles: 939217309Snwhitehorndnl GT_YES - "#" comment unless building intl library, otherwise empty 940217309Snwhitehorndnl GT_NO - "#" comment if building intl library, otherwise empty 941217309Snwhitehorndnl INTLDIR_MAKE - to make ./intl directory 942217309Snwhitehorndnl MSG_DIR_MAKE - to make ./po directory 943217309Snwhitehorndnl SUB_MAKEFILE - list of makefiles in ./intl, ./po directories 944220749Snwhitehorndnl 945220749Snwhitehorndnl Defines: 946217309Snwhitehorndnl HAVE_LIBGETTEXT_H if we're using ./intl 947220749Snwhitehorndnl NLS_TEXTDOMAIN 948217309Snwhitehorndnl 949217309Snwhitehorndnl Environment: 950217309Snwhitehorndnl ALL_LINGUAS if set, lists the root names of the ".po" files. 951217309Snwhitehorndnl CONFIG_H assumed to be "config.h" 952220749Snwhitehorndnl PACKAGE must be set, used as default for textdomain 953217309Snwhitehorndnl VERSION may be set, otherwise extract from "VERSION" file. 954217309Snwhitehorndnl 955217309SnwhitehornAC_DEFUN([CF_BUNDLED_INTL],[ 956217309Snwhitehorncf_makefile=ifelse($1,,Makefile,$1) 957217309Snwhitehorn 958217309Snwhitehorndnl Set of available languages (based on source distribution). Note that 959217309Snwhitehorndnl setting $LINGUAS overrides $ALL_LINGUAS. Some environments set $LINGUAS 960217309Snwhitehorndnl rather than $LC_ALL 961217309Snwhitehorntest -z "$ALL_LINGUAS" && ALL_LINGUAS=`test -d $srcdir/po && cd $srcdir/po && echo *.po|sed -e 's/\.po//g' -e 's/*//'` 962217309Snwhitehorn 963217309Snwhitehorn# Allow override of "config.h" definition: 964220749Snwhitehorn: ${CONFIG_H:=config.h} 965217309SnwhitehornAC_SUBST(CONFIG_H) 966217309Snwhitehorn 967220749Snwhitehornif test -z "$PACKAGE" ; then 968220749Snwhitehorn AC_MSG_ERROR([[CF_BUNDLED_INTL] used without setting [PACKAGE] variable]) 969220749Snwhitehornfi 970220749Snwhitehorn 971217309Snwhitehornif test -z "$VERSION" ; then 972217309Snwhitehornif test -f $srcdir/VERSION ; then 973217309Snwhitehorn VERSION=`sed -e '2,$d' $srcdir/VERSION|cut -f1` 974217309Snwhitehornelse 975217309Snwhitehorn VERSION=unknown 976217309Snwhitehornfi 977217309Snwhitehornfi 978217309SnwhitehornAC_SUBST(VERSION) 979217309Snwhitehorn 980217309SnwhitehornAM_GNU_GETTEXT(,,,[$2]) 981217309Snwhitehorn 982220749Snwhitehornif test "$USE_NLS" = yes ; then 983220749Snwhitehorn AC_ARG_WITH(textdomain, 984220749Snwhitehorn [ --with-textdomain=PKG NLS text-domain (default is package name)], 985220749Snwhitehorn [NLS_TEXTDOMAIN=$withval], 986220749Snwhitehorn [NLS_TEXTDOMAIN=$PACKAGE]) 987220749Snwhitehorn AC_DEFINE_UNQUOTED(NLS_TEXTDOMAIN,"$NLS_TEXTDOMAIN") 988220749Snwhitehorn AC_SUBST(NLS_TEXTDOMAIN) 989220749Snwhitehornfi 990220749Snwhitehorn 991217309SnwhitehornINTLDIR_MAKE= 992217309SnwhitehornMSG_DIR_MAKE= 993217309SnwhitehornSUB_MAKEFILE= 994217309Snwhitehorn 995217309Snwhitehorndnl this updates SUB_MAKEFILE and MSG_DIR_MAKE: 996217309SnwhitehornCF_OUR_MESSAGES($1) 997217309Snwhitehorn 998217309Snwhitehornif test "$USE_INCLUDED_LIBINTL" = yes ; then 999217309Snwhitehorn if test "$nls_cv_force_use_gnu_gettext" = yes ; then 1000217309Snwhitehorn : 1001217309Snwhitehorn elif test "$nls_cv_use_gnu_gettext" = yes ; then 1002217309Snwhitehorn : 1003217309Snwhitehorn else 1004217309Snwhitehorn INTLDIR_MAKE="#" 1005217309Snwhitehorn fi 1006217309Snwhitehorn if test -z "$INTLDIR_MAKE"; then 1007217309Snwhitehorn AC_DEFINE(HAVE_LIBGETTEXT_H) 1008217309Snwhitehorn for cf_makefile in \ 1009217309Snwhitehorn $srcdir/intl/Makefile.in \ 1010217309Snwhitehorn $srcdir/intl/makefile.in 1011217309Snwhitehorn do 1012217309Snwhitehorn if test -f "$cf_makefile" ; then 1013217309Snwhitehorn SUB_MAKEFILE="$SUB_MAKEFILE `echo \"${cf_makefile}\"|sed -e 's,^'$srcdir/',,' -e 's/\.in$//'`:${cf_makefile}" 1014217309Snwhitehorn break 1015217309Snwhitehorn fi 1016217309Snwhitehorn done 1017217309Snwhitehorn fi 1018217309Snwhitehornelse 1019217309Snwhitehorn INTLDIR_MAKE="#" 1020217309Snwhitehorn if test "$USE_NLS" = yes ; then 1021217309Snwhitehorn AC_CHECK_HEADERS(libintl.h) 1022217309Snwhitehorn fi 1023217309Snwhitehornfi 1024217309Snwhitehorn 1025217309Snwhitehornif test -z "$INTLDIR_MAKE" ; then 1026217309Snwhitehorn CPPFLAGS="$CPPFLAGS -I../intl" 1027217309Snwhitehornfi 1028217309Snwhitehorn 1029217309Snwhitehorndnl FIXME: we use this in lynx (the alternative is a spurious dependency upon 1030217309Snwhitehorndnl GNU make) 1031217309Snwhitehornif test "$BUILD_INCLUDED_LIBINTL" = yes ; then 1032217309Snwhitehorn GT_YES="#" 1033217309Snwhitehorn GT_NO= 1034217309Snwhitehornelse 1035217309Snwhitehorn GT_YES= 1036217309Snwhitehorn GT_NO="#" 1037217309Snwhitehornfi 1038217309Snwhitehorn 1039217309SnwhitehornAC_SUBST(INTLDIR_MAKE) 1040217309SnwhitehornAC_SUBST(MSG_DIR_MAKE) 1041217309SnwhitehornAC_SUBST(GT_YES) 1042217309SnwhitehornAC_SUBST(GT_NO) 1043217309Snwhitehorn 1044217309Snwhitehorndnl FIXME: the underlying AM_GNU_GETTEXT macro either needs some fixes or a 1045217309Snwhitehorndnl little documentation. It doesn't define anything so that we can ifdef our 1046217309Snwhitehorndnl own code, except ENABLE_NLS, which is too vague to be of any use. 1047217309Snwhitehorn 1048217309Snwhitehornif test "$USE_INCLUDED_LIBINTL" = yes ; then 1049217309Snwhitehorn if test "$nls_cv_force_use_gnu_gettext" = yes ; then 1050217309Snwhitehorn AC_DEFINE(HAVE_GETTEXT) 1051217309Snwhitehorn elif test "$nls_cv_use_gnu_gettext" = yes ; then 1052217309Snwhitehorn AC_DEFINE(HAVE_GETTEXT) 1053217309Snwhitehorn fi 1054217309Snwhitehorn if test -n "$nls_cv_header_intl" ; then 1055217309Snwhitehorn AC_DEFINE(HAVE_LIBINTL_H) 1056217309Snwhitehorn fi 1057217309Snwhitehornfi 1058217309Snwhitehorn])dnl 1059217309Snwhitehorndnl --------------------------------------------------------------------------- 1060217309Snwhitehorndnl CF_CHECK_CACHE version: 11 updated: 2008/03/23 14:45:59 1061217309Snwhitehorndnl -------------- 1062217309Snwhitehorndnl Check if we're accidentally using a cache from a different machine. 1063217309Snwhitehorndnl Derive the system name, as a check for reusing the autoconf cache. 1064217309Snwhitehorndnl 1065217309Snwhitehorndnl If we've packaged config.guess and config.sub, run that (since it does a 1066217309Snwhitehorndnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow 1067217309Snwhitehorndnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM 1068217309Snwhitehorndnl which is useful in cross-compiles. 1069217309Snwhitehorndnl 1070217309Snwhitehorndnl Note: we would use $ac_config_sub, but that is one of the places where 1071217309Snwhitehorndnl autoconf 2.5x broke compatibility with autoconf 2.13 1072217309SnwhitehornAC_DEFUN([CF_CHECK_CACHE], 1073217309Snwhitehorn[ 1074217309Snwhitehornif test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then 1075217309Snwhitehorn ifelse([$1],,[AC_CANONICAL_HOST],[$1]) 1076217309Snwhitehorn system_name="$host_os" 1077217309Snwhitehornelse 1078217309Snwhitehorn system_name="`(uname -s -r) 2>/dev/null`" 1079217309Snwhitehorn if test -z "$system_name" ; then 1080217309Snwhitehorn system_name="`(hostname) 2>/dev/null`" 1081217309Snwhitehorn fi 1082217309Snwhitehornfi 1083217309Snwhitehorntest -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name") 1084217309SnwhitehornAC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"]) 1085217309Snwhitehorn 1086217309Snwhitehorntest -z "$system_name" && system_name="$cf_cv_system_name" 1087217309Snwhitehorntest -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name) 1088217309Snwhitehorn 1089217309Snwhitehornif test ".$system_name" != ".$cf_cv_system_name" ; then 1090217309Snwhitehorn AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)) 1091217309Snwhitehorn AC_MSG_ERROR("Please remove config.cache and try again.") 1092217309Snwhitehornfi 1093217309Snwhitehorn])dnl 1094217309Snwhitehorndnl --------------------------------------------------------------------------- 1095220749Snwhitehorndnl CF_CURSES_CHTYPE version: 7 updated: 2010/10/23 15:54:49 1096217309Snwhitehorndnl ---------------- 1097217309Snwhitehorndnl Test if curses defines 'chtype' (usually a 'long' type for SysV curses). 1098217309SnwhitehornAC_DEFUN([CF_CURSES_CHTYPE], 1099217309Snwhitehorn[ 1100217309SnwhitehornAC_REQUIRE([CF_CURSES_CPPFLAGS])dnl 1101217309SnwhitehornAC_CACHE_CHECK(for chtype typedef,cf_cv_chtype_decl,[ 1102220749Snwhitehorn AC_TRY_COMPILE([#include <${cf_cv_ncurses_header:-curses.h}>], 1103217309Snwhitehorn [chtype foo], 1104217309Snwhitehorn [cf_cv_chtype_decl=yes], 1105217309Snwhitehorn [cf_cv_chtype_decl=no])]) 1106217309Snwhitehornif test $cf_cv_chtype_decl = yes ; then 1107217309Snwhitehorn AC_DEFINE(HAVE_TYPE_CHTYPE) 1108217309Snwhitehorn AC_CACHE_CHECK(if chtype is scalar or struct,cf_cv_chtype_type,[ 1109220749Snwhitehorn AC_TRY_COMPILE([#include <${cf_cv_ncurses_header:-curses.h}>], 1110217309Snwhitehorn [chtype foo; long x = foo], 1111217309Snwhitehorn [cf_cv_chtype_type=scalar], 1112217309Snwhitehorn [cf_cv_chtype_type=struct])]) 1113217309Snwhitehorn if test $cf_cv_chtype_type = scalar ; then 1114217309Snwhitehorn AC_DEFINE(TYPE_CHTYPE_IS_SCALAR) 1115217309Snwhitehorn fi 1116217309Snwhitehornfi 1117217309Snwhitehorn])dnl 1118217309Snwhitehorndnl --------------------------------------------------------------------------- 1119217309Snwhitehorndnl CF_CURSES_CONFIG version: 2 updated: 2006/10/29 11:06:27 1120217309Snwhitehorndnl ---------------- 1121217309Snwhitehorndnl Tie together the configure-script macros for curses. It may be ncurses, 1122217309Snwhitehorndnl but unless asked, we do not make a special search for ncurses. However, 1123217309Snwhitehorndnl still check for the ncurses version number, for use in other macros. 1124217309SnwhitehornAC_DEFUN([CF_CURSES_CONFIG], 1125217309Snwhitehorn[ 1126217309SnwhitehornCF_CURSES_CPPFLAGS 1127217309SnwhitehornCF_NCURSES_VERSION 1128217309SnwhitehornCF_CURSES_LIBS 1129217309Snwhitehorn])dnl 1130217309Snwhitehorndnl --------------------------------------------------------------------------- 1131224014Snwhitehorndnl CF_CURSES_CPPFLAGS version: 11 updated: 2011/04/09 14:51:08 1132217309Snwhitehorndnl ------------------ 1133217309Snwhitehorndnl Look for the curses headers. 1134217309SnwhitehornAC_DEFUN([CF_CURSES_CPPFLAGS],[ 1135217309Snwhitehorn 1136217309SnwhitehornAC_CACHE_CHECK(for extra include directories,cf_cv_curses_incdir,[ 1137217309Snwhitehorncf_cv_curses_incdir=no 1138217309Snwhitehorncase $host_os in #(vi 1139217309Snwhitehornhpux10.*) #(vi 1140224014Snwhitehorn if test "x$cf_cv_screen" = "xcurses_colr" 1141224014Snwhitehorn then 1142224014Snwhitehorn test -d /usr/include/curses_colr && \ 1143224014Snwhitehorn cf_cv_curses_incdir="-I/usr/include/curses_colr" 1144224014Snwhitehorn fi 1145217309Snwhitehorn ;; 1146217309Snwhitehornsunos3*|sunos4*) 1147224014Snwhitehorn if test "x$cf_cv_screen" = "xcurses_5lib" 1148224014Snwhitehorn then 1149224014Snwhitehorn test -d /usr/5lib && \ 1150224014Snwhitehorn test -d /usr/5include && \ 1151224014Snwhitehorn cf_cv_curses_incdir="-I/usr/5include" 1152224014Snwhitehorn fi 1153217309Snwhitehorn ;; 1154217309Snwhitehornesac 1155217309Snwhitehorn]) 1156217309Snwhitehorntest "$cf_cv_curses_incdir" != no && CPPFLAGS="$CPPFLAGS $cf_cv_curses_incdir" 1157217309Snwhitehorn 1158217309SnwhitehornCF_CURSES_HEADER 1159217309SnwhitehornCF_TERM_HEADER 1160217309Snwhitehorn])dnl 1161217309Snwhitehorndnl --------------------------------------------------------------------------- 1162224014Snwhitehorndnl CF_CURSES_FUNCS version: 17 updated: 2011/05/14 16:07:29 1163217309Snwhitehorndnl --------------- 1164217309Snwhitehorndnl Curses-functions are a little complicated, since a lot of them are macros. 1165217309SnwhitehornAC_DEFUN([CF_CURSES_FUNCS], 1166217309Snwhitehorn[ 1167217309SnwhitehornAC_REQUIRE([CF_CURSES_CPPFLAGS])dnl 1168217309SnwhitehornAC_REQUIRE([CF_XOPEN_CURSES]) 1169217309SnwhitehornAC_REQUIRE([CF_CURSES_TERM_H]) 1170224014SnwhitehornAC_REQUIRE([CF_CURSES_UNCTRL_H]) 1171217309Snwhitehornfor cf_func in $1 1172217309Snwhitehorndo 1173217309Snwhitehorn CF_UPPER(cf_tr_func,$cf_func) 1174217309Snwhitehorn AC_MSG_CHECKING(for ${cf_func}) 1175217309Snwhitehorn CF_MSG_LOG(${cf_func}) 1176217309Snwhitehorn AC_CACHE_VAL(cf_cv_func_$cf_func,[ 1177217309Snwhitehorn eval cf_result='$ac_cv_func_'$cf_func 1178217309Snwhitehorn if test ".$cf_result" != ".no"; then 1179217309Snwhitehorn AC_TRY_LINK(CF__CURSES_HEAD, 1180217309Snwhitehorn [ 1181217309Snwhitehorn#ifndef ${cf_func} 1182217309Snwhitehornlong foo = (long)(&${cf_func}); 1183224014Snwhitehornif (foo + 1234 > 5678) 1184224014Snwhitehorn ${cf_cv_main_return:-return}(foo); 1185217309Snwhitehorn#endif 1186217309Snwhitehorn ], 1187217309Snwhitehorn [cf_result=yes], 1188217309Snwhitehorn [cf_result=no]) 1189217309Snwhitehorn fi 1190217309Snwhitehorn eval 'cf_cv_func_'$cf_func'=$cf_result' 1191217309Snwhitehorn ]) 1192217309Snwhitehorn # use the computed/retrieved cache-value: 1193217309Snwhitehorn eval 'cf_result=$cf_cv_func_'$cf_func 1194217309Snwhitehorn AC_MSG_RESULT($cf_result) 1195217309Snwhitehorn if test $cf_result != no; then 1196217309Snwhitehorn AC_DEFINE_UNQUOTED(HAVE_${cf_tr_func}) 1197217309Snwhitehorn fi 1198217309Snwhitehorndone 1199217309Snwhitehorn])dnl 1200217309Snwhitehorndnl --------------------------------------------------------------------------- 1201224014Snwhitehorndnl CF_CURSES_HEADER version: 3 updated: 2011/05/01 19:47:45 1202217309Snwhitehorndnl ---------------- 1203217309Snwhitehorndnl Find a "curses" header file, e.g,. "curses.h", or one of the more common 1204217309Snwhitehorndnl variations of ncurses' installs. 1205217309Snwhitehorndnl 1206217309Snwhitehorndnl $1 = ncurses when looking for ncurses, or is empty 1207217309SnwhitehornAC_DEFUN([CF_CURSES_HEADER],[ 1208217309SnwhitehornAC_CACHE_CHECK(if we have identified curses headers,cf_cv_ncurses_header,[ 1209217309Snwhitehorncf_cv_ncurses_header=none 1210217309Snwhitehornfor cf_header in ifelse($1,,,[ \ 1211224014Snwhitehorn $1/ncurses.h \ 1212224014Snwhitehorn $1/curses.h]) \ 1213224014Snwhitehorn ncurses.h \ 1214224014Snwhitehorn curses.h ifelse($1,,[ncurses/ncurses.h ncurses/curses.h]) 1215217309Snwhitehorndo 1216217309SnwhitehornAC_TRY_COMPILE([#include <${cf_header}>], 1217217309Snwhitehorn [initscr(); tgoto("?", 0,0)], 1218217309Snwhitehorn [cf_cv_ncurses_header=$cf_header; break],[]) 1219217309Snwhitehorndone 1220217309Snwhitehorn]) 1221217309Snwhitehorn 1222217309Snwhitehornif test "$cf_cv_ncurses_header" = none ; then 1223217309Snwhitehorn AC_MSG_ERROR(No curses header-files found) 1224217309Snwhitehornfi 1225217309Snwhitehorn 1226217309Snwhitehorn# cheat, to get the right #define's for HAVE_NCURSES_H, etc. 1227217309SnwhitehornAC_CHECK_HEADERS($cf_cv_ncurses_header) 1228217309Snwhitehorn])dnl 1229217309Snwhitehorndnl --------------------------------------------------------------------------- 1230224014Snwhitehorndnl CF_CURSES_LIBS version: 34 updated: 2011/04/09 14:51:08 1231217309Snwhitehorndnl -------------- 1232217309Snwhitehorndnl Look for the curses libraries. Older curses implementations may require 1233217309Snwhitehorndnl termcap/termlib to be linked as well. Call CF_CURSES_CPPFLAGS first. 1234217309SnwhitehornAC_DEFUN([CF_CURSES_LIBS],[ 1235217309Snwhitehorn 1236217309SnwhitehornAC_REQUIRE([CF_CURSES_CPPFLAGS])dnl 1237217309SnwhitehornAC_MSG_CHECKING(if we have identified curses libraries) 1238220749SnwhitehornAC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], 1239217309Snwhitehorn [initscr(); tgoto("?", 0,0)], 1240217309Snwhitehorn cf_result=yes, 1241217309Snwhitehorn cf_result=no) 1242217309SnwhitehornAC_MSG_RESULT($cf_result) 1243217309Snwhitehorn 1244217309Snwhitehornif test "$cf_result" = no ; then 1245217309Snwhitehorncase $host_os in #(vi 1246217309Snwhitehornfreebsd*) #(vi 1247220749Snwhitehorn AC_CHECK_LIB(mytinfo,tgoto,[CF_ADD_LIBS(-lmytinfo)]) 1248217309Snwhitehorn ;; 1249217309Snwhitehornhpux10.*) #(vi 1250224014Snwhitehorn # Looking at HPUX 10.20, the Hcurses library is the oldest (1997), cur_colr 1251224014Snwhitehorn # next (1998), and xcurses "newer" (2000). There is no header file for 1252224014Snwhitehorn # Hcurses; the subdirectory curses_colr has the headers (curses.h and 1253224014Snwhitehorn # term.h) for cur_colr 1254224014Snwhitehorn if test "x$cf_cv_screen" = "xcurses_colr" 1255224014Snwhitehorn then 1256224014Snwhitehorn AC_CHECK_LIB(cur_colr,initscr,[ 1257224014Snwhitehorn CF_ADD_LIBS(-lcur_colr) 1258224014Snwhitehorn ac_cv_func_initscr=yes 1259224014Snwhitehorn ],[ 1260224014Snwhitehorn AC_CHECK_LIB(Hcurses,initscr,[ 1261224014Snwhitehorn # HP's header uses __HP_CURSES, but user claims _HP_CURSES. 1262224014Snwhitehorn CF_ADD_LIBS(-lHcurses) 1263224014Snwhitehorn CPPFLAGS="$CPPFLAGS -D__HP_CURSES -D_HP_CURSES" 1264224014Snwhitehorn ac_cv_func_initscr=yes 1265224014Snwhitehorn ])]) 1266224014Snwhitehorn fi 1267217309Snwhitehorn ;; 1268220749Snwhitehornlinux*) 1269224014Snwhitehorn case `arch 2>/dev/null` in 1270220749Snwhitehorn x86_64) 1271220749Snwhitehorn if test -d /lib64 1272220749Snwhitehorn then 1273220749Snwhitehorn CF_ADD_LIBDIR(/lib64) 1274220749Snwhitehorn else 1275220749Snwhitehorn CF_ADD_LIBDIR(/lib) 1276220749Snwhitehorn fi 1277220749Snwhitehorn ;; 1278220749Snwhitehorn *) 1279220749Snwhitehorn CF_ADD_LIBDIR(/lib) 1280220749Snwhitehorn ;; 1281220749Snwhitehorn esac 1282217309Snwhitehorn ;; 1283217309Snwhitehornsunos3*|sunos4*) 1284224014Snwhitehorn if test "x$cf_cv_screen" = "xcurses_5lib" 1285224014Snwhitehorn then 1286224014Snwhitehorn if test -d /usr/5lib ; then 1287224014Snwhitehorn CF_ADD_LIBDIR(/usr/5lib) 1288224014Snwhitehorn CF_ADD_LIBS(-lcurses -ltermcap) 1289224014Snwhitehorn fi 1290217309Snwhitehorn fi 1291217309Snwhitehorn ac_cv_func_initscr=yes 1292217309Snwhitehorn ;; 1293217309Snwhitehornesac 1294217309Snwhitehorn 1295217309Snwhitehornif test ".$ac_cv_func_initscr" != .yes ; then 1296217309Snwhitehorn cf_save_LIBS="$LIBS" 1297217309Snwhitehorn cf_term_lib="" 1298217309Snwhitehorn cf_curs_lib="" 1299217309Snwhitehorn 1300220749Snwhitehorn if test ".${cf_cv_ncurses_version:-no}" != .no 1301217309Snwhitehorn then 1302217309Snwhitehorn cf_check_list="ncurses curses cursesX" 1303217309Snwhitehorn else 1304217309Snwhitehorn cf_check_list="cursesX curses ncurses" 1305217309Snwhitehorn fi 1306217309Snwhitehorn 1307217309Snwhitehorn # Check for library containing tgoto. Do this before curses library 1308217309Snwhitehorn # because it may be needed to link the test-case for initscr. 1309217309Snwhitehorn AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[ 1310217309Snwhitehorn for cf_term_lib in $cf_check_list termcap termlib unknown 1311217309Snwhitehorn do 1312217309Snwhitehorn AC_CHECK_LIB($cf_term_lib,tgoto,[break]) 1313217309Snwhitehorn done 1314217309Snwhitehorn ]) 1315217309Snwhitehorn 1316217309Snwhitehorn # Check for library containing initscr 1317217309Snwhitehorn test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS" 1318217309Snwhitehorn for cf_curs_lib in $cf_check_list xcurses jcurses pdcurses unknown 1319217309Snwhitehorn do 1320217309Snwhitehorn AC_CHECK_LIB($cf_curs_lib,initscr,[break]) 1321217309Snwhitehorn done 1322217309Snwhitehorn test $cf_curs_lib = unknown && AC_MSG_ERROR(no curses library found) 1323217309Snwhitehorn 1324217309Snwhitehorn LIBS="-l$cf_curs_lib $cf_save_LIBS" 1325217309Snwhitehorn if test "$cf_term_lib" = unknown ; then 1326217309Snwhitehorn AC_MSG_CHECKING(if we can link with $cf_curs_lib library) 1327220749Snwhitehorn AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], 1328217309Snwhitehorn [initscr()], 1329217309Snwhitehorn [cf_result=yes], 1330217309Snwhitehorn [cf_result=no]) 1331217309Snwhitehorn AC_MSG_RESULT($cf_result) 1332217309Snwhitehorn test $cf_result = no && AC_MSG_ERROR(Cannot link curses library) 1333217309Snwhitehorn elif test "$cf_curs_lib" = "$cf_term_lib" ; then 1334217309Snwhitehorn : 1335217309Snwhitehorn elif test "$cf_term_lib" != predefined ; then 1336217309Snwhitehorn AC_MSG_CHECKING(if we need both $cf_curs_lib and $cf_term_lib libraries) 1337220749Snwhitehorn AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], 1338217309Snwhitehorn [initscr(); tgoto((char *)0, 0, 0);], 1339217309Snwhitehorn [cf_result=no], 1340217309Snwhitehorn [ 1341217309Snwhitehorn LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS" 1342220749Snwhitehorn AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], 1343217309Snwhitehorn [initscr()], 1344217309Snwhitehorn [cf_result=yes], 1345217309Snwhitehorn [cf_result=error]) 1346217309Snwhitehorn ]) 1347217309Snwhitehorn AC_MSG_RESULT($cf_result) 1348217309Snwhitehorn fi 1349217309Snwhitehornfi 1350217309Snwhitehornfi 1351217309Snwhitehorn 1352217309Snwhitehorn])dnl 1353217309Snwhitehorndnl --------------------------------------------------------------------------- 1354224014Snwhitehorndnl CF_CURSES_TERM_H version: 9 updated: 2011/04/09 18:19:55 1355217309Snwhitehorndnl ---------------- 1356217309Snwhitehorndnl SVr4 curses should have term.h as well (where it puts the definitions of 1357217309Snwhitehorndnl the low-level interface). This may not be true in old/broken implementations, 1358217309Snwhitehorndnl as well as in misconfigured systems (e.g., gcc configured for Solaris 2.4 1359217309Snwhitehorndnl running with Solaris 2.5.1). 1360217309SnwhitehornAC_DEFUN([CF_CURSES_TERM_H], 1361217309Snwhitehorn[ 1362217309SnwhitehornAC_REQUIRE([CF_CURSES_CPPFLAGS])dnl 1363217309Snwhitehorn 1364217309SnwhitehornAC_CACHE_CHECK(for term.h, cf_cv_term_header,[ 1365217309Snwhitehorn 1366217309Snwhitehorn# If we found <ncurses/curses.h>, look for <ncurses/term.h>, but always look 1367217309Snwhitehorn# for <term.h> if we do not find the variant. 1368224014Snwhitehorn 1369224014Snwhitehorncf_header_list="term.h ncurses/term.h ncursesw/term.h" 1370224014Snwhitehorn 1371224014Snwhitehorncase ${cf_cv_ncurses_header:-curses.h} in #(vi 1372224014Snwhitehorn*/*) 1373224014Snwhitehorn cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`term.h 1374224014Snwhitehorn cf_header_list="$cf_header_item $cf_header_list" 1375224014Snwhitehorn ;; 1376224014Snwhitehornesac 1377224014Snwhitehorn 1378224014Snwhitehornfor cf_header in $cf_header_list 1379217309Snwhitehorndo 1380217309Snwhitehorn AC_TRY_COMPILE([ 1381220749Snwhitehorn#include <${cf_cv_ncurses_header:-curses.h}> 1382217309Snwhitehorn#include <${cf_header}>], 1383217309Snwhitehorn [WINDOW *x], 1384217309Snwhitehorn [cf_cv_term_header=$cf_header 1385217309Snwhitehorn break], 1386217309Snwhitehorn [cf_cv_term_header=no]) 1387217309Snwhitehorndone 1388217309Snwhitehorn 1389217309Snwhitehorncase $cf_cv_term_header in #(vi 1390217309Snwhitehornno) 1391217309Snwhitehorn # If curses is ncurses, some packagers still mess it up by trying to make 1392217309Snwhitehorn # us use GNU termcap. This handles the most common case. 1393217309Snwhitehorn for cf_header in ncurses/term.h ncursesw/term.h 1394217309Snwhitehorn do 1395217309Snwhitehorn AC_TRY_COMPILE([ 1396220749Snwhitehorn#include <${cf_cv_ncurses_header:-curses.h}> 1397217309Snwhitehorn#ifdef NCURSES_VERSION 1398217309Snwhitehorn#include <${cf_header}> 1399217309Snwhitehorn#else 1400217309Snwhitehornmake an error 1401217309Snwhitehorn#endif], 1402217309Snwhitehorn [WINDOW *x], 1403217309Snwhitehorn [cf_cv_term_header=$cf_header 1404217309Snwhitehorn break], 1405217309Snwhitehorn [cf_cv_term_header=no]) 1406217309Snwhitehorn done 1407217309Snwhitehorn ;; 1408217309Snwhitehornesac 1409217309Snwhitehorn]) 1410217309Snwhitehorn 1411217309Snwhitehorncase $cf_cv_term_header in #(vi 1412217309Snwhitehornterm.h) #(vi 1413217309Snwhitehorn AC_DEFINE(HAVE_TERM_H) 1414217309Snwhitehorn ;; 1415217309Snwhitehornncurses/term.h) #(vi 1416217309Snwhitehorn AC_DEFINE(HAVE_NCURSES_TERM_H) 1417217309Snwhitehorn ;; 1418217309Snwhitehornncursesw/term.h) 1419217309Snwhitehorn AC_DEFINE(HAVE_NCURSESW_TERM_H) 1420217309Snwhitehorn ;; 1421217309Snwhitehornesac 1422217309Snwhitehorn])dnl 1423217309Snwhitehorndnl --------------------------------------------------------------------------- 1424224014Snwhitehorndnl CF_CURSES_UNCTRL_H version: 1 updated: 2011/04/09 18:19:55 1425224014Snwhitehorndnl ------------------ 1426224014Snwhitehorndnl Any X/Open curses implementation must have unctrl.h, but ncurses packages 1427224014Snwhitehorndnl may put it in a subdirectory (along with ncurses' other headers, of 1428224014Snwhitehorndnl course). Packages which put the headers in inconsistent locations are 1429224014Snwhitehorndnl broken). 1430224014SnwhitehornAC_DEFUN([CF_CURSES_UNCTRL_H], 1431224014Snwhitehorn[ 1432224014SnwhitehornAC_REQUIRE([CF_CURSES_CPPFLAGS])dnl 1433224014Snwhitehorn 1434224014SnwhitehornAC_CACHE_CHECK(for unctrl.h, cf_cv_unctrl_header,[ 1435224014Snwhitehorn 1436224014Snwhitehorn# If we found <ncurses/curses.h>, look for <ncurses/unctrl.h>, but always look 1437224014Snwhitehorn# for <unctrl.h> if we do not find the variant. 1438224014Snwhitehorn 1439224014Snwhitehorncf_header_list="unctrl.h ncurses/unctrl.h ncursesw/unctrl.h" 1440224014Snwhitehorn 1441224014Snwhitehorncase ${cf_cv_ncurses_header:-curses.h} in #(vi 1442224014Snwhitehorn*/*) 1443224014Snwhitehorn cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`unctrl.h 1444224014Snwhitehorn cf_header_list="$cf_header_item $cf_header_list" 1445224014Snwhitehorn ;; 1446224014Snwhitehornesac 1447224014Snwhitehorn 1448224014Snwhitehornfor cf_header in $cf_header_list 1449224014Snwhitehorndo 1450224014Snwhitehorn AC_TRY_COMPILE([ 1451224014Snwhitehorn#include <${cf_cv_ncurses_header:-curses.h}> 1452224014Snwhitehorn#include <${cf_header}>], 1453224014Snwhitehorn [WINDOW *x], 1454224014Snwhitehorn [cf_cv_unctrl_header=$cf_header 1455224014Snwhitehorn break], 1456224014Snwhitehorn [cf_cv_unctrl_header=no]) 1457224014Snwhitehorndone 1458224014Snwhitehorn 1459224014Snwhitehorncase $cf_cv_unctrl_header in #(vi 1460224014Snwhitehornno) 1461224014Snwhitehorn AC_MSG_WARN(unctrl.h header not found) 1462224014Snwhitehorn ;; 1463224014Snwhitehornesac 1464224014Snwhitehorn]) 1465224014Snwhitehorn 1466224014Snwhitehorncase $cf_cv_unctrl_header in #(vi 1467224014Snwhitehornunctrl.h) #(vi 1468224014Snwhitehorn AC_DEFINE(HAVE_UNCTRL_H) 1469224014Snwhitehorn ;; 1470224014Snwhitehornncurses/unctrl.h) #(vi 1471224014Snwhitehorn AC_DEFINE(HAVE_NCURSES_UNCTRL_H) 1472224014Snwhitehorn ;; 1473224014Snwhitehornncursesw/unctrl.h) 1474224014Snwhitehorn AC_DEFINE(HAVE_NCURSESW_UNCTRL_H) 1475224014Snwhitehorn ;; 1476224014Snwhitehornesac 1477224014Snwhitehorn])dnl 1478224014Snwhitehorndnl --------------------------------------------------------------------------- 1479220749Snwhitehorndnl CF_CURSES_WACS_MAP version: 5 updated: 2011/01/15 11:28:59 1480220749Snwhitehorndnl ------------------ 1481220749Snwhitehorndnl Check for likely values of wacs_map[]. 1482220749SnwhitehornAC_DEFUN([CF_CURSES_WACS_MAP], 1483220749Snwhitehorn[ 1484220749SnwhitehornAC_CACHE_CHECK(for wide alternate character set array, cf_cv_curses_wacs_map,[ 1485220749Snwhitehorn cf_cv_curses_wacs_map=unknown 1486220749Snwhitehorn for name in wacs_map _wacs_map __wacs_map _nc_wacs _wacs_char 1487220749Snwhitehorn do 1488220749Snwhitehorn AC_TRY_LINK([ 1489220749Snwhitehorn#ifndef _XOPEN_SOURCE_EXTENDED 1490220749Snwhitehorn#define _XOPEN_SOURCE_EXTENDED 1491220749Snwhitehorn#endif 1492220749Snwhitehorn#include <${cf_cv_ncurses_header:-curses.h}>], 1493220749Snwhitehorn [void *foo = &($name['k'])], 1494220749Snwhitehorn [cf_cv_curses_wacs_map=$name 1495220749Snwhitehorn break]) 1496220749Snwhitehorn done]) 1497220749Snwhitehorn 1498220749Snwhitehorntest "$cf_cv_curses_wacs_map" != unknown && AC_DEFINE_UNQUOTED(CURSES_WACS_ARRAY,$cf_cv_curses_wacs_map) 1499220749Snwhitehorn])dnl 1500220749Snwhitehorndnl --------------------------------------------------------------------------- 1501220749Snwhitehorndnl CF_CURSES_WACS_SYMBOLS version: 1 updated: 2011/01/15 11:28:59 1502220749Snwhitehorndnl ---------------------- 1503220749Snwhitehorndnl Do a check to see if the WACS_xxx constants are defined compatibly with 1504220749Snwhitehorndnl X/Open Curses. In particular, NetBSD's implementation of the WACS_xxx 1505220749Snwhitehorndnl constants is broken since those constants do not point to cchar_t's. 1506220749SnwhitehornAC_DEFUN([CF_CURSES_WACS_SYMBOLS], 1507220749Snwhitehorn[ 1508220749SnwhitehornAC_REQUIRE([CF_CURSES_WACS_MAP]) 1509220749Snwhitehorn 1510220749SnwhitehornAC_CACHE_CHECK(for wide alternate character constants, cf_cv_curses_wacs_symbols,[ 1511220749Snwhitehorncf_cv_curses_wacs_symbols=no 1512220749Snwhitehornif test "$cf_cv_curses_wacs_map" != unknown 1513220749Snwhitehornthen 1514220749Snwhitehorn AC_TRY_LINK([ 1515220749Snwhitehorn#ifndef _XOPEN_SOURCE_EXTENDED 1516220749Snwhitehorn#define _XOPEN_SOURCE_EXTENDED 1517220749Snwhitehorn#endif 1518220749Snwhitehorn#include <${cf_cv_ncurses_header:-curses.h}>], 1519220749Snwhitehorn [cchar_t *foo = WACS_PLUS; 1520220749Snwhitehorn $cf_cv_curses_wacs_map['k'] = *WACS_PLUS], 1521220749Snwhitehorn [cf_cv_curses_wacs_symbols=yes]) 1522220749Snwhitehornelse 1523220749Snwhitehorn AC_TRY_LINK([ 1524220749Snwhitehorn#ifndef _XOPEN_SOURCE_EXTENDED 1525220749Snwhitehorn#define _XOPEN_SOURCE_EXTENDED 1526220749Snwhitehorn#endif 1527220749Snwhitehorn#include <${cf_cv_ncurses_header:-curses.h}>], 1528220749Snwhitehorn [cchar_t *foo = WACS_PLUS], 1529220749Snwhitehorn [cf_cv_curses_wacs_symbols=yes]) 1530220749Snwhitehornfi 1531220749Snwhitehorn]) 1532220749Snwhitehorn 1533220749Snwhitehorntest "$cf_cv_curses_wacs_symbols" != no && AC_DEFINE(CURSES_WACS_SYMBOLS) 1534220749Snwhitehorn])dnl 1535220749Snwhitehorndnl --------------------------------------------------------------------------- 1536217309Snwhitehorndnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52 1537217309Snwhitehorndnl ---------- 1538217309Snwhitehorndnl "dirname" is not portable, so we fake it with a shell script. 1539217309SnwhitehornAC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl 1540217309Snwhitehorndnl --------------------------------------------------------------------------- 1541217309Snwhitehorndnl CF_DISABLE_ECHO version: 11 updated: 2009/12/13 13:16:57 1542217309Snwhitehorndnl --------------- 1543217309Snwhitehorndnl You can always use "make -n" to see the actual options, but it's hard to 1544217309Snwhitehorndnl pick out/analyze warning messages when the compile-line is long. 1545217309Snwhitehorndnl 1546217309Snwhitehorndnl Sets: 1547217309Snwhitehorndnl ECHO_LT - symbol to control if libtool is verbose 1548217309Snwhitehorndnl ECHO_LD - symbol to prefix "cc -o" lines 1549217309Snwhitehorndnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o) 1550217309Snwhitehorndnl SHOW_CC - symbol to put before explicit "cc -c" lines 1551217309Snwhitehorndnl ECHO_CC - symbol to put before any "cc" line 1552217309Snwhitehorndnl 1553217309SnwhitehornAC_DEFUN([CF_DISABLE_ECHO],[ 1554217309SnwhitehornAC_MSG_CHECKING(if you want to see long compiling messages) 1555217309SnwhitehornCF_ARG_DISABLE(echo, 1556217309Snwhitehorn [ --disable-echo display "compiling" commands], 1557217309Snwhitehorn [ 1558217309Snwhitehorn ECHO_LT='--silent' 1559217309Snwhitehorn ECHO_LD='@echo linking [$]@;' 1560217309Snwhitehorn RULE_CC='@echo compiling [$]<' 1561217309Snwhitehorn SHOW_CC='@echo compiling [$]@' 1562217309Snwhitehorn ECHO_CC='@' 1563217309Snwhitehorn],[ 1564217309Snwhitehorn ECHO_LT='' 1565217309Snwhitehorn ECHO_LD='' 1566217309Snwhitehorn RULE_CC='' 1567217309Snwhitehorn SHOW_CC='' 1568217309Snwhitehorn ECHO_CC='' 1569217309Snwhitehorn]) 1570217309SnwhitehornAC_MSG_RESULT($enableval) 1571217309SnwhitehornAC_SUBST(ECHO_LT) 1572217309SnwhitehornAC_SUBST(ECHO_LD) 1573217309SnwhitehornAC_SUBST(RULE_CC) 1574217309SnwhitehornAC_SUBST(SHOW_CC) 1575217309SnwhitehornAC_SUBST(ECHO_CC) 1576217309Snwhitehorn])dnl 1577217309Snwhitehorndnl --------------------------------------------------------------------------- 1578220749Snwhitehorndnl CF_DISABLE_LIBTOOL_VERSION version: 1 updated: 2010/05/15 15:45:59 1579220749Snwhitehorndnl -------------------------- 1580220749Snwhitehorndnl Check if we should use the libtool 1.5 feature "-version-number" instead of 1581220749Snwhitehorndnl the older "-version-info" feature. The newer feature allows us to use 1582220749Snwhitehorndnl version numbering on shared libraries which make them compatible with 1583220749Snwhitehorndnl various systems. 1584220749SnwhitehornAC_DEFUN([CF_DISABLE_LIBTOOL_VERSION], 1585220749Snwhitehorn[ 1586220749SnwhitehornAC_MSG_CHECKING(if libtool -version-number should be used) 1587220749SnwhitehornCF_ARG_DISABLE(libtool-version, 1588220749Snwhitehorn [ --disable-libtool-version enable to use libtool's incompatible naming scheme], 1589220749Snwhitehorn [cf_libtool_version=no], 1590220749Snwhitehorn [cf_libtool_version=yes]) 1591220749SnwhitehornAC_MSG_RESULT($cf_libtool_version) 1592220749Snwhitehorn 1593220749Snwhitehornif test "$cf_libtool_version" = yes ; then 1594220749Snwhitehorn LIBTOOL_VERSION="-version-number" 1595220749Snwhitehornelse 1596220749Snwhitehorn LIBTOOL_VERSION="-version-info" 1597220749Snwhitehornfi 1598220749Snwhitehorn 1599220749SnwhitehornAC_SUBST(LIBTOOL_VERSION) 1600220749Snwhitehorn])dnl 1601220749Snwhitehorndnl --------------------------------------------------------------------------- 1602224014Snwhitehorndnl CF_DISABLE_RPATH_HACK version: 2 updated: 2011/02/13 13:31:33 1603217309Snwhitehorndnl --------------------- 1604217309Snwhitehorndnl The rpath-hack makes it simpler to build programs, particularly with the 1605217309Snwhitehorndnl *BSD ports which may have essential libraries in unusual places. But it 1606217309Snwhitehorndnl can interfere with building an executable for the base system. Use this 1607217309Snwhitehorndnl option in that case. 1608217309SnwhitehornAC_DEFUN([CF_DISABLE_RPATH_HACK], 1609217309Snwhitehorn[ 1610224014SnwhitehornAC_MSG_CHECKING(if rpath-hack should be disabled) 1611217309SnwhitehornCF_ARG_DISABLE(rpath-hack, 1612217309Snwhitehorn [ --disable-rpath-hack don't add rpath options for additional libraries], 1613217309Snwhitehorn [cf_disable_rpath_hack=yes], 1614217309Snwhitehorn [cf_disable_rpath_hack=no]) 1615217309SnwhitehornAC_MSG_RESULT($cf_disable_rpath_hack) 1616217309Snwhitehornif test "$cf_disable_rpath_hack" = no ; then 1617217309Snwhitehorn CF_RPATH_HACK 1618217309Snwhitehornfi 1619217309Snwhitehorn]) 1620217309Snwhitehorndnl --------------------------------------------------------------------------- 1621217309Snwhitehorndnl CF_FIND_HEADER version: 2 updated: 2007/07/29 11:32:00 1622217309Snwhitehorndnl -------------- 1623217309Snwhitehorndnl Find a header file, searching for it if it is not already in the include 1624217309Snwhitehorndnl path. 1625217309Snwhitehorndnl 1626217309Snwhitehorndnl $1 = the header filename 1627217309Snwhitehorndnl $2 = the package name 1628217309Snwhitehorndnl $3 = action to perform if successful 1629217309Snwhitehorndnl $4 = action to perform if not successful 1630217309SnwhitehornAC_DEFUN([CF_FIND_HEADER],[ 1631217309SnwhitehornAC_CHECK_HEADER([$1], 1632217309Snwhitehorn cf_find_header=yes,[ 1633217309Snwhitehorn cf_find_header=no 1634217309SnwhitehornCF_HEADER_PATH(cf_search,$2) 1635217309Snwhitehornfor cf_incdir in $cf_search 1636217309Snwhitehorndo 1637217309Snwhitehorn if test -f $cf_incdir/$1 ; then 1638217309Snwhitehorn CF_ADD_INCDIR($cf_incdir) 1639217309Snwhitehorn CF_VERBOSE(... found in $cf_incdir) 1640217309Snwhitehorn cf_find_header=yes 1641217309Snwhitehorn break 1642217309Snwhitehorn fi 1643217309Snwhitehorn CF_VERBOSE(... tested $cf_incdir) 1644217309Snwhitehorndone 1645217309Snwhitehorn]) 1646217309Snwhitehornif test "$cf_find_header" = yes ; then 1647217309Snwhitehornifelse([$3],,:,[$3]) 1648217309Snwhitehornifelse([$4],,,[else 1649217309Snwhitehorn$4]) 1650217309Snwhitehornfi 1651217309Snwhitehorn])dnl 1652217309Snwhitehorndnl --------------------------------------------------------------------------- 1653217309Snwhitehorndnl CF_FIND_LIBRARY version: 9 updated: 2008/03/23 14:48:54 1654217309Snwhitehorndnl --------------- 1655217309Snwhitehorndnl Look for a non-standard library, given parameters for AC_TRY_LINK. We 1656217309Snwhitehorndnl prefer a standard location, and use -L options only if we do not find the 1657217309Snwhitehorndnl library in the standard library location(s). 1658217309Snwhitehorndnl $1 = library name 1659217309Snwhitehorndnl $2 = library class, usually the same as library name 1660217309Snwhitehorndnl $3 = includes 1661217309Snwhitehorndnl $4 = code fragment to compile/link 1662217309Snwhitehorndnl $5 = corresponding function-name 1663217309Snwhitehorndnl $6 = flag, nonnull if failure should not cause an error-exit 1664217309Snwhitehorndnl 1665217309Snwhitehorndnl Sets the variable "$cf_libdir" as a side-effect, so we can see if we had 1666217309Snwhitehorndnl to use a -L option. 1667217309SnwhitehornAC_DEFUN([CF_FIND_LIBRARY], 1668217309Snwhitehorn[ 1669217309Snwhitehorn eval 'cf_cv_have_lib_'$1'=no' 1670217309Snwhitehorn cf_libdir="" 1671217309Snwhitehorn AC_CHECK_FUNC($5, 1672217309Snwhitehorn eval 'cf_cv_have_lib_'$1'=yes',[ 1673217309Snwhitehorn cf_save_LIBS="$LIBS" 1674217309Snwhitehorn AC_MSG_CHECKING(for $5 in -l$1) 1675217309Snwhitehorn LIBS="-l$1 $LIBS" 1676217309Snwhitehorn AC_TRY_LINK([$3],[$4], 1677217309Snwhitehorn [AC_MSG_RESULT(yes) 1678217309Snwhitehorn eval 'cf_cv_have_lib_'$1'=yes' 1679217309Snwhitehorn ], 1680217309Snwhitehorn [AC_MSG_RESULT(no) 1681217309Snwhitehorn CF_LIBRARY_PATH(cf_search,$2) 1682217309Snwhitehorn for cf_libdir in $cf_search 1683217309Snwhitehorn do 1684217309Snwhitehorn AC_MSG_CHECKING(for -l$1 in $cf_libdir) 1685217309Snwhitehorn LIBS="-L$cf_libdir -l$1 $cf_save_LIBS" 1686217309Snwhitehorn AC_TRY_LINK([$3],[$4], 1687217309Snwhitehorn [AC_MSG_RESULT(yes) 1688217309Snwhitehorn eval 'cf_cv_have_lib_'$1'=yes' 1689217309Snwhitehorn break], 1690217309Snwhitehorn [AC_MSG_RESULT(no) 1691217309Snwhitehorn LIBS="$cf_save_LIBS"]) 1692217309Snwhitehorn done 1693217309Snwhitehorn ]) 1694217309Snwhitehorn ]) 1695217309Snwhitehorneval 'cf_found_library=[$]cf_cv_have_lib_'$1 1696217309Snwhitehornifelse($6,,[ 1697217309Snwhitehornif test $cf_found_library = no ; then 1698217309Snwhitehorn AC_MSG_ERROR(Cannot link $1 library) 1699217309Snwhitehornfi 1700217309Snwhitehorn]) 1701217309Snwhitehorn])dnl 1702217309Snwhitehorndnl --------------------------------------------------------------------------- 1703220749Snwhitehorndnl CF_FIND_LINKAGE version: 19 updated: 2010/05/29 16:31:02 1704217309Snwhitehorndnl --------------- 1705217309Snwhitehorndnl Find a library (specifically the linkage used in the code fragment), 1706217309Snwhitehorndnl searching for it if it is not already in the library path. 1707217309Snwhitehorndnl See also CF_ADD_SEARCHPATH. 1708217309Snwhitehorndnl 1709217309Snwhitehorndnl Parameters (4-on are optional): 1710217309Snwhitehorndnl $1 = headers for library entrypoint 1711217309Snwhitehorndnl $2 = code fragment for library entrypoint 1712217309Snwhitehorndnl $3 = the library name without the "-l" option or ".so" suffix. 1713217309Snwhitehorndnl $4 = action to perform if successful (default: update CPPFLAGS, etc) 1714217309Snwhitehorndnl $5 = action to perform if not successful 1715217309Snwhitehorndnl $6 = module name, if not the same as the library name 1716217309Snwhitehorndnl $7 = extra libraries 1717217309Snwhitehorndnl 1718217309Snwhitehorndnl Sets these variables: 1719217309Snwhitehorndnl $cf_cv_find_linkage_$3 - yes/no according to whether linkage is found 1720217309Snwhitehorndnl $cf_cv_header_path_$3 - include-directory if needed 1721217309Snwhitehorndnl $cf_cv_library_path_$3 - library-directory if needed 1722217309Snwhitehorndnl $cf_cv_library_file_$3 - library-file if needed, e.g., -l$3 1723217309SnwhitehornAC_DEFUN([CF_FIND_LINKAGE],[ 1724217309Snwhitehorn 1725217309Snwhitehorn# If the linkage is not already in the $CPPFLAGS/$LDFLAGS configuration, these 1726217309Snwhitehorn# will be set on completion of the AC_TRY_LINK below. 1727217309Snwhitehorncf_cv_header_path_$3= 1728217309Snwhitehorncf_cv_library_path_$3= 1729217309Snwhitehorn 1730217309SnwhitehornCF_MSG_LOG([Starting [FIND_LINKAGE]($3,$6)]) 1731217309Snwhitehorn 1732220749Snwhitehorncf_save_LIBS="$LIBS" 1733220749Snwhitehorn 1734217309SnwhitehornAC_TRY_LINK([$1],[$2],[ 1735217309Snwhitehorn cf_cv_find_linkage_$3=yes 1736220749Snwhitehorn cf_cv_header_path_$3=/usr/include 1737220749Snwhitehorn cf_cv_library_path_$3=/usr/lib 1738217309Snwhitehorn],[ 1739217309Snwhitehorn 1740217309SnwhitehornLIBS="-l$3 $7 $cf_save_LIBS" 1741217309Snwhitehorn 1742217309SnwhitehornAC_TRY_LINK([$1],[$2],[ 1743217309Snwhitehorn cf_cv_find_linkage_$3=yes 1744220749Snwhitehorn cf_cv_header_path_$3=/usr/include 1745220749Snwhitehorn cf_cv_library_path_$3=/usr/lib 1746217309Snwhitehorn cf_cv_library_file_$3="-l$3" 1747217309Snwhitehorn],[ 1748220749Snwhitehorn cf_cv_find_linkage_$3=no 1749217309Snwhitehorn LIBS="$cf_save_LIBS" 1750217309Snwhitehorn 1751217309Snwhitehorn CF_VERBOSE(find linkage for $3 library) 1752217309Snwhitehorn CF_MSG_LOG([Searching for headers in [FIND_LINKAGE]($3,$6)]) 1753217309Snwhitehorn 1754217309Snwhitehorn cf_save_CPPFLAGS="$CPPFLAGS" 1755217309Snwhitehorn cf_test_CPPFLAGS="$CPPFLAGS" 1756217309Snwhitehorn 1757217309Snwhitehorn CF_HEADER_PATH(cf_search,ifelse([$6],,[$3],[$6])) 1758217309Snwhitehorn for cf_cv_header_path_$3 in $cf_search 1759217309Snwhitehorn do 1760217309Snwhitehorn if test -d $cf_cv_header_path_$3 ; then 1761217309Snwhitehorn CF_VERBOSE(... testing $cf_cv_header_path_$3) 1762217309Snwhitehorn CPPFLAGS="$cf_save_CPPFLAGS -I$cf_cv_header_path_$3" 1763217309Snwhitehorn AC_TRY_COMPILE([$1],[$2],[ 1764217309Snwhitehorn CF_VERBOSE(... found $3 headers in $cf_cv_header_path_$3) 1765217309Snwhitehorn cf_cv_find_linkage_$3=maybe 1766217309Snwhitehorn cf_test_CPPFLAGS="$CPPFLAGS" 1767217309Snwhitehorn break],[ 1768217309Snwhitehorn CPPFLAGS="$cf_save_CPPFLAGS" 1769217309Snwhitehorn ]) 1770217309Snwhitehorn fi 1771217309Snwhitehorn done 1772217309Snwhitehorn 1773217309Snwhitehorn if test "$cf_cv_find_linkage_$3" = maybe ; then 1774217309Snwhitehorn 1775217309Snwhitehorn CF_MSG_LOG([Searching for $3 library in [FIND_LINKAGE]($3,$6)]) 1776217309Snwhitehorn 1777217309Snwhitehorn cf_save_LIBS="$LIBS" 1778217309Snwhitehorn cf_save_LDFLAGS="$LDFLAGS" 1779217309Snwhitehorn 1780217309Snwhitehorn ifelse([$6],,,[ 1781217309Snwhitehorn CPPFLAGS="$cf_test_CPPFLAGS" 1782217309Snwhitehorn LIBS="-l$3 $7 $cf_save_LIBS" 1783217309Snwhitehorn AC_TRY_LINK([$1],[$2],[ 1784217309Snwhitehorn CF_VERBOSE(... found $3 library in system) 1785217309Snwhitehorn cf_cv_find_linkage_$3=yes]) 1786217309Snwhitehorn CPPFLAGS="$cf_save_CPPFLAGS" 1787217309Snwhitehorn LIBS="$cf_save_LIBS" 1788217309Snwhitehorn ]) 1789217309Snwhitehorn 1790217309Snwhitehorn if test "$cf_cv_find_linkage_$3" != yes ; then 1791217309Snwhitehorn CF_LIBRARY_PATH(cf_search,$3) 1792217309Snwhitehorn for cf_cv_library_path_$3 in $cf_search 1793217309Snwhitehorn do 1794217309Snwhitehorn if test -d $cf_cv_library_path_$3 ; then 1795217309Snwhitehorn CF_VERBOSE(... testing $cf_cv_library_path_$3) 1796217309Snwhitehorn CPPFLAGS="$cf_test_CPPFLAGS" 1797217309Snwhitehorn LIBS="-l$3 $7 $cf_save_LIBS" 1798217309Snwhitehorn LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_$3" 1799217309Snwhitehorn AC_TRY_LINK([$1],[$2],[ 1800217309Snwhitehorn CF_VERBOSE(... found $3 library in $cf_cv_library_path_$3) 1801217309Snwhitehorn cf_cv_find_linkage_$3=yes 1802217309Snwhitehorn cf_cv_library_file_$3="-l$3" 1803217309Snwhitehorn break],[ 1804217309Snwhitehorn CPPFLAGS="$cf_save_CPPFLAGS" 1805217309Snwhitehorn LIBS="$cf_save_LIBS" 1806217309Snwhitehorn LDFLAGS="$cf_save_LDFLAGS" 1807217309Snwhitehorn ]) 1808217309Snwhitehorn fi 1809217309Snwhitehorn done 1810217309Snwhitehorn CPPFLAGS="$cf_save_CPPFLAGS" 1811217309Snwhitehorn LDFLAGS="$cf_save_LDFLAGS" 1812217309Snwhitehorn fi 1813217309Snwhitehorn 1814217309Snwhitehorn else 1815217309Snwhitehorn cf_cv_find_linkage_$3=no 1816217309Snwhitehorn fi 1817217309Snwhitehorn ],$7) 1818217309Snwhitehorn]) 1819217309Snwhitehorn 1820220749SnwhitehornLIBS="$cf_save_LIBS" 1821220749Snwhitehorn 1822217309Snwhitehornif test "$cf_cv_find_linkage_$3" = yes ; then 1823217309Snwhitehornifelse([$4],,[ 1824217309Snwhitehorn CF_ADD_INCDIR($cf_cv_header_path_$3) 1825217309Snwhitehorn CF_ADD_LIBDIR($cf_cv_library_path_$3) 1826220749Snwhitehorn CF_ADD_LIB($3) 1827217309Snwhitehorn],[$4]) 1828217309Snwhitehornelse 1829217309Snwhitehornifelse([$5],,AC_MSG_WARN(Cannot find $3 library),[$5]) 1830217309Snwhitehornfi 1831217309Snwhitehorn])dnl 1832217309Snwhitehorndnl --------------------------------------------------------------------------- 1833217309Snwhitehorndnl CF_FUNC_WAIT version: 2 updated: 1997/10/21 19:45:33 1834217309Snwhitehorndnl ------------ 1835217309Snwhitehorndnl Test for the presence of <sys/wait.h>, 'union wait', arg-type of 'wait()' 1836217309Snwhitehorndnl and/or 'waitpid()'. 1837217309Snwhitehorndnl 1838217309Snwhitehorndnl Note that we cannot simply grep for 'union wait' in the wait.h file, 1839217309Snwhitehorndnl because some Posix systems turn this on only when a BSD variable is 1840217309Snwhitehorndnl defined. 1841217309Snwhitehorndnl 1842217309Snwhitehorndnl I don't use AC_HEADER_SYS_WAIT, because it defines HAVE_SYS_WAIT_H, which 1843217309Snwhitehorndnl would conflict with an attempt to test that header directly. 1844217309Snwhitehorndnl 1845217309SnwhitehornAC_DEFUN([CF_FUNC_WAIT], 1846217309Snwhitehorn[ 1847217309SnwhitehornAC_REQUIRE([CF_UNION_WAIT]) 1848217309Snwhitehornif test $cf_cv_type_unionwait = yes; then 1849217309Snwhitehorn 1850217309Snwhitehorn AC_MSG_CHECKING(if union wait can be used as wait-arg) 1851217309Snwhitehorn AC_CACHE_VAL(cf_cv_arg_union_wait,[ 1852217309Snwhitehorn AC_TRY_COMPILE($cf_wait_headers, 1853217309Snwhitehorn [union wait x; wait(&x)], 1854217309Snwhitehorn [cf_cv_arg_union_wait=yes], 1855217309Snwhitehorn [cf_cv_arg_union_wait=no]) 1856217309Snwhitehorn ]) 1857217309Snwhitehorn AC_MSG_RESULT($cf_cv_arg_union_wait) 1858217309Snwhitehorn test $cf_cv_arg_union_wait = yes && AC_DEFINE(WAIT_USES_UNION) 1859217309Snwhitehorn 1860217309Snwhitehorn AC_MSG_CHECKING(if union wait can be used as waitpid-arg) 1861217309Snwhitehorn AC_CACHE_VAL(cf_cv_arg_union_waitpid,[ 1862217309Snwhitehorn AC_TRY_COMPILE($cf_wait_headers, 1863217309Snwhitehorn [union wait x; waitpid(0, &x, 0)], 1864217309Snwhitehorn [cf_cv_arg_union_waitpid=yes], 1865217309Snwhitehorn [cf_cv_arg_union_waitpid=no]) 1866217309Snwhitehorn ]) 1867217309Snwhitehorn AC_MSG_RESULT($cf_cv_arg_union_waitpid) 1868217309Snwhitehorn test $cf_cv_arg_union_waitpid = yes && AC_DEFINE(WAITPID_USES_UNION) 1869217309Snwhitehorn 1870217309Snwhitehornfi 1871217309Snwhitehorn])dnl 1872217309Snwhitehorndnl --------------------------------------------------------------------------- 1873220749Snwhitehorndnl CF_GCC_ATTRIBUTES version: 14 updated: 2010/10/23 15:52:32 1874217309Snwhitehorndnl ----------------- 1875217309Snwhitehorndnl Test for availability of useful gcc __attribute__ directives to quiet 1876217309Snwhitehorndnl compiler warnings. Though useful, not all are supported -- and contrary 1877217309Snwhitehorndnl to documentation, unrecognized directives cause older compilers to barf. 1878217309SnwhitehornAC_DEFUN([CF_GCC_ATTRIBUTES], 1879217309Snwhitehorn[ 1880217309Snwhitehornif test "$GCC" = yes 1881217309Snwhitehornthen 1882217309Snwhitehorncat > conftest.i <<EOF 1883217309Snwhitehorn#ifndef GCC_PRINTF 1884217309Snwhitehorn#define GCC_PRINTF 0 1885217309Snwhitehorn#endif 1886217309Snwhitehorn#ifndef GCC_SCANF 1887217309Snwhitehorn#define GCC_SCANF 0 1888217309Snwhitehorn#endif 1889217309Snwhitehorn#ifndef GCC_NORETURN 1890217309Snwhitehorn#define GCC_NORETURN /* nothing */ 1891217309Snwhitehorn#endif 1892217309Snwhitehorn#ifndef GCC_UNUSED 1893217309Snwhitehorn#define GCC_UNUSED /* nothing */ 1894217309Snwhitehorn#endif 1895217309SnwhitehornEOF 1896217309Snwhitehornif test "$GCC" = yes 1897217309Snwhitehornthen 1898217309Snwhitehorn AC_CHECKING([for $CC __attribute__ directives]) 1899217309Snwhitehorncat > conftest.$ac_ext <<EOF 1900220749Snwhitehorn#line __oline__ "${as_me:-configure}" 1901217309Snwhitehorn#include "confdefs.h" 1902217309Snwhitehorn#include "conftest.h" 1903217309Snwhitehorn#include "conftest.i" 1904217309Snwhitehorn#if GCC_PRINTF 1905217309Snwhitehorn#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) 1906217309Snwhitehorn#else 1907217309Snwhitehorn#define GCC_PRINTFLIKE(fmt,var) /*nothing*/ 1908217309Snwhitehorn#endif 1909217309Snwhitehorn#if GCC_SCANF 1910217309Snwhitehorn#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) 1911217309Snwhitehorn#else 1912217309Snwhitehorn#define GCC_SCANFLIKE(fmt,var) /*nothing*/ 1913217309Snwhitehorn#endif 1914217309Snwhitehornextern void wow(char *,...) GCC_SCANFLIKE(1,2); 1915217309Snwhitehornextern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; 1916217309Snwhitehornextern void foo(void) GCC_NORETURN; 1917217309Snwhitehornint main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; } 1918217309SnwhitehornEOF 1919217309Snwhitehorn cf_printf_attribute=no 1920217309Snwhitehorn cf_scanf_attribute=no 1921217309Snwhitehorn for cf_attribute in scanf printf unused noreturn 1922217309Snwhitehorn do 1923217309Snwhitehorn CF_UPPER(cf_ATTRIBUTE,$cf_attribute) 1924217309Snwhitehorn cf_directive="__attribute__(($cf_attribute))" 1925217309Snwhitehorn echo "checking for $CC $cf_directive" 1>&AC_FD_CC 1926217309Snwhitehorn 1927217309Snwhitehorn case $cf_attribute in #(vi 1928217309Snwhitehorn printf) #(vi 1929217309Snwhitehorn cf_printf_attribute=yes 1930217309Snwhitehorn cat >conftest.h <<EOF 1931217309Snwhitehorn#define GCC_$cf_ATTRIBUTE 1 1932217309SnwhitehornEOF 1933217309Snwhitehorn ;; 1934217309Snwhitehorn scanf) #(vi 1935217309Snwhitehorn cf_scanf_attribute=yes 1936217309Snwhitehorn cat >conftest.h <<EOF 1937217309Snwhitehorn#define GCC_$cf_ATTRIBUTE 1 1938217309SnwhitehornEOF 1939217309Snwhitehorn ;; 1940217309Snwhitehorn *) #(vi 1941217309Snwhitehorn cat >conftest.h <<EOF 1942217309Snwhitehorn#define GCC_$cf_ATTRIBUTE $cf_directive 1943217309SnwhitehornEOF 1944217309Snwhitehorn ;; 1945217309Snwhitehorn esac 1946217309Snwhitehorn 1947217309Snwhitehorn if AC_TRY_EVAL(ac_compile); then 1948217309Snwhitehorn test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute) 1949217309Snwhitehorn cat conftest.h >>confdefs.h 1950217309Snwhitehorn case $cf_attribute in #(vi 1951217309Snwhitehorn printf) #(vi 1952217309Snwhitehorn if test "$cf_printf_attribute" = no ; then 1953217309Snwhitehorn cat >>confdefs.h <<EOF 1954217309Snwhitehorn#define GCC_PRINTFLIKE(fmt,var) /* nothing */ 1955217309SnwhitehornEOF 1956217309Snwhitehorn else 1957217309Snwhitehorn cat >>confdefs.h <<EOF 1958217309Snwhitehorn#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) 1959217309SnwhitehornEOF 1960217309Snwhitehorn fi 1961217309Snwhitehorn ;; 1962217309Snwhitehorn scanf) #(vi 1963217309Snwhitehorn if test "$cf_scanf_attribute" = no ; then 1964217309Snwhitehorn cat >>confdefs.h <<EOF 1965217309Snwhitehorn#define GCC_SCANFLIKE(fmt,var) /* nothing */ 1966217309SnwhitehornEOF 1967217309Snwhitehorn else 1968217309Snwhitehorn cat >>confdefs.h <<EOF 1969217309Snwhitehorn#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) 1970217309SnwhitehornEOF 1971217309Snwhitehorn fi 1972217309Snwhitehorn ;; 1973217309Snwhitehorn esac 1974217309Snwhitehorn fi 1975217309Snwhitehorn done 1976217309Snwhitehornelse 1977217309Snwhitehorn fgrep define conftest.i >>confdefs.h 1978217309Snwhitehornfi 1979217309Snwhitehornrm -rf conftest* 1980217309Snwhitehornfi 1981217309Snwhitehorn])dnl 1982217309Snwhitehorndnl --------------------------------------------------------------------------- 1983217309Snwhitehorndnl CF_GCC_VERSION version: 5 updated: 2010/04/24 11:02:31 1984217309Snwhitehorndnl -------------- 1985217309Snwhitehorndnl Find version of gcc 1986217309SnwhitehornAC_DEFUN([CF_GCC_VERSION],[ 1987217309SnwhitehornAC_REQUIRE([AC_PROG_CC]) 1988217309SnwhitehornGCC_VERSION=none 1989217309Snwhitehornif test "$GCC" = yes ; then 1990217309Snwhitehorn AC_MSG_CHECKING(version of $CC) 1991217309Snwhitehorn GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`" 1992217309Snwhitehorn test -z "$GCC_VERSION" && GCC_VERSION=unknown 1993217309Snwhitehorn AC_MSG_RESULT($GCC_VERSION) 1994217309Snwhitehornfi 1995217309Snwhitehorn])dnl 1996217309Snwhitehorndnl --------------------------------------------------------------------------- 1997220749Snwhitehorndnl CF_GCC_WARNINGS version: 27 updated: 2010/10/23 15:52:32 1998217309Snwhitehorndnl --------------- 1999217309Snwhitehorndnl Check if the compiler supports useful warning options. There's a few that 2000217309Snwhitehorndnl we don't use, simply because they're too noisy: 2001217309Snwhitehorndnl 2002217309Snwhitehorndnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x) 2003217309Snwhitehorndnl -Wredundant-decls (system headers make this too noisy) 2004217309Snwhitehorndnl -Wtraditional (combines too many unrelated messages, only a few useful) 2005217309Snwhitehorndnl -Wwrite-strings (too noisy, but should review occasionally). This 2006217309Snwhitehorndnl is enabled for ncurses using "--enable-const". 2007217309Snwhitehorndnl -pedantic 2008217309Snwhitehorndnl 2009217309Snwhitehorndnl Parameter: 2010217309Snwhitehorndnl $1 is an optional list of gcc warning flags that a particular 2011217309Snwhitehorndnl application might want to use, e.g., "no-unused" for 2012217309Snwhitehorndnl -Wno-unused 2013217309Snwhitehorndnl Special: 2014217309Snwhitehorndnl If $with_ext_const is "yes", add a check for -Wwrite-strings 2015217309Snwhitehorndnl 2016217309SnwhitehornAC_DEFUN([CF_GCC_WARNINGS], 2017217309Snwhitehorn[ 2018217309SnwhitehornAC_REQUIRE([CF_GCC_VERSION]) 2019217309SnwhitehornCF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS) 2020217309Snwhitehorn 2021217309Snwhitehorncat > conftest.$ac_ext <<EOF 2022220749Snwhitehorn#line __oline__ "${as_me:-configure}" 2023217309Snwhitehornint main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; } 2024217309SnwhitehornEOF 2025217309Snwhitehorn 2026217309Snwhitehornif test "$INTEL_COMPILER" = yes 2027217309Snwhitehornthen 2028217309Snwhitehorn# The "-wdXXX" options suppress warnings: 2029217309Snwhitehorn# remark #1419: external declaration in primary source file 2030217309Snwhitehorn# remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem) 2031217309Snwhitehorn# remark #1684: conversion from pointer to same-sized integral type (potential portability problem) 2032217309Snwhitehorn# remark #193: zero used for undefined preprocessing identifier 2033217309Snwhitehorn# remark #593: variable "curs_sb_left_arrow" was set but never used 2034217309Snwhitehorn# remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits 2035217309Snwhitehorn# remark #869: parameter "tw" was never referenced 2036217309Snwhitehorn# remark #981: operands are evaluated in unspecified order 2037217309Snwhitehorn# warning #279: controlling expression is constant 2038217309Snwhitehorn 2039217309Snwhitehorn AC_CHECKING([for $CC warning options]) 2040217309Snwhitehorn cf_save_CFLAGS="$CFLAGS" 2041217309Snwhitehorn EXTRA_CFLAGS="-Wall" 2042217309Snwhitehorn for cf_opt in \ 2043217309Snwhitehorn wd1419 \ 2044217309Snwhitehorn wd1683 \ 2045217309Snwhitehorn wd1684 \ 2046217309Snwhitehorn wd193 \ 2047217309Snwhitehorn wd593 \ 2048217309Snwhitehorn wd279 \ 2049217309Snwhitehorn wd810 \ 2050217309Snwhitehorn wd869 \ 2051217309Snwhitehorn wd981 2052217309Snwhitehorn do 2053217309Snwhitehorn CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" 2054217309Snwhitehorn if AC_TRY_EVAL(ac_compile); then 2055217309Snwhitehorn test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt) 2056217309Snwhitehorn EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" 2057217309Snwhitehorn fi 2058217309Snwhitehorn done 2059217309Snwhitehorn CFLAGS="$cf_save_CFLAGS" 2060217309Snwhitehorn 2061217309Snwhitehornelif test "$GCC" = yes 2062217309Snwhitehornthen 2063217309Snwhitehorn AC_CHECKING([for $CC warning options]) 2064217309Snwhitehorn cf_save_CFLAGS="$CFLAGS" 2065217309Snwhitehorn EXTRA_CFLAGS= 2066217309Snwhitehorn cf_warn_CONST="" 2067217309Snwhitehorn test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings" 2068217309Snwhitehorn for cf_opt in W Wall \ 2069217309Snwhitehorn Wbad-function-cast \ 2070217309Snwhitehorn Wcast-align \ 2071217309Snwhitehorn Wcast-qual \ 2072217309Snwhitehorn Winline \ 2073217309Snwhitehorn Wmissing-declarations \ 2074217309Snwhitehorn Wmissing-prototypes \ 2075217309Snwhitehorn Wnested-externs \ 2076217309Snwhitehorn Wpointer-arith \ 2077217309Snwhitehorn Wshadow \ 2078217309Snwhitehorn Wstrict-prototypes \ 2079217309Snwhitehorn Wundef $cf_warn_CONST $1 2080217309Snwhitehorn do 2081217309Snwhitehorn CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" 2082217309Snwhitehorn if AC_TRY_EVAL(ac_compile); then 2083217309Snwhitehorn test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt) 2084217309Snwhitehorn case $cf_opt in #(vi 2085217309Snwhitehorn Wcast-qual) #(vi 2086217309Snwhitehorn CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES" 2087217309Snwhitehorn ;; 2088217309Snwhitehorn Winline) #(vi 2089217309Snwhitehorn case $GCC_VERSION in 2090217309Snwhitehorn [[34]].*) 2091217309Snwhitehorn CF_VERBOSE(feature is broken in gcc $GCC_VERSION) 2092217309Snwhitehorn continue;; 2093217309Snwhitehorn esac 2094217309Snwhitehorn ;; 2095217309Snwhitehorn esac 2096217309Snwhitehorn EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" 2097217309Snwhitehorn fi 2098217309Snwhitehorn done 2099217309Snwhitehorn CFLAGS="$cf_save_CFLAGS" 2100217309Snwhitehornfi 2101220749Snwhitehornrm -rf conftest* 2102217309Snwhitehorn 2103217309SnwhitehornAC_SUBST(EXTRA_CFLAGS) 2104217309Snwhitehorn])dnl 2105217309Snwhitehorndnl --------------------------------------------------------------------------- 2106217309Snwhitehorndnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07 2107217309Snwhitehorndnl ------------- 2108217309Snwhitehorndnl Check if we must define _GNU_SOURCE to get a reasonable value for 2109217309Snwhitehorndnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect 2110217309Snwhitehorndnl (or misfeature) of glibc2, which breaks portability of many applications, 2111217309Snwhitehorndnl since it is interwoven with GNU extensions. 2112217309Snwhitehorndnl 2113217309Snwhitehorndnl Well, yes we could work around it... 2114217309SnwhitehornAC_DEFUN([CF_GNU_SOURCE], 2115217309Snwhitehorn[ 2116217309SnwhitehornAC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[ 2117217309SnwhitehornAC_TRY_COMPILE([#include <sys/types.h>],[ 2118217309Snwhitehorn#ifndef _XOPEN_SOURCE 2119217309Snwhitehornmake an error 2120217309Snwhitehorn#endif], 2121217309Snwhitehorn [cf_cv_gnu_source=no], 2122217309Snwhitehorn [cf_save="$CPPFLAGS" 2123217309Snwhitehorn CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" 2124217309Snwhitehorn AC_TRY_COMPILE([#include <sys/types.h>],[ 2125217309Snwhitehorn#ifdef _XOPEN_SOURCE 2126217309Snwhitehornmake an error 2127217309Snwhitehorn#endif], 2128217309Snwhitehorn [cf_cv_gnu_source=no], 2129217309Snwhitehorn [cf_cv_gnu_source=yes]) 2130217309Snwhitehorn CPPFLAGS="$cf_save" 2131217309Snwhitehorn ]) 2132217309Snwhitehorn]) 2133217309Snwhitehorntest "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" 2134217309Snwhitehorn])dnl 2135217309Snwhitehorndnl --------------------------------------------------------------------------- 2136217309Snwhitehorndnl CF_HEADERS_SH version: 1 updated: 2007/07/04 15:37:05 2137217309Snwhitehorndnl ------------- 2138217309Snwhitehorndnl Setup variables needed to construct headers-sh 2139217309SnwhitehornAC_DEFUN([CF_HEADERS_SH],[ 2140217309SnwhitehornPACKAGE_PREFIX=$1 2141217309SnwhitehornPACKAGE_CONFIG=$2 2142217309SnwhitehornAC_SUBST(PACKAGE_PREFIX) 2143217309SnwhitehornAC_SUBST(PACKAGE_CONFIG) 2144217309SnwhitehornEXTRA_OUTPUT="$EXTRA_OUTPUT headers-sh:$srcdir/headers-sh.in" 2145217309Snwhitehorn]) 2146217309Snwhitehorndnl --------------------------------------------------------------------------- 2147220749Snwhitehorndnl CF_HEADER_PATH version: 12 updated: 2010/05/05 05:22:40 2148217309Snwhitehorndnl -------------- 2149217309Snwhitehorndnl Construct a search-list of directories for a nonstandard header-file 2150217309Snwhitehorndnl 2151217309Snwhitehorndnl Parameters 2152217309Snwhitehorndnl $1 = the variable to return as result 2153217309Snwhitehorndnl $2 = the package name 2154217309SnwhitehornAC_DEFUN([CF_HEADER_PATH], 2155217309Snwhitehorn[ 2156217309Snwhitehorn$1= 2157217309Snwhitehorn 2158217309Snwhitehorn# collect the current set of include-directories from compiler flags 2159217309Snwhitehorncf_header_path_list="" 2160217309Snwhitehornif test -n "${CFLAGS}${CPPFLAGS}" ; then 2161217309Snwhitehorn for cf_header_path in $CPPFLAGS $CFLAGS 2162217309Snwhitehorn do 2163217309Snwhitehorn case $cf_header_path in #(vi 2164217309Snwhitehorn -I*) 2165217309Snwhitehorn cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'` 2166220749Snwhitehorn CF_ADD_SUBDIR_PATH($1,$2,include,$cf_header_path,NONE) 2167220749Snwhitehorn cf_header_path_list="$cf_header_path_list [$]$1" 2168217309Snwhitehorn ;; 2169217309Snwhitehorn esac 2170217309Snwhitehorn done 2171217309Snwhitehornfi 2172217309Snwhitehorn 2173217309Snwhitehorn# add the variations for the package we are looking for 2174217309SnwhitehornCF_SUBDIR_PATH($1,$2,include) 2175217309Snwhitehorn 2176217309Snwhitehorntest "$includedir" != NONE && \ 2177217309Snwhitehorntest "$includedir" != "/usr/include" && \ 2178217309Snwhitehorntest -d "$includedir" && { 2179217309Snwhitehorn test -d $includedir && $1="[$]$1 $includedir" 2180217309Snwhitehorn test -d $includedir/$2 && $1="[$]$1 $includedir/$2" 2181217309Snwhitehorn} 2182217309Snwhitehorn 2183217309Snwhitehorntest "$oldincludedir" != NONE && \ 2184217309Snwhitehorntest "$oldincludedir" != "/usr/include" && \ 2185217309Snwhitehorntest -d "$oldincludedir" && { 2186217309Snwhitehorn test -d $oldincludedir && $1="[$]$1 $oldincludedir" 2187217309Snwhitehorn test -d $oldincludedir/$2 && $1="[$]$1 $oldincludedir/$2" 2188217309Snwhitehorn} 2189217309Snwhitehorn 2190217309Snwhitehorn$1="[$]$1 $cf_header_path_list" 2191217309Snwhitehorn])dnl 2192217309Snwhitehorndnl --------------------------------------------------------------------------- 2193217309Snwhitehorndnl CF_HELP_MESSAGE version: 3 updated: 1998/01/14 10:56:23 2194217309Snwhitehorndnl --------------- 2195217309Snwhitehorndnl Insert text into the help-message, for readability, from AC_ARG_WITH. 2196217309SnwhitehornAC_DEFUN([CF_HELP_MESSAGE], 2197217309Snwhitehorn[AC_DIVERT_HELP([$1])dnl 2198217309Snwhitehorn])dnl 2199217309Snwhitehorndnl --------------------------------------------------------------------------- 2200217309Snwhitehorndnl CF_INCLUDE_DIRS version: 6 updated: 2009/01/06 19:37:40 2201217309Snwhitehorndnl --------------- 2202217309Snwhitehorndnl Construct the list of include-options according to whether we're building 2203217309Snwhitehorndnl in the source directory or using '--srcdir=DIR' option. If we're building 2204217309Snwhitehorndnl with gcc, don't append the includedir if it happens to be /usr/include, 2205217309Snwhitehorndnl since that usually breaks gcc's shadow-includes. 2206217309SnwhitehornAC_DEFUN([CF_INCLUDE_DIRS], 2207217309Snwhitehorn[ 2208217309SnwhitehornCPPFLAGS="$CPPFLAGS -I. -I../include" 2209217309Snwhitehornif test "$srcdir" != "."; then 2210217309Snwhitehorn CPPFLAGS="$CPPFLAGS -I\${srcdir}/../include" 2211217309Snwhitehornfi 2212217309Snwhitehornif test "$GCC" != yes; then 2213217309Snwhitehorn CPPFLAGS="$CPPFLAGS -I\${includedir}" 2214217309Snwhitehornelif test "$includedir" != "/usr/include"; then 2215217309Snwhitehorn if test "$includedir" = '${prefix}/include' ; then 2216217309Snwhitehorn if test $prefix != /usr ; then 2217217309Snwhitehorn CPPFLAGS="$CPPFLAGS -I\${includedir}" 2218217309Snwhitehorn fi 2219217309Snwhitehorn else 2220217309Snwhitehorn CPPFLAGS="$CPPFLAGS -I\${includedir}" 2221217309Snwhitehorn fi 2222217309Snwhitehornfi 2223217309SnwhitehornAC_SUBST(CPPFLAGS) 2224217309Snwhitehorn])dnl 2225217309Snwhitehorndnl --------------------------------------------------------------------------- 2226217309Snwhitehorndnl CF_INCLUDE_PATH version: 5 updated: 2010/01/17 20:36:17 2227217309Snwhitehorndnl --------------- 2228217309Snwhitehorndnl Adds to the include-path 2229217309Snwhitehorndnl 2230217309Snwhitehorndnl Autoconf 1.11 should have provided a way to add include path options to 2231217309Snwhitehorndnl the cpp-tests. 2232217309Snwhitehorndnl 2233217309SnwhitehornAC_DEFUN([CF_INCLUDE_PATH], 2234217309Snwhitehorn[ 2235217309Snwhitehorn$1= 2236217309Snwhitehornfor cf_path in $1 2237217309Snwhitehorndo 2238217309Snwhitehorn cf_result="no" 2239217309Snwhitehorn AC_MSG_CHECKING(for directory $cf_path) 2240217309Snwhitehorn if test -d $cf_path 2241217309Snwhitehorn then 2242217309Snwhitehorn INCLUDES="$INCLUDES -I$cf_path" 2243217309Snwhitehorn ac_cpp="${ac_cpp} -I$cf_path" 2244217309Snwhitehorn CFLAGS="$CFLAGS -I$cf_path" 2245217309Snwhitehorn cf_result="yes" 2246217309Snwhitehorn case $cf_path in 2247217309Snwhitehorn /usr/include|/usr/include/*) 2248217309Snwhitehorn ;; 2249217309Snwhitehorn *) 2250217309Snwhitehorn CF_DIRNAME(cf_temp,$cf_path) 2251217309Snwhitehorn case $cf_temp in 2252217309Snwhitehorn */include) 2253217309Snwhitehorn INCLUDES="$INCLUDES -I$cf_temp" 2254217309Snwhitehorn ac_cpp="${ac_cpp} -I$cf_temp" 2255217309Snwhitehorn CFLAGS="$CFLAGS -I$cf_temp" 2256217309Snwhitehorn ;; 2257217309Snwhitehorn esac 2258217309Snwhitehorn esac 2259217309Snwhitehorn fi 2260217309Snwhitehorn AC_MSG_RESULT($cf_result) 2261217309Snwhitehorndone 2262217309Snwhitehorn])dnl 2263217309Snwhitehorndnl --------------------------------------------------------------------------- 2264220749Snwhitehorndnl CF_INTEL_COMPILER version: 4 updated: 2010/05/26 05:38:42 2265217309Snwhitehorndnl ----------------- 2266217309Snwhitehorndnl Check if the given compiler is really the Intel compiler for Linux. It 2267217309Snwhitehorndnl tries to imitate gcc, but does not return an error when it finds a mismatch 2268217309Snwhitehorndnl between prototypes, e.g., as exercised by CF_MISSING_CHECK. 2269217309Snwhitehorndnl 2270217309Snwhitehorndnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to 2271217309Snwhitehorndnl ensure that it is not mistaken for gcc/g++. It is normally invoked from 2272217309Snwhitehorndnl the wrappers for gcc and g++ warnings. 2273217309Snwhitehorndnl 2274217309Snwhitehorndnl $1 = GCC (default) or GXX 2275217309Snwhitehorndnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS 2276217309Snwhitehorndnl $3 = CFLAGS (default) or CXXFLAGS 2277217309SnwhitehornAC_DEFUN([CF_INTEL_COMPILER],[ 2278220749Snwhitehornifelse([$2],,INTEL_COMPILER,[$2])=no 2279217309Snwhitehorn 2280220749Snwhitehornif test "$ifelse([$1],,[$1],GCC)" = yes ; then 2281217309Snwhitehorn case $host_os in 2282217309Snwhitehorn linux*|gnu*) 2283220749Snwhitehorn AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler) 2284220749Snwhitehorn cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" 2285220749Snwhitehorn ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc" 2286217309Snwhitehorn AC_TRY_COMPILE([],[ 2287217309Snwhitehorn#ifdef __INTEL_COMPILER 2288217309Snwhitehorn#else 2289217309Snwhitehornmake an error 2290217309Snwhitehorn#endif 2291220749Snwhitehorn],[ifelse([$2],,INTEL_COMPILER,[$2])=yes 2292217309Snwhitehorncf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc" 2293217309Snwhitehorn],[]) 2294220749Snwhitehorn ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" 2295220749Snwhitehorn AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2])) 2296217309Snwhitehorn ;; 2297217309Snwhitehorn esac 2298217309Snwhitehornfi 2299217309Snwhitehorn])dnl 2300217309Snwhitehorndnl --------------------------------------------------------------------------- 2301217309Snwhitehorndnl CF_LARGEFILE version: 7 updated: 2007/06/02 11:58:50 2302217309Snwhitehorndnl ------------ 2303217309Snwhitehorndnl Add checks for large file support. 2304217309SnwhitehornAC_DEFUN([CF_LARGEFILE],[ 2305217309Snwhitehornifdef([AC_FUNC_FSEEKO],[ 2306217309Snwhitehorn AC_SYS_LARGEFILE 2307217309Snwhitehorn if test "$enable_largefile" != no ; then 2308217309Snwhitehorn AC_FUNC_FSEEKO 2309217309Snwhitehorn 2310217309Snwhitehorn # Normally we would collect these definitions in the config.h, 2311217309Snwhitehorn # but (like _XOPEN_SOURCE), some environments rely on having these 2312217309Snwhitehorn # defined before any of the system headers are included. Another 2313217309Snwhitehorn # case comes up with C++, e.g., on AIX the compiler compiles the 2314217309Snwhitehorn # header files by themselves before looking at the body files it is 2315217309Snwhitehorn # told to compile. For ncurses, those header files do not include 2316217309Snwhitehorn # the config.h 2317217309Snwhitehorn test "$ac_cv_sys_large_files" != no && CPPFLAGS="$CPPFLAGS -D_LARGE_FILES " 2318217309Snwhitehorn test "$ac_cv_sys_largefile_source" != no && CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE " 2319217309Snwhitehorn test "$ac_cv_sys_file_offset_bits" != no && CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits " 2320217309Snwhitehorn 2321217309Snwhitehorn AC_CACHE_CHECK(whether to use struct dirent64, cf_cv_struct_dirent64,[ 2322217309Snwhitehorn AC_TRY_COMPILE([ 2323217309Snwhitehorn#include <sys/types.h> 2324217309Snwhitehorn#include <dirent.h> 2325217309Snwhitehorn ],[ 2326217309Snwhitehorn /* if transitional largefile support is setup, this is true */ 2327217309Snwhitehorn extern struct dirent64 * readdir(DIR *); 2328217309Snwhitehorn struct dirent64 *x = readdir((DIR *)0); 2329217309Snwhitehorn struct dirent *y = readdir((DIR *)0); 2330217309Snwhitehorn int z = x - y; 2331217309Snwhitehorn ], 2332217309Snwhitehorn [cf_cv_struct_dirent64=yes], 2333217309Snwhitehorn [cf_cv_struct_dirent64=no]) 2334217309Snwhitehorn ]) 2335217309Snwhitehorn test "$cf_cv_struct_dirent64" = yes && AC_DEFINE(HAVE_STRUCT_DIRENT64) 2336217309Snwhitehorn fi 2337217309Snwhitehorn]) 2338217309Snwhitehorn]) 2339217309Snwhitehorndnl --------------------------------------------------------------------------- 2340224014Snwhitehorndnl CF_LD_RPATH_OPT version: 4 updated: 2011/06/04 20:09:13 2341217309Snwhitehorndnl --------------- 2342217309Snwhitehorndnl For the given system and compiler, find the compiler flags to pass to the 2343217309Snwhitehorndnl loader to use the "rpath" feature. 2344217309SnwhitehornAC_DEFUN([CF_LD_RPATH_OPT], 2345217309Snwhitehorn[ 2346217309SnwhitehornAC_REQUIRE([CF_CHECK_CACHE]) 2347217309Snwhitehorn 2348217309SnwhitehornLD_RPATH_OPT= 2349217309SnwhitehornAC_MSG_CHECKING(for an rpath option) 2350217309Snwhitehorncase $cf_cv_system_name in #(vi 2351217309Snwhitehornirix*) #(vi 2352217309Snwhitehorn if test "$GCC" = yes; then 2353217309Snwhitehorn LD_RPATH_OPT="-Wl,-rpath," 2354217309Snwhitehorn else 2355217309Snwhitehorn LD_RPATH_OPT="-rpath " 2356217309Snwhitehorn fi 2357217309Snwhitehorn ;; 2358217309Snwhitehornlinux*|gnu*|k*bsd*-gnu) #(vi 2359217309Snwhitehorn LD_RPATH_OPT="-Wl,-rpath," 2360217309Snwhitehorn ;; 2361224014Snwhitehornopenbsd[[2-9]].*|mirbsd*) #(vi 2362217309Snwhitehorn LD_RPATH_OPT="-Wl,-rpath," 2363217309Snwhitehorn ;; 2364217309Snwhitehornfreebsd*) #(vi 2365217309Snwhitehorn LD_RPATH_OPT="-rpath " 2366217309Snwhitehorn ;; 2367217309Snwhitehornnetbsd*) #(vi 2368217309Snwhitehorn LD_RPATH_OPT="-Wl,-rpath," 2369217309Snwhitehorn ;; 2370217309Snwhitehornosf*|mls+*) #(vi 2371217309Snwhitehorn LD_RPATH_OPT="-rpath " 2372217309Snwhitehorn ;; 2373217309Snwhitehornsolaris2*) #(vi 2374217309Snwhitehorn LD_RPATH_OPT="-R" 2375217309Snwhitehorn ;; 2376217309Snwhitehorn*) 2377217309Snwhitehorn ;; 2378217309Snwhitehornesac 2379217309SnwhitehornAC_MSG_RESULT($LD_RPATH_OPT) 2380217309Snwhitehorn 2381217309Snwhitehorncase "x$LD_RPATH_OPT" in #(vi 2382217309Snwhitehornx-R*) 2383217309Snwhitehorn AC_MSG_CHECKING(if we need a space after rpath option) 2384217309Snwhitehorn cf_save_LIBS="$LIBS" 2385220749Snwhitehorn CF_ADD_LIBS(${LD_RPATH_OPT}$libdir) 2386217309Snwhitehorn AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes) 2387217309Snwhitehorn LIBS="$cf_save_LIBS" 2388217309Snwhitehorn AC_MSG_RESULT($cf_rpath_space) 2389217309Snwhitehorn test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT " 2390217309Snwhitehorn ;; 2391217309Snwhitehornesac 2392217309Snwhitehorn])dnl 2393217309Snwhitehorndnl --------------------------------------------------------------------------- 2394217309Snwhitehorndnl CF_LIBRARY_PATH version: 9 updated: 2010/03/28 12:52:50 2395217309Snwhitehorndnl --------------- 2396217309Snwhitehorndnl Construct a search-list of directories for a nonstandard library-file 2397217309Snwhitehorndnl 2398217309Snwhitehorndnl Parameters 2399217309Snwhitehorndnl $1 = the variable to return as result 2400217309Snwhitehorndnl $2 = the package name 2401217309SnwhitehornAC_DEFUN([CF_LIBRARY_PATH], 2402217309Snwhitehorn[ 2403217309Snwhitehorn$1= 2404217309Snwhitehorncf_library_path_list="" 2405217309Snwhitehornif test -n "${LDFLAGS}${LIBS}" ; then 2406217309Snwhitehorn for cf_library_path in $LDFLAGS $LIBS 2407217309Snwhitehorn do 2408217309Snwhitehorn case $cf_library_path in #(vi 2409217309Snwhitehorn -L*) 2410217309Snwhitehorn cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'` 2411217309Snwhitehorn CF_ADD_SUBDIR_PATH($1,$2,lib,$cf_library_path,NONE) 2412217309Snwhitehorn cf_library_path_list="$cf_library_path_list [$]$1" 2413217309Snwhitehorn ;; 2414217309Snwhitehorn esac 2415217309Snwhitehorn done 2416217309Snwhitehornfi 2417217309Snwhitehorn 2418217309SnwhitehornCF_SUBDIR_PATH($1,$2,lib) 2419217309Snwhitehorn 2420217309Snwhitehorn$1="$cf_library_path_list [$]$1" 2421217309Snwhitehorn])dnl 2422217309Snwhitehorndnl --------------------------------------------------------------------------- 2423217309Snwhitehorndnl CF_LIB_PREFIX version: 8 updated: 2008/09/13 11:34:16 2424217309Snwhitehorndnl ------------- 2425217309Snwhitehorndnl Compute the library-prefix for the given host system 2426217309Snwhitehorndnl $1 = variable to set 2427217309SnwhitehornAC_DEFUN([CF_LIB_PREFIX], 2428217309Snwhitehorn[ 2429217309Snwhitehorn case $cf_cv_system_name in #(vi 2430217309Snwhitehorn OS/2*|os2*) #(vi 2431217309Snwhitehorn LIB_PREFIX='' 2432217309Snwhitehorn ;; 2433217309Snwhitehorn *) LIB_PREFIX='lib' 2434217309Snwhitehorn ;; 2435217309Snwhitehorn esac 2436217309Snwhitehornifelse($1,,,[$1=$LIB_PREFIX]) 2437217309Snwhitehorn AC_SUBST(LIB_PREFIX) 2438217309Snwhitehorn])dnl 2439217309Snwhitehorndnl --------------------------------------------------------------------------- 2440224014Snwhitehorndnl CF_MAKEFLAGS version: 14 updated: 2011/03/31 19:29:46 2441217309Snwhitehorndnl ------------ 2442217309Snwhitehorndnl Some 'make' programs support ${MAKEFLAGS}, some ${MFLAGS}, to pass 'make' 2443217309Snwhitehorndnl options to lower-levels. It's very useful for "make -n" -- if we have it. 2444217309Snwhitehorndnl (GNU 'make' does both, something POSIX 'make', which happens to make the 2445217309Snwhitehorndnl ${MAKEFLAGS} variable incompatible because it adds the assignments :-) 2446217309SnwhitehornAC_DEFUN([CF_MAKEFLAGS], 2447217309Snwhitehorn[ 2448217309SnwhitehornAC_CACHE_CHECK(for makeflags variable, cf_cv_makeflags,[ 2449217309Snwhitehorn cf_cv_makeflags='' 2450217309Snwhitehorn for cf_option in '-${MAKEFLAGS}' '${MFLAGS}' 2451217309Snwhitehorn do 2452217309Snwhitehorn cat >cf_makeflags.tmp <<CF_EOF 2453217309SnwhitehornSHELL = /bin/sh 2454217309Snwhitehornall : 2455217309Snwhitehorn @ echo '.$cf_option' 2456217309SnwhitehornCF_EOF 2457224014Snwhitehorn cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp 2>/dev/null | fgrep -v "ing directory" | sed -e 's,[[ ]]*$,,'` 2458217309Snwhitehorn case "$cf_result" in 2459217309Snwhitehorn .*k) 2460220749Snwhitehorn cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp CC=cc 2>/dev/null` 2461217309Snwhitehorn case "$cf_result" in 2462217309Snwhitehorn .*CC=*) cf_cv_makeflags= 2463217309Snwhitehorn ;; 2464217309Snwhitehorn *) cf_cv_makeflags=$cf_option 2465217309Snwhitehorn ;; 2466217309Snwhitehorn esac 2467217309Snwhitehorn break 2468217309Snwhitehorn ;; 2469217309Snwhitehorn .-) ;; 2470217309Snwhitehorn *) echo "given option \"$cf_option\", no match \"$cf_result\"" 2471217309Snwhitehorn ;; 2472217309Snwhitehorn esac 2473217309Snwhitehorn done 2474217309Snwhitehorn rm -f cf_makeflags.tmp 2475217309Snwhitehorn]) 2476217309Snwhitehorn 2477217309SnwhitehornAC_SUBST(cf_cv_makeflags) 2478217309Snwhitehorn])dnl 2479217309Snwhitehorndnl --------------------------------------------------------------------------- 2480220749Snwhitehorndnl CF_MAKE_TAGS version: 6 updated: 2010/10/23 15:52:32 2481217309Snwhitehorndnl ------------ 2482217309Snwhitehorndnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have 2483217309Snwhitehorndnl a monocase filesystem. 2484217309SnwhitehornAC_DEFUN([CF_MAKE_TAGS],[ 2485217309SnwhitehornAC_REQUIRE([CF_MIXEDCASE_FILENAMES]) 2486217309Snwhitehorn 2487217309SnwhitehornAC_CHECK_PROGS(CTAGS, exctags ctags) 2488217309SnwhitehornAC_CHECK_PROGS(ETAGS, exetags etags) 2489217309Snwhitehorn 2490220749SnwhitehornAC_CHECK_PROG(MAKE_LOWER_TAGS, ${CTAGS:-ctags}, yes, no) 2491217309Snwhitehorn 2492217309Snwhitehornif test "$cf_cv_mixedcase" = yes ; then 2493220749Snwhitehorn AC_CHECK_PROG(MAKE_UPPER_TAGS, ${ETAGS:-etags}, yes, no) 2494217309Snwhitehornelse 2495217309Snwhitehorn MAKE_UPPER_TAGS=no 2496217309Snwhitehornfi 2497217309Snwhitehorn 2498217309Snwhitehornif test "$MAKE_UPPER_TAGS" = yes ; then 2499217309Snwhitehorn MAKE_UPPER_TAGS= 2500217309Snwhitehornelse 2501217309Snwhitehorn MAKE_UPPER_TAGS="#" 2502217309Snwhitehornfi 2503217309Snwhitehorn 2504217309Snwhitehornif test "$MAKE_LOWER_TAGS" = yes ; then 2505217309Snwhitehorn MAKE_LOWER_TAGS= 2506217309Snwhitehornelse 2507217309Snwhitehorn MAKE_LOWER_TAGS="#" 2508217309Snwhitehornfi 2509217309Snwhitehorn 2510217309SnwhitehornAC_SUBST(CTAGS) 2511217309SnwhitehornAC_SUBST(ETAGS) 2512217309Snwhitehorn 2513217309SnwhitehornAC_SUBST(MAKE_UPPER_TAGS) 2514217309SnwhitehornAC_SUBST(MAKE_LOWER_TAGS) 2515217309Snwhitehorn])dnl 2516217309Snwhitehorndnl --------------------------------------------------------------------------- 2517220749Snwhitehorndnl CF_MATH_LIB version: 8 updated: 2010/05/29 16:31:02 2518217309Snwhitehorndnl ----------- 2519217309Snwhitehorndnl Checks for libraries. At least one UNIX system, Apple Macintosh 2520217309Snwhitehorndnl Rhapsody 5.5, does not have -lm. We cannot use the simpler 2521217309Snwhitehorndnl AC_CHECK_LIB(m,sin), because that fails for C++. 2522217309SnwhitehornAC_DEFUN([CF_MATH_LIB], 2523217309Snwhitehorn[ 2524217309SnwhitehornAC_CACHE_CHECK(if -lm needed for math functions, 2525217309Snwhitehorn cf_cv_need_libm,[ 2526217309Snwhitehorn AC_TRY_LINK([ 2527217309Snwhitehorn #include <stdio.h> 2528217309Snwhitehorn #include <math.h> 2529217309Snwhitehorn ], 2530220749Snwhitehorn [double x = rand(); printf("result = %g\n", ]ifelse([$2],,sin(x),$2)[)], 2531217309Snwhitehorn [cf_cv_need_libm=no], 2532217309Snwhitehorn [cf_cv_need_libm=yes])]) 2533217309Snwhitehornif test "$cf_cv_need_libm" = yes 2534217309Snwhitehornthen 2535217309Snwhitehornifelse($1,,[ 2536220749Snwhitehorn CF_ADD_LIB(m) 2537217309Snwhitehorn],[$1=-lm]) 2538217309Snwhitehornfi 2539217309Snwhitehorn]) 2540217309Snwhitehorndnl --------------------------------------------------------------------------- 2541217309Snwhitehorndnl CF_MBSTATE_T version: 3 updated: 2007/03/25 15:55:36 2542217309Snwhitehorndnl ------------ 2543217309Snwhitehorndnl Check if mbstate_t is declared, and if so, which header file. 2544217309Snwhitehorndnl This (including wchar.h) is needed on Tru64 5.0 to declare mbstate_t, 2545217309Snwhitehorndnl as well as include stdio.h to work around a misuse of varargs in wchar.h 2546217309SnwhitehornAC_DEFUN([CF_MBSTATE_T], 2547217309Snwhitehorn[ 2548217309SnwhitehornAC_CACHE_CHECK(if we must include wchar.h to declare mbstate_t,cf_cv_mbstate_t,[ 2549217309SnwhitehornAC_TRY_COMPILE([ 2550217309Snwhitehorn#include <stdlib.h> 2551217309Snwhitehorn#include <stdio.h> 2552217309Snwhitehorn#ifdef HAVE_LIBUTF8_H 2553217309Snwhitehorn#include <libutf8.h> 2554217309Snwhitehorn#endif], 2555217309Snwhitehorn [mbstate_t state], 2556217309Snwhitehorn [cf_cv_mbstate_t=no], 2557217309Snwhitehorn [AC_TRY_COMPILE([ 2558217309Snwhitehorn#include <stdlib.h> 2559217309Snwhitehorn#include <stdio.h> 2560217309Snwhitehorn#include <wchar.h> 2561217309Snwhitehorn#ifdef HAVE_LIBUTF8_H 2562217309Snwhitehorn#include <libutf8.h> 2563217309Snwhitehorn#endif], 2564217309Snwhitehorn [mbstate_t value], 2565217309Snwhitehorn [cf_cv_mbstate_t=yes], 2566217309Snwhitehorn [cf_cv_mbstate_t=unknown])])]) 2567217309Snwhitehorn 2568217309Snwhitehornif test "$cf_cv_mbstate_t" = yes ; then 2569217309Snwhitehorn AC_DEFINE(NEED_WCHAR_H) 2570217309Snwhitehornfi 2571217309Snwhitehorn 2572217309Snwhitehornif test "$cf_cv_mbstate_t" != unknown ; then 2573217309Snwhitehorn AC_DEFINE(HAVE_MBSTATE_T) 2574217309Snwhitehornfi 2575217309Snwhitehorn])dnl 2576217309Snwhitehorndnl --------------------------------------------------------------------------- 2577217309Snwhitehorndnl CF_MIXEDCASE_FILENAMES version: 3 updated: 2003/09/20 17:07:55 2578217309Snwhitehorndnl ---------------------- 2579217309Snwhitehorndnl Check if the file-system supports mixed-case filenames. If we're able to 2580217309Snwhitehorndnl create a lowercase name and see it as uppercase, it doesn't support that. 2581217309SnwhitehornAC_DEFUN([CF_MIXEDCASE_FILENAMES], 2582217309Snwhitehorn[ 2583217309SnwhitehornAC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[ 2584217309Snwhitehornif test "$cross_compiling" = yes ; then 2585217309Snwhitehorn case $target_alias in #(vi 2586217309Snwhitehorn *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-mingw32*|*-uwin*) #(vi 2587217309Snwhitehorn cf_cv_mixedcase=no 2588217309Snwhitehorn ;; 2589217309Snwhitehorn *) 2590217309Snwhitehorn cf_cv_mixedcase=yes 2591217309Snwhitehorn ;; 2592217309Snwhitehorn esac 2593217309Snwhitehornelse 2594217309Snwhitehorn rm -f conftest CONFTEST 2595217309Snwhitehorn echo test >conftest 2596217309Snwhitehorn if test -f CONFTEST ; then 2597217309Snwhitehorn cf_cv_mixedcase=no 2598217309Snwhitehorn else 2599217309Snwhitehorn cf_cv_mixedcase=yes 2600217309Snwhitehorn fi 2601217309Snwhitehorn rm -f conftest CONFTEST 2602217309Snwhitehornfi 2603217309Snwhitehorn]) 2604217309Snwhitehorntest "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES) 2605217309Snwhitehorn])dnl 2606217309Snwhitehorndnl --------------------------------------------------------------------------- 2607220749Snwhitehorndnl CF_MSG_LOG version: 5 updated: 2010/10/23 15:52:32 2608217309Snwhitehorndnl ---------- 2609217309Snwhitehorndnl Write a debug message to config.log, along with the line number in the 2610217309Snwhitehorndnl configure script. 2611217309SnwhitehornAC_DEFUN([CF_MSG_LOG],[ 2612220749Snwhitehornecho "${as_me:-configure}:__oline__: testing $* ..." 1>&AC_FD_CC 2613217309Snwhitehorn])dnl 2614217309Snwhitehorndnl --------------------------------------------------------------------------- 2615217309Snwhitehorndnl CF_NCURSES_CC_CHECK version: 4 updated: 2007/07/29 10:39:05 2616217309Snwhitehorndnl ------------------- 2617217309Snwhitehorndnl Check if we can compile with ncurses' header file 2618217309Snwhitehorndnl $1 is the cache variable to set 2619217309Snwhitehorndnl $2 is the header-file to include 2620217309Snwhitehorndnl $3 is the root name (ncurses or ncursesw) 2621217309SnwhitehornAC_DEFUN([CF_NCURSES_CC_CHECK],[ 2622217309Snwhitehorn AC_TRY_COMPILE([ 2623217309Snwhitehorn]ifelse($3,ncursesw,[ 2624217309Snwhitehorn#define _XOPEN_SOURCE_EXTENDED 2625217309Snwhitehorn#undef HAVE_LIBUTF8_H /* in case we used CF_UTF8_LIB */ 2626217309Snwhitehorn#define HAVE_LIBUTF8_H /* to force ncurses' header file to use cchar_t */ 2627217309Snwhitehorn])[ 2628217309Snwhitehorn#include <$2>],[ 2629217309Snwhitehorn#ifdef NCURSES_VERSION 2630217309Snwhitehorn]ifelse($3,ncursesw,[ 2631217309Snwhitehorn#ifndef WACS_BSSB 2632217309Snwhitehorn make an error 2633217309Snwhitehorn#endif 2634217309Snwhitehorn])[ 2635217309Snwhitehornprintf("%s\n", NCURSES_VERSION); 2636217309Snwhitehorn#else 2637217309Snwhitehorn#ifdef __NCURSES_H 2638217309Snwhitehornprintf("old\n"); 2639217309Snwhitehorn#else 2640217309Snwhitehorn make an error 2641217309Snwhitehorn#endif 2642217309Snwhitehorn#endif 2643217309Snwhitehorn ] 2644217309Snwhitehorn ,[$1=$2] 2645217309Snwhitehorn ,[$1=no]) 2646217309Snwhitehorn])dnl 2647217309Snwhitehorndnl --------------------------------------------------------------------------- 2648220749Snwhitehorndnl CF_NCURSES_CONFIG version: 8 updated: 2010/07/08 05:17:30 2649217309Snwhitehorndnl ----------------- 2650217309Snwhitehorndnl Tie together the configure-script macros for ncurses. 2651220749Snwhitehorndnl Prefer the "-config" script from ncurses 6.x, to simplify analysis. 2652217309Snwhitehorndnl Allow that to be overridden using the $NCURSES_CONFIG environment variable. 2653217309Snwhitehorndnl 2654217309Snwhitehorndnl $1 is the root library name (default: "ncurses") 2655217309SnwhitehornAC_DEFUN([CF_NCURSES_CONFIG], 2656217309Snwhitehorn[ 2657217309Snwhitehorncf_ncuconfig_root=ifelse($1,,ncurses,$1) 2658217309Snwhitehorn 2659217309Snwhitehornecho "Looking for ${cf_ncuconfig_root}-config" 2660217309SnwhitehornAC_PATH_PROGS(NCURSES_CONFIG,${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config,none) 2661217309Snwhitehorn 2662217309Snwhitehornif test "$NCURSES_CONFIG" != none ; then 2663217309Snwhitehorn 2664217309SnwhitehornCPPFLAGS="$CPPFLAGS `$NCURSES_CONFIG --cflags`" 2665220749SnwhitehornCF_ADD_LIBS(`$NCURSES_CONFIG --libs`) 2666217309Snwhitehorn 2667217309Snwhitehorn# even with config script, some packages use no-override for curses.h 2668217309SnwhitehornCF_CURSES_HEADER(ifelse($1,,ncurses,$1)) 2669217309Snwhitehorn 2670217309Snwhitehorndnl like CF_NCURSES_CPPFLAGS 2671217309SnwhitehornAC_DEFINE(NCURSES) 2672217309Snwhitehorn 2673217309Snwhitehorndnl like CF_NCURSES_LIBS 2674217309SnwhitehornCF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_ncuconfig_root) 2675217309SnwhitehornAC_DEFINE_UNQUOTED($cf_nculib_ROOT) 2676217309Snwhitehorn 2677217309Snwhitehorndnl like CF_NCURSES_VERSION 2678217309Snwhitehorncf_cv_ncurses_version=`$NCURSES_CONFIG --version` 2679217309Snwhitehorn 2680217309Snwhitehornelse 2681217309Snwhitehorn 2682217309SnwhitehornCF_NCURSES_CPPFLAGS(ifelse($1,,ncurses,$1)) 2683217309SnwhitehornCF_NCURSES_LIBS(ifelse($1,,ncurses,$1)) 2684217309Snwhitehorn 2685217309Snwhitehornfi 2686217309Snwhitehorn])dnl 2687217309Snwhitehorndnl --------------------------------------------------------------------------- 2688220749Snwhitehorndnl CF_NCURSES_CPPFLAGS version: 20 updated: 2010/11/20 17:02:38 2689217309Snwhitehorndnl ------------------- 2690217309Snwhitehorndnl Look for the SVr4 curses clone 'ncurses' in the standard places, adjusting 2691217309Snwhitehorndnl the CPPFLAGS variable so we can include its header. 2692217309Snwhitehorndnl 2693217309Snwhitehorndnl The header files may be installed as either curses.h, or ncurses.h (would 2694217309Snwhitehorndnl be obsolete, except that some packagers prefer this name to distinguish it 2695217309Snwhitehorndnl from a "native" curses implementation). If not installed for overwrite, 2696217309Snwhitehorndnl the curses.h file would be in an ncurses subdirectory (e.g., 2697217309Snwhitehorndnl /usr/include/ncurses), but someone may have installed overwriting the 2698217309Snwhitehorndnl vendor's curses. Only very old versions (pre-1.9.2d, the first autoconf'd 2699217309Snwhitehorndnl version) of ncurses don't define either __NCURSES_H or NCURSES_VERSION in 2700217309Snwhitehorndnl the header. 2701217309Snwhitehorndnl 2702217309Snwhitehorndnl If the installer has set $CFLAGS or $CPPFLAGS so that the ncurses header 2703217309Snwhitehorndnl is already in the include-path, don't even bother with this, since we cannot 2704217309Snwhitehorndnl easily determine which file it is. In this case, it has to be <curses.h>. 2705217309Snwhitehorndnl 2706217309Snwhitehorndnl The optional parameter gives the root name of the library, in case it is 2707217309Snwhitehorndnl not installed as the default curses library. That is how the 2708217309Snwhitehorndnl wide-character version of ncurses is installed. 2709217309SnwhitehornAC_DEFUN([CF_NCURSES_CPPFLAGS], 2710217309Snwhitehorn[AC_REQUIRE([CF_WITH_CURSES_DIR]) 2711217309Snwhitehorn 2712217309SnwhitehornAC_PROVIDE([CF_CURSES_CPPFLAGS])dnl 2713217309Snwhitehorncf_ncuhdr_root=ifelse($1,,ncurses,$1) 2714217309Snwhitehorn 2715217309Snwhitehorntest -n "$cf_cv_curses_dir" && \ 2716217309Snwhitehorntest "$cf_cv_curses_dir" != "no" && { \ 2717220749Snwhitehorn CF_ADD_INCDIR($cf_cv_curses_dir/include/$cf_ncuhdr_root) 2718217309Snwhitehorn} 2719217309Snwhitehorn 2720217309SnwhitehornAC_CACHE_CHECK(for $cf_ncuhdr_root header in include-path, cf_cv_ncurses_h,[ 2721217309Snwhitehorn cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h" 2722217309Snwhitehorn ( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h" 2723217309Snwhitehorn for cf_header in $cf_header_list 2724217309Snwhitehorn do 2725217309Snwhitehorn CF_NCURSES_CC_CHECK(cf_cv_ncurses_h,$cf_header,$1) 2726217309Snwhitehorn test "$cf_cv_ncurses_h" != no && break 2727217309Snwhitehorn done 2728217309Snwhitehorn]) 2729217309Snwhitehorn 2730217309SnwhitehornCF_NCURSES_HEADER 2731217309SnwhitehornCF_TERM_HEADER 2732217309Snwhitehorn 2733217309Snwhitehorn# some applications need this, but should check for NCURSES_VERSION 2734217309SnwhitehornAC_DEFINE(NCURSES) 2735217309Snwhitehorn 2736217309SnwhitehornCF_NCURSES_VERSION 2737217309Snwhitehorn])dnl 2738217309Snwhitehorndnl --------------------------------------------------------------------------- 2739217309Snwhitehorndnl CF_NCURSES_HEADER version: 2 updated: 2008/03/23 14:48:54 2740217309Snwhitehorndnl ----------------- 2741217309Snwhitehorndnl Find a "curses" header file, e.g,. "curses.h", or one of the more common 2742217309Snwhitehorndnl variations of ncurses' installs. 2743217309Snwhitehorndnl 2744217309Snwhitehorndnl See also CF_CURSES_HEADER, which sets the same cache variable. 2745217309SnwhitehornAC_DEFUN([CF_NCURSES_HEADER],[ 2746217309Snwhitehorn 2747217309Snwhitehornif test "$cf_cv_ncurses_h" != no ; then 2748217309Snwhitehorn cf_cv_ncurses_header=$cf_cv_ncurses_h 2749217309Snwhitehornelse 2750217309Snwhitehorn 2751217309SnwhitehornAC_CACHE_CHECK(for $cf_ncuhdr_root include-path, cf_cv_ncurses_h2,[ 2752217309Snwhitehorn test -n "$verbose" && echo 2753217309Snwhitehorn CF_HEADER_PATH(cf_search,$cf_ncuhdr_root) 2754217309Snwhitehorn test -n "$verbose" && echo search path $cf_search 2755217309Snwhitehorn cf_save2_CPPFLAGS="$CPPFLAGS" 2756217309Snwhitehorn for cf_incdir in $cf_search 2757217309Snwhitehorn do 2758217309Snwhitehorn CF_ADD_INCDIR($cf_incdir) 2759217309Snwhitehorn for cf_header in \ 2760217309Snwhitehorn ncurses.h \ 2761217309Snwhitehorn curses.h 2762217309Snwhitehorn do 2763217309Snwhitehorn CF_NCURSES_CC_CHECK(cf_cv_ncurses_h2,$cf_header,$1) 2764217309Snwhitehorn if test "$cf_cv_ncurses_h2" != no ; then 2765217309Snwhitehorn cf_cv_ncurses_h2=$cf_incdir/$cf_header 2766217309Snwhitehorn test -n "$verbose" && echo $ac_n " ... found $ac_c" 1>&AC_FD_MSG 2767217309Snwhitehorn break 2768217309Snwhitehorn fi 2769217309Snwhitehorn test -n "$verbose" && echo " ... tested $cf_incdir/$cf_header" 1>&AC_FD_MSG 2770217309Snwhitehorn done 2771217309Snwhitehorn CPPFLAGS="$cf_save2_CPPFLAGS" 2772217309Snwhitehorn test "$cf_cv_ncurses_h2" != no && break 2773217309Snwhitehorn done 2774217309Snwhitehorn test "$cf_cv_ncurses_h2" = no && AC_MSG_ERROR(not found) 2775217309Snwhitehorn ]) 2776217309Snwhitehorn 2777217309Snwhitehorn CF_DIRNAME(cf_1st_incdir,$cf_cv_ncurses_h2) 2778217309Snwhitehorn cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2` 2779217309Snwhitehorn if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then 2780217309Snwhitehorn cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header 2781217309Snwhitehorn fi 2782217309Snwhitehorn CF_ADD_INCDIR($cf_1st_incdir) 2783217309Snwhitehorn 2784217309Snwhitehornfi 2785217309Snwhitehorn 2786217309Snwhitehorn# Set definitions to allow ifdef'ing for ncurses.h 2787217309Snwhitehorn 2788217309Snwhitehorncase $cf_cv_ncurses_header in # (vi 2789217309Snwhitehorn*ncurses.h) 2790217309Snwhitehorn AC_DEFINE(HAVE_NCURSES_H) 2791217309Snwhitehorn ;; 2792217309Snwhitehornesac 2793217309Snwhitehorn 2794217309Snwhitehorncase $cf_cv_ncurses_header in # (vi 2795217309Snwhitehornncurses/curses.h|ncurses/ncurses.h) 2796217309Snwhitehorn AC_DEFINE(HAVE_NCURSES_NCURSES_H) 2797217309Snwhitehorn ;; 2798217309Snwhitehornncursesw/curses.h|ncursesw/ncurses.h) 2799217309Snwhitehorn AC_DEFINE(HAVE_NCURSESW_NCURSES_H) 2800217309Snwhitehorn ;; 2801217309Snwhitehornesac 2802217309Snwhitehorn 2803217309Snwhitehorn])dnl 2804217309Snwhitehorndnl --------------------------------------------------------------------------- 2805220749Snwhitehorndnl CF_NCURSES_LIBS version: 16 updated: 2010/11/20 17:02:38 2806217309Snwhitehorndnl --------------- 2807217309Snwhitehorndnl Look for the ncurses library. This is a little complicated on Linux, 2808217309Snwhitehorndnl because it may be linked with the gpm (general purpose mouse) library. 2809217309Snwhitehorndnl Some distributions have gpm linked with (bsd) curses, which makes it 2810217309Snwhitehorndnl unusable with ncurses. However, we don't want to link with gpm unless 2811217309Snwhitehorndnl ncurses has a dependency, since gpm is normally set up as a shared library, 2812217309Snwhitehorndnl and the linker will record a dependency. 2813217309Snwhitehorndnl 2814217309Snwhitehorndnl The optional parameter gives the root name of the library, in case it is 2815217309Snwhitehorndnl not installed as the default curses library. That is how the 2816217309Snwhitehorndnl wide-character version of ncurses is installed. 2817217309SnwhitehornAC_DEFUN([CF_NCURSES_LIBS], 2818217309Snwhitehorn[AC_REQUIRE([CF_NCURSES_CPPFLAGS]) 2819217309Snwhitehorn 2820217309Snwhitehorncf_nculib_root=ifelse($1,,ncurses,$1) 2821217309Snwhitehorn # This works, except for the special case where we find gpm, but 2822217309Snwhitehorn # ncurses is in a nonstandard location via $LIBS, and we really want 2823217309Snwhitehorn # to link gpm. 2824217309Snwhitehorncf_ncurses_LIBS="" 2825217309Snwhitehorncf_ncurses_SAVE="$LIBS" 2826217309SnwhitehornAC_CHECK_LIB(gpm,Gpm_Open, 2827217309Snwhitehorn [AC_CHECK_LIB(gpm,initscr, 2828217309Snwhitehorn [LIBS="$cf_ncurses_SAVE"], 2829217309Snwhitehorn [cf_ncurses_LIBS="-lgpm"])]) 2830217309Snwhitehorn 2831217309Snwhitehorncase $host_os in #(vi 2832217309Snwhitehornfreebsd*) 2833217309Snwhitehorn # This is only necessary if you are linking against an obsolete 2834217309Snwhitehorn # version of ncurses (but it should do no harm, since it's static). 2835217309Snwhitehorn if test "$cf_nculib_root" = ncurses ; then 2836217309Snwhitehorn AC_CHECK_LIB(mytinfo,tgoto,[cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS"]) 2837217309Snwhitehorn fi 2838217309Snwhitehorn ;; 2839217309Snwhitehornesac 2840217309Snwhitehorn 2841220749SnwhitehornCF_ADD_LIBS($cf_ncurses_LIBS) 2842217309Snwhitehorn 2843217309Snwhitehornif ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" ) 2844217309Snwhitehornthen 2845220749Snwhitehorn CF_ADD_LIBS(-l$cf_nculib_root) 2846217309Snwhitehornelse 2847217309Snwhitehorn CF_FIND_LIBRARY($cf_nculib_root,$cf_nculib_root, 2848220749Snwhitehorn [#include <${cf_cv_ncurses_header:-curses.h}>], 2849217309Snwhitehorn [initscr()], 2850217309Snwhitehorn initscr) 2851217309Snwhitehornfi 2852217309Snwhitehorn 2853217309Snwhitehornif test -n "$cf_ncurses_LIBS" ; then 2854217309Snwhitehorn AC_MSG_CHECKING(if we can link $cf_nculib_root without $cf_ncurses_LIBS) 2855217309Snwhitehorn cf_ncurses_SAVE="$LIBS" 2856217309Snwhitehorn for p in $cf_ncurses_LIBS ; do 2857217309Snwhitehorn q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"` 2858217309Snwhitehorn if test "$q" != "$LIBS" ; then 2859217309Snwhitehorn LIBS="$q" 2860217309Snwhitehorn fi 2861217309Snwhitehorn done 2862220749Snwhitehorn AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], 2863217309Snwhitehorn [initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);], 2864217309Snwhitehorn [AC_MSG_RESULT(yes)], 2865217309Snwhitehorn [AC_MSG_RESULT(no) 2866217309Snwhitehorn LIBS="$cf_ncurses_SAVE"]) 2867217309Snwhitehornfi 2868217309Snwhitehorn 2869217309SnwhitehornCF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_nculib_root) 2870217309SnwhitehornAC_DEFINE_UNQUOTED($cf_nculib_ROOT) 2871217309Snwhitehorn])dnl 2872217309Snwhitehorndnl --------------------------------------------------------------------------- 2873220749Snwhitehorndnl CF_NCURSES_VERSION version: 13 updated: 2010/10/23 15:54:49 2874217309Snwhitehorndnl ------------------ 2875217309Snwhitehorndnl Check for the version of ncurses, to aid in reporting bugs, etc. 2876217309Snwhitehorndnl Call CF_CURSES_CPPFLAGS first, or CF_NCURSES_CPPFLAGS. We don't use 2877217309Snwhitehorndnl AC_REQUIRE since that does not work with the shell's if/then/else/fi. 2878217309SnwhitehornAC_DEFUN([CF_NCURSES_VERSION], 2879217309Snwhitehorn[ 2880217309SnwhitehornAC_REQUIRE([CF_CURSES_CPPFLAGS])dnl 2881217309SnwhitehornAC_CACHE_CHECK(for ncurses version, cf_cv_ncurses_version,[ 2882217309Snwhitehorn cf_cv_ncurses_version=no 2883217309Snwhitehorn cf_tempfile=out$$ 2884217309Snwhitehorn rm -f $cf_tempfile 2885217309Snwhitehorn AC_TRY_RUN([ 2886220749Snwhitehorn#include <${cf_cv_ncurses_header:-curses.h}> 2887217309Snwhitehorn#include <stdio.h> 2888217309Snwhitehornint main() 2889217309Snwhitehorn{ 2890217309Snwhitehorn FILE *fp = fopen("$cf_tempfile", "w"); 2891217309Snwhitehorn#ifdef NCURSES_VERSION 2892217309Snwhitehorn# ifdef NCURSES_VERSION_PATCH 2893217309Snwhitehorn fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH); 2894217309Snwhitehorn# else 2895217309Snwhitehorn fprintf(fp, "%s\n", NCURSES_VERSION); 2896217309Snwhitehorn# endif 2897217309Snwhitehorn#else 2898217309Snwhitehorn# ifdef __NCURSES_H 2899217309Snwhitehorn fprintf(fp, "old\n"); 2900217309Snwhitehorn# else 2901217309Snwhitehorn make an error 2902217309Snwhitehorn# endif 2903217309Snwhitehorn#endif 2904220749Snwhitehorn ${cf_cv_main_return:-return}(0); 2905217309Snwhitehorn}],[ 2906217309Snwhitehorn cf_cv_ncurses_version=`cat $cf_tempfile`],,[ 2907217309Snwhitehorn 2908217309Snwhitehorn # This will not work if the preprocessor splits the line after the 2909217309Snwhitehorn # Autoconf token. The 'unproto' program does that. 2910217309Snwhitehorn cat > conftest.$ac_ext <<EOF 2911220749Snwhitehorn#include <${cf_cv_ncurses_header:-curses.h}> 2912217309Snwhitehorn#undef Autoconf 2913217309Snwhitehorn#ifdef NCURSES_VERSION 2914217309SnwhitehornAutoconf NCURSES_VERSION 2915217309Snwhitehorn#else 2916217309Snwhitehorn#ifdef __NCURSES_H 2917217309SnwhitehornAutoconf "old" 2918217309Snwhitehorn#endif 2919217309Snwhitehorn; 2920217309Snwhitehorn#endif 2921217309SnwhitehornEOF 2922217309Snwhitehorn cf_try="$ac_cpp conftest.$ac_ext 2>&AC_FD_CC | grep '^Autoconf ' >conftest.out" 2923217309Snwhitehorn AC_TRY_EVAL(cf_try) 2924217309Snwhitehorn if test -f conftest.out ; then 2925217309Snwhitehorn cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[[^"]]*"%%' -e 's%".*%%'` 2926217309Snwhitehorn test -n "$cf_out" && cf_cv_ncurses_version="$cf_out" 2927217309Snwhitehorn rm -f conftest.out 2928217309Snwhitehorn fi 2929217309Snwhitehorn]) 2930217309Snwhitehorn rm -f $cf_tempfile 2931217309Snwhitehorn]) 2932217309Snwhitehorntest "$cf_cv_ncurses_version" = no || AC_DEFINE(NCURSES) 2933217309Snwhitehorn])dnl 2934217309Snwhitehorndnl --------------------------------------------------------------------------- 2935217309Snwhitehorndnl CF_NO_LEAKS_OPTION version: 4 updated: 2006/12/16 14:24:05 2936217309Snwhitehorndnl ------------------ 2937217309Snwhitehorndnl see CF_WITH_NO_LEAKS 2938217309SnwhitehornAC_DEFUN([CF_NO_LEAKS_OPTION],[ 2939217309SnwhitehornAC_MSG_CHECKING(if you want to use $1 for testing) 2940217309SnwhitehornAC_ARG_WITH($1, 2941217309Snwhitehorn [$2], 2942217309Snwhitehorn [AC_DEFINE($3)ifelse([$4],,[ 2943217309Snwhitehorn $4 2944217309Snwhitehorn]) 2945217309Snwhitehorn : ${with_cflags:=-g} 2946217309Snwhitehorn : ${with_no_leaks:=yes} 2947217309Snwhitehorn with_$1=yes], 2948217309Snwhitehorn [with_$1=]) 2949217309SnwhitehornAC_MSG_RESULT(${with_$1:-no}) 2950217309Snwhitehorn 2951217309Snwhitehorncase .$with_cflags in #(vi 2952217309Snwhitehorn.*-g*) 2953217309Snwhitehorn case .$CFLAGS in #(vi 2954217309Snwhitehorn .*-g*) #(vi 2955217309Snwhitehorn ;; 2956217309Snwhitehorn *) 2957217309Snwhitehorn CF_ADD_CFLAGS([-g]) 2958217309Snwhitehorn ;; 2959217309Snwhitehorn esac 2960217309Snwhitehorn ;; 2961217309Snwhitehornesac 2962217309Snwhitehorn])dnl 2963217309Snwhitehorndnl --------------------------------------------------------------------------- 2964217309Snwhitehorndnl CF_OUR_MESSAGES version: 7 updated: 2004/09/12 19:45:55 2965217309Snwhitehorndnl --------------- 2966217309Snwhitehorndnl Check if we use the messages included with this program 2967217309Snwhitehorndnl 2968217309Snwhitehorndnl $1 specifies either Makefile or makefile, defaulting to the former. 2969217309Snwhitehorndnl 2970217309Snwhitehorndnl Sets variables which can be used to substitute in makefiles: 2971217309Snwhitehorndnl MSG_DIR_MAKE - to make ./po directory 2972217309Snwhitehorndnl SUB_MAKEFILE - makefile in ./po directory (see CF_BUNDLED_INTL) 2973217309Snwhitehorndnl 2974217309SnwhitehornAC_DEFUN([CF_OUR_MESSAGES], 2975217309Snwhitehorn[ 2976217309Snwhitehorncf_makefile=ifelse($1,,Makefile,$1) 2977217309Snwhitehorn 2978217309Snwhitehornuse_our_messages=no 2979217309Snwhitehornif test "$USE_NLS" = yes ; then 2980217309Snwhitehornif test -d $srcdir/po ; then 2981217309SnwhitehornAC_MSG_CHECKING(if we should use included message-library) 2982217309Snwhitehorn AC_ARG_ENABLE(included-msgs, 2983217309Snwhitehorn [ --disable-included-msgs use included messages, for i18n support], 2984217309Snwhitehorn [use_our_messages=$enableval], 2985217309Snwhitehorn [use_our_messages=yes]) 2986217309Snwhitehornfi 2987217309SnwhitehornAC_MSG_RESULT($use_our_messages) 2988217309Snwhitehornfi 2989217309Snwhitehorn 2990217309SnwhitehornMSG_DIR_MAKE="#" 2991217309Snwhitehornif test "$use_our_messages" = yes 2992217309Snwhitehornthen 2993217309Snwhitehorn SUB_MAKEFILE="$SUB_MAKEFILE po/$cf_makefile.in:$srcdir/po/$cf_makefile.inn" 2994217309Snwhitehorn MSG_DIR_MAKE= 2995217309Snwhitehornfi 2996217309Snwhitehorn 2997217309SnwhitehornAC_SUBST(MSG_DIR_MAKE) 2998217309SnwhitehornAC_SUBST(SUB_MAKEFILE) 2999217309Snwhitehorn])dnl 3000217309Snwhitehorndnl --------------------------------------------------------------------------- 3001220749Snwhitehorndnl CF_PATHSEP version: 5 updated: 2010/05/26 05:38:42 3002217309Snwhitehorndnl ---------- 3003217309Snwhitehorndnl Provide a value for the $PATH and similar separator 3004217309SnwhitehornAC_DEFUN([CF_PATHSEP], 3005217309Snwhitehorn[ 3006217309Snwhitehorn case $cf_cv_system_name in 3007217309Snwhitehorn os2*) PATH_SEPARATOR=';' ;; 3008217309Snwhitehorn *) PATH_SEPARATOR=':' ;; 3009217309Snwhitehorn esac 3010220749Snwhitehornifelse([$1],,,[$1=$PATH_SEPARATOR]) 3011217309Snwhitehorn AC_SUBST(PATH_SEPARATOR) 3012217309Snwhitehorn])dnl 3013217309Snwhitehorndnl --------------------------------------------------------------------------- 3014220749Snwhitehorndnl CF_PATH_SYNTAX version: 13 updated: 2010/05/26 05:38:42 3015217309Snwhitehorndnl -------------- 3016217309Snwhitehorndnl Check the argument to see that it looks like a pathname. Rewrite it if it 3017217309Snwhitehorndnl begins with one of the prefix/exec_prefix variables, and then again if the 3018217309Snwhitehorndnl result begins with 'NONE'. This is necessary to work around autoconf's 3019217309Snwhitehorndnl delayed evaluation of those symbols. 3020217309SnwhitehornAC_DEFUN([CF_PATH_SYNTAX],[ 3021217309Snwhitehornif test "x$prefix" != xNONE; then 3022217309Snwhitehorn cf_path_syntax="$prefix" 3023217309Snwhitehornelse 3024217309Snwhitehorn cf_path_syntax="$ac_default_prefix" 3025217309Snwhitehornfi 3026217309Snwhitehorn 3027217309Snwhitehorncase ".[$]$1" in #(vi 3028217309Snwhitehorn.\[$]\(*\)*|.\'*\'*) #(vi 3029217309Snwhitehorn ;; 3030217309Snwhitehorn..|./*|.\\*) #(vi 3031217309Snwhitehorn ;; 3032217309Snwhitehorn.[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX 3033217309Snwhitehorn ;; 3034217309Snwhitehorn.\[$]{*prefix}*) #(vi 3035217309Snwhitehorn eval $1="[$]$1" 3036217309Snwhitehorn case ".[$]$1" in #(vi 3037217309Snwhitehorn .NONE/*) 3038217309Snwhitehorn $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%` 3039217309Snwhitehorn ;; 3040217309Snwhitehorn esac 3041217309Snwhitehorn ;; #(vi 3042217309Snwhitehorn.no|.NONE/*) 3043217309Snwhitehorn $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%` 3044217309Snwhitehorn ;; 3045217309Snwhitehorn*) 3046220749Snwhitehorn ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2) 3047217309Snwhitehorn ;; 3048217309Snwhitehornesac 3049217309Snwhitehorn])dnl 3050217309Snwhitehorndnl --------------------------------------------------------------------------- 3051220749Snwhitehorndnl CF_POSIX_C_SOURCE version: 8 updated: 2010/05/26 05:38:42 3052217309Snwhitehorndnl ----------------- 3053217309Snwhitehorndnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed. 3054217309Snwhitehorndnl 3055217309Snwhitehorndnl POSIX.1-1990 _POSIX_SOURCE 3056217309Snwhitehorndnl POSIX.1-1990 and _POSIX_SOURCE and 3057217309Snwhitehorndnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2 3058217309Snwhitehorndnl Bindings Option 3059217309Snwhitehorndnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L 3060217309Snwhitehorndnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L 3061217309Snwhitehorndnl X/Open 2000 _POSIX_C_SOURCE=200112L 3062217309Snwhitehorndnl 3063217309Snwhitehorndnl Parameters: 3064217309Snwhitehorndnl $1 is the nominal value for _POSIX_C_SOURCE 3065217309SnwhitehornAC_DEFUN([CF_POSIX_C_SOURCE], 3066217309Snwhitehorn[ 3067220749Snwhitehorncf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1]) 3068217309Snwhitehorn 3069217309Snwhitehorncf_save_CFLAGS="$CFLAGS" 3070217309Snwhitehorncf_save_CPPFLAGS="$CPPFLAGS" 3071217309Snwhitehorn 3072217309SnwhitehornCF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE) 3073217309SnwhitehornCF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE) 3074217309Snwhitehorn 3075217309SnwhitehornAC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[ 3076217309Snwhitehorn CF_MSG_LOG(if the symbol is already defined go no further) 3077217309Snwhitehorn AC_TRY_COMPILE([#include <sys/types.h>],[ 3078217309Snwhitehorn#ifndef _POSIX_C_SOURCE 3079217309Snwhitehornmake an error 3080217309Snwhitehorn#endif], 3081217309Snwhitehorn [cf_cv_posix_c_source=no], 3082217309Snwhitehorn [cf_want_posix_source=no 3083217309Snwhitehorn case .$cf_POSIX_C_SOURCE in #(vi 3084217309Snwhitehorn .[[12]]??*) #(vi 3085217309Snwhitehorn cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" 3086217309Snwhitehorn ;; 3087217309Snwhitehorn .2) #(vi 3088217309Snwhitehorn cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" 3089217309Snwhitehorn cf_want_posix_source=yes 3090217309Snwhitehorn ;; 3091217309Snwhitehorn .*) 3092217309Snwhitehorn cf_want_posix_source=yes 3093217309Snwhitehorn ;; 3094217309Snwhitehorn esac 3095217309Snwhitehorn if test "$cf_want_posix_source" = yes ; then 3096217309Snwhitehorn AC_TRY_COMPILE([#include <sys/types.h>],[ 3097217309Snwhitehorn#ifdef _POSIX_SOURCE 3098217309Snwhitehornmake an error 3099217309Snwhitehorn#endif],[], 3100217309Snwhitehorn cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE") 3101217309Snwhitehorn fi 3102217309Snwhitehorn CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE) 3103217309Snwhitehorn CFLAGS="$cf_trim_CFLAGS" 3104217309Snwhitehorn CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source" 3105217309Snwhitehorn CF_MSG_LOG(if the second compile does not leave our definition intact error) 3106217309Snwhitehorn AC_TRY_COMPILE([#include <sys/types.h>],[ 3107217309Snwhitehorn#ifndef _POSIX_C_SOURCE 3108217309Snwhitehornmake an error 3109217309Snwhitehorn#endif],, 3110217309Snwhitehorn [cf_cv_posix_c_source=no]) 3111217309Snwhitehorn CFLAGS="$cf_save_CFLAGS" 3112217309Snwhitehorn CPPFLAGS="$cf_save_CPPFLAGS" 3113217309Snwhitehorn ]) 3114217309Snwhitehorn]) 3115217309Snwhitehorn 3116217309Snwhitehornif test "$cf_cv_posix_c_source" != no ; then 3117217309Snwhitehorn CFLAGS="$cf_trim_CFLAGS" 3118217309Snwhitehorn CPPFLAGS="$cf_trim_CPPFLAGS" 3119217309Snwhitehorn CF_ADD_CFLAGS($cf_cv_posix_c_source) 3120217309Snwhitehornfi 3121217309Snwhitehorn 3122217309Snwhitehorn])dnl 3123217309Snwhitehorndnl --------------------------------------------------------------------------- 3124217309Snwhitehorndnl CF_PROG_CC_U_D version: 1 updated: 2005/07/14 16:59:30 3125217309Snwhitehorndnl -------------- 3126217309Snwhitehorndnl Check if C (preprocessor) -U and -D options are processed in the order 3127217309Snwhitehorndnl given rather than by type of option. Some compilers insist on apply all 3128217309Snwhitehorndnl of the -U options after all of the -D options. Others allow mixing them, 3129217309Snwhitehorndnl and may predefine symbols that conflict with those we define. 3130217309SnwhitehornAC_DEFUN([CF_PROG_CC_U_D], 3131217309Snwhitehorn[ 3132217309SnwhitehornAC_CACHE_CHECK(if $CC -U and -D options work together,cf_cv_cc_u_d_options,[ 3133217309Snwhitehorn cf_save_CPPFLAGS="$CPPFLAGS" 3134217309Snwhitehorn CPPFLAGS="-UU_D_OPTIONS -DU_D_OPTIONS -DD_U_OPTIONS -UD_U_OPTIONS" 3135217309Snwhitehorn AC_TRY_COMPILE([],[ 3136217309Snwhitehorn#ifndef U_D_OPTIONS 3137217309Snwhitehornmake an undefined-error 3138217309Snwhitehorn#endif 3139217309Snwhitehorn#ifdef D_U_OPTIONS 3140217309Snwhitehornmake a defined-error 3141217309Snwhitehorn#endif 3142217309Snwhitehorn ],[ 3143217309Snwhitehorn cf_cv_cc_u_d_options=yes],[ 3144217309Snwhitehorn cf_cv_cc_u_d_options=no]) 3145217309Snwhitehorn CPPFLAGS="$cf_save_CPPFLAGS" 3146217309Snwhitehorn]) 3147217309Snwhitehorn])dnl 3148217309Snwhitehorndnl --------------------------------------------------------------------------- 3149217309Snwhitehorndnl CF_PROG_EXT version: 10 updated: 2004/01/03 19:28:18 3150217309Snwhitehorndnl ----------- 3151217309Snwhitehorndnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX. 3152217309SnwhitehornAC_DEFUN([CF_PROG_EXT], 3153217309Snwhitehorn[ 3154217309SnwhitehornAC_REQUIRE([CF_CHECK_CACHE]) 3155217309Snwhitehorncase $cf_cv_system_name in 3156217309Snwhitehornos2*) 3157217309Snwhitehorn CFLAGS="$CFLAGS -Zmt" 3158217309Snwhitehorn CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__" 3159217309Snwhitehorn CXXFLAGS="$CXXFLAGS -Zmt" 3160217309Snwhitehorn # autoconf's macro sets -Zexe and suffix both, which conflict:w 3161217309Snwhitehorn LDFLAGS="$LDFLAGS -Zmt -Zcrtdll" 3162217309Snwhitehorn ac_cv_exeext=.exe 3163217309Snwhitehorn ;; 3164217309Snwhitehornesac 3165217309Snwhitehorn 3166217309SnwhitehornAC_EXEEXT 3167217309SnwhitehornAC_OBJEXT 3168217309Snwhitehorn 3169217309SnwhitehornPROG_EXT="$EXEEXT" 3170217309SnwhitehornAC_SUBST(PROG_EXT) 3171217309Snwhitehorntest -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT") 3172217309Snwhitehorn])dnl 3173217309Snwhitehorndnl --------------------------------------------------------------------------- 3174217309Snwhitehorndnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50 3175217309Snwhitehorndnl ---------------- 3176217309Snwhitehorndnl Remove all -U and -D options that refer to the given symbol from a list 3177217309Snwhitehorndnl of C compiler options. This works around the problem that not all 3178217309Snwhitehorndnl compilers process -U and -D options from left-to-right, so a -U option 3179217309Snwhitehorndnl cannot be used to cancel the effect of a preceding -D option. 3180217309Snwhitehorndnl 3181217309Snwhitehorndnl $1 = target (which could be the same as the source variable) 3182217309Snwhitehorndnl $2 = source (including '$') 3183217309Snwhitehorndnl $3 = symbol to remove 3184217309Snwhitehorndefine([CF_REMOVE_DEFINE], 3185217309Snwhitehorn[ 3186217309Snwhitehorn$1=`echo "$2" | \ 3187217309Snwhitehorn sed -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[[ ]]/ /g' \ 3188217309Snwhitehorn -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'` 3189217309Snwhitehorn])dnl 3190217309Snwhitehorndnl --------------------------------------------------------------------------- 3191224014Snwhitehorndnl CF_RPATH_HACK version: 9 updated: 2011/02/13 13:31:33 3192217309Snwhitehorndnl ------------- 3193217309SnwhitehornAC_DEFUN([CF_RPATH_HACK], 3194217309Snwhitehorn[ 3195217309SnwhitehornAC_REQUIRE([CF_LD_RPATH_OPT]) 3196217309SnwhitehornAC_MSG_CHECKING(for updated LDFLAGS) 3197217309Snwhitehornif test -n "$LD_RPATH_OPT" ; then 3198217309Snwhitehorn AC_MSG_RESULT(maybe) 3199217309Snwhitehorn 3200217309Snwhitehorn AC_CHECK_PROGS(cf_ldd_prog,ldd,no) 3201217309Snwhitehorn cf_rpath_list="/usr/lib /lib" 3202217309Snwhitehorn if test "$cf_ldd_prog" != no 3203217309Snwhitehorn then 3204224014Snwhitehorn cf_rpath_oops= 3205224014Snwhitehorn 3206217309SnwhitehornAC_TRY_LINK([#include <stdio.h>], 3207217309Snwhitehorn [printf("Hello");], 3208224014Snwhitehorn [cf_rpath_oops=`$cf_ldd_prog conftest$ac_exeext | fgrep ' not found' | sed -e 's% =>.*$%%' |sort -u` 3209224014Snwhitehorn cf_rpath_list=`$cf_ldd_prog conftest$ac_exeext | fgrep / | sed -e 's%^.*[[ ]]/%/%' -e 's%/[[^/]][[^/]]*$%%' |sort -u`]) 3210224014Snwhitehorn 3211224014Snwhitehorn # If we passed the link-test, but get a "not found" on a given library, 3212224014Snwhitehorn # this could be due to inept reconfiguration of gcc to make it only 3213224014Snwhitehorn # partly honor /usr/local/lib (or whatever). Sometimes this behavior 3214224014Snwhitehorn # is intentional, e.g., installing gcc in /usr/bin and suppressing the 3215224014Snwhitehorn # /usr/local libraries. 3216224014Snwhitehorn if test -n "$cf_rpath_oops" 3217224014Snwhitehorn then 3218224014Snwhitehorn for cf_rpath_src in $cf_rpath_oops 3219224014Snwhitehorn do 3220224014Snwhitehorn for cf_rpath_dir in \ 3221224014Snwhitehorn /usr/local \ 3222224014Snwhitehorn /usr/pkg \ 3223224014Snwhitehorn /opt/sfw 3224224014Snwhitehorn do 3225224014Snwhitehorn if test -f $cf_rpath_dir/lib/$cf_rpath_src 3226224014Snwhitehorn then 3227224014Snwhitehorn CF_VERBOSE(...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src) 3228224014Snwhitehorn LDFLAGS="$LDFLAGS -L$cf_rpath_dir/lib" 3229224014Snwhitehorn break 3230224014Snwhitehorn fi 3231224014Snwhitehorn done 3232224014Snwhitehorn done 3233224014Snwhitehorn fi 3234217309Snwhitehorn fi 3235217309Snwhitehorn 3236217309Snwhitehorn CF_VERBOSE(...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS) 3237217309Snwhitehorn 3238217309Snwhitehorn CF_RPATH_HACK_2(LDFLAGS) 3239217309Snwhitehorn CF_RPATH_HACK_2(LIBS) 3240217309Snwhitehorn 3241217309Snwhitehorn CF_VERBOSE(...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS) 3242217309Snwhitehornfi 3243217309SnwhitehornAC_SUBST(EXTRA_LDFLAGS) 3244217309Snwhitehorn])dnl 3245217309Snwhitehorndnl --------------------------------------------------------------------------- 3246217309Snwhitehorndnl CF_RPATH_HACK_2 version: 6 updated: 2010/04/17 16:31:24 3247217309Snwhitehorndnl --------------- 3248217309Snwhitehorndnl Do one set of substitutions for CF_RPATH_HACK, adding an rpath option to 3249217309Snwhitehorndnl EXTRA_LDFLAGS for each -L option found. 3250217309Snwhitehorndnl 3251217309Snwhitehorndnl $cf_rpath_list contains a list of directories to ignore. 3252217309Snwhitehorndnl 3253217309Snwhitehorndnl $1 = variable name to update. The LDFLAGS variable should be the only one, 3254217309Snwhitehorndnl but LIBS often has misplaced -L options. 3255217309SnwhitehornAC_DEFUN([CF_RPATH_HACK_2], 3256217309Snwhitehorn[ 3257217309SnwhitehornCF_VERBOSE(...checking $1 [$]$1) 3258217309Snwhitehorn 3259217309Snwhitehorncf_rpath_dst= 3260217309Snwhitehornfor cf_rpath_src in [$]$1 3261217309Snwhitehorndo 3262217309Snwhitehorn case $cf_rpath_src in #(vi 3263217309Snwhitehorn -L*) #(vi 3264217309Snwhitehorn 3265217309Snwhitehorn # check if this refers to a directory which we will ignore 3266217309Snwhitehorn cf_rpath_skip=no 3267217309Snwhitehorn if test -n "$cf_rpath_list" 3268217309Snwhitehorn then 3269217309Snwhitehorn for cf_rpath_item in $cf_rpath_list 3270217309Snwhitehorn do 3271217309Snwhitehorn if test "x$cf_rpath_src" = "x-L$cf_rpath_item" 3272217309Snwhitehorn then 3273217309Snwhitehorn cf_rpath_skip=yes 3274217309Snwhitehorn break 3275217309Snwhitehorn fi 3276217309Snwhitehorn done 3277217309Snwhitehorn fi 3278217309Snwhitehorn 3279217309Snwhitehorn if test "$cf_rpath_skip" = no 3280217309Snwhitehorn then 3281217309Snwhitehorn # transform the option 3282217309Snwhitehorn if test "$LD_RPATH_OPT" = "-R " ; then 3283217309Snwhitehorn cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%-R %"` 3284217309Snwhitehorn else 3285217309Snwhitehorn cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%$LD_RPATH_OPT%"` 3286217309Snwhitehorn fi 3287217309Snwhitehorn 3288217309Snwhitehorn # if we have not already added this, add it now 3289217309Snwhitehorn cf_rpath_tst=`echo "$EXTRA_LDFLAGS" | sed -e "s%$cf_rpath_tmp %%"` 3290217309Snwhitehorn if test "x$cf_rpath_tst" = "x$EXTRA_LDFLAGS" 3291217309Snwhitehorn then 3292217309Snwhitehorn CF_VERBOSE(...Filter $cf_rpath_src ->$cf_rpath_tmp) 3293217309Snwhitehorn EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS" 3294217309Snwhitehorn fi 3295217309Snwhitehorn fi 3296217309Snwhitehorn ;; 3297217309Snwhitehorn esac 3298217309Snwhitehorn cf_rpath_dst="$cf_rpath_dst $cf_rpath_src" 3299217309Snwhitehorndone 3300217309Snwhitehorn$1=$cf_rpath_dst 3301217309Snwhitehorn 3302217309SnwhitehornCF_VERBOSE(...checked $1 [$]$1) 3303217309SnwhitehornAC_SUBST(EXTRA_LDFLAGS) 3304217309Snwhitehorn])dnl 3305217309Snwhitehorndnl --------------------------------------------------------------------------- 3306217309Snwhitehorndnl CF_SUBDIR_PATH version: 6 updated: 2010/04/21 06:20:50 3307217309Snwhitehorndnl -------------- 3308217309Snwhitehorndnl Construct a search-list for a nonstandard header/lib-file 3309217309Snwhitehorndnl $1 = the variable to return as result 3310217309Snwhitehorndnl $2 = the package name 3311217309Snwhitehorndnl $3 = the subdirectory, e.g., bin, include or lib 3312217309SnwhitehornAC_DEFUN([CF_SUBDIR_PATH], 3313217309Snwhitehorn[ 3314217309Snwhitehorn$1= 3315217309Snwhitehorn 3316217309SnwhitehornCF_ADD_SUBDIR_PATH($1,$2,$3,/usr,$prefix) 3317217309SnwhitehornCF_ADD_SUBDIR_PATH($1,$2,$3,$prefix,NONE) 3318217309SnwhitehornCF_ADD_SUBDIR_PATH($1,$2,$3,/usr/local,$prefix) 3319217309SnwhitehornCF_ADD_SUBDIR_PATH($1,$2,$3,/opt,$prefix) 3320217309SnwhitehornCF_ADD_SUBDIR_PATH($1,$2,$3,[$]HOME,$prefix) 3321217309Snwhitehorn])dnl 3322217309Snwhitehorndnl --------------------------------------------------------------------------- 3323217309Snwhitehorndnl CF_SUBST version: 4 updated: 2006/06/17 12:33:03 3324217309Snwhitehorndnl -------- 3325217309Snwhitehorndnl Shorthand macro for substituting things that the user may override 3326217309Snwhitehorndnl with an environment variable. 3327217309Snwhitehorndnl 3328217309Snwhitehorndnl $1 = long/descriptive name 3329217309Snwhitehorndnl $2 = environment variable 3330217309Snwhitehorndnl $3 = default value 3331217309SnwhitehornAC_DEFUN([CF_SUBST], 3332217309Snwhitehorn[AC_CACHE_VAL(cf_cv_subst_$2,[ 3333217309SnwhitehornAC_MSG_CHECKING(for $1 (symbol $2)) 3334217309SnwhitehornCF_SUBST_IF([-z "[$]$2"], [$2], [$3]) 3335217309Snwhitehorncf_cv_subst_$2=[$]$2 3336217309SnwhitehornAC_MSG_RESULT([$]$2) 3337217309Snwhitehorn]) 3338217309Snwhitehorn])dnl 3339217309Snwhitehorndnl --------------------------------------------------------------------------- 3340217309Snwhitehorndnl CF_SYSTYPE version: 3 updated: 2001/02/03 00:14:59 3341217309Snwhitehorndnl ---------- 3342217309Snwhitehorndnl Derive the system-type (our main clue to the method of building shared 3343217309Snwhitehorndnl libraries). 3344217309SnwhitehornAC_DEFUN([CF_SYSTYPE], 3345217309Snwhitehorn[ 3346217309SnwhitehornAC_MSG_CHECKING(for system type) 3347217309SnwhitehornAC_CACHE_VAL(cf_cv_systype,[ 3348217309SnwhitehornAC_ARG_WITH(system-type, 3349217309Snwhitehorn[ --with-system-type=XXX test: override derived host system-type], 3350217309Snwhitehorn[cf_cv_systype=$withval], 3351217309Snwhitehorn[ 3352217309Snwhitehorncf_cv_systype="`(uname -s || hostname || echo unknown) 2>/dev/null |sed -e s'/[[:\/.-]]/_/'g | sed 1q`" 3353217309Snwhitehornif test -z "$cf_cv_systype"; then cf_cv_systype=unknown;fi 3354217309Snwhitehorn])]) 3355217309SnwhitehornAC_MSG_RESULT($cf_cv_systype) 3356217309Snwhitehorn])dnl 3357217309Snwhitehorndnl --------------------------------------------------------------------------- 3358217309Snwhitehorndnl CF_SYS_NAME version: 3 updated: 2008/03/23 14:48:54 3359217309Snwhitehorndnl ----------- 3360217309Snwhitehorndnl Derive the system name, as a check for reusing the autoconf cache 3361217309SnwhitehornAC_DEFUN([CF_SYS_NAME], 3362217309Snwhitehorn[ 3363217309SnwhitehornSYS_NAME=`(uname -s -r || uname -a || hostname) 2>/dev/null | sed 1q` 3364217309Snwhitehorntest -z "$SYS_NAME" && SYS_NAME=unknown 3365217309SnwhitehornAC_DEFINE_UNQUOTED(SYS_NAME,"$SYS_NAME") 3366217309Snwhitehorn 3367217309SnwhitehornAC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$SYS_NAME"]) 3368217309Snwhitehorn 3369217309Snwhitehornif test ".$SYS_NAME" != ".$cf_cv_system_name" ; then 3370217309Snwhitehorn AC_MSG_RESULT("Cached system name does not agree with actual") 3371217309Snwhitehorn AC_MSG_ERROR("Please remove config.cache and try again.") 3372217309Snwhitehornfi]) 3373217309Snwhitehorndnl --------------------------------------------------------------------------- 3374220749Snwhitehorndnl CF_TERM_HEADER version: 2 updated: 2010/10/23 15:54:49 3375217309Snwhitehorndnl -------------- 3376217309Snwhitehorndnl Look for term.h, which is part of X/Open curses. It defines the interface 3377217309Snwhitehorndnl to terminfo database. Usually it is in the same include-path as curses.h, 3378217309Snwhitehorndnl but some packagers change this, breaking various applications. 3379217309SnwhitehornAC_DEFUN([CF_TERM_HEADER],[ 3380217309SnwhitehornAC_CACHE_CHECK(for terminfo header, cf_cv_term_header,[ 3381217309Snwhitehorncase ${cf_cv_ncurses_header} in #(vi 3382217309Snwhitehorn*/ncurses.h|*/ncursesw.h) #(vi 3383217309Snwhitehorn cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[[^.]]*\.h$%term.h%'` 3384217309Snwhitehorn ;; 3385217309Snwhitehorn*) 3386217309Snwhitehorn cf_term_header=term.h 3387217309Snwhitehorn ;; 3388217309Snwhitehornesac 3389217309Snwhitehorn 3390217309Snwhitehornfor cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h" 3391217309Snwhitehorndo 3392217309SnwhitehornAC_TRY_COMPILE([#include <stdio.h> 3393220749Snwhitehorn#include <${cf_cv_ncurses_header:-curses.h}> 3394217309Snwhitehorn#include <$cf_test> 3395217309Snwhitehorn],[int x = auto_left_margin],[ 3396217309Snwhitehorn cf_cv_term_header="$cf_test"],[ 3397217309Snwhitehorn cf_cv_term_header=unknown 3398217309Snwhitehorn ]) 3399217309Snwhitehorn test "$cf_cv_term_header" != unknown && break 3400217309Snwhitehorndone 3401217309Snwhitehorn]) 3402217309Snwhitehorn 3403217309Snwhitehorn# Set definitions to allow ifdef'ing to accommodate subdirectories 3404217309Snwhitehorn 3405217309Snwhitehorncase $cf_cv_term_header in # (vi 3406217309Snwhitehorn*term.h) 3407217309Snwhitehorn AC_DEFINE(HAVE_TERM_H) 3408217309Snwhitehorn ;; 3409217309Snwhitehornesac 3410217309Snwhitehorn 3411217309Snwhitehorncase $cf_cv_term_header in # (vi 3412217309Snwhitehornncurses/term.h) #(vi 3413217309Snwhitehorn AC_DEFINE(HAVE_NCURSES_TERM_H) 3414217309Snwhitehorn ;; 3415217309Snwhitehornncursesw/term.h) 3416217309Snwhitehorn AC_DEFINE(HAVE_NCURSESW_TERM_H) 3417217309Snwhitehorn ;; 3418217309Snwhitehornesac 3419217309Snwhitehorn])dnl 3420217309Snwhitehorndnl --------------------------------------------------------------------------- 3421217309Snwhitehorndnl CF_UNION_WAIT version: 5 updated: 1997/11/23 14:49:44 3422217309Snwhitehorndnl ------------- 3423217309Snwhitehorndnl Check to see if the BSD-style union wait is declared. Some platforms may 3424217309Snwhitehorndnl use this, though it is deprecated in favor of the 'int' type in Posix. 3425217309Snwhitehorndnl Some vendors provide a bogus implementation that declares union wait, but 3426217309Snwhitehorndnl uses the 'int' type instead; we try to spot these by checking for the 3427217309Snwhitehorndnl associated macros. 3428217309Snwhitehorndnl 3429217309Snwhitehorndnl Ahem. Some implementers cast the status value to an int*, as an attempt to 3430217309Snwhitehorndnl use the macros for either union wait or int. So we do a check compile to 3431217309Snwhitehorndnl see if the macros are defined and apply to an int. 3432217309Snwhitehorndnl 3433217309Snwhitehorndnl Sets: $cf_cv_type_unionwait 3434217309Snwhitehorndnl Defines: HAVE_TYPE_UNIONWAIT 3435217309SnwhitehornAC_DEFUN([CF_UNION_WAIT], 3436217309Snwhitehorn[ 3437217309SnwhitehornAC_REQUIRE([CF_WAIT_HEADERS]) 3438217309SnwhitehornAC_MSG_CHECKING([for union wait]) 3439217309SnwhitehornAC_CACHE_VAL(cf_cv_type_unionwait,[ 3440217309Snwhitehorn AC_TRY_LINK($cf_wait_headers, 3441217309Snwhitehorn [int x; 3442217309Snwhitehorn int y = WEXITSTATUS(x); 3443217309Snwhitehorn int z = WTERMSIG(x); 3444217309Snwhitehorn wait(&x); 3445217309Snwhitehorn ], 3446217309Snwhitehorn [cf_cv_type_unionwait=no 3447217309Snwhitehorn echo compiles ok w/o union wait 1>&AC_FD_CC 3448217309Snwhitehorn ],[ 3449217309Snwhitehorn AC_TRY_LINK($cf_wait_headers, 3450217309Snwhitehorn [union wait x; 3451217309Snwhitehorn#ifdef WEXITSTATUS 3452217309Snwhitehorn int y = WEXITSTATUS(x); 3453217309Snwhitehorn#endif 3454217309Snwhitehorn#ifdef WTERMSIG 3455217309Snwhitehorn int z = WTERMSIG(x); 3456217309Snwhitehorn#endif 3457217309Snwhitehorn wait(&x); 3458217309Snwhitehorn ], 3459217309Snwhitehorn [cf_cv_type_unionwait=yes 3460217309Snwhitehorn echo compiles ok with union wait and possibly macros too 1>&AC_FD_CC 3461217309Snwhitehorn ], 3462217309Snwhitehorn [cf_cv_type_unionwait=no])])]) 3463217309SnwhitehornAC_MSG_RESULT($cf_cv_type_unionwait) 3464217309Snwhitehorntest $cf_cv_type_unionwait = yes && AC_DEFINE(HAVE_TYPE_UNIONWAIT) 3465217309Snwhitehorn])dnl 3466217309Snwhitehorndnl --------------------------------------------------------------------------- 3467217309Snwhitehorndnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59 3468217309Snwhitehorndnl -------- 3469217309Snwhitehorndnl Make an uppercase version of a variable 3470217309Snwhitehorndnl $1=uppercase($2) 3471217309SnwhitehornAC_DEFUN([CF_UPPER], 3472217309Snwhitehorn[ 3473217309Snwhitehorn$1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` 3474217309Snwhitehorn])dnl 3475217309Snwhitehorndnl --------------------------------------------------------------------------- 3476220749Snwhitehorndnl CF_UTF8_LIB version: 7 updated: 2010/06/20 09:24:28 3477217309Snwhitehorndnl ----------- 3478217309Snwhitehorndnl Check for multibyte support, and if not found, utf8 compatibility library 3479217309SnwhitehornAC_DEFUN([CF_UTF8_LIB], 3480217309Snwhitehorn[ 3481217309SnwhitehornAC_CACHE_CHECK(for multibyte character support,cf_cv_utf8_lib,[ 3482217309Snwhitehorn cf_save_LIBS="$LIBS" 3483217309Snwhitehorn AC_TRY_LINK([ 3484217309Snwhitehorn#include <stdlib.h>],[putwc(0,0);], 3485217309Snwhitehorn [cf_cv_utf8_lib=yes], 3486217309Snwhitehorn [CF_FIND_LINKAGE([ 3487217309Snwhitehorn#include <libutf8.h>],[putwc(0,0);],utf8, 3488217309Snwhitehorn [cf_cv_utf8_lib=add-on], 3489217309Snwhitehorn [cf_cv_utf8_lib=no]) 3490217309Snwhitehorn])]) 3491217309Snwhitehorn 3492217309Snwhitehorn# HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between 3493217309Snwhitehorn# ncurses/ncursesw: 3494217309Snwhitehornif test "$cf_cv_utf8_lib" = "add-on" ; then 3495217309Snwhitehorn AC_DEFINE(HAVE_LIBUTF8_H) 3496217309Snwhitehorn CF_ADD_INCDIR($cf_cv_header_path_utf8) 3497217309Snwhitehorn CF_ADD_LIBDIR($cf_cv_library_path_utf8) 3498220749Snwhitehorn CF_ADD_LIBS($cf_cv_library_file_utf8) 3499217309Snwhitehornfi 3500217309Snwhitehorn])dnl 3501217309Snwhitehorndnl --------------------------------------------------------------------------- 3502217309Snwhitehorndnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12 3503217309Snwhitehorndnl ---------- 3504217309Snwhitehorndnl Use AC_VERBOSE w/o the warnings 3505217309SnwhitehornAC_DEFUN([CF_VERBOSE], 3506217309Snwhitehorn[test -n "$verbose" && echo " $1" 1>&AC_FD_MSG 3507217309SnwhitehornCF_MSG_LOG([$1]) 3508217309Snwhitehorn])dnl 3509217309Snwhitehorndnl --------------------------------------------------------------------------- 3510220749Snwhitehorndnl CF_VERSION_INFO version: 4 updated: 2011/01/02 19:09:47 3511217309Snwhitehorndnl --------------- 3512217309Snwhitehorndnl Define several useful symbols derived from the VERSION file. A separate 3513217309Snwhitehorndnl file is preferred to embedding the version numbers in various scripts. 3514217309Snwhitehorndnl (automake is a textbook-example of why the latter is a bad idea, but there 3515217309Snwhitehorndnl are others). 3516217309Snwhitehorndnl 3517217309Snwhitehorndnl The file contents are: 3518217309Snwhitehorndnl libtool-version release-version patch-version 3519217309Snwhitehorndnl or 3520217309Snwhitehorndnl release-version 3521217309Snwhitehorndnl where 3522217309Snwhitehorndnl libtool-version (see ?) consists of 3 integers separated by '.' 3523217309Snwhitehorndnl release-version consists of a major version and minor version 3524217309Snwhitehorndnl separated by '.', optionally followed by a patch-version 3525217309Snwhitehorndnl separated by '-'. The minor version need not be an 3526217309Snwhitehorndnl integer (but it is preferred). 3527217309Snwhitehorndnl patch-version is an integer in the form yyyymmdd, so ifdef's and 3528217309Snwhitehorndnl scripts can easily compare versions. 3529217309Snwhitehorndnl 3530217309Snwhitehorndnl If libtool is used, the first form is required, since CF_WITH_LIBTOOL 3531217309Snwhitehorndnl simply extracts the first field using 'cut -f1'. 3532220749Snwhitehorndnl 3533220749Snwhitehorndnl Optional parameters: 3534220749Snwhitehorndnl $1 = internal name for package 3535220749Snwhitehorndnl $2 = external name for package 3536217309SnwhitehornAC_DEFUN([CF_VERSION_INFO], 3537217309Snwhitehorn[ 3538217309Snwhitehornif test -f $srcdir/VERSION ; then 3539217309Snwhitehorn AC_MSG_CHECKING(for package version) 3540217309Snwhitehorn 3541217309Snwhitehorn # if there are not enough fields, cut returns the last one... 3542217309Snwhitehorn cf_field1=`sed -e '2,$d' $srcdir/VERSION|cut -f1` 3543217309Snwhitehorn cf_field2=`sed -e '2,$d' $srcdir/VERSION|cut -f2` 3544217309Snwhitehorn cf_field3=`sed -e '2,$d' $srcdir/VERSION|cut -f3` 3545217309Snwhitehorn 3546217309Snwhitehorn # this is how CF_BUNDLED_INTL uses $VERSION: 3547217309Snwhitehorn VERSION="$cf_field1" 3548217309Snwhitehorn 3549217309Snwhitehorn VERSION_MAJOR=`echo "$cf_field2" | sed -e 's/\..*//'` 3550217309Snwhitehorn test -z "$VERSION_MAJOR" && AC_MSG_ERROR(missing major-version) 3551217309Snwhitehorn 3552217309Snwhitehorn VERSION_MINOR=`echo "$cf_field2" | sed -e 's/^[[^.]]*\.//' -e 's/-.*//'` 3553217309Snwhitehorn test -z "$VERSION_MINOR" && AC_MSG_ERROR(missing minor-version) 3554217309Snwhitehorn 3555217309Snwhitehorn AC_MSG_RESULT(${VERSION_MAJOR}.${VERSION_MINOR}) 3556217309Snwhitehorn 3557217309Snwhitehorn AC_MSG_CHECKING(for package patch date) 3558217309Snwhitehorn VERSION_PATCH=`echo "$cf_field3" | sed -e 's/^[[^-]]*-//'` 3559217309Snwhitehorn case .$VERSION_PATCH in 3560217309Snwhitehorn .) 3561217309Snwhitehorn AC_MSG_ERROR(missing patch-date $VERSION_PATCH) 3562217309Snwhitehorn ;; 3563217309Snwhitehorn .[[0-9]][[0-9]][[0-9]][[0-9]][[0-9]][[0-9]][[0-9]][[0-9]]) 3564217309Snwhitehorn ;; 3565217309Snwhitehorn *) 3566217309Snwhitehorn AC_MSG_ERROR(illegal patch-date $VERSION_PATCH) 3567217309Snwhitehorn ;; 3568217309Snwhitehorn esac 3569217309Snwhitehorn AC_MSG_RESULT($VERSION_PATCH) 3570217309Snwhitehornelse 3571217309Snwhitehorn AC_MSG_ERROR(did not find $srcdir/VERSION) 3572217309Snwhitehornfi 3573217309Snwhitehorn 3574217309Snwhitehorn# show the actual data that we have for versions: 3575217309SnwhitehornCF_VERBOSE(VERSION $VERSION) 3576217309SnwhitehornCF_VERBOSE(VERSION_MAJOR $VERSION_MAJOR) 3577217309SnwhitehornCF_VERBOSE(VERSION_MINOR $VERSION_MINOR) 3578217309SnwhitehornCF_VERBOSE(VERSION_PATCH $VERSION_PATCH) 3579217309Snwhitehorn 3580217309SnwhitehornAC_SUBST(VERSION) 3581217309SnwhitehornAC_SUBST(VERSION_MAJOR) 3582217309SnwhitehornAC_SUBST(VERSION_MINOR) 3583217309SnwhitehornAC_SUBST(VERSION_PATCH) 3584217309Snwhitehorn 3585217309Snwhitehorndnl if a package name is given, define its corresponding version info. We 3586217309Snwhitehorndnl need the package name to ensure that the defined symbols are unique. 3587217309Snwhitehornifelse($1,,,[ 3588220749Snwhitehorn cf_PACKAGE=$1 3589220749Snwhitehorn PACKAGE=ifelse($2,,$1,$2) 3590217309Snwhitehorn AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE") 3591217309Snwhitehorn AC_SUBST(PACKAGE) 3592220749Snwhitehorn CF_UPPER(cf_PACKAGE,$cf_PACKAGE) 3593217309Snwhitehorn AC_DEFINE_UNQUOTED(${cf_PACKAGE}_VERSION,"${VERSION_MAJOR}.${VERSION_MINOR}") 3594217309Snwhitehorn AC_DEFINE_UNQUOTED(${cf_PACKAGE}_PATCHDATE,${VERSION_PATCH}) 3595217309Snwhitehorn]) 3596217309Snwhitehorn])dnl 3597217309Snwhitehorndnl --------------------------------------------------------------------------- 3598217309Snwhitehorndnl CF_WAIT_HEADERS version: 2 updated: 1997/10/21 19:45:33 3599217309Snwhitehorndnl --------------- 3600217309Snwhitehorndnl Build up an expression $cf_wait_headers with the header files needed to 3601217309Snwhitehorndnl compile against the prototypes for 'wait()', 'waitpid()', etc. Assume it's 3602217309Snwhitehorndnl Posix, which uses <sys/types.h> and <sys/wait.h>, but allow SVr4 variation 3603217309Snwhitehorndnl with <wait.h>. 3604217309SnwhitehornAC_DEFUN([CF_WAIT_HEADERS], 3605217309Snwhitehorn[ 3606217309SnwhitehornAC_HAVE_HEADERS(sys/wait.h) 3607217309Snwhitehorncf_wait_headers="#include <sys/types.h> 3608217309Snwhitehorn" 3609217309Snwhitehornif test $ac_cv_header_sys_wait_h = yes; then 3610217309Snwhitehorncf_wait_headers="$cf_wait_headers 3611217309Snwhitehorn#include <sys/wait.h> 3612217309Snwhitehorn" 3613217309Snwhitehornelse 3614217309SnwhitehornAC_HAVE_HEADERS(wait.h) 3615217309SnwhitehornAC_HAVE_HEADERS(waitstatus.h) 3616217309Snwhitehornif test $ac_cv_header_wait_h = yes; then 3617217309Snwhitehorncf_wait_headers="$cf_wait_headers 3618217309Snwhitehorn#include <wait.h> 3619217309Snwhitehorn" 3620217309Snwhitehornfi 3621217309Snwhitehornif test $ac_cv_header_waitstatus_h = yes; then 3622217309Snwhitehorncf_wait_headers="$cf_wait_headers 3623217309Snwhitehorn#include <waitstatus.h> 3624217309Snwhitehorn" 3625217309Snwhitehornfi 3626217309Snwhitehornfi 3627217309Snwhitehorn])dnl 3628217309Snwhitehorndnl --------------------------------------------------------------------------- 3629220749Snwhitehorndnl CF_WITH_CURSES_DIR version: 3 updated: 2010/11/20 17:02:38 3630217309Snwhitehorndnl ------------------ 3631217309Snwhitehorndnl Wrapper for AC_ARG_WITH to specify directory under which to look for curses 3632217309Snwhitehorndnl libraries. 3633217309SnwhitehornAC_DEFUN([CF_WITH_CURSES_DIR],[ 3634220749Snwhitehorn 3635220749SnwhitehornAC_MSG_CHECKING(for specific curses-directory) 3636217309SnwhitehornAC_ARG_WITH(curses-dir, 3637217309Snwhitehorn [ --with-curses-dir=DIR directory in which (n)curses is installed], 3638220749Snwhitehorn [cf_cv_curses_dir=$withval], 3639217309Snwhitehorn [cf_cv_curses_dir=no]) 3640220749SnwhitehornAC_MSG_RESULT($cf_cv_curses_dir) 3641220749Snwhitehorn 3642220749Snwhitehornif ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" ) 3643220749Snwhitehornthen 3644220749Snwhitehorn CF_PATH_SYNTAX(withval) 3645220749Snwhitehorn if test -d "$cf_cv_curses_dir" 3646220749Snwhitehorn then 3647220749Snwhitehorn CF_ADD_INCDIR($cf_cv_curses_dir/include) 3648220749Snwhitehorn CF_ADD_LIBDIR($cf_cv_curses_dir/lib) 3649220749Snwhitehorn fi 3650220749Snwhitehornfi 3651217309Snwhitehorn])dnl 3652217309Snwhitehorndnl --------------------------------------------------------------------------- 3653220749Snwhitehorndnl CF_WITH_DBMALLOC version: 7 updated: 2010/06/21 17:26:47 3654217309Snwhitehorndnl ---------------- 3655217309Snwhitehorndnl Configure-option for dbmalloc. The optional parameter is used to override 3656217309Snwhitehorndnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests. 3657217309SnwhitehornAC_DEFUN([CF_WITH_DBMALLOC],[ 3658217309SnwhitehornCF_NO_LEAKS_OPTION(dbmalloc, 3659217309Snwhitehorn [ --with-dbmalloc test: use Conor Cahill's dbmalloc library], 3660217309Snwhitehorn [USE_DBMALLOC]) 3661217309Snwhitehorn 3662217309Snwhitehornif test "$with_dbmalloc" = yes ; then 3663217309Snwhitehorn AC_CHECK_HEADER(dbmalloc.h, 3664220749Snwhitehorn [AC_CHECK_LIB(dbmalloc,[debug_malloc]ifelse([$1],,[],[,$1]))]) 3665217309Snwhitehornfi 3666217309Snwhitehorn])dnl 3667217309Snwhitehorndnl --------------------------------------------------------------------------- 3668220749Snwhitehorndnl CF_WITH_DMALLOC version: 7 updated: 2010/06/21 17:26:47 3669217309Snwhitehorndnl --------------- 3670217309Snwhitehorndnl Configure-option for dmalloc. The optional parameter is used to override 3671217309Snwhitehorndnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests. 3672217309SnwhitehornAC_DEFUN([CF_WITH_DMALLOC],[ 3673217309SnwhitehornCF_NO_LEAKS_OPTION(dmalloc, 3674217309Snwhitehorn [ --with-dmalloc test: use Gray Watson's dmalloc library], 3675217309Snwhitehorn [USE_DMALLOC]) 3676217309Snwhitehorn 3677217309Snwhitehornif test "$with_dmalloc" = yes ; then 3678217309Snwhitehorn AC_CHECK_HEADER(dmalloc.h, 3679220749Snwhitehorn [AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse([$1],,[],[,$1]))]) 3680217309Snwhitehornfi 3681217309Snwhitehorn])dnl 3682217309Snwhitehorndnl --------------------------------------------------------------------------- 3683224014Snwhitehorndnl CF_WITH_LIBTOOL version: 27 updated: 2011/06/28 18:45:38 3684217309Snwhitehorndnl --------------- 3685217309Snwhitehorndnl Provide a configure option to incorporate libtool. Define several useful 3686217309Snwhitehorndnl symbols for the makefile rules. 3687217309Snwhitehorndnl 3688217309Snwhitehorndnl The reference to AC_PROG_LIBTOOL does not normally work, since it uses 3689217309Snwhitehorndnl macros from libtool.m4 which is in the aclocal directory of automake. 3690217309Snwhitehorndnl Following is a simple script which turns on the AC_PROG_LIBTOOL macro. 3691217309Snwhitehorndnl But that still does not work properly since the macro is expanded outside 3692217309Snwhitehorndnl the CF_WITH_LIBTOOL macro: 3693217309Snwhitehorndnl 3694217309Snwhitehorndnl #!/bin/sh 3695217309Snwhitehorndnl ACLOCAL=`aclocal --print-ac-dir` 3696217309Snwhitehorndnl if test -z "$ACLOCAL" ; then 3697217309Snwhitehorndnl echo cannot find aclocal directory 3698217309Snwhitehorndnl exit 1 3699217309Snwhitehorndnl elif test ! -f $ACLOCAL/libtool.m4 ; then 3700217309Snwhitehorndnl echo cannot find libtool.m4 file 3701217309Snwhitehorndnl exit 1 3702217309Snwhitehorndnl fi 3703217309Snwhitehorndnl 3704217309Snwhitehorndnl LOCAL=aclocal.m4 3705217309Snwhitehorndnl ORIG=aclocal.m4.orig 3706217309Snwhitehorndnl 3707217309Snwhitehorndnl trap "mv $ORIG $LOCAL" 0 1 2 5 15 3708217309Snwhitehorndnl rm -f $ORIG 3709217309Snwhitehorndnl mv $LOCAL $ORIG 3710217309Snwhitehorndnl 3711217309Snwhitehorndnl # sed the LIBTOOL= assignment to omit the current directory? 3712220749Snwhitehorndnl sed -e 's/^LIBTOOL=.*/LIBTOOL=${LIBTOOL:-libtool}/' $ACLOCAL/libtool.m4 >>$LOCAL 3713217309Snwhitehorndnl cat $ORIG >>$LOCAL 3714217309Snwhitehorndnl 3715217309Snwhitehorndnl autoconf-257 $* 3716217309Snwhitehorndnl 3717217309SnwhitehornAC_DEFUN([CF_WITH_LIBTOOL], 3718217309Snwhitehorn[ 3719220749SnwhitehornAC_REQUIRE([CF_DISABLE_LIBTOOL_VERSION]) 3720217309Snwhitehornifdef([AC_PROG_LIBTOOL],,[ 3721217309SnwhitehornLIBTOOL= 3722217309Snwhitehorn]) 3723217309Snwhitehorn# common library maintenance symbols that are convenient for libtool scripts: 3724217309SnwhitehornLIB_CREATE='${AR} -cr' 3725217309SnwhitehornLIB_OBJECT='${OBJECTS}' 3726217309SnwhitehornLIB_SUFFIX=.a 3727217309SnwhitehornLIB_PREP="$RANLIB" 3728217309Snwhitehorn 3729217309Snwhitehorn# symbols used to prop libtool up to enable it to determine what it should be 3730217309Snwhitehorn# doing: 3731217309SnwhitehornLIB_CLEAN= 3732217309SnwhitehornLIB_COMPILE= 3733217309SnwhitehornLIB_LINK='${CC}' 3734217309SnwhitehornLIB_INSTALL= 3735217309SnwhitehornLIB_UNINSTALL= 3736217309Snwhitehorn 3737217309SnwhitehornAC_MSG_CHECKING(if you want to build libraries with libtool) 3738217309SnwhitehornAC_ARG_WITH(libtool, 3739217309Snwhitehorn [ --with-libtool generate libraries with libtool], 3740217309Snwhitehorn [with_libtool=$withval], 3741217309Snwhitehorn [with_libtool=no]) 3742217309SnwhitehornAC_MSG_RESULT($with_libtool) 3743217309Snwhitehornif test "$with_libtool" != "no"; then 3744217309Snwhitehornifdef([AC_PROG_LIBTOOL],[ 3745217309Snwhitehorn # missing_content_AC_PROG_LIBTOOL{{ 3746217309Snwhitehorn AC_PROG_LIBTOOL 3747217309Snwhitehorn # missing_content_AC_PROG_LIBTOOL}} 3748217309Snwhitehorn],[ 3749217309Snwhitehorn if test "$with_libtool" != "yes" ; then 3750217309Snwhitehorn CF_PATH_SYNTAX(with_libtool) 3751217309Snwhitehorn LIBTOOL=$with_libtool 3752217309Snwhitehorn else 3753217309Snwhitehorn AC_PATH_PROG(LIBTOOL,libtool) 3754217309Snwhitehorn fi 3755217309Snwhitehorn if test -z "$LIBTOOL" ; then 3756217309Snwhitehorn AC_MSG_ERROR(Cannot find libtool) 3757217309Snwhitehorn fi 3758217309Snwhitehorn])dnl 3759224014Snwhitehorn LIB_CREATE='${LIBTOOL} --mode=link ${CC} -rpath ${DESTDIR}${libdir} ${LIBTOOL_VERSION} `cut -f1 ${srcdir}/VERSION` ${LIBTOOL_OPTS} ${LT_UNDEF} $(LIBS) -o' 3760217309Snwhitehorn LIB_OBJECT='${OBJECTS:.o=.lo}' 3761217309Snwhitehorn LIB_SUFFIX=.la 3762217309Snwhitehorn LIB_CLEAN='${LIBTOOL} --mode=clean' 3763217309Snwhitehorn LIB_COMPILE='${LIBTOOL} --mode=compile' 3764217309Snwhitehorn LIB_LINK='${LIBTOOL} --mode=link ${CC} ${LIBTOOL_OPTS}' 3765217309Snwhitehorn LIB_INSTALL='${LIBTOOL} --mode=install' 3766217309Snwhitehorn LIB_UNINSTALL='${LIBTOOL} --mode=uninstall' 3767217309Snwhitehorn LIB_PREP=: 3768217309Snwhitehorn 3769217309Snwhitehorn # Show the version of libtool 3770217309Snwhitehorn AC_MSG_CHECKING(version of libtool) 3771217309Snwhitehorn 3772217309Snwhitehorn # Save the version in a cache variable - this is not entirely a good 3773217309Snwhitehorn # thing, but the version string from libtool is very ugly, and for 3774217309Snwhitehorn # bug reports it might be useful to have the original string. "(" 3775217309Snwhitehorn 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.]].*//'` 3776217309Snwhitehorn AC_MSG_RESULT($cf_cv_libtool_version) 3777217309Snwhitehorn if test -z "$cf_cv_libtool_version" ; then 3778217309Snwhitehorn AC_MSG_ERROR(This is not GNU libtool) 3779217309Snwhitehorn fi 3780217309Snwhitehorn 3781217309Snwhitehorn # special hack to add -no-undefined (which libtool should do for itself) 3782217309Snwhitehorn LT_UNDEF= 3783217309Snwhitehorn case "$cf_cv_system_name" in #(vi 3784217309Snwhitehorn cygwin*|mingw32*|uwin*|aix[[456]]) #(vi 3785217309Snwhitehorn LT_UNDEF=-no-undefined 3786217309Snwhitehorn ;; 3787217309Snwhitehorn esac 3788217309Snwhitehorn AC_SUBST([LT_UNDEF]) 3789217309Snwhitehorn 3790217309Snwhitehorn # special hack to add --tag option for C++ compiler 3791217309Snwhitehorn case $cf_cv_libtool_version in #(vi 3792217309Snwhitehorn 1.[[5-9]]*|[[2-9]].[[0-9.a-z]]*) #(vi 3793217309Snwhitehorn LIBTOOL_CXX="$LIBTOOL --tag=CXX" 3794217309Snwhitehorn LIBTOOL="$LIBTOOL --tag=CC" 3795217309Snwhitehorn ;; 3796217309Snwhitehorn *) 3797217309Snwhitehorn LIBTOOL_CXX="$LIBTOOL" 3798217309Snwhitehorn ;; 3799217309Snwhitehorn esac 3800217309Snwhitehornelse 3801217309Snwhitehorn LIBTOOL="" 3802217309Snwhitehorn LIBTOOL_CXX="" 3803217309Snwhitehornfi 3804217309Snwhitehorn 3805217309Snwhitehorntest -z "$LIBTOOL" && ECHO_LT= 3806217309Snwhitehorn 3807217309SnwhitehornAC_SUBST(LIBTOOL) 3808217309SnwhitehornAC_SUBST(LIBTOOL_CXX) 3809217309SnwhitehornAC_SUBST(LIBTOOL_OPTS) 3810217309Snwhitehorn 3811217309SnwhitehornAC_SUBST(LIB_CREATE) 3812217309SnwhitehornAC_SUBST(LIB_OBJECT) 3813217309SnwhitehornAC_SUBST(LIB_SUFFIX) 3814217309SnwhitehornAC_SUBST(LIB_PREP) 3815217309Snwhitehorn 3816217309SnwhitehornAC_SUBST(LIB_CLEAN) 3817217309SnwhitehornAC_SUBST(LIB_COMPILE) 3818217309SnwhitehornAC_SUBST(LIB_LINK) 3819217309SnwhitehornAC_SUBST(LIB_INSTALL) 3820217309SnwhitehornAC_SUBST(LIB_UNINSTALL) 3821217309Snwhitehorn 3822217309Snwhitehorn])dnl 3823217309Snwhitehorndnl --------------------------------------------------------------------------- 3824217309Snwhitehorndnl CF_WITH_LIBTOOL_OPTS version: 2 updated: 2007/04/08 18:14:54 3825217309Snwhitehorndnl -------------------- 3826217309Snwhitehorndnl Allow user to pass additional libtool options into the library creation 3827217309Snwhitehorndnl and link steps. The main use for this is to do something like 3828217309Snwhitehorndnl ./configure --with-libtool-opts=-static 3829217309Snwhitehorndnl to get the same behavior as automake-flavored 3830217309Snwhitehorndnl ./configure --enable-static 3831217309SnwhitehornAC_DEFUN([CF_WITH_LIBTOOL_OPTS],[ 3832217309SnwhitehornAC_MSG_CHECKING(for additional libtool options) 3833217309SnwhitehornAC_ARG_WITH(libtool-opts, 3834217309Snwhitehorn [ --with-libtool-opts=XXX specify additional libtool options], 3835217309Snwhitehorn [with_libtool_opts=$withval], 3836217309Snwhitehorn [with_libtool_opts=no]) 3837217309SnwhitehornAC_MSG_RESULT($with_libtool_opts) 3838217309Snwhitehorn 3839217309Snwhitehorncase .$with_libtool_opts in 3840217309Snwhitehorn.yes|.no|.) 3841217309Snwhitehorn ;; 3842217309Snwhitehorn*) 3843217309Snwhitehorn LIBTOOL_OPTS=$with_libtool_opts 3844217309Snwhitehorn ;; 3845217309Snwhitehornesac 3846217309Snwhitehorn 3847217309SnwhitehornAC_SUBST(LIBTOOL_OPTS) 3848217309Snwhitehorn])dnl 3849217309Snwhitehorndnl --------------------------------------------------------------------------- 3850217309Snwhitehorndnl CF_WITH_NO_LEAKS version: 1 updated: 2006/12/14 18:00:21 3851217309Snwhitehorndnl ---------------- 3852217309SnwhitehornAC_DEFUN([CF_WITH_NO_LEAKS],[ 3853217309Snwhitehorn 3854217309SnwhitehornAC_REQUIRE([CF_WITH_DMALLOC]) 3855217309SnwhitehornAC_REQUIRE([CF_WITH_DBMALLOC]) 3856217309SnwhitehornAC_REQUIRE([CF_WITH_PURIFY]) 3857217309SnwhitehornAC_REQUIRE([CF_WITH_VALGRIND]) 3858217309Snwhitehorn 3859217309SnwhitehornAC_MSG_CHECKING(if you want to perform memory-leak testing) 3860217309SnwhitehornAC_ARG_WITH(no-leaks, 3861217309Snwhitehorn [ --with-no-leaks test: free permanent memory, analyze leaks], 3862217309Snwhitehorn [AC_DEFINE(NO_LEAKS) 3863217309Snwhitehorn cf_doalloc=".${with_dmalloc}${with_dbmalloc}${with_purify}${with_valgrind}" 3864217309Snwhitehorn case ${cf_doalloc} in #(vi 3865217309Snwhitehorn *yes*) ;; 3866217309Snwhitehorn *) AC_DEFINE(DOALLOC,10000) ;; 3867217309Snwhitehorn esac 3868217309Snwhitehorn with_no_leaks=yes], 3869217309Snwhitehorn [with_no_leaks=]) 3870217309SnwhitehornAC_MSG_RESULT($with_no_leaks) 3871217309Snwhitehorn])dnl 3872217309Snwhitehorndnl --------------------------------------------------------------------------- 3873217309Snwhitehorndnl CF_WITH_PURIFY version: 2 updated: 2006/12/14 18:43:43 3874217309Snwhitehorndnl -------------- 3875217309SnwhitehornAC_DEFUN([CF_WITH_PURIFY],[ 3876217309SnwhitehornCF_NO_LEAKS_OPTION(purify, 3877217309Snwhitehorn [ --with-purify test: use Purify], 3878217309Snwhitehorn [USE_PURIFY], 3879217309Snwhitehorn [LINK_PREFIX="$LINK_PREFIX purify"]) 3880217309SnwhitehornAC_SUBST(LINK_PREFIX) 3881217309Snwhitehorn])dnl 3882217309Snwhitehorndnl --------------------------------------------------------------------------- 3883217309Snwhitehorndnl CF_WITH_VALGRIND version: 1 updated: 2006/12/14 18:00:21 3884217309Snwhitehorndnl ---------------- 3885217309SnwhitehornAC_DEFUN([CF_WITH_VALGRIND],[ 3886217309SnwhitehornCF_NO_LEAKS_OPTION(valgrind, 3887217309Snwhitehorn [ --with-valgrind test: use valgrind], 3888217309Snwhitehorn [USE_VALGRIND]) 3889217309Snwhitehorn])dnl 3890217309Snwhitehorndnl --------------------------------------------------------------------------- 3891217309Snwhitehorndnl CF_WITH_WARNINGS version: 5 updated: 2004/07/23 14:40:34 3892217309Snwhitehorndnl ---------------- 3893217309Snwhitehorndnl Combine the checks for gcc features into a configure-script option 3894217309Snwhitehorndnl 3895217309Snwhitehorndnl Parameters: 3896217309Snwhitehorndnl $1 - see CF_GCC_WARNINGS 3897217309SnwhitehornAC_DEFUN([CF_WITH_WARNINGS], 3898217309Snwhitehorn[ 3899217309Snwhitehornif ( test "$GCC" = yes || test "$GXX" = yes ) 3900217309Snwhitehornthen 3901217309SnwhitehornAC_MSG_CHECKING(if you want to check for gcc warnings) 3902217309SnwhitehornAC_ARG_WITH(warnings, 3903217309Snwhitehorn [ --with-warnings test: turn on gcc warnings], 3904217309Snwhitehorn [cf_opt_with_warnings=$withval], 3905217309Snwhitehorn [cf_opt_with_warnings=no]) 3906217309SnwhitehornAC_MSG_RESULT($cf_opt_with_warnings) 3907217309Snwhitehornif test "$cf_opt_with_warnings" != no ; then 3908217309Snwhitehorn CF_GCC_ATTRIBUTES 3909217309Snwhitehorn CF_GCC_WARNINGS([$1]) 3910217309Snwhitehornfi 3911217309Snwhitehornfi 3912217309Snwhitehorn])dnl 3913217309Snwhitehorndnl --------------------------------------------------------------------------- 3914220749Snwhitehorndnl CF_XOPEN_CURSES version: 11 updated: 2011/01/18 18:15:30 3915217309Snwhitehorndnl --------------- 3916217309Snwhitehorndnl Test if we should define X/Open source for curses, needed on Digital Unix 3917217309Snwhitehorndnl 4.x, to see the extended functions, but breaks on IRIX 6.x. 3918217309Snwhitehorndnl 3919217309Snwhitehorndnl The getbegyx() check is needed for HPUX, which omits legacy macros such 3920217309Snwhitehorndnl as getbegy(). The latter is better design, but the former is standard. 3921217309SnwhitehornAC_DEFUN([CF_XOPEN_CURSES], 3922217309Snwhitehorn[ 3923217309SnwhitehornAC_REQUIRE([CF_CURSES_CPPFLAGS])dnl 3924217309SnwhitehornAC_CACHE_CHECK(if we must define _XOPEN_SOURCE_EXTENDED,cf_cv_need_xopen_extension,[ 3925217309SnwhitehornAC_TRY_LINK([ 3926217309Snwhitehorn#include <stdlib.h> 3927220749Snwhitehorn#include <${cf_cv_ncurses_header:-curses.h}>],[ 3928217309Snwhitehorn#if defined(NCURSES_VERSION_PATCH) 3929220749Snwhitehorn#if (NCURSES_VERSION_PATCH < 20100501) && (NCURSES_VERSION_PATCH >= 20100403) 3930217309Snwhitehorn make an error 3931217309Snwhitehorn#endif 3932217309Snwhitehorn#endif 3933217309Snwhitehorn long x = winnstr(stdscr, "", 0); 3934217309Snwhitehorn int x1, y1; 3935217309Snwhitehorn getbegyx(stdscr, y1, x1)], 3936217309Snwhitehorn [cf_cv_need_xopen_extension=no], 3937217309Snwhitehorn [AC_TRY_LINK([ 3938217309Snwhitehorn#define _XOPEN_SOURCE_EXTENDED 3939217309Snwhitehorn#include <stdlib.h> 3940220749Snwhitehorn#include <${cf_cv_ncurses_header:-curses.h}>],[ 3941217309Snwhitehorn#ifdef NCURSES_VERSION 3942217309Snwhitehorn cchar_t check; 3943217309Snwhitehorn int check2 = curs_set((int)sizeof(check)); 3944217309Snwhitehorn#endif 3945217309Snwhitehorn long x = winnstr(stdscr, "", 0); 3946217309Snwhitehorn int x1, y1; 3947217309Snwhitehorn getbegyx(stdscr, y1, x1)], 3948217309Snwhitehorn [cf_cv_need_xopen_extension=yes], 3949217309Snwhitehorn [cf_cv_need_xopen_extension=unknown])])]) 3950217309Snwhitehorntest $cf_cv_need_xopen_extension = yes && CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED" 3951217309Snwhitehorn])dnl 3952217309Snwhitehorndnl --------------------------------------------------------------------------- 3953224014Snwhitehorndnl CF_XOPEN_SOURCE version: 35 updated: 2011/02/20 20:37:37 3954217309Snwhitehorndnl --------------- 3955217309Snwhitehorndnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions, 3956217309Snwhitehorndnl or adapt to the vendor's definitions to get equivalent functionality, 3957217309Snwhitehorndnl without losing the common non-POSIX features. 3958217309Snwhitehorndnl 3959217309Snwhitehorndnl Parameters: 3960217309Snwhitehorndnl $1 is the nominal value for _XOPEN_SOURCE 3961217309Snwhitehorndnl $2 is the nominal value for _POSIX_C_SOURCE 3962217309SnwhitehornAC_DEFUN([CF_XOPEN_SOURCE],[ 3963217309Snwhitehorn 3964220749Snwhitehorncf_XOPEN_SOURCE=ifelse([$1],,500,[$1]) 3965220749Snwhitehorncf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2]) 3966217309Snwhitehorncf_xopen_source= 3967217309Snwhitehorn 3968217309Snwhitehorncase $host_os in #(vi 3969217309Snwhitehornaix[[456]]*) #(vi 3970217309Snwhitehorn cf_xopen_source="-D_ALL_SOURCE" 3971217309Snwhitehorn ;; 3972224014Snwhitehorncygwin) #(vi 3973224014Snwhitehorn cf_XOPEN_SOURCE=600 3974224014Snwhitehorn ;; 3975217309Snwhitehorndarwin[[0-8]].*) #(vi 3976217309Snwhitehorn cf_xopen_source="-D_APPLE_C_SOURCE" 3977217309Snwhitehorn ;; 3978217309Snwhitehorndarwin*) #(vi 3979217309Snwhitehorn cf_xopen_source="-D_DARWIN_C_SOURCE" 3980217309Snwhitehorn ;; 3981217309Snwhitehornfreebsd*|dragonfly*) #(vi 3982217309Snwhitehorn # 5.x headers associate 3983217309Snwhitehorn # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L 3984217309Snwhitehorn # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L 3985217309Snwhitehorn cf_POSIX_C_SOURCE=200112L 3986217309Snwhitehorn cf_XOPEN_SOURCE=600 3987217309Snwhitehorn cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" 3988217309Snwhitehorn ;; 3989217309Snwhitehornhpux11*) #(vi 3990217309Snwhitehorn cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500" 3991217309Snwhitehorn ;; 3992217309Snwhitehornhpux*) #(vi 3993217309Snwhitehorn cf_xopen_source="-D_HPUX_SOURCE" 3994217309Snwhitehorn ;; 3995217309Snwhitehornirix[[56]].*) #(vi 3996217309Snwhitehorn cf_xopen_source="-D_SGI_SOURCE" 3997217309Snwhitehorn ;; 3998217309Snwhitehornlinux*|gnu*|mint*|k*bsd*-gnu) #(vi 3999217309Snwhitehorn CF_GNU_SOURCE 4000217309Snwhitehorn ;; 4001217309Snwhitehornmirbsd*) #(vi 4002217309Snwhitehorn # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h> 4003217309Snwhitehorn ;; 4004217309Snwhitehornnetbsd*) #(vi 4005217309Snwhitehorn # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw 4006217309Snwhitehorn ;; 4007217309Snwhitehornopenbsd*) #(vi 4008217309Snwhitehorn # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw 4009217309Snwhitehorn ;; 4010217309Snwhitehornosf[[45]]*) #(vi 4011217309Snwhitehorn cf_xopen_source="-D_OSF_SOURCE" 4012217309Snwhitehorn ;; 4013217309Snwhitehornnto-qnx*) #(vi 4014217309Snwhitehorn cf_xopen_source="-D_QNX_SOURCE" 4015217309Snwhitehorn ;; 4016217309Snwhitehornsco*) #(vi 4017217309Snwhitehorn # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer 4018217309Snwhitehorn ;; 4019217309Snwhitehornsolaris2.1[[0-9]]) #(vi 4020217309Snwhitehorn cf_xopen_source="-D__EXTENSIONS__ -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" 4021217309Snwhitehorn ;; 4022217309Snwhitehornsolaris2.[[1-9]]) #(vi 4023217309Snwhitehorn cf_xopen_source="-D__EXTENSIONS__" 4024217309Snwhitehorn ;; 4025217309Snwhitehorn*) 4026217309Snwhitehorn AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[ 4027217309Snwhitehorn AC_TRY_COMPILE([#include <sys/types.h>],[ 4028217309Snwhitehorn#ifndef _XOPEN_SOURCE 4029217309Snwhitehornmake an error 4030217309Snwhitehorn#endif], 4031217309Snwhitehorn [cf_cv_xopen_source=no], 4032217309Snwhitehorn [cf_save="$CPPFLAGS" 4033217309Snwhitehorn CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" 4034217309Snwhitehorn AC_TRY_COMPILE([#include <sys/types.h>],[ 4035217309Snwhitehorn#ifdef _XOPEN_SOURCE 4036217309Snwhitehornmake an error 4037217309Snwhitehorn#endif], 4038217309Snwhitehorn [cf_cv_xopen_source=no], 4039217309Snwhitehorn [cf_cv_xopen_source=$cf_XOPEN_SOURCE]) 4040217309Snwhitehorn CPPFLAGS="$cf_save" 4041217309Snwhitehorn ]) 4042217309Snwhitehorn]) 4043217309Snwhitehorn if test "$cf_cv_xopen_source" != no ; then 4044217309Snwhitehorn CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE) 4045217309Snwhitehorn CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE) 4046217309Snwhitehorn cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" 4047217309Snwhitehorn CF_ADD_CFLAGS($cf_temp_xopen_source) 4048217309Snwhitehorn fi 4049217309Snwhitehorn CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) 4050217309Snwhitehorn ;; 4051217309Snwhitehornesac 4052217309Snwhitehorn 4053217309Snwhitehornif test -n "$cf_xopen_source" ; then 4054217309Snwhitehorn CF_ADD_CFLAGS($cf_xopen_source) 4055217309Snwhitehornfi 4056217309Snwhitehorn]) 4057217309Snwhitehorndnl --------------------------------------------------------------------------- 4058220749Snwhitehorndnl CF__CURSES_HEAD version: 2 updated: 2010/10/23 15:54:49 4059217309Snwhitehorndnl --------------- 4060217309Snwhitehorndnl Define a reusable chunk which includes <curses.h> and <term.h> when they 4061217309Snwhitehorndnl are both available. 4062217309Snwhitehorndefine([CF__CURSES_HEAD],[ 4063217309Snwhitehorn#ifdef HAVE_XCURSES 4064217309Snwhitehorn#include <xcurses.h> 4065217309Snwhitehornchar * XCursesProgramName = "test"; 4066217309Snwhitehorn#else 4067220749Snwhitehorn#include <${cf_cv_ncurses_header:-curses.h}> 4068217309Snwhitehorn#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H) 4069217309Snwhitehorn#include <ncursesw/term.h> 4070217309Snwhitehorn#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H) 4071217309Snwhitehorn#include <ncurses/term.h> 4072217309Snwhitehorn#elif defined(HAVE_TERM_H) 4073217309Snwhitehorn#include <term.h> 4074217309Snwhitehorn#endif 4075217309Snwhitehorn#endif 4076217309Snwhitehorn]) 4077217309Snwhitehorndnl --------------------------------------------------------------------------- 4078217309Snwhitehorndnl CF__ICONV_BODY version: 2 updated: 2007/07/26 17:35:47 4079217309Snwhitehorndnl -------------- 4080217309Snwhitehorndnl Test-code needed for iconv compile-checks 4081217309Snwhitehorndefine([CF__ICONV_BODY],[ 4082217309Snwhitehorn iconv_t cd = iconv_open("",""); 4083217309Snwhitehorn iconv(cd,NULL,NULL,NULL,NULL); 4084217309Snwhitehorn iconv_close(cd);] 4085217309Snwhitehorn)dnl 4086217309Snwhitehorndnl --------------------------------------------------------------------------- 4087217309Snwhitehorndnl CF__ICONV_HEAD version: 1 updated: 2007/07/26 15:57:03 4088217309Snwhitehorndnl -------------- 4089217309Snwhitehorndnl Header-files needed for iconv compile-checks 4090217309Snwhitehorndefine([CF__ICONV_HEAD],[ 4091217309Snwhitehorn#include <stdlib.h> 4092217309Snwhitehorn#include <iconv.h>] 4093217309Snwhitehorn)dnl 4094217309Snwhitehorndnl --------------------------------------------------------------------------- 4095217309Snwhitehorndnl CF__INTL_BODY version: 1 updated: 2007/07/26 17:35:47 4096217309Snwhitehorndnl ------------- 4097217309Snwhitehorndnl Test-code needed for libintl compile-checks 4098217309Snwhitehorndnl $1 = parameter 2 from AM_WITH_NLS 4099217309Snwhitehorndefine([CF__INTL_BODY],[ 4100217309Snwhitehorn bindtextdomain ("", ""); 4101217309Snwhitehorn return (int) gettext ("") 4102217309Snwhitehorn ifelse([$1], need-ngettext, [ + (int) ngettext ("", "", 0)], []) 4103217309Snwhitehorn [ + _nl_msg_cat_cntr] 4104217309Snwhitehorn]) 4105217309Snwhitehorndnl --------------------------------------------------------------------------- 4106217309Snwhitehorndnl CF__INTL_HEAD version: 1 updated: 2007/07/26 17:35:47 4107217309Snwhitehorndnl ------------- 4108217309Snwhitehorndnl Header-files needed for libintl compile-checks 4109217309Snwhitehorndefine([CF__INTL_HEAD],[ 4110217309Snwhitehorn#include <libintl.h> 4111217309Snwhitehornextern int _nl_msg_cat_cntr; 4112217309Snwhitehorn])dnl 4113217309Snwhitehorndnl --------------------------------------------------------------------------- 4114217309Snwhitehorndnl jm_GLIBC21 version: 3 updated: 2002/10/27 23:21:42 4115217309Snwhitehorndnl ---------- 4116217309Snwhitehorndnl Inserted as requested by gettext 0.10.40 4117217309Snwhitehorndnl File from /usr/share/aclocal 4118217309Snwhitehorndnl glibc21.m4 4119217309Snwhitehorndnl ==================== 4120217309Snwhitehorndnl serial 2 4121217309Snwhitehorndnl 4122217309Snwhitehorndnl Test for the GNU C Library, version 2.1 or newer. 4123217309Snwhitehorndnl From Bruno Haible. 4124217309SnwhitehornAC_DEFUN([jm_GLIBC21], 4125217309Snwhitehorn [ 4126217309Snwhitehorn AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer, 4127217309Snwhitehorn ac_cv_gnu_library_2_1, 4128217309Snwhitehorn [AC_EGREP_CPP([Lucky GNU user], 4129217309Snwhitehorn [ 4130217309Snwhitehorn#include <features.h> 4131217309Snwhitehorn#ifdef __GNU_LIBRARY__ 4132217309Snwhitehorn #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) 4133217309Snwhitehorn Lucky GNU user 4134217309Snwhitehorn #endif 4135217309Snwhitehorn#endif 4136217309Snwhitehorn ], 4137217309Snwhitehorn ac_cv_gnu_library_2_1=yes, 4138217309Snwhitehorn ac_cv_gnu_library_2_1=no) 4139217309Snwhitehorn ] 4140217309Snwhitehorn ) 4141217309Snwhitehorn AC_SUBST(GLIBC21) 4142217309Snwhitehorn GLIBC21="$ac_cv_gnu_library_2_1" 4143217309Snwhitehorn ] 4144217309Snwhitehorn) 4145