source: trunk/essentials/sys-libs/ncurses/aclocal.m4@ 3604

Last change on this file since 3604 was 3043, checked in by bird, 18 years ago

-> essentials

File size: 129.5 KB
Line 
1dnl***************************************************************************
2dnl Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. *
3dnl *
4dnl Permission is hereby granted, free of charge, to any person obtaining a *
5dnl copy of this software and associated documentation files (the *
6dnl "Software"), to deal in the Software without restriction, including *
7dnl without limitation the rights to use, copy, modify, merge, publish, *
8dnl distribute, distribute with modifications, sublicense, and/or sell *
9dnl copies of the Software, and to permit persons to whom the Software is *
10dnl furnished to do so, subject to the following conditions: *
11dnl *
12dnl The above copyright notice and this permission notice shall be included *
13dnl in all copies or substantial portions of the Software. *
14dnl *
15dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
16dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
17dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
18dnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
19dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
20dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
21dnl THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
22dnl *
23dnl Except as contained in this notice, the name(s) of the above copyright *
24dnl holders shall not be used in advertising or otherwise to promote the *
25dnl sale, use or other dealings in this Software without prior written *
26dnl authorization. *
27dnl***************************************************************************
28dnl
29dnl Author: Thomas E. Dickey 1995-on
30dnl
31dnl $Id: aclocal.m4,v 1.373 2005/09/24 21:58:59 tom Exp $
32dnl Macros used in NCURSES auto-configuration script.
33dnl
34dnl See http://invisible-island.net/autoconf/ for additional information.
35dnl
36dnl ---------------------------------------------------------------------------
37dnl ---------------------------------------------------------------------------
38dnl AM_LANGINFO_CODESET version: 3 updated: 2002/10/27 23:21:42
39dnl -------------------
40dnl Inserted as requested by gettext 0.10.40
41dnl File from /usr/share/aclocal
42dnl codeset.m4
43dnl ====================
44dnl serial AM1
45dnl
46dnl From Bruno Haible.
47AC_DEFUN([AM_LANGINFO_CODESET],
48[
49 AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
50 [AC_TRY_LINK([#include <langinfo.h>],
51 [char* cs = nl_langinfo(CODESET);],
52 am_cv_langinfo_codeset=yes,
53 am_cv_langinfo_codeset=no)
54 ])
55 if test $am_cv_langinfo_codeset = yes; then
56 AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
57 [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
58 fi
59])dnl
60dnl ---------------------------------------------------------------------------
61dnl CF_ADA_INCLUDE_DIRS version: 4 updated: 2002/12/01 00:12:15
62dnl -------------------
63dnl Construct the list of include-options for the C programs in the Ada95
64dnl binding.
65AC_DEFUN([CF_ADA_INCLUDE_DIRS],
66[
67ACPPFLAGS="-I. -I../../include $ACPPFLAGS"
68if test "$srcdir" != "."; then
69 ACPPFLAGS="-I\$(srcdir)/../../include $ACPPFLAGS"
70fi
71if test "$GCC" != yes; then
72 ACPPFLAGS="$ACPPFLAGS -I\$(includedir)"
73elif test "$includedir" != "/usr/include"; then
74 if test "$includedir" = '${prefix}/include' ; then
75 if test $prefix != /usr ; then
76 ACPPFLAGS="$ACPPFLAGS -I\$(includedir)"
77 fi
78 else
79 ACPPFLAGS="$ACPPFLAGS -I\$(includedir)"
80 fi
81fi
82AC_SUBST(ACPPFLAGS)
83])dnl
84dnl ---------------------------------------------------------------------------
85dnl CF_ADD_CFLAGS version: 7 updated: 2004/04/25 17:48:30
86dnl -------------
87dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS
88dnl The second parameter if given makes this macro verbose.
89dnl
90dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS,
91dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily
92dnl confused by the quotes (which require backslashes to keep them usable).
93AC_DEFUN([CF_ADD_CFLAGS],
94[
95cf_fix_cppflags=no
96cf_new_cflags=
97cf_new_cppflags=
98cf_new_extra_cppflags=
99
100for cf_add_cflags in $1
101do
102case $cf_fix_cppflags in
103no)
104 case $cf_add_cflags in #(vi
105 -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
106 case $cf_add_cflags in
107 -D*)
108 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'`
109
110 test "${cf_add_cflags}" != "${cf_tst_cflags}" \
111 && test -z "${cf_tst_cflags}" \
112 && cf_fix_cppflags=yes
113
114 if test $cf_fix_cppflags = yes ; then
115 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
116 continue
117 elif test "${cf_tst_cflags}" = "\"'" ; then
118 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
119 continue
120 fi
121 ;;
122 esac
123 case "$CPPFLAGS" in
124 *$cf_add_cflags) #(vi
125 ;;
126 *) #(vi
127 cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
128 ;;
129 esac
130 ;;
131 *)
132 cf_new_cflags="$cf_new_cflags $cf_add_cflags"
133 ;;
134 esac
135 ;;
136yes)
137 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
138
139 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'`
140
141 test "${cf_add_cflags}" != "${cf_tst_cflags}" \
142 && test -z "${cf_tst_cflags}" \
143 && cf_fix_cppflags=no
144 ;;
145esac
146done
147
148if test -n "$cf_new_cflags" ; then
149 ifelse($2,,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)])
150 CFLAGS="$CFLAGS $cf_new_cflags"
151fi
152
153if test -n "$cf_new_cppflags" ; then
154 ifelse($2,,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)])
155 CPPFLAGS="$cf_new_cppflags $CPPFLAGS"
156fi
157
158if test -n "$cf_new_extra_cppflags" ; then
159 ifelse($2,,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)])
160 EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
161fi
162
163AC_SUBST(EXTRA_CPPFLAGS)
164
165])dnl
166dnl ---------------------------------------------------------------------------
167dnl CF_ANSI_CC_CHECK version: 9 updated: 2001/12/30 17:53:34
168dnl ----------------
169dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES'
170dnl in the sharutils 4.2 distribution.
171AC_DEFUN([CF_ANSI_CC_CHECK],
172[
173AC_CACHE_CHECK(for ${CC-cc} option to accept ANSI C, cf_cv_ansi_cc,[
174cf_cv_ansi_cc=no
175cf_save_CFLAGS="$CFLAGS"
176cf_save_CPPFLAGS="$CPPFLAGS"
177# Don't try gcc -ansi; that turns off useful extensions and
178# breaks some systems' header files.
179# AIX -qlanglvl=ansi
180# Ultrix and OSF/1 -std1
181# HP-UX -Aa -D_HPUX_SOURCE
182# SVR4 -Xc
183# UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes)
184for cf_arg in "-DCC_HAS_PROTOS" \
185 "" \
186 -qlanglvl=ansi \
187 -std1 \
188 -Ae \
189 "-Aa -D_HPUX_SOURCE" \
190 -Xc
191do
192 CF_ADD_CFLAGS($cf_arg)
193 AC_TRY_COMPILE(
194[
195#ifndef CC_HAS_PROTOS
196#if !defined(__STDC__) || (__STDC__ != 1)
197choke me
198#endif
199#endif
200],[
201 int test (int i, double x);
202 struct s1 {int (*f) (int a);};
203 struct s2 {int (*f) (double a);};],
204 [cf_cv_ansi_cc="$cf_arg"; break])
205done
206CFLAGS="$cf_save_CFLAGS"
207CPPFLAGS="$cf_save_CPPFLAGS"
208])
209
210if test "$cf_cv_ansi_cc" != "no"; then
211if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then
212 CF_ADD_CFLAGS($cf_cv_ansi_cc)
213else
214 AC_DEFINE(CC_HAS_PROTOS)
215fi
216fi
217])dnl
218dnl ---------------------------------------------------------------------------
219dnl CF_ANSI_CC_REQD version: 3 updated: 1997/09/06 13:40:44
220dnl ---------------
221dnl For programs that must use an ANSI compiler, obtain compiler options that
222dnl will make it recognize prototypes. We'll do preprocessor checks in other
223dnl macros, since tools such as unproto can fake prototypes, but only part of
224dnl the preprocessor.
225AC_DEFUN([CF_ANSI_CC_REQD],
226[AC_REQUIRE([CF_ANSI_CC_CHECK])
227if test "$cf_cv_ansi_cc" = "no"; then
228 AC_ERROR(
229[Your compiler does not appear to recognize prototypes.
230You have the following choices:
231 a. adjust your compiler options
232 b. get an up-to-date compiler
233 c. use a wrapper such as unproto])
234fi
235])dnl
236dnl ---------------------------------------------------------------------------
237dnl CF_BOOL_DECL version: 8 updated: 2004/01/30 15:51:18
238dnl ------------
239dnl Test if 'bool' is a builtin type in the configured C++ compiler. Some
240dnl older compilers (e.g., gcc 2.5.8) don't support 'bool' directly; gcc
241dnl 2.6.3 does, in anticipation of the ANSI C++ standard.
242dnl
243dnl Treat the configuration-variable specially here, since we're directly
244dnl substituting its value (i.e., 1/0).
245dnl
246dnl $1 is the shell variable to store the result in, if not $cv_cv_builtin_bool
247AC_DEFUN([CF_BOOL_DECL],
248[
249AC_MSG_CHECKING(if we should include stdbool.h)
250
251AC_CACHE_VAL(cf_cv_header_stdbool_h,[
252 AC_TRY_COMPILE([],[bool foo = false],
253 [cf_cv_header_stdbool_h=0],
254 [AC_TRY_COMPILE([
255#ifndef __BEOS__
256#include <stdbool.h>
257#endif
258],[bool foo = false],
259 [cf_cv_header_stdbool_h=1],
260 [cf_cv_header_stdbool_h=0])])])
261
262if test "$cf_cv_header_stdbool_h" = 1
263then AC_MSG_RESULT(yes)
264else AC_MSG_RESULT(no)
265fi
266
267AC_MSG_CHECKING([for builtin bool type])
268
269AC_CACHE_VAL(ifelse($1,,cf_cv_builtin_bool,[$1]),[
270 AC_TRY_COMPILE([
271#include <stdio.h>
272#include <sys/types.h>
273],[bool x = false],
274 [ifelse($1,,cf_cv_builtin_bool,[$1])=1],
275 [ifelse($1,,cf_cv_builtin_bool,[$1])=0])
276 ])
277
278if test "$ifelse($1,,cf_cv_builtin_bool,[$1])" = 1
279then AC_MSG_RESULT(yes)
280else AC_MSG_RESULT(no)
281fi
282])dnl
283dnl ---------------------------------------------------------------------------
284dnl CF_BOOL_SIZE version: 10 updated: 2002/02/23 20:38:31
285dnl ------------
286dnl Test for the size of 'bool' in the configured C++ compiler (e.g., a type).
287dnl Don't bother looking for bool.h, since it's been deprecated.
288dnl
289dnl If the current compiler is C rather than C++, we get the bool definition
290dnl from <stdbool.h>.
291AC_DEFUN([CF_BOOL_SIZE],
292[
293AC_MSG_CHECKING([for size of bool])
294AC_CACHE_VAL(cf_cv_type_of_bool,[
295 rm -f cf_test.out
296 AC_TRY_RUN([
297#include <stdlib.h>
298#include <stdio.h>
299
300#if defined(__cplusplus)
301
302#ifdef HAVE_GXX_BUILTIN_H
303#include <g++/builtin.h>
304#elif HAVE_GPP_BUILTIN_H
305#include <gpp/builtin.h>
306#elif HAVE_BUILTIN_H
307#include <builtin.h>
308#endif
309
310#else
311
312#if $cf_cv_header_stdbool_h
313#include <stdbool.h>
314#endif
315
316#endif
317
318main()
319{
320 FILE *fp = fopen("cf_test.out", "w");
321 if (fp != 0) {
322 bool x = true;
323 if ((bool)(-x) >= 0)
324 fputs("unsigned ", fp);
325 if (sizeof(x) == sizeof(int)) fputs("int", fp);
326 else if (sizeof(x) == sizeof(char)) fputs("char", fp);
327 else if (sizeof(x) == sizeof(short))fputs("short",fp);
328 else if (sizeof(x) == sizeof(long)) fputs("long", fp);
329 fclose(fp);
330 }
331 exit(0);
332}
333 ],
334 [cf_cv_type_of_bool=`cat cf_test.out`
335 if test -z "$cf_cv_type_of_bool"; then
336 cf_cv_type_of_bool=unknown
337 fi],
338 [cf_cv_type_of_bool=unknown],
339 [cf_cv_type_of_bool=unknown])
340 ])
341 rm -f cf_test.out
342AC_MSG_RESULT($cf_cv_type_of_bool)
343if test "$cf_cv_type_of_bool" = unknown ; then
344 case .$NCURSES_BOOL in #(vi
345 .auto|.) NCURSES_BOOL=unsigned;;
346 esac
347 AC_MSG_WARN(Assuming $NCURSES_BOOL for type of bool)
348 cf_cv_type_of_bool=$NCURSES_BOOL
349fi
350])dnl
351dnl ---------------------------------------------------------------------------
352dnl CF_BUILD_CC version: 5 updated: 2005/09/24 17:55:52
353dnl -----------
354dnl If we're cross-compiling, allow the user to override the tools and their
355dnl options. The configure script is oriented toward identifying the host
356dnl compiler, etc., but we need a build compiler to generate parts of the
357dnl source.
358dnl
359dnl $1 = default for $CPPFLAGS
360dnl $2 = default for $LIBS
361AC_DEFUN([CF_BUILD_CC],[
362AC_REQUIRE([CF_PROG_EXT])
363if test "$cross_compiling" = yes ; then
364
365 # defaults that we might want to override
366 : ${BUILD_CFLAGS:=''}
367 : ${BUILD_CPPFLAGS:='ifelse([$1],,,[$1])'}
368 : ${BUILD_LDFLAGS:=''}
369 : ${BUILD_LIBS:='ifelse([$2],,,[$2])'}
370 : ${BUILD_EXEEXT:='$x'}
371 : ${BUILD_OBJEXT:='o'}
372
373 AC_ARG_WITH(build-cc,
374 [ --with-build-cc=XXX the build C compiler ($BUILD_CC)],
375 [BUILD_CC="$withval"],
376 [AC_CHECK_PROGS(BUILD_CC, gcc cc cl)])
377 AC_MSG_CHECKING(for native build C compiler)
378 AC_MSG_RESULT($BUILD_CC)
379
380 AC_MSG_CHECKING(for native build C preprocessor)
381 AC_ARG_WITH(build-cpp,
382 [ --with-build-cpp=XXX the build C preprocessor ($BUILD_CPP)],
383 [BUILD_CPP="$withval"],
384 [BUILD_CPP='$(BUILD_CC) -E'])
385 AC_MSG_RESULT($BUILD_CPP)
386
387 AC_MSG_CHECKING(for native build C flags)
388 AC_ARG_WITH(build-cflags,
389 [ --with-build-cflags=XXX the build C compiler-flags ($BUILD_CFLAGS)],
390 [BUILD_CFLAGS="$withval"])
391 AC_MSG_RESULT($BUILD_CFLAGS)
392
393 AC_MSG_CHECKING(for native build C preprocessor-flags)
394 AC_ARG_WITH(build-cppflags,
395 [ --with-build-cppflags=XXX the build C preprocessor-flags ($BUILD_CPPFLAGS)],
396 [BUILD_CPPFLAGS="$withval"])
397 AC_MSG_RESULT($BUILD_CPPFLAGS)
398
399 AC_MSG_CHECKING(for native build linker-flags)
400 AC_ARG_WITH(build-ldflags,
401 [ --with-build-ldflags=XXX the build linker-flags ($BUILD_LDFLAGS)],
402 [BUILD_LDFLAGS="$withval"])
403 AC_MSG_RESULT($BUILD_LDFLAGS)
404
405 AC_MSG_CHECKING(for native build linker-libraries)
406 AC_ARG_WITH(build-libs,
407 [ --with-build-libs=XXX the build libraries ($(BUILD_LIBS)],
408 [BUILD_LIBS="$withval"])
409 AC_MSG_RESULT($BUILD_LIBS)
410
411 # this assumes we're on Unix.
412 BUILD_EXEEXT=
413 BUILD_OBJEXT=o
414
415 : ${BUILD_CC:='$(CC)'}
416
417 if ( test "$BUILD_CC" = "$CC" || test "$BUILD_CC" = '$(CC)' ) ; then
418 AC_MSG_ERROR([Cross-build requires two compilers.
419Use --with-build-cc to specify the native compiler.])
420 fi
421
422else
423 : ${BUILD_CC:='$(CC)'}
424 : ${BUILD_CPP:='$(CPP)'}
425 : ${BUILD_CFLAGS:='$(CFLAGS)'}
426 : ${BUILD_CPPFLAGS:='$(CPPFLAGS)'}
427 : ${BUILD_LDFLAGS:='$(LDFLAGS)'}
428 : ${BUILD_LIBS:='$(LIBS)'}
429 : ${BUILD_EXEEXT:='$x'}
430 : ${BUILD_OBJEXT:='o'}
431fi
432
433AC_SUBST(BUILD_CC)
434AC_SUBST(BUILD_CPP)
435AC_SUBST(BUILD_CFLAGS)
436AC_SUBST(BUILD_CPPFLAGS)
437AC_SUBST(BUILD_LDFLAGS)
438AC_SUBST(BUILD_LIBS)
439AC_SUBST(BUILD_EXEEXT)
440AC_SUBST(BUILD_OBJEXT)
441])dnl
442dnl ---------------------------------------------------------------------------
443dnl CF_CFG_DEFAULTS version: 7 updated: 2005/09/24 16:15:00
444dnl ---------------
445dnl Determine the default configuration into which we'll install ncurses. This
446dnl can be overridden by the user's command-line options. There's two items to
447dnl look for:
448dnl 1. the prefix (e.g., /usr)
449dnl 2. the header files (e.g., /usr/include/ncurses)
450dnl We'll look for a previous installation of ncurses and use the same defaults.
451dnl
452dnl We don't use AC_PREFIX_DEFAULT, because it gets evaluated too soon, and
453dnl we don't use AC_PREFIX_PROGRAM, because we cannot distinguish ncurses's
454dnl programs from a vendor's.
455AC_DEFUN([CF_CFG_DEFAULTS],
456[
457AC_MSG_CHECKING(for prefix)
458if test "x$prefix" = "xNONE" ; then
459 case "$cf_cv_system_name" in
460 # non-vendor systems don't have a conflict
461 openbsd*|freebsd*|linux*|cygwin*|k*bsd*-gnu)
462 prefix=/usr
463 ;;
464 *) prefix=$ac_default_prefix
465 ;;
466 esac
467fi
468AC_MSG_RESULT($prefix)
469
470if test "x$prefix" = "xNONE" ; then
471AC_MSG_CHECKING(for default include-directory)
472test -n "$verbose" && echo 1>&AC_FD_MSG
473for cf_symbol in \
474 $includedir \
475 $includedir/ncurses \
476 $prefix/include \
477 $prefix/include/ncurses \
478 /usr/local/include \
479 /usr/local/include/ncurses \
480 /usr/include \
481 /usr/include/ncurses
482do
483 cf_dir=`eval echo $cf_symbol`
484 if test -f $cf_dir/curses.h ; then
485 if ( fgrep NCURSES_VERSION $cf_dir/curses.h 2>&1 >/dev/null ) ; then
486 includedir="$cf_symbol"
487 test -n "$verbose" && echo $ac_n " found " 1>&AC_FD_MSG
488 break
489 fi
490 fi
491 test -n "$verbose" && echo " tested $cf_dir" 1>&AC_FD_MSG
492done
493AC_MSG_RESULT($includedir)
494fi
495])dnl
496dnl ---------------------------------------------------------------------------
497dnl CF_CGETENT version: 3 updated: 2000/08/12 23:18:52
498dnl ----------
499dnl Check if the terminal-capability database functions are available. If not,
500dnl ncurses has a much-reduced version.
501AC_DEFUN([CF_CGETENT],[
502AC_MSG_CHECKING(for terminal-capability database functions)
503AC_CACHE_VAL(cf_cv_cgetent,[
504AC_TRY_LINK([
505#include <stdlib.h>],[
506 char temp[128];
507 char *buf = temp;
508 char *db_array = temp;
509 cgetent(&buf, /* int *, */ &db_array, "vt100");
510 cgetcap(buf, "tc", '=');
511 cgetmatch(buf, "tc");
512 ],
513 [cf_cv_cgetent=yes],
514 [cf_cv_cgetent=no])
515])
516AC_MSG_RESULT($cf_cv_cgetent)
517test "$cf_cv_cgetent" = yes && AC_DEFINE(HAVE_BSD_CGETENT)
518])dnl
519dnl ---------------------------------------------------------------------------
520dnl CF_CHECK_CACHE version: 10 updated: 2004/05/23 13:03:31
521dnl --------------
522dnl Check if we're accidentally using a cache from a different machine.
523dnl Derive the system name, as a check for reusing the autoconf cache.
524dnl
525dnl If we've packaged config.guess and config.sub, run that (since it does a
526dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow
527dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM
528dnl which is useful in cross-compiles.
529dnl
530dnl Note: we would use $ac_config_sub, but that is one of the places where
531dnl autoconf 2.5x broke compatibility with autoconf 2.13
532AC_DEFUN([CF_CHECK_CACHE],
533[
534if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then
535 ifelse([$1],,[AC_CANONICAL_HOST],[$1])
536 system_name="$host_os"
537else
538 system_name="`(uname -s -r) 2>/dev/null`"
539 if test -z "$system_name" ; then
540 system_name="`(hostname) 2>/dev/null`"
541 fi
542fi
543test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name")
544AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
545
546test -z "$system_name" && system_name="$cf_cv_system_name"
547test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name)
548
549if test ".$system_name" != ".$cf_cv_system_name" ; then
550 AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name))
551 AC_ERROR("Please remove config.cache and try again.")
552fi
553])dnl
554dnl ---------------------------------------------------------------------------
555dnl CF_CHECK_ERRNO version: 9 updated: 2001/12/30 18:03:23
556dnl --------------
557dnl Check for data that is usually declared in <stdio.h> or <errno.h>, e.g.,
558dnl the 'errno' variable. Define a DECL_xxx symbol if we must declare it
559dnl ourselves.
560dnl
561dnl $1 = the name to check
562AC_DEFUN([CF_CHECK_ERRNO],
563[
564AC_CACHE_CHECK(if external $1 is declared, cf_cv_dcl_$1,[
565 AC_TRY_COMPILE([
566#ifdef HAVE_STDLIB_H
567#include <stdlib.h>
568#endif
569#include <stdio.h>
570#include <sys/types.h>
571#include <errno.h> ],
572 [long x = (long) $1],
573 [cf_cv_dcl_$1=yes],
574 [cf_cv_dcl_$1=no])
575])
576
577if test "$cf_cv_dcl_$1" = no ; then
578 CF_UPPER(cf_result,decl_$1)
579 AC_DEFINE_UNQUOTED($cf_result)
580fi
581
582# It's possible (for near-UNIX clones) that the data doesn't exist
583CF_CHECK_EXTERN_DATA($1,int)
584])dnl
585dnl ---------------------------------------------------------------------------
586dnl CF_CHECK_EXTERN_DATA version: 3 updated: 2001/12/30 18:03:23
587dnl --------------------
588dnl Check for existence of external data in the current set of libraries. If
589dnl we can modify it, it's real enough.
590dnl $1 = the name to check
591dnl $2 = its type
592AC_DEFUN([CF_CHECK_EXTERN_DATA],
593[
594AC_CACHE_CHECK(if external $1 exists, cf_cv_have_$1,[
595 AC_TRY_LINK([
596#undef $1
597extern $2 $1;
598],
599 [$1 = 2],
600 [cf_cv_have_$1=yes],
601 [cf_cv_have_$1=no])
602])
603
604if test "$cf_cv_have_$1" = yes ; then
605 CF_UPPER(cf_result,have_$1)
606 AC_DEFINE_UNQUOTED($cf_result)
607fi
608
609])dnl
610dnl ---------------------------------------------------------------------------
611dnl CF_CPP_PARAM_INIT version: 4 updated: 2001/04/07 22:31:18
612dnl -----------------
613dnl Check if the C++ compiler accepts duplicate parameter initialization. This
614dnl is a late feature for the standard and is not in some recent compilers
615dnl (1999/9/11).
616AC_DEFUN([CF_CPP_PARAM_INIT],
617[
618if test -n "$CXX"; then
619AC_CACHE_CHECK(if $CXX accepts parameter initialization,cf_cv_cpp_param_init,[
620 AC_LANG_SAVE
621 AC_LANG_CPLUSPLUS
622 AC_TRY_RUN([
623class TEST {
624private:
625 int value;
626public:
627 TEST(int x = 1);
628 ~TEST();
629};
630
631TEST::TEST(int x = 1) // some compilers do not like second initializer
632{
633 value = x;
634}
635void main() { }
636],
637 [cf_cv_cpp_param_init=yes],
638 [cf_cv_cpp_param_init=no],
639 [cf_cv_cpp_param_init=unknown])
640 AC_LANG_RESTORE
641])
642fi
643test "$cf_cv_cpp_param_init" = yes && AC_DEFINE(CPP_HAS_PARAM_INIT)
644])dnl
645dnl ---------------------------------------------------------------------------
646dnl CF_CPP_STATIC_CAST version: 1 updated: 2005/07/23 16:52:43
647dnl ------------------
648dnl Check if the C++ compiler accepts static_cast in generics. This appears to
649dnl not be supported in g++ before 3.0
650AC_DEFUN([CF_CPP_STATIC_CAST],
651[
652if test -n "$CXX"; then
653
654AC_CACHE_CHECK(if $CXX accepts static_cast,cf_cv_cpp_static_cast,[
655 AC_LANG_SAVE
656 AC_LANG_CPLUSPLUS
657
658 AC_TRY_COMPILE([
659class NCursesPanel
660{
661public:
662 NCursesPanel(int nlines,
663 int ncols,
664 int begin_y = 0,
665 int begin_x = 0)
666 {
667 }
668
669 ~NCursesPanel();
670};
671
672template<class T> class NCursesUserPanel : public NCursesPanel
673{
674public:
675 NCursesUserPanel (int nlines,
676 int ncols,
677 int begin_y = 0,
678 int begin_x = 0,
679 const T* p_UserData = static_cast<T*>(0))
680 : NCursesPanel (nlines, ncols, begin_y, begin_x)
681 {
682 };
683 NCursesUserPanel(const T* p_UserData = static_cast<T*>(0)) : NCursesPanel()
684 {
685 };
686
687 virtual ~NCursesUserPanel() {};
688};
689],[
690 const char* p_UserData = static_cast<char*>(0)],
691 [cf_cv_cpp_static_cast=yes],
692 [cf_cv_cpp_static_cast=no])
693
694 AC_LANG_RESTORE
695])
696
697fi
698
699test "$cf_cv_cpp_static_cast" = yes && AC_DEFINE(CPP_HAS_STATIC_CAST)
700])dnl
701dnl ---------------------------------------------------------------------------
702dnl CF_CPP_VSCAN_FUNC version: 5 updated: 2001/12/02 01:39:28
703dnl -----------------
704dnl Check if the g++ compiler supports vscan function (not a standard feature).
705AC_DEFUN([CF_CPP_VSCAN_FUNC],
706[
707if test -n "$CXX"; then
708
709AC_LANG_SAVE
710AC_LANG_CPLUSPLUS
711AC_CHECK_HEADERS(strstream.h)
712
713AC_CACHE_CHECK(if $CXX supports vscan function,cf_cv_cpp_vscan_func,[
714 for cf_vscan_func in strstream strstream_cast stdio
715 do
716 case $cf_vscan_func in #(vi
717 stdio) cf_vscan_defs=USE_STDIO_VSCAN ;; #(vi
718 strstream) cf_vscan_defs=USE_STRSTREAM_VSCAN ;;
719 strstream_cast) cf_vscan_defs=USE_STRSTREAM_VSCAN_CAST ;;
720 esac
721 AC_TRY_LINK([
722#include <stdio.h>
723#include <stdarg.h>
724#define $cf_vscan_defs 1
725#if defined(USE_STDIO_VSCAN)
726#elif defined(HAVE_STRSTREAM_H) && defined(USE_STRSTREAM_VSCAN)
727#include <strstream.h>
728#endif
729
730int scanw(const char* fmt, ...)
731{
732 int result = -1;
733 char buf[BUFSIZ];
734
735 va_list args;
736 va_start(args, fmt);
737#if defined(USE_STDIO_VSCAN)
738 if (::vsscanf(buf, fmt, args) != -1)
739 result = 0;
740#elif defined(USE_STRSTREAM_VSCAN)
741 strstreambuf ss(buf, sizeof(buf));
742 if (ss.vscan(fmt, args) != -1)
743 result = 0;
744#elif defined(USE_STRSTREAM_VSCAN_CAST)
745 strstreambuf ss(buf, sizeof(buf));
746 if (ss.vscan(fmt, (_IO_va_list)args) != -1)
747 result = 0;
748#else
749#error case $cf_vscan_func failed
750#endif
751 va_end(args);
752 return result;
753}
754],[int tmp, foo = scanw("%d", &tmp)],
755 [cf_cv_cpp_vscan_func=$cf_vscan_func; break],
756 [cf_cv_cpp_vscan_func=no])
757 test "$cf_cv_cpp_vscan_func" != no && break
758 done
759])
760
761AC_LANG_RESTORE
762fi
763
764case $cf_cv_cpp_vscan_func in #(vi
765stdio) #(vi
766 AC_DEFINE(CPP_HAS_VSCAN_FUNC)
767 AC_DEFINE(USE_STDIO_VSCAN)
768 ;;
769strstream)
770 AC_DEFINE(CPP_HAS_VSCAN_FUNC)
771 AC_DEFINE(USE_STRSTREAM_VSCAN)
772 ;;
773strstream_cast)
774 AC_DEFINE(CPP_HAS_VSCAN_FUNC)
775 AC_DEFINE(USE_STRSTREAM_VSCAN_CAST)
776 ;;
777esac
778])dnl
779dnl ---------------------------------------------------------------------------
780dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52
781dnl ----------
782dnl "dirname" is not portable, so we fake it with a shell script.
783AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl
784dnl ---------------------------------------------------------------------------
785dnl CF_DIRS_TO_MAKE version: 3 updated: 2002/02/23 20:38:31
786dnl ---------------
787AC_DEFUN([CF_DIRS_TO_MAKE],
788[
789DIRS_TO_MAKE="lib"
790for cf_item in $cf_list_models
791do
792 CF_OBJ_SUBDIR($cf_item,cf_subdir)
793 for cf_item2 in $DIRS_TO_MAKE
794 do
795 test $cf_item2 = $cf_subdir && break
796 done
797 test ".$cf_item2" != ".$cf_subdir" && DIRS_TO_MAKE="$DIRS_TO_MAKE $cf_subdir"
798done
799for cf_dir in $DIRS_TO_MAKE
800do
801 test ! -d $cf_dir && mkdir $cf_dir
802done
803AC_SUBST(DIRS_TO_MAKE)
804])dnl
805dnl ---------------------------------------------------------------------------
806dnl CF_ERRNO version: 5 updated: 1997/11/30 12:44:39
807dnl --------
808dnl Check if 'errno' is declared in <errno.h>
809AC_DEFUN([CF_ERRNO],
810[
811CF_CHECK_ERRNO(errno)
812])dnl
813dnl ---------------------------------------------------------------------------
814dnl CF_ETIP_DEFINES version: 3 updated: 2003/03/22 19:13:43
815dnl ---------------
816dnl Test for conflicting definitions of exception in gcc 2.8.0, etc., between
817dnl math.h and builtin.h, only for ncurses
818AC_DEFUN([CF_ETIP_DEFINES],
819[
820AC_MSG_CHECKING(for special defines needed for etip.h)
821cf_save_CXXFLAGS="$CXXFLAGS"
822cf_result="none"
823for cf_math in "" MATH_H
824do
825for cf_excp in "" MATH_EXCEPTION
826do
827 CXXFLAGS="$cf_save_CXXFLAGS -I${srcdir}/c++ -I${srcdir}/menu -I${srcdir}/include"
828 test -n "$cf_math" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_math}"
829 test -n "$cf_excp" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_excp}"
830AC_TRY_COMPILE([
831#include <etip.h.in>
832],[],[
833 test -n "$cf_math" && AC_DEFINE_UNQUOTED(ETIP_NEEDS_${cf_math})
834 test -n "$cf_excp" && AC_DEFINE_UNQUOTED(ETIP_NEEDS_${cf_excp})
835 cf_result="$cf_math $cf_excp"
836 break
837],[])
838done
839done
840AC_MSG_RESULT($cf_result)
841CXXFLAGS="$cf_save_CXXFLAGS"
842])
843dnl ---------------------------------------------------------------------------
844dnl CF_FUNC_DLSYM version: 1 updated: 2004/06/16 20:52:45
845dnl -------------
846dnl Test for dlsym() and related functions, as well as libdl.
847dnl
848dnl Sets
849dnl $cf_have_dlsym
850dnl $cf_have_libdl
851AC_DEFUN([CF_FUNC_DLSYM],[
852cf_have_dlsym=no
853AC_CHECK_FUNC(dlsym,cf_have_dlsym=yes,[
854
855cf_have_libdl=no
856AC_CHECK_LIB(dl,dlsym,[
857 cf_have_dlsym=yes
858 cf_have_libdl=yes])])
859
860if test "$cf_have_dlsym" = yes ; then
861 test "$cf_have_libdl" = yes && LIBS="-ldl $LIBS"
862
863 AC_MSG_CHECKING(whether able to link to dl*() functions)
864 AC_TRY_LINK([#include <dlfcn.h>],[
865 void *obj;
866 if ((obj = dlopen("filename", 0)) != 0) {
867 if (dlsym(obj, "symbolname") == 0) {
868 dlclose(obj);
869 }
870 }],[
871 AC_DEFINE(HAVE_LIBDL)],[
872 AC_MSG_ERROR(Cannot link test program for libdl)])
873 AC_MSG_RESULT(ok)
874else
875 AC_MSG_ERROR(Cannot find dlsym function)
876fi
877])
878dnl ---------------------------------------------------------------------------
879dnl CF_FUNC_MEMMOVE version: 5 updated: 2000/08/12 23:18:52
880dnl ---------------
881dnl Check for memmove, or a bcopy that can handle overlapping copy. If neither
882dnl is found, add our own version of memmove to the list of objects.
883AC_DEFUN([CF_FUNC_MEMMOVE],
884[
885AC_CHECK_FUNC(memmove,,[
886AC_CHECK_FUNC(bcopy,[
887 AC_CACHE_CHECK(if bcopy does overlapping moves,cf_cv_good_bcopy,[
888 AC_TRY_RUN([
889int main() {
890 static char data[] = "abcdefghijklmnopqrstuwwxyz";
891 char temp[40];
892 bcopy(data, temp, sizeof(data));
893 bcopy(temp+10, temp, 15);
894 bcopy(temp+5, temp+15, 10);
895 exit (strcmp(temp, "klmnopqrstuwwxypqrstuwwxyz"));
896}
897 ],
898 [cf_cv_good_bcopy=yes],
899 [cf_cv_good_bcopy=no],
900 [cf_cv_good_bcopy=unknown])
901 ])
902 ],[cf_cv_good_bcopy=no])
903 if test "$cf_cv_good_bcopy" = yes ; then
904 AC_DEFINE(USE_OK_BCOPY)
905 else
906 AC_DEFINE(USE_MY_MEMMOVE)
907 fi
908])])dnl
909dnl ---------------------------------------------------------------------------
910dnl CF_FUNC_NANOSLEEP version: 1 updated: 2005/07/02 15:38:12
911dnl -----------------
912dnl Check for existence of workable nanosleep() function. Some systems, e.g.,
913dnl AIX 4.x, provide a non-working version.
914AC_DEFUN([CF_FUNC_NANOSLEEP],[
915AC_CACHE_CHECK(if nanosleep really works,cf_cv_func_nanosleep,[
916AC_TRY_RUN([
917#include <stdio.h>
918#include <errno.h>
919#include <time.h>
920
921#ifdef HAVE_SYS_TIME_H
922#include <sys/time.h>
923#endif
924
925int main() {
926 struct timespec ts1, ts2;
927 int code;
928 ts1.tv_sec = 0;
929 ts1.tv_nsec = 750000000;
930 ts2.tv_sec = 0;
931 ts2.tv_nsec = 0;
932 errno = 0;
933 code = nanosleep(&ts1, &ts2); /* on failure errno is ENOSYS. */
934 exit(code != 0);
935}
936],
937 [cf_cv_func_nanosleep=yes],
938 [cf_cv_func_nanosleep=no],
939 [cf_cv_func_nanosleep=unknown])])
940
941test "$cf_cv_func_nanosleep" = "yes" && AC_DEFINE(HAVE_NANOSLEEP)
942])
943dnl ---------------------------------------------------------------------------
944dnl CF_FUNC_POLL version: 2 updated: 2000/02/06 01:38:04
945dnl ------------
946dnl See if the poll function really works. Some platforms have poll(), but
947dnl it does not work for terminals or files.
948AC_DEFUN([CF_FUNC_POLL],[
949AC_CACHE_CHECK(if poll really works,cf_cv_working_poll,[
950AC_TRY_RUN([
951#include <stdio.h>
952#ifdef HAVE_POLL_H
953#include <poll.h>
954#else
955#include <sys/poll.h>
956#endif
957int main() {
958 struct pollfd myfds;
959 int ret;
960
961 myfds.fd = 0;
962 myfds.events = POLLIN;
963
964 ret = poll(&myfds, 1, 100);
965 exit(ret != 0);
966}],
967 [cf_cv_working_poll=yes],
968 [cf_cv_working_poll=no],
969 [cf_cv_working_poll=unknown])])
970test "$cf_cv_working_poll" = "yes" && AC_DEFINE(HAVE_WORKING_POLL)
971])dnl
972dnl ---------------------------------------------------------------------------
973dnl CF_FUNC_TERMIOS version: 2 updated: 2000/07/22 23:37:24
974dnl ---------------
975dnl Some old/broken variations define tcgetattr() only as a macro in
976dnl termio(s).h
977AC_DEFUN([CF_FUNC_TERMIOS],[
978AC_REQUIRE([CF_STRUCT_TERMIOS])
979AC_CACHE_CHECK(for tcgetattr, cf_cv_have_tcgetattr,[
980AC_TRY_LINK([
981#include <sys/types.h>
982#ifdef HAVE_UNISTD_H
983#include <unistd.h>
984#endif
985#ifdef HAVE_TERMIOS_H
986#include <termios.h>
987#define TTY struct termios
988#else
989#ifdef HAVE_TERMIO_H
990#include <termio.h>
991#define TTY struct termio
992#endif
993#endif
994],[
995TTY foo;
996tcgetattr(1, &foo);],
997[cf_cv_have_tcgetattr=yes],
998[cf_cv_have_tcgetattr=no])])
999test "$cf_cv_have_tcgetattr" = yes && AC_DEFINE(HAVE_TCGETATTR)
1000])dnl
1001dnl ---------------------------------------------------------------------------
1002dnl CF_FUNC_VSSCANF version: 3 updated: 2001/12/19 00:50:10
1003dnl ---------------
1004dnl Check for vsscanf() function, which is in c9x but generally not in earlier
1005dnl versions of C. It is in the GNU C library, and can often be simulated by
1006dnl other functions.
1007AC_DEFUN([CF_FUNC_VSSCANF],
1008[
1009AC_CACHE_CHECK(for vsscanf function or workaround,cf_cv_func_vsscanf,[
1010AC_TRY_LINK([
1011#include <stdarg.h>
1012#include <stdio.h>],[
1013 va_list ap;
1014 vsscanf("from", "%d", ap)],[cf_cv_func_vsscanf=vsscanf],[
1015AC_TRY_LINK([
1016#include <stdarg.h>
1017#include <stdio.h>],[
1018 FILE strbuf;
1019 char *str = "from";
1020
1021 strbuf._flag = _IOREAD;
1022 strbuf._ptr = strbuf._base = (unsigned char *) str;
1023 strbuf._cnt = strlen(str);
1024 strbuf._file = _NFILE;
1025 return (vfscanf(&strbuf, "%d", ap))],[cf_cv_func_vsscanf=vfscanf],[
1026AC_TRY_LINK([
1027#include <stdarg.h>
1028#include <stdio.h>],[
1029 FILE strbuf;
1030 char *str = "from";
1031
1032 strbuf._flag = _IOREAD;
1033 strbuf._ptr = strbuf._base = (unsigned char *) str;
1034 strbuf._cnt = strlen(str);
1035 strbuf._file = _NFILE;
1036 return (_doscan(&strbuf, "%d", ap))],[cf_cv_func_vsscanf=_doscan],[
1037cf_cv_func_vsscanf=no])])])])
1038
1039case $cf_cv_func_vsscanf in #(vi
1040vsscanf) AC_DEFINE(HAVE_VSSCANF);; #(vi
1041vfscanf) AC_DEFINE(HAVE_VFSCANF);; #(vi
1042_doscan) AC_DEFINE(HAVE__DOSCAN);;
1043esac
1044
1045])dnl
1046dnl ---------------------------------------------------------------------------
1047dnl CF_GCC_ATTRIBUTES version: 10 updated: 2005/05/28 13:16:28
1048dnl -----------------
1049dnl Test for availability of useful gcc __attribute__ directives to quiet
1050dnl compiler warnings. Though useful, not all are supported -- and contrary
1051dnl to documentation, unrecognized directives cause older compilers to barf.
1052AC_DEFUN([CF_GCC_ATTRIBUTES],
1053[
1054if test "$GCC" = yes
1055then
1056cat > conftest.i <<EOF
1057#ifndef GCC_PRINTF
1058#define GCC_PRINTF 0
1059#endif
1060#ifndef GCC_SCANF
1061#define GCC_SCANF 0
1062#endif
1063#ifndef GCC_NORETURN
1064#define GCC_NORETURN /* nothing */
1065#endif
1066#ifndef GCC_UNUSED
1067#define GCC_UNUSED /* nothing */
1068#endif
1069EOF
1070if test "$GCC" = yes
1071then
1072 AC_CHECKING([for $CC __attribute__ directives])
1073cat > conftest.$ac_ext <<EOF
1074#line __oline__ "configure"
1075#include "confdefs.h"
1076#include "conftest.h"
1077#include "conftest.i"
1078#if GCC_PRINTF
1079#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
1080#else
1081#define GCC_PRINTFLIKE(fmt,var) /*nothing*/
1082#endif
1083#if GCC_SCANF
1084#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
1085#else
1086#define GCC_SCANFLIKE(fmt,var) /*nothing*/
1087#endif
1088extern void wow(char *,...) GCC_SCANFLIKE(1,2);
1089extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
1090extern void foo(void) GCC_NORETURN;
1091int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; }
1092EOF
1093 for cf_attribute in scanf printf unused noreturn
1094 do
1095 CF_UPPER(cf_ATTRIBUTE,$cf_attribute)
1096 cf_directive="__attribute__(($cf_attribute))"
1097 echo "checking for $CC $cf_directive" 1>&AC_FD_CC
1098 case $cf_attribute in
1099 scanf|printf)
1100 cat >conftest.h <<EOF
1101#define GCC_$cf_ATTRIBUTE 1
1102EOF
1103 ;;
1104 *)
1105 cat >conftest.h <<EOF
1106#define GCC_$cf_ATTRIBUTE $cf_directive
1107EOF
1108 ;;
1109 esac
1110 if AC_TRY_EVAL(ac_compile); then
1111 test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute)
1112 cat conftest.h >>confdefs.h
1113 fi
1114 done
1115else
1116 fgrep define conftest.i >>confdefs.h
1117fi
1118rm -rf conftest*
1119fi
1120])dnl
1121dnl ---------------------------------------------------------------------------
1122dnl CF_GCC_VERSION version: 4 updated: 2005/08/27 09:53:42
1123dnl --------------
1124dnl Find version of gcc
1125AC_DEFUN([CF_GCC_VERSION],[
1126AC_REQUIRE([AC_PROG_CC])
1127GCC_VERSION=none
1128if test "$GCC" = yes ; then
1129 AC_MSG_CHECKING(version of $CC)
1130 GCC_VERSION="`${CC} --version| sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
1131 test -z "$GCC_VERSION" && GCC_VERSION=unknown
1132 AC_MSG_RESULT($GCC_VERSION)
1133fi
1134])dnl
1135dnl ---------------------------------------------------------------------------
1136dnl CF_GCC_WARNINGS version: 20 updated: 2005/08/06 18:37:29
1137dnl ---------------
1138dnl Check if the compiler supports useful warning options. There's a few that
1139dnl we don't use, simply because they're too noisy:
1140dnl
1141dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x)
1142dnl -Wredundant-decls (system headers make this too noisy)
1143dnl -Wtraditional (combines too many unrelated messages, only a few useful)
1144dnl -Wwrite-strings (too noisy, but should review occasionally). This
1145dnl is enabled for ncurses using "--enable-const".
1146dnl -pedantic
1147dnl
1148dnl Parameter:
1149dnl $1 is an optional list of gcc warning flags that a particular
1150dnl application might want to use, e.g., "no-unused" for
1151dnl -Wno-unused
1152dnl Special:
1153dnl If $with_ext_const is "yes", add a check for -Wwrite-strings
1154dnl
1155AC_DEFUN([CF_GCC_WARNINGS],
1156[
1157AC_REQUIRE([CF_GCC_VERSION])
1158CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)
1159
1160cat > conftest.$ac_ext <<EOF
1161#line __oline__ "configure"
1162int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
1163EOF
1164
1165if test "$INTEL_COMPILER" = yes
1166then
1167# The "-wdXXX" options suppress warnings:
1168# remark #1419: external declaration in primary source file
1169# remark #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
1170# remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
1171# remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
1172# remark #193: zero used for undefined preprocessing identifier
1173# remark #593: variable "curs_sb_left_arrow" was set but never used
1174# remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
1175# remark #869: parameter "tw" was never referenced
1176# remark #981: operands are evaluated in unspecified order
1177# warning #269: invalid format string conversion
1178
1179 AC_CHECKING([for $CC warning options])
1180 cf_save_CFLAGS="$CFLAGS"
1181 EXTRA_CFLAGS="-Wall"
1182 for cf_opt in $1 \
1183 wd1419 \
1184 wd1682 \
1185 wd1683 \
1186 wd1684 \
1187 wd193 \
1188 wd279 \
1189 wd593 \
1190 wd810 \
1191 wd869 \
1192 wd981
1193 do
1194 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
1195 if AC_TRY_EVAL(ac_compile); then
1196 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
1197 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
1198 fi
1199 done
1200 CFLAGS="$cf_save_CFLAGS"
1201
1202elif test "$GCC" = yes
1203then
1204 AC_CHECKING([for $CC warning options])
1205 cf_save_CFLAGS="$CFLAGS"
1206 EXTRA_CFLAGS="-W -Wall"
1207 cf_warn_CONST=""
1208 test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
1209 for cf_opt in \
1210 Wbad-function-cast \
1211 Wcast-align \
1212 Wcast-qual \
1213 Winline \
1214 Wmissing-declarations \
1215 Wmissing-prototypes \
1216 Wnested-externs \
1217 Wpointer-arith \
1218 Wshadow \
1219 Wstrict-prototypes \
1220 Wundef $cf_warn_CONST $1
1221 do
1222 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
1223 if AC_TRY_EVAL(ac_compile); then
1224 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
1225 case $cf_opt in #(vi
1226 Wcast-qual) #(vi
1227 CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES"
1228 ;;
1229 Winline) #(vi
1230 case $GCC_VERSION in
1231 3.3*)
1232 CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
1233 continue;;
1234 esac
1235 ;;
1236 esac
1237 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
1238 fi
1239 done
1240 CFLAGS="$cf_save_CFLAGS"
1241fi
1242rm -f conftest*
1243
1244AC_SUBST(EXTRA_CFLAGS)
1245])dnl
1246dnl ---------------------------------------------------------------------------
1247dnl CF_GNAT_TRY_LINK version: 1 updated: 2004/08/21 19:02:08
1248dnl ----------------
1249dnl Verify that a test program compiles/links with GNAT.
1250dnl $cf_ada_make is set to the program that compiles/links
1251dnl $ADAFLAGS may be set to the GNAT flags.
1252dnl
1253dnl $1 is the text of the spec
1254dnl $2 is the text of the body
1255dnl $3 is the shell command to execute if successful
1256dnl $4 is the shell command to execute if not successful
1257AC_DEFUN([CF_GNAT_TRY_LINK],
1258[
1259rm -f conftest*
1260cat >>conftest.ads <<CF_EOF
1261$1
1262CF_EOF
1263cat >>conftest.adb <<CF_EOF
1264$2
1265CF_EOF
1266if ( $cf_ada_make $ADAFLAGS conftest 1>&AC_FD_CC 2>&1 ) ; then
1267ifelse($3,, :,[ $3])
1268ifelse($4,,,[else
1269 $4])
1270fi
1271rm -f conftest*
1272])dnl
1273dnl ---------------------------------------------------------------------------
1274dnl CF_GNAT_TRY_RUN version: 3 updated: 2004/08/21 19:02:08
1275dnl ---------------
1276dnl Verify that a test program compiles and runs with GNAT
1277dnl $cf_ada_make is set to the program that compiles/links
1278dnl $ADAFLAGS may be set to the GNAT flags.
1279dnl
1280dnl $1 is the text of the spec
1281dnl $2 is the text of the body
1282dnl $3 is the shell command to execute if successful
1283dnl $4 is the shell command to execute if not successful
1284AC_DEFUN([CF_GNAT_TRY_RUN],
1285[
1286rm -f conftest*
1287cat >>conftest.ads <<CF_EOF
1288$1
1289CF_EOF
1290cat >>conftest.adb <<CF_EOF
1291$2
1292CF_EOF
1293if ( $cf_ada_make $ADAFLAGS conftest 1>&AC_FD_CC 2>&1 ) ; then
1294 if ( ./conftest 1>&AC_FD_CC 2>&1 ) ; then
1295ifelse($3,, :,[ $3])
1296ifelse($4,,,[ else
1297 $4])
1298 fi
1299ifelse($4,,,[else
1300 $4])
1301fi
1302rm -f conftest*
1303])dnl
1304dnl ---------------------------------------------------------------------------
1305dnl CF_GNAT_VERSION version: 11 updated: 2003/09/06 19:42:09
1306dnl ---------------
1307dnl Verify version of GNAT.
1308AC_DEFUN([CF_GNAT_VERSION],
1309[
1310AC_MSG_CHECKING(for gnat version)
1311cf_gnat_version=`${cf_ada_make-gnatmake} -v 2>&1 | grep '[[0-9]].[[0-9]][[0-9]]*' |\
1312 sed -e '2,$d' -e 's/[[^0-9 \.]]//g' -e 's/^[[ ]]*//' -e 's/ .*//'`
1313AC_MSG_RESULT($cf_gnat_version)
1314
1315case $cf_gnat_version in
1316 3.1[[1-9]]*|3.[[2-9]]*|[[4-9]].*)
1317 cf_cv_prog_gnat_correct=yes
1318 ;;
1319 *) echo Unsupported GNAT version $cf_gnat_version. Required is 3.11 or better. Disabling Ada95 binding.
1320 cf_cv_prog_gnat_correct=no
1321 ;;
1322esac
1323case $cf_gnat_version in
1324 3.[[1-9]]*|[[4-9]].*)
1325 cf_compile_generics=generics
1326 cf_generic_objects="\$(GENOBJS)"
1327 ;;
1328 *) cf_compile_generics=
1329 cf_generic_objects=
1330 ;;
1331esac
1332])
1333dnl ---------------------------------------------------------------------------
1334dnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07
1335dnl -------------
1336dnl Check if we must define _GNU_SOURCE to get a reasonable value for
1337dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect
1338dnl (or misfeature) of glibc2, which breaks portability of many applications,
1339dnl since it is interwoven with GNU extensions.
1340dnl
1341dnl Well, yes we could work around it...
1342AC_DEFUN([CF_GNU_SOURCE],
1343[
1344AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[
1345AC_TRY_COMPILE([#include <sys/types.h>],[
1346#ifndef _XOPEN_SOURCE
1347make an error
1348#endif],
1349 [cf_cv_gnu_source=no],
1350 [cf_save="$CPPFLAGS"
1351 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
1352 AC_TRY_COMPILE([#include <sys/types.h>],[
1353#ifdef _XOPEN_SOURCE
1354make an error
1355#endif],
1356 [cf_cv_gnu_source=no],
1357 [cf_cv_gnu_source=yes])
1358 CPPFLAGS="$cf_save"
1359 ])
1360])
1361test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
1362])dnl
1363dnl ---------------------------------------------------------------------------
1364dnl CF_GPP_LIBRARY version: 8 updated: 2003/02/02 01:41:46
1365dnl --------------
1366dnl If we're trying to use g++, test if libg++ is installed (a rather common
1367dnl problem :-). If we have the compiler but no library, we'll be able to
1368dnl configure, but won't be able to build the c++ demo program.
1369AC_DEFUN([CF_GPP_LIBRARY],
1370[
1371cf_cxx_library=unknown
1372case $cf_cv_system_name in #(vi
1373os2*) #(vi
1374 cf_gpp_libname=gpp
1375 ;;
1376*)
1377 cf_gpp_libname=g++
1378 ;;
1379esac
1380if test "$GXX" = yes; then
1381 AC_MSG_CHECKING([for lib$cf_gpp_libname])
1382 cf_save="$LIBS"
1383 LIBS="$LIBS -l$cf_gpp_libname"
1384 AC_TRY_LINK([
1385#include <$cf_gpp_libname/builtin.h>
1386 ],
1387 [two_arg_error_handler_t foo2 = lib_error_handler],
1388 [cf_cxx_library=yes
1389 CXXLIBS="$CXXLIBS -l$cf_gpp_libname"
1390 if test "$cf_gpp_libname" = cpp ; then
1391 AC_DEFINE(HAVE_GPP_BUILTIN_H)
1392 else
1393 AC_DEFINE(HAVE_GXX_BUILTIN_H)
1394 fi],
1395 [AC_TRY_LINK([
1396#include <builtin.h>
1397 ],
1398 [two_arg_error_handler_t foo2 = lib_error_handler],
1399 [cf_cxx_library=yes
1400 CXXLIBS="$CXXLIBS -l$cf_gpp_libname"
1401 AC_DEFINE(HAVE_BUILTIN_H)],
1402 [cf_cxx_library=no])])
1403 LIBS="$cf_save"
1404 AC_MSG_RESULT($cf_cxx_library)
1405fi
1406])dnl
1407dnl ---------------------------------------------------------------------------
1408dnl CF_GXX_VERSION version: 5 updated: 2005/08/27 09:53:42
1409dnl --------------
1410dnl Check for version of g++
1411AC_DEFUN([CF_GXX_VERSION],[
1412AC_REQUIRE([AC_PROG_CPP])
1413GXX_VERSION=none
1414if test "$GXX" = yes; then
1415 AC_MSG_CHECKING(version of g++)
1416 GXX_VERSION="`${CXX-g++} --version| sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
1417 test -z "$GXX_VERSION" && GXX_VERSION=unknown
1418 AC_MSG_RESULT($GXX_VERSION)
1419fi
1420])dnl
1421dnl ---------------------------------------------------------------------------
1422dnl CF_GXX_WARNINGS version: 5 updated: 2005/08/13 14:54:38
1423dnl ---------------
1424dnl Check if the compiler supports useful warning options.
1425dnl
1426dnl Most of gcc's options apply to g++, except:
1427dnl -Wbad-function-cast
1428dnl -Wmissing-declarations
1429dnl -Wnested-externs
1430dnl
1431dnl Omit a few (for now):
1432dnl -Winline
1433dnl
1434dnl Parameter:
1435dnl $1 is an optional list of g++ warning flags that a particular
1436dnl application might want to use, e.g., "no-unused" for
1437dnl -Wno-unused
1438dnl Special:
1439dnl If $with_ext_const is "yes", add a check for -Wwrite-strings
1440dnl
1441AC_DEFUN([CF_GXX_WARNINGS],
1442[
1443
1444CF_INTEL_COMPILER(GXX,INTEL_CPLUSPLUS,CXXFLAGS)
1445
1446AC_REQUIRE([CF_GXX_VERSION])
1447
1448AC_LANG_SAVE
1449AC_LANG_CPLUSPLUS
1450
1451cat > conftest.$ac_ext <<EOF
1452#line __oline__ "configure"
1453int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
1454EOF
1455
1456if test "$INTEL_CPLUSPLUS" = yes
1457then
1458# The "-wdXXX" options suppress warnings:
1459# remark #1419: external declaration in primary source file
1460# remark #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
1461# remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
1462# remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
1463# remark #193: zero used for undefined preprocessing identifier
1464# remark #593: variable "curs_sb_left_arrow" was set but never used
1465# remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
1466# remark #869: parameter "tw" was never referenced
1467# remark #981: operands are evaluated in unspecified order
1468# warning #269: invalid format string conversion
1469
1470 AC_CHECKING([for $CC warning options])
1471 cf_save_CXXFLAGS="$CXXFLAGS"
1472 EXTRA_CXXFLAGS="-Wall"
1473 for cf_opt in \
1474 wd1419 \
1475 wd1682 \
1476 wd1683 \
1477 wd1684 \
1478 wd193 \
1479 wd279 \
1480 wd593 \
1481 wd810 \
1482 wd869 \
1483 wd981
1484 do
1485 CXXFLAGS="$cf_save_CXXFLAGS $EXTRA_CXXFLAGS -$cf_opt"
1486 if AC_TRY_EVAL(ac_compile); then
1487 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
1488 EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -$cf_opt"
1489 fi
1490 done
1491 CXXFLAGS="$cf_save_CXXFLAGS"
1492
1493elif test "$GXX" = yes
1494then
1495 AC_CHECKING([for $CXX warning options])
1496 cf_save_CXXFLAGS="$CXXFLAGS"
1497 EXTRA_CXXFLAGS="-W -Wall"
1498 cf_gxx_extra_warnings=""
1499 test "$with_ext_const" = yes && cf_gxx_extra_warnings="Wwrite-strings"
1500 case "$GCC_VERSION" in
1501 [[1-2]].*)
1502 ;;
1503 *)
1504 cf_gxx_extra_warnings="$cf_gxx_extra_warnings Weffc++"
1505 ;;
1506 esac
1507 for cf_opt in \
1508 Wabi \
1509 fabi-version=0 \
1510 Woverloaded-virtual \
1511 Wsign-promo \
1512 Wsynth \
1513 Wold-style-cast \
1514 Wcast-align \
1515 Wcast-qual \
1516 Wmissing-prototypes \
1517 Wpointer-arith \
1518 Wshadow \
1519 Wstrict-prototypes \
1520 Wundef $cf_gxx_extra_warnings $1
1521 do
1522 CXXFLAGS="$cf_save_CXXFLAGS $EXTRA_CXXFLAGS -Werror -$cf_opt"
1523 if AC_TRY_EVAL(ac_compile); then
1524 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
1525 EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -$cf_opt"
1526 else
1527 test -n "$verbose" && AC_MSG_RESULT(... no -$cf_opt)
1528 fi
1529 done
1530 CXXFLAGS="$cf_save_CXXFLAGS"
1531fi
1532
1533rm -f conftest*
1534AC_LANG_RESTORE
1535AC_SUBST(EXTRA_CXXFLAGS)
1536])dnl
1537dnl ---------------------------------------------------------------------------
1538dnl CF_HELP_MESSAGE version: 3 updated: 1998/01/14 10:56:23
1539dnl ---------------
1540dnl Insert text into the help-message, for readability, from AC_ARG_WITH.
1541AC_DEFUN([CF_HELP_MESSAGE],
1542[dnl AC_DIVERT_HELP([$1])dnl
1543])dnl
1544dnl ---------------------------------------------------------------------------
1545dnl CF_INCLUDE_DIRS version: 4 updated: 2002/12/01 00:12:15
1546dnl ---------------
1547dnl Construct the list of include-options according to whether we're building
1548dnl in the source directory or using '--srcdir=DIR' option. If we're building
1549dnl with gcc, don't append the includedir if it happens to be /usr/include,
1550dnl since that usually breaks gcc's shadow-includes.
1551AC_DEFUN([CF_INCLUDE_DIRS],
1552[
1553CPPFLAGS="-I. -I../include $CPPFLAGS"
1554if test "$srcdir" != "."; then
1555 CPPFLAGS="-I\$(srcdir)/../include $CPPFLAGS"
1556fi
1557if test "$GCC" != yes; then
1558 CPPFLAGS="$CPPFLAGS -I\$(includedir)"
1559elif test "$includedir" != "/usr/include"; then
1560 if test "$includedir" = '${prefix}/include' ; then
1561 if test $prefix != /usr ; then
1562 CPPFLAGS="$CPPFLAGS -I\$(includedir)"
1563 fi
1564 else
1565 CPPFLAGS="$CPPFLAGS -I\$(includedir)"
1566 fi
1567fi
1568AC_SUBST(CPPFLAGS)
1569])dnl
1570dnl ---------------------------------------------------------------------------
1571dnl CF_INTEL_COMPILER version: 3 updated: 2005/08/06 18:37:29
1572dnl -----------------
1573dnl Check if the given compiler is really the Intel compiler for Linux. It
1574dnl tries to imitate gcc, but does not return an error when it finds a mismatch
1575dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK.
1576dnl
1577dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
1578dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from
1579dnl the wrappers for gcc and g++ warnings.
1580dnl
1581dnl $1 = GCC (default) or GXX
1582dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
1583dnl $3 = CFLAGS (default) or CXXFLAGS
1584AC_DEFUN([CF_INTEL_COMPILER],[
1585ifelse($2,,INTEL_COMPILER,[$2])=no
1586
1587if test "$ifelse($1,,[$1],GCC)" = yes ; then
1588 case $host_os in
1589 linux*|gnu*)
1590 AC_MSG_CHECKING(if this is really Intel ifelse($1,GXX,C++,C) compiler)
1591 cf_save_CFLAGS="$ifelse($3,,CFLAGS,[$3])"
1592 ifelse($3,,CFLAGS,[$3])="$ifelse($3,,CFLAGS,[$3]) -no-gcc"
1593 AC_TRY_COMPILE([],[
1594#ifdef __INTEL_COMPILER
1595#else
1596make an error
1597#endif
1598],[ifelse($2,,INTEL_COMPILER,[$2])=yes
1599cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc"
1600],[])
1601 ifelse($3,,CFLAGS,[$3])="$cf_save_CFLAGS"
1602 AC_MSG_RESULT($ifelse($2,,INTEL_COMPILER,[$2]))
1603 ;;
1604 esac
1605fi
1606])dnl
1607dnl ---------------------------------------------------------------------------
1608dnl CF_ISASCII version: 3 updated: 2000/08/12 23:18:52
1609dnl ----------
1610dnl Check if we have either a function or macro for 'isascii()'.
1611AC_DEFUN([CF_ISASCII],
1612[
1613AC_MSG_CHECKING(for isascii)
1614AC_CACHE_VAL(cf_cv_have_isascii,[
1615 AC_TRY_LINK([#include <ctype.h>],[int x = isascii(' ')],
1616 [cf_cv_have_isascii=yes],
1617 [cf_cv_have_isascii=no])
1618])dnl
1619AC_MSG_RESULT($cf_cv_have_isascii)
1620test "$cf_cv_have_isascii" = yes && AC_DEFINE(HAVE_ISASCII)
1621])dnl
1622dnl ---------------------------------------------------------------------------
1623dnl CF_LARGEFILE version: 5 updated: 2005/07/17 11:03:36
1624dnl ------------
1625dnl Add checks for large file support.
1626AC_DEFUN([CF_LARGEFILE],[
1627ifdef([AC_FUNC_FSEEKO],[
1628 AC_FUNC_FSEEKO
1629 AC_SYS_LARGEFILE
1630
1631 # Normally we would collect these definitions in the config.h,
1632 # but (like _XOPEN_SOURCE), some environments rely on having these
1633 # defined before any of the system headers are included. Another
1634 # case comes up with C++, e.g., on AIX the compiler compiles the
1635 # header files by themselves before looking at the body files it is
1636 # told to compile. For ncurses, those header files do not include
1637 # the config.h
1638 test "$ac_cv_sys_large_files" != no && CPPFLAGS="$CPPFLAGS -D_LARGE_FILES "
1639 test "$ac_cv_sys_largefile_source" != no && CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE "
1640
1641 AC_CACHE_CHECK(whether to use struct dirent64, cf_cv_struct_dirent64,[
1642 AC_TRY_COMPILE([
1643#include <sys/types.h>
1644#include <dirent.h>
1645 ],[
1646 /* if transitional largefile support is setup, this is true */
1647 extern struct dirent64 * readdir(DIR *);
1648 struct dirent64 *x = readdir((DIR *)0);
1649 struct dirent *y = readdir((DIR *)0);
1650 int z = x - y;
1651 ],
1652 [cf_cv_struct_dirent64=yes],
1653 [cf_cv_struct_dirent64=no])
1654 ])
1655 test "$cf_cv_struct_dirent64" = yes && AC_DEFINE(HAVE_STRUCT_DIRENT64)
1656])
1657])
1658dnl ---------------------------------------------------------------------------
1659dnl CF_LIBUTF8 version: 2 updated: 2002/01/19 22:51:32
1660dnl ----------
1661dnl Check for libutf8
1662AC_DEFUN([CF_LIBUTF8],
1663[
1664AC_CACHE_CHECK(for putwc in libutf8,cf_cv_libutf8,[
1665 cf_save_LIBS="$LIBS"
1666 LIBS="-lutf8 $LIBS"
1667AC_TRY_LINK([
1668#include <libutf8.h>],[putwc(0,0);],
1669 [cf_cv_libutf8=yes],
1670 [cf_cv_libutf8=no])
1671 LIBS="$cf_save_LIBS"
1672])
1673
1674if test "$cf_cv_libutf8" = yes ; then
1675 AC_DEFINE(HAVE_LIBUTF8_H)
1676 LIBS="-lutf8 $LIBS"
1677fi
1678])dnl
1679dnl ---------------------------------------------------------------------------
1680dnl CF_LIB_PREFIX version: 7 updated: 2001/01/12 01:23:48
1681dnl -------------
1682dnl Compute the library-prefix for the given host system
1683dnl $1 = variable to set
1684AC_DEFUN([CF_LIB_PREFIX],
1685[
1686 case $cf_cv_system_name in
1687 OS/2*) LIB_PREFIX='' ;;
1688 os2*) LIB_PREFIX='' ;;
1689 *) LIB_PREFIX='lib' ;;
1690 esac
1691ifelse($1,,,[$1=$LIB_PREFIX])
1692 AC_SUBST(LIB_PREFIX)
1693])dnl
1694dnl ---------------------------------------------------------------------------
1695dnl CF_LIB_RULES version: 36 updated: 2005/05/28 13:16:28
1696dnl ------------
1697dnl Append definitions and rules for the given models to the subdirectory
1698dnl Makefiles, and the recursion rule for the top-level Makefile. If the
1699dnl subdirectory is a library-source directory, modify the LIBRARIES list in
1700dnl the corresponding makefile to list the models that we'll generate.
1701dnl
1702dnl For shared libraries, make a list of symbolic links to construct when
1703dnl generating each library. The convention used for Linux is the simplest
1704dnl one:
1705dnl lib<name>.so ->
1706dnl lib<name>.so.<major> ->
1707dnl lib<name>.so.<maj>.<minor>
1708AC_DEFUN([CF_LIB_RULES],
1709[
1710CF_LIB_PREFIX(cf_prefix)
1711AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
1712for cf_dir in $SRC_SUBDIRS
1713do
1714 if test -f $srcdir/$cf_dir/modules; then
1715
1716 IMPORT_LIB=
1717 SHARED_LIB=
1718 LIBS_TO_MAKE=
1719 for cf_item in $CF_LIST_MODELS
1720 do
1721 CF_LIB_SUFFIX($cf_item,cf_suffix)
1722 if test $cf_item = shared ; then
1723 if test "$cf_cv_do_symlinks" = yes ; then
1724 case "$cf_cv_shlib_version" in #(vi
1725 rel) #(vi
1726 case "$cf_cv_system_name" in #(vi
1727 darwin*)
1728 case .${LIB_SUFFIX} in
1729 .w*)
1730 cf_suffix=`echo $cf_suffix | sed 's/^w//'`
1731 cf_suffix=w'.$(REL_VERSION)'"$cf_suffix"
1732 ;;
1733 *)
1734 cf_suffix='.$(REL_VERSION)'"$cf_suffix"
1735 ;;
1736 esac
1737 ;; #(vi
1738 *) cf_suffix="$cf_suffix"'.$(REL_VERSION)' ;;
1739 esac
1740 ;;
1741 abi)
1742 case "$cf_cv_system_name" in #(vi
1743 darwin*)
1744 case .${LIB_SUFFIX} in
1745 .w*)
1746 cf_suffix=`echo $cf_suffix | sed 's/^w//'`
1747 cf_suffix=w'.$(ABI_VERSION)'"$cf_suffix"
1748 ;;
1749 *)
1750 cf_suffix='.$(ABI_VERSION)'"$cf_suffix"
1751 ;;
1752 esac
1753 ;; #(vi
1754 *) cf_suffix="$cf_suffix"'.$(ABI_VERSION)' ;;
1755 esac
1756 ;;
1757 esac
1758 fi
1759 # cygwin needs import library, and has unique naming convention
1760 # use autodetected ${cf_prefix} for import lib and static lib, but
1761 # use 'cyg' prefix for shared lib.
1762 if test $cf_cv_shlib_version = cygdll ; then
1763 SHARED_LIB="../lib/cyg${cf_dir}\$(ABI_VERSION).dll"
1764 IMPORT_LIB="../lib/${cf_prefix}${cf_dir}.dll.a"
1765 LIBS_TO_MAKE="$LIBS_TO_MAKE \$(SHARED_LIB) \$(IMPORT_LIB)"
1766 continue
1767 fi
1768 fi
1769 LIBS_TO_MAKE="$LIBS_TO_MAKE ../lib/${cf_prefix}${cf_dir}${cf_suffix}"
1770 done
1771
1772 if test $cf_dir = ncurses ; then
1773 cf_subsets="$LIB_SUBSETS"
1774 cf_termlib=`echo "$cf_subsets" |sed -e 's/ .*$//'`
1775 if test "$cf_termlib" != "$cf_subsets" ; then
1776 cf_item=`echo $LIBS_TO_MAKE |sed -e s%${LIB_NAME}${LIB_SUFFIX}%${TINFO_LIB_SUFFIX}%g`
1777 LIBS_TO_MAKE="$cf_item $LIBS_TO_MAKE"
1778 fi
1779 else
1780 cf_subsets=`echo "$LIB_SUBSETS" | sed -e 's/^termlib.* //'`
1781 fi
1782
1783 sed -e "s%@LIBS_TO_MAKE@%$LIBS_TO_MAKE%" \
1784 -e "s%@IMPORT_LIB@%$IMPORT_LIB%" \
1785 -e "s%@SHARED_LIB@%$SHARED_LIB%" \
1786 $cf_dir/Makefile >$cf_dir/Makefile.out
1787 mv $cf_dir/Makefile.out $cf_dir/Makefile
1788
1789 $AWK -f $srcdir/mk-0th.awk \
1790 libname="${cf_dir}${LIB_SUFFIX}" subsets="$LIB_SUBSETS" \
1791 $srcdir/$cf_dir/modules >>$cf_dir/Makefile
1792
1793 for cf_subset in $cf_subsets
1794 do
1795 cf_subdirs=
1796 for cf_item in $CF_LIST_MODELS
1797 do
1798 echo "Appending rules for ${cf_item} model (${cf_dir}: ${cf_subset})"
1799 CF_UPPER(cf_ITEM,$cf_item)
1800 CF_LIB_SUFFIX($cf_item,cf_suffix)
1801 CF_OBJ_SUBDIR($cf_item,cf_subdir)
1802
1803 # Test for case where we build libtinfo with a different name.
1804 cf_libname=$cf_dir
1805 if test $cf_dir = ncurses ; then
1806 case $cf_subset in
1807 *base*)
1808 ;;
1809 termlib*)
1810 cf_libname=$TINFO_LIB_SUFFIX
1811 if test -n "${DFT_ARG_SUFFIX}" ; then
1812 # undo $LIB_SUFFIX add-on in CF_LIB_SUFFIX
1813 cf_suffix=`echo $cf_suffix |sed -e "s%^${LIB_SUFFIX}%%"`
1814 fi
1815 ;;
1816 esac
1817 fi
1818
1819 # These dependencies really are for development, not
1820 # builds, but they are useful in porting, too.
1821 cf_depend="../include/ncurses_cfg.h"
1822 if test "$srcdir" = "."; then
1823 cf_reldir="."
1824 else
1825 cf_reldir="\$(srcdir)"
1826 fi
1827
1828 if test -f $srcdir/$cf_dir/$cf_dir.priv.h; then
1829 cf_depend="$cf_depend $cf_reldir/$cf_dir.priv.h"
1830 elif test -f $srcdir/$cf_dir/curses.priv.h; then
1831 cf_depend="$cf_depend $cf_reldir/curses.priv.h"
1832 fi
1833
1834 cf_dir_suffix=
1835 old_cf_suffix="$cf_suffix"
1836 if test "$cf_cv_shlib_version_infix" = yes ; then
1837 if test -n "$LIB_SUFFIX" ; then
1838 case $LIB_SUFFIX in
1839 w*)
1840 cf_libname=`echo $cf_libname | sed 's/w$//'`
1841 cf_suffix=`echo $cf_suffix | sed 's/^w//'`
1842 cf_dir_suffix=w
1843 ;;
1844 esac
1845 fi
1846 fi
1847
1848 $AWK -f $srcdir/mk-1st.awk \
1849 name=${cf_libname}${cf_dir_suffix} \
1850 traces=$LIB_TRACING \
1851 MODEL=$cf_ITEM \
1852 model=$cf_subdir \
1853 prefix=$cf_prefix \
1854 suffix=$cf_suffix \
1855 subset=$cf_subset \
1856 ShlibVer=$cf_cv_shlib_version \
1857 ShlibVerInfix=$cf_cv_shlib_version_infix \
1858 DoLinks=$cf_cv_do_symlinks \
1859 rmSoLocs=$cf_cv_rm_so_locs \
1860 ldconfig="$LDCONFIG" \
1861 overwrite=$WITH_OVERWRITE \
1862 depend="$cf_depend" \
1863 host="$host" \
1864 $srcdir/$cf_dir/modules >>$cf_dir/Makefile
1865
1866 cf_suffix="$old_cf_suffix"
1867
1868 for cf_subdir2 in $cf_subdirs lib
1869 do
1870 test $cf_subdir = $cf_subdir2 && break
1871 done
1872 test "${cf_subset}.${cf_subdir2}" != "${cf_subset}.${cf_subdir}" && \
1873 $AWK -f $srcdir/mk-2nd.awk \
1874 name=$cf_dir \
1875 traces=$LIB_TRACING \
1876 MODEL=$cf_ITEM \
1877 model=$cf_subdir \
1878 subset=$cf_subset \
1879 srcdir=$srcdir \
1880 echo=$WITH_ECHO \
1881 crenames=$cf_cv_prog_CC_c_o \
1882 cxxrenames=$cf_cv_prog_CXX_c_o \
1883 $srcdir/$cf_dir/modules >>$cf_dir/Makefile
1884 cf_subdirs="$cf_subdirs $cf_subdir"
1885 done
1886 done
1887 fi
1888
1889 echo ' cd '$cf_dir' && $(MAKE) $(CF_MFLAGS) [$]@' >>Makefile
1890done
1891
1892for cf_dir in $SRC_SUBDIRS
1893do
1894 if test -f $cf_dir/Makefile ; then
1895 case "$cf_dir" in
1896 Ada95) #(vi
1897 echo 'libs \' >> Makefile
1898 echo 'install.libs \' >> Makefile
1899 echo 'uninstall.libs ::' >> Makefile
1900 echo ' cd '$cf_dir' && $(MAKE) $(CF_MFLAGS) [$]@' >> Makefile
1901 ;;
1902 esac
1903 fi
1904
1905 if test -f $srcdir/$cf_dir/modules; then
1906 echo >> Makefile
1907 if test -f $srcdir/$cf_dir/headers; then
1908cat >> Makefile <<CF_EOF
1909install.includes \\
1910uninstall.includes \\
1911CF_EOF
1912 fi
1913if test "$cf_dir" != "c++" ; then
1914echo 'lint \' >> Makefile
1915fi
1916cat >> Makefile <<CF_EOF
1917libs \\
1918lintlib \\
1919install.libs \\
1920uninstall.libs \\
1921install.$cf_dir \\
1922uninstall.$cf_dir ::
1923 cd $cf_dir && \$(MAKE) \$(CF_MFLAGS) \[$]@
1924CF_EOF
1925 elif test -f $srcdir/$cf_dir/headers; then
1926cat >> Makefile <<CF_EOF
1927
1928libs \\
1929install.libs \\
1930uninstall.libs \\
1931install.includes \\
1932uninstall.includes ::
1933 cd $cf_dir && \$(MAKE) \$(CF_MFLAGS) \[$]@
1934CF_EOF
1935fi
1936done
1937
1938cat >> Makefile <<CF_EOF
1939
1940install.data \\
1941uninstall.data ::
1942$MAKE_TERMINFO cd misc && \$(MAKE) \$(CF_MFLAGS) \[$]@
1943
1944install.man \\
1945uninstall.man ::
1946 cd man && \$(MAKE) \$(CF_MFLAGS) \[$]@
1947
1948distclean ::
1949 rm -f config.cache config.log config.status Makefile include/ncurses_cfg.h
1950 rm -f headers.sh headers.sed
1951 rm -rf \$(DIRS_TO_MAKE)
1952CF_EOF
1953
1954# Special case: tack's manpage lives in its own directory.
1955if test -d tack ; then
1956if test -f $srcdir/$tack.h; then
1957cat >> Makefile <<CF_EOF
1958
1959install.man \\
1960uninstall.man ::
1961 cd tack && \$(MAKE) \$(CF_MFLAGS) \[$]@
1962CF_EOF
1963fi
1964fi
1965
1966dnl If we're installing into a subdirectory of /usr/include, etc., we should
1967dnl prepend the subdirectory's name to the "#include" paths. It won't hurt
1968dnl anything, and will make it more standardized. It's awkward to decide this
1969dnl at configuration because of quoting, so we'll simply make all headers
1970dnl installed via a script that can do the right thing.
1971
1972rm -f headers.sed headers.sh
1973
1974dnl ( generating this script makes the makefiles a little tidier :-)
1975echo creating headers.sh
1976cat >headers.sh <<CF_EOF
1977#! /bin/sh
1978# This shell script is generated by the 'configure' script. It is invoked in a
1979# subdirectory of the build tree. It generates a sed-script in the parent
1980# directory that is used to adjust includes for header files that reside in a
1981# subdirectory of /usr/include, etc.
1982PRG=""
1983while test \[$]# != 3
1984do
1985PRG="\$PRG \[$]1"; shift
1986done
1987DST=\[$]1
1988REF=\[$]2
1989SRC=\[$]3
1990TMPSRC=\${TMPDIR-/tmp}/\`basename \$SRC\`\$\$
1991TMPSED=\${TMPDIR-/tmp}/headers.sed\$\$
1992echo installing \$SRC in \$DST
1993CF_EOF
1994if test $WITH_CURSES_H = yes; then
1995 cat >>headers.sh <<CF_EOF
1996case \$DST in
1997/*/include/*)
1998 END=\`basename \$DST\`
1999 for i in \`cat \$REF/../*/headers |fgrep -v "#"\`
2000 do
2001 NAME=\`basename \$i\`
2002 echo "s/<\$NAME>/<\$END\/\$NAME>/" >> \$TMPSED
2003 done
2004 ;;
2005*)
2006 echo "" >> \$TMPSED
2007 ;;
2008esac
2009CF_EOF
2010else
2011 cat >>headers.sh <<CF_EOF
2012case \$DST in
2013/*/include/*)
2014 END=\`basename \$DST\`
2015 for i in \`cat \$REF/../*/headers |fgrep -v "#"\`
2016 do
2017 NAME=\`basename \$i\`
2018 if test "\$NAME" = "curses.h"
2019 then
2020 echo "s/<curses.h>/<ncurses.h>/" >> \$TMPSED
2021 NAME=ncurses.h
2022 fi
2023 echo "s/<\$NAME>/<\$END\/\$NAME>/" >> \$TMPSED
2024 done
2025 ;;
2026*)
2027 echo "s/<curses.h>/<ncurses.h>/" >> \$TMPSED
2028 ;;
2029esac
2030CF_EOF
2031fi
2032cat >>headers.sh <<CF_EOF
2033rm -f \$TMPSRC
2034sed -f \$TMPSED \$SRC > \$TMPSRC
2035NAME=\`basename \$SRC\`
2036CF_EOF
2037if test $WITH_CURSES_H != yes; then
2038 cat >>headers.sh <<CF_EOF
2039test "\$NAME" = "curses.h" && NAME=ncurses.h
2040CF_EOF
2041fi
2042cat >>headers.sh <<CF_EOF
2043# Just in case someone gzip'd manpages, remove the conflicting copy.
2044test -f \$DST/\$NAME.gz && rm -f \$DST/\$NAME.gz
2045
2046eval \$PRG \$TMPSRC \$DST/\$NAME
2047rm -f \$TMPSRC \$TMPSED
2048CF_EOF
2049
2050chmod 0755 headers.sh
2051
2052for cf_dir in $SRC_SUBDIRS
2053do
2054 if test -f $srcdir/$cf_dir/headers; then
2055 cat >>$cf_dir/Makefile <<CF_EOF
2056\$(DESTDIR)\$(includedir) :
2057 sh \$(srcdir)/../mkinstalldirs \[$]@
2058
2059install \\
2060install.libs \\
2061install.includes :: \$(AUTO_SRC) \$(DESTDIR)\$(includedir) \\
2062CF_EOF
2063 j=""
2064 for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"`
2065 do
2066 test -n "$j" && echo " $j \\" >>$cf_dir/Makefile
2067 j=$i
2068 done
2069 echo " $j" >>$cf_dir/Makefile
2070 for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"`
2071 do
2072 echo " @ (cd \$(DESTDIR)\$(includedir) && rm -f `basename $i`) ; ../headers.sh \$(INSTALL_DATA) \$(DESTDIR)\$(includedir) \$(srcdir) $i" >>$cf_dir/Makefile
2073 test $i = curses.h && test $WITH_CURSES_H = yes && echo " @ (cd \$(DESTDIR)\$(includedir) && rm -f ncurses.h && \$(LN_S) curses.h ncurses.h)" >>$cf_dir/Makefile
2074 done
2075
2076 cat >>$cf_dir/Makefile <<CF_EOF
2077
2078uninstall \\
2079uninstall.libs \\
2080uninstall.includes ::
2081CF_EOF
2082 for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"`
2083 do
2084 i=`basename $i`
2085 echo " -@ (cd \$(DESTDIR)\$(includedir) && rm -f $i)" >>$cf_dir/Makefile
2086 test $i = curses.h && echo " -@ (cd \$(DESTDIR)\$(includedir) && rm -f ncurses.h)" >>$cf_dir/Makefile
2087 done
2088 fi
2089
2090 if test -f $srcdir/$cf_dir/modules; then
2091 if test "$cf_dir" != "c++" ; then
2092 cat >>$cf_dir/Makefile <<"CF_EOF"
2093depend : $(AUTO_SRC)
2094 makedepend -- $(CPPFLAGS) -- $(C_SRC)
2095
2096# DO NOT DELETE THIS LINE -- make depend depends on it.
2097CF_EOF
2098 fi
2099 fi
2100done
2101
2102])dnl
2103dnl ---------------------------------------------------------------------------
2104dnl CF_LIB_SONAME version: 2 updated: 2005/06/25 16:05:47
2105dnl -------------
2106dnl Find the and soname for the given shared library. Set the cache variable
2107dnl cf_cv_$3_soname to this, unless it is not found. Then set the cache
2108dnl variable to "unknown".
2109dnl
2110dnl $1 = headers
2111dnl $2 = code
2112dnl $3 = library name
2113AC_DEFUN([CF_LIB_SONAME],
2114[
2115AC_CACHE_CHECK(for soname of $3 library,cf_cv_$3_soname,[
2116
2117cf_cv_$3_soname=unknown
2118if test "$cross_compiling" != yes ; then
2119cat >conftest.$ac_ext <<CF_EOF
2120$1
2121int main()
2122{
2123$2
2124return 0;
2125}
2126CF_EOF
2127cf_save_LIBS="$LIBS"
2128 LIBS="-l$3 $LIBS"
2129 if AC_TRY_EVAL(ac_compile) ; then
2130 if AC_TRY_EVAL(ac_link) ; then
2131 cf_cv_$3_soname=`ldd conftest$ac_exeext 2>/dev/null | sed -e 's,^.*/,,' -e 's, .*$,,' | fgrep lib$3.`
2132 test -z "$cf_cv_$3_soname" && cf_cv_$3_soname=unknown
2133 fi
2134 fi
2135rm -f conftest*
2136LIBS="$cf_save_LIBS"
2137fi
2138])
2139])
2140dnl ---------------------------------------------------------------------------
2141dnl CF_LIB_SUFFIX version: 13 updated: 2003/11/01 16:09:07
2142dnl -------------
2143dnl Compute the library file-suffix from the given model name
2144dnl $1 = model name
2145dnl $2 = variable to set
2146dnl The variable $LIB_SUFFIX, if set, prepends the variable to set.
2147AC_DEFUN([CF_LIB_SUFFIX],
2148[
2149 AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
2150 case $1 in
2151 libtool) $2='.la' ;;
2152 normal) $2='.a' ;;
2153 debug) $2='_g.a' ;;
2154 profile) $2='_p.a' ;;
2155 shared)
2156 case $cf_cv_system_name in
2157 cygwin*) $2='.dll' ;;
2158 darwin*) $2='.dylib' ;;
2159 hpux*)
2160 case $target in
2161 ia64*) $2='.so' ;;
2162 *) $2='.sl' ;;
2163 esac
2164 ;;
2165 *) $2='.so' ;;
2166 esac
2167 esac
2168 test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}"
2169])dnl
2170dnl ---------------------------------------------------------------------------
2171dnl CF_LIB_TYPE version: 4 updated: 2000/10/20 22:57:49
2172dnl -----------
2173dnl Compute the string to append to -library from the given model name
2174dnl $1 = model name
2175dnl $2 = variable to set
2176dnl The variable $LIB_SUFFIX, if set, prepends the variable to set.
2177AC_DEFUN([CF_LIB_TYPE],
2178[
2179 case $1 in
2180 libtool) $2='' ;;
2181 normal) $2='' ;;
2182 debug) $2='_g' ;;
2183 profile) $2='_p' ;;
2184 shared) $2='' ;;
2185 esac
2186 test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}"
2187])dnl
2188dnl ---------------------------------------------------------------------------
2189dnl CF_LINK_DATAONLY version: 6 updated: 2003/02/02 01:41:46
2190dnl ----------------
2191dnl Some systems have a non-ANSI linker that doesn't pull in modules that have
2192dnl only data (i.e., no functions), for example NeXT. On those systems we'll
2193dnl have to provide wrappers for global tables to ensure they're linked
2194dnl properly.
2195AC_DEFUN([CF_LINK_DATAONLY],
2196[
2197AC_MSG_CHECKING([if data-only library module links])
2198AC_CACHE_VAL(cf_cv_link_dataonly,[
2199 rm -f conftest.a
2200 cat >conftest.$ac_ext <<EOF
2201#line __oline__ "configure"
2202int testdata[[3]] = { 123, 456, 789 };
2203EOF
2204 if AC_TRY_EVAL(ac_compile) ; then
2205 mv conftest.o data.o && \
2206 ( $AR $AR_OPTS conftest.a data.o ) 2>&AC_FD_CC 1>/dev/null
2207 fi
2208 rm -f conftest.$ac_ext data.o
2209 cat >conftest.$ac_ext <<EOF
2210#line __oline__ "configure"
2211int testfunc()
2212{
2213#if defined(NeXT)
2214 exit(1); /* I'm told this linker is broken */
2215#else
2216 extern int testdata[[3]];
2217 return testdata[[0]] == 123
2218 && testdata[[1]] == 456
2219 && testdata[[2]] == 789;
2220#endif
2221}
2222EOF
2223 if AC_TRY_EVAL(ac_compile); then
2224 mv conftest.o func.o && \
2225 ( $AR $AR_OPTS conftest.a func.o ) 2>&AC_FD_CC 1>/dev/null
2226 fi
2227 rm -f conftest.$ac_ext func.o
2228 ( eval $RANLIB conftest.a ) 2>&AC_FD_CC >/dev/null
2229 cf_saveLIBS="$LIBS"
2230 LIBS="conftest.a $LIBS"
2231 AC_TRY_RUN([
2232 int main()
2233 {
2234 extern int testfunc();
2235 exit (!testfunc());
2236 }
2237 ],
2238 [cf_cv_link_dataonly=yes],
2239 [cf_cv_link_dataonly=no],
2240 [cf_cv_link_dataonly=unknown])
2241 LIBS="$cf_saveLIBS"
2242 ])
2243AC_MSG_RESULT($cf_cv_link_dataonly)
2244
2245if test "$cf_cv_link_dataonly" = no ; then
2246 AC_DEFINE(BROKEN_LINKER)
2247 BROKEN_LINKER=1
2248fi
2249
2250])dnl
2251dnl ---------------------------------------------------------------------------
2252dnl CF_LINK_FUNCS version: 5 updated: 2003/02/02 01:41:46
2253dnl -------------
2254dnl Most Unix systems have both link and symlink, a few don't have symlink.
2255dnl A few non-Unix systems implement symlink, but not link.
2256dnl A few non-systems implement neither (or have nonfunctional versions).
2257AC_DEFUN([CF_LINK_FUNCS],
2258[
2259AC_CHECK_FUNCS( \
2260 remove \
2261 unlink )
2262
2263if test "$cross_compiling" = yes ; then
2264 AC_CHECK_FUNCS( \
2265 link \
2266 symlink )
2267else
2268 AC_CACHE_CHECK(if link/symlink functions work,cf_cv_link_funcs,[
2269 cf_cv_link_funcs=
2270 for cf_func in link symlink ; do
2271 AC_TRY_RUN([
2272#include <sys/types.h>
2273#include <sys/stat.h>
2274#ifdef HAVE_UNISTD_H
2275#include <unistd.h>
2276#endif
2277int main()
2278{
2279 int fail = 0;
2280 char *src = "config.log";
2281 char *dst = "conftest.chk";
2282 struct stat src_sb;
2283 struct stat dst_sb;
2284
2285 stat(src, &src_sb);
2286 fail = ($cf_func("config.log", "conftest.chk") < 0)
2287 || (stat(dst, &dst_sb) < 0)
2288 || (dst_sb.st_mtime != src_sb.st_mtime);
2289#ifdef HAVE_UNLINK
2290 unlink(dst);
2291#else
2292 remove(dst);
2293#endif
2294 exit (fail);
2295}
2296 ],[
2297 cf_cv_link_funcs="$cf_cv_link_funcs $cf_func"
2298 eval 'ac_cv_func_'$cf_func'=yes'],[
2299 eval 'ac_cv_func_'$cf_func'=no'],[
2300 eval 'ac_cv_func_'$cf_func'=error'])
2301 done
2302 test -z "$cf_cv_link_funcs" && cf_cv_link_funcs=no
2303 ])
2304 test "$ac_cv_func_link" = yes && AC_DEFINE(HAVE_LINK)
2305 test "$ac_cv_func_symlink" = yes && AC_DEFINE(HAVE_SYMLINK)
2306fi
2307])dnl
2308dnl ---------------------------------------------------------------------------
2309dnl CF_MAKEFLAGS version: 9 updated: 2001/12/30 18:17:27
2310dnl ------------
2311dnl Some 'make' programs support $(MAKEFLAGS), some $(MFLAGS), to pass 'make'
2312dnl options to lower-levels. It's very useful for "make -n" -- if we have it.
2313dnl (GNU 'make' does both, something POSIX 'make', which happens to make the
2314dnl $(MAKEFLAGS) variable incompatible because it adds the assignments :-)
2315AC_DEFUN([CF_MAKEFLAGS],
2316[
2317AC_CACHE_CHECK(for makeflags variable, cf_cv_makeflags,[
2318 cf_cv_makeflags=''
2319 for cf_option in '-$(MAKEFLAGS)' '$(MFLAGS)'
2320 do
2321 cat >cf_makeflags.tmp <<CF_EOF
2322SHELL = /bin/sh
2323all :
2324 @ echo '.$cf_option'
2325CF_EOF
2326 cf_result=`${MAKE-make} -k -f cf_makeflags.tmp 2>/dev/null`
2327 case "$cf_result" in
2328 .*k)
2329 cf_result=`${MAKE-make} -k -f cf_makeflags.tmp CC=cc 2>/dev/null`
2330 case "$cf_result" in
2331 .*CC=*) cf_cv_makeflags=
2332 ;;
2333 *) cf_cv_makeflags=$cf_option
2334 ;;
2335 esac
2336 break
2337 ;;
2338 *) echo no match "$cf_result"
2339 ;;
2340 esac
2341 done
2342 rm -f cf_makeflags.tmp
2343])
2344
2345AC_SUBST(cf_cv_makeflags)
2346])dnl
2347dnl ---------------------------------------------------------------------------
2348dnl CF_MAKE_TAGS version: 2 updated: 2000/10/04 09:18:40
2349dnl ------------
2350dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have
2351dnl a monocase filesystem.
2352AC_DEFUN([CF_MAKE_TAGS],[
2353AC_REQUIRE([CF_MIXEDCASE_FILENAMES])
2354AC_CHECK_PROG(MAKE_LOWER_TAGS, ctags, yes, no)
2355
2356if test "$cf_cv_mixedcase" = yes ; then
2357 AC_CHECK_PROG(MAKE_UPPER_TAGS, etags, yes, no)
2358else
2359 MAKE_UPPER_TAGS=no
2360fi
2361
2362if test "$MAKE_UPPER_TAGS" = yes ; then
2363 MAKE_UPPER_TAGS=
2364else
2365 MAKE_UPPER_TAGS="#"
2366fi
2367AC_SUBST(MAKE_UPPER_TAGS)
2368
2369if test "$MAKE_LOWER_TAGS" = yes ; then
2370 MAKE_LOWER_TAGS=
2371else
2372 MAKE_LOWER_TAGS="#"
2373fi
2374AC_SUBST(MAKE_LOWER_TAGS)
2375])dnl
2376dnl ---------------------------------------------------------------------------
2377dnl CF_MANPAGE_FORMAT version: 7 updated: 2003/12/20 19:30:34
2378dnl -----------------
2379dnl Option to allow user to override automatic configuration of manpage format.
2380dnl There are several special cases:
2381dnl
2382dnl gzip - man checks for, can display gzip'd files
2383dnl compress - man checks for, can display compressed files
2384dnl BSDI - files in the cat-directories are suffixed ".0"
2385dnl formatted - installer should format (put files in cat-directory)
2386dnl catonly - installer should only format, e.g., for a turnkey system.
2387dnl
2388dnl There are other configurations which this macro does not test, e.g., HPUX's
2389dnl compressed manpages (but uncompressed manpages are fine, and HPUX's naming
2390dnl convention would not match our use).
2391AC_DEFUN([CF_MANPAGE_FORMAT],
2392[
2393AC_REQUIRE([CF_PATHSEP])
2394AC_MSG_CHECKING(format of man-pages)
2395
2396AC_ARG_WITH(manpage-format,
2397 [ --with-manpage-format specify manpage-format: gzip/compress/BSDI/normal and
2398 optionally formatted/catonly, e.g., gzip,formatted],
2399 [MANPAGE_FORMAT=$withval],
2400 [MANPAGE_FORMAT=unknown])
2401
2402test -z "$MANPAGE_FORMAT" && MANPAGE_FORMAT=unknown
2403MANPAGE_FORMAT=`echo "$MANPAGE_FORMAT" | sed -e 's/,/ /g'`
2404
2405cf_unknown=
2406
2407case $MANPAGE_FORMAT in
2408unknown)
2409 if test -z "$MANPATH" ; then
2410 MANPATH="/usr/man:/usr/share/man"
2411 fi
2412
2413 # look for the 'date' man-page (it's most likely to be installed!)
2414 MANPAGE_FORMAT=
2415 cf_preform=no
2416 cf_catonly=yes
2417 cf_example=date
2418
2419 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATHSEP}"
2420 for cf_dir in $MANPATH; do
2421 test -z "$cf_dir" && cf_dir=/usr/man
2422 for cf_name in $cf_dir/man*/$cf_example.[[01]]* $cf_dir/cat*/$cf_example.[[01]]* $cf_dir/man*/$cf_example $cf_dir/cat*/$cf_example
2423 do
2424 cf_test=`echo $cf_name | sed -e 's/*//'`
2425 if test "x$cf_test" = "x$cf_name" ; then
2426
2427 case "$cf_name" in
2428 *.gz) MANPAGE_FORMAT="$MANPAGE_FORMAT gzip";;
2429 *.Z) MANPAGE_FORMAT="$MANPAGE_FORMAT compress";;
2430 *.0) MANPAGE_FORMAT="$MANPAGE_FORMAT BSDI";;
2431 *) MANPAGE_FORMAT="$MANPAGE_FORMAT normal";;
2432 esac
2433
2434 case "$cf_name" in
2435 $cf_dir/man*)
2436 cf_catonly=no
2437 ;;
2438 $cf_dir/cat*)
2439 cf_preform=yes
2440 ;;
2441 esac
2442 break
2443 fi
2444
2445 # if we found a match in either man* or cat*, stop looking
2446 if test -n "$MANPAGE_FORMAT" ; then
2447 cf_found=no
2448 test "$cf_preform" = yes && MANPAGE_FORMAT="$MANPAGE_FORMAT formatted"
2449 test "$cf_catonly" = yes && MANPAGE_FORMAT="$MANPAGE_FORMAT catonly"
2450 case "$cf_name" in
2451 $cf_dir/cat*)
2452 cf_found=yes
2453 ;;
2454 esac
2455 test $cf_found=yes && break
2456 fi
2457 done
2458 # only check the first directory in $MANPATH where we find manpages
2459 if test -n "$MANPAGE_FORMAT" ; then
2460 break
2461 fi
2462 done
2463 # if we did not find the example, just assume it is normal
2464 test -z "$MANPAGE_FORMAT" && MANPAGE_FORMAT=normal
2465 IFS="$ac_save_ifs"
2466 ;;
2467*)
2468 for cf_option in $MANPAGE_FORMAT; do
2469 case $cf_option in #(vi
2470 gzip|compress|BSDI|normal|formatted|catonly)
2471 ;;
2472 *)
2473 cf_unknown="$cf_unknown $cf_option"
2474 ;;
2475 esac
2476 done
2477 ;;
2478esac
2479
2480AC_MSG_RESULT($MANPAGE_FORMAT)
2481if test -n "$cf_unknown" ; then
2482 AC_MSG_WARN(Unexpected manpage-format $cf_unknown)
2483fi
2484])dnl
2485dnl ---------------------------------------------------------------------------
2486dnl CF_MANPAGE_RENAMES version: 7 updated: 2005/06/18 18:51:57
2487dnl ------------------
2488dnl The Debian people have their own naming convention for manpages. This
2489dnl option lets us override the name of the file containing renaming, or
2490dnl disable it altogether.
2491AC_DEFUN([CF_MANPAGE_RENAMES],
2492[
2493AC_MSG_CHECKING(for manpage renaming)
2494
2495AC_ARG_WITH(manpage-renames,
2496 [ --with-manpage-renames specify manpage-renaming],
2497 [MANPAGE_RENAMES=$withval],
2498 [MANPAGE_RENAMES=yes])
2499
2500case ".$MANPAGE_RENAMES" in #(vi
2501.no) #(vi
2502 ;;
2503.|.yes)
2504 # Debian 'man' program?
2505 if test -f /etc/debian_version ; then
2506 MANPAGE_RENAMES=`cd $srcdir && pwd`/man/man_db.renames
2507 else
2508 MANPAGE_RENAMES=no
2509 fi
2510 ;;
2511esac
2512
2513if test "$MANPAGE_RENAMES" != no ; then
2514 if test -f $srcdir/man/$MANPAGE_RENAMES ; then
2515 MANPAGE_RENAMES=`cd $srcdir/man && pwd`/$MANPAGE_RENAMES
2516 elif test ! -f $MANPAGE_RENAMES ; then
2517 AC_MSG_ERROR(not a filename: $MANPAGE_RENAMES)
2518 fi
2519
2520 test ! -d man && mkdir man
2521
2522 # Construct a sed-script to perform renaming within man-pages
2523 if test -n "$MANPAGE_RENAMES" ; then
2524 test ! -d man && mkdir man
2525 sh $srcdir/man/make_sed.sh $MANPAGE_RENAMES >./edit_man.sed
2526 fi
2527fi
2528
2529AC_MSG_RESULT($MANPAGE_RENAMES)
2530AC_SUBST(MANPAGE_RENAMES)
2531])dnl
2532dnl ---------------------------------------------------------------------------
2533dnl CF_MANPAGE_SYMLINKS version: 4 updated: 2003/12/13 18:01:58
2534dnl -------------------
2535dnl Some people expect each tool to make all aliases for manpages in the
2536dnl man-directory. This accommodates the older, less-capable implementations
2537dnl of 'man', and is optional.
2538AC_DEFUN([CF_MANPAGE_SYMLINKS],
2539[
2540AC_MSG_CHECKING(if manpage aliases will be installed)
2541
2542AC_ARG_WITH(manpage-aliases,
2543 [ --with-manpage-aliases specify manpage-aliases using .so],
2544 [MANPAGE_ALIASES=$withval],
2545 [MANPAGE_ALIASES=yes])
2546
2547AC_MSG_RESULT($MANPAGE_ALIASES)
2548
2549if test "$LN_S" = "ln -s"; then
2550 cf_use_symlinks=yes
2551else
2552 cf_use_symlinks=no
2553fi
2554
2555MANPAGE_SYMLINKS=no
2556if test "$MANPAGE_ALIASES" = yes ; then
2557AC_MSG_CHECKING(if manpage symlinks should be used)
2558
2559AC_ARG_WITH(manpage-symlinks,
2560 [ --with-manpage-symlinks specify manpage-aliases using symlinks],
2561 [MANPAGE_SYMLINKS=$withval],
2562 [MANPAGE_SYMLINKS=$cf_use_symlinks])
2563
2564if test "$$cf_use_symlinks" = no; then
2565if test "$MANPAGE_SYMLINKS" = yes ; then
2566 AC_MSG_WARN(cannot make symlinks, will use .so files)
2567 MANPAGE_SYMLINKS=no
2568fi
2569fi
2570
2571AC_MSG_RESULT($MANPAGE_SYMLINKS)
2572fi
2573
2574])dnl
2575dnl ---------------------------------------------------------------------------
2576dnl CF_MANPAGE_TBL version: 3 updated: 2002/01/19 22:51:32
2577dnl --------------
2578dnl This option causes manpages to be run through tbl(1) to generate tables
2579dnl correctly.
2580AC_DEFUN([CF_MANPAGE_TBL],
2581[
2582AC_MSG_CHECKING(for manpage tbl)
2583
2584AC_ARG_WITH(manpage-tbl,
2585 [ --with-manpage-tbl specify manpage processing with tbl],
2586 [MANPAGE_TBL=$withval],
2587 [MANPAGE_TBL=no])
2588
2589AC_MSG_RESULT($MANPAGE_TBL)
2590])dnl
2591dnl ---------------------------------------------------------------------------
2592dnl CF_MAN_PAGES version: 29 updated: 2005/06/18 19:42:52
2593dnl ------------
2594dnl Try to determine if the man-pages on the system are compressed, and if
2595dnl so, what format is used. Use this information to construct a script that
2596dnl will install man-pages.
2597AC_DEFUN([CF_MAN_PAGES],
2598[
2599CF_HELP_MESSAGE(Options to Specify How Manpages are Installed:)
2600CF_MANPAGE_FORMAT
2601CF_MANPAGE_RENAMES
2602CF_MANPAGE_SYMLINKS
2603CF_MANPAGE_TBL
2604
2605 if test "$prefix" = "NONE" ; then
2606 cf_prefix="$ac_default_prefix"
2607 else
2608 cf_prefix="$prefix"
2609 fi
2610
2611 case "$MANPAGE_FORMAT" in # (vi
2612 *catonly*) # (vi
2613 cf_format=yes
2614 cf_inboth=no
2615 ;;
2616 *formatted*) # (vi
2617 cf_format=yes
2618 cf_inboth=yes
2619 ;;
2620 *)
2621 cf_format=no
2622 cf_inboth=no
2623 ;;
2624 esac
2625
2626test ! -d man && mkdir man
2627
2628cf_so_strip=
2629cf_compress=
2630case "$MANPAGE_FORMAT" in #(vi
2631*compress*) #(vi
2632 cf_so_strip="Z"
2633 cf_compress=compress
2634 ;;
2635*gzip*) #(vi
2636 cf_so_strip="gz"
2637 cf_compress=gzip
2638 ;;
2639esac
2640
2641cf_edit_man=./edit_man.sh
2642
2643cat >$cf_edit_man <<CF_EOF
2644#! /bin/sh
2645# this script is generated by the configure-script CF_MAN_PAGES macro.
2646prefix="$cf_prefix"
2647datadir="$datadir"
2648NCURSES_OSPEED="$NCURSES_OSPEED"
2649TERMINFO="$TERMINFO"
2650MKDIRS="sh `cd $srcdir && pwd`/mkinstalldirs"
2651INSTALL="$INSTALL"
2652INSTALL_DATA="$INSTALL_DATA"
2653transform="$program_transform_name"
2654
2655TMP=\${TMPDIR-/tmp}/man\$\$
2656trap "rm -f \$TMP" 0 1 2 5 15
2657
2658form=\[$]1
2659shift || exit 1
2660
2661verb=\[$]1
2662shift || exit 1
2663
2664mandir=\[$]1
2665shift || exit 1
2666
2667srcdir=\[$]1
2668top_srcdir=\[$]srcdir/..
2669shift || exit 1
2670
2671if test "\$form" = normal ; then
2672 if test "$cf_format" = yes ; then
2673 if test "$cf_inboth" = no ; then
2674 sh \[$]0 format \$verb \$mandir \$srcdir \[$]*
2675 exit $?
2676 fi
2677 fi
2678 cf_subdir=\$mandir/man
2679 cf_tables=$MANPAGE_TBL
2680else
2681 cf_subdir=\$mandir/cat
2682 cf_tables=yes
2683fi
2684
2685# process the list of source-files
2686for i in \[$]* ; do
2687case \$i in #(vi
2688*.orig|*.rej) ;; #(vi
2689*.[[0-9]]*)
2690 section=\`expr "\$i" : '.*\\.\\([[0-9]]\\)[[xm]]*'\`;
2691 if test \$verb = installing ; then
2692 if test ! -d \$cf_subdir\${section} ; then
2693 \$MKDIRS \$cf_subdir\$section
2694 fi
2695 fi
2696 aliases=
2697 source=\`basename \$i\`
2698 inalias=\$source
2699 test ! -f \$inalias && inalias="\$srcdir/\$inalias"
2700 if test ! -f \$inalias ; then
2701 echo .. skipped \$source
2702 continue
2703 fi
2704CF_EOF
2705
2706if test "$MANPAGE_ALIASES" != no ; then
2707cat >>$cf_edit_man <<CF_EOF
2708 aliases=\`sed -f \$top_srcdir/man/manlinks.sed \$inalias | sort -u\`
2709CF_EOF
2710fi
2711
2712if test "$MANPAGE_RENAMES" = no ; then
2713cat >>$cf_edit_man <<CF_EOF
2714 # perform program transformations for section 1 man pages
2715 if test \$section = 1 ; then
2716 target=\$cf_subdir\${section}/\`echo \$source|sed "\${transform}"\`
2717 else
2718 target=\$cf_subdir\${section}/\$source
2719 fi
2720CF_EOF
2721else
2722cat >>$cf_edit_man <<CF_EOF
2723 target=\`grep "^\$source" $MANPAGE_RENAMES | $AWK '{print \[$]2}'\`
2724 if test -z "\$target" ; then
2725 echo '? missing rename for '\$source
2726 target="\$source"
2727 fi
2728 target="\$cf_subdir\${section}/\${target}"
2729CF_EOF
2730fi
2731
2732 # replace variables in man page
2733 ifelse($1,,,[
2734 for cf_name in $1
2735 do
2736cat >>$cf_edit_man <<CF_EOF
2737 prog_$cf_name=\`echo $cf_name|sed "\${transform}"\`
2738CF_EOF
2739 done
2740 ])
2741cat >>$cf_edit_man <<CF_EOF
2742 sed -e "s,@DATADIR@,\$datadir," \\
2743 -e "s,@TERMINFO@,\$TERMINFO," \\
2744 -e "s,@NCURSES_OSPEED@,\$NCURSES_OSPEED," \\
2745CF_EOF
2746
2747 ifelse($1,,,[
2748 for cf_name in $1
2749 do
2750 cf_NAME=`echo "$cf_name" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
2751cat >>$cf_edit_man <<CF_EOF
2752 -e "s,@$cf_NAME@,\$prog_$cf_name," \\
2753CF_EOF
2754 done
2755 ])
2756
2757if test -f $MANPAGE_RENAMES ; then
2758cat >>$cf_edit_man <<CF_EOF
2759 < \$i | sed -f `pwd`/edit_man.sed >\$TMP
2760CF_EOF
2761else
2762cat >>$cf_edit_man <<CF_EOF
2763 < \$i >\$TMP
2764CF_EOF
2765fi
2766
2767cat >>$cf_edit_man <<CF_EOF
2768if test \$cf_tables = yes ; then
2769 tbl \$TMP >\$TMP.out
2770 mv \$TMP.out \$TMP
2771fi
2772CF_EOF
2773
2774if test $with_curses_h != yes ; then
2775cat >>$cf_edit_man <<CF_EOF
2776 sed -e "/\#[ ]*include/s,curses.h,ncurses.h," < \$TMP >\$TMP.out
2777 mv \$TMP.out \$TMP
2778CF_EOF
2779fi
2780
2781cat >>$cf_edit_man <<CF_EOF
2782 if test \$form = format ; then
2783 nroff -man \$TMP >\$TMP.out
2784 mv \$TMP.out \$TMP
2785 fi
2786CF_EOF
2787
2788if test -n "$cf_compress" ; then
2789cat >>$cf_edit_man <<CF_EOF
2790 if test \$verb = installing ; then
2791 if ( $cf_compress -f \$TMP )
2792 then
2793 mv \$TMP.$cf_so_strip \$TMP
2794 fi
2795 fi
2796 target="\$target.$cf_so_strip"
2797CF_EOF
2798fi
2799
2800case "$MANPAGE_FORMAT" in #(vi
2801*BSDI*)
2802cat >>$cf_edit_man <<CF_EOF
2803 if test \$form = format ; then
2804 # BSDI installs only .0 suffixes in the cat directories
2805 target="\`echo \$target|sed -e 's/\.[[1-9]]\+[[a-z]]*/.0/'\`"
2806 fi
2807CF_EOF
2808 ;;
2809esac
2810
2811cat >>$cf_edit_man <<CF_EOF
2812 suffix=\`basename \$target | sed -e 's%^[[^.]]*%%'\`
2813 if test \$verb = installing ; then
2814 echo \$verb \$target
2815 \$INSTALL_DATA \$TMP \$target
2816 test -n "\$aliases" && (
2817 cd \$cf_subdir\${section} && (
2818 source=\`echo \$target |sed -e 's%^.*/\([[^/]][[^/]]*/[[^/]][[^/]]*$\)%\1%'\`
2819 test -n "$cf_so_strip" && source=\`echo \$source |sed -e 's%\.$cf_so_strip\$%%'\`
2820 target=\`basename \$target\`
2821 for cf_alias in \$aliases
2822 do
2823 if test \$section = 1 ; then
2824 cf_alias=\`echo \$cf_alias|sed "\${transform}"\`
2825 fi
2826
2827 if test "$MANPAGE_SYMLINKS" = yes ; then
2828 if test -f \$cf_alias\${suffix} ; then
2829 if ( cmp -s \$target \$cf_alias\${suffix} )
2830 then
2831 continue
2832 fi
2833 fi
2834 echo .. \$verb alias \$cf_alias\${suffix}
2835 rm -f \$cf_alias\${suffix}
2836 $LN_S \$target \$cf_alias\${suffix}
2837 elif test "\$target" != "\$cf_alias\${suffix}" ; then
2838 echo ".so \$source" >\$TMP
2839CF_EOF
2840if test -n "$cf_compress" ; then
2841cat >>$cf_edit_man <<CF_EOF
2842 if test -n "$cf_so_strip" ; then
2843 $cf_compress -f \$TMP
2844 mv \$TMP.$cf_so_strip \$TMP
2845 fi
2846CF_EOF
2847fi
2848cat >>$cf_edit_man <<CF_EOF
2849 echo .. \$verb alias \$cf_alias\${suffix}
2850 rm -f \$cf_alias\${suffix}
2851 \$INSTALL_DATA \$TMP \$cf_alias\${suffix}
2852 fi
2853 done
2854 )
2855 )
2856 elif test \$verb = removing ; then
2857 echo \$verb \$target
2858 rm -f \$target
2859 test -n "\$aliases" && (
2860 cd \$cf_subdir\${section} && (
2861 for cf_alias in \$aliases
2862 do
2863 if test \$section = 1 ; then
2864 cf_alias=\`echo \$cf_alias|sed "\${transform}"\`
2865 fi
2866
2867 echo .. \$verb alias \$cf_alias\${suffix}
2868 rm -f \$cf_alias\${suffix}
2869 done
2870 )
2871 )
2872 else
2873# echo ".hy 0"
2874 cat \$TMP
2875 fi
2876 ;;
2877esac
2878done
2879
2880if test $cf_inboth = yes ; then
2881if test \$form != format ; then
2882 sh \[$]0 format \$verb \$mandir \$srcdir \[$]*
2883fi
2884fi
2885
2886exit 0
2887CF_EOF
2888chmod 755 $cf_edit_man
2889
2890])dnl
2891dnl ---------------------------------------------------------------------------
2892dnl CF_MATH_LIB version: 5 updated: 2000/05/28 01:39:10
2893dnl -----------
2894dnl Checks for libraries. At least one UNIX system, Apple Macintosh
2895dnl Rhapsody 5.5, does not have -lm. We cannot use the simpler
2896dnl AC_CHECK_LIB(m,sin), because that fails for C++.
2897AC_DEFUN([CF_MATH_LIB],
2898[
2899AC_CACHE_CHECK(if -lm needed for math functions,
2900 cf_cv_need_libm,[
2901 AC_TRY_LINK([
2902 #include <stdio.h>
2903 #include <math.h>
2904 ],
2905 [double x = rand(); printf("result = %g\n", ]ifelse($2,,sin(x),$2)[)],
2906 [cf_cv_need_libm=no],
2907 [cf_cv_need_libm=yes])])
2908if test "$cf_cv_need_libm" = yes
2909then
2910ifelse($1,,[
2911 LIBS="$LIBS -lm"
2912],[$1=-lm])
2913fi
2914])
2915dnl ---------------------------------------------------------------------------
2916dnl CF_MIXEDCASE_FILENAMES version: 3 updated: 2003/09/20 17:07:55
2917dnl ----------------------
2918dnl Check if the file-system supports mixed-case filenames. If we're able to
2919dnl create a lowercase name and see it as uppercase, it doesn't support that.
2920AC_DEFUN([CF_MIXEDCASE_FILENAMES],
2921[
2922AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[
2923if test "$cross_compiling" = yes ; then
2924 case $target_alias in #(vi
2925 *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-mingw32*|*-uwin*) #(vi
2926 cf_cv_mixedcase=no
2927 ;;
2928 *)
2929 cf_cv_mixedcase=yes
2930 ;;
2931 esac
2932else
2933 rm -f conftest CONFTEST
2934 echo test >conftest
2935 if test -f CONFTEST ; then
2936 cf_cv_mixedcase=no
2937 else
2938 cf_cv_mixedcase=yes
2939 fi
2940 rm -f conftest CONFTEST
2941fi
2942])
2943test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES)
2944])dnl
2945dnl ---------------------------------------------------------------------------
2946dnl CF_MKSTEMP version: 3 updated: 2001/11/08 20:59:59
2947dnl ----------
2948dnl Check for a working mkstemp. This creates two files, checks that they are
2949dnl successfully created and distinct (AmigaOS apparently fails on the last).
2950AC_DEFUN([CF_MKSTEMP],[
2951AC_CACHE_CHECK(for working mkstemp, cf_cv_func_mkstemp,[
2952rm -f conftest*
2953AC_TRY_RUN([
2954#include <sys/types.h>
2955#include <stdlib.h>
2956#include <stdio.h>
2957#include <string.h>
2958#include <sys/stat.h>
2959int main()
2960{
2961 char *tmpl = "conftestXXXXXX";
2962 char name[2][80];
2963 int n;
2964 int result = 0;
2965 int fd;
2966 struct stat sb;
2967
2968 umask(077);
2969 for (n = 0; n < 2; ++n) {
2970 strcpy(name[n], tmpl);
2971 if ((fd = mkstemp(name[n])) >= 0) {
2972 if (!strcmp(name[n], tmpl)
2973 || stat(name[n], &sb) != 0
2974 || (sb.st_mode & S_IFMT) != S_IFREG
2975 || (sb.st_mode & 077) != 0) {
2976 result = 1;
2977 }
2978 close(fd);
2979 }
2980 }
2981 if (result == 0
2982 && !strcmp(name[0], name[1]))
2983 result = 1;
2984 exit(result);
2985}
2986],[cf_cv_func_mkstemp=yes
2987],[cf_cv_func_mkstemp=no
2988],[AC_CHECK_FUNC(mkstemp)
2989])
2990])
2991if test "$cf_cv_func_mkstemp" = yes ; then
2992 AC_DEFINE(HAVE_MKSTEMP)
2993fi
2994])dnl
2995dnl ---------------------------------------------------------------------------
2996dnl CF_MSG_LOG version: 3 updated: 1997/09/07 14:05:52
2997dnl ----------
2998dnl Write a debug message to config.log, along with the line number in the
2999dnl configure script.
3000AC_DEFUN([CF_MSG_LOG],[
3001echo "(line __oline__) testing $* ..." 1>&AC_FD_CC
3002])dnl
3003dnl ---------------------------------------------------------------------------
3004dnl CF_NCURSES_ABI_6 version: 1 updated: 2005/09/17 18:42:49
3005dnl ----------------
3006dnl Set ncurses' ABI to 6 unless overridden by explicit configure option, and
3007dnl warn about this.
3008AC_DEFUN([CF_NCURSES_ABI_6],[
3009if test "${with_abi_version+set}" != set; then
3010 case $cf_cv_rel_version in
3011 5.*)
3012 cf_cv_rel_version=6.0
3013 cf_cv_abi_version=6
3014 AC_MSG_WARN(Overriding ABI version to $cf_cv_abi_version)
3015 ;;
3016 esac
3017fi
3018])dnl
3019dnl ---------------------------------------------------------------------------
3020dnl CF_NUMBER_SYNTAX version: 1 updated: 2003/09/20 18:12:49
3021dnl ----------------
3022dnl Check if the given variable is a number. If not, report an error.
3023dnl $1 is the variable
3024dnl $2 is the message
3025AC_DEFUN([CF_NUMBER_SYNTAX],[
3026if test -n "$1" ; then
3027 case $1 in #(vi
3028 [[0-9]]*) #(vi
3029 ;;
3030 *)
3031 AC_MSG_ERROR($2 is not a number: $1)
3032 ;;
3033 esac
3034else
3035 AC_MSG_ERROR($2 value is empty)
3036fi
3037])dnl
3038dnl ---------------------------------------------------------------------------
3039dnl CF_OBJ_SUBDIR version: 4 updated: 2002/02/23 20:38:31
3040dnl -------------
3041dnl Compute the object-directory name from the given model name
3042AC_DEFUN([CF_OBJ_SUBDIR],
3043[
3044 case $1 in
3045 libtool) $2='obj_lo' ;;
3046 normal) $2='objects' ;;
3047 debug) $2='obj_g' ;;
3048 profile) $2='obj_p' ;;
3049 shared)
3050 case $cf_cv_system_name in #(vi
3051 cygwin) #(vi
3052 $2='objects' ;;
3053 *)
3054 $2='obj_s' ;;
3055 esac
3056 esac
3057])dnl
3058dnl ---------------------------------------------------------------------------
3059dnl CF_PATHSEP version: 3 updated: 2001/01/12 01:23:53
3060dnl ----------
3061dnl Provide a value for the $PATH and similar separator
3062AC_DEFUN([CF_PATHSEP],
3063[
3064 case $cf_cv_system_name in
3065 os2*) PATHSEP=';' ;;
3066 *) PATHSEP=':' ;;
3067 esac
3068ifelse($1,,,[$1=$PATHSEP])
3069 AC_SUBST(PATHSEP)
3070])dnl
3071dnl ---------------------------------------------------------------------------
3072dnl CF_PATH_SYNTAX version: 9 updated: 2002/09/17 23:03:38
3073dnl --------------
3074dnl Check the argument to see that it looks like a pathname. Rewrite it if it
3075dnl begins with one of the prefix/exec_prefix variables, and then again if the
3076dnl result begins with 'NONE'. This is necessary to work around autoconf's
3077dnl delayed evaluation of those symbols.
3078AC_DEFUN([CF_PATH_SYNTAX],[
3079case ".[$]$1" in #(vi
3080.\[$]\(*\)*|.\'*\'*) #(vi
3081 ;;
3082..|./*|.\\*) #(vi
3083 ;;
3084.[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX
3085 ;;
3086.\[$]{*prefix}*) #(vi
3087 eval $1="[$]$1"
3088 case ".[$]$1" in #(vi
3089 .NONE/*)
3090 $1=`echo [$]$1 | sed -e s%NONE%$ac_default_prefix%`
3091 ;;
3092 esac
3093 ;; #(vi
3094.NONE/*)
3095 $1=`echo [$]$1 | sed -e s%NONE%$ac_default_prefix%`
3096 ;;
3097*)
3098 ifelse($2,,[AC_ERROR([expected a pathname, not \"[$]$1\"])],$2)
3099 ;;
3100esac
3101])dnl
3102dnl ---------------------------------------------------------------------------
3103dnl CF_POSIX_C_SOURCE version: 6 updated: 2005/07/14 20:25:10
3104dnl -----------------
3105dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed.
3106dnl
3107dnl POSIX.1-1990 _POSIX_SOURCE
3108dnl POSIX.1-1990 and _POSIX_SOURCE and
3109dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2
3110dnl Bindings Option
3111dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L
3112dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L
3113dnl X/Open 2000 _POSIX_C_SOURCE=200112L
3114dnl
3115dnl Parameters:
3116dnl $1 is the nominal value for _POSIX_C_SOURCE
3117AC_DEFUN([CF_POSIX_C_SOURCE],
3118[
3119cf_POSIX_C_SOURCE=ifelse($1,,199506L,$1)
3120
3121cf_save_CFLAGS="$CFLAGS"
3122cf_save_CPPFLAGS="$CPPFLAGS"
3123
3124CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE)
3125CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE)
3126
3127AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[
3128 CF_MSG_LOG(if the symbol is already defined go no further)
3129 AC_TRY_COMPILE([#include <sys/types.h>],[
3130#ifndef _POSIX_C_SOURCE
3131make an error
3132#endif],
3133 [cf_cv_posix_c_source=no],
3134 [cf_want_posix_source=no
3135 case .$cf_POSIX_C_SOURCE in #(vi
3136 .[[12]]??*) #(vi
3137 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
3138 ;;
3139 .2) #(vi
3140 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
3141 cf_want_posix_source=yes
3142 ;;
3143 .*)
3144 cf_want_posix_source=yes
3145 ;;
3146 esac
3147 if test "$cf_want_posix_source" = yes ; then
3148 AC_TRY_COMPILE([#include <sys/types.h>],[
3149#ifdef _POSIX_SOURCE
3150make an error
3151#endif],[],
3152 cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE")
3153 fi
3154 CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE)
3155 CFLAGS="$cf_trim_CFLAGS"
3156 CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source"
3157 CF_MSG_LOG(if the second compile does not leave our definition intact error)
3158 AC_TRY_COMPILE([#include <sys/types.h>],[
3159#ifndef _POSIX_C_SOURCE
3160make an error
3161#endif],,
3162 [cf_cv_posix_c_source=no])
3163 CFLAGS="$cf_save_CFLAGS"
3164 CPPFLAGS="$cf_save_CPPFLAGS"
3165 ])
3166])
3167
3168if test "$cf_cv_posix_c_source" != no ; then
3169 CFLAGS="$cf_trim_CFLAGS"
3170 CPPFLAGS="$cf_trim_CPPFLAGS"
3171 if test "$cf_cv_cc_u_d_options" = yes ; then
3172 cf_temp_posix_c_source=`echo "$cf_cv_posix_c_source" | \
3173 sed -e 's/-D/-U/g' -e 's/=[[^ ]]*//g'`
3174 CPPFLAGS="$CPPFLAGS $cf_temp_posix_c_source"
3175 fi
3176 CPPFLAGS="$CPPFLAGS $cf_cv_posix_c_source"
3177fi
3178
3179])dnl
3180dnl ---------------------------------------------------------------------------
3181dnl CF_PREDEFINE version: 1 updated: 2003/07/26 17:53:56
3182dnl ------------
3183dnl Add definitions to CPPFLAGS to ensure they're predefined for all compiles.
3184dnl
3185dnl $1 = symbol to test
3186dnl $2 = value (if any) to use for a predefinition
3187AC_DEFUN([CF_PREDEFINE],
3188[
3189AC_MSG_CHECKING(if we must define $1)
3190AC_TRY_COMPILE([#include <sys/types.h>
3191],[
3192#ifndef $1
3193make an error
3194#endif],[cf_result=no],[cf_result=yes])
3195AC_MSG_RESULT($cf_result)
3196
3197if test "$cf_result" = yes ; then
3198 CPPFLAGS="$CPPFLAGS ifelse($2,,-D$1,[-D$1=$2])"
3199elif test "x$2" != "x" ; then
3200 AC_MSG_CHECKING(checking for compatible value versus $2)
3201 AC_TRY_COMPILE([#include <sys/types.h>
3202],[
3203#if $1-$2 < 0
3204make an error
3205#endif],[cf_result=yes],[cf_result=no])
3206 AC_MSG_RESULT($cf_result)
3207 if test "$cf_result" = no ; then
3208 # perhaps we can override it - try...
3209 CPPFLAGS="$CPPFLAGS -D$1=$2"
3210 fi
3211fi
3212])dnl
3213dnl ---------------------------------------------------------------------------
3214dnl CF_PROG_CC_C_O version: 1 updated: 2004/02/14 15:00:43
3215dnl --------------
3216dnl Analogous to AC_PROG_CC_C_O, but more useful: tests only $CC, ensures that
3217dnl the output file can be renamed, and allows for a shell variable that can
3218dnl be used later. The parameter is either CC or CXX. The result is the
3219dnl cache variable:
3220dnl $cf_cv_prog_CC_c_o
3221dnl $cf_cv_prog_CXX_c_o
3222AC_DEFUN([CF_PROG_CC_C_O],
3223[AC_REQUIRE([AC_PROG_CC])dnl
3224AC_MSG_CHECKING([whether [$]$1 understands -c and -o together])
3225AC_CACHE_VAL(cf_cv_prog_$1_c_o,
3226[
3227cat > conftest.$ac_ext <<CF_EOF
3228#include <stdio.h>
3229int main()
3230{
3231 return 0;
3232}
3233CF_EOF
3234# We do the test twice because some compilers refuse to overwrite an
3235# existing .o file with -o, though they will create one.
3236ac_try='[$]$1 -c conftest.$ac_ext -o conftest2.$ac_objext >&AC_FD_CC'
3237if AC_TRY_EVAL(ac_try) &&
3238 test -f conftest2.$ac_objext && AC_TRY_EVAL(ac_try);
3239then
3240 eval cf_cv_prog_$1_c_o=yes
3241else
3242 eval cf_cv_prog_$1_c_o=no
3243fi
3244rm -f conftest*
3245])dnl
3246if test $cf_cv_prog_$1_c_o = yes; then
3247 AC_MSG_RESULT([yes])
3248else
3249 AC_MSG_RESULT([no])
3250fi
3251])dnl
3252dnl ---------------------------------------------------------------------------
3253dnl CF_PROG_CC_U_D version: 1 updated: 2005/07/14 16:59:30
3254dnl --------------
3255dnl Check if C (preprocessor) -U and -D options are processed in the order
3256dnl given rather than by type of option. Some compilers insist on apply all
3257dnl of the -U options after all of the -D options. Others allow mixing them,
3258dnl and may predefine symbols that conflict with those we define.
3259AC_DEFUN([CF_PROG_CC_U_D],
3260[
3261AC_CACHE_CHECK(if $CC -U and -D options work together,cf_cv_cc_u_d_options,[
3262 cf_save_CPPFLAGS="$CPPFLAGS"
3263 CPPFLAGS="-UU_D_OPTIONS -DU_D_OPTIONS -DD_U_OPTIONS -UD_U_OPTIONS"
3264 AC_TRY_COMPILE([],[
3265#ifndef U_D_OPTIONS
3266make an undefined-error
3267#endif
3268#ifdef D_U_OPTIONS
3269make a defined-error
3270#endif
3271 ],[
3272 cf_cv_cc_u_d_options=yes],[
3273 cf_cv_cc_u_d_options=no])
3274 CPPFLAGS="$cf_save_CPPFLAGS"
3275])
3276])dnl
3277dnl ---------------------------------------------------------------------------
3278dnl CF_PROG_EXT version: 10 updated: 2004/01/03 19:28:18
3279dnl -----------
3280dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX.
3281AC_DEFUN([CF_PROG_EXT],
3282[
3283AC_REQUIRE([CF_CHECK_CACHE])
3284case $cf_cv_system_name in
3285os2*)
3286 CFLAGS="$CFLAGS -Zmt"
3287 CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__"
3288 CXXFLAGS="$CXXFLAGS -Zmt"
3289 # autoconf's macro sets -Zexe and suffix both, which conflict:w
3290 LDFLAGS="$LDFLAGS -Zmt -Zcrtdll"
3291 ac_cv_exeext=.exe
3292 ;;
3293esac
3294
3295AC_EXEEXT
3296AC_OBJEXT
3297
3298PROG_EXT="$EXEEXT"
3299AC_SUBST(PROG_EXT)
3300test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT")
3301])dnl
3302dnl ---------------------------------------------------------------------------
3303dnl CF_PROG_INSTALL version: 5 updated: 2002/12/21 22:46:07
3304dnl ---------------
3305dnl Force $INSTALL to be an absolute-path. Otherwise, edit_man.sh and the
3306dnl misc/tabset install won't work properly. Usually this happens only when
3307dnl using the fallback mkinstalldirs script
3308AC_DEFUN([CF_PROG_INSTALL],
3309[AC_PROG_INSTALL
3310case $INSTALL in
3311/*)
3312 ;;
3313*)
3314 CF_DIRNAME(cf_dir,$INSTALL)
3315 test -z "$cf_dir" && cf_dir=.
3316 INSTALL=`cd $cf_dir && pwd`/`echo $INSTALL | sed -e 's%^.*/%%'`
3317 ;;
3318esac
3319])dnl
3320dnl ---------------------------------------------------------------------------
3321dnl CF_PROG_LDCONFIG version: 1 updated: 2003/09/20 17:07:55
3322dnl ----------------
3323dnl Check for ldconfig, needed to fixup shared libraries that would be built
3324dnl and then used in the install.
3325AC_DEFUN([CF_PROG_LDCONFIG],[
3326if test "$cross_compiling" = yes ; then
3327 LDCONFIG=:
3328else
3329case "$cf_cv_system_name" in #(vi
3330freebsd*) #(vi
3331 test -z "$LDCONFIG" && LDCONFIG="/sbin/ldconfig -R"
3332 ;;
3333*) LDPATH=$PATH:/sbin:/usr/sbin
3334 AC_PATH_PROG(LDCONFIG,ldconfig,,$LDPATH)
3335 ;;
3336esac
3337fi
3338AC_SUBST(LDCONFIG)
3339])dnl
3340dnl ---------------------------------------------------------------------------
3341dnl CF_REGEX version: 3 updated: 1997/11/01 14:26:01
3342dnl --------
3343dnl Attempt to determine if we've got one of the flavors of regular-expression
3344dnl code that we can support.
3345AC_DEFUN([CF_REGEX],
3346[
3347AC_MSG_CHECKING([for regular-expression headers])
3348AC_CACHE_VAL(cf_cv_regex,[
3349AC_TRY_LINK([#include <sys/types.h>
3350#include <regex.h>],[
3351 regex_t *p;
3352 int x = regcomp(p, "", 0);
3353 int y = regexec(p, "", 0, 0, 0);
3354 regfree(p);
3355 ],[cf_cv_regex="regex.h"],[
3356 AC_TRY_LINK([#include <regexp.h>],[
3357 char *p = compile("", "", "", 0);
3358 int x = step("", "");
3359 ],[cf_cv_regex="regexp.h"],[
3360 cf_save_LIBS="$LIBS"
3361 LIBS="-lgen $LIBS"
3362 AC_TRY_LINK([#include <regexpr.h>],[
3363 char *p = compile("", "", "");
3364 int x = step("", "");
3365 ],[cf_cv_regex="regexpr.h"],[LIBS="$cf_save_LIBS"])])])
3366])
3367AC_MSG_RESULT($cf_cv_regex)
3368case $cf_cv_regex in
3369 regex.h) AC_DEFINE(HAVE_REGEX_H_FUNCS) ;;
3370 regexp.h) AC_DEFINE(HAVE_REGEXP_H_FUNCS) ;;
3371 regexpr.h) AC_DEFINE(HAVE_REGEXPR_H_FUNCS) ;;
3372esac
3373])dnl
3374dnl ---------------------------------------------------------------------------
3375dnl CF_REMOVE_DEFINE version: 2 updated: 2005/07/09 16:12:18
3376dnl ----------------
3377dnl Remove all -U and -D options that refer to the given symbol from a list
3378dnl of C compiler options. This works around the problem that not all
3379dnl compilers process -U and -D options from left-to-right, so a -U option
3380dnl cannot be used to cancel the effect of a preceding -D option.
3381dnl
3382dnl $1 = target (which could be the same as the source variable)
3383dnl $2 = source (including '$')
3384dnl $3 = symbol to remove
3385define([CF_REMOVE_DEFINE],
3386[
3387# remove $3 symbol from $2
3388$1=`echo "$2" | \
3389 sed -e 's/-[[UD]]$3\(=[[^ ]]*\)\?[[ ]]/ /g' \
3390 -e 's/-[[UD]]$3\(=[[^ ]]*\)\?[$]//g'`
3391])dnl
3392dnl ---------------------------------------------------------------------------
3393dnl CF_SHARED_OPTS version: 31 updated: 2005/01/01 16:39:44
3394dnl --------------
3395dnl Attempt to determine the appropriate CC/LD options for creating a shared
3396dnl library.
3397dnl
3398dnl Note: $(LOCAL_LDFLAGS) is used to link executables that will run within the
3399dnl build-tree, i.e., by making use of the libraries that are compiled in ../lib
3400dnl We avoid compiling-in a ../lib path for the shared library since that can
3401dnl lead to unexpected results at runtime.
3402dnl $(LOCAL_LDFLAGS2) has the same intention but assumes that the shared libraries
3403dnl are compiled in ../../lib
3404dnl
3405dnl The variable 'cf_cv_do_symlinks' is used to control whether we configure
3406dnl to install symbolic links to the rel/abi versions of shared libraries.
3407dnl
3408dnl The variable 'cf_cv_shlib_version' controls whether we use the rel or abi
3409dnl version when making symbolic links.
3410dnl
3411dnl The variable 'cf_cv_shlib_version_infix' controls whether shared library
3412dnl version numbers are infix (ex: libncurses.<ver>.dylib) or postfix
3413dnl (ex: libncurses.so.<ver>).
3414dnl
3415dnl Some loaders leave 'so_locations' lying around. It's nice to clean up.
3416AC_DEFUN([CF_SHARED_OPTS],
3417[
3418 AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
3419 LOCAL_LDFLAGS=
3420 LOCAL_LDFLAGS2=
3421 LD_SHARED_OPTS=
3422 INSTALL_LIB="-m 644"
3423
3424 cf_cv_do_symlinks=no
3425
3426 AC_MSG_CHECKING(if release/abi version should be used for shared libs)
3427 AC_ARG_WITH(shlib-version,
3428 [ --with-shlib-version=X Specify rel or abi version for shared libs],
3429 [test -z "$withval" && withval=auto
3430 case $withval in #(vi
3431 yes) #(vi
3432 cf_cv_shlib_version=auto
3433 ;;
3434 rel|abi|auto|no) #(vi
3435 cf_cv_shlib_version=$withval
3436 ;;
3437 *)
3438 AC_ERROR([option value must be one of: rel, abi, auto or no])
3439 ;;
3440 esac
3441 ],[cf_cv_shlib_version=auto])
3442 AC_MSG_RESULT($cf_cv_shlib_version)
3443
3444 cf_cv_rm_so_locs=no
3445
3446 # Some less-capable ports of gcc support only -fpic
3447 CC_SHARED_OPTS=
3448 if test "$GCC" = yes
3449 then
3450 AC_MSG_CHECKING(which $CC option to use)
3451 cf_save_CFLAGS="$CFLAGS"
3452 for CC_SHARED_OPTS in -fPIC -fpic ''
3453 do
3454 CFLAGS="$cf_save_CFLAGS $CC_SHARED_OPTS"
3455 AC_TRY_COMPILE([#include <stdio.h>],[int x = 1],[break],[])
3456 done
3457 AC_MSG_RESULT($CC_SHARED_OPTS)
3458 CFLAGS="$cf_save_CFLAGS"
3459 fi
3460
3461 cf_cv_shlib_version_infix=no
3462
3463 case $cf_cv_system_name in
3464 beos*)
3465 MK_SHARED_LIB='$(CC) -o $[@] -Xlinker -soname=`basename $[@]` -nostart -e 0'
3466 ;;
3467 cygwin*)
3468 CC_SHARED_OPTS=
3469 MK_SHARED_LIB='$(CC) -shared -Wl,--out-implib=$(IMPORT_LIB) -Wl,--export-all-symbols -o $(SHARED_LIB)'
3470 cf_cv_shlib_version=cygdll
3471 cf_cv_shlib_version_infix=cygdll
3472 ;;
3473 darwin*)
3474 EXTRA_CFLAGS="-no-cpp-precomp"
3475 CC_SHARED_OPTS="-dynamic"
3476 MK_SHARED_LIB='$(CC) -dynamiclib -install_name $(DESTDIR)$(libdir)/`basename $[@]` -compatibility_version $(ABI_VERSION) -current_version $(ABI_VERSION) -o $[@]'
3477 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=abi
3478 cf_cv_shlib_version_infix=yes
3479 ;;
3480 hpux*)
3481 # (tested with gcc 2.7.2 -- I don't have c89)
3482 if test "$GCC" = yes; then
3483 LD_SHARED_OPTS='-Xlinker +b -Xlinker $(libdir)'
3484 else
3485 CC_SHARED_OPTS='+Z'
3486 LD_SHARED_OPTS='-Wl,+b,$(libdir)'
3487 fi
3488 MK_SHARED_LIB='$(LD) +b $(libdir) -b -o $[@]'
3489 # HP-UX shared libraries must be executable, and should be
3490 # readonly to exploit a quirk in the memory manager.
3491 INSTALL_LIB="-m 555"
3492 ;;
3493 irix*)
3494 if test "$cf_cv_ld_rpath" = yes ; then
3495 if test "$GCC" = yes; then
3496 cf_ld_rpath_opt="-Wl,-rpath,"
3497 EXTRA_LDFLAGS="-Wl,-rpath,\$(libdir) $EXTRA_LDFLAGS"
3498 else
3499 cf_ld_rpath_opt="-rpath "
3500 EXTRA_LDFLAGS="-rpath \$(libdir) $EXTRA_LDFLAGS"
3501 fi
3502 fi
3503 # tested with IRIX 5.2 and 'cc'.
3504 if test "$GCC" != yes; then
3505 CC_SHARED_OPTS='-KPIC'
3506 fi
3507 MK_SHARED_LIB='$(LD) -shared -rdata_shared -soname `basename $[@]` -o $[@]'
3508 cf_cv_rm_so_locs=yes
3509 ;;
3510 linux*|gnu*|k*bsd*-gnu)
3511 if test "$DFT_LWR_MODEL" = "shared" ; then
3512 LOCAL_LDFLAGS="-Wl,-rpath,`pwd`/lib"
3513 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
3514 fi
3515 if test "$cf_cv_ld_rpath" = yes ; then
3516 cf_ld_rpath_opt="-Wl,-rpath,"
3517 EXTRA_LDFLAGS="$LOCAL_LDFLAGS $EXTRA_LDFLAGS"
3518 fi
3519 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
3520 MK_SHARED_LIB='$(CC) -shared -Wl,-soname,`basename $[@] .$(REL_VERSION)`.$(ABI_VERSION),-stats,-lc -o $[@]'
3521 ;;
3522 openbsd2*)
3523 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
3524 MK_SHARED_LIB='$(LD) -Bshareable -soname,`basename $[@].$(ABI_VERSION)` -o $[@]'
3525 ;;
3526 freebsd[[45]]*)
3527 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
3528 MK_SHARED_LIB='$(LD) -Bshareable -soname=`basename $[@]` -o $[@]'
3529 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
3530
3531# This doesn't work - I keep getting spurious references to needing
3532# libncurses.so.5.3 when ldd says it's resolved. LOCAL_LDFLAGS2 seems to be
3533# no longer used anyway. And the rpath logic isn't relative - so I have to
3534# add the local and install lib-directories:
3535#
3536# if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_ld_rpath" = yes ; then
3537# LOCAL_LDFLAGS="-rpath `pwd`/lib"
3538# LOCAL_LDFLAGS2="-rpath \$(libdir) $LOCAL_LDFLAGS"
3539# cf_ld_rpath_opt="-rpath "
3540# EXTRA_LDFLAGS="$LOCAL_LDFLAGS $EXTRA_LDFLAGS"
3541# fi
3542 ;;
3543 openbsd*|freebsd*)
3544 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
3545 MK_SHARED_LIB='$(LD) -Bshareable -o $[@]'
3546 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
3547 ;;
3548 netbsd*)
3549 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
3550 test "$cf_cv_ld_rpath" = yes && cf_ld_rpath_opt="-Wl,-rpath,"
3551 if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_ld_rpath" = yes ; then
3552 LOCAL_LDFLAGS="-Wl,-rpath,`pwd`/lib"
3553 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
3554 EXTRA_LDFLAGS="-Wl,-rpath,\$(libdir) $EXTRA_LDFLAGS"
3555 MK_SHARED_LIB='$(CC) -shared -Wl,-soname,`basename $[@] .$(REL_VERSION)`.$(ABI_VERSION) -o $[@]'
3556 if test "$cf_cv_shlib_version" = auto; then
3557 if test ! -f /usr/libexec/ld.elf_so; then
3558 cf_cv_shlib_version=rel
3559 fi
3560 fi
3561 else
3562 MK_SHARED_LIB='$(LD) -Bshareable -o $[@]'
3563 fi
3564 ;;
3565 osf*|mls+*)
3566 # tested with OSF/1 V3.2 and 'cc'
3567 # tested with OSF/1 V3.2 and gcc 2.6.3 (but the c++ demo didn't
3568 # link with shared libs).
3569 MK_SHARED_LIB='$(LD) -set_version $(REL_VERSION):$(ABI_VERSION) -expect_unresolved "*" -shared -soname `basename $[@]`'
3570 case $host_os in
3571 osf4*)
3572 MK_SHARED_LIB="${MK_SHARED_LIB} -msym"
3573 ;;
3574 esac
3575 MK_SHARED_LIB="${MK_SHARED_LIB}"' -o $[@]'
3576 if test "$DFT_LWR_MODEL" = "shared" ; then
3577 LOCAL_LDFLAGS="-Wl,-rpath,`pwd`/lib"
3578 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
3579 fi
3580 if test "$cf_cv_ld_rpath" = yes ; then
3581 cf_ld_rpath_opt="-rpath"
3582 # EXTRA_LDFLAGS="$LOCAL_LDFLAGS $EXTRA_LDFLAGS"
3583 fi
3584 cf_cv_rm_so_locs=yes
3585 ;;
3586 sco3.2v5*) # (also uw2* and UW7) hops 13-Apr-98
3587 # tested with osr5.0.5
3588 if test "$GCC" != yes; then
3589 CC_SHARED_OPTS='-belf -KPIC'
3590 fi
3591 MK_SHARED_LIB='$(LD) -dy -G -h `basename $[@] .$(REL_VERSION)`.$(ABI_VERSION) -o [$]@'
3592 if test "$cf_cv_ld_rpath" = yes ; then
3593 # only way is to set LD_RUN_PATH but no switch for it
3594 RUN_PATH=$libdir
3595 fi
3596 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
3597 LINK_PROGS='LD_RUN_PATH=$(libdir)'
3598 LINK_TESTS='Pwd=`pwd`;LD_RUN_PATH=`dirname $${Pwd}`/lib'
3599 ;;
3600 sunos4*)
3601 # tested with SunOS 4.1.1 and gcc 2.7.0
3602 if test "$GCC" != yes; then
3603 CC_SHARED_OPTS='-KPIC'
3604 fi
3605 MK_SHARED_LIB='$(LD) -assert pure-text -o $[@]'
3606 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
3607 ;;
3608 solaris2*)
3609 # tested with SunOS 5.5.1 (solaris 2.5.1) and gcc 2.7.2
3610 if test "$GCC" != yes; then
3611 CC_SHARED_OPTS='-KPIC'
3612 fi
3613 MK_SHARED_LIB='$(LD) -dy -G -h `basename $[@] .$(REL_VERSION)`.$(ABI_VERSION) -o $[@]'
3614 if test "$DFT_LWR_MODEL" = "shared" ; then
3615 LOCAL_LDFLAGS="-R `pwd`/lib:\$(libdir)"
3616 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
3617 fi
3618 if test "$cf_cv_ld_rpath" = yes ; then
3619 cf_ld_rpath_opt="-R"
3620 EXTRA_LDFLAGS="$LOCAL_LDFLAGS $EXTRA_LDFLAGS"
3621 fi
3622 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
3623 ;;
3624 sysv5uw7*|unix_sv*)
3625 # tested with UnixWare 7.1.0 (gcc 2.95.2 and cc)
3626 if test "$GCC" != yes; then
3627 CC_SHARED_OPTS='-KPIC'
3628 fi
3629 MK_SHARED_LIB='$(LD) -d y -G -o [$]@'
3630 ;;
3631 *)
3632 CC_SHARED_OPTS='unknown'
3633 MK_SHARED_LIB='echo unknown'
3634 ;;
3635 esac
3636
3637 # This works if the last tokens in $MK_SHARED_LIB are the -o target.
3638 case "$cf_cv_shlib_version" in #(vi
3639 rel|abi)
3640 case "$MK_SHARED_LIB" in #(vi
3641 *'-o $[@]')
3642 test "$cf_cv_do_symlinks" = no && cf_cv_do_symlinks=yes
3643 ;;
3644 *)
3645 AC_MSG_WARN(ignored --with-shlib-version)
3646 ;;
3647 esac
3648 ;;
3649 esac
3650
3651 if test -n "$cf_ld_rpath_opt" ; then
3652 AC_MSG_CHECKING(if we need a space after rpath option)
3653 cf_save_LIBS="$LIBS"
3654 LIBS="$LIBS ${cf_ld_rpath_opt}$libdir"
3655 AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes)
3656 LIBS="$cf_save_LIBS"
3657 AC_MSG_RESULT($cf_rpath_space)
3658 test "$cf_rpath_space" = yes && cf_ld_rpath_opt="$cf_ld_rpath_opt "
3659 MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\$(libdir)"
3660 fi
3661
3662 AC_SUBST(CC_SHARED_OPTS)
3663 AC_SUBST(LD_SHARED_OPTS)
3664 AC_SUBST(MK_SHARED_LIB)
3665 AC_SUBST(LINK_PROGS)
3666 AC_SUBST(LINK_TESTS)
3667 AC_SUBST(EXTRA_LDFLAGS)
3668 AC_SUBST(LOCAL_LDFLAGS)
3669 AC_SUBST(LOCAL_LDFLAGS2)
3670 AC_SUBST(INSTALL_LIB)
3671])dnl
3672dnl ---------------------------------------------------------------------------
3673dnl CF_SIZECHANGE version: 8 updated: 2000/11/04 12:22:16
3674dnl -------------
3675dnl Check for definitions & structures needed for window size-changing
3676dnl FIXME: check that this works with "snake" (HP-UX 10.x)
3677AC_DEFUN([CF_SIZECHANGE],
3678[
3679AC_REQUIRE([CF_STRUCT_TERMIOS])
3680AC_CACHE_CHECK(declaration of size-change, cf_cv_sizechange,[
3681 cf_cv_sizechange=unknown
3682 cf_save_CPPFLAGS="$CPPFLAGS"
3683
3684for cf_opts in "" "NEED_PTEM_H"
3685do
3686
3687 CPPFLAGS="$cf_save_CPPFLAGS"
3688 test -n "$cf_opts" && CPPFLAGS="$CPPFLAGS -D$cf_opts"
3689 AC_TRY_COMPILE([#include <sys/types.h>
3690#ifdef HAVE_TERMIOS_H
3691#include <termios.h>
3692#else
3693#ifdef HAVE_TERMIO_H
3694#include <termio.h>
3695#endif
3696#endif
3697#ifdef NEED_PTEM_H
3698/* This is a workaround for SCO: they neglected to define struct winsize in
3699 * termios.h -- it's only in termio.h and ptem.h
3700 */
3701#include <sys/stream.h>
3702#include <sys/ptem.h>
3703#endif
3704#if !defined(sun) || !defined(HAVE_TERMIOS_H)
3705#include <sys/ioctl.h>
3706#endif
3707],[
3708#ifdef TIOCGSIZE
3709 struct ttysize win; /* FIXME: what system is this? */
3710 int y = win.ts_lines;
3711 int x = win.ts_cols;
3712#else
3713#ifdef TIOCGWINSZ
3714 struct winsize win;
3715 int y = win.ws_row;
3716 int x = win.ws_col;
3717#else
3718 no TIOCGSIZE or TIOCGWINSZ
3719#endif /* TIOCGWINSZ */
3720#endif /* TIOCGSIZE */
3721 ],
3722 [cf_cv_sizechange=yes],
3723 [cf_cv_sizechange=no])
3724
3725 CPPFLAGS="$cf_save_CPPFLAGS"
3726 if test "$cf_cv_sizechange" = yes ; then
3727 echo "size-change succeeded ($cf_opts)" >&AC_FD_CC
3728 test -n "$cf_opts" && cf_cv_sizechange="$cf_opts"
3729 break
3730 fi
3731done
3732])
3733if test "$cf_cv_sizechange" != no ; then
3734 AC_DEFINE(HAVE_SIZECHANGE)
3735 case $cf_cv_sizechange in #(vi
3736 NEED*)
3737 AC_DEFINE_UNQUOTED($cf_cv_sizechange )
3738 ;;
3739 esac
3740fi
3741])dnl
3742dnl ---------------------------------------------------------------------------
3743dnl CF_SRC_MODULES version: 18 updated: 2005/05/28 12:58:54
3744dnl --------------
3745dnl For each parameter, test if the source-directory exists, and if it contains
3746dnl a 'modules' file. If so, add to the list $cf_cv_src_modules which we'll
3747dnl use in CF_LIB_RULES.
3748dnl
3749dnl This uses the configured value to make the lists SRC_SUBDIRS and
3750dnl SUB_MAKEFILES which are used in the makefile-generation scheme.
3751AC_DEFUN([CF_SRC_MODULES],
3752[
3753AC_MSG_CHECKING(for src modules)
3754
3755# dependencies and linker-arguments for test-programs
3756TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEPS"
3757TEST_DEP2="${LIB_2ND}/${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEP2"
3758if test "$DFT_LWR_MODEL" = "libtool"; then
3759 TEST_ARGS="${TEST_DEPS}"
3760 TEST_ARG2="${TEST_DEP2}"
3761else
3762 TEST_ARGS="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARGS"
3763 TEST_ARG2="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARG2"
3764fi
3765
3766cf_cv_src_modules=
3767for cf_dir in $1
3768do
3769 if test -f $srcdir/$cf_dir/modules; then
3770
3771 # We may/may not have tack in the distribution, though the
3772 # makefile is.
3773 if test $cf_dir = tack ; then
3774 if test ! -f $srcdir/${cf_dir}/${cf_dir}.h; then
3775 continue
3776 fi
3777 fi
3778
3779 if test -z "$cf_cv_src_modules"; then
3780 cf_cv_src_modules=$cf_dir
3781 else
3782 cf_cv_src_modules="$cf_cv_src_modules $cf_dir"
3783 fi
3784
3785 # Make the ncurses_cfg.h file record the library interface files as
3786 # well. These are header files that are the same name as their
3787 # directory. Ncurses is the only library that does not follow
3788 # that pattern.
3789 if test $cf_dir = tack ; then
3790 continue
3791 elif test -f $srcdir/${cf_dir}/${cf_dir}.h; then
3792 CF_UPPER(cf_have_include,$cf_dir)
3793 AC_DEFINE_UNQUOTED(HAVE_${cf_have_include}_H)
3794 AC_DEFINE_UNQUOTED(HAVE_LIB${cf_have_include})
3795 TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${cf_dir}${DFT_DEP_SUFFIX} $TEST_DEPS"
3796 TEST_DEP2="${LIB_2ND}/${LIB_PREFIX}${cf_dir}${DFT_DEP_SUFFIX} $TEST_DEP2"
3797 if test "$DFT_LWR_MODEL" = "libtool"; then
3798 TEST_ARGS="${TEST_DEPS}"
3799 TEST_ARG2="${TEST_DEP2}"
3800 else
3801 TEST_ARGS="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARGS"
3802 TEST_ARG2="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARG2"
3803 fi
3804 fi
3805 fi
3806done
3807AC_MSG_RESULT($cf_cv_src_modules)
3808
3809TEST_ARGS="-L${LIB_DIR} $TEST_ARGS"
3810TEST_ARG2="-L${LIB_2ND} $TEST_ARG2"
3811
3812AC_SUBST(TEST_ARGS)
3813AC_SUBST(TEST_DEPS)
3814
3815AC_SUBST(TEST_ARG2)
3816AC_SUBST(TEST_DEP2)
3817
3818SRC_SUBDIRS="man include"
3819for cf_dir in $cf_cv_src_modules
3820do
3821 SRC_SUBDIRS="$SRC_SUBDIRS $cf_dir"
3822done
3823SRC_SUBDIRS="$SRC_SUBDIRS test"
3824test -z "$MAKE_TERMINFO" && SRC_SUBDIRS="$SRC_SUBDIRS misc"
3825test "$cf_with_cxx_binding" != no && SRC_SUBDIRS="$SRC_SUBDIRS c++"
3826
3827ADA_SUBDIRS=
3828if test "$cf_cv_prog_gnat_correct" = yes && test -f $srcdir/Ada95/Makefile.in; then
3829 SRC_SUBDIRS="$SRC_SUBDIRS Ada95"
3830 ADA_SUBDIRS="gen src samples"
3831fi
3832
3833SUB_MAKEFILES=
3834for cf_dir in $SRC_SUBDIRS
3835do
3836 SUB_MAKEFILES="$SUB_MAKEFILES $cf_dir/Makefile"
3837done
3838
3839if test -n "$ADA_SUBDIRS"; then
3840 for cf_dir in $ADA_SUBDIRS
3841 do
3842 SUB_MAKEFILES="$SUB_MAKEFILES Ada95/$cf_dir/Makefile"
3843 done
3844 AC_SUBST(ADA_SUBDIRS)
3845fi
3846])dnl
3847dnl ---------------------------------------------------------------------------
3848dnl CF_STDCPP_LIBRARY version: 5 updated: 2000/08/12 23:18:52
3849dnl -----------------
3850dnl Check for -lstdc++, which is GNU's standard C++ library.
3851AC_DEFUN([CF_STDCPP_LIBRARY],
3852[
3853if test -n "$GXX" ; then
3854case $cf_cv_system_name in #(vi
3855os2*) #(vi
3856 cf_stdcpp_libname=stdcpp
3857 ;;
3858*)
3859 cf_stdcpp_libname=stdc++
3860 ;;
3861esac
3862AC_CACHE_CHECK(for library $cf_stdcpp_libname,cf_cv_libstdcpp,[
3863 cf_save="$LIBS"
3864 LIBS="$LIBS -l$cf_stdcpp_libname"
3865AC_TRY_LINK([
3866#include <strstream.h>],[
3867char buf[80];
3868strstreambuf foo(buf, sizeof(buf))
3869],
3870 [cf_cv_libstdcpp=yes],
3871 [cf_cv_libstdcpp=no])
3872 LIBS="$cf_save"
3873])
3874test "$cf_cv_libstdcpp" = yes && CXXLIBS="$CXXLIBS -l$cf_stdcpp_libname"
3875fi
3876])dnl
3877dnl ---------------------------------------------------------------------------
3878dnl CF_STRIP_G_OPT version: 3 updated: 2002/12/21 19:25:52
3879dnl --------------
3880dnl Remove "-g" option from the compiler options
3881AC_DEFUN([CF_STRIP_G_OPT],
3882[$1=`echo ${$1} | sed -e 's%-g %%' -e 's%-g$%%'`])dnl
3883dnl ---------------------------------------------------------------------------
3884dnl CF_STRUCT_SIGACTION version: 3 updated: 2000/08/12 23:18:52
3885dnl -------------------
3886dnl Check if we need _POSIX_SOURCE defined to use struct sigaction. We'll only
3887dnl do this if we've found the sigaction function.
3888dnl
3889dnl If needed, define SVR4_ACTION.
3890AC_DEFUN([CF_STRUCT_SIGACTION],[
3891if test "$ac_cv_func_sigaction" = yes; then
3892AC_MSG_CHECKING(whether sigaction needs _POSIX_SOURCE)
3893AC_TRY_COMPILE([
3894#include <sys/types.h>
3895#include <signal.h>],
3896 [struct sigaction act],
3897 [sigact_bad=no],
3898 [
3899AC_TRY_COMPILE([
3900#define _POSIX_SOURCE
3901#include <sys/types.h>
3902#include <signal.h>],
3903 [struct sigaction act],
3904 [sigact_bad=yes
3905 AC_DEFINE(SVR4_ACTION)],
3906 [sigact_bad=unknown])])
3907AC_MSG_RESULT($sigact_bad)
3908fi
3909])dnl
3910dnl ---------------------------------------------------------------------------
3911dnl CF_STRUCT_TERMIOS version: 5 updated: 2000/11/04 12:22:46
3912dnl -----------------
3913dnl Some machines require _POSIX_SOURCE to completely define struct termios.
3914dnl If so, define SVR4_TERMIO
3915AC_DEFUN([CF_STRUCT_TERMIOS],[
3916AC_CHECK_HEADERS( \
3917termio.h \
3918termios.h \
3919unistd.h \
3920)
3921if test "$ISC" = yes ; then
3922 AC_CHECK_HEADERS( sys/termio.h )
3923fi
3924if test "$ac_cv_header_termios_h" = yes ; then
3925 case "$CFLAGS $CPPFLAGS" in
3926 *-D_POSIX_SOURCE*)
3927 termios_bad=dunno ;;
3928 *) termios_bad=maybe ;;
3929 esac
3930 if test "$termios_bad" = maybe ; then
3931 AC_MSG_CHECKING(whether termios.h needs _POSIX_SOURCE)
3932 AC_TRY_COMPILE([#include <termios.h>],
3933 [struct termios foo; int x = foo.c_iflag],
3934 termios_bad=no, [
3935 AC_TRY_COMPILE([
3936#define _POSIX_SOURCE
3937#include <termios.h>],
3938 [struct termios foo; int x = foo.c_iflag],
3939 termios_bad=unknown,
3940 termios_bad=yes AC_DEFINE(SVR4_TERMIO))
3941 ])
3942 AC_MSG_RESULT($termios_bad)
3943 fi
3944fi
3945])dnl
3946dnl ---------------------------------------------------------------------------
3947dnl CF_SUBST version: 2 updated: 1997/09/06 23:41:28
3948dnl --------
3949dnl Shorthand macro for substituting things that the user may override
3950dnl with an environment variable.
3951dnl
3952dnl $1 = long/descriptive name
3953dnl $2 = environment variable
3954dnl $3 = default value
3955AC_DEFUN([CF_SUBST],
3956[AC_CACHE_VAL(cf_cv_subst_$2,[
3957AC_MSG_CHECKING(for $1 (symbol $2))
3958test -z "[$]$2" && $2=$3
3959AC_MSG_RESULT([$]$2)
3960AC_SUBST($2)
3961cf_cv_subst_$2=[$]$2])
3962$2=${cf_cv_subst_$2}
3963])dnl
3964dnl ---------------------------------------------------------------------------
3965dnl CF_SUBST_NCURSES_VERSION version: 7 updated: 2003/06/07 16:22:51
3966dnl ------------------------
3967dnl Get the version-number for use in shared-library naming, etc.
3968AC_DEFUN([CF_SUBST_NCURSES_VERSION],
3969[
3970NCURSES_MAJOR="`egrep '^NCURSES_MAJOR[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`"
3971NCURSES_MINOR="`egrep '^NCURSES_MINOR[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`"
3972NCURSES_PATCH="`egrep '^NCURSES_PATCH[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`"
3973cf_cv_abi_version=${NCURSES_MAJOR}
3974cf_cv_rel_version=${NCURSES_MAJOR}.${NCURSES_MINOR}
3975dnl Show the computed version, for logging
3976cf_cv_timestamp=`date`
3977AC_MSG_RESULT(Configuring NCURSES $cf_cv_rel_version ABI $cf_cv_abi_version ($cf_cv_timestamp))
3978dnl We need these values in the generated headers
3979AC_SUBST(NCURSES_MAJOR)
3980AC_SUBST(NCURSES_MINOR)
3981AC_SUBST(NCURSES_PATCH)
3982dnl We need these values in the generated makefiles
3983AC_SUBST(cf_cv_rel_version)
3984AC_SUBST(cf_cv_abi_version)
3985AC_SUBST(cf_cv_builtin_bool)
3986AC_SUBST(cf_cv_header_stdbool_h)
3987AC_SUBST(cf_cv_type_of_bool)dnl
3988])dnl
3989dnl ---------------------------------------------------------------------------
3990dnl CF_SYS_TIME_SELECT version: 4 updated: 2000/10/04 09:18:40
3991dnl ------------------
3992dnl Check if we can include <sys/time.h> with <sys/select.h>; this breaks on
3993dnl older SCO configurations.
3994AC_DEFUN([CF_SYS_TIME_SELECT],
3995[
3996AC_MSG_CHECKING(if sys/time.h works with sys/select.h)
3997AC_CACHE_VAL(cf_cv_sys_time_select,[
3998AC_TRY_COMPILE([
3999#include <sys/types.h>
4000#ifdef HAVE_SYS_TIME_H
4001#include <sys/time.h>
4002#endif
4003#ifdef HAVE_SYS_SELECT_H
4004#include <sys/select.h>
4005#endif
4006],[],[cf_cv_sys_time_select=yes],
4007 [cf_cv_sys_time_select=no])
4008 ])
4009AC_MSG_RESULT($cf_cv_sys_time_select)
4010test "$cf_cv_sys_time_select" = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT)
4011])dnl
4012dnl ---------------------------------------------------------------------------
4013dnl CF_TYPEOF_CHTYPE version: 6 updated: 2005/06/25 16:16:34
4014dnl ----------------
4015dnl Determine the type we should use for chtype (and attr_t, which is treated
4016dnl as the same thing). We want around 32 bits, so on most machines want a
4017dnl long, but on newer 64-bit machines, probably want an int. If we're using
4018dnl wide characters, we have to have a type compatible with that, as well.
4019AC_DEFUN([CF_TYPEOF_CHTYPE],
4020[
4021AC_MSG_CHECKING([for type of chtype])
4022AC_CACHE_VAL(cf_cv_typeof_chtype,[
4023 AC_TRY_RUN([
4024#define WANT_BITS 31
4025#include <stdio.h>
4026int main()
4027{
4028 FILE *fp = fopen("cf_test.out", "w");
4029 if (fp != 0) {
4030 char *result = "long";
4031 if (sizeof(unsigned long) > sizeof(unsigned int)) {
4032 int n;
4033 unsigned int x, y;
4034 for (n = 0; n < WANT_BITS; n++) {
4035 x = (1 << n);
4036 y = (x >> n);
4037 if (y != 1 || x == 0) {
4038 x = 0;
4039 break;
4040 }
4041 }
4042 /*
4043 * If x is nonzero, an int is big enough for the bits
4044 * that we want.
4045 */
4046 result = (x != 0) ? "int" : "long";
4047 }
4048 fputs(result, fp);
4049 fclose(fp);
4050 }
4051 exit(0);
4052}
4053 ],
4054 [cf_cv_typeof_chtype=`cat cf_test.out`],
4055 [cf_cv_typeof_chtype=long],
4056 [cf_cv_typeof_chtype=long])
4057 rm -f cf_test.out
4058 ])
4059AC_MSG_RESULT($cf_cv_typeof_chtype)
4060
4061AC_SUBST(cf_cv_typeof_chtype)
4062AC_DEFINE_UNQUOTED(TYPEOF_CHTYPE,$cf_cv_typeof_chtype)
4063])dnl
4064dnl ---------------------------------------------------------------------------
4065dnl CF_TYPE_SIGACTION version: 3 updated: 2000/08/12 23:18:52
4066dnl -----------------
4067dnl
4068AC_DEFUN([CF_TYPE_SIGACTION],
4069[
4070AC_MSG_CHECKING([for type sigaction_t])
4071AC_CACHE_VAL(cf_cv_type_sigaction,[
4072 AC_TRY_COMPILE([
4073#include <signal.h>],
4074 [sigaction_t x],
4075 [cf_cv_type_sigaction=yes],
4076 [cf_cv_type_sigaction=no])])
4077AC_MSG_RESULT($cf_cv_type_sigaction)
4078test "$cf_cv_type_sigaction" = yes && AC_DEFINE(HAVE_TYPE_SIGACTION)
4079])dnl
4080dnl ---------------------------------------------------------------------------
4081dnl CF_UNSIGNED_LITERALS version: 2 updated: 1998/02/07 22:10:16
4082dnl --------------------
4083dnl Test if the compiler supports 'U' and 'L' suffixes. Only old compilers
4084dnl won't, but they're still there.
4085AC_DEFUN([CF_UNSIGNED_LITERALS],
4086[
4087AC_MSG_CHECKING([if unsigned literals are legal])
4088AC_CACHE_VAL(cf_cv_unsigned_literals,[
4089 AC_TRY_COMPILE([],[long x = 1L + 1UL + 1U + 1],
4090 [cf_cv_unsigned_literals=yes],
4091 [cf_cv_unsigned_literals=no])
4092 ])
4093AC_MSG_RESULT($cf_cv_unsigned_literals)
4094])dnl
4095dnl ---------------------------------------------------------------------------
4096dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59
4097dnl --------
4098dnl Make an uppercase version of a variable
4099dnl $1=uppercase($2)
4100AC_DEFUN([CF_UPPER],
4101[
4102$1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
4103])dnl
4104dnl ---------------------------------------------------------------------------
4105dnl CF_VERBOSE version: 2 updated: 1997/09/05 10:45:14
4106dnl ----------
4107dnl Use AC_VERBOSE w/o the warnings
4108AC_DEFUN([CF_VERBOSE],
4109[test -n "$verbose" && echo " $1" 1>&AC_FD_MSG
4110])dnl
4111dnl ---------------------------------------------------------------------------
4112dnl CF_WCHAR_TYPE version: 2 updated: 2004/01/17 19:18:20
4113dnl -------------
4114dnl Check if type wide-character type $1 is declared, and if so, which header
4115dnl file is needed. The second parameter is used to set a shell variable when
4116dnl the type is not found. The first parameter sets a shell variable for the
4117dnl opposite sense.
4118AC_DEFUN([CF_WCHAR_TYPE],
4119[
4120# This is needed on Tru64 5.0 to declare $1
4121AC_CACHE_CHECK(if we must include wchar.h to declare $1,cf_cv_$1,[
4122AC_TRY_COMPILE([
4123#include <stdlib.h>
4124#include <stdarg.h>
4125#include <stdio.h>
4126#ifdef HAVE_LIBUTF8_H
4127#include <libutf8.h>
4128#endif],
4129 [$1 state],
4130 [cf_cv_$1=no],
4131 [AC_TRY_COMPILE([
4132#include <stdlib.h>
4133#include <stdarg.h>
4134#include <stdio.h>
4135#include <wchar.h>
4136#ifdef HAVE_LIBUTF8_H
4137#include <libutf8.h>
4138#endif],
4139 [$1 value],
4140 [cf_cv_$1=yes],
4141 [cf_cv_$1=unknown])])])
4142
4143if test "$cf_cv_$1" = yes ; then
4144 AC_DEFINE(NEED_WCHAR_H)
4145 NEED_WCHAR_H=1
4146fi
4147
4148ifelse($2,,,[
4149# if we do not find $1 in either place, use substitution to provide a fallback.
4150if test "$cf_cv_$1" = unknown ; then
4151 $2=1
4152fi
4153])
4154ifelse($3,,,[
4155# if we find $1 in either place, use substitution to provide a fallback.
4156if test "$cf_cv_$1" != unknown ; then
4157 $3=1
4158fi
4159])
4160])dnl
4161dnl ---------------------------------------------------------------------------
4162dnl CF_WITH_ABI_VERSION version: 1 updated: 2003/09/20 18:12:49
4163dnl -------------------
4164dnl Allow library's ABI to be overridden. Generally this happens when a
4165dnl packager has incremented the ABI past that used in the original package,
4166dnl and wishes to keep doing this.
4167dnl
4168dnl $1 is the package name, if any, to derive a corresponding {package}_ABI
4169dnl symbol.
4170AC_DEFUN([CF_WITH_ABI_VERSION],[
4171test -z "$cf_cv_abi_version" && cf_cv_abi_version=0
4172AC_ARG_WITH(abi-version,
4173[ --with-abi-version=XXX override derived ABI version],
4174[AC_MSG_WARN(overriding ABI version $cf_cv_abi_version to $withval)
4175 cf_cv_abi_version=$withval])
4176 CF_NUMBER_SYNTAX($cf_cv_abi_version,ABI version)
4177ifelse($1,,,[
4178$1_ABI=$cf_cv_abi_version
4179])
4180])dnl
4181dnl ---------------------------------------------------------------------------
4182dnl CF_WITH_DBMALLOC version: 4 updated: 2004/02/28 05:49:27
4183dnl ----------------
4184dnl Configure-option for dbmalloc. The optional parameter is used to override
4185dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests.
4186AC_DEFUN([CF_WITH_DBMALLOC],[
4187AC_MSG_CHECKING(if you want to link with dbmalloc for testing)
4188AC_ARG_WITH(dbmalloc,
4189 [ --with-dbmalloc use Conor Cahill's dbmalloc library],
4190 [with_dbmalloc=$withval],
4191 [with_dbmalloc=no])
4192AC_MSG_RESULT($with_dbmalloc)
4193if test "$with_dbmalloc" = yes ; then
4194 AC_CHECK_HEADER(dbmalloc.h,
4195 [AC_CHECK_LIB(dbmalloc,[debug_malloc]ifelse($1,,[],[,$1]))])
4196fi
4197])dnl
4198dnl ---------------------------------------------------------------------------
4199dnl CF_WITH_DMALLOC version: 4 updated: 2004/02/28 05:49:27
4200dnl ---------------
4201dnl Configure-option for dmalloc. The optional parameter is used to override
4202dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests.
4203AC_DEFUN([CF_WITH_DMALLOC],[
4204AC_MSG_CHECKING(if you want to link with dmalloc for testing)
4205AC_ARG_WITH(dmalloc,
4206 [ --with-dmalloc use Gray Watson's dmalloc library],
4207 [with_dmalloc=$withval],
4208 [with_dmalloc=no])
4209AC_MSG_RESULT($with_dmalloc)
4210if test "$with_dmalloc" = yes ; then
4211 AC_CHECK_HEADER(dmalloc.h,
4212 [AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse($1,,[],[,$1]))])
4213fi
4214])dnl
4215dnl ---------------------------------------------------------------------------
4216dnl CF_WITH_GPM version: 1 updated: 2005/06/25 15:47:45
4217dnl -----------
4218AC_DEFUN([CF_WITH_GPM],
4219[
4220AC_MSG_CHECKING(if you want to link with the GPM mouse library)
4221AC_ARG_WITH(gpm,
4222 [ --with-gpm use Alessandro Rubini's GPM library],
4223 [with_gpm=$withval],
4224 [with_gpm=maybe])
4225AC_MSG_RESULT($with_gpm)
4226if test "$with_gpm" != no ; then
4227 AC_CHECK_LIB(gpm,Gpm_Open,[
4228 AC_CHECK_HEADER(gpm.h,[
4229 AC_DEFINE(HAVE_GPM_H)
4230 with_gpm=yes
4231 ],[
4232 if test "$with_gpm" = yes ; then
4233 AC_ERROR(Cannot find GPM header)
4234 fi
4235 ])
4236 ],[
4237 if test "$with_gpm" = yes ; then
4238 AC_ERROR(Cannot link with GPM library)
4239 fi
4240 with_gpm=no
4241 ])
4242fi
4243])
4244dnl ---------------------------------------------------------------------------
4245dnl CF_WITH_LIBTOOL version: 9 updated: 2004/01/16 14:55:37
4246dnl ---------------
4247dnl Provide a configure option to incorporate libtool. Define several useful
4248dnl symbols for the makefile rules.
4249dnl
4250dnl The reference to AC_PROG_LIBTOOL does not normally work, since it uses
4251dnl macros from libtool.m4 which is in the aclocal directory of automake.
4252dnl Following is a simple script which turns on the AC_PROG_LIBTOOL macro.
4253dnl But that still does not work properly since the macro is expanded outside
4254dnl the CF_WITH_LIBTOOL macro:
4255dnl
4256dnl #!/bin/sh
4257dnl ACLOCAL=`aclocal --print-ac-dir`
4258dnl if test -z "$ACLOCAL" ; then
4259dnl echo cannot find aclocal directory
4260dnl exit 1
4261dnl elif test ! -f $ACLOCAL/libtool.m4 ; then
4262dnl echo cannot find libtool.m4 file
4263dnl exit 1
4264dnl fi
4265dnl
4266dnl LOCAL=aclocal.m4
4267dnl ORIG=aclocal.m4.orig
4268dnl
4269dnl trap "mv $ORIG $LOCAL" 0 1 2 5 15
4270dnl rm -f $ORIG
4271dnl mv $LOCAL $ORIG
4272dnl
4273dnl # sed the LIBTOOL= assignment to omit the current directory?
4274dnl sed -e 's/^LIBTOOL=.*/LIBTOOL=${LIBTOOL-libtool}/' $ACLOCAL/libtool.m4 >>$LOCAL
4275dnl cat $ORIG >>$LOCAL
4276dnl
4277dnl autoconf-257 $*
4278dnl
4279AC_DEFUN([CF_WITH_LIBTOOL],
4280[
4281ifdef([AC_PROG_LIBTOOL],,[
4282LIBTOOL=
4283])
4284# common library maintenance symbols that are convenient for libtool scripts:
4285LIB_CREATE='$(AR) -cr'
4286LIB_OBJECT='$(OBJECTS)'
4287LIB_SUFFIX=.a
4288LIB_PREP="$RANLIB"
4289
4290# symbols used to prop libtool up to enable it to determine what it should be
4291# doing:
4292LIB_CLEAN=
4293LIB_COMPILE=
4294LIB_LINK=
4295LIB_INSTALL=
4296LIB_UNINSTALL=
4297
4298AC_MSG_CHECKING(if you want to build libraries with libtool)
4299AC_ARG_WITH(libtool,
4300 [ --with-libtool generate libraries with libtool],
4301 [with_libtool=$withval],
4302 [with_libtool=no])
4303AC_MSG_RESULT($with_libtool)
4304if test "$with_libtool" != "no"; then
4305ifdef([AC_PROG_LIBTOOL],[
4306 # missing_content_AC_PROG_LIBTOOL{{
4307#bird AC_PROG_LIBTOOL
4308 # missing_content_AC_PROG_LIBTOOL}}
4309],[
4310 if test "$with_libtool" != "yes" ; then
4311 CF_PATH_SYNTAX(with_libtool)
4312 LIBTOOL=$with_libtool
4313 else
4314 AC_PATH_PROG(LIBTOOL,libtool)
4315 fi
4316 if test -z "$LIBTOOL" ; then
4317 AC_MSG_ERROR(Cannot find libtool)
4318 fi
4319])dnl
4320 LIB_CREATE='$(LIBTOOL) --mode=link $(CC) -rpath $(DESTDIR)$(libdir) -version-info `cut -f1 $(srcdir)/VERSION` -o'
4321 LIB_OBJECT='$(OBJECTS:.o=.lo)'
4322 LIB_SUFFIX=.la
4323 LIB_CLEAN='$(LIBTOOL) --mode=clean'
4324 LIB_COMPILE='$(LIBTOOL) --mode=compile'
4325 LIB_LINK='$(LIBTOOL) --mode=link'
4326 LIB_INSTALL='$(LIBTOOL) --mode=install'
4327 LIB_UNINSTALL='$(LIBTOOL) --mode=uninstall'
4328 LIB_PREP=:
4329
4330 # Show the version of libtool
4331 AC_MSG_CHECKING(version of libtool)
4332
4333 # Save the version in a cache variable - this is not entirely a good
4334 # thing, but the version string from libtool is very ugly, and for
4335 # bug reports it might be useful to have the original string.
4336 cf_cv_libtool_version=`$LIBTOOL --version 2>&1 | sed -e '2,$d' -e 's/([[^)]]*)//g' -e 's/^[[^1-9]]*//' -e 's/[[^0-9.]].*//'`
4337 AC_MSG_RESULT($cf_cv_libtool_version)
4338 if test -z "$cf_cv_libtool_version" ; then
4339 AC_MSG_ERROR(This is not libtool)
4340 fi
4341
4342 # special hack to add --tag option for C++ compiler
4343 case $cf_cv_libtool_version in
4344 1.[[5-9]]*|[[2-9]]*)
4345 LIBTOOL_CXX="$LIBTOOL --tag=CXX"
4346 ;;
4347 *)
4348 LIBTOOL_CXX="$LIBTOOL"
4349 ;;
4350 esac
4351else
4352 LIBTOOL=""
4353 LIBTOOL_CXX=""
4354fi
4355
4356test -z "$LIBTOOL" && ECHO_LT=
4357
4358AC_SUBST(LIBTOOL)
4359AC_SUBST(LIBTOOL_CXX)
4360
4361AC_SUBST(LIB_CREATE)
4362AC_SUBST(LIB_OBJECT)
4363AC_SUBST(LIB_SUFFIX)
4364AC_SUBST(LIB_PREP)
4365
4366AC_SUBST(LIB_CLEAN)
4367AC_SUBST(LIB_COMPILE)
4368AC_SUBST(LIB_LINK)
4369AC_SUBST(LIB_INSTALL)
4370AC_SUBST(LIB_UNINSTALL)
4371
4372])dnl
4373dnl ---------------------------------------------------------------------------
4374dnl CF_WITH_PATH version: 6 updated: 1998/10/11 00:40:17
4375dnl ------------
4376dnl Wrapper for AC_ARG_WITH to ensure that user supplies a pathname, not just
4377dnl defaulting to yes/no.
4378dnl
4379dnl $1 = option name
4380dnl $2 = help-text
4381dnl $3 = environment variable to set
4382dnl $4 = default value, shown in the help-message, must be a constant
4383dnl $5 = default value, if it's an expression & cannot be in the help-message
4384dnl
4385AC_DEFUN([CF_WITH_PATH],
4386[AC_ARG_WITH($1,[$2 ](default: ifelse($4,,empty,$4)),,
4387ifelse($4,,[withval="${$3}"],[withval="${$3-ifelse($5,,$4,$5)}"]))dnl
4388CF_PATH_SYNTAX(withval)
4389eval $3="$withval"
4390AC_SUBST($3)dnl
4391])dnl
4392dnl ---------------------------------------------------------------------------
4393dnl CF_WITH_PATHLIST version: 5 updated: 2001/12/10 01:28:30
4394dnl ----------------
4395dnl Process an option specifying a list of colon-separated paths.
4396dnl
4397dnl $1 = option name
4398dnl $2 = help-text
4399dnl $3 = environment variable to set
4400dnl $4 = default value, shown in the help-message, must be a constant
4401dnl $5 = default value, if it's an expression & cannot be in the help-message
4402dnl $6 = flag to tell if we want to define or substitute
4403dnl
4404AC_DEFUN([CF_WITH_PATHLIST],[
4405AC_REQUIRE([CF_PATHSEP])
4406AC_ARG_WITH($1,[$2 ](default: ifelse($4,,empty,$4)),,
4407ifelse($4,,[withval=${$3}],[withval=${$3-ifelse($5,,$4,$5)}]))dnl
4408
4409IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${PATHSEP}"
4410cf_dst_path=
4411for cf_src_path in $withval
4412do
4413 CF_PATH_SYNTAX(cf_src_path)
4414 test -n "$cf_dst_path" && cf_dst_path="${cf_dst_path}:"
4415 cf_dst_path="${cf_dst_path}${cf_src_path}"
4416done
4417IFS="$ac_save_ifs"
4418
4419ifelse($6,define,[
4420# Strip single quotes from the value, e.g., when it was supplied as a literal
4421# for $4 or $5.
4422case $cf_dst_path in #(vi
4423\'*)
4424 cf_dst_path=`echo $cf_dst_path |sed -e s/\'// -e s/\'\$//`
4425 ;;
4426esac
4427cf_dst_path=`echo "$cf_dst_path" | sed -e 's/\\\\/\\\\\\\\/g'`
4428])
4429
4430eval '$3="$cf_dst_path"'
4431AC_SUBST($3)dnl
4432
4433])dnl
4434dnl ---------------------------------------------------------------------------
4435dnl CF_WITH_REL_VERSION version: 1 updated: 2003/09/20 18:12:49
4436dnl -------------------
4437dnl Allow library's release-version to be overridden. Generally this happens when a
4438dnl packager has incremented the release-version past that used in the original package,
4439dnl and wishes to keep doing this.
4440dnl
4441dnl $1 is the package name, if any, to derive corresponding {package}_MAJOR
4442dnl and {package}_MINOR symbols
4443dnl symbol.
4444AC_DEFUN([CF_WITH_REL_VERSION],[
4445test -z "$cf_cv_rel_version" && cf_cv_rel_version=0.0
4446AC_ARG_WITH(rel-version,
4447[ --with-rel-version=XXX override derived release version],
4448[AC_MSG_WARN(overriding release version $cf_cv_rel_version to $withval)
4449 cf_cv_rel_version=$withval])
4450ifelse($1,,[
4451 CF_NUMBER_SYNTAX($cf_cv_rel_version,Release version)
4452],[
4453 $1_MAJOR=`echo "$cf_cv_rel_version" | sed -e 's/\..*//'`
4454 $1_MINOR=`echo "$cf_cv_rel_version" | sed -e 's/^[[^.]]*//' -e 's/^\.//' -e 's/\..*//'`
4455 CF_NUMBER_SYNTAX([$]$1_MAJOR,Release major-version)
4456 CF_NUMBER_SYNTAX([$]$1_MINOR,Release minor-version)
4457])
4458])dnl
4459dnl ---------------------------------------------------------------------------
4460dnl CF_WITH_SYSMOUSE version: 2 updated: 2003/03/22 19:13:43
4461dnl ----------------
4462dnl If we can compile with sysmouse, make it available unless it is not wanted.
4463AC_DEFUN([CF_WITH_SYSMOUSE],[
4464# not everyone has "test -c"
4465if test -c /dev/sysmouse 2>/dev/null ; then
4466AC_MSG_CHECKING(if you want to use sysmouse)
4467AC_ARG_WITH(sysmouse,
4468 [ --with-sysmouse use sysmouse (FreeBSD console)],
4469 [cf_with_sysmouse=$withval],
4470 [cf_with_sysmouse=maybe])
4471 if test "$cf_with_sysmouse" != no ; then
4472 AC_TRY_COMPILE([
4473#include <osreldate.h>
4474#if (__FreeBSD_version >= 400017)
4475#include <sys/consio.h>
4476#include <sys/fbio.h>
4477#else
4478#include <machine/console.h>
4479#endif
4480],[
4481 struct mouse_info the_mouse;
4482 ioctl(0, CONS_MOUSECTL, &the_mouse);
4483],[cf_with_sysmouse=yes],[cf_with_sysmouse=no])
4484 fi
4485AC_MSG_RESULT($cf_with_sysmouse)
4486test "$cf_with_sysmouse" = yes && AC_DEFINE(USE_SYSMOUSE)
4487fi
4488])dnl
4489dnl ---------------------------------------------------------------------------
4490dnl CF_XOPEN_SOURCE version: 22 updated: 2005/08/06 18:06:32
4491dnl ---------------
4492dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
4493dnl or adapt to the vendor's definitions to get equivalent functionality.
4494dnl
4495dnl Parameters:
4496dnl $1 is the nominal value for _XOPEN_SOURCE
4497dnl $2 is the nominal value for _POSIX_C_SOURCE
4498AC_DEFUN([CF_XOPEN_SOURCE],[
4499
4500AC_REQUIRE([CF_PROG_CC_U_D])
4501
4502cf_XOPEN_SOURCE=ifelse($1,,500,$1)
4503cf_POSIX_C_SOURCE=ifelse($2,,199506L,$2)
4504
4505case $host_os in #(vi
4506aix[[45]]*) #(vi
4507 CPPFLAGS="$CPPFLAGS -D_ALL_SOURCE"
4508 ;;
4509darwin*) #(vi
4510 # setting _XOPEN_SOURCE breaks things on Darwin
4511 ;;
4512freebsd*|emx*|os2*) #(vi
4513 # 5.x headers associate
4514 # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L
4515 # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L
4516 cf_POSIX_C_SOURCE=200112L
4517 cf_XOPEN_SOURCE=600
4518 CPPFLAGS="$CPPFLAGS -D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
4519 ;;
4520hpux*) #(vi
4521 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE"
4522 ;;
4523irix[[56]].*) #(vi
4524 CPPFLAGS="$CPPFLAGS -D_SGI_SOURCE"
4525 ;;
4526linux*|gnu*) #(vi
4527 CF_GNU_SOURCE
4528 ;;
4529mirbsd*) #(vi
4530 # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h>
4531 ;;
4532netbsd*) #(vi
4533 # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
4534 ;;
4535openbsd*) #(vi
4536 # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
4537 ;;
4538osf[[45]]*) #(vi
4539 CPPFLAGS="$CPPFLAGS -D_OSF_SOURCE"
4540 ;;
4541nto-qnx*) #(vi
4542 CPPFLAGS="$CPPFLAGS -D_QNX_SOURCE"
4543 ;;
4544sco*) #(vi
4545 # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
4546 ;;
4547solaris*) #(vi
4548 CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
4549 ;;
4550*)
4551 AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
4552 AC_TRY_COMPILE([#include <sys/types.h>],[
4553#ifndef _XOPEN_SOURCE
4554make an error
4555#endif],
4556 [cf_cv_xopen_source=no],
4557 [cf_save="$CPPFLAGS"
4558 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
4559 AC_TRY_COMPILE([#include <sys/types.h>],[
4560#ifdef _XOPEN_SOURCE
4561make an error
4562#endif],
4563 [cf_cv_xopen_source=no],
4564 [cf_cv_xopen_source=$cf_XOPEN_SOURCE])
4565 CPPFLAGS="$cf_save"
4566 ])
4567])
4568 if test "$cf_cv_xopen_source" != no ; then
4569 CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE)
4570 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE)
4571 test "$cf_cv_cc_u_d_options" = yes && \
4572 CPPFLAGS="$CPPFLAGS -U_XOPEN_SOURCE"
4573 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_cv_xopen_source"
4574 fi
4575 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
4576 ;;
4577esac
4578])
Note: See TracBrowser for help on using the repository browser.