1 dnl macros used for DIALOG configure script
2 dnl $Id: aclocal.m4,v 1.90 2012/12/02 20:07:30 tom Exp $
3 dnl ---------------------------------------------------------------------------
4 dnl Copyright 1999-2011,2012 -- Thomas E. Dickey
6 dnl Permission is hereby granted, free of charge, to any person obtaining a
7 dnl copy of this software and associated documentation files (the
8 dnl "Software"), to deal in the Software without restriction, including
9 dnl without limitation the rights to use, copy, modify, merge, publish,
10 dnl distribute, distribute with modifications, sublicense, and/or sell
11 dnl copies of the Software, and to permit persons to whom the Software is
12 dnl furnished to do so, subject to the following conditions:
14 dnl The above copyright notice and this permission notice shall be included
15 dnl in all copies or portions of the Software.
17 dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 dnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
21 dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
22 dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
23 dnl THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 dnl Except as contained in this notice, the name(s) of the above copyright
26 dnl holders shall not be used in advertising or otherwise to promote the
27 dnl sale, use or other dealings in this Software without prior written
31 dnl http://invisible-island.net/autoconf/
32 dnl ---------------------------------------------------------------------------
33 dnl ---------------------------------------------------------------------------
34 dnl AM_GNU_GETTEXT version: 13 updated: 2012/11/09 05:47:26
36 dnl Usage: Just like AM_WITH_NLS, which see.
37 AC_DEFUN([AM_GNU_GETTEXT],
38 [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
39 AC_REQUIRE([AC_CANONICAL_HOST])dnl
40 AC_REQUIRE([AC_PROG_RANLIB])dnl
41 AC_REQUIRE([AC_HEADER_STDC])dnl
42 AC_REQUIRE([AC_C_INLINE])dnl
43 AC_REQUIRE([AC_TYPE_OFF_T])dnl
44 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
45 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
46 AC_REQUIRE([AC_FUNC_MMAP])dnl
47 AC_REQUIRE([jm_GLIBC21])dnl
48 AC_REQUIRE([CF_PROG_CC])dnl
50 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
51 stdlib.h string.h unistd.h sys/param.h])
52 AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \
53 getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \
54 strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
59 AM_WITH_NLS([$1],[$2],[$3],[$4])
61 if test "x$CATOBJEXT" != "x"; then
62 if test "x$ALL_LINGUAS" = "x"; then
65 AC_MSG_CHECKING(for catalogs to be installed)
67 for presentlang in $ALL_LINGUAS; do
69 for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do
70 # Use the presentlang catalog if desiredlang is
71 # a. equal to presentlang, or
72 # b. a variant of presentlang (because in this case,
73 # presentlang can be used as a fallback for messages
74 # which are not translated in the desiredlang catalog).
75 case "$desiredlang" in
76 "$presentlang"*) useit=yes;;
79 if test $useit = yes; then
80 NEW_LINGUAS="$NEW_LINGUAS $presentlang"
84 AC_MSG_RESULT($LINGUAS)
87 dnl Construct list of names of catalog files to be constructed.
88 if test -n "$LINGUAS"; then
89 for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
93 dnl Enable libtool support if the surrounding package wishes it.
94 INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], [])
95 AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
97 dnl ---------------------------------------------------------------------------
98 dnl AM_ICONV version: 12 updated: 2007/07/30 19:12:03
100 dnl Inserted as requested by gettext 0.10.40
101 dnl File from /usr/share/aclocal
103 dnl ====================
106 dnl From Bruno Haible.
108 dnl ====================
109 dnl Modified to use CF_FIND_LINKAGE and CF_ADD_SEARCHPATH, to broaden the
110 dnl range of locations searched. Retain the same cache-variable naming to
111 dnl allow reuse with the other gettext macros -Thomas E Dickey
114 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
115 dnl those with the standalone portable GNU libiconv installed).
117 AC_ARG_WITH([libiconv-prefix],
118 [ --with-libiconv-prefix=DIR
119 search for libiconv in DIR/include and DIR/lib], [
120 CF_ADD_OPTIONAL_PATH($withval, libiconv)
123 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
124 CF_FIND_LINKAGE(CF__ICONV_HEAD,
127 am_cv_func_iconv=yes,
128 am_cv_func_iconv=["no, consider installing GNU libiconv"])])
130 if test "$am_cv_func_iconv" = yes; then
131 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
133 AC_CACHE_CHECK([if the declaration of iconv() needs const.],
134 am_cv_proto_iconv_const,[
135 AC_TRY_COMPILE(CF__ICONV_HEAD [
140 #if defined(__STDC__) || defined(__cplusplus)
141 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
145 ],[], am_cv_proto_iconv_const=no,
146 am_cv_proto_iconv_const=yes)])
148 if test "$am_cv_proto_iconv_const" = yes ; then
149 am_cv_proto_iconv_arg1="const"
151 am_cv_proto_iconv_arg1=""
154 AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
155 [Define as const if the declaration of iconv() needs const.])
159 if test "$cf_cv_find_linkage_iconv" = yes; then
160 CF_ADD_INCDIR($cf_cv_header_path_iconv)
161 if test -n "$cf_cv_library_file_iconv" ; then
163 CF_ADD_LIBDIR($cf_cv_library_path_iconv)
169 dnl ---------------------------------------------------------------------------
170 dnl AM_LANGINFO_CODESET version: 3 updated: 2002/10/27 23:21:42
171 dnl -------------------
172 dnl Inserted as requested by gettext 0.10.40
173 dnl File from /usr/share/aclocal
175 dnl ====================
178 dnl From Bruno Haible.
179 AC_DEFUN([AM_LANGINFO_CODESET],
181 AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
182 [AC_TRY_LINK([#include <langinfo.h>],
183 [char* cs = nl_langinfo(CODESET);],
184 am_cv_langinfo_codeset=yes,
185 am_cv_langinfo_codeset=no)
187 if test $am_cv_langinfo_codeset = yes; then
188 AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
189 [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
192 dnl ---------------------------------------------------------------------------
193 dnl AM_LC_MESSAGES version: 4 updated: 2002/10/27 23:21:42
195 dnl Inserted as requested by gettext 0.10.40
196 dnl File from /usr/share/aclocal
198 dnl ====================
199 dnl Check whether LC_MESSAGES is available in <locale.h>.
200 dnl Ulrich Drepper <drepper@cygnus.com>, 1995.
202 dnl This file can be copied and used freely without restrictions. It can
203 dnl be used in projects which are not available under the GNU General Public
204 dnl License or the GNU Library General Public License but which still want
205 dnl to provide support for the GNU gettext functionality.
206 dnl Please note that the actual code of the GNU gettext library is covered
207 dnl by the GNU Library General Public License, and the rest of the GNU
208 dnl gettext package package is covered by the GNU General Public License.
209 dnl They are *not* in the public domain.
213 AC_DEFUN([AM_LC_MESSAGES],
214 [if test $ac_cv_header_locale_h = yes; then
215 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
216 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
217 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
218 if test $am_cv_val_LC_MESSAGES = yes; then
219 AC_DEFINE(HAVE_LC_MESSAGES, 1,
220 [Define if your <locale.h> file defines LC_MESSAGES.])
223 dnl ---------------------------------------------------------------------------
224 dnl AM_PATH_PROG_WITH_TEST version: 8 updated: 2009/01/11 20:31:12
225 dnl ----------------------
226 dnl Inserted as requested by gettext 0.10.40
227 dnl File from /usr/share/aclocal
229 dnl ====================
230 dnl Search path for a program which passes the given test.
231 dnl Ulrich Drepper <drepper@cygnus.com>, 1996.
233 dnl This file can be copied and used freely without restrictions. It can
234 dnl be used in projects which are not available under the GNU General Public
235 dnl License or the GNU Library General Public License but which still want
236 dnl to provide support for the GNU gettext functionality.
237 dnl Please note that the actual code of the GNU gettext library is covered
238 dnl by the GNU Library General Public License, and the rest of the GNU
239 dnl gettext package package is covered by the GNU General Public License.
240 dnl They are *not* in the public domain.
244 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
245 dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
246 AC_DEFUN([AM_PATH_PROG_WITH_TEST],
247 [# Extract the first word of "$2", so it can be a program name with args.
248 AC_REQUIRE([CF_PATHSEP])
249 set dummy $2; ac_word=[$]2
250 AC_MSG_CHECKING([for $ac_word])
251 AC_CACHE_VAL(ac_cv_path_$1,
254 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
257 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
258 for ac_dir in ifelse([$5], , $PATH, [$5]); do
259 test -z "$ac_dir" && ac_dir=.
260 if test -f $ac_dir/$ac_word$ac_exeext; then
262 ac_cv_path_$1="$ac_dir/$ac_word$ac_exeext"
268 dnl If no 4th arg is given, leave the cache variable unset,
269 dnl so AC_PATH_PROGS will keep looking.
270 ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
275 if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
282 dnl ---------------------------------------------------------------------------
283 dnl AM_WITH_NLS version: 25 updated: 2012/10/06 08:57:51
285 dnl Inserted as requested by gettext 0.10.40
286 dnl File from /usr/share/aclocal
288 dnl ====================
289 dnl Macro to add for using GNU gettext.
290 dnl Ulrich Drepper <drepper@cygnus.com>, 1995.
291 dnl ====================
292 dnl Modified to use CF_FIND_LINKAGE and CF_ADD_SEARCHPATH, to broaden the
293 dnl range of locations searched. Retain the same cache-variable naming to
294 dnl allow reuse with the other gettext macros -Thomas E Dickey
295 dnl ====================
297 dnl This file can be copied and used freely without restrictions. It can
298 dnl be used in projects which are not available under the GNU General Public
299 dnl License or the GNU Library General Public License but which still want
300 dnl to provide support for the GNU gettext functionality.
301 dnl Please note that the actual code of the GNU gettext library is covered
302 dnl by the GNU Library General Public License, and the rest of the GNU
303 dnl gettext package package is covered by the GNU General Public License.
304 dnl They are *not* in the public domain.
308 dnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR], [ENABLED]).
309 dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library
310 dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static,
311 dnl depending on --{enable,disable}-{shared,static} and on the presence of
312 dnl AM-DISABLE-SHARED). Otherwise, a static library
313 dnl $(top_builddir)/intl/libintl.a will be created.
314 dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
315 dnl implementations (in libc or libintl) without the ngettext() function
317 dnl LIBDIR is used to find the intl libraries. If empty,
318 dnl the value `$(top_builddir)/intl/' is used.
319 dnl ENABLED is used to control the default for the related --enable-nls, since
320 dnl not all application developers want this feature by default, e.g., lynx.
322 dnl The result of the configuration is one of three cases:
323 dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
325 dnl Catalog format: GNU --> install in $(datadir)
326 dnl Catalog extension: .mo after installation, .gmo in source tree
327 dnl 2) GNU gettext has been found in the system's C library.
328 dnl Catalog format: GNU --> install in $(datadir)
329 dnl Catalog extension: .mo after installation, .gmo in source tree
330 dnl 3) No internationalization, always use English msgid.
331 dnl Catalog format: none
332 dnl Catalog extension: none
333 dnl The use of .gmo is historical (it was needed to avoid overwriting the
334 dnl GNU format catalogs when building on a platform with an X/Open gettext),
335 dnl but we keep it in order not to force irrelevant filename changes on the
338 AC_DEFUN([AM_WITH_NLS],
339 [AC_MSG_CHECKING([whether NLS is requested])
340 dnl Default is enabled NLS
343 [ --disable-nls do not use Native Language Support],
344 USE_NLS=$enableval, USE_NLS=yes)],[
346 [ --enable-nls use Native Language Support],
347 USE_NLS=$enableval, USE_NLS=no)])
348 AC_MSG_RESULT($USE_NLS)
351 BUILD_INCLUDED_LIBINTL=no
352 USE_INCLUDED_LIBINTL=no
355 dnl If we use NLS figure out what method
356 if test "$USE_NLS" = "yes"; then
357 AC_DEFINE(ENABLE_NLS, 1,
358 [Define to 1 if translation of program messages to the user's native language
360 AC_MSG_CHECKING([whether included gettext is requested])
361 AC_ARG_WITH(included-gettext,
362 [ --with-included-gettext use the GNU gettext library included here],
363 nls_cv_force_use_gnu_gettext=$withval,
364 nls_cv_force_use_gnu_gettext=no)
365 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
367 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
368 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
369 dnl User does not insist on using GNU NLS library. Figure out what
370 dnl to use. If GNU gettext is available we use this. Else we have
371 dnl to fall back to GNU NLS library.
374 cf_save_LIBS_1="$LIBS"
375 CF_ADD_LIBS($LIBICONV)
376 AC_CACHE_CHECK([for libintl.h and gettext()], cf_cv_func_gettext,[
377 CF_FIND_LINKAGE(CF__INTL_HEAD,
380 cf_cv_func_gettext=yes,
381 cf_cv_func_gettext=no)
383 LIBS="$cf_save_LIBS_1"
385 if test "$cf_cv_func_gettext" = yes ; then
386 AC_DEFINE(HAVE_LIBINTL_H,1,[Define to 1 if we have libintl.h])
388 dnl If an already present or preinstalled GNU gettext() is found,
389 dnl use it. But if this macro is used in GNU gettext, and GNU
390 dnl gettext is already preinstalled in libintl, we update this
391 dnl libintl. (Cf. the install rule in intl/Makefile.in.)
392 if test "$PACKAGE" != gettext; then
393 AC_DEFINE(HAVE_GETTEXT, 1,
394 [Define if the GNU gettext() function is already present or preinstalled.])
396 CF_ADD_INCDIR($cf_cv_header_path_intl)
398 if test -n "$cf_cv_library_file_intl" ; then
399 dnl If iconv() is in a separate libiconv library, then anyone
400 dnl linking with libintl{.a,.so} also needs to link with
402 INTLLIBS="$cf_cv_library_file_intl $LIBICONV"
403 CF_ADD_LIBDIR($cf_cv_library_path_intl,INTLLIBS)
407 LIBS="$LIBS $INTLLIBS"
408 AC_CHECK_FUNCS(dcgettext)
411 dnl Search for GNU msgfmt in the PATH.
412 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
413 [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
414 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
416 dnl Search for GNU xgettext in the PATH.
417 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
418 [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
424 if test "$CATOBJEXT" = "NONE"; then
425 dnl GNU gettext is not found in the C library.
426 dnl Fall back on GNU gettext library.
427 nls_cv_use_gnu_gettext=yes
431 if test "$nls_cv_use_gnu_gettext" = "yes"; then
432 if test ! -d $srcdir/intl ; then
433 AC_MSG_ERROR(no NLS library is packaged with this application)
435 dnl Mark actions used to generate GNU NLS library.
436 INTLOBJS="\$(GETTOBJS)"
437 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
438 [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
439 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
440 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
441 [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
443 BUILD_INCLUDED_LIBINTL=yes
444 USE_INCLUDED_LIBINTL=yes
446 INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV"
447 LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
450 dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
451 dnl Test whether we really found GNU msgfmt.
452 if test "$GMSGFMT" != ":"; then
453 dnl If it is no GNU msgfmt we define it as : so that the
454 dnl Makefiles still can work.
455 if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then
459 [found msgfmt program is not GNU msgfmt; ignore it])
464 dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
465 dnl Test whether we really found GNU xgettext.
466 if test "$XGETTEXT" != ":"; then
467 dnl If it is no GNU xgettext we define it as : so that the
468 dnl Makefiles still can work.
469 if $XGETTEXT --omit-header /dev/null >/dev/null 2>&1; then
473 [found xgettext program is not GNU xgettext; ignore it])
478 dnl We need to process the po/ directory.
483 [for ac_file in $CONFIG_FILES; do
485 # Support "outfile[:infile[:infile...]]"
487 *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
490 # PO directories have a Makefile.in generated from Makefile.inn.
491 case "$ac_file" in */[Mm]akefile.in)
492 # Adjust a relative srcdir.
493 ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
494 ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
495 ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
496 ac_base=`basename $ac_file .in`
497 # In autoconf-2.13 it is called $ac_given_srcdir.
498 # In autoconf-2.50 it is called $srcdir.
499 test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
501 case "$ac_given_srcdir" in
502 .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
503 /*) top_srcdir="$ac_given_srcdir" ;;
504 *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
507 if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
508 rm -f "$ac_dir/POTFILES"
509 test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
510 sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES"
511 test -n "$as_me" && echo "$as_me: creating $ac_dir/$ac_base" || echo "creating $ac_dir/$ac_base"
512 sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/$ac_base.in" > "$ac_dir/$ac_base"
518 dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
519 dnl to 'yes' because some of the testsuite requires it.
520 if test "$PACKAGE" = gettext; then
521 BUILD_INCLUDED_LIBINTL=yes
524 dnl intl/plural.c is generated from intl/plural.y. It requires bison,
525 dnl because plural.y uses bison specific features. It requires at least
526 dnl bison-1.26 because earlier versions generate a plural.c that doesn't
528 dnl bison is only needed for the maintainer (who touches plural.y). But in
529 dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
530 dnl the rule in general Makefile. Now, some people carelessly touch the
531 dnl files or have a broken "make" program, hence the plural.c rule will
532 dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
533 dnl present or too old.
534 if test "$nls_cv_use_gnu_gettext" = "yes"; then
535 AC_CHECK_PROGS([INTLBISON], [bison])
536 if test -z "$INTLBISON"; then
539 dnl Found it, now check the version.
540 AC_MSG_CHECKING([version of bison])
541 changequote(<<,>>)dnl
542 ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
543 case $ac_prog_version in
544 '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
545 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
547 ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
548 *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
550 AC_MSG_RESULT([$ac_prog_version])
552 if test $ac_verc_fail = yes; then
557 dnl These rules are solely for the distribution goal. While doing this
558 dnl we only have to keep exactly one list of the available catalogs
560 for lang in $ALL_LINGUAS; do
561 GMOFILES="$GMOFILES $lang.gmo"
562 POFILES="$POFILES $lang.po"
565 dnl Make all variables we use known to autoconf.
566 AC_SUBST(BUILD_INCLUDED_LIBINTL)
567 AC_SUBST(USE_INCLUDED_LIBINTL)
576 dnl For backward compatibility. Some configure.ins may be using this.
580 dnl For backward compatibility. Some Makefiles may be using this.
582 AC_SUBST(DATADIRNAME)
584 dnl For backward compatibility. Some Makefiles may be using this.
588 dnl For backward compatibility. Some Makefiles may be using this.
592 dnl ---------------------------------------------------------------------------
593 dnl CF_ACVERSION_CHECK version: 3 updated: 2012/10/03 18:39:53
594 dnl ------------------
595 dnl Conditionally generate script according to whether we're using a given autoconf.
597 dnl $1 = version to compare against
598 dnl $2 = code to use if AC_ACVERSION is at least as high as $1.
599 dnl $3 = code to use if AC_ACVERSION is older than $1.
600 define([CF_ACVERSION_CHECK],
602 ifdef([m4_version_compare],
603 [m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])],
604 [CF_ACVERSION_COMPARE(
605 AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])),
606 AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl
607 dnl ---------------------------------------------------------------------------
608 dnl CF_ACVERSION_COMPARE version: 3 updated: 2012/10/03 18:39:53
609 dnl --------------------
610 dnl CF_ACVERSION_COMPARE(MAJOR1, MINOR1, TERNARY1,
611 dnl MAJOR2, MINOR2, TERNARY2,
612 dnl PRINTABLE2, not FOUND, FOUND)
613 define([CF_ACVERSION_COMPARE],
614 [ifelse(builtin([eval], [$2 < $5]), 1,
615 [ifelse([$8], , ,[$8])],
616 [ifelse([$9], , ,[$9])])])dnl
617 dnl ---------------------------------------------------------------------------
618 dnl CF_ADD_CFLAGS version: 10 updated: 2010/05/26 05:38:42
620 dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS
621 dnl The second parameter if given makes this macro verbose.
623 dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS,
624 dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily
625 dnl confused by the quotes (which require backslashes to keep them usable).
626 AC_DEFUN([CF_ADD_CFLAGS],
631 cf_new_extra_cppflags=
633 for cf_add_cflags in $1
635 case $cf_fix_cppflags in
637 case $cf_add_cflags in #(vi
638 -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
639 case $cf_add_cflags in
641 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'`
643 test "${cf_add_cflags}" != "${cf_tst_cflags}" \
644 && test -z "${cf_tst_cflags}" \
645 && cf_fix_cppflags=yes
647 if test $cf_fix_cppflags = yes ; then
648 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
650 elif test "${cf_tst_cflags}" = "\"'" ; then
651 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
657 *$cf_add_cflags) #(vi
660 case $cf_add_cflags in #(vi
662 cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
663 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags)
666 cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
671 cf_new_cflags="$cf_new_cflags $cf_add_cflags"
676 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
678 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'`
680 test "${cf_add_cflags}" != "${cf_tst_cflags}" \
681 && test -z "${cf_tst_cflags}" \
682 && cf_fix_cppflags=no
687 if test -n "$cf_new_cflags" ; then
688 ifelse([$2],,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)])
689 CFLAGS="$CFLAGS $cf_new_cflags"
692 if test -n "$cf_new_cppflags" ; then
693 ifelse([$2],,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)])
694 CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
697 if test -n "$cf_new_extra_cppflags" ; then
698 ifelse([$2],,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)])
699 EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
702 AC_SUBST(EXTRA_CPPFLAGS)
705 dnl ---------------------------------------------------------------------------
706 dnl CF_ADD_INCDIR version: 13 updated: 2010/05/26 16:44:57
708 dnl Add an include-directory to $CPPFLAGS. Don't add /usr/include, since it's
709 dnl redundant. We don't normally need to add -I/usr/local/include for gcc,
710 dnl but old versions (and some misinstalled ones) need that. To make things
711 dnl worse, gcc 3.x may give error messages if -I/usr/local/include is added to
712 dnl the include-path).
713 AC_DEFUN([CF_ADD_INCDIR],
715 if test -n "$1" ; then
716 for cf_add_incdir in $1
718 while test $cf_add_incdir != /usr/include
720 if test -d $cf_add_incdir
723 if test -n "$CFLAGS$CPPFLAGS" ; then
724 # a loop is needed to ensure we can add subdirs of existing dirs
725 for cf_test_incdir in $CFLAGS $CPPFLAGS ; do
726 if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then
727 cf_have_incdir=yes; break
732 if test "$cf_have_incdir" = no ; then
733 if test "$cf_add_incdir" = /usr/local/include ; then
736 cf_save_CPPFLAGS=$CPPFLAGS
737 CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
738 AC_TRY_COMPILE([#include <stdio.h>],
741 [cf_have_incdir=yes])
742 CPPFLAGS=$cf_save_CPPFLAGS
747 if test "$cf_have_incdir" = no ; then
748 CF_VERBOSE(adding $cf_add_incdir to include-path)
749 ifelse([$2],,CPPFLAGS,[$2])="$ifelse([$2],,CPPFLAGS,[$2]) -I$cf_add_incdir"
751 cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'`
752 test "$cf_top_incdir" = "$cf_add_incdir" && break
753 cf_add_incdir="$cf_top_incdir"
762 dnl ---------------------------------------------------------------------------
763 dnl CF_ADD_LIB version: 2 updated: 2010/06/02 05:03:05
765 dnl Add a library, used to enforce consistency.
767 dnl $1 = library to add, without the "-l"
768 dnl $2 = variable to update (default $LIBS)
769 AC_DEFUN([CF_ADD_LIB],[CF_ADD_LIBS(-l$1,ifelse($2,,LIBS,[$2]))])dnl
770 dnl ---------------------------------------------------------------------------
771 dnl CF_ADD_LIBDIR version: 9 updated: 2010/05/26 16:44:57
773 dnl Adds to the library-path
775 dnl Some machines have trouble with multiple -L options.
777 dnl $1 is the (list of) directory(s) to add
778 dnl $2 is the optional name of the variable to update (default LDFLAGS)
780 AC_DEFUN([CF_ADD_LIBDIR],
782 if test -n "$1" ; then
783 for cf_add_libdir in $1
785 if test $cf_add_libdir = /usr/lib ; then
787 elif test -d $cf_add_libdir
790 if test -n "$LDFLAGS$LIBS" ; then
791 # a loop is needed to ensure we can add subdirs of existing dirs
792 for cf_test_libdir in $LDFLAGS $LIBS ; do
793 if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then
794 cf_have_libdir=yes; break
798 if test "$cf_have_libdir" = no ; then
799 CF_VERBOSE(adding $cf_add_libdir to library-path)
800 ifelse([$2],,LDFLAGS,[$2])="-L$cf_add_libdir $ifelse([$2],,LDFLAGS,[$2])"
806 dnl ---------------------------------------------------------------------------
807 dnl CF_ADD_LIBS version: 1 updated: 2010/06/02 05:03:05
809 dnl Add one or more libraries, used to enforce consistency.
811 dnl $1 = libraries to add, with the "-l", etc.
812 dnl $2 = variable to update (default $LIBS)
813 AC_DEFUN([CF_ADD_LIBS],[ifelse($2,,LIBS,[$2])="$1 [$]ifelse($2,,LIBS,[$2])"])dnl
814 dnl ---------------------------------------------------------------------------
815 dnl CF_ADD_OPTIONAL_PATH version: 1 updated: 2007/07/29 12:33:33
816 dnl --------------------
817 dnl Add an optional search-path to the compile/link variables.
820 dnl $1 = shell variable containing the result of --with-XXX=[DIR]
821 dnl $2 = module to look for.
822 AC_DEFUN([CF_ADD_OPTIONAL_PATH],[
829 CF_ADD_SEARCHPATH([$1], [AC_MSG_ERROR(cannot find $2 under $1)])
833 dnl ---------------------------------------------------------------------------
834 dnl CF_ADD_SEARCHPATH version: 5 updated: 2009/01/11 20:40:21
835 dnl -----------------
836 dnl Set $CPPFLAGS and $LDFLAGS with the directories given via the parameter.
837 dnl They can be either the common root of include- and lib-directories, or the
838 dnl lib-directory (to allow for things like lib64 directories).
839 dnl See also CF_FIND_LINKAGE.
841 dnl $1 is the list of colon-separated directory names to search.
842 dnl $2 is the action to take if a parameter does not yield a directory.
843 AC_DEFUN([CF_ADD_SEARCHPATH],
845 AC_REQUIRE([CF_PATHSEP])
846 for cf_searchpath in `echo "$1" | tr $PATH_SEPARATOR ' '`; do
847 if test -d $cf_searchpath/include; then
848 CF_ADD_INCDIR($cf_searchpath/include)
849 elif test -d $cf_searchpath/../include ; then
850 CF_ADD_INCDIR($cf_searchpath/../include)
854 if test -d $cf_searchpath/lib; then
855 CF_ADD_LIBDIR($cf_searchpath/lib)
856 elif test -d $cf_searchpath ; then
857 CF_ADD_LIBDIR($cf_searchpath)
863 dnl ---------------------------------------------------------------------------
864 dnl CF_ADD_SUBDIR_PATH version: 3 updated: 2010/07/03 20:58:12
865 dnl ------------------
866 dnl Append to a search-list for a nonstandard header/lib-file
867 dnl $1 = the variable to return as result
868 dnl $2 = the package name
869 dnl $3 = the subdirectory, e.g., bin, include or lib
870 dnl $4 = the directory under which we will test for subdirectories
871 dnl $5 = a directory that we do not want $4 to match
872 AC_DEFUN([CF_ADD_SUBDIR_PATH],
874 test "$4" != "$5" && \
876 ifelse([$5],NONE,,[(test $5 = NONE || test "$4" != "$5") &&]) {
877 test -n "$verbose" && echo " ... testing for $3-directories under $4"
878 test -d $4/$3 && $1="[$]$1 $4/$3"
879 test -d $4/$3/$2 && $1="[$]$1 $4/$3/$2"
880 test -d $4/$3/$2/$3 && $1="[$]$1 $4/$3/$2/$3"
881 test -d $4/$2/$3 && $1="[$]$1 $4/$2/$3"
882 test -d $4/$2/$3/$2 && $1="[$]$1 $4/$2/$3/$2"
885 dnl ---------------------------------------------------------------------------
886 dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31
888 dnl Allow user to disable a normally-on option.
889 AC_DEFUN([CF_ARG_DISABLE],
890 [CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl
891 dnl ---------------------------------------------------------------------------
892 dnl CF_ARG_MSG_ENABLE version: 2 updated: 2000/07/29 19:32:03
893 dnl -----------------
894 dnl Verbose form of AC_ARG_ENABLE:
900 dnl $4 = action to perform if option is enabled
901 dnl $5 = action if perform if option is disabled
902 dnl $6 = default option value (either 'yes' or 'no')
903 AC_DEFUN([CF_ARG_MSG_ENABLE],[
905 AC_ARG_ENABLE($2,[$3],,enableval=ifelse($6,,no,$6))
906 AC_MSG_RESULT($enableval)
907 if test "$enableval" != no ; then
913 dnl ---------------------------------------------------------------------------
914 dnl CF_ARG_OPTION version: 4 updated: 2010/05/26 05:38:42
916 dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus
922 dnl $3 = action to perform if option is not default
923 dnl $4 = action if perform if option is default
924 dnl $5 = default option value (either 'yes' or 'no')
925 AC_DEFUN([CF_ARG_OPTION],
926 [AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes)
927 if test "$enableval" != "$5" ; then
929 ,[ $3]) ifelse([$4],,,[
932 fi],[enableval=$5 ifelse([$4],,,[
936 dnl ---------------------------------------------------------------------------
937 dnl CF_BUNDLED_INTL version: 17 updated: 2012/10/06 08:57:51
939 dnl Top-level macro for configuring an application with a bundled copy of
940 dnl the intl and po directories for gettext.
942 dnl $1 specifies either Makefile or makefile, defaulting to the former.
943 dnl $2 if nonempty sets the option to --enable-nls rather than to --disable-nls
945 dnl Sets variables which can be used to substitute in makefiles:
946 dnl GT_YES - "#" comment unless building intl library, otherwise empty
947 dnl GT_NO - "#" comment if building intl library, otherwise empty
948 dnl INTLDIR_MAKE - to make ./intl directory
949 dnl MSG_DIR_MAKE - to make ./po directory
950 dnl SUB_MAKEFILE - list of makefiles in ./intl, ./po directories
953 dnl HAVE_LIBGETTEXT_H if we're using ./intl
957 dnl ALL_LINGUAS if set, lists the root names of the ".po" files.
958 dnl CONFIG_H assumed to be "config.h"
959 dnl PACKAGE must be set, used as default for textdomain
960 dnl VERSION may be set, otherwise extract from "VERSION" file.
962 AC_DEFUN([CF_BUNDLED_INTL],[
963 cf_makefile=ifelse($1,,Makefile,$1)
965 dnl Set of available languages (based on source distribution). Note that
966 dnl setting $LINGUAS overrides $ALL_LINGUAS. Some environments set $LINGUAS
967 dnl rather than $LC_ALL
968 test -z "$ALL_LINGUAS" && ALL_LINGUAS=`test -d $srcdir/po && cd $srcdir/po && echo *.po|sed -e 's/\.po//g' -e 's/*//'`
970 # Allow override of "config.h" definition:
971 : ${CONFIG_H:=config.h}
974 if test -z "$PACKAGE" ; then
975 AC_MSG_ERROR([[CF_BUNDLED_INTL] used without setting [PACKAGE] variable])
978 if test -z "$VERSION" ; then
979 if test -f $srcdir/VERSION ; then
980 VERSION=`sed -e '2,$d' $srcdir/VERSION|cut -f1`
987 AM_GNU_GETTEXT(,,,[$2])
989 if test "$USE_NLS" = yes ; then
990 AC_ARG_WITH(textdomain,
991 [ --with-textdomain=PKG NLS text-domain (default is package name)],
992 [NLS_TEXTDOMAIN=$withval],
993 [NLS_TEXTDOMAIN=$PACKAGE])
994 AC_DEFINE_UNQUOTED(NLS_TEXTDOMAIN,"$NLS_TEXTDOMAIN",[Define to the nls textdomain value])
995 AC_SUBST(NLS_TEXTDOMAIN)
1002 dnl this updates SUB_MAKEFILE and MSG_DIR_MAKE:
1005 if test "$USE_INCLUDED_LIBINTL" = yes ; then
1006 if test "$nls_cv_force_use_gnu_gettext" = yes ; then
1008 elif test "$nls_cv_use_gnu_gettext" = yes ; then
1013 if test -z "$INTLDIR_MAKE"; then
1014 AC_DEFINE(HAVE_LIBGETTEXT_H,1,[Define to 1 if we have libgettext.h])
1015 for cf_makefile in \
1016 $srcdir/intl/Makefile.in \
1017 $srcdir/intl/makefile.in
1019 if test -f "$cf_makefile" ; then
1020 SUB_MAKEFILE="$SUB_MAKEFILE `echo \"${cf_makefile}\"|sed -e 's,^'$srcdir/',,' -e 's/\.in$//'`:${cf_makefile}"
1027 if test "$USE_NLS" = yes ; then
1028 AC_CHECK_HEADERS(libintl.h)
1032 if test -z "$INTLDIR_MAKE" ; then
1033 CPPFLAGS="$CPPFLAGS -I../intl"
1036 dnl FIXME: we use this in lynx (the alternative is a spurious dependency upon
1038 if test "$BUILD_INCLUDED_LIBINTL" = yes ; then
1046 AC_SUBST(INTLDIR_MAKE)
1047 AC_SUBST(MSG_DIR_MAKE)
1051 dnl FIXME: the underlying AM_GNU_GETTEXT macro either needs some fixes or a
1052 dnl little documentation. It doesn't define anything so that we can ifdef our
1053 dnl own code, except ENABLE_NLS, which is too vague to be of any use.
1055 if test "$USE_INCLUDED_LIBINTL" = yes ; then
1056 if test "$nls_cv_force_use_gnu_gettext" = yes ; then
1057 AC_DEFINE(HAVE_GETTEXT,1,[Define to 1 if we have gettext function])
1058 elif test "$nls_cv_use_gnu_gettext" = yes ; then
1059 AC_DEFINE(HAVE_GETTEXT,1,[Define to 1 if we have gettext function])
1061 if test -n "$nls_cv_header_intl" ; then
1062 AC_DEFINE(HAVE_LIBINTL_H,1,[Define to 1 if we have header-file for libintl])
1066 dnl ---------------------------------------------------------------------------
1067 dnl CF_CC_ENV_FLAGS version: 1 updated: 2012/10/03 05:25:49
1069 dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content
1070 dnl into CC. This will not help with broken scripts that wrap the compiler with
1071 dnl options, but eliminates a more common category of user confusion.
1072 AC_DEFUN([CF_CC_ENV_FLAGS],
1074 # This should have been defined by AC_PROG_CC
1077 AC_MSG_CHECKING(\$CC variable)
1080 AC_MSG_RESULT(broken)
1081 AC_MSG_WARN(your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options)
1083 cf_flags=`echo "$CC" | sed -e 's/^[[^ ]]*[[ ]]//'`
1084 CC=`echo "$CC" | sed -e 's/[[ ]].*//'`
1085 CF_ADD_CFLAGS($cf_flags)
1092 dnl ---------------------------------------------------------------------------
1093 dnl CF_CHECK_CACHE version: 12 updated: 2012/10/02 20:55:03
1095 dnl Check if we're accidentally using a cache from a different machine.
1096 dnl Derive the system name, as a check for reusing the autoconf cache.
1098 dnl If we've packaged config.guess and config.sub, run that (since it does a
1099 dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow
1100 dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM
1101 dnl which is useful in cross-compiles.
1103 dnl Note: we would use $ac_config_sub, but that is one of the places where
1104 dnl autoconf 2.5x broke compatibility with autoconf 2.13
1105 AC_DEFUN([CF_CHECK_CACHE],
1107 if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then
1108 ifelse([$1],,[AC_CANONICAL_HOST],[$1])
1109 system_name="$host_os"
1111 system_name="`(uname -s -r) 2>/dev/null`"
1112 if test -z "$system_name" ; then
1113 system_name="`(hostname) 2>/dev/null`"
1116 test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name",[Define to the system name.])
1117 AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
1119 test -z "$system_name" && system_name="$cf_cv_system_name"
1120 test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name)
1122 if test ".$system_name" != ".$cf_cv_system_name" ; then
1123 AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name))
1124 AC_MSG_ERROR("Please remove config.cache and try again.")
1127 dnl ---------------------------------------------------------------------------
1128 dnl CF_CLANG_COMPILER version: 1 updated: 2012/06/16 14:55:39
1129 dnl -----------------
1130 dnl Check if the given compiler is really clang. clang's C driver defines
1131 dnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does
1132 dnl not ignore some gcc options.
1134 dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
1135 dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from
1136 dnl the wrappers for gcc and g++ warnings.
1138 dnl $1 = GCC (default) or GXX
1139 dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
1140 dnl $3 = CFLAGS (default) or CXXFLAGS
1141 AC_DEFUN([CF_CLANG_COMPILER],[
1142 ifelse([$2],,CLANG_COMPILER,[$2])=no
1144 if test "$ifelse([$1],,[$1],GCC)" = yes ; then
1145 AC_MSG_CHECKING(if this is really Clang ifelse([$1],GXX,C++,C) compiler)
1146 cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])"
1147 ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -Qunused-arguments"
1153 ],[ifelse([$2],,CLANG_COMPILER,[$2])=yes
1154 cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments"
1156 ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
1157 AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2]))
1160 dnl ---------------------------------------------------------------------------
1161 dnl CF_CURSES_CHTYPE version: 8 updated: 2012/10/06 08:57:51
1162 dnl ----------------
1163 dnl Test if curses defines 'chtype' (usually a 'long' type for SysV curses).
1164 AC_DEFUN([CF_CURSES_CHTYPE],
1166 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
1167 AC_CACHE_CHECK(for chtype typedef,cf_cv_chtype_decl,[
1168 AC_TRY_COMPILE([#include <${cf_cv_ncurses_header:-curses.h}>],
1170 [cf_cv_chtype_decl=yes],
1171 [cf_cv_chtype_decl=no])])
1172 if test $cf_cv_chtype_decl = yes ; then
1173 AC_DEFINE(HAVE_TYPE_CHTYPE,1,[Define to 1 if chtype is declared])
1174 AC_CACHE_CHECK(if chtype is scalar or struct,cf_cv_chtype_type,[
1175 AC_TRY_COMPILE([#include <${cf_cv_ncurses_header:-curses.h}>],
1176 [chtype foo; long x = foo],
1177 [cf_cv_chtype_type=scalar],
1178 [cf_cv_chtype_type=struct])])
1179 if test $cf_cv_chtype_type = scalar ; then
1180 AC_DEFINE(TYPE_CHTYPE_IS_SCALAR,1,[Define to 1 if chtype is a scaler/integer])
1184 dnl ---------------------------------------------------------------------------
1185 dnl CF_CURSES_CONFIG version: 2 updated: 2006/10/29 11:06:27
1186 dnl ----------------
1187 dnl Tie together the configure-script macros for curses. It may be ncurses,
1188 dnl but unless asked, we do not make a special search for ncurses. However,
1189 dnl still check for the ncurses version number, for use in other macros.
1190 AC_DEFUN([CF_CURSES_CONFIG],
1196 dnl ---------------------------------------------------------------------------
1197 dnl CF_CURSES_CPPFLAGS version: 11 updated: 2011/04/09 14:51:08
1198 dnl ------------------
1199 dnl Look for the curses headers.
1200 AC_DEFUN([CF_CURSES_CPPFLAGS],[
1202 AC_CACHE_CHECK(for extra include directories,cf_cv_curses_incdir,[
1203 cf_cv_curses_incdir=no
1204 case $host_os in #(vi
1206 if test "x$cf_cv_screen" = "xcurses_colr"
1208 test -d /usr/include/curses_colr && \
1209 cf_cv_curses_incdir="-I/usr/include/curses_colr"
1213 if test "x$cf_cv_screen" = "xcurses_5lib"
1215 test -d /usr/5lib && \
1216 test -d /usr/5include && \
1217 cf_cv_curses_incdir="-I/usr/5include"
1222 test "$cf_cv_curses_incdir" != no && CPPFLAGS="$CPPFLAGS $cf_cv_curses_incdir"
1227 dnl ---------------------------------------------------------------------------
1228 dnl CF_CURSES_FUNCS version: 17 updated: 2011/05/14 16:07:29
1230 dnl Curses-functions are a little complicated, since a lot of them are macros.
1231 AC_DEFUN([CF_CURSES_FUNCS],
1233 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
1234 AC_REQUIRE([CF_XOPEN_CURSES])
1235 AC_REQUIRE([CF_CURSES_TERM_H])
1236 AC_REQUIRE([CF_CURSES_UNCTRL_H])
1239 CF_UPPER(cf_tr_func,$cf_func)
1240 AC_MSG_CHECKING(for ${cf_func})
1241 CF_MSG_LOG(${cf_func})
1242 AC_CACHE_VAL(cf_cv_func_$cf_func,[
1243 eval cf_result='$ac_cv_func_'$cf_func
1244 if test ".$cf_result" != ".no"; then
1245 AC_TRY_LINK(CF__CURSES_HEAD,
1248 long foo = (long)(&${cf_func});
1249 if (foo + 1234 > 5678)
1250 ${cf_cv_main_return:-return}(foo);
1256 eval 'cf_cv_func_'$cf_func'=$cf_result'
1258 # use the computed/retrieved cache-value:
1259 eval 'cf_result=$cf_cv_func_'$cf_func
1260 AC_MSG_RESULT($cf_result)
1261 if test $cf_result != no; then
1262 AC_DEFINE_UNQUOTED(HAVE_${cf_tr_func})
1266 dnl ---------------------------------------------------------------------------
1267 dnl CF_CURSES_HEADER version: 3 updated: 2011/05/01 19:47:45
1268 dnl ----------------
1269 dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
1270 dnl variations of ncurses' installs.
1272 dnl $1 = ncurses when looking for ncurses, or is empty
1273 AC_DEFUN([CF_CURSES_HEADER],[
1274 AC_CACHE_CHECK(if we have identified curses headers,cf_cv_ncurses_header,[
1275 cf_cv_ncurses_header=none
1276 for cf_header in ifelse($1,,,[ \
1280 curses.h ifelse($1,,[ncurses/ncurses.h ncurses/curses.h])
1282 AC_TRY_COMPILE([#include <${cf_header}>],
1283 [initscr(); tgoto("?", 0,0)],
1284 [cf_cv_ncurses_header=$cf_header; break],[])
1288 if test "$cf_cv_ncurses_header" = none ; then
1289 AC_MSG_ERROR(No curses header-files found)
1292 # cheat, to get the right #define's for HAVE_NCURSES_H, etc.
1293 AC_CHECK_HEADERS($cf_cv_ncurses_header)
1295 dnl ---------------------------------------------------------------------------
1296 dnl CF_CURSES_LIBS version: 36 updated: 2012/07/07 21:02:48
1298 dnl Look for the curses libraries. Older curses implementations may require
1299 dnl termcap/termlib to be linked as well. Call CF_CURSES_CPPFLAGS first.
1300 AC_DEFUN([CF_CURSES_LIBS],[
1302 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
1303 AC_MSG_CHECKING(if we have identified curses libraries)
1304 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
1305 [initscr(); tgoto("?", 0,0)],
1308 AC_MSG_RESULT($cf_result)
1310 if test "$cf_result" = no ; then
1311 case $host_os in #(vi
1313 AC_CHECK_LIB(mytinfo,tgoto,[CF_ADD_LIBS(-lmytinfo)])
1316 # Looking at HPUX 10.20, the Hcurses library is the oldest (1997), cur_colr
1317 # next (1998), and xcurses "newer" (2000). There is no header file for
1318 # Hcurses; the subdirectory curses_colr has the headers (curses.h and
1319 # term.h) for cur_colr
1320 if test "x$cf_cv_screen" = "xcurses_colr"
1322 AC_CHECK_LIB(cur_colr,initscr,[
1323 CF_ADD_LIBS(-lcur_colr)
1324 ac_cv_func_initscr=yes
1326 AC_CHECK_LIB(Hcurses,initscr,[
1327 # HP's header uses __HP_CURSES, but user claims _HP_CURSES.
1328 CF_ADD_LIBS(-lHcurses)
1329 CPPFLAGS="$CPPFLAGS -D__HP_CURSES -D_HP_CURSES"
1330 ac_cv_func_initscr=yes
1335 case `arch 2>/dev/null` in
1339 CF_ADD_LIBDIR(/lib64)
1350 if test "x$cf_cv_screen" = "xcurses_5lib"
1352 if test -d /usr/5lib ; then
1353 CF_ADD_LIBDIR(/usr/5lib)
1354 CF_ADD_LIBS(-lcurses -ltermcap)
1357 ac_cv_func_initscr=yes
1361 if test ".$ac_cv_func_initscr" != .yes ; then
1362 cf_save_LIBS="$LIBS"
1366 if test ".${cf_cv_ncurses_version:-no}" != .no
1368 cf_check_list="ncurses curses cursesX"
1370 cf_check_list="cursesX curses ncurses"
1373 # Check for library containing tgoto. Do this before curses library
1374 # because it may be needed to link the test-case for initscr.
1375 AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[
1376 for cf_term_lib in $cf_check_list otermcap termcap tinfo termlib unknown
1378 AC_CHECK_LIB($cf_term_lib,tgoto,[break])
1382 # Check for library containing initscr
1383 test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS"
1384 for cf_curs_lib in $cf_check_list xcurses jcurses pdcurses unknown
1386 AC_CHECK_LIB($cf_curs_lib,initscr,[break])
1388 test $cf_curs_lib = unknown && AC_MSG_ERROR(no curses library found)
1390 LIBS="-l$cf_curs_lib $cf_save_LIBS"
1391 if test "$cf_term_lib" = unknown ; then
1392 AC_MSG_CHECKING(if we can link with $cf_curs_lib library)
1393 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
1397 AC_MSG_RESULT($cf_result)
1398 test $cf_result = no && AC_MSG_ERROR(Cannot link curses library)
1399 elif test "$cf_curs_lib" = "$cf_term_lib" ; then
1401 elif test "$cf_term_lib" != predefined ; then
1402 AC_MSG_CHECKING(if we need both $cf_curs_lib and $cf_term_lib libraries)
1403 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
1404 [initscr(); tgoto((char *)0, 0, 0);],
1407 LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS"
1408 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
1413 AC_MSG_RESULT($cf_result)
1419 dnl ---------------------------------------------------------------------------
1420 dnl CF_CURSES_TERM_H version: 10 updated: 2012/10/06 08:57:51
1421 dnl ----------------
1422 dnl SVr4 curses should have term.h as well (where it puts the definitions of
1423 dnl the low-level interface). This may not be true in old/broken implementations,
1424 dnl as well as in misconfigured systems (e.g., gcc configured for Solaris 2.4
1425 dnl running with Solaris 2.5.1).
1426 AC_DEFUN([CF_CURSES_TERM_H],
1428 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
1430 AC_CACHE_CHECK(for term.h, cf_cv_term_header,[
1432 # If we found <ncurses/curses.h>, look for <ncurses/term.h>, but always look
1433 # for <term.h> if we do not find the variant.
1435 cf_header_list="term.h ncurses/term.h ncursesw/term.h"
1437 case ${cf_cv_ncurses_header:-curses.h} in #(vi
1439 cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`term.h
1440 cf_header_list="$cf_header_item $cf_header_list"
1444 for cf_header in $cf_header_list
1447 #include <${cf_cv_ncurses_header:-curses.h}>
1448 #include <${cf_header}>],
1450 [cf_cv_term_header=$cf_header
1452 [cf_cv_term_header=no])
1455 case $cf_cv_term_header in #(vi
1457 # If curses is ncurses, some packagers still mess it up by trying to make
1458 # us use GNU termcap. This handles the most common case.
1459 for cf_header in ncurses/term.h ncursesw/term.h
1462 #include <${cf_cv_ncurses_header:-curses.h}>
1463 #ifdef NCURSES_VERSION
1464 #include <${cf_header}>
1469 [cf_cv_term_header=$cf_header
1471 [cf_cv_term_header=no])
1477 case $cf_cv_term_header in #(vi
1479 AC_DEFINE(HAVE_TERM_H,1,[Define to 1 if we have term.h])
1481 ncurses/term.h) #(vi
1482 AC_DEFINE(HAVE_NCURSES_TERM_H,1,[Define to 1 if we have ncurses/term.h])
1485 AC_DEFINE(HAVE_NCURSESW_TERM_H,1,[Define to 1 if we have ncursesw/term.h])
1489 dnl ---------------------------------------------------------------------------
1490 dnl CF_CURSES_UNCTRL_H version: 2 updated: 2012/10/06 08:57:51
1491 dnl ------------------
1492 dnl Any X/Open curses implementation must have unctrl.h, but ncurses packages
1493 dnl may put it in a subdirectory (along with ncurses' other headers, of
1494 dnl course). Packages which put the headers in inconsistent locations are
1496 AC_DEFUN([CF_CURSES_UNCTRL_H],
1498 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
1500 AC_CACHE_CHECK(for unctrl.h, cf_cv_unctrl_header,[
1502 # If we found <ncurses/curses.h>, look for <ncurses/unctrl.h>, but always look
1503 # for <unctrl.h> if we do not find the variant.
1505 cf_header_list="unctrl.h ncurses/unctrl.h ncursesw/unctrl.h"
1507 case ${cf_cv_ncurses_header:-curses.h} in #(vi
1509 cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`unctrl.h
1510 cf_header_list="$cf_header_item $cf_header_list"
1514 for cf_header in $cf_header_list
1517 #include <${cf_cv_ncurses_header:-curses.h}>
1518 #include <${cf_header}>],
1520 [cf_cv_unctrl_header=$cf_header
1522 [cf_cv_unctrl_header=no])
1525 case $cf_cv_unctrl_header in #(vi
1527 AC_MSG_WARN(unctrl.h header not found)
1532 case $cf_cv_unctrl_header in #(vi
1534 AC_DEFINE(HAVE_UNCTRL_H,1,[Define to 1 if we have unctrl.h])
1536 ncurses/unctrl.h) #(vi
1537 AC_DEFINE(HAVE_NCURSES_UNCTRL_H,1,[Define to 1 if we have ncurses/unctrl.h])
1540 AC_DEFINE(HAVE_NCURSESW_UNCTRL_H,1,[Define to 1 if we have ncursesw/unctrl.h])
1544 dnl ---------------------------------------------------------------------------
1545 dnl CF_CURSES_WACS_MAP version: 6 updated: 2012/10/06 08:57:51
1546 dnl ------------------
1547 dnl Check for likely values of wacs_map[].
1548 AC_DEFUN([CF_CURSES_WACS_MAP],
1550 AC_CACHE_CHECK(for wide alternate character set array, cf_cv_curses_wacs_map,[
1551 cf_cv_curses_wacs_map=unknown
1552 for name in wacs_map _wacs_map __wacs_map _nc_wacs _wacs_char
1555 #ifndef _XOPEN_SOURCE_EXTENDED
1556 #define _XOPEN_SOURCE_EXTENDED
1558 #include <${cf_cv_ncurses_header:-curses.h}>],
1559 [void *foo = &($name['k'])],
1560 [cf_cv_curses_wacs_map=$name
1564 test "$cf_cv_curses_wacs_map" != unknown && AC_DEFINE_UNQUOTED(CURSES_WACS_ARRAY,$cf_cv_curses_wacs_map,[Define to name of (n)curses wide-character array])
1566 dnl ---------------------------------------------------------------------------
1567 dnl CF_CURSES_WACS_SYMBOLS version: 2 updated: 2012/10/06 08:57:51
1568 dnl ----------------------
1569 dnl Do a check to see if the WACS_xxx constants are defined compatibly with
1570 dnl X/Open Curses. In particular, NetBSD's implementation of the WACS_xxx
1571 dnl constants is broken since those constants do not point to cchar_t's.
1572 AC_DEFUN([CF_CURSES_WACS_SYMBOLS],
1574 AC_REQUIRE([CF_CURSES_WACS_MAP])
1576 AC_CACHE_CHECK(for wide alternate character constants, cf_cv_curses_wacs_symbols,[
1577 cf_cv_curses_wacs_symbols=no
1578 if test "$cf_cv_curses_wacs_map" != unknown
1581 #ifndef _XOPEN_SOURCE_EXTENDED
1582 #define _XOPEN_SOURCE_EXTENDED
1584 #include <${cf_cv_ncurses_header:-curses.h}>],
1585 [cchar_t *foo = WACS_PLUS;
1586 $cf_cv_curses_wacs_map['k'] = *WACS_PLUS],
1587 [cf_cv_curses_wacs_symbols=yes])
1590 #ifndef _XOPEN_SOURCE_EXTENDED
1591 #define _XOPEN_SOURCE_EXTENDED
1593 #include <${cf_cv_ncurses_header:-curses.h}>],
1594 [cchar_t *foo = WACS_PLUS],
1595 [cf_cv_curses_wacs_symbols=yes])
1599 test "$cf_cv_curses_wacs_symbols" != no && AC_DEFINE(CURSES_WACS_SYMBOLS,1,[Define to 1 if (n)curses supports wide-character WACS_ symbols])
1601 dnl ---------------------------------------------------------------------------
1602 dnl CF_CURSES_WGETPARENT version: 3 updated: 2012/10/06 08:57:51
1603 dnl --------------------
1604 dnl Check for curses support for directly determining the parent of a given
1605 dnl window. Some implementations make this difficult, so we provide for
1606 dnl defining an application-specific function that gives this functionality.
1608 dnl $1 = name of function to use if the feature is missing
1609 AC_DEFUN([CF_CURSES_WGETPARENT],[
1610 CF_CURSES_FUNCS(wgetparent)
1611 if test "x$cf_cv_func_wgetparent" != xyes
1613 AC_MSG_CHECKING(if WINDOW has _parent member)
1614 AC_TRY_COMPILE([#include <${cf_cv_ncurses_header:-curses.h}>],
1615 [WINDOW *p = stdscr->_parent],
1616 [cf_window__parent=yes],
1617 [cf_window__parent=no])
1618 AC_MSG_RESULT($cf_window__parent)
1619 if test "$cf_window__parent" = yes
1621 AC_DEFINE(HAVE_WINDOW__PARENT,1,[Define to 1 if WINDOW struct has _parent member])
1625 dnl ---------------------------------------------------------------------------
1626 dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52
1628 dnl "dirname" is not portable, so we fake it with a shell script.
1629 AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl
1630 dnl ---------------------------------------------------------------------------
1631 dnl CF_DISABLE_ECHO version: 12 updated: 2012/10/06 16:30:28
1633 dnl You can always use "make -n" to see the actual options, but it's hard to
1634 dnl pick out/analyze warning messages when the compile-line is long.
1637 dnl ECHO_LT - symbol to control if libtool is verbose
1638 dnl ECHO_LD - symbol to prefix "cc -o" lines
1639 dnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o)
1640 dnl SHOW_CC - symbol to put before explicit "cc -c" lines
1641 dnl ECHO_CC - symbol to put before any "cc" line
1643 AC_DEFUN([CF_DISABLE_ECHO],[
1644 AC_MSG_CHECKING(if you want to see long compiling messages)
1645 CF_ARG_DISABLE(echo,
1646 [ --disable-echo do not display "compiling" commands],
1649 ECHO_LD='@echo linking [$]@;'
1650 RULE_CC='@echo compiling [$]<'
1651 SHOW_CC='@echo compiling [$]@'
1660 AC_MSG_RESULT($enableval)
1667 dnl ---------------------------------------------------------------------------
1668 dnl CF_DISABLE_LIBTOOL_VERSION version: 1 updated: 2010/05/15 15:45:59
1669 dnl --------------------------
1670 dnl Check if we should use the libtool 1.5 feature "-version-number" instead of
1671 dnl the older "-version-info" feature. The newer feature allows us to use
1672 dnl version numbering on shared libraries which make them compatible with
1673 dnl various systems.
1674 AC_DEFUN([CF_DISABLE_LIBTOOL_VERSION],
1676 AC_MSG_CHECKING(if libtool -version-number should be used)
1677 CF_ARG_DISABLE(libtool-version,
1678 [ --disable-libtool-version enable to use libtool's incompatible naming scheme],
1679 [cf_libtool_version=no],
1680 [cf_libtool_version=yes])
1681 AC_MSG_RESULT($cf_libtool_version)
1683 if test "$cf_libtool_version" = yes ; then
1684 LIBTOOL_VERSION="-version-number"
1686 LIBTOOL_VERSION="-version-info"
1689 AC_SUBST(LIBTOOL_VERSION)
1691 dnl ---------------------------------------------------------------------------
1692 dnl CF_DISABLE_RPATH_HACK version: 2 updated: 2011/02/13 13:31:33
1693 dnl ---------------------
1694 dnl The rpath-hack makes it simpler to build programs, particularly with the
1695 dnl *BSD ports which may have essential libraries in unusual places. But it
1696 dnl can interfere with building an executable for the base system. Use this
1697 dnl option in that case.
1698 AC_DEFUN([CF_DISABLE_RPATH_HACK],
1700 AC_MSG_CHECKING(if rpath-hack should be disabled)
1701 CF_ARG_DISABLE(rpath-hack,
1702 [ --disable-rpath-hack don't add rpath options for additional libraries],
1703 [cf_disable_rpath_hack=yes],
1704 [cf_disable_rpath_hack=no])
1705 AC_MSG_RESULT($cf_disable_rpath_hack)
1706 if test "$cf_disable_rpath_hack" = no ; then
1710 dnl ---------------------------------------------------------------------------
1711 dnl CF_FIND_LIBRARY version: 9 updated: 2008/03/23 14:48:54
1713 dnl Look for a non-standard library, given parameters for AC_TRY_LINK. We
1714 dnl prefer a standard location, and use -L options only if we do not find the
1715 dnl library in the standard library location(s).
1716 dnl $1 = library name
1717 dnl $2 = library class, usually the same as library name
1719 dnl $4 = code fragment to compile/link
1720 dnl $5 = corresponding function-name
1721 dnl $6 = flag, nonnull if failure should not cause an error-exit
1723 dnl Sets the variable "$cf_libdir" as a side-effect, so we can see if we had
1724 dnl to use a -L option.
1725 AC_DEFUN([CF_FIND_LIBRARY],
1727 eval 'cf_cv_have_lib_'$1'=no'
1730 eval 'cf_cv_have_lib_'$1'=yes',[
1731 cf_save_LIBS="$LIBS"
1732 AC_MSG_CHECKING(for $5 in -l$1)
1734 AC_TRY_LINK([$3],[$4],
1736 eval 'cf_cv_have_lib_'$1'=yes'
1739 CF_LIBRARY_PATH(cf_search,$2)
1740 for cf_libdir in $cf_search
1742 AC_MSG_CHECKING(for -l$1 in $cf_libdir)
1743 LIBS="-L$cf_libdir -l$1 $cf_save_LIBS"
1744 AC_TRY_LINK([$3],[$4],
1746 eval 'cf_cv_have_lib_'$1'=yes'
1749 LIBS="$cf_save_LIBS"])
1753 eval 'cf_found_library=[$]cf_cv_have_lib_'$1
1755 if test $cf_found_library = no ; then
1756 AC_MSG_ERROR(Cannot link $1 library)
1760 dnl ---------------------------------------------------------------------------
1761 dnl CF_FIND_LINKAGE version: 19 updated: 2010/05/29 16:31:02
1763 dnl Find a library (specifically the linkage used in the code fragment),
1764 dnl searching for it if it is not already in the library path.
1765 dnl See also CF_ADD_SEARCHPATH.
1767 dnl Parameters (4-on are optional):
1768 dnl $1 = headers for library entrypoint
1769 dnl $2 = code fragment for library entrypoint
1770 dnl $3 = the library name without the "-l" option or ".so" suffix.
1771 dnl $4 = action to perform if successful (default: update CPPFLAGS, etc)
1772 dnl $5 = action to perform if not successful
1773 dnl $6 = module name, if not the same as the library name
1774 dnl $7 = extra libraries
1776 dnl Sets these variables:
1777 dnl $cf_cv_find_linkage_$3 - yes/no according to whether linkage is found
1778 dnl $cf_cv_header_path_$3 - include-directory if needed
1779 dnl $cf_cv_library_path_$3 - library-directory if needed
1780 dnl $cf_cv_library_file_$3 - library-file if needed, e.g., -l$3
1781 AC_DEFUN([CF_FIND_LINKAGE],[
1783 # If the linkage is not already in the $CPPFLAGS/$LDFLAGS configuration, these
1784 # will be set on completion of the AC_TRY_LINK below.
1785 cf_cv_header_path_$3=
1786 cf_cv_library_path_$3=
1788 CF_MSG_LOG([Starting [FIND_LINKAGE]($3,$6)])
1790 cf_save_LIBS="$LIBS"
1792 AC_TRY_LINK([$1],[$2],[
1793 cf_cv_find_linkage_$3=yes
1794 cf_cv_header_path_$3=/usr/include
1795 cf_cv_library_path_$3=/usr/lib
1798 LIBS="-l$3 $7 $cf_save_LIBS"
1800 AC_TRY_LINK([$1],[$2],[
1801 cf_cv_find_linkage_$3=yes
1802 cf_cv_header_path_$3=/usr/include
1803 cf_cv_library_path_$3=/usr/lib
1804 cf_cv_library_file_$3="-l$3"
1806 cf_cv_find_linkage_$3=no
1807 LIBS="$cf_save_LIBS"
1809 CF_VERBOSE(find linkage for $3 library)
1810 CF_MSG_LOG([Searching for headers in [FIND_LINKAGE]($3,$6)])
1812 cf_save_CPPFLAGS="$CPPFLAGS"
1813 cf_test_CPPFLAGS="$CPPFLAGS"
1815 CF_HEADER_PATH(cf_search,ifelse([$6],,[$3],[$6]))
1816 for cf_cv_header_path_$3 in $cf_search
1818 if test -d $cf_cv_header_path_$3 ; then
1819 CF_VERBOSE(... testing $cf_cv_header_path_$3)
1820 CPPFLAGS="$cf_save_CPPFLAGS -I$cf_cv_header_path_$3"
1821 AC_TRY_COMPILE([$1],[$2],[
1822 CF_VERBOSE(... found $3 headers in $cf_cv_header_path_$3)
1823 cf_cv_find_linkage_$3=maybe
1824 cf_test_CPPFLAGS="$CPPFLAGS"
1826 CPPFLAGS="$cf_save_CPPFLAGS"
1831 if test "$cf_cv_find_linkage_$3" = maybe ; then
1833 CF_MSG_LOG([Searching for $3 library in [FIND_LINKAGE]($3,$6)])
1835 cf_save_LIBS="$LIBS"
1836 cf_save_LDFLAGS="$LDFLAGS"
1839 CPPFLAGS="$cf_test_CPPFLAGS"
1840 LIBS="-l$3 $7 $cf_save_LIBS"
1841 AC_TRY_LINK([$1],[$2],[
1842 CF_VERBOSE(... found $3 library in system)
1843 cf_cv_find_linkage_$3=yes])
1844 CPPFLAGS="$cf_save_CPPFLAGS"
1845 LIBS="$cf_save_LIBS"
1848 if test "$cf_cv_find_linkage_$3" != yes ; then
1849 CF_LIBRARY_PATH(cf_search,$3)
1850 for cf_cv_library_path_$3 in $cf_search
1852 if test -d $cf_cv_library_path_$3 ; then
1853 CF_VERBOSE(... testing $cf_cv_library_path_$3)
1854 CPPFLAGS="$cf_test_CPPFLAGS"
1855 LIBS="-l$3 $7 $cf_save_LIBS"
1856 LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_$3"
1857 AC_TRY_LINK([$1],[$2],[
1858 CF_VERBOSE(... found $3 library in $cf_cv_library_path_$3)
1859 cf_cv_find_linkage_$3=yes
1860 cf_cv_library_file_$3="-l$3"
1862 CPPFLAGS="$cf_save_CPPFLAGS"
1863 LIBS="$cf_save_LIBS"
1864 LDFLAGS="$cf_save_LDFLAGS"
1868 CPPFLAGS="$cf_save_CPPFLAGS"
1869 LDFLAGS="$cf_save_LDFLAGS"
1873 cf_cv_find_linkage_$3=no
1878 LIBS="$cf_save_LIBS"
1880 if test "$cf_cv_find_linkage_$3" = yes ; then
1882 CF_ADD_INCDIR($cf_cv_header_path_$3)
1883 CF_ADD_LIBDIR($cf_cv_library_path_$3)
1887 ifelse([$5],,AC_MSG_WARN(Cannot find $3 library),[$5])
1890 dnl ---------------------------------------------------------------------------
1891 dnl CF_FUNC_WAIT version: 3 updated: 2012/10/06 08:57:51
1893 dnl Test for the presence of <sys/wait.h>, 'union wait', arg-type of 'wait()'
1894 dnl and/or 'waitpid()'.
1896 dnl Note that we cannot simply grep for 'union wait' in the wait.h file,
1897 dnl because some Posix systems turn this on only when a BSD variable is
1900 dnl I don't use AC_HEADER_SYS_WAIT, because it defines HAVE_SYS_WAIT_H, which
1901 dnl would conflict with an attempt to test that header directly.
1903 AC_DEFUN([CF_FUNC_WAIT],
1905 AC_REQUIRE([CF_UNION_WAIT])
1906 if test $cf_cv_type_unionwait = yes; then
1908 AC_MSG_CHECKING(if union wait can be used as wait-arg)
1909 AC_CACHE_VAL(cf_cv_arg_union_wait,[
1910 AC_TRY_COMPILE($cf_wait_headers,
1911 [union wait x; wait(&x)],
1912 [cf_cv_arg_union_wait=yes],
1913 [cf_cv_arg_union_wait=no])
1915 AC_MSG_RESULT($cf_cv_arg_union_wait)
1916 test $cf_cv_arg_union_wait = yes && AC_DEFINE(WAIT_USES_UNION,1,[Define to 1 if wait() uses a union parameter])
1918 AC_MSG_CHECKING(if union wait can be used as waitpid-arg)
1919 AC_CACHE_VAL(cf_cv_arg_union_waitpid,[
1920 AC_TRY_COMPILE($cf_wait_headers,
1921 [union wait x; waitpid(0, &x, 0)],
1922 [cf_cv_arg_union_waitpid=yes],
1923 [cf_cv_arg_union_waitpid=no])
1925 AC_MSG_RESULT($cf_cv_arg_union_waitpid)
1926 test $cf_cv_arg_union_waitpid = yes && AC_DEFINE(WAITPID_USES_UNION,1,[Define to 1 if waitpid() uses a union parameter])
1930 dnl ---------------------------------------------------------------------------
1931 dnl CF_GCC_ATTRIBUTES version: 16 updated: 2012/10/02 20:55:03
1932 dnl -----------------
1933 dnl Test for availability of useful gcc __attribute__ directives to quiet
1934 dnl compiler warnings. Though useful, not all are supported -- and contrary
1935 dnl to documentation, unrecognized directives cause older compilers to barf.
1936 AC_DEFUN([CF_GCC_ATTRIBUTES],
1938 if test "$GCC" = yes
1940 cat > conftest.i <<EOF
1942 #define GCC_PRINTF 0
1947 #ifndef GCC_NORETURN
1948 #define GCC_NORETURN /* nothing */
1951 #define GCC_UNUSED /* nothing */
1954 if test "$GCC" = yes
1956 AC_CHECKING([for $CC __attribute__ directives])
1957 cat > conftest.$ac_ext <<EOF
1958 #line __oline__ "${as_me:-configure}"
1959 #include "confdefs.h"
1960 #include "conftest.h"
1961 #include "conftest.i"
1963 #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
1965 #define GCC_PRINTFLIKE(fmt,var) /*nothing*/
1968 #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
1970 #define GCC_SCANFLIKE(fmt,var) /*nothing*/
1972 extern void wow(char *,...) GCC_SCANFLIKE(1,2);
1973 extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
1974 extern void foo(void) GCC_NORETURN;
1975 int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; }
1977 cf_printf_attribute=no
1978 cf_scanf_attribute=no
1979 for cf_attribute in scanf printf unused noreturn
1981 CF_UPPER(cf_ATTRIBUTE,$cf_attribute)
1982 cf_directive="__attribute__(($cf_attribute))"
1983 echo "checking for $CC $cf_directive" 1>&AC_FD_CC
1985 case $cf_attribute in #(vi
1987 cf_printf_attribute=yes
1988 cat >conftest.h <<EOF
1989 #define GCC_$cf_ATTRIBUTE 1
1993 cf_scanf_attribute=yes
1994 cat >conftest.h <<EOF
1995 #define GCC_$cf_ATTRIBUTE 1
1999 cat >conftest.h <<EOF
2000 #define GCC_$cf_ATTRIBUTE $cf_directive
2005 if AC_TRY_EVAL(ac_compile); then
2006 test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute)
2007 cat conftest.h >>confdefs.h
2008 case $cf_attribute in #(vi
2010 AC_DEFINE_UNQUOTED(GCC_NORETURN,$cf_directive,[Define to noreturn-attribute for gcc])
2013 cf_value='/* nothing */'
2014 if test "$cf_printf_attribute" != no ; then
2015 cf_value='__attribute__((format(printf,fmt,var)))'
2016 AC_DEFINE(GCC_PRINTF,1,[Define to 1 if the compiler supports gcc-like printf attribute.])
2018 AC_DEFINE_UNQUOTED(GCC_PRINTFLIKE(fmt,var),$cf_value,[Define to printf-attribute for gcc])
2021 cf_value='/* nothing */'
2022 if test "$cf_scanf_attribute" != no ; then
2023 cf_value='__attribute__((format(scanf,fmt,var)))'
2024 AC_DEFINE(GCC_SCANF,1,[Define to 1 if the compiler supports gcc-like scanf attribute.])
2026 AC_DEFINE_UNQUOTED(GCC_SCANFLIKE(fmt,var),$cf_value,[Define to sscanf-attribute for gcc])
2029 AC_DEFINE_UNQUOTED(GCC_UNUSED,$cf_directive,[Define to unused-attribute for gcc])
2035 fgrep define conftest.i >>confdefs.h
2040 dnl ---------------------------------------------------------------------------
2041 dnl CF_GCC_VERSION version: 7 updated: 2012/10/18 06:46:33
2043 dnl Find version of gcc
2044 AC_DEFUN([CF_GCC_VERSION],[
2045 AC_REQUIRE([AC_PROG_CC])
2047 if test "$GCC" = yes ; then
2048 AC_MSG_CHECKING(version of $CC)
2049 GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC[[^)]]*) //' -e 's/^.*(Debian[[^)]]*) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
2050 test -z "$GCC_VERSION" && GCC_VERSION=unknown
2051 AC_MSG_RESULT($GCC_VERSION)
2054 dnl ---------------------------------------------------------------------------
2055 dnl CF_GCC_WARNINGS version: 29 updated: 2012/06/16 14:55:39
2057 dnl Check if the compiler supports useful warning options. There's a few that
2058 dnl we don't use, simply because they're too noisy:
2060 dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x)
2061 dnl -Wredundant-decls (system headers make this too noisy)
2062 dnl -Wtraditional (combines too many unrelated messages, only a few useful)
2063 dnl -Wwrite-strings (too noisy, but should review occasionally). This
2064 dnl is enabled for ncurses using "--enable-const".
2068 dnl $1 is an optional list of gcc warning flags that a particular
2069 dnl application might want to use, e.g., "no-unused" for
2072 dnl If $with_ext_const is "yes", add a check for -Wwrite-strings
2074 AC_DEFUN([CF_GCC_WARNINGS],
2076 AC_REQUIRE([CF_GCC_VERSION])
2077 CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)
2078 CF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS)
2080 cat > conftest.$ac_ext <<EOF
2081 #line __oline__ "${as_me:-configure}"
2082 int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
2085 if test "$INTEL_COMPILER" = yes
2087 # The "-wdXXX" options suppress warnings:
2088 # remark #1419: external declaration in primary source file
2089 # remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
2090 # remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
2091 # remark #193: zero used for undefined preprocessing identifier
2092 # remark #593: variable "curs_sb_left_arrow" was set but never used
2093 # remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
2094 # remark #869: parameter "tw" was never referenced
2095 # remark #981: operands are evaluated in unspecified order
2096 # warning #279: controlling expression is constant
2098 AC_CHECKING([for $CC warning options])
2099 cf_save_CFLAGS="$CFLAGS"
2100 EXTRA_CFLAGS="-Wall"
2112 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
2113 if AC_TRY_EVAL(ac_compile); then
2114 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
2115 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
2118 CFLAGS="$cf_save_CFLAGS"
2120 elif test "$GCC" = yes
2122 AC_CHECKING([for $CC warning options])
2123 cf_save_CFLAGS="$CFLAGS"
2126 test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
2127 for cf_opt in W Wall \
2128 Wbad-function-cast \
2132 Wmissing-declarations \
2133 Wmissing-prototypes \
2137 Wstrict-prototypes \
2138 Wundef $cf_warn_CONST $1
2140 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
2141 if AC_TRY_EVAL(ac_compile); then
2142 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
2143 case $cf_opt in #(vi
2145 CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES"
2148 case $GCC_VERSION in
2150 CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
2154 Wpointer-arith) #(vi
2155 case $GCC_VERSION in
2157 CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
2162 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
2165 CFLAGS="$cf_save_CFLAGS"
2169 AC_SUBST(EXTRA_CFLAGS)
2171 dnl ---------------------------------------------------------------------------
2172 dnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07
2174 dnl Check if we must define _GNU_SOURCE to get a reasonable value for
2175 dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect
2176 dnl (or misfeature) of glibc2, which breaks portability of many applications,
2177 dnl since it is interwoven with GNU extensions.
2179 dnl Well, yes we could work around it...
2180 AC_DEFUN([CF_GNU_SOURCE],
2182 AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[
2183 AC_TRY_COMPILE([#include <sys/types.h>],[
2184 #ifndef _XOPEN_SOURCE
2187 [cf_cv_gnu_source=no],
2188 [cf_save="$CPPFLAGS"
2189 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
2190 AC_TRY_COMPILE([#include <sys/types.h>],[
2191 #ifdef _XOPEN_SOURCE
2194 [cf_cv_gnu_source=no],
2195 [cf_cv_gnu_source=yes])
2199 test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
2201 dnl ---------------------------------------------------------------------------
2202 dnl CF_HEADERS_SH version: 1 updated: 2007/07/04 15:37:05
2204 dnl Setup variables needed to construct headers-sh
2205 AC_DEFUN([CF_HEADERS_SH],[
2208 AC_SUBST(PACKAGE_PREFIX)
2209 AC_SUBST(PACKAGE_CONFIG)
2210 EXTRA_OUTPUT="$EXTRA_OUTPUT headers-sh:$srcdir/headers-sh.in"
2212 dnl ---------------------------------------------------------------------------
2213 dnl CF_HEADER_PATH version: 12 updated: 2010/05/05 05:22:40
2215 dnl Construct a search-list of directories for a nonstandard header-file
2218 dnl $1 = the variable to return as result
2219 dnl $2 = the package name
2220 AC_DEFUN([CF_HEADER_PATH],
2224 # collect the current set of include-directories from compiler flags
2225 cf_header_path_list=""
2226 if test -n "${CFLAGS}${CPPFLAGS}" ; then
2227 for cf_header_path in $CPPFLAGS $CFLAGS
2229 case $cf_header_path in #(vi
2231 cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'`
2232 CF_ADD_SUBDIR_PATH($1,$2,include,$cf_header_path,NONE)
2233 cf_header_path_list="$cf_header_path_list [$]$1"
2239 # add the variations for the package we are looking for
2240 CF_SUBDIR_PATH($1,$2,include)
2242 test "$includedir" != NONE && \
2243 test "$includedir" != "/usr/include" && \
2244 test -d "$includedir" && {
2245 test -d $includedir && $1="[$]$1 $includedir"
2246 test -d $includedir/$2 && $1="[$]$1 $includedir/$2"
2249 test "$oldincludedir" != NONE && \
2250 test "$oldincludedir" != "/usr/include" && \
2251 test -d "$oldincludedir" && {
2252 test -d $oldincludedir && $1="[$]$1 $oldincludedir"
2253 test -d $oldincludedir/$2 && $1="[$]$1 $oldincludedir/$2"
2256 $1="[$]$1 $cf_header_path_list"
2258 dnl ---------------------------------------------------------------------------
2259 dnl CF_INTEL_COMPILER version: 4 updated: 2010/05/26 05:38:42
2260 dnl -----------------
2261 dnl Check if the given compiler is really the Intel compiler for Linux. It
2262 dnl tries to imitate gcc, but does not return an error when it finds a mismatch
2263 dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK.
2265 dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
2266 dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from
2267 dnl the wrappers for gcc and g++ warnings.
2269 dnl $1 = GCC (default) or GXX
2270 dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
2271 dnl $3 = CFLAGS (default) or CXXFLAGS
2272 AC_DEFUN([CF_INTEL_COMPILER],[
2273 ifelse([$2],,INTEL_COMPILER,[$2])=no
2275 if test "$ifelse([$1],,[$1],GCC)" = yes ; then
2278 AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler)
2279 cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])"
2280 ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc"
2282 #ifdef __INTEL_COMPILER
2286 ],[ifelse([$2],,INTEL_COMPILER,[$2])=yes
2287 cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc"
2289 ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
2290 AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2]))
2295 dnl ---------------------------------------------------------------------------
2296 dnl CF_LARGEFILE version: 8 updated: 2012/10/06 08:57:51
2298 dnl Add checks for large file support.
2299 AC_DEFUN([CF_LARGEFILE],[
2300 ifdef([AC_FUNC_FSEEKO],[
2302 if test "$enable_largefile" != no ; then
2305 # Normally we would collect these definitions in the config.h,
2306 # but (like _XOPEN_SOURCE), some environments rely on having these
2307 # defined before any of the system headers are included. Another
2308 # case comes up with C++, e.g., on AIX the compiler compiles the
2309 # header files by themselves before looking at the body files it is
2310 # told to compile. For ncurses, those header files do not include
2312 test "$ac_cv_sys_large_files" != no && CPPFLAGS="$CPPFLAGS -D_LARGE_FILES "
2313 test "$ac_cv_sys_largefile_source" != no && CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE "
2314 test "$ac_cv_sys_file_offset_bits" != no && CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits "
2316 AC_CACHE_CHECK(whether to use struct dirent64, cf_cv_struct_dirent64,[
2318 #include <sys/types.h>
2321 /* if transitional largefile support is setup, this is true */
2322 extern struct dirent64 * readdir(DIR *);
2323 struct dirent64 *x = readdir((DIR *)0);
2324 struct dirent *y = readdir((DIR *)0);
2327 [cf_cv_struct_dirent64=yes],
2328 [cf_cv_struct_dirent64=no])
2330 test "$cf_cv_struct_dirent64" = yes && AC_DEFINE(HAVE_STRUCT_DIRENT64,1,[Define to 1 if we have struct dirent64])
2334 dnl ---------------------------------------------------------------------------
2335 dnl CF_LD_RPATH_OPT version: 5 updated: 2011/07/17 14:48:41
2337 dnl For the given system and compiler, find the compiler flags to pass to the
2338 dnl loader to use the "rpath" feature.
2339 AC_DEFUN([CF_LD_RPATH_OPT],
2341 AC_REQUIRE([CF_CHECK_CACHE])
2344 AC_MSG_CHECKING(for an rpath option)
2345 case $cf_cv_system_name in #(vi
2347 if test "$GCC" = yes; then
2348 LD_RPATH_OPT="-Wl,-rpath,"
2350 LD_RPATH_OPT="-rpath "
2353 linux*|gnu*|k*bsd*-gnu) #(vi
2354 LD_RPATH_OPT="-Wl,-rpath,"
2356 openbsd[[2-9]].*|mirbsd*) #(vi
2357 LD_RPATH_OPT="-Wl,-rpath,"
2359 dragonfly*|freebsd*) #(vi
2360 LD_RPATH_OPT="-rpath "
2363 LD_RPATH_OPT="-Wl,-rpath,"
2366 LD_RPATH_OPT="-rpath "
2374 AC_MSG_RESULT($LD_RPATH_OPT)
2376 case "x$LD_RPATH_OPT" in #(vi
2378 AC_MSG_CHECKING(if we need a space after rpath option)
2379 cf_save_LIBS="$LIBS"
2380 CF_ADD_LIBS(${LD_RPATH_OPT}$libdir)
2381 AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes)
2382 LIBS="$cf_save_LIBS"
2383 AC_MSG_RESULT($cf_rpath_space)
2384 test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT "
2388 dnl ---------------------------------------------------------------------------
2389 dnl CF_LIBRARY_PATH version: 9 updated: 2010/03/28 12:52:50
2391 dnl Construct a search-list of directories for a nonstandard library-file
2394 dnl $1 = the variable to return as result
2395 dnl $2 = the package name
2396 AC_DEFUN([CF_LIBRARY_PATH],
2399 cf_library_path_list=""
2400 if test -n "${LDFLAGS}${LIBS}" ; then
2401 for cf_library_path in $LDFLAGS $LIBS
2403 case $cf_library_path in #(vi
2405 cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'`
2406 CF_ADD_SUBDIR_PATH($1,$2,lib,$cf_library_path,NONE)
2407 cf_library_path_list="$cf_library_path_list [$]$1"
2413 CF_SUBDIR_PATH($1,$2,lib)
2415 $1="$cf_library_path_list [$]$1"
2417 dnl ---------------------------------------------------------------------------
2418 dnl CF_LIB_PREFIX version: 9 updated: 2012/01/21 19:28:10
2420 dnl Compute the library-prefix for the given host system
2421 dnl $1 = variable to set
2422 define([CF_LIB_PREFIX],
2424 case $cf_cv_system_name in #(vi
2431 ifelse($1,,,[$1=$LIB_PREFIX])
2432 AC_SUBST(LIB_PREFIX)
2434 dnl ---------------------------------------------------------------------------
2435 dnl CF_MAKEFLAGS version: 14 updated: 2011/03/31 19:29:46
2437 dnl Some 'make' programs support ${MAKEFLAGS}, some ${MFLAGS}, to pass 'make'
2438 dnl options to lower-levels. It's very useful for "make -n" -- if we have it.
2439 dnl (GNU 'make' does both, something POSIX 'make', which happens to make the
2440 dnl ${MAKEFLAGS} variable incompatible because it adds the assignments :-)
2441 AC_DEFUN([CF_MAKEFLAGS],
2443 AC_CACHE_CHECK(for makeflags variable, cf_cv_makeflags,[
2445 for cf_option in '-${MAKEFLAGS}' '${MFLAGS}'
2447 cat >cf_makeflags.tmp <<CF_EOF
2450 @ echo '.$cf_option'
2452 cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp 2>/dev/null | fgrep -v "ing directory" | sed -e 's,[[ ]]*$,,'`
2453 case "$cf_result" in
2455 cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp CC=cc 2>/dev/null`
2456 case "$cf_result" in
2457 .*CC=*) cf_cv_makeflags=
2459 *) cf_cv_makeflags=$cf_option
2465 *) echo "given option \"$cf_option\", no match \"$cf_result\""
2469 rm -f cf_makeflags.tmp
2472 AC_SUBST(cf_cv_makeflags)
2474 dnl ---------------------------------------------------------------------------
2475 dnl CF_MAKE_TAGS version: 6 updated: 2010/10/23 15:52:32
2477 dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have
2478 dnl a monocase filesystem.
2479 AC_DEFUN([CF_MAKE_TAGS],[
2480 AC_REQUIRE([CF_MIXEDCASE_FILENAMES])
2482 AC_CHECK_PROGS(CTAGS, exctags ctags)
2483 AC_CHECK_PROGS(ETAGS, exetags etags)
2485 AC_CHECK_PROG(MAKE_LOWER_TAGS, ${CTAGS:-ctags}, yes, no)
2487 if test "$cf_cv_mixedcase" = yes ; then
2488 AC_CHECK_PROG(MAKE_UPPER_TAGS, ${ETAGS:-etags}, yes, no)
2493 if test "$MAKE_UPPER_TAGS" = yes ; then
2499 if test "$MAKE_LOWER_TAGS" = yes ; then
2508 AC_SUBST(MAKE_UPPER_TAGS)
2509 AC_SUBST(MAKE_LOWER_TAGS)
2511 dnl ---------------------------------------------------------------------------
2512 dnl CF_MATH_LIB version: 8 updated: 2010/05/29 16:31:02
2514 dnl Checks for libraries. At least one UNIX system, Apple Macintosh
2515 dnl Rhapsody 5.5, does not have -lm. We cannot use the simpler
2516 dnl AC_CHECK_LIB(m,sin), because that fails for C++.
2517 AC_DEFUN([CF_MATH_LIB],
2519 AC_CACHE_CHECK(if -lm needed for math functions,
2525 [double x = rand(); printf("result = %g\n", ]ifelse([$2],,sin(x),$2)[)],
2526 [cf_cv_need_libm=no],
2527 [cf_cv_need_libm=yes])])
2528 if test "$cf_cv_need_libm" = yes
2535 dnl ---------------------------------------------------------------------------
2536 dnl CF_MBSTATE_T version: 4 updated: 2012/10/06 08:57:51
2538 dnl Check if mbstate_t is declared, and if so, which header file.
2539 dnl This (including wchar.h) is needed on Tru64 5.0 to declare mbstate_t,
2540 dnl as well as include stdio.h to work around a misuse of varargs in wchar.h
2541 AC_DEFUN([CF_MBSTATE_T],
2543 AC_CACHE_CHECK(if we must include wchar.h to declare mbstate_t,cf_cv_mbstate_t,[
2547 #ifdef HAVE_LIBUTF8_H
2548 #include <libutf8.h>
2551 [cf_cv_mbstate_t=no],
2556 #ifdef HAVE_LIBUTF8_H
2557 #include <libutf8.h>
2560 [cf_cv_mbstate_t=yes],
2561 [cf_cv_mbstate_t=unknown])])])
2563 if test "$cf_cv_mbstate_t" = yes ; then
2564 AC_DEFINE(NEED_WCHAR_H,1,[Define to 1 if we must include wchar.h])
2567 if test "$cf_cv_mbstate_t" != unknown ; then
2568 AC_DEFINE(HAVE_MBSTATE_T,1,[Define to 1 if mbstate_t is declared])
2571 dnl ---------------------------------------------------------------------------
2572 dnl CF_MIXEDCASE_FILENAMES version: 4 updated: 2012/10/02 20:55:03
2573 dnl ----------------------
2574 dnl Check if the file-system supports mixed-case filenames. If we're able to
2575 dnl create a lowercase name and see it as uppercase, it doesn't support that.
2576 AC_DEFUN([CF_MIXEDCASE_FILENAMES],
2578 AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[
2579 if test "$cross_compiling" = yes ; then
2580 case $target_alias in #(vi
2581 *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-mingw32*|*-uwin*) #(vi
2589 rm -f conftest CONFTEST
2591 if test -f CONFTEST ; then
2596 rm -f conftest CONFTEST
2599 test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if filesystem supports mixed-case filenames.])
2601 dnl ---------------------------------------------------------------------------
2602 dnl CF_MSG_LOG version: 5 updated: 2010/10/23 15:52:32
2604 dnl Write a debug message to config.log, along with the line number in the
2605 dnl configure script.
2606 AC_DEFUN([CF_MSG_LOG],[
2607 echo "${as_me:-configure}:__oline__: testing $* ..." 1>&AC_FD_CC
2609 dnl ---------------------------------------------------------------------------
2610 dnl CF_NCURSES_CC_CHECK version: 4 updated: 2007/07/29 10:39:05
2611 dnl -------------------
2612 dnl Check if we can compile with ncurses' header file
2613 dnl $1 is the cache variable to set
2614 dnl $2 is the header-file to include
2615 dnl $3 is the root name (ncurses or ncursesw)
2616 AC_DEFUN([CF_NCURSES_CC_CHECK],[
2618 ]ifelse($3,ncursesw,[
2619 #define _XOPEN_SOURCE_EXTENDED
2620 #undef HAVE_LIBUTF8_H /* in case we used CF_UTF8_LIB */
2621 #define HAVE_LIBUTF8_H /* to force ncurses' header file to use cchar_t */
2624 #ifdef NCURSES_VERSION
2625 ]ifelse($3,ncursesw,[
2630 printf("%s\n", NCURSES_VERSION);
2642 dnl ---------------------------------------------------------------------------
2643 dnl CF_NCURSES_CONFIG version: 10 updated: 2012/10/06 08:57:51
2644 dnl -----------------
2645 dnl Tie together the configure-script macros for ncurses.
2646 dnl Prefer the "-config" script from ncurses 6.x, to simplify analysis.
2647 dnl Allow that to be overridden using the $NCURSES_CONFIG environment variable.
2649 dnl $1 is the root library name (default: "ncurses")
2650 AC_DEFUN([CF_NCURSES_CONFIG],
2652 cf_ncuconfig_root=ifelse($1,,ncurses,$1)
2654 echo "Looking for ${cf_ncuconfig_root}-config"
2656 CF_ACVERSION_CHECK(2.52,
2657 [AC_CHECK_TOOLS(NCURSES_CONFIG, ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)],
2658 [AC_PATH_PROGS(NCURSES_CONFIG, ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)])
2660 if test "$NCURSES_CONFIG" != none ; then
2662 CPPFLAGS="$CPPFLAGS `$NCURSES_CONFIG --cflags`"
2663 CF_ADD_LIBS(`$NCURSES_CONFIG --libs`)
2665 # even with config script, some packages use no-override for curses.h
2666 CF_CURSES_HEADER(ifelse($1,,ncurses,$1))
2668 dnl like CF_NCURSES_CPPFLAGS
2669 AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries])
2671 dnl like CF_NCURSES_LIBS
2672 CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_ncuconfig_root)
2673 AC_DEFINE_UNQUOTED($cf_nculib_ROOT)
2675 dnl like CF_NCURSES_VERSION
2676 cf_cv_ncurses_version=`$NCURSES_CONFIG --version`
2680 CF_NCURSES_CPPFLAGS(ifelse($1,,ncurses,$1))
2681 CF_NCURSES_LIBS(ifelse($1,,ncurses,$1))
2685 dnl ---------------------------------------------------------------------------
2686 dnl CF_NCURSES_CPPFLAGS version: 21 updated: 2012/10/06 08:57:51
2687 dnl -------------------
2688 dnl Look for the SVr4 curses clone 'ncurses' in the standard places, adjusting
2689 dnl the CPPFLAGS variable so we can include its header.
2691 dnl The header files may be installed as either curses.h, or ncurses.h (would
2692 dnl be obsolete, except that some packagers prefer this name to distinguish it
2693 dnl from a "native" curses implementation). If not installed for overwrite,
2694 dnl the curses.h file would be in an ncurses subdirectory (e.g.,
2695 dnl /usr/include/ncurses), but someone may have installed overwriting the
2696 dnl vendor's curses. Only very old versions (pre-1.9.2d, the first autoconf'd
2697 dnl version) of ncurses don't define either __NCURSES_H or NCURSES_VERSION in
2700 dnl If the installer has set $CFLAGS or $CPPFLAGS so that the ncurses header
2701 dnl is already in the include-path, don't even bother with this, since we cannot
2702 dnl easily determine which file it is. In this case, it has to be <curses.h>.
2704 dnl The optional parameter gives the root name of the library, in case it is
2705 dnl not installed as the default curses library. That is how the
2706 dnl wide-character version of ncurses is installed.
2707 AC_DEFUN([CF_NCURSES_CPPFLAGS],
2708 [AC_REQUIRE([CF_WITH_CURSES_DIR])
2710 AC_PROVIDE([CF_CURSES_CPPFLAGS])dnl
2711 cf_ncuhdr_root=ifelse($1,,ncurses,$1)
2713 test -n "$cf_cv_curses_dir" && \
2714 test "$cf_cv_curses_dir" != "no" && { \
2715 CF_ADD_INCDIR($cf_cv_curses_dir/include/$cf_ncuhdr_root)
2718 AC_CACHE_CHECK(for $cf_ncuhdr_root header in include-path, cf_cv_ncurses_h,[
2719 cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h"
2720 ( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h"
2721 for cf_header in $cf_header_list
2723 CF_NCURSES_CC_CHECK(cf_cv_ncurses_h,$cf_header,$1)
2724 test "$cf_cv_ncurses_h" != no && break
2731 # some applications need this, but should check for NCURSES_VERSION
2732 AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries])
2736 dnl ---------------------------------------------------------------------------
2737 dnl CF_NCURSES_HEADER version: 3 updated: 2012/10/06 08:57:51
2738 dnl -----------------
2739 dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
2740 dnl variations of ncurses' installs.
2742 dnl See also CF_CURSES_HEADER, which sets the same cache variable.
2743 AC_DEFUN([CF_NCURSES_HEADER],[
2745 if test "$cf_cv_ncurses_h" != no ; then
2746 cf_cv_ncurses_header=$cf_cv_ncurses_h
2749 AC_CACHE_CHECK(for $cf_ncuhdr_root include-path, cf_cv_ncurses_h2,[
2750 test -n "$verbose" && echo
2751 CF_HEADER_PATH(cf_search,$cf_ncuhdr_root)
2752 test -n "$verbose" && echo search path $cf_search
2753 cf_save2_CPPFLAGS="$CPPFLAGS"
2754 for cf_incdir in $cf_search
2756 CF_ADD_INCDIR($cf_incdir)
2761 CF_NCURSES_CC_CHECK(cf_cv_ncurses_h2,$cf_header,$1)
2762 if test "$cf_cv_ncurses_h2" != no ; then
2763 cf_cv_ncurses_h2=$cf_incdir/$cf_header
2764 test -n "$verbose" && echo $ac_n " ... found $ac_c" 1>&AC_FD_MSG
2767 test -n "$verbose" && echo " ... tested $cf_incdir/$cf_header" 1>&AC_FD_MSG
2769 CPPFLAGS="$cf_save2_CPPFLAGS"
2770 test "$cf_cv_ncurses_h2" != no && break
2772 test "$cf_cv_ncurses_h2" = no && AC_MSG_ERROR(not found)
2775 CF_DIRNAME(cf_1st_incdir,$cf_cv_ncurses_h2)
2776 cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2`
2777 if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then
2778 cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header
2780 CF_ADD_INCDIR($cf_1st_incdir)
2784 # Set definitions to allow ifdef'ing for ncurses.h
2786 case $cf_cv_ncurses_header in # (vi
2788 AC_DEFINE(HAVE_NCURSES_H,1,[Define to 1 if we have ncurses.h])
2792 case $cf_cv_ncurses_header in # (vi
2793 ncurses/curses.h|ncurses/ncurses.h)
2794 AC_DEFINE(HAVE_NCURSES_NCURSES_H,1,[Define to 1 if we have ncurses/ncurses.h])
2796 ncursesw/curses.h|ncursesw/ncurses.h)
2797 AC_DEFINE(HAVE_NCURSESW_NCURSES_H,1,[Define to 1 if we have ncursesw/ncurses.h])
2802 dnl ---------------------------------------------------------------------------
2803 dnl CF_NCURSES_LIBS version: 16 updated: 2010/11/20 17:02:38
2805 dnl Look for the ncurses library. This is a little complicated on Linux,
2806 dnl because it may be linked with the gpm (general purpose mouse) library.
2807 dnl Some distributions have gpm linked with (bsd) curses, which makes it
2808 dnl unusable with ncurses. However, we don't want to link with gpm unless
2809 dnl ncurses has a dependency, since gpm is normally set up as a shared library,
2810 dnl and the linker will record a dependency.
2812 dnl The optional parameter gives the root name of the library, in case it is
2813 dnl not installed as the default curses library. That is how the
2814 dnl wide-character version of ncurses is installed.
2815 AC_DEFUN([CF_NCURSES_LIBS],
2816 [AC_REQUIRE([CF_NCURSES_CPPFLAGS])
2818 cf_nculib_root=ifelse($1,,ncurses,$1)
2819 # This works, except for the special case where we find gpm, but
2820 # ncurses is in a nonstandard location via $LIBS, and we really want
2823 cf_ncurses_SAVE="$LIBS"
2824 AC_CHECK_LIB(gpm,Gpm_Open,
2825 [AC_CHECK_LIB(gpm,initscr,
2826 [LIBS="$cf_ncurses_SAVE"],
2827 [cf_ncurses_LIBS="-lgpm"])])
2829 case $host_os in #(vi
2831 # This is only necessary if you are linking against an obsolete
2832 # version of ncurses (but it should do no harm, since it's static).
2833 if test "$cf_nculib_root" = ncurses ; then
2834 AC_CHECK_LIB(mytinfo,tgoto,[cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS"])
2839 CF_ADD_LIBS($cf_ncurses_LIBS)
2841 if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
2843 CF_ADD_LIBS(-l$cf_nculib_root)
2845 CF_FIND_LIBRARY($cf_nculib_root,$cf_nculib_root,
2846 [#include <${cf_cv_ncurses_header:-curses.h}>],
2851 if test -n "$cf_ncurses_LIBS" ; then
2852 AC_MSG_CHECKING(if we can link $cf_nculib_root without $cf_ncurses_LIBS)
2853 cf_ncurses_SAVE="$LIBS"
2854 for p in $cf_ncurses_LIBS ; do
2855 q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"`
2856 if test "$q" != "$LIBS" ; then
2860 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
2861 [initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);],
2862 [AC_MSG_RESULT(yes)],
2864 LIBS="$cf_ncurses_SAVE"])
2867 CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_nculib_root)
2868 AC_DEFINE_UNQUOTED($cf_nculib_ROOT)
2870 dnl ---------------------------------------------------------------------------
2871 dnl CF_NCURSES_VERSION version: 14 updated: 2012/10/06 08:57:51
2872 dnl ------------------
2873 dnl Check for the version of ncurses, to aid in reporting bugs, etc.
2874 dnl Call CF_CURSES_CPPFLAGS first, or CF_NCURSES_CPPFLAGS. We don't use
2875 dnl AC_REQUIRE since that does not work with the shell's if/then/else/fi.
2876 AC_DEFUN([CF_NCURSES_VERSION],
2878 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
2879 AC_CACHE_CHECK(for ncurses version, cf_cv_ncurses_version,[
2880 cf_cv_ncurses_version=no
2884 #include <${cf_cv_ncurses_header:-curses.h}>
2888 FILE *fp = fopen("$cf_tempfile", "w");
2889 #ifdef NCURSES_VERSION
2890 # ifdef NCURSES_VERSION_PATCH
2891 fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH);
2893 fprintf(fp, "%s\n", NCURSES_VERSION);
2897 fprintf(fp, "old\n");
2902 ${cf_cv_main_return:-return}(0);
2904 cf_cv_ncurses_version=`cat $cf_tempfile`],,[
2906 # This will not work if the preprocessor splits the line after the
2907 # Autoconf token. The 'unproto' program does that.
2908 cat > conftest.$ac_ext <<EOF
2909 #include <${cf_cv_ncurses_header:-curses.h}>
2911 #ifdef NCURSES_VERSION
2912 Autoconf NCURSES_VERSION
2920 cf_try="$ac_cpp conftest.$ac_ext 2>&AC_FD_CC | grep '^Autoconf ' >conftest.out"
2922 if test -f conftest.out ; then
2923 cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[[^"]]*"%%' -e 's%".*%%'`
2924 test -n "$cf_out" && cf_cv_ncurses_version="$cf_out"
2930 test "$cf_cv_ncurses_version" = no || AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries])
2932 dnl ---------------------------------------------------------------------------
2933 dnl CF_NO_LEAKS_OPTION version: 5 updated: 2012/10/02 20:55:03
2934 dnl ------------------
2935 dnl see CF_WITH_NO_LEAKS
2936 AC_DEFUN([CF_NO_LEAKS_OPTION],[
2937 AC_MSG_CHECKING(if you want to use $1 for testing)
2940 [AC_DEFINE_UNQUOTED($3,1,"Define to 1 if you want to use $1 for testing.")ifelse([$4],,[
2943 : ${with_cflags:=-g}
2944 : ${with_no_leaks:=yes}
2947 AC_MSG_RESULT(${with_$1:-no})
2949 case .$with_cflags in #(vi
2951 case .$CFLAGS in #(vi
2961 dnl ---------------------------------------------------------------------------
2962 dnl CF_OUR_MESSAGES version: 7 updated: 2004/09/12 19:45:55
2964 dnl Check if we use the messages included with this program
2966 dnl $1 specifies either Makefile or makefile, defaulting to the former.
2968 dnl Sets variables which can be used to substitute in makefiles:
2969 dnl MSG_DIR_MAKE - to make ./po directory
2970 dnl SUB_MAKEFILE - makefile in ./po directory (see CF_BUNDLED_INTL)
2972 AC_DEFUN([CF_OUR_MESSAGES],
2974 cf_makefile=ifelse($1,,Makefile,$1)
2977 if test "$USE_NLS" = yes ; then
2978 if test -d $srcdir/po ; then
2979 AC_MSG_CHECKING(if we should use included message-library)
2980 AC_ARG_ENABLE(included-msgs,
2981 [ --disable-included-msgs use included messages, for i18n support],
2982 [use_our_messages=$enableval],
2983 [use_our_messages=yes])
2985 AC_MSG_RESULT($use_our_messages)
2989 if test "$use_our_messages" = yes
2991 SUB_MAKEFILE="$SUB_MAKEFILE po/$cf_makefile.in:$srcdir/po/$cf_makefile.inn"
2995 AC_SUBST(MSG_DIR_MAKE)
2996 AC_SUBST(SUB_MAKEFILE)
2998 dnl ---------------------------------------------------------------------------
2999 dnl CF_PATHSEP version: 6 updated: 2012/09/29 18:38:12
3001 dnl Provide a value for the $PATH and similar separator (or amend the value
3002 dnl as provided in autoconf 2.5x).
3003 AC_DEFUN([CF_PATHSEP],
3005 AC_MSG_CHECKING(for PATH separator)
3006 case $cf_cv_system_name in
3007 os2*) PATH_SEPARATOR=';' ;;
3008 *) ${PATH_SEPARATOR:=':'} ;;
3010 ifelse([$1],,,[$1=$PATH_SEPARATOR])
3011 AC_SUBST(PATH_SEPARATOR)
3012 AC_MSG_RESULT($PATH_SEPARATOR)
3014 dnl ---------------------------------------------------------------------------
3015 dnl CF_PATH_SYNTAX version: 14 updated: 2012/06/19 20:58:54
3017 dnl Check the argument to see that it looks like a pathname. Rewrite it if it
3018 dnl begins with one of the prefix/exec_prefix variables, and then again if the
3019 dnl result begins with 'NONE'. This is necessary to work around autoconf's
3020 dnl delayed evaluation of those symbols.
3021 AC_DEFUN([CF_PATH_SYNTAX],[
3022 if test "x$prefix" != xNONE; then
3023 cf_path_syntax="$prefix"
3025 cf_path_syntax="$ac_default_prefix"
3028 case ".[$]$1" in #(vi
3029 .\[$]\(*\)*|.\'*\'*) #(vi
3033 .[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX
3035 .\[$]{*prefix}*|.\[$]{*dir}*) #(vi
3037 case ".[$]$1" in #(vi
3039 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
3044 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
3047 ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2)
3051 dnl ---------------------------------------------------------------------------
3052 dnl CF_POSIX_C_SOURCE version: 8 updated: 2010/05/26 05:38:42
3053 dnl -----------------
3054 dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed.
3056 dnl POSIX.1-1990 _POSIX_SOURCE
3057 dnl POSIX.1-1990 and _POSIX_SOURCE and
3058 dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2
3060 dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L
3061 dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L
3062 dnl X/Open 2000 _POSIX_C_SOURCE=200112L
3065 dnl $1 is the nominal value for _POSIX_C_SOURCE
3066 AC_DEFUN([CF_POSIX_C_SOURCE],
3068 cf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1])
3070 cf_save_CFLAGS="$CFLAGS"
3071 cf_save_CPPFLAGS="$CPPFLAGS"
3073 CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE)
3074 CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE)
3076 AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[
3077 CF_MSG_LOG(if the symbol is already defined go no further)
3078 AC_TRY_COMPILE([#include <sys/types.h>],[
3079 #ifndef _POSIX_C_SOURCE
3082 [cf_cv_posix_c_source=no],
3083 [cf_want_posix_source=no
3084 case .$cf_POSIX_C_SOURCE in #(vi
3086 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
3089 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
3090 cf_want_posix_source=yes
3093 cf_want_posix_source=yes
3096 if test "$cf_want_posix_source" = yes ; then
3097 AC_TRY_COMPILE([#include <sys/types.h>],[
3098 #ifdef _POSIX_SOURCE
3101 cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE")
3103 CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE)
3104 CFLAGS="$cf_trim_CFLAGS"
3105 CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source"
3106 CF_MSG_LOG(if the second compile does not leave our definition intact error)
3107 AC_TRY_COMPILE([#include <sys/types.h>],[
3108 #ifndef _POSIX_C_SOURCE
3111 [cf_cv_posix_c_source=no])
3112 CFLAGS="$cf_save_CFLAGS"
3113 CPPFLAGS="$cf_save_CPPFLAGS"
3117 if test "$cf_cv_posix_c_source" != no ; then
3118 CFLAGS="$cf_trim_CFLAGS"
3119 CPPFLAGS="$cf_trim_CPPFLAGS"
3120 CF_ADD_CFLAGS($cf_cv_posix_c_source)
3124 dnl ---------------------------------------------------------------------------
3125 dnl CF_PROG_CC version: 3 updated: 2012/10/06 15:31:55
3127 dnl standard check for CC, plus followup sanity checks
3128 dnl $1 = optional parameter to pass to AC_PROG_CC to specify compiler name
3129 AC_DEFUN([CF_PROG_CC],[
3130 ifelse($1,,[AC_PROG_CC],[AC_PROG_CC($1)])
3132 CF_ACVERSION_CHECK(2.52,
3137 dnl ---------------------------------------------------------------------------
3138 dnl CF_PROG_EXT version: 11 updated: 2012/10/06 08:57:51
3140 dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX.
3141 AC_DEFUN([CF_PROG_EXT],
3143 AC_REQUIRE([CF_CHECK_CACHE])
3144 case $cf_cv_system_name in
3146 CFLAGS="$CFLAGS -Zmt"
3147 CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__"
3148 CXXFLAGS="$CXXFLAGS -Zmt"
3149 # autoconf's macro sets -Zexe and suffix both, which conflict:w
3150 LDFLAGS="$LDFLAGS -Zmt -Zcrtdll"
3160 test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT",[Define to the program extension (normally blank)])
3162 dnl ---------------------------------------------------------------------------
3163 dnl CF_PROG_LINT version: 2 updated: 2009/08/12 04:43:14
3165 AC_DEFUN([CF_PROG_LINT],
3167 AC_CHECK_PROGS(LINT, tdlint lint alint splint lclint)
3170 dnl ---------------------------------------------------------------------------
3171 dnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50
3172 dnl ----------------
3173 dnl Remove all -U and -D options that refer to the given symbol from a list
3174 dnl of C compiler options. This works around the problem that not all
3175 dnl compilers process -U and -D options from left-to-right, so a -U option
3176 dnl cannot be used to cancel the effect of a preceding -D option.
3178 dnl $1 = target (which could be the same as the source variable)
3179 dnl $2 = source (including '$')
3180 dnl $3 = symbol to remove
3181 define([CF_REMOVE_DEFINE],
3184 sed -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[[ ]]/ /g' \
3185 -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'`
3187 dnl ---------------------------------------------------------------------------
3188 dnl CF_RPATH_HACK version: 9 updated: 2011/02/13 13:31:33
3190 AC_DEFUN([CF_RPATH_HACK],
3192 AC_REQUIRE([CF_LD_RPATH_OPT])
3193 AC_MSG_CHECKING(for updated LDFLAGS)
3194 if test -n "$LD_RPATH_OPT" ; then
3195 AC_MSG_RESULT(maybe)
3197 AC_CHECK_PROGS(cf_ldd_prog,ldd,no)
3198 cf_rpath_list="/usr/lib /lib"
3199 if test "$cf_ldd_prog" != no
3203 AC_TRY_LINK([#include <stdio.h>],
3205 [cf_rpath_oops=`$cf_ldd_prog conftest$ac_exeext | fgrep ' not found' | sed -e 's% =>.*$%%' |sort -u`
3206 cf_rpath_list=`$cf_ldd_prog conftest$ac_exeext | fgrep / | sed -e 's%^.*[[ ]]/%/%' -e 's%/[[^/]][[^/]]*$%%' |sort -u`])
3208 # If we passed the link-test, but get a "not found" on a given library,
3209 # this could be due to inept reconfiguration of gcc to make it only
3210 # partly honor /usr/local/lib (or whatever). Sometimes this behavior
3211 # is intentional, e.g., installing gcc in /usr/bin and suppressing the
3212 # /usr/local libraries.
3213 if test -n "$cf_rpath_oops"
3215 for cf_rpath_src in $cf_rpath_oops
3217 for cf_rpath_dir in \
3222 if test -f $cf_rpath_dir/lib/$cf_rpath_src
3224 CF_VERBOSE(...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src)
3225 LDFLAGS="$LDFLAGS -L$cf_rpath_dir/lib"
3233 CF_VERBOSE(...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS)
3235 CF_RPATH_HACK_2(LDFLAGS)
3236 CF_RPATH_HACK_2(LIBS)
3238 CF_VERBOSE(...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS)
3240 AC_SUBST(EXTRA_LDFLAGS)
3242 dnl ---------------------------------------------------------------------------
3243 dnl CF_RPATH_HACK_2 version: 6 updated: 2010/04/17 16:31:24
3245 dnl Do one set of substitutions for CF_RPATH_HACK, adding an rpath option to
3246 dnl EXTRA_LDFLAGS for each -L option found.
3248 dnl $cf_rpath_list contains a list of directories to ignore.
3250 dnl $1 = variable name to update. The LDFLAGS variable should be the only one,
3251 dnl but LIBS often has misplaced -L options.
3252 AC_DEFUN([CF_RPATH_HACK_2],
3254 CF_VERBOSE(...checking $1 [$]$1)
3257 for cf_rpath_src in [$]$1
3259 case $cf_rpath_src in #(vi
3262 # check if this refers to a directory which we will ignore
3264 if test -n "$cf_rpath_list"
3266 for cf_rpath_item in $cf_rpath_list
3268 if test "x$cf_rpath_src" = "x-L$cf_rpath_item"
3276 if test "$cf_rpath_skip" = no
3278 # transform the option
3279 if test "$LD_RPATH_OPT" = "-R " ; then
3280 cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%-R %"`
3282 cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%$LD_RPATH_OPT%"`
3285 # if we have not already added this, add it now
3286 cf_rpath_tst=`echo "$EXTRA_LDFLAGS" | sed -e "s%$cf_rpath_tmp %%"`
3287 if test "x$cf_rpath_tst" = "x$EXTRA_LDFLAGS"
3289 CF_VERBOSE(...Filter $cf_rpath_src ->$cf_rpath_tmp)
3290 EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS"
3295 cf_rpath_dst="$cf_rpath_dst $cf_rpath_src"
3299 CF_VERBOSE(...checked $1 [$]$1)
3300 AC_SUBST(EXTRA_LDFLAGS)
3302 dnl ---------------------------------------------------------------------------
3303 dnl CF_SUBDIR_PATH version: 6 updated: 2010/04/21 06:20:50
3305 dnl Construct a search-list for a nonstandard header/lib-file
3306 dnl $1 = the variable to return as result
3307 dnl $2 = the package name
3308 dnl $3 = the subdirectory, e.g., bin, include or lib
3309 AC_DEFUN([CF_SUBDIR_PATH],
3313 CF_ADD_SUBDIR_PATH($1,$2,$3,/usr,$prefix)
3314 CF_ADD_SUBDIR_PATH($1,$2,$3,$prefix,NONE)
3315 CF_ADD_SUBDIR_PATH($1,$2,$3,/usr/local,$prefix)
3316 CF_ADD_SUBDIR_PATH($1,$2,$3,/opt,$prefix)
3317 CF_ADD_SUBDIR_PATH($1,$2,$3,[$]HOME,$prefix)
3319 dnl ---------------------------------------------------------------------------
3320 dnl CF_TERM_HEADER version: 3 updated: 2012/10/06 08:57:51
3322 dnl Look for term.h, which is part of X/Open curses. It defines the interface
3323 dnl to terminfo database. Usually it is in the same include-path as curses.h,
3324 dnl but some packagers change this, breaking various applications.
3325 AC_DEFUN([CF_TERM_HEADER],[
3326 AC_CACHE_CHECK(for terminfo header, cf_cv_term_header,[
3327 case ${cf_cv_ncurses_header} in #(vi
3328 */ncurses.h|*/ncursesw.h) #(vi
3329 cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[[^.]]*\.h$%term.h%'`
3332 cf_term_header=term.h
3336 for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h"
3338 AC_TRY_COMPILE([#include <stdio.h>
3339 #include <${cf_cv_ncurses_header:-curses.h}>
3341 ],[int x = auto_left_margin],[
3342 cf_cv_term_header="$cf_test"],[
3343 cf_cv_term_header=unknown
3345 test "$cf_cv_term_header" != unknown && break
3349 # Set definitions to allow ifdef'ing to accommodate subdirectories
3351 case $cf_cv_term_header in # (vi
3353 AC_DEFINE(HAVE_TERM_H,1,[Define to 1 if we have term.h])
3357 case $cf_cv_term_header in # (vi
3358 ncurses/term.h) #(vi
3359 AC_DEFINE(HAVE_NCURSES_TERM_H,1,[Define to 1 if we have ncurses/term.h])
3362 AC_DEFINE(HAVE_NCURSESW_TERM_H,1,[Define to 1 if we have ncursesw/term.h])
3366 dnl ---------------------------------------------------------------------------
3367 dnl CF_TRY_XOPEN_SOURCE version: 1 updated: 2011/10/30 17:09:50
3368 dnl -------------------
3369 dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we
3370 dnl can define it successfully.
3371 AC_DEFUN([CF_TRY_XOPEN_SOURCE],[
3372 AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
3376 #include <sys/types.h>
3378 #ifndef _XOPEN_SOURCE
3381 [cf_cv_xopen_source=no],
3382 [cf_save="$CPPFLAGS"
3383 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
3387 #include <sys/types.h>
3389 #ifdef _XOPEN_SOURCE
3392 [cf_cv_xopen_source=no],
3393 [cf_cv_xopen_source=$cf_XOPEN_SOURCE])
3398 if test "$cf_cv_xopen_source" != no ; then
3399 CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE)
3400 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE)
3401 cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
3402 CF_ADD_CFLAGS($cf_temp_xopen_source)
3405 dnl ---------------------------------------------------------------------------
3406 dnl CF_UNION_WAIT version: 6 updated: 2012/10/06 08:57:51
3408 dnl Check to see if the BSD-style union wait is declared. Some platforms may
3409 dnl use this, though it is deprecated in favor of the 'int' type in Posix.
3410 dnl Some vendors provide a bogus implementation that declares union wait, but
3411 dnl uses the 'int' type instead; we try to spot these by checking for the
3412 dnl associated macros.
3414 dnl Ahem. Some implementers cast the status value to an int*, as an attempt to
3415 dnl use the macros for either union wait or int. So we do a check compile to
3416 dnl see if the macros are defined and apply to an int.
3418 dnl Sets: $cf_cv_type_unionwait
3419 dnl Defines: HAVE_TYPE_UNIONWAIT
3420 AC_DEFUN([CF_UNION_WAIT],
3422 AC_REQUIRE([CF_WAIT_HEADERS])
3423 AC_MSG_CHECKING([for union wait])
3424 AC_CACHE_VAL(cf_cv_type_unionwait,[
3425 AC_TRY_LINK($cf_wait_headers,
3427 int y = WEXITSTATUS(x);
3428 int z = WTERMSIG(x);
3431 [cf_cv_type_unionwait=no
3432 echo compiles ok w/o union wait 1>&AC_FD_CC
3434 AC_TRY_LINK($cf_wait_headers,
3437 int y = WEXITSTATUS(x);
3440 int z = WTERMSIG(x);
3444 [cf_cv_type_unionwait=yes
3445 echo compiles ok with union wait and possibly macros too 1>&AC_FD_CC
3447 [cf_cv_type_unionwait=no])])])
3448 AC_MSG_RESULT($cf_cv_type_unionwait)
3449 test $cf_cv_type_unionwait = yes && AC_DEFINE(HAVE_TYPE_UNIONWAIT,1,[Define to 1 if type unionwait is declared])
3451 dnl ---------------------------------------------------------------------------
3452 dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59
3454 dnl Make an uppercase version of a variable
3455 dnl $1=uppercase($2)
3456 AC_DEFUN([CF_UPPER],
3458 $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
3460 dnl ---------------------------------------------------------------------------
3461 dnl CF_UTF8_LIB version: 8 updated: 2012/10/06 08:57:51
3463 dnl Check for multibyte support, and if not found, utf8 compatibility library
3464 AC_DEFUN([CF_UTF8_LIB],
3466 AC_CACHE_CHECK(for multibyte character support,cf_cv_utf8_lib,[
3467 cf_save_LIBS="$LIBS"
3469 #include <stdlib.h>],[putwc(0,0);],
3470 [cf_cv_utf8_lib=yes],
3472 #include <libutf8.h>],[putwc(0,0);],utf8,
3473 [cf_cv_utf8_lib=add-on],
3474 [cf_cv_utf8_lib=no])
3477 # HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between
3479 if test "$cf_cv_utf8_lib" = "add-on" ; then
3480 AC_DEFINE(HAVE_LIBUTF8_H,1,[Define to 1 if we should include libutf8.h])
3481 CF_ADD_INCDIR($cf_cv_header_path_utf8)
3482 CF_ADD_LIBDIR($cf_cv_library_path_utf8)
3483 CF_ADD_LIBS($cf_cv_library_file_utf8)
3486 dnl ---------------------------------------------------------------------------
3487 dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12
3489 dnl Use AC_VERBOSE w/o the warnings
3490 AC_DEFUN([CF_VERBOSE],
3491 [test -n "$verbose" && echo " $1" 1>&AC_FD_MSG
3494 dnl ---------------------------------------------------------------------------
3495 dnl CF_VERSION_INFO version: 5 updated: 2012/10/06 08:57:51
3497 dnl Define several useful symbols derived from the VERSION file. A separate
3498 dnl file is preferred to embedding the version numbers in various scripts.
3499 dnl (automake is a textbook-example of why the latter is a bad idea, but there
3502 dnl The file contents are:
3503 dnl libtool-version release-version patch-version
3507 dnl libtool-version (see ?) consists of 3 integers separated by '.'
3508 dnl release-version consists of a major version and minor version
3509 dnl separated by '.', optionally followed by a patch-version
3510 dnl separated by '-'. The minor version need not be an
3511 dnl integer (but it is preferred).
3512 dnl patch-version is an integer in the form yyyymmdd, so ifdef's and
3513 dnl scripts can easily compare versions.
3515 dnl If libtool is used, the first form is required, since CF_WITH_LIBTOOL
3516 dnl simply extracts the first field using 'cut -f1'.
3518 dnl Optional parameters:
3519 dnl $1 = internal name for package
3520 dnl $2 = external name for package
3521 AC_DEFUN([CF_VERSION_INFO],
3523 if test -f $srcdir/VERSION ; then
3524 AC_MSG_CHECKING(for package version)
3526 # if there are not enough fields, cut returns the last one...
3527 cf_field1=`sed -e '2,$d' $srcdir/VERSION|cut -f1`
3528 cf_field2=`sed -e '2,$d' $srcdir/VERSION|cut -f2`
3529 cf_field3=`sed -e '2,$d' $srcdir/VERSION|cut -f3`
3531 # this is how CF_BUNDLED_INTL uses $VERSION:
3532 VERSION="$cf_field1"
3534 VERSION_MAJOR=`echo "$cf_field2" | sed -e 's/\..*//'`
3535 test -z "$VERSION_MAJOR" && AC_MSG_ERROR(missing major-version)
3537 VERSION_MINOR=`echo "$cf_field2" | sed -e 's/^[[^.]]*\.//' -e 's/-.*//'`
3538 test -z "$VERSION_MINOR" && AC_MSG_ERROR(missing minor-version)
3540 AC_MSG_RESULT(${VERSION_MAJOR}.${VERSION_MINOR})
3542 AC_MSG_CHECKING(for package patch date)
3543 VERSION_PATCH=`echo "$cf_field3" | sed -e 's/^[[^-]]*-//'`
3544 case .$VERSION_PATCH in
3546 AC_MSG_ERROR(missing patch-date $VERSION_PATCH)
3548 .[[0-9]][[0-9]][[0-9]][[0-9]][[0-9]][[0-9]][[0-9]][[0-9]])
3551 AC_MSG_ERROR(illegal patch-date $VERSION_PATCH)
3554 AC_MSG_RESULT($VERSION_PATCH)
3556 AC_MSG_ERROR(did not find $srcdir/VERSION)
3559 # show the actual data that we have for versions:
3560 CF_VERBOSE(VERSION $VERSION)
3561 CF_VERBOSE(VERSION_MAJOR $VERSION_MAJOR)
3562 CF_VERBOSE(VERSION_MINOR $VERSION_MINOR)
3563 CF_VERBOSE(VERSION_PATCH $VERSION_PATCH)
3566 AC_SUBST(VERSION_MAJOR)
3567 AC_SUBST(VERSION_MINOR)
3568 AC_SUBST(VERSION_PATCH)
3570 dnl if a package name is given, define its corresponding version info. We
3571 dnl need the package name to ensure that the defined symbols are unique.
3574 PACKAGE=ifelse($2,,$1,$2)
3575 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE",[Define to the package-name])
3577 CF_UPPER(cf_PACKAGE,$cf_PACKAGE)
3578 AC_DEFINE_UNQUOTED(${cf_PACKAGE}_VERSION,"${VERSION_MAJOR}.${VERSION_MINOR}")
3579 AC_DEFINE_UNQUOTED(${cf_PACKAGE}_PATCHDATE,${VERSION_PATCH})
3582 dnl ---------------------------------------------------------------------------
3583 dnl CF_WAIT_HEADERS version: 2 updated: 1997/10/21 19:45:33
3585 dnl Build up an expression $cf_wait_headers with the header files needed to
3586 dnl compile against the prototypes for 'wait()', 'waitpid()', etc. Assume it's
3587 dnl Posix, which uses <sys/types.h> and <sys/wait.h>, but allow SVr4 variation
3589 AC_DEFUN([CF_WAIT_HEADERS],
3591 AC_HAVE_HEADERS(sys/wait.h)
3592 cf_wait_headers="#include <sys/types.h>
3594 if test $ac_cv_header_sys_wait_h = yes; then
3595 cf_wait_headers="$cf_wait_headers
3596 #include <sys/wait.h>
3599 AC_HAVE_HEADERS(wait.h)
3600 AC_HAVE_HEADERS(waitstatus.h)
3601 if test $ac_cv_header_wait_h = yes; then
3602 cf_wait_headers="$cf_wait_headers
3606 if test $ac_cv_header_waitstatus_h = yes; then
3607 cf_wait_headers="$cf_wait_headers
3608 #include <waitstatus.h>
3613 dnl ---------------------------------------------------------------------------
3614 dnl CF_WITH_CURSES_DIR version: 3 updated: 2010/11/20 17:02:38
3615 dnl ------------------
3616 dnl Wrapper for AC_ARG_WITH to specify directory under which to look for curses
3618 AC_DEFUN([CF_WITH_CURSES_DIR],[
3620 AC_MSG_CHECKING(for specific curses-directory)
3621 AC_ARG_WITH(curses-dir,
3622 [ --with-curses-dir=DIR directory in which (n)curses is installed],
3623 [cf_cv_curses_dir=$withval],
3624 [cf_cv_curses_dir=no])
3625 AC_MSG_RESULT($cf_cv_curses_dir)
3627 if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
3629 CF_PATH_SYNTAX(withval)
3630 if test -d "$cf_cv_curses_dir"
3632 CF_ADD_INCDIR($cf_cv_curses_dir/include)
3633 CF_ADD_LIBDIR($cf_cv_curses_dir/lib)
3637 dnl ---------------------------------------------------------------------------
3638 dnl CF_WITH_DBMALLOC version: 7 updated: 2010/06/21 17:26:47
3639 dnl ----------------
3640 dnl Configure-option for dbmalloc. The optional parameter is used to override
3641 dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests.
3642 AC_DEFUN([CF_WITH_DBMALLOC],[
3643 CF_NO_LEAKS_OPTION(dbmalloc,
3644 [ --with-dbmalloc test: use Conor Cahill's dbmalloc library],
3647 if test "$with_dbmalloc" = yes ; then
3648 AC_CHECK_HEADER(dbmalloc.h,
3649 [AC_CHECK_LIB(dbmalloc,[debug_malloc]ifelse([$1],,[],[,$1]))])
3652 dnl ---------------------------------------------------------------------------
3653 dnl CF_WITH_DMALLOC version: 7 updated: 2010/06/21 17:26:47
3655 dnl Configure-option for dmalloc. The optional parameter is used to override
3656 dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests.
3657 AC_DEFUN([CF_WITH_DMALLOC],[
3658 CF_NO_LEAKS_OPTION(dmalloc,
3659 [ --with-dmalloc test: use Gray Watson's dmalloc library],
3662 if test "$with_dmalloc" = yes ; then
3663 AC_CHECK_HEADER(dmalloc.h,
3664 [AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse([$1],,[],[,$1]))])
3667 dnl ---------------------------------------------------------------------------
3668 dnl CF_WITH_LIBTOOL version: 28 updated: 2011/07/02 15:40:32
3670 dnl Provide a configure option to incorporate libtool. Define several useful
3671 dnl symbols for the makefile rules.
3673 dnl The reference to AC_PROG_LIBTOOL does not normally work, since it uses
3674 dnl macros from libtool.m4 which is in the aclocal directory of automake.
3675 dnl Following is a simple script which turns on the AC_PROG_LIBTOOL macro.
3676 dnl But that still does not work properly since the macro is expanded outside
3677 dnl the CF_WITH_LIBTOOL macro:
3680 dnl ACLOCAL=`aclocal --print-ac-dir`
3681 dnl if test -z "$ACLOCAL" ; then
3682 dnl echo cannot find aclocal directory
3684 dnl elif test ! -f $ACLOCAL/libtool.m4 ; then
3685 dnl echo cannot find libtool.m4 file
3689 dnl LOCAL=aclocal.m4
3690 dnl ORIG=aclocal.m4.orig
3692 dnl trap "mv $ORIG $LOCAL" 0 1 2 5 15
3696 dnl # sed the LIBTOOL= assignment to omit the current directory?
3697 dnl sed -e 's/^LIBTOOL=.*/LIBTOOL=${LIBTOOL:-libtool}/' $ACLOCAL/libtool.m4 >>$LOCAL
3698 dnl cat $ORIG >>$LOCAL
3702 AC_DEFUN([CF_WITH_LIBTOOL],
3704 AC_REQUIRE([CF_DISABLE_LIBTOOL_VERSION])
3705 ifdef([AC_PROG_LIBTOOL],,[
3708 # common library maintenance symbols that are convenient for libtool scripts:
3709 LIB_CREATE='${AR} -cr'
3710 LIB_OBJECT='${OBJECTS}'
3714 # symbols used to prop libtool up to enable it to determine what it should be
3722 AC_MSG_CHECKING(if you want to build libraries with libtool)
3723 AC_ARG_WITH(libtool,
3724 [ --with-libtool generate libraries with libtool],
3725 [with_libtool=$withval],
3727 AC_MSG_RESULT($with_libtool)
3728 if test "$with_libtool" != "no"; then
3729 ifdef([AC_PROG_LIBTOOL],[
3730 # missing_content_AC_PROG_LIBTOOL{{
3732 # missing_content_AC_PROG_LIBTOOL}}
3734 if test "$with_libtool" != "yes" ; then
3735 CF_PATH_SYNTAX(with_libtool)
3736 LIBTOOL=$with_libtool
3738 AC_PATH_PROG(LIBTOOL,libtool)
3740 if test -z "$LIBTOOL" ; then
3741 AC_MSG_ERROR(Cannot find libtool)
3744 LIB_CREATE='${LIBTOOL} --mode=link ${CC} -rpath ${DESTDIR}${libdir} ${LIBTOOL_VERSION} `cut -f1 ${srcdir}/VERSION` ${LIBTOOL_OPTS} ${LT_UNDEF} $(LIBS) -o'
3745 LIB_OBJECT='${OBJECTS:.o=.lo}'
3747 LIB_CLEAN='${LIBTOOL} --mode=clean'
3748 LIB_COMPILE='${LIBTOOL} --mode=compile'
3749 LIB_LINK='${LIBTOOL} --mode=link ${CC} ${LIBTOOL_OPTS}'
3750 LIB_INSTALL='${LIBTOOL} --mode=install'
3751 LIB_UNINSTALL='${LIBTOOL} --mode=uninstall'
3754 # Show the version of libtool
3755 AC_MSG_CHECKING(version of libtool)
3757 # Save the version in a cache variable - this is not entirely a good
3758 # thing, but the version string from libtool is very ugly, and for
3759 # bug reports it might be useful to have the original string. "("
3760 cf_cv_libtool_version=`$LIBTOOL --version 2>&1 | sed -e '/^$/d' |sed -e '2,$d' -e 's/([[^)]]*)//g' -e 's/^[[^1-9]]*//' -e 's/[[^0-9.]].*//'`
3761 AC_MSG_RESULT($cf_cv_libtool_version)
3762 if test -z "$cf_cv_libtool_version" ; then
3763 AC_MSG_ERROR(This is not GNU libtool)
3766 # special hack to add -no-undefined (which libtool should do for itself)
3768 case "$cf_cv_system_name" in #(vi
3769 cygwin*|mingw32*|uwin*|aix[[4-7]]) #(vi
3770 LT_UNDEF=-no-undefined
3773 AC_SUBST([LT_UNDEF])
3775 # special hack to add --tag option for C++ compiler
3776 case $cf_cv_libtool_version in #(vi
3777 1.[[5-9]]*|[[2-9]].[[0-9.a-z]]*) #(vi
3778 LIBTOOL_CXX="$LIBTOOL --tag=CXX"
3779 LIBTOOL="$LIBTOOL --tag=CC"
3782 LIBTOOL_CXX="$LIBTOOL"
3790 test -z "$LIBTOOL" && ECHO_LT=
3793 AC_SUBST(LIBTOOL_CXX)
3794 AC_SUBST(LIBTOOL_OPTS)
3796 AC_SUBST(LIB_CREATE)
3797 AC_SUBST(LIB_OBJECT)
3798 AC_SUBST(LIB_SUFFIX)
3802 AC_SUBST(LIB_COMPILE)
3804 AC_SUBST(LIB_INSTALL)
3805 AC_SUBST(LIB_UNINSTALL)
3808 dnl ---------------------------------------------------------------------------
3809 dnl CF_WITH_LIBTOOL_OPTS version: 2 updated: 2007/04/08 18:14:54
3810 dnl --------------------
3811 dnl Allow user to pass additional libtool options into the library creation
3812 dnl and link steps. The main use for this is to do something like
3813 dnl ./configure --with-libtool-opts=-static
3814 dnl to get the same behavior as automake-flavored
3815 dnl ./configure --enable-static
3816 AC_DEFUN([CF_WITH_LIBTOOL_OPTS],[
3817 AC_MSG_CHECKING(for additional libtool options)
3818 AC_ARG_WITH(libtool-opts,
3819 [ --with-libtool-opts=XXX specify additional libtool options],
3820 [with_libtool_opts=$withval],
3821 [with_libtool_opts=no])
3822 AC_MSG_RESULT($with_libtool_opts)
3824 case .$with_libtool_opts in
3828 LIBTOOL_OPTS=$with_libtool_opts
3832 AC_SUBST(LIBTOOL_OPTS)
3834 dnl ---------------------------------------------------------------------------
3835 dnl CF_WITH_NO_LEAKS version: 2 updated: 2012/10/06 08:57:51
3836 dnl ----------------
3837 AC_DEFUN([CF_WITH_NO_LEAKS],[
3839 AC_REQUIRE([CF_WITH_DMALLOC])
3840 AC_REQUIRE([CF_WITH_DBMALLOC])
3841 AC_REQUIRE([CF_WITH_PURIFY])
3842 AC_REQUIRE([CF_WITH_VALGRIND])
3844 AC_MSG_CHECKING(if you want to perform memory-leak testing)
3845 AC_ARG_WITH(no-leaks,
3846 [ --with-no-leaks test: free permanent memory, analyze leaks],
3847 [AC_DEFINE(NO_LEAKS,1,[Define to 1 to enable leak-checking])
3848 cf_doalloc=".${with_dmalloc}${with_dbmalloc}${with_purify}${with_valgrind}"
3849 case ${cf_doalloc} in #(vi
3851 *) AC_DEFINE(DOALLOC,10000,[Define to size of malloc-array]) ;;
3855 AC_MSG_RESULT($with_no_leaks)
3857 dnl ---------------------------------------------------------------------------
3858 dnl CF_WITH_PURIFY version: 2 updated: 2006/12/14 18:43:43
3860 AC_DEFUN([CF_WITH_PURIFY],[
3861 CF_NO_LEAKS_OPTION(purify,
3862 [ --with-purify test: use Purify],
3864 [LINK_PREFIX="$LINK_PREFIX purify"])
3865 AC_SUBST(LINK_PREFIX)
3867 dnl ---------------------------------------------------------------------------
3868 dnl CF_WITH_VALGRIND version: 1 updated: 2006/12/14 18:00:21
3869 dnl ----------------
3870 AC_DEFUN([CF_WITH_VALGRIND],[
3871 CF_NO_LEAKS_OPTION(valgrind,
3872 [ --with-valgrind test: use valgrind],
3875 dnl ---------------------------------------------------------------------------
3876 dnl CF_WITH_WARNINGS version: 5 updated: 2004/07/23 14:40:34
3877 dnl ----------------
3878 dnl Combine the checks for gcc features into a configure-script option
3881 dnl $1 - see CF_GCC_WARNINGS
3882 AC_DEFUN([CF_WITH_WARNINGS],
3884 if ( test "$GCC" = yes || test "$GXX" = yes )
3886 AC_MSG_CHECKING(if you want to check for gcc warnings)
3887 AC_ARG_WITH(warnings,
3888 [ --with-warnings test: turn on gcc warnings],
3889 [cf_opt_with_warnings=$withval],
3890 [cf_opt_with_warnings=no])
3891 AC_MSG_RESULT($cf_opt_with_warnings)
3892 if test "$cf_opt_with_warnings" != no ; then
3894 CF_GCC_WARNINGS([$1])
3898 dnl ---------------------------------------------------------------------------
3899 dnl CF_XOPEN_CURSES version: 11 updated: 2011/01/18 18:15:30
3901 dnl Test if we should define X/Open source for curses, needed on Digital Unix
3902 dnl 4.x, to see the extended functions, but breaks on IRIX 6.x.
3904 dnl The getbegyx() check is needed for HPUX, which omits legacy macros such
3905 dnl as getbegy(). The latter is better design, but the former is standard.
3906 AC_DEFUN([CF_XOPEN_CURSES],
3908 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
3909 AC_CACHE_CHECK(if we must define _XOPEN_SOURCE_EXTENDED,cf_cv_need_xopen_extension,[
3912 #include <${cf_cv_ncurses_header:-curses.h}>],[
3913 #if defined(NCURSES_VERSION_PATCH)
3914 #if (NCURSES_VERSION_PATCH < 20100501) && (NCURSES_VERSION_PATCH >= 20100403)
3918 long x = winnstr(stdscr, "", 0);
3920 getbegyx(stdscr, y1, x1)],
3921 [cf_cv_need_xopen_extension=no],
3923 #define _XOPEN_SOURCE_EXTENDED
3925 #include <${cf_cv_ncurses_header:-curses.h}>],[
3926 #ifdef NCURSES_VERSION
3928 int check2 = curs_set((int)sizeof(check));
3930 long x = winnstr(stdscr, "", 0);
3932 getbegyx(stdscr, y1, x1)],
3933 [cf_cv_need_xopen_extension=yes],
3934 [cf_cv_need_xopen_extension=unknown])])])
3935 test $cf_cv_need_xopen_extension = yes && CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
3937 dnl ---------------------------------------------------------------------------
3938 dnl CF_XOPEN_SOURCE version: 42 updated: 2012/01/07 08:26:49
3940 dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
3941 dnl or adapt to the vendor's definitions to get equivalent functionality,
3942 dnl without losing the common non-POSIX features.
3945 dnl $1 is the nominal value for _XOPEN_SOURCE
3946 dnl $2 is the nominal value for _POSIX_C_SOURCE
3947 AC_DEFUN([CF_XOPEN_SOURCE],[
3949 cf_XOPEN_SOURCE=ifelse([$1],,500,[$1])
3950 cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2])
3953 case $host_os in #(vi
3955 cf_xopen_source="-D_ALL_SOURCE"
3960 darwin[[0-8]].*) #(vi
3961 cf_xopen_source="-D_APPLE_C_SOURCE"
3964 cf_xopen_source="-D_DARWIN_C_SOURCE"
3967 freebsd*|dragonfly*) #(vi
3968 # 5.x headers associate
3969 # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L
3970 # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L
3971 cf_POSIX_C_SOURCE=200112L
3973 cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
3976 cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500"
3979 cf_xopen_source="-D_HPUX_SOURCE"
3982 cf_xopen_source="-D_SGI_SOURCE"
3985 linux*|gnu*|mint*|k*bsd*-gnu) #(vi
3989 # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <sys/select.h> and other headers which use u_int / u_short types
3991 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
3994 cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
3996 openbsd[[4-9]]*) #(vi
3997 # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw
3998 cf_xopen_source="-D_BSD_SOURCE"
4002 # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
4005 cf_xopen_source="-D_OSF_SOURCE"
4008 cf_xopen_source="-D_QNX_SOURCE"
4011 # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
4014 cf_xopen_source="-D__EXTENSIONS__"
4018 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
4022 if test -n "$cf_xopen_source" ; then
4023 CF_ADD_CFLAGS($cf_xopen_source)
4026 dnl In anything but the default case, we may have system-specific setting
4027 dnl which is still not guaranteed to provide all of the entrypoints that
4028 dnl _XOPEN_SOURCE would yield.
4029 if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then
4030 AC_MSG_CHECKING(if _XOPEN_SOURCE really is set)
4031 AC_TRY_COMPILE([#include <stdlib.h>],[
4032 #ifndef _XOPEN_SOURCE
4035 [cf_XOPEN_SOURCE_set=yes],
4036 [cf_XOPEN_SOURCE_set=no])
4037 AC_MSG_RESULT($cf_XOPEN_SOURCE_set)
4038 if test $cf_XOPEN_SOURCE_set = yes
4040 AC_TRY_COMPILE([#include <stdlib.h>],[
4041 #if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE
4044 [cf_XOPEN_SOURCE_set_ok=yes],
4045 [cf_XOPEN_SOURCE_set_ok=no])
4046 if test $cf_XOPEN_SOURCE_set_ok = no
4048 AC_MSG_WARN(_XOPEN_SOURCE is lower than requested)
4055 dnl ---------------------------------------------------------------------------
4056 dnl CF__CURSES_HEAD version: 2 updated: 2010/10/23 15:54:49
4058 dnl Define a reusable chunk which includes <curses.h> and <term.h> when they
4059 dnl are both available.
4060 define([CF__CURSES_HEAD],[
4062 #include <xcurses.h>
4063 char * XCursesProgramName = "test";
4065 #include <${cf_cv_ncurses_header:-curses.h}>
4066 #if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H)
4067 #include <ncursesw/term.h>
4068 #elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H)
4069 #include <ncurses/term.h>
4070 #elif defined(HAVE_TERM_H)
4075 dnl ---------------------------------------------------------------------------
4076 dnl CF__ICONV_BODY version: 2 updated: 2007/07/26 17:35:47
4078 dnl Test-code needed for iconv compile-checks
4079 define([CF__ICONV_BODY],[
4080 iconv_t cd = iconv_open("","");
4081 iconv(cd,NULL,NULL,NULL,NULL);
4084 dnl ---------------------------------------------------------------------------
4085 dnl CF__ICONV_HEAD version: 1 updated: 2007/07/26 15:57:03
4087 dnl Header-files needed for iconv compile-checks
4088 define([CF__ICONV_HEAD],[
4092 dnl ---------------------------------------------------------------------------
4093 dnl CF__INTL_BODY version: 1 updated: 2007/07/26 17:35:47
4095 dnl Test-code needed for libintl compile-checks
4096 dnl $1 = parameter 2 from AM_WITH_NLS
4097 define([CF__INTL_BODY],[
4098 bindtextdomain ("", "");
4099 return (int) gettext ("")
4100 ifelse([$1], need-ngettext, [ + (int) ngettext ("", "", 0)], [])
4101 [ + _nl_msg_cat_cntr]
4103 dnl ---------------------------------------------------------------------------
4104 dnl CF__INTL_HEAD version: 1 updated: 2007/07/26 17:35:47
4106 dnl Header-files needed for libintl compile-checks
4107 define([CF__INTL_HEAD],[
4108 #include <libintl.h>
4109 extern int _nl_msg_cat_cntr;
4111 dnl ---------------------------------------------------------------------------
4112 dnl jm_GLIBC21 version: 3 updated: 2002/10/27 23:21:42
4114 dnl Inserted as requested by gettext 0.10.40
4115 dnl File from /usr/share/aclocal
4117 dnl ====================
4120 dnl Test for the GNU C Library, version 2.1 or newer.
4121 dnl From Bruno Haible.
4122 AC_DEFUN([jm_GLIBC21],
4124 AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
4125 ac_cv_gnu_library_2_1,
4126 [AC_EGREP_CPP([Lucky GNU user],
4128 #include <features.h>
4129 #ifdef __GNU_LIBRARY__
4130 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
4135 ac_cv_gnu_library_2_1=yes,
4136 ac_cv_gnu_library_2_1=no)
4140 GLIBC21="$ac_cv_gnu_library_2_1"