1217309Snwhitehorndnl macros used for DIALOG configure script
2255852Sdteskednl $Id: aclocal.m4,v 1.94 2013/09/22 14:26:24 tom Exp $
3220749Snwhitehorndnl ---------------------------------------------------------------------------
4255852Sdteskednl Copyright 1999-2012,2013 -- Thomas E. Dickey
5217309Snwhitehorndnl
6220749Snwhitehorndnl Permission is hereby granted, free of charge, to any person obtaining a
7220749Snwhitehorndnl copy of this software and associated documentation files (the
8220749Snwhitehorndnl "Software"), to deal in the Software without restriction, including
9220749Snwhitehorndnl without limitation the rights to use, copy, modify, merge, publish,
10220749Snwhitehorndnl distribute, distribute with modifications, sublicense, and/or sell
11220749Snwhitehorndnl copies of the Software, and to permit persons to whom the Software is
12220749Snwhitehorndnl furnished to do so, subject to the following conditions:
13220749Snwhitehorndnl 
14220749Snwhitehorndnl The above copyright notice and this permission notice shall be included
15220749Snwhitehorndnl in all copies or portions of the Software.
16220749Snwhitehorndnl 
17220749Snwhitehorndnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18220749Snwhitehorndnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19220749Snwhitehorndnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20220749Snwhitehorndnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
21220749Snwhitehorndnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
22220749Snwhitehorndnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
23220749Snwhitehorndnl THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24220749Snwhitehorndnl 
25220749Snwhitehorndnl Except as contained in this notice, the name(s) of the above copyright
26220749Snwhitehorndnl holders shall not be used in advertising or otherwise to promote the
27220749Snwhitehorndnl sale, use or other dealings in this Software without prior written
28220749Snwhitehorndnl authorization.
29220749Snwhitehorndnl
30217309Snwhitehorndnl see
31217309Snwhitehorndnl http://invisible-island.net/autoconf/ 
32217309Snwhitehorndnl ---------------------------------------------------------------------------
33217309Snwhitehorndnl ---------------------------------------------------------------------------
34251843Sbaptdnl AM_GNU_GETTEXT version: 13 updated: 2012/11/09 05:47:26
35217309Snwhitehorndnl --------------
36217309Snwhitehorndnl Usage: Just like AM_WITH_NLS, which see.
37217309SnwhitehornAC_DEFUN([AM_GNU_GETTEXT],
38217309Snwhitehorn  [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
39217309Snwhitehorn   AC_REQUIRE([AC_CANONICAL_HOST])dnl
40217309Snwhitehorn   AC_REQUIRE([AC_PROG_RANLIB])dnl
41217309Snwhitehorn   AC_REQUIRE([AC_HEADER_STDC])dnl
42217309Snwhitehorn   AC_REQUIRE([AC_C_INLINE])dnl
43217309Snwhitehorn   AC_REQUIRE([AC_TYPE_OFF_T])dnl
44217309Snwhitehorn   AC_REQUIRE([AC_TYPE_SIZE_T])dnl
45217309Snwhitehorn   AC_REQUIRE([AC_FUNC_ALLOCA])dnl
46217309Snwhitehorn   AC_REQUIRE([AC_FUNC_MMAP])dnl
47217309Snwhitehorn   AC_REQUIRE([jm_GLIBC21])dnl
48251843Sbapt   AC_REQUIRE([CF_PROG_CC])dnl
49217309Snwhitehorn
50217309Snwhitehorn   AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
51217309Snwhitehornstdlib.h string.h unistd.h sys/param.h])
52217309Snwhitehorn   AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \
53217309Snwhitehorngetgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \
54217309Snwhitehornstrdup strtoul tsearch __argz_count __argz_stringify __argz_next])
55217309Snwhitehorn
56217309Snwhitehorn   AM_ICONV
57217309Snwhitehorn   AM_LANGINFO_CODESET
58217309Snwhitehorn   AM_LC_MESSAGES
59217309Snwhitehorn   AM_WITH_NLS([$1],[$2],[$3],[$4])
60217309Snwhitehorn
61217309Snwhitehorn   if test "x$CATOBJEXT" != "x"; then
62217309Snwhitehorn     if test "x$ALL_LINGUAS" = "x"; then
63217309Snwhitehorn       LINGUAS=
64217309Snwhitehorn     else
65217309Snwhitehorn       AC_MSG_CHECKING(for catalogs to be installed)
66217309Snwhitehorn       NEW_LINGUAS=
67217309Snwhitehorn       for presentlang in $ALL_LINGUAS; do
68217309Snwhitehorn         useit=no
69217309Snwhitehorn         for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do
70217309Snwhitehorn           # Use the presentlang catalog if desiredlang is
71217309Snwhitehorn           #   a. equal to presentlang, or
72217309Snwhitehorn           #   b. a variant of presentlang (because in this case,
73217309Snwhitehorn           #      presentlang can be used as a fallback for messages
74217309Snwhitehorn           #      which are not translated in the desiredlang catalog).
75217309Snwhitehorn           case "$desiredlang" in
76217309Snwhitehorn             "$presentlang"*) useit=yes;;
77217309Snwhitehorn           esac
78217309Snwhitehorn         done
79217309Snwhitehorn         if test $useit = yes; then
80217309Snwhitehorn           NEW_LINGUAS="$NEW_LINGUAS $presentlang"
81217309Snwhitehorn         fi
82217309Snwhitehorn       done
83217309Snwhitehorn       LINGUAS=$NEW_LINGUAS
84217309Snwhitehorn       AC_MSG_RESULT($LINGUAS)
85217309Snwhitehorn     fi
86217309Snwhitehorn
87217309Snwhitehorn     dnl Construct list of names of catalog files to be constructed.
88217309Snwhitehorn     if test -n "$LINGUAS"; then
89217309Snwhitehorn       for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
90217309Snwhitehorn     fi
91217309Snwhitehorn   fi
92217309Snwhitehorn
93217309Snwhitehorn   dnl Enable libtool support if the surrounding package wishes it.
94217309Snwhitehorn   INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], [])
95217309Snwhitehorn   AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
96217309Snwhitehorn])dnl
97217309Snwhitehorndnl ---------------------------------------------------------------------------
98217309Snwhitehorndnl AM_ICONV version: 12 updated: 2007/07/30 19:12:03
99217309Snwhitehorndnl --------
100217309Snwhitehorndnl Inserted as requested by gettext 0.10.40
101217309Snwhitehorndnl File from /usr/share/aclocal
102217309Snwhitehorndnl iconv.m4
103217309Snwhitehorndnl ====================
104217309Snwhitehorndnl serial AM2
105217309Snwhitehorndnl
106217309Snwhitehorndnl From Bruno Haible.
107217309Snwhitehorndnl
108217309Snwhitehorndnl ====================
109217309Snwhitehorndnl Modified to use CF_FIND_LINKAGE and CF_ADD_SEARCHPATH, to broaden the
110217309Snwhitehorndnl range of locations searched.  Retain the same cache-variable naming to
111217309Snwhitehorndnl allow reuse with the other gettext macros -Thomas E Dickey
112217309SnwhitehornAC_DEFUN([AM_ICONV],
113217309Snwhitehorn[
114217309Snwhitehorn  dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
115217309Snwhitehorn  dnl those with the standalone portable GNU libiconv installed).
116217309Snwhitehorn
117217309Snwhitehorn  AC_ARG_WITH([libiconv-prefix],
118217309Snwhitehorn[  --with-libiconv-prefix=DIR
119217309Snwhitehorn                          search for libiconv in DIR/include and DIR/lib], [
120217309Snwhitehorn    CF_ADD_OPTIONAL_PATH($withval, libiconv)
121217309Snwhitehorn   ])
122217309Snwhitehorn
123217309Snwhitehorn  AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
124217309Snwhitehorn    CF_FIND_LINKAGE(CF__ICONV_HEAD,
125217309Snwhitehorn      CF__ICONV_BODY,
126217309Snwhitehorn      iconv,
127217309Snwhitehorn      am_cv_func_iconv=yes,
128217309Snwhitehorn      am_cv_func_iconv=["no, consider installing GNU libiconv"])])
129217309Snwhitehorn
130217309Snwhitehorn  if test "$am_cv_func_iconv" = yes; then
131217309Snwhitehorn    AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
132217309Snwhitehorn
133217309Snwhitehorn    AC_CACHE_CHECK([if the declaration of iconv() needs const.],
134217309Snwhitehorn		   am_cv_proto_iconv_const,[
135217309Snwhitehorn      AC_TRY_COMPILE(CF__ICONV_HEAD [
136217309Snwhitehornextern
137217309Snwhitehorn#ifdef __cplusplus
138217309Snwhitehorn"C"
139217309Snwhitehorn#endif
140217309Snwhitehorn#if defined(__STDC__) || defined(__cplusplus)
141217309Snwhitehornsize_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
142217309Snwhitehorn#else
143217309Snwhitehornsize_t iconv();
144217309Snwhitehorn#endif
145217309Snwhitehorn],[], am_cv_proto_iconv_const=no,
146217309Snwhitehorn      am_cv_proto_iconv_const=yes)])
147217309Snwhitehorn
148217309Snwhitehorn    if test "$am_cv_proto_iconv_const" = yes ; then
149217309Snwhitehorn      am_cv_proto_iconv_arg1="const"
150217309Snwhitehorn    else
151217309Snwhitehorn      am_cv_proto_iconv_arg1=""
152217309Snwhitehorn    fi
153217309Snwhitehorn
154217309Snwhitehorn    AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
155217309Snwhitehorn      [Define as const if the declaration of iconv() needs const.])
156217309Snwhitehorn  fi
157217309Snwhitehorn
158217309Snwhitehorn  LIBICONV=
159217309Snwhitehorn  if test "$cf_cv_find_linkage_iconv" = yes; then
160217309Snwhitehorn    CF_ADD_INCDIR($cf_cv_header_path_iconv)
161217309Snwhitehorn    if test -n "$cf_cv_library_file_iconv" ; then
162217309Snwhitehorn      LIBICONV="-liconv"
163217309Snwhitehorn      CF_ADD_LIBDIR($cf_cv_library_path_iconv)
164217309Snwhitehorn    fi
165217309Snwhitehorn  fi
166217309Snwhitehorn
167217309Snwhitehorn  AC_SUBST(LIBICONV)
168217309Snwhitehorn])dnl
169217309Snwhitehorndnl ---------------------------------------------------------------------------
170217309Snwhitehorndnl AM_LANGINFO_CODESET version: 3 updated: 2002/10/27 23:21:42
171217309Snwhitehorndnl -------------------
172217309Snwhitehorndnl Inserted as requested by gettext 0.10.40
173217309Snwhitehorndnl File from /usr/share/aclocal
174217309Snwhitehorndnl codeset.m4
175217309Snwhitehorndnl ====================
176217309Snwhitehorndnl serial AM1
177217309Snwhitehorndnl
178217309Snwhitehorndnl From Bruno Haible.
179217309SnwhitehornAC_DEFUN([AM_LANGINFO_CODESET],
180217309Snwhitehorn[
181217309Snwhitehorn  AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
182217309Snwhitehorn    [AC_TRY_LINK([#include <langinfo.h>],
183217309Snwhitehorn      [char* cs = nl_langinfo(CODESET);],
184217309Snwhitehorn      am_cv_langinfo_codeset=yes,
185217309Snwhitehorn      am_cv_langinfo_codeset=no)
186217309Snwhitehorn    ])
187217309Snwhitehorn  if test $am_cv_langinfo_codeset = yes; then
188217309Snwhitehorn    AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
189217309Snwhitehorn      [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
190217309Snwhitehorn  fi
191217309Snwhitehorn])dnl
192217309Snwhitehorndnl ---------------------------------------------------------------------------
193217309Snwhitehorndnl AM_LC_MESSAGES version: 4 updated: 2002/10/27 23:21:42
194217309Snwhitehorndnl --------------
195217309Snwhitehorndnl Inserted as requested by gettext 0.10.40
196217309Snwhitehorndnl File from /usr/share/aclocal
197217309Snwhitehorndnl lcmessage.m4
198217309Snwhitehorndnl ====================
199217309Snwhitehorndnl Check whether LC_MESSAGES is available in <locale.h>.
200217309Snwhitehorndnl Ulrich Drepper <drepper@cygnus.com>, 1995.
201217309Snwhitehorndnl
202217309Snwhitehorndnl This file can be copied and used freely without restrictions.  It can
203217309Snwhitehorndnl be used in projects which are not available under the GNU General Public
204217309Snwhitehorndnl License or the GNU Library General Public License but which still want
205217309Snwhitehorndnl to provide support for the GNU gettext functionality.
206217309Snwhitehorndnl Please note that the actual code of the GNU gettext library is covered
207217309Snwhitehorndnl by the GNU Library General Public License, and the rest of the GNU
208217309Snwhitehorndnl gettext package package is covered by the GNU General Public License.
209217309Snwhitehorndnl They are *not* in the public domain.
210217309Snwhitehorndnl
211217309Snwhitehorndnl serial 2
212217309Snwhitehorndnl
213217309SnwhitehornAC_DEFUN([AM_LC_MESSAGES],
214217309Snwhitehorn  [if test $ac_cv_header_locale_h = yes; then
215217309Snwhitehorn    AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
216217309Snwhitehorn      [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
217217309Snwhitehorn       am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
218217309Snwhitehorn    if test $am_cv_val_LC_MESSAGES = yes; then
219217309Snwhitehorn      AC_DEFINE(HAVE_LC_MESSAGES, 1,
220217309Snwhitehorn        [Define if your <locale.h> file defines LC_MESSAGES.])
221217309Snwhitehorn    fi
222217309Snwhitehorn  fi])dnl
223217309Snwhitehorndnl ---------------------------------------------------------------------------
224217309Snwhitehorndnl AM_PATH_PROG_WITH_TEST version: 8 updated: 2009/01/11 20:31:12
225217309Snwhitehorndnl ----------------------
226217309Snwhitehorndnl Inserted as requested by gettext 0.10.40
227217309Snwhitehorndnl File from /usr/share/aclocal
228217309Snwhitehorndnl progtest.m4
229217309Snwhitehorndnl ====================
230217309Snwhitehorndnl Search path for a program which passes the given test.
231217309Snwhitehorndnl Ulrich Drepper <drepper@cygnus.com>, 1996.
232217309Snwhitehorndnl
233217309Snwhitehorndnl This file can be copied and used freely without restrictions.  It can
234217309Snwhitehorndnl be used in projects which are not available under the GNU General Public
235217309Snwhitehorndnl License or the GNU Library General Public License but which still want
236217309Snwhitehorndnl to provide support for the GNU gettext functionality.
237217309Snwhitehorndnl Please note that the actual code of the GNU gettext library is covered
238217309Snwhitehorndnl by the GNU Library General Public License, and the rest of the GNU
239217309Snwhitehorndnl gettext package package is covered by the GNU General Public License.
240217309Snwhitehorndnl They are *not* in the public domain.
241217309Snwhitehorndnl
242217309Snwhitehorndnl serial 2
243217309Snwhitehorndnl
244217309Snwhitehorndnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
245217309Snwhitehorndnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
246217309SnwhitehornAC_DEFUN([AM_PATH_PROG_WITH_TEST],
247217309Snwhitehorn[# Extract the first word of "$2", so it can be a program name with args.
248217309SnwhitehornAC_REQUIRE([CF_PATHSEP])
249217309Snwhitehornset dummy $2; ac_word=[$]2
250217309SnwhitehornAC_MSG_CHECKING([for $ac_word])
251217309SnwhitehornAC_CACHE_VAL(ac_cv_path_$1,
252217309Snwhitehorn[case "[$]$1" in
253217309Snwhitehorn  [[\\/]*|?:[\\/]]*)
254217309Snwhitehorn  ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
255217309Snwhitehorn  ;;
256217309Snwhitehorn  *)
257217309Snwhitehorn  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
258217309Snwhitehorn  for ac_dir in ifelse([$5], , $PATH, [$5]); do
259217309Snwhitehorn    test -z "$ac_dir" && ac_dir=.
260217309Snwhitehorn    if test -f $ac_dir/$ac_word$ac_exeext; then
261217309Snwhitehorn      if [$3]; then
262217309Snwhitehorn	ac_cv_path_$1="$ac_dir/$ac_word$ac_exeext"
263217309Snwhitehorn	break
264217309Snwhitehorn      fi
265217309Snwhitehorn    fi
266217309Snwhitehorn  done
267217309Snwhitehorn  IFS="$ac_save_ifs"
268217309Snwhitehorndnl If no 4th arg is given, leave the cache variable unset,
269217309Snwhitehorndnl so AC_PATH_PROGS will keep looking.
270217309Snwhitehornifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
271217309Snwhitehorn])dnl
272217309Snwhitehorn  ;;
273217309Snwhitehornesac])dnl
274217309Snwhitehorn$1="$ac_cv_path_$1"
275217309Snwhitehornif test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
276217309Snwhitehorn  AC_MSG_RESULT([$]$1)
277217309Snwhitehornelse
278217309Snwhitehorn  AC_MSG_RESULT(no)
279217309Snwhitehornfi
280217309SnwhitehornAC_SUBST($1)dnl
281217309Snwhitehorn])dnl
282217309Snwhitehorndnl ---------------------------------------------------------------------------
283251843Sbaptdnl AM_WITH_NLS version: 25 updated: 2012/10/06 08:57:51
284217309Snwhitehorndnl -----------
285217309Snwhitehorndnl Inserted as requested by gettext 0.10.40
286217309Snwhitehorndnl File from /usr/share/aclocal
287217309Snwhitehorndnl gettext.m4
288217309Snwhitehorndnl ====================
289217309Snwhitehorndnl Macro to add for using GNU gettext.
290217309Snwhitehorndnl Ulrich Drepper <drepper@cygnus.com>, 1995.
291217309Snwhitehorndnl ====================
292217309Snwhitehorndnl Modified to use CF_FIND_LINKAGE and CF_ADD_SEARCHPATH, to broaden the
293217309Snwhitehorndnl range of locations searched.  Retain the same cache-variable naming to
294217309Snwhitehorndnl allow reuse with the other gettext macros -Thomas E Dickey
295217309Snwhitehorndnl ====================
296217309Snwhitehorndnl
297217309Snwhitehorndnl This file can be copied and used freely without restrictions.  It can
298217309Snwhitehorndnl be used in projects which are not available under the GNU General Public
299217309Snwhitehorndnl License or the GNU Library General Public License but which still want
300217309Snwhitehorndnl to provide support for the GNU gettext functionality.
301217309Snwhitehorndnl Please note that the actual code of the GNU gettext library is covered
302217309Snwhitehorndnl by the GNU Library General Public License, and the rest of the GNU
303217309Snwhitehorndnl gettext package package is covered by the GNU General Public License.
304217309Snwhitehorndnl They are *not* in the public domain.
305217309Snwhitehorndnl
306217309Snwhitehorndnl serial 10
307217309Snwhitehorndnl
308217309Snwhitehorndnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR], [ENABLED]).
309217309Snwhitehorndnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library
310217309Snwhitehorndnl    $(top_builddir)/intl/libintl.la will be created (shared and/or static,
311217309Snwhitehorndnl    depending on --{enable,disable}-{shared,static} and on the presence of
312217309Snwhitehorndnl    AM-DISABLE-SHARED). Otherwise, a static library
313217309Snwhitehorndnl    $(top_builddir)/intl/libintl.a will be created.
314217309Snwhitehorndnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
315217309Snwhitehorndnl    implementations (in libc or libintl) without the ngettext() function
316217309Snwhitehorndnl    will be ignored.
317217309Snwhitehorndnl LIBDIR is used to find the intl libraries.  If empty,
318217309Snwhitehorndnl    the value `$(top_builddir)/intl/' is used.
319217309Snwhitehorndnl ENABLED is used to control the default for the related --enable-nls, since
320217309Snwhitehorndnl    not all application developers want this feature by default, e.g., lynx.
321217309Snwhitehorndnl
322217309Snwhitehorndnl The result of the configuration is one of three cases:
323217309Snwhitehorndnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
324217309Snwhitehorndnl    and used.
325217309Snwhitehorndnl    Catalog format: GNU --> install in $(datadir)
326217309Snwhitehorndnl    Catalog extension: .mo after installation, .gmo in source tree
327217309Snwhitehorndnl 2) GNU gettext has been found in the system's C library.
328217309Snwhitehorndnl    Catalog format: GNU --> install in $(datadir)
329217309Snwhitehorndnl    Catalog extension: .mo after installation, .gmo in source tree
330217309Snwhitehorndnl 3) No internationalization, always use English msgid.
331217309Snwhitehorndnl    Catalog format: none
332217309Snwhitehorndnl    Catalog extension: none
333217309Snwhitehorndnl The use of .gmo is historical (it was needed to avoid overwriting the
334217309Snwhitehorndnl GNU format catalogs when building on a platform with an X/Open gettext),
335217309Snwhitehorndnl but we keep it in order not to force irrelevant filename changes on the
336217309Snwhitehorndnl maintainers.
337217309Snwhitehorndnl
338217309SnwhitehornAC_DEFUN([AM_WITH_NLS],
339217309Snwhitehorn[AC_MSG_CHECKING([whether NLS is requested])
340217309Snwhitehorn  dnl Default is enabled NLS
341217309Snwhitehorn  ifelse([$4],,[
342217309Snwhitehorn  AC_ARG_ENABLE(nls,
343217309Snwhitehorn    [  --disable-nls           do not use Native Language Support],
344217309Snwhitehorn    USE_NLS=$enableval, USE_NLS=yes)],[
345217309Snwhitehorn  AC_ARG_ENABLE(nls,
346217309Snwhitehorn    [  --enable-nls            use Native Language Support],
347217309Snwhitehorn    USE_NLS=$enableval, USE_NLS=no)])
348217309Snwhitehorn  AC_MSG_RESULT($USE_NLS)
349217309Snwhitehorn  AC_SUBST(USE_NLS)
350217309Snwhitehorn
351217309Snwhitehorn  BUILD_INCLUDED_LIBINTL=no
352217309Snwhitehorn  USE_INCLUDED_LIBINTL=no
353217309Snwhitehorn  INTLLIBS=
354217309Snwhitehorn
355217309Snwhitehorn  dnl If we use NLS figure out what method
356217309Snwhitehorn  if test "$USE_NLS" = "yes"; then
357217309Snwhitehorn    AC_DEFINE(ENABLE_NLS, 1,
358217309Snwhitehorn      [Define to 1 if translation of program messages to the user's native language
359217309Snwhitehorn is requested.])
360217309Snwhitehorn    AC_MSG_CHECKING([whether included gettext is requested])
361217309Snwhitehorn    AC_ARG_WITH(included-gettext,
362217309Snwhitehorn      [  --with-included-gettext use the GNU gettext library included here],
363217309Snwhitehorn      nls_cv_force_use_gnu_gettext=$withval,
364217309Snwhitehorn      nls_cv_force_use_gnu_gettext=no)
365217309Snwhitehorn    AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
366217309Snwhitehorn
367217309Snwhitehorn    nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
368217309Snwhitehorn    if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
369217309Snwhitehorn      dnl User does not insist on using GNU NLS library.  Figure out what
370217309Snwhitehorn      dnl to use.  If GNU gettext is available we use this.  Else we have
371217309Snwhitehorn      dnl to fall back to GNU NLS library.
372217309Snwhitehorn      CATOBJEXT=NONE
373217309Snwhitehorn
374217309Snwhitehorn      cf_save_LIBS_1="$LIBS"
375220749Snwhitehorn      CF_ADD_LIBS($LIBICONV)
376217309Snwhitehorn      AC_CACHE_CHECK([for libintl.h and gettext()], cf_cv_func_gettext,[
377217309Snwhitehorn        CF_FIND_LINKAGE(CF__INTL_HEAD,
378217309Snwhitehorn        CF__INTL_BODY,
379217309Snwhitehorn        intl,
380217309Snwhitehorn        cf_cv_func_gettext=yes,
381217309Snwhitehorn        cf_cv_func_gettext=no)
382217309Snwhitehorn      ])
383217309Snwhitehorn      LIBS="$cf_save_LIBS_1"
384217309Snwhitehorn
385217309Snwhitehorn      if test "$cf_cv_func_gettext" = yes ; then
386251843Sbapt        AC_DEFINE(HAVE_LIBINTL_H,1,[Define to 1 if we have libintl.h])
387217309Snwhitehorn
388217309Snwhitehorn        dnl If an already present or preinstalled GNU gettext() is found,
389217309Snwhitehorn        dnl use it.  But if this macro is used in GNU gettext, and GNU
390217309Snwhitehorn        dnl gettext is already preinstalled in libintl, we update this
391217309Snwhitehorn        dnl libintl.  (Cf. the install rule in intl/Makefile.in.)
392217309Snwhitehorn        if test "$PACKAGE" != gettext; then
393217309Snwhitehorn          AC_DEFINE(HAVE_GETTEXT, 1,
394217309Snwhitehorn              [Define if the GNU gettext() function is already present or preinstalled.])
395217309Snwhitehorn
396217309Snwhitehorn          CF_ADD_INCDIR($cf_cv_header_path_intl)
397217309Snwhitehorn
398217309Snwhitehorn          if test -n "$cf_cv_library_file_intl" ; then
399217309Snwhitehorn            dnl If iconv() is in a separate libiconv library, then anyone
400217309Snwhitehorn            dnl linking with libintl{.a,.so} also needs to link with
401217309Snwhitehorn            dnl libiconv.
402217309Snwhitehorn            INTLLIBS="$cf_cv_library_file_intl $LIBICONV"
403217309Snwhitehorn            CF_ADD_LIBDIR($cf_cv_library_path_intl,INTLLIBS)
404217309Snwhitehorn          fi
405217309Snwhitehorn
406217309Snwhitehorn          gt_save_LIBS="$LIBS"
407217309Snwhitehorn          LIBS="$LIBS $INTLLIBS"
408217309Snwhitehorn          AC_CHECK_FUNCS(dcgettext)
409217309Snwhitehorn          LIBS="$gt_save_LIBS"
410217309Snwhitehorn
411217309Snwhitehorn          dnl Search for GNU msgfmt in the PATH.
412217309Snwhitehorn          AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
413217309Snwhitehorn              [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
414217309Snwhitehorn          AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
415217309Snwhitehorn
416217309Snwhitehorn          dnl Search for GNU xgettext in the PATH.
417217309Snwhitehorn          AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
418217309Snwhitehorn              [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
419217309Snwhitehorn
420217309Snwhitehorn          CATOBJEXT=.gmo
421217309Snwhitehorn        fi
422217309Snwhitehorn      fi
423217309Snwhitehorn
424217309Snwhitehorn      if test "$CATOBJEXT" = "NONE"; then
425217309Snwhitehorn        dnl GNU gettext is not found in the C library.
426217309Snwhitehorn        dnl Fall back on GNU gettext library.
427217309Snwhitehorn        nls_cv_use_gnu_gettext=yes
428217309Snwhitehorn      fi
429217309Snwhitehorn    fi
430217309Snwhitehorn
431217309Snwhitehorn    if test "$nls_cv_use_gnu_gettext" = "yes"; then
432217309Snwhitehorn      if test ! -d $srcdir/intl ; then
433217309Snwhitehorn        AC_MSG_ERROR(no NLS library is packaged with this application)
434217309Snwhitehorn      fi
435217309Snwhitehorn      dnl Mark actions used to generate GNU NLS library.
436217309Snwhitehorn      INTLOBJS="\$(GETTOBJS)"
437217309Snwhitehorn      AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
438217309Snwhitehorn          [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
439217309Snwhitehorn      AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
440217309Snwhitehorn      AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
441217309Snwhitehorn          [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
442217309Snwhitehorn      AC_SUBST(MSGFMT)
443217309Snwhitehorn      BUILD_INCLUDED_LIBINTL=yes
444217309Snwhitehorn      USE_INCLUDED_LIBINTL=yes
445217309Snwhitehorn      CATOBJEXT=.gmo
446217309Snwhitehorn      INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV"
447217309Snwhitehorn      LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
448217309Snwhitehorn    fi
449217309Snwhitehorn
450217309Snwhitehorn    dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
451217309Snwhitehorn    dnl Test whether we really found GNU msgfmt.
452217309Snwhitehorn    if test "$GMSGFMT" != ":"; then
453217309Snwhitehorn      dnl If it is no GNU msgfmt we define it as : so that the
454217309Snwhitehorn      dnl Makefiles still can work.
455217309Snwhitehorn      if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then
456217309Snwhitehorn        : ;
457217309Snwhitehorn      else
458217309Snwhitehorn        AC_MSG_RESULT(
459217309Snwhitehorn          [found msgfmt program is not GNU msgfmt; ignore it])
460217309Snwhitehorn        GMSGFMT=":"
461217309Snwhitehorn      fi
462217309Snwhitehorn    fi
463217309Snwhitehorn
464217309Snwhitehorn    dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
465217309Snwhitehorn    dnl Test whether we really found GNU xgettext.
466217309Snwhitehorn    if test "$XGETTEXT" != ":"; then
467217309Snwhitehorn        dnl If it is no GNU xgettext we define it as : so that the
468217309Snwhitehorn        dnl Makefiles still can work.
469217309Snwhitehorn      if $XGETTEXT --omit-header /dev/null >/dev/null 2>&1; then
470217309Snwhitehorn        : ;
471217309Snwhitehorn      else
472217309Snwhitehorn        AC_MSG_RESULT(
473217309Snwhitehorn          [found xgettext program is not GNU xgettext; ignore it])
474217309Snwhitehorn        XGETTEXT=":"
475217309Snwhitehorn      fi
476217309Snwhitehorn    fi
477217309Snwhitehorn
478217309Snwhitehorn    dnl We need to process the po/ directory.
479217309Snwhitehorn    POSUB=po
480217309Snwhitehorn  fi
481217309Snwhitehorn
482217309Snwhitehorn  AC_OUTPUT_COMMANDS(
483217309Snwhitehorn   [for ac_file in $CONFIG_FILES; do
484217309Snwhitehorn
485217309Snwhitehorn      # Support "outfile[:infile[:infile...]]"
486217309Snwhitehorn      case "$ac_file" in
487217309Snwhitehorn        *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
488217309Snwhitehorn      esac
489217309Snwhitehorn
490217309Snwhitehorn      # PO directories have a Makefile.in generated from Makefile.inn.
491217309Snwhitehorn      case "$ac_file" in */[Mm]akefile.in)
492217309Snwhitehorn        # Adjust a relative srcdir.
493217309Snwhitehorn        ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
494217309Snwhitehorn        ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
495217309Snwhitehorn        ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
496217309Snwhitehorn        ac_base=`basename $ac_file .in`
497217309Snwhitehorn        # In autoconf-2.13 it is called $ac_given_srcdir.
498217309Snwhitehorn        # In autoconf-2.50 it is called $srcdir.
499217309Snwhitehorn        test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
500217309Snwhitehorn
501217309Snwhitehorn        case "$ac_given_srcdir" in
502217309Snwhitehorn          .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
503217309Snwhitehorn          /*) top_srcdir="$ac_given_srcdir" ;;
504217309Snwhitehorn          *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
505217309Snwhitehorn        esac
506217309Snwhitehorn
507217309Snwhitehorn        if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
508217309Snwhitehorn          rm -f "$ac_dir/POTFILES"
509217309Snwhitehorn          test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
510217309Snwhitehorn          sed -e "/^#/d" -e "/^[ 	]*\$/d" -e "s,.*,     $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES"
511217309Snwhitehorn          test -n "$as_me" && echo "$as_me: creating $ac_dir/$ac_base" || echo "creating $ac_dir/$ac_base"
512217309Snwhitehorn          sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/$ac_base.in" > "$ac_dir/$ac_base"
513217309Snwhitehorn        fi
514217309Snwhitehorn        ;;
515217309Snwhitehorn      esac
516217309Snwhitehorn    done])
517217309Snwhitehorn
518217309Snwhitehorn  dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
519217309Snwhitehorn  dnl to 'yes' because some of the testsuite requires it.
520217309Snwhitehorn  if test "$PACKAGE" = gettext; then
521217309Snwhitehorn    BUILD_INCLUDED_LIBINTL=yes
522217309Snwhitehorn  fi
523217309Snwhitehorn
524217309Snwhitehorn  dnl intl/plural.c is generated from intl/plural.y. It requires bison,
525217309Snwhitehorn  dnl because plural.y uses bison specific features. It requires at least
526217309Snwhitehorn  dnl bison-1.26 because earlier versions generate a plural.c that doesn't
527217309Snwhitehorn  dnl compile.
528217309Snwhitehorn  dnl bison is only needed for the maintainer (who touches plural.y). But in
529217309Snwhitehorn  dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
530217309Snwhitehorn  dnl the rule in general Makefile. Now, some people carelessly touch the
531217309Snwhitehorn  dnl files or have a broken "make" program, hence the plural.c rule will
532217309Snwhitehorn  dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
533217309Snwhitehorn  dnl present or too old.
534217309Snwhitehorn  if test "$nls_cv_use_gnu_gettext" = "yes"; then
535217309Snwhitehorn    AC_CHECK_PROGS([INTLBISON], [bison])
536217309Snwhitehorn    if test -z "$INTLBISON"; then
537217309Snwhitehorn      ac_verc_fail=yes
538217309Snwhitehorn    else
539217309Snwhitehorn      dnl Found it, now check the version.
540217309Snwhitehorn      AC_MSG_CHECKING([version of bison])
541217309Snwhitehornchangequote(<<,>>)dnl
542217309Snwhitehorn      ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
543217309Snwhitehorn      case $ac_prog_version in
544217309Snwhitehorn        '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
545217309Snwhitehorn        1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
546217309Snwhitehornchangequote([,])dnl
547217309Snwhitehorn           ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
548217309Snwhitehorn        *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
549217309Snwhitehorn      esac
550217309Snwhitehorn    AC_MSG_RESULT([$ac_prog_version])
551217309Snwhitehorn    fi
552217309Snwhitehorn    if test $ac_verc_fail = yes; then
553217309Snwhitehorn      INTLBISON=:
554217309Snwhitehorn    fi
555217309Snwhitehorn  fi
556217309Snwhitehorn
557217309Snwhitehorn  dnl These rules are solely for the distribution goal.  While doing this
558217309Snwhitehorn  dnl we only have to keep exactly one list of the available catalogs
559217309Snwhitehorn  dnl in configure.in.
560217309Snwhitehorn  for lang in $ALL_LINGUAS; do
561217309Snwhitehorn    GMOFILES="$GMOFILES $lang.gmo"
562217309Snwhitehorn    POFILES="$POFILES $lang.po"
563217309Snwhitehorn  done
564217309Snwhitehorn
565217309Snwhitehorn  dnl Make all variables we use known to autoconf.
566217309Snwhitehorn  AC_SUBST(BUILD_INCLUDED_LIBINTL)
567217309Snwhitehorn  AC_SUBST(USE_INCLUDED_LIBINTL)
568217309Snwhitehorn  AC_SUBST(CATALOGS)
569217309Snwhitehorn  AC_SUBST(CATOBJEXT)
570217309Snwhitehorn  AC_SUBST(GMOFILES)
571217309Snwhitehorn  AC_SUBST(INTLLIBS)
572217309Snwhitehorn  AC_SUBST(INTLOBJS)
573217309Snwhitehorn  AC_SUBST(POFILES)
574217309Snwhitehorn  AC_SUBST(POSUB)
575217309Snwhitehorn
576217309Snwhitehorn  dnl For backward compatibility. Some configure.ins may be using this.
577217309Snwhitehorn  nls_cv_header_intl=
578217309Snwhitehorn  nls_cv_header_libgt=
579217309Snwhitehorn
580217309Snwhitehorn  dnl For backward compatibility. Some Makefiles may be using this.
581217309Snwhitehorn  DATADIRNAME=share
582217309Snwhitehorn  AC_SUBST(DATADIRNAME)
583217309Snwhitehorn
584217309Snwhitehorn  dnl For backward compatibility. Some Makefiles may be using this.
585217309Snwhitehorn  INSTOBJEXT=.mo
586217309Snwhitehorn  AC_SUBST(INSTOBJEXT)
587217309Snwhitehorn
588217309Snwhitehorn  dnl For backward compatibility. Some Makefiles may be using this.
589217309Snwhitehorn  GENCAT=gencat
590217309Snwhitehorn  AC_SUBST(GENCAT)
591217309Snwhitehorn])dnl
592217309Snwhitehorndnl ---------------------------------------------------------------------------
593255852Sdteskednl CF_ACVERSION_CHECK version: 4 updated: 2013/03/04 19:52:56
594251843Sbaptdnl ------------------
595251843Sbaptdnl Conditionally generate script according to whether we're using a given autoconf.
596251843Sbaptdnl
597251843Sbaptdnl $1 = version to compare against
598251843Sbaptdnl $2 = code to use if AC_ACVERSION is at least as high as $1.
599251843Sbaptdnl $3 = code to use if AC_ACVERSION is older than $1.
600251843Sbaptdefine([CF_ACVERSION_CHECK],
601251843Sbapt[
602255852Sdteskeifdef([AC_ACVERSION], ,[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])dnl
603251843Sbaptifdef([m4_version_compare],
604251843Sbapt[m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])],
605251843Sbapt[CF_ACVERSION_COMPARE(
606251843SbaptAC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])),
607251843SbaptAC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl
608217309Snwhitehorndnl ---------------------------------------------------------------------------
609251843Sbaptdnl CF_ACVERSION_COMPARE version: 3 updated: 2012/10/03 18:39:53
610251843Sbaptdnl --------------------
611251843Sbaptdnl CF_ACVERSION_COMPARE(MAJOR1, MINOR1, TERNARY1,
612251843Sbaptdnl                      MAJOR2, MINOR2, TERNARY2,
613251843Sbaptdnl                      PRINTABLE2, not FOUND, FOUND)
614251843Sbaptdefine([CF_ACVERSION_COMPARE],
615251843Sbapt[ifelse(builtin([eval], [$2 < $5]), 1,
616251843Sbapt[ifelse([$8], , ,[$8])],
617251843Sbapt[ifelse([$9], , ,[$9])])])dnl
618251843Sbaptdnl ---------------------------------------------------------------------------
619220749Snwhitehorndnl CF_ADD_CFLAGS version: 10 updated: 2010/05/26 05:38:42
620217309Snwhitehorndnl -------------
621217309Snwhitehorndnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS
622217309Snwhitehorndnl The second parameter if given makes this macro verbose.
623217309Snwhitehorndnl
624217309Snwhitehorndnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS,
625217309Snwhitehorndnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily
626217309Snwhitehorndnl confused by the quotes (which require backslashes to keep them usable).
627217309SnwhitehornAC_DEFUN([CF_ADD_CFLAGS],
628217309Snwhitehorn[
629217309Snwhitehorncf_fix_cppflags=no
630217309Snwhitehorncf_new_cflags=
631217309Snwhitehorncf_new_cppflags=
632217309Snwhitehorncf_new_extra_cppflags=
633217309Snwhitehorn
634217309Snwhitehornfor cf_add_cflags in $1
635217309Snwhitehorndo
636217309Snwhitehorncase $cf_fix_cppflags in
637217309Snwhitehornno)
638217309Snwhitehorn	case $cf_add_cflags in #(vi
639217309Snwhitehorn	-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
640217309Snwhitehorn		case $cf_add_cflags in
641217309Snwhitehorn		-D*)
642217309Snwhitehorn			cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'`
643217309Snwhitehorn
644217309Snwhitehorn			test "${cf_add_cflags}" != "${cf_tst_cflags}" \
645217309Snwhitehorn				&& test -z "${cf_tst_cflags}" \
646217309Snwhitehorn				&& cf_fix_cppflags=yes
647217309Snwhitehorn
648217309Snwhitehorn			if test $cf_fix_cppflags = yes ; then
649217309Snwhitehorn				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
650217309Snwhitehorn				continue
651217309Snwhitehorn			elif test "${cf_tst_cflags}" = "\"'" ; then
652217309Snwhitehorn				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
653217309Snwhitehorn				continue
654217309Snwhitehorn			fi
655217309Snwhitehorn			;;
656217309Snwhitehorn		esac
657217309Snwhitehorn		case "$CPPFLAGS" in
658217309Snwhitehorn		*$cf_add_cflags) #(vi
659217309Snwhitehorn			;;
660217309Snwhitehorn		*) #(vi
661217309Snwhitehorn			case $cf_add_cflags in #(vi
662217309Snwhitehorn			-D*)
663217309Snwhitehorn				cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
664217309Snwhitehorn				CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags)
665217309Snwhitehorn				;;
666217309Snwhitehorn			esac
667217309Snwhitehorn			cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
668217309Snwhitehorn			;;
669217309Snwhitehorn		esac
670217309Snwhitehorn		;;
671217309Snwhitehorn	*)
672217309Snwhitehorn		cf_new_cflags="$cf_new_cflags $cf_add_cflags"
673217309Snwhitehorn		;;
674217309Snwhitehorn	esac
675217309Snwhitehorn	;;
676217309Snwhitehornyes)
677217309Snwhitehorn	cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
678217309Snwhitehorn
679217309Snwhitehorn	cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'`
680217309Snwhitehorn
681217309Snwhitehorn	test "${cf_add_cflags}" != "${cf_tst_cflags}" \
682217309Snwhitehorn		&& test -z "${cf_tst_cflags}" \
683217309Snwhitehorn		&& cf_fix_cppflags=no
684217309Snwhitehorn	;;
685217309Snwhitehornesac
686217309Snwhitehorndone
687217309Snwhitehorn
688217309Snwhitehornif test -n "$cf_new_cflags" ; then
689220749Snwhitehorn	ifelse([$2],,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)])
690217309Snwhitehorn	CFLAGS="$CFLAGS $cf_new_cflags"
691217309Snwhitehornfi
692217309Snwhitehorn
693217309Snwhitehornif test -n "$cf_new_cppflags" ; then
694220749Snwhitehorn	ifelse([$2],,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)])
695217309Snwhitehorn	CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
696217309Snwhitehornfi
697217309Snwhitehorn
698217309Snwhitehornif test -n "$cf_new_extra_cppflags" ; then
699220749Snwhitehorn	ifelse([$2],,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)])
700217309Snwhitehorn	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
701217309Snwhitehornfi
702217309Snwhitehorn
703217309SnwhitehornAC_SUBST(EXTRA_CPPFLAGS)
704217309Snwhitehorn
705217309Snwhitehorn])dnl
706217309Snwhitehorndnl ---------------------------------------------------------------------------
707220749Snwhitehorndnl CF_ADD_INCDIR version: 13 updated: 2010/05/26 16:44:57
708217309Snwhitehorndnl -------------
709217309Snwhitehorndnl Add an include-directory to $CPPFLAGS.  Don't add /usr/include, since it's
710217309Snwhitehorndnl redundant.  We don't normally need to add -I/usr/local/include for gcc,
711217309Snwhitehorndnl but old versions (and some misinstalled ones) need that.  To make things
712217309Snwhitehorndnl worse, gcc 3.x may give error messages if -I/usr/local/include is added to
713217309Snwhitehorndnl the include-path).
714217309SnwhitehornAC_DEFUN([CF_ADD_INCDIR],
715217309Snwhitehorn[
716217309Snwhitehornif test -n "$1" ; then
717217309Snwhitehorn  for cf_add_incdir in $1
718217309Snwhitehorn  do
719217309Snwhitehorn	while test $cf_add_incdir != /usr/include
720217309Snwhitehorn	do
721217309Snwhitehorn	  if test -d $cf_add_incdir
722217309Snwhitehorn	  then
723217309Snwhitehorn		cf_have_incdir=no
724217309Snwhitehorn		if test -n "$CFLAGS$CPPFLAGS" ; then
725217309Snwhitehorn		  # a loop is needed to ensure we can add subdirs of existing dirs
726217309Snwhitehorn		  for cf_test_incdir in $CFLAGS $CPPFLAGS ; do
727217309Snwhitehorn			if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then
728217309Snwhitehorn			  cf_have_incdir=yes; break
729217309Snwhitehorn			fi
730217309Snwhitehorn		  done
731217309Snwhitehorn		fi
732217309Snwhitehorn
733217309Snwhitehorn		if test "$cf_have_incdir" = no ; then
734217309Snwhitehorn		  if test "$cf_add_incdir" = /usr/local/include ; then
735217309Snwhitehorn			if test "$GCC" = yes
736217309Snwhitehorn			then
737217309Snwhitehorn			  cf_save_CPPFLAGS=$CPPFLAGS
738217309Snwhitehorn			  CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
739217309Snwhitehorn			  AC_TRY_COMPILE([#include <stdio.h>],
740217309Snwhitehorn				  [printf("Hello")],
741217309Snwhitehorn				  [],
742217309Snwhitehorn				  [cf_have_incdir=yes])
743217309Snwhitehorn			  CPPFLAGS=$cf_save_CPPFLAGS
744217309Snwhitehorn			fi
745217309Snwhitehorn		  fi
746217309Snwhitehorn		fi
747217309Snwhitehorn
748217309Snwhitehorn		if test "$cf_have_incdir" = no ; then
749217309Snwhitehorn		  CF_VERBOSE(adding $cf_add_incdir to include-path)
750220749Snwhitehorn		  ifelse([$2],,CPPFLAGS,[$2])="$ifelse([$2],,CPPFLAGS,[$2]) -I$cf_add_incdir"
751217309Snwhitehorn
752217309Snwhitehorn		  cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'`
753217309Snwhitehorn		  test "$cf_top_incdir" = "$cf_add_incdir" && break
754217309Snwhitehorn		  cf_add_incdir="$cf_top_incdir"
755217309Snwhitehorn		else
756217309Snwhitehorn		  break
757217309Snwhitehorn		fi
758217309Snwhitehorn	  fi
759217309Snwhitehorn	done
760217309Snwhitehorn  done
761217309Snwhitehornfi
762217309Snwhitehorn])dnl
763217309Snwhitehorndnl ---------------------------------------------------------------------------
764220749Snwhitehorndnl CF_ADD_LIB version: 2 updated: 2010/06/02 05:03:05
765220749Snwhitehorndnl ----------
766220749Snwhitehorndnl Add a library, used to enforce consistency.
767220749Snwhitehorndnl
768220749Snwhitehorndnl $1 = library to add, without the "-l"
769220749Snwhitehorndnl $2 = variable to update (default $LIBS)
770220749SnwhitehornAC_DEFUN([CF_ADD_LIB],[CF_ADD_LIBS(-l$1,ifelse($2,,LIBS,[$2]))])dnl
771220749Snwhitehorndnl ---------------------------------------------------------------------------
772220749Snwhitehorndnl CF_ADD_LIBDIR version: 9 updated: 2010/05/26 16:44:57
773217309Snwhitehorndnl -------------
774217309Snwhitehorndnl	Adds to the library-path
775217309Snwhitehorndnl
776217309Snwhitehorndnl	Some machines have trouble with multiple -L options.
777217309Snwhitehorndnl
778217309Snwhitehorndnl $1 is the (list of) directory(s) to add
779217309Snwhitehorndnl $2 is the optional name of the variable to update (default LDFLAGS)
780217309Snwhitehorndnl
781217309SnwhitehornAC_DEFUN([CF_ADD_LIBDIR],
782217309Snwhitehorn[
783217309Snwhitehornif test -n "$1" ; then
784217309Snwhitehorn  for cf_add_libdir in $1
785217309Snwhitehorn  do
786217309Snwhitehorn    if test $cf_add_libdir = /usr/lib ; then
787217309Snwhitehorn      :
788217309Snwhitehorn    elif test -d $cf_add_libdir
789217309Snwhitehorn    then
790217309Snwhitehorn      cf_have_libdir=no
791217309Snwhitehorn      if test -n "$LDFLAGS$LIBS" ; then
792217309Snwhitehorn        # a loop is needed to ensure we can add subdirs of existing dirs
793217309Snwhitehorn        for cf_test_libdir in $LDFLAGS $LIBS ; do
794217309Snwhitehorn          if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then
795217309Snwhitehorn            cf_have_libdir=yes; break
796217309Snwhitehorn          fi
797217309Snwhitehorn        done
798217309Snwhitehorn      fi
799217309Snwhitehorn      if test "$cf_have_libdir" = no ; then
800217309Snwhitehorn        CF_VERBOSE(adding $cf_add_libdir to library-path)
801220749Snwhitehorn        ifelse([$2],,LDFLAGS,[$2])="-L$cf_add_libdir $ifelse([$2],,LDFLAGS,[$2])"
802217309Snwhitehorn      fi
803217309Snwhitehorn    fi
804217309Snwhitehorn  done
805217309Snwhitehornfi
806217309Snwhitehorn])dnl
807217309Snwhitehorndnl ---------------------------------------------------------------------------
808220749Snwhitehorndnl CF_ADD_LIBS version: 1 updated: 2010/06/02 05:03:05
809220749Snwhitehorndnl -----------
810220749Snwhitehorndnl Add one or more libraries, used to enforce consistency.
811220749Snwhitehorndnl
812220749Snwhitehorndnl $1 = libraries to add, with the "-l", etc.
813220749Snwhitehorndnl $2 = variable to update (default $LIBS)
814220749SnwhitehornAC_DEFUN([CF_ADD_LIBS],[ifelse($2,,LIBS,[$2])="$1 [$]ifelse($2,,LIBS,[$2])"])dnl
815220749Snwhitehorndnl ---------------------------------------------------------------------------
816217309Snwhitehorndnl CF_ADD_OPTIONAL_PATH version: 1 updated: 2007/07/29 12:33:33
817217309Snwhitehorndnl --------------------
818217309Snwhitehorndnl Add an optional search-path to the compile/link variables.
819217309Snwhitehorndnl See CF_WITH_PATH
820217309Snwhitehorndnl
821217309Snwhitehorndnl $1 = shell variable containing the result of --with-XXX=[DIR]
822217309Snwhitehorndnl $2 = module to look for.
823217309SnwhitehornAC_DEFUN([CF_ADD_OPTIONAL_PATH],[
824217309Snwhitehorn  case "$1" in #(vi
825217309Snwhitehorn  no) #(vi
826217309Snwhitehorn      ;;
827217309Snwhitehorn  yes) #(vi
828217309Snwhitehorn      ;;
829217309Snwhitehorn  *)
830217309Snwhitehorn      CF_ADD_SEARCHPATH([$1], [AC_MSG_ERROR(cannot find $2 under $1)])
831217309Snwhitehorn      ;;
832217309Snwhitehorn  esac
833217309Snwhitehorn])dnl
834217309Snwhitehorndnl ---------------------------------------------------------------------------
835217309Snwhitehorndnl CF_ADD_SEARCHPATH version: 5 updated: 2009/01/11 20:40:21
836217309Snwhitehorndnl -----------------
837217309Snwhitehorndnl Set $CPPFLAGS and $LDFLAGS with the directories given via the parameter.
838217309Snwhitehorndnl They can be either the common root of include- and lib-directories, or the
839217309Snwhitehorndnl lib-directory (to allow for things like lib64 directories).
840217309Snwhitehorndnl See also CF_FIND_LINKAGE.
841217309Snwhitehorndnl
842217309Snwhitehorndnl $1 is the list of colon-separated directory names to search.
843217309Snwhitehorndnl $2 is the action to take if a parameter does not yield a directory.
844217309SnwhitehornAC_DEFUN([CF_ADD_SEARCHPATH],
845217309Snwhitehorn[
846217309SnwhitehornAC_REQUIRE([CF_PATHSEP])
847217309Snwhitehornfor cf_searchpath in `echo "$1" | tr $PATH_SEPARATOR ' '`; do
848217309Snwhitehorn	if test -d $cf_searchpath/include; then
849217309Snwhitehorn		CF_ADD_INCDIR($cf_searchpath/include)
850217309Snwhitehorn	elif test -d $cf_searchpath/../include ; then
851217309Snwhitehorn		CF_ADD_INCDIR($cf_searchpath/../include)
852217309Snwhitehorn	ifelse([$2],,,[else
853217309Snwhitehorn$2])
854217309Snwhitehorn	fi
855217309Snwhitehorn	if test -d $cf_searchpath/lib; then
856217309Snwhitehorn		CF_ADD_LIBDIR($cf_searchpath/lib)
857217309Snwhitehorn	elif test -d $cf_searchpath ; then
858217309Snwhitehorn		CF_ADD_LIBDIR($cf_searchpath)
859217309Snwhitehorn	ifelse([$2],,,[else
860217309Snwhitehorn$2])
861217309Snwhitehorn	fi
862217309Snwhitehorndone
863217309Snwhitehorn])
864217309Snwhitehorndnl ---------------------------------------------------------------------------
865220749Snwhitehorndnl CF_ADD_SUBDIR_PATH version: 3 updated: 2010/07/03 20:58:12
866217309Snwhitehorndnl ------------------
867217309Snwhitehorndnl Append to a search-list for a nonstandard header/lib-file
868217309Snwhitehorndnl	$1 = the variable to return as result
869217309Snwhitehorndnl	$2 = the package name
870217309Snwhitehorndnl	$3 = the subdirectory, e.g., bin, include or lib
871217309Snwhitehorndnl $4 = the directory under which we will test for subdirectories
872217309Snwhitehorndnl $5 = a directory that we do not want $4 to match
873217309SnwhitehornAC_DEFUN([CF_ADD_SUBDIR_PATH],
874217309Snwhitehorn[
875217309Snwhitehorntest "$4" != "$5" && \
876217309Snwhitehorntest -d "$4" && \
877220749Snwhitehornifelse([$5],NONE,,[(test $5 = NONE || test "$4" != "$5") &&]) {
878217309Snwhitehorn	test -n "$verbose" && echo "	... testing for $3-directories under $4"
879217309Snwhitehorn	test -d $4/$3 &&          $1="[$]$1 $4/$3"
880217309Snwhitehorn	test -d $4/$3/$2 &&       $1="[$]$1 $4/$3/$2"
881217309Snwhitehorn	test -d $4/$3/$2/$3 &&    $1="[$]$1 $4/$3/$2/$3"
882217309Snwhitehorn	test -d $4/$2/$3 &&       $1="[$]$1 $4/$2/$3"
883217309Snwhitehorn	test -d $4/$2/$3/$2 &&    $1="[$]$1 $4/$2/$3/$2"
884217309Snwhitehorn}
885217309Snwhitehorn])dnl
886217309Snwhitehorndnl ---------------------------------------------------------------------------
887217309Snwhitehorndnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31
888217309Snwhitehorndnl --------------
889217309Snwhitehorndnl Allow user to disable a normally-on option.
890217309SnwhitehornAC_DEFUN([CF_ARG_DISABLE],
891217309Snwhitehorn[CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl
892217309Snwhitehorndnl ---------------------------------------------------------------------------
893217309Snwhitehorndnl CF_ARG_MSG_ENABLE version: 2 updated: 2000/07/29 19:32:03
894217309Snwhitehorndnl -----------------
895217309Snwhitehorndnl Verbose form of AC_ARG_ENABLE:
896217309Snwhitehorndnl
897217309Snwhitehorndnl Parameters:
898217309Snwhitehorndnl $1 = message
899217309Snwhitehorndnl $2 = option name
900217309Snwhitehorndnl $3 = help-string
901217309Snwhitehorndnl $4 = action to perform if option is enabled
902217309Snwhitehorndnl $5 = action if perform if option is disabled
903217309Snwhitehorndnl $6 = default option value (either 'yes' or 'no')
904217309SnwhitehornAC_DEFUN([CF_ARG_MSG_ENABLE],[
905217309SnwhitehornAC_MSG_CHECKING($1)
906217309SnwhitehornAC_ARG_ENABLE($2,[$3],,enableval=ifelse($6,,no,$6))
907217309SnwhitehornAC_MSG_RESULT($enableval)
908217309Snwhitehornif test "$enableval" != no ; then
909217309Snwhitehornifelse($4,,[	:],$4)
910217309Snwhitehornelse
911217309Snwhitehornifelse($5,,[	:],$5)
912217309Snwhitehornfi
913217309Snwhitehorn])dnl
914217309Snwhitehorndnl ---------------------------------------------------------------------------
915220749Snwhitehorndnl CF_ARG_OPTION version: 4 updated: 2010/05/26 05:38:42
916217309Snwhitehorndnl -------------
917217309Snwhitehorndnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus
918217309Snwhitehorndnl values.
919217309Snwhitehorndnl
920217309Snwhitehorndnl Parameters:
921217309Snwhitehorndnl $1 = option name
922217309Snwhitehorndnl $2 = help-string
923217309Snwhitehorndnl $3 = action to perform if option is not default
924217309Snwhitehorndnl $4 = action if perform if option is default
925217309Snwhitehorndnl $5 = default option value (either 'yes' or 'no')
926217309SnwhitehornAC_DEFUN([CF_ARG_OPTION],
927220749Snwhitehorn[AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes)
928217309Snwhitehorn  if test "$enableval" != "$5" ; then
929220749Snwhitehornifelse([$3],,[    :]dnl
930220749Snwhitehorn,[    $3]) ifelse([$4],,,[
931217309Snwhitehorn  else
932217309Snwhitehorn    $4])
933220749Snwhitehorn  fi],[enableval=$5 ifelse([$4],,,[
934217309Snwhitehorn  $4
935217309Snwhitehorn])dnl
936217309Snwhitehorn  ])])dnl
937217309Snwhitehorndnl ---------------------------------------------------------------------------
938251843Sbaptdnl CF_BUNDLED_INTL version: 17 updated: 2012/10/06 08:57:51
939217309Snwhitehorndnl ---------------
940217309Snwhitehorndnl Top-level macro for configuring an application with a bundled copy of
941217309Snwhitehorndnl the intl and po directories for gettext.
942217309Snwhitehorndnl
943217309Snwhitehorndnl $1 specifies either Makefile or makefile, defaulting to the former.
944217309Snwhitehorndnl $2 if nonempty sets the option to --enable-nls rather than to --disable-nls
945217309Snwhitehorndnl
946217309Snwhitehorndnl Sets variables which can be used to substitute in makefiles:
947217309Snwhitehorndnl	GT_YES       - "#" comment unless building intl library, otherwise empty
948217309Snwhitehorndnl	GT_NO        - "#" comment if building intl library, otherwise empty
949217309Snwhitehorndnl	INTLDIR_MAKE - to make ./intl directory
950217309Snwhitehorndnl	MSG_DIR_MAKE - to make ./po directory
951217309Snwhitehorndnl	SUB_MAKEFILE - list of makefiles in ./intl, ./po directories
952220749Snwhitehorndnl
953220749Snwhitehorndnl Defines:
954217309Snwhitehorndnl	HAVE_LIBGETTEXT_H if we're using ./intl
955220749Snwhitehorndnl	NLS_TEXTDOMAIN
956217309Snwhitehorndnl
957217309Snwhitehorndnl Environment:
958217309Snwhitehorndnl	ALL_LINGUAS if set, lists the root names of the ".po" files.
959217309Snwhitehorndnl	CONFIG_H assumed to be "config.h"
960220749Snwhitehorndnl	PACKAGE must be set, used as default for textdomain
961217309Snwhitehorndnl	VERSION may be set, otherwise extract from "VERSION" file.
962217309Snwhitehorndnl
963217309SnwhitehornAC_DEFUN([CF_BUNDLED_INTL],[
964217309Snwhitehorncf_makefile=ifelse($1,,Makefile,$1)
965217309Snwhitehorn
966217309Snwhitehorndnl Set of available languages (based on source distribution).  Note that
967217309Snwhitehorndnl setting $LINGUAS overrides $ALL_LINGUAS.  Some environments set $LINGUAS
968217309Snwhitehorndnl rather than $LC_ALL
969217309Snwhitehorntest -z "$ALL_LINGUAS" && ALL_LINGUAS=`test -d $srcdir/po && cd $srcdir/po && echo *.po|sed -e 's/\.po//g' -e 's/*//'`
970217309Snwhitehorn
971217309Snwhitehorn# Allow override of "config.h" definition:
972220749Snwhitehorn: ${CONFIG_H:=config.h}
973217309SnwhitehornAC_SUBST(CONFIG_H)
974217309Snwhitehorn
975220749Snwhitehornif test -z "$PACKAGE" ; then
976220749Snwhitehorn	AC_MSG_ERROR([[CF_BUNDLED_INTL] used without setting [PACKAGE] variable])
977220749Snwhitehornfi
978220749Snwhitehorn
979217309Snwhitehornif test -z "$VERSION" ; then
980217309Snwhitehornif test -f $srcdir/VERSION ; then
981217309Snwhitehorn	VERSION=`sed -e '2,$d' $srcdir/VERSION|cut -f1`
982217309Snwhitehornelse
983217309Snwhitehorn	VERSION=unknown
984217309Snwhitehornfi
985217309Snwhitehornfi
986217309SnwhitehornAC_SUBST(VERSION)
987217309Snwhitehorn
988217309SnwhitehornAM_GNU_GETTEXT(,,,[$2])
989217309Snwhitehorn
990220749Snwhitehornif test "$USE_NLS" = yes ; then
991220749Snwhitehorn	AC_ARG_WITH(textdomain,
992220749Snwhitehorn		[  --with-textdomain=PKG   NLS text-domain (default is package name)],
993220749Snwhitehorn		[NLS_TEXTDOMAIN=$withval],
994220749Snwhitehorn		[NLS_TEXTDOMAIN=$PACKAGE])
995251843Sbapt	AC_DEFINE_UNQUOTED(NLS_TEXTDOMAIN,"$NLS_TEXTDOMAIN",[Define to the nls textdomain value])
996220749Snwhitehorn	AC_SUBST(NLS_TEXTDOMAIN)
997220749Snwhitehornfi
998220749Snwhitehorn
999217309SnwhitehornINTLDIR_MAKE=
1000217309SnwhitehornMSG_DIR_MAKE=
1001217309SnwhitehornSUB_MAKEFILE=
1002217309Snwhitehorn
1003217309Snwhitehorndnl this updates SUB_MAKEFILE and MSG_DIR_MAKE:
1004217309SnwhitehornCF_OUR_MESSAGES($1)
1005217309Snwhitehorn
1006217309Snwhitehornif test "$USE_INCLUDED_LIBINTL" = yes ; then
1007217309Snwhitehorn        if test "$nls_cv_force_use_gnu_gettext" = yes ; then
1008217309Snwhitehorn		:
1009217309Snwhitehorn	elif test "$nls_cv_use_gnu_gettext" = yes ; then
1010217309Snwhitehorn		:
1011217309Snwhitehorn	else
1012217309Snwhitehorn		INTLDIR_MAKE="#"
1013217309Snwhitehorn	fi
1014217309Snwhitehorn	if test -z "$INTLDIR_MAKE"; then
1015251843Sbapt		AC_DEFINE(HAVE_LIBGETTEXT_H,1,[Define to 1 if we have libgettext.h])
1016217309Snwhitehorn		for cf_makefile in \
1017217309Snwhitehorn			$srcdir/intl/Makefile.in \
1018217309Snwhitehorn			$srcdir/intl/makefile.in
1019217309Snwhitehorn		do
1020217309Snwhitehorn			if test -f "$cf_makefile" ; then
1021217309Snwhitehorn				SUB_MAKEFILE="$SUB_MAKEFILE `echo \"${cf_makefile}\"|sed -e 's,^'$srcdir/',,' -e 's/\.in$//'`:${cf_makefile}"
1022217309Snwhitehorn				break
1023217309Snwhitehorn			fi
1024217309Snwhitehorn		done
1025217309Snwhitehorn	fi
1026217309Snwhitehornelse
1027217309Snwhitehorn	INTLDIR_MAKE="#"
1028217309Snwhitehorn	if test "$USE_NLS" = yes ; then
1029217309Snwhitehorn		AC_CHECK_HEADERS(libintl.h)
1030217309Snwhitehorn	fi
1031217309Snwhitehornfi
1032217309Snwhitehorn
1033217309Snwhitehornif test -z "$INTLDIR_MAKE" ; then
1034217309Snwhitehorn	CPPFLAGS="$CPPFLAGS -I../intl"
1035217309Snwhitehornfi
1036217309Snwhitehorn
1037217309Snwhitehorndnl FIXME:  we use this in lynx (the alternative is a spurious dependency upon
1038217309Snwhitehorndnl GNU make)
1039217309Snwhitehornif test "$BUILD_INCLUDED_LIBINTL" = yes ; then
1040217309Snwhitehorn	GT_YES="#"
1041217309Snwhitehorn	GT_NO=
1042217309Snwhitehornelse
1043217309Snwhitehorn	GT_YES=
1044217309Snwhitehorn	GT_NO="#"
1045217309Snwhitehornfi
1046217309Snwhitehorn
1047217309SnwhitehornAC_SUBST(INTLDIR_MAKE)
1048217309SnwhitehornAC_SUBST(MSG_DIR_MAKE)
1049217309SnwhitehornAC_SUBST(GT_YES)
1050217309SnwhitehornAC_SUBST(GT_NO)
1051217309Snwhitehorn
1052217309Snwhitehorndnl FIXME:  the underlying AM_GNU_GETTEXT macro either needs some fixes or a
1053217309Snwhitehorndnl little documentation.  It doesn't define anything so that we can ifdef our
1054217309Snwhitehorndnl own code, except ENABLE_NLS, which is too vague to be of any use.
1055217309Snwhitehorn
1056217309Snwhitehornif test "$USE_INCLUDED_LIBINTL" = yes ; then
1057217309Snwhitehorn	if test "$nls_cv_force_use_gnu_gettext" = yes ; then
1058251843Sbapt		AC_DEFINE(HAVE_GETTEXT,1,[Define to 1 if we have gettext function])
1059217309Snwhitehorn	elif test "$nls_cv_use_gnu_gettext" = yes ; then
1060251843Sbapt		AC_DEFINE(HAVE_GETTEXT,1,[Define to 1 if we have gettext function])
1061217309Snwhitehorn	fi
1062217309Snwhitehorn	if test -n "$nls_cv_header_intl" ; then
1063251843Sbapt		AC_DEFINE(HAVE_LIBINTL_H,1,[Define to 1 if we have header-file for libintl])
1064217309Snwhitehorn	fi
1065217309Snwhitehornfi
1066217309Snwhitehorn])dnl
1067217309Snwhitehorndnl ---------------------------------------------------------------------------
1068251843Sbaptdnl CF_CC_ENV_FLAGS version: 1 updated: 2012/10/03 05:25:49
1069251843Sbaptdnl ---------------
1070251843Sbaptdnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content
1071251843Sbaptdnl into CC.  This will not help with broken scripts that wrap the compiler with
1072251843Sbaptdnl options, but eliminates a more common category of user confusion.
1073251843SbaptAC_DEFUN([CF_CC_ENV_FLAGS],
1074251843Sbapt[
1075251843Sbapt# This should have been defined by AC_PROG_CC
1076251843Sbapt: ${CC:=cc}
1077251843Sbapt
1078251843SbaptAC_MSG_CHECKING(\$CC variable)
1079251843Sbaptcase "$CC" in #(vi
1080251843Sbapt*[[\ \	]]-[[IUD]]*)
1081251843Sbapt	AC_MSG_RESULT(broken)
1082251843Sbapt	AC_MSG_WARN(your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options)
1083251843Sbapt	# humor him...
1084251843Sbapt	cf_flags=`echo "$CC" | sed -e 's/^[[^ 	]]*[[ 	]]//'`
1085251843Sbapt	CC=`echo "$CC" | sed -e 's/[[ 	]].*//'`
1086251843Sbapt	CF_ADD_CFLAGS($cf_flags)
1087251843Sbapt	;;
1088251843Sbapt*)
1089251843Sbapt	AC_MSG_RESULT(ok)
1090251843Sbapt	;;
1091251843Sbaptesac
1092251843Sbapt])dnl
1093251843Sbaptdnl ---------------------------------------------------------------------------
1094251843Sbaptdnl CF_CHECK_CACHE version: 12 updated: 2012/10/02 20:55:03
1095217309Snwhitehorndnl --------------
1096217309Snwhitehorndnl Check if we're accidentally using a cache from a different machine.
1097217309Snwhitehorndnl Derive the system name, as a check for reusing the autoconf cache.
1098217309Snwhitehorndnl
1099217309Snwhitehorndnl If we've packaged config.guess and config.sub, run that (since it does a
1100217309Snwhitehorndnl better job than uname).  Normally we'll use AC_CANONICAL_HOST, but allow
1101217309Snwhitehorndnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM
1102217309Snwhitehorndnl which is useful in cross-compiles.
1103217309Snwhitehorndnl
1104217309Snwhitehorndnl Note: we would use $ac_config_sub, but that is one of the places where
1105217309Snwhitehorndnl autoconf 2.5x broke compatibility with autoconf 2.13
1106217309SnwhitehornAC_DEFUN([CF_CHECK_CACHE],
1107217309Snwhitehorn[
1108217309Snwhitehornif test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then
1109217309Snwhitehorn	ifelse([$1],,[AC_CANONICAL_HOST],[$1])
1110217309Snwhitehorn	system_name="$host_os"
1111217309Snwhitehornelse
1112217309Snwhitehorn	system_name="`(uname -s -r) 2>/dev/null`"
1113217309Snwhitehorn	if test -z "$system_name" ; then
1114217309Snwhitehorn		system_name="`(hostname) 2>/dev/null`"
1115217309Snwhitehorn	fi
1116217309Snwhitehornfi
1117251843Sbapttest -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name",[Define to the system name.])
1118217309SnwhitehornAC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
1119217309Snwhitehorn
1120217309Snwhitehorntest -z "$system_name" && system_name="$cf_cv_system_name"
1121217309Snwhitehorntest -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name)
1122217309Snwhitehorn
1123217309Snwhitehornif test ".$system_name" != ".$cf_cv_system_name" ; then
1124217309Snwhitehorn	AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name))
1125217309Snwhitehorn	AC_MSG_ERROR("Please remove config.cache and try again.")
1126217309Snwhitehornfi
1127217309Snwhitehorn])dnl
1128217309Snwhitehorndnl ---------------------------------------------------------------------------
1129255852Sdteskednl CF_CHECK_LIBTOOL_VERSION version: 1 updated: 2013/04/06 18:03:09
1130255852Sdteskednl ------------------------
1131255852Sdteskednl Show the version of libtool
1132255852Sdteskednl
1133255852Sdteskednl Save the version in a cache variable - this is not entirely a good thing,
1134255852Sdteskednl but the version string from libtool is very ugly, and for bug reports it
1135255852Sdteskednl might be useful to have the original string.
1136255852SdteskeAC_DEFUN([CF_CHECK_LIBTOOL_VERSION],[
1137255852Sdteskeif test -n "$LIBTOOL" && test "$LIBTOOL" != none
1138255852Sdteskethen
1139255852Sdteske	AC_MSG_CHECKING(version of $LIBTOOL)
1140255852Sdteske	CF_LIBTOOL_VERSION
1141255852Sdteske	AC_MSG_RESULT($cf_cv_libtool_version)
1142255852Sdteske	if test -z "$cf_cv_libtool_version" ; then
1143255852Sdteske		AC_MSG_ERROR(This is not GNU libtool)
1144255852Sdteske	fi
1145255852Sdteskeelse
1146255852Sdteske	AC_MSG_ERROR(GNU libtool has not been found)
1147255852Sdteskefi
1148255852Sdteske])dnl
1149255852Sdteskednl ---------------------------------------------------------------------------
1150251843Sbaptdnl CF_CLANG_COMPILER version: 1 updated: 2012/06/16 14:55:39
1151251843Sbaptdnl -----------------
1152251843Sbaptdnl Check if the given compiler is really clang.  clang's C driver defines
1153251843Sbaptdnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does
1154251843Sbaptdnl not ignore some gcc options.
1155251843Sbaptdnl
1156251843Sbaptdnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
1157251843Sbaptdnl ensure that it is not mistaken for gcc/g++.  It is normally invoked from
1158251843Sbaptdnl the wrappers for gcc and g++ warnings.
1159251843Sbaptdnl
1160251843Sbaptdnl $1 = GCC (default) or GXX
1161251843Sbaptdnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
1162251843Sbaptdnl $3 = CFLAGS (default) or CXXFLAGS
1163251843SbaptAC_DEFUN([CF_CLANG_COMPILER],[
1164251843Sbaptifelse([$2],,CLANG_COMPILER,[$2])=no
1165251843Sbapt
1166251843Sbaptif test "$ifelse([$1],,[$1],GCC)" = yes ; then
1167251843Sbapt	AC_MSG_CHECKING(if this is really Clang ifelse([$1],GXX,C++,C) compiler)
1168251843Sbapt	cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])"
1169251843Sbapt	ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -Qunused-arguments"
1170251843Sbapt	AC_TRY_COMPILE([],[
1171251843Sbapt#ifdef __clang__
1172251843Sbapt#else
1173251843Sbaptmake an error
1174251843Sbapt#endif
1175251843Sbapt],[ifelse([$2],,CLANG_COMPILER,[$2])=yes
1176251843Sbaptcf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments"
1177251843Sbapt],[])
1178251843Sbapt	ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
1179251843Sbapt	AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2]))
1180251843Sbaptfi
1181251843Sbapt])
1182251843Sbaptdnl ---------------------------------------------------------------------------
1183251843Sbaptdnl CF_CURSES_CHTYPE version: 8 updated: 2012/10/06 08:57:51
1184217309Snwhitehorndnl ----------------
1185217309Snwhitehorndnl Test if curses defines 'chtype' (usually a 'long' type for SysV curses).
1186217309SnwhitehornAC_DEFUN([CF_CURSES_CHTYPE],
1187217309Snwhitehorn[
1188217309SnwhitehornAC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
1189217309SnwhitehornAC_CACHE_CHECK(for chtype typedef,cf_cv_chtype_decl,[
1190220749Snwhitehorn	AC_TRY_COMPILE([#include <${cf_cv_ncurses_header:-curses.h}>],
1191217309Snwhitehorn		[chtype foo],
1192217309Snwhitehorn		[cf_cv_chtype_decl=yes],
1193217309Snwhitehorn		[cf_cv_chtype_decl=no])])
1194217309Snwhitehornif test $cf_cv_chtype_decl = yes ; then
1195251843Sbapt	AC_DEFINE(HAVE_TYPE_CHTYPE,1,[Define to 1 if chtype is declared])
1196217309Snwhitehorn	AC_CACHE_CHECK(if chtype is scalar or struct,cf_cv_chtype_type,[
1197220749Snwhitehorn		AC_TRY_COMPILE([#include <${cf_cv_ncurses_header:-curses.h}>],
1198217309Snwhitehorn			[chtype foo; long x = foo],
1199217309Snwhitehorn			[cf_cv_chtype_type=scalar],
1200217309Snwhitehorn			[cf_cv_chtype_type=struct])])
1201217309Snwhitehorn	if test $cf_cv_chtype_type = scalar ; then
1202251843Sbapt		AC_DEFINE(TYPE_CHTYPE_IS_SCALAR,1,[Define to 1 if chtype is a scaler/integer])
1203217309Snwhitehorn	fi
1204217309Snwhitehornfi
1205217309Snwhitehorn])dnl
1206217309Snwhitehorndnl ---------------------------------------------------------------------------
1207217309Snwhitehorndnl CF_CURSES_CONFIG version: 2 updated: 2006/10/29 11:06:27
1208217309Snwhitehorndnl ----------------
1209217309Snwhitehorndnl Tie together the configure-script macros for curses.  It may be ncurses,
1210217309Snwhitehorndnl but unless asked, we do not make a special search for ncurses.  However,
1211217309Snwhitehorndnl still check for the ncurses version number, for use in other macros.
1212217309SnwhitehornAC_DEFUN([CF_CURSES_CONFIG],
1213217309Snwhitehorn[
1214217309SnwhitehornCF_CURSES_CPPFLAGS
1215217309SnwhitehornCF_NCURSES_VERSION
1216217309SnwhitehornCF_CURSES_LIBS
1217217309Snwhitehorn])dnl
1218217309Snwhitehorndnl ---------------------------------------------------------------------------
1219224014Snwhitehorndnl CF_CURSES_CPPFLAGS version: 11 updated: 2011/04/09 14:51:08
1220217309Snwhitehorndnl ------------------
1221217309Snwhitehorndnl Look for the curses headers.
1222217309SnwhitehornAC_DEFUN([CF_CURSES_CPPFLAGS],[
1223217309Snwhitehorn
1224217309SnwhitehornAC_CACHE_CHECK(for extra include directories,cf_cv_curses_incdir,[
1225217309Snwhitehorncf_cv_curses_incdir=no
1226217309Snwhitehorncase $host_os in #(vi
1227217309Snwhitehornhpux10.*) #(vi
1228224014Snwhitehorn	if test "x$cf_cv_screen" = "xcurses_colr"
1229224014Snwhitehorn	then
1230224014Snwhitehorn		test -d /usr/include/curses_colr && \
1231224014Snwhitehorn		cf_cv_curses_incdir="-I/usr/include/curses_colr"
1232224014Snwhitehorn	fi
1233217309Snwhitehorn	;;
1234217309Snwhitehornsunos3*|sunos4*)
1235224014Snwhitehorn	if test "x$cf_cv_screen" = "xcurses_5lib"
1236224014Snwhitehorn	then
1237224014Snwhitehorn		test -d /usr/5lib && \
1238224014Snwhitehorn		test -d /usr/5include && \
1239224014Snwhitehorn		cf_cv_curses_incdir="-I/usr/5include"
1240224014Snwhitehorn	fi
1241217309Snwhitehorn	;;
1242217309Snwhitehornesac
1243217309Snwhitehorn])
1244217309Snwhitehorntest "$cf_cv_curses_incdir" != no && CPPFLAGS="$CPPFLAGS $cf_cv_curses_incdir"
1245217309Snwhitehorn
1246217309SnwhitehornCF_CURSES_HEADER
1247217309SnwhitehornCF_TERM_HEADER
1248217309Snwhitehorn])dnl
1249217309Snwhitehorndnl ---------------------------------------------------------------------------
1250224014Snwhitehorndnl CF_CURSES_FUNCS version: 17 updated: 2011/05/14 16:07:29
1251217309Snwhitehorndnl ---------------
1252217309Snwhitehorndnl Curses-functions are a little complicated, since a lot of them are macros.
1253217309SnwhitehornAC_DEFUN([CF_CURSES_FUNCS],
1254217309Snwhitehorn[
1255217309SnwhitehornAC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
1256217309SnwhitehornAC_REQUIRE([CF_XOPEN_CURSES])
1257217309SnwhitehornAC_REQUIRE([CF_CURSES_TERM_H])
1258224014SnwhitehornAC_REQUIRE([CF_CURSES_UNCTRL_H])
1259217309Snwhitehornfor cf_func in $1
1260217309Snwhitehorndo
1261217309Snwhitehorn	CF_UPPER(cf_tr_func,$cf_func)
1262217309Snwhitehorn	AC_MSG_CHECKING(for ${cf_func})
1263217309Snwhitehorn	CF_MSG_LOG(${cf_func})
1264217309Snwhitehorn	AC_CACHE_VAL(cf_cv_func_$cf_func,[
1265217309Snwhitehorn		eval cf_result='$ac_cv_func_'$cf_func
1266217309Snwhitehorn		if test ".$cf_result" != ".no"; then
1267217309Snwhitehorn			AC_TRY_LINK(CF__CURSES_HEAD,
1268217309Snwhitehorn			[
1269217309Snwhitehorn#ifndef ${cf_func}
1270217309Snwhitehornlong foo = (long)(&${cf_func});
1271224014Snwhitehornif (foo + 1234 > 5678)
1272224014Snwhitehorn	${cf_cv_main_return:-return}(foo);
1273217309Snwhitehorn#endif
1274217309Snwhitehorn			],
1275217309Snwhitehorn			[cf_result=yes],
1276217309Snwhitehorn			[cf_result=no])
1277217309Snwhitehorn		fi
1278217309Snwhitehorn		eval 'cf_cv_func_'$cf_func'=$cf_result'
1279217309Snwhitehorn	])
1280217309Snwhitehorn	# use the computed/retrieved cache-value:
1281217309Snwhitehorn	eval 'cf_result=$cf_cv_func_'$cf_func
1282217309Snwhitehorn	AC_MSG_RESULT($cf_result)
1283217309Snwhitehorn	if test $cf_result != no; then
1284217309Snwhitehorn		AC_DEFINE_UNQUOTED(HAVE_${cf_tr_func})
1285217309Snwhitehorn	fi
1286217309Snwhitehorndone
1287217309Snwhitehorn])dnl
1288217309Snwhitehorndnl ---------------------------------------------------------------------------
1289224014Snwhitehorndnl CF_CURSES_HEADER version: 3 updated: 2011/05/01 19:47:45
1290217309Snwhitehorndnl ----------------
1291217309Snwhitehorndnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
1292217309Snwhitehorndnl variations of ncurses' installs.
1293217309Snwhitehorndnl
1294217309Snwhitehorndnl $1 = ncurses when looking for ncurses, or is empty
1295217309SnwhitehornAC_DEFUN([CF_CURSES_HEADER],[
1296217309SnwhitehornAC_CACHE_CHECK(if we have identified curses headers,cf_cv_ncurses_header,[
1297217309Snwhitehorncf_cv_ncurses_header=none
1298217309Snwhitehornfor cf_header in ifelse($1,,,[ \
1299224014Snwhitehorn    $1/ncurses.h \
1300224014Snwhitehorn	$1/curses.h]) \
1301224014Snwhitehorn	ncurses.h \
1302224014Snwhitehorn	curses.h ifelse($1,,[ncurses/ncurses.h ncurses/curses.h])
1303217309Snwhitehorndo
1304217309SnwhitehornAC_TRY_COMPILE([#include <${cf_header}>],
1305217309Snwhitehorn	[initscr(); tgoto("?", 0,0)],
1306217309Snwhitehorn	[cf_cv_ncurses_header=$cf_header; break],[])
1307217309Snwhitehorndone
1308217309Snwhitehorn])
1309217309Snwhitehorn
1310217309Snwhitehornif test "$cf_cv_ncurses_header" = none ; then
1311217309Snwhitehorn	AC_MSG_ERROR(No curses header-files found)
1312217309Snwhitehornfi
1313217309Snwhitehorn
1314217309Snwhitehorn# cheat, to get the right #define's for HAVE_NCURSES_H, etc.
1315217309SnwhitehornAC_CHECK_HEADERS($cf_cv_ncurses_header)
1316217309Snwhitehorn])dnl
1317217309Snwhitehorndnl ---------------------------------------------------------------------------
1318255852Sdteskednl CF_CURSES_LIBS version: 37 updated: 2013/02/09 17:33:50
1319217309Snwhitehorndnl --------------
1320217309Snwhitehorndnl Look for the curses libraries.  Older curses implementations may require
1321217309Snwhitehorndnl termcap/termlib to be linked as well.  Call CF_CURSES_CPPFLAGS first.
1322217309SnwhitehornAC_DEFUN([CF_CURSES_LIBS],[
1323217309Snwhitehorn
1324217309SnwhitehornAC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
1325217309SnwhitehornAC_MSG_CHECKING(if we have identified curses libraries)
1326220749SnwhitehornAC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
1327217309Snwhitehorn    [initscr(); tgoto("?", 0,0)],
1328217309Snwhitehorn    cf_result=yes,
1329217309Snwhitehorn    cf_result=no)
1330217309SnwhitehornAC_MSG_RESULT($cf_result)
1331217309Snwhitehorn
1332217309Snwhitehornif test "$cf_result" = no ; then
1333217309Snwhitehorncase $host_os in #(vi
1334217309Snwhitehornfreebsd*) #(vi
1335220749Snwhitehorn    AC_CHECK_LIB(mytinfo,tgoto,[CF_ADD_LIBS(-lmytinfo)])
1336217309Snwhitehorn    ;;
1337217309Snwhitehornhpux10.*) #(vi
1338224014Snwhitehorn	# Looking at HPUX 10.20, the Hcurses library is the oldest (1997), cur_colr
1339224014Snwhitehorn	# next (1998), and xcurses "newer" (2000).  There is no header file for
1340224014Snwhitehorn	# Hcurses; the subdirectory curses_colr has the headers (curses.h and
1341224014Snwhitehorn	# term.h) for cur_colr
1342224014Snwhitehorn	if test "x$cf_cv_screen" = "xcurses_colr"
1343224014Snwhitehorn	then
1344224014Snwhitehorn		AC_CHECK_LIB(cur_colr,initscr,[
1345224014Snwhitehorn			CF_ADD_LIBS(-lcur_colr)
1346224014Snwhitehorn			ac_cv_func_initscr=yes
1347224014Snwhitehorn			],[
1348224014Snwhitehorn		AC_CHECK_LIB(Hcurses,initscr,[
1349224014Snwhitehorn			# HP's header uses __HP_CURSES, but user claims _HP_CURSES.
1350224014Snwhitehorn			CF_ADD_LIBS(-lHcurses)
1351224014Snwhitehorn			CPPFLAGS="$CPPFLAGS -D__HP_CURSES -D_HP_CURSES"
1352224014Snwhitehorn			ac_cv_func_initscr=yes
1353224014Snwhitehorn			])])
1354224014Snwhitehorn	fi
1355255852Sdteske	;;
1356220749Snwhitehornlinux*)
1357224014Snwhitehorn	case `arch 2>/dev/null` in
1358220749Snwhitehorn	x86_64)
1359220749Snwhitehorn		if test -d /lib64
1360220749Snwhitehorn		then
1361220749Snwhitehorn			CF_ADD_LIBDIR(/lib64)
1362220749Snwhitehorn		else
1363220749Snwhitehorn			CF_ADD_LIBDIR(/lib)
1364220749Snwhitehorn		fi
1365220749Snwhitehorn		;;
1366220749Snwhitehorn	*)
1367220749Snwhitehorn		CF_ADD_LIBDIR(/lib)
1368220749Snwhitehorn		;;
1369220749Snwhitehorn	esac
1370255852Sdteske	;;
1371217309Snwhitehornsunos3*|sunos4*)
1372224014Snwhitehorn	if test "x$cf_cv_screen" = "xcurses_5lib"
1373224014Snwhitehorn	then
1374224014Snwhitehorn		if test -d /usr/5lib ; then
1375224014Snwhitehorn			CF_ADD_LIBDIR(/usr/5lib)
1376224014Snwhitehorn			CF_ADD_LIBS(-lcurses -ltermcap)
1377224014Snwhitehorn		fi
1378217309Snwhitehorn    fi
1379217309Snwhitehorn    ac_cv_func_initscr=yes
1380217309Snwhitehorn    ;;
1381217309Snwhitehornesac
1382217309Snwhitehorn
1383217309Snwhitehornif test ".$ac_cv_func_initscr" != .yes ; then
1384255852Sdteske	cf_save_LIBS="$LIBS"
1385217309Snwhitehorn
1386255852Sdteske	if test ".${cf_cv_ncurses_version:-no}" != .no
1387255852Sdteske	then
1388255852Sdteske		cf_check_list="ncurses curses cursesX"
1389255852Sdteske	else
1390255852Sdteske		cf_check_list="cursesX curses ncurses"
1391255852Sdteske	fi
1392217309Snwhitehorn
1393255852Sdteske	# Check for library containing tgoto.  Do this before curses library
1394255852Sdteske	# because it may be needed to link the test-case for initscr.
1395255852Sdteske	if test "x$cf_term_lib" = x
1396255852Sdteske	then
1397255852Sdteske		AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[
1398255852Sdteske			for cf_term_lib in $cf_check_list otermcap termcap tinfo termlib unknown
1399255852Sdteske			do
1400255852Sdteske				AC_CHECK_LIB($cf_term_lib,tgoto,[break])
1401255852Sdteske			done
1402255852Sdteske		])
1403255852Sdteske	fi
1404217309Snwhitehorn
1405255852Sdteske	# Check for library containing initscr
1406255852Sdteske	test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS"
1407255852Sdteske	if test "x$cf_curs_lib" = x
1408255852Sdteske	then
1409255852Sdteske		for cf_curs_lib in $cf_check_list xcurses jcurses pdcurses unknown
1410255852Sdteske		do
1411255852Sdteske			AC_CHECK_LIB($cf_curs_lib,initscr,[break])
1412255852Sdteske		done
1413255852Sdteske	fi
1414255852Sdteske	test $cf_curs_lib = unknown && AC_MSG_ERROR(no curses library found)
1415217309Snwhitehorn
1416255852Sdteske	LIBS="-l$cf_curs_lib $cf_save_LIBS"
1417255852Sdteske	if test "$cf_term_lib" = unknown ; then
1418255852Sdteske		AC_MSG_CHECKING(if we can link with $cf_curs_lib library)
1419255852Sdteske		AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
1420255852Sdteske			[initscr()],
1421255852Sdteske			[cf_result=yes],
1422255852Sdteske			[cf_result=no])
1423255852Sdteske		AC_MSG_RESULT($cf_result)
1424255852Sdteske		test $cf_result = no && AC_MSG_ERROR(Cannot link curses library)
1425255852Sdteske	elif test "$cf_curs_lib" = "$cf_term_lib" ; then
1426255852Sdteske		:
1427255852Sdteske	elif test "$cf_term_lib" != predefined ; then
1428255852Sdteske		AC_MSG_CHECKING(if we need both $cf_curs_lib and $cf_term_lib libraries)
1429255852Sdteske		AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
1430255852Sdteske			[initscr(); tgoto((char *)0, 0, 0);],
1431255852Sdteske			[cf_result=no],
1432255852Sdteske			[
1433255852Sdteske			LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS"
1434255852Sdteske			AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
1435255852Sdteske				[initscr()],
1436255852Sdteske				[cf_result=yes],
1437255852Sdteske				[cf_result=error])
1438255852Sdteske			])
1439255852Sdteske		AC_MSG_RESULT($cf_result)
1440255852Sdteske	fi
1441217309Snwhitehornfi
1442217309Snwhitehornfi
1443217309Snwhitehorn
1444217309Snwhitehorn])dnl
1445217309Snwhitehorndnl ---------------------------------------------------------------------------
1446251843Sbaptdnl CF_CURSES_TERM_H version: 10 updated: 2012/10/06 08:57:51
1447217309Snwhitehorndnl ----------------
1448217309Snwhitehorndnl SVr4 curses should have term.h as well (where it puts the definitions of
1449217309Snwhitehorndnl the low-level interface).  This may not be true in old/broken implementations,
1450217309Snwhitehorndnl as well as in misconfigured systems (e.g., gcc configured for Solaris 2.4
1451217309Snwhitehorndnl running with Solaris 2.5.1).
1452217309SnwhitehornAC_DEFUN([CF_CURSES_TERM_H],
1453217309Snwhitehorn[
1454217309SnwhitehornAC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
1455217309Snwhitehorn
1456217309SnwhitehornAC_CACHE_CHECK(for term.h, cf_cv_term_header,[
1457217309Snwhitehorn
1458217309Snwhitehorn# If we found <ncurses/curses.h>, look for <ncurses/term.h>, but always look
1459217309Snwhitehorn# for <term.h> if we do not find the variant.
1460224014Snwhitehorn
1461224014Snwhitehorncf_header_list="term.h ncurses/term.h ncursesw/term.h"
1462224014Snwhitehorn
1463224014Snwhitehorncase ${cf_cv_ncurses_header:-curses.h} in #(vi
1464224014Snwhitehorn*/*)
1465224014Snwhitehorn	cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`term.h
1466224014Snwhitehorn	cf_header_list="$cf_header_item $cf_header_list"
1467224014Snwhitehorn	;;
1468224014Snwhitehornesac
1469224014Snwhitehorn
1470224014Snwhitehornfor cf_header in $cf_header_list
1471217309Snwhitehorndo
1472217309Snwhitehorn	AC_TRY_COMPILE([
1473220749Snwhitehorn#include <${cf_cv_ncurses_header:-curses.h}>
1474217309Snwhitehorn#include <${cf_header}>],
1475217309Snwhitehorn	[WINDOW *x],
1476217309Snwhitehorn	[cf_cv_term_header=$cf_header
1477217309Snwhitehorn	 break],
1478217309Snwhitehorn	[cf_cv_term_header=no])
1479217309Snwhitehorndone
1480217309Snwhitehorn
1481217309Snwhitehorncase $cf_cv_term_header in #(vi
1482217309Snwhitehornno)
1483217309Snwhitehorn	# If curses is ncurses, some packagers still mess it up by trying to make
1484217309Snwhitehorn	# us use GNU termcap.  This handles the most common case.
1485217309Snwhitehorn	for cf_header in ncurses/term.h ncursesw/term.h
1486217309Snwhitehorn	do
1487217309Snwhitehorn		AC_TRY_COMPILE([
1488220749Snwhitehorn#include <${cf_cv_ncurses_header:-curses.h}>
1489217309Snwhitehorn#ifdef NCURSES_VERSION
1490217309Snwhitehorn#include <${cf_header}>
1491217309Snwhitehorn#else
1492217309Snwhitehornmake an error
1493217309Snwhitehorn#endif],
1494217309Snwhitehorn			[WINDOW *x],
1495217309Snwhitehorn			[cf_cv_term_header=$cf_header
1496217309Snwhitehorn			 break],
1497217309Snwhitehorn			[cf_cv_term_header=no])
1498217309Snwhitehorn	done
1499217309Snwhitehorn	;;
1500217309Snwhitehornesac
1501217309Snwhitehorn])
1502217309Snwhitehorn
1503217309Snwhitehorncase $cf_cv_term_header in #(vi
1504217309Snwhitehornterm.h) #(vi
1505251843Sbapt	AC_DEFINE(HAVE_TERM_H,1,[Define to 1 if we have term.h])
1506217309Snwhitehorn	;;
1507217309Snwhitehornncurses/term.h) #(vi
1508251843Sbapt	AC_DEFINE(HAVE_NCURSES_TERM_H,1,[Define to 1 if we have ncurses/term.h])
1509217309Snwhitehorn	;;
1510217309Snwhitehornncursesw/term.h)
1511251843Sbapt	AC_DEFINE(HAVE_NCURSESW_TERM_H,1,[Define to 1 if we have ncursesw/term.h])
1512217309Snwhitehorn	;;
1513217309Snwhitehornesac
1514217309Snwhitehorn])dnl
1515217309Snwhitehorndnl ---------------------------------------------------------------------------
1516251843Sbaptdnl CF_CURSES_UNCTRL_H version: 2 updated: 2012/10/06 08:57:51
1517224014Snwhitehorndnl ------------------
1518224014Snwhitehorndnl Any X/Open curses implementation must have unctrl.h, but ncurses packages
1519224014Snwhitehorndnl may put it in a subdirectory (along with ncurses' other headers, of
1520224014Snwhitehorndnl course).  Packages which put the headers in inconsistent locations are
1521224014Snwhitehorndnl broken).
1522224014SnwhitehornAC_DEFUN([CF_CURSES_UNCTRL_H],
1523224014Snwhitehorn[
1524224014SnwhitehornAC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
1525224014Snwhitehorn
1526224014SnwhitehornAC_CACHE_CHECK(for unctrl.h, cf_cv_unctrl_header,[
1527224014Snwhitehorn
1528224014Snwhitehorn# If we found <ncurses/curses.h>, look for <ncurses/unctrl.h>, but always look
1529224014Snwhitehorn# for <unctrl.h> if we do not find the variant.
1530224014Snwhitehorn
1531224014Snwhitehorncf_header_list="unctrl.h ncurses/unctrl.h ncursesw/unctrl.h"
1532224014Snwhitehorn
1533224014Snwhitehorncase ${cf_cv_ncurses_header:-curses.h} in #(vi
1534224014Snwhitehorn*/*)
1535224014Snwhitehorn	cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`unctrl.h
1536224014Snwhitehorn	cf_header_list="$cf_header_item $cf_header_list"
1537224014Snwhitehorn	;;
1538224014Snwhitehornesac
1539224014Snwhitehorn
1540224014Snwhitehornfor cf_header in $cf_header_list
1541224014Snwhitehorndo
1542224014Snwhitehorn	AC_TRY_COMPILE([
1543224014Snwhitehorn#include <${cf_cv_ncurses_header:-curses.h}>
1544224014Snwhitehorn#include <${cf_header}>],
1545224014Snwhitehorn	[WINDOW *x],
1546224014Snwhitehorn	[cf_cv_unctrl_header=$cf_header
1547224014Snwhitehorn	 break],
1548224014Snwhitehorn	[cf_cv_unctrl_header=no])
1549224014Snwhitehorndone
1550224014Snwhitehorn
1551224014Snwhitehorncase $cf_cv_unctrl_header in #(vi
1552224014Snwhitehornno)
1553224014Snwhitehorn	AC_MSG_WARN(unctrl.h header not found)
1554224014Snwhitehorn	;;
1555224014Snwhitehornesac
1556224014Snwhitehorn])
1557224014Snwhitehorn
1558224014Snwhitehorncase $cf_cv_unctrl_header in #(vi
1559224014Snwhitehornunctrl.h) #(vi
1560251843Sbapt	AC_DEFINE(HAVE_UNCTRL_H,1,[Define to 1 if we have unctrl.h])
1561224014Snwhitehorn	;;
1562224014Snwhitehornncurses/unctrl.h) #(vi
1563251843Sbapt	AC_DEFINE(HAVE_NCURSES_UNCTRL_H,1,[Define to 1 if we have ncurses/unctrl.h])
1564224014Snwhitehorn	;;
1565224014Snwhitehornncursesw/unctrl.h)
1566251843Sbapt	AC_DEFINE(HAVE_NCURSESW_UNCTRL_H,1,[Define to 1 if we have ncursesw/unctrl.h])
1567224014Snwhitehorn	;;
1568224014Snwhitehornesac
1569224014Snwhitehorn])dnl
1570224014Snwhitehorndnl ---------------------------------------------------------------------------
1571251843Sbaptdnl CF_CURSES_WACS_MAP version: 6 updated: 2012/10/06 08:57:51
1572220749Snwhitehorndnl ------------------
1573220749Snwhitehorndnl Check for likely values of wacs_map[].
1574220749SnwhitehornAC_DEFUN([CF_CURSES_WACS_MAP],
1575220749Snwhitehorn[
1576220749SnwhitehornAC_CACHE_CHECK(for wide alternate character set array, cf_cv_curses_wacs_map,[
1577220749Snwhitehorn	cf_cv_curses_wacs_map=unknown
1578220749Snwhitehorn	for name in wacs_map _wacs_map __wacs_map _nc_wacs _wacs_char
1579220749Snwhitehorn	do
1580220749Snwhitehorn	AC_TRY_LINK([
1581220749Snwhitehorn#ifndef _XOPEN_SOURCE_EXTENDED
1582220749Snwhitehorn#define _XOPEN_SOURCE_EXTENDED
1583220749Snwhitehorn#endif
1584220749Snwhitehorn#include <${cf_cv_ncurses_header:-curses.h}>],
1585220749Snwhitehorn	[void *foo = &($name['k'])],
1586220749Snwhitehorn	[cf_cv_curses_wacs_map=$name
1587220749Snwhitehorn	 break])
1588220749Snwhitehorn	done])
1589220749Snwhitehorn
1590251843Sbapttest "$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])
1591220749Snwhitehorn])dnl
1592220749Snwhitehorndnl ---------------------------------------------------------------------------
1593251843Sbaptdnl CF_CURSES_WACS_SYMBOLS version: 2 updated: 2012/10/06 08:57:51
1594220749Snwhitehorndnl ----------------------
1595220749Snwhitehorndnl Do a check to see if the WACS_xxx constants are defined compatibly with
1596220749Snwhitehorndnl X/Open Curses.  In particular, NetBSD's implementation of the WACS_xxx
1597220749Snwhitehorndnl constants is broken since those constants do not point to cchar_t's.
1598220749SnwhitehornAC_DEFUN([CF_CURSES_WACS_SYMBOLS],
1599220749Snwhitehorn[
1600220749SnwhitehornAC_REQUIRE([CF_CURSES_WACS_MAP])
1601220749Snwhitehorn
1602220749SnwhitehornAC_CACHE_CHECK(for wide alternate character constants, cf_cv_curses_wacs_symbols,[
1603220749Snwhitehorncf_cv_curses_wacs_symbols=no
1604220749Snwhitehornif test "$cf_cv_curses_wacs_map" != unknown
1605220749Snwhitehornthen
1606220749Snwhitehorn	AC_TRY_LINK([
1607220749Snwhitehorn#ifndef _XOPEN_SOURCE_EXTENDED
1608220749Snwhitehorn#define _XOPEN_SOURCE_EXTENDED
1609220749Snwhitehorn#endif
1610220749Snwhitehorn#include <${cf_cv_ncurses_header:-curses.h}>],
1611220749Snwhitehorn	[cchar_t *foo = WACS_PLUS;
1612220749Snwhitehorn	 $cf_cv_curses_wacs_map['k'] = *WACS_PLUS],
1613220749Snwhitehorn	[cf_cv_curses_wacs_symbols=yes])
1614220749Snwhitehornelse
1615220749Snwhitehorn	AC_TRY_LINK([
1616220749Snwhitehorn#ifndef _XOPEN_SOURCE_EXTENDED
1617220749Snwhitehorn#define _XOPEN_SOURCE_EXTENDED
1618220749Snwhitehorn#endif
1619220749Snwhitehorn#include <${cf_cv_ncurses_header:-curses.h}>],
1620220749Snwhitehorn	[cchar_t *foo = WACS_PLUS],
1621220749Snwhitehorn	[cf_cv_curses_wacs_symbols=yes])
1622220749Snwhitehornfi
1623220749Snwhitehorn])
1624220749Snwhitehorn
1625251843Sbapttest "$cf_cv_curses_wacs_symbols" != no && AC_DEFINE(CURSES_WACS_SYMBOLS,1,[Define to 1 if (n)curses supports wide-character WACS_ symbols])
1626220749Snwhitehorn])dnl
1627220749Snwhitehorndnl ---------------------------------------------------------------------------
1628251843Sbaptdnl CF_CURSES_WGETPARENT version: 3 updated: 2012/10/06 08:57:51
1629251843Sbaptdnl --------------------
1630251843Sbaptdnl Check for curses support for directly determining the parent of a given
1631251843Sbaptdnl window.  Some implementations make this difficult, so we provide for
1632251843Sbaptdnl defining an application-specific function that gives this functionality.
1633251843Sbaptdnl
1634251843Sbaptdnl $1 = name of function to use if the feature is missing
1635251843SbaptAC_DEFUN([CF_CURSES_WGETPARENT],[
1636251843SbaptCF_CURSES_FUNCS(wgetparent)
1637251843Sbaptif test "x$cf_cv_func_wgetparent" != xyes
1638251843Sbaptthen
1639251843Sbapt	AC_MSG_CHECKING(if WINDOW has _parent member)
1640251843Sbapt	AC_TRY_COMPILE([#include <${cf_cv_ncurses_header:-curses.h}>],
1641251843Sbapt		[WINDOW *p = stdscr->_parent],
1642251843Sbapt		[cf_window__parent=yes],
1643251843Sbapt		[cf_window__parent=no])
1644251843Sbapt	AC_MSG_RESULT($cf_window__parent)
1645251843Sbapt	if test "$cf_window__parent" = yes
1646251843Sbapt	then
1647251843Sbapt		AC_DEFINE(HAVE_WINDOW__PARENT,1,[Define to 1 if WINDOW struct has _parent member])
1648251843Sbapt	fi
1649251843Sbaptfi
1650251843Sbapt])dnl
1651251843Sbaptdnl ---------------------------------------------------------------------------
1652217309Snwhitehorndnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52
1653217309Snwhitehorndnl ----------
1654217309Snwhitehorndnl "dirname" is not portable, so we fake it with a shell script.
1655217309SnwhitehornAC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl
1656217309Snwhitehorndnl ---------------------------------------------------------------------------
1657251843Sbaptdnl CF_DISABLE_ECHO version: 12 updated: 2012/10/06 16:30:28
1658217309Snwhitehorndnl ---------------
1659217309Snwhitehorndnl You can always use "make -n" to see the actual options, but it's hard to
1660217309Snwhitehorndnl pick out/analyze warning messages when the compile-line is long.
1661217309Snwhitehorndnl
1662217309Snwhitehorndnl Sets:
1663217309Snwhitehorndnl	ECHO_LT - symbol to control if libtool is verbose
1664217309Snwhitehorndnl	ECHO_LD - symbol to prefix "cc -o" lines
1665217309Snwhitehorndnl	RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o)
1666217309Snwhitehorndnl	SHOW_CC - symbol to put before explicit "cc -c" lines
1667217309Snwhitehorndnl	ECHO_CC - symbol to put before any "cc" line
1668217309Snwhitehorndnl
1669217309SnwhitehornAC_DEFUN([CF_DISABLE_ECHO],[
1670217309SnwhitehornAC_MSG_CHECKING(if you want to see long compiling messages)
1671217309SnwhitehornCF_ARG_DISABLE(echo,
1672251843Sbapt	[  --disable-echo          do not display "compiling" commands],
1673217309Snwhitehorn	[
1674217309Snwhitehorn    ECHO_LT='--silent'
1675217309Snwhitehorn    ECHO_LD='@echo linking [$]@;'
1676217309Snwhitehorn    RULE_CC='@echo compiling [$]<'
1677217309Snwhitehorn    SHOW_CC='@echo compiling [$]@'
1678217309Snwhitehorn    ECHO_CC='@'
1679217309Snwhitehorn],[
1680217309Snwhitehorn    ECHO_LT=''
1681217309Snwhitehorn    ECHO_LD=''
1682217309Snwhitehorn    RULE_CC=''
1683217309Snwhitehorn    SHOW_CC=''
1684217309Snwhitehorn    ECHO_CC=''
1685217309Snwhitehorn])
1686217309SnwhitehornAC_MSG_RESULT($enableval)
1687217309SnwhitehornAC_SUBST(ECHO_LT)
1688217309SnwhitehornAC_SUBST(ECHO_LD)
1689217309SnwhitehornAC_SUBST(RULE_CC)
1690217309SnwhitehornAC_SUBST(SHOW_CC)
1691217309SnwhitehornAC_SUBST(ECHO_CC)
1692217309Snwhitehorn])dnl
1693217309Snwhitehorndnl ---------------------------------------------------------------------------
1694220749Snwhitehorndnl CF_DISABLE_LIBTOOL_VERSION version: 1 updated: 2010/05/15 15:45:59
1695220749Snwhitehorndnl --------------------------
1696220749Snwhitehorndnl Check if we should use the libtool 1.5 feature "-version-number" instead of
1697220749Snwhitehorndnl the older "-version-info" feature.  The newer feature allows us to use
1698220749Snwhitehorndnl version numbering on shared libraries which make them compatible with
1699220749Snwhitehorndnl various systems.
1700220749SnwhitehornAC_DEFUN([CF_DISABLE_LIBTOOL_VERSION],
1701220749Snwhitehorn[
1702220749SnwhitehornAC_MSG_CHECKING(if libtool -version-number should be used)
1703220749SnwhitehornCF_ARG_DISABLE(libtool-version,
1704220749Snwhitehorn	[  --disable-libtool-version  enable to use libtool's incompatible naming scheme],
1705220749Snwhitehorn	[cf_libtool_version=no],
1706220749Snwhitehorn	[cf_libtool_version=yes])
1707220749SnwhitehornAC_MSG_RESULT($cf_libtool_version)
1708220749Snwhitehorn
1709220749Snwhitehornif test "$cf_libtool_version" = yes ; then
1710220749Snwhitehorn	LIBTOOL_VERSION="-version-number"
1711220749Snwhitehornelse
1712220749Snwhitehorn	LIBTOOL_VERSION="-version-info"
1713220749Snwhitehornfi
1714220749Snwhitehorn
1715220749SnwhitehornAC_SUBST(LIBTOOL_VERSION)
1716220749Snwhitehorn])dnl
1717220749Snwhitehorndnl ---------------------------------------------------------------------------
1718224014Snwhitehorndnl CF_DISABLE_RPATH_HACK version: 2 updated: 2011/02/13 13:31:33
1719217309Snwhitehorndnl ---------------------
1720217309Snwhitehorndnl The rpath-hack makes it simpler to build programs, particularly with the
1721217309Snwhitehorndnl *BSD ports which may have essential libraries in unusual places.  But it
1722217309Snwhitehorndnl can interfere with building an executable for the base system.  Use this
1723217309Snwhitehorndnl option in that case.
1724217309SnwhitehornAC_DEFUN([CF_DISABLE_RPATH_HACK],
1725217309Snwhitehorn[
1726224014SnwhitehornAC_MSG_CHECKING(if rpath-hack should be disabled)
1727217309SnwhitehornCF_ARG_DISABLE(rpath-hack,
1728217309Snwhitehorn	[  --disable-rpath-hack    don't add rpath options for additional libraries],
1729217309Snwhitehorn	[cf_disable_rpath_hack=yes],
1730217309Snwhitehorn	[cf_disable_rpath_hack=no])
1731217309SnwhitehornAC_MSG_RESULT($cf_disable_rpath_hack)
1732217309Snwhitehornif test "$cf_disable_rpath_hack" = no ; then
1733217309Snwhitehorn	CF_RPATH_HACK
1734217309Snwhitehornfi
1735217309Snwhitehorn])
1736217309Snwhitehorndnl ---------------------------------------------------------------------------
1737255852Sdteskednl CF_ENABLE_RPATH version: 2 updated: 2010/03/27 18:39:42
1738255852Sdteskednl ---------------
1739255852Sdteskednl Check if the rpath option should be used, setting cache variable
1740255852Sdteskednl cf_cv_enable_rpath if so.
1741255852SdteskeAC_DEFUN([CF_ENABLE_RPATH],
1742255852Sdteske[
1743255852SdteskeAC_MSG_CHECKING(if rpath option should be used)
1744255852SdteskeAC_ARG_ENABLE(rpath,
1745255852Sdteske[  --enable-rpath          use rpath option when generating shared libraries],
1746255852Sdteske[cf_cv_enable_rpath=$enableval],
1747255852Sdteske[cf_cv_enable_rpath=no])
1748255852SdteskeAC_MSG_RESULT($cf_cv_enable_rpath)
1749255852Sdteske])dnl
1750255852Sdteskednl ---------------------------------------------------------------------------
1751217309Snwhitehorndnl CF_FIND_LIBRARY version: 9 updated: 2008/03/23 14:48:54
1752217309Snwhitehorndnl ---------------
1753217309Snwhitehorndnl Look for a non-standard library, given parameters for AC_TRY_LINK.  We
1754217309Snwhitehorndnl prefer a standard location, and use -L options only if we do not find the
1755217309Snwhitehorndnl library in the standard library location(s).
1756217309Snwhitehorndnl	$1 = library name
1757217309Snwhitehorndnl	$2 = library class, usually the same as library name
1758217309Snwhitehorndnl	$3 = includes
1759217309Snwhitehorndnl	$4 = code fragment to compile/link
1760217309Snwhitehorndnl	$5 = corresponding function-name
1761217309Snwhitehorndnl	$6 = flag, nonnull if failure should not cause an error-exit
1762217309Snwhitehorndnl
1763217309Snwhitehorndnl Sets the variable "$cf_libdir" as a side-effect, so we can see if we had
1764217309Snwhitehorndnl to use a -L option.
1765217309SnwhitehornAC_DEFUN([CF_FIND_LIBRARY],
1766217309Snwhitehorn[
1767217309Snwhitehorn	eval 'cf_cv_have_lib_'$1'=no'
1768217309Snwhitehorn	cf_libdir=""
1769217309Snwhitehorn	AC_CHECK_FUNC($5,
1770217309Snwhitehorn		eval 'cf_cv_have_lib_'$1'=yes',[
1771217309Snwhitehorn		cf_save_LIBS="$LIBS"
1772217309Snwhitehorn		AC_MSG_CHECKING(for $5 in -l$1)
1773217309Snwhitehorn		LIBS="-l$1 $LIBS"
1774217309Snwhitehorn		AC_TRY_LINK([$3],[$4],
1775217309Snwhitehorn			[AC_MSG_RESULT(yes)
1776217309Snwhitehorn			 eval 'cf_cv_have_lib_'$1'=yes'
1777217309Snwhitehorn			],
1778217309Snwhitehorn			[AC_MSG_RESULT(no)
1779217309Snwhitehorn			CF_LIBRARY_PATH(cf_search,$2)
1780217309Snwhitehorn			for cf_libdir in $cf_search
1781217309Snwhitehorn			do
1782217309Snwhitehorn				AC_MSG_CHECKING(for -l$1 in $cf_libdir)
1783217309Snwhitehorn				LIBS="-L$cf_libdir -l$1 $cf_save_LIBS"
1784217309Snwhitehorn				AC_TRY_LINK([$3],[$4],
1785217309Snwhitehorn					[AC_MSG_RESULT(yes)
1786217309Snwhitehorn			 		 eval 'cf_cv_have_lib_'$1'=yes'
1787217309Snwhitehorn					 break],
1788217309Snwhitehorn					[AC_MSG_RESULT(no)
1789217309Snwhitehorn					 LIBS="$cf_save_LIBS"])
1790217309Snwhitehorn			done
1791217309Snwhitehorn			])
1792217309Snwhitehorn		])
1793217309Snwhitehorneval 'cf_found_library=[$]cf_cv_have_lib_'$1
1794217309Snwhitehornifelse($6,,[
1795217309Snwhitehornif test $cf_found_library = no ; then
1796217309Snwhitehorn	AC_MSG_ERROR(Cannot link $1 library)
1797217309Snwhitehornfi
1798217309Snwhitehorn])
1799217309Snwhitehorn])dnl
1800217309Snwhitehorndnl ---------------------------------------------------------------------------
1801220749Snwhitehorndnl CF_FIND_LINKAGE version: 19 updated: 2010/05/29 16:31:02
1802217309Snwhitehorndnl ---------------
1803217309Snwhitehorndnl Find a library (specifically the linkage used in the code fragment),
1804217309Snwhitehorndnl searching for it if it is not already in the library path.
1805217309Snwhitehorndnl See also CF_ADD_SEARCHPATH.
1806217309Snwhitehorndnl
1807217309Snwhitehorndnl Parameters (4-on are optional):
1808217309Snwhitehorndnl     $1 = headers for library entrypoint
1809217309Snwhitehorndnl     $2 = code fragment for library entrypoint
1810217309Snwhitehorndnl     $3 = the library name without the "-l" option or ".so" suffix.
1811217309Snwhitehorndnl     $4 = action to perform if successful (default: update CPPFLAGS, etc)
1812217309Snwhitehorndnl     $5 = action to perform if not successful
1813217309Snwhitehorndnl     $6 = module name, if not the same as the library name
1814217309Snwhitehorndnl     $7 = extra libraries
1815217309Snwhitehorndnl
1816217309Snwhitehorndnl Sets these variables:
1817217309Snwhitehorndnl     $cf_cv_find_linkage_$3 - yes/no according to whether linkage is found
1818217309Snwhitehorndnl     $cf_cv_header_path_$3 - include-directory if needed
1819217309Snwhitehorndnl     $cf_cv_library_path_$3 - library-directory if needed
1820217309Snwhitehorndnl     $cf_cv_library_file_$3 - library-file if needed, e.g., -l$3
1821217309SnwhitehornAC_DEFUN([CF_FIND_LINKAGE],[
1822217309Snwhitehorn
1823217309Snwhitehorn# If the linkage is not already in the $CPPFLAGS/$LDFLAGS configuration, these
1824217309Snwhitehorn# will be set on completion of the AC_TRY_LINK below.
1825217309Snwhitehorncf_cv_header_path_$3=
1826217309Snwhitehorncf_cv_library_path_$3=
1827217309Snwhitehorn
1828217309SnwhitehornCF_MSG_LOG([Starting [FIND_LINKAGE]($3,$6)])
1829217309Snwhitehorn
1830220749Snwhitehorncf_save_LIBS="$LIBS"
1831220749Snwhitehorn
1832217309SnwhitehornAC_TRY_LINK([$1],[$2],[
1833217309Snwhitehorn	cf_cv_find_linkage_$3=yes
1834220749Snwhitehorn	cf_cv_header_path_$3=/usr/include
1835220749Snwhitehorn	cf_cv_library_path_$3=/usr/lib
1836217309Snwhitehorn],[
1837217309Snwhitehorn
1838217309SnwhitehornLIBS="-l$3 $7 $cf_save_LIBS"
1839217309Snwhitehorn
1840217309SnwhitehornAC_TRY_LINK([$1],[$2],[
1841217309Snwhitehorn	cf_cv_find_linkage_$3=yes
1842220749Snwhitehorn	cf_cv_header_path_$3=/usr/include
1843220749Snwhitehorn	cf_cv_library_path_$3=/usr/lib
1844217309Snwhitehorn	cf_cv_library_file_$3="-l$3"
1845217309Snwhitehorn],[
1846220749Snwhitehorn	cf_cv_find_linkage_$3=no
1847217309Snwhitehorn	LIBS="$cf_save_LIBS"
1848217309Snwhitehorn
1849217309Snwhitehorn    CF_VERBOSE(find linkage for $3 library)
1850217309Snwhitehorn    CF_MSG_LOG([Searching for headers in [FIND_LINKAGE]($3,$6)])
1851217309Snwhitehorn
1852217309Snwhitehorn    cf_save_CPPFLAGS="$CPPFLAGS"
1853217309Snwhitehorn    cf_test_CPPFLAGS="$CPPFLAGS"
1854217309Snwhitehorn
1855217309Snwhitehorn    CF_HEADER_PATH(cf_search,ifelse([$6],,[$3],[$6]))
1856217309Snwhitehorn    for cf_cv_header_path_$3 in $cf_search
1857217309Snwhitehorn    do
1858217309Snwhitehorn      if test -d $cf_cv_header_path_$3 ; then
1859217309Snwhitehorn        CF_VERBOSE(... testing $cf_cv_header_path_$3)
1860217309Snwhitehorn        CPPFLAGS="$cf_save_CPPFLAGS -I$cf_cv_header_path_$3"
1861217309Snwhitehorn        AC_TRY_COMPILE([$1],[$2],[
1862217309Snwhitehorn            CF_VERBOSE(... found $3 headers in $cf_cv_header_path_$3)
1863217309Snwhitehorn            cf_cv_find_linkage_$3=maybe
1864217309Snwhitehorn            cf_test_CPPFLAGS="$CPPFLAGS"
1865217309Snwhitehorn            break],[
1866217309Snwhitehorn            CPPFLAGS="$cf_save_CPPFLAGS"
1867217309Snwhitehorn            ])
1868217309Snwhitehorn      fi
1869217309Snwhitehorn    done
1870217309Snwhitehorn
1871217309Snwhitehorn    if test "$cf_cv_find_linkage_$3" = maybe ; then
1872217309Snwhitehorn
1873217309Snwhitehorn      CF_MSG_LOG([Searching for $3 library in [FIND_LINKAGE]($3,$6)])
1874217309Snwhitehorn
1875217309Snwhitehorn      cf_save_LIBS="$LIBS"
1876217309Snwhitehorn      cf_save_LDFLAGS="$LDFLAGS"
1877217309Snwhitehorn
1878217309Snwhitehorn      ifelse([$6],,,[
1879217309Snwhitehorn        CPPFLAGS="$cf_test_CPPFLAGS"
1880217309Snwhitehorn        LIBS="-l$3 $7 $cf_save_LIBS"
1881217309Snwhitehorn        AC_TRY_LINK([$1],[$2],[
1882217309Snwhitehorn            CF_VERBOSE(... found $3 library in system)
1883217309Snwhitehorn            cf_cv_find_linkage_$3=yes])
1884217309Snwhitehorn            CPPFLAGS="$cf_save_CPPFLAGS"
1885217309Snwhitehorn            LIBS="$cf_save_LIBS"
1886217309Snwhitehorn            ])
1887217309Snwhitehorn
1888217309Snwhitehorn      if test "$cf_cv_find_linkage_$3" != yes ; then
1889217309Snwhitehorn        CF_LIBRARY_PATH(cf_search,$3)
1890217309Snwhitehorn        for cf_cv_library_path_$3 in $cf_search
1891217309Snwhitehorn        do
1892217309Snwhitehorn          if test -d $cf_cv_library_path_$3 ; then
1893217309Snwhitehorn            CF_VERBOSE(... testing $cf_cv_library_path_$3)
1894217309Snwhitehorn            CPPFLAGS="$cf_test_CPPFLAGS"
1895217309Snwhitehorn            LIBS="-l$3 $7 $cf_save_LIBS"
1896217309Snwhitehorn            LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_$3"
1897217309Snwhitehorn            AC_TRY_LINK([$1],[$2],[
1898217309Snwhitehorn                CF_VERBOSE(... found $3 library in $cf_cv_library_path_$3)
1899217309Snwhitehorn                cf_cv_find_linkage_$3=yes
1900217309Snwhitehorn                cf_cv_library_file_$3="-l$3"
1901217309Snwhitehorn                break],[
1902217309Snwhitehorn                CPPFLAGS="$cf_save_CPPFLAGS"
1903217309Snwhitehorn                LIBS="$cf_save_LIBS"
1904217309Snwhitehorn                LDFLAGS="$cf_save_LDFLAGS"
1905217309Snwhitehorn                ])
1906217309Snwhitehorn          fi
1907217309Snwhitehorn        done
1908217309Snwhitehorn        CPPFLAGS="$cf_save_CPPFLAGS"
1909217309Snwhitehorn        LDFLAGS="$cf_save_LDFLAGS"
1910217309Snwhitehorn      fi
1911217309Snwhitehorn
1912217309Snwhitehorn    else
1913217309Snwhitehorn      cf_cv_find_linkage_$3=no
1914217309Snwhitehorn    fi
1915217309Snwhitehorn    ],$7)
1916217309Snwhitehorn])
1917217309Snwhitehorn
1918220749SnwhitehornLIBS="$cf_save_LIBS"
1919220749Snwhitehorn
1920217309Snwhitehornif test "$cf_cv_find_linkage_$3" = yes ; then
1921217309Snwhitehornifelse([$4],,[
1922217309Snwhitehorn	CF_ADD_INCDIR($cf_cv_header_path_$3)
1923217309Snwhitehorn	CF_ADD_LIBDIR($cf_cv_library_path_$3)
1924220749Snwhitehorn	CF_ADD_LIB($3)
1925217309Snwhitehorn],[$4])
1926217309Snwhitehornelse
1927217309Snwhitehornifelse([$5],,AC_MSG_WARN(Cannot find $3 library),[$5])
1928217309Snwhitehornfi
1929217309Snwhitehorn])dnl
1930217309Snwhitehorndnl ---------------------------------------------------------------------------
1931255852Sdteskednl CF_FORGET_TOOL version: 1 updated: 2013/04/06 18:03:09
1932255852Sdteskednl --------------
1933255852Sdteskednl Forget that we saw the given tool.
1934255852SdteskeAC_DEFUN([CF_FORGET_TOOL],[
1935255852Sdteskeunset ac_cv_prog_ac_ct_$1
1936255852Sdteskeunset ac_ct_$1
1937255852Sdteskeunset $1
1938255852Sdteske])dnl
1939255852Sdteskednl ---------------------------------------------------------------------------
1940251843Sbaptdnl CF_FUNC_WAIT version: 3 updated: 2012/10/06 08:57:51
1941217309Snwhitehorndnl ------------
1942217309Snwhitehorndnl Test for the presence of <sys/wait.h>, 'union wait', arg-type of 'wait()'
1943217309Snwhitehorndnl and/or 'waitpid()'.
1944217309Snwhitehorndnl
1945217309Snwhitehorndnl Note that we cannot simply grep for 'union wait' in the wait.h file,
1946217309Snwhitehorndnl because some Posix systems turn this on only when a BSD variable is
1947217309Snwhitehorndnl defined.
1948217309Snwhitehorndnl
1949217309Snwhitehorndnl I don't use AC_HEADER_SYS_WAIT, because it defines HAVE_SYS_WAIT_H, which
1950217309Snwhitehorndnl would conflict with an attempt to test that header directly.
1951217309Snwhitehorndnl
1952217309SnwhitehornAC_DEFUN([CF_FUNC_WAIT],
1953217309Snwhitehorn[
1954217309SnwhitehornAC_REQUIRE([CF_UNION_WAIT])
1955217309Snwhitehornif test $cf_cv_type_unionwait = yes; then
1956217309Snwhitehorn
1957217309Snwhitehorn	AC_MSG_CHECKING(if union wait can be used as wait-arg)
1958217309Snwhitehorn	AC_CACHE_VAL(cf_cv_arg_union_wait,[
1959217309Snwhitehorn		AC_TRY_COMPILE($cf_wait_headers,
1960217309Snwhitehorn 			[union wait x; wait(&x)],
1961217309Snwhitehorn			[cf_cv_arg_union_wait=yes],
1962217309Snwhitehorn			[cf_cv_arg_union_wait=no])
1963217309Snwhitehorn		])
1964217309Snwhitehorn	AC_MSG_RESULT($cf_cv_arg_union_wait)
1965251843Sbapt	test $cf_cv_arg_union_wait = yes && AC_DEFINE(WAIT_USES_UNION,1,[Define to 1 if wait() uses a union parameter])
1966217309Snwhitehorn
1967217309Snwhitehorn	AC_MSG_CHECKING(if union wait can be used as waitpid-arg)
1968217309Snwhitehorn	AC_CACHE_VAL(cf_cv_arg_union_waitpid,[
1969217309Snwhitehorn		AC_TRY_COMPILE($cf_wait_headers,
1970217309Snwhitehorn 			[union wait x; waitpid(0, &x, 0)],
1971217309Snwhitehorn			[cf_cv_arg_union_waitpid=yes],
1972217309Snwhitehorn			[cf_cv_arg_union_waitpid=no])
1973217309Snwhitehorn		])
1974217309Snwhitehorn	AC_MSG_RESULT($cf_cv_arg_union_waitpid)
1975251843Sbapt	test $cf_cv_arg_union_waitpid = yes && AC_DEFINE(WAITPID_USES_UNION,1,[Define to 1 if waitpid() uses a union parameter])
1976217309Snwhitehorn
1977217309Snwhitehornfi
1978217309Snwhitehorn])dnl
1979217309Snwhitehorndnl ---------------------------------------------------------------------------
1980251843Sbaptdnl CF_GCC_ATTRIBUTES version: 16 updated: 2012/10/02 20:55:03
1981217309Snwhitehorndnl -----------------
1982217309Snwhitehorndnl Test for availability of useful gcc __attribute__ directives to quiet
1983217309Snwhitehorndnl compiler warnings.  Though useful, not all are supported -- and contrary
1984217309Snwhitehorndnl to documentation, unrecognized directives cause older compilers to barf.
1985217309SnwhitehornAC_DEFUN([CF_GCC_ATTRIBUTES],
1986217309Snwhitehorn[
1987217309Snwhitehornif test "$GCC" = yes
1988217309Snwhitehornthen
1989217309Snwhitehorncat > conftest.i <<EOF
1990217309Snwhitehorn#ifndef GCC_PRINTF
1991217309Snwhitehorn#define GCC_PRINTF 0
1992217309Snwhitehorn#endif
1993217309Snwhitehorn#ifndef GCC_SCANF
1994217309Snwhitehorn#define GCC_SCANF 0
1995217309Snwhitehorn#endif
1996217309Snwhitehorn#ifndef GCC_NORETURN
1997217309Snwhitehorn#define GCC_NORETURN /* nothing */
1998217309Snwhitehorn#endif
1999217309Snwhitehorn#ifndef GCC_UNUSED
2000217309Snwhitehorn#define GCC_UNUSED /* nothing */
2001217309Snwhitehorn#endif
2002217309SnwhitehornEOF
2003217309Snwhitehornif test "$GCC" = yes
2004217309Snwhitehornthen
2005217309Snwhitehorn	AC_CHECKING([for $CC __attribute__ directives])
2006217309Snwhitehorncat > conftest.$ac_ext <<EOF
2007220749Snwhitehorn#line __oline__ "${as_me:-configure}"
2008217309Snwhitehorn#include "confdefs.h"
2009217309Snwhitehorn#include "conftest.h"
2010217309Snwhitehorn#include "conftest.i"
2011217309Snwhitehorn#if	GCC_PRINTF
2012217309Snwhitehorn#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
2013217309Snwhitehorn#else
2014217309Snwhitehorn#define GCC_PRINTFLIKE(fmt,var) /*nothing*/
2015217309Snwhitehorn#endif
2016217309Snwhitehorn#if	GCC_SCANF
2017217309Snwhitehorn#define GCC_SCANFLIKE(fmt,var)  __attribute__((format(scanf,fmt,var)))
2018217309Snwhitehorn#else
2019217309Snwhitehorn#define GCC_SCANFLIKE(fmt,var)  /*nothing*/
2020217309Snwhitehorn#endif
2021217309Snwhitehornextern void wow(char *,...) GCC_SCANFLIKE(1,2);
2022217309Snwhitehornextern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
2023217309Snwhitehornextern void foo(void) GCC_NORETURN;
2024217309Snwhitehornint main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; }
2025217309SnwhitehornEOF
2026217309Snwhitehorn	cf_printf_attribute=no
2027217309Snwhitehorn	cf_scanf_attribute=no
2028217309Snwhitehorn	for cf_attribute in scanf printf unused noreturn
2029217309Snwhitehorn	do
2030217309Snwhitehorn		CF_UPPER(cf_ATTRIBUTE,$cf_attribute)
2031217309Snwhitehorn		cf_directive="__attribute__(($cf_attribute))"
2032217309Snwhitehorn		echo "checking for $CC $cf_directive" 1>&AC_FD_CC
2033217309Snwhitehorn
2034217309Snwhitehorn		case $cf_attribute in #(vi
2035217309Snwhitehorn		printf) #(vi
2036217309Snwhitehorn			cf_printf_attribute=yes
2037217309Snwhitehorn			cat >conftest.h <<EOF
2038217309Snwhitehorn#define GCC_$cf_ATTRIBUTE 1
2039217309SnwhitehornEOF
2040217309Snwhitehorn			;;
2041217309Snwhitehorn		scanf) #(vi
2042217309Snwhitehorn			cf_scanf_attribute=yes
2043217309Snwhitehorn			cat >conftest.h <<EOF
2044217309Snwhitehorn#define GCC_$cf_ATTRIBUTE 1
2045217309SnwhitehornEOF
2046217309Snwhitehorn			;;
2047217309Snwhitehorn		*) #(vi
2048217309Snwhitehorn			cat >conftest.h <<EOF
2049217309Snwhitehorn#define GCC_$cf_ATTRIBUTE $cf_directive
2050217309SnwhitehornEOF
2051217309Snwhitehorn			;;
2052217309Snwhitehorn		esac
2053217309Snwhitehorn
2054217309Snwhitehorn		if AC_TRY_EVAL(ac_compile); then
2055217309Snwhitehorn			test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute)
2056217309Snwhitehorn			cat conftest.h >>confdefs.h
2057217309Snwhitehorn			case $cf_attribute in #(vi
2058251843Sbapt			noreturn) #(vi
2059251843Sbapt				AC_DEFINE_UNQUOTED(GCC_NORETURN,$cf_directive,[Define to noreturn-attribute for gcc])
2060251843Sbapt				;;
2061217309Snwhitehorn			printf) #(vi
2062251843Sbapt				cf_value='/* nothing */'
2063251843Sbapt				if test "$cf_printf_attribute" != no ; then
2064251843Sbapt					cf_value='__attribute__((format(printf,fmt,var)))'
2065251843Sbapt					AC_DEFINE(GCC_PRINTF,1,[Define to 1 if the compiler supports gcc-like printf attribute.])
2066217309Snwhitehorn				fi
2067251843Sbapt				AC_DEFINE_UNQUOTED(GCC_PRINTFLIKE(fmt,var),$cf_value,[Define to printf-attribute for gcc])
2068217309Snwhitehorn				;;
2069217309Snwhitehorn			scanf) #(vi
2070251843Sbapt				cf_value='/* nothing */'
2071251843Sbapt				if test "$cf_scanf_attribute" != no ; then
2072251843Sbapt					cf_value='__attribute__((format(scanf,fmt,var)))'
2073251843Sbapt					AC_DEFINE(GCC_SCANF,1,[Define to 1 if the compiler supports gcc-like scanf attribute.])
2074217309Snwhitehorn				fi
2075251843Sbapt				AC_DEFINE_UNQUOTED(GCC_SCANFLIKE(fmt,var),$cf_value,[Define to sscanf-attribute for gcc])
2076217309Snwhitehorn				;;
2077251843Sbapt			unused) #(vi
2078251843Sbapt				AC_DEFINE_UNQUOTED(GCC_UNUSED,$cf_directive,[Define to unused-attribute for gcc])
2079251843Sbapt				;;
2080217309Snwhitehorn			esac
2081217309Snwhitehorn		fi
2082217309Snwhitehorn	done
2083217309Snwhitehornelse
2084217309Snwhitehorn	fgrep define conftest.i >>confdefs.h
2085217309Snwhitehornfi
2086217309Snwhitehornrm -rf conftest*
2087217309Snwhitehornfi
2088217309Snwhitehorn])dnl
2089217309Snwhitehorndnl ---------------------------------------------------------------------------
2090251843Sbaptdnl CF_GCC_VERSION version: 7 updated: 2012/10/18 06:46:33
2091217309Snwhitehorndnl --------------
2092217309Snwhitehorndnl Find version of gcc
2093217309SnwhitehornAC_DEFUN([CF_GCC_VERSION],[
2094217309SnwhitehornAC_REQUIRE([AC_PROG_CC])
2095217309SnwhitehornGCC_VERSION=none
2096217309Snwhitehornif test "$GCC" = yes ; then
2097217309Snwhitehorn	AC_MSG_CHECKING(version of $CC)
2098251843Sbapt	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.]].*//'`"
2099217309Snwhitehorn	test -z "$GCC_VERSION" && GCC_VERSION=unknown
2100217309Snwhitehorn	AC_MSG_RESULT($GCC_VERSION)
2101217309Snwhitehornfi
2102217309Snwhitehorn])dnl
2103217309Snwhitehorndnl ---------------------------------------------------------------------------
2104251843Sbaptdnl CF_GCC_WARNINGS version: 29 updated: 2012/06/16 14:55:39
2105217309Snwhitehorndnl ---------------
2106217309Snwhitehorndnl Check if the compiler supports useful warning options.  There's a few that
2107217309Snwhitehorndnl we don't use, simply because they're too noisy:
2108217309Snwhitehorndnl
2109217309Snwhitehorndnl	-Wconversion (useful in older versions of gcc, but not in gcc 2.7.x)
2110217309Snwhitehorndnl	-Wredundant-decls (system headers make this too noisy)
2111217309Snwhitehorndnl	-Wtraditional (combines too many unrelated messages, only a few useful)
2112217309Snwhitehorndnl	-Wwrite-strings (too noisy, but should review occasionally).  This
2113217309Snwhitehorndnl		is enabled for ncurses using "--enable-const".
2114217309Snwhitehorndnl	-pedantic
2115217309Snwhitehorndnl
2116217309Snwhitehorndnl Parameter:
2117217309Snwhitehorndnl	$1 is an optional list of gcc warning flags that a particular
2118217309Snwhitehorndnl		application might want to use, e.g., "no-unused" for
2119217309Snwhitehorndnl		-Wno-unused
2120217309Snwhitehorndnl Special:
2121217309Snwhitehorndnl	If $with_ext_const is "yes", add a check for -Wwrite-strings
2122217309Snwhitehorndnl
2123217309SnwhitehornAC_DEFUN([CF_GCC_WARNINGS],
2124217309Snwhitehorn[
2125217309SnwhitehornAC_REQUIRE([CF_GCC_VERSION])
2126217309SnwhitehornCF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)
2127251843SbaptCF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS)
2128217309Snwhitehorn
2129217309Snwhitehorncat > conftest.$ac_ext <<EOF
2130220749Snwhitehorn#line __oline__ "${as_me:-configure}"
2131217309Snwhitehornint main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
2132217309SnwhitehornEOF
2133217309Snwhitehorn
2134217309Snwhitehornif test "$INTEL_COMPILER" = yes
2135217309Snwhitehornthen
2136217309Snwhitehorn# The "-wdXXX" options suppress warnings:
2137217309Snwhitehorn# remark #1419: external declaration in primary source file
2138217309Snwhitehorn# remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
2139217309Snwhitehorn# remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
2140217309Snwhitehorn# remark #193: zero used for undefined preprocessing identifier
2141217309Snwhitehorn# remark #593: variable "curs_sb_left_arrow" was set but never used
2142217309Snwhitehorn# remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
2143217309Snwhitehorn# remark #869: parameter "tw" was never referenced
2144217309Snwhitehorn# remark #981: operands are evaluated in unspecified order
2145217309Snwhitehorn# warning #279: controlling expression is constant
2146217309Snwhitehorn
2147217309Snwhitehorn	AC_CHECKING([for $CC warning options])
2148217309Snwhitehorn	cf_save_CFLAGS="$CFLAGS"
2149217309Snwhitehorn	EXTRA_CFLAGS="-Wall"
2150217309Snwhitehorn	for cf_opt in \
2151217309Snwhitehorn		wd1419 \
2152217309Snwhitehorn		wd1683 \
2153217309Snwhitehorn		wd1684 \
2154217309Snwhitehorn		wd193 \
2155217309Snwhitehorn		wd593 \
2156217309Snwhitehorn		wd279 \
2157217309Snwhitehorn		wd810 \
2158217309Snwhitehorn		wd869 \
2159217309Snwhitehorn		wd981
2160217309Snwhitehorn	do
2161217309Snwhitehorn		CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
2162217309Snwhitehorn		if AC_TRY_EVAL(ac_compile); then
2163217309Snwhitehorn			test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
2164217309Snwhitehorn			EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
2165217309Snwhitehorn		fi
2166217309Snwhitehorn	done
2167217309Snwhitehorn	CFLAGS="$cf_save_CFLAGS"
2168217309Snwhitehorn
2169217309Snwhitehornelif test "$GCC" = yes
2170217309Snwhitehornthen
2171217309Snwhitehorn	AC_CHECKING([for $CC warning options])
2172217309Snwhitehorn	cf_save_CFLAGS="$CFLAGS"
2173217309Snwhitehorn	EXTRA_CFLAGS=
2174217309Snwhitehorn	cf_warn_CONST=""
2175217309Snwhitehorn	test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
2176217309Snwhitehorn	for cf_opt in W Wall \
2177217309Snwhitehorn		Wbad-function-cast \
2178217309Snwhitehorn		Wcast-align \
2179217309Snwhitehorn		Wcast-qual \
2180217309Snwhitehorn		Winline \
2181217309Snwhitehorn		Wmissing-declarations \
2182217309Snwhitehorn		Wmissing-prototypes \
2183217309Snwhitehorn		Wnested-externs \
2184217309Snwhitehorn		Wpointer-arith \
2185217309Snwhitehorn		Wshadow \
2186217309Snwhitehorn		Wstrict-prototypes \
2187217309Snwhitehorn		Wundef $cf_warn_CONST $1
2188217309Snwhitehorn	do
2189217309Snwhitehorn		CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
2190217309Snwhitehorn		if AC_TRY_EVAL(ac_compile); then
2191217309Snwhitehorn			test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
2192217309Snwhitehorn			case $cf_opt in #(vi
2193217309Snwhitehorn			Wcast-qual) #(vi
2194217309Snwhitehorn				CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES"
2195217309Snwhitehorn				;;
2196217309Snwhitehorn			Winline) #(vi
2197217309Snwhitehorn				case $GCC_VERSION in
2198217309Snwhitehorn				[[34]].*)
2199217309Snwhitehorn					CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
2200217309Snwhitehorn					continue;;
2201217309Snwhitehorn				esac
2202217309Snwhitehorn				;;
2203251843Sbapt			Wpointer-arith) #(vi
2204251843Sbapt				case $GCC_VERSION in
2205251843Sbapt				[[12]].*)
2206251843Sbapt					CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
2207251843Sbapt					continue;;
2208251843Sbapt				esac
2209251843Sbapt				;;
2210217309Snwhitehorn			esac
2211217309Snwhitehorn			EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
2212217309Snwhitehorn		fi
2213217309Snwhitehorn	done
2214217309Snwhitehorn	CFLAGS="$cf_save_CFLAGS"
2215217309Snwhitehornfi
2216220749Snwhitehornrm -rf conftest*
2217217309Snwhitehorn
2218217309SnwhitehornAC_SUBST(EXTRA_CFLAGS)
2219217309Snwhitehorn])dnl
2220217309Snwhitehorndnl ---------------------------------------------------------------------------
2221217309Snwhitehorndnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07
2222217309Snwhitehorndnl -------------
2223217309Snwhitehorndnl Check if we must define _GNU_SOURCE to get a reasonable value for
2224217309Snwhitehorndnl _XOPEN_SOURCE, upon which many POSIX definitions depend.  This is a defect
2225217309Snwhitehorndnl (or misfeature) of glibc2, which breaks portability of many applications,
2226217309Snwhitehorndnl since it is interwoven with GNU extensions.
2227217309Snwhitehorndnl
2228217309Snwhitehorndnl Well, yes we could work around it...
2229217309SnwhitehornAC_DEFUN([CF_GNU_SOURCE],
2230217309Snwhitehorn[
2231217309SnwhitehornAC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[
2232217309SnwhitehornAC_TRY_COMPILE([#include <sys/types.h>],[
2233217309Snwhitehorn#ifndef _XOPEN_SOURCE
2234217309Snwhitehornmake an error
2235217309Snwhitehorn#endif],
2236217309Snwhitehorn	[cf_cv_gnu_source=no],
2237217309Snwhitehorn	[cf_save="$CPPFLAGS"
2238217309Snwhitehorn	 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
2239217309Snwhitehorn	 AC_TRY_COMPILE([#include <sys/types.h>],[
2240217309Snwhitehorn#ifdef _XOPEN_SOURCE
2241217309Snwhitehornmake an error
2242217309Snwhitehorn#endif],
2243217309Snwhitehorn	[cf_cv_gnu_source=no],
2244217309Snwhitehorn	[cf_cv_gnu_source=yes])
2245217309Snwhitehorn	CPPFLAGS="$cf_save"
2246217309Snwhitehorn	])
2247217309Snwhitehorn])
2248217309Snwhitehorntest "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
2249217309Snwhitehorn])dnl
2250217309Snwhitehorndnl ---------------------------------------------------------------------------
2251217309Snwhitehorndnl CF_HEADERS_SH version: 1 updated: 2007/07/04 15:37:05
2252217309Snwhitehorndnl -------------
2253217309Snwhitehorndnl Setup variables needed to construct headers-sh
2254217309SnwhitehornAC_DEFUN([CF_HEADERS_SH],[
2255217309SnwhitehornPACKAGE_PREFIX=$1
2256217309SnwhitehornPACKAGE_CONFIG=$2
2257217309SnwhitehornAC_SUBST(PACKAGE_PREFIX)
2258217309SnwhitehornAC_SUBST(PACKAGE_CONFIG)
2259217309SnwhitehornEXTRA_OUTPUT="$EXTRA_OUTPUT headers-sh:$srcdir/headers-sh.in"
2260217309Snwhitehorn])
2261217309Snwhitehorndnl ---------------------------------------------------------------------------
2262220749Snwhitehorndnl CF_HEADER_PATH version: 12 updated: 2010/05/05 05:22:40
2263217309Snwhitehorndnl --------------
2264217309Snwhitehorndnl Construct a search-list of directories for a nonstandard header-file
2265217309Snwhitehorndnl
2266217309Snwhitehorndnl Parameters
2267217309Snwhitehorndnl	$1 = the variable to return as result
2268217309Snwhitehorndnl	$2 = the package name
2269217309SnwhitehornAC_DEFUN([CF_HEADER_PATH],
2270217309Snwhitehorn[
2271217309Snwhitehorn$1=
2272217309Snwhitehorn
2273217309Snwhitehorn# collect the current set of include-directories from compiler flags
2274217309Snwhitehorncf_header_path_list=""
2275217309Snwhitehornif test -n "${CFLAGS}${CPPFLAGS}" ; then
2276217309Snwhitehorn	for cf_header_path in $CPPFLAGS $CFLAGS
2277217309Snwhitehorn	do
2278217309Snwhitehorn		case $cf_header_path in #(vi
2279217309Snwhitehorn		-I*)
2280217309Snwhitehorn			cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'`
2281220749Snwhitehorn			CF_ADD_SUBDIR_PATH($1,$2,include,$cf_header_path,NONE)
2282220749Snwhitehorn			cf_header_path_list="$cf_header_path_list [$]$1"
2283217309Snwhitehorn			;;
2284217309Snwhitehorn		esac
2285217309Snwhitehorn	done
2286217309Snwhitehornfi
2287217309Snwhitehorn
2288217309Snwhitehorn# add the variations for the package we are looking for
2289217309SnwhitehornCF_SUBDIR_PATH($1,$2,include)
2290217309Snwhitehorn
2291217309Snwhitehorntest "$includedir" != NONE && \
2292217309Snwhitehorntest "$includedir" != "/usr/include" && \
2293217309Snwhitehorntest -d "$includedir" && {
2294217309Snwhitehorn	test -d $includedir &&    $1="[$]$1 $includedir"
2295217309Snwhitehorn	test -d $includedir/$2 && $1="[$]$1 $includedir/$2"
2296217309Snwhitehorn}
2297217309Snwhitehorn
2298217309Snwhitehorntest "$oldincludedir" != NONE && \
2299217309Snwhitehorntest "$oldincludedir" != "/usr/include" && \
2300217309Snwhitehorntest -d "$oldincludedir" && {
2301217309Snwhitehorn	test -d $oldincludedir    && $1="[$]$1 $oldincludedir"
2302217309Snwhitehorn	test -d $oldincludedir/$2 && $1="[$]$1 $oldincludedir/$2"
2303217309Snwhitehorn}
2304217309Snwhitehorn
2305217309Snwhitehorn$1="[$]$1 $cf_header_path_list"
2306217309Snwhitehorn])dnl
2307217309Snwhitehorndnl ---------------------------------------------------------------------------
2308255852Sdteskednl CF_INTEL_COMPILER version: 5 updated: 2013/02/10 10:41:05
2309217309Snwhitehorndnl -----------------
2310217309Snwhitehorndnl Check if the given compiler is really the Intel compiler for Linux.  It
2311217309Snwhitehorndnl tries to imitate gcc, but does not return an error when it finds a mismatch
2312217309Snwhitehorndnl between prototypes, e.g., as exercised by CF_MISSING_CHECK.
2313217309Snwhitehorndnl
2314217309Snwhitehorndnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
2315217309Snwhitehorndnl ensure that it is not mistaken for gcc/g++.  It is normally invoked from
2316217309Snwhitehorndnl the wrappers for gcc and g++ warnings.
2317217309Snwhitehorndnl
2318217309Snwhitehorndnl $1 = GCC (default) or GXX
2319217309Snwhitehorndnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
2320217309Snwhitehorndnl $3 = CFLAGS (default) or CXXFLAGS
2321217309SnwhitehornAC_DEFUN([CF_INTEL_COMPILER],[
2322255852SdteskeAC_REQUIRE([AC_CANONICAL_HOST])
2323220749Snwhitehornifelse([$2],,INTEL_COMPILER,[$2])=no
2324217309Snwhitehorn
2325220749Snwhitehornif test "$ifelse([$1],,[$1],GCC)" = yes ; then
2326217309Snwhitehorn	case $host_os in
2327217309Snwhitehorn	linux*|gnu*)
2328220749Snwhitehorn		AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler)
2329220749Snwhitehorn		cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])"
2330220749Snwhitehorn		ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc"
2331217309Snwhitehorn		AC_TRY_COMPILE([],[
2332217309Snwhitehorn#ifdef __INTEL_COMPILER
2333217309Snwhitehorn#else
2334217309Snwhitehornmake an error
2335217309Snwhitehorn#endif
2336220749Snwhitehorn],[ifelse([$2],,INTEL_COMPILER,[$2])=yes
2337217309Snwhitehorncf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc"
2338217309Snwhitehorn],[])
2339220749Snwhitehorn		ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
2340220749Snwhitehorn		AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2]))
2341217309Snwhitehorn		;;
2342217309Snwhitehorn	esac
2343217309Snwhitehornfi
2344217309Snwhitehorn])dnl
2345217309Snwhitehorndnl ---------------------------------------------------------------------------
2346251843Sbaptdnl CF_LARGEFILE version: 8 updated: 2012/10/06 08:57:51
2347217309Snwhitehorndnl ------------
2348217309Snwhitehorndnl Add checks for large file support.
2349217309SnwhitehornAC_DEFUN([CF_LARGEFILE],[
2350217309Snwhitehornifdef([AC_FUNC_FSEEKO],[
2351217309Snwhitehorn    AC_SYS_LARGEFILE
2352217309Snwhitehorn    if test "$enable_largefile" != no ; then
2353217309Snwhitehorn	AC_FUNC_FSEEKO
2354217309Snwhitehorn
2355217309Snwhitehorn	# Normally we would collect these definitions in the config.h,
2356217309Snwhitehorn	# but (like _XOPEN_SOURCE), some environments rely on having these
2357217309Snwhitehorn	# defined before any of the system headers are included.  Another
2358217309Snwhitehorn	# case comes up with C++, e.g., on AIX the compiler compiles the
2359217309Snwhitehorn	# header files by themselves before looking at the body files it is
2360217309Snwhitehorn	# told to compile.  For ncurses, those header files do not include
2361217309Snwhitehorn	# the config.h
2362217309Snwhitehorn	test "$ac_cv_sys_large_files"      != no && CPPFLAGS="$CPPFLAGS -D_LARGE_FILES "
2363217309Snwhitehorn	test "$ac_cv_sys_largefile_source" != no && CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE "
2364217309Snwhitehorn	test "$ac_cv_sys_file_offset_bits" != no && CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits "
2365217309Snwhitehorn
2366217309Snwhitehorn	AC_CACHE_CHECK(whether to use struct dirent64, cf_cv_struct_dirent64,[
2367217309Snwhitehorn		AC_TRY_COMPILE([
2368217309Snwhitehorn#include <sys/types.h>
2369217309Snwhitehorn#include <dirent.h>
2370217309Snwhitehorn		],[
2371217309Snwhitehorn		/* if transitional largefile support is setup, this is true */
2372217309Snwhitehorn		extern struct dirent64 * readdir(DIR *);
2373217309Snwhitehorn		struct dirent64 *x = readdir((DIR *)0);
2374217309Snwhitehorn		struct dirent *y = readdir((DIR *)0);
2375217309Snwhitehorn		int z = x - y;
2376217309Snwhitehorn		],
2377217309Snwhitehorn		[cf_cv_struct_dirent64=yes],
2378217309Snwhitehorn		[cf_cv_struct_dirent64=no])
2379217309Snwhitehorn	])
2380251843Sbapt	test "$cf_cv_struct_dirent64" = yes && AC_DEFINE(HAVE_STRUCT_DIRENT64,1,[Define to 1 if we have struct dirent64])
2381217309Snwhitehorn    fi
2382217309Snwhitehorn])
2383217309Snwhitehorn])
2384217309Snwhitehorndnl ---------------------------------------------------------------------------
2385251843Sbaptdnl CF_LD_RPATH_OPT version: 5 updated: 2011/07/17 14:48:41
2386217309Snwhitehorndnl ---------------
2387217309Snwhitehorndnl For the given system and compiler, find the compiler flags to pass to the
2388217309Snwhitehorndnl loader to use the "rpath" feature.
2389217309SnwhitehornAC_DEFUN([CF_LD_RPATH_OPT],
2390217309Snwhitehorn[
2391217309SnwhitehornAC_REQUIRE([CF_CHECK_CACHE])
2392217309Snwhitehorn
2393217309SnwhitehornLD_RPATH_OPT=
2394217309SnwhitehornAC_MSG_CHECKING(for an rpath option)
2395217309Snwhitehorncase $cf_cv_system_name in #(vi
2396217309Snwhitehornirix*) #(vi
2397217309Snwhitehorn	if test "$GCC" = yes; then
2398217309Snwhitehorn		LD_RPATH_OPT="-Wl,-rpath,"
2399217309Snwhitehorn	else
2400217309Snwhitehorn		LD_RPATH_OPT="-rpath "
2401217309Snwhitehorn	fi
2402217309Snwhitehorn	;;
2403217309Snwhitehornlinux*|gnu*|k*bsd*-gnu) #(vi
2404217309Snwhitehorn	LD_RPATH_OPT="-Wl,-rpath,"
2405217309Snwhitehorn	;;
2406224014Snwhitehornopenbsd[[2-9]].*|mirbsd*) #(vi
2407217309Snwhitehorn	LD_RPATH_OPT="-Wl,-rpath,"
2408217309Snwhitehorn	;;
2409251843Sbaptdragonfly*|freebsd*) #(vi
2410217309Snwhitehorn	LD_RPATH_OPT="-rpath "
2411217309Snwhitehorn	;;
2412217309Snwhitehornnetbsd*) #(vi
2413217309Snwhitehorn	LD_RPATH_OPT="-Wl,-rpath,"
2414217309Snwhitehorn	;;
2415217309Snwhitehornosf*|mls+*) #(vi
2416217309Snwhitehorn	LD_RPATH_OPT="-rpath "
2417217309Snwhitehorn	;;
2418217309Snwhitehornsolaris2*) #(vi
2419217309Snwhitehorn	LD_RPATH_OPT="-R"
2420217309Snwhitehorn	;;
2421217309Snwhitehorn*)
2422217309Snwhitehorn	;;
2423217309Snwhitehornesac
2424217309SnwhitehornAC_MSG_RESULT($LD_RPATH_OPT)
2425217309Snwhitehorn
2426217309Snwhitehorncase "x$LD_RPATH_OPT" in #(vi
2427217309Snwhitehornx-R*)
2428217309Snwhitehorn	AC_MSG_CHECKING(if we need a space after rpath option)
2429217309Snwhitehorn	cf_save_LIBS="$LIBS"
2430220749Snwhitehorn	CF_ADD_LIBS(${LD_RPATH_OPT}$libdir)
2431217309Snwhitehorn	AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes)
2432217309Snwhitehorn	LIBS="$cf_save_LIBS"
2433217309Snwhitehorn	AC_MSG_RESULT($cf_rpath_space)
2434217309Snwhitehorn	test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT "
2435217309Snwhitehorn	;;
2436217309Snwhitehornesac
2437217309Snwhitehorn])dnl
2438217309Snwhitehorndnl ---------------------------------------------------------------------------
2439217309Snwhitehorndnl CF_LIBRARY_PATH version: 9 updated: 2010/03/28 12:52:50
2440217309Snwhitehorndnl ---------------
2441217309Snwhitehorndnl Construct a search-list of directories for a nonstandard library-file
2442217309Snwhitehorndnl
2443217309Snwhitehorndnl Parameters
2444217309Snwhitehorndnl	$1 = the variable to return as result
2445217309Snwhitehorndnl	$2 = the package name
2446217309SnwhitehornAC_DEFUN([CF_LIBRARY_PATH],
2447217309Snwhitehorn[
2448217309Snwhitehorn$1=
2449217309Snwhitehorncf_library_path_list=""
2450217309Snwhitehornif test -n "${LDFLAGS}${LIBS}" ; then
2451217309Snwhitehorn	for cf_library_path in $LDFLAGS $LIBS
2452217309Snwhitehorn	do
2453217309Snwhitehorn		case $cf_library_path in #(vi
2454217309Snwhitehorn		-L*)
2455217309Snwhitehorn			cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'`
2456217309Snwhitehorn			CF_ADD_SUBDIR_PATH($1,$2,lib,$cf_library_path,NONE)
2457217309Snwhitehorn			cf_library_path_list="$cf_library_path_list [$]$1"
2458217309Snwhitehorn			;;
2459217309Snwhitehorn		esac
2460217309Snwhitehorn	done
2461217309Snwhitehornfi
2462217309Snwhitehorn
2463217309SnwhitehornCF_SUBDIR_PATH($1,$2,lib)
2464217309Snwhitehorn
2465217309Snwhitehorn$1="$cf_library_path_list [$]$1"
2466217309Snwhitehorn])dnl
2467217309Snwhitehorndnl ---------------------------------------------------------------------------
2468255852Sdteskednl CF_LIBTOOL_VERSION version: 1 updated: 2013/04/06 18:03:09
2469255852Sdteskednl ------------------
2470255852SdteskeAC_DEFUN([CF_LIBTOOL_VERSION],[
2471255852Sdteskeif test -n "$LIBTOOL" && test "$LIBTOOL" != none
2472255852Sdteskethen
2473255852Sdteske	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.]].*//'`
2474255852Sdteskeelse
2475255852Sdteske	cf_cv_libtool_version=
2476255852Sdteskefi
2477255852Sdtesketest -z "$cf_cv_libtool_version" && unset cf_cv_libtool_version
2478255852Sdteske])dnl
2479255852Sdteskednl ---------------------------------------------------------------------------
2480251843Sbaptdnl CF_LIB_PREFIX version: 9 updated: 2012/01/21 19:28:10
2481217309Snwhitehorndnl -------------
2482217309Snwhitehorndnl Compute the library-prefix for the given host system
2483217309Snwhitehorndnl $1 = variable to set
2484251843Sbaptdefine([CF_LIB_PREFIX],
2485217309Snwhitehorn[
2486217309Snwhitehorn	case $cf_cv_system_name in #(vi
2487217309Snwhitehorn	OS/2*|os2*) #(vi
2488217309Snwhitehorn        LIB_PREFIX=''
2489217309Snwhitehorn        ;;
2490217309Snwhitehorn	*)	LIB_PREFIX='lib'
2491217309Snwhitehorn        ;;
2492217309Snwhitehorn	esac
2493217309Snwhitehornifelse($1,,,[$1=$LIB_PREFIX])
2494217309Snwhitehorn	AC_SUBST(LIB_PREFIX)
2495217309Snwhitehorn])dnl
2496217309Snwhitehorndnl ---------------------------------------------------------------------------
2497255852Sdteskednl CF_LIB_SUFFIX version: 22 updated: 2013/09/07 13:54:05
2498255852Sdteskednl -------------
2499255852Sdteskednl Compute the library file-suffix from the given model name
2500255852Sdteskednl $1 = model name
2501255852Sdteskednl $2 = variable to set (the nominal library suffix)
2502255852Sdteskednl $3 = dependency variable to set (actual filename)
2503255852Sdteskednl The variable $LIB_SUFFIX, if set, prepends the variable to set.
2504255852SdteskeAC_DEFUN([CF_LIB_SUFFIX],
2505255852Sdteske[
2506255852Sdteske	case X$1 in #(vi
2507255852Sdteske	Xlibtool) #(vi
2508255852Sdteske		$2='.la'
2509255852Sdteske		$3=[$]$2
2510255852Sdteske		;;
2511255852Sdteske	Xdebug) #(vi
2512255852Sdteske		$2='_g.a'
2513255852Sdteske		$3=[$]$2
2514255852Sdteske		;;
2515255852Sdteske	Xprofile) #(vi
2516255852Sdteske		$2='_p.a'
2517255852Sdteske		$3=[$]$2
2518255852Sdteske		;;
2519255852Sdteske	Xshared) #(vi
2520255852Sdteske		case $cf_cv_system_name in
2521255852Sdteske		aix[[5-7]]*) #(vi
2522255852Sdteske			$2='.a'
2523255852Sdteske			$3=[$]$2
2524255852Sdteske			;;
2525255852Sdteske		cygwin*|msys*|mingw*) #(vi
2526255852Sdteske			$2='.dll'
2527255852Sdteske			$3='.dll.a'
2528255852Sdteske			;;
2529255852Sdteske		darwin*) #(vi
2530255852Sdteske			$2='.dylib'
2531255852Sdteske			$3=[$]$2
2532255852Sdteske			;;
2533255852Sdteske		hpux*) #(vi
2534255852Sdteske			case $target in
2535255852Sdteske			ia64*) #(vi
2536255852Sdteske				$2='.so'
2537255852Sdteske				$3=[$]$2
2538255852Sdteske				;;
2539255852Sdteske			*) #(vi
2540255852Sdteske				$2='.sl'
2541255852Sdteske				$3=[$]$2
2542255852Sdteske				;;
2543255852Sdteske			esac
2544255852Sdteske			;;
2545255852Sdteske		*) #(vi
2546255852Sdteske			$2='.so'
2547255852Sdteske			$3=[$]$2
2548255852Sdteske			;;
2549255852Sdteske		esac
2550255852Sdteske		;;
2551255852Sdteske	*)
2552255852Sdteske		$2='.a'
2553255852Sdteske		$3=[$]$2
2554255852Sdteske		;;
2555255852Sdteske	esac
2556255852Sdteske	test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}"
2557255852Sdteske	test -n "$LIB_SUFFIX" && $3="${LIB_SUFFIX}[$]{$3}"
2558255852Sdteske])dnl
2559255852Sdteskednl ---------------------------------------------------------------------------
2560224014Snwhitehorndnl CF_MAKEFLAGS version: 14 updated: 2011/03/31 19:29:46
2561217309Snwhitehorndnl ------------
2562217309Snwhitehorndnl Some 'make' programs support ${MAKEFLAGS}, some ${MFLAGS}, to pass 'make'
2563217309Snwhitehorndnl options to lower-levels.  It's very useful for "make -n" -- if we have it.
2564217309Snwhitehorndnl (GNU 'make' does both, something POSIX 'make', which happens to make the
2565217309Snwhitehorndnl ${MAKEFLAGS} variable incompatible because it adds the assignments :-)
2566217309SnwhitehornAC_DEFUN([CF_MAKEFLAGS],
2567217309Snwhitehorn[
2568217309SnwhitehornAC_CACHE_CHECK(for makeflags variable, cf_cv_makeflags,[
2569217309Snwhitehorn	cf_cv_makeflags=''
2570217309Snwhitehorn	for cf_option in '-${MAKEFLAGS}' '${MFLAGS}'
2571217309Snwhitehorn	do
2572217309Snwhitehorn		cat >cf_makeflags.tmp <<CF_EOF
2573217309SnwhitehornSHELL = /bin/sh
2574217309Snwhitehornall :
2575217309Snwhitehorn	@ echo '.$cf_option'
2576217309SnwhitehornCF_EOF
2577224014Snwhitehorn		cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp 2>/dev/null | fgrep -v "ing directory" | sed -e 's,[[ 	]]*$,,'`
2578217309Snwhitehorn		case "$cf_result" in
2579217309Snwhitehorn		.*k)
2580220749Snwhitehorn			cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp CC=cc 2>/dev/null`
2581217309Snwhitehorn			case "$cf_result" in
2582217309Snwhitehorn			.*CC=*)	cf_cv_makeflags=
2583217309Snwhitehorn				;;
2584217309Snwhitehorn			*)	cf_cv_makeflags=$cf_option
2585217309Snwhitehorn				;;
2586217309Snwhitehorn			esac
2587217309Snwhitehorn			break
2588217309Snwhitehorn			;;
2589217309Snwhitehorn		.-)	;;
2590217309Snwhitehorn		*)	echo "given option \"$cf_option\", no match \"$cf_result\""
2591217309Snwhitehorn			;;
2592217309Snwhitehorn		esac
2593217309Snwhitehorn	done
2594217309Snwhitehorn	rm -f cf_makeflags.tmp
2595217309Snwhitehorn])
2596217309Snwhitehorn
2597217309SnwhitehornAC_SUBST(cf_cv_makeflags)
2598217309Snwhitehorn])dnl
2599217309Snwhitehorndnl ---------------------------------------------------------------------------
2600220749Snwhitehorndnl CF_MAKE_TAGS version: 6 updated: 2010/10/23 15:52:32
2601217309Snwhitehorndnl ------------
2602217309Snwhitehorndnl Generate tags/TAGS targets for makefiles.  Do not generate TAGS if we have
2603217309Snwhitehorndnl a monocase filesystem.
2604217309SnwhitehornAC_DEFUN([CF_MAKE_TAGS],[
2605217309SnwhitehornAC_REQUIRE([CF_MIXEDCASE_FILENAMES])
2606217309Snwhitehorn
2607217309SnwhitehornAC_CHECK_PROGS(CTAGS, exctags ctags)
2608217309SnwhitehornAC_CHECK_PROGS(ETAGS, exetags etags)
2609217309Snwhitehorn
2610220749SnwhitehornAC_CHECK_PROG(MAKE_LOWER_TAGS, ${CTAGS:-ctags}, yes, no)
2611217309Snwhitehorn
2612217309Snwhitehornif test "$cf_cv_mixedcase" = yes ; then
2613220749Snwhitehorn	AC_CHECK_PROG(MAKE_UPPER_TAGS, ${ETAGS:-etags}, yes, no)
2614217309Snwhitehornelse
2615217309Snwhitehorn	MAKE_UPPER_TAGS=no
2616217309Snwhitehornfi
2617217309Snwhitehorn
2618217309Snwhitehornif test "$MAKE_UPPER_TAGS" = yes ; then
2619217309Snwhitehorn	MAKE_UPPER_TAGS=
2620217309Snwhitehornelse
2621217309Snwhitehorn	MAKE_UPPER_TAGS="#"
2622217309Snwhitehornfi
2623217309Snwhitehorn
2624217309Snwhitehornif test "$MAKE_LOWER_TAGS" = yes ; then
2625217309Snwhitehorn	MAKE_LOWER_TAGS=
2626217309Snwhitehornelse
2627217309Snwhitehorn	MAKE_LOWER_TAGS="#"
2628217309Snwhitehornfi
2629217309Snwhitehorn
2630217309SnwhitehornAC_SUBST(CTAGS)
2631217309SnwhitehornAC_SUBST(ETAGS)
2632217309Snwhitehorn
2633217309SnwhitehornAC_SUBST(MAKE_UPPER_TAGS)
2634217309SnwhitehornAC_SUBST(MAKE_LOWER_TAGS)
2635217309Snwhitehorn])dnl
2636217309Snwhitehorndnl ---------------------------------------------------------------------------
2637220749Snwhitehorndnl CF_MATH_LIB version: 8 updated: 2010/05/29 16:31:02
2638217309Snwhitehorndnl -----------
2639217309Snwhitehorndnl Checks for libraries.  At least one UNIX system, Apple Macintosh
2640217309Snwhitehorndnl Rhapsody 5.5, does not have -lm.  We cannot use the simpler
2641217309Snwhitehorndnl AC_CHECK_LIB(m,sin), because that fails for C++.
2642217309SnwhitehornAC_DEFUN([CF_MATH_LIB],
2643217309Snwhitehorn[
2644217309SnwhitehornAC_CACHE_CHECK(if -lm needed for math functions,
2645217309Snwhitehorn	cf_cv_need_libm,[
2646217309Snwhitehorn	AC_TRY_LINK([
2647217309Snwhitehorn	#include <stdio.h>
2648217309Snwhitehorn	#include <math.h>
2649217309Snwhitehorn	],
2650220749Snwhitehorn	[double x = rand(); printf("result = %g\n", ]ifelse([$2],,sin(x),$2)[)],
2651217309Snwhitehorn	[cf_cv_need_libm=no],
2652217309Snwhitehorn	[cf_cv_need_libm=yes])])
2653217309Snwhitehornif test "$cf_cv_need_libm" = yes
2654217309Snwhitehornthen
2655217309Snwhitehornifelse($1,,[
2656220749Snwhitehorn	CF_ADD_LIB(m)
2657217309Snwhitehorn],[$1=-lm])
2658217309Snwhitehornfi
2659217309Snwhitehorn])
2660217309Snwhitehorndnl ---------------------------------------------------------------------------
2661251843Sbaptdnl CF_MBSTATE_T version: 4 updated: 2012/10/06 08:57:51
2662217309Snwhitehorndnl ------------
2663217309Snwhitehorndnl Check if mbstate_t is declared, and if so, which header file.
2664217309Snwhitehorndnl This (including wchar.h) is needed on Tru64 5.0 to declare mbstate_t,
2665217309Snwhitehorndnl as well as include stdio.h to work around a misuse of varargs in wchar.h
2666217309SnwhitehornAC_DEFUN([CF_MBSTATE_T],
2667217309Snwhitehorn[
2668217309SnwhitehornAC_CACHE_CHECK(if we must include wchar.h to declare mbstate_t,cf_cv_mbstate_t,[
2669217309SnwhitehornAC_TRY_COMPILE([
2670217309Snwhitehorn#include <stdlib.h>
2671217309Snwhitehorn#include <stdio.h>
2672217309Snwhitehorn#ifdef HAVE_LIBUTF8_H
2673217309Snwhitehorn#include <libutf8.h>
2674217309Snwhitehorn#endif],
2675217309Snwhitehorn	[mbstate_t state],
2676217309Snwhitehorn	[cf_cv_mbstate_t=no],
2677217309Snwhitehorn	[AC_TRY_COMPILE([
2678217309Snwhitehorn#include <stdlib.h>
2679217309Snwhitehorn#include <stdio.h>
2680217309Snwhitehorn#include <wchar.h>
2681217309Snwhitehorn#ifdef HAVE_LIBUTF8_H
2682217309Snwhitehorn#include <libutf8.h>
2683217309Snwhitehorn#endif],
2684217309Snwhitehorn	[mbstate_t value],
2685217309Snwhitehorn	[cf_cv_mbstate_t=yes],
2686217309Snwhitehorn	[cf_cv_mbstate_t=unknown])])])
2687217309Snwhitehorn
2688217309Snwhitehornif test "$cf_cv_mbstate_t" = yes ; then
2689251843Sbapt	AC_DEFINE(NEED_WCHAR_H,1,[Define to 1 if we must include wchar.h])
2690217309Snwhitehornfi
2691217309Snwhitehorn
2692217309Snwhitehornif test "$cf_cv_mbstate_t" != unknown ; then
2693251843Sbapt	AC_DEFINE(HAVE_MBSTATE_T,1,[Define to 1 if mbstate_t is declared])
2694217309Snwhitehornfi
2695217309Snwhitehorn])dnl
2696217309Snwhitehorndnl ---------------------------------------------------------------------------
2697255852Sdteskednl CF_MIXEDCASE_FILENAMES version: 5 updated: 2013/09/07 13:54:05
2698217309Snwhitehorndnl ----------------------
2699217309Snwhitehorndnl Check if the file-system supports mixed-case filenames.  If we're able to
2700217309Snwhitehorndnl create a lowercase name and see it as uppercase, it doesn't support that.
2701217309SnwhitehornAC_DEFUN([CF_MIXEDCASE_FILENAMES],
2702217309Snwhitehorn[
2703217309SnwhitehornAC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[
2704217309Snwhitehornif test "$cross_compiling" = yes ; then
2705217309Snwhitehorn	case $target_alias in #(vi
2706255852Sdteske	*-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw32*|*-uwin*) #(vi
2707217309Snwhitehorn		cf_cv_mixedcase=no
2708217309Snwhitehorn		;;
2709217309Snwhitehorn	*)
2710217309Snwhitehorn		cf_cv_mixedcase=yes
2711217309Snwhitehorn		;;
2712217309Snwhitehorn	esac
2713217309Snwhitehornelse
2714217309Snwhitehorn	rm -f conftest CONFTEST
2715217309Snwhitehorn	echo test >conftest
2716217309Snwhitehorn	if test -f CONFTEST ; then
2717217309Snwhitehorn		cf_cv_mixedcase=no
2718217309Snwhitehorn	else
2719217309Snwhitehorn		cf_cv_mixedcase=yes
2720217309Snwhitehorn	fi
2721217309Snwhitehorn	rm -f conftest CONFTEST
2722217309Snwhitehornfi
2723217309Snwhitehorn])
2724251843Sbapttest "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if filesystem supports mixed-case filenames.])
2725217309Snwhitehorn])dnl
2726217309Snwhitehorndnl ---------------------------------------------------------------------------
2727220749Snwhitehorndnl CF_MSG_LOG version: 5 updated: 2010/10/23 15:52:32
2728217309Snwhitehorndnl ----------
2729217309Snwhitehorndnl Write a debug message to config.log, along with the line number in the
2730217309Snwhitehorndnl configure script.
2731217309SnwhitehornAC_DEFUN([CF_MSG_LOG],[
2732220749Snwhitehornecho "${as_me:-configure}:__oline__: testing $* ..." 1>&AC_FD_CC
2733217309Snwhitehorn])dnl
2734217309Snwhitehorndnl ---------------------------------------------------------------------------
2735217309Snwhitehorndnl CF_NCURSES_CC_CHECK version: 4 updated: 2007/07/29 10:39:05
2736217309Snwhitehorndnl -------------------
2737217309Snwhitehorndnl Check if we can compile with ncurses' header file
2738217309Snwhitehorndnl $1 is the cache variable to set
2739217309Snwhitehorndnl $2 is the header-file to include
2740217309Snwhitehorndnl $3 is the root name (ncurses or ncursesw)
2741217309SnwhitehornAC_DEFUN([CF_NCURSES_CC_CHECK],[
2742217309Snwhitehorn	AC_TRY_COMPILE([
2743217309Snwhitehorn]ifelse($3,ncursesw,[
2744217309Snwhitehorn#define _XOPEN_SOURCE_EXTENDED
2745217309Snwhitehorn#undef  HAVE_LIBUTF8_H	/* in case we used CF_UTF8_LIB */
2746217309Snwhitehorn#define HAVE_LIBUTF8_H	/* to force ncurses' header file to use cchar_t */
2747217309Snwhitehorn])[
2748217309Snwhitehorn#include <$2>],[
2749217309Snwhitehorn#ifdef NCURSES_VERSION
2750217309Snwhitehorn]ifelse($3,ncursesw,[
2751217309Snwhitehorn#ifndef WACS_BSSB
2752217309Snwhitehorn	make an error
2753217309Snwhitehorn#endif
2754217309Snwhitehorn])[
2755217309Snwhitehornprintf("%s\n", NCURSES_VERSION);
2756217309Snwhitehorn#else
2757217309Snwhitehorn#ifdef __NCURSES_H
2758217309Snwhitehornprintf("old\n");
2759217309Snwhitehorn#else
2760217309Snwhitehorn	make an error
2761217309Snwhitehorn#endif
2762217309Snwhitehorn#endif
2763217309Snwhitehorn	]
2764217309Snwhitehorn	,[$1=$2]
2765217309Snwhitehorn	,[$1=no])
2766217309Snwhitehorn])dnl
2767217309Snwhitehorndnl ---------------------------------------------------------------------------
2768251843Sbaptdnl CF_NCURSES_CONFIG version: 10 updated: 2012/10/06 08:57:51
2769217309Snwhitehorndnl -----------------
2770217309Snwhitehorndnl Tie together the configure-script macros for ncurses.
2771220749Snwhitehorndnl Prefer the "-config" script from ncurses 6.x, to simplify analysis.
2772217309Snwhitehorndnl Allow that to be overridden using the $NCURSES_CONFIG environment variable.
2773217309Snwhitehorndnl
2774217309Snwhitehorndnl $1 is the root library name (default: "ncurses")
2775217309SnwhitehornAC_DEFUN([CF_NCURSES_CONFIG],
2776217309Snwhitehorn[
2777217309Snwhitehorncf_ncuconfig_root=ifelse($1,,ncurses,$1)
2778217309Snwhitehorn
2779217309Snwhitehornecho "Looking for ${cf_ncuconfig_root}-config"
2780217309Snwhitehorn
2781251843SbaptCF_ACVERSION_CHECK(2.52,
2782251843Sbapt	[AC_CHECK_TOOLS(NCURSES_CONFIG, ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)],
2783251843Sbapt	[AC_PATH_PROGS(NCURSES_CONFIG, ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)])
2784251843Sbapt
2785217309Snwhitehornif test "$NCURSES_CONFIG" != none ; then
2786217309Snwhitehorn
2787217309SnwhitehornCPPFLAGS="$CPPFLAGS `$NCURSES_CONFIG --cflags`"
2788220749SnwhitehornCF_ADD_LIBS(`$NCURSES_CONFIG --libs`)
2789217309Snwhitehorn
2790217309Snwhitehorn# even with config script, some packages use no-override for curses.h
2791217309SnwhitehornCF_CURSES_HEADER(ifelse($1,,ncurses,$1))
2792217309Snwhitehorn
2793217309Snwhitehorndnl like CF_NCURSES_CPPFLAGS
2794251843SbaptAC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries])
2795217309Snwhitehorn
2796217309Snwhitehorndnl like CF_NCURSES_LIBS
2797217309SnwhitehornCF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_ncuconfig_root)
2798217309SnwhitehornAC_DEFINE_UNQUOTED($cf_nculib_ROOT)
2799217309Snwhitehorn
2800217309Snwhitehorndnl like CF_NCURSES_VERSION
2801217309Snwhitehorncf_cv_ncurses_version=`$NCURSES_CONFIG --version`
2802217309Snwhitehorn
2803217309Snwhitehornelse
2804217309Snwhitehorn
2805217309SnwhitehornCF_NCURSES_CPPFLAGS(ifelse($1,,ncurses,$1))
2806217309SnwhitehornCF_NCURSES_LIBS(ifelse($1,,ncurses,$1))
2807217309Snwhitehorn
2808217309Snwhitehornfi
2809217309Snwhitehorn])dnl
2810217309Snwhitehorndnl ---------------------------------------------------------------------------
2811251843Sbaptdnl CF_NCURSES_CPPFLAGS version: 21 updated: 2012/10/06 08:57:51
2812217309Snwhitehorndnl -------------------
2813217309Snwhitehorndnl Look for the SVr4 curses clone 'ncurses' in the standard places, adjusting
2814217309Snwhitehorndnl the CPPFLAGS variable so we can include its header.
2815217309Snwhitehorndnl
2816217309Snwhitehorndnl The header files may be installed as either curses.h, or ncurses.h (would
2817217309Snwhitehorndnl be obsolete, except that some packagers prefer this name to distinguish it
2818217309Snwhitehorndnl from a "native" curses implementation).  If not installed for overwrite,
2819217309Snwhitehorndnl the curses.h file would be in an ncurses subdirectory (e.g.,
2820217309Snwhitehorndnl /usr/include/ncurses), but someone may have installed overwriting the
2821217309Snwhitehorndnl vendor's curses.  Only very old versions (pre-1.9.2d, the first autoconf'd
2822217309Snwhitehorndnl version) of ncurses don't define either __NCURSES_H or NCURSES_VERSION in
2823217309Snwhitehorndnl the header.
2824217309Snwhitehorndnl
2825217309Snwhitehorndnl If the installer has set $CFLAGS or $CPPFLAGS so that the ncurses header
2826217309Snwhitehorndnl is already in the include-path, don't even bother with this, since we cannot
2827217309Snwhitehorndnl easily determine which file it is.  In this case, it has to be <curses.h>.
2828217309Snwhitehorndnl
2829217309Snwhitehorndnl The optional parameter gives the root name of the library, in case it is
2830217309Snwhitehorndnl not installed as the default curses library.  That is how the
2831217309Snwhitehorndnl wide-character version of ncurses is installed.
2832217309SnwhitehornAC_DEFUN([CF_NCURSES_CPPFLAGS],
2833217309Snwhitehorn[AC_REQUIRE([CF_WITH_CURSES_DIR])
2834217309Snwhitehorn
2835217309SnwhitehornAC_PROVIDE([CF_CURSES_CPPFLAGS])dnl
2836217309Snwhitehorncf_ncuhdr_root=ifelse($1,,ncurses,$1)
2837217309Snwhitehorn
2838217309Snwhitehorntest -n "$cf_cv_curses_dir" && \
2839217309Snwhitehorntest "$cf_cv_curses_dir" != "no" && { \
2840220749Snwhitehorn  CF_ADD_INCDIR($cf_cv_curses_dir/include/$cf_ncuhdr_root)
2841217309Snwhitehorn}
2842217309Snwhitehorn
2843217309SnwhitehornAC_CACHE_CHECK(for $cf_ncuhdr_root header in include-path, cf_cv_ncurses_h,[
2844217309Snwhitehorn	cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h"
2845217309Snwhitehorn	( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h"
2846217309Snwhitehorn	for cf_header in $cf_header_list
2847217309Snwhitehorn	do
2848217309Snwhitehorn		CF_NCURSES_CC_CHECK(cf_cv_ncurses_h,$cf_header,$1)
2849217309Snwhitehorn		test "$cf_cv_ncurses_h" != no && break
2850217309Snwhitehorn	done
2851217309Snwhitehorn])
2852217309Snwhitehorn
2853217309SnwhitehornCF_NCURSES_HEADER
2854217309SnwhitehornCF_TERM_HEADER
2855217309Snwhitehorn
2856217309Snwhitehorn# some applications need this, but should check for NCURSES_VERSION
2857251843SbaptAC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries])
2858217309Snwhitehorn
2859217309SnwhitehornCF_NCURSES_VERSION
2860217309Snwhitehorn])dnl
2861217309Snwhitehorndnl ---------------------------------------------------------------------------
2862251843Sbaptdnl CF_NCURSES_HEADER version: 3 updated: 2012/10/06 08:57:51
2863217309Snwhitehorndnl -----------------
2864217309Snwhitehorndnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
2865217309Snwhitehorndnl variations of ncurses' installs.
2866217309Snwhitehorndnl
2867217309Snwhitehorndnl See also CF_CURSES_HEADER, which sets the same cache variable.
2868217309SnwhitehornAC_DEFUN([CF_NCURSES_HEADER],[
2869217309Snwhitehorn
2870217309Snwhitehornif test "$cf_cv_ncurses_h" != no ; then
2871217309Snwhitehorn	cf_cv_ncurses_header=$cf_cv_ncurses_h
2872217309Snwhitehornelse
2873217309Snwhitehorn
2874217309SnwhitehornAC_CACHE_CHECK(for $cf_ncuhdr_root include-path, cf_cv_ncurses_h2,[
2875217309Snwhitehorn	test -n "$verbose" && echo
2876217309Snwhitehorn	CF_HEADER_PATH(cf_search,$cf_ncuhdr_root)
2877217309Snwhitehorn	test -n "$verbose" && echo search path $cf_search
2878217309Snwhitehorn	cf_save2_CPPFLAGS="$CPPFLAGS"
2879217309Snwhitehorn	for cf_incdir in $cf_search
2880217309Snwhitehorn	do
2881217309Snwhitehorn		CF_ADD_INCDIR($cf_incdir)
2882217309Snwhitehorn		for cf_header in \
2883217309Snwhitehorn			ncurses.h \
2884217309Snwhitehorn			curses.h
2885217309Snwhitehorn		do
2886217309Snwhitehorn			CF_NCURSES_CC_CHECK(cf_cv_ncurses_h2,$cf_header,$1)
2887217309Snwhitehorn			if test "$cf_cv_ncurses_h2" != no ; then
2888217309Snwhitehorn				cf_cv_ncurses_h2=$cf_incdir/$cf_header
2889217309Snwhitehorn				test -n "$verbose" && echo $ac_n "	... found $ac_c" 1>&AC_FD_MSG
2890217309Snwhitehorn				break
2891217309Snwhitehorn			fi
2892217309Snwhitehorn			test -n "$verbose" && echo "	... tested $cf_incdir/$cf_header" 1>&AC_FD_MSG
2893217309Snwhitehorn		done
2894217309Snwhitehorn		CPPFLAGS="$cf_save2_CPPFLAGS"
2895217309Snwhitehorn		test "$cf_cv_ncurses_h2" != no && break
2896217309Snwhitehorn	done
2897217309Snwhitehorn	test "$cf_cv_ncurses_h2" = no && AC_MSG_ERROR(not found)
2898217309Snwhitehorn	])
2899217309Snwhitehorn
2900217309Snwhitehorn	CF_DIRNAME(cf_1st_incdir,$cf_cv_ncurses_h2)
2901217309Snwhitehorn	cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2`
2902217309Snwhitehorn	if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then
2903217309Snwhitehorn		cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header
2904217309Snwhitehorn	fi
2905217309Snwhitehorn	CF_ADD_INCDIR($cf_1st_incdir)
2906217309Snwhitehorn
2907217309Snwhitehornfi
2908217309Snwhitehorn
2909217309Snwhitehorn# Set definitions to allow ifdef'ing for ncurses.h
2910217309Snwhitehorn
2911217309Snwhitehorncase $cf_cv_ncurses_header in # (vi
2912217309Snwhitehorn*ncurses.h)
2913251843Sbapt	AC_DEFINE(HAVE_NCURSES_H,1,[Define to 1 if we have ncurses.h])
2914217309Snwhitehorn	;;
2915217309Snwhitehornesac
2916217309Snwhitehorn
2917217309Snwhitehorncase $cf_cv_ncurses_header in # (vi
2918217309Snwhitehornncurses/curses.h|ncurses/ncurses.h)
2919251843Sbapt	AC_DEFINE(HAVE_NCURSES_NCURSES_H,1,[Define to 1 if we have ncurses/ncurses.h])
2920217309Snwhitehorn	;;
2921217309Snwhitehornncursesw/curses.h|ncursesw/ncurses.h)
2922251843Sbapt	AC_DEFINE(HAVE_NCURSESW_NCURSES_H,1,[Define to 1 if we have ncursesw/ncurses.h])
2923217309Snwhitehorn	;;
2924217309Snwhitehornesac
2925217309Snwhitehorn
2926217309Snwhitehorn])dnl
2927217309Snwhitehorndnl ---------------------------------------------------------------------------
2928220749Snwhitehorndnl CF_NCURSES_LIBS version: 16 updated: 2010/11/20 17:02:38
2929217309Snwhitehorndnl ---------------
2930217309Snwhitehorndnl Look for the ncurses library.  This is a little complicated on Linux,
2931217309Snwhitehorndnl because it may be linked with the gpm (general purpose mouse) library.
2932217309Snwhitehorndnl Some distributions have gpm linked with (bsd) curses, which makes it
2933217309Snwhitehorndnl unusable with ncurses.  However, we don't want to link with gpm unless
2934217309Snwhitehorndnl ncurses has a dependency, since gpm is normally set up as a shared library,
2935217309Snwhitehorndnl and the linker will record a dependency.
2936217309Snwhitehorndnl
2937217309Snwhitehorndnl The optional parameter gives the root name of the library, in case it is
2938217309Snwhitehorndnl not installed as the default curses library.  That is how the
2939217309Snwhitehorndnl wide-character version of ncurses is installed.
2940217309SnwhitehornAC_DEFUN([CF_NCURSES_LIBS],
2941217309Snwhitehorn[AC_REQUIRE([CF_NCURSES_CPPFLAGS])
2942217309Snwhitehorn
2943217309Snwhitehorncf_nculib_root=ifelse($1,,ncurses,$1)
2944217309Snwhitehorn	# This works, except for the special case where we find gpm, but
2945217309Snwhitehorn	# ncurses is in a nonstandard location via $LIBS, and we really want
2946217309Snwhitehorn	# to link gpm.
2947217309Snwhitehorncf_ncurses_LIBS=""
2948217309Snwhitehorncf_ncurses_SAVE="$LIBS"
2949217309SnwhitehornAC_CHECK_LIB(gpm,Gpm_Open,
2950217309Snwhitehorn	[AC_CHECK_LIB(gpm,initscr,
2951217309Snwhitehorn		[LIBS="$cf_ncurses_SAVE"],
2952217309Snwhitehorn		[cf_ncurses_LIBS="-lgpm"])])
2953217309Snwhitehorn
2954217309Snwhitehorncase $host_os in #(vi
2955217309Snwhitehornfreebsd*)
2956217309Snwhitehorn	# This is only necessary if you are linking against an obsolete
2957217309Snwhitehorn	# version of ncurses (but it should do no harm, since it's static).
2958217309Snwhitehorn	if test "$cf_nculib_root" = ncurses ; then
2959217309Snwhitehorn		AC_CHECK_LIB(mytinfo,tgoto,[cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS"])
2960217309Snwhitehorn	fi
2961217309Snwhitehorn	;;
2962217309Snwhitehornesac
2963217309Snwhitehorn
2964220749SnwhitehornCF_ADD_LIBS($cf_ncurses_LIBS)
2965217309Snwhitehorn
2966217309Snwhitehornif ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
2967217309Snwhitehornthen
2968220749Snwhitehorn	CF_ADD_LIBS(-l$cf_nculib_root)
2969217309Snwhitehornelse
2970217309Snwhitehorn	CF_FIND_LIBRARY($cf_nculib_root,$cf_nculib_root,
2971220749Snwhitehorn		[#include <${cf_cv_ncurses_header:-curses.h}>],
2972217309Snwhitehorn		[initscr()],
2973217309Snwhitehorn		initscr)
2974217309Snwhitehornfi
2975217309Snwhitehorn
2976217309Snwhitehornif test -n "$cf_ncurses_LIBS" ; then
2977217309Snwhitehorn	AC_MSG_CHECKING(if we can link $cf_nculib_root without $cf_ncurses_LIBS)
2978217309Snwhitehorn	cf_ncurses_SAVE="$LIBS"
2979217309Snwhitehorn	for p in $cf_ncurses_LIBS ; do
2980217309Snwhitehorn		q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"`
2981217309Snwhitehorn		if test "$q" != "$LIBS" ; then
2982217309Snwhitehorn			LIBS="$q"
2983217309Snwhitehorn		fi
2984217309Snwhitehorn	done
2985220749Snwhitehorn	AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
2986217309Snwhitehorn		[initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);],
2987217309Snwhitehorn		[AC_MSG_RESULT(yes)],
2988217309Snwhitehorn		[AC_MSG_RESULT(no)
2989217309Snwhitehorn		 LIBS="$cf_ncurses_SAVE"])
2990217309Snwhitehornfi
2991217309Snwhitehorn
2992217309SnwhitehornCF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_nculib_root)
2993217309SnwhitehornAC_DEFINE_UNQUOTED($cf_nculib_ROOT)
2994217309Snwhitehorn])dnl
2995217309Snwhitehorndnl ---------------------------------------------------------------------------
2996251843Sbaptdnl CF_NCURSES_VERSION version: 14 updated: 2012/10/06 08:57:51
2997217309Snwhitehorndnl ------------------
2998217309Snwhitehorndnl Check for the version of ncurses, to aid in reporting bugs, etc.
2999217309Snwhitehorndnl Call CF_CURSES_CPPFLAGS first, or CF_NCURSES_CPPFLAGS.  We don't use
3000217309Snwhitehorndnl AC_REQUIRE since that does not work with the shell's if/then/else/fi.
3001217309SnwhitehornAC_DEFUN([CF_NCURSES_VERSION],
3002217309Snwhitehorn[
3003217309SnwhitehornAC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
3004217309SnwhitehornAC_CACHE_CHECK(for ncurses version, cf_cv_ncurses_version,[
3005217309Snwhitehorn	cf_cv_ncurses_version=no
3006217309Snwhitehorn	cf_tempfile=out$$
3007217309Snwhitehorn	rm -f $cf_tempfile
3008217309Snwhitehorn	AC_TRY_RUN([
3009220749Snwhitehorn#include <${cf_cv_ncurses_header:-curses.h}>
3010217309Snwhitehorn#include <stdio.h>
3011217309Snwhitehornint main()
3012217309Snwhitehorn{
3013217309Snwhitehorn	FILE *fp = fopen("$cf_tempfile", "w");
3014217309Snwhitehorn#ifdef NCURSES_VERSION
3015217309Snwhitehorn# ifdef NCURSES_VERSION_PATCH
3016217309Snwhitehorn	fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH);
3017217309Snwhitehorn# else
3018217309Snwhitehorn	fprintf(fp, "%s\n", NCURSES_VERSION);
3019217309Snwhitehorn# endif
3020217309Snwhitehorn#else
3021217309Snwhitehorn# ifdef __NCURSES_H
3022217309Snwhitehorn	fprintf(fp, "old\n");
3023217309Snwhitehorn# else
3024217309Snwhitehorn	make an error
3025217309Snwhitehorn# endif
3026217309Snwhitehorn#endif
3027220749Snwhitehorn	${cf_cv_main_return:-return}(0);
3028217309Snwhitehorn}],[
3029217309Snwhitehorn	cf_cv_ncurses_version=`cat $cf_tempfile`],,[
3030217309Snwhitehorn
3031217309Snwhitehorn	# This will not work if the preprocessor splits the line after the
3032217309Snwhitehorn	# Autoconf token.  The 'unproto' program does that.
3033217309Snwhitehorn	cat > conftest.$ac_ext <<EOF
3034220749Snwhitehorn#include <${cf_cv_ncurses_header:-curses.h}>
3035217309Snwhitehorn#undef Autoconf
3036217309Snwhitehorn#ifdef NCURSES_VERSION
3037217309SnwhitehornAutoconf NCURSES_VERSION
3038217309Snwhitehorn#else
3039217309Snwhitehorn#ifdef __NCURSES_H
3040217309SnwhitehornAutoconf "old"
3041217309Snwhitehorn#endif
3042217309Snwhitehorn;
3043217309Snwhitehorn#endif
3044217309SnwhitehornEOF
3045217309Snwhitehorn	cf_try="$ac_cpp conftest.$ac_ext 2>&AC_FD_CC | grep '^Autoconf ' >conftest.out"
3046217309Snwhitehorn	AC_TRY_EVAL(cf_try)
3047217309Snwhitehorn	if test -f conftest.out ; then
3048217309Snwhitehorn		cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[[^"]]*"%%' -e 's%".*%%'`
3049217309Snwhitehorn		test -n "$cf_out" && cf_cv_ncurses_version="$cf_out"
3050217309Snwhitehorn		rm -f conftest.out
3051217309Snwhitehorn	fi
3052217309Snwhitehorn])
3053217309Snwhitehorn	rm -f $cf_tempfile
3054217309Snwhitehorn])
3055251843Sbapttest "$cf_cv_ncurses_version" = no || AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries])
3056217309Snwhitehorn])dnl
3057217309Snwhitehorndnl ---------------------------------------------------------------------------
3058251843Sbaptdnl CF_NO_LEAKS_OPTION version: 5 updated: 2012/10/02 20:55:03
3059217309Snwhitehorndnl ------------------
3060217309Snwhitehorndnl see CF_WITH_NO_LEAKS
3061217309SnwhitehornAC_DEFUN([CF_NO_LEAKS_OPTION],[
3062217309SnwhitehornAC_MSG_CHECKING(if you want to use $1 for testing)
3063217309SnwhitehornAC_ARG_WITH($1,
3064217309Snwhitehorn	[$2],
3065251843Sbapt	[AC_DEFINE_UNQUOTED($3,1,"Define to 1 if you want to use $1 for testing.")ifelse([$4],,[
3066217309Snwhitehorn	 $4
3067217309Snwhitehorn])
3068217309Snwhitehorn	: ${with_cflags:=-g}
3069217309Snwhitehorn	: ${with_no_leaks:=yes}
3070217309Snwhitehorn	 with_$1=yes],
3071217309Snwhitehorn	[with_$1=])
3072217309SnwhitehornAC_MSG_RESULT(${with_$1:-no})
3073217309Snwhitehorn
3074217309Snwhitehorncase .$with_cflags in #(vi
3075217309Snwhitehorn.*-g*)
3076217309Snwhitehorn	case .$CFLAGS in #(vi
3077217309Snwhitehorn	.*-g*) #(vi
3078217309Snwhitehorn		;;
3079217309Snwhitehorn	*)
3080217309Snwhitehorn		CF_ADD_CFLAGS([-g])
3081217309Snwhitehorn		;;
3082217309Snwhitehorn	esac
3083217309Snwhitehorn	;;
3084217309Snwhitehornesac
3085217309Snwhitehorn])dnl
3086217309Snwhitehorndnl ---------------------------------------------------------------------------
3087255852Sdteskednl CF_NUMBER_SYNTAX version: 1 updated: 2003/09/20 18:12:49
3088255852Sdteskednl ----------------
3089255852Sdteskednl Check if the given variable is a number.  If not, report an error.
3090255852Sdteskednl $1 is the variable
3091255852Sdteskednl $2 is the message
3092255852SdteskeAC_DEFUN([CF_NUMBER_SYNTAX],[
3093255852Sdteskeif test -n "$1" ; then
3094255852Sdteske  case $1 in #(vi
3095255852Sdteske  [[0-9]]*) #(vi
3096255852Sdteske 	;;
3097255852Sdteske  *)
3098255852Sdteske	AC_MSG_ERROR($2 is not a number: $1)
3099255852Sdteske 	;;
3100255852Sdteske  esac
3101255852Sdteskeelse
3102255852Sdteske  AC_MSG_ERROR($2 value is empty)
3103255852Sdteskefi
3104255852Sdteske])dnl
3105255852Sdteskednl ---------------------------------------------------------------------------
3106217309Snwhitehorndnl CF_OUR_MESSAGES version: 7 updated: 2004/09/12 19:45:55
3107217309Snwhitehorndnl ---------------
3108217309Snwhitehorndnl Check if we use the messages included with this program
3109217309Snwhitehorndnl
3110217309Snwhitehorndnl $1 specifies either Makefile or makefile, defaulting to the former.
3111217309Snwhitehorndnl
3112217309Snwhitehorndnl Sets variables which can be used to substitute in makefiles:
3113217309Snwhitehorndnl	MSG_DIR_MAKE - to make ./po directory
3114217309Snwhitehorndnl	SUB_MAKEFILE - makefile in ./po directory (see CF_BUNDLED_INTL)
3115217309Snwhitehorndnl
3116217309SnwhitehornAC_DEFUN([CF_OUR_MESSAGES],
3117217309Snwhitehorn[
3118217309Snwhitehorncf_makefile=ifelse($1,,Makefile,$1)
3119217309Snwhitehorn
3120217309Snwhitehornuse_our_messages=no
3121217309Snwhitehornif test "$USE_NLS" = yes ; then
3122217309Snwhitehornif test -d $srcdir/po ; then
3123217309SnwhitehornAC_MSG_CHECKING(if we should use included message-library)
3124217309Snwhitehorn	AC_ARG_ENABLE(included-msgs,
3125217309Snwhitehorn	[  --disable-included-msgs use included messages, for i18n support],
3126217309Snwhitehorn	[use_our_messages=$enableval],
3127217309Snwhitehorn	[use_our_messages=yes])
3128217309Snwhitehornfi
3129217309SnwhitehornAC_MSG_RESULT($use_our_messages)
3130217309Snwhitehornfi
3131217309Snwhitehorn
3132217309SnwhitehornMSG_DIR_MAKE="#"
3133217309Snwhitehornif test "$use_our_messages" = yes
3134217309Snwhitehornthen
3135217309Snwhitehorn	SUB_MAKEFILE="$SUB_MAKEFILE po/$cf_makefile.in:$srcdir/po/$cf_makefile.inn"
3136217309Snwhitehorn	MSG_DIR_MAKE=
3137217309Snwhitehornfi
3138217309Snwhitehorn
3139217309SnwhitehornAC_SUBST(MSG_DIR_MAKE)
3140217309SnwhitehornAC_SUBST(SUB_MAKEFILE)
3141217309Snwhitehorn])dnl
3142217309Snwhitehorndnl ---------------------------------------------------------------------------
3143251843Sbaptdnl CF_PATHSEP version: 6 updated: 2012/09/29 18:38:12
3144217309Snwhitehorndnl ----------
3145251843Sbaptdnl Provide a value for the $PATH and similar separator (or amend the value
3146251843Sbaptdnl as provided in autoconf 2.5x).
3147217309SnwhitehornAC_DEFUN([CF_PATHSEP],
3148217309Snwhitehorn[
3149251843Sbapt	AC_MSG_CHECKING(for PATH separator)
3150217309Snwhitehorn	case $cf_cv_system_name in
3151217309Snwhitehorn	os2*)	PATH_SEPARATOR=';'  ;;
3152251843Sbapt	*)	${PATH_SEPARATOR:=':'}  ;;
3153217309Snwhitehorn	esac
3154220749Snwhitehornifelse([$1],,,[$1=$PATH_SEPARATOR])
3155217309Snwhitehorn	AC_SUBST(PATH_SEPARATOR)
3156251843Sbapt	AC_MSG_RESULT($PATH_SEPARATOR)
3157217309Snwhitehorn])dnl
3158217309Snwhitehorndnl ---------------------------------------------------------------------------
3159251843Sbaptdnl CF_PATH_SYNTAX version: 14 updated: 2012/06/19 20:58:54
3160217309Snwhitehorndnl --------------
3161217309Snwhitehorndnl Check the argument to see that it looks like a pathname.  Rewrite it if it
3162217309Snwhitehorndnl begins with one of the prefix/exec_prefix variables, and then again if the
3163217309Snwhitehorndnl result begins with 'NONE'.  This is necessary to work around autoconf's
3164217309Snwhitehorndnl delayed evaluation of those symbols.
3165217309SnwhitehornAC_DEFUN([CF_PATH_SYNTAX],[
3166217309Snwhitehornif test "x$prefix" != xNONE; then
3167217309Snwhitehorn  cf_path_syntax="$prefix"
3168217309Snwhitehornelse
3169217309Snwhitehorn  cf_path_syntax="$ac_default_prefix"
3170217309Snwhitehornfi
3171217309Snwhitehorn
3172217309Snwhitehorncase ".[$]$1" in #(vi
3173217309Snwhitehorn.\[$]\(*\)*|.\'*\'*) #(vi
3174217309Snwhitehorn  ;;
3175217309Snwhitehorn..|./*|.\\*) #(vi
3176217309Snwhitehorn  ;;
3177217309Snwhitehorn.[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX
3178217309Snwhitehorn  ;;
3179251843Sbapt.\[$]{*prefix}*|.\[$]{*dir}*) #(vi
3180217309Snwhitehorn  eval $1="[$]$1"
3181217309Snwhitehorn  case ".[$]$1" in #(vi
3182217309Snwhitehorn  .NONE/*)
3183217309Snwhitehorn    $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
3184217309Snwhitehorn    ;;
3185217309Snwhitehorn  esac
3186217309Snwhitehorn  ;; #(vi
3187217309Snwhitehorn.no|.NONE/*)
3188217309Snwhitehorn  $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
3189217309Snwhitehorn  ;;
3190217309Snwhitehorn*)
3191220749Snwhitehorn  ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2)
3192217309Snwhitehorn  ;;
3193217309Snwhitehornesac
3194217309Snwhitehorn])dnl
3195217309Snwhitehorndnl ---------------------------------------------------------------------------
3196255852Sdteskednl CF_PKG_CONFIG version: 7 updated: 2011/04/29 04:53:22
3197255852Sdteskednl -------------
3198255852Sdteskednl Check for the package-config program, unless disabled by command-line.
3199255852SdteskeAC_DEFUN([CF_PKG_CONFIG],
3200255852Sdteske[
3201255852SdteskeAC_MSG_CHECKING(if you want to use pkg-config)
3202255852SdteskeAC_ARG_WITH(pkg-config,
3203255852Sdteske	[  --with-pkg-config{=path} enable/disable use of pkg-config],
3204255852Sdteske	[cf_pkg_config=$withval],
3205255852Sdteske	[cf_pkg_config=yes])
3206255852SdteskeAC_MSG_RESULT($cf_pkg_config)
3207255852Sdteske
3208255852Sdteskecase $cf_pkg_config in #(vi
3209255852Sdteskeno) #(vi
3210255852Sdteske	PKG_CONFIG=none
3211255852Sdteske	;;
3212255852Sdteskeyes) #(vi
3213255852Sdteske	CF_ACVERSION_CHECK(2.52,
3214255852Sdteske		[AC_PATH_TOOL(PKG_CONFIG, pkg-config, none)],
3215255852Sdteske		[AC_PATH_PROG(PKG_CONFIG, pkg-config, none)])
3216255852Sdteske	;;
3217255852Sdteske*)
3218255852Sdteske	PKG_CONFIG=$withval
3219255852Sdteske	;;
3220255852Sdteskeesac
3221255852Sdteske
3222255852Sdtesketest -z "$PKG_CONFIG" && PKG_CONFIG=none
3223255852Sdteskeif test "$PKG_CONFIG" != none ; then
3224255852Sdteske	CF_PATH_SYNTAX(PKG_CONFIG)
3225255852Sdteskefi
3226255852Sdteske
3227255852SdteskeAC_SUBST(PKG_CONFIG)
3228255852Sdteske])dnl
3229255852Sdteskednl ---------------------------------------------------------------------------
3230220749Snwhitehorndnl CF_POSIX_C_SOURCE version: 8 updated: 2010/05/26 05:38:42
3231217309Snwhitehorndnl -----------------
3232217309Snwhitehorndnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed.
3233217309Snwhitehorndnl
3234217309Snwhitehorndnl	POSIX.1-1990				_POSIX_SOURCE
3235217309Snwhitehorndnl	POSIX.1-1990 and			_POSIX_SOURCE and
3236217309Snwhitehorndnl		POSIX.2-1992 C-Language			_POSIX_C_SOURCE=2
3237217309Snwhitehorndnl		Bindings Option
3238217309Snwhitehorndnl	POSIX.1b-1993				_POSIX_C_SOURCE=199309L
3239217309Snwhitehorndnl	POSIX.1c-1996				_POSIX_C_SOURCE=199506L
3240217309Snwhitehorndnl	X/Open 2000				_POSIX_C_SOURCE=200112L
3241217309Snwhitehorndnl
3242217309Snwhitehorndnl Parameters:
3243217309Snwhitehorndnl	$1 is the nominal value for _POSIX_C_SOURCE
3244217309SnwhitehornAC_DEFUN([CF_POSIX_C_SOURCE],
3245217309Snwhitehorn[
3246220749Snwhitehorncf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1])
3247217309Snwhitehorn
3248217309Snwhitehorncf_save_CFLAGS="$CFLAGS"
3249217309Snwhitehorncf_save_CPPFLAGS="$CPPFLAGS"
3250217309Snwhitehorn
3251217309SnwhitehornCF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE)
3252217309SnwhitehornCF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE)
3253217309Snwhitehorn
3254217309SnwhitehornAC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[
3255217309Snwhitehorn	CF_MSG_LOG(if the symbol is already defined go no further)
3256217309Snwhitehorn	AC_TRY_COMPILE([#include <sys/types.h>],[
3257217309Snwhitehorn#ifndef _POSIX_C_SOURCE
3258217309Snwhitehornmake an error
3259217309Snwhitehorn#endif],
3260217309Snwhitehorn	[cf_cv_posix_c_source=no],
3261217309Snwhitehorn	[cf_want_posix_source=no
3262217309Snwhitehorn	 case .$cf_POSIX_C_SOURCE in #(vi
3263217309Snwhitehorn	 .[[12]]??*) #(vi
3264217309Snwhitehorn		cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
3265217309Snwhitehorn		;;
3266217309Snwhitehorn	 .2) #(vi
3267217309Snwhitehorn		cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
3268217309Snwhitehorn		cf_want_posix_source=yes
3269217309Snwhitehorn		;;
3270217309Snwhitehorn	 .*)
3271217309Snwhitehorn		cf_want_posix_source=yes
3272217309Snwhitehorn		;;
3273217309Snwhitehorn	 esac
3274217309Snwhitehorn	 if test "$cf_want_posix_source" = yes ; then
3275217309Snwhitehorn		AC_TRY_COMPILE([#include <sys/types.h>],[
3276217309Snwhitehorn#ifdef _POSIX_SOURCE
3277217309Snwhitehornmake an error
3278217309Snwhitehorn#endif],[],
3279217309Snwhitehorn		cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE")
3280217309Snwhitehorn	 fi
3281217309Snwhitehorn	 CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE)
3282217309Snwhitehorn	 CFLAGS="$cf_trim_CFLAGS"
3283217309Snwhitehorn	 CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source"
3284217309Snwhitehorn	 CF_MSG_LOG(if the second compile does not leave our definition intact error)
3285217309Snwhitehorn	 AC_TRY_COMPILE([#include <sys/types.h>],[
3286217309Snwhitehorn#ifndef _POSIX_C_SOURCE
3287217309Snwhitehornmake an error
3288217309Snwhitehorn#endif],,
3289217309Snwhitehorn	 [cf_cv_posix_c_source=no])
3290217309Snwhitehorn	 CFLAGS="$cf_save_CFLAGS"
3291217309Snwhitehorn	 CPPFLAGS="$cf_save_CPPFLAGS"
3292217309Snwhitehorn	])
3293217309Snwhitehorn])
3294217309Snwhitehorn
3295217309Snwhitehornif test "$cf_cv_posix_c_source" != no ; then
3296217309Snwhitehorn	CFLAGS="$cf_trim_CFLAGS"
3297217309Snwhitehorn	CPPFLAGS="$cf_trim_CPPFLAGS"
3298217309Snwhitehorn	CF_ADD_CFLAGS($cf_cv_posix_c_source)
3299217309Snwhitehornfi
3300217309Snwhitehorn
3301217309Snwhitehorn])dnl
3302217309Snwhitehorndnl ---------------------------------------------------------------------------
3303251843Sbaptdnl CF_PROG_CC version: 3 updated: 2012/10/06 15:31:55
3304251843Sbaptdnl ----------
3305251843Sbaptdnl standard check for CC, plus followup sanity checks
3306251843Sbaptdnl $1 = optional parameter to pass to AC_PROG_CC to specify compiler name
3307251843SbaptAC_DEFUN([CF_PROG_CC],[
3308251843Sbaptifelse($1,,[AC_PROG_CC],[AC_PROG_CC($1)])
3309251843SbaptCF_GCC_VERSION
3310251843SbaptCF_ACVERSION_CHECK(2.52,
3311251843Sbapt	[AC_PROG_CC_STDC],
3312251843Sbapt	[CF_ANSI_CC_REQD])
3313251843SbaptCF_CC_ENV_FLAGS 
3314217309Snwhitehorn])dnl
3315217309Snwhitehorndnl ---------------------------------------------------------------------------
3316251843Sbaptdnl CF_PROG_EXT version: 11 updated: 2012/10/06 08:57:51
3317217309Snwhitehorndnl -----------
3318217309Snwhitehorndnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX.
3319217309SnwhitehornAC_DEFUN([CF_PROG_EXT],
3320217309Snwhitehorn[
3321217309SnwhitehornAC_REQUIRE([CF_CHECK_CACHE])
3322217309Snwhitehorncase $cf_cv_system_name in
3323217309Snwhitehornos2*)
3324217309Snwhitehorn    CFLAGS="$CFLAGS -Zmt"
3325217309Snwhitehorn    CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__"
3326217309Snwhitehorn    CXXFLAGS="$CXXFLAGS -Zmt"
3327217309Snwhitehorn    # autoconf's macro sets -Zexe and suffix both, which conflict:w
3328217309Snwhitehorn    LDFLAGS="$LDFLAGS -Zmt -Zcrtdll"
3329217309Snwhitehorn    ac_cv_exeext=.exe
3330217309Snwhitehorn    ;;
3331217309Snwhitehornesac
3332217309Snwhitehorn
3333217309SnwhitehornAC_EXEEXT
3334217309SnwhitehornAC_OBJEXT
3335217309Snwhitehorn
3336217309SnwhitehornPROG_EXT="$EXEEXT"
3337217309SnwhitehornAC_SUBST(PROG_EXT)
3338251843Sbapttest -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT",[Define to the program extension (normally blank)])
3339217309Snwhitehorn])dnl
3340217309Snwhitehorndnl ---------------------------------------------------------------------------
3341251843Sbaptdnl CF_PROG_LINT version: 2 updated: 2009/08/12 04:43:14
3342251843Sbaptdnl ------------
3343251843SbaptAC_DEFUN([CF_PROG_LINT],
3344251843Sbapt[
3345251843SbaptAC_CHECK_PROGS(LINT, tdlint lint alint splint lclint)
3346251843SbaptAC_SUBST(LINT_OPTS)
3347251843Sbapt])dnl
3348251843Sbaptdnl ---------------------------------------------------------------------------
3349255852Sdteskednl CF_PROG_LN_S version: 2 updated: 2010/08/14 18:25:37
3350255852Sdteskednl ------------
3351255852Sdteskednl Combine checks for "ln -s" and "ln -sf", updating $LN_S to include "-f"
3352255852Sdteskednl option if it is supported.
3353255852SdteskeAC_DEFUN([CF_PROG_LN_S],[
3354255852SdteskeAC_PROG_LN_S
3355255852SdteskeAC_MSG_CHECKING(if $LN_S -f options work)
3356255852Sdteske
3357255852Sdteskerm -f conf$$.src conf$$dst
3358255852Sdteskeecho >conf$$.dst
3359255852Sdteskeecho first >conf$$.src
3360255852Sdteskeif $LN_S -f conf$$.src conf$$.dst 2>/dev/null; then
3361255852Sdteske	cf_prog_ln_sf=yes
3362255852Sdteskeelse
3363255852Sdteske	cf_prog_ln_sf=no
3364255852Sdteskefi
3365255852Sdteskerm -f conf$$.dst conf$$src
3366255852SdteskeAC_MSG_RESULT($cf_prog_ln_sf)
3367255852Sdteske
3368255852Sdtesketest "$cf_prog_ln_sf" = yes && LN_S="$LN_S -f"
3369255852Sdteske])dnl
3370255852Sdteskednl ---------------------------------------------------------------------------
3371217309Snwhitehorndnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50
3372217309Snwhitehorndnl ----------------
3373217309Snwhitehorndnl Remove all -U and -D options that refer to the given symbol from a list
3374217309Snwhitehorndnl of C compiler options.  This works around the problem that not all
3375217309Snwhitehorndnl compilers process -U and -D options from left-to-right, so a -U option
3376217309Snwhitehorndnl cannot be used to cancel the effect of a preceding -D option.
3377217309Snwhitehorndnl
3378217309Snwhitehorndnl $1 = target (which could be the same as the source variable)
3379217309Snwhitehorndnl $2 = source (including '$')
3380217309Snwhitehorndnl $3 = symbol to remove
3381217309Snwhitehorndefine([CF_REMOVE_DEFINE],
3382217309Snwhitehorn[
3383217309Snwhitehorn$1=`echo "$2" | \
3384217309Snwhitehorn	sed	-e 's/-[[UD]]'"$3"'\(=[[^ 	]]*\)\?[[ 	]]/ /g' \
3385217309Snwhitehorn		-e 's/-[[UD]]'"$3"'\(=[[^ 	]]*\)\?[$]//g'`
3386217309Snwhitehorn])dnl
3387217309Snwhitehorndnl ---------------------------------------------------------------------------
3388255852Sdteskednl CF_RPATH_HACK version: 11 updated: 2013/09/01 13:02:00
3389217309Snwhitehorndnl -------------
3390217309SnwhitehornAC_DEFUN([CF_RPATH_HACK],
3391217309Snwhitehorn[
3392217309SnwhitehornAC_REQUIRE([CF_LD_RPATH_OPT])
3393217309SnwhitehornAC_MSG_CHECKING(for updated LDFLAGS)
3394217309Snwhitehornif test -n "$LD_RPATH_OPT" ; then
3395217309Snwhitehorn	AC_MSG_RESULT(maybe)
3396217309Snwhitehorn
3397217309Snwhitehorn	AC_CHECK_PROGS(cf_ldd_prog,ldd,no)
3398217309Snwhitehorn	cf_rpath_list="/usr/lib /lib"
3399217309Snwhitehorn	if test "$cf_ldd_prog" != no
3400217309Snwhitehorn	then
3401224014Snwhitehorn		cf_rpath_oops=
3402224014Snwhitehorn
3403217309SnwhitehornAC_TRY_LINK([#include <stdio.h>],
3404217309Snwhitehorn		[printf("Hello");],
3405255852Sdteske		[cf_rpath_oops=`$cf_ldd_prog conftest$ac_exeext | fgrep ' not found' | sed -e 's% =>.*$%%' |sort | uniq`
3406255852Sdteske		 cf_rpath_list=`$cf_ldd_prog conftest$ac_exeext | fgrep / | sed -e 's%^.*[[ 	]]/%/%' -e 's%/[[^/]][[^/]]*$%%' |sort | uniq`])
3407224014Snwhitehorn
3408224014Snwhitehorn		# If we passed the link-test, but get a "not found" on a given library,
3409224014Snwhitehorn		# this could be due to inept reconfiguration of gcc to make it only
3410224014Snwhitehorn		# partly honor /usr/local/lib (or whatever).  Sometimes this behavior
3411224014Snwhitehorn		# is intentional, e.g., installing gcc in /usr/bin and suppressing the
3412224014Snwhitehorn		# /usr/local libraries.
3413224014Snwhitehorn		if test -n "$cf_rpath_oops"
3414224014Snwhitehorn		then
3415224014Snwhitehorn			for cf_rpath_src in $cf_rpath_oops
3416224014Snwhitehorn			do
3417224014Snwhitehorn				for cf_rpath_dir in \
3418224014Snwhitehorn					/usr/local \
3419224014Snwhitehorn					/usr/pkg \
3420224014Snwhitehorn					/opt/sfw
3421224014Snwhitehorn				do
3422224014Snwhitehorn					if test -f $cf_rpath_dir/lib/$cf_rpath_src
3423224014Snwhitehorn					then
3424224014Snwhitehorn						CF_VERBOSE(...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src)
3425224014Snwhitehorn						LDFLAGS="$LDFLAGS -L$cf_rpath_dir/lib"
3426224014Snwhitehorn						break
3427224014Snwhitehorn					fi
3428224014Snwhitehorn				done
3429224014Snwhitehorn			done
3430224014Snwhitehorn		fi
3431217309Snwhitehorn	fi
3432217309Snwhitehorn
3433217309Snwhitehorn	CF_VERBOSE(...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS)
3434217309Snwhitehorn
3435217309Snwhitehorn	CF_RPATH_HACK_2(LDFLAGS)
3436217309Snwhitehorn	CF_RPATH_HACK_2(LIBS)
3437217309Snwhitehorn
3438217309Snwhitehorn	CF_VERBOSE(...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS)
3439255852Sdteskeelse
3440255852Sdteske	AC_MSG_RESULT(no)
3441217309Snwhitehornfi
3442217309SnwhitehornAC_SUBST(EXTRA_LDFLAGS)
3443217309Snwhitehorn])dnl
3444217309Snwhitehorndnl ---------------------------------------------------------------------------
3445217309Snwhitehorndnl CF_RPATH_HACK_2 version: 6 updated: 2010/04/17 16:31:24
3446217309Snwhitehorndnl ---------------
3447217309Snwhitehorndnl Do one set of substitutions for CF_RPATH_HACK, adding an rpath option to
3448217309Snwhitehorndnl EXTRA_LDFLAGS for each -L option found.
3449217309Snwhitehorndnl
3450217309Snwhitehorndnl $cf_rpath_list contains a list of directories to ignore.
3451217309Snwhitehorndnl
3452217309Snwhitehorndnl $1 = variable name to update.  The LDFLAGS variable should be the only one,
3453217309Snwhitehorndnl      but LIBS often has misplaced -L options.
3454217309SnwhitehornAC_DEFUN([CF_RPATH_HACK_2],
3455217309Snwhitehorn[
3456217309SnwhitehornCF_VERBOSE(...checking $1 [$]$1)
3457217309Snwhitehorn
3458217309Snwhitehorncf_rpath_dst=
3459217309Snwhitehornfor cf_rpath_src in [$]$1
3460217309Snwhitehorndo
3461217309Snwhitehorn	case $cf_rpath_src in #(vi
3462217309Snwhitehorn	-L*) #(vi
3463217309Snwhitehorn
3464217309Snwhitehorn		# check if this refers to a directory which we will ignore
3465217309Snwhitehorn		cf_rpath_skip=no
3466217309Snwhitehorn		if test -n "$cf_rpath_list"
3467217309Snwhitehorn		then
3468217309Snwhitehorn			for cf_rpath_item in $cf_rpath_list
3469217309Snwhitehorn			do
3470217309Snwhitehorn				if test "x$cf_rpath_src" = "x-L$cf_rpath_item"
3471217309Snwhitehorn				then
3472217309Snwhitehorn					cf_rpath_skip=yes
3473217309Snwhitehorn					break
3474217309Snwhitehorn				fi
3475217309Snwhitehorn			done
3476217309Snwhitehorn		fi
3477217309Snwhitehorn
3478217309Snwhitehorn		if test "$cf_rpath_skip" = no
3479217309Snwhitehorn		then
3480217309Snwhitehorn			# transform the option
3481217309Snwhitehorn			if test "$LD_RPATH_OPT" = "-R " ; then
3482217309Snwhitehorn				cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%-R %"`
3483217309Snwhitehorn			else
3484217309Snwhitehorn				cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%$LD_RPATH_OPT%"`
3485217309Snwhitehorn			fi
3486217309Snwhitehorn
3487217309Snwhitehorn			# if we have not already added this, add it now
3488217309Snwhitehorn			cf_rpath_tst=`echo "$EXTRA_LDFLAGS" | sed -e "s%$cf_rpath_tmp %%"`
3489217309Snwhitehorn			if test "x$cf_rpath_tst" = "x$EXTRA_LDFLAGS"
3490217309Snwhitehorn			then
3491217309Snwhitehorn				CF_VERBOSE(...Filter $cf_rpath_src ->$cf_rpath_tmp)
3492217309Snwhitehorn				EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS"
3493217309Snwhitehorn			fi
3494217309Snwhitehorn		fi
3495217309Snwhitehorn		;;
3496217309Snwhitehorn	esac
3497217309Snwhitehorn	cf_rpath_dst="$cf_rpath_dst $cf_rpath_src"
3498217309Snwhitehorndone
3499217309Snwhitehorn$1=$cf_rpath_dst
3500217309Snwhitehorn
3501217309SnwhitehornCF_VERBOSE(...checked $1 [$]$1)
3502217309SnwhitehornAC_SUBST(EXTRA_LDFLAGS)
3503217309Snwhitehorn])dnl
3504217309Snwhitehorndnl ---------------------------------------------------------------------------
3505255852Sdteskednl CF_SHARED_OPTS version: 83 updated: 2013/09/21 17:34:53
3506255852Sdteskednl --------------
3507255852Sdteskednl --------------
3508255852Sdteskednl Attempt to determine the appropriate CC/LD options for creating a shared
3509255852Sdteskednl library.
3510255852Sdteskednl
3511255852Sdteskednl Notes:
3512255852Sdteskednl a) ${LOCAL_LDFLAGS} is used to link executables that will run within
3513255852Sdteskednl the build-tree, i.e., by making use of the libraries that are compiled in
3514255852Sdteskednl $rel_builddir/lib We avoid compiling-in a $rel_builddir/lib path for the
3515255852Sdteskednl shared library since that can lead to unexpected results at runtime.
3516255852Sdteskednl b) ${LOCAL_LDFLAGS2} has the same intention but assumes that the shared
3517255852Sdteskednl libraries are compiled in ../../lib
3518255852Sdteskednl
3519255852Sdteskednl The variable 'cf_cv_do_symlinks' is used to control whether we configure
3520255852Sdteskednl to install symbolic links to the rel/abi versions of shared libraries.
3521255852Sdteskednl
3522255852Sdteskednl The variable 'cf_cv_shlib_version' controls whether we use the rel or abi
3523255852Sdteskednl version when making symbolic links.
3524255852Sdteskednl
3525255852Sdteskednl The variable 'cf_cv_shlib_version_infix' controls whether shared library
3526255852Sdteskednl version numbers are infix (ex: libncurses.<ver>.dylib) or postfix
3527255852Sdteskednl (ex: libncurses.so.<ver>).
3528255852Sdteskednl
3529255852Sdteskednl Some loaders leave 'so_locations' lying around.  It's nice to clean up.
3530255852SdteskeAC_DEFUN([CF_SHARED_OPTS],
3531255852Sdteske[
3532255852Sdteske	AC_REQUIRE([CF_LD_RPATH_OPT])
3533255852Sdteske	RM_SHARED_OPTS=
3534255852Sdteske	LOCAL_LDFLAGS=
3535255852Sdteske	LOCAL_LDFLAGS2=
3536255852Sdteske	LD_SHARED_OPTS=
3537255852Sdteske	INSTALL_LIB="-m 644"
3538255852Sdteske	: ${rel_builddir:=.}
3539255852Sdteske
3540255852Sdteske	cf_cv_do_symlinks=no
3541255852Sdteske	cf_ld_rpath_opt=
3542255852Sdteske	test "$cf_cv_enable_rpath" = yes && cf_ld_rpath_opt="$LD_RPATH_OPT"
3543255852Sdteske
3544255852Sdteske	AC_MSG_CHECKING(if release/abi version should be used for shared libs)
3545255852Sdteske	AC_ARG_WITH(shlib-version,
3546255852Sdteske	[  --with-shlib-version=X  Specify rel or abi version for shared libs],
3547255852Sdteske	[test -z "$withval" && withval=auto
3548255852Sdteske	case $withval in #(vi
3549255852Sdteske	yes) #(vi
3550255852Sdteske		cf_cv_shlib_version=auto
3551255852Sdteske		;;
3552255852Sdteske	rel|abi|auto|no) #(vi
3553255852Sdteske		cf_cv_shlib_version=$withval
3554255852Sdteske		;;
3555255852Sdteske	*)
3556255852Sdteske		AC_MSG_ERROR([option value must be one of: rel, abi, auto or no])
3557255852Sdteske		;;
3558255852Sdteske	esac
3559255852Sdteske	],[cf_cv_shlib_version=auto])
3560255852Sdteske	AC_MSG_RESULT($cf_cv_shlib_version)
3561255852Sdteske
3562255852Sdteske	cf_cv_rm_so_locs=no
3563255852Sdteske	cf_try_cflags=
3564255852Sdteske
3565255852Sdteske	# Some less-capable ports of gcc support only -fpic
3566255852Sdteske	CC_SHARED_OPTS=
3567255852Sdteske	if test "$GCC" = yes
3568255852Sdteske	then
3569255852Sdteske		AC_MSG_CHECKING(which $CC option to use)
3570255852Sdteske		cf_save_CFLAGS="$CFLAGS"
3571255852Sdteske		for CC_SHARED_OPTS in -fPIC -fpic ''
3572255852Sdteske		do
3573255852Sdteske			CFLAGS="$cf_save_CFLAGS $CC_SHARED_OPTS"
3574255852Sdteske			AC_TRY_COMPILE([#include <stdio.h>],[int x = 1],[break],[])
3575255852Sdteske		done
3576255852Sdteske		AC_MSG_RESULT($CC_SHARED_OPTS)
3577255852Sdteske		CFLAGS="$cf_save_CFLAGS"
3578255852Sdteske	fi
3579255852Sdteske
3580255852Sdteske	cf_cv_shlib_version_infix=no
3581255852Sdteske
3582255852Sdteske	case $cf_cv_system_name in #(vi
3583255852Sdteske	aix4.[3-9]*|aix[[5-7]]*) #(vi
3584255852Sdteske		if test "$GCC" = yes; then
3585255852Sdteske			CC_SHARED_OPTS=
3586255852Sdteske			MK_SHARED_LIB='${CC} -shared -Wl,-brtl -Wl,-blibpath:${RPATH_LIST}:/usr/lib -o [$]@'
3587255852Sdteske		else
3588255852Sdteske			# CC_SHARED_OPTS='-qpic=large -G'
3589255852Sdteske			# perhaps "-bM:SRE -bnoentry -bexpall"
3590255852Sdteske			MK_SHARED_LIB='${CC} -G -Wl,-brtl -Wl,-blibpath:${RPATH_LIST}:/usr/lib -o [$]@'
3591255852Sdteske		fi
3592255852Sdteske		;;
3593255852Sdteske	beos*) #(vi
3594255852Sdteske		MK_SHARED_LIB='${CC} ${CFLAGS} -o $[@] -Xlinker -soname=`basename $[@]` -nostart -e 0'
3595255852Sdteske		;;
3596255852Sdteske	cygwin*) #(vi
3597255852Sdteske		CC_SHARED_OPTS=
3598255852Sdteske		MK_SHARED_LIB='sh '$rel_builddir'/mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}'
3599255852Sdteske		RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a"
3600255852Sdteske		cf_cv_shlib_version=cygdll
3601255852Sdteske		cf_cv_shlib_version_infix=cygdll
3602255852Sdteske		cat >mk_shared_lib.sh <<-CF_EOF
3603255852Sdteske		#!/bin/sh
3604255852Sdteske		SHARED_LIB=\[$]1
3605255852Sdteske		IMPORT_LIB=\`echo "\[$]1" | sed -e 's/cyg/lib/' -e 's/[[0-9]]*\.dll[$]/.dll.a/'\`
3606255852Sdteske		shift
3607255852Sdteske		cat <<-EOF
3608255852Sdteske		Linking shared library
3609255852Sdteske		** SHARED_LIB \[$]SHARED_LIB
3610255852Sdteske		** IMPORT_LIB \[$]IMPORT_LIB
3611255852SdteskeEOF
3612255852Sdteske		exec \[$]* -shared -Wl,--out-implib=\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o \[$]{SHARED_LIB}
3613255852SdteskeCF_EOF
3614255852Sdteske		chmod +x mk_shared_lib.sh
3615255852Sdteske		;;
3616255852Sdteske	msys*) #(vi
3617255852Sdteske		CC_SHARED_OPTS=
3618255852Sdteske		MK_SHARED_LIB='sh '$rel_builddir'/mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}'
3619255852Sdteske		RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a"
3620255852Sdteske		cf_cv_shlib_version=msysdll
3621255852Sdteske		cf_cv_shlib_version_infix=msysdll
3622255852Sdteske		cat >mk_shared_lib.sh <<-CF_EOF
3623255852Sdteske		#!/bin/sh
3624255852Sdteske		SHARED_LIB=\[$]1
3625255852Sdteske		IMPORT_LIB=\`echo "\[$]1" | sed -e 's/msys-/lib/' -e 's/[[0-9]]*\.dll[$]/.dll.a/'\`
3626255852Sdteske		shift
3627255852Sdteske		cat <<-EOF
3628255852Sdteske		Linking shared library
3629255852Sdteske		** SHARED_LIB \[$]SHARED_LIB
3630255852Sdteske		** IMPORT_LIB \[$]IMPORT_LIB
3631255852SdteskeEOF
3632255852Sdteske		exec \[$]* -shared -Wl,--out-implib=\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o \[$]{SHARED_LIB}
3633255852SdteskeCF_EOF
3634255852Sdteske		chmod +x mk_shared_lib.sh
3635255852Sdteske		;;
3636255852Sdteske	darwin*) #(vi
3637255852Sdteske		cf_try_cflags="no-cpp-precomp"
3638255852Sdteske		CC_SHARED_OPTS="-dynamic"
3639255852Sdteske		MK_SHARED_LIB='${CC} ${CFLAGS} -dynamiclib -install_name ${libdir}/`basename $[@]` -compatibility_version ${ABI_VERSION} -current_version ${ABI_VERSION} -o $[@]'
3640255852Sdteske		test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=abi
3641255852Sdteske		cf_cv_shlib_version_infix=yes
3642255852Sdteske		AC_CACHE_CHECK([if ld -search_paths_first works], cf_cv_ldflags_search_paths_first, [
3643255852Sdteske			cf_save_LDFLAGS=$LDFLAGS
3644255852Sdteske			LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
3645255852Sdteske			AC_TRY_LINK(, [int i;], cf_cv_ldflags_search_paths_first=yes, cf_cv_ldflags_search_paths_first=no)
3646255852Sdteske				LDFLAGS=$cf_save_LDFLAGS])
3647255852Sdteske		if test $cf_cv_ldflags_search_paths_first = yes; then
3648255852Sdteske			LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
3649255852Sdteske		fi
3650255852Sdteske		;;
3651255852Sdteske	hpux[[7-8]]*) #(vi
3652255852Sdteske		# HP-UX 8.07 ld lacks "+b" option used for libdir search-list 
3653255852Sdteske		if test "$GCC" != yes; then
3654255852Sdteske			CC_SHARED_OPTS='+Z'
3655255852Sdteske		fi
3656255852Sdteske		MK_SHARED_LIB='${LD} -b -o $[@]'
3657255852Sdteske		INSTALL_LIB="-m 555"
3658255852Sdteske		;;
3659255852Sdteske	hpux*) #(vi
3660255852Sdteske		# (tested with gcc 2.7.2 -- I don't have c89)
3661255852Sdteske		if test "$GCC" = yes; then
3662255852Sdteske			LD_SHARED_OPTS='-Xlinker +b -Xlinker ${libdir}'
3663255852Sdteske		else
3664255852Sdteske			CC_SHARED_OPTS='+Z'
3665255852Sdteske			LD_SHARED_OPTS='-Wl,+b,${libdir}'
3666255852Sdteske		fi
3667255852Sdteske		MK_SHARED_LIB='${LD} +b ${libdir} -b -o $[@]'
3668255852Sdteske		# HP-UX shared libraries must be executable, and should be
3669255852Sdteske		# readonly to exploit a quirk in the memory manager.
3670255852Sdteske		INSTALL_LIB="-m 555"
3671255852Sdteske		;;
3672255852Sdteske	interix*)
3673255852Sdteske		test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
3674255852Sdteske		if test "$cf_cv_shlib_version" = rel; then
3675255852Sdteske			cf_shared_soname='`basename $@ .${REL_VERSION}`.${ABI_VERSION}'
3676255852Sdteske		else
3677255852Sdteske			cf_shared_soname='`basename $@`'
3678255852Sdteske		fi
3679255852Sdteske		CC_SHARED_OPTS=
3680255852Sdteske		MK_SHARED_LIB='${CC} -shared -Wl,-rpath,${RPATH_LIST} -Wl,-h,'$cf_shared_soname' -o $@'
3681255852Sdteske		;;
3682255852Sdteske	irix*) #(vi
3683255852Sdteske		if test "$cf_cv_enable_rpath" = yes ; then
3684255852Sdteske			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
3685255852Sdteske		fi
3686255852Sdteske		# tested with IRIX 5.2 and 'cc'.
3687255852Sdteske		if test "$GCC" != yes; then
3688255852Sdteske			CC_SHARED_OPTS='-KPIC'
3689255852Sdteske			MK_SHARED_LIB='${CC} -shared -rdata_shared -soname `basename $[@]` -o $[@]'
3690255852Sdteske		else
3691255852Sdteske			MK_SHARED_LIB='${CC} -shared -Wl,-soname,`basename $[@]` -o $[@]'
3692255852Sdteske		fi
3693255852Sdteske		cf_cv_rm_so_locs=yes
3694255852Sdteske		;;
3695255852Sdteske	linux*|gnu*|k*bsd*-gnu) #(vi
3696255852Sdteske		if test "$DFT_LWR_MODEL" = "shared" ; then
3697255852Sdteske			LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)"
3698255852Sdteske			LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
3699255852Sdteske		fi
3700255852Sdteske		if test "$cf_cv_enable_rpath" = yes ; then
3701255852Sdteske			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
3702255852Sdteske		fi
3703255852Sdteske		CF_SHARED_SONAME
3704255852Sdteske		MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]'
3705255852Sdteske		;;
3706255852Sdteske	mingw*) #(vi
3707255852Sdteske		cf_cv_shlib_version=mingw
3708255852Sdteske		cf_cv_shlib_version_infix=mingw
3709255852Sdteske		if test "$DFT_LWR_MODEL" = "shared" ; then
3710255852Sdteske			LOCAL_LDFLAGS="-Wl,--enable-auto-import"
3711255852Sdteske			LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
3712255852Sdteske			EXTRA_LDFLAGS="-Wl,--enable-auto-import $EXTRA_LDFLAGS"
3713255852Sdteske		fi
3714255852Sdteske		CC_SHARED_OPTS=
3715255852Sdteske		MK_SHARED_LIB='sh '$rel_builddir'/mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}'
3716255852Sdteske		RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a"
3717255852Sdteske		cat >mk_shared_lib.sh <<-CF_EOF
3718255852Sdteske		#!/bin/sh
3719255852Sdteske		SHARED_LIB=\[$]1
3720255852Sdteske		IMPORT_LIB=\`echo "\[$]1" | sed -e 's/[[0-9]]*\.dll[$]/.dll.a/'\`
3721255852Sdteske		shift
3722255852Sdteske		cat <<-EOF
3723255852Sdteske		Linking shared library
3724255852Sdteske		** SHARED_LIB \[$]SHARED_LIB
3725255852Sdteske		** IMPORT_LIB \[$]IMPORT_LIB
3726255852SdteskeEOF
3727255852Sdteske		exec \[$]* -shared -Wl,--enable-auto-import,--out-implib=\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o \[$]{SHARED_LIB}
3728255852SdteskeCF_EOF
3729255852Sdteske		chmod +x mk_shared_lib.sh
3730255852Sdteske		;;
3731255852Sdteske	openbsd[[2-9]].*|mirbsd*) #(vi
3732255852Sdteske		if test "$DFT_LWR_MODEL" = "shared" ; then
3733255852Sdteske			LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)"
3734255852Sdteske			LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
3735255852Sdteske		fi
3736255852Sdteske		if test "$cf_cv_enable_rpath" = yes ; then
3737255852Sdteske			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
3738255852Sdteske		fi
3739255852Sdteske		CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
3740255852Sdteske		CF_SHARED_SONAME
3741255852Sdteske		MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-Bshareable,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]'
3742255852Sdteske		;;
3743255852Sdteske	nto-qnx*|openbsd*|freebsd[[12]].*) #(vi
3744255852Sdteske		CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
3745255852Sdteske		MK_SHARED_LIB='${LD} -Bshareable -o $[@]'
3746255852Sdteske		test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
3747255852Sdteske		;;
3748255852Sdteske	dragonfly*|freebsd*) #(vi
3749255852Sdteske		CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
3750255852Sdteske		if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then
3751255852Sdteske			LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)"
3752255852Sdteske			LOCAL_LDFLAGS2="${cf_ld_rpath_opt}\${RPATH_LIST} $LOCAL_LDFLAGS"
3753255852Sdteske			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
3754255852Sdteske		fi
3755255852Sdteske		CF_SHARED_SONAME
3756255852Sdteske		MK_SHARED_LIB='${LD} -shared -Bshareable -soname=`basename $[@]` -o $[@]'
3757255852Sdteske		;;
3758255852Sdteske	netbsd*) #(vi
3759255852Sdteske		CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
3760255852Sdteske		if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then
3761255852Sdteske			LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)"
3762255852Sdteske			LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
3763255852Sdteske			EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
3764255852Sdteske			if test "$cf_cv_shlib_version" = auto; then
3765255852Sdteske			if test -f /usr/libexec/ld.elf_so; then
3766255852Sdteske				cf_cv_shlib_version=abi
3767255852Sdteske			else
3768255852Sdteske				cf_cv_shlib_version=rel
3769255852Sdteske			fi
3770255852Sdteske			fi
3771255852Sdteske			CF_SHARED_SONAME
3772255852Sdteske			MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname' -o $[@]'
3773255852Sdteske		else
3774255852Sdteske			MK_SHARED_LIB='${CC} -Wl,-shared -Wl,-Bshareable -o $[@]'
3775255852Sdteske		fi
3776255852Sdteske		;;
3777255852Sdteske	osf*|mls+*) #(vi
3778255852Sdteske		# tested with OSF/1 V3.2 and 'cc'
3779255852Sdteske		# tested with OSF/1 V3.2 and gcc 2.6.3 (but the c++ demo didn't
3780255852Sdteske		# link with shared libs).
3781255852Sdteske		MK_SHARED_LIB='${LD} -set_version ${REL_VERSION}:${ABI_VERSION} -expect_unresolved "*" -shared -soname `basename $[@]`'
3782255852Sdteske		case $host_os in #(vi
3783255852Sdteske		osf4*)
3784255852Sdteske			MK_SHARED_LIB="${MK_SHARED_LIB} -msym"
3785255852Sdteske			;;
3786255852Sdteske		esac
3787255852Sdteske		MK_SHARED_LIB="${MK_SHARED_LIB}"' -o $[@]'
3788255852Sdteske		if test "$DFT_LWR_MODEL" = "shared" ; then
3789255852Sdteske			LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)"
3790255852Sdteske			LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
3791255852Sdteske		fi
3792255852Sdteske		cf_cv_rm_so_locs=yes
3793255852Sdteske		;;
3794255852Sdteske	sco3.2v5*)  # (also uw2* and UW7: hops 13-Apr-98
3795255852Sdteske		# tested with osr5.0.5
3796255852Sdteske		if test "$GCC" != yes; then
3797255852Sdteske			CC_SHARED_OPTS='-belf -KPIC'
3798255852Sdteske		fi
3799255852Sdteske		MK_SHARED_LIB='${LD} -dy -G -h `basename $[@] .${REL_VERSION}`.${ABI_VERSION} -o [$]@'
3800255852Sdteske		if test "$cf_cv_enable_rpath" = yes ; then
3801255852Sdteske			# only way is to set LD_RUN_PATH but no switch for it
3802255852Sdteske			RUN_PATH=$libdir
3803255852Sdteske		fi
3804255852Sdteske		test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
3805255852Sdteske		LINK_PROGS='LD_RUN_PATH=${libdir}'
3806255852Sdteske		LINK_TESTS='Pwd=`pwd`;LD_RUN_PATH=`dirname $${Pwd}`/lib'
3807255852Sdteske		;;
3808255852Sdteske	sunos4*) #(vi
3809255852Sdteske		# tested with SunOS 4.1.1 and gcc 2.7.0
3810255852Sdteske		if test "$GCC" != yes; then
3811255852Sdteske			CC_SHARED_OPTS='-KPIC'
3812255852Sdteske		fi
3813255852Sdteske		MK_SHARED_LIB='${LD} -assert pure-text -o $[@]'
3814255852Sdteske		test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
3815255852Sdteske		;;
3816255852Sdteske	solaris2*) #(vi
3817255852Sdteske		# tested with SunOS 5.5.1 (solaris 2.5.1) and gcc 2.7.2
3818255852Sdteske		# tested with SunOS 5.10 (solaris 10) and gcc 3.4.3
3819255852Sdteske		if test "$DFT_LWR_MODEL" = "shared" ; then
3820255852Sdteske			LOCAL_LDFLAGS="-R \$(LOCAL_LIBDIR):\${libdir}"
3821255852Sdteske			LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
3822255852Sdteske		fi
3823255852Sdteske		if test "$cf_cv_enable_rpath" = yes ; then
3824255852Sdteske			EXTRA_LDFLAGS="-R \${libdir} $EXTRA_LDFLAGS"
3825255852Sdteske		fi
3826255852Sdteske		CF_SHARED_SONAME
3827255852Sdteske		if test "$GCC" != yes; then
3828255852Sdteske			cf_save_CFLAGS="$CFLAGS"
3829255852Sdteske			for cf_shared_opts in -xcode=pic32 -xcode=pic13 -KPIC -Kpic -O
3830255852Sdteske			do
3831255852Sdteske				CFLAGS="$cf_shared_opts $cf_save_CFLAGS"
3832255852Sdteske				AC_TRY_COMPILE([#include <stdio.h>],[printf("Hello\n");],[break])
3833255852Sdteske			done
3834255852Sdteske			CFLAGS="$cf_save_CFLAGS"
3835255852Sdteske			CC_SHARED_OPTS=$cf_shared_opts
3836255852Sdteske			MK_SHARED_LIB='${CC} -dy -G -h '$cf_cv_shared_soname' -o $[@]'
3837255852Sdteske		else
3838255852Sdteske			MK_SHARED_LIB='${CC} -shared -dy -G -h '$cf_cv_shared_soname' -o $[@]'
3839255852Sdteske		fi
3840255852Sdteske		;;
3841255852Sdteske	sysv5uw7*|unix_sv*) #(vi
3842255852Sdteske		# tested with UnixWare 7.1.0 (gcc 2.95.2 and cc)
3843255852Sdteske		if test "$GCC" != yes; then
3844255852Sdteske			CC_SHARED_OPTS='-KPIC'
3845255852Sdteske		fi
3846255852Sdteske		MK_SHARED_LIB='${LD} -d y -G -o [$]@'
3847255852Sdteske		;;
3848255852Sdteske	*)
3849255852Sdteske		CC_SHARED_OPTS='unknown'
3850255852Sdteske		MK_SHARED_LIB='echo unknown'
3851255852Sdteske		;;
3852255852Sdteske	esac
3853255852Sdteske
3854255852Sdteske	# This works if the last tokens in $MK_SHARED_LIB are the -o target.
3855255852Sdteske	case "$cf_cv_shlib_version" in #(vi
3856255852Sdteske	rel|abi)
3857255852Sdteske		case "$MK_SHARED_LIB" in #(vi
3858255852Sdteske		*'-o $[@]') #(vi
3859255852Sdteske			test "$cf_cv_do_symlinks" = no && cf_cv_do_symlinks=yes
3860255852Sdteske			;;
3861255852Sdteske		*)
3862255852Sdteske			AC_MSG_WARN(ignored --with-shlib-version)
3863255852Sdteske			;;
3864255852Sdteske		esac
3865255852Sdteske		;;
3866255852Sdteske	esac
3867255852Sdteske
3868255852Sdteske	if test -n "$cf_try_cflags"
3869255852Sdteske	then
3870255852Sdteskecat > conftest.$ac_ext <<EOF
3871255852Sdteske#line __oline__ "${as_me:-configure}"
3872255852Sdteske#include <stdio.h>
3873255852Sdteskeint main(int argc, char *argv[[]])
3874255852Sdteske{
3875255852Sdteske	printf("hello\n");
3876255852Sdteske	return (argv[[argc-1]] == 0) ;
3877255852Sdteske}
3878255852SdteskeEOF
3879255852Sdteske		cf_save_CFLAGS="$CFLAGS"
3880255852Sdteske		for cf_opt in $cf_try_cflags
3881255852Sdteske		do
3882255852Sdteske			CFLAGS="$cf_save_CFLAGS -$cf_opt"
3883255852Sdteske			AC_MSG_CHECKING(if CFLAGS option -$cf_opt works)
3884255852Sdteske			if AC_TRY_EVAL(ac_compile); then
3885255852Sdteske				AC_MSG_RESULT(yes)
3886255852Sdteske				cf_save_CFLAGS="$CFLAGS"
3887255852Sdteske			else
3888255852Sdteske				AC_MSG_RESULT(no)
3889255852Sdteske			fi
3890255852Sdteske		done
3891255852Sdteske		CFLAGS="$cf_save_CFLAGS"
3892255852Sdteske	fi
3893255852Sdteske
3894255852Sdteske
3895255852Sdteske	# RPATH_LIST is a colon-separated list of directories
3896255852Sdteske	test -n "$cf_ld_rpath_opt" && MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\${RPATH_LIST}"
3897255852Sdteske	test -z "$RPATH_LIST" && RPATH_LIST="\${libdir}"
3898255852Sdteske
3899255852Sdteske	test $cf_cv_rm_so_locs = yes && RM_SHARED_OPTS="$RM_SHARED_OPTS so_locations"
3900255852Sdteske
3901255852Sdteske	CF_VERBOSE(CC_SHARED_OPTS: $CC_SHARED_OPTS)
3902255852Sdteske	CF_VERBOSE(MK_SHARED_LIB:  $MK_SHARED_LIB)
3903255852Sdteske
3904255852Sdteske	AC_SUBST(CC_SHARED_OPTS)
3905255852Sdteske	AC_SUBST(LD_RPATH_OPT)
3906255852Sdteske	AC_SUBST(LD_SHARED_OPTS)
3907255852Sdteske	AC_SUBST(MK_SHARED_LIB)
3908255852Sdteske	AC_SUBST(RM_SHARED_OPTS)
3909255852Sdteske
3910255852Sdteske	AC_SUBST(LINK_PROGS)
3911255852Sdteske	AC_SUBST(LINK_TESTS)
3912255852Sdteske
3913255852Sdteske	AC_SUBST(EXTRA_LDFLAGS)
3914255852Sdteske	AC_SUBST(LOCAL_LDFLAGS)
3915255852Sdteske	AC_SUBST(LOCAL_LDFLAGS2)
3916255852Sdteske
3917255852Sdteske	AC_SUBST(INSTALL_LIB)
3918255852Sdteske	AC_SUBST(RPATH_LIST)
3919255852Sdteske])dnl
3920255852Sdteskednl ---------------------------------------------------------------------------
3921255852Sdteskednl CF_SHARED_SONAME version: 3 updated: 2008/09/08 18:34:43
3922255852Sdteskednl ----------------
3923255852Sdteskednl utility macro for CF_SHARED_OPTS, constructs "$cf_cv_shared_soname" for
3924255852Sdteskednl substitution into MK_SHARED_LIB string for the "-soname" (or similar)
3925255852Sdteskednl option.
3926255852Sdteskednl
3927255852Sdteskednl $1 is the default that should be used for "$cf_cv_shlib_version".
3928255852Sdteskednl If missing, use "rel".
3929255852Sdteskedefine([CF_SHARED_SONAME],
3930255852Sdteske[
3931255852Sdteske	test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=ifelse($1,,rel,$1)
3932255852Sdteske	if test "$cf_cv_shlib_version" = rel; then
3933255852Sdteske		cf_cv_shared_soname='`basename $[@] .${REL_VERSION}`.${ABI_VERSION}'
3934255852Sdteske	else
3935255852Sdteske		cf_cv_shared_soname='`basename $[@]`'
3936255852Sdteske	fi
3937255852Sdteske])
3938255852Sdteskednl ---------------------------------------------------------------------------
3939217309Snwhitehorndnl CF_SUBDIR_PATH version: 6 updated: 2010/04/21 06:20:50
3940217309Snwhitehorndnl --------------
3941217309Snwhitehorndnl Construct a search-list for a nonstandard header/lib-file
3942217309Snwhitehorndnl	$1 = the variable to return as result
3943217309Snwhitehorndnl	$2 = the package name
3944217309Snwhitehorndnl	$3 = the subdirectory, e.g., bin, include or lib
3945217309SnwhitehornAC_DEFUN([CF_SUBDIR_PATH],
3946217309Snwhitehorn[
3947217309Snwhitehorn$1=
3948217309Snwhitehorn
3949217309SnwhitehornCF_ADD_SUBDIR_PATH($1,$2,$3,/usr,$prefix)
3950217309SnwhitehornCF_ADD_SUBDIR_PATH($1,$2,$3,$prefix,NONE)
3951217309SnwhitehornCF_ADD_SUBDIR_PATH($1,$2,$3,/usr/local,$prefix)
3952217309SnwhitehornCF_ADD_SUBDIR_PATH($1,$2,$3,/opt,$prefix)
3953217309SnwhitehornCF_ADD_SUBDIR_PATH($1,$2,$3,[$]HOME,$prefix)
3954217309Snwhitehorn])dnl
3955217309Snwhitehorndnl ---------------------------------------------------------------------------
3956251843Sbaptdnl CF_TERM_HEADER version: 3 updated: 2012/10/06 08:57:51
3957217309Snwhitehorndnl --------------
3958217309Snwhitehorndnl Look for term.h, which is part of X/Open curses.  It defines the interface
3959217309Snwhitehorndnl to terminfo database.  Usually it is in the same include-path as curses.h,
3960217309Snwhitehorndnl but some packagers change this, breaking various applications.
3961217309SnwhitehornAC_DEFUN([CF_TERM_HEADER],[
3962217309SnwhitehornAC_CACHE_CHECK(for terminfo header, cf_cv_term_header,[
3963217309Snwhitehorncase ${cf_cv_ncurses_header} in #(vi
3964217309Snwhitehorn*/ncurses.h|*/ncursesw.h) #(vi
3965217309Snwhitehorn	cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[[^.]]*\.h$%term.h%'`
3966217309Snwhitehorn	;;
3967217309Snwhitehorn*)
3968217309Snwhitehorn	cf_term_header=term.h
3969217309Snwhitehorn	;;
3970217309Snwhitehornesac
3971217309Snwhitehorn
3972217309Snwhitehornfor cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h"
3973217309Snwhitehorndo
3974217309SnwhitehornAC_TRY_COMPILE([#include <stdio.h>
3975220749Snwhitehorn#include <${cf_cv_ncurses_header:-curses.h}>
3976217309Snwhitehorn#include <$cf_test>
3977217309Snwhitehorn],[int x = auto_left_margin],[
3978217309Snwhitehorn	cf_cv_term_header="$cf_test"],[
3979217309Snwhitehorn	cf_cv_term_header=unknown
3980217309Snwhitehorn	])
3981217309Snwhitehorn	test "$cf_cv_term_header" != unknown && break
3982217309Snwhitehorndone
3983217309Snwhitehorn])
3984217309Snwhitehorn
3985217309Snwhitehorn# Set definitions to allow ifdef'ing to accommodate subdirectories
3986217309Snwhitehorn
3987217309Snwhitehorncase $cf_cv_term_header in # (vi
3988217309Snwhitehorn*term.h)
3989251843Sbapt	AC_DEFINE(HAVE_TERM_H,1,[Define to 1 if we have term.h])
3990217309Snwhitehorn	;;
3991217309Snwhitehornesac
3992217309Snwhitehorn
3993217309Snwhitehorncase $cf_cv_term_header in # (vi
3994217309Snwhitehornncurses/term.h) #(vi
3995251843Sbapt	AC_DEFINE(HAVE_NCURSES_TERM_H,1,[Define to 1 if we have ncurses/term.h])
3996217309Snwhitehorn	;;
3997217309Snwhitehornncursesw/term.h)
3998251843Sbapt	AC_DEFINE(HAVE_NCURSESW_TERM_H,1,[Define to 1 if we have ncursesw/term.h])
3999217309Snwhitehorn	;;
4000217309Snwhitehornesac
4001217309Snwhitehorn])dnl
4002217309Snwhitehorndnl ---------------------------------------------------------------------------
4003251843Sbaptdnl CF_TRY_XOPEN_SOURCE version: 1 updated: 2011/10/30 17:09:50
4004251843Sbaptdnl -------------------
4005251843Sbaptdnl If _XOPEN_SOURCE is not defined in the compile environment, check if we
4006251843Sbaptdnl can define it successfully.
4007251843SbaptAC_DEFUN([CF_TRY_XOPEN_SOURCE],[
4008251843SbaptAC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
4009251843Sbapt	AC_TRY_COMPILE([
4010251843Sbapt#include <stdlib.h>
4011251843Sbapt#include <string.h>
4012251843Sbapt#include <sys/types.h>
4013251843Sbapt],[
4014251843Sbapt#ifndef _XOPEN_SOURCE
4015251843Sbaptmake an error
4016251843Sbapt#endif],
4017251843Sbapt	[cf_cv_xopen_source=no],
4018251843Sbapt	[cf_save="$CPPFLAGS"
4019251843Sbapt	 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
4020251843Sbapt	 AC_TRY_COMPILE([
4021251843Sbapt#include <stdlib.h>
4022251843Sbapt#include <string.h>
4023251843Sbapt#include <sys/types.h>
4024251843Sbapt],[
4025251843Sbapt#ifdef _XOPEN_SOURCE
4026251843Sbaptmake an error
4027251843Sbapt#endif],
4028251843Sbapt	[cf_cv_xopen_source=no],
4029251843Sbapt	[cf_cv_xopen_source=$cf_XOPEN_SOURCE])
4030251843Sbapt	CPPFLAGS="$cf_save"
4031251843Sbapt	])
4032251843Sbapt])
4033251843Sbapt
4034251843Sbaptif test "$cf_cv_xopen_source" != no ; then
4035251843Sbapt	CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE)
4036251843Sbapt	CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE)
4037251843Sbapt	cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
4038251843Sbapt	CF_ADD_CFLAGS($cf_temp_xopen_source)
4039251843Sbaptfi
4040251843Sbapt])
4041251843Sbaptdnl ---------------------------------------------------------------------------
4042251843Sbaptdnl CF_UNION_WAIT version: 6 updated: 2012/10/06 08:57:51
4043217309Snwhitehorndnl -------------
4044217309Snwhitehorndnl Check to see if the BSD-style union wait is declared.  Some platforms may
4045217309Snwhitehorndnl use this, though it is deprecated in favor of the 'int' type in Posix.
4046217309Snwhitehorndnl Some vendors provide a bogus implementation that declares union wait, but
4047217309Snwhitehorndnl uses the 'int' type instead; we try to spot these by checking for the
4048217309Snwhitehorndnl associated macros.
4049217309Snwhitehorndnl
4050217309Snwhitehorndnl Ahem.  Some implementers cast the status value to an int*, as an attempt to
4051217309Snwhitehorndnl use the macros for either union wait or int.  So we do a check compile to
4052217309Snwhitehorndnl see if the macros are defined and apply to an int.
4053217309Snwhitehorndnl
4054217309Snwhitehorndnl Sets: $cf_cv_type_unionwait
4055217309Snwhitehorndnl Defines: HAVE_TYPE_UNIONWAIT
4056217309SnwhitehornAC_DEFUN([CF_UNION_WAIT],
4057217309Snwhitehorn[
4058217309SnwhitehornAC_REQUIRE([CF_WAIT_HEADERS])
4059217309SnwhitehornAC_MSG_CHECKING([for union wait])
4060217309SnwhitehornAC_CACHE_VAL(cf_cv_type_unionwait,[
4061217309Snwhitehorn	AC_TRY_LINK($cf_wait_headers,
4062217309Snwhitehorn	[int x;
4063217309Snwhitehorn	 int y = WEXITSTATUS(x);
4064217309Snwhitehorn	 int z = WTERMSIG(x);
4065217309Snwhitehorn	 wait(&x);
4066217309Snwhitehorn	],
4067217309Snwhitehorn	[cf_cv_type_unionwait=no
4068217309Snwhitehorn	 echo compiles ok w/o union wait 1>&AC_FD_CC
4069217309Snwhitehorn	],[
4070217309Snwhitehorn	AC_TRY_LINK($cf_wait_headers,
4071217309Snwhitehorn	[union wait x;
4072217309Snwhitehorn#ifdef WEXITSTATUS
4073217309Snwhitehorn	 int y = WEXITSTATUS(x);
4074217309Snwhitehorn#endif
4075217309Snwhitehorn#ifdef WTERMSIG
4076217309Snwhitehorn	 int z = WTERMSIG(x);
4077217309Snwhitehorn#endif
4078217309Snwhitehorn	 wait(&x);
4079217309Snwhitehorn	],
4080217309Snwhitehorn	[cf_cv_type_unionwait=yes
4081217309Snwhitehorn	 echo compiles ok with union wait and possibly macros too 1>&AC_FD_CC
4082217309Snwhitehorn	],
4083217309Snwhitehorn	[cf_cv_type_unionwait=no])])])
4084217309SnwhitehornAC_MSG_RESULT($cf_cv_type_unionwait)
4085251843Sbapttest $cf_cv_type_unionwait = yes && AC_DEFINE(HAVE_TYPE_UNIONWAIT,1,[Define to 1 if type unionwait is declared])
4086217309Snwhitehorn])dnl
4087217309Snwhitehorndnl ---------------------------------------------------------------------------
4088217309Snwhitehorndnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59
4089217309Snwhitehorndnl --------
4090217309Snwhitehorndnl Make an uppercase version of a variable
4091217309Snwhitehorndnl $1=uppercase($2)
4092217309SnwhitehornAC_DEFUN([CF_UPPER],
4093217309Snwhitehorn[
4094217309Snwhitehorn$1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
4095217309Snwhitehorn])dnl
4096217309Snwhitehorndnl ---------------------------------------------------------------------------
4097251843Sbaptdnl CF_UTF8_LIB version: 8 updated: 2012/10/06 08:57:51
4098217309Snwhitehorndnl -----------
4099217309Snwhitehorndnl Check for multibyte support, and if not found, utf8 compatibility library
4100217309SnwhitehornAC_DEFUN([CF_UTF8_LIB],
4101217309Snwhitehorn[
4102217309SnwhitehornAC_CACHE_CHECK(for multibyte character support,cf_cv_utf8_lib,[
4103217309Snwhitehorn	cf_save_LIBS="$LIBS"
4104217309Snwhitehorn	AC_TRY_LINK([
4105217309Snwhitehorn#include <stdlib.h>],[putwc(0,0);],
4106217309Snwhitehorn	[cf_cv_utf8_lib=yes],
4107217309Snwhitehorn	[CF_FIND_LINKAGE([
4108217309Snwhitehorn#include <libutf8.h>],[putwc(0,0);],utf8,
4109217309Snwhitehorn		[cf_cv_utf8_lib=add-on],
4110217309Snwhitehorn		[cf_cv_utf8_lib=no])
4111217309Snwhitehorn])])
4112217309Snwhitehorn
4113217309Snwhitehorn# HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between
4114217309Snwhitehorn# ncurses/ncursesw:
4115217309Snwhitehornif test "$cf_cv_utf8_lib" = "add-on" ; then
4116251843Sbapt	AC_DEFINE(HAVE_LIBUTF8_H,1,[Define to 1 if we should include libutf8.h])
4117217309Snwhitehorn	CF_ADD_INCDIR($cf_cv_header_path_utf8)
4118217309Snwhitehorn	CF_ADD_LIBDIR($cf_cv_library_path_utf8)
4119220749Snwhitehorn	CF_ADD_LIBS($cf_cv_library_file_utf8)
4120217309Snwhitehornfi
4121217309Snwhitehorn])dnl
4122217309Snwhitehorndnl ---------------------------------------------------------------------------
4123217309Snwhitehorndnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12
4124217309Snwhitehorndnl ----------
4125217309Snwhitehorndnl Use AC_VERBOSE w/o the warnings
4126217309SnwhitehornAC_DEFUN([CF_VERBOSE],
4127217309Snwhitehorn[test -n "$verbose" && echo "	$1" 1>&AC_FD_MSG
4128217309SnwhitehornCF_MSG_LOG([$1])
4129217309Snwhitehorn])dnl
4130217309Snwhitehorndnl ---------------------------------------------------------------------------
4131255852Sdteskednl CF_VERSION_INFO version: 6 updated: 2013/06/16 10:25:53
4132217309Snwhitehorndnl ---------------
4133217309Snwhitehorndnl Define several useful symbols derived from the VERSION file.  A separate
4134217309Snwhitehorndnl file is preferred to embedding the version numbers in various scripts.
4135217309Snwhitehorndnl (automake is a textbook-example of why the latter is a bad idea, but there
4136217309Snwhitehorndnl are others).
4137217309Snwhitehorndnl
4138217309Snwhitehorndnl The file contents are:
4139217309Snwhitehorndnl	libtool-version	release-version	patch-version
4140217309Snwhitehorndnl or
4141217309Snwhitehorndnl	release-version
4142217309Snwhitehorndnl where
4143217309Snwhitehorndnl	libtool-version (see ?) consists of 3 integers separated by '.'
4144217309Snwhitehorndnl	release-version consists of a major version and minor version
4145217309Snwhitehorndnl		separated by '.', optionally followed by a patch-version
4146217309Snwhitehorndnl		separated by '-'.  The minor version need not be an
4147217309Snwhitehorndnl		integer (but it is preferred).
4148217309Snwhitehorndnl	patch-version is an integer in the form yyyymmdd, so ifdef's and
4149217309Snwhitehorndnl		scripts can easily compare versions.
4150217309Snwhitehorndnl
4151217309Snwhitehorndnl If libtool is used, the first form is required, since CF_WITH_LIBTOOL
4152217309Snwhitehorndnl simply extracts the first field using 'cut -f1'.
4153220749Snwhitehorndnl
4154220749Snwhitehorndnl Optional parameters:
4155220749Snwhitehorndnl $1 = internal name for package
4156220749Snwhitehorndnl $2 = external name for package
4157217309SnwhitehornAC_DEFUN([CF_VERSION_INFO],
4158217309Snwhitehorn[
4159217309Snwhitehornif test -f $srcdir/VERSION ; then
4160217309Snwhitehorn	AC_MSG_CHECKING(for package version)
4161217309Snwhitehorn
4162217309Snwhitehorn	# if there are not enough fields, cut returns the last one...
4163217309Snwhitehorn	cf_field1=`sed -e '2,$d' $srcdir/VERSION|cut -f1`
4164217309Snwhitehorn	cf_field2=`sed -e '2,$d' $srcdir/VERSION|cut -f2`
4165217309Snwhitehorn	cf_field3=`sed -e '2,$d' $srcdir/VERSION|cut -f3`
4166217309Snwhitehorn
4167217309Snwhitehorn	# this is how CF_BUNDLED_INTL uses $VERSION:
4168217309Snwhitehorn	VERSION="$cf_field1"
4169217309Snwhitehorn
4170217309Snwhitehorn	VERSION_MAJOR=`echo "$cf_field2" | sed -e 's/\..*//'`
4171217309Snwhitehorn	test -z "$VERSION_MAJOR" && AC_MSG_ERROR(missing major-version)
4172217309Snwhitehorn
4173217309Snwhitehorn	VERSION_MINOR=`echo "$cf_field2" | sed -e 's/^[[^.]]*\.//' -e 's/-.*//'`
4174217309Snwhitehorn	test -z "$VERSION_MINOR" && AC_MSG_ERROR(missing minor-version)
4175217309Snwhitehorn
4176217309Snwhitehorn	AC_MSG_RESULT(${VERSION_MAJOR}.${VERSION_MINOR})
4177217309Snwhitehorn
4178217309Snwhitehorn	AC_MSG_CHECKING(for package patch date)
4179217309Snwhitehorn	VERSION_PATCH=`echo "$cf_field3" | sed -e 's/^[[^-]]*-//'`
4180217309Snwhitehorn	case .$VERSION_PATCH in
4181217309Snwhitehorn	.)
4182217309Snwhitehorn		AC_MSG_ERROR(missing patch-date $VERSION_PATCH)
4183217309Snwhitehorn		;;
4184217309Snwhitehorn	.[[0-9]][[0-9]][[0-9]][[0-9]][[0-9]][[0-9]][[0-9]][[0-9]])
4185217309Snwhitehorn		;;
4186217309Snwhitehorn	*)
4187217309Snwhitehorn		AC_MSG_ERROR(illegal patch-date $VERSION_PATCH)
4188217309Snwhitehorn		;;
4189217309Snwhitehorn	esac
4190217309Snwhitehorn	AC_MSG_RESULT($VERSION_PATCH)
4191217309Snwhitehornelse
4192217309Snwhitehorn	AC_MSG_ERROR(did not find $srcdir/VERSION)
4193217309Snwhitehornfi
4194217309Snwhitehorn
4195217309Snwhitehorn# show the actual data that we have for versions:
4196255852SdteskeCF_VERBOSE(ABI VERSION $VERSION)
4197217309SnwhitehornCF_VERBOSE(VERSION_MAJOR $VERSION_MAJOR)
4198217309SnwhitehornCF_VERBOSE(VERSION_MINOR $VERSION_MINOR)
4199217309SnwhitehornCF_VERBOSE(VERSION_PATCH $VERSION_PATCH)
4200217309Snwhitehorn
4201217309SnwhitehornAC_SUBST(VERSION)
4202217309SnwhitehornAC_SUBST(VERSION_MAJOR)
4203217309SnwhitehornAC_SUBST(VERSION_MINOR)
4204217309SnwhitehornAC_SUBST(VERSION_PATCH)
4205217309Snwhitehorn
4206217309Snwhitehorndnl if a package name is given, define its corresponding version info.  We
4207217309Snwhitehorndnl need the package name to ensure that the defined symbols are unique.
4208217309Snwhitehornifelse($1,,,[
4209220749Snwhitehorn	cf_PACKAGE=$1
4210220749Snwhitehorn	PACKAGE=ifelse($2,,$1,$2)
4211251843Sbapt	AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE",[Define to the package-name])
4212217309Snwhitehorn	AC_SUBST(PACKAGE)
4213220749Snwhitehorn	CF_UPPER(cf_PACKAGE,$cf_PACKAGE)
4214217309Snwhitehorn	AC_DEFINE_UNQUOTED(${cf_PACKAGE}_VERSION,"${VERSION_MAJOR}.${VERSION_MINOR}")
4215217309Snwhitehorn	AC_DEFINE_UNQUOTED(${cf_PACKAGE}_PATCHDATE,${VERSION_PATCH})
4216217309Snwhitehorn])
4217217309Snwhitehorn])dnl
4218217309Snwhitehorndnl ---------------------------------------------------------------------------
4219217309Snwhitehorndnl CF_WAIT_HEADERS version: 2 updated: 1997/10/21 19:45:33
4220217309Snwhitehorndnl ---------------
4221217309Snwhitehorndnl Build up an expression $cf_wait_headers with the header files needed to
4222217309Snwhitehorndnl compile against the prototypes for 'wait()', 'waitpid()', etc.  Assume it's
4223217309Snwhitehorndnl Posix, which uses <sys/types.h> and <sys/wait.h>, but allow SVr4 variation
4224217309Snwhitehorndnl with <wait.h>.
4225217309SnwhitehornAC_DEFUN([CF_WAIT_HEADERS],
4226217309Snwhitehorn[
4227217309SnwhitehornAC_HAVE_HEADERS(sys/wait.h)
4228217309Snwhitehorncf_wait_headers="#include <sys/types.h>
4229217309Snwhitehorn"
4230217309Snwhitehornif test $ac_cv_header_sys_wait_h = yes; then
4231217309Snwhitehorncf_wait_headers="$cf_wait_headers
4232217309Snwhitehorn#include <sys/wait.h>
4233217309Snwhitehorn"
4234217309Snwhitehornelse
4235217309SnwhitehornAC_HAVE_HEADERS(wait.h)
4236217309SnwhitehornAC_HAVE_HEADERS(waitstatus.h)
4237217309Snwhitehornif test $ac_cv_header_wait_h = yes; then
4238217309Snwhitehorncf_wait_headers="$cf_wait_headers
4239217309Snwhitehorn#include <wait.h>
4240217309Snwhitehorn"
4241217309Snwhitehornfi
4242217309Snwhitehornif test $ac_cv_header_waitstatus_h = yes; then
4243217309Snwhitehorncf_wait_headers="$cf_wait_headers
4244217309Snwhitehorn#include <waitstatus.h>
4245217309Snwhitehorn"
4246217309Snwhitehornfi
4247217309Snwhitehornfi
4248217309Snwhitehorn])dnl
4249217309Snwhitehorndnl ---------------------------------------------------------------------------
4250255852Sdteskednl CF_WITH_ABI_VERSION version: 1 updated: 2003/09/20 18:12:49
4251255852Sdteskednl -------------------
4252255852Sdteskednl Allow library's ABI to be overridden.  Generally this happens when a
4253255852Sdteskednl packager has incremented the ABI past that used in the original package,
4254255852Sdteskednl and wishes to keep doing this.
4255255852Sdteskednl
4256255852Sdteskednl $1 is the package name, if any, to derive a corresponding {package}_ABI
4257255852Sdteskednl symbol.
4258255852SdteskeAC_DEFUN([CF_WITH_ABI_VERSION],[
4259255852Sdtesketest -z "$cf_cv_abi_version" && cf_cv_abi_version=0
4260255852SdteskeAC_ARG_WITH(abi-version,
4261255852Sdteske[  --with-abi-version=XXX  override derived ABI version],
4262255852Sdteske[AC_MSG_WARN(overriding ABI version $cf_cv_abi_version to $withval)
4263255852Sdteske cf_cv_abi_version=$withval])
4264255852Sdteske CF_NUMBER_SYNTAX($cf_cv_abi_version,ABI version)
4265255852Sdteskeifelse($1,,,[
4266255852Sdteske$1_ABI=$cf_cv_abi_version
4267255852Sdteske])
4268255852Sdteske])dnl
4269255852Sdteskednl ---------------------------------------------------------------------------
4270220749Snwhitehorndnl CF_WITH_CURSES_DIR version: 3 updated: 2010/11/20 17:02:38
4271217309Snwhitehorndnl ------------------
4272217309Snwhitehorndnl Wrapper for AC_ARG_WITH to specify directory under which to look for curses
4273217309Snwhitehorndnl libraries.
4274217309SnwhitehornAC_DEFUN([CF_WITH_CURSES_DIR],[
4275220749Snwhitehorn
4276220749SnwhitehornAC_MSG_CHECKING(for specific curses-directory)
4277217309SnwhitehornAC_ARG_WITH(curses-dir,
4278217309Snwhitehorn	[  --with-curses-dir=DIR   directory in which (n)curses is installed],
4279220749Snwhitehorn	[cf_cv_curses_dir=$withval],
4280217309Snwhitehorn	[cf_cv_curses_dir=no])
4281220749SnwhitehornAC_MSG_RESULT($cf_cv_curses_dir)
4282220749Snwhitehorn
4283220749Snwhitehornif ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
4284220749Snwhitehornthen
4285220749Snwhitehorn	CF_PATH_SYNTAX(withval)
4286220749Snwhitehorn	if test -d "$cf_cv_curses_dir"
4287220749Snwhitehorn	then
4288220749Snwhitehorn		CF_ADD_INCDIR($cf_cv_curses_dir/include)
4289220749Snwhitehorn		CF_ADD_LIBDIR($cf_cv_curses_dir/lib)
4290220749Snwhitehorn	fi
4291220749Snwhitehornfi
4292217309Snwhitehorn])dnl
4293217309Snwhitehorndnl ---------------------------------------------------------------------------
4294220749Snwhitehorndnl CF_WITH_DBMALLOC version: 7 updated: 2010/06/21 17:26:47
4295217309Snwhitehorndnl ----------------
4296217309Snwhitehorndnl Configure-option for dbmalloc.  The optional parameter is used to override
4297217309Snwhitehorndnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests.
4298217309SnwhitehornAC_DEFUN([CF_WITH_DBMALLOC],[
4299217309SnwhitehornCF_NO_LEAKS_OPTION(dbmalloc,
4300217309Snwhitehorn	[  --with-dbmalloc         test: use Conor Cahill's dbmalloc library],
4301217309Snwhitehorn	[USE_DBMALLOC])
4302217309Snwhitehorn
4303217309Snwhitehornif test "$with_dbmalloc" = yes ; then
4304217309Snwhitehorn	AC_CHECK_HEADER(dbmalloc.h,
4305220749Snwhitehorn		[AC_CHECK_LIB(dbmalloc,[debug_malloc]ifelse([$1],,[],[,$1]))])
4306217309Snwhitehornfi
4307217309Snwhitehorn])dnl
4308217309Snwhitehorndnl ---------------------------------------------------------------------------
4309220749Snwhitehorndnl CF_WITH_DMALLOC version: 7 updated: 2010/06/21 17:26:47
4310217309Snwhitehorndnl ---------------
4311217309Snwhitehorndnl Configure-option for dmalloc.  The optional parameter is used to override
4312217309Snwhitehorndnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests.
4313217309SnwhitehornAC_DEFUN([CF_WITH_DMALLOC],[
4314217309SnwhitehornCF_NO_LEAKS_OPTION(dmalloc,
4315217309Snwhitehorn	[  --with-dmalloc          test: use Gray Watson's dmalloc library],
4316217309Snwhitehorn	[USE_DMALLOC])
4317217309Snwhitehorn
4318217309Snwhitehornif test "$with_dmalloc" = yes ; then
4319217309Snwhitehorn	AC_CHECK_HEADER(dmalloc.h,
4320220749Snwhitehorn		[AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse([$1],,[],[,$1]))])
4321217309Snwhitehornfi
4322217309Snwhitehorn])dnl
4323217309Snwhitehorndnl ---------------------------------------------------------------------------
4324255852Sdteskednl CF_WITH_LIBTOOL version: 30 updated: 2013/09/07 13:54:05
4325217309Snwhitehorndnl ---------------
4326217309Snwhitehorndnl Provide a configure option to incorporate libtool.  Define several useful
4327217309Snwhitehorndnl symbols for the makefile rules.
4328217309Snwhitehorndnl
4329217309Snwhitehorndnl The reference to AC_PROG_LIBTOOL does not normally work, since it uses
4330217309Snwhitehorndnl macros from libtool.m4 which is in the aclocal directory of automake.
4331217309Snwhitehorndnl Following is a simple script which turns on the AC_PROG_LIBTOOL macro.
4332217309Snwhitehorndnl But that still does not work properly since the macro is expanded outside
4333217309Snwhitehorndnl the CF_WITH_LIBTOOL macro:
4334217309Snwhitehorndnl
4335217309Snwhitehorndnl	#!/bin/sh
4336217309Snwhitehorndnl	ACLOCAL=`aclocal --print-ac-dir`
4337217309Snwhitehorndnl	if test -z "$ACLOCAL" ; then
4338217309Snwhitehorndnl		echo cannot find aclocal directory
4339217309Snwhitehorndnl		exit 1
4340217309Snwhitehorndnl	elif test ! -f $ACLOCAL/libtool.m4 ; then
4341217309Snwhitehorndnl		echo cannot find libtool.m4 file
4342217309Snwhitehorndnl		exit 1
4343217309Snwhitehorndnl	fi
4344217309Snwhitehorndnl
4345217309Snwhitehorndnl	LOCAL=aclocal.m4
4346217309Snwhitehorndnl	ORIG=aclocal.m4.orig
4347217309Snwhitehorndnl
4348217309Snwhitehorndnl	trap "mv $ORIG $LOCAL" 0 1 2 5 15
4349217309Snwhitehorndnl	rm -f $ORIG
4350217309Snwhitehorndnl	mv $LOCAL $ORIG
4351217309Snwhitehorndnl
4352217309Snwhitehorndnl	# sed the LIBTOOL= assignment to omit the current directory?
4353220749Snwhitehorndnl	sed -e 's/^LIBTOOL=.*/LIBTOOL=${LIBTOOL:-libtool}/' $ACLOCAL/libtool.m4 >>$LOCAL
4354217309Snwhitehorndnl	cat $ORIG >>$LOCAL
4355217309Snwhitehorndnl
4356217309Snwhitehorndnl	autoconf-257 $*
4357217309Snwhitehorndnl
4358217309SnwhitehornAC_DEFUN([CF_WITH_LIBTOOL],
4359217309Snwhitehorn[
4360220749SnwhitehornAC_REQUIRE([CF_DISABLE_LIBTOOL_VERSION])
4361217309Snwhitehornifdef([AC_PROG_LIBTOOL],,[
4362217309SnwhitehornLIBTOOL=
4363217309Snwhitehorn])
4364217309Snwhitehorn# common library maintenance symbols that are convenient for libtool scripts:
4365217309SnwhitehornLIB_CREATE='${AR} -cr'
4366217309SnwhitehornLIB_OBJECT='${OBJECTS}'
4367217309SnwhitehornLIB_SUFFIX=.a
4368217309SnwhitehornLIB_PREP="$RANLIB"
4369217309Snwhitehorn
4370217309Snwhitehorn# symbols used to prop libtool up to enable it to determine what it should be
4371217309Snwhitehorn# doing:
4372217309SnwhitehornLIB_CLEAN=
4373217309SnwhitehornLIB_COMPILE=
4374217309SnwhitehornLIB_LINK='${CC}'
4375217309SnwhitehornLIB_INSTALL=
4376217309SnwhitehornLIB_UNINSTALL=
4377217309Snwhitehorn
4378217309SnwhitehornAC_MSG_CHECKING(if you want to build libraries with libtool)
4379217309SnwhitehornAC_ARG_WITH(libtool,
4380217309Snwhitehorn	[  --with-libtool          generate libraries with libtool],
4381217309Snwhitehorn	[with_libtool=$withval],
4382217309Snwhitehorn	[with_libtool=no])
4383217309SnwhitehornAC_MSG_RESULT($with_libtool)
4384217309Snwhitehornif test "$with_libtool" != "no"; then
4385217309Snwhitehornifdef([AC_PROG_LIBTOOL],[
4386217309Snwhitehorn	# missing_content_AC_PROG_LIBTOOL{{
4387217309Snwhitehorn	AC_PROG_LIBTOOL
4388217309Snwhitehorn	# missing_content_AC_PROG_LIBTOOL}}
4389217309Snwhitehorn],[
4390217309Snwhitehorn	if test "$with_libtool" != "yes" ; then
4391217309Snwhitehorn		CF_PATH_SYNTAX(with_libtool)
4392217309Snwhitehorn		LIBTOOL=$with_libtool
4393217309Snwhitehorn	else
4394255852Sdteske		AC_CHECK_TOOLS(LIBTOOL,[libtool glibtool],none)
4395255852Sdteske		CF_LIBTOOL_VERSION
4396255852Sdteske		if test -z "$cf_cv_libtool_version" && test "$LIBTOOL" = libtool
4397255852Sdteske		then
4398255852Sdteske			CF_FORGET_TOOL(LIBTOOL)
4399255852Sdteske			AC_CHECK_TOOLS(LIBTOOL,[glibtool],none)
4400255852Sdteske			CF_LIBTOOL_VERSION
4401255852Sdteske		fi
4402217309Snwhitehorn	fi
4403217309Snwhitehorn	if test -z "$LIBTOOL" ; then
4404217309Snwhitehorn		AC_MSG_ERROR(Cannot find libtool)
4405217309Snwhitehorn	fi
4406217309Snwhitehorn])dnl
4407224014Snwhitehorn	LIB_CREATE='${LIBTOOL} --mode=link ${CC} -rpath ${DESTDIR}${libdir} ${LIBTOOL_VERSION} `cut -f1 ${srcdir}/VERSION` ${LIBTOOL_OPTS} ${LT_UNDEF} $(LIBS) -o'
4408217309Snwhitehorn	LIB_OBJECT='${OBJECTS:.o=.lo}'
4409217309Snwhitehorn	LIB_SUFFIX=.la
4410217309Snwhitehorn	LIB_CLEAN='${LIBTOOL} --mode=clean'
4411217309Snwhitehorn	LIB_COMPILE='${LIBTOOL} --mode=compile'
4412217309Snwhitehorn	LIB_LINK='${LIBTOOL} --mode=link ${CC} ${LIBTOOL_OPTS}'
4413217309Snwhitehorn	LIB_INSTALL='${LIBTOOL} --mode=install'
4414217309Snwhitehorn	LIB_UNINSTALL='${LIBTOOL} --mode=uninstall'
4415217309Snwhitehorn	LIB_PREP=:
4416217309Snwhitehorn
4417255852Sdteske	CF_CHECK_LIBTOOL_VERSION
4418217309Snwhitehorn
4419217309Snwhitehorn	# special hack to add -no-undefined (which libtool should do for itself)
4420217309Snwhitehorn	LT_UNDEF=
4421217309Snwhitehorn	case "$cf_cv_system_name" in #(vi
4422255852Sdteske	cygwin*|msys*|mingw32*|uwin*|aix[[4-7]]) #(vi
4423217309Snwhitehorn		LT_UNDEF=-no-undefined
4424217309Snwhitehorn		;;
4425217309Snwhitehorn	esac
4426217309Snwhitehorn	AC_SUBST([LT_UNDEF])
4427217309Snwhitehorn
4428217309Snwhitehorn	# special hack to add --tag option for C++ compiler
4429217309Snwhitehorn	case $cf_cv_libtool_version in #(vi
4430217309Snwhitehorn	1.[[5-9]]*|[[2-9]].[[0-9.a-z]]*) #(vi
4431217309Snwhitehorn		LIBTOOL_CXX="$LIBTOOL --tag=CXX"
4432217309Snwhitehorn		LIBTOOL="$LIBTOOL --tag=CC"
4433217309Snwhitehorn		;;
4434217309Snwhitehorn	*)
4435217309Snwhitehorn		LIBTOOL_CXX="$LIBTOOL"
4436217309Snwhitehorn		;;
4437217309Snwhitehorn	esac
4438217309Snwhitehornelse
4439217309Snwhitehorn	LIBTOOL=""
4440217309Snwhitehorn	LIBTOOL_CXX=""
4441217309Snwhitehornfi
4442217309Snwhitehorn
4443217309Snwhitehorntest -z "$LIBTOOL" && ECHO_LT=
4444217309Snwhitehorn
4445217309SnwhitehornAC_SUBST(LIBTOOL)
4446217309SnwhitehornAC_SUBST(LIBTOOL_CXX)
4447217309SnwhitehornAC_SUBST(LIBTOOL_OPTS)
4448217309Snwhitehorn
4449217309SnwhitehornAC_SUBST(LIB_CREATE)
4450217309SnwhitehornAC_SUBST(LIB_OBJECT)
4451217309SnwhitehornAC_SUBST(LIB_SUFFIX)
4452217309SnwhitehornAC_SUBST(LIB_PREP)
4453217309Snwhitehorn
4454217309SnwhitehornAC_SUBST(LIB_CLEAN)
4455217309SnwhitehornAC_SUBST(LIB_COMPILE)
4456217309SnwhitehornAC_SUBST(LIB_LINK)
4457217309SnwhitehornAC_SUBST(LIB_INSTALL)
4458217309SnwhitehornAC_SUBST(LIB_UNINSTALL)
4459217309Snwhitehorn
4460217309Snwhitehorn])dnl
4461217309Snwhitehorndnl ---------------------------------------------------------------------------
4462217309Snwhitehorndnl CF_WITH_LIBTOOL_OPTS version: 2 updated: 2007/04/08 18:14:54
4463217309Snwhitehorndnl --------------------
4464217309Snwhitehorndnl Allow user to pass additional libtool options into the library creation
4465217309Snwhitehorndnl and link steps.  The main use for this is to do something like
4466217309Snwhitehorndnl	./configure --with-libtool-opts=-static
4467217309Snwhitehorndnl to get the same behavior as automake-flavored
4468217309Snwhitehorndnl	./configure --enable-static
4469217309SnwhitehornAC_DEFUN([CF_WITH_LIBTOOL_OPTS],[
4470217309SnwhitehornAC_MSG_CHECKING(for additional libtool options)
4471217309SnwhitehornAC_ARG_WITH(libtool-opts,
4472217309Snwhitehorn	[  --with-libtool-opts=XXX specify additional libtool options],
4473217309Snwhitehorn	[with_libtool_opts=$withval],
4474217309Snwhitehorn	[with_libtool_opts=no])
4475217309SnwhitehornAC_MSG_RESULT($with_libtool_opts)
4476217309Snwhitehorn
4477217309Snwhitehorncase .$with_libtool_opts in
4478217309Snwhitehorn.yes|.no|.)
4479217309Snwhitehorn	;;
4480217309Snwhitehorn*)
4481217309Snwhitehorn	LIBTOOL_OPTS=$with_libtool_opts
4482217309Snwhitehorn	;;
4483217309Snwhitehornesac
4484217309Snwhitehorn
4485217309SnwhitehornAC_SUBST(LIBTOOL_OPTS)
4486217309Snwhitehorn])dnl
4487217309Snwhitehorndnl ---------------------------------------------------------------------------
4488251843Sbaptdnl CF_WITH_NO_LEAKS version: 2 updated: 2012/10/06 08:57:51
4489217309Snwhitehorndnl ----------------
4490217309SnwhitehornAC_DEFUN([CF_WITH_NO_LEAKS],[
4491217309Snwhitehorn
4492217309SnwhitehornAC_REQUIRE([CF_WITH_DMALLOC])
4493217309SnwhitehornAC_REQUIRE([CF_WITH_DBMALLOC])
4494217309SnwhitehornAC_REQUIRE([CF_WITH_PURIFY])
4495217309SnwhitehornAC_REQUIRE([CF_WITH_VALGRIND])
4496217309Snwhitehorn
4497217309SnwhitehornAC_MSG_CHECKING(if you want to perform memory-leak testing)
4498217309SnwhitehornAC_ARG_WITH(no-leaks,
4499217309Snwhitehorn	[  --with-no-leaks         test: free permanent memory, analyze leaks],
4500251843Sbapt	[AC_DEFINE(NO_LEAKS,1,[Define to 1 to enable leak-checking])
4501217309Snwhitehorn	 cf_doalloc=".${with_dmalloc}${with_dbmalloc}${with_purify}${with_valgrind}"
4502217309Snwhitehorn	 case ${cf_doalloc} in #(vi
4503217309Snwhitehorn	 *yes*) ;;
4504251843Sbapt	 *) AC_DEFINE(DOALLOC,10000,[Define to size of malloc-array]) ;;
4505217309Snwhitehorn	 esac
4506217309Snwhitehorn	 with_no_leaks=yes],
4507217309Snwhitehorn	[with_no_leaks=])
4508217309SnwhitehornAC_MSG_RESULT($with_no_leaks)
4509217309Snwhitehorn])dnl
4510217309Snwhitehorndnl ---------------------------------------------------------------------------
4511217309Snwhitehorndnl CF_WITH_PURIFY version: 2 updated: 2006/12/14 18:43:43
4512217309Snwhitehorndnl --------------
4513217309SnwhitehornAC_DEFUN([CF_WITH_PURIFY],[
4514217309SnwhitehornCF_NO_LEAKS_OPTION(purify,
4515217309Snwhitehorn	[  --with-purify           test: use Purify],
4516217309Snwhitehorn	[USE_PURIFY],
4517217309Snwhitehorn	[LINK_PREFIX="$LINK_PREFIX purify"])
4518217309SnwhitehornAC_SUBST(LINK_PREFIX)
4519217309Snwhitehorn])dnl
4520217309Snwhitehorndnl ---------------------------------------------------------------------------
4521255852Sdteskednl CF_WITH_REL_VERSION version: 1 updated: 2003/09/20 18:12:49
4522255852Sdteskednl -------------------
4523255852Sdteskednl Allow library's release-version to be overridden.  Generally this happens when a
4524255852Sdteskednl packager has incremented the release-version past that used in the original package,
4525255852Sdteskednl and wishes to keep doing this.
4526255852Sdteskednl
4527255852Sdteskednl $1 is the package name, if any, to derive corresponding {package}_MAJOR
4528255852Sdteskednl and {package}_MINOR symbols
4529255852Sdteskednl symbol.
4530255852SdteskeAC_DEFUN([CF_WITH_REL_VERSION],[
4531255852Sdtesketest -z "$cf_cv_rel_version" && cf_cv_rel_version=0.0
4532255852SdteskeAC_ARG_WITH(rel-version,
4533255852Sdteske[  --with-rel-version=XXX  override derived release version],
4534255852Sdteske[AC_MSG_WARN(overriding release version $cf_cv_rel_version to $withval)
4535255852Sdteske cf_cv_rel_version=$withval])
4536255852Sdteskeifelse($1,,[
4537255852Sdteske CF_NUMBER_SYNTAX($cf_cv_rel_version,Release version)
4538255852Sdteske],[
4539255852Sdteske $1_MAJOR=`echo "$cf_cv_rel_version" | sed -e 's/\..*//'`
4540255852Sdteske $1_MINOR=`echo "$cf_cv_rel_version" | sed -e 's/^[[^.]]*//' -e 's/^\.//' -e 's/\..*//'`
4541255852Sdteske CF_NUMBER_SYNTAX([$]$1_MAJOR,Release major-version)
4542255852Sdteske CF_NUMBER_SYNTAX([$]$1_MINOR,Release minor-version)
4543255852Sdteske])
4544255852Sdteske])dnl
4545255852Sdteskednl ---------------------------------------------------------------------------
4546255852Sdteskednl CF_WITH_SHARED_OR_LIBTOOL version: 5 updated: 2013/09/02 09:17:44
4547255852Sdteskednl -------------------------
4548255852Sdteskednl Provide shared libraries using either autoconf macros (--with-shared) or
4549255852Sdteskednl using the external libtool script (--with-libtool).
4550255852Sdteskednl
4551255852Sdteskednl $1 = program name (all caps preferred)
4552255852Sdteskednl $1 = release version
4553255852Sdteskednl $2 = ABI version
4554255852Sdteskedefine([CF_WITH_SHARED_OR_LIBTOOL],[
4555255852Sdteske
4556255852SdteskeREL_VERSION=$2
4557255852SdteskeABI_VERSION=$3
4558255852Sdteskecf_cv_rel_version=$REL_VERSION
4559255852SdteskeAC_SUBST(ABI_VERSION)
4560255852SdteskeAC_SUBST(REL_VERSION)
4561255852Sdteske
4562255852SdteskeCF_WITH_REL_VERSION($1)
4563255852SdteskeCF_WITH_ABI_VERSION
4564255852Sdteske
4565255852SdteskeLIB_MODEL=static
4566255852SdteskeDFT_LWR_MODEL=$LIB_MODEL
4567255852SdteskeLIBTOOL_MAKE="#"
4568255852Sdteske
4569255852Sdteske# use to comment-out makefile lines
4570255852SdteskeMAKE_NORMAL=
4571255852SdteskeMAKE_STATIC=
4572255852SdteskeMAKE_SHARED="#"
4573255852Sdteske
4574255852SdteskeCF_WITH_LIBTOOL
4575255852Sdteske
4576255852SdteskeLIB_CREATE="$LIB_CREATE \[$]@"
4577255852Sdteske
4578255852Sdteskeif test "$with_libtool" = "yes" ; then
4579255852Sdteske	OBJEXT="lo"
4580255852Sdteske	LIB_MODEL=libtool
4581255852Sdteske	DFT_LWR_MODEL=$LIB_MODEL
4582255852Sdteske	LIBTOOL_MAKE=
4583255852Sdteske	CF_WITH_LIBTOOL_OPTS
4584255852Sdteske	MAKE_NORMAL="#"
4585255852Sdteske	MAKE_STATIC="#"
4586255852Sdteske	MAKE_SHARED=
4587255852Sdteskeelse
4588255852Sdteske	AC_MSG_CHECKING(if you want to build shared libraries)
4589255852Sdteske	AC_ARG_WITH(shared,
4590255852Sdteske		[  --with-shared           generate shared-libraries],
4591255852Sdteske		[with_shared=$withval],
4592255852Sdteske		[with_shared=no])
4593255852Sdteske	AC_MSG_RESULT($with_shared)
4594255852Sdteske	if test "$with_shared" = "yes" ; then
4595255852Sdteske		LIB_MODEL=shared
4596255852Sdteske		DFT_LWR_MODEL=$LIB_MODEL
4597255852Sdteske		CF_SHARED_OPTS
4598255852Sdteske		LIB_PREP=:
4599255852Sdteske		LIB_CREATE="[$]MK_SHARED_LIB"
4600255852Sdteske		CFLAGS="$CFLAGS $CC_SHARED_OPTS"
4601255852Sdteske		MAKE_NORMAL="#"
4602255852Sdteske		MAKE_STATIC="#"
4603255852Sdteske		MAKE_SHARED=
4604255852Sdteske	fi
4605255852Sdteskefi
4606255852Sdteske
4607255852SdteskeLIB_SUFFIX=
4608255852SdteskeCF_LIB_SUFFIX($LIB_MODEL, DFT_LIB_SUFFIX, DFT_DEP_SUFFIX)
4609255852SdteskeLIB_SUFFIX=$DFT_LIB_SUFFIX
4610255852Sdteske
4611255852SdteskeAC_SUBST(DFT_LWR_MODEL)
4612255852SdteskeAC_SUBST(DFT_LIB_SUFFIX)
4613255852SdteskeAC_SUBST(DFT_DEP_SUFFIX)
4614255852SdteskeAC_SUBST(LIB_MODEL)
4615255852Sdteske
4616255852SdteskeAC_SUBST(LIBTOOL_MAKE)
4617255852Sdteske
4618255852SdteskeAC_SUBST(MAKE_NORMAL)
4619255852SdteskeAC_SUBST(MAKE_SHARED)
4620255852SdteskeAC_SUBST(MAKE_STATIC)
4621255852Sdteske])dnl
4622255852Sdteskednl ---------------------------------------------------------------------------
4623217309Snwhitehorndnl CF_WITH_VALGRIND version: 1 updated: 2006/12/14 18:00:21
4624217309Snwhitehorndnl ----------------
4625217309SnwhitehornAC_DEFUN([CF_WITH_VALGRIND],[
4626217309SnwhitehornCF_NO_LEAKS_OPTION(valgrind,
4627217309Snwhitehorn	[  --with-valgrind         test: use valgrind],
4628217309Snwhitehorn	[USE_VALGRIND])
4629217309Snwhitehorn])dnl
4630217309Snwhitehorndnl ---------------------------------------------------------------------------
4631217309Snwhitehorndnl CF_WITH_WARNINGS version: 5 updated: 2004/07/23 14:40:34
4632217309Snwhitehorndnl ----------------
4633217309Snwhitehorndnl Combine the checks for gcc features into a configure-script option
4634217309Snwhitehorndnl
4635217309Snwhitehorndnl Parameters:
4636217309Snwhitehorndnl	$1 - see CF_GCC_WARNINGS
4637217309SnwhitehornAC_DEFUN([CF_WITH_WARNINGS],
4638217309Snwhitehorn[
4639217309Snwhitehornif ( test "$GCC" = yes || test "$GXX" = yes )
4640217309Snwhitehornthen
4641217309SnwhitehornAC_MSG_CHECKING(if you want to check for gcc warnings)
4642217309SnwhitehornAC_ARG_WITH(warnings,
4643217309Snwhitehorn	[  --with-warnings         test: turn on gcc warnings],
4644217309Snwhitehorn	[cf_opt_with_warnings=$withval],
4645217309Snwhitehorn	[cf_opt_with_warnings=no])
4646217309SnwhitehornAC_MSG_RESULT($cf_opt_with_warnings)
4647217309Snwhitehornif test "$cf_opt_with_warnings" != no ; then
4648217309Snwhitehorn	CF_GCC_ATTRIBUTES
4649217309Snwhitehorn	CF_GCC_WARNINGS([$1])
4650217309Snwhitehornfi
4651217309Snwhitehornfi
4652217309Snwhitehorn])dnl
4653217309Snwhitehorndnl ---------------------------------------------------------------------------
4654220749Snwhitehorndnl CF_XOPEN_CURSES version: 11 updated: 2011/01/18 18:15:30
4655217309Snwhitehorndnl ---------------
4656217309Snwhitehorndnl Test if we should define X/Open source for curses, needed on Digital Unix
4657217309Snwhitehorndnl 4.x, to see the extended functions, but breaks on IRIX 6.x.
4658217309Snwhitehorndnl
4659217309Snwhitehorndnl The getbegyx() check is needed for HPUX, which omits legacy macros such
4660217309Snwhitehorndnl as getbegy().  The latter is better design, but the former is standard.
4661217309SnwhitehornAC_DEFUN([CF_XOPEN_CURSES],
4662217309Snwhitehorn[
4663217309SnwhitehornAC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
4664217309SnwhitehornAC_CACHE_CHECK(if we must define _XOPEN_SOURCE_EXTENDED,cf_cv_need_xopen_extension,[
4665217309SnwhitehornAC_TRY_LINK([
4666217309Snwhitehorn#include <stdlib.h>
4667220749Snwhitehorn#include <${cf_cv_ncurses_header:-curses.h}>],[
4668217309Snwhitehorn#if defined(NCURSES_VERSION_PATCH)
4669220749Snwhitehorn#if (NCURSES_VERSION_PATCH < 20100501) && (NCURSES_VERSION_PATCH >= 20100403)
4670217309Snwhitehorn	make an error
4671217309Snwhitehorn#endif
4672217309Snwhitehorn#endif
4673217309Snwhitehorn	long x = winnstr(stdscr, "", 0);
4674217309Snwhitehorn	int x1, y1;
4675217309Snwhitehorn	getbegyx(stdscr, y1, x1)],
4676217309Snwhitehorn	[cf_cv_need_xopen_extension=no],
4677217309Snwhitehorn	[AC_TRY_LINK([
4678217309Snwhitehorn#define _XOPEN_SOURCE_EXTENDED
4679217309Snwhitehorn#include <stdlib.h>
4680220749Snwhitehorn#include <${cf_cv_ncurses_header:-curses.h}>],[
4681217309Snwhitehorn#ifdef NCURSES_VERSION
4682217309Snwhitehorn	cchar_t check;
4683217309Snwhitehorn	int check2 = curs_set((int)sizeof(check));
4684217309Snwhitehorn#endif
4685217309Snwhitehorn	long x = winnstr(stdscr, "", 0);
4686217309Snwhitehorn	int x1, y1;
4687217309Snwhitehorn	getbegyx(stdscr, y1, x1)],
4688217309Snwhitehorn	[cf_cv_need_xopen_extension=yes],
4689217309Snwhitehorn	[cf_cv_need_xopen_extension=unknown])])])
4690217309Snwhitehorntest $cf_cv_need_xopen_extension = yes && CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
4691217309Snwhitehorn])dnl
4692217309Snwhitehorndnl ---------------------------------------------------------------------------
4693255852Sdteskednl CF_XOPEN_SOURCE version: 45 updated: 2013/09/07 14:06:25
4694217309Snwhitehorndnl ---------------
4695217309Snwhitehorndnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
4696217309Snwhitehorndnl or adapt to the vendor's definitions to get equivalent functionality,
4697217309Snwhitehorndnl without losing the common non-POSIX features.
4698217309Snwhitehorndnl
4699217309Snwhitehorndnl Parameters:
4700217309Snwhitehorndnl	$1 is the nominal value for _XOPEN_SOURCE
4701217309Snwhitehorndnl	$2 is the nominal value for _POSIX_C_SOURCE
4702217309SnwhitehornAC_DEFUN([CF_XOPEN_SOURCE],[
4703255852SdteskeAC_REQUIRE([AC_CANONICAL_HOST])
4704217309Snwhitehorn
4705220749Snwhitehorncf_XOPEN_SOURCE=ifelse([$1],,500,[$1])
4706220749Snwhitehorncf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2])
4707217309Snwhitehorncf_xopen_source=
4708217309Snwhitehorn
4709217309Snwhitehorncase $host_os in #(vi
4710251843Sbaptaix[[4-7]]*) #(vi
4711217309Snwhitehorn	cf_xopen_source="-D_ALL_SOURCE"
4712217309Snwhitehorn	;;
4713255852Sdteskecygwin|msys) #(vi
4714224014Snwhitehorn	cf_XOPEN_SOURCE=600
4715224014Snwhitehorn	;;
4716217309Snwhitehorndarwin[[0-8]].*) #(vi
4717217309Snwhitehorn	cf_xopen_source="-D_APPLE_C_SOURCE"
4718217309Snwhitehorn	;;
4719217309Snwhitehorndarwin*) #(vi
4720217309Snwhitehorn	cf_xopen_source="-D_DARWIN_C_SOURCE"
4721251843Sbapt	cf_XOPEN_SOURCE=
4722217309Snwhitehorn	;;
4723217309Snwhitehornfreebsd*|dragonfly*) #(vi
4724217309Snwhitehorn	# 5.x headers associate
4725217309Snwhitehorn	#	_XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L
4726217309Snwhitehorn	#	_XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L
4727217309Snwhitehorn	cf_POSIX_C_SOURCE=200112L
4728217309Snwhitehorn	cf_XOPEN_SOURCE=600
4729217309Snwhitehorn	cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
4730217309Snwhitehorn	;;
4731217309Snwhitehornhpux11*) #(vi
4732217309Snwhitehorn	cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500"
4733217309Snwhitehorn	;;
4734217309Snwhitehornhpux*) #(vi
4735217309Snwhitehorn	cf_xopen_source="-D_HPUX_SOURCE"
4736217309Snwhitehorn	;;
4737217309Snwhitehornirix[[56]].*) #(vi
4738217309Snwhitehorn	cf_xopen_source="-D_SGI_SOURCE"
4739251843Sbapt	cf_XOPEN_SOURCE=
4740217309Snwhitehorn	;;
4741217309Snwhitehornlinux*|gnu*|mint*|k*bsd*-gnu) #(vi
4742217309Snwhitehorn	CF_GNU_SOURCE
4743217309Snwhitehorn	;;
4744217309Snwhitehornmirbsd*) #(vi
4745251843Sbapt	# setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <sys/select.h> and other headers which use u_int / u_short types
4746251843Sbapt	cf_XOPEN_SOURCE=
4747251843Sbapt	CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
4748217309Snwhitehorn	;;
4749217309Snwhitehornnetbsd*) #(vi
4750251843Sbapt	cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
4751217309Snwhitehorn	;;
4752251843Sbaptopenbsd[[4-9]]*) #(vi
4753251843Sbapt	# setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw
4754251843Sbapt	cf_xopen_source="-D_BSD_SOURCE"
4755251843Sbapt	cf_XOPEN_SOURCE=600
4756251843Sbapt	;;
4757217309Snwhitehornopenbsd*) #(vi
4758217309Snwhitehorn	# setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
4759217309Snwhitehorn	;;
4760217309Snwhitehornosf[[45]]*) #(vi
4761217309Snwhitehorn	cf_xopen_source="-D_OSF_SOURCE"
4762217309Snwhitehorn	;;
4763217309Snwhitehornnto-qnx*) #(vi
4764217309Snwhitehorn	cf_xopen_source="-D_QNX_SOURCE"
4765217309Snwhitehorn	;;
4766217309Snwhitehornsco*) #(vi
4767217309Snwhitehorn	# setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
4768217309Snwhitehorn	;;
4769251843Sbaptsolaris2.*) #(vi
4770217309Snwhitehorn	cf_xopen_source="-D__EXTENSIONS__"
4771217309Snwhitehorn	;;
4772217309Snwhitehorn*)
4773251843Sbapt	CF_TRY_XOPEN_SOURCE
4774217309Snwhitehorn	CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
4775217309Snwhitehorn	;;
4776217309Snwhitehornesac
4777217309Snwhitehorn
4778217309Snwhitehornif test -n "$cf_xopen_source" ; then
4779217309Snwhitehorn	CF_ADD_CFLAGS($cf_xopen_source)
4780217309Snwhitehornfi
4781251843Sbapt
4782251843Sbaptdnl In anything but the default case, we may have system-specific setting
4783251843Sbaptdnl which is still not guaranteed to provide all of the entrypoints that
4784251843Sbaptdnl _XOPEN_SOURCE would yield.
4785251843Sbaptif test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then
4786251843Sbapt	AC_MSG_CHECKING(if _XOPEN_SOURCE really is set)
4787251843Sbapt	AC_TRY_COMPILE([#include <stdlib.h>],[
4788251843Sbapt#ifndef _XOPEN_SOURCE
4789251843Sbaptmake an error
4790251843Sbapt#endif],
4791251843Sbapt	[cf_XOPEN_SOURCE_set=yes],
4792251843Sbapt	[cf_XOPEN_SOURCE_set=no])
4793251843Sbapt	AC_MSG_RESULT($cf_XOPEN_SOURCE_set)
4794251843Sbapt	if test $cf_XOPEN_SOURCE_set = yes
4795251843Sbapt	then
4796251843Sbapt		AC_TRY_COMPILE([#include <stdlib.h>],[
4797251843Sbapt#if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE
4798251843Sbaptmake an error
4799251843Sbapt#endif],
4800251843Sbapt		[cf_XOPEN_SOURCE_set_ok=yes],
4801251843Sbapt		[cf_XOPEN_SOURCE_set_ok=no])
4802251843Sbapt		if test $cf_XOPEN_SOURCE_set_ok = no
4803251843Sbapt		then
4804251843Sbapt			AC_MSG_WARN(_XOPEN_SOURCE is lower than requested)
4805251843Sbapt		fi
4806251843Sbapt	else
4807251843Sbapt		CF_TRY_XOPEN_SOURCE
4808251843Sbapt	fi
4809251843Sbaptfi
4810217309Snwhitehorn])
4811217309Snwhitehorndnl ---------------------------------------------------------------------------
4812255852Sdteskednl CF__ADD_SHLIB_RULES version: 4 updated: 2013/07/22 18:49:24
4813255852Sdteskednl -------------------
4814255852Sdteskednl Append rules for creating, installing, uninstalling and cleaning library.
4815255852Sdteskednl In particular, this is needed for shared libraries since there are symbolic
4816255852Sdteskednl links which depend on configuration choices.
4817255852Sdteskednl
4818255852Sdteskednl The logic is controlled by these cache variables:
4819255852Sdteskednl $cf_cv_do_symlinks
4820255852Sdteskednl $cf_cv_shlib_version
4821255852Sdteskednl
4822255852Sdteskednl The macro uses variables set by CF__DEFINE_SHLIB_VARS
4823255852Sdteskednl
4824255852Sdteskednl $1 = makefile to append to
4825255852Sdteskednl $2 = model (static, shared, libtool)
4826255852Sdteskednl $3 = objects (dependencies)
4827255852Sdteskednl $4 = additional libraries needed to link the shared library
4828255852Sdteskedefine([CF__ADD_SHLIB_RULES],[
4829255852Sdteske
4830255852SdteskeCF__DEFINE_LIB_TARGET
4831255852Sdteske
4832255852Sdteskecase x$2 in
4833255852Sdteskexlibtool|xshared) #(vi
4834255852Sdteske	cf_libdeps="ifelse($4,,,[$4])"
4835255852Sdteske	;;
4836255852Sdteskex*)
4837255852Sdteske	cf_libdeps=
4838255852Sdteske	;;
4839255852Sdteskeesac
4840255852Sdteske
4841255852Sdteskecat >>$1 <<CF_EOF
4842255852Sdteske
4843255852Sdteske# generated by CF__ADD_SHLIB_RULES
4844255852Sdteske# libmodel: $2
4845255852Sdteske# symlinks: $cf_cv_do_symlinks
4846255852Sdteske# shlibver: $cf_cv_shlib_version
4847255852Sdteske
4848255852SdteskeCF_EOF
4849255852Sdteske
4850255852Sdteskecat >>$1 <<CF_EOF
4851255852Sdteske$cf_libname :: \\
4852255852SdteskeCF_EOF
4853255852Sdteske
4854255852Sdteskecat >>$1 <<CF_EOF
4855255852Sdteske		$3
4856255852Sdteske	@echo linking \[$]@
4857255852Sdteske	\$(LIBTOOL_CREATE) $3 $cf_libdeps
4858255852SdteskeCF_EOF
4859255852Sdteske
4860255852Sdteskeif test "x$cf_cv_do_symlinks" = xyes
4861255852Sdteskethen
4862255852Sdteskecat >>$1 <<CF_EOF
4863255852Sdteske	\$(LN_S) $cf_libname $cf_liblink
4864255852Sdteske	\$(LN_S) $cf_liblink $cf_libroot
4865255852SdteskeCF_EOF
4866255852Sdteskefi
4867255852Sdteske
4868255852Sdteskecat >>$1 <<CF_EOF
4869255852Sdteske
4870255852Sdteskeinstall \\
4871255852Sdteskeinstall.libs :: \$(DESTDIR)\$(libdir)/$cf_libname
4872255852Sdteske
4873255852Sdteske\$(DESTDIR)\$(libdir)/$cf_libname :: \\
4874255852Sdteske		\$(DESTDIR)\$(libdir) \\
4875255852Sdteske		$3
4876255852Sdteske	@echo linking \[$]@
4877255852Sdteske	\$(LIBTOOL_CREATE) $3 $cf_libdeps
4878255852SdteskeCF_EOF
4879255852Sdteske
4880255852Sdteskeif test "x$cf_cv_do_symlinks" = xyes
4881255852Sdteskethen
4882255852Sdteskecat >>$1 <<CF_EOF
4883255852Sdteske	cd \$(DESTDIR)\$(libdir) && (\$(LN_S) $cf_libname $cf_liblink; \$(LN_S) $cf_liblink $cf_libroot; )
4884255852SdteskeCF_EOF
4885255852Sdteskefi
4886255852Sdteske
4887255852Sdteskeif test x$2 = xshared
4888255852Sdteskethen
4889255852Sdteskecat >>$1 <<CF_EOF
4890255852Sdteske	- test -z "\$(DESTDIR)" && /sbin/ldconfig
4891255852SdteskeCF_EOF
4892255852Sdteskefi
4893255852Sdteske
4894255852Sdteskecat >>$1 <<CF_EOF
4895255852Sdteske
4896255852Sdteskeuninstall \\
4897255852Sdteskeuninstall.libs ::
4898255852Sdteske	@echo uninstalling \$(DESTDIR)\$(libdir)/$cf_libname
4899255852SdteskeCF_EOF
4900255852Sdteske
4901255852Sdteskeif test "x$cf_cv_do_symlinks" = xyes
4902255852Sdteskethen
4903255852Sdteskecat >>$1 <<CF_EOF
4904255852Sdteske	-rm -f \$(DESTDIR)\$(libdir)/$cf_libroot
4905255852Sdteske	-rm -f \$(DESTDIR)\$(libdir)/$cf_liblink
4906255852SdteskeCF_EOF
4907255852Sdteskefi
4908255852Sdteske
4909255852Sdteskecat >>$1 <<CF_EOF
4910255852Sdteske	-rm -f \$(DESTDIR)\$(libdir)/$cf_libname
4911255852Sdteske
4912255852Sdteskeclean \\
4913255852Sdteskeclean.libs ::
4914255852SdteskeCF_EOF
4915255852Sdteske
4916255852Sdteskeif test "x$cf_cv_do_symlinks" = xyes
4917255852Sdteskethen
4918255852Sdteskecat >>$1 <<CF_EOF
4919255852Sdteske	-rm -f $cf_libroot
4920255852Sdteske	-rm -f $cf_liblink
4921255852SdteskeCF_EOF
4922255852Sdteskefi
4923255852Sdteske
4924255852Sdteskecat >>$1 <<CF_EOF
4925255852Sdteske	-rm -f $cf_libname
4926255852Sdteske
4927255852Sdteskemostlyclean::
4928255852Sdteske	-rm -f $3
4929255852Sdteske# end generated by CF__ADD_SHLIB_RULES
4930255852SdteskeCF_EOF
4931255852Sdteske])dnl
4932255852Sdteskednl ---------------------------------------------------------------------------
4933220749Snwhitehorndnl CF__CURSES_HEAD version: 2 updated: 2010/10/23 15:54:49
4934217309Snwhitehorndnl ---------------
4935217309Snwhitehorndnl Define a reusable chunk which includes <curses.h> and <term.h> when they
4936217309Snwhitehorndnl are both available.
4937217309Snwhitehorndefine([CF__CURSES_HEAD],[
4938217309Snwhitehorn#ifdef HAVE_XCURSES
4939217309Snwhitehorn#include <xcurses.h>
4940217309Snwhitehornchar * XCursesProgramName = "test";
4941217309Snwhitehorn#else
4942220749Snwhitehorn#include <${cf_cv_ncurses_header:-curses.h}>
4943217309Snwhitehorn#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H)
4944217309Snwhitehorn#include <ncursesw/term.h>
4945217309Snwhitehorn#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H)
4946217309Snwhitehorn#include <ncurses/term.h>
4947217309Snwhitehorn#elif defined(HAVE_TERM_H)
4948217309Snwhitehorn#include <term.h>
4949217309Snwhitehorn#endif
4950217309Snwhitehorn#endif
4951217309Snwhitehorn])
4952217309Snwhitehorndnl ---------------------------------------------------------------------------
4953255852Sdteskednl CF__CURSES_HEAD version: 2 updated: 2010/10/23 15:54:49
4954255852Sdteskednl ---------------
4955255852Sdteskednl Define a reusable chunk which includes <curses.h> and <term.h> when they
4956255852Sdteskednl are both available.
4957255852Sdteskedefine([CF__CURSES_HEAD],[
4958255852Sdteske#ifdef HAVE_XCURSES
4959255852Sdteske#include <xcurses.h>
4960255852Sdteskechar * XCursesProgramName = "test";
4961255852Sdteske#else
4962255852Sdteske#include <${cf_cv_ncurses_header:-curses.h}>
4963255852Sdteske#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H)
4964255852Sdteske#include <ncursesw/term.h>
4965255852Sdteske#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H)
4966255852Sdteske#include <ncurses/term.h>
4967255852Sdteske#elif defined(HAVE_TERM_H)
4968255852Sdteske#include <term.h>
4969255852Sdteske#endif
4970255852Sdteske#endif
4971255852Sdteske])
4972255852Sdteskednl ---------------------------------------------------------------------------
4973255852Sdteskednl CF__DEFINE_LIB_TARGET version: 1 updated: 2013/07/22 18:27:50
4974255852Sdteskednl ---------------------
4975255852Sdteskedefine([CF__DEFINE_LIB_TARGET],[
4976255852Sdteskecf_libname=\${LIB_BASENAME}
4977255852Sdteskecf_liblink=$cf_libname
4978255852Sdteskecf_libroot=$cf_libname
4979255852Sdteske
4980255852Sdteskeif test "x$cf_cv_do_symlinks" = xyes
4981255852Sdteskethen
4982255852Sdteske	case "x$cf_cv_shlib_version" in #(vi
4983255852Sdteske	xrel) #(vi
4984255852Sdteske		cf_liblink="\${LIB_ABI_NAME}"
4985255852Sdteske		cf_libname="\${LIB_REL_NAME}"
4986255852Sdteske		;;
4987255852Sdteske	xabi)
4988255852Sdteske		cf_liblink="\${LIB_REL_NAME}"
4989255852Sdteske		cf_libname="\${LIB_ABI_NAME}"
4990255852Sdteske		;;
4991255852Sdteske	esac
4992255852Sdteskefi
4993255852SdteskeLIB_TARGET=$cf_libname
4994255852Sdteske])dnl
4995255852Sdteskednl ---------------------------------------------------------------------------
4996255852Sdteskednl CF__DEFINE_SHLIB_VARS version: 2 updated: 2013/07/27 17:38:32
4997255852Sdteskednl ---------------------
4998255852Sdteskednl Substitute makefile variables useful for CF__ADD_SHLIB_RULES.
4999255852Sdteskednl
5000255852Sdteskednl The substitution requires these variables:
5001255852Sdteskednl		LIB_PREFI - "lib"
5002255852Sdteskednl		LIB_ROOTNAME - "foo"
5003255852Sdteskednl		LIB_SUFFIX - ".so"
5004255852Sdteskednl		REL_VERSION - "5.0"
5005255852Sdteskednl		ABI_VERSION - "4.2.4"
5006255852Sdteskedefine([CF__DEFINE_SHLIB_VARS],[
5007255852SdteskeCF__DEFINE_LIB_TARGET
5008255852SdteskeSET_SHLIB_VARS="# begin CF__DEFINE_SHLIB_VARS\\
5009255852SdteskeLIB_BASENAME	= ${LIB_PREFIX}\${LIB_ROOTNAME}\${LIB_SUFFIX}\\
5010255852SdteskeLIB_REL_NAME	= \${LIB_BASENAME}.\${REL_VERSION}\\
5011255852SdteskeLIB_ABI_NAME	= \${LIB_BASENAME}.\${ABI_VERSION}\\
5012255852SdteskeLIB_TARGET	= $LIB_TARGET\\
5013255852SdteskeRM_SHARED_OPTS	= $RM_SHARED_OPTS\\
5014255852Sdteske# end CF__DEFINE_SHLIB_VARS"
5015255852SdteskeAC_SUBST(SET_SHLIB_VARS)
5016255852SdteskeAC_SUBST(LIB_TARGET)
5017255852Sdteske])dnl
5018255852Sdteskednl ---------------------------------------------------------------------------
5019217309Snwhitehorndnl CF__ICONV_BODY version: 2 updated: 2007/07/26 17:35:47
5020217309Snwhitehorndnl --------------
5021217309Snwhitehorndnl Test-code needed for iconv compile-checks
5022217309Snwhitehorndefine([CF__ICONV_BODY],[
5023217309Snwhitehorn	iconv_t cd = iconv_open("","");
5024217309Snwhitehorn	iconv(cd,NULL,NULL,NULL,NULL);
5025217309Snwhitehorn	iconv_close(cd);]
5026217309Snwhitehorn)dnl
5027217309Snwhitehorndnl ---------------------------------------------------------------------------
5028217309Snwhitehorndnl CF__ICONV_HEAD version: 1 updated: 2007/07/26 15:57:03
5029217309Snwhitehorndnl --------------
5030217309Snwhitehorndnl Header-files needed for iconv compile-checks
5031217309Snwhitehorndefine([CF__ICONV_HEAD],[
5032217309Snwhitehorn#include <stdlib.h>
5033217309Snwhitehorn#include <iconv.h>]
5034217309Snwhitehorn)dnl
5035217309Snwhitehorndnl ---------------------------------------------------------------------------
5036255852Sdteskednl CF__INIT_SHLIB_RULES version: 2 updated: 2013/07/27 17:38:32
5037255852Sdteskednl --------------------
5038255852Sdteskednl The third parameter to AC_OUTPUT, used to pass variables needed for
5039255852Sdteskednl CF__ADD_SHLIB_RULES.
5040255852Sdteskedefine([CF__INIT_SHLIB_RULES],[
5041255852SdteskeABI_VERSION="$ABI_VERSION"
5042255852SdteskeREL_VERSION="$REL_VERSION"
5043255852SdteskeLIB_MODEL="$LIB_MODEL"
5044255852SdteskeLIB_PREFIX="$LIB_PREFIX"
5045255852SdteskeLIB_ROOTNAME="$LIB_ROOTNAME"
5046255852SdteskeDFT_DEP_SUFFIX="$DFT_DEP_SUFFIX"
5047255852SdteskeRM_SHARED_OPTS="$RM_SHARED_OPTS"
5048255852Sdteskecf_cv_do_symlinks="$cf_cv_do_symlinks"
5049255852Sdteskecf_cv_shlib_version="$cf_cv_shlib_version"
5050255852Sdteske])
5051255852Sdteskednl ---------------------------------------------------------------------------
5052217309Snwhitehorndnl CF__INTL_BODY version: 1 updated: 2007/07/26 17:35:47
5053217309Snwhitehorndnl -------------
5054217309Snwhitehorndnl Test-code needed for libintl compile-checks
5055217309Snwhitehorndnl $1 = parameter 2 from AM_WITH_NLS
5056217309Snwhitehorndefine([CF__INTL_BODY],[
5057217309Snwhitehorn    bindtextdomain ("", "");
5058217309Snwhitehorn    return (int) gettext ("")
5059217309Snwhitehorn            ifelse([$1], need-ngettext, [ + (int) ngettext ("", "", 0)], [])
5060217309Snwhitehorn            [ + _nl_msg_cat_cntr]
5061217309Snwhitehorn])
5062217309Snwhitehorndnl ---------------------------------------------------------------------------
5063217309Snwhitehorndnl CF__INTL_HEAD version: 1 updated: 2007/07/26 17:35:47
5064217309Snwhitehorndnl -------------
5065217309Snwhitehorndnl Header-files needed for libintl compile-checks
5066217309Snwhitehorndefine([CF__INTL_HEAD],[
5067217309Snwhitehorn#include <libintl.h>
5068217309Snwhitehornextern int _nl_msg_cat_cntr;
5069217309Snwhitehorn])dnl
5070217309Snwhitehorndnl ---------------------------------------------------------------------------
5071217309Snwhitehorndnl jm_GLIBC21 version: 3 updated: 2002/10/27 23:21:42
5072217309Snwhitehorndnl ----------
5073217309Snwhitehorndnl Inserted as requested by gettext 0.10.40
5074217309Snwhitehorndnl File from /usr/share/aclocal
5075217309Snwhitehorndnl glibc21.m4
5076217309Snwhitehorndnl ====================
5077217309Snwhitehorndnl serial 2
5078217309Snwhitehorndnl
5079217309Snwhitehorndnl Test for the GNU C Library, version 2.1 or newer.
5080217309Snwhitehorndnl From Bruno Haible.
5081217309SnwhitehornAC_DEFUN([jm_GLIBC21],
5082217309Snwhitehorn  [
5083217309Snwhitehorn    AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
5084217309Snwhitehorn      ac_cv_gnu_library_2_1,
5085217309Snwhitehorn      [AC_EGREP_CPP([Lucky GNU user],
5086217309Snwhitehorn	[
5087217309Snwhitehorn#include <features.h>
5088217309Snwhitehorn#ifdef __GNU_LIBRARY__
5089217309Snwhitehorn #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
5090217309Snwhitehorn  Lucky GNU user
5091217309Snwhitehorn #endif
5092217309Snwhitehorn#endif
5093217309Snwhitehorn	],
5094217309Snwhitehorn	ac_cv_gnu_library_2_1=yes,
5095217309Snwhitehorn	ac_cv_gnu_library_2_1=no)
5096217309Snwhitehorn      ]
5097217309Snwhitehorn    )
5098217309Snwhitehorn    AC_SUBST(GLIBC21)
5099217309Snwhitehorn    GLIBC21="$ac_cv_gnu_library_2_1"
5100217309Snwhitehorn  ]
5101217309Snwhitehorn)
5102