1 dnl macros used for DIALOG configure script
2 dnl $Id: aclocal.m4,v 1.94 2013/09/22 14:26:24 tom Exp $
3 dnl ---------------------------------------------------------------------------
4 dnl Copyright 1999-2012,2013 -- 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: 4 updated: 2013/03/04 19:52:56
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([AC_ACVERSION], ,[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])dnl
603 ifdef([m4_version_compare],
604 [m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])],
605 [CF_ACVERSION_COMPARE(
606 AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])),
607 AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl
608 dnl ---------------------------------------------------------------------------
609 dnl CF_ACVERSION_COMPARE version: 3 updated: 2012/10/03 18:39:53
610 dnl --------------------
611 dnl CF_ACVERSION_COMPARE(MAJOR1, MINOR1, TERNARY1,
612 dnl MAJOR2, MINOR2, TERNARY2,
613 dnl PRINTABLE2, not FOUND, FOUND)
614 define([CF_ACVERSION_COMPARE],
615 [ifelse(builtin([eval], [$2 < $5]), 1,
616 [ifelse([$8], , ,[$8])],
617 [ifelse([$9], , ,[$9])])])dnl
618 dnl ---------------------------------------------------------------------------
619 dnl CF_ADD_CFLAGS version: 10 updated: 2010/05/26 05:38:42
621 dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS
622 dnl The second parameter if given makes this macro verbose.
624 dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS,
625 dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily
626 dnl confused by the quotes (which require backslashes to keep them usable).
627 AC_DEFUN([CF_ADD_CFLAGS],
632 cf_new_extra_cppflags=
634 for cf_add_cflags in $1
636 case $cf_fix_cppflags in
638 case $cf_add_cflags in #(vi
639 -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
640 case $cf_add_cflags in
642 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'`
644 test "${cf_add_cflags}" != "${cf_tst_cflags}" \
645 && test -z "${cf_tst_cflags}" \
646 && cf_fix_cppflags=yes
648 if test $cf_fix_cppflags = yes ; then
649 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
651 elif test "${cf_tst_cflags}" = "\"'" ; then
652 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
658 *$cf_add_cflags) #(vi
661 case $cf_add_cflags in #(vi
663 cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
664 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags)
667 cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
672 cf_new_cflags="$cf_new_cflags $cf_add_cflags"
677 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
679 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'`
681 test "${cf_add_cflags}" != "${cf_tst_cflags}" \
682 && test -z "${cf_tst_cflags}" \
683 && cf_fix_cppflags=no
688 if test -n "$cf_new_cflags" ; then
689 ifelse([$2],,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)])
690 CFLAGS="$CFLAGS $cf_new_cflags"
693 if test -n "$cf_new_cppflags" ; then
694 ifelse([$2],,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)])
695 CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
698 if test -n "$cf_new_extra_cppflags" ; then
699 ifelse([$2],,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)])
700 EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
703 AC_SUBST(EXTRA_CPPFLAGS)
706 dnl ---------------------------------------------------------------------------
707 dnl CF_ADD_INCDIR version: 13 updated: 2010/05/26 16:44:57
709 dnl Add an include-directory to $CPPFLAGS. Don't add /usr/include, since it's
710 dnl redundant. We don't normally need to add -I/usr/local/include for gcc,
711 dnl but old versions (and some misinstalled ones) need that. To make things
712 dnl worse, gcc 3.x may give error messages if -I/usr/local/include is added to
713 dnl the include-path).
714 AC_DEFUN([CF_ADD_INCDIR],
716 if test -n "$1" ; then
717 for cf_add_incdir in $1
719 while test $cf_add_incdir != /usr/include
721 if test -d $cf_add_incdir
724 if test -n "$CFLAGS$CPPFLAGS" ; then
725 # a loop is needed to ensure we can add subdirs of existing dirs
726 for cf_test_incdir in $CFLAGS $CPPFLAGS ; do
727 if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then
728 cf_have_incdir=yes; break
733 if test "$cf_have_incdir" = no ; then
734 if test "$cf_add_incdir" = /usr/local/include ; then
737 cf_save_CPPFLAGS=$CPPFLAGS
738 CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
739 AC_TRY_COMPILE([#include <stdio.h>],
742 [cf_have_incdir=yes])
743 CPPFLAGS=$cf_save_CPPFLAGS
748 if test "$cf_have_incdir" = no ; then
749 CF_VERBOSE(adding $cf_add_incdir to include-path)
750 ifelse([$2],,CPPFLAGS,[$2])="$ifelse([$2],,CPPFLAGS,[$2]) -I$cf_add_incdir"
752 cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'`
753 test "$cf_top_incdir" = "$cf_add_incdir" && break
754 cf_add_incdir="$cf_top_incdir"
763 dnl ---------------------------------------------------------------------------
764 dnl CF_ADD_LIB version: 2 updated: 2010/06/02 05:03:05
766 dnl Add a library, used to enforce consistency.
768 dnl $1 = library to add, without the "-l"
769 dnl $2 = variable to update (default $LIBS)
770 AC_DEFUN([CF_ADD_LIB],[CF_ADD_LIBS(-l$1,ifelse($2,,LIBS,[$2]))])dnl
771 dnl ---------------------------------------------------------------------------
772 dnl CF_ADD_LIBDIR version: 9 updated: 2010/05/26 16:44:57
774 dnl Adds to the library-path
776 dnl Some machines have trouble with multiple -L options.
778 dnl $1 is the (list of) directory(s) to add
779 dnl $2 is the optional name of the variable to update (default LDFLAGS)
781 AC_DEFUN([CF_ADD_LIBDIR],
783 if test -n "$1" ; then
784 for cf_add_libdir in $1
786 if test $cf_add_libdir = /usr/lib ; then
788 elif test -d $cf_add_libdir
791 if test -n "$LDFLAGS$LIBS" ; then
792 # a loop is needed to ensure we can add subdirs of existing dirs
793 for cf_test_libdir in $LDFLAGS $LIBS ; do
794 if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then
795 cf_have_libdir=yes; break
799 if test "$cf_have_libdir" = no ; then
800 CF_VERBOSE(adding $cf_add_libdir to library-path)
801 ifelse([$2],,LDFLAGS,[$2])="-L$cf_add_libdir $ifelse([$2],,LDFLAGS,[$2])"
807 dnl ---------------------------------------------------------------------------
808 dnl CF_ADD_LIBS version: 1 updated: 2010/06/02 05:03:05
810 dnl Add one or more libraries, used to enforce consistency.
812 dnl $1 = libraries to add, with the "-l", etc.
813 dnl $2 = variable to update (default $LIBS)
814 AC_DEFUN([CF_ADD_LIBS],[ifelse($2,,LIBS,[$2])="$1 [$]ifelse($2,,LIBS,[$2])"])dnl
815 dnl ---------------------------------------------------------------------------
816 dnl CF_ADD_OPTIONAL_PATH version: 1 updated: 2007/07/29 12:33:33
817 dnl --------------------
818 dnl Add an optional search-path to the compile/link variables.
821 dnl $1 = shell variable containing the result of --with-XXX=[DIR]
822 dnl $2 = module to look for.
823 AC_DEFUN([CF_ADD_OPTIONAL_PATH],[
830 CF_ADD_SEARCHPATH([$1], [AC_MSG_ERROR(cannot find $2 under $1)])
834 dnl ---------------------------------------------------------------------------
835 dnl CF_ADD_SEARCHPATH version: 5 updated: 2009/01/11 20:40:21
836 dnl -----------------
837 dnl Set $CPPFLAGS and $LDFLAGS with the directories given via the parameter.
838 dnl They can be either the common root of include- and lib-directories, or the
839 dnl lib-directory (to allow for things like lib64 directories).
840 dnl See also CF_FIND_LINKAGE.
842 dnl $1 is the list of colon-separated directory names to search.
843 dnl $2 is the action to take if a parameter does not yield a directory.
844 AC_DEFUN([CF_ADD_SEARCHPATH],
846 AC_REQUIRE([CF_PATHSEP])
847 for cf_searchpath in `echo "$1" | tr $PATH_SEPARATOR ' '`; do
848 if test -d $cf_searchpath/include; then
849 CF_ADD_INCDIR($cf_searchpath/include)
850 elif test -d $cf_searchpath/../include ; then
851 CF_ADD_INCDIR($cf_searchpath/../include)
855 if test -d $cf_searchpath/lib; then
856 CF_ADD_LIBDIR($cf_searchpath/lib)
857 elif test -d $cf_searchpath ; then
858 CF_ADD_LIBDIR($cf_searchpath)
864 dnl ---------------------------------------------------------------------------
865 dnl CF_ADD_SUBDIR_PATH version: 3 updated: 2010/07/03 20:58:12
866 dnl ------------------
867 dnl Append to a search-list for a nonstandard header/lib-file
868 dnl $1 = the variable to return as result
869 dnl $2 = the package name
870 dnl $3 = the subdirectory, e.g., bin, include or lib
871 dnl $4 = the directory under which we will test for subdirectories
872 dnl $5 = a directory that we do not want $4 to match
873 AC_DEFUN([CF_ADD_SUBDIR_PATH],
875 test "$4" != "$5" && \
877 ifelse([$5],NONE,,[(test $5 = NONE || test "$4" != "$5") &&]) {
878 test -n "$verbose" && echo " ... testing for $3-directories under $4"
879 test -d $4/$3 && $1="[$]$1 $4/$3"
880 test -d $4/$3/$2 && $1="[$]$1 $4/$3/$2"
881 test -d $4/$3/$2/$3 && $1="[$]$1 $4/$3/$2/$3"
882 test -d $4/$2/$3 && $1="[$]$1 $4/$2/$3"
883 test -d $4/$2/$3/$2 && $1="[$]$1 $4/$2/$3/$2"
886 dnl ---------------------------------------------------------------------------
887 dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31
889 dnl Allow user to disable a normally-on option.
890 AC_DEFUN([CF_ARG_DISABLE],
891 [CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl
892 dnl ---------------------------------------------------------------------------
893 dnl CF_ARG_MSG_ENABLE version: 2 updated: 2000/07/29 19:32:03
894 dnl -----------------
895 dnl Verbose form of AC_ARG_ENABLE:
901 dnl $4 = action to perform if option is enabled
902 dnl $5 = action if perform if option is disabled
903 dnl $6 = default option value (either 'yes' or 'no')
904 AC_DEFUN([CF_ARG_MSG_ENABLE],[
906 AC_ARG_ENABLE($2,[$3],,enableval=ifelse($6,,no,$6))
907 AC_MSG_RESULT($enableval)
908 if test "$enableval" != no ; then
914 dnl ---------------------------------------------------------------------------
915 dnl CF_ARG_OPTION version: 4 updated: 2010/05/26 05:38:42
917 dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus
923 dnl $3 = action to perform if option is not default
924 dnl $4 = action if perform if option is default
925 dnl $5 = default option value (either 'yes' or 'no')
926 AC_DEFUN([CF_ARG_OPTION],
927 [AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes)
928 if test "$enableval" != "$5" ; then
930 ,[ $3]) ifelse([$4],,,[
933 fi],[enableval=$5 ifelse([$4],,,[
937 dnl ---------------------------------------------------------------------------
938 dnl CF_BUNDLED_INTL version: 17 updated: 2012/10/06 08:57:51
940 dnl Top-level macro for configuring an application with a bundled copy of
941 dnl the intl and po directories for gettext.
943 dnl $1 specifies either Makefile or makefile, defaulting to the former.
944 dnl $2 if nonempty sets the option to --enable-nls rather than to --disable-nls
946 dnl Sets variables which can be used to substitute in makefiles:
947 dnl GT_YES - "#" comment unless building intl library, otherwise empty
948 dnl GT_NO - "#" comment if building intl library, otherwise empty
949 dnl INTLDIR_MAKE - to make ./intl directory
950 dnl MSG_DIR_MAKE - to make ./po directory
951 dnl SUB_MAKEFILE - list of makefiles in ./intl, ./po directories
954 dnl HAVE_LIBGETTEXT_H if we're using ./intl
958 dnl ALL_LINGUAS if set, lists the root names of the ".po" files.
959 dnl CONFIG_H assumed to be "config.h"
960 dnl PACKAGE must be set, used as default for textdomain
961 dnl VERSION may be set, otherwise extract from "VERSION" file.
963 AC_DEFUN([CF_BUNDLED_INTL],[
964 cf_makefile=ifelse($1,,Makefile,$1)
966 dnl Set of available languages (based on source distribution). Note that
967 dnl setting $LINGUAS overrides $ALL_LINGUAS. Some environments set $LINGUAS
968 dnl rather than $LC_ALL
969 test -z "$ALL_LINGUAS" && ALL_LINGUAS=`test -d $srcdir/po && cd $srcdir/po && echo *.po|sed -e 's/\.po//g' -e 's/*//'`
971 # Allow override of "config.h" definition:
972 : ${CONFIG_H:=config.h}
975 if test -z "$PACKAGE" ; then
976 AC_MSG_ERROR([[CF_BUNDLED_INTL] used without setting [PACKAGE] variable])
979 if test -z "$VERSION" ; then
980 if test -f $srcdir/VERSION ; then
981 VERSION=`sed -e '2,$d' $srcdir/VERSION|cut -f1`
988 AM_GNU_GETTEXT(,,,[$2])
990 if test "$USE_NLS" = yes ; then
991 AC_ARG_WITH(textdomain,
992 [ --with-textdomain=PKG NLS text-domain (default is package name)],
993 [NLS_TEXTDOMAIN=$withval],
994 [NLS_TEXTDOMAIN=$PACKAGE])
995 AC_DEFINE_UNQUOTED(NLS_TEXTDOMAIN,"$NLS_TEXTDOMAIN",[Define to the nls textdomain value])
996 AC_SUBST(NLS_TEXTDOMAIN)
1003 dnl this updates SUB_MAKEFILE and MSG_DIR_MAKE:
1006 if test "$USE_INCLUDED_LIBINTL" = yes ; then
1007 if test "$nls_cv_force_use_gnu_gettext" = yes ; then
1009 elif test "$nls_cv_use_gnu_gettext" = yes ; then
1014 if test -z "$INTLDIR_MAKE"; then
1015 AC_DEFINE(HAVE_LIBGETTEXT_H,1,[Define to 1 if we have libgettext.h])
1016 for cf_makefile in \
1017 $srcdir/intl/Makefile.in \
1018 $srcdir/intl/makefile.in
1020 if test -f "$cf_makefile" ; then
1021 SUB_MAKEFILE="$SUB_MAKEFILE `echo \"${cf_makefile}\"|sed -e 's,^'$srcdir/',,' -e 's/\.in$//'`:${cf_makefile}"
1028 if test "$USE_NLS" = yes ; then
1029 AC_CHECK_HEADERS(libintl.h)
1033 if test -z "$INTLDIR_MAKE" ; then
1034 CPPFLAGS="$CPPFLAGS -I../intl"
1037 dnl FIXME: we use this in lynx (the alternative is a spurious dependency upon
1039 if test "$BUILD_INCLUDED_LIBINTL" = yes ; then
1047 AC_SUBST(INTLDIR_MAKE)
1048 AC_SUBST(MSG_DIR_MAKE)
1052 dnl FIXME: the underlying AM_GNU_GETTEXT macro either needs some fixes or a
1053 dnl little documentation. It doesn't define anything so that we can ifdef our
1054 dnl own code, except ENABLE_NLS, which is too vague to be of any use.
1056 if test "$USE_INCLUDED_LIBINTL" = yes ; then
1057 if test "$nls_cv_force_use_gnu_gettext" = yes ; then
1058 AC_DEFINE(HAVE_GETTEXT,1,[Define to 1 if we have gettext function])
1059 elif test "$nls_cv_use_gnu_gettext" = yes ; then
1060 AC_DEFINE(HAVE_GETTEXT,1,[Define to 1 if we have gettext function])
1062 if test -n "$nls_cv_header_intl" ; then
1063 AC_DEFINE(HAVE_LIBINTL_H,1,[Define to 1 if we have header-file for libintl])
1067 dnl ---------------------------------------------------------------------------
1068 dnl CF_CC_ENV_FLAGS version: 1 updated: 2012/10/03 05:25:49
1070 dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content
1071 dnl into CC. This will not help with broken scripts that wrap the compiler with
1072 dnl options, but eliminates a more common category of user confusion.
1073 AC_DEFUN([CF_CC_ENV_FLAGS],
1075 # This should have been defined by AC_PROG_CC
1078 AC_MSG_CHECKING(\$CC variable)
1081 AC_MSG_RESULT(broken)
1082 AC_MSG_WARN(your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options)
1084 cf_flags=`echo "$CC" | sed -e 's/^[[^ ]]*[[ ]]//'`
1085 CC=`echo "$CC" | sed -e 's/[[ ]].*//'`
1086 CF_ADD_CFLAGS($cf_flags)
1093 dnl ---------------------------------------------------------------------------
1094 dnl CF_CHECK_CACHE version: 12 updated: 2012/10/02 20:55:03
1096 dnl Check if we're accidentally using a cache from a different machine.
1097 dnl Derive the system name, as a check for reusing the autoconf cache.
1099 dnl If we've packaged config.guess and config.sub, run that (since it does a
1100 dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow
1101 dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM
1102 dnl which is useful in cross-compiles.
1104 dnl Note: we would use $ac_config_sub, but that is one of the places where
1105 dnl autoconf 2.5x broke compatibility with autoconf 2.13
1106 AC_DEFUN([CF_CHECK_CACHE],
1108 if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then
1109 ifelse([$1],,[AC_CANONICAL_HOST],[$1])
1110 system_name="$host_os"
1112 system_name="`(uname -s -r) 2>/dev/null`"
1113 if test -z "$system_name" ; then
1114 system_name="`(hostname) 2>/dev/null`"
1117 test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name",[Define to the system name.])
1118 AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
1120 test -z "$system_name" && system_name="$cf_cv_system_name"
1121 test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name)
1123 if test ".$system_name" != ".$cf_cv_system_name" ; then
1124 AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name))
1125 AC_MSG_ERROR("Please remove config.cache and try again.")
1128 dnl ---------------------------------------------------------------------------
1129 dnl CF_CHECK_LIBTOOL_VERSION version: 1 updated: 2013/04/06 18:03:09
1130 dnl ------------------------
1131 dnl Show the version of libtool
1133 dnl Save the version in a cache variable - this is not entirely a good thing,
1134 dnl but the version string from libtool is very ugly, and for bug reports it
1135 dnl might be useful to have the original string.
1136 AC_DEFUN([CF_CHECK_LIBTOOL_VERSION],[
1137 if test -n "$LIBTOOL" && test "$LIBTOOL" != none
1139 AC_MSG_CHECKING(version of $LIBTOOL)
1141 AC_MSG_RESULT($cf_cv_libtool_version)
1142 if test -z "$cf_cv_libtool_version" ; then
1143 AC_MSG_ERROR(This is not GNU libtool)
1146 AC_MSG_ERROR(GNU libtool has not been found)
1149 dnl ---------------------------------------------------------------------------
1150 dnl CF_CLANG_COMPILER version: 1 updated: 2012/06/16 14:55:39
1151 dnl -----------------
1152 dnl Check if the given compiler is really clang. clang's C driver defines
1153 dnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does
1154 dnl not ignore some gcc options.
1156 dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
1157 dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from
1158 dnl the wrappers for gcc and g++ warnings.
1160 dnl $1 = GCC (default) or GXX
1161 dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
1162 dnl $3 = CFLAGS (default) or CXXFLAGS
1163 AC_DEFUN([CF_CLANG_COMPILER],[
1164 ifelse([$2],,CLANG_COMPILER,[$2])=no
1166 if test "$ifelse([$1],,[$1],GCC)" = yes ; then
1167 AC_MSG_CHECKING(if this is really Clang ifelse([$1],GXX,C++,C) compiler)
1168 cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])"
1169 ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -Qunused-arguments"
1175 ],[ifelse([$2],,CLANG_COMPILER,[$2])=yes
1176 cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments"
1178 ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
1179 AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2]))
1182 dnl ---------------------------------------------------------------------------
1183 dnl CF_CURSES_CHTYPE version: 8 updated: 2012/10/06 08:57:51
1184 dnl ----------------
1185 dnl Test if curses defines 'chtype' (usually a 'long' type for SysV curses).
1186 AC_DEFUN([CF_CURSES_CHTYPE],
1188 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
1189 AC_CACHE_CHECK(for chtype typedef,cf_cv_chtype_decl,[
1190 AC_TRY_COMPILE([#include <${cf_cv_ncurses_header:-curses.h}>],
1192 [cf_cv_chtype_decl=yes],
1193 [cf_cv_chtype_decl=no])])
1194 if test $cf_cv_chtype_decl = yes ; then
1195 AC_DEFINE(HAVE_TYPE_CHTYPE,1,[Define to 1 if chtype is declared])
1196 AC_CACHE_CHECK(if chtype is scalar or struct,cf_cv_chtype_type,[
1197 AC_TRY_COMPILE([#include <${cf_cv_ncurses_header:-curses.h}>],
1198 [chtype foo; long x = foo],
1199 [cf_cv_chtype_type=scalar],
1200 [cf_cv_chtype_type=struct])])
1201 if test $cf_cv_chtype_type = scalar ; then
1202 AC_DEFINE(TYPE_CHTYPE_IS_SCALAR,1,[Define to 1 if chtype is a scaler/integer])
1206 dnl ---------------------------------------------------------------------------
1207 dnl CF_CURSES_CONFIG version: 2 updated: 2006/10/29 11:06:27
1208 dnl ----------------
1209 dnl Tie together the configure-script macros for curses. It may be ncurses,
1210 dnl but unless asked, we do not make a special search for ncurses. However,
1211 dnl still check for the ncurses version number, for use in other macros.
1212 AC_DEFUN([CF_CURSES_CONFIG],
1218 dnl ---------------------------------------------------------------------------
1219 dnl CF_CURSES_CPPFLAGS version: 11 updated: 2011/04/09 14:51:08
1220 dnl ------------------
1221 dnl Look for the curses headers.
1222 AC_DEFUN([CF_CURSES_CPPFLAGS],[
1224 AC_CACHE_CHECK(for extra include directories,cf_cv_curses_incdir,[
1225 cf_cv_curses_incdir=no
1226 case $host_os in #(vi
1228 if test "x$cf_cv_screen" = "xcurses_colr"
1230 test -d /usr/include/curses_colr && \
1231 cf_cv_curses_incdir="-I/usr/include/curses_colr"
1235 if test "x$cf_cv_screen" = "xcurses_5lib"
1237 test -d /usr/5lib && \
1238 test -d /usr/5include && \
1239 cf_cv_curses_incdir="-I/usr/5include"
1244 test "$cf_cv_curses_incdir" != no && CPPFLAGS="$CPPFLAGS $cf_cv_curses_incdir"
1249 dnl ---------------------------------------------------------------------------
1250 dnl CF_CURSES_FUNCS version: 17 updated: 2011/05/14 16:07:29
1252 dnl Curses-functions are a little complicated, since a lot of them are macros.
1253 AC_DEFUN([CF_CURSES_FUNCS],
1255 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
1256 AC_REQUIRE([CF_XOPEN_CURSES])
1257 AC_REQUIRE([CF_CURSES_TERM_H])
1258 AC_REQUIRE([CF_CURSES_UNCTRL_H])
1261 CF_UPPER(cf_tr_func,$cf_func)
1262 AC_MSG_CHECKING(for ${cf_func})
1263 CF_MSG_LOG(${cf_func})
1264 AC_CACHE_VAL(cf_cv_func_$cf_func,[
1265 eval cf_result='$ac_cv_func_'$cf_func
1266 if test ".$cf_result" != ".no"; then
1267 AC_TRY_LINK(CF__CURSES_HEAD,
1270 long foo = (long)(&${cf_func});
1271 if (foo + 1234 > 5678)
1272 ${cf_cv_main_return:-return}(foo);
1278 eval 'cf_cv_func_'$cf_func'=$cf_result'
1280 # use the computed/retrieved cache-value:
1281 eval 'cf_result=$cf_cv_func_'$cf_func
1282 AC_MSG_RESULT($cf_result)
1283 if test $cf_result != no; then
1284 AC_DEFINE_UNQUOTED(HAVE_${cf_tr_func})
1288 dnl ---------------------------------------------------------------------------
1289 dnl CF_CURSES_HEADER version: 3 updated: 2011/05/01 19:47:45
1290 dnl ----------------
1291 dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
1292 dnl variations of ncurses' installs.
1294 dnl $1 = ncurses when looking for ncurses, or is empty
1295 AC_DEFUN([CF_CURSES_HEADER],[
1296 AC_CACHE_CHECK(if we have identified curses headers,cf_cv_ncurses_header,[
1297 cf_cv_ncurses_header=none
1298 for cf_header in ifelse($1,,,[ \
1302 curses.h ifelse($1,,[ncurses/ncurses.h ncurses/curses.h])
1304 AC_TRY_COMPILE([#include <${cf_header}>],
1305 [initscr(); tgoto("?", 0,0)],
1306 [cf_cv_ncurses_header=$cf_header; break],[])
1310 if test "$cf_cv_ncurses_header" = none ; then
1311 AC_MSG_ERROR(No curses header-files found)
1314 # cheat, to get the right #define's for HAVE_NCURSES_H, etc.
1315 AC_CHECK_HEADERS($cf_cv_ncurses_header)
1317 dnl ---------------------------------------------------------------------------
1318 dnl CF_CURSES_LIBS version: 37 updated: 2013/02/09 17:33:50
1320 dnl Look for the curses libraries. Older curses implementations may require
1321 dnl termcap/termlib to be linked as well. Call CF_CURSES_CPPFLAGS first.
1322 AC_DEFUN([CF_CURSES_LIBS],[
1324 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
1325 AC_MSG_CHECKING(if we have identified curses libraries)
1326 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
1327 [initscr(); tgoto("?", 0,0)],
1330 AC_MSG_RESULT($cf_result)
1332 if test "$cf_result" = no ; then
1333 case $host_os in #(vi
1335 AC_CHECK_LIB(mytinfo,tgoto,[CF_ADD_LIBS(-lmytinfo)])
1338 # Looking at HPUX 10.20, the Hcurses library is the oldest (1997), cur_colr
1339 # next (1998), and xcurses "newer" (2000). There is no header file for
1340 # Hcurses; the subdirectory curses_colr has the headers (curses.h and
1341 # term.h) for cur_colr
1342 if test "x$cf_cv_screen" = "xcurses_colr"
1344 AC_CHECK_LIB(cur_colr,initscr,[
1345 CF_ADD_LIBS(-lcur_colr)
1346 ac_cv_func_initscr=yes
1348 AC_CHECK_LIB(Hcurses,initscr,[
1349 # HP's header uses __HP_CURSES, but user claims _HP_CURSES.
1350 CF_ADD_LIBS(-lHcurses)
1351 CPPFLAGS="$CPPFLAGS -D__HP_CURSES -D_HP_CURSES"
1352 ac_cv_func_initscr=yes
1357 case `arch 2>/dev/null` in
1361 CF_ADD_LIBDIR(/lib64)
1372 if test "x$cf_cv_screen" = "xcurses_5lib"
1374 if test -d /usr/5lib ; then
1375 CF_ADD_LIBDIR(/usr/5lib)
1376 CF_ADD_LIBS(-lcurses -ltermcap)
1379 ac_cv_func_initscr=yes
1383 if test ".$ac_cv_func_initscr" != .yes ; then
1384 cf_save_LIBS="$LIBS"
1386 if test ".${cf_cv_ncurses_version:-no}" != .no
1388 cf_check_list="ncurses curses cursesX"
1390 cf_check_list="cursesX curses ncurses"
1393 # Check for library containing tgoto. Do this before curses library
1394 # because it may be needed to link the test-case for initscr.
1395 if test "x$cf_term_lib" = x
1397 AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[
1398 for cf_term_lib in $cf_check_list otermcap termcap tinfo termlib unknown
1400 AC_CHECK_LIB($cf_term_lib,tgoto,[break])
1405 # Check for library containing initscr
1406 test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS"
1407 if test "x$cf_curs_lib" = x
1409 for cf_curs_lib in $cf_check_list xcurses jcurses pdcurses unknown
1411 AC_CHECK_LIB($cf_curs_lib,initscr,[break])
1414 test $cf_curs_lib = unknown && AC_MSG_ERROR(no curses library found)
1416 LIBS="-l$cf_curs_lib $cf_save_LIBS"
1417 if test "$cf_term_lib" = unknown ; then
1418 AC_MSG_CHECKING(if we can link with $cf_curs_lib library)
1419 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
1423 AC_MSG_RESULT($cf_result)
1424 test $cf_result = no && AC_MSG_ERROR(Cannot link curses library)
1425 elif test "$cf_curs_lib" = "$cf_term_lib" ; then
1427 elif test "$cf_term_lib" != predefined ; then
1428 AC_MSG_CHECKING(if we need both $cf_curs_lib and $cf_term_lib libraries)
1429 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
1430 [initscr(); tgoto((char *)0, 0, 0);],
1433 LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS"
1434 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
1439 AC_MSG_RESULT($cf_result)
1445 dnl ---------------------------------------------------------------------------
1446 dnl CF_CURSES_TERM_H version: 10 updated: 2012/10/06 08:57:51
1447 dnl ----------------
1448 dnl SVr4 curses should have term.h as well (where it puts the definitions of
1449 dnl the low-level interface). This may not be true in old/broken implementations,
1450 dnl as well as in misconfigured systems (e.g., gcc configured for Solaris 2.4
1451 dnl running with Solaris 2.5.1).
1452 AC_DEFUN([CF_CURSES_TERM_H],
1454 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
1456 AC_CACHE_CHECK(for term.h, cf_cv_term_header,[
1458 # If we found <ncurses/curses.h>, look for <ncurses/term.h>, but always look
1459 # for <term.h> if we do not find the variant.
1461 cf_header_list="term.h ncurses/term.h ncursesw/term.h"
1463 case ${cf_cv_ncurses_header:-curses.h} in #(vi
1465 cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`term.h
1466 cf_header_list="$cf_header_item $cf_header_list"
1470 for cf_header in $cf_header_list
1473 #include <${cf_cv_ncurses_header:-curses.h}>
1474 #include <${cf_header}>],
1476 [cf_cv_term_header=$cf_header
1478 [cf_cv_term_header=no])
1481 case $cf_cv_term_header in #(vi
1483 # If curses is ncurses, some packagers still mess it up by trying to make
1484 # us use GNU termcap. This handles the most common case.
1485 for cf_header in ncurses/term.h ncursesw/term.h
1488 #include <${cf_cv_ncurses_header:-curses.h}>
1489 #ifdef NCURSES_VERSION
1490 #include <${cf_header}>
1495 [cf_cv_term_header=$cf_header
1497 [cf_cv_term_header=no])
1503 case $cf_cv_term_header in #(vi
1505 AC_DEFINE(HAVE_TERM_H,1,[Define to 1 if we have term.h])
1507 ncurses/term.h) #(vi
1508 AC_DEFINE(HAVE_NCURSES_TERM_H,1,[Define to 1 if we have ncurses/term.h])
1511 AC_DEFINE(HAVE_NCURSESW_TERM_H,1,[Define to 1 if we have ncursesw/term.h])
1515 dnl ---------------------------------------------------------------------------
1516 dnl CF_CURSES_UNCTRL_H version: 2 updated: 2012/10/06 08:57:51
1517 dnl ------------------
1518 dnl Any X/Open curses implementation must have unctrl.h, but ncurses packages
1519 dnl may put it in a subdirectory (along with ncurses' other headers, of
1520 dnl course). Packages which put the headers in inconsistent locations are
1522 AC_DEFUN([CF_CURSES_UNCTRL_H],
1524 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
1526 AC_CACHE_CHECK(for unctrl.h, cf_cv_unctrl_header,[
1528 # If we found <ncurses/curses.h>, look for <ncurses/unctrl.h>, but always look
1529 # for <unctrl.h> if we do not find the variant.
1531 cf_header_list="unctrl.h ncurses/unctrl.h ncursesw/unctrl.h"
1533 case ${cf_cv_ncurses_header:-curses.h} in #(vi
1535 cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`unctrl.h
1536 cf_header_list="$cf_header_item $cf_header_list"
1540 for cf_header in $cf_header_list
1543 #include <${cf_cv_ncurses_header:-curses.h}>
1544 #include <${cf_header}>],
1546 [cf_cv_unctrl_header=$cf_header
1548 [cf_cv_unctrl_header=no])
1551 case $cf_cv_unctrl_header in #(vi
1553 AC_MSG_WARN(unctrl.h header not found)
1558 case $cf_cv_unctrl_header in #(vi
1560 AC_DEFINE(HAVE_UNCTRL_H,1,[Define to 1 if we have unctrl.h])
1562 ncurses/unctrl.h) #(vi
1563 AC_DEFINE(HAVE_NCURSES_UNCTRL_H,1,[Define to 1 if we have ncurses/unctrl.h])
1566 AC_DEFINE(HAVE_NCURSESW_UNCTRL_H,1,[Define to 1 if we have ncursesw/unctrl.h])
1570 dnl ---------------------------------------------------------------------------
1571 dnl CF_CURSES_WACS_MAP version: 6 updated: 2012/10/06 08:57:51
1572 dnl ------------------
1573 dnl Check for likely values of wacs_map[].
1574 AC_DEFUN([CF_CURSES_WACS_MAP],
1576 AC_CACHE_CHECK(for wide alternate character set array, cf_cv_curses_wacs_map,[
1577 cf_cv_curses_wacs_map=unknown
1578 for name in wacs_map _wacs_map __wacs_map _nc_wacs _wacs_char
1581 #ifndef _XOPEN_SOURCE_EXTENDED
1582 #define _XOPEN_SOURCE_EXTENDED
1584 #include <${cf_cv_ncurses_header:-curses.h}>],
1585 [void *foo = &($name['k'])],
1586 [cf_cv_curses_wacs_map=$name
1590 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])
1592 dnl ---------------------------------------------------------------------------
1593 dnl CF_CURSES_WACS_SYMBOLS version: 2 updated: 2012/10/06 08:57:51
1594 dnl ----------------------
1595 dnl Do a check to see if the WACS_xxx constants are defined compatibly with
1596 dnl X/Open Curses. In particular, NetBSD's implementation of the WACS_xxx
1597 dnl constants is broken since those constants do not point to cchar_t's.
1598 AC_DEFUN([CF_CURSES_WACS_SYMBOLS],
1600 AC_REQUIRE([CF_CURSES_WACS_MAP])
1602 AC_CACHE_CHECK(for wide alternate character constants, cf_cv_curses_wacs_symbols,[
1603 cf_cv_curses_wacs_symbols=no
1604 if test "$cf_cv_curses_wacs_map" != unknown
1607 #ifndef _XOPEN_SOURCE_EXTENDED
1608 #define _XOPEN_SOURCE_EXTENDED
1610 #include <${cf_cv_ncurses_header:-curses.h}>],
1611 [cchar_t *foo = WACS_PLUS;
1612 $cf_cv_curses_wacs_map['k'] = *WACS_PLUS],
1613 [cf_cv_curses_wacs_symbols=yes])
1616 #ifndef _XOPEN_SOURCE_EXTENDED
1617 #define _XOPEN_SOURCE_EXTENDED
1619 #include <${cf_cv_ncurses_header:-curses.h}>],
1620 [cchar_t *foo = WACS_PLUS],
1621 [cf_cv_curses_wacs_symbols=yes])
1625 test "$cf_cv_curses_wacs_symbols" != no && AC_DEFINE(CURSES_WACS_SYMBOLS,1,[Define to 1 if (n)curses supports wide-character WACS_ symbols])
1627 dnl ---------------------------------------------------------------------------
1628 dnl CF_CURSES_WGETPARENT version: 3 updated: 2012/10/06 08:57:51
1629 dnl --------------------
1630 dnl Check for curses support for directly determining the parent of a given
1631 dnl window. Some implementations make this difficult, so we provide for
1632 dnl defining an application-specific function that gives this functionality.
1634 dnl $1 = name of function to use if the feature is missing
1635 AC_DEFUN([CF_CURSES_WGETPARENT],[
1636 CF_CURSES_FUNCS(wgetparent)
1637 if test "x$cf_cv_func_wgetparent" != xyes
1639 AC_MSG_CHECKING(if WINDOW has _parent member)
1640 AC_TRY_COMPILE([#include <${cf_cv_ncurses_header:-curses.h}>],
1641 [WINDOW *p = stdscr->_parent],
1642 [cf_window__parent=yes],
1643 [cf_window__parent=no])
1644 AC_MSG_RESULT($cf_window__parent)
1645 if test "$cf_window__parent" = yes
1647 AC_DEFINE(HAVE_WINDOW__PARENT,1,[Define to 1 if WINDOW struct has _parent member])
1651 dnl ---------------------------------------------------------------------------
1652 dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52
1654 dnl "dirname" is not portable, so we fake it with a shell script.
1655 AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl
1656 dnl ---------------------------------------------------------------------------
1657 dnl CF_DISABLE_ECHO version: 12 updated: 2012/10/06 16:30:28
1659 dnl You can always use "make -n" to see the actual options, but it's hard to
1660 dnl pick out/analyze warning messages when the compile-line is long.
1663 dnl ECHO_LT - symbol to control if libtool is verbose
1664 dnl ECHO_LD - symbol to prefix "cc -o" lines
1665 dnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o)
1666 dnl SHOW_CC - symbol to put before explicit "cc -c" lines
1667 dnl ECHO_CC - symbol to put before any "cc" line
1669 AC_DEFUN([CF_DISABLE_ECHO],[
1670 AC_MSG_CHECKING(if you want to see long compiling messages)
1671 CF_ARG_DISABLE(echo,
1672 [ --disable-echo do not display "compiling" commands],
1675 ECHO_LD='@echo linking [$]@;'
1676 RULE_CC='@echo compiling [$]<'
1677 SHOW_CC='@echo compiling [$]@'
1686 AC_MSG_RESULT($enableval)
1693 dnl ---------------------------------------------------------------------------
1694 dnl CF_DISABLE_LIBTOOL_VERSION version: 1 updated: 2010/05/15 15:45:59
1695 dnl --------------------------
1696 dnl Check if we should use the libtool 1.5 feature "-version-number" instead of
1697 dnl the older "-version-info" feature. The newer feature allows us to use
1698 dnl version numbering on shared libraries which make them compatible with
1699 dnl various systems.
1700 AC_DEFUN([CF_DISABLE_LIBTOOL_VERSION],
1702 AC_MSG_CHECKING(if libtool -version-number should be used)
1703 CF_ARG_DISABLE(libtool-version,
1704 [ --disable-libtool-version enable to use libtool's incompatible naming scheme],
1705 [cf_libtool_version=no],
1706 [cf_libtool_version=yes])
1707 AC_MSG_RESULT($cf_libtool_version)
1709 if test "$cf_libtool_version" = yes ; then
1710 LIBTOOL_VERSION="-version-number"
1712 LIBTOOL_VERSION="-version-info"
1715 AC_SUBST(LIBTOOL_VERSION)
1717 dnl ---------------------------------------------------------------------------
1718 dnl CF_DISABLE_RPATH_HACK version: 2 updated: 2011/02/13 13:31:33
1719 dnl ---------------------
1720 dnl The rpath-hack makes it simpler to build programs, particularly with the
1721 dnl *BSD ports which may have essential libraries in unusual places. But it
1722 dnl can interfere with building an executable for the base system. Use this
1723 dnl option in that case.
1724 AC_DEFUN([CF_DISABLE_RPATH_HACK],
1726 AC_MSG_CHECKING(if rpath-hack should be disabled)
1727 CF_ARG_DISABLE(rpath-hack,
1728 [ --disable-rpath-hack don't add rpath options for additional libraries],
1729 [cf_disable_rpath_hack=yes],
1730 [cf_disable_rpath_hack=no])
1731 AC_MSG_RESULT($cf_disable_rpath_hack)
1732 if test "$cf_disable_rpath_hack" = no ; then
1736 dnl ---------------------------------------------------------------------------
1737 dnl CF_ENABLE_RPATH version: 2 updated: 2010/03/27 18:39:42
1739 dnl Check if the rpath option should be used, setting cache variable
1740 dnl cf_cv_enable_rpath if so.
1741 AC_DEFUN([CF_ENABLE_RPATH],
1743 AC_MSG_CHECKING(if rpath option should be used)
1744 AC_ARG_ENABLE(rpath,
1745 [ --enable-rpath use rpath option when generating shared libraries],
1746 [cf_cv_enable_rpath=$enableval],
1747 [cf_cv_enable_rpath=no])
1748 AC_MSG_RESULT($cf_cv_enable_rpath)
1750 dnl ---------------------------------------------------------------------------
1751 dnl CF_FIND_LIBRARY version: 9 updated: 2008/03/23 14:48:54
1753 dnl Look for a non-standard library, given parameters for AC_TRY_LINK. We
1754 dnl prefer a standard location, and use -L options only if we do not find the
1755 dnl library in the standard library location(s).
1756 dnl $1 = library name
1757 dnl $2 = library class, usually the same as library name
1759 dnl $4 = code fragment to compile/link
1760 dnl $5 = corresponding function-name
1761 dnl $6 = flag, nonnull if failure should not cause an error-exit
1763 dnl Sets the variable "$cf_libdir" as a side-effect, so we can see if we had
1764 dnl to use a -L option.
1765 AC_DEFUN([CF_FIND_LIBRARY],
1767 eval 'cf_cv_have_lib_'$1'=no'
1770 eval 'cf_cv_have_lib_'$1'=yes',[
1771 cf_save_LIBS="$LIBS"
1772 AC_MSG_CHECKING(for $5 in -l$1)
1774 AC_TRY_LINK([$3],[$4],
1776 eval 'cf_cv_have_lib_'$1'=yes'
1779 CF_LIBRARY_PATH(cf_search,$2)
1780 for cf_libdir in $cf_search
1782 AC_MSG_CHECKING(for -l$1 in $cf_libdir)
1783 LIBS="-L$cf_libdir -l$1 $cf_save_LIBS"
1784 AC_TRY_LINK([$3],[$4],
1786 eval 'cf_cv_have_lib_'$1'=yes'
1789 LIBS="$cf_save_LIBS"])
1793 eval 'cf_found_library=[$]cf_cv_have_lib_'$1
1795 if test $cf_found_library = no ; then
1796 AC_MSG_ERROR(Cannot link $1 library)
1800 dnl ---------------------------------------------------------------------------
1801 dnl CF_FIND_LINKAGE version: 19 updated: 2010/05/29 16:31:02
1803 dnl Find a library (specifically the linkage used in the code fragment),
1804 dnl searching for it if it is not already in the library path.
1805 dnl See also CF_ADD_SEARCHPATH.
1807 dnl Parameters (4-on are optional):
1808 dnl $1 = headers for library entrypoint
1809 dnl $2 = code fragment for library entrypoint
1810 dnl $3 = the library name without the "-l" option or ".so" suffix.
1811 dnl $4 = action to perform if successful (default: update CPPFLAGS, etc)
1812 dnl $5 = action to perform if not successful
1813 dnl $6 = module name, if not the same as the library name
1814 dnl $7 = extra libraries
1816 dnl Sets these variables:
1817 dnl $cf_cv_find_linkage_$3 - yes/no according to whether linkage is found
1818 dnl $cf_cv_header_path_$3 - include-directory if needed
1819 dnl $cf_cv_library_path_$3 - library-directory if needed
1820 dnl $cf_cv_library_file_$3 - library-file if needed, e.g., -l$3
1821 AC_DEFUN([CF_FIND_LINKAGE],[
1823 # If the linkage is not already in the $CPPFLAGS/$LDFLAGS configuration, these
1824 # will be set on completion of the AC_TRY_LINK below.
1825 cf_cv_header_path_$3=
1826 cf_cv_library_path_$3=
1828 CF_MSG_LOG([Starting [FIND_LINKAGE]($3,$6)])
1830 cf_save_LIBS="$LIBS"
1832 AC_TRY_LINK([$1],[$2],[
1833 cf_cv_find_linkage_$3=yes
1834 cf_cv_header_path_$3=/usr/include
1835 cf_cv_library_path_$3=/usr/lib
1838 LIBS="-l$3 $7 $cf_save_LIBS"
1840 AC_TRY_LINK([$1],[$2],[
1841 cf_cv_find_linkage_$3=yes
1842 cf_cv_header_path_$3=/usr/include
1843 cf_cv_library_path_$3=/usr/lib
1844 cf_cv_library_file_$3="-l$3"
1846 cf_cv_find_linkage_$3=no
1847 LIBS="$cf_save_LIBS"
1849 CF_VERBOSE(find linkage for $3 library)
1850 CF_MSG_LOG([Searching for headers in [FIND_LINKAGE]($3,$6)])
1852 cf_save_CPPFLAGS="$CPPFLAGS"
1853 cf_test_CPPFLAGS="$CPPFLAGS"
1855 CF_HEADER_PATH(cf_search,ifelse([$6],,[$3],[$6]))
1856 for cf_cv_header_path_$3 in $cf_search
1858 if test -d $cf_cv_header_path_$3 ; then
1859 CF_VERBOSE(... testing $cf_cv_header_path_$3)
1860 CPPFLAGS="$cf_save_CPPFLAGS -I$cf_cv_header_path_$3"
1861 AC_TRY_COMPILE([$1],[$2],[
1862 CF_VERBOSE(... found $3 headers in $cf_cv_header_path_$3)
1863 cf_cv_find_linkage_$3=maybe
1864 cf_test_CPPFLAGS="$CPPFLAGS"
1866 CPPFLAGS="$cf_save_CPPFLAGS"
1871 if test "$cf_cv_find_linkage_$3" = maybe ; then
1873 CF_MSG_LOG([Searching for $3 library in [FIND_LINKAGE]($3,$6)])
1875 cf_save_LIBS="$LIBS"
1876 cf_save_LDFLAGS="$LDFLAGS"
1879 CPPFLAGS="$cf_test_CPPFLAGS"
1880 LIBS="-l$3 $7 $cf_save_LIBS"
1881 AC_TRY_LINK([$1],[$2],[
1882 CF_VERBOSE(... found $3 library in system)
1883 cf_cv_find_linkage_$3=yes])
1884 CPPFLAGS="$cf_save_CPPFLAGS"
1885 LIBS="$cf_save_LIBS"
1888 if test "$cf_cv_find_linkage_$3" != yes ; then
1889 CF_LIBRARY_PATH(cf_search,$3)
1890 for cf_cv_library_path_$3 in $cf_search
1892 if test -d $cf_cv_library_path_$3 ; then
1893 CF_VERBOSE(... testing $cf_cv_library_path_$3)
1894 CPPFLAGS="$cf_test_CPPFLAGS"
1895 LIBS="-l$3 $7 $cf_save_LIBS"
1896 LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_$3"
1897 AC_TRY_LINK([$1],[$2],[
1898 CF_VERBOSE(... found $3 library in $cf_cv_library_path_$3)
1899 cf_cv_find_linkage_$3=yes
1900 cf_cv_library_file_$3="-l$3"
1902 CPPFLAGS="$cf_save_CPPFLAGS"
1903 LIBS="$cf_save_LIBS"
1904 LDFLAGS="$cf_save_LDFLAGS"
1908 CPPFLAGS="$cf_save_CPPFLAGS"
1909 LDFLAGS="$cf_save_LDFLAGS"
1913 cf_cv_find_linkage_$3=no
1918 LIBS="$cf_save_LIBS"
1920 if test "$cf_cv_find_linkage_$3" = yes ; then
1922 CF_ADD_INCDIR($cf_cv_header_path_$3)
1923 CF_ADD_LIBDIR($cf_cv_library_path_$3)
1927 ifelse([$5],,AC_MSG_WARN(Cannot find $3 library),[$5])
1930 dnl ---------------------------------------------------------------------------
1931 dnl CF_FORGET_TOOL version: 1 updated: 2013/04/06 18:03:09
1933 dnl Forget that we saw the given tool.
1934 AC_DEFUN([CF_FORGET_TOOL],[
1935 unset ac_cv_prog_ac_ct_$1
1939 dnl ---------------------------------------------------------------------------
1940 dnl CF_FUNC_WAIT version: 3 updated: 2012/10/06 08:57:51
1942 dnl Test for the presence of <sys/wait.h>, 'union wait', arg-type of 'wait()'
1943 dnl and/or 'waitpid()'.
1945 dnl Note that we cannot simply grep for 'union wait' in the wait.h file,
1946 dnl because some Posix systems turn this on only when a BSD variable is
1949 dnl I don't use AC_HEADER_SYS_WAIT, because it defines HAVE_SYS_WAIT_H, which
1950 dnl would conflict with an attempt to test that header directly.
1952 AC_DEFUN([CF_FUNC_WAIT],
1954 AC_REQUIRE([CF_UNION_WAIT])
1955 if test $cf_cv_type_unionwait = yes; then
1957 AC_MSG_CHECKING(if union wait can be used as wait-arg)
1958 AC_CACHE_VAL(cf_cv_arg_union_wait,[
1959 AC_TRY_COMPILE($cf_wait_headers,
1960 [union wait x; wait(&x)],
1961 [cf_cv_arg_union_wait=yes],
1962 [cf_cv_arg_union_wait=no])
1964 AC_MSG_RESULT($cf_cv_arg_union_wait)
1965 test $cf_cv_arg_union_wait = yes && AC_DEFINE(WAIT_USES_UNION,1,[Define to 1 if wait() uses a union parameter])
1967 AC_MSG_CHECKING(if union wait can be used as waitpid-arg)
1968 AC_CACHE_VAL(cf_cv_arg_union_waitpid,[
1969 AC_TRY_COMPILE($cf_wait_headers,
1970 [union wait x; waitpid(0, &x, 0)],
1971 [cf_cv_arg_union_waitpid=yes],
1972 [cf_cv_arg_union_waitpid=no])
1974 AC_MSG_RESULT($cf_cv_arg_union_waitpid)
1975 test $cf_cv_arg_union_waitpid = yes && AC_DEFINE(WAITPID_USES_UNION,1,[Define to 1 if waitpid() uses a union parameter])
1979 dnl ---------------------------------------------------------------------------
1980 dnl CF_GCC_ATTRIBUTES version: 16 updated: 2012/10/02 20:55:03
1981 dnl -----------------
1982 dnl Test for availability of useful gcc __attribute__ directives to quiet
1983 dnl compiler warnings. Though useful, not all are supported -- and contrary
1984 dnl to documentation, unrecognized directives cause older compilers to barf.
1985 AC_DEFUN([CF_GCC_ATTRIBUTES],
1987 if test "$GCC" = yes
1989 cat > conftest.i <<EOF
1991 #define GCC_PRINTF 0
1996 #ifndef GCC_NORETURN
1997 #define GCC_NORETURN /* nothing */
2000 #define GCC_UNUSED /* nothing */
2003 if test "$GCC" = yes
2005 AC_CHECKING([for $CC __attribute__ directives])
2006 cat > conftest.$ac_ext <<EOF
2007 #line __oline__ "${as_me:-configure}"
2008 #include "confdefs.h"
2009 #include "conftest.h"
2010 #include "conftest.i"
2012 #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
2014 #define GCC_PRINTFLIKE(fmt,var) /*nothing*/
2017 #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
2019 #define GCC_SCANFLIKE(fmt,var) /*nothing*/
2021 extern void wow(char *,...) GCC_SCANFLIKE(1,2);
2022 extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
2023 extern void foo(void) GCC_NORETURN;
2024 int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; }
2026 cf_printf_attribute=no
2027 cf_scanf_attribute=no
2028 for cf_attribute in scanf printf unused noreturn
2030 CF_UPPER(cf_ATTRIBUTE,$cf_attribute)
2031 cf_directive="__attribute__(($cf_attribute))"
2032 echo "checking for $CC $cf_directive" 1>&AC_FD_CC
2034 case $cf_attribute in #(vi
2036 cf_printf_attribute=yes
2037 cat >conftest.h <<EOF
2038 #define GCC_$cf_ATTRIBUTE 1
2042 cf_scanf_attribute=yes
2043 cat >conftest.h <<EOF
2044 #define GCC_$cf_ATTRIBUTE 1
2048 cat >conftest.h <<EOF
2049 #define GCC_$cf_ATTRIBUTE $cf_directive
2054 if AC_TRY_EVAL(ac_compile); then
2055 test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute)
2056 cat conftest.h >>confdefs.h
2057 case $cf_attribute in #(vi
2059 AC_DEFINE_UNQUOTED(GCC_NORETURN,$cf_directive,[Define to noreturn-attribute for gcc])
2062 cf_value='/* nothing */'
2063 if test "$cf_printf_attribute" != no ; then
2064 cf_value='__attribute__((format(printf,fmt,var)))'
2065 AC_DEFINE(GCC_PRINTF,1,[Define to 1 if the compiler supports gcc-like printf attribute.])
2067 AC_DEFINE_UNQUOTED(GCC_PRINTFLIKE(fmt,var),$cf_value,[Define to printf-attribute for gcc])
2070 cf_value='/* nothing */'
2071 if test "$cf_scanf_attribute" != no ; then
2072 cf_value='__attribute__((format(scanf,fmt,var)))'
2073 AC_DEFINE(GCC_SCANF,1,[Define to 1 if the compiler supports gcc-like scanf attribute.])
2075 AC_DEFINE_UNQUOTED(GCC_SCANFLIKE(fmt,var),$cf_value,[Define to sscanf-attribute for gcc])
2078 AC_DEFINE_UNQUOTED(GCC_UNUSED,$cf_directive,[Define to unused-attribute for gcc])
2084 fgrep define conftest.i >>confdefs.h
2089 dnl ---------------------------------------------------------------------------
2090 dnl CF_GCC_VERSION version: 7 updated: 2012/10/18 06:46:33
2092 dnl Find version of gcc
2093 AC_DEFUN([CF_GCC_VERSION],[
2094 AC_REQUIRE([AC_PROG_CC])
2096 if test "$GCC" = yes ; then
2097 AC_MSG_CHECKING(version of $CC)
2098 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.]].*//'`"
2099 test -z "$GCC_VERSION" && GCC_VERSION=unknown
2100 AC_MSG_RESULT($GCC_VERSION)
2103 dnl ---------------------------------------------------------------------------
2104 dnl CF_GCC_WARNINGS version: 29 updated: 2012/06/16 14:55:39
2106 dnl Check if the compiler supports useful warning options. There's a few that
2107 dnl we don't use, simply because they're too noisy:
2109 dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x)
2110 dnl -Wredundant-decls (system headers make this too noisy)
2111 dnl -Wtraditional (combines too many unrelated messages, only a few useful)
2112 dnl -Wwrite-strings (too noisy, but should review occasionally). This
2113 dnl is enabled for ncurses using "--enable-const".
2117 dnl $1 is an optional list of gcc warning flags that a particular
2118 dnl application might want to use, e.g., "no-unused" for
2121 dnl If $with_ext_const is "yes", add a check for -Wwrite-strings
2123 AC_DEFUN([CF_GCC_WARNINGS],
2125 AC_REQUIRE([CF_GCC_VERSION])
2126 CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)
2127 CF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS)
2129 cat > conftest.$ac_ext <<EOF
2130 #line __oline__ "${as_me:-configure}"
2131 int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
2134 if test "$INTEL_COMPILER" = yes
2136 # The "-wdXXX" options suppress warnings:
2137 # remark #1419: external declaration in primary source file
2138 # remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
2139 # remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
2140 # remark #193: zero used for undefined preprocessing identifier
2141 # remark #593: variable "curs_sb_left_arrow" was set but never used
2142 # remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
2143 # remark #869: parameter "tw" was never referenced
2144 # remark #981: operands are evaluated in unspecified order
2145 # warning #279: controlling expression is constant
2147 AC_CHECKING([for $CC warning options])
2148 cf_save_CFLAGS="$CFLAGS"
2149 EXTRA_CFLAGS="-Wall"
2161 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
2162 if AC_TRY_EVAL(ac_compile); then
2163 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
2164 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
2167 CFLAGS="$cf_save_CFLAGS"
2169 elif test "$GCC" = yes
2171 AC_CHECKING([for $CC warning options])
2172 cf_save_CFLAGS="$CFLAGS"
2175 test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
2176 for cf_opt in W Wall \
2177 Wbad-function-cast \
2181 Wmissing-declarations \
2182 Wmissing-prototypes \
2186 Wstrict-prototypes \
2187 Wundef $cf_warn_CONST $1
2189 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
2190 if AC_TRY_EVAL(ac_compile); then
2191 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
2192 case $cf_opt in #(vi
2194 CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES"
2197 case $GCC_VERSION in
2199 CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
2203 Wpointer-arith) #(vi
2204 case $GCC_VERSION in
2206 CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
2211 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
2214 CFLAGS="$cf_save_CFLAGS"
2218 AC_SUBST(EXTRA_CFLAGS)
2220 dnl ---------------------------------------------------------------------------
2221 dnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07
2223 dnl Check if we must define _GNU_SOURCE to get a reasonable value for
2224 dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect
2225 dnl (or misfeature) of glibc2, which breaks portability of many applications,
2226 dnl since it is interwoven with GNU extensions.
2228 dnl Well, yes we could work around it...
2229 AC_DEFUN([CF_GNU_SOURCE],
2231 AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[
2232 AC_TRY_COMPILE([#include <sys/types.h>],[
2233 #ifndef _XOPEN_SOURCE
2236 [cf_cv_gnu_source=no],
2237 [cf_save="$CPPFLAGS"
2238 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
2239 AC_TRY_COMPILE([#include <sys/types.h>],[
2240 #ifdef _XOPEN_SOURCE
2243 [cf_cv_gnu_source=no],
2244 [cf_cv_gnu_source=yes])
2248 test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
2250 dnl ---------------------------------------------------------------------------
2251 dnl CF_HEADERS_SH version: 1 updated: 2007/07/04 15:37:05
2253 dnl Setup variables needed to construct headers-sh
2254 AC_DEFUN([CF_HEADERS_SH],[
2257 AC_SUBST(PACKAGE_PREFIX)
2258 AC_SUBST(PACKAGE_CONFIG)
2259 EXTRA_OUTPUT="$EXTRA_OUTPUT headers-sh:$srcdir/headers-sh.in"
2261 dnl ---------------------------------------------------------------------------
2262 dnl CF_HEADER_PATH version: 12 updated: 2010/05/05 05:22:40
2264 dnl Construct a search-list of directories for a nonstandard header-file
2267 dnl $1 = the variable to return as result
2268 dnl $2 = the package name
2269 AC_DEFUN([CF_HEADER_PATH],
2273 # collect the current set of include-directories from compiler flags
2274 cf_header_path_list=""
2275 if test -n "${CFLAGS}${CPPFLAGS}" ; then
2276 for cf_header_path in $CPPFLAGS $CFLAGS
2278 case $cf_header_path in #(vi
2280 cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'`
2281 CF_ADD_SUBDIR_PATH($1,$2,include,$cf_header_path,NONE)
2282 cf_header_path_list="$cf_header_path_list [$]$1"
2288 # add the variations for the package we are looking for
2289 CF_SUBDIR_PATH($1,$2,include)
2291 test "$includedir" != NONE && \
2292 test "$includedir" != "/usr/include" && \
2293 test -d "$includedir" && {
2294 test -d $includedir && $1="[$]$1 $includedir"
2295 test -d $includedir/$2 && $1="[$]$1 $includedir/$2"
2298 test "$oldincludedir" != NONE && \
2299 test "$oldincludedir" != "/usr/include" && \
2300 test -d "$oldincludedir" && {
2301 test -d $oldincludedir && $1="[$]$1 $oldincludedir"
2302 test -d $oldincludedir/$2 && $1="[$]$1 $oldincludedir/$2"
2305 $1="[$]$1 $cf_header_path_list"
2307 dnl ---------------------------------------------------------------------------
2308 dnl CF_INTEL_COMPILER version: 5 updated: 2013/02/10 10:41:05
2309 dnl -----------------
2310 dnl Check if the given compiler is really the Intel compiler for Linux. It
2311 dnl tries to imitate gcc, but does not return an error when it finds a mismatch
2312 dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK.
2314 dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
2315 dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from
2316 dnl the wrappers for gcc and g++ warnings.
2318 dnl $1 = GCC (default) or GXX
2319 dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
2320 dnl $3 = CFLAGS (default) or CXXFLAGS
2321 AC_DEFUN([CF_INTEL_COMPILER],[
2322 AC_REQUIRE([AC_CANONICAL_HOST])
2323 ifelse([$2],,INTEL_COMPILER,[$2])=no
2325 if test "$ifelse([$1],,[$1],GCC)" = yes ; then
2328 AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler)
2329 cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])"
2330 ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc"
2332 #ifdef __INTEL_COMPILER
2336 ],[ifelse([$2],,INTEL_COMPILER,[$2])=yes
2337 cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc"
2339 ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
2340 AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2]))
2345 dnl ---------------------------------------------------------------------------
2346 dnl CF_LARGEFILE version: 8 updated: 2012/10/06 08:57:51
2348 dnl Add checks for large file support.
2349 AC_DEFUN([CF_LARGEFILE],[
2350 ifdef([AC_FUNC_FSEEKO],[
2352 if test "$enable_largefile" != no ; then
2355 # Normally we would collect these definitions in the config.h,
2356 # but (like _XOPEN_SOURCE), some environments rely on having these
2357 # defined before any of the system headers are included. Another
2358 # case comes up with C++, e.g., on AIX the compiler compiles the
2359 # header files by themselves before looking at the body files it is
2360 # told to compile. For ncurses, those header files do not include
2362 test "$ac_cv_sys_large_files" != no && CPPFLAGS="$CPPFLAGS -D_LARGE_FILES "
2363 test "$ac_cv_sys_largefile_source" != no && CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE "
2364 test "$ac_cv_sys_file_offset_bits" != no && CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits "
2366 AC_CACHE_CHECK(whether to use struct dirent64, cf_cv_struct_dirent64,[
2368 #include <sys/types.h>
2371 /* if transitional largefile support is setup, this is true */
2372 extern struct dirent64 * readdir(DIR *);
2373 struct dirent64 *x = readdir((DIR *)0);
2374 struct dirent *y = readdir((DIR *)0);
2377 [cf_cv_struct_dirent64=yes],
2378 [cf_cv_struct_dirent64=no])
2380 test "$cf_cv_struct_dirent64" = yes && AC_DEFINE(HAVE_STRUCT_DIRENT64,1,[Define to 1 if we have struct dirent64])
2384 dnl ---------------------------------------------------------------------------
2385 dnl CF_LD_RPATH_OPT version: 5 updated: 2011/07/17 14:48:41
2387 dnl For the given system and compiler, find the compiler flags to pass to the
2388 dnl loader to use the "rpath" feature.
2389 AC_DEFUN([CF_LD_RPATH_OPT],
2391 AC_REQUIRE([CF_CHECK_CACHE])
2394 AC_MSG_CHECKING(for an rpath option)
2395 case $cf_cv_system_name in #(vi
2397 if test "$GCC" = yes; then
2398 LD_RPATH_OPT="-Wl,-rpath,"
2400 LD_RPATH_OPT="-rpath "
2403 linux*|gnu*|k*bsd*-gnu) #(vi
2404 LD_RPATH_OPT="-Wl,-rpath,"
2406 openbsd[[2-9]].*|mirbsd*) #(vi
2407 LD_RPATH_OPT="-Wl,-rpath,"
2409 dragonfly*|freebsd*) #(vi
2410 LD_RPATH_OPT="-rpath "
2413 LD_RPATH_OPT="-Wl,-rpath,"
2416 LD_RPATH_OPT="-rpath "
2424 AC_MSG_RESULT($LD_RPATH_OPT)
2426 case "x$LD_RPATH_OPT" in #(vi
2428 AC_MSG_CHECKING(if we need a space after rpath option)
2429 cf_save_LIBS="$LIBS"
2430 CF_ADD_LIBS(${LD_RPATH_OPT}$libdir)
2431 AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes)
2432 LIBS="$cf_save_LIBS"
2433 AC_MSG_RESULT($cf_rpath_space)
2434 test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT "
2438 dnl ---------------------------------------------------------------------------
2439 dnl CF_LIBRARY_PATH version: 9 updated: 2010/03/28 12:52:50
2441 dnl Construct a search-list of directories for a nonstandard library-file
2444 dnl $1 = the variable to return as result
2445 dnl $2 = the package name
2446 AC_DEFUN([CF_LIBRARY_PATH],
2449 cf_library_path_list=""
2450 if test -n "${LDFLAGS}${LIBS}" ; then
2451 for cf_library_path in $LDFLAGS $LIBS
2453 case $cf_library_path in #(vi
2455 cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'`
2456 CF_ADD_SUBDIR_PATH($1,$2,lib,$cf_library_path,NONE)
2457 cf_library_path_list="$cf_library_path_list [$]$1"
2463 CF_SUBDIR_PATH($1,$2,lib)
2465 $1="$cf_library_path_list [$]$1"
2467 dnl ---------------------------------------------------------------------------
2468 dnl CF_LIBTOOL_VERSION version: 1 updated: 2013/04/06 18:03:09
2469 dnl ------------------
2470 AC_DEFUN([CF_LIBTOOL_VERSION],[
2471 if test -n "$LIBTOOL" && test "$LIBTOOL" != none
2473 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.]].*//'`
2475 cf_cv_libtool_version=
2477 test -z "$cf_cv_libtool_version" && unset cf_cv_libtool_version
2479 dnl ---------------------------------------------------------------------------
2480 dnl CF_LIB_PREFIX version: 9 updated: 2012/01/21 19:28:10
2482 dnl Compute the library-prefix for the given host system
2483 dnl $1 = variable to set
2484 define([CF_LIB_PREFIX],
2486 case $cf_cv_system_name in #(vi
2493 ifelse($1,,,[$1=$LIB_PREFIX])
2494 AC_SUBST(LIB_PREFIX)
2496 dnl ---------------------------------------------------------------------------
2497 dnl CF_LIB_SUFFIX version: 22 updated: 2013/09/07 13:54:05
2499 dnl Compute the library file-suffix from the given model name
2501 dnl $2 = variable to set (the nominal library suffix)
2502 dnl $3 = dependency variable to set (actual filename)
2503 dnl The variable $LIB_SUFFIX, if set, prepends the variable to set.
2504 AC_DEFUN([CF_LIB_SUFFIX],
2520 case $cf_cv_system_name in
2525 cygwin*|msys*|mingw*) #(vi
2556 test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}"
2557 test -n "$LIB_SUFFIX" && $3="${LIB_SUFFIX}[$]{$3}"
2559 dnl ---------------------------------------------------------------------------
2560 dnl CF_MAKEFLAGS version: 14 updated: 2011/03/31 19:29:46
2562 dnl Some 'make' programs support ${MAKEFLAGS}, some ${MFLAGS}, to pass 'make'
2563 dnl options to lower-levels. It's very useful for "make -n" -- if we have it.
2564 dnl (GNU 'make' does both, something POSIX 'make', which happens to make the
2565 dnl ${MAKEFLAGS} variable incompatible because it adds the assignments :-)
2566 AC_DEFUN([CF_MAKEFLAGS],
2568 AC_CACHE_CHECK(for makeflags variable, cf_cv_makeflags,[
2570 for cf_option in '-${MAKEFLAGS}' '${MFLAGS}'
2572 cat >cf_makeflags.tmp <<CF_EOF
2575 @ echo '.$cf_option'
2577 cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp 2>/dev/null | fgrep -v "ing directory" | sed -e 's,[[ ]]*$,,'`
2578 case "$cf_result" in
2580 cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp CC=cc 2>/dev/null`
2581 case "$cf_result" in
2582 .*CC=*) cf_cv_makeflags=
2584 *) cf_cv_makeflags=$cf_option
2590 *) echo "given option \"$cf_option\", no match \"$cf_result\""
2594 rm -f cf_makeflags.tmp
2597 AC_SUBST(cf_cv_makeflags)
2599 dnl ---------------------------------------------------------------------------
2600 dnl CF_MAKE_TAGS version: 6 updated: 2010/10/23 15:52:32
2602 dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have
2603 dnl a monocase filesystem.
2604 AC_DEFUN([CF_MAKE_TAGS],[
2605 AC_REQUIRE([CF_MIXEDCASE_FILENAMES])
2607 AC_CHECK_PROGS(CTAGS, exctags ctags)
2608 AC_CHECK_PROGS(ETAGS, exetags etags)
2610 AC_CHECK_PROG(MAKE_LOWER_TAGS, ${CTAGS:-ctags}, yes, no)
2612 if test "$cf_cv_mixedcase" = yes ; then
2613 AC_CHECK_PROG(MAKE_UPPER_TAGS, ${ETAGS:-etags}, yes, no)
2618 if test "$MAKE_UPPER_TAGS" = yes ; then
2624 if test "$MAKE_LOWER_TAGS" = yes ; then
2633 AC_SUBST(MAKE_UPPER_TAGS)
2634 AC_SUBST(MAKE_LOWER_TAGS)
2636 dnl ---------------------------------------------------------------------------
2637 dnl CF_MATH_LIB version: 8 updated: 2010/05/29 16:31:02
2639 dnl Checks for libraries. At least one UNIX system, Apple Macintosh
2640 dnl Rhapsody 5.5, does not have -lm. We cannot use the simpler
2641 dnl AC_CHECK_LIB(m,sin), because that fails for C++.
2642 AC_DEFUN([CF_MATH_LIB],
2644 AC_CACHE_CHECK(if -lm needed for math functions,
2650 [double x = rand(); printf("result = %g\n", ]ifelse([$2],,sin(x),$2)[)],
2651 [cf_cv_need_libm=no],
2652 [cf_cv_need_libm=yes])])
2653 if test "$cf_cv_need_libm" = yes
2660 dnl ---------------------------------------------------------------------------
2661 dnl CF_MBSTATE_T version: 4 updated: 2012/10/06 08:57:51
2663 dnl Check if mbstate_t is declared, and if so, which header file.
2664 dnl This (including wchar.h) is needed on Tru64 5.0 to declare mbstate_t,
2665 dnl as well as include stdio.h to work around a misuse of varargs in wchar.h
2666 AC_DEFUN([CF_MBSTATE_T],
2668 AC_CACHE_CHECK(if we must include wchar.h to declare mbstate_t,cf_cv_mbstate_t,[
2672 #ifdef HAVE_LIBUTF8_H
2673 #include <libutf8.h>
2676 [cf_cv_mbstate_t=no],
2681 #ifdef HAVE_LIBUTF8_H
2682 #include <libutf8.h>
2685 [cf_cv_mbstate_t=yes],
2686 [cf_cv_mbstate_t=unknown])])])
2688 if test "$cf_cv_mbstate_t" = yes ; then
2689 AC_DEFINE(NEED_WCHAR_H,1,[Define to 1 if we must include wchar.h])
2692 if test "$cf_cv_mbstate_t" != unknown ; then
2693 AC_DEFINE(HAVE_MBSTATE_T,1,[Define to 1 if mbstate_t is declared])
2696 dnl ---------------------------------------------------------------------------
2697 dnl CF_MIXEDCASE_FILENAMES version: 5 updated: 2013/09/07 13:54:05
2698 dnl ----------------------
2699 dnl Check if the file-system supports mixed-case filenames. If we're able to
2700 dnl create a lowercase name and see it as uppercase, it doesn't support that.
2701 AC_DEFUN([CF_MIXEDCASE_FILENAMES],
2703 AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[
2704 if test "$cross_compiling" = yes ; then
2705 case $target_alias in #(vi
2706 *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw32*|*-uwin*) #(vi
2714 rm -f conftest CONFTEST
2716 if test -f CONFTEST ; then
2721 rm -f conftest CONFTEST
2724 test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if filesystem supports mixed-case filenames.])
2726 dnl ---------------------------------------------------------------------------
2727 dnl CF_MSG_LOG version: 5 updated: 2010/10/23 15:52:32
2729 dnl Write a debug message to config.log, along with the line number in the
2730 dnl configure script.
2731 AC_DEFUN([CF_MSG_LOG],[
2732 echo "${as_me:-configure}:__oline__: testing $* ..." 1>&AC_FD_CC
2734 dnl ---------------------------------------------------------------------------
2735 dnl CF_NCURSES_CC_CHECK version: 4 updated: 2007/07/29 10:39:05
2736 dnl -------------------
2737 dnl Check if we can compile with ncurses' header file
2738 dnl $1 is the cache variable to set
2739 dnl $2 is the header-file to include
2740 dnl $3 is the root name (ncurses or ncursesw)
2741 AC_DEFUN([CF_NCURSES_CC_CHECK],[
2743 ]ifelse($3,ncursesw,[
2744 #define _XOPEN_SOURCE_EXTENDED
2745 #undef HAVE_LIBUTF8_H /* in case we used CF_UTF8_LIB */
2746 #define HAVE_LIBUTF8_H /* to force ncurses' header file to use cchar_t */
2749 #ifdef NCURSES_VERSION
2750 ]ifelse($3,ncursesw,[
2755 printf("%s\n", NCURSES_VERSION);
2767 dnl ---------------------------------------------------------------------------
2768 dnl CF_NCURSES_CONFIG version: 10 updated: 2012/10/06 08:57:51
2769 dnl -----------------
2770 dnl Tie together the configure-script macros for ncurses.
2771 dnl Prefer the "-config" script from ncurses 6.x, to simplify analysis.
2772 dnl Allow that to be overridden using the $NCURSES_CONFIG environment variable.
2774 dnl $1 is the root library name (default: "ncurses")
2775 AC_DEFUN([CF_NCURSES_CONFIG],
2777 cf_ncuconfig_root=ifelse($1,,ncurses,$1)
2779 echo "Looking for ${cf_ncuconfig_root}-config"
2781 CF_ACVERSION_CHECK(2.52,
2782 [AC_CHECK_TOOLS(NCURSES_CONFIG, ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)],
2783 [AC_PATH_PROGS(NCURSES_CONFIG, ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)])
2785 if test "$NCURSES_CONFIG" != none ; then
2787 CPPFLAGS="$CPPFLAGS `$NCURSES_CONFIG --cflags`"
2788 CF_ADD_LIBS(`$NCURSES_CONFIG --libs`)
2790 # even with config script, some packages use no-override for curses.h
2791 CF_CURSES_HEADER(ifelse($1,,ncurses,$1))
2793 dnl like CF_NCURSES_CPPFLAGS
2794 AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries])
2796 dnl like CF_NCURSES_LIBS
2797 CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_ncuconfig_root)
2798 AC_DEFINE_UNQUOTED($cf_nculib_ROOT)
2800 dnl like CF_NCURSES_VERSION
2801 cf_cv_ncurses_version=`$NCURSES_CONFIG --version`
2805 CF_NCURSES_CPPFLAGS(ifelse($1,,ncurses,$1))
2806 CF_NCURSES_LIBS(ifelse($1,,ncurses,$1))
2810 dnl ---------------------------------------------------------------------------
2811 dnl CF_NCURSES_CPPFLAGS version: 21 updated: 2012/10/06 08:57:51
2812 dnl -------------------
2813 dnl Look for the SVr4 curses clone 'ncurses' in the standard places, adjusting
2814 dnl the CPPFLAGS variable so we can include its header.
2816 dnl The header files may be installed as either curses.h, or ncurses.h (would
2817 dnl be obsolete, except that some packagers prefer this name to distinguish it
2818 dnl from a "native" curses implementation). If not installed for overwrite,
2819 dnl the curses.h file would be in an ncurses subdirectory (e.g.,
2820 dnl /usr/include/ncurses), but someone may have installed overwriting the
2821 dnl vendor's curses. Only very old versions (pre-1.9.2d, the first autoconf'd
2822 dnl version) of ncurses don't define either __NCURSES_H or NCURSES_VERSION in
2825 dnl If the installer has set $CFLAGS or $CPPFLAGS so that the ncurses header
2826 dnl is already in the include-path, don't even bother with this, since we cannot
2827 dnl easily determine which file it is. In this case, it has to be <curses.h>.
2829 dnl The optional parameter gives the root name of the library, in case it is
2830 dnl not installed as the default curses library. That is how the
2831 dnl wide-character version of ncurses is installed.
2832 AC_DEFUN([CF_NCURSES_CPPFLAGS],
2833 [AC_REQUIRE([CF_WITH_CURSES_DIR])
2835 AC_PROVIDE([CF_CURSES_CPPFLAGS])dnl
2836 cf_ncuhdr_root=ifelse($1,,ncurses,$1)
2838 test -n "$cf_cv_curses_dir" && \
2839 test "$cf_cv_curses_dir" != "no" && { \
2840 CF_ADD_INCDIR($cf_cv_curses_dir/include/$cf_ncuhdr_root)
2843 AC_CACHE_CHECK(for $cf_ncuhdr_root header in include-path, cf_cv_ncurses_h,[
2844 cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h"
2845 ( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h"
2846 for cf_header in $cf_header_list
2848 CF_NCURSES_CC_CHECK(cf_cv_ncurses_h,$cf_header,$1)
2849 test "$cf_cv_ncurses_h" != no && break
2856 # some applications need this, but should check for NCURSES_VERSION
2857 AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries])
2861 dnl ---------------------------------------------------------------------------
2862 dnl CF_NCURSES_HEADER version: 3 updated: 2012/10/06 08:57:51
2863 dnl -----------------
2864 dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
2865 dnl variations of ncurses' installs.
2867 dnl See also CF_CURSES_HEADER, which sets the same cache variable.
2868 AC_DEFUN([CF_NCURSES_HEADER],[
2870 if test "$cf_cv_ncurses_h" != no ; then
2871 cf_cv_ncurses_header=$cf_cv_ncurses_h
2874 AC_CACHE_CHECK(for $cf_ncuhdr_root include-path, cf_cv_ncurses_h2,[
2875 test -n "$verbose" && echo
2876 CF_HEADER_PATH(cf_search,$cf_ncuhdr_root)
2877 test -n "$verbose" && echo search path $cf_search
2878 cf_save2_CPPFLAGS="$CPPFLAGS"
2879 for cf_incdir in $cf_search
2881 CF_ADD_INCDIR($cf_incdir)
2886 CF_NCURSES_CC_CHECK(cf_cv_ncurses_h2,$cf_header,$1)
2887 if test "$cf_cv_ncurses_h2" != no ; then
2888 cf_cv_ncurses_h2=$cf_incdir/$cf_header
2889 test -n "$verbose" && echo $ac_n " ... found $ac_c" 1>&AC_FD_MSG
2892 test -n "$verbose" && echo " ... tested $cf_incdir/$cf_header" 1>&AC_FD_MSG
2894 CPPFLAGS="$cf_save2_CPPFLAGS"
2895 test "$cf_cv_ncurses_h2" != no && break
2897 test "$cf_cv_ncurses_h2" = no && AC_MSG_ERROR(not found)
2900 CF_DIRNAME(cf_1st_incdir,$cf_cv_ncurses_h2)
2901 cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2`
2902 if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then
2903 cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header
2905 CF_ADD_INCDIR($cf_1st_incdir)
2909 # Set definitions to allow ifdef'ing for ncurses.h
2911 case $cf_cv_ncurses_header in # (vi
2913 AC_DEFINE(HAVE_NCURSES_H,1,[Define to 1 if we have ncurses.h])
2917 case $cf_cv_ncurses_header in # (vi
2918 ncurses/curses.h|ncurses/ncurses.h)
2919 AC_DEFINE(HAVE_NCURSES_NCURSES_H,1,[Define to 1 if we have ncurses/ncurses.h])
2921 ncursesw/curses.h|ncursesw/ncurses.h)
2922 AC_DEFINE(HAVE_NCURSESW_NCURSES_H,1,[Define to 1 if we have ncursesw/ncurses.h])
2927 dnl ---------------------------------------------------------------------------
2928 dnl CF_NCURSES_LIBS version: 16 updated: 2010/11/20 17:02:38
2930 dnl Look for the ncurses library. This is a little complicated on Linux,
2931 dnl because it may be linked with the gpm (general purpose mouse) library.
2932 dnl Some distributions have gpm linked with (bsd) curses, which makes it
2933 dnl unusable with ncurses. However, we don't want to link with gpm unless
2934 dnl ncurses has a dependency, since gpm is normally set up as a shared library,
2935 dnl and the linker will record a dependency.
2937 dnl The optional parameter gives the root name of the library, in case it is
2938 dnl not installed as the default curses library. That is how the
2939 dnl wide-character version of ncurses is installed.
2940 AC_DEFUN([CF_NCURSES_LIBS],
2941 [AC_REQUIRE([CF_NCURSES_CPPFLAGS])
2943 cf_nculib_root=ifelse($1,,ncurses,$1)
2944 # This works, except for the special case where we find gpm, but
2945 # ncurses is in a nonstandard location via $LIBS, and we really want
2948 cf_ncurses_SAVE="$LIBS"
2949 AC_CHECK_LIB(gpm,Gpm_Open,
2950 [AC_CHECK_LIB(gpm,initscr,
2951 [LIBS="$cf_ncurses_SAVE"],
2952 [cf_ncurses_LIBS="-lgpm"])])
2954 case $host_os in #(vi
2956 # This is only necessary if you are linking against an obsolete
2957 # version of ncurses (but it should do no harm, since it's static).
2958 if test "$cf_nculib_root" = ncurses ; then
2959 AC_CHECK_LIB(mytinfo,tgoto,[cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS"])
2964 CF_ADD_LIBS($cf_ncurses_LIBS)
2966 if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
2968 CF_ADD_LIBS(-l$cf_nculib_root)
2970 CF_FIND_LIBRARY($cf_nculib_root,$cf_nculib_root,
2971 [#include <${cf_cv_ncurses_header:-curses.h}>],
2976 if test -n "$cf_ncurses_LIBS" ; then
2977 AC_MSG_CHECKING(if we can link $cf_nculib_root without $cf_ncurses_LIBS)
2978 cf_ncurses_SAVE="$LIBS"
2979 for p in $cf_ncurses_LIBS ; do
2980 q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"`
2981 if test "$q" != "$LIBS" ; then
2985 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
2986 [initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);],
2987 [AC_MSG_RESULT(yes)],
2989 LIBS="$cf_ncurses_SAVE"])
2992 CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_nculib_root)
2993 AC_DEFINE_UNQUOTED($cf_nculib_ROOT)
2995 dnl ---------------------------------------------------------------------------
2996 dnl CF_NCURSES_VERSION version: 14 updated: 2012/10/06 08:57:51
2997 dnl ------------------
2998 dnl Check for the version of ncurses, to aid in reporting bugs, etc.
2999 dnl Call CF_CURSES_CPPFLAGS first, or CF_NCURSES_CPPFLAGS. We don't use
3000 dnl AC_REQUIRE since that does not work with the shell's if/then/else/fi.
3001 AC_DEFUN([CF_NCURSES_VERSION],
3003 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
3004 AC_CACHE_CHECK(for ncurses version, cf_cv_ncurses_version,[
3005 cf_cv_ncurses_version=no
3009 #include <${cf_cv_ncurses_header:-curses.h}>
3013 FILE *fp = fopen("$cf_tempfile", "w");
3014 #ifdef NCURSES_VERSION
3015 # ifdef NCURSES_VERSION_PATCH
3016 fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH);
3018 fprintf(fp, "%s\n", NCURSES_VERSION);
3022 fprintf(fp, "old\n");
3027 ${cf_cv_main_return:-return}(0);
3029 cf_cv_ncurses_version=`cat $cf_tempfile`],,[
3031 # This will not work if the preprocessor splits the line after the
3032 # Autoconf token. The 'unproto' program does that.
3033 cat > conftest.$ac_ext <<EOF
3034 #include <${cf_cv_ncurses_header:-curses.h}>
3036 #ifdef NCURSES_VERSION
3037 Autoconf NCURSES_VERSION
3045 cf_try="$ac_cpp conftest.$ac_ext 2>&AC_FD_CC | grep '^Autoconf ' >conftest.out"
3047 if test -f conftest.out ; then
3048 cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[[^"]]*"%%' -e 's%".*%%'`
3049 test -n "$cf_out" && cf_cv_ncurses_version="$cf_out"
3055 test "$cf_cv_ncurses_version" = no || AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries])
3057 dnl ---------------------------------------------------------------------------
3058 dnl CF_NO_LEAKS_OPTION version: 5 updated: 2012/10/02 20:55:03
3059 dnl ------------------
3060 dnl see CF_WITH_NO_LEAKS
3061 AC_DEFUN([CF_NO_LEAKS_OPTION],[
3062 AC_MSG_CHECKING(if you want to use $1 for testing)
3065 [AC_DEFINE_UNQUOTED($3,1,"Define to 1 if you want to use $1 for testing.")ifelse([$4],,[
3068 : ${with_cflags:=-g}
3069 : ${with_no_leaks:=yes}
3072 AC_MSG_RESULT(${with_$1:-no})
3074 case .$with_cflags in #(vi
3076 case .$CFLAGS in #(vi
3086 dnl ---------------------------------------------------------------------------
3087 dnl CF_NUMBER_SYNTAX version: 1 updated: 2003/09/20 18:12:49
3088 dnl ----------------
3089 dnl Check if the given variable is a number. If not, report an error.
3090 dnl $1 is the variable
3091 dnl $2 is the message
3092 AC_DEFUN([CF_NUMBER_SYNTAX],[
3093 if test -n "$1" ; then
3098 AC_MSG_ERROR($2 is not a number: $1)
3102 AC_MSG_ERROR($2 value is empty)
3105 dnl ---------------------------------------------------------------------------
3106 dnl CF_OUR_MESSAGES version: 7 updated: 2004/09/12 19:45:55
3108 dnl Check if we use the messages included with this program
3110 dnl $1 specifies either Makefile or makefile, defaulting to the former.
3112 dnl Sets variables which can be used to substitute in makefiles:
3113 dnl MSG_DIR_MAKE - to make ./po directory
3114 dnl SUB_MAKEFILE - makefile in ./po directory (see CF_BUNDLED_INTL)
3116 AC_DEFUN([CF_OUR_MESSAGES],
3118 cf_makefile=ifelse($1,,Makefile,$1)
3121 if test "$USE_NLS" = yes ; then
3122 if test -d $srcdir/po ; then
3123 AC_MSG_CHECKING(if we should use included message-library)
3124 AC_ARG_ENABLE(included-msgs,
3125 [ --disable-included-msgs use included messages, for i18n support],
3126 [use_our_messages=$enableval],
3127 [use_our_messages=yes])
3129 AC_MSG_RESULT($use_our_messages)
3133 if test "$use_our_messages" = yes
3135 SUB_MAKEFILE="$SUB_MAKEFILE po/$cf_makefile.in:$srcdir/po/$cf_makefile.inn"
3139 AC_SUBST(MSG_DIR_MAKE)
3140 AC_SUBST(SUB_MAKEFILE)
3142 dnl ---------------------------------------------------------------------------
3143 dnl CF_PATHSEP version: 6 updated: 2012/09/29 18:38:12
3145 dnl Provide a value for the $PATH and similar separator (or amend the value
3146 dnl as provided in autoconf 2.5x).
3147 AC_DEFUN([CF_PATHSEP],
3149 AC_MSG_CHECKING(for PATH separator)
3150 case $cf_cv_system_name in
3151 os2*) PATH_SEPARATOR=';' ;;
3152 *) ${PATH_SEPARATOR:=':'} ;;
3154 ifelse([$1],,,[$1=$PATH_SEPARATOR])
3155 AC_SUBST(PATH_SEPARATOR)
3156 AC_MSG_RESULT($PATH_SEPARATOR)
3158 dnl ---------------------------------------------------------------------------
3159 dnl CF_PATH_SYNTAX version: 14 updated: 2012/06/19 20:58:54
3161 dnl Check the argument to see that it looks like a pathname. Rewrite it if it
3162 dnl begins with one of the prefix/exec_prefix variables, and then again if the
3163 dnl result begins with 'NONE'. This is necessary to work around autoconf's
3164 dnl delayed evaluation of those symbols.
3165 AC_DEFUN([CF_PATH_SYNTAX],[
3166 if test "x$prefix" != xNONE; then
3167 cf_path_syntax="$prefix"
3169 cf_path_syntax="$ac_default_prefix"
3172 case ".[$]$1" in #(vi
3173 .\[$]\(*\)*|.\'*\'*) #(vi
3177 .[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX
3179 .\[$]{*prefix}*|.\[$]{*dir}*) #(vi
3181 case ".[$]$1" in #(vi
3183 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
3188 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
3191 ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2)
3195 dnl ---------------------------------------------------------------------------
3196 dnl CF_PKG_CONFIG version: 7 updated: 2011/04/29 04:53:22
3198 dnl Check for the package-config program, unless disabled by command-line.
3199 AC_DEFUN([CF_PKG_CONFIG],
3201 AC_MSG_CHECKING(if you want to use pkg-config)
3202 AC_ARG_WITH(pkg-config,
3203 [ --with-pkg-config{=path} enable/disable use of pkg-config],
3204 [cf_pkg_config=$withval],
3205 [cf_pkg_config=yes])
3206 AC_MSG_RESULT($cf_pkg_config)
3208 case $cf_pkg_config in #(vi
3213 CF_ACVERSION_CHECK(2.52,
3214 [AC_PATH_TOOL(PKG_CONFIG, pkg-config, none)],
3215 [AC_PATH_PROG(PKG_CONFIG, pkg-config, none)])
3222 test -z "$PKG_CONFIG" && PKG_CONFIG=none
3223 if test "$PKG_CONFIG" != none ; then
3224 CF_PATH_SYNTAX(PKG_CONFIG)
3227 AC_SUBST(PKG_CONFIG)
3229 dnl ---------------------------------------------------------------------------
3230 dnl CF_POSIX_C_SOURCE version: 8 updated: 2010/05/26 05:38:42
3231 dnl -----------------
3232 dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed.
3234 dnl POSIX.1-1990 _POSIX_SOURCE
3235 dnl POSIX.1-1990 and _POSIX_SOURCE and
3236 dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2
3238 dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L
3239 dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L
3240 dnl X/Open 2000 _POSIX_C_SOURCE=200112L
3243 dnl $1 is the nominal value for _POSIX_C_SOURCE
3244 AC_DEFUN([CF_POSIX_C_SOURCE],
3246 cf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1])
3248 cf_save_CFLAGS="$CFLAGS"
3249 cf_save_CPPFLAGS="$CPPFLAGS"
3251 CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE)
3252 CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE)
3254 AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[
3255 CF_MSG_LOG(if the symbol is already defined go no further)
3256 AC_TRY_COMPILE([#include <sys/types.h>],[
3257 #ifndef _POSIX_C_SOURCE
3260 [cf_cv_posix_c_source=no],
3261 [cf_want_posix_source=no
3262 case .$cf_POSIX_C_SOURCE in #(vi
3264 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
3267 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
3268 cf_want_posix_source=yes
3271 cf_want_posix_source=yes
3274 if test "$cf_want_posix_source" = yes ; then
3275 AC_TRY_COMPILE([#include <sys/types.h>],[
3276 #ifdef _POSIX_SOURCE
3279 cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE")
3281 CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE)
3282 CFLAGS="$cf_trim_CFLAGS"
3283 CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source"
3284 CF_MSG_LOG(if the second compile does not leave our definition intact error)
3285 AC_TRY_COMPILE([#include <sys/types.h>],[
3286 #ifndef _POSIX_C_SOURCE
3289 [cf_cv_posix_c_source=no])
3290 CFLAGS="$cf_save_CFLAGS"
3291 CPPFLAGS="$cf_save_CPPFLAGS"
3295 if test "$cf_cv_posix_c_source" != no ; then
3296 CFLAGS="$cf_trim_CFLAGS"
3297 CPPFLAGS="$cf_trim_CPPFLAGS"
3298 CF_ADD_CFLAGS($cf_cv_posix_c_source)
3302 dnl ---------------------------------------------------------------------------
3303 dnl CF_PROG_CC version: 3 updated: 2012/10/06 15:31:55
3305 dnl standard check for CC, plus followup sanity checks
3306 dnl $1 = optional parameter to pass to AC_PROG_CC to specify compiler name
3307 AC_DEFUN([CF_PROG_CC],[
3308 ifelse($1,,[AC_PROG_CC],[AC_PROG_CC($1)])
3310 CF_ACVERSION_CHECK(2.52,
3315 dnl ---------------------------------------------------------------------------
3316 dnl CF_PROG_EXT version: 11 updated: 2012/10/06 08:57:51
3318 dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX.
3319 AC_DEFUN([CF_PROG_EXT],
3321 AC_REQUIRE([CF_CHECK_CACHE])
3322 case $cf_cv_system_name in
3324 CFLAGS="$CFLAGS -Zmt"
3325 CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__"
3326 CXXFLAGS="$CXXFLAGS -Zmt"
3327 # autoconf's macro sets -Zexe and suffix both, which conflict:w
3328 LDFLAGS="$LDFLAGS -Zmt -Zcrtdll"
3338 test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT",[Define to the program extension (normally blank)])
3340 dnl ---------------------------------------------------------------------------
3341 dnl CF_PROG_LINT version: 2 updated: 2009/08/12 04:43:14
3343 AC_DEFUN([CF_PROG_LINT],
3345 AC_CHECK_PROGS(LINT, tdlint lint alint splint lclint)
3348 dnl ---------------------------------------------------------------------------
3349 dnl CF_PROG_LN_S version: 2 updated: 2010/08/14 18:25:37
3351 dnl Combine checks for "ln -s" and "ln -sf", updating $LN_S to include "-f"
3352 dnl option if it is supported.
3353 AC_DEFUN([CF_PROG_LN_S],[
3355 AC_MSG_CHECKING(if $LN_S -f options work)
3357 rm -f conf$$.src conf$$dst
3359 echo first >conf$$.src
3360 if $LN_S -f conf$$.src conf$$.dst 2>/dev/null; then
3365 rm -f conf$$.dst conf$$src
3366 AC_MSG_RESULT($cf_prog_ln_sf)
3368 test "$cf_prog_ln_sf" = yes && LN_S="$LN_S -f"
3370 dnl ---------------------------------------------------------------------------
3371 dnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50
3372 dnl ----------------
3373 dnl Remove all -U and -D options that refer to the given symbol from a list
3374 dnl of C compiler options. This works around the problem that not all
3375 dnl compilers process -U and -D options from left-to-right, so a -U option
3376 dnl cannot be used to cancel the effect of a preceding -D option.
3378 dnl $1 = target (which could be the same as the source variable)
3379 dnl $2 = source (including '$')
3380 dnl $3 = symbol to remove
3381 define([CF_REMOVE_DEFINE],
3384 sed -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[[ ]]/ /g' \
3385 -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'`
3387 dnl ---------------------------------------------------------------------------
3388 dnl CF_RPATH_HACK version: 11 updated: 2013/09/01 13:02:00
3390 AC_DEFUN([CF_RPATH_HACK],
3392 AC_REQUIRE([CF_LD_RPATH_OPT])
3393 AC_MSG_CHECKING(for updated LDFLAGS)
3394 if test -n "$LD_RPATH_OPT" ; then
3395 AC_MSG_RESULT(maybe)
3397 AC_CHECK_PROGS(cf_ldd_prog,ldd,no)
3398 cf_rpath_list="/usr/lib /lib"
3399 if test "$cf_ldd_prog" != no
3403 AC_TRY_LINK([#include <stdio.h>],
3405 [cf_rpath_oops=`$cf_ldd_prog conftest$ac_exeext | fgrep ' not found' | sed -e 's% =>.*$%%' |sort | uniq`
3406 cf_rpath_list=`$cf_ldd_prog conftest$ac_exeext | fgrep / | sed -e 's%^.*[[ ]]/%/%' -e 's%/[[^/]][[^/]]*$%%' |sort | uniq`])
3408 # If we passed the link-test, but get a "not found" on a given library,
3409 # this could be due to inept reconfiguration of gcc to make it only
3410 # partly honor /usr/local/lib (or whatever). Sometimes this behavior
3411 # is intentional, e.g., installing gcc in /usr/bin and suppressing the
3412 # /usr/local libraries.
3413 if test -n "$cf_rpath_oops"
3415 for cf_rpath_src in $cf_rpath_oops
3417 for cf_rpath_dir in \
3422 if test -f $cf_rpath_dir/lib/$cf_rpath_src
3424 CF_VERBOSE(...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src)
3425 LDFLAGS="$LDFLAGS -L$cf_rpath_dir/lib"
3433 CF_VERBOSE(...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS)
3435 CF_RPATH_HACK_2(LDFLAGS)
3436 CF_RPATH_HACK_2(LIBS)
3438 CF_VERBOSE(...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS)
3442 AC_SUBST(EXTRA_LDFLAGS)
3444 dnl ---------------------------------------------------------------------------
3445 dnl CF_RPATH_HACK_2 version: 6 updated: 2010/04/17 16:31:24
3447 dnl Do one set of substitutions for CF_RPATH_HACK, adding an rpath option to
3448 dnl EXTRA_LDFLAGS for each -L option found.
3450 dnl $cf_rpath_list contains a list of directories to ignore.
3452 dnl $1 = variable name to update. The LDFLAGS variable should be the only one,
3453 dnl but LIBS often has misplaced -L options.
3454 AC_DEFUN([CF_RPATH_HACK_2],
3456 CF_VERBOSE(...checking $1 [$]$1)
3459 for cf_rpath_src in [$]$1
3461 case $cf_rpath_src in #(vi
3464 # check if this refers to a directory which we will ignore
3466 if test -n "$cf_rpath_list"
3468 for cf_rpath_item in $cf_rpath_list
3470 if test "x$cf_rpath_src" = "x-L$cf_rpath_item"
3478 if test "$cf_rpath_skip" = no
3480 # transform the option
3481 if test "$LD_RPATH_OPT" = "-R " ; then
3482 cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%-R %"`
3484 cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%$LD_RPATH_OPT%"`
3487 # if we have not already added this, add it now
3488 cf_rpath_tst=`echo "$EXTRA_LDFLAGS" | sed -e "s%$cf_rpath_tmp %%"`
3489 if test "x$cf_rpath_tst" = "x$EXTRA_LDFLAGS"
3491 CF_VERBOSE(...Filter $cf_rpath_src ->$cf_rpath_tmp)
3492 EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS"
3497 cf_rpath_dst="$cf_rpath_dst $cf_rpath_src"
3501 CF_VERBOSE(...checked $1 [$]$1)
3502 AC_SUBST(EXTRA_LDFLAGS)
3504 dnl ---------------------------------------------------------------------------
3505 dnl CF_SHARED_OPTS version: 83 updated: 2013/09/21 17:34:53
3508 dnl Attempt to determine the appropriate CC/LD options for creating a shared
3512 dnl a) ${LOCAL_LDFLAGS} is used to link executables that will run within
3513 dnl the build-tree, i.e., by making use of the libraries that are compiled in
3514 dnl $rel_builddir/lib We avoid compiling-in a $rel_builddir/lib path for the
3515 dnl shared library since that can lead to unexpected results at runtime.
3516 dnl b) ${LOCAL_LDFLAGS2} has the same intention but assumes that the shared
3517 dnl libraries are compiled in ../../lib
3519 dnl The variable 'cf_cv_do_symlinks' is used to control whether we configure
3520 dnl to install symbolic links to the rel/abi versions of shared libraries.
3522 dnl The variable 'cf_cv_shlib_version' controls whether we use the rel or abi
3523 dnl version when making symbolic links.
3525 dnl The variable 'cf_cv_shlib_version_infix' controls whether shared library
3526 dnl version numbers are infix (ex: libncurses.<ver>.dylib) or postfix
3527 dnl (ex: libncurses.so.<ver>).
3529 dnl Some loaders leave 'so_locations' lying around. It's nice to clean up.
3530 AC_DEFUN([CF_SHARED_OPTS],
3532 AC_REQUIRE([CF_LD_RPATH_OPT])
3537 INSTALL_LIB="-m 644"
3538 : ${rel_builddir:=.}
3540 cf_cv_do_symlinks=no
3542 test "$cf_cv_enable_rpath" = yes && cf_ld_rpath_opt="$LD_RPATH_OPT"
3544 AC_MSG_CHECKING(if release/abi version should be used for shared libs)
3545 AC_ARG_WITH(shlib-version,
3546 [ --with-shlib-version=X Specify rel or abi version for shared libs],
3547 [test -z "$withval" && withval=auto
3548 case $withval in #(vi
3550 cf_cv_shlib_version=auto
3552 rel|abi|auto|no) #(vi
3553 cf_cv_shlib_version=$withval
3556 AC_MSG_ERROR([option value must be one of: rel, abi, auto or no])
3559 ],[cf_cv_shlib_version=auto])
3560 AC_MSG_RESULT($cf_cv_shlib_version)
3565 # Some less-capable ports of gcc support only -fpic
3567 if test "$GCC" = yes
3569 AC_MSG_CHECKING(which $CC option to use)
3570 cf_save_CFLAGS="$CFLAGS"
3571 for CC_SHARED_OPTS in -fPIC -fpic ''
3573 CFLAGS="$cf_save_CFLAGS $CC_SHARED_OPTS"
3574 AC_TRY_COMPILE([#include <stdio.h>],[int x = 1],[break],[])
3576 AC_MSG_RESULT($CC_SHARED_OPTS)
3577 CFLAGS="$cf_save_CFLAGS"
3580 cf_cv_shlib_version_infix=no
3582 case $cf_cv_system_name in #(vi
3583 aix4.[3-9]*|aix[[5-7]]*) #(vi
3584 if test "$GCC" = yes; then
3586 MK_SHARED_LIB='${CC} -shared -Wl,-brtl -Wl,-blibpath:${RPATH_LIST}:/usr/lib -o [$]@'
3588 # CC_SHARED_OPTS='-qpic=large -G'
3589 # perhaps "-bM:SRE -bnoentry -bexpall"
3590 MK_SHARED_LIB='${CC} -G -Wl,-brtl -Wl,-blibpath:${RPATH_LIST}:/usr/lib -o [$]@'
3594 MK_SHARED_LIB='${CC} ${CFLAGS} -o $[@] -Xlinker -soname=`basename $[@]` -nostart -e 0'
3598 MK_SHARED_LIB='sh '$rel_builddir'/mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}'
3599 RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a"
3600 cf_cv_shlib_version=cygdll
3601 cf_cv_shlib_version_infix=cygdll
3602 cat >mk_shared_lib.sh <<-CF_EOF
3605 IMPORT_LIB=\`echo "\[$]1" | sed -e 's/cyg/lib/' -e 's/[[0-9]]*\.dll[$]/.dll.a/'\`
3608 Linking shared library
3609 ** SHARED_LIB \[$]SHARED_LIB
3610 ** IMPORT_LIB \[$]IMPORT_LIB
3612 exec \[$]* -shared -Wl,--out-implib=\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o \[$]{SHARED_LIB}
3614 chmod +x mk_shared_lib.sh
3618 MK_SHARED_LIB='sh '$rel_builddir'/mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}'
3619 RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a"
3620 cf_cv_shlib_version=msysdll
3621 cf_cv_shlib_version_infix=msysdll
3622 cat >mk_shared_lib.sh <<-CF_EOF
3625 IMPORT_LIB=\`echo "\[$]1" | sed -e 's/msys-/lib/' -e 's/[[0-9]]*\.dll[$]/.dll.a/'\`
3628 Linking shared library
3629 ** SHARED_LIB \[$]SHARED_LIB
3630 ** IMPORT_LIB \[$]IMPORT_LIB
3632 exec \[$]* -shared -Wl,--out-implib=\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o \[$]{SHARED_LIB}
3634 chmod +x mk_shared_lib.sh
3637 cf_try_cflags="no-cpp-precomp"
3638 CC_SHARED_OPTS="-dynamic"
3639 MK_SHARED_LIB='${CC} ${CFLAGS} -dynamiclib -install_name ${libdir}/`basename $[@]` -compatibility_version ${ABI_VERSION} -current_version ${ABI_VERSION} -o $[@]'
3640 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=abi
3641 cf_cv_shlib_version_infix=yes
3642 AC_CACHE_CHECK([if ld -search_paths_first works], cf_cv_ldflags_search_paths_first, [
3643 cf_save_LDFLAGS=$LDFLAGS
3644 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
3645 AC_TRY_LINK(, [int i;], cf_cv_ldflags_search_paths_first=yes, cf_cv_ldflags_search_paths_first=no)
3646 LDFLAGS=$cf_save_LDFLAGS])
3647 if test $cf_cv_ldflags_search_paths_first = yes; then
3648 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
3652 # HP-UX 8.07 ld lacks "+b" option used for libdir search-list
3653 if test "$GCC" != yes; then
3656 MK_SHARED_LIB='${LD} -b -o $[@]'
3657 INSTALL_LIB="-m 555"
3660 # (tested with gcc 2.7.2 -- I don't have c89)
3661 if test "$GCC" = yes; then
3662 LD_SHARED_OPTS='-Xlinker +b -Xlinker ${libdir}'
3665 LD_SHARED_OPTS='-Wl,+b,${libdir}'
3667 MK_SHARED_LIB='${LD} +b ${libdir} -b -o $[@]'
3668 # HP-UX shared libraries must be executable, and should be
3669 # readonly to exploit a quirk in the memory manager.
3670 INSTALL_LIB="-m 555"
3673 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
3674 if test "$cf_cv_shlib_version" = rel; then
3675 cf_shared_soname='`basename $@ .${REL_VERSION}`.${ABI_VERSION}'
3677 cf_shared_soname='`basename $@`'
3680 MK_SHARED_LIB='${CC} -shared -Wl,-rpath,${RPATH_LIST} -Wl,-h,'$cf_shared_soname' -o $@'
3683 if test "$cf_cv_enable_rpath" = yes ; then
3684 EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
3686 # tested with IRIX 5.2 and 'cc'.
3687 if test "$GCC" != yes; then
3688 CC_SHARED_OPTS='-KPIC'
3689 MK_SHARED_LIB='${CC} -shared -rdata_shared -soname `basename $[@]` -o $[@]'
3691 MK_SHARED_LIB='${CC} -shared -Wl,-soname,`basename $[@]` -o $[@]'
3693 cf_cv_rm_so_locs=yes
3695 linux*|gnu*|k*bsd*-gnu) #(vi
3696 if test "$DFT_LWR_MODEL" = "shared" ; then
3697 LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)"
3698 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
3700 if test "$cf_cv_enable_rpath" = yes ; then
3701 EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
3704 MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]'
3707 cf_cv_shlib_version=mingw
3708 cf_cv_shlib_version_infix=mingw
3709 if test "$DFT_LWR_MODEL" = "shared" ; then
3710 LOCAL_LDFLAGS="-Wl,--enable-auto-import"
3711 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
3712 EXTRA_LDFLAGS="-Wl,--enable-auto-import $EXTRA_LDFLAGS"
3715 MK_SHARED_LIB='sh '$rel_builddir'/mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}'
3716 RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a"
3717 cat >mk_shared_lib.sh <<-CF_EOF
3720 IMPORT_LIB=\`echo "\[$]1" | sed -e 's/[[0-9]]*\.dll[$]/.dll.a/'\`
3723 Linking shared library
3724 ** SHARED_LIB \[$]SHARED_LIB
3725 ** IMPORT_LIB \[$]IMPORT_LIB
3727 exec \[$]* -shared -Wl,--enable-auto-import,--out-implib=\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o \[$]{SHARED_LIB}
3729 chmod +x mk_shared_lib.sh
3731 openbsd[[2-9]].*|mirbsd*) #(vi
3732 if test "$DFT_LWR_MODEL" = "shared" ; then
3733 LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)"
3734 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
3736 if test "$cf_cv_enable_rpath" = yes ; then
3737 EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
3739 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
3741 MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-Bshareable,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]'
3743 nto-qnx*|openbsd*|freebsd[[12]].*) #(vi
3744 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
3745 MK_SHARED_LIB='${LD} -Bshareable -o $[@]'
3746 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
3748 dragonfly*|freebsd*) #(vi
3749 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
3750 if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then
3751 LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)"
3752 LOCAL_LDFLAGS2="${cf_ld_rpath_opt}\${RPATH_LIST} $LOCAL_LDFLAGS"
3753 EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
3756 MK_SHARED_LIB='${LD} -shared -Bshareable -soname=`basename $[@]` -o $[@]'
3759 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
3760 if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then
3761 LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)"
3762 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
3763 EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
3764 if test "$cf_cv_shlib_version" = auto; then
3765 if test -f /usr/libexec/ld.elf_so; then
3766 cf_cv_shlib_version=abi
3768 cf_cv_shlib_version=rel
3772 MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname' -o $[@]'
3774 MK_SHARED_LIB='${CC} -Wl,-shared -Wl,-Bshareable -o $[@]'
3778 # tested with OSF/1 V3.2 and 'cc'
3779 # tested with OSF/1 V3.2 and gcc 2.6.3 (but the c++ demo didn't
3780 # link with shared libs).
3781 MK_SHARED_LIB='${LD} -set_version ${REL_VERSION}:${ABI_VERSION} -expect_unresolved "*" -shared -soname `basename $[@]`'
3782 case $host_os in #(vi
3784 MK_SHARED_LIB="${MK_SHARED_LIB} -msym"
3787 MK_SHARED_LIB="${MK_SHARED_LIB}"' -o $[@]'
3788 if test "$DFT_LWR_MODEL" = "shared" ; then
3789 LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)"
3790 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
3792 cf_cv_rm_so_locs=yes
3794 sco3.2v5*) # (also uw2* and UW7: hops 13-Apr-98
3795 # tested with osr5.0.5
3796 if test "$GCC" != yes; then
3797 CC_SHARED_OPTS='-belf -KPIC'
3799 MK_SHARED_LIB='${LD} -dy -G -h `basename $[@] .${REL_VERSION}`.${ABI_VERSION} -o [$]@'
3800 if test "$cf_cv_enable_rpath" = yes ; then
3801 # only way is to set LD_RUN_PATH but no switch for it
3804 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
3805 LINK_PROGS='LD_RUN_PATH=${libdir}'
3806 LINK_TESTS='Pwd=`pwd`;LD_RUN_PATH=`dirname $${Pwd}`/lib'
3809 # tested with SunOS 4.1.1 and gcc 2.7.0
3810 if test "$GCC" != yes; then
3811 CC_SHARED_OPTS='-KPIC'
3813 MK_SHARED_LIB='${LD} -assert pure-text -o $[@]'
3814 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
3817 # tested with SunOS 5.5.1 (solaris 2.5.1) and gcc 2.7.2
3818 # tested with SunOS 5.10 (solaris 10) and gcc 3.4.3
3819 if test "$DFT_LWR_MODEL" = "shared" ; then
3820 LOCAL_LDFLAGS="-R \$(LOCAL_LIBDIR):\${libdir}"
3821 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
3823 if test "$cf_cv_enable_rpath" = yes ; then
3824 EXTRA_LDFLAGS="-R \${libdir} $EXTRA_LDFLAGS"
3827 if test "$GCC" != yes; then
3828 cf_save_CFLAGS="$CFLAGS"
3829 for cf_shared_opts in -xcode=pic32 -xcode=pic13 -KPIC -Kpic -O
3831 CFLAGS="$cf_shared_opts $cf_save_CFLAGS"
3832 AC_TRY_COMPILE([#include <stdio.h>],[printf("Hello\n");],[break])
3834 CFLAGS="$cf_save_CFLAGS"
3835 CC_SHARED_OPTS=$cf_shared_opts
3836 MK_SHARED_LIB='${CC} -dy -G -h '$cf_cv_shared_soname' -o $[@]'
3838 MK_SHARED_LIB='${CC} -shared -dy -G -h '$cf_cv_shared_soname' -o $[@]'
3841 sysv5uw7*|unix_sv*) #(vi
3842 # tested with UnixWare 7.1.0 (gcc 2.95.2 and cc)
3843 if test "$GCC" != yes; then
3844 CC_SHARED_OPTS='-KPIC'
3846 MK_SHARED_LIB='${LD} -d y -G -o [$]@'
3849 CC_SHARED_OPTS='unknown'
3850 MK_SHARED_LIB='echo unknown'
3854 # This works if the last tokens in $MK_SHARED_LIB are the -o target.
3855 case "$cf_cv_shlib_version" in #(vi
3857 case "$MK_SHARED_LIB" in #(vi
3859 test "$cf_cv_do_symlinks" = no && cf_cv_do_symlinks=yes
3862 AC_MSG_WARN(ignored --with-shlib-version)
3868 if test -n "$cf_try_cflags"
3870 cat > conftest.$ac_ext <<EOF
3871 #line __oline__ "${as_me:-configure}"
3873 int main(int argc, char *argv[[]])
3876 return (argv[[argc-1]] == 0) ;
3879 cf_save_CFLAGS="$CFLAGS"
3880 for cf_opt in $cf_try_cflags
3882 CFLAGS="$cf_save_CFLAGS -$cf_opt"
3883 AC_MSG_CHECKING(if CFLAGS option -$cf_opt works)
3884 if AC_TRY_EVAL(ac_compile); then
3886 cf_save_CFLAGS="$CFLAGS"
3891 CFLAGS="$cf_save_CFLAGS"
3895 # RPATH_LIST is a colon-separated list of directories
3896 test -n "$cf_ld_rpath_opt" && MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\${RPATH_LIST}"
3897 test -z "$RPATH_LIST" && RPATH_LIST="\${libdir}"
3899 test $cf_cv_rm_so_locs = yes && RM_SHARED_OPTS="$RM_SHARED_OPTS so_locations"
3901 CF_VERBOSE(CC_SHARED_OPTS: $CC_SHARED_OPTS)
3902 CF_VERBOSE(MK_SHARED_LIB: $MK_SHARED_LIB)
3904 AC_SUBST(CC_SHARED_OPTS)
3905 AC_SUBST(LD_RPATH_OPT)
3906 AC_SUBST(LD_SHARED_OPTS)
3907 AC_SUBST(MK_SHARED_LIB)
3908 AC_SUBST(RM_SHARED_OPTS)
3910 AC_SUBST(LINK_PROGS)
3911 AC_SUBST(LINK_TESTS)
3913 AC_SUBST(EXTRA_LDFLAGS)
3914 AC_SUBST(LOCAL_LDFLAGS)
3915 AC_SUBST(LOCAL_LDFLAGS2)
3917 AC_SUBST(INSTALL_LIB)
3918 AC_SUBST(RPATH_LIST)
3920 dnl ---------------------------------------------------------------------------
3921 dnl CF_SHARED_SONAME version: 3 updated: 2008/09/08 18:34:43
3922 dnl ----------------
3923 dnl utility macro for CF_SHARED_OPTS, constructs "$cf_cv_shared_soname" for
3924 dnl substitution into MK_SHARED_LIB string for the "-soname" (or similar)
3927 dnl $1 is the default that should be used for "$cf_cv_shlib_version".
3928 dnl If missing, use "rel".
3929 define([CF_SHARED_SONAME],
3931 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=ifelse($1,,rel,$1)
3932 if test "$cf_cv_shlib_version" = rel; then
3933 cf_cv_shared_soname='`basename $[@] .${REL_VERSION}`.${ABI_VERSION}'
3935 cf_cv_shared_soname='`basename $[@]`'
3938 dnl ---------------------------------------------------------------------------
3939 dnl CF_SUBDIR_PATH version: 6 updated: 2010/04/21 06:20:50
3941 dnl Construct a search-list for a nonstandard header/lib-file
3942 dnl $1 = the variable to return as result
3943 dnl $2 = the package name
3944 dnl $3 = the subdirectory, e.g., bin, include or lib
3945 AC_DEFUN([CF_SUBDIR_PATH],
3949 CF_ADD_SUBDIR_PATH($1,$2,$3,/usr,$prefix)
3950 CF_ADD_SUBDIR_PATH($1,$2,$3,$prefix,NONE)
3951 CF_ADD_SUBDIR_PATH($1,$2,$3,/usr/local,$prefix)
3952 CF_ADD_SUBDIR_PATH($1,$2,$3,/opt,$prefix)
3953 CF_ADD_SUBDIR_PATH($1,$2,$3,[$]HOME,$prefix)
3955 dnl ---------------------------------------------------------------------------
3956 dnl CF_TERM_HEADER version: 3 updated: 2012/10/06 08:57:51
3958 dnl Look for term.h, which is part of X/Open curses. It defines the interface
3959 dnl to terminfo database. Usually it is in the same include-path as curses.h,
3960 dnl but some packagers change this, breaking various applications.
3961 AC_DEFUN([CF_TERM_HEADER],[
3962 AC_CACHE_CHECK(for terminfo header, cf_cv_term_header,[
3963 case ${cf_cv_ncurses_header} in #(vi
3964 */ncurses.h|*/ncursesw.h) #(vi
3965 cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[[^.]]*\.h$%term.h%'`
3968 cf_term_header=term.h
3972 for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h"
3974 AC_TRY_COMPILE([#include <stdio.h>
3975 #include <${cf_cv_ncurses_header:-curses.h}>
3977 ],[int x = auto_left_margin],[
3978 cf_cv_term_header="$cf_test"],[
3979 cf_cv_term_header=unknown
3981 test "$cf_cv_term_header" != unknown && break
3985 # Set definitions to allow ifdef'ing to accommodate subdirectories
3987 case $cf_cv_term_header in # (vi
3989 AC_DEFINE(HAVE_TERM_H,1,[Define to 1 if we have term.h])
3993 case $cf_cv_term_header in # (vi
3994 ncurses/term.h) #(vi
3995 AC_DEFINE(HAVE_NCURSES_TERM_H,1,[Define to 1 if we have ncurses/term.h])
3998 AC_DEFINE(HAVE_NCURSESW_TERM_H,1,[Define to 1 if we have ncursesw/term.h])
4002 dnl ---------------------------------------------------------------------------
4003 dnl CF_TRY_XOPEN_SOURCE version: 1 updated: 2011/10/30 17:09:50
4004 dnl -------------------
4005 dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we
4006 dnl can define it successfully.
4007 AC_DEFUN([CF_TRY_XOPEN_SOURCE],[
4008 AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
4012 #include <sys/types.h>
4014 #ifndef _XOPEN_SOURCE
4017 [cf_cv_xopen_source=no],
4018 [cf_save="$CPPFLAGS"
4019 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
4023 #include <sys/types.h>
4025 #ifdef _XOPEN_SOURCE
4028 [cf_cv_xopen_source=no],
4029 [cf_cv_xopen_source=$cf_XOPEN_SOURCE])
4034 if test "$cf_cv_xopen_source" != no ; then
4035 CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE)
4036 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE)
4037 cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
4038 CF_ADD_CFLAGS($cf_temp_xopen_source)
4041 dnl ---------------------------------------------------------------------------
4042 dnl CF_UNION_WAIT version: 6 updated: 2012/10/06 08:57:51
4044 dnl Check to see if the BSD-style union wait is declared. Some platforms may
4045 dnl use this, though it is deprecated in favor of the 'int' type in Posix.
4046 dnl Some vendors provide a bogus implementation that declares union wait, but
4047 dnl uses the 'int' type instead; we try to spot these by checking for the
4048 dnl associated macros.
4050 dnl Ahem. Some implementers cast the status value to an int*, as an attempt to
4051 dnl use the macros for either union wait or int. So we do a check compile to
4052 dnl see if the macros are defined and apply to an int.
4054 dnl Sets: $cf_cv_type_unionwait
4055 dnl Defines: HAVE_TYPE_UNIONWAIT
4056 AC_DEFUN([CF_UNION_WAIT],
4058 AC_REQUIRE([CF_WAIT_HEADERS])
4059 AC_MSG_CHECKING([for union wait])
4060 AC_CACHE_VAL(cf_cv_type_unionwait,[
4061 AC_TRY_LINK($cf_wait_headers,
4063 int y = WEXITSTATUS(x);
4064 int z = WTERMSIG(x);
4067 [cf_cv_type_unionwait=no
4068 echo compiles ok w/o union wait 1>&AC_FD_CC
4070 AC_TRY_LINK($cf_wait_headers,
4073 int y = WEXITSTATUS(x);
4076 int z = WTERMSIG(x);
4080 [cf_cv_type_unionwait=yes
4081 echo compiles ok with union wait and possibly macros too 1>&AC_FD_CC
4083 [cf_cv_type_unionwait=no])])])
4084 AC_MSG_RESULT($cf_cv_type_unionwait)
4085 test $cf_cv_type_unionwait = yes && AC_DEFINE(HAVE_TYPE_UNIONWAIT,1,[Define to 1 if type unionwait is declared])
4087 dnl ---------------------------------------------------------------------------
4088 dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59
4090 dnl Make an uppercase version of a variable
4091 dnl $1=uppercase($2)
4092 AC_DEFUN([CF_UPPER],
4094 $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
4096 dnl ---------------------------------------------------------------------------
4097 dnl CF_UTF8_LIB version: 8 updated: 2012/10/06 08:57:51
4099 dnl Check for multibyte support, and if not found, utf8 compatibility library
4100 AC_DEFUN([CF_UTF8_LIB],
4102 AC_CACHE_CHECK(for multibyte character support,cf_cv_utf8_lib,[
4103 cf_save_LIBS="$LIBS"
4105 #include <stdlib.h>],[putwc(0,0);],
4106 [cf_cv_utf8_lib=yes],
4108 #include <libutf8.h>],[putwc(0,0);],utf8,
4109 [cf_cv_utf8_lib=add-on],
4110 [cf_cv_utf8_lib=no])
4113 # HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between
4115 if test "$cf_cv_utf8_lib" = "add-on" ; then
4116 AC_DEFINE(HAVE_LIBUTF8_H,1,[Define to 1 if we should include libutf8.h])
4117 CF_ADD_INCDIR($cf_cv_header_path_utf8)
4118 CF_ADD_LIBDIR($cf_cv_library_path_utf8)
4119 CF_ADD_LIBS($cf_cv_library_file_utf8)
4122 dnl ---------------------------------------------------------------------------
4123 dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12
4125 dnl Use AC_VERBOSE w/o the warnings
4126 AC_DEFUN([CF_VERBOSE],
4127 [test -n "$verbose" && echo " $1" 1>&AC_FD_MSG
4130 dnl ---------------------------------------------------------------------------
4131 dnl CF_VERSION_INFO version: 6 updated: 2013/06/16 10:25:53
4133 dnl Define several useful symbols derived from the VERSION file. A separate
4134 dnl file is preferred to embedding the version numbers in various scripts.
4135 dnl (automake is a textbook-example of why the latter is a bad idea, but there
4138 dnl The file contents are:
4139 dnl libtool-version release-version patch-version
4143 dnl libtool-version (see ?) consists of 3 integers separated by '.'
4144 dnl release-version consists of a major version and minor version
4145 dnl separated by '.', optionally followed by a patch-version
4146 dnl separated by '-'. The minor version need not be an
4147 dnl integer (but it is preferred).
4148 dnl patch-version is an integer in the form yyyymmdd, so ifdef's and
4149 dnl scripts can easily compare versions.
4151 dnl If libtool is used, the first form is required, since CF_WITH_LIBTOOL
4152 dnl simply extracts the first field using 'cut -f1'.
4154 dnl Optional parameters:
4155 dnl $1 = internal name for package
4156 dnl $2 = external name for package
4157 AC_DEFUN([CF_VERSION_INFO],
4159 if test -f $srcdir/VERSION ; then
4160 AC_MSG_CHECKING(for package version)
4162 # if there are not enough fields, cut returns the last one...
4163 cf_field1=`sed -e '2,$d' $srcdir/VERSION|cut -f1`
4164 cf_field2=`sed -e '2,$d' $srcdir/VERSION|cut -f2`
4165 cf_field3=`sed -e '2,$d' $srcdir/VERSION|cut -f3`
4167 # this is how CF_BUNDLED_INTL uses $VERSION:
4168 VERSION="$cf_field1"
4170 VERSION_MAJOR=`echo "$cf_field2" | sed -e 's/\..*//'`
4171 test -z "$VERSION_MAJOR" && AC_MSG_ERROR(missing major-version)
4173 VERSION_MINOR=`echo "$cf_field2" | sed -e 's/^[[^.]]*\.//' -e 's/-.*//'`
4174 test -z "$VERSION_MINOR" && AC_MSG_ERROR(missing minor-version)
4176 AC_MSG_RESULT(${VERSION_MAJOR}.${VERSION_MINOR})
4178 AC_MSG_CHECKING(for package patch date)
4179 VERSION_PATCH=`echo "$cf_field3" | sed -e 's/^[[^-]]*-//'`
4180 case .$VERSION_PATCH in
4182 AC_MSG_ERROR(missing patch-date $VERSION_PATCH)
4184 .[[0-9]][[0-9]][[0-9]][[0-9]][[0-9]][[0-9]][[0-9]][[0-9]])
4187 AC_MSG_ERROR(illegal patch-date $VERSION_PATCH)
4190 AC_MSG_RESULT($VERSION_PATCH)
4192 AC_MSG_ERROR(did not find $srcdir/VERSION)
4195 # show the actual data that we have for versions:
4196 CF_VERBOSE(ABI VERSION $VERSION)
4197 CF_VERBOSE(VERSION_MAJOR $VERSION_MAJOR)
4198 CF_VERBOSE(VERSION_MINOR $VERSION_MINOR)
4199 CF_VERBOSE(VERSION_PATCH $VERSION_PATCH)
4202 AC_SUBST(VERSION_MAJOR)
4203 AC_SUBST(VERSION_MINOR)
4204 AC_SUBST(VERSION_PATCH)
4206 dnl if a package name is given, define its corresponding version info. We
4207 dnl need the package name to ensure that the defined symbols are unique.
4210 PACKAGE=ifelse($2,,$1,$2)
4211 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE",[Define to the package-name])
4213 CF_UPPER(cf_PACKAGE,$cf_PACKAGE)
4214 AC_DEFINE_UNQUOTED(${cf_PACKAGE}_VERSION,"${VERSION_MAJOR}.${VERSION_MINOR}")
4215 AC_DEFINE_UNQUOTED(${cf_PACKAGE}_PATCHDATE,${VERSION_PATCH})
4218 dnl ---------------------------------------------------------------------------
4219 dnl CF_WAIT_HEADERS version: 2 updated: 1997/10/21 19:45:33
4221 dnl Build up an expression $cf_wait_headers with the header files needed to
4222 dnl compile against the prototypes for 'wait()', 'waitpid()', etc. Assume it's
4223 dnl Posix, which uses <sys/types.h> and <sys/wait.h>, but allow SVr4 variation
4225 AC_DEFUN([CF_WAIT_HEADERS],
4227 AC_HAVE_HEADERS(sys/wait.h)
4228 cf_wait_headers="#include <sys/types.h>
4230 if test $ac_cv_header_sys_wait_h = yes; then
4231 cf_wait_headers="$cf_wait_headers
4232 #include <sys/wait.h>
4235 AC_HAVE_HEADERS(wait.h)
4236 AC_HAVE_HEADERS(waitstatus.h)
4237 if test $ac_cv_header_wait_h = yes; then
4238 cf_wait_headers="$cf_wait_headers
4242 if test $ac_cv_header_waitstatus_h = yes; then
4243 cf_wait_headers="$cf_wait_headers
4244 #include <waitstatus.h>
4249 dnl ---------------------------------------------------------------------------
4250 dnl CF_WITH_ABI_VERSION version: 1 updated: 2003/09/20 18:12:49
4251 dnl -------------------
4252 dnl Allow library's ABI to be overridden. Generally this happens when a
4253 dnl packager has incremented the ABI past that used in the original package,
4254 dnl and wishes to keep doing this.
4256 dnl $1 is the package name, if any, to derive a corresponding {package}_ABI
4258 AC_DEFUN([CF_WITH_ABI_VERSION],[
4259 test -z "$cf_cv_abi_version" && cf_cv_abi_version=0
4260 AC_ARG_WITH(abi-version,
4261 [ --with-abi-version=XXX override derived ABI version],
4262 [AC_MSG_WARN(overriding ABI version $cf_cv_abi_version to $withval)
4263 cf_cv_abi_version=$withval])
4264 CF_NUMBER_SYNTAX($cf_cv_abi_version,ABI version)
4266 $1_ABI=$cf_cv_abi_version
4269 dnl ---------------------------------------------------------------------------
4270 dnl CF_WITH_CURSES_DIR version: 3 updated: 2010/11/20 17:02:38
4271 dnl ------------------
4272 dnl Wrapper for AC_ARG_WITH to specify directory under which to look for curses
4274 AC_DEFUN([CF_WITH_CURSES_DIR],[
4276 AC_MSG_CHECKING(for specific curses-directory)
4277 AC_ARG_WITH(curses-dir,
4278 [ --with-curses-dir=DIR directory in which (n)curses is installed],
4279 [cf_cv_curses_dir=$withval],
4280 [cf_cv_curses_dir=no])
4281 AC_MSG_RESULT($cf_cv_curses_dir)
4283 if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
4285 CF_PATH_SYNTAX(withval)
4286 if test -d "$cf_cv_curses_dir"
4288 CF_ADD_INCDIR($cf_cv_curses_dir/include)
4289 CF_ADD_LIBDIR($cf_cv_curses_dir/lib)
4293 dnl ---------------------------------------------------------------------------
4294 dnl CF_WITH_DBMALLOC version: 7 updated: 2010/06/21 17:26:47
4295 dnl ----------------
4296 dnl Configure-option for dbmalloc. The optional parameter is used to override
4297 dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests.
4298 AC_DEFUN([CF_WITH_DBMALLOC],[
4299 CF_NO_LEAKS_OPTION(dbmalloc,
4300 [ --with-dbmalloc test: use Conor Cahill's dbmalloc library],
4303 if test "$with_dbmalloc" = yes ; then
4304 AC_CHECK_HEADER(dbmalloc.h,
4305 [AC_CHECK_LIB(dbmalloc,[debug_malloc]ifelse([$1],,[],[,$1]))])
4308 dnl ---------------------------------------------------------------------------
4309 dnl CF_WITH_DMALLOC version: 7 updated: 2010/06/21 17:26:47
4311 dnl Configure-option for dmalloc. The optional parameter is used to override
4312 dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests.
4313 AC_DEFUN([CF_WITH_DMALLOC],[
4314 CF_NO_LEAKS_OPTION(dmalloc,
4315 [ --with-dmalloc test: use Gray Watson's dmalloc library],
4318 if test "$with_dmalloc" = yes ; then
4319 AC_CHECK_HEADER(dmalloc.h,
4320 [AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse([$1],,[],[,$1]))])
4323 dnl ---------------------------------------------------------------------------
4324 dnl CF_WITH_LIBTOOL version: 30 updated: 2013/09/07 13:54:05
4326 dnl Provide a configure option to incorporate libtool. Define several useful
4327 dnl symbols for the makefile rules.
4329 dnl The reference to AC_PROG_LIBTOOL does not normally work, since it uses
4330 dnl macros from libtool.m4 which is in the aclocal directory of automake.
4331 dnl Following is a simple script which turns on the AC_PROG_LIBTOOL macro.
4332 dnl But that still does not work properly since the macro is expanded outside
4333 dnl the CF_WITH_LIBTOOL macro:
4336 dnl ACLOCAL=`aclocal --print-ac-dir`
4337 dnl if test -z "$ACLOCAL" ; then
4338 dnl echo cannot find aclocal directory
4340 dnl elif test ! -f $ACLOCAL/libtool.m4 ; then
4341 dnl echo cannot find libtool.m4 file
4345 dnl LOCAL=aclocal.m4
4346 dnl ORIG=aclocal.m4.orig
4348 dnl trap "mv $ORIG $LOCAL" 0 1 2 5 15
4352 dnl # sed the LIBTOOL= assignment to omit the current directory?
4353 dnl sed -e 's/^LIBTOOL=.*/LIBTOOL=${LIBTOOL:-libtool}/' $ACLOCAL/libtool.m4 >>$LOCAL
4354 dnl cat $ORIG >>$LOCAL
4358 AC_DEFUN([CF_WITH_LIBTOOL],
4360 AC_REQUIRE([CF_DISABLE_LIBTOOL_VERSION])
4361 ifdef([AC_PROG_LIBTOOL],,[
4364 # common library maintenance symbols that are convenient for libtool scripts:
4365 LIB_CREATE='${AR} -cr'
4366 LIB_OBJECT='${OBJECTS}'
4370 # symbols used to prop libtool up to enable it to determine what it should be
4378 AC_MSG_CHECKING(if you want to build libraries with libtool)
4379 AC_ARG_WITH(libtool,
4380 [ --with-libtool generate libraries with libtool],
4381 [with_libtool=$withval],
4383 AC_MSG_RESULT($with_libtool)
4384 if test "$with_libtool" != "no"; then
4385 ifdef([AC_PROG_LIBTOOL],[
4386 # missing_content_AC_PROG_LIBTOOL{{
4388 # missing_content_AC_PROG_LIBTOOL}}
4390 if test "$with_libtool" != "yes" ; then
4391 CF_PATH_SYNTAX(with_libtool)
4392 LIBTOOL=$with_libtool
4394 AC_CHECK_TOOLS(LIBTOOL,[libtool glibtool],none)
4396 if test -z "$cf_cv_libtool_version" && test "$LIBTOOL" = libtool
4398 CF_FORGET_TOOL(LIBTOOL)
4399 AC_CHECK_TOOLS(LIBTOOL,[glibtool],none)
4403 if test -z "$LIBTOOL" ; then
4404 AC_MSG_ERROR(Cannot find libtool)
4407 LIB_CREATE='${LIBTOOL} --mode=link ${CC} -rpath ${DESTDIR}${libdir} ${LIBTOOL_VERSION} `cut -f1 ${srcdir}/VERSION` ${LIBTOOL_OPTS} ${LT_UNDEF} $(LIBS) -o'
4408 LIB_OBJECT='${OBJECTS:.o=.lo}'
4410 LIB_CLEAN='${LIBTOOL} --mode=clean'
4411 LIB_COMPILE='${LIBTOOL} --mode=compile'
4412 LIB_LINK='${LIBTOOL} --mode=link ${CC} ${LIBTOOL_OPTS}'
4413 LIB_INSTALL='${LIBTOOL} --mode=install'
4414 LIB_UNINSTALL='${LIBTOOL} --mode=uninstall'
4417 CF_CHECK_LIBTOOL_VERSION
4419 # special hack to add -no-undefined (which libtool should do for itself)
4421 case "$cf_cv_system_name" in #(vi
4422 cygwin*|msys*|mingw32*|uwin*|aix[[4-7]]) #(vi
4423 LT_UNDEF=-no-undefined
4426 AC_SUBST([LT_UNDEF])
4428 # special hack to add --tag option for C++ compiler
4429 case $cf_cv_libtool_version in #(vi
4430 1.[[5-9]]*|[[2-9]].[[0-9.a-z]]*) #(vi
4431 LIBTOOL_CXX="$LIBTOOL --tag=CXX"
4432 LIBTOOL="$LIBTOOL --tag=CC"
4435 LIBTOOL_CXX="$LIBTOOL"
4443 test -z "$LIBTOOL" && ECHO_LT=
4446 AC_SUBST(LIBTOOL_CXX)
4447 AC_SUBST(LIBTOOL_OPTS)
4449 AC_SUBST(LIB_CREATE)
4450 AC_SUBST(LIB_OBJECT)
4451 AC_SUBST(LIB_SUFFIX)
4455 AC_SUBST(LIB_COMPILE)
4457 AC_SUBST(LIB_INSTALL)
4458 AC_SUBST(LIB_UNINSTALL)
4461 dnl ---------------------------------------------------------------------------
4462 dnl CF_WITH_LIBTOOL_OPTS version: 2 updated: 2007/04/08 18:14:54
4463 dnl --------------------
4464 dnl Allow user to pass additional libtool options into the library creation
4465 dnl and link steps. The main use for this is to do something like
4466 dnl ./configure --with-libtool-opts=-static
4467 dnl to get the same behavior as automake-flavored
4468 dnl ./configure --enable-static
4469 AC_DEFUN([CF_WITH_LIBTOOL_OPTS],[
4470 AC_MSG_CHECKING(for additional libtool options)
4471 AC_ARG_WITH(libtool-opts,
4472 [ --with-libtool-opts=XXX specify additional libtool options],
4473 [with_libtool_opts=$withval],
4474 [with_libtool_opts=no])
4475 AC_MSG_RESULT($with_libtool_opts)
4477 case .$with_libtool_opts in
4481 LIBTOOL_OPTS=$with_libtool_opts
4485 AC_SUBST(LIBTOOL_OPTS)
4487 dnl ---------------------------------------------------------------------------
4488 dnl CF_WITH_NO_LEAKS version: 2 updated: 2012/10/06 08:57:51
4489 dnl ----------------
4490 AC_DEFUN([CF_WITH_NO_LEAKS],[
4492 AC_REQUIRE([CF_WITH_DMALLOC])
4493 AC_REQUIRE([CF_WITH_DBMALLOC])
4494 AC_REQUIRE([CF_WITH_PURIFY])
4495 AC_REQUIRE([CF_WITH_VALGRIND])
4497 AC_MSG_CHECKING(if you want to perform memory-leak testing)
4498 AC_ARG_WITH(no-leaks,
4499 [ --with-no-leaks test: free permanent memory, analyze leaks],
4500 [AC_DEFINE(NO_LEAKS,1,[Define to 1 to enable leak-checking])
4501 cf_doalloc=".${with_dmalloc}${with_dbmalloc}${with_purify}${with_valgrind}"
4502 case ${cf_doalloc} in #(vi
4504 *) AC_DEFINE(DOALLOC,10000,[Define to size of malloc-array]) ;;
4508 AC_MSG_RESULT($with_no_leaks)
4510 dnl ---------------------------------------------------------------------------
4511 dnl CF_WITH_PURIFY version: 2 updated: 2006/12/14 18:43:43
4513 AC_DEFUN([CF_WITH_PURIFY],[
4514 CF_NO_LEAKS_OPTION(purify,
4515 [ --with-purify test: use Purify],
4517 [LINK_PREFIX="$LINK_PREFIX purify"])
4518 AC_SUBST(LINK_PREFIX)
4520 dnl ---------------------------------------------------------------------------
4521 dnl CF_WITH_REL_VERSION version: 1 updated: 2003/09/20 18:12:49
4522 dnl -------------------
4523 dnl Allow library's release-version to be overridden. Generally this happens when a
4524 dnl packager has incremented the release-version past that used in the original package,
4525 dnl and wishes to keep doing this.
4527 dnl $1 is the package name, if any, to derive corresponding {package}_MAJOR
4528 dnl and {package}_MINOR symbols
4530 AC_DEFUN([CF_WITH_REL_VERSION],[
4531 test -z "$cf_cv_rel_version" && cf_cv_rel_version=0.0
4532 AC_ARG_WITH(rel-version,
4533 [ --with-rel-version=XXX override derived release version],
4534 [AC_MSG_WARN(overriding release version $cf_cv_rel_version to $withval)
4535 cf_cv_rel_version=$withval])
4537 CF_NUMBER_SYNTAX($cf_cv_rel_version,Release version)
4539 $1_MAJOR=`echo "$cf_cv_rel_version" | sed -e 's/\..*//'`
4540 $1_MINOR=`echo "$cf_cv_rel_version" | sed -e 's/^[[^.]]*//' -e 's/^\.//' -e 's/\..*//'`
4541 CF_NUMBER_SYNTAX([$]$1_MAJOR,Release major-version)
4542 CF_NUMBER_SYNTAX([$]$1_MINOR,Release minor-version)
4545 dnl ---------------------------------------------------------------------------
4546 dnl CF_WITH_SHARED_OR_LIBTOOL version: 5 updated: 2013/09/02 09:17:44
4547 dnl -------------------------
4548 dnl Provide shared libraries using either autoconf macros (--with-shared) or
4549 dnl using the external libtool script (--with-libtool).
4551 dnl $1 = program name (all caps preferred)
4552 dnl $1 = release version
4553 dnl $2 = ABI version
4554 define([CF_WITH_SHARED_OR_LIBTOOL],[
4558 cf_cv_rel_version=$REL_VERSION
4559 AC_SUBST(ABI_VERSION)
4560 AC_SUBST(REL_VERSION)
4562 CF_WITH_REL_VERSION($1)
4566 DFT_LWR_MODEL=$LIB_MODEL
4569 # use to comment-out makefile lines
4576 LIB_CREATE="$LIB_CREATE \[$]@"
4578 if test "$with_libtool" = "yes" ; then
4581 DFT_LWR_MODEL=$LIB_MODEL
4583 CF_WITH_LIBTOOL_OPTS
4588 AC_MSG_CHECKING(if you want to build shared libraries)
4590 [ --with-shared generate shared-libraries],
4591 [with_shared=$withval],
4593 AC_MSG_RESULT($with_shared)
4594 if test "$with_shared" = "yes" ; then
4596 DFT_LWR_MODEL=$LIB_MODEL
4599 LIB_CREATE="[$]MK_SHARED_LIB"
4600 CFLAGS="$CFLAGS $CC_SHARED_OPTS"
4608 CF_LIB_SUFFIX($LIB_MODEL, DFT_LIB_SUFFIX, DFT_DEP_SUFFIX)
4609 LIB_SUFFIX=$DFT_LIB_SUFFIX
4611 AC_SUBST(DFT_LWR_MODEL)
4612 AC_SUBST(DFT_LIB_SUFFIX)
4613 AC_SUBST(DFT_DEP_SUFFIX)
4616 AC_SUBST(LIBTOOL_MAKE)
4618 AC_SUBST(MAKE_NORMAL)
4619 AC_SUBST(MAKE_SHARED)
4620 AC_SUBST(MAKE_STATIC)
4622 dnl ---------------------------------------------------------------------------
4623 dnl CF_WITH_VALGRIND version: 1 updated: 2006/12/14 18:00:21
4624 dnl ----------------
4625 AC_DEFUN([CF_WITH_VALGRIND],[
4626 CF_NO_LEAKS_OPTION(valgrind,
4627 [ --with-valgrind test: use valgrind],
4630 dnl ---------------------------------------------------------------------------
4631 dnl CF_WITH_WARNINGS version: 5 updated: 2004/07/23 14:40:34
4632 dnl ----------------
4633 dnl Combine the checks for gcc features into a configure-script option
4636 dnl $1 - see CF_GCC_WARNINGS
4637 AC_DEFUN([CF_WITH_WARNINGS],
4639 if ( test "$GCC" = yes || test "$GXX" = yes )
4641 AC_MSG_CHECKING(if you want to check for gcc warnings)
4642 AC_ARG_WITH(warnings,
4643 [ --with-warnings test: turn on gcc warnings],
4644 [cf_opt_with_warnings=$withval],
4645 [cf_opt_with_warnings=no])
4646 AC_MSG_RESULT($cf_opt_with_warnings)
4647 if test "$cf_opt_with_warnings" != no ; then
4649 CF_GCC_WARNINGS([$1])
4653 dnl ---------------------------------------------------------------------------
4654 dnl CF_XOPEN_CURSES version: 11 updated: 2011/01/18 18:15:30
4656 dnl Test if we should define X/Open source for curses, needed on Digital Unix
4657 dnl 4.x, to see the extended functions, but breaks on IRIX 6.x.
4659 dnl The getbegyx() check is needed for HPUX, which omits legacy macros such
4660 dnl as getbegy(). The latter is better design, but the former is standard.
4661 AC_DEFUN([CF_XOPEN_CURSES],
4663 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
4664 AC_CACHE_CHECK(if we must define _XOPEN_SOURCE_EXTENDED,cf_cv_need_xopen_extension,[
4667 #include <${cf_cv_ncurses_header:-curses.h}>],[
4668 #if defined(NCURSES_VERSION_PATCH)
4669 #if (NCURSES_VERSION_PATCH < 20100501) && (NCURSES_VERSION_PATCH >= 20100403)
4673 long x = winnstr(stdscr, "", 0);
4675 getbegyx(stdscr, y1, x1)],
4676 [cf_cv_need_xopen_extension=no],
4678 #define _XOPEN_SOURCE_EXTENDED
4680 #include <${cf_cv_ncurses_header:-curses.h}>],[
4681 #ifdef NCURSES_VERSION
4683 int check2 = curs_set((int)sizeof(check));
4685 long x = winnstr(stdscr, "", 0);
4687 getbegyx(stdscr, y1, x1)],
4688 [cf_cv_need_xopen_extension=yes],
4689 [cf_cv_need_xopen_extension=unknown])])])
4690 test $cf_cv_need_xopen_extension = yes && CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
4692 dnl ---------------------------------------------------------------------------
4693 dnl CF_XOPEN_SOURCE version: 45 updated: 2013/09/07 14:06:25
4695 dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
4696 dnl or adapt to the vendor's definitions to get equivalent functionality,
4697 dnl without losing the common non-POSIX features.
4700 dnl $1 is the nominal value for _XOPEN_SOURCE
4701 dnl $2 is the nominal value for _POSIX_C_SOURCE
4702 AC_DEFUN([CF_XOPEN_SOURCE],[
4703 AC_REQUIRE([AC_CANONICAL_HOST])
4705 cf_XOPEN_SOURCE=ifelse([$1],,500,[$1])
4706 cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2])
4709 case $host_os in #(vi
4711 cf_xopen_source="-D_ALL_SOURCE"
4716 darwin[[0-8]].*) #(vi
4717 cf_xopen_source="-D_APPLE_C_SOURCE"
4720 cf_xopen_source="-D_DARWIN_C_SOURCE"
4723 freebsd*|dragonfly*) #(vi
4724 # 5.x headers associate
4725 # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L
4726 # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L
4727 cf_POSIX_C_SOURCE=200112L
4729 cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
4732 cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500"
4735 cf_xopen_source="-D_HPUX_SOURCE"
4738 cf_xopen_source="-D_SGI_SOURCE"
4741 linux*|gnu*|mint*|k*bsd*-gnu) #(vi
4745 # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <sys/select.h> and other headers which use u_int / u_short types
4747 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
4750 cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
4752 openbsd[[4-9]]*) #(vi
4753 # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw
4754 cf_xopen_source="-D_BSD_SOURCE"
4758 # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
4761 cf_xopen_source="-D_OSF_SOURCE"
4764 cf_xopen_source="-D_QNX_SOURCE"
4767 # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
4770 cf_xopen_source="-D__EXTENSIONS__"
4774 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
4778 if test -n "$cf_xopen_source" ; then
4779 CF_ADD_CFLAGS($cf_xopen_source)
4782 dnl In anything but the default case, we may have system-specific setting
4783 dnl which is still not guaranteed to provide all of the entrypoints that
4784 dnl _XOPEN_SOURCE would yield.
4785 if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then
4786 AC_MSG_CHECKING(if _XOPEN_SOURCE really is set)
4787 AC_TRY_COMPILE([#include <stdlib.h>],[
4788 #ifndef _XOPEN_SOURCE
4791 [cf_XOPEN_SOURCE_set=yes],
4792 [cf_XOPEN_SOURCE_set=no])
4793 AC_MSG_RESULT($cf_XOPEN_SOURCE_set)
4794 if test $cf_XOPEN_SOURCE_set = yes
4796 AC_TRY_COMPILE([#include <stdlib.h>],[
4797 #if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE
4800 [cf_XOPEN_SOURCE_set_ok=yes],
4801 [cf_XOPEN_SOURCE_set_ok=no])
4802 if test $cf_XOPEN_SOURCE_set_ok = no
4804 AC_MSG_WARN(_XOPEN_SOURCE is lower than requested)
4811 dnl ---------------------------------------------------------------------------
4812 dnl CF__ADD_SHLIB_RULES version: 4 updated: 2013/07/22 18:49:24
4813 dnl -------------------
4814 dnl Append rules for creating, installing, uninstalling and cleaning library.
4815 dnl In particular, this is needed for shared libraries since there are symbolic
4816 dnl links which depend on configuration choices.
4818 dnl The logic is controlled by these cache variables:
4819 dnl $cf_cv_do_symlinks
4820 dnl $cf_cv_shlib_version
4822 dnl The macro uses variables set by CF__DEFINE_SHLIB_VARS
4824 dnl $1 = makefile to append to
4825 dnl $2 = model (static, shared, libtool)
4826 dnl $3 = objects (dependencies)
4827 dnl $4 = additional libraries needed to link the shared library
4828 define([CF__ADD_SHLIB_RULES],[
4830 CF__DEFINE_LIB_TARGET
4833 xlibtool|xshared) #(vi
4834 cf_libdeps="ifelse($4,,,[$4])"
4843 # generated by CF__ADD_SHLIB_RULES
4845 # symlinks: $cf_cv_do_symlinks
4846 # shlibver: $cf_cv_shlib_version
4857 \$(LIBTOOL_CREATE) $3 $cf_libdeps
4860 if test "x$cf_cv_do_symlinks" = xyes
4863 \$(LN_S) $cf_libname $cf_liblink
4864 \$(LN_S) $cf_liblink $cf_libroot
4871 install.libs :: \$(DESTDIR)\$(libdir)/$cf_libname
4873 \$(DESTDIR)\$(libdir)/$cf_libname :: \\
4874 \$(DESTDIR)\$(libdir) \\
4877 \$(LIBTOOL_CREATE) $3 $cf_libdeps
4880 if test "x$cf_cv_do_symlinks" = xyes
4883 cd \$(DESTDIR)\$(libdir) && (\$(LN_S) $cf_libname $cf_liblink; \$(LN_S) $cf_liblink $cf_libroot; )
4887 if test x$2 = xshared
4890 - test -z "\$(DESTDIR)" && /sbin/ldconfig
4898 @echo uninstalling \$(DESTDIR)\$(libdir)/$cf_libname
4901 if test "x$cf_cv_do_symlinks" = xyes
4904 -rm -f \$(DESTDIR)\$(libdir)/$cf_libroot
4905 -rm -f \$(DESTDIR)\$(libdir)/$cf_liblink
4910 -rm -f \$(DESTDIR)\$(libdir)/$cf_libname
4916 if test "x$cf_cv_do_symlinks" = xyes
4929 # end generated by CF__ADD_SHLIB_RULES
4932 dnl ---------------------------------------------------------------------------
4933 dnl CF__CURSES_HEAD version: 2 updated: 2010/10/23 15:54:49
4935 dnl Define a reusable chunk which includes <curses.h> and <term.h> when they
4936 dnl are both available.
4937 define([CF__CURSES_HEAD],[
4939 #include <xcurses.h>
4940 char * XCursesProgramName = "test";
4942 #include <${cf_cv_ncurses_header:-curses.h}>
4943 #if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H)
4944 #include <ncursesw/term.h>
4945 #elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H)
4946 #include <ncurses/term.h>
4947 #elif defined(HAVE_TERM_H)
4952 dnl ---------------------------------------------------------------------------
4953 dnl CF__CURSES_HEAD version: 2 updated: 2010/10/23 15:54:49
4955 dnl Define a reusable chunk which includes <curses.h> and <term.h> when they
4956 dnl are both available.
4957 define([CF__CURSES_HEAD],[
4959 #include <xcurses.h>
4960 char * XCursesProgramName = "test";
4962 #include <${cf_cv_ncurses_header:-curses.h}>
4963 #if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H)
4964 #include <ncursesw/term.h>
4965 #elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H)
4966 #include <ncurses/term.h>
4967 #elif defined(HAVE_TERM_H)
4972 dnl ---------------------------------------------------------------------------
4973 dnl CF__DEFINE_LIB_TARGET version: 1 updated: 2013/07/22 18:27:50
4974 dnl ---------------------
4975 define([CF__DEFINE_LIB_TARGET],[
4976 cf_libname=\${LIB_BASENAME}
4977 cf_liblink=$cf_libname
4978 cf_libroot=$cf_libname
4980 if test "x$cf_cv_do_symlinks" = xyes
4982 case "x$cf_cv_shlib_version" in #(vi
4984 cf_liblink="\${LIB_ABI_NAME}"
4985 cf_libname="\${LIB_REL_NAME}"
4988 cf_liblink="\${LIB_REL_NAME}"
4989 cf_libname="\${LIB_ABI_NAME}"
4993 LIB_TARGET=$cf_libname
4995 dnl ---------------------------------------------------------------------------
4996 dnl CF__DEFINE_SHLIB_VARS version: 2 updated: 2013/07/27 17:38:32
4997 dnl ---------------------
4998 dnl Substitute makefile variables useful for CF__ADD_SHLIB_RULES.
5000 dnl The substitution requires these variables:
5001 dnl LIB_PREFI - "lib"
5002 dnl LIB_ROOTNAME - "foo"
5003 dnl LIB_SUFFIX - ".so"
5004 dnl REL_VERSION - "5.0"
5005 dnl ABI_VERSION - "4.2.4"
5006 define([CF__DEFINE_SHLIB_VARS],[
5007 CF__DEFINE_LIB_TARGET
5008 SET_SHLIB_VARS="# begin CF__DEFINE_SHLIB_VARS\\
5009 LIB_BASENAME = ${LIB_PREFIX}\${LIB_ROOTNAME}\${LIB_SUFFIX}\\
5010 LIB_REL_NAME = \${LIB_BASENAME}.\${REL_VERSION}\\
5011 LIB_ABI_NAME = \${LIB_BASENAME}.\${ABI_VERSION}\\
5012 LIB_TARGET = $LIB_TARGET\\
5013 RM_SHARED_OPTS = $RM_SHARED_OPTS\\
5014 # end CF__DEFINE_SHLIB_VARS"
5015 AC_SUBST(SET_SHLIB_VARS)
5016 AC_SUBST(LIB_TARGET)
5018 dnl ---------------------------------------------------------------------------
5019 dnl CF__ICONV_BODY version: 2 updated: 2007/07/26 17:35:47
5021 dnl Test-code needed for iconv compile-checks
5022 define([CF__ICONV_BODY],[
5023 iconv_t cd = iconv_open("","");
5024 iconv(cd,NULL,NULL,NULL,NULL);
5027 dnl ---------------------------------------------------------------------------
5028 dnl CF__ICONV_HEAD version: 1 updated: 2007/07/26 15:57:03
5030 dnl Header-files needed for iconv compile-checks
5031 define([CF__ICONV_HEAD],[
5035 dnl ---------------------------------------------------------------------------
5036 dnl CF__INIT_SHLIB_RULES version: 2 updated: 2013/07/27 17:38:32
5037 dnl --------------------
5038 dnl The third parameter to AC_OUTPUT, used to pass variables needed for
5039 dnl CF__ADD_SHLIB_RULES.
5040 define([CF__INIT_SHLIB_RULES],[
5041 ABI_VERSION="$ABI_VERSION"
5042 REL_VERSION="$REL_VERSION"
5043 LIB_MODEL="$LIB_MODEL"
5044 LIB_PREFIX="$LIB_PREFIX"
5045 LIB_ROOTNAME="$LIB_ROOTNAME"
5046 DFT_DEP_SUFFIX="$DFT_DEP_SUFFIX"
5047 RM_SHARED_OPTS="$RM_SHARED_OPTS"
5048 cf_cv_do_symlinks="$cf_cv_do_symlinks"
5049 cf_cv_shlib_version="$cf_cv_shlib_version"
5051 dnl ---------------------------------------------------------------------------
5052 dnl CF__INTL_BODY version: 1 updated: 2007/07/26 17:35:47
5054 dnl Test-code needed for libintl compile-checks
5055 dnl $1 = parameter 2 from AM_WITH_NLS
5056 define([CF__INTL_BODY],[
5057 bindtextdomain ("", "");
5058 return (int) gettext ("")
5059 ifelse([$1], need-ngettext, [ + (int) ngettext ("", "", 0)], [])
5060 [ + _nl_msg_cat_cntr]
5062 dnl ---------------------------------------------------------------------------
5063 dnl CF__INTL_HEAD version: 1 updated: 2007/07/26 17:35:47
5065 dnl Header-files needed for libintl compile-checks
5066 define([CF__INTL_HEAD],[
5067 #include <libintl.h>
5068 extern int _nl_msg_cat_cntr;
5070 dnl ---------------------------------------------------------------------------
5071 dnl jm_GLIBC21 version: 3 updated: 2002/10/27 23:21:42
5073 dnl Inserted as requested by gettext 0.10.40
5074 dnl File from /usr/share/aclocal
5076 dnl ====================
5079 dnl Test for the GNU C Library, version 2.1 or newer.
5080 dnl From Bruno Haible.
5081 AC_DEFUN([jm_GLIBC21],
5083 AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
5084 ac_cv_gnu_library_2_1,
5085 [AC_EGREP_CPP([Lucky GNU user],
5087 #include <features.h>
5088 #ifdef __GNU_LIBRARY__
5089 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
5094 ac_cv_gnu_library_2_1=yes,
5095 ac_cv_gnu_library_2_1=no)
5099 GLIBC21="$ac_cv_gnu_library_2_1"