]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/dialog/aclocal.m4
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / dialog / aclocal.m4
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
5 dnl
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:
13 dnl 
14 dnl The above copyright notice and this permission notice shall be included
15 dnl in all copies or portions of the Software.
16 dnl 
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.
24 dnl 
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
28 dnl authorization.
29 dnl
30 dnl see
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
35 dnl --------------
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
49
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])
55
56    AM_ICONV
57    AM_LANGINFO_CODESET
58    AM_LC_MESSAGES
59    AM_WITH_NLS([$1],[$2],[$3],[$4])
60
61    if test "x$CATOBJEXT" != "x"; then
62      if test "x$ALL_LINGUAS" = "x"; then
63        LINGUAS=
64      else
65        AC_MSG_CHECKING(for catalogs to be installed)
66        NEW_LINGUAS=
67        for presentlang in $ALL_LINGUAS; do
68          useit=no
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;;
77            esac
78          done
79          if test $useit = yes; then
80            NEW_LINGUAS="$NEW_LINGUAS $presentlang"
81          fi
82        done
83        LINGUAS=$NEW_LINGUAS
84        AC_MSG_RESULT($LINGUAS)
85      fi
86
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
90      fi
91    fi
92
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)
96 ])dnl
97 dnl ---------------------------------------------------------------------------
98 dnl AM_ICONV version: 12 updated: 2007/07/30 19:12:03
99 dnl --------
100 dnl Inserted as requested by gettext 0.10.40
101 dnl File from /usr/share/aclocal
102 dnl iconv.m4
103 dnl ====================
104 dnl serial AM2
105 dnl
106 dnl From Bruno Haible.
107 dnl
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
112 AC_DEFUN([AM_ICONV],
113 [
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).
116
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)
121    ])
122
123   AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
124     CF_FIND_LINKAGE(CF__ICONV_HEAD,
125       CF__ICONV_BODY,
126       iconv,
127       am_cv_func_iconv=yes,
128       am_cv_func_iconv=["no, consider installing GNU libiconv"])])
129
130   if test "$am_cv_func_iconv" = yes; then
131     AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
132
133     AC_CACHE_CHECK([if the declaration of iconv() needs const.],
134                    am_cv_proto_iconv_const,[
135       AC_TRY_COMPILE(CF__ICONV_HEAD [
136 extern
137 #ifdef __cplusplus
138 "C"
139 #endif
140 #if defined(__STDC__) || defined(__cplusplus)
141 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
142 #else
143 size_t iconv();
144 #endif
145 ],[], am_cv_proto_iconv_const=no,
146       am_cv_proto_iconv_const=yes)])
147
148     if test "$am_cv_proto_iconv_const" = yes ; then
149       am_cv_proto_iconv_arg1="const"
150     else
151       am_cv_proto_iconv_arg1=""
152     fi
153
154     AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
155       [Define as const if the declaration of iconv() needs const.])
156   fi
157
158   LIBICONV=
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
162       LIBICONV="-liconv"
163       CF_ADD_LIBDIR($cf_cv_library_path_iconv)
164     fi
165   fi
166
167   AC_SUBST(LIBICONV)
168 ])dnl
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
174 dnl codeset.m4
175 dnl ====================
176 dnl serial AM1
177 dnl
178 dnl From Bruno Haible.
179 AC_DEFUN([AM_LANGINFO_CODESET],
180 [
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)
186     ])
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).])
190   fi
191 ])dnl
192 dnl ---------------------------------------------------------------------------
193 dnl AM_LC_MESSAGES version: 4 updated: 2002/10/27 23:21:42
194 dnl --------------
195 dnl Inserted as requested by gettext 0.10.40
196 dnl File from /usr/share/aclocal
197 dnl lcmessage.m4
198 dnl ====================
199 dnl Check whether LC_MESSAGES is available in <locale.h>.
200 dnl Ulrich Drepper <drepper@cygnus.com>, 1995.
201 dnl
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.
210 dnl
211 dnl serial 2
212 dnl
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.])
221     fi
222   fi])dnl
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
228 dnl progtest.m4
229 dnl ====================
230 dnl Search path for a program which passes the given test.
231 dnl Ulrich Drepper <drepper@cygnus.com>, 1996.
232 dnl
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.
241 dnl
242 dnl serial 2
243 dnl
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,
252 [case "[$]$1" in
253   [[\\/]*|?:[\\/]]*)
254   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
255   ;;
256   *)
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
261       if [$3]; then
262         ac_cv_path_$1="$ac_dir/$ac_word$ac_exeext"
263         break
264       fi
265     fi
266   done
267   IFS="$ac_save_ifs"
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"
271 ])dnl
272   ;;
273 esac])dnl
274 $1="$ac_cv_path_$1"
275 if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
276   AC_MSG_RESULT([$]$1)
277 else
278   AC_MSG_RESULT(no)
279 fi
280 AC_SUBST($1)dnl
281 ])dnl
282 dnl ---------------------------------------------------------------------------
283 dnl AM_WITH_NLS version: 25 updated: 2012/10/06 08:57:51
284 dnl -----------
285 dnl Inserted as requested by gettext 0.10.40
286 dnl File from /usr/share/aclocal
287 dnl gettext.m4
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 ====================
296 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.
305 dnl
306 dnl serial 10
307 dnl
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
316 dnl    will be ignored.
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.
321 dnl
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
324 dnl    and used.
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
336 dnl maintainers.
337 dnl
338 AC_DEFUN([AM_WITH_NLS],
339 [AC_MSG_CHECKING([whether NLS is requested])
340   dnl Default is enabled NLS
341   ifelse([$4],,[
342   AC_ARG_ENABLE(nls,
343     [  --disable-nls           do not use Native Language Support],
344     USE_NLS=$enableval, USE_NLS=yes)],[
345   AC_ARG_ENABLE(nls,
346     [  --enable-nls            use Native Language Support],
347     USE_NLS=$enableval, USE_NLS=no)])
348   AC_MSG_RESULT($USE_NLS)
349   AC_SUBST(USE_NLS)
350
351   BUILD_INCLUDED_LIBINTL=no
352   USE_INCLUDED_LIBINTL=no
353   INTLLIBS=
354
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
359  is requested.])
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)
366
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.
372       CATOBJEXT=NONE
373
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,
378         CF__INTL_BODY,
379         intl,
380         cf_cv_func_gettext=yes,
381         cf_cv_func_gettext=no)
382       ])
383       LIBS="$cf_save_LIBS_1"
384
385       if test "$cf_cv_func_gettext" = yes ; then
386         AC_DEFINE(HAVE_LIBINTL_H,1,[Define to 1 if we have libintl.h])
387
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.])
395
396           CF_ADD_INCDIR($cf_cv_header_path_intl)
397
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
401             dnl libiconv.
402             INTLLIBS="$cf_cv_library_file_intl $LIBICONV"
403             CF_ADD_LIBDIR($cf_cv_library_path_intl,INTLLIBS)
404           fi
405
406           gt_save_LIBS="$LIBS"
407           LIBS="$LIBS $INTLLIBS"
408           AC_CHECK_FUNCS(dcgettext)
409           LIBS="$gt_save_LIBS"
410
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)
415
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], :)
419
420           CATOBJEXT=.gmo
421         fi
422       fi
423
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
428       fi
429     fi
430
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)
434       fi
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], :)
442       AC_SUBST(MSGFMT)
443       BUILD_INCLUDED_LIBINTL=yes
444       USE_INCLUDED_LIBINTL=yes
445       CATOBJEXT=.gmo
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/ $//'`
448     fi
449
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
456         : ;
457       else
458         AC_MSG_RESULT(
459           [found msgfmt program is not GNU msgfmt; ignore it])
460         GMSGFMT=":"
461       fi
462     fi
463
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
470         : ;
471       else
472         AC_MSG_RESULT(
473           [found xgettext program is not GNU xgettext; ignore it])
474         XGETTEXT=":"
475       fi
476     fi
477
478     dnl We need to process the po/ directory.
479     POSUB=po
480   fi
481
482   AC_OUTPUT_COMMANDS(
483    [for ac_file in $CONFIG_FILES; do
484
485       # Support "outfile[:infile[:infile...]]"
486       case "$ac_file" in
487         *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
488       esac
489
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"
500
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" ;;
505         esac
506
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"
513         fi
514         ;;
515       esac
516     done])
517
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
522   fi
523
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
527   dnl compile.
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
537       ac_verc_fail=yes
538     else
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].*)
546 changequote([,])dnl
547            ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
548         *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
549       esac
550     AC_MSG_RESULT([$ac_prog_version])
551     fi
552     if test $ac_verc_fail = yes; then
553       INTLBISON=:
554     fi
555   fi
556
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
559   dnl in configure.in.
560   for lang in $ALL_LINGUAS; do
561     GMOFILES="$GMOFILES $lang.gmo"
562     POFILES="$POFILES $lang.po"
563   done
564
565   dnl Make all variables we use known to autoconf.
566   AC_SUBST(BUILD_INCLUDED_LIBINTL)
567   AC_SUBST(USE_INCLUDED_LIBINTL)
568   AC_SUBST(CATALOGS)
569   AC_SUBST(CATOBJEXT)
570   AC_SUBST(GMOFILES)
571   AC_SUBST(INTLLIBS)
572   AC_SUBST(INTLOBJS)
573   AC_SUBST(POFILES)
574   AC_SUBST(POSUB)
575
576   dnl For backward compatibility. Some configure.ins may be using this.
577   nls_cv_header_intl=
578   nls_cv_header_libgt=
579
580   dnl For backward compatibility. Some Makefiles may be using this.
581   DATADIRNAME=share
582   AC_SUBST(DATADIRNAME)
583
584   dnl For backward compatibility. Some Makefiles may be using this.
585   INSTOBJEXT=.mo
586   AC_SUBST(INSTOBJEXT)
587
588   dnl For backward compatibility. Some Makefiles may be using this.
589   GENCAT=gencat
590   AC_SUBST(GENCAT)
591 ])dnl
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.
596 dnl
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],
601 [
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
620 dnl -------------
621 dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS
622 dnl The second parameter if given makes this macro verbose.
623 dnl
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],
628 [
629 cf_fix_cppflags=no
630 cf_new_cflags=
631 cf_new_cppflags=
632 cf_new_extra_cppflags=
633
634 for cf_add_cflags in $1
635 do
636 case $cf_fix_cppflags in
637 no)
638         case $cf_add_cflags in #(vi
639         -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
640                 case $cf_add_cflags in
641                 -D*)
642                         cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'`
643
644                         test "${cf_add_cflags}" != "${cf_tst_cflags}" \
645                                 && test -z "${cf_tst_cflags}" \
646                                 && cf_fix_cppflags=yes
647
648                         if test $cf_fix_cppflags = yes ; then
649                                 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
650                                 continue
651                         elif test "${cf_tst_cflags}" = "\"'" ; then
652                                 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
653                                 continue
654                         fi
655                         ;;
656                 esac
657                 case "$CPPFLAGS" in
658                 *$cf_add_cflags) #(vi
659                         ;;
660                 *) #(vi
661                         case $cf_add_cflags in #(vi
662                         -D*)
663                                 cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
664                                 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags)
665                                 ;;
666                         esac
667                         cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
668                         ;;
669                 esac
670                 ;;
671         *)
672                 cf_new_cflags="$cf_new_cflags $cf_add_cflags"
673                 ;;
674         esac
675         ;;
676 yes)
677         cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
678
679         cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'`
680
681         test "${cf_add_cflags}" != "${cf_tst_cflags}" \
682                 && test -z "${cf_tst_cflags}" \
683                 && cf_fix_cppflags=no
684         ;;
685 esac
686 done
687
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"
691 fi
692
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"
696 fi
697
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"
701 fi
702
703 AC_SUBST(EXTRA_CPPFLAGS)
704
705 ])dnl
706 dnl ---------------------------------------------------------------------------
707 dnl CF_ADD_INCDIR version: 13 updated: 2010/05/26 16:44:57
708 dnl -------------
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],
715 [
716 if test -n "$1" ; then
717   for cf_add_incdir in $1
718   do
719         while test $cf_add_incdir != /usr/include
720         do
721           if test -d $cf_add_incdir
722           then
723                 cf_have_incdir=no
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
729                         fi
730                   done
731                 fi
732
733                 if test "$cf_have_incdir" = no ; then
734                   if test "$cf_add_incdir" = /usr/local/include ; then
735                         if test "$GCC" = yes
736                         then
737                           cf_save_CPPFLAGS=$CPPFLAGS
738                           CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
739                           AC_TRY_COMPILE([#include <stdio.h>],
740                                   [printf("Hello")],
741                                   [],
742                                   [cf_have_incdir=yes])
743                           CPPFLAGS=$cf_save_CPPFLAGS
744                         fi
745                   fi
746                 fi
747
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"
751
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"
755                 else
756                   break
757                 fi
758           fi
759         done
760   done
761 fi
762 ])dnl
763 dnl ---------------------------------------------------------------------------
764 dnl CF_ADD_LIB version: 2 updated: 2010/06/02 05:03:05
765 dnl ----------
766 dnl Add a library, used to enforce consistency.
767 dnl
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
773 dnl -------------
774 dnl     Adds to the library-path
775 dnl
776 dnl     Some machines have trouble with multiple -L options.
777 dnl
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)
780 dnl
781 AC_DEFUN([CF_ADD_LIBDIR],
782 [
783 if test -n "$1" ; then
784   for cf_add_libdir in $1
785   do
786     if test $cf_add_libdir = /usr/lib ; then
787       :
788     elif test -d $cf_add_libdir
789     then
790       cf_have_libdir=no
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
796           fi
797         done
798       fi
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])"
802       fi
803     fi
804   done
805 fi
806 ])dnl
807 dnl ---------------------------------------------------------------------------
808 dnl CF_ADD_LIBS version: 1 updated: 2010/06/02 05:03:05
809 dnl -----------
810 dnl Add one or more libraries, used to enforce consistency.
811 dnl
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.
819 dnl See CF_WITH_PATH
820 dnl
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],[
824   case "$1" in #(vi
825   no) #(vi
826       ;;
827   yes) #(vi
828       ;;
829   *)
830       CF_ADD_SEARCHPATH([$1], [AC_MSG_ERROR(cannot find $2 under $1)])
831       ;;
832   esac
833 ])dnl
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.
841 dnl
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],
845 [
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)
852         ifelse([$2],,,[else
853 $2])
854         fi
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)
859         ifelse([$2],,,[else
860 $2])
861         fi
862 done
863 ])
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],
874 [
875 test "$4" != "$5" && \
876 test -d "$4" && \
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"
884 }
885 ])dnl
886 dnl ---------------------------------------------------------------------------
887 dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31
888 dnl --------------
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:
896 dnl
897 dnl Parameters:
898 dnl $1 = message
899 dnl $2 = option name
900 dnl $3 = help-string
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],[
905 AC_MSG_CHECKING($1)
906 AC_ARG_ENABLE($2,[$3],,enableval=ifelse($6,,no,$6))
907 AC_MSG_RESULT($enableval)
908 if test "$enableval" != no ; then
909 ifelse($4,,[    :],$4)
910 else
911 ifelse($5,,[    :],$5)
912 fi
913 ])dnl
914 dnl ---------------------------------------------------------------------------
915 dnl CF_ARG_OPTION version: 4 updated: 2010/05/26 05:38:42
916 dnl -------------
917 dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus
918 dnl values.
919 dnl
920 dnl Parameters:
921 dnl $1 = option name
922 dnl $2 = help-string
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
929 ifelse([$3],,[    :]dnl
930 ,[    $3]) ifelse([$4],,,[
931   else
932     $4])
933   fi],[enableval=$5 ifelse([$4],,,[
934   $4
935 ])dnl
936   ])])dnl
937 dnl ---------------------------------------------------------------------------
938 dnl CF_BUNDLED_INTL version: 17 updated: 2012/10/06 08:57:51
939 dnl ---------------
940 dnl Top-level macro for configuring an application with a bundled copy of
941 dnl the intl and po directories for gettext.
942 dnl
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
945 dnl
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
952 dnl
953 dnl Defines:
954 dnl     HAVE_LIBGETTEXT_H if we're using ./intl
955 dnl     NLS_TEXTDOMAIN
956 dnl
957 dnl Environment:
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.
962 dnl
963 AC_DEFUN([CF_BUNDLED_INTL],[
964 cf_makefile=ifelse($1,,Makefile,$1)
965
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/*//'`
970
971 # Allow override of "config.h" definition:
972 : ${CONFIG_H:=config.h}
973 AC_SUBST(CONFIG_H)
974
975 if test -z "$PACKAGE" ; then
976         AC_MSG_ERROR([[CF_BUNDLED_INTL] used without setting [PACKAGE] variable])
977 fi
978
979 if test -z "$VERSION" ; then
980 if test -f $srcdir/VERSION ; then
981         VERSION=`sed -e '2,$d' $srcdir/VERSION|cut -f1`
982 else
983         VERSION=unknown
984 fi
985 fi
986 AC_SUBST(VERSION)
987
988 AM_GNU_GETTEXT(,,,[$2])
989
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)
997 fi
998
999 INTLDIR_MAKE=
1000 MSG_DIR_MAKE=
1001 SUB_MAKEFILE=
1002
1003 dnl this updates SUB_MAKEFILE and MSG_DIR_MAKE:
1004 CF_OUR_MESSAGES($1)
1005
1006 if test "$USE_INCLUDED_LIBINTL" = yes ; then
1007         if test "$nls_cv_force_use_gnu_gettext" = yes ; then
1008                 :
1009         elif test "$nls_cv_use_gnu_gettext" = yes ; then
1010                 :
1011         else
1012                 INTLDIR_MAKE="#"
1013         fi
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
1019                 do
1020                         if test -f "$cf_makefile" ; then
1021                                 SUB_MAKEFILE="$SUB_MAKEFILE `echo \"${cf_makefile}\"|sed -e 's,^'$srcdir/',,' -e 's/\.in$//'`:${cf_makefile}"
1022                                 break
1023                         fi
1024                 done
1025         fi
1026 else
1027         INTLDIR_MAKE="#"
1028         if test "$USE_NLS" = yes ; then
1029                 AC_CHECK_HEADERS(libintl.h)
1030         fi
1031 fi
1032
1033 if test -z "$INTLDIR_MAKE" ; then
1034         CPPFLAGS="$CPPFLAGS -I../intl"
1035 fi
1036
1037 dnl FIXME:  we use this in lynx (the alternative is a spurious dependency upon
1038 dnl GNU make)
1039 if test "$BUILD_INCLUDED_LIBINTL" = yes ; then
1040         GT_YES="#"
1041         GT_NO=
1042 else
1043         GT_YES=
1044         GT_NO="#"
1045 fi
1046
1047 AC_SUBST(INTLDIR_MAKE)
1048 AC_SUBST(MSG_DIR_MAKE)
1049 AC_SUBST(GT_YES)
1050 AC_SUBST(GT_NO)
1051
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.
1055
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])
1061         fi
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])
1064         fi
1065 fi
1066 ])dnl
1067 dnl ---------------------------------------------------------------------------
1068 dnl CF_CC_ENV_FLAGS version: 1 updated: 2012/10/03 05:25:49
1069 dnl ---------------
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],
1074 [
1075 # This should have been defined by AC_PROG_CC
1076 : ${CC:=cc}
1077
1078 AC_MSG_CHECKING(\$CC variable)
1079 case "$CC" in #(vi
1080 *[[\ \  ]]-[[IUD]]*)
1081         AC_MSG_RESULT(broken)
1082         AC_MSG_WARN(your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options)
1083         # humor him...
1084         cf_flags=`echo "$CC" | sed -e 's/^[[^   ]]*[[   ]]//'`
1085         CC=`echo "$CC" | sed -e 's/[[   ]].*//'`
1086         CF_ADD_CFLAGS($cf_flags)
1087         ;;
1088 *)
1089         AC_MSG_RESULT(ok)
1090         ;;
1091 esac
1092 ])dnl
1093 dnl ---------------------------------------------------------------------------
1094 dnl CF_CHECK_CACHE version: 12 updated: 2012/10/02 20:55:03
1095 dnl --------------
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.
1098 dnl
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.
1103 dnl
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],
1107 [
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"
1111 else
1112         system_name="`(uname -s -r) 2>/dev/null`"
1113         if test -z "$system_name" ; then
1114                 system_name="`(hostname) 2>/dev/null`"
1115         fi
1116 fi
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"])
1119
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)
1122
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.")
1126 fi
1127 ])dnl
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
1132 dnl
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
1138 then
1139         AC_MSG_CHECKING(version of $LIBTOOL)
1140         CF_LIBTOOL_VERSION
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)
1144         fi
1145 else
1146         AC_MSG_ERROR(GNU libtool has not been found)
1147 fi
1148 ])dnl
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.
1155 dnl
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.
1159 dnl
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
1165
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"
1170         AC_TRY_COMPILE([],[
1171 #ifdef __clang__
1172 #else
1173 make an error
1174 #endif
1175 ],[ifelse([$2],,CLANG_COMPILER,[$2])=yes
1176 cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments"
1177 ],[])
1178         ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
1179         AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2]))
1180 fi
1181 ])
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],
1187 [
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}>],
1191                 [chtype foo],
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])
1203         fi
1204 fi
1205 ])dnl
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],
1213 [
1214 CF_CURSES_CPPFLAGS
1215 CF_NCURSES_VERSION
1216 CF_CURSES_LIBS
1217 ])dnl
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],[
1223
1224 AC_CACHE_CHECK(for extra include directories,cf_cv_curses_incdir,[
1225 cf_cv_curses_incdir=no
1226 case $host_os in #(vi
1227 hpux10.*) #(vi
1228         if test "x$cf_cv_screen" = "xcurses_colr"
1229         then
1230                 test -d /usr/include/curses_colr && \
1231                 cf_cv_curses_incdir="-I/usr/include/curses_colr"
1232         fi
1233         ;;
1234 sunos3*|sunos4*)
1235         if test "x$cf_cv_screen" = "xcurses_5lib"
1236         then
1237                 test -d /usr/5lib && \
1238                 test -d /usr/5include && \
1239                 cf_cv_curses_incdir="-I/usr/5include"
1240         fi
1241         ;;
1242 esac
1243 ])
1244 test "$cf_cv_curses_incdir" != no && CPPFLAGS="$CPPFLAGS $cf_cv_curses_incdir"
1245
1246 CF_CURSES_HEADER
1247 CF_TERM_HEADER
1248 ])dnl
1249 dnl ---------------------------------------------------------------------------
1250 dnl CF_CURSES_FUNCS version: 17 updated: 2011/05/14 16:07:29
1251 dnl ---------------
1252 dnl Curses-functions are a little complicated, since a lot of them are macros.
1253 AC_DEFUN([CF_CURSES_FUNCS],
1254 [
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])
1259 for cf_func in $1
1260 do
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,
1268                         [
1269 #ifndef ${cf_func}
1270 long foo = (long)(&${cf_func});
1271 if (foo + 1234 > 5678)
1272         ${cf_cv_main_return:-return}(foo);
1273 #endif
1274                         ],
1275                         [cf_result=yes],
1276                         [cf_result=no])
1277                 fi
1278                 eval 'cf_cv_func_'$cf_func'=$cf_result'
1279         ])
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})
1285         fi
1286 done
1287 ])dnl
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.
1293 dnl
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,,,[ \
1299     $1/ncurses.h \
1300         $1/curses.h]) \
1301         ncurses.h \
1302         curses.h ifelse($1,,[ncurses/ncurses.h ncurses/curses.h])
1303 do
1304 AC_TRY_COMPILE([#include <${cf_header}>],
1305         [initscr(); tgoto("?", 0,0)],
1306         [cf_cv_ncurses_header=$cf_header; break],[])
1307 done
1308 ])
1309
1310 if test "$cf_cv_ncurses_header" = none ; then
1311         AC_MSG_ERROR(No curses header-files found)
1312 fi
1313
1314 # cheat, to get the right #define's for HAVE_NCURSES_H, etc.
1315 AC_CHECK_HEADERS($cf_cv_ncurses_header)
1316 ])dnl
1317 dnl ---------------------------------------------------------------------------
1318 dnl CF_CURSES_LIBS version: 37 updated: 2013/02/09 17:33:50
1319 dnl --------------
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],[
1323
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)],
1328     cf_result=yes,
1329     cf_result=no)
1330 AC_MSG_RESULT($cf_result)
1331
1332 if test "$cf_result" = no ; then
1333 case $host_os in #(vi
1334 freebsd*) #(vi
1335     AC_CHECK_LIB(mytinfo,tgoto,[CF_ADD_LIBS(-lmytinfo)])
1336     ;;
1337 hpux10.*) #(vi
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"
1343         then
1344                 AC_CHECK_LIB(cur_colr,initscr,[
1345                         CF_ADD_LIBS(-lcur_colr)
1346                         ac_cv_func_initscr=yes
1347                         ],[
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
1353                         ])])
1354         fi
1355         ;;
1356 linux*)
1357         case `arch 2>/dev/null` in
1358         x86_64)
1359                 if test -d /lib64
1360                 then
1361                         CF_ADD_LIBDIR(/lib64)
1362                 else
1363                         CF_ADD_LIBDIR(/lib)
1364                 fi
1365                 ;;
1366         *)
1367                 CF_ADD_LIBDIR(/lib)
1368                 ;;
1369         esac
1370         ;;
1371 sunos3*|sunos4*)
1372         if test "x$cf_cv_screen" = "xcurses_5lib"
1373         then
1374                 if test -d /usr/5lib ; then
1375                         CF_ADD_LIBDIR(/usr/5lib)
1376                         CF_ADD_LIBS(-lcurses -ltermcap)
1377                 fi
1378     fi
1379     ac_cv_func_initscr=yes
1380     ;;
1381 esac
1382
1383 if test ".$ac_cv_func_initscr" != .yes ; then
1384         cf_save_LIBS="$LIBS"
1385
1386         if test ".${cf_cv_ncurses_version:-no}" != .no
1387         then
1388                 cf_check_list="ncurses curses cursesX"
1389         else
1390                 cf_check_list="cursesX curses ncurses"
1391         fi
1392
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
1396         then
1397                 AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[
1398                         for cf_term_lib in $cf_check_list otermcap termcap tinfo termlib unknown
1399                         do
1400                                 AC_CHECK_LIB($cf_term_lib,tgoto,[break])
1401                         done
1402                 ])
1403         fi
1404
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
1408         then
1409                 for cf_curs_lib in $cf_check_list xcurses jcurses pdcurses unknown
1410                 do
1411                         AC_CHECK_LIB($cf_curs_lib,initscr,[break])
1412                 done
1413         fi
1414         test $cf_curs_lib = unknown && AC_MSG_ERROR(no curses library found)
1415
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}>],
1420                         [initscr()],
1421                         [cf_result=yes],
1422                         [cf_result=no])
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
1426                 :
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);],
1431                         [cf_result=no],
1432                         [
1433                         LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS"
1434                         AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
1435                                 [initscr()],
1436                                 [cf_result=yes],
1437                                 [cf_result=error])
1438                         ])
1439                 AC_MSG_RESULT($cf_result)
1440         fi
1441 fi
1442 fi
1443
1444 ])dnl
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],
1453 [
1454 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
1455
1456 AC_CACHE_CHECK(for term.h, cf_cv_term_header,[
1457
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.
1460
1461 cf_header_list="term.h ncurses/term.h ncursesw/term.h"
1462
1463 case ${cf_cv_ncurses_header:-curses.h} in #(vi
1464 */*)
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"
1467         ;;
1468 esac
1469
1470 for cf_header in $cf_header_list
1471 do
1472         AC_TRY_COMPILE([
1473 #include <${cf_cv_ncurses_header:-curses.h}>
1474 #include <${cf_header}>],
1475         [WINDOW *x],
1476         [cf_cv_term_header=$cf_header
1477          break],
1478         [cf_cv_term_header=no])
1479 done
1480
1481 case $cf_cv_term_header in #(vi
1482 no)
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
1486         do
1487                 AC_TRY_COMPILE([
1488 #include <${cf_cv_ncurses_header:-curses.h}>
1489 #ifdef NCURSES_VERSION
1490 #include <${cf_header}>
1491 #else
1492 make an error
1493 #endif],
1494                         [WINDOW *x],
1495                         [cf_cv_term_header=$cf_header
1496                          break],
1497                         [cf_cv_term_header=no])
1498         done
1499         ;;
1500 esac
1501 ])
1502
1503 case $cf_cv_term_header in #(vi
1504 term.h) #(vi
1505         AC_DEFINE(HAVE_TERM_H,1,[Define to 1 if we have term.h])
1506         ;;
1507 ncurses/term.h) #(vi
1508         AC_DEFINE(HAVE_NCURSES_TERM_H,1,[Define to 1 if we have ncurses/term.h])
1509         ;;
1510 ncursesw/term.h)
1511         AC_DEFINE(HAVE_NCURSESW_TERM_H,1,[Define to 1 if we have ncursesw/term.h])
1512         ;;
1513 esac
1514 ])dnl
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
1521 dnl broken).
1522 AC_DEFUN([CF_CURSES_UNCTRL_H],
1523 [
1524 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
1525
1526 AC_CACHE_CHECK(for unctrl.h, cf_cv_unctrl_header,[
1527
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.
1530
1531 cf_header_list="unctrl.h ncurses/unctrl.h ncursesw/unctrl.h"
1532
1533 case ${cf_cv_ncurses_header:-curses.h} in #(vi
1534 */*)
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"
1537         ;;
1538 esac
1539
1540 for cf_header in $cf_header_list
1541 do
1542         AC_TRY_COMPILE([
1543 #include <${cf_cv_ncurses_header:-curses.h}>
1544 #include <${cf_header}>],
1545         [WINDOW *x],
1546         [cf_cv_unctrl_header=$cf_header
1547          break],
1548         [cf_cv_unctrl_header=no])
1549 done
1550
1551 case $cf_cv_unctrl_header in #(vi
1552 no)
1553         AC_MSG_WARN(unctrl.h header not found)
1554         ;;
1555 esac
1556 ])
1557
1558 case $cf_cv_unctrl_header in #(vi
1559 unctrl.h) #(vi
1560         AC_DEFINE(HAVE_UNCTRL_H,1,[Define to 1 if we have unctrl.h])
1561         ;;
1562 ncurses/unctrl.h) #(vi
1563         AC_DEFINE(HAVE_NCURSES_UNCTRL_H,1,[Define to 1 if we have ncurses/unctrl.h])
1564         ;;
1565 ncursesw/unctrl.h)
1566         AC_DEFINE(HAVE_NCURSESW_UNCTRL_H,1,[Define to 1 if we have ncursesw/unctrl.h])
1567         ;;
1568 esac
1569 ])dnl
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],
1575 [
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
1579         do
1580         AC_TRY_LINK([
1581 #ifndef _XOPEN_SOURCE_EXTENDED
1582 #define _XOPEN_SOURCE_EXTENDED
1583 #endif
1584 #include <${cf_cv_ncurses_header:-curses.h}>],
1585         [void *foo = &($name['k'])],
1586         [cf_cv_curses_wacs_map=$name
1587          break])
1588         done])
1589
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])
1591 ])dnl
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],
1599 [
1600 AC_REQUIRE([CF_CURSES_WACS_MAP])
1601
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
1605 then
1606         AC_TRY_LINK([
1607 #ifndef _XOPEN_SOURCE_EXTENDED
1608 #define _XOPEN_SOURCE_EXTENDED
1609 #endif
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])
1614 else
1615         AC_TRY_LINK([
1616 #ifndef _XOPEN_SOURCE_EXTENDED
1617 #define _XOPEN_SOURCE_EXTENDED
1618 #endif
1619 #include <${cf_cv_ncurses_header:-curses.h}>],
1620         [cchar_t *foo = WACS_PLUS],
1621         [cf_cv_curses_wacs_symbols=yes])
1622 fi
1623 ])
1624
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])
1626 ])dnl
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.
1633 dnl
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
1638 then
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
1646         then
1647                 AC_DEFINE(HAVE_WINDOW__PARENT,1,[Define to 1 if WINDOW struct has _parent member])
1648         fi
1649 fi
1650 ])dnl
1651 dnl ---------------------------------------------------------------------------
1652 dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52
1653 dnl ----------
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
1658 dnl ---------------
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.
1661 dnl
1662 dnl Sets:
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
1668 dnl
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],
1673         [
1674     ECHO_LT='--silent'
1675     ECHO_LD='@echo linking [$]@;'
1676     RULE_CC='@echo compiling [$]<'
1677     SHOW_CC='@echo compiling [$]@'
1678     ECHO_CC='@'
1679 ],[
1680     ECHO_LT=''
1681     ECHO_LD=''
1682     RULE_CC=''
1683     SHOW_CC=''
1684     ECHO_CC=''
1685 ])
1686 AC_MSG_RESULT($enableval)
1687 AC_SUBST(ECHO_LT)
1688 AC_SUBST(ECHO_LD)
1689 AC_SUBST(RULE_CC)
1690 AC_SUBST(SHOW_CC)
1691 AC_SUBST(ECHO_CC)
1692 ])dnl
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],
1701 [
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)
1708
1709 if test "$cf_libtool_version" = yes ; then
1710         LIBTOOL_VERSION="-version-number"
1711 else
1712         LIBTOOL_VERSION="-version-info"
1713 fi
1714
1715 AC_SUBST(LIBTOOL_VERSION)
1716 ])dnl
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],
1725 [
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
1733         CF_RPATH_HACK
1734 fi
1735 ])
1736 dnl ---------------------------------------------------------------------------
1737 dnl CF_ENABLE_RPATH version: 2 updated: 2010/03/27 18:39:42
1738 dnl ---------------
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],
1742 [
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)
1749 ])dnl
1750 dnl ---------------------------------------------------------------------------
1751 dnl CF_FIND_LIBRARY version: 9 updated: 2008/03/23 14:48:54
1752 dnl ---------------
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
1758 dnl     $3 = includes
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
1762 dnl
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],
1766 [
1767         eval 'cf_cv_have_lib_'$1'=no'
1768         cf_libdir=""
1769         AC_CHECK_FUNC($5,
1770                 eval 'cf_cv_have_lib_'$1'=yes',[
1771                 cf_save_LIBS="$LIBS"
1772                 AC_MSG_CHECKING(for $5 in -l$1)
1773                 LIBS="-l$1 $LIBS"
1774                 AC_TRY_LINK([$3],[$4],
1775                         [AC_MSG_RESULT(yes)
1776                          eval 'cf_cv_have_lib_'$1'=yes'
1777                         ],
1778                         [AC_MSG_RESULT(no)
1779                         CF_LIBRARY_PATH(cf_search,$2)
1780                         for cf_libdir in $cf_search
1781                         do
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],
1785                                         [AC_MSG_RESULT(yes)
1786                                          eval 'cf_cv_have_lib_'$1'=yes'
1787                                          break],
1788                                         [AC_MSG_RESULT(no)
1789                                          LIBS="$cf_save_LIBS"])
1790                         done
1791                         ])
1792                 ])
1793 eval 'cf_found_library=[$]cf_cv_have_lib_'$1
1794 ifelse($6,,[
1795 if test $cf_found_library = no ; then
1796         AC_MSG_ERROR(Cannot link $1 library)
1797 fi
1798 ])
1799 ])dnl
1800 dnl ---------------------------------------------------------------------------
1801 dnl CF_FIND_LINKAGE version: 19 updated: 2010/05/29 16:31:02
1802 dnl ---------------
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.
1806 dnl
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
1815 dnl
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],[
1822
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=
1827
1828 CF_MSG_LOG([Starting [FIND_LINKAGE]($3,$6)])
1829
1830 cf_save_LIBS="$LIBS"
1831
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
1836 ],[
1837
1838 LIBS="-l$3 $7 $cf_save_LIBS"
1839
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"
1845 ],[
1846         cf_cv_find_linkage_$3=no
1847         LIBS="$cf_save_LIBS"
1848
1849     CF_VERBOSE(find linkage for $3 library)
1850     CF_MSG_LOG([Searching for headers in [FIND_LINKAGE]($3,$6)])
1851
1852     cf_save_CPPFLAGS="$CPPFLAGS"
1853     cf_test_CPPFLAGS="$CPPFLAGS"
1854
1855     CF_HEADER_PATH(cf_search,ifelse([$6],,[$3],[$6]))
1856     for cf_cv_header_path_$3 in $cf_search
1857     do
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"
1865             break],[
1866             CPPFLAGS="$cf_save_CPPFLAGS"
1867             ])
1868       fi
1869     done
1870
1871     if test "$cf_cv_find_linkage_$3" = maybe ; then
1872
1873       CF_MSG_LOG([Searching for $3 library in [FIND_LINKAGE]($3,$6)])
1874
1875       cf_save_LIBS="$LIBS"
1876       cf_save_LDFLAGS="$LDFLAGS"
1877
1878       ifelse([$6],,,[
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"
1886             ])
1887
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
1891         do
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"
1901                 break],[
1902                 CPPFLAGS="$cf_save_CPPFLAGS"
1903                 LIBS="$cf_save_LIBS"
1904                 LDFLAGS="$cf_save_LDFLAGS"
1905                 ])
1906           fi
1907         done
1908         CPPFLAGS="$cf_save_CPPFLAGS"
1909         LDFLAGS="$cf_save_LDFLAGS"
1910       fi
1911
1912     else
1913       cf_cv_find_linkage_$3=no
1914     fi
1915     ],$7)
1916 ])
1917
1918 LIBS="$cf_save_LIBS"
1919
1920 if test "$cf_cv_find_linkage_$3" = yes ; then
1921 ifelse([$4],,[
1922         CF_ADD_INCDIR($cf_cv_header_path_$3)
1923         CF_ADD_LIBDIR($cf_cv_library_path_$3)
1924         CF_ADD_LIB($3)
1925 ],[$4])
1926 else
1927 ifelse([$5],,AC_MSG_WARN(Cannot find $3 library),[$5])
1928 fi
1929 ])dnl
1930 dnl ---------------------------------------------------------------------------
1931 dnl CF_FORGET_TOOL version: 1 updated: 2013/04/06 18:03:09
1932 dnl --------------
1933 dnl Forget that we saw the given tool.
1934 AC_DEFUN([CF_FORGET_TOOL],[
1935 unset ac_cv_prog_ac_ct_$1
1936 unset ac_ct_$1
1937 unset $1
1938 ])dnl
1939 dnl ---------------------------------------------------------------------------
1940 dnl CF_FUNC_WAIT version: 3 updated: 2012/10/06 08:57:51
1941 dnl ------------
1942 dnl Test for the presence of <sys/wait.h>, 'union wait', arg-type of 'wait()'
1943 dnl and/or 'waitpid()'.
1944 dnl
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
1947 dnl defined.
1948 dnl
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.
1951 dnl
1952 AC_DEFUN([CF_FUNC_WAIT],
1953 [
1954 AC_REQUIRE([CF_UNION_WAIT])
1955 if test $cf_cv_type_unionwait = yes; then
1956
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])
1963                 ])
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])
1966
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])
1973                 ])
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])
1976
1977 fi
1978 ])dnl
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],
1986 [
1987 if test "$GCC" = yes
1988 then
1989 cat > conftest.i <<EOF
1990 #ifndef GCC_PRINTF
1991 #define GCC_PRINTF 0
1992 #endif
1993 #ifndef GCC_SCANF
1994 #define GCC_SCANF 0
1995 #endif
1996 #ifndef GCC_NORETURN
1997 #define GCC_NORETURN /* nothing */
1998 #endif
1999 #ifndef GCC_UNUSED
2000 #define GCC_UNUSED /* nothing */
2001 #endif
2002 EOF
2003 if test "$GCC" = yes
2004 then
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"
2011 #if     GCC_PRINTF
2012 #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
2013 #else
2014 #define GCC_PRINTFLIKE(fmt,var) /*nothing*/
2015 #endif
2016 #if     GCC_SCANF
2017 #define GCC_SCANFLIKE(fmt,var)  __attribute__((format(scanf,fmt,var)))
2018 #else
2019 #define GCC_SCANFLIKE(fmt,var)  /*nothing*/
2020 #endif
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; }
2025 EOF
2026         cf_printf_attribute=no
2027         cf_scanf_attribute=no
2028         for cf_attribute in scanf printf unused noreturn
2029         do
2030                 CF_UPPER(cf_ATTRIBUTE,$cf_attribute)
2031                 cf_directive="__attribute__(($cf_attribute))"
2032                 echo "checking for $CC $cf_directive" 1>&AC_FD_CC
2033
2034                 case $cf_attribute in #(vi
2035                 printf) #(vi
2036                         cf_printf_attribute=yes
2037                         cat >conftest.h <<EOF
2038 #define GCC_$cf_ATTRIBUTE 1
2039 EOF
2040                         ;;
2041                 scanf) #(vi
2042                         cf_scanf_attribute=yes
2043                         cat >conftest.h <<EOF
2044 #define GCC_$cf_ATTRIBUTE 1
2045 EOF
2046                         ;;
2047                 *) #(vi
2048                         cat >conftest.h <<EOF
2049 #define GCC_$cf_ATTRIBUTE $cf_directive
2050 EOF
2051                         ;;
2052                 esac
2053
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
2058                         noreturn) #(vi
2059                                 AC_DEFINE_UNQUOTED(GCC_NORETURN,$cf_directive,[Define to noreturn-attribute for gcc])
2060                                 ;;
2061                         printf) #(vi
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.])
2066                                 fi
2067                                 AC_DEFINE_UNQUOTED(GCC_PRINTFLIKE(fmt,var),$cf_value,[Define to printf-attribute for gcc])
2068                                 ;;
2069                         scanf) #(vi
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.])
2074                                 fi
2075                                 AC_DEFINE_UNQUOTED(GCC_SCANFLIKE(fmt,var),$cf_value,[Define to sscanf-attribute for gcc])
2076                                 ;;
2077                         unused) #(vi
2078                                 AC_DEFINE_UNQUOTED(GCC_UNUSED,$cf_directive,[Define to unused-attribute for gcc])
2079                                 ;;
2080                         esac
2081                 fi
2082         done
2083 else
2084         fgrep define conftest.i >>confdefs.h
2085 fi
2086 rm -rf conftest*
2087 fi
2088 ])dnl
2089 dnl ---------------------------------------------------------------------------
2090 dnl CF_GCC_VERSION version: 7 updated: 2012/10/18 06:46:33
2091 dnl --------------
2092 dnl Find version of gcc
2093 AC_DEFUN([CF_GCC_VERSION],[
2094 AC_REQUIRE([AC_PROG_CC])
2095 GCC_VERSION=none
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)
2101 fi
2102 ])dnl
2103 dnl ---------------------------------------------------------------------------
2104 dnl CF_GCC_WARNINGS version: 29 updated: 2012/06/16 14:55:39
2105 dnl ---------------
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:
2108 dnl
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".
2114 dnl     -pedantic
2115 dnl
2116 dnl Parameter:
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
2119 dnl             -Wno-unused
2120 dnl Special:
2121 dnl     If $with_ext_const is "yes", add a check for -Wwrite-strings
2122 dnl
2123 AC_DEFUN([CF_GCC_WARNINGS],
2124 [
2125 AC_REQUIRE([CF_GCC_VERSION])
2126 CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)
2127 CF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS)
2128
2129 cat > conftest.$ac_ext <<EOF
2130 #line __oline__ "${as_me:-configure}"
2131 int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
2132 EOF
2133
2134 if test "$INTEL_COMPILER" = yes
2135 then
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
2146
2147         AC_CHECKING([for $CC warning options])
2148         cf_save_CFLAGS="$CFLAGS"
2149         EXTRA_CFLAGS="-Wall"
2150         for cf_opt in \
2151                 wd1419 \
2152                 wd1683 \
2153                 wd1684 \
2154                 wd193 \
2155                 wd593 \
2156                 wd279 \
2157                 wd810 \
2158                 wd869 \
2159                 wd981
2160         do
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"
2165                 fi
2166         done
2167         CFLAGS="$cf_save_CFLAGS"
2168
2169 elif test "$GCC" = yes
2170 then
2171         AC_CHECKING([for $CC warning options])
2172         cf_save_CFLAGS="$CFLAGS"
2173         EXTRA_CFLAGS=
2174         cf_warn_CONST=""
2175         test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
2176         for cf_opt in W Wall \
2177                 Wbad-function-cast \
2178                 Wcast-align \
2179                 Wcast-qual \
2180                 Winline \
2181                 Wmissing-declarations \
2182                 Wmissing-prototypes \
2183                 Wnested-externs \
2184                 Wpointer-arith \
2185                 Wshadow \
2186                 Wstrict-prototypes \
2187                 Wundef $cf_warn_CONST $1
2188         do
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
2193                         Wcast-qual) #(vi
2194                                 CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES"
2195                                 ;;
2196                         Winline) #(vi
2197                                 case $GCC_VERSION in
2198                                 [[34]].*)
2199                                         CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
2200                                         continue;;
2201                                 esac
2202                                 ;;
2203                         Wpointer-arith) #(vi
2204                                 case $GCC_VERSION in
2205                                 [[12]].*)
2206                                         CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
2207                                         continue;;
2208                                 esac
2209                                 ;;
2210                         esac
2211                         EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
2212                 fi
2213         done
2214         CFLAGS="$cf_save_CFLAGS"
2215 fi
2216 rm -rf conftest*
2217
2218 AC_SUBST(EXTRA_CFLAGS)
2219 ])dnl
2220 dnl ---------------------------------------------------------------------------
2221 dnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07
2222 dnl -------------
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.
2227 dnl
2228 dnl Well, yes we could work around it...
2229 AC_DEFUN([CF_GNU_SOURCE],
2230 [
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
2234 make an error
2235 #endif],
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
2241 make an error
2242 #endif],
2243         [cf_cv_gnu_source=no],
2244         [cf_cv_gnu_source=yes])
2245         CPPFLAGS="$cf_save"
2246         ])
2247 ])
2248 test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
2249 ])dnl
2250 dnl ---------------------------------------------------------------------------
2251 dnl CF_HEADERS_SH version: 1 updated: 2007/07/04 15:37:05
2252 dnl -------------
2253 dnl Setup variables needed to construct headers-sh
2254 AC_DEFUN([CF_HEADERS_SH],[
2255 PACKAGE_PREFIX=$1
2256 PACKAGE_CONFIG=$2
2257 AC_SUBST(PACKAGE_PREFIX)
2258 AC_SUBST(PACKAGE_CONFIG)
2259 EXTRA_OUTPUT="$EXTRA_OUTPUT headers-sh:$srcdir/headers-sh.in"
2260 ])
2261 dnl ---------------------------------------------------------------------------
2262 dnl CF_HEADER_PATH version: 12 updated: 2010/05/05 05:22:40
2263 dnl --------------
2264 dnl Construct a search-list of directories for a nonstandard header-file
2265 dnl
2266 dnl Parameters
2267 dnl     $1 = the variable to return as result
2268 dnl     $2 = the package name
2269 AC_DEFUN([CF_HEADER_PATH],
2270 [
2271 $1=
2272
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
2277         do
2278                 case $cf_header_path in #(vi
2279                 -I*)
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"
2283                         ;;
2284                 esac
2285         done
2286 fi
2287
2288 # add the variations for the package we are looking for
2289 CF_SUBDIR_PATH($1,$2,include)
2290
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"
2296 }
2297
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"
2303 }
2304
2305 $1="[$]$1 $cf_header_path_list"
2306 ])dnl
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.
2313 dnl
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.
2317 dnl
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
2324
2325 if test "$ifelse([$1],,[$1],GCC)" = yes ; then
2326         case $host_os in
2327         linux*|gnu*)
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"
2331                 AC_TRY_COMPILE([],[
2332 #ifdef __INTEL_COMPILER
2333 #else
2334 make an error
2335 #endif
2336 ],[ifelse([$2],,INTEL_COMPILER,[$2])=yes
2337 cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc"
2338 ],[])
2339                 ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
2340                 AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2]))
2341                 ;;
2342         esac
2343 fi
2344 ])dnl
2345 dnl ---------------------------------------------------------------------------
2346 dnl CF_LARGEFILE version: 8 updated: 2012/10/06 08:57:51
2347 dnl ------------
2348 dnl Add checks for large file support.
2349 AC_DEFUN([CF_LARGEFILE],[
2350 ifdef([AC_FUNC_FSEEKO],[
2351     AC_SYS_LARGEFILE
2352     if test "$enable_largefile" != no ; then
2353         AC_FUNC_FSEEKO
2354
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
2361         # the config.h
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 "
2365
2366         AC_CACHE_CHECK(whether to use struct dirent64, cf_cv_struct_dirent64,[
2367                 AC_TRY_COMPILE([
2368 #include <sys/types.h>
2369 #include <dirent.h>
2370                 ],[
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);
2375                 int z = x - y;
2376                 ],
2377                 [cf_cv_struct_dirent64=yes],
2378                 [cf_cv_struct_dirent64=no])
2379         ])
2380         test "$cf_cv_struct_dirent64" = yes && AC_DEFINE(HAVE_STRUCT_DIRENT64,1,[Define to 1 if we have struct dirent64])
2381     fi
2382 ])
2383 ])
2384 dnl ---------------------------------------------------------------------------
2385 dnl CF_LD_RPATH_OPT version: 5 updated: 2011/07/17 14:48:41
2386 dnl ---------------
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],
2390 [
2391 AC_REQUIRE([CF_CHECK_CACHE])
2392
2393 LD_RPATH_OPT=
2394 AC_MSG_CHECKING(for an rpath option)
2395 case $cf_cv_system_name in #(vi
2396 irix*) #(vi
2397         if test "$GCC" = yes; then
2398                 LD_RPATH_OPT="-Wl,-rpath,"
2399         else
2400                 LD_RPATH_OPT="-rpath "
2401         fi
2402         ;;
2403 linux*|gnu*|k*bsd*-gnu) #(vi
2404         LD_RPATH_OPT="-Wl,-rpath,"
2405         ;;
2406 openbsd[[2-9]].*|mirbsd*) #(vi
2407         LD_RPATH_OPT="-Wl,-rpath,"
2408         ;;
2409 dragonfly*|freebsd*) #(vi
2410         LD_RPATH_OPT="-rpath "
2411         ;;
2412 netbsd*) #(vi
2413         LD_RPATH_OPT="-Wl,-rpath,"
2414         ;;
2415 osf*|mls+*) #(vi
2416         LD_RPATH_OPT="-rpath "
2417         ;;
2418 solaris2*) #(vi
2419         LD_RPATH_OPT="-R"
2420         ;;
2421 *)
2422         ;;
2423 esac
2424 AC_MSG_RESULT($LD_RPATH_OPT)
2425
2426 case "x$LD_RPATH_OPT" in #(vi
2427 x-R*)
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 "
2435         ;;
2436 esac
2437 ])dnl
2438 dnl ---------------------------------------------------------------------------
2439 dnl CF_LIBRARY_PATH version: 9 updated: 2010/03/28 12:52:50
2440 dnl ---------------
2441 dnl Construct a search-list of directories for a nonstandard library-file
2442 dnl
2443 dnl Parameters
2444 dnl     $1 = the variable to return as result
2445 dnl     $2 = the package name
2446 AC_DEFUN([CF_LIBRARY_PATH],
2447 [
2448 $1=
2449 cf_library_path_list=""
2450 if test -n "${LDFLAGS}${LIBS}" ; then
2451         for cf_library_path in $LDFLAGS $LIBS
2452         do
2453                 case $cf_library_path in #(vi
2454                 -L*)
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"
2458                         ;;
2459                 esac
2460         done
2461 fi
2462
2463 CF_SUBDIR_PATH($1,$2,lib)
2464
2465 $1="$cf_library_path_list [$]$1"
2466 ])dnl
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
2472 then
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.]].*//'`
2474 else
2475         cf_cv_libtool_version=
2476 fi
2477 test -z "$cf_cv_libtool_version" && unset cf_cv_libtool_version
2478 ])dnl
2479 dnl ---------------------------------------------------------------------------
2480 dnl CF_LIB_PREFIX version: 9 updated: 2012/01/21 19:28:10
2481 dnl -------------
2482 dnl Compute the library-prefix for the given host system
2483 dnl $1 = variable to set
2484 define([CF_LIB_PREFIX],
2485 [
2486         case $cf_cv_system_name in #(vi
2487         OS/2*|os2*) #(vi
2488         LIB_PREFIX=''
2489         ;;
2490         *)      LIB_PREFIX='lib'
2491         ;;
2492         esac
2493 ifelse($1,,,[$1=$LIB_PREFIX])
2494         AC_SUBST(LIB_PREFIX)
2495 ])dnl
2496 dnl ---------------------------------------------------------------------------
2497 dnl CF_LIB_SUFFIX version: 22 updated: 2013/09/07 13:54:05
2498 dnl -------------
2499 dnl Compute the library file-suffix from the given model name
2500 dnl $1 = 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],
2505 [
2506         case X$1 in #(vi
2507         Xlibtool) #(vi
2508                 $2='.la'
2509                 $3=[$]$2
2510                 ;;
2511         Xdebug) #(vi
2512                 $2='_g.a'
2513                 $3=[$]$2
2514                 ;;
2515         Xprofile) #(vi
2516                 $2='_p.a'
2517                 $3=[$]$2
2518                 ;;
2519         Xshared) #(vi
2520                 case $cf_cv_system_name in
2521                 aix[[5-7]]*) #(vi
2522                         $2='.a'
2523                         $3=[$]$2
2524                         ;;
2525                 cygwin*|msys*|mingw*) #(vi
2526                         $2='.dll'
2527                         $3='.dll.a'
2528                         ;;
2529                 darwin*) #(vi
2530                         $2='.dylib'
2531                         $3=[$]$2
2532                         ;;
2533                 hpux*) #(vi
2534                         case $target in
2535                         ia64*) #(vi
2536                                 $2='.so'
2537                                 $3=[$]$2
2538                                 ;;
2539                         *) #(vi
2540                                 $2='.sl'
2541                                 $3=[$]$2
2542                                 ;;
2543                         esac
2544                         ;;
2545                 *) #(vi
2546                         $2='.so'
2547                         $3=[$]$2
2548                         ;;
2549                 esac
2550                 ;;
2551         *)
2552                 $2='.a'
2553                 $3=[$]$2
2554                 ;;
2555         esac
2556         test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}"
2557         test -n "$LIB_SUFFIX" && $3="${LIB_SUFFIX}[$]{$3}"
2558 ])dnl
2559 dnl ---------------------------------------------------------------------------
2560 dnl CF_MAKEFLAGS version: 14 updated: 2011/03/31 19:29:46
2561 dnl ------------
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],
2567 [
2568 AC_CACHE_CHECK(for makeflags variable, cf_cv_makeflags,[
2569         cf_cv_makeflags=''
2570         for cf_option in '-${MAKEFLAGS}' '${MFLAGS}'
2571         do
2572                 cat >cf_makeflags.tmp <<CF_EOF
2573 SHELL = /bin/sh
2574 all :
2575         @ echo '.$cf_option'
2576 CF_EOF
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
2579                 .*k)
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=
2583                                 ;;
2584                         *)      cf_cv_makeflags=$cf_option
2585                                 ;;
2586                         esac
2587                         break
2588                         ;;
2589                 .-)     ;;
2590                 *)      echo "given option \"$cf_option\", no match \"$cf_result\""
2591                         ;;
2592                 esac
2593         done
2594         rm -f cf_makeflags.tmp
2595 ])
2596
2597 AC_SUBST(cf_cv_makeflags)
2598 ])dnl
2599 dnl ---------------------------------------------------------------------------
2600 dnl CF_MAKE_TAGS version: 6 updated: 2010/10/23 15:52:32
2601 dnl ------------
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])
2606
2607 AC_CHECK_PROGS(CTAGS, exctags ctags)
2608 AC_CHECK_PROGS(ETAGS, exetags etags)
2609
2610 AC_CHECK_PROG(MAKE_LOWER_TAGS, ${CTAGS:-ctags}, yes, no)
2611
2612 if test "$cf_cv_mixedcase" = yes ; then
2613         AC_CHECK_PROG(MAKE_UPPER_TAGS, ${ETAGS:-etags}, yes, no)
2614 else
2615         MAKE_UPPER_TAGS=no
2616 fi
2617
2618 if test "$MAKE_UPPER_TAGS" = yes ; then
2619         MAKE_UPPER_TAGS=
2620 else
2621         MAKE_UPPER_TAGS="#"
2622 fi
2623
2624 if test "$MAKE_LOWER_TAGS" = yes ; then
2625         MAKE_LOWER_TAGS=
2626 else
2627         MAKE_LOWER_TAGS="#"
2628 fi
2629
2630 AC_SUBST(CTAGS)
2631 AC_SUBST(ETAGS)
2632
2633 AC_SUBST(MAKE_UPPER_TAGS)
2634 AC_SUBST(MAKE_LOWER_TAGS)
2635 ])dnl
2636 dnl ---------------------------------------------------------------------------
2637 dnl CF_MATH_LIB version: 8 updated: 2010/05/29 16:31:02
2638 dnl -----------
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],
2643 [
2644 AC_CACHE_CHECK(if -lm needed for math functions,
2645         cf_cv_need_libm,[
2646         AC_TRY_LINK([
2647         #include <stdio.h>
2648         #include <math.h>
2649         ],
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
2654 then
2655 ifelse($1,,[
2656         CF_ADD_LIB(m)
2657 ],[$1=-lm])
2658 fi
2659 ])
2660 dnl ---------------------------------------------------------------------------
2661 dnl CF_MBSTATE_T version: 4 updated: 2012/10/06 08:57:51
2662 dnl ------------
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],
2667 [
2668 AC_CACHE_CHECK(if we must include wchar.h to declare mbstate_t,cf_cv_mbstate_t,[
2669 AC_TRY_COMPILE([
2670 #include <stdlib.h>
2671 #include <stdio.h>
2672 #ifdef HAVE_LIBUTF8_H
2673 #include <libutf8.h>
2674 #endif],
2675         [mbstate_t state],
2676         [cf_cv_mbstate_t=no],
2677         [AC_TRY_COMPILE([
2678 #include <stdlib.h>
2679 #include <stdio.h>
2680 #include <wchar.h>
2681 #ifdef HAVE_LIBUTF8_H
2682 #include <libutf8.h>
2683 #endif],
2684         [mbstate_t value],
2685         [cf_cv_mbstate_t=yes],
2686         [cf_cv_mbstate_t=unknown])])])
2687
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])
2690 fi
2691
2692 if test "$cf_cv_mbstate_t" != unknown ; then
2693         AC_DEFINE(HAVE_MBSTATE_T,1,[Define to 1 if mbstate_t is declared])
2694 fi
2695 ])dnl
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],
2702 [
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
2707                 cf_cv_mixedcase=no
2708                 ;;
2709         *)
2710                 cf_cv_mixedcase=yes
2711                 ;;
2712         esac
2713 else
2714         rm -f conftest CONFTEST
2715         echo test >conftest
2716         if test -f CONFTEST ; then
2717                 cf_cv_mixedcase=no
2718         else
2719                 cf_cv_mixedcase=yes
2720         fi
2721         rm -f conftest CONFTEST
2722 fi
2723 ])
2724 test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if filesystem supports mixed-case filenames.])
2725 ])dnl
2726 dnl ---------------------------------------------------------------------------
2727 dnl CF_MSG_LOG version: 5 updated: 2010/10/23 15:52:32
2728 dnl ----------
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
2733 ])dnl
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],[
2742         AC_TRY_COMPILE([
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 */
2747 ])[
2748 #include <$2>],[
2749 #ifdef NCURSES_VERSION
2750 ]ifelse($3,ncursesw,[
2751 #ifndef WACS_BSSB
2752         make an error
2753 #endif
2754 ])[
2755 printf("%s\n", NCURSES_VERSION);
2756 #else
2757 #ifdef __NCURSES_H
2758 printf("old\n");
2759 #else
2760         make an error
2761 #endif
2762 #endif
2763         ]
2764         ,[$1=$2]
2765         ,[$1=no])
2766 ])dnl
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.
2773 dnl
2774 dnl $1 is the root library name (default: "ncurses")
2775 AC_DEFUN([CF_NCURSES_CONFIG],
2776 [
2777 cf_ncuconfig_root=ifelse($1,,ncurses,$1)
2778
2779 echo "Looking for ${cf_ncuconfig_root}-config"
2780
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)])
2784
2785 if test "$NCURSES_CONFIG" != none ; then
2786
2787 CPPFLAGS="$CPPFLAGS `$NCURSES_CONFIG --cflags`"
2788 CF_ADD_LIBS(`$NCURSES_CONFIG --libs`)
2789
2790 # even with config script, some packages use no-override for curses.h
2791 CF_CURSES_HEADER(ifelse($1,,ncurses,$1))
2792
2793 dnl like CF_NCURSES_CPPFLAGS
2794 AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries])
2795
2796 dnl like CF_NCURSES_LIBS
2797 CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_ncuconfig_root)
2798 AC_DEFINE_UNQUOTED($cf_nculib_ROOT)
2799
2800 dnl like CF_NCURSES_VERSION
2801 cf_cv_ncurses_version=`$NCURSES_CONFIG --version`
2802
2803 else
2804
2805 CF_NCURSES_CPPFLAGS(ifelse($1,,ncurses,$1))
2806 CF_NCURSES_LIBS(ifelse($1,,ncurses,$1))
2807
2808 fi
2809 ])dnl
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.
2815 dnl
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
2823 dnl the header.
2824 dnl
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>.
2828 dnl
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])
2834
2835 AC_PROVIDE([CF_CURSES_CPPFLAGS])dnl
2836 cf_ncuhdr_root=ifelse($1,,ncurses,$1)
2837
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)
2841 }
2842
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
2847         do
2848                 CF_NCURSES_CC_CHECK(cf_cv_ncurses_h,$cf_header,$1)
2849                 test "$cf_cv_ncurses_h" != no && break
2850         done
2851 ])
2852
2853 CF_NCURSES_HEADER
2854 CF_TERM_HEADER
2855
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])
2858
2859 CF_NCURSES_VERSION
2860 ])dnl
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.
2866 dnl
2867 dnl See also CF_CURSES_HEADER, which sets the same cache variable.
2868 AC_DEFUN([CF_NCURSES_HEADER],[
2869
2870 if test "$cf_cv_ncurses_h" != no ; then
2871         cf_cv_ncurses_header=$cf_cv_ncurses_h
2872 else
2873
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
2880         do
2881                 CF_ADD_INCDIR($cf_incdir)
2882                 for cf_header in \
2883                         ncurses.h \
2884                         curses.h
2885                 do
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
2890                                 break
2891                         fi
2892                         test -n "$verbose" && echo "    ... tested $cf_incdir/$cf_header" 1>&AC_FD_MSG
2893                 done
2894                 CPPFLAGS="$cf_save2_CPPFLAGS"
2895                 test "$cf_cv_ncurses_h2" != no && break
2896         done
2897         test "$cf_cv_ncurses_h2" = no && AC_MSG_ERROR(not found)
2898         ])
2899
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
2904         fi
2905         CF_ADD_INCDIR($cf_1st_incdir)
2906
2907 fi
2908
2909 # Set definitions to allow ifdef'ing for ncurses.h
2910
2911 case $cf_cv_ncurses_header in # (vi
2912 *ncurses.h)
2913         AC_DEFINE(HAVE_NCURSES_H,1,[Define to 1 if we have ncurses.h])
2914         ;;
2915 esac
2916
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])
2920         ;;
2921 ncursesw/curses.h|ncursesw/ncurses.h)
2922         AC_DEFINE(HAVE_NCURSESW_NCURSES_H,1,[Define to 1 if we have ncursesw/ncurses.h])
2923         ;;
2924 esac
2925
2926 ])dnl
2927 dnl ---------------------------------------------------------------------------
2928 dnl CF_NCURSES_LIBS version: 16 updated: 2010/11/20 17:02:38
2929 dnl ---------------
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.
2936 dnl
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])
2942
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
2946         # to link gpm.
2947 cf_ncurses_LIBS=""
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"])])
2953
2954 case $host_os in #(vi
2955 freebsd*)
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"])
2960         fi
2961         ;;
2962 esac
2963
2964 CF_ADD_LIBS($cf_ncurses_LIBS)
2965
2966 if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
2967 then
2968         CF_ADD_LIBS(-l$cf_nculib_root)
2969 else
2970         CF_FIND_LIBRARY($cf_nculib_root,$cf_nculib_root,
2971                 [#include <${cf_cv_ncurses_header:-curses.h}>],
2972                 [initscr()],
2973                 initscr)
2974 fi
2975
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
2982                         LIBS="$q"
2983                 fi
2984         done
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)],
2988                 [AC_MSG_RESULT(no)
2989                  LIBS="$cf_ncurses_SAVE"])
2990 fi
2991
2992 CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_nculib_root)
2993 AC_DEFINE_UNQUOTED($cf_nculib_ROOT)
2994 ])dnl
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],
3002 [
3003 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
3004 AC_CACHE_CHECK(for ncurses version, cf_cv_ncurses_version,[
3005         cf_cv_ncurses_version=no
3006         cf_tempfile=out$$
3007         rm -f $cf_tempfile
3008         AC_TRY_RUN([
3009 #include <${cf_cv_ncurses_header:-curses.h}>
3010 #include <stdio.h>
3011 int main()
3012 {
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);
3017 # else
3018         fprintf(fp, "%s\n", NCURSES_VERSION);
3019 # endif
3020 #else
3021 # ifdef __NCURSES_H
3022         fprintf(fp, "old\n");
3023 # else
3024         make an error
3025 # endif
3026 #endif
3027         ${cf_cv_main_return:-return}(0);
3028 }],[
3029         cf_cv_ncurses_version=`cat $cf_tempfile`],,[
3030
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}>
3035 #undef Autoconf
3036 #ifdef NCURSES_VERSION
3037 Autoconf NCURSES_VERSION
3038 #else
3039 #ifdef __NCURSES_H
3040 Autoconf "old"
3041 #endif
3042 ;
3043 #endif
3044 EOF
3045         cf_try="$ac_cpp conftest.$ac_ext 2>&AC_FD_CC | grep '^Autoconf ' >conftest.out"
3046         AC_TRY_EVAL(cf_try)
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"
3050                 rm -f conftest.out
3051         fi
3052 ])
3053         rm -f $cf_tempfile
3054 ])
3055 test "$cf_cv_ncurses_version" = no || AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries])
3056 ])dnl
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)
3063 AC_ARG_WITH($1,
3064         [$2],
3065         [AC_DEFINE_UNQUOTED($3,1,"Define to 1 if you want to use $1 for testing.")ifelse([$4],,[
3066          $4
3067 ])
3068         : ${with_cflags:=-g}
3069         : ${with_no_leaks:=yes}
3070          with_$1=yes],
3071         [with_$1=])
3072 AC_MSG_RESULT(${with_$1:-no})
3073
3074 case .$with_cflags in #(vi
3075 .*-g*)
3076         case .$CFLAGS in #(vi
3077         .*-g*) #(vi
3078                 ;;
3079         *)
3080                 CF_ADD_CFLAGS([-g])
3081                 ;;
3082         esac
3083         ;;
3084 esac
3085 ])dnl
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
3094   case $1 in #(vi
3095   [[0-9]]*) #(vi
3096         ;;
3097   *)
3098         AC_MSG_ERROR($2 is not a number: $1)
3099         ;;
3100   esac
3101 else
3102   AC_MSG_ERROR($2 value is empty)
3103 fi
3104 ])dnl
3105 dnl ---------------------------------------------------------------------------
3106 dnl CF_OUR_MESSAGES version: 7 updated: 2004/09/12 19:45:55
3107 dnl ---------------
3108 dnl Check if we use the messages included with this program
3109 dnl
3110 dnl $1 specifies either Makefile or makefile, defaulting to the former.
3111 dnl
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)
3115 dnl
3116 AC_DEFUN([CF_OUR_MESSAGES],
3117 [
3118 cf_makefile=ifelse($1,,Makefile,$1)
3119
3120 use_our_messages=no
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])
3128 fi
3129 AC_MSG_RESULT($use_our_messages)
3130 fi
3131
3132 MSG_DIR_MAKE="#"
3133 if test "$use_our_messages" = yes
3134 then
3135         SUB_MAKEFILE="$SUB_MAKEFILE po/$cf_makefile.in:$srcdir/po/$cf_makefile.inn"
3136         MSG_DIR_MAKE=
3137 fi
3138
3139 AC_SUBST(MSG_DIR_MAKE)
3140 AC_SUBST(SUB_MAKEFILE)
3141 ])dnl
3142 dnl ---------------------------------------------------------------------------
3143 dnl CF_PATHSEP version: 6 updated: 2012/09/29 18:38:12
3144 dnl ----------
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],
3148 [
3149         AC_MSG_CHECKING(for PATH separator)
3150         case $cf_cv_system_name in
3151         os2*)   PATH_SEPARATOR=';'  ;;
3152         *)      ${PATH_SEPARATOR:=':'}  ;;
3153         esac
3154 ifelse([$1],,,[$1=$PATH_SEPARATOR])
3155         AC_SUBST(PATH_SEPARATOR)
3156         AC_MSG_RESULT($PATH_SEPARATOR)
3157 ])dnl
3158 dnl ---------------------------------------------------------------------------
3159 dnl CF_PATH_SYNTAX version: 14 updated: 2012/06/19 20:58:54
3160 dnl --------------
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"
3168 else
3169   cf_path_syntax="$ac_default_prefix"
3170 fi
3171
3172 case ".[$]$1" in #(vi
3173 .\[$]\(*\)*|.\'*\'*) #(vi
3174   ;;
3175 ..|./*|.\\*) #(vi
3176   ;;
3177 .[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX
3178   ;;
3179 .\[$]{*prefix}*|.\[$]{*dir}*) #(vi
3180   eval $1="[$]$1"
3181   case ".[$]$1" in #(vi
3182   .NONE/*)
3183     $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
3184     ;;
3185   esac
3186   ;; #(vi
3187 .no|.NONE/*)
3188   $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
3189   ;;
3190 *)
3191   ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2)
3192   ;;
3193 esac
3194 ])dnl
3195 dnl ---------------------------------------------------------------------------
3196 dnl CF_PKG_CONFIG version: 7 updated: 2011/04/29 04:53:22
3197 dnl -------------
3198 dnl Check for the package-config program, unless disabled by command-line.
3199 AC_DEFUN([CF_PKG_CONFIG],
3200 [
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)
3207
3208 case $cf_pkg_config in #(vi
3209 no) #(vi
3210         PKG_CONFIG=none
3211         ;;
3212 yes) #(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)])
3216         ;;
3217 *)
3218         PKG_CONFIG=$withval
3219         ;;
3220 esac
3221
3222 test -z "$PKG_CONFIG" && PKG_CONFIG=none
3223 if test "$PKG_CONFIG" != none ; then
3224         CF_PATH_SYNTAX(PKG_CONFIG)
3225 fi
3226
3227 AC_SUBST(PKG_CONFIG)
3228 ])dnl
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.
3233 dnl
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
3237 dnl             Bindings Option
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
3241 dnl
3242 dnl Parameters:
3243 dnl     $1 is the nominal value for _POSIX_C_SOURCE
3244 AC_DEFUN([CF_POSIX_C_SOURCE],
3245 [
3246 cf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1])
3247
3248 cf_save_CFLAGS="$CFLAGS"
3249 cf_save_CPPFLAGS="$CPPFLAGS"
3250
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)
3253
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
3258 make an error
3259 #endif],
3260         [cf_cv_posix_c_source=no],
3261         [cf_want_posix_source=no
3262          case .$cf_POSIX_C_SOURCE in #(vi
3263          .[[12]]??*) #(vi
3264                 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
3265                 ;;
3266          .2) #(vi
3267                 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
3268                 cf_want_posix_source=yes
3269                 ;;
3270          .*)
3271                 cf_want_posix_source=yes
3272                 ;;
3273          esac
3274          if test "$cf_want_posix_source" = yes ; then
3275                 AC_TRY_COMPILE([#include <sys/types.h>],[
3276 #ifdef _POSIX_SOURCE
3277 make an error
3278 #endif],[],
3279                 cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE")
3280          fi
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
3287 make an error
3288 #endif],,
3289          [cf_cv_posix_c_source=no])
3290          CFLAGS="$cf_save_CFLAGS"
3291          CPPFLAGS="$cf_save_CPPFLAGS"
3292         ])
3293 ])
3294
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)
3299 fi
3300
3301 ])dnl
3302 dnl ---------------------------------------------------------------------------
3303 dnl CF_PROG_CC version: 3 updated: 2012/10/06 15:31:55
3304 dnl ----------
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)])
3309 CF_GCC_VERSION
3310 CF_ACVERSION_CHECK(2.52,
3311         [AC_PROG_CC_STDC],
3312         [CF_ANSI_CC_REQD])
3313 CF_CC_ENV_FLAGS 
3314 ])dnl
3315 dnl ---------------------------------------------------------------------------
3316 dnl CF_PROG_EXT version: 11 updated: 2012/10/06 08:57:51
3317 dnl -----------
3318 dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX.
3319 AC_DEFUN([CF_PROG_EXT],
3320 [
3321 AC_REQUIRE([CF_CHECK_CACHE])
3322 case $cf_cv_system_name in
3323 os2*)
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"
3329     ac_cv_exeext=.exe
3330     ;;
3331 esac
3332
3333 AC_EXEEXT
3334 AC_OBJEXT
3335
3336 PROG_EXT="$EXEEXT"
3337 AC_SUBST(PROG_EXT)
3338 test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT",[Define to the program extension (normally blank)])
3339 ])dnl
3340 dnl ---------------------------------------------------------------------------
3341 dnl CF_PROG_LINT version: 2 updated: 2009/08/12 04:43:14
3342 dnl ------------
3343 AC_DEFUN([CF_PROG_LINT],
3344 [
3345 AC_CHECK_PROGS(LINT, tdlint lint alint splint lclint)
3346 AC_SUBST(LINT_OPTS)
3347 ])dnl
3348 dnl ---------------------------------------------------------------------------
3349 dnl CF_PROG_LN_S version: 2 updated: 2010/08/14 18:25:37
3350 dnl ------------
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],[
3354 AC_PROG_LN_S
3355 AC_MSG_CHECKING(if $LN_S -f options work)
3356
3357 rm -f conf$$.src conf$$dst
3358 echo >conf$$.dst
3359 echo first >conf$$.src
3360 if $LN_S -f conf$$.src conf$$.dst 2>/dev/null; then
3361         cf_prog_ln_sf=yes
3362 else
3363         cf_prog_ln_sf=no
3364 fi
3365 rm -f conf$$.dst conf$$src
3366 AC_MSG_RESULT($cf_prog_ln_sf)
3367
3368 test "$cf_prog_ln_sf" = yes && LN_S="$LN_S -f"
3369 ])dnl
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.
3377 dnl
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],
3382 [
3383 $1=`echo "$2" | \
3384         sed     -e 's/-[[UD]]'"$3"'\(=[[^       ]]*\)\?[[       ]]/ /g' \
3385                 -e 's/-[[UD]]'"$3"'\(=[[^       ]]*\)\?[$]//g'`
3386 ])dnl
3387 dnl ---------------------------------------------------------------------------
3388 dnl CF_RPATH_HACK version: 11 updated: 2013/09/01 13:02:00
3389 dnl -------------
3390 AC_DEFUN([CF_RPATH_HACK],
3391 [
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)
3396
3397         AC_CHECK_PROGS(cf_ldd_prog,ldd,no)
3398         cf_rpath_list="/usr/lib /lib"
3399         if test "$cf_ldd_prog" != no
3400         then
3401                 cf_rpath_oops=
3402
3403 AC_TRY_LINK([#include <stdio.h>],
3404                 [printf("Hello");],
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`])
3407
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"
3414                 then
3415                         for cf_rpath_src in $cf_rpath_oops
3416                         do
3417                                 for cf_rpath_dir in \
3418                                         /usr/local \
3419                                         /usr/pkg \
3420                                         /opt/sfw
3421                                 do
3422                                         if test -f $cf_rpath_dir/lib/$cf_rpath_src
3423                                         then
3424                                                 CF_VERBOSE(...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src)
3425                                                 LDFLAGS="$LDFLAGS -L$cf_rpath_dir/lib"
3426                                                 break
3427                                         fi
3428                                 done
3429                         done
3430                 fi
3431         fi
3432
3433         CF_VERBOSE(...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS)
3434
3435         CF_RPATH_HACK_2(LDFLAGS)
3436         CF_RPATH_HACK_2(LIBS)
3437
3438         CF_VERBOSE(...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS)
3439 else
3440         AC_MSG_RESULT(no)
3441 fi
3442 AC_SUBST(EXTRA_LDFLAGS)
3443 ])dnl
3444 dnl ---------------------------------------------------------------------------
3445 dnl CF_RPATH_HACK_2 version: 6 updated: 2010/04/17 16:31:24
3446 dnl ---------------
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.
3449 dnl
3450 dnl $cf_rpath_list contains a list of directories to ignore.
3451 dnl
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],
3455 [
3456 CF_VERBOSE(...checking $1 [$]$1)
3457
3458 cf_rpath_dst=
3459 for cf_rpath_src in [$]$1
3460 do
3461         case $cf_rpath_src in #(vi
3462         -L*) #(vi
3463
3464                 # check if this refers to a directory which we will ignore
3465                 cf_rpath_skip=no
3466                 if test -n "$cf_rpath_list"
3467                 then
3468                         for cf_rpath_item in $cf_rpath_list
3469                         do
3470                                 if test "x$cf_rpath_src" = "x-L$cf_rpath_item"
3471                                 then
3472                                         cf_rpath_skip=yes
3473                                         break
3474                                 fi
3475                         done
3476                 fi
3477
3478                 if test "$cf_rpath_skip" = no
3479                 then
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 %"`
3483                         else
3484                                 cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%$LD_RPATH_OPT%"`
3485                         fi
3486
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"
3490                         then
3491                                 CF_VERBOSE(...Filter $cf_rpath_src ->$cf_rpath_tmp)
3492                                 EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS"
3493                         fi
3494                 fi
3495                 ;;
3496         esac
3497         cf_rpath_dst="$cf_rpath_dst $cf_rpath_src"
3498 done
3499 $1=$cf_rpath_dst
3500
3501 CF_VERBOSE(...checked $1 [$]$1)
3502 AC_SUBST(EXTRA_LDFLAGS)
3503 ])dnl
3504 dnl ---------------------------------------------------------------------------
3505 dnl CF_SHARED_OPTS version: 83 updated: 2013/09/21 17:34:53
3506 dnl --------------
3507 dnl --------------
3508 dnl Attempt to determine the appropriate CC/LD options for creating a shared
3509 dnl library.
3510 dnl
3511 dnl Notes:
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
3518 dnl
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.
3521 dnl
3522 dnl The variable 'cf_cv_shlib_version' controls whether we use the rel or abi
3523 dnl version when making symbolic links.
3524 dnl
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>).
3528 dnl
3529 dnl Some loaders leave 'so_locations' lying around.  It's nice to clean up.
3530 AC_DEFUN([CF_SHARED_OPTS],
3531 [
3532         AC_REQUIRE([CF_LD_RPATH_OPT])
3533         RM_SHARED_OPTS=
3534         LOCAL_LDFLAGS=
3535         LOCAL_LDFLAGS2=
3536         LD_SHARED_OPTS=
3537         INSTALL_LIB="-m 644"
3538         : ${rel_builddir:=.}
3539
3540         cf_cv_do_symlinks=no
3541         cf_ld_rpath_opt=
3542         test "$cf_cv_enable_rpath" = yes && cf_ld_rpath_opt="$LD_RPATH_OPT"
3543
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
3549         yes) #(vi
3550                 cf_cv_shlib_version=auto
3551                 ;;
3552         rel|abi|auto|no) #(vi
3553                 cf_cv_shlib_version=$withval
3554                 ;;
3555         *)
3556                 AC_MSG_ERROR([option value must be one of: rel, abi, auto or no])
3557                 ;;
3558         esac
3559         ],[cf_cv_shlib_version=auto])
3560         AC_MSG_RESULT($cf_cv_shlib_version)
3561
3562         cf_cv_rm_so_locs=no
3563         cf_try_cflags=
3564
3565         # Some less-capable ports of gcc support only -fpic
3566         CC_SHARED_OPTS=
3567         if test "$GCC" = yes
3568         then
3569                 AC_MSG_CHECKING(which $CC option to use)
3570                 cf_save_CFLAGS="$CFLAGS"
3571                 for CC_SHARED_OPTS in -fPIC -fpic ''
3572                 do
3573                         CFLAGS="$cf_save_CFLAGS $CC_SHARED_OPTS"
3574                         AC_TRY_COMPILE([#include <stdio.h>],[int x = 1],[break],[])
3575                 done
3576                 AC_MSG_RESULT($CC_SHARED_OPTS)
3577                 CFLAGS="$cf_save_CFLAGS"
3578         fi
3579
3580         cf_cv_shlib_version_infix=no
3581
3582         case $cf_cv_system_name in #(vi
3583         aix4.[3-9]*|aix[[5-7]]*) #(vi
3584                 if test "$GCC" = yes; then
3585                         CC_SHARED_OPTS=
3586                         MK_SHARED_LIB='${CC} -shared -Wl,-brtl -Wl,-blibpath:${RPATH_LIST}:/usr/lib -o [$]@'
3587                 else
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 [$]@'
3591                 fi
3592                 ;;
3593         beos*) #(vi
3594                 MK_SHARED_LIB='${CC} ${CFLAGS} -o $[@] -Xlinker -soname=`basename $[@]` -nostart -e 0'
3595                 ;;
3596         cygwin*) #(vi
3597                 CC_SHARED_OPTS=
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
3603                 #!/bin/sh
3604                 SHARED_LIB=\[$]1
3605                 IMPORT_LIB=\`echo "\[$]1" | sed -e 's/cyg/lib/' -e 's/[[0-9]]*\.dll[$]/.dll.a/'\`
3606                 shift
3607                 cat <<-EOF
3608                 Linking shared library
3609                 ** SHARED_LIB \[$]SHARED_LIB
3610                 ** IMPORT_LIB \[$]IMPORT_LIB
3611 EOF
3612                 exec \[$]* -shared -Wl,--out-implib=\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o \[$]{SHARED_LIB}
3613 CF_EOF
3614                 chmod +x mk_shared_lib.sh
3615                 ;;
3616         msys*) #(vi
3617                 CC_SHARED_OPTS=
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
3623                 #!/bin/sh
3624                 SHARED_LIB=\[$]1
3625                 IMPORT_LIB=\`echo "\[$]1" | sed -e 's/msys-/lib/' -e 's/[[0-9]]*\.dll[$]/.dll.a/'\`
3626                 shift
3627                 cat <<-EOF
3628                 Linking shared library
3629                 ** SHARED_LIB \[$]SHARED_LIB
3630                 ** IMPORT_LIB \[$]IMPORT_LIB
3631 EOF
3632                 exec \[$]* -shared -Wl,--out-implib=\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o \[$]{SHARED_LIB}
3633 CF_EOF
3634                 chmod +x mk_shared_lib.sh
3635                 ;;
3636         darwin*) #(vi
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"
3649                 fi
3650                 ;;
3651         hpux[[7-8]]*) #(vi
3652                 # HP-UX 8.07 ld lacks "+b" option used for libdir search-list 
3653                 if test "$GCC" != yes; then
3654                         CC_SHARED_OPTS='+Z'
3655                 fi
3656                 MK_SHARED_LIB='${LD} -b -o $[@]'
3657                 INSTALL_LIB="-m 555"
3658                 ;;
3659         hpux*) #(vi
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}'
3663                 else
3664                         CC_SHARED_OPTS='+Z'
3665                         LD_SHARED_OPTS='-Wl,+b,${libdir}'
3666                 fi
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"
3671                 ;;
3672         interix*)
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}'
3676                 else
3677                         cf_shared_soname='`basename $@`'
3678                 fi
3679                 CC_SHARED_OPTS=
3680                 MK_SHARED_LIB='${CC} -shared -Wl,-rpath,${RPATH_LIST} -Wl,-h,'$cf_shared_soname' -o $@'
3681                 ;;
3682         irix*) #(vi
3683                 if test "$cf_cv_enable_rpath" = yes ; then
3684                         EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
3685                 fi
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 $[@]'
3690                 else
3691                         MK_SHARED_LIB='${CC} -shared -Wl,-soname,`basename $[@]` -o $[@]'
3692                 fi
3693                 cf_cv_rm_so_locs=yes
3694                 ;;
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"
3699                 fi
3700                 if test "$cf_cv_enable_rpath" = yes ; then
3701                         EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
3702                 fi
3703                 CF_SHARED_SONAME
3704                 MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]'
3705                 ;;
3706         mingw*) #(vi
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"
3713                 fi
3714                 CC_SHARED_OPTS=
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
3718                 #!/bin/sh
3719                 SHARED_LIB=\[$]1
3720                 IMPORT_LIB=\`echo "\[$]1" | sed -e 's/[[0-9]]*\.dll[$]/.dll.a/'\`
3721                 shift
3722                 cat <<-EOF
3723                 Linking shared library
3724                 ** SHARED_LIB \[$]SHARED_LIB
3725                 ** IMPORT_LIB \[$]IMPORT_LIB
3726 EOF
3727                 exec \[$]* -shared -Wl,--enable-auto-import,--out-implib=\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o \[$]{SHARED_LIB}
3728 CF_EOF
3729                 chmod +x mk_shared_lib.sh
3730                 ;;
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"
3735                 fi
3736                 if test "$cf_cv_enable_rpath" = yes ; then
3737                         EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
3738                 fi
3739                 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
3740                 CF_SHARED_SONAME
3741                 MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-Bshareable,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]'
3742                 ;;
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
3747                 ;;
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"
3754                 fi
3755                 CF_SHARED_SONAME
3756                 MK_SHARED_LIB='${LD} -shared -Bshareable -soname=`basename $[@]` -o $[@]'
3757                 ;;
3758         netbsd*) #(vi
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
3767                         else
3768                                 cf_cv_shlib_version=rel
3769                         fi
3770                         fi
3771                         CF_SHARED_SONAME
3772                         MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname' -o $[@]'
3773                 else
3774                         MK_SHARED_LIB='${CC} -Wl,-shared -Wl,-Bshareable -o $[@]'
3775                 fi
3776                 ;;
3777         osf*|mls+*) #(vi
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
3783                 osf4*)
3784                         MK_SHARED_LIB="${MK_SHARED_LIB} -msym"
3785                         ;;
3786                 esac
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"
3791                 fi
3792                 cf_cv_rm_so_locs=yes
3793                 ;;
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'
3798                 fi
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
3802                         RUN_PATH=$libdir
3803                 fi
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'
3807                 ;;
3808         sunos4*) #(vi
3809                 # tested with SunOS 4.1.1 and gcc 2.7.0
3810                 if test "$GCC" != yes; then
3811                         CC_SHARED_OPTS='-KPIC'
3812                 fi
3813                 MK_SHARED_LIB='${LD} -assert pure-text -o $[@]'
3814                 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
3815                 ;;
3816         solaris2*) #(vi
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"
3822                 fi
3823                 if test "$cf_cv_enable_rpath" = yes ; then
3824                         EXTRA_LDFLAGS="-R \${libdir} $EXTRA_LDFLAGS"
3825                 fi
3826                 CF_SHARED_SONAME
3827                 if test "$GCC" != yes; then
3828                         cf_save_CFLAGS="$CFLAGS"
3829                         for cf_shared_opts in -xcode=pic32 -xcode=pic13 -KPIC -Kpic -O
3830                         do
3831                                 CFLAGS="$cf_shared_opts $cf_save_CFLAGS"
3832                                 AC_TRY_COMPILE([#include <stdio.h>],[printf("Hello\n");],[break])
3833                         done
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 $[@]'
3837                 else
3838                         MK_SHARED_LIB='${CC} -shared -dy -G -h '$cf_cv_shared_soname' -o $[@]'
3839                 fi
3840                 ;;
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'
3845                 fi
3846                 MK_SHARED_LIB='${LD} -d y -G -o [$]@'
3847                 ;;
3848         *)
3849                 CC_SHARED_OPTS='unknown'
3850                 MK_SHARED_LIB='echo unknown'
3851                 ;;
3852         esac
3853
3854         # This works if the last tokens in $MK_SHARED_LIB are the -o target.
3855         case "$cf_cv_shlib_version" in #(vi
3856         rel|abi)
3857                 case "$MK_SHARED_LIB" in #(vi
3858                 *'-o $[@]') #(vi
3859                         test "$cf_cv_do_symlinks" = no && cf_cv_do_symlinks=yes
3860                         ;;
3861                 *)
3862                         AC_MSG_WARN(ignored --with-shlib-version)
3863                         ;;
3864                 esac
3865                 ;;
3866         esac
3867
3868         if test -n "$cf_try_cflags"
3869         then
3870 cat > conftest.$ac_ext <<EOF
3871 #line __oline__ "${as_me:-configure}"
3872 #include <stdio.h>
3873 int main(int argc, char *argv[[]])
3874 {
3875         printf("hello\n");
3876         return (argv[[argc-1]] == 0) ;
3877 }
3878 EOF
3879                 cf_save_CFLAGS="$CFLAGS"
3880                 for cf_opt in $cf_try_cflags
3881                 do
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
3885                                 AC_MSG_RESULT(yes)
3886                                 cf_save_CFLAGS="$CFLAGS"
3887                         else
3888                                 AC_MSG_RESULT(no)
3889                         fi
3890                 done
3891                 CFLAGS="$cf_save_CFLAGS"
3892         fi
3893
3894
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}"
3898
3899         test $cf_cv_rm_so_locs = yes && RM_SHARED_OPTS="$RM_SHARED_OPTS so_locations"
3900
3901         CF_VERBOSE(CC_SHARED_OPTS: $CC_SHARED_OPTS)
3902         CF_VERBOSE(MK_SHARED_LIB:  $MK_SHARED_LIB)
3903
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)
3909
3910         AC_SUBST(LINK_PROGS)
3911         AC_SUBST(LINK_TESTS)
3912
3913         AC_SUBST(EXTRA_LDFLAGS)
3914         AC_SUBST(LOCAL_LDFLAGS)
3915         AC_SUBST(LOCAL_LDFLAGS2)
3916
3917         AC_SUBST(INSTALL_LIB)
3918         AC_SUBST(RPATH_LIST)
3919 ])dnl
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)
3925 dnl option.
3926 dnl
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],
3930 [
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}'
3934         else
3935                 cf_cv_shared_soname='`basename $[@]`'
3936         fi
3937 ])
3938 dnl ---------------------------------------------------------------------------
3939 dnl CF_SUBDIR_PATH version: 6 updated: 2010/04/21 06:20:50
3940 dnl --------------
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],
3946 [
3947 $1=
3948
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)
3954 ])dnl
3955 dnl ---------------------------------------------------------------------------
3956 dnl CF_TERM_HEADER version: 3 updated: 2012/10/06 08:57:51
3957 dnl --------------
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%'`
3966         ;;
3967 *)
3968         cf_term_header=term.h
3969         ;;
3970 esac
3971
3972 for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h"
3973 do
3974 AC_TRY_COMPILE([#include <stdio.h>
3975 #include <${cf_cv_ncurses_header:-curses.h}>
3976 #include <$cf_test>
3977 ],[int x = auto_left_margin],[
3978         cf_cv_term_header="$cf_test"],[
3979         cf_cv_term_header=unknown
3980         ])
3981         test "$cf_cv_term_header" != unknown && break
3982 done
3983 ])
3984
3985 # Set definitions to allow ifdef'ing to accommodate subdirectories
3986
3987 case $cf_cv_term_header in # (vi
3988 *term.h)
3989         AC_DEFINE(HAVE_TERM_H,1,[Define to 1 if we have term.h])
3990         ;;
3991 esac
3992
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])
3996         ;;
3997 ncursesw/term.h)
3998         AC_DEFINE(HAVE_NCURSESW_TERM_H,1,[Define to 1 if we have ncursesw/term.h])
3999         ;;
4000 esac
4001 ])dnl
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,[
4009         AC_TRY_COMPILE([
4010 #include <stdlib.h>
4011 #include <string.h>
4012 #include <sys/types.h>
4013 ],[
4014 #ifndef _XOPEN_SOURCE
4015 make an error
4016 #endif],
4017         [cf_cv_xopen_source=no],
4018         [cf_save="$CPPFLAGS"
4019          CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
4020          AC_TRY_COMPILE([
4021 #include <stdlib.h>
4022 #include <string.h>
4023 #include <sys/types.h>
4024 ],[
4025 #ifdef _XOPEN_SOURCE
4026 make an error
4027 #endif],
4028         [cf_cv_xopen_source=no],
4029         [cf_cv_xopen_source=$cf_XOPEN_SOURCE])
4030         CPPFLAGS="$cf_save"
4031         ])
4032 ])
4033
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)
4039 fi
4040 ])
4041 dnl ---------------------------------------------------------------------------
4042 dnl CF_UNION_WAIT version: 6 updated: 2012/10/06 08:57:51
4043 dnl -------------
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.
4049 dnl
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.
4053 dnl
4054 dnl Sets: $cf_cv_type_unionwait
4055 dnl Defines: HAVE_TYPE_UNIONWAIT
4056 AC_DEFUN([CF_UNION_WAIT],
4057 [
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,
4062         [int x;
4063          int y = WEXITSTATUS(x);
4064          int z = WTERMSIG(x);
4065          wait(&x);
4066         ],
4067         [cf_cv_type_unionwait=no
4068          echo compiles ok w/o union wait 1>&AC_FD_CC
4069         ],[
4070         AC_TRY_LINK($cf_wait_headers,
4071         [union wait x;
4072 #ifdef WEXITSTATUS
4073          int y = WEXITSTATUS(x);
4074 #endif
4075 #ifdef WTERMSIG
4076          int z = WTERMSIG(x);
4077 #endif
4078          wait(&x);
4079         ],
4080         [cf_cv_type_unionwait=yes
4081          echo compiles ok with union wait and possibly macros too 1>&AC_FD_CC
4082         ],
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])
4086 ])dnl
4087 dnl ---------------------------------------------------------------------------
4088 dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59
4089 dnl --------
4090 dnl Make an uppercase version of a variable
4091 dnl $1=uppercase($2)
4092 AC_DEFUN([CF_UPPER],
4093 [
4094 $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
4095 ])dnl
4096 dnl ---------------------------------------------------------------------------
4097 dnl CF_UTF8_LIB version: 8 updated: 2012/10/06 08:57:51
4098 dnl -----------
4099 dnl Check for multibyte support, and if not found, utf8 compatibility library
4100 AC_DEFUN([CF_UTF8_LIB],
4101 [
4102 AC_CACHE_CHECK(for multibyte character support,cf_cv_utf8_lib,[
4103         cf_save_LIBS="$LIBS"
4104         AC_TRY_LINK([
4105 #include <stdlib.h>],[putwc(0,0);],
4106         [cf_cv_utf8_lib=yes],
4107         [CF_FIND_LINKAGE([
4108 #include <libutf8.h>],[putwc(0,0);],utf8,
4109                 [cf_cv_utf8_lib=add-on],
4110                 [cf_cv_utf8_lib=no])
4111 ])])
4112
4113 # HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between
4114 # ncurses/ncursesw:
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)
4120 fi
4121 ])dnl
4122 dnl ---------------------------------------------------------------------------
4123 dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12
4124 dnl ----------
4125 dnl Use AC_VERBOSE w/o the warnings
4126 AC_DEFUN([CF_VERBOSE],
4127 [test -n "$verbose" && echo "   $1" 1>&AC_FD_MSG
4128 CF_MSG_LOG([$1])
4129 ])dnl
4130 dnl ---------------------------------------------------------------------------
4131 dnl CF_VERSION_INFO version: 6 updated: 2013/06/16 10:25:53
4132 dnl ---------------
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
4136 dnl are others).
4137 dnl
4138 dnl The file contents are:
4139 dnl     libtool-version release-version patch-version
4140 dnl or
4141 dnl     release-version
4142 dnl where
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.
4150 dnl
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'.
4153 dnl
4154 dnl Optional parameters:
4155 dnl $1 = internal name for package
4156 dnl $2 = external name for package
4157 AC_DEFUN([CF_VERSION_INFO],
4158 [
4159 if test -f $srcdir/VERSION ; then
4160         AC_MSG_CHECKING(for package version)
4161
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`
4166
4167         # this is how CF_BUNDLED_INTL uses $VERSION:
4168         VERSION="$cf_field1"
4169
4170         VERSION_MAJOR=`echo "$cf_field2" | sed -e 's/\..*//'`
4171         test -z "$VERSION_MAJOR" && AC_MSG_ERROR(missing major-version)
4172
4173         VERSION_MINOR=`echo "$cf_field2" | sed -e 's/^[[^.]]*\.//' -e 's/-.*//'`
4174         test -z "$VERSION_MINOR" && AC_MSG_ERROR(missing minor-version)
4175
4176         AC_MSG_RESULT(${VERSION_MAJOR}.${VERSION_MINOR})
4177
4178         AC_MSG_CHECKING(for package patch date)
4179         VERSION_PATCH=`echo "$cf_field3" | sed -e 's/^[[^-]]*-//'`
4180         case .$VERSION_PATCH in
4181         .)
4182                 AC_MSG_ERROR(missing patch-date $VERSION_PATCH)
4183                 ;;
4184         .[[0-9]][[0-9]][[0-9]][[0-9]][[0-9]][[0-9]][[0-9]][[0-9]])
4185                 ;;
4186         *)
4187                 AC_MSG_ERROR(illegal patch-date $VERSION_PATCH)
4188                 ;;
4189         esac
4190         AC_MSG_RESULT($VERSION_PATCH)
4191 else
4192         AC_MSG_ERROR(did not find $srcdir/VERSION)
4193 fi
4194
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)
4200
4201 AC_SUBST(VERSION)
4202 AC_SUBST(VERSION_MAJOR)
4203 AC_SUBST(VERSION_MINOR)
4204 AC_SUBST(VERSION_PATCH)
4205
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.
4208 ifelse($1,,,[
4209         cf_PACKAGE=$1
4210         PACKAGE=ifelse($2,,$1,$2)
4211         AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE",[Define to the package-name])
4212         AC_SUBST(PACKAGE)
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})
4216 ])
4217 ])dnl
4218 dnl ---------------------------------------------------------------------------
4219 dnl CF_WAIT_HEADERS version: 2 updated: 1997/10/21 19:45:33
4220 dnl ---------------
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
4224 dnl with <wait.h>.
4225 AC_DEFUN([CF_WAIT_HEADERS],
4226 [
4227 AC_HAVE_HEADERS(sys/wait.h)
4228 cf_wait_headers="#include <sys/types.h>
4229 "
4230 if test $ac_cv_header_sys_wait_h = yes; then
4231 cf_wait_headers="$cf_wait_headers
4232 #include <sys/wait.h>
4233 "
4234 else
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
4239 #include <wait.h>
4240 "
4241 fi
4242 if test $ac_cv_header_waitstatus_h = yes; then
4243 cf_wait_headers="$cf_wait_headers
4244 #include <waitstatus.h>
4245 "
4246 fi
4247 fi
4248 ])dnl
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.
4255 dnl
4256 dnl $1 is the package name, if any, to derive a corresponding {package}_ABI
4257 dnl symbol.
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)
4265 ifelse($1,,,[
4266 $1_ABI=$cf_cv_abi_version
4267 ])
4268 ])dnl
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
4273 dnl libraries.
4274 AC_DEFUN([CF_WITH_CURSES_DIR],[
4275
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)
4282
4283 if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
4284 then
4285         CF_PATH_SYNTAX(withval)
4286         if test -d "$cf_cv_curses_dir"
4287         then
4288                 CF_ADD_INCDIR($cf_cv_curses_dir/include)
4289                 CF_ADD_LIBDIR($cf_cv_curses_dir/lib)
4290         fi
4291 fi
4292 ])dnl
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],
4301         [USE_DBMALLOC])
4302
4303 if test "$with_dbmalloc" = yes ; then
4304         AC_CHECK_HEADER(dbmalloc.h,
4305                 [AC_CHECK_LIB(dbmalloc,[debug_malloc]ifelse([$1],,[],[,$1]))])
4306 fi
4307 ])dnl
4308 dnl ---------------------------------------------------------------------------
4309 dnl CF_WITH_DMALLOC version: 7 updated: 2010/06/21 17:26:47
4310 dnl ---------------
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],
4316         [USE_DMALLOC])
4317
4318 if test "$with_dmalloc" = yes ; then
4319         AC_CHECK_HEADER(dmalloc.h,
4320                 [AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse([$1],,[],[,$1]))])
4321 fi
4322 ])dnl
4323 dnl ---------------------------------------------------------------------------
4324 dnl CF_WITH_LIBTOOL version: 30 updated: 2013/09/07 13:54:05
4325 dnl ---------------
4326 dnl Provide a configure option to incorporate libtool.  Define several useful
4327 dnl symbols for the makefile rules.
4328 dnl
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:
4334 dnl
4335 dnl     #!/bin/sh
4336 dnl     ACLOCAL=`aclocal --print-ac-dir`
4337 dnl     if test -z "$ACLOCAL" ; then
4338 dnl             echo cannot find aclocal directory
4339 dnl             exit 1
4340 dnl     elif test ! -f $ACLOCAL/libtool.m4 ; then
4341 dnl             echo cannot find libtool.m4 file
4342 dnl             exit 1
4343 dnl     fi
4344 dnl
4345 dnl     LOCAL=aclocal.m4
4346 dnl     ORIG=aclocal.m4.orig
4347 dnl
4348 dnl     trap "mv $ORIG $LOCAL" 0 1 2 5 15
4349 dnl     rm -f $ORIG
4350 dnl     mv $LOCAL $ORIG
4351 dnl
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
4355 dnl
4356 dnl     autoconf-257 $*
4357 dnl
4358 AC_DEFUN([CF_WITH_LIBTOOL],
4359 [
4360 AC_REQUIRE([CF_DISABLE_LIBTOOL_VERSION])
4361 ifdef([AC_PROG_LIBTOOL],,[
4362 LIBTOOL=
4363 ])
4364 # common library maintenance symbols that are convenient for libtool scripts:
4365 LIB_CREATE='${AR} -cr'
4366 LIB_OBJECT='${OBJECTS}'
4367 LIB_SUFFIX=.a
4368 LIB_PREP="$RANLIB"
4369
4370 # symbols used to prop libtool up to enable it to determine what it should be
4371 # doing:
4372 LIB_CLEAN=
4373 LIB_COMPILE=
4374 LIB_LINK='${CC}'
4375 LIB_INSTALL=
4376 LIB_UNINSTALL=
4377
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],
4382         [with_libtool=no])
4383 AC_MSG_RESULT($with_libtool)
4384 if test "$with_libtool" != "no"; then
4385 ifdef([AC_PROG_LIBTOOL],[
4386         # missing_content_AC_PROG_LIBTOOL{{
4387         AC_PROG_LIBTOOL
4388         # missing_content_AC_PROG_LIBTOOL}}
4389 ],[
4390         if test "$with_libtool" != "yes" ; then
4391                 CF_PATH_SYNTAX(with_libtool)
4392                 LIBTOOL=$with_libtool
4393         else
4394                 AC_CHECK_TOOLS(LIBTOOL,[libtool glibtool],none)
4395                 CF_LIBTOOL_VERSION
4396                 if test -z "$cf_cv_libtool_version" && test "$LIBTOOL" = libtool
4397                 then
4398                         CF_FORGET_TOOL(LIBTOOL)
4399                         AC_CHECK_TOOLS(LIBTOOL,[glibtool],none)
4400                         CF_LIBTOOL_VERSION
4401                 fi
4402         fi
4403         if test -z "$LIBTOOL" ; then
4404                 AC_MSG_ERROR(Cannot find libtool)
4405         fi
4406 ])dnl
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}'
4409         LIB_SUFFIX=.la
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'
4415         LIB_PREP=:
4416
4417         CF_CHECK_LIBTOOL_VERSION
4418
4419         # special hack to add -no-undefined (which libtool should do for itself)
4420         LT_UNDEF=
4421         case "$cf_cv_system_name" in #(vi
4422         cygwin*|msys*|mingw32*|uwin*|aix[[4-7]]) #(vi
4423                 LT_UNDEF=-no-undefined
4424                 ;;
4425         esac
4426         AC_SUBST([LT_UNDEF])
4427
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"
4433                 ;;
4434         *)
4435                 LIBTOOL_CXX="$LIBTOOL"
4436                 ;;
4437         esac
4438 else
4439         LIBTOOL=""
4440         LIBTOOL_CXX=""
4441 fi
4442
4443 test -z "$LIBTOOL" && ECHO_LT=
4444
4445 AC_SUBST(LIBTOOL)
4446 AC_SUBST(LIBTOOL_CXX)
4447 AC_SUBST(LIBTOOL_OPTS)
4448
4449 AC_SUBST(LIB_CREATE)
4450 AC_SUBST(LIB_OBJECT)
4451 AC_SUBST(LIB_SUFFIX)
4452 AC_SUBST(LIB_PREP)
4453
4454 AC_SUBST(LIB_CLEAN)
4455 AC_SUBST(LIB_COMPILE)
4456 AC_SUBST(LIB_LINK)
4457 AC_SUBST(LIB_INSTALL)
4458 AC_SUBST(LIB_UNINSTALL)
4459
4460 ])dnl
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)
4476
4477 case .$with_libtool_opts in
4478 .yes|.no|.)
4479         ;;
4480 *)
4481         LIBTOOL_OPTS=$with_libtool_opts
4482         ;;
4483 esac
4484
4485 AC_SUBST(LIBTOOL_OPTS)
4486 ])dnl
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],[
4491
4492 AC_REQUIRE([CF_WITH_DMALLOC])
4493 AC_REQUIRE([CF_WITH_DBMALLOC])
4494 AC_REQUIRE([CF_WITH_PURIFY])
4495 AC_REQUIRE([CF_WITH_VALGRIND])
4496
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
4503          *yes*) ;;
4504          *) AC_DEFINE(DOALLOC,10000,[Define to size of malloc-array]) ;;
4505          esac
4506          with_no_leaks=yes],
4507         [with_no_leaks=])
4508 AC_MSG_RESULT($with_no_leaks)
4509 ])dnl
4510 dnl ---------------------------------------------------------------------------
4511 dnl CF_WITH_PURIFY version: 2 updated: 2006/12/14 18:43:43
4512 dnl --------------
4513 AC_DEFUN([CF_WITH_PURIFY],[
4514 CF_NO_LEAKS_OPTION(purify,
4515         [  --with-purify           test: use Purify],
4516         [USE_PURIFY],
4517         [LINK_PREFIX="$LINK_PREFIX purify"])
4518 AC_SUBST(LINK_PREFIX)
4519 ])dnl
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.
4526 dnl
4527 dnl $1 is the package name, if any, to derive corresponding {package}_MAJOR
4528 dnl and {package}_MINOR symbols
4529 dnl symbol.
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])
4536 ifelse($1,,[
4537  CF_NUMBER_SYNTAX($cf_cv_rel_version,Release version)
4538 ],[
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)
4543 ])
4544 ])dnl
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).
4550 dnl
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],[
4555
4556 REL_VERSION=$2
4557 ABI_VERSION=$3
4558 cf_cv_rel_version=$REL_VERSION
4559 AC_SUBST(ABI_VERSION)
4560 AC_SUBST(REL_VERSION)
4561
4562 CF_WITH_REL_VERSION($1)
4563 CF_WITH_ABI_VERSION
4564
4565 LIB_MODEL=static
4566 DFT_LWR_MODEL=$LIB_MODEL
4567 LIBTOOL_MAKE="#"
4568
4569 # use to comment-out makefile lines
4570 MAKE_NORMAL=
4571 MAKE_STATIC=
4572 MAKE_SHARED="#"
4573
4574 CF_WITH_LIBTOOL
4575
4576 LIB_CREATE="$LIB_CREATE \[$]@"
4577
4578 if test "$with_libtool" = "yes" ; then
4579         OBJEXT="lo"
4580         LIB_MODEL=libtool
4581         DFT_LWR_MODEL=$LIB_MODEL
4582         LIBTOOL_MAKE=
4583         CF_WITH_LIBTOOL_OPTS
4584         MAKE_NORMAL="#"
4585         MAKE_STATIC="#"
4586         MAKE_SHARED=
4587 else
4588         AC_MSG_CHECKING(if you want to build shared libraries)
4589         AC_ARG_WITH(shared,
4590                 [  --with-shared           generate shared-libraries],
4591                 [with_shared=$withval],
4592                 [with_shared=no])
4593         AC_MSG_RESULT($with_shared)
4594         if test "$with_shared" = "yes" ; then
4595                 LIB_MODEL=shared
4596                 DFT_LWR_MODEL=$LIB_MODEL
4597                 CF_SHARED_OPTS
4598                 LIB_PREP=:
4599                 LIB_CREATE="[$]MK_SHARED_LIB"
4600                 CFLAGS="$CFLAGS $CC_SHARED_OPTS"
4601                 MAKE_NORMAL="#"
4602                 MAKE_STATIC="#"
4603                 MAKE_SHARED=
4604         fi
4605 fi
4606
4607 LIB_SUFFIX=
4608 CF_LIB_SUFFIX($LIB_MODEL, DFT_LIB_SUFFIX, DFT_DEP_SUFFIX)
4609 LIB_SUFFIX=$DFT_LIB_SUFFIX
4610
4611 AC_SUBST(DFT_LWR_MODEL)
4612 AC_SUBST(DFT_LIB_SUFFIX)
4613 AC_SUBST(DFT_DEP_SUFFIX)
4614 AC_SUBST(LIB_MODEL)
4615
4616 AC_SUBST(LIBTOOL_MAKE)
4617
4618 AC_SUBST(MAKE_NORMAL)
4619 AC_SUBST(MAKE_SHARED)
4620 AC_SUBST(MAKE_STATIC)
4621 ])dnl
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],
4628         [USE_VALGRIND])
4629 ])dnl
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
4634 dnl
4635 dnl Parameters:
4636 dnl     $1 - see CF_GCC_WARNINGS
4637 AC_DEFUN([CF_WITH_WARNINGS],
4638 [
4639 if ( test "$GCC" = yes || test "$GXX" = yes )
4640 then
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
4648         CF_GCC_ATTRIBUTES
4649         CF_GCC_WARNINGS([$1])
4650 fi
4651 fi
4652 ])dnl
4653 dnl ---------------------------------------------------------------------------
4654 dnl CF_XOPEN_CURSES version: 11 updated: 2011/01/18 18:15:30
4655 dnl ---------------
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.
4658 dnl
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],
4662 [
4663 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
4664 AC_CACHE_CHECK(if we must define _XOPEN_SOURCE_EXTENDED,cf_cv_need_xopen_extension,[
4665 AC_TRY_LINK([
4666 #include <stdlib.h>
4667 #include <${cf_cv_ncurses_header:-curses.h}>],[
4668 #if defined(NCURSES_VERSION_PATCH)
4669 #if (NCURSES_VERSION_PATCH < 20100501) && (NCURSES_VERSION_PATCH >= 20100403)
4670         make an error
4671 #endif
4672 #endif
4673         long x = winnstr(stdscr, "", 0);
4674         int x1, y1;
4675         getbegyx(stdscr, y1, x1)],
4676         [cf_cv_need_xopen_extension=no],
4677         [AC_TRY_LINK([
4678 #define _XOPEN_SOURCE_EXTENDED
4679 #include <stdlib.h>
4680 #include <${cf_cv_ncurses_header:-curses.h}>],[
4681 #ifdef NCURSES_VERSION
4682         cchar_t check;
4683         int check2 = curs_set((int)sizeof(check));
4684 #endif
4685         long x = winnstr(stdscr, "", 0);
4686         int x1, y1;
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"
4691 ])dnl
4692 dnl ---------------------------------------------------------------------------
4693 dnl CF_XOPEN_SOURCE version: 45 updated: 2013/09/07 14:06:25
4694 dnl ---------------
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.
4698 dnl
4699 dnl Parameters:
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])
4704
4705 cf_XOPEN_SOURCE=ifelse([$1],,500,[$1])
4706 cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2])
4707 cf_xopen_source=
4708
4709 case $host_os in #(vi
4710 aix[[4-7]]*) #(vi
4711         cf_xopen_source="-D_ALL_SOURCE"
4712         ;;
4713 cygwin|msys) #(vi
4714         cf_XOPEN_SOURCE=600
4715         ;;
4716 darwin[[0-8]].*) #(vi
4717         cf_xopen_source="-D_APPLE_C_SOURCE"
4718         ;;
4719 darwin*) #(vi
4720         cf_xopen_source="-D_DARWIN_C_SOURCE"
4721         cf_XOPEN_SOURCE=
4722         ;;
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
4728         cf_XOPEN_SOURCE=600
4729         cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
4730         ;;
4731 hpux11*) #(vi
4732         cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500"
4733         ;;
4734 hpux*) #(vi
4735         cf_xopen_source="-D_HPUX_SOURCE"
4736         ;;
4737 irix[[56]].*) #(vi
4738         cf_xopen_source="-D_SGI_SOURCE"
4739         cf_XOPEN_SOURCE=
4740         ;;
4741 linux*|gnu*|mint*|k*bsd*-gnu) #(vi
4742         CF_GNU_SOURCE
4743         ;;
4744 mirbsd*) #(vi
4745         # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <sys/select.h> and other headers which use u_int / u_short types
4746         cf_XOPEN_SOURCE=
4747         CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
4748         ;;
4749 netbsd*) #(vi
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
4751         ;;
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"
4755         cf_XOPEN_SOURCE=600
4756         ;;
4757 openbsd*) #(vi
4758         # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
4759         ;;
4760 osf[[45]]*) #(vi
4761         cf_xopen_source="-D_OSF_SOURCE"
4762         ;;
4763 nto-qnx*) #(vi
4764         cf_xopen_source="-D_QNX_SOURCE"
4765         ;;
4766 sco*) #(vi
4767         # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
4768         ;;
4769 solaris2.*) #(vi
4770         cf_xopen_source="-D__EXTENSIONS__"
4771         ;;
4772 *)
4773         CF_TRY_XOPEN_SOURCE
4774         CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
4775         ;;
4776 esac
4777
4778 if test -n "$cf_xopen_source" ; then
4779         CF_ADD_CFLAGS($cf_xopen_source)
4780 fi
4781
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
4789 make an error
4790 #endif],
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
4795         then
4796                 AC_TRY_COMPILE([#include <stdlib.h>],[
4797 #if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE
4798 make an error
4799 #endif],
4800                 [cf_XOPEN_SOURCE_set_ok=yes],
4801                 [cf_XOPEN_SOURCE_set_ok=no])
4802                 if test $cf_XOPEN_SOURCE_set_ok = no
4803                 then
4804                         AC_MSG_WARN(_XOPEN_SOURCE is lower than requested)
4805                 fi
4806         else
4807                 CF_TRY_XOPEN_SOURCE
4808         fi
4809 fi
4810 ])
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.
4817 dnl
4818 dnl The logic is controlled by these cache variables:
4819 dnl $cf_cv_do_symlinks
4820 dnl $cf_cv_shlib_version
4821 dnl
4822 dnl The macro uses variables set by CF__DEFINE_SHLIB_VARS
4823 dnl
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],[
4829
4830 CF__DEFINE_LIB_TARGET
4831
4832 case x$2 in
4833 xlibtool|xshared) #(vi
4834         cf_libdeps="ifelse($4,,,[$4])"
4835         ;;
4836 x*)
4837         cf_libdeps=
4838         ;;
4839 esac
4840
4841 cat >>$1 <<CF_EOF
4842
4843 # generated by CF__ADD_SHLIB_RULES
4844 # libmodel: $2
4845 # symlinks: $cf_cv_do_symlinks
4846 # shlibver: $cf_cv_shlib_version
4847
4848 CF_EOF
4849
4850 cat >>$1 <<CF_EOF
4851 $cf_libname :: \\
4852 CF_EOF
4853
4854 cat >>$1 <<CF_EOF
4855                 $3
4856         @echo linking \[$]@
4857         \$(LIBTOOL_CREATE) $3 $cf_libdeps
4858 CF_EOF
4859
4860 if test "x$cf_cv_do_symlinks" = xyes
4861 then
4862 cat >>$1 <<CF_EOF
4863         \$(LN_S) $cf_libname $cf_liblink
4864         \$(LN_S) $cf_liblink $cf_libroot
4865 CF_EOF
4866 fi
4867
4868 cat >>$1 <<CF_EOF
4869
4870 install \\
4871 install.libs :: \$(DESTDIR)\$(libdir)/$cf_libname
4872
4873 \$(DESTDIR)\$(libdir)/$cf_libname :: \\
4874                 \$(DESTDIR)\$(libdir) \\
4875                 $3
4876         @echo linking \[$]@
4877         \$(LIBTOOL_CREATE) $3 $cf_libdeps
4878 CF_EOF
4879
4880 if test "x$cf_cv_do_symlinks" = xyes
4881 then
4882 cat >>$1 <<CF_EOF
4883         cd \$(DESTDIR)\$(libdir) && (\$(LN_S) $cf_libname $cf_liblink; \$(LN_S) $cf_liblink $cf_libroot; )
4884 CF_EOF
4885 fi
4886
4887 if test x$2 = xshared
4888 then
4889 cat >>$1 <<CF_EOF
4890         - test -z "\$(DESTDIR)" && /sbin/ldconfig
4891 CF_EOF
4892 fi
4893
4894 cat >>$1 <<CF_EOF
4895
4896 uninstall \\
4897 uninstall.libs ::
4898         @echo uninstalling \$(DESTDIR)\$(libdir)/$cf_libname
4899 CF_EOF
4900
4901 if test "x$cf_cv_do_symlinks" = xyes
4902 then
4903 cat >>$1 <<CF_EOF
4904         -rm -f \$(DESTDIR)\$(libdir)/$cf_libroot
4905         -rm -f \$(DESTDIR)\$(libdir)/$cf_liblink
4906 CF_EOF
4907 fi
4908
4909 cat >>$1 <<CF_EOF
4910         -rm -f \$(DESTDIR)\$(libdir)/$cf_libname
4911
4912 clean \\
4913 clean.libs ::
4914 CF_EOF
4915
4916 if test "x$cf_cv_do_symlinks" = xyes
4917 then
4918 cat >>$1 <<CF_EOF
4919         -rm -f $cf_libroot
4920         -rm -f $cf_liblink
4921 CF_EOF
4922 fi
4923
4924 cat >>$1 <<CF_EOF
4925         -rm -f $cf_libname
4926
4927 mostlyclean::
4928         -rm -f $3
4929 # end generated by CF__ADD_SHLIB_RULES
4930 CF_EOF
4931 ])dnl
4932 dnl ---------------------------------------------------------------------------
4933 dnl CF__CURSES_HEAD version: 2 updated: 2010/10/23 15:54:49
4934 dnl ---------------
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],[
4938 #ifdef HAVE_XCURSES
4939 #include <xcurses.h>
4940 char * XCursesProgramName = "test";
4941 #else
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)
4948 #include <term.h>
4949 #endif
4950 #endif
4951 ])
4952 dnl ---------------------------------------------------------------------------
4953 dnl CF__CURSES_HEAD version: 2 updated: 2010/10/23 15:54:49
4954 dnl ---------------
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],[
4958 #ifdef HAVE_XCURSES
4959 #include <xcurses.h>
4960 char * XCursesProgramName = "test";
4961 #else
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)
4968 #include <term.h>
4969 #endif
4970 #endif
4971 ])
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
4979
4980 if test "x$cf_cv_do_symlinks" = xyes
4981 then
4982         case "x$cf_cv_shlib_version" in #(vi
4983         xrel) #(vi
4984                 cf_liblink="\${LIB_ABI_NAME}"
4985                 cf_libname="\${LIB_REL_NAME}"
4986                 ;;
4987         xabi)
4988                 cf_liblink="\${LIB_REL_NAME}"
4989                 cf_libname="\${LIB_ABI_NAME}"
4990                 ;;
4991         esac
4992 fi
4993 LIB_TARGET=$cf_libname
4994 ])dnl
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.
4999 dnl
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)
5017 ])dnl
5018 dnl ---------------------------------------------------------------------------
5019 dnl CF__ICONV_BODY version: 2 updated: 2007/07/26 17:35:47
5020 dnl --------------
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);
5025         iconv_close(cd);]
5026 )dnl
5027 dnl ---------------------------------------------------------------------------
5028 dnl CF__ICONV_HEAD version: 1 updated: 2007/07/26 15:57:03
5029 dnl --------------
5030 dnl Header-files needed for iconv compile-checks
5031 define([CF__ICONV_HEAD],[
5032 #include <stdlib.h>
5033 #include <iconv.h>]
5034 )dnl
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"
5050 ])
5051 dnl ---------------------------------------------------------------------------
5052 dnl CF__INTL_BODY version: 1 updated: 2007/07/26 17:35:47
5053 dnl -------------
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]
5061 ])
5062 dnl ---------------------------------------------------------------------------
5063 dnl CF__INTL_HEAD version: 1 updated: 2007/07/26 17:35:47
5064 dnl -------------
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;
5069 ])dnl
5070 dnl ---------------------------------------------------------------------------
5071 dnl jm_GLIBC21 version: 3 updated: 2002/10/27 23:21:42
5072 dnl ----------
5073 dnl Inserted as requested by gettext 0.10.40
5074 dnl File from /usr/share/aclocal
5075 dnl glibc21.m4
5076 dnl ====================
5077 dnl serial 2
5078 dnl
5079 dnl Test for the GNU C Library, version 2.1 or newer.
5080 dnl From Bruno Haible.
5081 AC_DEFUN([jm_GLIBC21],
5082   [
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],
5086         [
5087 #include <features.h>
5088 #ifdef __GNU_LIBRARY__
5089  #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
5090   Lucky GNU user
5091  #endif
5092 #endif
5093         ],
5094         ac_cv_gnu_library_2_1=yes,
5095         ac_cv_gnu_library_2_1=no)
5096       ]
5097     )
5098     AC_SUBST(GLIBC21)
5099     GLIBC21="$ac_cv_gnu_library_2_1"
5100   ]
5101 )