aclocal.m4 217 KB
Newer Older
1
dnl $LynxId: aclocal.m4,v 1.243 2017/07/11 08:44:41 tom Exp $
2
dnl Macros for auto-configure script.
3
dnl by Thomas E. Dickey <dickey@invisible-island.net>
4 5 6
dnl and Jim Spath <jspath@mail.bcpl.lib.md.us>
dnl and Philippe De Muyter <phdm@macqel.be>
dnl
7
dnl Created: 1997/01/28
8
dnl
9 10
dnl The autoconf used in Lynx development is GNU autoconf 2.13 or 2.52, patched
dnl by Thomas Dickey.  See your local GNU archives, and this URL:
11 12 13
dnl http://invisible-island.net/autoconf/autoconf.html
dnl
dnl ---------------------------------------------------------------------------
14
dnl
15
dnl Copyright 1997-2016,2017 by Thomas E. Dickey
16
dnl
17 18 19 20 21 22 23 24
dnl Permission to use, copy, modify, and distribute this software and its
dnl documentation for any purpose and without fee is hereby granted,
dnl provided that the above copyright notice appear in all copies and that
dnl both that copyright notice and this permission notice appear in
dnl supporting documentation, and that the name of the above listed
dnl copyright holder(s) not be used in advertising or publicity pertaining
dnl to distribution of the software without specific, written prior
dnl permission.
25
dnl
26 27 28 29 30 31 32 33 34 35 36 37 38
dnl THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
dnl TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
dnl AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
dnl LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
dnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
dnl ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
dnl OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
dnl
dnl ---------------------------------------------------------------------------
dnl A few macros (the AM_xxx ones) are originally from gettext 0.10.35 (but
dnl are modified), and are part of this file due to mechanical limitations of
dnl autoconf.
dnl ---------------------------------------------------------------------------
39
dnl ---------------------------------------------------------------------------
40
dnl AM_GNU_GETTEXT version: 14 updated: 2015/04/15 19:08:48
41 42 43
dnl --------------
dnl Usage: Just like AM_WITH_NLS, which see.
AC_DEFUN([AM_GNU_GETTEXT],
44
  [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
45
   AC_REQUIRE([AC_CANONICAL_HOST])dnl
46 47 48 49 50 51 52
   AC_REQUIRE([AC_PROG_RANLIB])dnl
   AC_REQUIRE([AC_HEADER_STDC])dnl
   AC_REQUIRE([AC_C_INLINE])dnl
   AC_REQUIRE([AC_TYPE_OFF_T])dnl
   AC_REQUIRE([AC_TYPE_SIZE_T])dnl
   AC_REQUIRE([AC_FUNC_ALLOCA])dnl
   AC_REQUIRE([AC_FUNC_MMAP])dnl
53
   AC_REQUIRE([jm_GLIBC21])dnl
54
   AC_REQUIRE([CF_PROG_CC])dnl
55

56 57 58 59 60
   AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
stdlib.h string.h unistd.h sys/param.h])
   AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \
getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \
strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
61

62 63
   AM_ICONV
   AM_LANGINFO_CODESET
64
   AM_LC_MESSAGES
65
   AM_WITH_NLS([$1],[$2],[$3],[$4])
66 67 68 69 70 71 72

   if test "x$CATOBJEXT" != "x"; then
     if test "x$ALL_LINGUAS" = "x"; then
       LINGUAS=
     else
       AC_MSG_CHECKING(for catalogs to be installed)
       NEW_LINGUAS=
73 74 75 76 77 78 79 80 81
       for presentlang in $ALL_LINGUAS; do
         useit=no
         for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do
           # Use the presentlang catalog if desiredlang is
           #   a. equal to presentlang, or
           #   b. a variant of presentlang (because in this case,
           #      presentlang can be used as a fallback for messages
           #      which are not translated in the desiredlang catalog).
           case "$desiredlang" in
82
             ("$presentlang"*) useit=yes;;
83 84 85 86 87
           esac
         done
         if test $useit = yes; then
           NEW_LINGUAS="$NEW_LINGUAS $presentlang"
         fi
88 89 90 91 92 93 94 95 96 97 98
       done
       LINGUAS=$NEW_LINGUAS
       AC_MSG_RESULT($LINGUAS)
     fi

     dnl Construct list of names of catalog files to be constructed.
     if test -n "$LINGUAS"; then
       for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
     fi
   fi

99 100 101 102 103
   dnl Enable libtool support if the surrounding package wishes it.
   INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], [])
   AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
])dnl
dnl ---------------------------------------------------------------------------
104
dnl AM_ICONV version: 12 updated: 2007/07/30 19:12:03
105 106 107 108 109 110 111 112
dnl --------
dnl Inserted as requested by gettext 0.10.40
dnl File from /usr/share/aclocal
dnl iconv.m4
dnl ====================
dnl serial AM2
dnl
dnl From Bruno Haible.
113 114 115 116 117
dnl
dnl ====================
dnl Modified to use CF_FIND_LINKAGE and CF_ADD_SEARCHPATH, to broaden the
dnl range of locations searched.  Retain the same cache-variable naming to
dnl allow reuse with the other gettext macros -Thomas E Dickey
118 119 120 121 122 123
AC_DEFUN([AM_ICONV],
[
  dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
  dnl those with the standalone portable GNU libiconv installed).

  AC_ARG_WITH([libiconv-prefix],
124 125
[  --with-libiconv-prefix=DIR
                          search for libiconv in DIR/include and DIR/lib], [
126
    CF_ADD_OPTIONAL_PATH($withval, libiconv)
127 128 129
   ])

  AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
130 131 132 133 134 135
    CF_FIND_LINKAGE(CF__ICONV_HEAD,
      CF__ICONV_BODY,
      iconv,
      am_cv_func_iconv=yes,
      am_cv_func_iconv=["no, consider installing GNU libiconv"])])

136 137
  if test "$am_cv_func_iconv" = yes; then
    AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
138 139 140 141

    AC_CACHE_CHECK([if the declaration of iconv() needs const.],
		   am_cv_proto_iconv_const,[
      AC_TRY_COMPILE(CF__ICONV_HEAD [
142 143 144 145 146 147 148 149 150
extern
#ifdef __cplusplus
"C"
#endif
#if defined(__STDC__) || defined(__cplusplus)
size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
#else
size_t iconv();
#endif
151 152 153 154 155 156 157 158 159
],[], am_cv_proto_iconv_const=no,
      am_cv_proto_iconv_const=yes)])

    if test "$am_cv_proto_iconv_const" = yes ; then
      am_cv_proto_iconv_arg1="const"
    else
      am_cv_proto_iconv_arg1=""
    fi

160 161 162
    AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
      [Define as const if the declaration of iconv() needs const.])
  fi
163

164
  LIBICONV=
165 166 167 168 169 170
  if test "$cf_cv_find_linkage_iconv" = yes; then
    CF_ADD_INCDIR($cf_cv_header_path_iconv)
    if test -n "$cf_cv_library_file_iconv" ; then
      LIBICONV="-liconv"
      CF_ADD_LIBDIR($cf_cv_library_path_iconv)
    fi
171
  fi
172

173
  AC_SUBST(LIBICONV)
174 175
])dnl
dnl ---------------------------------------------------------------------------
176
dnl AM_LANGINFO_CODESET version: 4 updated: 2015/04/18 08:56:57
177 178 179 180 181 182
dnl -------------------
dnl Inserted as requested by gettext 0.10.40
dnl File from /usr/share/aclocal
dnl codeset.m4
dnl ====================
dnl serial AM1
183
dnl
184 185 186
dnl From Bruno Haible.
AC_DEFUN([AM_LANGINFO_CODESET],
[
187 188 189 190 191 192 193 194 195 196
AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
	[AC_TRY_LINK([#include <langinfo.h>],
	[char* cs = nl_langinfo(CODESET);],
	am_cv_langinfo_codeset=yes,
	am_cv_langinfo_codeset=no)
	])
	if test $am_cv_langinfo_codeset = yes; then
		AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
		[Define if you have <langinfo.h> and nl_langinfo(CODESET).])
	fi
197 198
])dnl
dnl ---------------------------------------------------------------------------
199
dnl AM_LC_MESSAGES version: 5 updated: 2015/05/10 19:52:14
200 201 202 203 204
dnl --------------
dnl Inserted as requested by gettext 0.10.40
dnl File from /usr/share/aclocal
dnl lcmessage.m4
dnl ====================
205 206 207 208
dnl Check whether LC_MESSAGES is available in <locale.h>.
dnl Ulrich Drepper <drepper@cygnus.com>, 1995.
dnl
dnl This file can be copied and used freely without restrictions.  It can
209 210 211 212 213 214 215
dnl be used in projects which are not available under the GNU General Public
dnl License or the GNU Library General Public License but which still want
dnl to provide support for the GNU gettext functionality.
dnl Please note that the actual code of the GNU gettext library is covered
dnl by the GNU Library General Public License, and the rest of the GNU
dnl gettext package package is covered by the GNU General Public License.
dnl They are *not* in the public domain.
216
dnl
217
dnl serial 2
218
dnl
219
AC_DEFUN([AM_LC_MESSAGES],
220 221 222 223 224 225 226 227 228
[if test $ac_cv_header_locale_h = yes; then
	AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
		[AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
		am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
	if test $am_cv_val_LC_MESSAGES = yes; then
		AC_DEFINE(HAVE_LC_MESSAGES, 1,
		[Define if your <locale.h> file defines LC_MESSAGES.])
	fi
fi])dnl
229
dnl ---------------------------------------------------------------------------
230
dnl AM_PATH_PROG_WITH_TEST version: 9 updated: 2015/04/15 19:08:48
231 232 233 234 235
dnl ----------------------
dnl Inserted as requested by gettext 0.10.40
dnl File from /usr/share/aclocal
dnl progtest.m4
dnl ====================
236 237 238 239
dnl Search path for a program which passes the given test.
dnl Ulrich Drepper <drepper@cygnus.com>, 1996.
dnl
dnl This file can be copied and used freely without restrictions.  It can
240 241 242 243 244 245 246
dnl be used in projects which are not available under the GNU General Public
dnl License or the GNU Library General Public License but which still want
dnl to provide support for the GNU gettext functionality.
dnl Please note that the actual code of the GNU gettext library is covered
dnl by the GNU Library General Public License, and the rest of the GNU
dnl gettext package package is covered by the GNU General Public License.
dnl They are *not* in the public domain.
247
dnl
248
dnl serial 2
249 250 251
dnl
dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
252
AC_DEFUN([AM_PATH_PROG_WITH_TEST],
253 254 255 256 257 258
[# Extract the first word of "$2", so it can be a program name with args.
AC_REQUIRE([CF_PATHSEP])
set dummy $2; ac_word=[$]2
AC_MSG_CHECKING([for $ac_word])
AC_CACHE_VAL(ac_cv_path_$1,
[case "[$]$1" in
259
  ([[\\/]*|?:[\\/]]*)
260 261
  ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
  ;;
262
  (*)
263
  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
264 265
  for ac_dir in ifelse([$5], , $PATH, [$5]); do
    test -z "$ac_dir" && ac_dir=.
266
    if test -f $ac_dir/$ac_word$ac_exeext; then
267
      if [$3]; then
268
	ac_cv_path_$1="$ac_dir/$ac_word$ac_exeext"
269 270 271 272 273 274 275 276 277 278 279 280
	break
      fi
    fi
  done
  IFS="$ac_save_ifs"
dnl If no 4th arg is given, leave the cache variable unset,
dnl so AC_PATH_PROGS will keep looking.
ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
])dnl
  ;;
esac])dnl
$1="$ac_cv_path_$1"
281
if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
282 283 284 285 286
  AC_MSG_RESULT([$]$1)
else
  AC_MSG_RESULT(no)
fi
AC_SUBST($1)dnl
287
])dnl
288
dnl ---------------------------------------------------------------------------
289
dnl AM_WITH_NLS version: 27 updated: 2017/07/10 20:13:33
290 291 292 293 294
dnl -----------
dnl Inserted as requested by gettext 0.10.40
dnl File from /usr/share/aclocal
dnl gettext.m4
dnl ====================
295 296
dnl Macro to add for using GNU gettext.
dnl Ulrich Drepper <drepper@cygnus.com>, 1995.
297 298 299 300 301
dnl ====================
dnl Modified to use CF_FIND_LINKAGE and CF_ADD_SEARCHPATH, to broaden the
dnl range of locations searched.  Retain the same cache-variable naming to
dnl allow reuse with the other gettext macros -Thomas E Dickey
dnl ====================
302 303
dnl
dnl This file can be copied and used freely without restrictions.  It can
304 305 306 307 308 309 310 311 312
dnl be used in projects which are not available under the GNU General Public
dnl License or the GNU Library General Public License but which still want
dnl to provide support for the GNU gettext functionality.
dnl Please note that the actual code of the GNU gettext library is covered
dnl by the GNU Library General Public License, and the rest of the GNU
dnl gettext package package is covered by the GNU General Public License.
dnl They are *not* in the public domain.
dnl
dnl serial 10
313
dnl
314 315 316 317 318 319 320 321 322 323 324 325 326
dnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR], [ENABLED]).
dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library
dnl    $(top_builddir)/intl/libintl.la will be created (shared and/or static,
dnl    depending on --{enable,disable}-{shared,static} and on the presence of
dnl    AM-DISABLE-SHARED). Otherwise, a static library
dnl    $(top_builddir)/intl/libintl.a will be created.
dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
dnl    implementations (in libc or libintl) without the ngettext() function
dnl    will be ignored.
dnl LIBDIR is used to find the intl libraries.  If empty,
dnl    the value `$(top_builddir)/intl/' is used.
dnl ENABLED is used to control the default for the related --enable-nls, since
dnl    not all application developers want this feature by default, e.g., lynx.
327
dnl
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344
dnl The result of the configuration is one of three cases:
dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
dnl    and used.
dnl    Catalog format: GNU --> install in $(datadir)
dnl    Catalog extension: .mo after installation, .gmo in source tree
dnl 2) GNU gettext has been found in the system's C library.
dnl    Catalog format: GNU --> install in $(datadir)
dnl    Catalog extension: .mo after installation, .gmo in source tree
dnl 3) No internationalization, always use English msgid.
dnl    Catalog format: none
dnl    Catalog extension: none
dnl The use of .gmo is historical (it was needed to avoid overwriting the
dnl GNU format catalogs when building on a platform with an X/Open gettext),
dnl but we keep it in order not to force irrelevant filename changes on the
dnl maintainers.
dnl
AC_DEFUN([AM_WITH_NLS],
345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362
[AC_MSG_CHECKING([whether NLS is requested])
  dnl Default is enabled NLS
  ifelse([$4],,[
  AC_ARG_ENABLE(nls,
    [  --disable-nls           do not use Native Language Support],
    USE_NLS=$enableval, USE_NLS=yes)],[
  AC_ARG_ENABLE(nls,
    [  --enable-nls            use Native Language Support],
    USE_NLS=$enableval, USE_NLS=no)])
  AC_MSG_RESULT($USE_NLS)
  AC_SUBST(USE_NLS)

  BUILD_INCLUDED_LIBINTL=no
  USE_INCLUDED_LIBINTL=no
  INTLLIBS=

  dnl If we use NLS figure out what method
  if test "$USE_NLS" = "yes"; then
363 364
    dnl We need to process the po/ directory.
    POSUB=po
365 366 367 368 369 370 371 372 373 374 375 376 377
    AC_DEFINE(ENABLE_NLS, 1,
      [Define to 1 if translation of program messages to the user's native language
 is requested.])
    AC_MSG_CHECKING([whether included gettext is requested])
    AC_ARG_WITH(included-gettext,
      [  --with-included-gettext use the GNU gettext library included here],
      nls_cv_force_use_gnu_gettext=$withval,
      nls_cv_force_use_gnu_gettext=no)
    AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)

    nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
    if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
      dnl User does not insist on using GNU NLS library.  Figure out what
378
      dnl to use.  If GNU gettext is available we use this.  Else we may have
379 380 381
      dnl to fall back to GNU NLS library.
      CATOBJEXT=NONE

382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406
      dnl Save these (possibly-set) variables for reference.  If the user
      dnl overrode these to provide full pathnames, then warn if not actually
      dnl GNU gettext, but do not override their values.  Also, if they were
      dnl overridden, suppress the part of the library test which prevents it
      dnl from finding anything other than GNU gettext.  Doing this also
      dnl suppresses a bogus search for the intl library.
      cf_save_msgfmt_path="$MSGFMT"
      cf_save_xgettext_path="$XGETTEXT"

      dnl Search for GNU msgfmt in the PATH.
      AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
          [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
      AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
      AC_SUBST(MSGFMT)

      dnl Search for GNU xgettext in the PATH.
      AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
          [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)

      cf_save_OPTS_1="$CPPFLAGS"
      if test "x$cf_save_msgfmt_path" = "x$MSGFMT" && \
         test "x$cf_save_xgettext_path" = "x$XGETTEXT" ; then
          CF_ADD_CFLAGS(-DIGNORE_MSGFMT_HACK)
      fi

407
      cf_save_LIBS_1="$LIBS"
408
      CF_ADD_LIBS($LIBICONV)
409 410 411

      CF_FIND_LINKAGE(CF__INTL_HEAD,
        CF__INTL_BODY($2),
412 413 414
        intl,
        cf_cv_func_gettext=yes,
        cf_cv_func_gettext=no)
415 416 417 418

      AC_MSG_CHECKING([for libintl.h and gettext()])
      AC_MSG_RESULT($cf_cv_func_gettext)

419
      LIBS="$cf_save_LIBS_1"
420
      CPPFLAGS="$cf_save_OPTS_1"
421 422

      if test "$cf_cv_func_gettext" = yes ; then
423
        AC_DEFINE(HAVE_LIBINTL_H,1,[Define to 1 if we have libintl.h])
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448

        dnl If an already present or preinstalled GNU gettext() is found,
        dnl use it.  But if this macro is used in GNU gettext, and GNU
        dnl gettext is already preinstalled in libintl, we update this
        dnl libintl.  (Cf. the install rule in intl/Makefile.in.)
        if test "$PACKAGE" != gettext; then
          AC_DEFINE(HAVE_GETTEXT, 1,
              [Define if the GNU gettext() function is already present or preinstalled.])

          CF_ADD_INCDIR($cf_cv_header_path_intl)

          if test -n "$cf_cv_library_file_intl" ; then
            dnl If iconv() is in a separate libiconv library, then anyone
            dnl linking with libintl{.a,.so} also needs to link with
            dnl libiconv.
            INTLLIBS="$cf_cv_library_file_intl $LIBICONV"
            CF_ADD_LIBDIR($cf_cv_library_path_intl,INTLLIBS)
          fi

          gt_save_LIBS="$LIBS"
          LIBS="$LIBS $INTLLIBS"
          AC_CHECK_FUNCS(dcgettext)
          LIBS="$gt_save_LIBS"

          CATOBJEXT=.gmo
449
        fi
450 451 452 453 454 455 456 457 458 459 460 461 462 463
      elif test -z "$MSGFMT" || test -z "$XGETTEXT" ; then
        AC_MSG_WARN(disabling NLS feature)
        sed -e /ENABLE_NLS/d confdefs.h >confdefs.tmp
        mv confdefs.tmp confdefs.h
        ALL_LINGUAS=
        CATOBJEXT=.ignored
        MSGFMT=":"
        GMSGFMT=":"
        XGETTEXT=":"
        POSUB=
        BUILD_INCLUDED_LIBINTL=no
        USE_INCLUDED_LIBINTL=no
        USE_NLS=no
        nls_cv_use_gnu_gettext=no
464 465
      fi

466 467 468
      if test "$CATOBJEXT" = "NONE"; then
        dnl GNU gettext is not found in the C library.
        dnl Fall back on GNU gettext library.
469
        nls_cv_use_gnu_gettext=maybe
470
      fi
471
    fi
472

473
    if test "$nls_cv_use_gnu_gettext" != "no"; then
474
      CATOBJEXT=.gmo
475 476 477 478 479 480 481 482 483 484 485
      if test -f $srcdir/intl/libintl.h ; then
        dnl Mark actions used to generate GNU NLS library.
        INTLOBJS="\$(GETTOBJS)"
        BUILD_INCLUDED_LIBINTL=yes
        USE_INCLUDED_LIBINTL=yes
        INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV"
        LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
      elif test "$nls_cv_use_gnu_gettext" = "yes"; then
        nls_cv_use_gnu_gettext=no
        AC_MSG_WARN(no NLS library is packaged with this application)
      fi
486
    fi
487

488 489 490 491 492
    dnl Test whether we really found GNU msgfmt.
    if test "$GMSGFMT" != ":"; then
      if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then
        : ;
      else
493
        AC_MSG_WARN([found msgfmt program is not GNU msgfmt])
494
      fi
495
    fi
496

497 498 499 500 501
    dnl Test whether we really found GNU xgettext.
    if test "$XGETTEXT" != ":"; then
      if $XGETTEXT --omit-header /dev/null >/dev/null 2>&1; then
        : ;
      else
502
        AC_MSG_WARN([found xgettext program is not GNU xgettext])
503
      fi
504
    fi
505 506
  fi

507 508 509 510 511 512 513
  if test "$XGETTEXT" != ":"; then
    AC_OUTPUT_COMMANDS(
     [for ac_file in $CONFIG_FILES; do
  
        # Support "outfile[:infile[:infile...]]"
        case "$ac_file" in
          (*:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
514
        esac
515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567
  
        # PO directories have a Makefile.in generated from Makefile.inn.
        case "$ac_file" in
        (*/[Mm]akefile.in)
          # Adjust a relative srcdir.
          ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
          ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
          ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
          ac_base=`basename $ac_file .in`
          # In autoconf-2.13 it is called $ac_given_srcdir.
          # In autoconf-2.50 it is called $srcdir.
          test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
  
          case "$ac_given_srcdir" in
            (.)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
            (/*) top_srcdir="$ac_given_srcdir" ;;
            (*)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
          esac
  
          if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
            rm -f "$ac_dir/POTFILES"
            test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
            sed -e "/^#/d" -e "/^[ 	]*\$/d" -e "s,.*,     $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES"
            test -n "$as_me" && echo "$as_me: creating $ac_dir/$ac_base" || echo "creating $ac_dir/$ac_base"
            sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/$ac_base.in" > "$ac_dir/$ac_base"
          fi
          ;;
        esac
      done])
  
    dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
    dnl to 'yes' because some of the testsuite requires it.
    if test "$PACKAGE" = gettext; then
      BUILD_INCLUDED_LIBINTL=yes
    fi
  
    dnl intl/plural.c is generated from intl/plural.y. It requires bison,
    dnl because plural.y uses bison specific features. It requires at least
    dnl bison-1.26 because earlier versions generate a plural.c that doesn't
    dnl compile.
    dnl bison is only needed for the maintainer (who touches plural.y). But in
    dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
    dnl the rule in general Makefile. Now, some people carelessly touch the
    dnl files or have a broken "make" program, hence the plural.c rule will
    dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
    dnl present or too old.
    if test "$nls_cv_use_gnu_gettext" = "yes"; then
      AC_CHECK_PROGS([INTLBISON], [bison])
      if test -z "$INTLBISON"; then
        ac_verc_fail=yes
      else
        dnl Found it, now check the version.
        AC_MSG_CHECKING([version of bison])
568
changequote(<<,>>)dnl
569 570 571 572
        ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
        case $ac_prog_version in
          ('') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
          (1.2[6-9]*|1.[3-9][0-9]*|[2-9].*)
573
changequote([,])dnl
574 575 576 577 578 579 580 581
             ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
          (*) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
        esac
      AC_MSG_RESULT([$ac_prog_version])
      fi
      if test $ac_verc_fail = yes; then
        INTLBISON=:
      fi
582
    fi
583 584 585 586 587 588 589 590
  
    dnl These rules are solely for the distribution goal.  While doing this
    dnl we only have to keep exactly one list of the available catalogs
    dnl in configure.in.
    for lang in $ALL_LINGUAS; do
      GMOFILES="$GMOFILES $lang.gmo"
      POFILES="$POFILES $lang.po"
    done
591
  fi
592

593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619
  dnl Make all variables we use known to autoconf.
  AC_SUBST(BUILD_INCLUDED_LIBINTL)
  AC_SUBST(USE_INCLUDED_LIBINTL)
  AC_SUBST(CATALOGS)
  AC_SUBST(CATOBJEXT)
  AC_SUBST(GMOFILES)
  AC_SUBST(INTLLIBS)
  AC_SUBST(INTLOBJS)
  AC_SUBST(POFILES)
  AC_SUBST(POSUB)

  dnl For backward compatibility. Some configure.ins may be using this.
  nls_cv_header_intl=
  nls_cv_header_libgt=

  dnl For backward compatibility. Some Makefiles may be using this.
  DATADIRNAME=share
  AC_SUBST(DATADIRNAME)

  dnl For backward compatibility. Some Makefiles may be using this.
  INSTOBJEXT=.mo
  AC_SUBST(INSTOBJEXT)

  dnl For backward compatibility. Some Makefiles may be using this.
  GENCAT=gencat
  AC_SUBST(GENCAT)
])dnl
620
dnl ---------------------------------------------------------------------------
621
dnl CF_ACVERSION_CHECK version: 5 updated: 2014/06/04 19:11:49
622 623 624 625 626 627
dnl ------------------
dnl Conditionally generate script according to whether we're using a given autoconf.
dnl
dnl $1 = version to compare against
dnl $2 = code to use if AC_ACVERSION is at least as high as $1.
dnl $3 = code to use if AC_ACVERSION is older than $1.
628
define([CF_ACVERSION_CHECK],
629
[
630
ifdef([AC_ACVERSION], ,[ifdef([AC_AUTOCONF_VERSION],[m4_copy([AC_AUTOCONF_VERSION],[AC_ACVERSION])],[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])])dnl
631 632 633 634 635 636
ifdef([m4_version_compare],
[m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])],
[CF_ACVERSION_COMPARE(
AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])),
AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl
dnl ---------------------------------------------------------------------------
637
dnl CF_ACVERSION_COMPARE version: 3 updated: 2012/10/03 18:39:53
638 639 640 641
dnl --------------------
dnl CF_ACVERSION_COMPARE(MAJOR1, MINOR1, TERNARY1,
dnl                      MAJOR2, MINOR2, TERNARY2,
dnl                      PRINTABLE2, not FOUND, FOUND)
642
define([CF_ACVERSION_COMPARE],
643 644 645 646
[ifelse(builtin([eval], [$2 < $5]), 1,
[ifelse([$8], , ,[$8])],
[ifelse([$9], , ,[$9])])])dnl
dnl ---------------------------------------------------------------------------
647
dnl CF_ADD_CFLAGS version: 13 updated: 2017/02/25 18:57:40
648
dnl -------------
649
dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS
650
dnl The second parameter if given makes this macro verbose.
651 652 653 654
dnl
dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS,
dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily
dnl confused by the quotes (which require backslashes to keep them usable).
655 656
AC_DEFUN([CF_ADD_CFLAGS],
[
657
cf_fix_cppflags=no
658 659
cf_new_cflags=
cf_new_cppflags=
660 661
cf_new_extra_cppflags=

662 663
for cf_add_cflags in $1
do
664
case $cf_fix_cppflags in
665 666 667
(no)
	case $cf_add_cflags in
	(-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C)
668
		case $cf_add_cflags in
669
		(-D*)
670 671
			cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'`

672
			test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \
673 674
				&& test -z "${cf_tst_cflags}" \
				&& cf_fix_cppflags=yes
675 676

			if test $cf_fix_cppflags = yes ; then
677
				CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags)
678 679
				continue
			elif test "${cf_tst_cflags}" = "\"'" ; then
680
				CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags)
681 682 683 684
				continue
			fi
			;;
		esac
685
		case "$CPPFLAGS" in
686
		(*$cf_add_cflags)
687
			;;
688 689 690
		(*)
			case $cf_add_cflags in
			(-D*)
691 692 693 694
				cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
				CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags)
				;;
			esac
695
			CF_APPEND_TEXT(cf_new_cppflags,$cf_add_cflags)
696 697 698
			;;
		esac
		;;
699
	(*)
700
		CF_APPEND_TEXT(cf_new_cflags,$cf_add_cflags)
701 702
		;;
	esac
703
	;;
704
(yes)
705
	CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags)
706 707 708

	cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'`

709
	test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \
710 711
		&& test -z "${cf_tst_cflags}" \
		&& cf_fix_cppflags=no
712 713
	;;
esac
714
done
715 716

if test -n "$cf_new_cflags" ; then
717
	ifelse([$2],,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)])
718
	CF_APPEND_TEXT(CFLAGS,$cf_new_cflags)
719 720 721
fi

if test -n "$cf_new_cppflags" ; then
722
	ifelse([$2],,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)])
723
	CF_APPEND_TEXT(CPPFLAGS,$cf_new_cppflags)
724 725
fi

726
if test -n "$cf_new_extra_cppflags" ; then
727
	ifelse([$2],,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)])
728
	CF_APPEND_TEXT(EXTRA_CPPFLAGS,$cf_new_extra_cppflags)
729 730 731 732
fi

AC_SUBST(EXTRA_CPPFLAGS)

733 734
])dnl
dnl ---------------------------------------------------------------------------
735
dnl CF_ADD_INCDIR version: 14 updated: 2015/05/25 20:53:04
736
dnl -------------
737 738
dnl Add an include-directory to $CPPFLAGS.  Don't add /usr/include, since it's
dnl redundant.  We don't normally need to add -I/usr/local/include for gcc,
739
dnl but old versions (and some misinstalled ones) need that.  To make things
740
dnl worse, gcc 3.x may give error messages if -I/usr/local/include is added to
741
dnl the include-path).
742 743
AC_DEFUN([CF_ADD_INCDIR],
[
744 745 746 747
if test -n "$1" ; then
  for cf_add_incdir in $1
  do
	while test $cf_add_incdir != /usr/include
748
	do
749 750 751 752 753 754 755 756 757 758 759 760 761
	  if test -d $cf_add_incdir
	  then
		cf_have_incdir=no
		if test -n "$CFLAGS$CPPFLAGS" ; then
		  # a loop is needed to ensure we can add subdirs of existing dirs
		  for cf_test_incdir in $CFLAGS $CPPFLAGS ; do
			if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then
			  cf_have_incdir=yes; break
			fi
		  done
		fi

		if test "$cf_have_incdir" = no ; then
762
		  if test "$cf_add_incdir" = /usr/local/include ; then
763 764
			if test "$GCC" = yes
			then
765 766 767 768 769 770 771
			  cf_save_CPPFLAGS=$CPPFLAGS
			  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
			  AC_TRY_COMPILE([#include <stdio.h>],
				  [printf("Hello")],
				  [],
				  [cf_have_incdir=yes])
			  CPPFLAGS=$cf_save_CPPFLAGS
772
			fi
773 774 775 776
		  fi
		fi

		if test "$cf_have_incdir" = no ; then
777
		  CF_VERBOSE(adding $cf_add_incdir to include-path)
778
		  ifelse([$2],,CPPFLAGS,[$2])="$ifelse([$2],,CPPFLAGS,[$2]) -I$cf_add_incdir"
779

780 781 782
		  cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'`
		  test "$cf_top_incdir" = "$cf_add_incdir" && break
		  cf_add_incdir="$cf_top_incdir"
783 784 785
		else
		  break
		fi
786 787
	  else
		break
788
	  fi
789
	done
790 791 792 793
  done
fi
])dnl
dnl ---------------------------------------------------------------------------
794 795 796 797 798 799 800 801
dnl CF_ADD_LIB version: 2 updated: 2010/06/02 05:03:05
dnl ----------
dnl Add a library, used to enforce consistency.
dnl
dnl $1 = library to add, without the "-l"
dnl $2 = variable to update (default $LIBS)
AC_DEFUN([CF_ADD_LIB],[CF_ADD_LIBS(-l$1,ifelse($2,,LIBS,[$2]))])dnl
dnl ---------------------------------------------------------------------------
802
dnl CF_ADD_LIBDIR version: 10 updated: 2015/04/18 08:56:57
803 804 805 806 807 808 809 810 811 812 813
dnl -------------
dnl	Adds to the library-path
dnl
dnl	Some machines have trouble with multiple -L options.
dnl
dnl $1 is the (list of) directory(s) to add
dnl $2 is the optional name of the variable to update (default LDFLAGS)
dnl
AC_DEFUN([CF_ADD_LIBDIR],
[
if test -n "$1" ; then
814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834
	for cf_add_libdir in $1
	do
		if test $cf_add_libdir = /usr/lib ; then
			:
		elif test -d $cf_add_libdir
		then
			cf_have_libdir=no
			if test -n "$LDFLAGS$LIBS" ; then
				# a loop is needed to ensure we can add subdirs of existing dirs
				for cf_test_libdir in $LDFLAGS $LIBS ; do
					if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then
						cf_have_libdir=yes; break
					fi
				done
			fi
			if test "$cf_have_libdir" = no ; then
				CF_VERBOSE(adding $cf_add_libdir to library-path)
				ifelse([$2],,LDFLAGS,[$2])="-L$cf_add_libdir $ifelse([$2],,LDFLAGS,[$2])"
			fi
		fi
	done
835 836 837
fi
])dnl
dnl ---------------------------------------------------------------------------
838
dnl CF_ADD_LIBS version: 2 updated: 2014/07/13 14:33:27
839
dnl -----------
840 841 842
dnl Add one or more libraries, used to enforce consistency.  Libraries are
dnl prepended to an existing list, since their dependencies are assumed to
dnl already exist in the list.
843 844 845
dnl
dnl $1 = libraries to add, with the "-l", etc.
dnl $2 = variable to update (default $LIBS)
846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862
AC_DEFUN([CF_ADD_LIBS],[
cf_add_libs="$1"
# Filter out duplicates - this happens with badly-designed ".pc" files...
for cf_add_1lib in [$]ifelse($2,,LIBS,[$2])
do
	for cf_add_2lib in $cf_add_libs
	do
		if test "x$cf_add_1lib" = "x$cf_add_2lib"
		then
			cf_add_1lib=
			break
		fi
	done
	test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib"
done
ifelse($2,,LIBS,[$2])="$cf_add_libs"
])dnl
863
dnl ---------------------------------------------------------------------------
864
dnl CF_ADD_LIB_AFTER version: 3 updated: 2013/07/09 21:27:22
865 866 867 868 869 870 871 872
dnl ----------------
dnl Add a given library after another, e.g., following the one it satisfies a
dnl dependency for.
dnl
dnl $1 = the first library
dnl $2 = its dependency
AC_DEFUN([CF_ADD_LIB_AFTER],[
CF_VERBOSE(...before $LIBS)
873
LIBS=`echo "$LIBS" | sed -e "s/[[ 	]][[ 	]]*/ /g" -e "s%$1 %$1 $2 %" -e 's%  % %g'`
874 875 876
CF_VERBOSE(...after  $LIBS)
])dnl
dnl ---------------------------------------------------------------------------
877
dnl CF_ADD_OPTIONAL_PATH version: 3 updated: 2015/05/10 19:52:14
878 879 880 881 882 883 884
dnl --------------------
dnl Add an optional search-path to the compile/link variables.
dnl See CF_WITH_PATH
dnl
dnl $1 = shell variable containing the result of --with-XXX=[DIR]
dnl $2 = module to look for.
AC_DEFUN([CF_ADD_OPTIONAL_PATH],[
885 886 887 888 889 890 891 892 893
case "$1" in
(no)
	;;
(yes)
	;;
(*)
	CF_ADD_SEARCHPATH([$1], [AC_MSG_ERROR(cannot find $2 under $1)])
	;;
esac
894 895
])dnl
dnl ---------------------------------------------------------------------------
896
dnl CF_ADD_SEARCHPATH version: 5 updated: 2009/01/11 20:40:21
897 898 899 900 901 902 903 904 905 906
dnl -----------------
dnl Set $CPPFLAGS and $LDFLAGS with the directories given via the parameter.
dnl They can be either the common root of include- and lib-directories, or the
dnl lib-directory (to allow for things like lib64 directories).
dnl See also CF_FIND_LINKAGE.
dnl
dnl $1 is the list of colon-separated directory names to search.
dnl $2 is the action to take if a parameter does not yield a directory.
AC_DEFUN([CF_ADD_SEARCHPATH],
[
907 908
AC_REQUIRE([CF_PATHSEP])
for cf_searchpath in `echo "$1" | tr $PATH_SEPARATOR ' '`; do
909 910 911 912 913 914 915 916 917 918 919 920 921 922
	if test -d $cf_searchpath/include; then
		CF_ADD_INCDIR($cf_searchpath/include)
	elif test -d $cf_searchpath/../include ; then
		CF_ADD_INCDIR($cf_searchpath/../include)
	ifelse([$2],,,[else
$2])
	fi
	if test -d $cf_searchpath/lib; then
		CF_ADD_LIBDIR($cf_searchpath/lib)
	elif test -d $cf_searchpath ; then
		CF_ADD_LIBDIR($cf_searchpath)
	ifelse([$2],,,[else
$2])
	fi
923
done
924 925
])
dnl ---------------------------------------------------------------------------
926
dnl CF_ADD_SUBDIR_PATH version: 4 updated: 2013/10/08 17:47:05
927 928 929 930 931 932 933 934 935
dnl ------------------
dnl Append to a search-list for a nonstandard header/lib-file
dnl	$1 = the variable to return as result
dnl	$2 = the package name
dnl	$3 = the subdirectory, e.g., bin, include or lib
dnl $4 = the directory under which we will test for subdirectories
dnl $5 = a directory that we do not want $4 to match
AC_DEFUN([CF_ADD_SUBDIR_PATH],
[
936
test "x$4" != "x$5" && \
937
test -d "$4" && \
938
ifelse([$5],NONE,,[(test -z "$5" || test x$5 = xNONE || test "x$4" != "x$5") &&]) {
939 940 941 942 943 944 945
	test -n "$verbose" && echo "	... testing for $3-directories under $4"
	test -d $4/$3 &&          $1="[$]$1 $4/$3"
	test -d $4/$3/$2 &&       $1="[$]$1 $4/$3/$2"
	test -d $4/$3/$2/$3 &&    $1="[$]$1 $4/$3/$2/$3"
	test -d $4/$2/$3 &&       $1="[$]$1 $4/$2/$3"
	test -d $4/$2/$3/$2 &&    $1="[$]$1 $4/$2/$3/$2"
}
946 947
])dnl
dnl ---------------------------------------------------------------------------
948
dnl CF_ALT_CHAR_SET version: 8 updated: 2012/11/08 20:57:52
949
dnl ---------------
950 951 952 953 954 955 956 957 958 959
dnl Check for existence of alternate-character-set support in curses, so we
dnl can decide to use it for box characters.
dnl
AC_DEFUN([CF_ALT_CHAR_SET],
[
AC_MSG_CHECKING([if curses supports alternate-character set])
AC_CACHE_VAL(cf_cv_alt_char_set,[
for mapname in acs_map _acs_map
do
	AC_TRY_LINK([
960
#include <${cf_cv_ncurses_header:-curses.h}>
961 962 963 964 965 966 967
	],[chtype x = $mapname['l']; $mapname['m'] = 0],
	[cf_cv_alt_char_set=$mapname
	 break],
	[cf_cv_alt_char_set=no])
done
	])
AC_MSG_RESULT($cf_cv_alt_char_set)
968
test $cf_cv_alt_char_set != no && AC_DEFINE_UNQUOTED(ALT_CHAR_SET,$cf_cv_alt_char_set,[Define to 1 if if curses supports alternate-character set])
969 970
])dnl
dnl ---------------------------------------------------------------------------
971
dnl CF_ANSI_CC_CHECK version: 13 updated: 2012/10/06 11:17:15
972
dnl ----------------
973 974
dnl This was originally adapted from the macros 'fp_PROG_CC_STDC' and
dnl 'fp_C_PROTOTYPES' in the sharutils 4.2 distribution.
975 976
AC_DEFUN([CF_ANSI_CC_CHECK],
[
977
CF_CC_ENV_FLAGS
978

979
AC_CACHE_CHECK(for ${CC:-cc} option to accept ANSI C, cf_cv_ansi_cc,[
980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019
cf_cv_ansi_cc=no
cf_save_CFLAGS="$CFLAGS"
cf_save_CPPFLAGS="$CPPFLAGS"
# Don't try gcc -ansi; that turns off useful extensions and
# breaks some systems' header files.
# AIX			-qlanglvl=ansi
# Ultrix and OSF/1	-std1
# HP-UX			-Aa -D_HPUX_SOURCE
# SVR4			-Xc
# UnixWare 1.2		(cannot use -Xc, since ANSI/POSIX clashes)
for cf_arg in "-DCC_HAS_PROTOS" \
	"" \
	-qlanglvl=ansi \
	-std1 \
	-Ae \
	"-Aa -D_HPUX_SOURCE" \
	-Xc
do
	CF_ADD_CFLAGS($cf_arg)
	AC_TRY_COMPILE(
[
#ifndef CC_HAS_PROTOS
#if !defined(__STDC__) || (__STDC__ != 1)
choke me
#endif
#endif
],[
	int test (int i, double x);
	struct s1 {int (*f) (int a);};
	struct s2 {int (*f) (double a);};],
	[cf_cv_ansi_cc="$cf_arg"; break])
done
CFLAGS="$cf_save_CFLAGS"
CPPFLAGS="$cf_save_CPPFLAGS"
])

if test "$cf_cv_ansi_cc" != "no"; then
if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then
	CF_ADD_CFLAGS($cf_cv_ansi_cc)
else
1020
	AC_DEFINE(CC_HAS_PROTOS,1,[Define to 1 if C compiler supports prototypes])
1021 1022 1023 1024
fi
fi
])dnl
dnl ---------------------------------------------------------------------------
1025
dnl CF_ANSI_CC_REQD version: 4 updated: 2008/03/23 14:48:54
1026 1027 1028 1029 1030 1031 1032 1033
dnl ---------------
dnl For programs that must use an ANSI compiler, obtain compiler options that
dnl will make it recognize prototypes.  We'll do preprocessor checks in other
dnl macros, since tools such as unproto can fake prototypes, but only part of
dnl the preprocessor.
AC_DEFUN([CF_ANSI_CC_REQD],
[AC_REQUIRE([CF_ANSI_CC_CHECK])
if test "$cf_cv_ansi_cc" = "no"; then
1034
	AC_MSG_ERROR(
1035 1036 1037 1038 1039 1040 1041 1042
[Your compiler does not appear to recognize prototypes.
You have the following choices:
	a. adjust your compiler options
	b. get an up-to-date compiler
	c. use a wrapper such as unproto])
fi
])dnl
dnl ---------------------------------------------------------------------------
1043 1044 1045 1046 1047 1048 1049 1050 1051 1052
dnl CF_APPEND_TEXT version: 1 updated: 2017/02/25 18:58:55
dnl --------------
dnl use this macro for appending text without introducing an extra blank at
dnl the beginning
define([CF_APPEND_TEXT],
[
	test -n "[$]$1" && $1="[$]$1 "
	$1="[$]{$1}$2"
])dnl
dnl ---------------------------------------------------------------------------
1053 1054
dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31
dnl --------------
1055 1056 1057 1058
dnl Allow user to disable a normally-on option.
AC_DEFUN([CF_ARG_DISABLE],
[CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl
dnl ---------------------------------------------------------------------------
1059 1060
dnl CF_ARG_ENABLE version: 3 updated: 1999/03/30 17:24:31
dnl -------------
1061 1062 1063 1064
dnl Allow user to enable a normally-off option.
AC_DEFUN([CF_ARG_ENABLE],
[CF_ARG_OPTION($1,[$2],[$3],[$4],no)])dnl
dnl ---------------------------------------------------------------------------
1065
dnl CF_ARG_OPTION version: 5 updated: 2015/05/10 19:52:14
1066
dnl -------------
1067 1068 1069 1070 1071 1072 1073 1074 1075 1076
dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus
dnl values.
dnl
dnl Parameters:
dnl $1 = option name
dnl $2 = help-string
dnl $3 = action to perform if option is not default
dnl $4 = action if perform if option is default
dnl $5 = default option value (either 'yes' or 'no')
AC_DEFUN([CF_ARG_OPTION],
1077
[AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes)
1078
	if test "$enableval" != "$5" ; then
1079 1080
ifelse([$3],,[    :]dnl
,[    $3]) ifelse([$4],,,[
1081 1082 1083 1084
	else
		$4])
	fi],[enableval=$5 ifelse([$4],,,[
	$4
1085
])dnl
1086
])])dnl
1087
dnl ---------------------------------------------------------------------------
1088
dnl CF_AR_FLAGS version: 6 updated: 2015/10/10 15:25:05
1089 1090
dnl -----------
dnl Check for suitable "ar" (archiver) options for updating an archive.
1091 1092 1093 1094
dnl
dnl In particular, handle some obsolete cases where the "-" might be omitted,
dnl as well as a workaround for breakage of make's archive rules by the GNU
dnl binutils "ar" program.
1095 1096 1097 1098 1099
AC_DEFUN([CF_AR_FLAGS],[
AC_REQUIRE([CF_PROG_AR])

AC_CACHE_CHECK(for options to update archives, cf_cv_ar_flags,[
	cf_cv_ar_flags=unknown
1100
	for cf_ar_flags in -curvU -curv curv -crv crv -cqv cqv -rv rv
1101
	do
1102 1103 1104 1105 1106 1107 1108 1109 1110 1111

		# check if $ARFLAGS already contains this choice
		if test "x$ARFLAGS" != "x" ; then
			cf_check_ar_flags=`echo "x$ARFLAGS" | sed -e "s/$cf_ar_flags\$//" -e "s/$cf_ar_flags / /"`
			if test "x$ARFLAGS" != "$cf_check_ar_flags" ; then
				cf_cv_ar_flags=
				break
			fi
		fi

1112 1113 1114 1115 1116 1117 1118 1119
		rm -f conftest.$ac_cv_objext
		rm -f conftest.a

		cat >conftest.$ac_ext <<EOF
#line __oline__ "configure"
int	testdata[[3]] = { 123, 456, 789 };
EOF
		if AC_TRY_EVAL(ac_compile) ; then
1120 1121
			echo "$AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext" >&AC_FD_CC
			$AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext 2>&AC_FD_CC 1>/dev/null
1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132
			if test -f conftest.a ; then
				cf_cv_ar_flags=$cf_ar_flags
				break
			fi
		else
			CF_VERBOSE(cannot compile test-program)
			break
		fi
	done
	rm -f conftest.a conftest.$ac_ext conftest.$ac_cv_objext
])
1133 1134 1135 1136 1137 1138 1139 1140 1141 1142

if test -n "$ARFLAGS" ; then
	if test -n "$cf_cv_ar_flags" ; then
		ARFLAGS="$ARFLAGS $cf_cv_ar_flags"
	fi
else
	ARFLAGS=$cf_cv_ar_flags
fi

AC_SUBST(ARFLAGS)
1143 1144
])
dnl ---------------------------------------------------------------------------
1145
dnl CF_BOOL_DEFS version: 5 updated: 2012/11/08 20:57:52
1146
dnl ------------
1147 1148 1149 1150 1151 1152
dnl Check if curses.h defines TRUE/FALSE (it does under SVr4).
AC_DEFUN([CF_BOOL_DEFS],
[
AC_MSG_CHECKING(if TRUE/FALSE are defined)
AC_CACHE_VAL(cf_cv_bool_defs,[
AC_TRY_COMPILE([
1153
#include <${cf_cv_ncurses_header:-curses.h}>
1154 1155 1156 1157 1158
#include <stdio.h>],[int x = TRUE, y = FALSE],
	[cf_cv_bool_defs=yes],
	[cf_cv_bool_defs=no])])
AC_MSG_RESULT($cf_cv_bool_defs)
if test "$cf_cv_bool_defs" = no ; then
1159 1160
	AC_DEFINE(TRUE,(1),[Define to TRUE if curses.h does not define])
	AC_DEFINE(FALSE,(0),[Define to FALSE if curses.h does not define])
1161 1162 1163
fi
])dnl
dnl ---------------------------------------------------------------------------
1164
dnl CF_BUILD_CC version: 7 updated: 2012/10/06 15:31:55
1165 1166 1167 1168 1169 1170 1171 1172 1173
dnl -----------
dnl If we're cross-compiling, allow the user to override the tools and their
dnl options.  The configure script is oriented toward identifying the host
dnl compiler, etc., but we need a build compiler to generate parts of the
dnl source.
dnl
dnl $1 = default for $CPPFLAGS
dnl $2 = default for $LIBS
AC_DEFUN([CF_BUILD_CC],[
1174 1175
CF_ACVERSION_CHECK(2.52,,
	[AC_REQUIRE([CF_PROG_EXT])])
1176
if test "$cross_compiling" = yes ; then
1177

1178 1179 1180 1181 1182 1183 1184
	# defaults that we might want to override
	: ${BUILD_CFLAGS:=''}
	: ${BUILD_CPPFLAGS:='ifelse([$1],,,[$1])'}
	: ${BUILD_LDFLAGS:=''}
	: ${BUILD_LIBS:='ifelse([$2],,,[$2])'}
	: ${BUILD_EXEEXT:='$x'}
	: ${BUILD_OBJEXT:='o'}
1185

1186 1187 1188
	AC_ARG_WITH(build-cc,
		[  --with-build-cc=XXX     the build C compiler ($BUILD_CC)],
		[BUILD_CC="$withval"],
1189 1190 1191 1192 1193
		[AC_CHECK_PROGS(BUILD_CC, gcc cc cl)])
	AC_MSG_CHECKING(for native build C compiler)
	AC_MSG_RESULT($BUILD_CC)

	AC_MSG_CHECKING(for native build C preprocessor)
1194 1195 1196
	AC_ARG_WITH(build-cpp,
		[  --with-build-cpp=XXX    the build C preprocessor ($BUILD_CPP)],
		[BUILD_CPP="$withval"],
1197
		[BUILD_CPP='${BUILD_CC} -E'])
1198 1199 1200
	AC_MSG_RESULT($BUILD_CPP)

	AC_MSG_CHECKING(for native build C flags)
1201
	AC_ARG_WITH(build-cflags,
1202
		[  --with-build-cflags=XXX the build C compiler-flags ($BUILD_CFLAGS)],
1203
		[BUILD_CFLAGS="$withval"])
1204 1205 1206
	AC_MSG_RESULT($BUILD_CFLAGS)

	AC_MSG_CHECKING(for native build C preprocessor-flags)
1207
	AC_ARG_WITH(build-cppflags,
1208
		[  --with-build-cppflags=XXX the build C preprocessor-flags ($BUILD_CPPFLAGS)],
1209
		[BUILD_CPPFLAGS="$withval"])
1210 1211 1212
	AC_MSG_RESULT($BUILD_CPPFLAGS)

	AC_MSG_CHECKING(for native build linker-flags)
1213
	AC_ARG_WITH(build-ldflags,
1214
		[  --with-build-ldflags=XXX the build linker-flags ($BUILD_LDFLAGS)],
1215
		[BUILD_LDFLAGS="$withval"])
1216 1217 1218
	AC_MSG_RESULT($BUILD_LDFLAGS)

	AC_MSG_CHECKING(for native build linker-libraries)
1219
	AC_ARG_WITH(build-libs,
1220
		[  --with-build-libs=XXX   the build libraries (${BUILD_LIBS})],
1221
		[BUILD_LIBS="$withval"])
1222 1223
	AC_MSG_RESULT($BUILD_LIBS)

1224 1225 1226
	# this assumes we're on Unix.
	BUILD_EXEEXT=
	BUILD_OBJEXT=o
1227

1228
	: ${BUILD_CC:='${CC}'}
1229

1230
	if ( test "$BUILD_CC" = "$CC" || test "$BUILD_CC" = '${CC}' ) ; then
1231 1232 1233 1234
		AC_MSG_ERROR([Cross-build requires two compilers.
Use --with-build-cc to specify the native compiler.])
	fi

1235
else
1236 1237 1238 1239 1240 1241
	: ${BUILD_CC:='${CC}'}
	: ${BUILD_CPP:='${CPP}'}
	: ${BUILD_CFLAGS:='${CFLAGS}'}
	: ${BUILD_CPPFLAGS:='${CPPFLAGS}'}
	: ${BUILD_LDFLAGS:='${LDFLAGS}'}
	: ${BUILD_LIBS:='${LIBS}'}
1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255
	: ${BUILD_EXEEXT:='$x'}
	: ${BUILD_OBJEXT:='o'}
fi

AC_SUBST(BUILD_CC)
AC_SUBST(BUILD_CPP)
AC_SUBST(BUILD_CFLAGS)
AC_SUBST(BUILD_CPPFLAGS)
AC_SUBST(BUILD_LDFLAGS)
AC_SUBST(BUILD_LIBS)
AC_SUBST(BUILD_EXEEXT)
AC_SUBST(BUILD_OBJEXT)
])dnl
dnl ---------------------------------------------------------------------------
1256
dnl CF_BUNDLED_INTL version: 18 updated: 2015/05/10 19:52:14
1257
dnl ---------------
1258 1259 1260 1261
dnl Top-level macro for configuring an application with a bundled copy of
dnl the intl and po directories for gettext.
dnl
dnl $1 specifies either Makefile or makefile, defaulting to the former.
1262 1263 1264
dnl $2 if nonempty sets the option to --enable-nls rather than to --disable-nls
dnl
dnl Sets variables which can be used to substitute in makefiles:
1265 1266
dnl	GT_YES       - "#" comment unless building intl library, otherwise empty
dnl	GT_NO        - "#" comment if building intl library, otherwise empty
1267 1268 1269
dnl	INTLDIR_MAKE - to make ./intl directory
dnl	MSG_DIR_MAKE - to make ./po directory
dnl	SUB_MAKEFILE - list of makefiles in ./intl, ./po directories
1270 1271
dnl
dnl Defines:
1272
dnl	HAVE_LIBGETTEXT_H if we're using ./intl
1273
dnl	NLS_TEXTDOMAIN
1274 1275 1276 1277
dnl
dnl Environment:
dnl	ALL_LINGUAS if set, lists the root names of the ".po" files.
dnl	CONFIG_H assumed to be "config.h"
1278
dnl	PACKAGE must be set, used as default for textdomain
1279 1280
dnl	VERSION may be set, otherwise extract from "VERSION" file.
dnl
1281 1282 1283 1284 1285 1286 1287 1288
AC_DEFUN([CF_BUNDLED_INTL],[
cf_makefile=ifelse($1,,Makefile,$1)

dnl Set of available languages (based on source distribution).  Note that
dnl setting $LINGUAS overrides $ALL_LINGUAS.  Some environments set $LINGUAS
dnl rather than $LC_ALL
test -z "$ALL_LINGUAS" && ALL_LINGUAS=`test -d $srcdir/po && cd $srcdir/po && echo *.po|sed -e 's/\.po//g' -e 's/*//'`

1289
# Allow override of "config.h" definition:
1290
: ${CONFIG_H:=config.h}
1291 1292
AC_SUBST(CONFIG_H)

1293 1294 1295 1296
if test -z "$PACKAGE" ; then
	AC_MSG_ERROR([[CF_BUNDLED_INTL] used without setting [PACKAGE] variable])
fi

1297 1298 1299 1300 1301 1302 1303 1304 1305 1306
if test -z "$VERSION" ; then
if test -f $srcdir/VERSION ; then
	VERSION=`sed -e '2,$d' $srcdir/VERSION|cut -f1`
else
	VERSION=unknown
fi
fi
AC_SUBST(VERSION)

AM_GNU_GETTEXT(,,,[$2])
1307

1308 1309 1310 1311 1312
if test "$USE_NLS" = yes ; then
	AC_ARG_WITH(textdomain,
		[  --with-textdomain=PKG   NLS text-domain (default is package name)],
		[NLS_TEXTDOMAIN=$withval],
		[NLS_TEXTDOMAIN=$PACKAGE])
1313
	AC_DEFINE_UNQUOTED(NLS_TEXTDOMAIN,"$NLS_TEXTDOMAIN",[Define to the nls textdomain value])
1314 1315 1316
	AC_SUBST(NLS_TEXTDOMAIN)
fi

1317 1318 1319
INTLDIR_MAKE=
MSG_DIR_MAKE=
SUB_MAKEFILE=
1320 1321 1322 1323

dnl this updates SUB_MAKEFILE and MSG_DIR_MAKE:
CF_OUR_MESSAGES($1)

1324
if test "$USE_INCLUDED_LIBINTL" = yes ; then
1325
	if test "$nls_cv_force_use_gnu_gettext" = yes ; then
1326
		:
1327
	elif test "$nls_cv_use_gnu_gettext" = yes ; then
1328
		:
1329 1330 1331
	else
		INTLDIR_MAKE="#"
	fi
1332
	if test -z "$INTLDIR_MAKE"; then
1333
		AC_DEFINE(HAVE_LIBGETTEXT_H,1,[Define to 1 if we have libgettext.h])
1334 1335 1336 1337 1338
		for cf_makefile in \
			$srcdir/intl/Makefile.in \
			$srcdir/intl/makefile.in
		do
			if test -f "$cf_makefile" ; then
1339
				SUB_MAKEFILE="$SUB_MAKEFILE `echo \"${cf_makefile}\"|sed -e 's,^'$srcdir/',,' -e 's/\.in$//'`:${cf_makefile}"
1340 1341 1342
				break
			fi
		done
1343 1344 1345
	fi
else
	INTLDIR_MAKE="#"
1346 1347
	if test "$USE_NLS" = yes ; then
		AC_CHECK_HEADERS(libintl.h)
1348 1349 1350 1351
	fi
fi

if test -z "$INTLDIR_MAKE" ; then
1352
	CPPFLAGS="$CPPFLAGS -I../intl"
1353 1354 1355 1356 1357 1358 1359 1360 1361 1362
fi

dnl FIXME:  we use this in lynx (the alternative is a spurious dependency upon
dnl GNU make)
if test "$BUILD_INCLUDED_LIBINTL" = yes ; then
	GT_YES="#"
	GT_NO=
else
	GT_YES=
	GT_NO="#"
1363 1364 1365 1366
fi

AC_SUBST(INTLDIR_MAKE)
AC_SUBST(MSG_DIR_MAKE)
1367 1368
AC_SUBST(GT_YES)
AC_SUBST(GT_NO)
1369 1370 1371 1372 1373 1374 1375

dnl FIXME:  the underlying AM_GNU_GETTEXT macro either needs some fixes or a
dnl little documentation.  It doesn't define anything so that we can ifdef our
dnl own code, except ENABLE_NLS, which is too vague to be of any use.

if test "$USE_INCLUDED_LIBINTL" = yes ; then
	if test "$nls_cv_force_use_gnu_gettext" = yes ; then
1376
		AC_DEFINE(HAVE_GETTEXT,1,[Define to 1 if we have gettext function])
1377
	elif test "$nls_cv_use_gnu_gettext" = yes ; then
1378
		AC_DEFINE(HAVE_GETTEXT,1,[Define to 1 if we have gettext function])
1379 1380
	fi
	if test -n "$nls_cv_header_intl" ; then
1381
		AC_DEFINE(HAVE_LIBINTL_H,1,[Define to 1 if we have header-file for libintl])
1382 1383 1384 1385
	fi
fi
])dnl
dnl ---------------------------------------------------------------------------
1386
dnl CF_CC_ENV_FLAGS version: 7 updated: 2017/02/25 18:57:40
1387 1388
dnl ---------------
dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content
1389 1390 1391 1392 1393 1394 1395 1396 1397
dnl into CC.  This will not help with broken scripts that wrap the compiler
dnl with options, but eliminates a more common category of user confusion.
dnl
dnl In particular, it addresses the problem of being able to run the C
dnl preprocessor in a consistent manner.
dnl
dnl Caveat: this also disallows blanks in the pathname for the compiler, but
dnl the nuisance of having inconsistent settings for compiler and preprocessor
dnl outweighs that limitation.
1398 1399 1400 1401 1402 1403
AC_DEFUN([CF_CC_ENV_FLAGS],
[
# This should have been defined by AC_PROG_CC
: ${CC:=cc}

AC_MSG_CHECKING(\$CC variable)
1404
case "$CC" in
1405
(*[[\ \	]]-*)
1406 1407 1408
	AC_MSG_RESULT(broken)
	AC_MSG_WARN(your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options)
	# humor him...
1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425
	cf_prog=`echo "$CC" | sed -e 's/	/ /g' -e 's/[[ ]]* / /g' -e 's/[[ ]]*[[ ]]-[[^ ]].*//'`
	cf_flags=`echo "$CC" | ${AWK:-awk} -v prog="$cf_prog" '{ printf("%s", substr([$]0,1+length(prog))); }'`
	CC="$cf_prog"
	for cf_arg in $cf_flags
	do
		case "x$cf_arg" in
		(x-[[IUDfgOW]]*)
			CF_ADD_CFLAGS($cf_arg)
			;;
		(*)
			CC="$CC $cf_arg"
			;;
		esac
	done
	CF_VERBOSE(resulting CC: '$CC')
	CF_VERBOSE(resulting CFLAGS: '$CFLAGS')
	CF_VERBOSE(resulting CPPFLAGS: '$CPPFLAGS')
1426
	;;
1427
(*)
1428 1429 1430 1431 1432 1433
	AC_MSG_RESULT(ok)
	;;
esac
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_CHECK_CACHE version: 12 updated: 2012/10/02 20:55:03
1434
dnl --------------
1435 1436 1437 1438 1439 1440 1441
dnl Check if we're accidentally using a cache from a different machine.
dnl Derive the system name, as a check for reusing the autoconf cache.
dnl
dnl If we've packaged config.guess and config.sub, run that (since it does a
dnl better job than uname).  Normally we'll use AC_CANONICAL_HOST, but allow
dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM
dnl which is useful in cross-compiles.
1442 1443 1444
dnl
dnl Note: we would use $ac_config_sub, but that is one of the places where
dnl autoconf 2.5x broke compatibility with autoconf 2.13
1445 1446
AC_DEFUN([CF_CHECK_CACHE],
[
1447
if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then
1448 1449 1450 1451 1452 1453 1454 1455
	ifelse([$1],,[AC_CANONICAL_HOST],[$1])
	system_name="$host_os"
else
	system_name="`(uname -s -r) 2>/dev/null`"
	if test -z "$system_name" ; then
		system_name="`(hostname) 2>/dev/null`"
	fi
fi
1456
test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name",[Define to the system name.])
1457 1458 1459
AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])

test -z "$system_name" && system_name="$cf_cv_system_name"
1460
test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name)
1461 1462 1463

if test ".$system_name" != ".$cf_cv_system_name" ; then
	AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name))
1464
	AC_MSG_ERROR("Please remove config.cache and try again.")
1465 1466 1467
fi
])dnl
dnl ---------------------------------------------------------------------------
1468
dnl CF_CHECK_CFLAGS version: 3 updated: 2014/07/22 05:32:57
1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479
dnl ---------------
dnl Conditionally add to $CFLAGS and $CPPFLAGS values which are derived from
dnl a build-configuration such as imake.  These have the pitfall that they
dnl often contain compiler-specific options which we cannot use, mixed with
dnl preprocessor options that we usually can.
AC_DEFUN([CF_CHECK_CFLAGS],
[
CF_VERBOSE(checking additions to CFLAGS)
cf_check_cflags="$CFLAGS"
cf_check_cppflags="$CPPFLAGS"
CF_ADD_CFLAGS($1,yes)
1480
if test "x$cf_check_cflags" != "x$CFLAGS" ; then
1481 1482
AC_TRY_LINK([#include <stdio.h>],[printf("Hello world");],,
	[CF_VERBOSE(test-compile failed.  Undoing change to \$CFLAGS)
1483
	 if test "x$cf_check_cppflags" != "x$CPPFLAGS" ; then
1484 1485 1486 1487 1488 1489
		 CF_VERBOSE(but keeping change to \$CPPFLAGS)
	 fi
	 CFLAGS="$cf_check_flags"])
fi
])dnl
dnl ---------------------------------------------------------------------------
1490
dnl CF_CHECK_ERRNO version: 12 updated: 2015/04/18 08:56:57
1491
dnl --------------
1492 1493 1494 1495 1496
dnl Check for data that is usually declared in <stdio.h> or <errno.h>, e.g.,
dnl the 'errno' variable.  Define a DECL_xxx symbol if we must declare it
dnl ourselves.
dnl
dnl $1 = the name to check
1497
dnl $2 = the assumed type
1498 1499
AC_DEFUN([CF_CHECK_ERRNO],
[
1500
AC_CACHE_CHECK(if external $1 is declared, cf_cv_dcl_$1,[
1501
	AC_TRY_COMPILE([
1502 1503 1504 1505 1506 1507
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include <stdio.h>
#include <sys/types.h>
#include <errno.h> ],
1508 1509 1510
	ifelse([$2],,int,[$2]) x = (ifelse([$2],,int,[$2])) $1,
	[cf_cv_dcl_$1=yes],
	[cf_cv_dcl_$1=no])
1511 1512
])

1513
if test "$cf_cv_dcl_$1" = no ; then
1514 1515
	CF_UPPER(cf_result,decl_$1)
	AC_DEFINE_UNQUOTED($cf_result)
1516 1517 1518
fi

# It's possible (for near-UNIX clones) that the data doesn't exist
1519
CF_CHECK_EXTERN_DATA($1,ifelse([$2],,int,[$2]))
1520 1521
])dnl
dnl ---------------------------------------------------------------------------
1522
dnl CF_CHECK_EXTERN_DATA version: 4 updated: 2015/04/18 08:56:57
1523
dnl --------------------
1524 1525 1526 1527 1528 1529
dnl Check for existence of external data in the current set of libraries.  If
dnl we can modify it, it's real enough.
dnl $1 = the name to check
dnl $2 = its type
AC_DEFUN([CF_CHECK_EXTERN_DATA],
[
1530
AC_CACHE_CHECK(if external $1 exists, cf_cv_have_$1,[
1531
	AC_TRY_LINK([
1532 1533 1534
#undef $1
extern $2 $1;
],
1535 1536 1537
	[$1 = 2],
	[cf_cv_have_$1=yes],
	[cf_cv_have_$1=no])
1538
])
1539

1540
if test "$cf_cv_have_$1" = yes ; then
1541 1542
	CF_UPPER(cf_result,have_$1)
	AC_DEFINE_UNQUOTED($cf_result)
1543 1544 1545 1546
fi

])dnl
dnl ---------------------------------------------------------------------------
1547
dnl CF_CHECK_FUNCDECL version: 7 updated: 2009/10/15 19:39:18
1548
dnl -----------------
1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561
dnl Check if a function is declared by including a set of include files.
dnl Invoke the corresponding actions according to whether it is found or not.
dnl
dnl Gcc (unlike other compilers) will only warn about the miscast assignment
dnl in the first test, but most compilers will oblige with an error in the
dnl second test.
dnl
dnl CF_CHECK_FUNCDECL(INCLUDES, FUNCTION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
AC_DEFUN([CF_CHECK_FUNCDECL],
[
AC_MSG_CHECKING([for $2 declaration])
AC_CACHE_VAL(ac_cv_func_decl_$2,
[AC_TRY_COMPILE([$1],
1562 1563
[#ifndef $2
extern	int	$2();
1564 1565
#endif],[
AC_TRY_COMPILE([$1],
1566 1567
[#ifndef $2
int	(*p)() = $2;
1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581
#endif],[
eval "ac_cv_func_decl_$2=yes"],[
eval "ac_cv_func_decl_$2=no"])],[
eval "ac_cv_func_decl_$2=yes"])])
if eval "test \"`echo '$ac_cv_func_'decl_$2`\" = yes"; then
  AC_MSG_RESULT(yes)
  ifelse([$3], , :, [$3])
else
  AC_MSG_RESULT(no)
ifelse([$4], , , [$4
])dnl
fi
])dnl
dnl ---------------------------------------------------------------------------
1582 1583
dnl CF_CHECK_FUNCDECLS version: 4 updated: 1999/03/30 12:24:31
dnl ------------------
1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598
dnl Check if functions are declared by including a set of include files.
dnl and define DECL_XXX if not.
dnl
dnl CF_CHECK_FUNCDECLS(INCLUDES, FUNCTION... [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
AC_DEFUN([CF_CHECK_FUNCDECLS],
[for ac_func in $2
do
CF_CHECK_FUNCDECL([$1], $ac_func,
[$3],
[
  CF_UPPER(ac_tr_func,DECL_$ac_func)
  AC_DEFINE_UNQUOTED($ac_tr_func) $4])dnl
done
])dnl
dnl ---------------------------------------------------------------------------
1599 1600
dnl CF_CHECK_IPV6 version: 3 updated: 2004/01/22 17:38:22
dnl -------------
1601 1602 1603 1604 1605 1606 1607 1608 1609
dnl Check for IPV6 configuration.
AC_DEFUN([CF_CHECK_IPV6],[
CF_FIND_IPV6_TYPE
CF_FIND_IPV6_LIBS

CF_FUNC_GETADDRINFO

if test "$cf_cv_getaddrinfo" != "yes"; then
	if test "$cf_cv_ipv6type" != "linux"; then
1610
		AC_MSG_WARN(
1611 1612 1613 1614 1615 1616 1617 1618 1619 1620
[You must get working getaddrinfo() function,
or you can specify "--disable-ipv6"])
	else
		AC_MSG_WARN(
[The getaddrinfo() implementation on your system seems be buggy.
You should upgrade your system library to the newest version
of GNU C library (aka glibc).])
	fi
fi

1621 1622
])dnl
dnl ---------------------------------------------------------------------------
1623
dnl CF_CHECK_SIZEOF version: 2 updated: 2015/05/09 11:00:10
1624 1625 1626 1627 1628 1629 1630 1631 1632 1633
dnl ---------------
dnl Improve on AC_CHECK_SIZEOF for cases when the build-environment is
dnl deficient, e.g., if someone tries to build in busybox.  Use the second
dnl parameter as the fallback value.
dnl
dnl By the way, 2.13/2.52 differ in AC_CHECK_SIZEOF regarding the types they
dnl can detect; the former includes only stdio.h for types while the latter
dnl includes several header files.
AC_DEFUN([CF_CHECK_SIZEOF],[
AC_CHECK_SIZEOF([$1],[$2])
1634 1635
if test "${ac_cv_type_$1+set}" = set; then
	if test "${ac_cv_sizeof_$1+set}" != set; then
1636 1637 1638 1639 1640 1641 1642
		AC_MSG_WARN(using $2 for sizeof $1)
		ac_cv_sizeof_$1=$2
	elif test "x${ac_cv_sizeof_$1}" = x0; then
		AC_MSG_WARN([sizeof $1 not found, using $2])
		ac_cv_sizeof_$1=$2
	fi
fi
1643 1644
])dnl
dnl ---------------------------------------------------------------------------
1645
dnl CF_CHECK_SSL_X509 version: 5 updated: 2014/11/30 18:19:56
1646 1647
dnl -----------------
dnl Check for X509 support in the SSL library.
1648
define([CF_CHECK_SSL_X509],[
1649 1650
AC_MSG_CHECKING(for X509 support)
AC_TRY_LINK(CF__SSL_HEAD [
1651 1652 1653 1654 1655 1656
#if defined(USE_GNUTLS_INCL)
#include <gnutls/x509.h>
#else
#include <openssl/x509.h>
#endif
],
1657
	[X509_verify_cert_error_string(X509_STORE_CTX_get_error(NULL))],
1658 1659 1660 1661 1662 1663 1664
	[cf_x509_support=yes],
	[cf_x509_support=no])
AC_MSG_RESULT($cf_x509_support)

if test "$cf_x509_support" = yes ; then
	AC_DEFINE(USE_X509_SUPPORT)
fi
1665 1666
])dnl
dnl ---------------------------------------------------------------------------
1667
dnl CF_CHECK_TYPE version: 3 updated: 2012/10/04 05:24:07
1668 1669 1670 1671 1672 1673
dnl -------------
dnl Add a 3rd parameter to AC_CHECK_TYPE, working around autoconf 2.5x's
dnl deliberate incompatibility.
dnl	$1 = name of type to check for
dnl	$2 = default type
dnl	$3 = additional #include's and related preprocessor lines.
1674 1675 1676
ifdef([m4_HAS_AC_CT_FOURARGS], [m4_undefine([m4_HAS_AC_CT_FOURARGS])])dnl
ifelse(m4_PACKAGE_VERSION, [fnord_acsalt], [],
[ifdef([m4_version_compare],[m4_define([m4_HAS_AC_CT_FOURARGS])])])dnl
1677 1678
AC_DEFUN([CF_CHECK_TYPE],
[
1679
ifdef([m4_HAS_AC_CT_FOURARGS],[
1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695
	AC_CHECK_TYPE([$1],ac_cv_type_$1=yes,ac_cv_type_$1=no,[$3])
	],[
	AC_MSG_CHECKING(for $1)
	AC_TRY_COMPILE([
#if STDC_HEADERS
#include <stdlib.h>
#include <stddef.h>
#endif
$3
],[
	static $1 dummy; if (sizeof(dummy)) return 0; else return 1;],
	ac_cv_type_$1=yes,
	ac_cv_type_$1=no)
	AC_MSG_RESULT($ac_cv_type_$1)
])dnl
if test $ac_cv_type_$1 = no; then
1696
	AC_DEFINE($1, $2, Define to $2 if $1 is not declared)
1697
fi
1698 1699
])dnl
dnl ---------------------------------------------------------------------------
1700
dnl CF_CLANG_COMPILER version: 2 updated: 2013/11/19 19:23:35
1701 1702 1703 1704 1705 1706 1707 1708 1709 1710
dnl -----------------
dnl Check if the given compiler is really clang.  clang's C driver defines
dnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does
dnl not ignore some gcc options.
dnl
dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
dnl ensure that it is not mistaken for gcc/g++.  It is normally invoked from
dnl the wrappers for gcc and g++ warnings.
dnl
dnl $1 = GCC (default) or GXX
1711
dnl $2 = CLANG_COMPILER (default)
1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732
dnl $3 = CFLAGS (default) or CXXFLAGS
AC_DEFUN([CF_CLANG_COMPILER],[
ifelse([$2],,CLANG_COMPILER,[$2])=no

if test "$ifelse([$1],,[$1],GCC)" = yes ; then
	AC_MSG_CHECKING(if this is really Clang ifelse([$1],GXX,C++,C) compiler)
	cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])"
	ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -Qunused-arguments"
	AC_TRY_COMPILE([],[
#ifdef __clang__
#else
make an error
#endif
],[ifelse([$2],,CLANG_COMPILER,[$2])=yes
cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments"
],[])
	ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
	AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2]))
fi
])
dnl ---------------------------------------------------------------------------
1733
dnl CF_COLOR_CURSES version: 8 updated: 2012/11/08 20:57:52
1734
dnl ---------------
1735 1736 1737 1738 1739 1740 1741 1742 1743
dnl Check if curses supports color.  (Note that while SVr3 curses supports
dnl color, it does this differently from SVr4 curses; more work would be needed
dnl to accommodate SVr3).
dnl
AC_DEFUN([CF_COLOR_CURSES],
[
AC_MSG_CHECKING(if curses supports color attributes)
AC_CACHE_VAL(cf_cv_color_curses,[
	AC_TRY_LINK([
1744
#include <${cf_cv_ncurses_header:-curses.h}>
1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757
],
	[chtype x = COLOR_BLUE;
	 has_colors();
	 start_color();
#ifndef NCURSES_BROKEN
	 wbkgd(curscr, getbkgd(stdscr)); /* X/Open XPG4 aka SVr4 Curses */
#endif
	],
	[cf_cv_color_curses=yes],
	[cf_cv_color_curses=no])
	])
AC_MSG_RESULT($cf_cv_color_curses)
if test $cf_cv_color_curses = yes ; then
1758 1759
	AC_DEFINE(COLOR_CURSES,1,[Define to 1 if if curses supports color attributes])
	test ".$cf_cv_ncurses_broken" != .yes && AC_DEFINE(HAVE_GETBKGD,1,[Define to 1 if curses has getbkgd function])
1760
fi
1761
])dnl
1762
dnl ---------------------------------------------------------------------------
1763
dnl CF_CURSES_CHTYPE version: 8 updated: 2012/10/06 08:57:51
1764 1765 1766 1767 1768 1769
dnl ----------------
dnl Test if curses defines 'chtype' (usually a 'long' type for SysV curses).
AC_DEFUN([CF_CURSES_CHTYPE],
[
AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
AC_CACHE_CHECK(for chtype typedef,cf_cv_chtype_decl,[
1770
	AC_TRY_COMPILE([#include <${cf_cv_ncurses_header:-curses.h}>],
1771 1772 1773 1774
		[chtype foo],
		[cf_cv_chtype_decl=yes],
		[cf_cv_chtype_decl=no])])
if test $cf_cv_chtype_decl = yes ; then
1775
	AC_DEFINE(HAVE_TYPE_CHTYPE,1,[Define to 1 if chtype is declared])
1776
	AC_CACHE_CHECK(if chtype is scalar or struct,cf_cv_chtype_type,[
1777
		AC_TRY_COMPILE([#include <${cf_cv_ncurses_header:-curses.h}>],
1778 1779 1780 1781
			[chtype foo; long x = foo],
			[cf_cv_chtype_type=scalar],
			[cf_cv_chtype_type=struct])])
	if test $cf_cv_chtype_type = scalar ; then
1782
		AC_DEFINE(TYPE_CHTYPE_IS_SCALAR,1,[Define to 1 if chtype is a scaler/integer])
1783 1784 1785 1786
	fi
fi
])dnl
dnl ---------------------------------------------------------------------------
1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798
dnl CF_CURSES_CONFIG version: 2 updated: 2006/10/29 11:06:27
dnl ----------------
dnl Tie together the configure-script macros for curses.  It may be ncurses,
dnl but unless asked, we do not make a special search for ncurses.  However,
dnl still check for the ncurses version number, for use in other macros.
AC_DEFUN([CF_CURSES_CONFIG],
[
CF_CURSES_CPPFLAGS
CF_NCURSES_VERSION
CF_CURSES_LIBS
])dnl
dnl ---------------------------------------------------------------------------
1799
dnl CF_CURSES_CPPFLAGS version: 12 updated: 2015/04/15 19:08:48