1 dnl***************************************************************************
2 dnl Copyright (c) 2010 Free Software Foundation, Inc. *
4 dnl Permission is hereby granted, free of charge, to any person obtaining a *
5 dnl copy of this software and associated documentation files (the *
6 dnl "Software"), to deal in the Software without restriction, including *
7 dnl without limitation the rights to use, copy, modify, merge, publish, *
8 dnl distribute, distribute with modifications, sublicense, and/or sell *
9 dnl copies of the Software, and to permit persons to whom the Software is *
10 dnl furnished to do so, subject to the following conditions: *
12 dnl The above copyright notice and this permission notice shall be included *
13 dnl in all copies or substantial portions of the Software. *
15 dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
16 dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
17 dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
18 dnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
19 dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
20 dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
21 dnl THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
23 dnl Except as contained in this notice, the name(s) of the above copyright *
24 dnl holders shall not be used in advertising or otherwise to promote the *
25 dnl sale, use or other dealings in this Software without prior written *
27 dnl***************************************************************************
29 dnl Author: Thomas E. Dickey
31 dnl $Id: aclocal.m4,v 1.9 2010/06/12 18:59:22 tom Exp $
32 dnl Macros used in NCURSES Ada95 auto-configuration script.
34 dnl These macros are maintained separately from NCURSES. The copyright on
35 dnl this file applies to the aggregation of macros and does not affect use of
36 dnl these macros in other applications.
38 dnl See http://invisible-island.net/autoconf/ for additional information.
40 dnl ---------------------------------------------------------------------------
41 dnl ---------------------------------------------------------------------------
42 dnl CF_ADA_INCLUDE_DIRS version: 6 updated: 2010/02/26 19:52:07
43 dnl -------------------
44 dnl Construct the list of include-options for the C programs in the Ada95
46 AC_DEFUN([CF_ADA_INCLUDE_DIRS],
48 ACPPFLAGS="-I. -I../include -I../../include $ACPPFLAGS"
49 if test "$srcdir" != "."; then
50 ACPPFLAGS="-I\${srcdir}/../../include $ACPPFLAGS"
52 if test "$GCC" != yes; then
53 ACPPFLAGS="$ACPPFLAGS -I\${includedir}"
54 elif test "$includedir" != "/usr/include"; then
55 if test "$includedir" = '${prefix}/include' ; then
56 if test $prefix != /usr ; then
57 ACPPFLAGS="$ACPPFLAGS -I\${includedir}"
60 ACPPFLAGS="$ACPPFLAGS -I\${includedir}"
65 dnl ---------------------------------------------------------------------------
66 dnl CF_ADD_CFLAGS version: 10 updated: 2010/05/26 05:38:42
68 dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS
69 dnl The second parameter if given makes this macro verbose.
71 dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS,
72 dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily
73 dnl confused by the quotes (which require backslashes to keep them usable).
74 AC_DEFUN([CF_ADD_CFLAGS],
79 cf_new_extra_cppflags=
81 for cf_add_cflags in $1
83 case $cf_fix_cppflags in
85 case $cf_add_cflags in #(vi
86 -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
87 case $cf_add_cflags in
89 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'`
91 test "${cf_add_cflags}" != "${cf_tst_cflags}" \
92 && test -z "${cf_tst_cflags}" \
93 && cf_fix_cppflags=yes
95 if test $cf_fix_cppflags = yes ; then
96 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
98 elif test "${cf_tst_cflags}" = "\"'" ; then
99 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
105 *$cf_add_cflags) #(vi
108 case $cf_add_cflags in #(vi
110 cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
111 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags)
114 cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
119 cf_new_cflags="$cf_new_cflags $cf_add_cflags"
124 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
126 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'`
128 test "${cf_add_cflags}" != "${cf_tst_cflags}" \
129 && test -z "${cf_tst_cflags}" \
130 && cf_fix_cppflags=no
135 if test -n "$cf_new_cflags" ; then
136 ifelse([$2],,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)])
137 CFLAGS="$CFLAGS $cf_new_cflags"
140 if test -n "$cf_new_cppflags" ; then
141 ifelse([$2],,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)])
142 CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
145 if test -n "$cf_new_extra_cppflags" ; then
146 ifelse([$2],,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)])
147 EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
150 AC_SUBST(EXTRA_CPPFLAGS)
153 dnl ---------------------------------------------------------------------------
154 dnl CF_ADD_INCDIR version: 13 updated: 2010/05/26 16:44:57
156 dnl Add an include-directory to $CPPFLAGS. Don't add /usr/include, since it's
157 dnl redundant. We don't normally need to add -I/usr/local/include for gcc,
158 dnl but old versions (and some misinstalled ones) need that. To make things
159 dnl worse, gcc 3.x may give error messages if -I/usr/local/include is added to
160 dnl the include-path).
161 AC_DEFUN([CF_ADD_INCDIR],
163 if test -n "$1" ; then
164 for cf_add_incdir in $1
166 while test $cf_add_incdir != /usr/include
168 if test -d $cf_add_incdir
171 if test -n "$CFLAGS$CPPFLAGS" ; then
172 # a loop is needed to ensure we can add subdirs of existing dirs
173 for cf_test_incdir in $CFLAGS $CPPFLAGS ; do
174 if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then
175 cf_have_incdir=yes; break
180 if test "$cf_have_incdir" = no ; then
181 if test "$cf_add_incdir" = /usr/local/include ; then
184 cf_save_CPPFLAGS=$CPPFLAGS
185 CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
186 AC_TRY_COMPILE([#include <stdio.h>],
189 [cf_have_incdir=yes])
190 CPPFLAGS=$cf_save_CPPFLAGS
195 if test "$cf_have_incdir" = no ; then
196 CF_VERBOSE(adding $cf_add_incdir to include-path)
197 ifelse([$2],,CPPFLAGS,[$2])="$ifelse([$2],,CPPFLAGS,[$2]) -I$cf_add_incdir"
199 cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'`
200 test "$cf_top_incdir" = "$cf_add_incdir" && break
201 cf_add_incdir="$cf_top_incdir"
210 dnl ---------------------------------------------------------------------------
211 dnl CF_ADD_LIB version: 2 updated: 2010/06/02 05:03:05
213 dnl Add a library, used to enforce consistency.
215 dnl $1 = library to add, without the "-l"
216 dnl $2 = variable to update (default $LIBS)
217 AC_DEFUN([CF_ADD_LIB],[CF_ADD_LIBS(-l$1,ifelse($2,,LIBS,[$2]))])dnl
218 dnl ---------------------------------------------------------------------------
219 dnl CF_ADD_LIBDIR version: 9 updated: 2010/05/26 16:44:57
221 dnl Adds to the library-path
223 dnl Some machines have trouble with multiple -L options.
225 dnl $1 is the (list of) directory(s) to add
226 dnl $2 is the optional name of the variable to update (default LDFLAGS)
228 AC_DEFUN([CF_ADD_LIBDIR],
230 if test -n "$1" ; then
231 for cf_add_libdir in $1
233 if test $cf_add_libdir = /usr/lib ; then
235 elif test -d $cf_add_libdir
238 if test -n "$LDFLAGS$LIBS" ; then
239 # a loop is needed to ensure we can add subdirs of existing dirs
240 for cf_test_libdir in $LDFLAGS $LIBS ; do
241 if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then
242 cf_have_libdir=yes; break
246 if test "$cf_have_libdir" = no ; then
247 CF_VERBOSE(adding $cf_add_libdir to library-path)
248 ifelse([$2],,LDFLAGS,[$2])="-L$cf_add_libdir $ifelse([$2],,LDFLAGS,[$2])"
254 dnl ---------------------------------------------------------------------------
255 dnl CF_ADD_LIBS version: 1 updated: 2010/06/02 05:03:05
257 dnl Add one or more libraries, used to enforce consistency.
259 dnl $1 = libraries to add, with the "-l", etc.
260 dnl $2 = variable to update (default $LIBS)
261 AC_DEFUN([CF_ADD_LIBS],[ifelse($2,,LIBS,[$2])="$1 [$]ifelse($2,,LIBS,[$2])"])dnl
262 dnl ---------------------------------------------------------------------------
263 dnl CF_ADD_SUBDIR_PATH version: 2 updated: 2007/07/29 10:12:59
264 dnl ------------------
265 dnl Append to a search-list for a nonstandard header/lib-file
266 dnl $1 = the variable to return as result
267 dnl $2 = the package name
268 dnl $3 = the subdirectory, e.g., bin, include or lib
269 dnl $4 = the directory under which we will test for subdirectories
270 dnl $5 = a directory that we do not want $4 to match
271 AC_DEFUN([CF_ADD_SUBDIR_PATH],
273 test "$4" != "$5" && \
275 ifelse([$5],NONE,,[(test $5 = NONE || test -d $5) &&]) {
276 test -n "$verbose" && echo " ... testing for $3-directories under $4"
277 test -d $4/$3 && $1="[$]$1 $4/$3"
278 test -d $4/$3/$2 && $1="[$]$1 $4/$3/$2"
279 test -d $4/$3/$2/$3 && $1="[$]$1 $4/$3/$2/$3"
280 test -d $4/$2/$3 && $1="[$]$1 $4/$2/$3"
281 test -d $4/$2/$3/$2 && $1="[$]$1 $4/$2/$3/$2"
284 dnl ---------------------------------------------------------------------------
285 dnl CF_ANSI_CC_CHECK version: 9 updated: 2001/12/30 17:53:34
287 dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES'
288 dnl in the sharutils 4.2 distribution.
289 AC_DEFUN([CF_ANSI_CC_CHECK],
291 AC_CACHE_CHECK(for ${CC-cc} option to accept ANSI C, cf_cv_ansi_cc,[
293 cf_save_CFLAGS="$CFLAGS"
294 cf_save_CPPFLAGS="$CPPFLAGS"
295 # Don't try gcc -ansi; that turns off useful extensions and
296 # breaks some systems' header files.
298 # Ultrix and OSF/1 -std1
299 # HP-UX -Aa -D_HPUX_SOURCE
301 # UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes)
302 for cf_arg in "-DCC_HAS_PROTOS" \
307 "-Aa -D_HPUX_SOURCE" \
310 CF_ADD_CFLAGS($cf_arg)
313 #ifndef CC_HAS_PROTOS
314 #if !defined(__STDC__) || (__STDC__ != 1)
319 int test (int i, double x);
320 struct s1 {int (*f) (int a);};
321 struct s2 {int (*f) (double a);};],
322 [cf_cv_ansi_cc="$cf_arg"; break])
324 CFLAGS="$cf_save_CFLAGS"
325 CPPFLAGS="$cf_save_CPPFLAGS"
328 if test "$cf_cv_ansi_cc" != "no"; then
329 if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then
330 CF_ADD_CFLAGS($cf_cv_ansi_cc)
332 AC_DEFINE(CC_HAS_PROTOS)
336 dnl ---------------------------------------------------------------------------
337 dnl CF_ANSI_CC_REQD version: 4 updated: 2008/03/23 14:48:54
339 dnl For programs that must use an ANSI compiler, obtain compiler options that
340 dnl will make it recognize prototypes. We'll do preprocessor checks in other
341 dnl macros, since tools such as unproto can fake prototypes, but only part of
342 dnl the preprocessor.
343 AC_DEFUN([CF_ANSI_CC_REQD],
344 [AC_REQUIRE([CF_ANSI_CC_CHECK])
345 if test "$cf_cv_ansi_cc" = "no"; then
347 [Your compiler does not appear to recognize prototypes.
348 You have the following choices:
349 a. adjust your compiler options
350 b. get an up-to-date compiler
351 c. use a wrapper such as unproto])
354 dnl ---------------------------------------------------------------------------
355 dnl CF_AR_FLAGS version: 5 updated: 2010/05/20 20:24:29
357 dnl Check for suitable "ar" (archiver) options for updating an archive.
358 AC_DEFUN([CF_AR_FLAGS],[
359 AC_REQUIRE([CF_PROG_AR])
361 AC_CACHE_CHECK(for options to update archives, cf_cv_ar_flags,[
362 cf_cv_ar_flags=unknown
363 for cf_ar_flags in -curv curv -crv crv -cqv cqv -rv rv
366 # check if $ARFLAGS already contains this choice
367 if test "x$ARFLAGS" != "x" ; then
368 cf_check_ar_flags=`echo "x$ARFLAGS" | sed -e "s/$cf_ar_flags\$//" -e "s/$cf_ar_flags / /"`
369 if test "x$ARFLAGS" != "$cf_check_ar_flags" ; then
375 rm -f conftest.$ac_cv_objext
378 cat >conftest.$ac_ext <<EOF
379 #line __oline__ "configure"
380 int testdata[[3]] = { 123, 456, 789 };
382 if AC_TRY_EVAL(ac_compile) ; then
383 echo "$AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext" >&AC_FD_CC
384 $AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext 2>&AC_FD_CC 1>/dev/null
385 if test -f conftest.a ; then
386 cf_cv_ar_flags=$cf_ar_flags
390 CF_VERBOSE(cannot compile test-program)
394 rm -f conftest.a conftest.$ac_ext conftest.$ac_cv_objext
397 if test -n "$ARFLAGS" ; then
398 if test -n "$cf_cv_ar_flags" ; then
399 ARFLAGS="$ARFLAGS $cf_cv_ar_flags"
402 ARFLAGS=$cf_cv_ar_flags
407 dnl ---------------------------------------------------------------------------
408 dnl CF_BUILD_CC version: 6 updated: 2006/10/14 15:23:15
410 dnl If we're cross-compiling, allow the user to override the tools and their
411 dnl options. The configure script is oriented toward identifying the host
412 dnl compiler, etc., but we need a build compiler to generate parts of the
415 dnl $1 = default for $CPPFLAGS
416 dnl $2 = default for $LIBS
417 AC_DEFUN([CF_BUILD_CC],[
418 AC_REQUIRE([CF_PROG_EXT])
419 if test "$cross_compiling" = yes ; then
421 # defaults that we might want to override
422 : ${BUILD_CFLAGS:=''}
423 : ${BUILD_CPPFLAGS:='ifelse([$1],,,[$1])'}
424 : ${BUILD_LDFLAGS:=''}
425 : ${BUILD_LIBS:='ifelse([$2],,,[$2])'}
426 : ${BUILD_EXEEXT:='$x'}
427 : ${BUILD_OBJEXT:='o'}
429 AC_ARG_WITH(build-cc,
430 [ --with-build-cc=XXX the build C compiler ($BUILD_CC)],
431 [BUILD_CC="$withval"],
432 [AC_CHECK_PROGS(BUILD_CC, gcc cc cl)])
433 AC_MSG_CHECKING(for native build C compiler)
434 AC_MSG_RESULT($BUILD_CC)
436 AC_MSG_CHECKING(for native build C preprocessor)
437 AC_ARG_WITH(build-cpp,
438 [ --with-build-cpp=XXX the build C preprocessor ($BUILD_CPP)],
439 [BUILD_CPP="$withval"],
440 [BUILD_CPP='${BUILD_CC} -E'])
441 AC_MSG_RESULT($BUILD_CPP)
443 AC_MSG_CHECKING(for native build C flags)
444 AC_ARG_WITH(build-cflags,
445 [ --with-build-cflags=XXX the build C compiler-flags ($BUILD_CFLAGS)],
446 [BUILD_CFLAGS="$withval"])
447 AC_MSG_RESULT($BUILD_CFLAGS)
449 AC_MSG_CHECKING(for native build C preprocessor-flags)
450 AC_ARG_WITH(build-cppflags,
451 [ --with-build-cppflags=XXX the build C preprocessor-flags ($BUILD_CPPFLAGS)],
452 [BUILD_CPPFLAGS="$withval"])
453 AC_MSG_RESULT($BUILD_CPPFLAGS)
455 AC_MSG_CHECKING(for native build linker-flags)
456 AC_ARG_WITH(build-ldflags,
457 [ --with-build-ldflags=XXX the build linker-flags ($BUILD_LDFLAGS)],
458 [BUILD_LDFLAGS="$withval"])
459 AC_MSG_RESULT($BUILD_LDFLAGS)
461 AC_MSG_CHECKING(for native build linker-libraries)
462 AC_ARG_WITH(build-libs,
463 [ --with-build-libs=XXX the build libraries (${BUILD_LIBS})],
464 [BUILD_LIBS="$withval"])
465 AC_MSG_RESULT($BUILD_LIBS)
467 # this assumes we're on Unix.
471 : ${BUILD_CC:='${CC}'}
473 if ( test "$BUILD_CC" = "$CC" || test "$BUILD_CC" = '${CC}' ) ; then
474 AC_MSG_ERROR([Cross-build requires two compilers.
475 Use --with-build-cc to specify the native compiler.])
479 : ${BUILD_CC:='${CC}'}
480 : ${BUILD_CPP:='${CPP}'}
481 : ${BUILD_CFLAGS:='${CFLAGS}'}
482 : ${BUILD_CPPFLAGS:='${CPPFLAGS}'}
483 : ${BUILD_LDFLAGS:='${LDFLAGS}'}
484 : ${BUILD_LIBS:='${LIBS}'}
485 : ${BUILD_EXEEXT:='$x'}
486 : ${BUILD_OBJEXT:='o'}
491 AC_SUBST(BUILD_CFLAGS)
492 AC_SUBST(BUILD_CPPFLAGS)
493 AC_SUBST(BUILD_LDFLAGS)
495 AC_SUBST(BUILD_EXEEXT)
496 AC_SUBST(BUILD_OBJEXT)
498 dnl ---------------------------------------------------------------------------
499 dnl CF_CFG_DEFAULTS version: 7 updated: 2005/09/24 16:15:00
501 dnl Determine the default configuration into which we'll install ncurses. This
502 dnl can be overridden by the user's command-line options. There's two items to
504 dnl 1. the prefix (e.g., /usr)
505 dnl 2. the header files (e.g., /usr/include/ncurses)
506 dnl We'll look for a previous installation of ncurses and use the same defaults.
508 dnl We don't use AC_PREFIX_DEFAULT, because it gets evaluated too soon, and
509 dnl we don't use AC_PREFIX_PROGRAM, because we cannot distinguish ncurses's
510 dnl programs from a vendor's.
511 AC_DEFUN([CF_CFG_DEFAULTS],
513 AC_MSG_CHECKING(for prefix)
514 if test "x$prefix" = "xNONE" ; then
515 case "$cf_cv_system_name" in
516 # non-vendor systems don't have a conflict
517 openbsd*|freebsd*|linux*|cygwin*|k*bsd*-gnu)
520 *) prefix=$ac_default_prefix
524 AC_MSG_RESULT($prefix)
526 if test "x$prefix" = "xNONE" ; then
527 AC_MSG_CHECKING(for default include-directory)
528 test -n "$verbose" && echo 1>&AC_FD_MSG
531 $includedir/ncurses \
533 $prefix/include/ncurses \
535 /usr/local/include/ncurses \
539 cf_dir=`eval echo $cf_symbol`
540 if test -f $cf_dir/curses.h ; then
541 if ( fgrep NCURSES_VERSION $cf_dir/curses.h 2>&1 >/dev/null ) ; then
542 includedir="$cf_symbol"
543 test -n "$verbose" && echo $ac_n " found " 1>&AC_FD_MSG
547 test -n "$verbose" && echo " tested $cf_dir" 1>&AC_FD_MSG
549 AC_MSG_RESULT($includedir)
552 dnl ---------------------------------------------------------------------------
553 dnl CF_CHECK_CACHE version: 11 updated: 2008/03/23 14:45:59
555 dnl Check if we're accidentally using a cache from a different machine.
556 dnl Derive the system name, as a check for reusing the autoconf cache.
558 dnl If we've packaged config.guess and config.sub, run that (since it does a
559 dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow
560 dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM
561 dnl which is useful in cross-compiles.
563 dnl Note: we would use $ac_config_sub, but that is one of the places where
564 dnl autoconf 2.5x broke compatibility with autoconf 2.13
565 AC_DEFUN([CF_CHECK_CACHE],
567 if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then
568 ifelse([$1],,[AC_CANONICAL_HOST],[$1])
569 system_name="$host_os"
571 system_name="`(uname -s -r) 2>/dev/null`"
572 if test -z "$system_name" ; then
573 system_name="`(hostname) 2>/dev/null`"
576 test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name")
577 AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
579 test -z "$system_name" && system_name="$cf_cv_system_name"
580 test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name)
582 if test ".$system_name" != ".$cf_cv_system_name" ; then
583 AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name))
584 AC_MSG_ERROR("Please remove config.cache and try again.")
587 dnl ---------------------------------------------------------------------------
588 dnl CF_CURSES_HEADER version: 2 updated: 2010/04/28 06:02:16
590 dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
591 dnl variations of ncurses' installs.
593 dnl $1 = ncurses when looking for ncurses, or is empty
594 AC_DEFUN([CF_CURSES_HEADER],[
595 AC_CACHE_CHECK(if we have identified curses headers,cf_cv_ncurses_header,[
596 cf_cv_ncurses_header=none
597 for cf_header in ifelse($1,,,[ \
601 ncurses.h ifelse($1,,[ncurses/curses.h ncurses/ncurses.h])
603 AC_TRY_COMPILE([#include <${cf_header}>],
604 [initscr(); tgoto("?", 0,0)],
605 [cf_cv_ncurses_header=$cf_header; break],[])
609 if test "$cf_cv_ncurses_header" = none ; then
610 AC_MSG_ERROR(No curses header-files found)
613 # cheat, to get the right #define's for HAVE_NCURSES_H, etc.
614 AC_CHECK_HEADERS($cf_cv_ncurses_header)
616 dnl ---------------------------------------------------------------------------
617 dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52
619 dnl "dirname" is not portable, so we fake it with a shell script.
620 AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl
621 dnl ---------------------------------------------------------------------------
622 dnl CF_FIND_LIBRARY version: 9 updated: 2008/03/23 14:48:54
624 dnl Look for a non-standard library, given parameters for AC_TRY_LINK. We
625 dnl prefer a standard location, and use -L options only if we do not find the
626 dnl library in the standard library location(s).
627 dnl $1 = library name
628 dnl $2 = library class, usually the same as library name
630 dnl $4 = code fragment to compile/link
631 dnl $5 = corresponding function-name
632 dnl $6 = flag, nonnull if failure should not cause an error-exit
634 dnl Sets the variable "$cf_libdir" as a side-effect, so we can see if we had
635 dnl to use a -L option.
636 AC_DEFUN([CF_FIND_LIBRARY],
638 eval 'cf_cv_have_lib_'$1'=no'
641 eval 'cf_cv_have_lib_'$1'=yes',[
643 AC_MSG_CHECKING(for $5 in -l$1)
645 AC_TRY_LINK([$3],[$4],
647 eval 'cf_cv_have_lib_'$1'=yes'
650 CF_LIBRARY_PATH(cf_search,$2)
651 for cf_libdir in $cf_search
653 AC_MSG_CHECKING(for -l$1 in $cf_libdir)
654 LIBS="-L$cf_libdir -l$1 $cf_save_LIBS"
655 AC_TRY_LINK([$3],[$4],
657 eval 'cf_cv_have_lib_'$1'=yes'
660 LIBS="$cf_save_LIBS"])
664 eval 'cf_found_library=[$]cf_cv_have_lib_'$1
666 if test $cf_found_library = no ; then
667 AC_MSG_ERROR(Cannot link $1 library)
671 dnl ---------------------------------------------------------------------------
672 dnl CF_FIND_LINKAGE version: 19 updated: 2010/05/29 16:31:02
674 dnl Find a library (specifically the linkage used in the code fragment),
675 dnl searching for it if it is not already in the library path.
676 dnl See also CF_ADD_SEARCHPATH.
678 dnl Parameters (4-on are optional):
679 dnl $1 = headers for library entrypoint
680 dnl $2 = code fragment for library entrypoint
681 dnl $3 = the library name without the "-l" option or ".so" suffix.
682 dnl $4 = action to perform if successful (default: update CPPFLAGS, etc)
683 dnl $5 = action to perform if not successful
684 dnl $6 = module name, if not the same as the library name
685 dnl $7 = extra libraries
687 dnl Sets these variables:
688 dnl $cf_cv_find_linkage_$3 - yes/no according to whether linkage is found
689 dnl $cf_cv_header_path_$3 - include-directory if needed
690 dnl $cf_cv_library_path_$3 - library-directory if needed
691 dnl $cf_cv_library_file_$3 - library-file if needed, e.g., -l$3
692 AC_DEFUN([CF_FIND_LINKAGE],[
694 # If the linkage is not already in the $CPPFLAGS/$LDFLAGS configuration, these
695 # will be set on completion of the AC_TRY_LINK below.
696 cf_cv_header_path_$3=
697 cf_cv_library_path_$3=
699 CF_MSG_LOG([Starting [FIND_LINKAGE]($3,$6)])
703 AC_TRY_LINK([$1],[$2],[
704 cf_cv_find_linkage_$3=yes
705 cf_cv_header_path_$3=/usr/include
706 cf_cv_library_path_$3=/usr/lib
709 LIBS="-l$3 $7 $cf_save_LIBS"
711 AC_TRY_LINK([$1],[$2],[
712 cf_cv_find_linkage_$3=yes
713 cf_cv_header_path_$3=/usr/include
714 cf_cv_library_path_$3=/usr/lib
715 cf_cv_library_file_$3="-l$3"
717 cf_cv_find_linkage_$3=no
720 CF_VERBOSE(find linkage for $3 library)
721 CF_MSG_LOG([Searching for headers in [FIND_LINKAGE]($3,$6)])
723 cf_save_CPPFLAGS="$CPPFLAGS"
724 cf_test_CPPFLAGS="$CPPFLAGS"
726 CF_HEADER_PATH(cf_search,ifelse([$6],,[$3],[$6]))
727 for cf_cv_header_path_$3 in $cf_search
729 if test -d $cf_cv_header_path_$3 ; then
730 CF_VERBOSE(... testing $cf_cv_header_path_$3)
731 CPPFLAGS="$cf_save_CPPFLAGS -I$cf_cv_header_path_$3"
732 AC_TRY_COMPILE([$1],[$2],[
733 CF_VERBOSE(... found $3 headers in $cf_cv_header_path_$3)
734 cf_cv_find_linkage_$3=maybe
735 cf_test_CPPFLAGS="$CPPFLAGS"
737 CPPFLAGS="$cf_save_CPPFLAGS"
742 if test "$cf_cv_find_linkage_$3" = maybe ; then
744 CF_MSG_LOG([Searching for $3 library in [FIND_LINKAGE]($3,$6)])
747 cf_save_LDFLAGS="$LDFLAGS"
750 CPPFLAGS="$cf_test_CPPFLAGS"
751 LIBS="-l$3 $7 $cf_save_LIBS"
752 AC_TRY_LINK([$1],[$2],[
753 CF_VERBOSE(... found $3 library in system)
754 cf_cv_find_linkage_$3=yes])
755 CPPFLAGS="$cf_save_CPPFLAGS"
759 if test "$cf_cv_find_linkage_$3" != yes ; then
760 CF_LIBRARY_PATH(cf_search,$3)
761 for cf_cv_library_path_$3 in $cf_search
763 if test -d $cf_cv_library_path_$3 ; then
764 CF_VERBOSE(... testing $cf_cv_library_path_$3)
765 CPPFLAGS="$cf_test_CPPFLAGS"
766 LIBS="-l$3 $7 $cf_save_LIBS"
767 LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_$3"
768 AC_TRY_LINK([$1],[$2],[
769 CF_VERBOSE(... found $3 library in $cf_cv_library_path_$3)
770 cf_cv_find_linkage_$3=yes
771 cf_cv_library_file_$3="-l$3"
773 CPPFLAGS="$cf_save_CPPFLAGS"
775 LDFLAGS="$cf_save_LDFLAGS"
779 CPPFLAGS="$cf_save_CPPFLAGS"
780 LDFLAGS="$cf_save_LDFLAGS"
784 cf_cv_find_linkage_$3=no
791 if test "$cf_cv_find_linkage_$3" = yes ; then
793 CF_ADD_INCDIR($cf_cv_header_path_$3)
794 CF_ADD_LIBDIR($cf_cv_library_path_$3)
798 ifelse([$5],,AC_MSG_WARN(Cannot find $3 library),[$5])
801 dnl ---------------------------------------------------------------------------
802 dnl CF_GCC_ATTRIBUTES version: 13 updated: 2009/08/11 20:19:56
803 dnl -----------------
804 dnl Test for availability of useful gcc __attribute__ directives to quiet
805 dnl compiler warnings. Though useful, not all are supported -- and contrary
806 dnl to documentation, unrecognized directives cause older compilers to barf.
807 AC_DEFUN([CF_GCC_ATTRIBUTES],
811 cat > conftest.i <<EOF
819 #define GCC_NORETURN /* nothing */
822 #define GCC_UNUSED /* nothing */
827 AC_CHECKING([for $CC __attribute__ directives])
828 cat > conftest.$ac_ext <<EOF
829 #line __oline__ "${as_me-configure}"
830 #include "confdefs.h"
831 #include "conftest.h"
832 #include "conftest.i"
834 #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
836 #define GCC_PRINTFLIKE(fmt,var) /*nothing*/
839 #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
841 #define GCC_SCANFLIKE(fmt,var) /*nothing*/
843 extern void wow(char *,...) GCC_SCANFLIKE(1,2);
844 extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
845 extern void foo(void) GCC_NORETURN;
846 int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; }
848 cf_printf_attribute=no
849 cf_scanf_attribute=no
850 for cf_attribute in scanf printf unused noreturn
852 CF_UPPER(cf_ATTRIBUTE,$cf_attribute)
853 cf_directive="__attribute__(($cf_attribute))"
854 echo "checking for $CC $cf_directive" 1>&AC_FD_CC
856 case $cf_attribute in #(vi
858 cf_printf_attribute=yes
859 cat >conftest.h <<EOF
860 #define GCC_$cf_ATTRIBUTE 1
864 cf_scanf_attribute=yes
865 cat >conftest.h <<EOF
866 #define GCC_$cf_ATTRIBUTE 1
870 cat >conftest.h <<EOF
871 #define GCC_$cf_ATTRIBUTE $cf_directive
876 if AC_TRY_EVAL(ac_compile); then
877 test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute)
878 cat conftest.h >>confdefs.h
879 case $cf_attribute in #(vi
881 if test "$cf_printf_attribute" = no ; then
882 cat >>confdefs.h <<EOF
883 #define GCC_PRINTFLIKE(fmt,var) /* nothing */
886 cat >>confdefs.h <<EOF
887 #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
892 if test "$cf_scanf_attribute" = no ; then
893 cat >>confdefs.h <<EOF
894 #define GCC_SCANFLIKE(fmt,var) /* nothing */
897 cat >>confdefs.h <<EOF
898 #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
906 fgrep define conftest.i >>confdefs.h
911 dnl ---------------------------------------------------------------------------
912 dnl CF_GCC_VERSION version: 5 updated: 2010/04/24 11:02:31
914 dnl Find version of gcc
915 AC_DEFUN([CF_GCC_VERSION],[
916 AC_REQUIRE([AC_PROG_CC])
918 if test "$GCC" = yes ; then
919 AC_MSG_CHECKING(version of $CC)
920 GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
921 test -z "$GCC_VERSION" && GCC_VERSION=unknown
922 AC_MSG_RESULT($GCC_VERSION)
925 dnl ---------------------------------------------------------------------------
926 dnl CF_GCC_WARNINGS version: 25 updated: 2010/04/24 11:03:31
928 dnl Check if the compiler supports useful warning options. There's a few that
929 dnl we don't use, simply because they're too noisy:
931 dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x)
932 dnl -Wredundant-decls (system headers make this too noisy)
933 dnl -Wtraditional (combines too many unrelated messages, only a few useful)
934 dnl -Wwrite-strings (too noisy, but should review occasionally). This
935 dnl is enabled for ncurses using "--enable-const".
939 dnl $1 is an optional list of gcc warning flags that a particular
940 dnl application might want to use, e.g., "no-unused" for
943 dnl If $with_ext_const is "yes", add a check for -Wwrite-strings
945 AC_DEFUN([CF_GCC_WARNINGS],
947 AC_REQUIRE([CF_GCC_VERSION])
948 CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)
950 cat > conftest.$ac_ext <<EOF
951 #line __oline__ "${as_me-configure}"
952 int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
955 if test "$INTEL_COMPILER" = yes
957 # The "-wdXXX" options suppress warnings:
958 # remark #1419: external declaration in primary source file
959 # remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
960 # remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
961 # remark #193: zero used for undefined preprocessing identifier
962 # remark #593: variable "curs_sb_left_arrow" was set but never used
963 # remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
964 # remark #869: parameter "tw" was never referenced
965 # remark #981: operands are evaluated in unspecified order
966 # warning #279: controlling expression is constant
968 AC_CHECKING([for $CC warning options])
969 cf_save_CFLAGS="$CFLAGS"
982 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
983 if AC_TRY_EVAL(ac_compile); then
984 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
985 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
988 CFLAGS="$cf_save_CFLAGS"
990 elif test "$GCC" = yes
992 AC_CHECKING([for $CC warning options])
993 cf_save_CFLAGS="$CFLAGS"
996 test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
997 for cf_opt in W Wall \
1002 Wmissing-declarations \
1003 Wmissing-prototypes \
1007 Wstrict-prototypes \
1008 Wundef $cf_warn_CONST $1
1010 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
1011 if AC_TRY_EVAL(ac_compile); then
1012 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
1013 case $cf_opt in #(vi
1015 CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES"
1018 case $GCC_VERSION in
1020 CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
1025 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
1028 CFLAGS="$cf_save_CFLAGS"
1032 AC_SUBST(EXTRA_CFLAGS)
1034 dnl ---------------------------------------------------------------------------
1035 dnl CF_GNAT_TRY_LINK version: 1 updated: 2004/08/21 19:02:08
1036 dnl ----------------
1037 dnl Verify that a test program compiles/links with GNAT.
1038 dnl $cf_ada_make is set to the program that compiles/links
1039 dnl $ADAFLAGS may be set to the GNAT flags.
1041 dnl $1 is the text of the spec
1042 dnl $2 is the text of the body
1043 dnl $3 is the shell command to execute if successful
1044 dnl $4 is the shell command to execute if not successful
1045 AC_DEFUN([CF_GNAT_TRY_LINK],
1048 cat >>conftest.ads <<CF_EOF
1051 cat >>conftest.adb <<CF_EOF
1054 if ( $cf_ada_make $ADAFLAGS conftest 1>&AC_FD_CC 2>&1 ) ; then
1055 ifelse($3,, :,[ $3])
1061 dnl ---------------------------------------------------------------------------
1062 dnl CF_GNAT_TRY_RUN version: 3 updated: 2004/08/21 19:02:08
1064 dnl Verify that a test program compiles and runs with GNAT
1065 dnl $cf_ada_make is set to the program that compiles/links
1066 dnl $ADAFLAGS may be set to the GNAT flags.
1068 dnl $1 is the text of the spec
1069 dnl $2 is the text of the body
1070 dnl $3 is the shell command to execute if successful
1071 dnl $4 is the shell command to execute if not successful
1072 AC_DEFUN([CF_GNAT_TRY_RUN],
1075 cat >>conftest.ads <<CF_EOF
1078 cat >>conftest.adb <<CF_EOF
1081 if ( $cf_ada_make $ADAFLAGS conftest 1>&AC_FD_CC 2>&1 ) ; then
1082 if ( ./conftest 1>&AC_FD_CC 2>&1 ) ; then
1083 ifelse($3,, :,[ $3])
1092 dnl ---------------------------------------------------------------------------
1093 dnl CF_GNAT_VERSION version: 12 updated: 2006/10/14 15:23:15
1095 dnl Verify version of GNAT.
1096 AC_DEFUN([CF_GNAT_VERSION],
1098 AC_MSG_CHECKING(for gnat version)
1099 cf_gnat_version=`${cf_ada_make-gnatmake} -v 2>&1 | grep '[[0-9]].[[0-9]][[0-9]]*' |\
1100 sed -e '2,$d' -e 's/[[^0-9 \.]]//g' -e 's/^[[ ]]*//' -e 's/ .*//'`
1101 AC_MSG_RESULT($cf_gnat_version)
1103 case $cf_gnat_version in
1104 3.1[[1-9]]*|3.[[2-9]]*|[[4-9]].*)
1105 cf_cv_prog_gnat_correct=yes
1107 *) echo Unsupported GNAT version $cf_gnat_version. Required is 3.11 or better. Disabling Ada95 binding.
1108 cf_cv_prog_gnat_correct=no
1111 case $cf_gnat_version in
1112 3.[[1-9]]*|[[4-9]].*)
1113 cf_compile_generics=generics
1114 cf_generic_objects="\${GENOBJS}"
1116 *) cf_compile_generics=
1121 dnl ---------------------------------------------------------------------------
1122 dnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07
1124 dnl Check if we must define _GNU_SOURCE to get a reasonable value for
1125 dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect
1126 dnl (or misfeature) of glibc2, which breaks portability of many applications,
1127 dnl since it is interwoven with GNU extensions.
1129 dnl Well, yes we could work around it...
1130 AC_DEFUN([CF_GNU_SOURCE],
1132 AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[
1133 AC_TRY_COMPILE([#include <sys/types.h>],[
1134 #ifndef _XOPEN_SOURCE
1137 [cf_cv_gnu_source=no],
1138 [cf_save="$CPPFLAGS"
1139 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
1140 AC_TRY_COMPILE([#include <sys/types.h>],[
1141 #ifdef _XOPEN_SOURCE
1144 [cf_cv_gnu_source=no],
1145 [cf_cv_gnu_source=yes])
1149 test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
1151 dnl ---------------------------------------------------------------------------
1152 dnl CF_HEADER_PATH version: 12 updated: 2010/05/05 05:22:40
1154 dnl Construct a search-list of directories for a nonstandard header-file
1157 dnl $1 = the variable to return as result
1158 dnl $2 = the package name
1159 AC_DEFUN([CF_HEADER_PATH],
1163 # collect the current set of include-directories from compiler flags
1164 cf_header_path_list=""
1165 if test -n "${CFLAGS}${CPPFLAGS}" ; then
1166 for cf_header_path in $CPPFLAGS $CFLAGS
1168 case $cf_header_path in #(vi
1170 cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'`
1171 CF_ADD_SUBDIR_PATH($1,$2,include,$cf_header_path,NONE)
1172 cf_header_path_list="$cf_header_path_list [$]$1"
1178 # add the variations for the package we are looking for
1179 CF_SUBDIR_PATH($1,$2,include)
1181 test "$includedir" != NONE && \
1182 test "$includedir" != "/usr/include" && \
1183 test -d "$includedir" && {
1184 test -d $includedir && $1="[$]$1 $includedir"
1185 test -d $includedir/$2 && $1="[$]$1 $includedir/$2"
1188 test "$oldincludedir" != NONE && \
1189 test "$oldincludedir" != "/usr/include" && \
1190 test -d "$oldincludedir" && {
1191 test -d $oldincludedir && $1="[$]$1 $oldincludedir"
1192 test -d $oldincludedir/$2 && $1="[$]$1 $oldincludedir/$2"
1195 $1="[$]$1 $cf_header_path_list"
1197 dnl ---------------------------------------------------------------------------
1198 dnl CF_HELP_MESSAGE version: 3 updated: 1998/01/14 10:56:23
1200 dnl Insert text into the help-message, for readability, from AC_ARG_WITH.
1201 AC_DEFUN([CF_HELP_MESSAGE],
1202 [AC_DIVERT_HELP([$1])dnl
1204 dnl ---------------------------------------------------------------------------
1205 dnl CF_INCLUDE_DIRS version: 6 updated: 2009/01/06 19:37:40
1207 dnl Construct the list of include-options according to whether we're building
1208 dnl in the source directory or using '--srcdir=DIR' option. If we're building
1209 dnl with gcc, don't append the includedir if it happens to be /usr/include,
1210 dnl since that usually breaks gcc's shadow-includes.
1211 AC_DEFUN([CF_INCLUDE_DIRS],
1213 CPPFLAGS="$CPPFLAGS -I. -I../include"
1214 if test "$srcdir" != "."; then
1215 CPPFLAGS="$CPPFLAGS -I\${srcdir}/../include"
1217 if test "$GCC" != yes; then
1218 CPPFLAGS="$CPPFLAGS -I\${includedir}"
1219 elif test "$includedir" != "/usr/include"; then
1220 if test "$includedir" = '${prefix}/include' ; then
1221 if test $prefix != /usr ; then
1222 CPPFLAGS="$CPPFLAGS -I\${includedir}"
1225 CPPFLAGS="$CPPFLAGS -I\${includedir}"
1230 dnl ---------------------------------------------------------------------------
1231 dnl CF_INTEL_COMPILER version: 4 updated: 2010/05/26 05:38:42
1232 dnl -----------------
1233 dnl Check if the given compiler is really the Intel compiler for Linux. It
1234 dnl tries to imitate gcc, but does not return an error when it finds a mismatch
1235 dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK.
1237 dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
1238 dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from
1239 dnl the wrappers for gcc and g++ warnings.
1241 dnl $1 = GCC (default) or GXX
1242 dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
1243 dnl $3 = CFLAGS (default) or CXXFLAGS
1244 AC_DEFUN([CF_INTEL_COMPILER],[
1245 ifelse([$2],,INTEL_COMPILER,[$2])=no
1247 if test "$ifelse([$1],,[$1],GCC)" = yes ; then
1250 AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler)
1251 cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])"
1252 ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc"
1254 #ifdef __INTEL_COMPILER
1258 ],[ifelse([$2],,INTEL_COMPILER,[$2])=yes
1259 cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc"
1261 ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
1262 AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2]))
1267 dnl ---------------------------------------------------------------------------
1268 dnl CF_LARGEFILE version: 7 updated: 2007/06/02 11:58:50
1270 dnl Add checks for large file support.
1271 AC_DEFUN([CF_LARGEFILE],[
1272 ifdef([AC_FUNC_FSEEKO],[
1274 if test "$enable_largefile" != no ; then
1277 # Normally we would collect these definitions in the config.h,
1278 # but (like _XOPEN_SOURCE), some environments rely on having these
1279 # defined before any of the system headers are included. Another
1280 # case comes up with C++, e.g., on AIX the compiler compiles the
1281 # header files by themselves before looking at the body files it is
1282 # told to compile. For ncurses, those header files do not include
1284 test "$ac_cv_sys_large_files" != no && CPPFLAGS="$CPPFLAGS -D_LARGE_FILES "
1285 test "$ac_cv_sys_largefile_source" != no && CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE "
1286 test "$ac_cv_sys_file_offset_bits" != no && CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits "
1288 AC_CACHE_CHECK(whether to use struct dirent64, cf_cv_struct_dirent64,[
1290 #include <sys/types.h>
1293 /* if transitional largefile support is setup, this is true */
1294 extern struct dirent64 * readdir(DIR *);
1295 struct dirent64 *x = readdir((DIR *)0);
1296 struct dirent *y = readdir((DIR *)0);
1299 [cf_cv_struct_dirent64=yes],
1300 [cf_cv_struct_dirent64=no])
1302 test "$cf_cv_struct_dirent64" = yes && AC_DEFINE(HAVE_STRUCT_DIRENT64)
1306 dnl ---------------------------------------------------------------------------
1307 dnl CF_LD_RPATH_OPT version: 3 updated: 2010/06/02 05:03:05
1309 dnl For the given system and compiler, find the compiler flags to pass to the
1310 dnl loader to use the "rpath" feature.
1311 AC_DEFUN([CF_LD_RPATH_OPT],
1313 AC_REQUIRE([CF_CHECK_CACHE])
1316 AC_MSG_CHECKING(for an rpath option)
1317 case $cf_cv_system_name in #(vi
1319 if test "$GCC" = yes; then
1320 LD_RPATH_OPT="-Wl,-rpath,"
1322 LD_RPATH_OPT="-rpath "
1325 linux*|gnu*|k*bsd*-gnu) #(vi
1326 LD_RPATH_OPT="-Wl,-rpath,"
1328 openbsd[[2-9]].*) #(vi
1329 LD_RPATH_OPT="-Wl,-rpath,"
1332 LD_RPATH_OPT="-rpath "
1335 LD_RPATH_OPT="-Wl,-rpath,"
1338 LD_RPATH_OPT="-rpath "
1346 AC_MSG_RESULT($LD_RPATH_OPT)
1348 case "x$LD_RPATH_OPT" in #(vi
1350 AC_MSG_CHECKING(if we need a space after rpath option)
1351 cf_save_LIBS="$LIBS"
1352 CF_ADD_LIBS(${LD_RPATH_OPT}$libdir)
1353 AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes)
1354 LIBS="$cf_save_LIBS"
1355 AC_MSG_RESULT($cf_rpath_space)
1356 test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT "
1360 dnl ---------------------------------------------------------------------------
1361 dnl CF_LIBRARY_PATH version: 9 updated: 2010/03/28 12:52:50
1363 dnl Construct a search-list of directories for a nonstandard library-file
1366 dnl $1 = the variable to return as result
1367 dnl $2 = the package name
1368 AC_DEFUN([CF_LIBRARY_PATH],
1371 cf_library_path_list=""
1372 if test -n "${LDFLAGS}${LIBS}" ; then
1373 for cf_library_path in $LDFLAGS $LIBS
1375 case $cf_library_path in #(vi
1377 cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'`
1378 CF_ADD_SUBDIR_PATH($1,$2,lib,$cf_library_path,NONE)
1379 cf_library_path_list="$cf_library_path_list [$]$1"
1385 CF_SUBDIR_PATH($1,$2,lib)
1387 $1="$cf_library_path_list [$]$1"
1389 dnl ---------------------------------------------------------------------------
1390 dnl CF_LIB_PREFIX version: 8 updated: 2008/09/13 11:34:16
1392 dnl Compute the library-prefix for the given host system
1393 dnl $1 = variable to set
1394 AC_DEFUN([CF_LIB_PREFIX],
1396 case $cf_cv_system_name in #(vi
1403 ifelse($1,,,[$1=$LIB_PREFIX])
1404 AC_SUBST(LIB_PREFIX)
1406 dnl ---------------------------------------------------------------------------
1407 dnl CF_LIB_SONAME version: 4 updated: 2010/05/29 16:31:02
1409 dnl Find the and soname for the given shared library. Set the cache variable
1410 dnl cf_cv_$3_soname to this, unless it is not found. Then set the cache
1411 dnl variable to "unknown".
1415 dnl $3 = library name
1416 AC_DEFUN([CF_LIB_SONAME],
1418 AC_CACHE_CHECK(for soname of $3 library,cf_cv_$3_soname,[
1420 cf_cv_$3_soname=unknown
1421 if test "$cross_compiling" != yes ; then
1422 cat >conftest.$ac_ext <<CF_EOF
1427 ${cf_cv_main_return:-return}(0);
1430 cf_save_LIBS="$LIBS"
1432 if AC_TRY_EVAL(ac_compile) ; then
1433 if AC_TRY_EVAL(ac_link) ; then
1434 cf_cv_$3_soname=`ldd conftest$ac_exeext 2>/dev/null | sed -e 's,^.*/,,' -e 's, .*$,,' | fgrep lib$3.`
1435 test -z "$cf_cv_$3_soname" && cf_cv_$3_soname=unknown
1439 LIBS="$cf_save_LIBS"
1443 dnl ---------------------------------------------------------------------------
1444 dnl CF_LIB_SUFFIX version: 16 updated: 2008/12/27 12:30:03
1446 dnl Compute the library file-suffix from the given model name
1448 dnl $2 = variable to set (the nominal library suffix)
1449 dnl $3 = dependency variable to set (actual filename)
1450 dnl The variable $LIB_SUFFIX, if set, prepends the variable to set.
1451 AC_DEFUN([CF_LIB_SUFFIX],
1453 AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
1472 case $cf_cv_system_name in
1502 test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}"
1503 test -n "$LIB_SUFFIX" && $3="${LIB_SUFFIX}[$]{$3}"
1505 dnl ---------------------------------------------------------------------------
1506 dnl CF_LIB_TYPE version: 4 updated: 2000/10/20 22:57:49
1508 dnl Compute the string to append to -library from the given model name
1510 dnl $2 = variable to set
1511 dnl The variable $LIB_SUFFIX, if set, prepends the variable to set.
1512 AC_DEFUN([CF_LIB_TYPE],
1521 test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}"
1523 dnl ---------------------------------------------------------------------------
1524 dnl CF_LINK_DATAONLY version: 9 updated: 2009/01/01 20:21:38
1525 dnl ----------------
1526 dnl Some systems have a non-ANSI linker that doesn't pull in modules that have
1527 dnl only data (i.e., no functions), for example NeXT. On those systems we'll
1528 dnl have to provide wrappers for global tables to ensure they're linked
1530 AC_DEFUN([CF_LINK_DATAONLY],
1532 AC_MSG_CHECKING([if data-only library module links])
1533 AC_CACHE_VAL(cf_cv_link_dataonly,[
1535 cat >conftest.$ac_ext <<EOF
1536 #line __oline__ "configure"
1537 int testdata[[3]] = { 123, 456, 789 };
1539 if AC_TRY_EVAL(ac_compile) ; then
1540 mv conftest.o data.o && \
1541 ( $AR $ARFLAGS conftest.a data.o ) 2>&AC_FD_CC 1>/dev/null
1543 rm -f conftest.$ac_ext data.o
1544 cat >conftest.$ac_ext <<EOF
1545 #line __oline__ "configure"
1549 ${cf_cv_main_return:-return}(1); /* I'm told this linker is broken */
1551 extern int testdata[[3]];
1552 return testdata[[0]] == 123
1553 && testdata[[1]] == 456
1554 && testdata[[2]] == 789;
1558 if AC_TRY_EVAL(ac_compile); then
1559 mv conftest.o func.o && \
1560 ( $AR $ARFLAGS conftest.a func.o ) 2>&AC_FD_CC 1>/dev/null
1562 rm -f conftest.$ac_ext func.o
1563 ( eval $RANLIB conftest.a ) 2>&AC_FD_CC >/dev/null
1565 LIBS="conftest.a $LIBS"
1569 extern int testfunc();
1570 ${cf_cv_main_return:-return} (!testfunc());
1573 [cf_cv_link_dataonly=yes],
1574 [cf_cv_link_dataonly=no],
1575 [cf_cv_link_dataonly=unknown])
1578 AC_MSG_RESULT($cf_cv_link_dataonly)
1580 if test "$cf_cv_link_dataonly" = no ; then
1581 AC_DEFINE(BROKEN_LINKER)
1586 dnl ---------------------------------------------------------------------------
1587 dnl CF_LINK_FUNCS version: 7 updated: 2006/12/16 12:33:30
1589 dnl Most Unix systems have both link and symlink, a few don't have symlink.
1590 dnl A few non-Unix systems implement symlink, but not link.
1591 dnl A few non-systems implement neither (or have nonfunctional versions).
1592 AC_DEFUN([CF_LINK_FUNCS],
1598 if test "$cross_compiling" = yes ; then
1603 AC_CACHE_CHECK(if link/symlink functions work,cf_cv_link_funcs,[
1605 for cf_func in link symlink ; do
1607 #include <sys/types.h>
1608 #include <sys/stat.h>
1609 #ifdef HAVE_UNISTD_H
1615 char *src = "config.log";
1616 char *dst = "conftest.chk";
1621 fail = ($cf_func("config.log", "conftest.chk") < 0)
1622 || (stat(dst, &dst_sb) < 0)
1623 || (dst_sb.st_mtime != src_sb.st_mtime);
1629 ${cf_cv_main_return:-return} (fail);
1632 cf_cv_link_funcs="$cf_cv_link_funcs $cf_func"
1633 eval 'ac_cv_func_'$cf_func'=yes'],[
1634 eval 'ac_cv_func_'$cf_func'=no'],[
1635 eval 'ac_cv_func_'$cf_func'=error'])
1637 test -z "$cf_cv_link_funcs" && cf_cv_link_funcs=no
1639 test "$ac_cv_func_link" = yes && AC_DEFINE(HAVE_LINK)
1640 test "$ac_cv_func_symlink" = yes && AC_DEFINE(HAVE_SYMLINK)
1643 dnl ---------------------------------------------------------------------------
1644 dnl CF_MAIN_RETURN version: 1 updated: 2006/12/10 09:51:54
1646 dnl Check if a return from main to the shell actually returns the same exit
1647 dnl code. This is true for almost any POSIX environment.
1649 dnl Some very old environments did not flush stdout, etc., on an exit. That
1650 dnl would be a useful case to test for also.
1651 AC_DEFUN([CF_MAIN_RETURN],
1653 cf_cv_main_return=return
1655 dnl ---------------------------------------------------------------------------
1656 dnl CF_MAKEFLAGS version: 12 updated: 2006/10/21 08:27:03
1658 dnl Some 'make' programs support ${MAKEFLAGS}, some ${MFLAGS}, to pass 'make'
1659 dnl options to lower-levels. It's very useful for "make -n" -- if we have it.
1660 dnl (GNU 'make' does both, something POSIX 'make', which happens to make the
1661 dnl ${MAKEFLAGS} variable incompatible because it adds the assignments :-)
1662 AC_DEFUN([CF_MAKEFLAGS],
1664 AC_CACHE_CHECK(for makeflags variable, cf_cv_makeflags,[
1666 for cf_option in '-${MAKEFLAGS}' '${MFLAGS}'
1668 cat >cf_makeflags.tmp <<CF_EOF
1671 @ echo '.$cf_option'
1673 cf_result=`${MAKE-make} -k -f cf_makeflags.tmp 2>/dev/null | sed -e 's,[[ ]]*$,,'`
1674 case "$cf_result" in
1676 cf_result=`${MAKE-make} -k -f cf_makeflags.tmp CC=cc 2>/dev/null`
1677 case "$cf_result" in
1678 .*CC=*) cf_cv_makeflags=
1680 *) cf_cv_makeflags=$cf_option
1686 *) echo "given option \"$cf_option\", no match \"$cf_result\""
1690 rm -f cf_makeflags.tmp
1693 AC_SUBST(cf_cv_makeflags)
1695 dnl ---------------------------------------------------------------------------
1696 dnl CF_MAKE_TAGS version: 5 updated: 2010/04/03 20:07:32
1698 dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have
1699 dnl a monocase filesystem.
1700 AC_DEFUN([CF_MAKE_TAGS],[
1701 AC_REQUIRE([CF_MIXEDCASE_FILENAMES])
1703 AC_CHECK_PROGS(CTAGS, exctags ctags)
1704 AC_CHECK_PROGS(ETAGS, exetags etags)
1706 AC_CHECK_PROG(MAKE_LOWER_TAGS, ${CTAGS-ctags}, yes, no)
1708 if test "$cf_cv_mixedcase" = yes ; then
1709 AC_CHECK_PROG(MAKE_UPPER_TAGS, ${ETAGS-etags}, yes, no)
1714 if test "$MAKE_UPPER_TAGS" = yes ; then
1720 if test "$MAKE_LOWER_TAGS" = yes ; then
1729 AC_SUBST(MAKE_UPPER_TAGS)
1730 AC_SUBST(MAKE_LOWER_TAGS)
1732 dnl ---------------------------------------------------------------------------
1733 dnl CF_MIXEDCASE_FILENAMES version: 3 updated: 2003/09/20 17:07:55
1734 dnl ----------------------
1735 dnl Check if the file-system supports mixed-case filenames. If we're able to
1736 dnl create a lowercase name and see it as uppercase, it doesn't support that.
1737 AC_DEFUN([CF_MIXEDCASE_FILENAMES],
1739 AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[
1740 if test "$cross_compiling" = yes ; then
1741 case $target_alias in #(vi
1742 *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-mingw32*|*-uwin*) #(vi
1750 rm -f conftest CONFTEST
1752 if test -f CONFTEST ; then
1757 rm -f conftest CONFTEST
1760 test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES)
1762 dnl ---------------------------------------------------------------------------
1763 dnl CF_MKSTEMP version: 6 updated: 2010/05/22 14:44:30
1765 dnl Check for a working mkstemp. This creates two files, checks that they are
1766 dnl successfully created and distinct (AmigaOS apparently fails on the last).
1767 AC_DEFUN([CF_MKSTEMP],[
1768 AC_CACHE_CHECK(for working mkstemp, cf_cv_func_mkstemp,[
1771 #include <sys/types.h>
1775 #include <sys/stat.h>
1778 char *tmpl = "conftestXXXXXX";
1786 for (n = 0; n < 2; ++n) {
1787 strcpy(name[n], tmpl);
1788 if ((fd = mkstemp(name[n])) >= 0) {
1789 if (!strcmp(name[n], tmpl)
1790 || stat(name[n], &sb) != 0
1791 || (sb.st_mode & S_IFMT) != S_IFREG
1792 || (sb.st_mode & 077) != 0) {
1799 && !strcmp(name[0], name[1]))
1801 ${cf_cv_main_return:-return}(result);
1803 ],[cf_cv_func_mkstemp=yes
1804 ],[cf_cv_func_mkstemp=no
1805 ],[AC_CHECK_FUNC(mkstemp)
1808 if test "x$cf_cv_func_mkstemp" = xyes || test "x$ac_cv_func_mkstemp" = xyes ; then
1809 AC_DEFINE(HAVE_MKSTEMP)
1812 dnl ---------------------------------------------------------------------------
1813 dnl CF_MSG_LOG version: 4 updated: 2007/07/29 09:55:12
1815 dnl Write a debug message to config.log, along with the line number in the
1816 dnl configure script.
1817 AC_DEFUN([CF_MSG_LOG],[
1818 echo "${as_me-configure}:__oline__: testing $* ..." 1>&AC_FD_CC
1820 dnl ---------------------------------------------------------------------------
1821 dnl CF_NCURSES_ADDON version: 2 updated: 2010/02/27 18:27:44
1822 dnl ----------------
1823 dnl Configure an ncurses add-on, built outside the ncurses tree.
1824 AC_DEFUN([CF_NCURSES_ADDON],[
1826 AC_PROVIDE([CF_SUBST_NCURSES_VERSION])
1828 AC_MSG_CHECKING(if you want wide-character code)
1829 AC_ARG_ENABLE(widec,
1830 [ --enable-widec compile with wide-char/UTF-8 code],
1831 [with_widec=$enableval],
1833 AC_MSG_RESULT($with_widec)
1834 if test "$with_widec" = yes ; then
1836 CF_NCURSES_CONFIG(ncursesw)
1838 CF_NCURSES_CONFIG(ncurses)
1841 if test "$NCURSES_CONFIG" != none ; then
1843 cf_version=`$NCURSES_CONFIG --version`
1845 NCURSES_MAJOR=`echo "$cf_version" | sed -e 's/\..*//'`
1846 NCURSES_MINOR=`echo "$cf_version" | sed -e 's/^[[0-9]]\+\.//' -e 's/\..*//'`
1847 NCURSES_PATCH=`echo "$cf_version" | sed -e 's/^[[0-9]]\+\.[[0-9]]\+\.//'`
1849 # ABI version is not available from headers
1850 cf_cv_abi_version=`$NCURSES_CONFIG --abi-version`
1854 for cf_name in MAJOR MINOR PATCH
1856 cat >conftest.$ac_ext <<CF_EOF
1857 #include <${cf_cv_ncurses_header-curses.h}>
1858 AUTOCONF_$cf_name NCURSES_VERSION_$cf_name
1860 cf_try="$ac_cpp conftest.$ac_ext 2>&5 | fgrep AUTOCONF_$cf_name >conftest.out"
1862 if test -f conftest.out ; then
1863 cf_result=`cat conftest.out | sed -e "s/^.*AUTOCONF_$cf_name[[ ]]\+//"`
1864 eval NCURSES_$cf_name=$cf_result
1865 cat conftest.$ac_ext
1870 cf_cv_abi_version=${NCURSES_MAJOR}
1874 cf_cv_rel_version=${NCURSES_MAJOR}.${NCURSES_MINOR}
1876 dnl Show the computed version, for logging
1877 cf_cv_timestamp=`date`
1879 AC_MSG_RESULT(Configuring NCURSES $cf_cv_rel_version ABI $cf_cv_abi_version ($cf_cv_timestamp))
1881 dnl We need these values in the generated headers
1882 AC_SUBST(NCURSES_MAJOR)
1883 AC_SUBST(NCURSES_MINOR)
1884 AC_SUBST(NCURSES_PATCH)
1886 dnl We need these values in the generated makefiles
1887 AC_SUBST(cf_cv_rel_version)
1888 AC_SUBST(cf_cv_abi_version)
1890 dnl FIXME - not needed for Ada95
1891 AC_SUBST(cf_cv_builtin_bool)
1892 AC_SUBST(cf_cv_header_stdbool_h)
1893 AC_SUBST(cf_cv_type_of_bool)dnl
1896 dnl ---------------------------------------------------------------------------
1897 dnl CF_NCURSES_CC_CHECK version: 4 updated: 2007/07/29 10:39:05
1898 dnl -------------------
1899 dnl Check if we can compile with ncurses' header file
1900 dnl $1 is the cache variable to set
1901 dnl $2 is the header-file to include
1902 dnl $3 is the root name (ncurses or ncursesw)
1903 AC_DEFUN([CF_NCURSES_CC_CHECK],[
1905 ]ifelse($3,ncursesw,[
1906 #define _XOPEN_SOURCE_EXTENDED
1907 #undef HAVE_LIBUTF8_H /* in case we used CF_UTF8_LIB */
1908 #define HAVE_LIBUTF8_H /* to force ncurses' header file to use cchar_t */
1911 #ifdef NCURSES_VERSION
1912 ]ifelse($3,ncursesw,[
1917 printf("%s\n", NCURSES_VERSION);
1929 dnl ---------------------------------------------------------------------------
1930 dnl CF_NCURSES_CONFIG version: 6 updated: 2010/04/28 06:02:16
1931 dnl -----------------
1932 dnl Tie together the configure-script macros for ncurses.
1933 dnl Prefer the "-config" script from ncurses 5.6, to simplify analysis.
1934 dnl Allow that to be overridden using the $NCURSES_CONFIG environment variable.
1936 dnl $1 is the root library name (default: "ncurses")
1937 AC_DEFUN([CF_NCURSES_CONFIG],
1939 cf_ncuconfig_root=ifelse($1,,ncurses,$1)
1941 echo "Looking for ${cf_ncuconfig_root}-config"
1942 AC_PATH_PROGS(NCURSES_CONFIG,${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config,none)
1944 if test "$NCURSES_CONFIG" != none ; then
1946 CPPFLAGS="$CPPFLAGS `$NCURSES_CONFIG --cflags`"
1947 LIBS="`$NCURSES_CONFIG --libs` $LIBS"
1949 # even with config script, some packages use no-override for curses.h
1950 CF_CURSES_HEADER(ifelse($1,,ncurses,$1))
1952 dnl like CF_NCURSES_CPPFLAGS
1955 dnl like CF_NCURSES_LIBS
1956 CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_ncuconfig_root)
1957 AC_DEFINE_UNQUOTED($cf_nculib_ROOT)
1959 dnl like CF_NCURSES_VERSION
1960 cf_cv_ncurses_version=`$NCURSES_CONFIG --version`
1964 CF_NCURSES_CPPFLAGS(ifelse($1,,ncurses,$1))
1965 CF_NCURSES_LIBS(ifelse($1,,ncurses,$1))
1969 dnl ---------------------------------------------------------------------------
1970 dnl CF_NCURSES_CPPFLAGS version: 19 updated: 2007/07/29 13:35:20
1971 dnl -------------------
1972 dnl Look for the SVr4 curses clone 'ncurses' in the standard places, adjusting
1973 dnl the CPPFLAGS variable so we can include its header.
1975 dnl The header files may be installed as either curses.h, or ncurses.h (would
1976 dnl be obsolete, except that some packagers prefer this name to distinguish it
1977 dnl from a "native" curses implementation). If not installed for overwrite,
1978 dnl the curses.h file would be in an ncurses subdirectory (e.g.,
1979 dnl /usr/include/ncurses), but someone may have installed overwriting the
1980 dnl vendor's curses. Only very old versions (pre-1.9.2d, the first autoconf'd
1981 dnl version) of ncurses don't define either __NCURSES_H or NCURSES_VERSION in
1984 dnl If the installer has set $CFLAGS or $CPPFLAGS so that the ncurses header
1985 dnl is already in the include-path, don't even bother with this, since we cannot
1986 dnl easily determine which file it is. In this case, it has to be <curses.h>.
1988 dnl The optional parameter gives the root name of the library, in case it is
1989 dnl not installed as the default curses library. That is how the
1990 dnl wide-character version of ncurses is installed.
1991 AC_DEFUN([CF_NCURSES_CPPFLAGS],
1992 [AC_REQUIRE([CF_WITH_CURSES_DIR])
1994 AC_PROVIDE([CF_CURSES_CPPFLAGS])dnl
1995 cf_ncuhdr_root=ifelse($1,,ncurses,$1)
1997 test -n "$cf_cv_curses_dir" && \
1998 test "$cf_cv_curses_dir" != "no" && { \
1999 CF_ADD_INCDIR($cf_cv_curses_dir/include $cf_cv_curses_dir/include/$cf_ncuhdr_root)
2002 AC_CACHE_CHECK(for $cf_ncuhdr_root header in include-path, cf_cv_ncurses_h,[
2003 cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h"
2004 ( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h"
2005 for cf_header in $cf_header_list
2007 CF_NCURSES_CC_CHECK(cf_cv_ncurses_h,$cf_header,$1)
2008 test "$cf_cv_ncurses_h" != no && break
2015 # some applications need this, but should check for NCURSES_VERSION
2020 dnl ---------------------------------------------------------------------------
2021 dnl CF_NCURSES_HEADER version: 2 updated: 2008/03/23 14:48:54
2022 dnl -----------------
2023 dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
2024 dnl variations of ncurses' installs.
2026 dnl See also CF_CURSES_HEADER, which sets the same cache variable.
2027 AC_DEFUN([CF_NCURSES_HEADER],[
2029 if test "$cf_cv_ncurses_h" != no ; then
2030 cf_cv_ncurses_header=$cf_cv_ncurses_h
2033 AC_CACHE_CHECK(for $cf_ncuhdr_root include-path, cf_cv_ncurses_h2,[
2034 test -n "$verbose" && echo
2035 CF_HEADER_PATH(cf_search,$cf_ncuhdr_root)
2036 test -n "$verbose" && echo search path $cf_search
2037 cf_save2_CPPFLAGS="$CPPFLAGS"
2038 for cf_incdir in $cf_search
2040 CF_ADD_INCDIR($cf_incdir)
2045 CF_NCURSES_CC_CHECK(cf_cv_ncurses_h2,$cf_header,$1)
2046 if test "$cf_cv_ncurses_h2" != no ; then
2047 cf_cv_ncurses_h2=$cf_incdir/$cf_header
2048 test -n "$verbose" && echo $ac_n " ... found $ac_c" 1>&AC_FD_MSG
2051 test -n "$verbose" && echo " ... tested $cf_incdir/$cf_header" 1>&AC_FD_MSG
2053 CPPFLAGS="$cf_save2_CPPFLAGS"
2054 test "$cf_cv_ncurses_h2" != no && break
2056 test "$cf_cv_ncurses_h2" = no && AC_MSG_ERROR(not found)
2059 CF_DIRNAME(cf_1st_incdir,$cf_cv_ncurses_h2)
2060 cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2`
2061 if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then
2062 cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header
2064 CF_ADD_INCDIR($cf_1st_incdir)
2068 # Set definitions to allow ifdef'ing for ncurses.h
2070 case $cf_cv_ncurses_header in # (vi
2072 AC_DEFINE(HAVE_NCURSES_H)
2076 case $cf_cv_ncurses_header in # (vi
2077 ncurses/curses.h|ncurses/ncurses.h)
2078 AC_DEFINE(HAVE_NCURSES_NCURSES_H)
2080 ncursesw/curses.h|ncursesw/ncurses.h)
2081 AC_DEFINE(HAVE_NCURSESW_NCURSES_H)
2086 dnl ---------------------------------------------------------------------------
2087 dnl CF_NCURSES_LIBS version: 13 updated: 2007/07/29 10:29:20
2089 dnl Look for the ncurses library. This is a little complicated on Linux,
2090 dnl because it may be linked with the gpm (general purpose mouse) library.
2091 dnl Some distributions have gpm linked with (bsd) curses, which makes it
2092 dnl unusable with ncurses. However, we don't want to link with gpm unless
2093 dnl ncurses has a dependency, since gpm is normally set up as a shared library,
2094 dnl and the linker will record a dependency.
2096 dnl The optional parameter gives the root name of the library, in case it is
2097 dnl not installed as the default curses library. That is how the
2098 dnl wide-character version of ncurses is installed.
2099 AC_DEFUN([CF_NCURSES_LIBS],
2100 [AC_REQUIRE([CF_NCURSES_CPPFLAGS])
2102 cf_nculib_root=ifelse($1,,ncurses,$1)
2103 # This works, except for the special case where we find gpm, but
2104 # ncurses is in a nonstandard location via $LIBS, and we really want
2107 cf_ncurses_SAVE="$LIBS"
2108 AC_CHECK_LIB(gpm,Gpm_Open,
2109 [AC_CHECK_LIB(gpm,initscr,
2110 [LIBS="$cf_ncurses_SAVE"],
2111 [cf_ncurses_LIBS="-lgpm"])])
2113 case $host_os in #(vi
2115 # This is only necessary if you are linking against an obsolete
2116 # version of ncurses (but it should do no harm, since it's static).
2117 if test "$cf_nculib_root" = ncurses ; then
2118 AC_CHECK_LIB(mytinfo,tgoto,[cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS"])
2123 LIBS="$cf_ncurses_LIBS $LIBS"
2125 if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
2127 CF_ADD_LIBDIR($cf_cv_curses_dir/lib)
2128 LIBS="-l$cf_nculib_root $LIBS"
2130 CF_FIND_LIBRARY($cf_nculib_root,$cf_nculib_root,
2131 [#include <${cf_cv_ncurses_header-curses.h}>],
2136 if test -n "$cf_ncurses_LIBS" ; then
2137 AC_MSG_CHECKING(if we can link $cf_nculib_root without $cf_ncurses_LIBS)
2138 cf_ncurses_SAVE="$LIBS"
2139 for p in $cf_ncurses_LIBS ; do
2140 q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"`
2141 if test "$q" != "$LIBS" ; then
2145 AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
2146 [initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);],
2147 [AC_MSG_RESULT(yes)],
2149 LIBS="$cf_ncurses_SAVE"])
2152 CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_nculib_root)
2153 AC_DEFINE_UNQUOTED($cf_nculib_ROOT)
2155 dnl ---------------------------------------------------------------------------
2156 dnl CF_NCURSES_VERSION version: 12 updated: 2007/04/28 09:15:55
2157 dnl ------------------
2158 dnl Check for the version of ncurses, to aid in reporting bugs, etc.
2159 dnl Call CF_CURSES_CPPFLAGS first, or CF_NCURSES_CPPFLAGS. We don't use
2160 dnl AC_REQUIRE since that does not work with the shell's if/then/else/fi.
2161 AC_DEFUN([CF_NCURSES_VERSION],
2163 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
2164 AC_CACHE_CHECK(for ncurses version, cf_cv_ncurses_version,[
2165 cf_cv_ncurses_version=no
2169 #include <${cf_cv_ncurses_header-curses.h}>
2173 FILE *fp = fopen("$cf_tempfile", "w");
2174 #ifdef NCURSES_VERSION
2175 # ifdef NCURSES_VERSION_PATCH
2176 fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH);
2178 fprintf(fp, "%s\n", NCURSES_VERSION);
2182 fprintf(fp, "old\n");
2187 ${cf_cv_main_return-return}(0);
2189 cf_cv_ncurses_version=`cat $cf_tempfile`],,[
2191 # This will not work if the preprocessor splits the line after the
2192 # Autoconf token. The 'unproto' program does that.
2193 cat > conftest.$ac_ext <<EOF
2194 #include <${cf_cv_ncurses_header-curses.h}>
2196 #ifdef NCURSES_VERSION
2197 Autoconf NCURSES_VERSION
2205 cf_try="$ac_cpp conftest.$ac_ext 2>&AC_FD_CC | grep '^Autoconf ' >conftest.out"
2207 if test -f conftest.out ; then
2208 cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[[^"]]*"%%' -e 's%".*%%'`
2209 test -n "$cf_out" && cf_cv_ncurses_version="$cf_out"
2215 test "$cf_cv_ncurses_version" = no || AC_DEFINE(NCURSES)
2217 dnl ---------------------------------------------------------------------------
2218 dnl CF_NO_LEAKS_OPTION version: 4 updated: 2006/12/16 14:24:05
2219 dnl ------------------
2220 dnl see CF_WITH_NO_LEAKS
2221 AC_DEFUN([CF_NO_LEAKS_OPTION],[
2222 AC_MSG_CHECKING(if you want to use $1 for testing)
2225 [AC_DEFINE($3)ifelse([$4],,[
2228 : ${with_cflags:=-g}
2229 : ${with_no_leaks:=yes}
2232 AC_MSG_RESULT(${with_$1:-no})
2234 case .$with_cflags in #(vi
2236 case .$CFLAGS in #(vi
2246 dnl ---------------------------------------------------------------------------
2247 dnl CF_NUMBER_SYNTAX version: 1 updated: 2003/09/20 18:12:49
2248 dnl ----------------
2249 dnl Check if the given variable is a number. If not, report an error.
2250 dnl $1 is the variable
2251 dnl $2 is the message
2252 AC_DEFUN([CF_NUMBER_SYNTAX],[
2253 if test -n "$1" ; then
2258 AC_MSG_ERROR($2 is not a number: $1)
2262 AC_MSG_ERROR($2 value is empty)
2265 dnl ---------------------------------------------------------------------------
2266 dnl CF_OBJ_SUBDIR version: 4 updated: 2002/02/23 20:38:31
2268 dnl Compute the object-directory name from the given model name
2269 AC_DEFUN([CF_OBJ_SUBDIR],
2272 libtool) $2='obj_lo' ;;
2273 normal) $2='objects' ;;
2274 debug) $2='obj_g' ;;
2275 profile) $2='obj_p' ;;
2277 case $cf_cv_system_name in #(vi
2285 dnl ---------------------------------------------------------------------------
2286 dnl CF_PATHSEP version: 5 updated: 2010/05/26 05:38:42
2288 dnl Provide a value for the $PATH and similar separator
2289 AC_DEFUN([CF_PATHSEP],
2291 case $cf_cv_system_name in
2292 os2*) PATH_SEPARATOR=';' ;;
2293 *) PATH_SEPARATOR=':' ;;
2295 ifelse([$1],,,[$1=$PATH_SEPARATOR])
2296 AC_SUBST(PATH_SEPARATOR)
2298 dnl ---------------------------------------------------------------------------
2299 dnl CF_PATH_SYNTAX version: 13 updated: 2010/05/26 05:38:42
2301 dnl Check the argument to see that it looks like a pathname. Rewrite it if it
2302 dnl begins with one of the prefix/exec_prefix variables, and then again if the
2303 dnl result begins with 'NONE'. This is necessary to work around autoconf's
2304 dnl delayed evaluation of those symbols.
2305 AC_DEFUN([CF_PATH_SYNTAX],[
2306 if test "x$prefix" != xNONE; then
2307 cf_path_syntax="$prefix"
2309 cf_path_syntax="$ac_default_prefix"
2312 case ".[$]$1" in #(vi
2313 .\[$]\(*\)*|.\'*\'*) #(vi
2317 .[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX
2319 .\[$]{*prefix}*) #(vi
2321 case ".[$]$1" in #(vi
2323 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
2328 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
2331 ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2)
2335 dnl ---------------------------------------------------------------------------
2336 dnl CF_PKG_CONFIG version: 3 updated: 2009/01/25 10:55:09
2338 dnl Check for the package-config program, unless disabled by command-line.
2339 AC_DEFUN([CF_PKG_CONFIG],
2341 AC_MSG_CHECKING(if you want to use pkg-config)
2342 AC_ARG_WITH(pkg-config,
2343 [ --with-pkg-config{=path} enable/disable use of pkg-config],
2344 [cf_pkg_config=$withval],
2345 [cf_pkg_config=yes])
2346 AC_MSG_RESULT($cf_pkg_config)
2348 case $cf_pkg_config in #(vi
2353 AC_PATH_PROG(PKG_CONFIG, pkg-config, none)
2360 test -z "$PKG_CONFIG" && PKG_CONFIG=none
2361 if test "$PKG_CONFIG" != none ; then
2362 CF_PATH_SYNTAX(PKG_CONFIG)
2365 AC_SUBST(PKG_CONFIG)
2367 dnl ---------------------------------------------------------------------------
2368 dnl CF_POSIX_C_SOURCE version: 8 updated: 2010/05/26 05:38:42
2369 dnl -----------------
2370 dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed.
2372 dnl POSIX.1-1990 _POSIX_SOURCE
2373 dnl POSIX.1-1990 and _POSIX_SOURCE and
2374 dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2
2376 dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L
2377 dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L
2378 dnl X/Open 2000 _POSIX_C_SOURCE=200112L
2381 dnl $1 is the nominal value for _POSIX_C_SOURCE
2382 AC_DEFUN([CF_POSIX_C_SOURCE],
2384 cf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1])
2386 cf_save_CFLAGS="$CFLAGS"
2387 cf_save_CPPFLAGS="$CPPFLAGS"
2389 CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE)
2390 CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE)
2392 AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[
2393 CF_MSG_LOG(if the symbol is already defined go no further)
2394 AC_TRY_COMPILE([#include <sys/types.h>],[
2395 #ifndef _POSIX_C_SOURCE
2398 [cf_cv_posix_c_source=no],
2399 [cf_want_posix_source=no
2400 case .$cf_POSIX_C_SOURCE in #(vi
2402 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
2405 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
2406 cf_want_posix_source=yes
2409 cf_want_posix_source=yes
2412 if test "$cf_want_posix_source" = yes ; then
2413 AC_TRY_COMPILE([#include <sys/types.h>],[
2414 #ifdef _POSIX_SOURCE
2417 cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE")
2419 CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE)
2420 CFLAGS="$cf_trim_CFLAGS"
2421 CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source"
2422 CF_MSG_LOG(if the second compile does not leave our definition intact error)
2423 AC_TRY_COMPILE([#include <sys/types.h>],[
2424 #ifndef _POSIX_C_SOURCE
2427 [cf_cv_posix_c_source=no])
2428 CFLAGS="$cf_save_CFLAGS"
2429 CPPFLAGS="$cf_save_CPPFLAGS"
2433 if test "$cf_cv_posix_c_source" != no ; then
2434 CFLAGS="$cf_trim_CFLAGS"
2435 CPPFLAGS="$cf_trim_CPPFLAGS"
2436 CF_ADD_CFLAGS($cf_cv_posix_c_source)
2440 dnl ---------------------------------------------------------------------------
2441 dnl CF_PROG_AR version: 1 updated: 2009/01/01 20:15:22
2443 dnl Check for archiver "ar".
2444 AC_DEFUN([CF_PROG_AR],[
2445 AC_CHECK_TOOL(AR, ar, ar)
2447 dnl ---------------------------------------------------------------------------
2448 dnl CF_PROG_AWK version: 1 updated: 2006/09/16 11:40:59
2450 dnl Check for awk, ensure that the check found something.
2451 AC_DEFUN([CF_PROG_AWK],
2454 test -z "$AWK" && AC_MSG_ERROR(No awk program found)
2456 dnl ---------------------------------------------------------------------------
2457 dnl CF_PROG_CC_C_O version: 2 updated: 2006/12/16 15:55:46
2459 dnl Analogous to AC_PROG_CC_C_O, but more useful: tests only $CC, ensures that
2460 dnl the output file can be renamed, and allows for a shell variable that can
2461 dnl be used later. The parameter is either CC or CXX. The result is the
2463 dnl $cf_cv_prog_CC_c_o
2464 dnl $cf_cv_prog_CXX_c_o
2465 AC_DEFUN([CF_PROG_CC_C_O],
2466 [AC_REQUIRE([AC_PROG_CC])dnl
2467 AC_MSG_CHECKING([whether [$]$1 understands -c and -o together])
2468 AC_CACHE_VAL(cf_cv_prog_$1_c_o,
2470 cat > conftest.$ac_ext <<CF_EOF
2474 ${cf_cv_main_return:-return}(0);
2477 # We do the test twice because some compilers refuse to overwrite an
2478 # existing .o file with -o, though they will create one.
2479 ac_try='[$]$1 -c conftest.$ac_ext -o conftest2.$ac_objext >&AC_FD_CC'
2480 if AC_TRY_EVAL(ac_try) &&
2481 test -f conftest2.$ac_objext && AC_TRY_EVAL(ac_try);
2483 eval cf_cv_prog_$1_c_o=yes
2485 eval cf_cv_prog_$1_c_o=no
2489 if test $cf_cv_prog_$1_c_o = yes; then
2490 AC_MSG_RESULT([yes])
2495 dnl ---------------------------------------------------------------------------
2496 dnl CF_PROG_EGREP version: 1 updated: 2006/09/16 11:40:59
2498 dnl AC_PROG_EGREP was introduced in autoconf 2.53.
2499 dnl This macro adds a check to ensure the script found something.
2500 AC_DEFUN([CF_PROG_EGREP],
2501 [AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep],
2502 [if echo a | (grep -E '(a|b)') >/dev/null 2>&1
2503 then ac_cv_prog_egrep='grep -E'
2504 else ac_cv_prog_egrep='egrep'
2506 EGREP=$ac_cv_prog_egrep
2508 test -z "$EGREP" && AC_MSG_ERROR(No egrep program found)
2510 dnl ---------------------------------------------------------------------------
2511 dnl CF_PROG_EXT version: 10 updated: 2004/01/03 19:28:18
2513 dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX.
2514 AC_DEFUN([CF_PROG_EXT],
2516 AC_REQUIRE([CF_CHECK_CACHE])
2517 case $cf_cv_system_name in
2519 CFLAGS="$CFLAGS -Zmt"
2520 CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__"
2521 CXXFLAGS="$CXXFLAGS -Zmt"
2522 # autoconf's macro sets -Zexe and suffix both, which conflict:w
2523 LDFLAGS="$LDFLAGS -Zmt -Zcrtdll"
2533 test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT")
2535 dnl ---------------------------------------------------------------------------
2536 dnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50
2537 dnl ----------------
2538 dnl Remove all -U and -D options that refer to the given symbol from a list
2539 dnl of C compiler options. This works around the problem that not all
2540 dnl compilers process -U and -D options from left-to-right, so a -U option
2541 dnl cannot be used to cancel the effect of a preceding -D option.
2543 dnl $1 = target (which could be the same as the source variable)
2544 dnl $2 = source (including '$')
2545 dnl $3 = symbol to remove
2546 define([CF_REMOVE_DEFINE],
2549 sed -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[[ ]]/ /g' \
2550 -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'`
2552 dnl ---------------------------------------------------------------------------
2553 dnl CF_REMOVE_LIB version: 1 updated: 2007/02/17 14:11:52
2555 dnl Remove the given library from the symbol
2557 dnl $1 = target (which could be the same as the source variable)
2558 dnl $2 = source (including '$')
2559 dnl $3 = library to remove
2560 define([CF_REMOVE_LIB],
2562 # remove $3 library from $2
2563 $1=`echo "$2" | sed -e 's/-l$3[[ ]]//g' -e 's/-l$3[$]//'`
2565 dnl ---------------------------------------------------------------------------
2566 dnl CF_SHARED_OPTS version: 64 updated: 2010/06/05 16:51:16
2569 dnl Attempt to determine the appropriate CC/LD options for creating a shared
2572 dnl Note: ${LOCAL_LDFLAGS} is used to link executables that will run within the
2573 dnl build-tree, i.e., by making use of the libraries that are compiled in ../lib
2574 dnl We avoid compiling-in a ../lib path for the shared library since that can
2575 dnl lead to unexpected results at runtime.
2576 dnl ${LOCAL_LDFLAGS2} has the same intention but assumes that the shared libraries
2577 dnl are compiled in ../../lib
2579 dnl The variable 'cf_cv_do_symlinks' is used to control whether we configure
2580 dnl to install symbolic links to the rel/abi versions of shared libraries.
2582 dnl The variable 'cf_cv_shlib_version' controls whether we use the rel or abi
2583 dnl version when making symbolic links.
2585 dnl The variable 'cf_cv_shlib_version_infix' controls whether shared library
2586 dnl version numbers are infix (ex: libncurses.<ver>.dylib) or postfix
2587 dnl (ex: libncurses.so.<ver>).
2589 dnl Some loaders leave 'so_locations' lying around. It's nice to clean up.
2590 AC_DEFUN([CF_SHARED_OPTS],
2592 AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
2593 AC_REQUIRE([CF_LD_RPATH_OPT])
2597 INSTALL_LIB="-m 644"
2599 cf_cv_do_symlinks=no
2601 test "$cf_cv_enable_rpath" = yes && cf_ld_rpath_opt="$LD_RPATH_OPT"
2603 AC_MSG_CHECKING(if release/abi version should be used for shared libs)
2604 AC_ARG_WITH(shlib-version,
2605 [ --with-shlib-version=X Specify rel or abi version for shared libs],
2606 [test -z "$withval" && withval=auto
2607 case $withval in #(vi
2609 cf_cv_shlib_version=auto
2611 rel|abi|auto|no) #(vi
2612 cf_cv_shlib_version=$withval
2615 AC_MSG_ERROR([option value must be one of: rel, abi, auto or no])
2618 ],[cf_cv_shlib_version=auto])
2619 AC_MSG_RESULT($cf_cv_shlib_version)
2623 # Some less-capable ports of gcc support only -fpic
2625 if test "$GCC" = yes
2627 AC_MSG_CHECKING(which $CC option to use)
2628 cf_save_CFLAGS="$CFLAGS"
2629 for CC_SHARED_OPTS in -fPIC -fpic ''
2631 CFLAGS="$cf_save_CFLAGS $CC_SHARED_OPTS"
2632 AC_TRY_COMPILE([#include <stdio.h>],[int x = 1],[break],[])
2634 AC_MSG_RESULT($CC_SHARED_OPTS)
2635 CFLAGS="$cf_save_CFLAGS"
2638 cf_cv_shlib_version_infix=no
2640 case $cf_cv_system_name in #(vi
2642 if test "$GCC" = yes; then
2644 MK_SHARED_LIB='$(CC) -shared'
2648 MK_SHARED_LIB='${CC} ${CFLAGS} -o $[@] -Xlinker -soname=`basename $[@]` -nostart -e 0'
2652 MK_SHARED_LIB='sh ../mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}'
2653 cf_cv_shlib_version=cygdll
2654 cf_cv_shlib_version_infix=cygdll
2655 cat >mk_shared_lib.sh <<-CF_EOF
2658 IMPORT_LIB=\`echo "\[$]1" | sed -e 's/cyg/lib/' -e 's/[[0-9]]*\.dll[$]/.dll.a/'\`
2661 Linking shared library
2662 ** SHARED_LIB \[$]SHARED_LIB
2663 ** IMPORT_LIB \[$]IMPORT_LIB
2665 exec \[$]* -shared -Wl,--out-implib=../lib/\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o ../lib/\[$]{SHARED_LIB}
2667 chmod +x mk_shared_lib.sh
2670 EXTRA_CFLAGS="-no-cpp-precomp"
2671 CC_SHARED_OPTS="-dynamic"
2672 MK_SHARED_LIB='${CC} ${CFLAGS} -dynamiclib -install_name ${libdir}/`basename $[@]` -compatibility_version ${ABI_VERSION} -current_version ${ABI_VERSION} -o $[@]'
2673 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=abi
2674 cf_cv_shlib_version_infix=yes
2675 AC_CACHE_CHECK([if ld -search_paths_first works], cf_cv_ldflags_search_paths_first, [
2676 cf_save_LDFLAGS=$LDFLAGS
2677 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
2678 AC_TRY_LINK(, [int i;], cf_cv_ldflags_search_paths_first=yes, cf_cv_ldflags_search_paths_first=no)
2679 LDFLAGS=$cf_save_LDFLAGS])
2680 if test $cf_cv_ldflags_search_paths_first = yes; then
2681 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
2685 # (tested with gcc 2.7.2 -- I don't have c89)
2686 if test "$GCC" = yes; then
2687 LD_SHARED_OPTS='-Xlinker +b -Xlinker ${libdir}'
2690 LD_SHARED_OPTS='-Wl,+b,${libdir}'
2692 MK_SHARED_LIB='${LD} +b ${libdir} -b -o $[@]'
2693 # HP-UX shared libraries must be executable, and should be
2694 # readonly to exploit a quirk in the memory manager.
2695 INSTALL_LIB="-m 555"
2698 if test "$cf_cv_enable_rpath" = yes ; then
2699 EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
2701 # tested with IRIX 5.2 and 'cc'.
2702 if test "$GCC" != yes; then
2703 CC_SHARED_OPTS='-KPIC'
2704 MK_SHARED_LIB='${CC} -shared -rdata_shared -soname `basename $[@]` -o $[@]'
2706 MK_SHARED_LIB='${CC} -shared -Wl,-soname,`basename $[@]` -o $[@]'
2708 cf_cv_rm_so_locs=yes
2710 linux*|gnu*|k*bsd*-gnu) #(vi
2711 if test "$DFT_LWR_MODEL" = "shared" ; then
2712 LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)"
2713 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
2715 if test "$cf_cv_enable_rpath" = yes ; then
2716 EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
2719 MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]'
2721 openbsd[[2-9]].*) #(vi
2722 if test "$DFT_LWR_MODEL" = "shared" ; then
2723 LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)"
2724 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
2726 if test "$cf_cv_enable_rpath" = yes ; then
2727 EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
2729 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
2731 MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-Bshareable,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]'
2733 nto-qnx*|openbsd*|freebsd[[12]].*) #(vi
2734 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
2735 MK_SHARED_LIB='${LD} -Bshareable -o $[@]'
2736 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
2739 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
2740 if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then
2741 LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)"
2742 LOCAL_LDFLAGS2="${cf_ld_rpath_opt}\${libdir} $LOCAL_LDFLAGS"
2743 EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
2746 MK_SHARED_LIB='${LD} -shared -Bshareable -soname=`basename $[@]` -o $[@]'
2749 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
2750 if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then
2751 LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)"
2752 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
2753 EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
2754 if test "$cf_cv_shlib_version" = auto; then
2755 if test -f /usr/libexec/ld.elf_so; then
2756 cf_cv_shlib_version=abi
2758 cf_cv_shlib_version=rel
2762 MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname' -o $[@]'
2764 MK_SHARED_LIB='${LD} -shared -Bshareable -o $[@]'
2768 # tested with OSF/1 V3.2 and 'cc'
2769 # tested with OSF/1 V3.2 and gcc 2.6.3 (but the c++ demo didn't
2770 # link with shared libs).
2771 MK_SHARED_LIB='${LD} -set_version ${REL_VERSION}:${ABI_VERSION} -expect_unresolved "*" -shared -soname `basename $[@]`'
2772 case $host_os in #(vi
2774 MK_SHARED_LIB="${MK_SHARED_LIB} -msym"
2777 MK_SHARED_LIB="${MK_SHARED_LIB}"' -o $[@]'
2778 if test "$DFT_LWR_MODEL" = "shared" ; then
2779 LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)"
2780 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
2782 cf_cv_rm_so_locs=yes
2784 sco3.2v5*) # (also uw2* and UW7: hops 13-Apr-98
2785 # tested with osr5.0.5
2786 if test "$GCC" != yes; then
2787 CC_SHARED_OPTS='-belf -KPIC'
2789 MK_SHARED_LIB='${LD} -dy -G -h `basename $[@] .${REL_VERSION}`.${ABI_VERSION} -o [$]@'
2790 if test "$cf_cv_enable_rpath" = yes ; then
2791 # only way is to set LD_RUN_PATH but no switch for it
2794 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
2795 LINK_PROGS='LD_RUN_PATH=${libdir}'
2796 LINK_TESTS='Pwd=`pwd`;LD_RUN_PATH=`dirname $${Pwd}`/lib'
2799 # tested with SunOS 4.1.1 and gcc 2.7.0
2800 if test "$GCC" != yes; then
2801 CC_SHARED_OPTS='-KPIC'
2803 MK_SHARED_LIB='${LD} -assert pure-text -o $[@]'
2804 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
2807 # tested with SunOS 5.5.1 (solaris 2.5.1) and gcc 2.7.2
2808 # tested with SunOS 5.10 (solaris 10) and gcc 3.4.3
2809 if test "$DFT_LWR_MODEL" = "shared" ; then
2810 LOCAL_LDFLAGS="-R \$(LOCAL_LIBDIR):\${libdir}"
2811 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
2813 if test "$cf_cv_enable_rpath" = yes ; then
2814 EXTRA_LDFLAGS="-R \${libdir} $EXTRA_LDFLAGS"
2817 if test "$GCC" != yes; then
2818 cf_save_CFLAGS="$CFLAGS"
2819 for cf_shared_opts in -xcode=pic32 -xcode=pic13 -KPIC -Kpic -O
2821 CFLAGS="$cf_shared_opts $cf_save_CFLAGS"
2822 AC_TRY_COMPILE([#include <stdio.h>],[printf("Hello\n");],[break])
2824 CFLAGS="$cf_save_CFLAGS"
2825 CC_SHARED_OPTS=$cf_shared_opts
2826 MK_SHARED_LIB='${CC} -dy -G -h '$cf_cv_shared_soname' -o $[@]'
2828 MK_SHARED_LIB='${CC} -shared -dy -G -h '$cf_cv_shared_soname' -o $[@]'
2831 sysv5uw7*|unix_sv*) #(vi
2832 # tested with UnixWare 7.1.0 (gcc 2.95.2 and cc)
2833 if test "$GCC" != yes; then
2834 CC_SHARED_OPTS='-KPIC'
2836 MK_SHARED_LIB='${LD} -d y -G -o [$]@'
2839 CC_SHARED_OPTS='unknown'
2840 MK_SHARED_LIB='echo unknown'
2844 # This works if the last tokens in $MK_SHARED_LIB are the -o target.
2845 case "$cf_cv_shlib_version" in #(vi
2847 case "$MK_SHARED_LIB" in #(vi
2849 test "$cf_cv_do_symlinks" = no && cf_cv_do_symlinks=yes
2852 AC_MSG_WARN(ignored --with-shlib-version)
2858 if test -n "$cf_ld_rpath_opt" ; then
2859 MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\${libdir}"
2862 AC_SUBST(CC_SHARED_OPTS)
2863 AC_SUBST(LD_RPATH_OPT)
2864 AC_SUBST(LD_SHARED_OPTS)
2865 AC_SUBST(MK_SHARED_LIB)
2866 AC_SUBST(LINK_PROGS)
2867 AC_SUBST(LINK_TESTS)
2868 AC_SUBST(EXTRA_LDFLAGS)
2869 AC_SUBST(LOCAL_LDFLAGS)
2870 AC_SUBST(LOCAL_LDFLAGS2)
2871 AC_SUBST(INSTALL_LIB)
2873 dnl ---------------------------------------------------------------------------
2874 dnl CF_SHARED_SONAME version: 3 updated: 2008/09/08 18:34:43
2875 dnl ----------------
2876 dnl utility macro for CF_SHARED_OPTS, constructs "$cf_cv_shared_soname" for
2877 dnl substitution into MK_SHARED_LIB string for the "-soname" (or similar)
2880 dnl $1 is the default that should be used for "$cf_cv_shlib_version".
2881 dnl If missing, use "rel".
2882 define([CF_SHARED_SONAME],
2884 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=ifelse($1,,rel,$1)
2885 if test "$cf_cv_shlib_version" = rel; then
2886 cf_cv_shared_soname='`basename $[@] .${REL_VERSION}`.${ABI_VERSION}'
2888 cf_cv_shared_soname='`basename $[@]`'
2891 dnl ---------------------------------------------------------------------------
2892 dnl CF_STRIP_G_OPT version: 3 updated: 2002/12/21 19:25:52
2894 dnl Remove "-g" option from the compiler options
2895 AC_DEFUN([CF_STRIP_G_OPT],
2896 [$1=`echo ${$1} | sed -e 's%-g %%' -e 's%-g$%%'`])dnl
2897 dnl ---------------------------------------------------------------------------
2898 dnl CF_SUBDIR_PATH version: 6 updated: 2010/04/21 06:20:50
2900 dnl Construct a search-list for a nonstandard header/lib-file
2901 dnl $1 = the variable to return as result
2902 dnl $2 = the package name
2903 dnl $3 = the subdirectory, e.g., bin, include or lib
2904 AC_DEFUN([CF_SUBDIR_PATH],
2908 CF_ADD_SUBDIR_PATH($1,$2,$3,/usr,$prefix)
2909 CF_ADD_SUBDIR_PATH($1,$2,$3,$prefix,NONE)
2910 CF_ADD_SUBDIR_PATH($1,$2,$3,/usr/local,$prefix)
2911 CF_ADD_SUBDIR_PATH($1,$2,$3,/opt,$prefix)
2912 CF_ADD_SUBDIR_PATH($1,$2,$3,[$]HOME,$prefix)
2914 dnl ---------------------------------------------------------------------------
2915 dnl CF_SUBST version: 4 updated: 2006/06/17 12:33:03
2917 dnl Shorthand macro for substituting things that the user may override
2918 dnl with an environment variable.
2920 dnl $1 = long/descriptive name
2921 dnl $2 = environment variable
2922 dnl $3 = default value
2923 AC_DEFUN([CF_SUBST],
2924 [AC_CACHE_VAL(cf_cv_subst_$2,[
2925 AC_MSG_CHECKING(for $1 (symbol $2))
2926 CF_SUBST_IF([-z "[$]$2"], [$2], [$3])
2927 cf_cv_subst_$2=[$]$2
2928 AC_MSG_RESULT([$]$2)
2931 dnl ---------------------------------------------------------------------------
2932 dnl CF_TERM_HEADER version: 1 updated: 2005/12/31 13:26:39
2934 dnl Look for term.h, which is part of X/Open curses. It defines the interface
2935 dnl to terminfo database. Usually it is in the same include-path as curses.h,
2936 dnl but some packagers change this, breaking various applications.
2937 AC_DEFUN([CF_TERM_HEADER],[
2938 AC_CACHE_CHECK(for terminfo header, cf_cv_term_header,[
2939 case ${cf_cv_ncurses_header} in #(vi
2940 */ncurses.h|*/ncursesw.h) #(vi
2941 cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[[^.]]*\.h$%term.h%'`
2944 cf_term_header=term.h
2948 for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h"
2950 AC_TRY_COMPILE([#include <stdio.h>
2951 #include <${cf_cv_ncurses_header-curses.h}>
2953 ],[int x = auto_left_margin],[
2954 cf_cv_term_header="$cf_test"],[
2955 cf_cv_term_header=unknown
2957 test "$cf_cv_term_header" != unknown && break
2961 # Set definitions to allow ifdef'ing to accommodate subdirectories
2963 case $cf_cv_term_header in # (vi
2965 AC_DEFINE(HAVE_TERM_H)
2969 case $cf_cv_term_header in # (vi
2970 ncurses/term.h) #(vi
2971 AC_DEFINE(HAVE_NCURSES_TERM_H)
2974 AC_DEFINE(HAVE_NCURSESW_TERM_H)
2978 dnl ---------------------------------------------------------------------------
2979 dnl CF_TOP_BUILDDIR version: 1 updated: 2006/10/15 16:33:23
2981 dnl Define a top_builddir symbol, for applications that need an absolute path.
2982 AC_DEFUN([CF_TOP_BUILDDIR],
2985 AC_SUBST(top_builddir)
2987 dnl ---------------------------------------------------------------------------
2988 dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59
2990 dnl Make an uppercase version of a variable
2991 dnl $1=uppercase($2)
2992 AC_DEFUN([CF_UPPER],
2994 $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
2996 dnl ---------------------------------------------------------------------------
2997 dnl CF_UTF8_LIB version: 6 updated: 2010/04/21 06:20:50
2999 dnl Check for multibyte support, and if not found, utf8 compatibility library
3000 AC_DEFUN([CF_UTF8_LIB],
3002 AC_CACHE_CHECK(for multibyte character support,cf_cv_utf8_lib,[
3003 cf_save_LIBS="$LIBS"
3005 #include <stdlib.h>],[putwc(0,0);],
3006 [cf_cv_utf8_lib=yes],
3008 #include <libutf8.h>],[putwc(0,0);],utf8,
3009 [cf_cv_utf8_lib=add-on],
3010 [cf_cv_utf8_lib=no])
3013 # HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between
3015 if test "$cf_cv_utf8_lib" = "add-on" ; then
3016 AC_DEFINE(HAVE_LIBUTF8_H)
3017 CF_ADD_INCDIR($cf_cv_header_path_utf8)
3018 CF_ADD_LIBDIR($cf_cv_library_path_utf8)
3019 LIBS="$cf_cv_library_file_utf8 $LIBS"
3022 dnl ---------------------------------------------------------------------------
3023 dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12
3025 dnl Use AC_VERBOSE w/o the warnings
3026 AC_DEFUN([CF_VERBOSE],
3027 [test -n "$verbose" && echo " $1" 1>&AC_FD_MSG
3030 dnl ---------------------------------------------------------------------------
3031 dnl CF_WEAK_SYMBOLS version: 1 updated: 2008/08/16 19:18:06
3033 dnl Check for compiler-support for weak symbols.
3034 dnl This works with "recent" gcc.
3035 AC_DEFUN([CF_WEAK_SYMBOLS],[
3036 AC_CACHE_CHECK(if $CC supports weak symbols,cf_cv_weak_symbols,[
3039 #include <stdio.h>],
3041 #if defined(__GNUC__)
3042 # if defined __USE_ISOC99
3043 # define _cat_pragma(exp) _Pragma(#exp)
3044 # define _weak_pragma(exp) _cat_pragma(weak name)
3046 # define _weak_pragma(exp)
3048 # define _declare(name) __extension__ extern __typeof__(name) name
3049 # define weak_symbol(name) _weak_pragma(name) _declare(name) __attribute__((weak))
3053 ],[cf_cv_weak_symbols=yes],[cf_cv_weak_symbols=no])
3056 dnl ---------------------------------------------------------------------------
3057 dnl CF_WITH_CURSES_DIR version: 2 updated: 2002/11/10 14:46:59
3058 dnl ------------------
3059 dnl Wrapper for AC_ARG_WITH to specify directory under which to look for curses
3061 AC_DEFUN([CF_WITH_CURSES_DIR],[
3062 AC_ARG_WITH(curses-dir,
3063 [ --with-curses-dir=DIR directory in which (n)curses is installed],
3064 [CF_PATH_SYNTAX(withval)
3065 cf_cv_curses_dir=$withval],
3066 [cf_cv_curses_dir=no])
3068 dnl ---------------------------------------------------------------------------
3069 dnl CF_WITH_PATH version: 9 updated: 2010/05/26 05:38:42
3071 dnl Wrapper for AC_ARG_WITH to ensure that user supplies a pathname, not just
3072 dnl defaulting to yes/no.
3074 dnl $1 = option name
3076 dnl $3 = environment variable to set
3077 dnl $4 = default value, shown in the help-message, must be a constant
3078 dnl $5 = default value, if it's an expression & cannot be in the help-message
3080 AC_DEFUN([CF_WITH_PATH],
3081 [AC_ARG_WITH($1,[$2 ](default: ifelse([$4],,empty,[$4])),,
3082 ifelse([$4],,[withval="${$3}"],[withval="${$3-ifelse([$5],,[$4],[$5])}"]))dnl
3083 if ifelse([$5],,true,[test -n "$5"]) ; then
3084 CF_PATH_SYNTAX(withval)
3089 dnl ---------------------------------------------------------------------------
3090 dnl CF_WITH_PTHREAD version: 3 updated: 2010/05/29 16:31:02
3092 dnl Check for POSIX thread library.
3093 AC_DEFUN([CF_WITH_PTHREAD],
3095 AC_MSG_CHECKING(if you want to link with the pthread library)
3096 AC_ARG_WITH(pthread,
3097 [ --with-pthread use POSIX thread library],
3098 [with_pthread=$withval],
3100 AC_MSG_RESULT($with_pthread)
3102 if test "$with_pthread" != no ; then
3103 AC_CHECK_HEADER(pthread.h,[
3104 AC_DEFINE(HAVE_PTHREADS_H)
3106 AC_MSG_CHECKING(if we can link with the pthread library)
3107 cf_save_LIBS="$LIBS"
3110 #include <pthread.h>
3112 int rc = pthread_create(0,0,0,0);
3113 ],[with_pthread=yes],[with_pthread=no])
3114 LIBS="$cf_save_LIBS"
3115 AC_MSG_RESULT($with_pthread)
3117 if test "$with_pthread" = yes ; then
3119 AC_DEFINE(HAVE_LIBPTHREADS)
3121 AC_MSG_ERROR(Cannot link with pthread library)
3126 dnl ---------------------------------------------------------------------------
3127 dnl CF_XOPEN_SOURCE version: 34 updated: 2010/05/26 05:38:42
3129 dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
3130 dnl or adapt to the vendor's definitions to get equivalent functionality,
3131 dnl without losing the common non-POSIX features.
3134 dnl $1 is the nominal value for _XOPEN_SOURCE
3135 dnl $2 is the nominal value for _POSIX_C_SOURCE
3136 AC_DEFUN([CF_XOPEN_SOURCE],[
3138 cf_XOPEN_SOURCE=ifelse([$1],,500,[$1])
3139 cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2])
3142 case $host_os in #(vi
3144 cf_xopen_source="-D_ALL_SOURCE"
3146 darwin[[0-8]].*) #(vi
3147 cf_xopen_source="-D_APPLE_C_SOURCE"
3150 cf_xopen_source="-D_DARWIN_C_SOURCE"
3152 freebsd*|dragonfly*) #(vi
3153 # 5.x headers associate
3154 # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L
3155 # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L
3156 cf_POSIX_C_SOURCE=200112L
3158 cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
3161 cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500"
3164 cf_xopen_source="-D_HPUX_SOURCE"
3167 cf_xopen_source="-D_SGI_SOURCE"
3169 linux*|gnu*|mint*|k*bsd*-gnu) #(vi
3173 # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h>
3176 # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
3179 # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
3182 cf_xopen_source="-D_OSF_SOURCE"
3185 cf_xopen_source="-D_QNX_SOURCE"
3188 # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
3190 solaris2.1[[0-9]]) #(vi
3191 cf_xopen_source="-D__EXTENSIONS__ -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
3193 solaris2.[[1-9]]) #(vi
3194 cf_xopen_source="-D__EXTENSIONS__"
3197 AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
3198 AC_TRY_COMPILE([#include <sys/types.h>],[
3199 #ifndef _XOPEN_SOURCE
3202 [cf_cv_xopen_source=no],
3203 [cf_save="$CPPFLAGS"
3204 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
3205 AC_TRY_COMPILE([#include <sys/types.h>],[
3206 #ifdef _XOPEN_SOURCE
3209 [cf_cv_xopen_source=no],
3210 [cf_cv_xopen_source=$cf_XOPEN_SOURCE])
3214 if test "$cf_cv_xopen_source" != no ; then
3215 CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE)
3216 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE)
3217 cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
3218 CF_ADD_CFLAGS($cf_temp_xopen_source)
3220 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
3224 if test -n "$cf_xopen_source" ; then
3225 CF_ADD_CFLAGS($cf_xopen_source)