1 dnl***************************************************************************
2 dnl Copyright (c) 1998 Free Software Foundation, Inc. *
4 dnl Permission is hereby granted, free of charge, to any person obtaining a *
5 dnl copy of this software and associated documentation files (the *
6 dnl "Software"), to deal in the Software without restriction, including *
7 dnl without limitation the rights to use, copy, modify, merge, publish, *
8 dnl distribute, distribute with modifications, sublicense, and/or sell *
9 dnl copies of the Software, and to permit persons to whom the Software is *
10 dnl furnished to do so, subject to the following conditions: *
12 dnl The above copyright notice and this permission notice shall be included *
13 dnl in all copies or substantial portions of the Software. *
15 dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
16 dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
17 dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
18 dnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
19 dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
20 dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
21 dnl THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
23 dnl Except as contained in this notice, the name(s) of the above copyright *
24 dnl holders shall not be used in advertising or otherwise to promote the *
25 dnl sale, use or other dealings in this Software without prior written *
27 dnl***************************************************************************
29 dnl Author: Thomas E. Dickey <dickey@clark.net> 1996,1997,1998
31 dnl $Id: aclocal.m4,v 1.162 1999/08/22 00:13:21 tom Exp $
32 dnl Macros used in NCURSES auto-configuration script.
34 dnl ---------------------------------------------------------------------------
35 dnl ---------------------------------------------------------------------------
36 dnl Construct the list of include-options for the C programs in the Ada95
38 AC_DEFUN([CF_ADA_INCLUDE_DIRS],
40 ACPPFLAGS="$ACPPFLAGS -I. -I../../include"
41 if test "$srcdir" != "."; then
42 ACPPFLAGS="$ACPPFLAGS -I\$(srcdir)/../../include"
44 if test -z "$GCC"; then
45 ACPPFLAGS="$ACPPFLAGS -I\$(includedir)"
46 elif test "$includedir" != "/usr/include"; then
47 if test "$includedir" = '${prefix}/include' ; then
48 if test $prefix != /usr ; then
49 ACPPFLAGS="$ACPPFLAGS -I\$(includedir)"
52 ACPPFLAGS="$ACPPFLAGS -I\$(includedir)"
57 dnl ---------------------------------------------------------------------------
58 dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES'
59 dnl in the sharutils 4.2 distribution.
60 AC_DEFUN([CF_ANSI_CC_CHECK],
62 AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
63 AC_CACHE_VAL(cf_cv_ansi_cc,[
65 cf_save_CFLAGS="$CFLAGS"
66 # Don't try gcc -ansi; that turns off useful extensions and
67 # breaks some systems' header files.
69 # Ultrix and OSF/1 -std1
70 # HP-UX -Aa -D_HPUX_SOURCE
72 # UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes)
73 for cf_arg in "-DCC_HAS_PROTOS" \
77 "-Aa -D_HPUX_SOURCE +e" \
78 "-Aa -D_HPUX_SOURCE" \
81 CFLAGS="$cf_save_CFLAGS $cf_arg"
85 #if !defined(__STDC__) || (__STDC__ != 1)
90 int test (int i, double x);
91 struct s1 {int (*f) (int a);};
92 struct s2 {int (*f) (double a);};],
93 [cf_cv_ansi_cc="$cf_arg"; break])
95 CFLAGS="$cf_save_CFLAGS"
97 AC_MSG_RESULT($cf_cv_ansi_cc)
99 if test "$cf_cv_ansi_cc" != "no"; then
100 if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then
101 CFLAGS="$CFLAGS $cf_cv_ansi_cc"
103 AC_DEFINE(CC_HAS_PROTOS)
107 dnl ---------------------------------------------------------------------------
108 dnl For programs that must use an ANSI compiler, obtain compiler options that
109 dnl will make it recognize prototypes. We'll do preprocessor checks in other
110 dnl macros, since tools such as unproto can fake prototypes, but only part of
111 dnl the preprocessor.
112 AC_DEFUN([CF_ANSI_CC_REQD],
113 [AC_REQUIRE([CF_ANSI_CC_CHECK])
114 if test "$cf_cv_ansi_cc" = "no"; then
116 [Your compiler does not appear to recognize prototypes.
117 You have the following choices:
118 a. adjust your compiler options
119 b. get an up-to-date compiler
120 c. use a wrapper such as unproto])
123 dnl ---------------------------------------------------------------------------
124 dnl Test if 'bool' is a builtin type in the configured C++ compiler. Some
125 dnl older compilers (e.g., gcc 2.5.8) don't support 'bool' directly; gcc
126 dnl 2.6.3 does, in anticipation of the ANSI C++ standard.
128 dnl Treat the configuration-variable specially here, since we're directly
129 dnl substituting its value (i.e., 1/0).
130 AC_DEFUN([CF_BOOL_DECL],
132 AC_MSG_CHECKING([for builtin ifelse(AC_LANG,[C],$CC,$CXX) bool type])
133 AC_CACHE_VAL(ifelse($1,,cf_cv_builtin_bool,[$1]),[
136 #include <sys/types.h>
138 [ifelse($1,,cf_cv_builtin_bool,[$1])=1],
139 [ifelse($1,,cf_cv_builtin_bool,[$1])=0])
141 if test $ifelse($1,,cf_cv_builtin_bool,[$1]) = 1
142 then AC_MSG_RESULT(yes)
143 else AC_MSG_RESULT(no)
146 dnl ---------------------------------------------------------------------------
147 dnl Test for the size of 'bool' in the configured C++ compiler (e.g., a type).
148 dnl Don't bother looking for bool.h, since it's been deprecated.
149 AC_DEFUN([CF_BOOL_SIZE],
151 AC_MSG_CHECKING([for size of ifelse(AC_LANG,[C],$CC,$CXX) bool])
152 AC_CACHE_VAL(cf_cv_type_of_bool,[
162 FILE *fp = fopen("cf_test.out", "w");
166 fputs("unsigned ", fp);
167 if (sizeof(x) == sizeof(int)) fputs("int", fp);
168 else if (sizeof(x) == sizeof(char)) fputs("char", fp);
169 else if (sizeof(x) == sizeof(short))fputs("short",fp);
170 else if (sizeof(x) == sizeof(long)) fputs("long", fp);
176 [cf_cv_type_of_bool=`cat cf_test.out`],
177 [cf_cv_type_of_bool=unknown],
178 [cf_cv_type_of_bool=unknown])
181 AC_MSG_RESULT($cf_cv_type_of_bool)
182 if test "$cf_cv_type_of_bool" = unknown ; then
183 AC_MSG_WARN(Assuming unsigned for type of bool)
184 cf_cv_type_of_bool=unsigned
187 dnl ---------------------------------------------------------------------------
188 dnl Determine the default configuration into which we'll install ncurses. This
189 dnl can be overridden by the user's command-line options. There's two items to
191 dnl 1. the prefix (e.g., /usr)
192 dnl 2. the header files (e.g., /usr/include/ncurses)
193 dnl We'll look for a previous installation of ncurses and use the same defaults.
195 dnl We don't use AC_PREFIX_DEFAULT, because it gets evaluated too soon, and
196 dnl we don't use AC_PREFIX_PROGRAM, because we cannot distinguish ncurses's
197 dnl programs from a vendor's.
198 AC_DEFUN([CF_CFG_DEFAULTS],
200 AC_MSG_CHECKING(for prefix)
201 if test "x$prefix" = "xNONE" ; then
202 case "$cf_cv_system_name" in
203 # non-vendor systems don't have a conflict
204 openbsd*|netbsd*|freebsd*|linux*)
207 *) prefix=$ac_default_prefix
211 AC_MSG_RESULT($prefix)
213 if test "x$prefix" = "xNONE" ; then
214 AC_MSG_CHECKING(for default include-directory)
215 test -n "$verbose" && echo 1>&AC_FD_MSG
218 $includedir/ncurses \
220 $prefix/include/ncurses \
222 /usr/local/include/ncurses \
226 cf_dir=`eval echo $cf_symbol`
227 if test -f $cf_dir/curses.h ; then
228 if ( fgrep NCURSES_VERSION $cf_dir/curses.h 2>&1 >/dev/null ) ; then
229 includedir="$cf_symbol"
230 test -n "$verbose" && echo $ac_n " found " 1>&AC_FD_MSG
234 test -n "$verbose" && echo " tested $cf_dir" 1>&AC_FD_MSG
236 AC_MSG_RESULT($includedir)
239 dnl ---------------------------------------------------------------------------
240 dnl Check if the terminal-capability database functions are available. If not,
241 dnl ncurses has a much-reduced version.
242 AC_DEFUN([CF_CGETENT],[
243 AC_MSG_CHECKING(for terminal-capability database functions)
244 AC_CACHE_VAL(cf_cv_cgetent,[
246 #include <stdlib.h>],[
249 char *db_array = temp;
250 cgetent(&buf, /* int *, */ &db_array, "vt100");
251 cgetcap(buf, "tc", '=');
252 cgetmatch(buf, "tc");
257 AC_MSG_RESULT($cf_cv_cgetent)
258 test $cf_cv_cgetent = yes && AC_DEFINE(HAVE_BSD_CGETENT)
260 dnl ---------------------------------------------------------------------------
261 dnl Check if we're accidentally using a cache from a different machine.
262 dnl Derive the system name, as a check for reusing the autoconf cache.
264 dnl If we've packaged config.guess and config.sub, run that (since it does a
265 dnl better job than uname).
266 AC_DEFUN([CF_CHECK_CACHE],
268 if test -f $srcdir/config.guess ; then
270 system_name="$host_os"
272 system_name="`(uname -s -r) 2>/dev/null`"
273 if test -z "$system_name" ; then
274 system_name="`(hostname) 2>/dev/null`"
277 test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name")
278 AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
280 test -z "$system_name" && system_name="$cf_cv_system_name"
281 test -n "$cf_cv_system_name" && AC_MSG_RESULT("Configuring for $cf_cv_system_name")
283 if test ".$system_name" != ".$cf_cv_system_name" ; then
284 AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name))
285 AC_ERROR("Please remove config.cache and try again.")
288 dnl ---------------------------------------------------------------------------
289 dnl Check for data that is usually declared in <stdio.h> or <errno.h>, e.g.,
290 dnl the 'errno' variable. Define a DECL_xxx symbol if we must declare it
293 dnl (I would use AC_CACHE_CHECK here, but it will not work when called in a
294 dnl loop from CF_SYS_ERRLIST).
296 dnl $1 = the name to check
297 AC_DEFUN([CF_CHECK_ERRNO],
299 AC_MSG_CHECKING(if external $1 is declared)
300 AC_CACHE_VAL(cf_cv_dcl_$1,[
306 #include <sys/types.h>
307 #include <errno.h> ],
308 [long x = (long) $1],
309 [eval 'cf_cv_dcl_'$1'=yes'],
310 [eval 'cf_cv_dcl_'$1'=no]')
313 eval 'cf_result=$cf_cv_dcl_'$1
314 AC_MSG_RESULT($cf_result)
316 if test "$cf_result" = no ; then
317 eval 'cf_result=DECL_'$1
318 CF_UPPER(cf_result,$cf_result)
319 AC_DEFINE_UNQUOTED($cf_result)
322 # It's possible (for near-UNIX clones) that the data doesn't exist
323 CF_CHECK_EXTERN_DATA($1,int)
325 dnl ---------------------------------------------------------------------------
326 dnl Check for existence of external data in the current set of libraries. If
327 dnl we can modify it, it's real enough.
328 dnl $1 = the name to check
330 AC_DEFUN([CF_CHECK_EXTERN_DATA],
332 AC_MSG_CHECKING(if external $1 exists)
333 AC_CACHE_VAL(cf_cv_have_$1,[
339 [eval 'cf_cv_have_'$1'=yes'],
340 [eval 'cf_cv_have_'$1'=no'])])
342 eval 'cf_result=$cf_cv_have_'$1
343 AC_MSG_RESULT($cf_result)
345 if test "$cf_result" = yes ; then
346 eval 'cf_result=HAVE_'$1
347 CF_UPPER(cf_result,$cf_result)
348 AC_DEFINE_UNQUOTED($cf_result)
352 dnl ---------------------------------------------------------------------------
353 dnl If we're trying to use g++, test if libg++ is installed (a rather common
354 dnl problem :-). If we have the compiler but no library, we'll be able to
355 dnl configure, but won't be able to build the c++ demo program.
356 AC_DEFUN([CF_CXX_LIBRARY],
358 cf_cxx_library=unknown
359 if test $ac_cv_prog_gxx = yes; then
360 AC_MSG_CHECKING([for libg++])
362 LIBS="$LIBS -lg++ -lm"
366 [float foo=abs(1.0)],
368 CXXLIBS="$CXXLIBS -lg++ -lm"],
371 AC_MSG_RESULT($cf_cxx_library)
374 dnl ---------------------------------------------------------------------------
375 AC_DEFUN([CF_DIRS_TO_MAKE],
378 for cf_item in $cf_list_models
380 CF_OBJ_SUBDIR($cf_item,cf_subdir)
381 DIRS_TO_MAKE="$DIRS_TO_MAKE $cf_subdir"
383 for cf_dir in $DIRS_TO_MAKE
385 test ! -d $cf_dir && mkdir $cf_dir
387 AC_SUBST(DIRS_TO_MAKE)
389 dnl ---------------------------------------------------------------------------
390 dnl Check if 'errno' is declared in <errno.h>
393 CF_CHECK_ERRNO(errno)
395 dnl ---------------------------------------------------------------------------
396 dnl Test for conflicting definitions of exception in gcc 2.8.0, etc., between
397 dnl math.h and builtin.h, only for ncurses
398 AC_DEFUN([CF_ETIP_DEFINES],
400 AC_MSG_CHECKING(for special defines needed for etip.h)
401 cf_save_CXXFLAGS="$CXXFLAGS"
403 for cf_math in "" MATH_H
405 for cf_excp in "" MATH_EXCEPTION
407 CXXFLAGS="$cf_save_CXXFLAGS -I${srcdir}/c++ -I${srcdir}/menu"
408 test -n "$cf_math" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_math}"
409 test -n "$cf_excp" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_excp}"
413 test -n "$cf_math" && AC_DEFINE(ETIP_NEEDS_${cf_math})
414 test -n "$cf_excp" && AC_DEFINE(ETIP_NEEDS_${cf_excp})
415 cf_result="$cf_math $cf_excp"
420 AC_MSG_RESULT($cf_result)
421 CXXFLAGS="$cf_save_CXXFLAGS"
423 dnl ---------------------------------------------------------------------------
424 dnl Check for memmove, or a bcopy that can handle overlapping copy. If neither
425 dnl is found, add our own version of memmove to the list of objects.
426 AC_DEFUN([CF_FUNC_MEMMOVE],
428 AC_CHECK_FUNC(memmove,,[
429 AC_CHECK_FUNC(bcopy,[
430 AC_CACHE_CHECK(if bcopy does overlapping moves,cf_cv_good_bcopy,[
433 static char data[] = "abcdefghijklmnopqrstuwwxyz";
435 bcopy(data, temp, sizeof(data));
436 bcopy(temp+10, temp, 15);
437 bcopy(temp+5, temp+15, 10);
438 exit (strcmp(temp, "klmnopqrstuwwxypqrstuwwxyz"));
441 [cf_cv_good_bcopy=yes],
442 [cf_cv_good_bcopy=no],
443 [cf_cv_good_bcopy=unknown])
445 ],[cf_cv_good_bcopy=no])
446 if test $cf_cv_good_bcopy = yes ; then
447 AC_DEFINE(USE_OK_BCOPY)
449 AC_DEFINE(USE_MY_MEMMOVE)
452 dnl ---------------------------------------------------------------------------
453 dnl Test for availability of useful gcc __attribute__ directives to quiet
454 dnl compiler warnings. Though useful, not all are supported -- and contrary
455 dnl to documentation, unrecognized directives cause older compilers to barf.
456 AC_DEFUN([CF_GCC_ATTRIBUTES],
460 cat > conftest.i <<EOF
468 #define GCC_NORETURN /* nothing */
471 #define GCC_UNUSED /* nothing */
476 AC_CHECKING([for gcc __attribute__ directives])
478 cat > conftest.$ac_ext <<EOF
479 #line __oline__ "configure"
480 #include "confdefs.h"
481 #include "conftest.h"
482 #include "conftest.i"
484 #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
486 #define GCC_PRINTFLIKE(fmt,var) /*nothing*/
489 #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
491 #define GCC_SCANFLIKE(fmt,var) /*nothing*/
493 extern void wow(char *,...) GCC_SCANFLIKE(1,2);
494 extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
495 extern void foo(void) GCC_NORETURN;
496 int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) { return 0; }
499 for cf_attribute in scanf printf unused noreturn
501 CF_UPPER(CF_ATTRIBUTE,$cf_attribute)
502 cf_directive="__attribute__(($cf_attribute))"
503 echo "checking for gcc $cf_directive" 1>&AC_FD_CC
504 case $cf_attribute in
506 cat >conftest.h <<EOF
507 #define GCC_$CF_ATTRIBUTE 1
511 cat >conftest.h <<EOF
512 #define GCC_$CF_ATTRIBUTE $cf_directive
516 if AC_TRY_EVAL(ac_compile); then
517 test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute)
518 cat conftest.h >>confdefs.h
520 # sed -e 's/__attr.*/\/*nothing*\//' conftest.h >>confdefs.h
524 fgrep define conftest.i >>confdefs.h
529 dnl ---------------------------------------------------------------------------
530 dnl Check if the compiler supports useful warning options. There's a few that
531 dnl we don't use, simply because they're too noisy:
533 dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x)
534 dnl -Wredundant-decls (system headers make this too noisy)
535 dnl -Wtraditional (combines too many unrelated messages, only a few useful)
536 dnl -Wwrite-strings (too noisy, but should review occasionally)
539 AC_DEFUN([CF_GCC_WARNINGS],
544 cat > conftest.$ac_ext <<EOF
545 #line __oline__ "configure"
546 int main(int argc, char *argv[]) { return (argv[argc-1] == 0) ; }
549 AC_CHECKING([for gcc warning options])
550 cf_save_CFLAGS="$CFLAGS"
551 EXTRA_CFLAGS="-W -Wall"
553 test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
559 Wmissing-declarations \
560 Wmissing-prototypes \
564 Wstrict-prototypes $cf_warn_CONST
566 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
567 if AC_TRY_EVAL(ac_compile); then
568 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
569 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
570 test "$cf_opt" = Wcast-qual && EXTRA_CFLAGS="$EXTRA_CFLAGS -DXTSTRINGDEFINES"
574 CFLAGS="$cf_save_CFLAGS"
576 AC_SUBST(EXTRA_CFLAGS)
578 dnl ---------------------------------------------------------------------------
579 dnl Verify that a test program compiles and runs with GNAT
580 dnl $cf_ada_make is set to the program that compiles/links
581 AC_DEFUN([CF_GNAT_TRY_RUN],
584 cat >>conftest.ads <<CF_EOF
587 cat >>conftest.adb <<CF_EOF
590 if ( $cf_ada_make conftest 1>&AC_FD_CC 2>&1 ) ; then
591 if ( ./conftest 1>&AC_FD_CC 2>&1 ) ; then
601 dnl ---------------------------------------------------------------------------
602 dnl Verify Version of GNAT.
603 AC_DEFUN([CF_GNAT_VERSION],
605 changequote(<<, >>)dnl
606 cf_cv_gnat_version=`$cf_ada_make -v 2>&1 | grep '[0-9].[0-9][0-9]*' |\
607 sed -e 's/[^0-9 \.]//g' | $AWK '{print $<<1>>;}'`
608 case $cf_cv_gnat_version in
610 cf_cv_prog_gnat_correct=yes
612 *) echo Unsupported GNAT version $cf_cv_gnat_version. Required is 3.10 or better. Disabling Ada95 binding.
613 cf_cv_prog_gnat_correct=no
616 case $cf_cv_gnat_version in
618 cf_compile_generics=generics
619 cf_generic_objects="\$(GENOBJS)"
621 *) cf_compile_generics=
627 dnl ---------------------------------------------------------------------------
628 dnl Insert text into the help-message, for readability, from AC_ARG_WITH.
629 AC_DEFUN([CF_HELP_MESSAGE],
630 [AC_DIVERT_HELP([$1])dnl
632 dnl ---------------------------------------------------------------------------
633 dnl Construct the list of include-options according to whether we're building
634 dnl in the source directory or using '--srcdir=DIR' option. If we're building
635 dnl with gcc, don't append the includedir if it happens to be /usr/include,
636 dnl since that usually breaks gcc's shadow-includes.
637 AC_DEFUN([CF_INCLUDE_DIRS],
639 CPPFLAGS="$CPPFLAGS -I. -I../include"
640 if test "$srcdir" != "."; then
641 CPPFLAGS="$CPPFLAGS -I\$(srcdir)/../include"
643 if test -z "$GCC"; then
644 CPPFLAGS="$CPPFLAGS -I\$(includedir)"
645 elif test "$includedir" != "/usr/include"; then
646 if test "$includedir" = '${prefix}/include' ; then
647 if test $prefix != /usr ; then
648 CPPFLAGS="$CPPFLAGS -I\$(includedir)"
651 CPPFLAGS="$CPPFLAGS -I\$(includedir)"
656 dnl ---------------------------------------------------------------------------
657 dnl Check if we have either a function or macro for 'isascii()'.
658 AC_DEFUN([CF_ISASCII],
660 AC_MSG_CHECKING(for isascii)
661 AC_CACHE_VAL(cf_cv_have_isascii,[
662 AC_TRY_LINK([#include <ctype.h>],[int x = isascii(' ')],
663 [cf_cv_have_isascii=yes],
664 [cf_cv_have_isascii=no])
666 AC_MSG_RESULT($cf_cv_have_isascii)
667 test $cf_cv_have_isascii = yes && AC_DEFINE(HAVE_ISASCII)
669 dnl ---------------------------------------------------------------------------
670 dnl Compute the library-prefix for the given host system
671 dnl $1 = variable to set
672 AC_DEFUN([CF_LIB_PREFIX],
674 case $cf_cv_system_name in
679 dnl ---------------------------------------------------------------------------
680 dnl Append definitions and rules for the given models to the subdirectory
681 dnl Makefiles, and the recursion rule for the top-level Makefile. If the
682 dnl subdirectory is a library-source directory, modify the LIBRARIES list in
683 dnl the corresponding makefile to list the models that we'll generate.
685 dnl For shared libraries, make a list of symbolic links to construct when
686 dnl generating each library. The convention used for Linux is the simplest
689 dnl lib<name>.so.<major> ->
690 dnl lib<name>.so.<maj>.<minor>
691 AC_DEFUN([CF_LIB_RULES],
693 CF_LIB_PREFIX(cf_prefix)
694 AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
695 for cf_dir in $SRC_SUBDIRS
697 if test -f $srcdir/$cf_dir/modules; then
700 for cf_item in $CF_LIST_MODELS
702 CF_LIB_SUFFIX($cf_item,cf_suffix)
703 cf_libs_to_make="$cf_libs_to_make ../lib/${cf_prefix}${cf_dir}${cf_suffix}"
706 if test $cf_dir = ncurses ; then
707 case "$LIB_SUBSETS" in
711 cf_item=`echo $cf_libs_to_make |sed -e s/$LIB_NAME/$TINFO_NAME/g`
712 cf_libs_to_make="$cf_item $cf_libs_to_make"
717 sed -e "s@\@LIBS_TO_MAKE\@@$cf_libs_to_make@" \
718 $cf_dir/Makefile >$cf_dir/Makefile.out
719 mv $cf_dir/Makefile.out $cf_dir/Makefile
721 $AWK -f $srcdir/mk-0th.awk \
723 $srcdir/$cf_dir/modules >>$cf_dir/Makefile
725 for cf_item in $CF_LIST_MODELS
727 echo 'Appending rules for '$cf_item' model ('$cf_dir')'
728 CF_UPPER(CF_ITEM,$cf_item)
729 CF_LIB_SUFFIX($cf_item,cf_suffix)
730 CF_OBJ_SUBDIR($cf_item,cf_subdir)
732 # These dependencies really are for development, not
733 # builds, but they are useful in porting, too.
734 cf_depend="../include/ncurses_cfg.h"
735 if test "$srcdir" = "."; then
738 cf_reldir="\$(srcdir)"
741 if test -f $srcdir/$cf_dir/$cf_dir.priv.h; then
742 cf_depend="$cf_depend $cf_reldir/$cf_dir.priv.h"
743 elif test -f $srcdir/$cf_dir/curses.priv.h; then
744 cf_depend="$cf_depend $cf_reldir/curses.priv.h"
747 for cf_subset in $LIB_SUBSETS
749 $AWK -f $srcdir/mk-1st.awk \
756 DoLinks=$cf_cv_do_symlinks \
757 rmSoLocs=$cf_cv_rm_so_locs \
758 ldconfig="$LDCONFIG" \
759 overwrite=$WITH_OVERWRITE \
760 depend="$cf_depend" \
762 $srcdir/$cf_dir/modules >>$cf_dir/Makefile
763 test $cf_dir = ncurses && WITH_OVERWRITE=no
764 $AWK -f $srcdir/mk-2nd.awk \
771 $srcdir/$cf_dir/modules >>$cf_dir/Makefile
776 echo ' cd '$cf_dir' && $(MAKE) $(CF_MFLAGS) [$]@' >>Makefile
779 for cf_dir in $SRC_SUBDIRS
781 if test -f $cf_dir/Makefile ; then
784 echo 'install.libs \' >> Makefile
785 echo 'uninstall.libs ::' >> Makefile
786 echo ' cd '$cf_dir' && $(MAKE) $(CF_MFLAGS) [$]@' >> Makefile
791 if test -f $srcdir/$cf_dir/modules; then
793 if test -f $srcdir/$cf_dir/headers; then
794 cat >> Makefile <<CF_EOF
796 uninstall.includes \\
799 if test "$cf_dir" != "c++" ; then
800 echo 'lint \' >> Makefile
802 cat >> Makefile <<CF_EOF
808 cd $cf_dir && \$(MAKE) \$(CF_MFLAGS) \[$]@
810 elif test -f $srcdir/$cf_dir/headers; then
811 cat >> Makefile <<CF_EOF
816 uninstall.includes ::
817 cd $cf_dir && \$(MAKE) \$(CF_MFLAGS) \[$]@
822 cat >> Makefile <<CF_EOF
825 cd misc && \$(MAKE) \$(CF_MFLAGS) \[$]@
828 cd man && \$(MAKE) \$(CF_MFLAGS) \[$]@
831 rm -f config.cache config.log config.status Makefile include/ncurses_cfg.h
832 rm -f headers.sh headers.sed
833 rm -rf \$(DIRS_TO_MAKE)
836 dnl If we're installing into a subdirectory of /usr/include, etc., we should
837 dnl prepend the subdirectory's name to the "#include" paths. It won't hurt
838 dnl anything, and will make it more standardized. It's awkward to decide this
839 dnl at configuration because of quoting, so we'll simply make all headers
840 dnl installed via a script that can do the right thing.
842 rm -f headers.sed headers.sh
844 dnl ( generating this script makes the makefiles a little tidier :-)
845 echo creating headers.sh
846 cat >headers.sh <<CF_EOF
848 # This shell script is generated by the 'configure' script. It is invoked in a
849 # subdirectory of the build tree. It generates a sed-script in the parent
850 # directory that is used to adjust includes for header files that reside in a
851 # subdirectory of /usr/include, etc.
853 while test \[$]# != 3
855 PRG="\$PRG \[$]1"; shift
860 echo installing \$SRC in \$DST
863 TMP=\${TMPDIR-/tmp}/\`basename \$SRC\`
864 if test ! -f ../headers.sed ; then
865 END=\`basename \$DST\`
866 for i in \`cat \$REF/../*/headers |fgrep -v "#"\`
868 NAME=\`basename \$i\`
869 echo "s/<\$NAME>/<\$END\/\$NAME>/" >> ../headers.sed
873 sed -f ../headers.sed \$SRC > \$TMP
874 eval \$PRG \$TMP \$DST
878 eval \$PRG \$SRC \$DST
883 chmod 0755 headers.sh
885 for cf_dir in $SRC_SUBDIRS
887 if test -f $srcdir/$cf_dir/headers; then
888 cat >>$cf_dir/Makefile <<CF_EOF
889 \$(INSTALL_PREFIX)\$(includedir) :
890 \$(srcdir)/../mkinstalldirs \[$]@
894 install.includes :: \$(INSTALL_PREFIX)\$(includedir) \\
897 for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"`
899 test -n "$j" && echo " $j \\" >>$cf_dir/Makefile
902 echo " $j" >>$cf_dir/Makefile
903 for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"`
905 echo " @ (cd \$(INSTALL_PREFIX)\$(includedir) && rm -f `basename $i`) ; ../headers.sh \$(INSTALL_DATA) \$(INSTALL_PREFIX)\$(includedir) \$(srcdir) $i" >>$cf_dir/Makefile
906 test $i = curses.h && echo " @ (cd \$(INSTALL_PREFIX)\$(includedir) && rm -f ncurses.h && \$(LN_S) curses.h ncurses.h)" >>$cf_dir/Makefile
909 cat >>$cf_dir/Makefile <<CF_EOF
913 uninstall.includes ::
915 for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"`
918 echo " -@ (cd \$(INSTALL_PREFIX)\$(includedir) && rm -f $i)" >>$cf_dir/Makefile
919 test $i = curses.h && echo " -@ (cd \$(INSTALL_PREFIX)\$(includedir) && rm -f ncurses.h)" >>$cf_dir/Makefile
925 dnl ---------------------------------------------------------------------------
926 dnl Compute the library-suffix from the given model name
928 dnl $2 = variable to set
929 AC_DEFUN([CF_LIB_SUFFIX],
931 AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
935 profile) $2='_p.a' ;;
937 case $cf_cv_system_name in
938 openbsd*|netbsd*|freebsd*)
939 $2='.so.$(REL_VERSION)' ;;
945 dnl ---------------------------------------------------------------------------
946 dnl Compute the string to append to -library from the given model name
947 AC_DEFUN([CF_LIB_TYPE],
956 dnl ---------------------------------------------------------------------------
957 dnl Some systems have a non-ANSI linker that doesn't pull in modules that have
958 dnl only data (i.e., no functions), for example NeXT. On those systems we'll
959 dnl have to provide wrappers for global tables to ensure they're linked
961 AC_DEFUN([CF_LINK_DATAONLY],
963 AC_MSG_CHECKING([if data-only library module links])
964 AC_CACHE_VAL(cf_cv_link_dataonly,[
967 cat >conftest.$ac_ext <<EOF
968 #line __oline__ "configure"
969 int testdata[3] = { 123, 456, 789 };
972 if AC_TRY_EVAL(ac_compile) ; then
973 mv conftest.o data.o && \
974 ( $AR $AR_OPTS conftest.a data.o ) 2>&5 1>/dev/null
976 rm -f conftest.$ac_ext data.o
978 cat >conftest.$ac_ext <<EOF
979 #line __oline__ "configure"
983 exit(1); /* I'm told this linker is broken */
985 extern int testdata[3];
986 return testdata[0] == 123
987 && testdata[1] == 456
988 && testdata[2] == 789;
993 if AC_TRY_EVAL(ac_compile); then
994 mv conftest.o func.o && \
995 ( $AR $AR_OPTS conftest.a func.o ) 2>&5 1>/dev/null
997 rm -f conftest.$ac_ext func.o
998 ( eval $ac_cv_prog_RANLIB conftest.a ) 2>&5 >/dev/null
1000 LIBS="conftest.a $LIBS"
1004 extern int testfunc();
1008 [cf_cv_link_dataonly=yes],
1009 [cf_cv_link_dataonly=no],
1010 [cf_cv_link_dataonly=unknown])
1013 AC_MSG_RESULT($cf_cv_link_dataonly)
1014 test $cf_cv_link_dataonly = no && AC_DEFINE(BROKEN_LINKER)
1016 dnl ---------------------------------------------------------------------------
1017 dnl Most Unix systems have both link and symlink, a few don't have symlink.
1018 dnl A few non-Unix systems implement symlink, but not link.
1019 dnl A few non-systems implement neither (or have nonfunctional versions).
1020 AC_DEFUN([CF_LINK_FUNCS],
1026 if test "$ac_cv_prog_cc_cross" = yes ; then
1031 AC_CACHE_CHECK(if link/symlink functions work,cf_cv_link_funcs,[
1033 for cf_func in link symlink ; do
1035 #include <sys/types.h>
1036 #include <sys/stat.h>
1037 #ifdef HAVE_UNISTD_H
1043 char *src = "config.log";
1044 char *dst = "conftest.chk";
1049 fail = ($cf_func("config.log", "conftest.chk") < 0)
1050 || (stat(dst, &dst_sb) < 0)
1051 || (dst_sb.st_mtime != src_sb.st_mtime);
1060 cf_cv_link_funcs="$cf_cv_link_funcs $cf_func"
1061 eval 'ac_cv_func_'$cf_func'=yes'],[
1062 eval 'ac_cv_func_'$cf_func'=no'],[
1063 eval 'ac_cv_func_'$cf_func'=error'])
1065 test -z "$cf_cv_link_funcs" && cf_cv_link_funcs=no
1069 dnl ---------------------------------------------------------------------------
1070 dnl Some 'make' programs support $(MAKEFLAGS), some $(MFLAGS), to pass 'make'
1071 dnl options to lower-levels. It's very useful for "make -n" -- if we have it.
1072 dnl (GNU 'make' does both, something POSIX 'make', which happens to make the
1073 dnl $(MAKEFLAGS) variable incompatible because it adds the assignments :-)
1074 AC_DEFUN([CF_MAKEFLAGS],
1076 AC_MSG_CHECKING([for makeflags variable])
1077 AC_CACHE_VAL(cf_cv_makeflags,[
1079 for cf_option in '-$(MAKEFLAGS)' '$(MFLAGS)'
1081 cat >cf_makeflags.tmp <<CF_EOF
1083 @ echo '.$cf_option'
1085 cf_result=`${MAKE-make} -k -f cf_makeflags.tmp 2>/dev/null`
1086 case "$cf_result" in
1088 cf_result=`${MAKE-make} -k -f cf_makeflags.tmp CC=cc 2>/dev/null`
1089 case "$cf_result" in
1090 .*CC=*) cf_cv_makeflags=
1092 *) cf_cv_makeflags=$cf_option
1097 *) echo no match "$cf_result"
1101 rm -f cf_makeflags.tmp])
1102 AC_MSG_RESULT($cf_cv_makeflags)
1103 AC_SUBST(cf_cv_makeflags)
1105 dnl ---------------------------------------------------------------------------
1106 dnl Option to allow user to override automatic configuration of manpage format.
1107 dnl There are several special cases.
1108 AC_DEFUN([CF_MANPAGE_FORMAT],
1109 [ AC_MSG_CHECKING(format of man-pages)
1111 AC_ARG_WITH(manpage-format,
1112 [ --with-manpage-format specify manpage-format: gzip/compress/BSDI/normal and
1113 optionally formatted, e.g., gzip,formatted],
1114 [cf_manpage_form=$withval],
1115 [cf_manpage_form=unknown])
1117 case ".$cf_manpage_form" in
1118 .gzip|.compress|.BSDI|.normal|.formatted) # (vi
1121 if test -z "$MANPATH" ; then
1122 MANPATH="/usr/man:/usr/share/man"
1124 # look for the 'date' man-page (it's most likely to be installed!)
1125 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
1126 cf_manpage_form=unknown
1127 for cf_dir in $MANPATH; do
1128 test -z "$cf_dir" && cf_dir=/usr/man
1129 changequote({{,}})dnl
1130 for cf_name in $cf_dir/*/date.[01]* $cf_dir/*/date
1133 cf_test=`echo $cf_name | sed -e 's/*//'`
1134 if test "x$cf_test" = "x$cf_name" ; then
1136 *.gz) cf_manpage_form=gzip;;
1137 *.Z) cf_manpage_form=compress;;
1138 *.0) cf_manpage_form=BSDI,formatted;;
1139 *) cf_manpage_form=normal;;
1144 if test "$cf_manpage_form" != "unknown" ; then
1151 AC_MSG_WARN(Unexpected manpage-format)
1155 AC_MSG_RESULT($cf_manpage_form)
1157 dnl ---------------------------------------------------------------------------
1158 dnl The Debian people have their own naming convention for manpages. This
1159 dnl option lets us override the name of the file containing renaming, or
1160 dnl disable it altogether.
1161 AC_DEFUN([CF_MANPAGE_RENAMES],
1163 AC_MSG_CHECKING(for manpage renaming)
1165 AC_ARG_WITH(manpage-renames,
1166 [ --with-manpage-renames specify manpage-renaming],
1167 [cf_manpage_renames=$withval],
1168 [cf_manpage_renames=yes])
1170 case ".$cf_manpage_renames" in #(vi
1174 # Debian 'man' program?
1175 if test -f /etc/debian_version ; then
1176 cf_manpage_renames=`cd $srcdir && pwd`/man/man_db.renames
1178 cf_manpage_renames=no
1183 if test "$cf_manpage_renames" != no ; then
1184 if test ! -f $cf_manpage_renames ; then
1185 AC_MSG_ERROR(not a filename: $cf_manpage_renames)
1188 test ! -d man && mkdir man
1190 # Construct a sed-script to perform renaming within man-pages
1191 if test -n "$cf_manpage_renames" ; then
1192 test ! -d man && mkdir man
1193 $srcdir/man/make_sed.sh $cf_manpage_renames >man/edit_man.sed
1197 AC_MSG_RESULT($cf_manpage_renames)
1199 dnl ---------------------------------------------------------------------------
1200 dnl Try to determine if the man-pages on the system are compressed, and if
1201 dnl so, what format is used. Use this information to construct a script that
1202 dnl will install man-pages.
1203 AC_DEFUN([CF_MAN_PAGES],
1205 CF_HELP_MESSAGE(Options to Specify How Manpages are Installed:)
1209 if test "$prefix" = "NONE" ; then
1210 cf_prefix="$ac_default_prefix"
1215 case "$cf_manpage_form" in # (vi
1217 cf_subdir='$mandir/cat'
1221 cf_subdir='$mandir/man'
1226 test ! -d man && mkdir man
1227 cat >man/edit_man.sh <<CF_EOF
1228 changequote({{,}})dnl
1230 # this script is generated by the configure-script
1233 MKDIRS="`cd $srcdir && pwd`/mkinstalldirs"
1235 INSTALL_DATA="$INSTALL_DATA"
1236 TMP=\${TMPDIR-/tmp}/man\$\$
1237 trap "rm -f \$TMP" 0 1 2 5 15
1245 for i in \{{$}}* ; do
1247 *.orig|*.rej) ;; #(vi
1249 section=\`expr "\$i" : '.*\\.\\([0-9]\\)[xm]*'\`;
1250 if test \$verb = installing ; then
1251 if test ! -d $cf_subdir\${section} ; then
1252 \$MKDIRS $cf_subdir\$section
1255 source=\`basename \$i\`
1257 if test "$cf_manpage_renames" = no ; then
1258 cat >>man/edit_man.sh <<CF_EOF
1259 target=$cf_subdir\${section}/\$source
1260 sed -e "s,@DATADIR@,\$datadir," < \$i >\$TMP
1263 cat >>man/edit_man.sh <<CF_EOF
1264 target=\`grep "^\$source" $cf_manpage_renames | $AWK '{print \{{$}}2}'\`
1265 if test -z "\$target" ; then
1266 echo '? missing rename for '\$source
1269 target="$cf_subdir\$section/\$target"
1270 test \$verb = installing && sed -e "s,@DATADIR@,\$datadir," < \$i | sed -f edit_man.sed >\$TMP
1273 if test $cf_format = yes ; then
1274 cat >>man/edit_man.sh <<CF_EOF
1275 nroff -man \$TMP >\$TMP.out
1279 case "$cf_manpage_form" in #(vi
1281 cat >>man/edit_man.sh <<CF_EOF
1282 if test \$verb = installing ; then
1283 if ( compress -f \$TMP )
1292 cat >>man/edit_man.sh <<CF_EOF
1293 if test \$verb = installing ; then
1294 if ( gzip -f \$TMP )
1299 target="\$target.gz"
1303 cat >>man/edit_man.sh <<CF_EOF
1304 # BSDI installs only .0 suffixes in the cat directories
1305 target="\`echo \$target|sed -e 's/\.[1-9]\+.\?/.0/'\`"
1309 cat >>man/edit_man.sh <<CF_EOF
1310 echo \$verb \$target
1311 if test \$verb = installing ; then
1312 \$INSTALL_DATA \$TMP \$target
1321 chmod 755 man/edit_man.sh
1324 dnl ---------------------------------------------------------------------------
1325 dnl Compute the object-directory name from the given model name
1326 AC_DEFUN([CF_OBJ_SUBDIR],
1329 normal) $2='objects' ;;
1330 debug) $2='obj_g' ;;
1331 profile) $2='obj_p' ;;
1332 shared) $2='obj_s' ;;
1335 dnl ---------------------------------------------------------------------------
1336 dnl Check the argument to see that it looks like a pathname. Rewrite it if it
1337 dnl begins with one of the prefix/exec_prefix variables, and then again if the
1338 dnl result begins with 'NONE'. This is necessary to workaround autoconf's
1339 dnl delayed evaluation of those symbols.
1340 AC_DEFUN([CF_PATH_SYNTAX],[
1341 case ".[$]$1" in #(vi
1344 .\[$]{*prefix}*) #(vi
1346 case ".[$]$1" in #(vi
1348 $1=`echo [$]$1 | sed -e s@NONE@$ac_default_prefix@`
1353 $1=`echo [$]$1 | sed -e s@NONE@$ac_default_prefix@`
1356 AC_ERROR(expected a pathname)
1360 dnl ---------------------------------------------------------------------------
1361 dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX.
1362 AC_DEFUN([CF_PROG_EXT],
1364 AC_REQUIRE([CF_CHECK_CACHE])
1366 case $cf_cv_system_name in
1368 # We make sure -Zexe is not used -- it would interfere with @PROG_EXT@
1369 CFLAGS="$CFLAGS -Zmt -D__ST_MT_ERRNO__"
1370 LDFLAGS=`echo "$LDFLAGS -Zmt -Zcrtdll" | sed "s/-Zexe//g"`
1376 dnl ---------------------------------------------------------------------------
1377 dnl Force $INSTALL to be an absolute-path. Otherwise, edit_man.sh and the
1378 dnl misc/tabset install won't work properly. Usually this happens only when
1379 dnl using the fallback mkinstalldirs script
1380 AC_DEFUN([CF_PROG_INSTALL],
1386 changequote({{,}})dnl
1387 cf_dir=`echo $INSTALL|sed -e 's%/[^/]*$%%'`
1388 test -z "$cf_dir" && cf_dir=.
1390 INSTALL=`cd $cf_dir && pwd`/`echo $INSTALL | sed -e 's:^.*/::'`
1394 dnl ---------------------------------------------------------------------------
1395 dnl Attempt to determine if we've got one of the flavors of regular-expression
1396 dnl code that we can support.
1397 AC_DEFUN([CF_REGEX],
1399 AC_MSG_CHECKING([for regular-expression headers])
1400 AC_CACHE_VAL(cf_cv_regex,[
1401 AC_TRY_LINK([#include <sys/types.h>
1402 #include <regex.h>],[
1404 int x = regcomp(p, "", 0);
1405 int y = regexec(p, "", 0, 0, 0);
1407 ],[cf_cv_regex="regex.h"],[
1408 AC_TRY_LINK([#include <regexp.h>],[
1409 char *p = compile("", "", "", 0);
1410 int x = step("", "");
1411 ],[cf_cv_regex="regexp.h"],[
1412 cf_save_LIBS="$LIBS"
1414 AC_TRY_LINK([#include <regexpr.h>],[
1415 char *p = compile("", "", "");
1416 int x = step("", "");
1417 ],[cf_cv_regex="regexpr.h"],[LIBS="$cf_save_LIBS"])])])
1419 AC_MSG_RESULT($cf_cv_regex)
1420 case $cf_cv_regex in
1421 regex.h) AC_DEFINE(HAVE_REGEX_H_FUNCS) ;;
1422 regexp.h) AC_DEFINE(HAVE_REGEXP_H_FUNCS) ;;
1423 regexpr.h) AC_DEFINE(HAVE_REGEXPR_H_FUNCS) ;;
1426 dnl ---------------------------------------------------------------------------
1427 dnl Attempt to determine the appropriate CC/LD options for creating a shared
1430 dnl Note: $(LOCAL_LDFLAGS) is used to link executables that will run within the
1431 dnl build-tree, i.e., by making use of the libraries that are compiled in ../lib
1432 dnl We avoid compiling-in a ../lib path for the shared library since that can
1433 dnl lead to unexpected results at runtime.
1434 dnl $(LOCAL_LDFLAGS2) has the same intention but assumes that the shared libraries
1435 dnl are compiled in ../../lib
1437 dnl The variable 'cf_cv_do_symlinks' is used to control whether we configure
1438 dnl to install symbolic links to the rel/abi versions of shared libraries.
1440 dnl The variable 'cf_cv_shlib_version' controls whether we use the rel or abi
1441 dnl version when making symbolic links.
1443 dnl Some loaders leave 'so_locations' lying around. It's nice to clean up.
1444 AC_DEFUN([CF_SHARED_OPTS],
1446 AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
1450 INSTALL_LIB="-m 644"
1452 cf_cv_do_symlinks=no
1454 AC_MSG_CHECKING(if release/abi version should be used for shared libs)
1455 AC_ARG_WITH(shlib-version,
1456 [ --with-shlib-version=X Specify rel or abi version for shared libs],
1457 [test -z "$withval" && withval=auto
1458 case $withval in #(vi
1460 cf_cv_shlib_version=auto
1462 rel|abi|auto|no) #(vi
1463 cf_cv_shlib_version=$withval
1466 AC_ERROR([option value must be one of: rel, abi, auto or no])
1469 ],[cf_cv_shlib_version=auto])
1470 AC_MSG_RESULT($cf_cv_shlib_version)
1474 case $cf_cv_system_name in
1476 # (tested with gcc 2.7.2 -- I don't have c89)
1477 if test -n "$GCC"; then
1478 CC_SHARED_OPTS='-fPIC'
1479 LD_SHARED_OPTS='-Xlinker +b -Xlinker $(libdir)'
1482 LD_SHARED_OPTS='-Wl,+b,$(libdir)'
1484 MK_SHARED_LIB='$(LD) +b $(libdir) -b +h `basename $[@]` -o $[@]'
1485 # HP-UX shared libraries must be executable, and should be
1486 # readonly to exploit a quirk in the memory manager.
1487 INSTALL_LIB="-m 555"
1488 cf_cv_do_symlinks=reverse
1491 # (tested with gcc 2.7.2 -- I don't have c89)
1492 if test -n "$GCC"; then
1493 CC_SHARED_OPTS='-fPIC'
1494 LD_SHARED_OPTS='-Xlinker +b -Xlinker $(libdir)'
1497 LD_SHARED_OPTS='-Wl,+b,$(libdir)'
1499 MK_SHARED_LIB='$(LD) +b $(libdir) -b -o $[@]'
1500 # HP-UX shared libraries must be executable, and should be
1501 # readonly to exploit a quirk in the memory manager.
1502 INSTALL_LIB="-m 555"
1505 # tested with IRIX 5.2 and 'cc'.
1506 if test -n "$GCC"; then
1507 CC_SHARED_OPTS='-fPIC'
1509 CC_SHARED_OPTS='-KPIC'
1511 MK_SHARED_LIB='$(LD) -shared -rdata_shared -soname `basename $[@]` -o $[@]'
1512 cf_cv_rm_so_locs=yes
1515 # tested with Linux 2.0.29 and gcc 2.7.2 (ELF)
1516 CC_SHARED_OPTS='-fpic'
1517 test $cf_cv_ld_rpath = yes && cf_ld_rpath_opt="-Wl,-rpath,"
1518 if test $DFT_LWR_MODEL = "shared" ; then
1519 LOCAL_LDFLAGS='-Wl,-rpath,../lib'
1520 LOCAL_LDFLAGS2='-Wl,-rpath,../../lib'
1522 test $cf_cv_shlib_version = auto && cf_cv_shlib_version=rel
1523 if test $cf_cv_shlib_version = no ; then
1524 MK_SHARED_LIB='gcc -shared -Wl,-stats,-lc -o $[@]'
1526 MK_SHARED_LIB='gcc -shared -Wl,-soname,`basename $[@].$(ABI_VERSION)`,-stats,-lc -o $[@]'
1530 CC_SHARED_OPTS='-fpic -DPIC'
1531 MK_SHARED_LIB='$(LD) -Bshareable -soname,`basename $[@].$(ABI_VERSION)` -o $[@]'
1533 openbsd*|netbsd*|freebsd*)
1534 CC_SHARED_OPTS='-fpic -DPIC'
1535 MK_SHARED_LIB='$(LD) -Bshareable -o $[@]'
1538 # tested with OSF/1 V3.2 and 'cc'
1539 # tested with OSF/1 V3.2 and gcc 2.6.3 (but the c++ demo didn't
1540 # link with shared libs).
1542 MK_SHARED_LIB='$(LD) -set_version $(REL_VERSION):$(ABI_VERSION) -expect_unresolved "*" -shared -soname `basename $[@]`'
1543 test $cf_cv_ld_rpath = yes && cf_ld_rpath_opt="-rpath"
1546 MK_SHARED_LIB="${MK_SHARED_LIB} -msym"
1549 MK_SHARED_LIB="${MK_SHARED_LIB}"' -o $[@]'
1550 if test $DFT_LWR_MODEL = "shared" ; then
1551 LOCAL_LDFLAGS='-Wl,-rpath,../lib'
1552 LOCAL_LDFLAGS2='-Wl,-rpath,../../lib'
1554 cf_cv_rm_so_locs=yes
1556 sco3.2v5*) # (also uw2* and UW7) hops 13-Apr-98
1557 # tested with osr5.0.5
1558 if test $ac_cv_prog_gcc = yes; then
1559 CC_SHARED_OPTS='-melf -fpic'
1561 CC_SHARED_OPTS='-KPIC'
1563 MK_SHARED_LIB='$(LD) -dy -G -h `basename [$]@.$(ABI_VERSION)` -o [$]@'
1564 if test $cf_cv_ld_rpath = yes ; then
1565 # only way is to set LD_RUN_PATH but no switch for it
1568 test $cf_cv_shlib_version = auto && cf_cv_shlib_version=rel
1569 LINK_PROGS='LD_RUN_PATH=$(libdir)'
1570 LINK_TESTS='Pwd=`pwd`;LD_RUN_PATH=`dirname $${Pwd}`/lib'
1573 # tested with SunOS 4.1.1 and gcc 2.7.0
1574 if test $ac_cv_prog_gcc = yes; then
1575 CC_SHARED_OPTS='-fpic'
1577 CC_SHARED_OPTS='-KPIC'
1579 MK_SHARED_LIB='$(LD) -assert pure-text -o $[@]'
1580 test $cf_cv_shlib_version = auto && cf_cv_shlib_version=rel
1583 # tested with SunOS 5.5.1 (solaris 2.5.1) and gcc 2.7.2
1584 if test $ac_cv_prog_gcc = yes; then
1585 CC_SHARED_OPTS='-fpic'
1587 CC_SHARED_OPTS='-KPIC'
1589 MK_SHARED_LIB='$(LD) -dy -G -h `basename $[@].$(ABI_VERSION)` -o $[@]'
1590 if test $cf_cv_ld_rpath = yes ; then
1591 cf_ld_rpath_opt="-R"
1592 EXTRA_LDFLAGS="-R ../lib:\$(libdir) $EXTRA_LDFLAGS"
1594 test $cf_cv_shlib_version = auto && cf_cv_shlib_version=rel
1597 # tested with UnixWare 1.1.2
1598 CC_SHARED_OPTS='-KPIC'
1599 MK_SHARED_LIB='$(LD) -d y -G -o $[@]'
1602 CC_SHARED_OPTS='unknown'
1603 MK_SHARED_LIB='echo unknown'
1607 # This works if the last tokens in $MK_SHARED_LIB are the -o target.
1608 case "$cf_cv_shlib_version" in #(vi
1610 case "$MK_SHARED_LIB" in #(vi
1612 if test "$cf_cv_do_symlinks" = reverse ; then
1613 AC_ERROR(cannot use --with-shlib-version with this platform)
1615 if test "$cf_cv_shlib_version" = rel ; then
1616 MK_SHARED_LIB="$MK_SHARED_LIB"'.$(REL_VERSION)'
1618 MK_SHARED_LIB="$MK_SHARED_LIB"'.$(ABI_VERSION)'
1620 cf_cv_do_symlinks=yes
1623 AC_MSG_WARN(ignored --with-shlib-version)
1629 if test -n "$cf_ld_rpath_opt" ; then
1630 AC_MSG_CHECKING(if we need a space after rpath option)
1631 cf_save_LIBS="$LIBS"
1632 LIBS="$LIBS ${cf_ld_rpath_opt}/usr/lib"
1633 AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes)
1634 LIBS="$cf_save_LIBS"
1635 AC_MSG_RESULT($cf_rpath_space)
1636 test $cf_rpath_space = yes && cf_ld_rpath_opt="$cf_ld_rpath_opt "
1637 MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\$(libdir)"
1640 AC_SUBST(CC_SHARED_OPTS)
1641 AC_SUBST(LD_SHARED_OPTS)
1642 AC_SUBST(MK_SHARED_LIB)
1643 AC_SUBST(LINK_PROGS)
1644 AC_SUBST(LINK_TESTS)
1645 AC_SUBST(EXTRA_LDFLAGS)
1646 AC_SUBST(LOCAL_LDFLAGS)
1647 AC_SUBST(LOCAL_LDFLAGS2)
1648 AC_SUBST(INSTALL_LIB)
1650 dnl ---------------------------------------------------------------------------
1651 dnl Check for definitions & structures needed for window size-changing
1652 dnl FIXME: check that this works with "snake" (HP-UX 10.x)
1653 AC_DEFUN([CF_SIZECHANGE],
1655 AC_MSG_CHECKING([declaration of size-change])
1656 AC_CACHE_VAL(cf_cv_sizechange,[
1657 cf_cv_sizechange=unknown
1658 cf_save_CFLAGS="$CFLAGS"
1660 for cf_opts in "" "NEED_PTEM_H"
1663 CFLAGS="$cf_save_CFLAGS"
1664 test -n "$cf_opts" && CFLAGS="$CFLAGS -D$cf_opts"
1665 AC_TRY_COMPILE([#include <sys/types.h>
1667 #include <termios.h>
1674 /* This is a workaround for SCO: they neglected to define struct winsize in
1675 * termios.h -- it's only in termio.h and ptem.h
1677 #include <sys/stream.h>
1678 #include <sys/ptem.h>
1680 #if !defined(sun) || !defined(HAVE_TERMIOS_H)
1681 #include <sys/ioctl.h>
1685 struct ttysize win; /* FIXME: what system is this? */
1686 int y = win.ts_lines;
1687 int x = win.ts_cols;
1694 no TIOCGSIZE or TIOCGWINSZ
1695 #endif /* TIOCGWINSZ */
1696 #endif /* TIOCGSIZE */
1698 [cf_cv_sizechange=yes],
1699 [cf_cv_sizechange=no])
1701 CFLAGS="$cf_save_CFLAGS"
1702 if test "$cf_cv_sizechange" = yes ; then
1703 echo "size-change succeeded ($cf_opts)" >&AC_FD_CC
1704 test -n "$cf_opts" && AC_DEFINE_UNQUOTED($cf_opts)
1709 AC_MSG_RESULT($cf_cv_sizechange)
1710 test $cf_cv_sizechange != no && AC_DEFINE(HAVE_SIZECHANGE)
1712 dnl ---------------------------------------------------------------------------
1713 dnl Check for datatype 'speed_t', which is normally declared via either
1714 dnl sys/types.h or termios.h
1715 AC_DEFUN([CF_SPEED_TYPE],
1717 AC_MSG_CHECKING(for speed_t)
1719 AC_TRY_COMPILE([#include <sys/types.h>],
1720 [speed_t some_variable = 0],
1721 [OSPEED_TYPE=speed_t],
1722 [OSPEED_TYPE=unsigned])
1723 AC_TRY_COMPILE([#include <termios.h>],
1724 [speed_t some_variable = 0],
1725 [OSPEED_TYPE=speed_t
1726 OSPEED_INCLUDES="#include <termios.h>"],[])
1727 AC_SUBST(OSPEED_TYPE)
1728 AC_SUBST(OSPEED_INCLUDES)
1729 if test "$OSPEED_TYPE" = "unsigned" ; then
1731 AC_DEFINE(speed_t,unsigned)
1736 dnl ---------------------------------------------------------------------------
1737 dnl For each parameter, test if the source-directory exists, and if it contains
1738 dnl a 'modules' file. If so, add to the list $cf_cv_src_modules which we'll
1739 dnl use in CF_LIB_RULES.
1741 dnl This uses the configured value to make the lists SRC_SUBDIRS and
1742 dnl SUB_MAKEFILES which are used in the makefile-generation scheme.
1743 AC_DEFUN([CF_SRC_MODULES],
1745 AC_MSG_CHECKING(for src modules)
1747 # dependencies and linker-arguments for test-programs
1748 TEST_DEPS="${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEPS"
1749 TEST_ARGS="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARGS"
1751 # dependencies and linker-arguments for utility-programs
1752 PROG_ARGS="$TEST_ARGS"
1757 if test -f $srcdir/$cf_dir/modules; then
1759 # We may/may not have tack in the distribution, though the
1761 if test $cf_dir = tack ; then
1762 if test ! -f $srcdir/${cf_dir}/${cf_dir}.h; then
1767 if test -z "$cf_cv_src_modules"; then
1768 cf_cv_src_modules=$cf_dir
1770 cf_cv_src_modules="$cf_cv_src_modules $cf_dir"
1773 # Make the ncurses_cfg.h file record the library interface files as
1774 # well. These are header files that are the same name as their
1775 # directory. Ncurses is the only library that does not follow
1777 if test $cf_dir = tack ; then
1779 elif test -f $srcdir/${cf_dir}/${cf_dir}.h; then
1780 CF_UPPER(cf_have_include,$cf_dir)
1781 AC_DEFINE_UNQUOTED(HAVE_${cf_have_include}_H)
1782 AC_DEFINE_UNQUOTED(HAVE_LIB${cf_have_include})
1783 TEST_DEPS="${LIB_PREFIX}${cf_dir}${DFT_DEP_SUFFIX} $TEST_DEPS"
1784 TEST_ARGS="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARGS"
1788 AC_MSG_RESULT($cf_cv_src_modules)
1789 TEST_ARGS="-L${LIB_DIR} -L\$(libdir) $TEST_ARGS"
1793 PROG_ARGS="-L${LIB_DIR} -L\$(libdir) $PROG_ARGS"
1796 SRC_SUBDIRS="man include"
1797 for cf_dir in $cf_cv_src_modules
1799 SRC_SUBDIRS="$SRC_SUBDIRS $cf_dir"
1801 SRC_SUBDIRS="$SRC_SUBDIRS misc test"
1802 test $cf_cxx_library != no && SRC_SUBDIRS="$SRC_SUBDIRS c++"
1805 if test "$cf_cv_prog_gnat_correct" = yes && test -d $srcdir/Ada95; then
1806 SRC_SUBDIRS="$SRC_SUBDIRS Ada95"
1807 ADA_SUBDIRS="gen src samples"
1811 for cf_dir in $SRC_SUBDIRS
1813 SUB_MAKEFILES="$SUB_MAKEFILES $cf_dir/Makefile"
1816 if test -n "$ADA_SUBDIRS"; then
1817 for cf_dir in $ADA_SUBDIRS
1819 SUB_MAKEFILES="$SUB_MAKEFILES Ada95/$cf_dir/Makefile"
1821 AC_SUBST(ADA_SUBDIRS)
1824 dnl ---------------------------------------------------------------------------
1825 dnl Remove "-g" option from the compiler options
1826 AC_DEFUN([CF_STRIP_G_OPT],
1827 [$1=`echo ${$1} | sed -e 's/-g //' -e 's/-g$//'`])dnl
1828 dnl ---------------------------------------------------------------------------
1829 dnl Check if we need _POSIX_SOURCE defined to use struct sigaction. We'll only
1830 dnl do this if we've found the sigaction function.
1832 dnl If needed, define SVR4_ACTION.
1833 AC_DEFUN([CF_STRUCT_SIGACTION],[
1834 if test $ac_cv_func_sigaction = yes; then
1835 AC_MSG_CHECKING(whether sigaction needs _POSIX_SOURCE)
1837 #include <sys/types.h>
1838 #include <signal.h>],
1839 [struct sigaction act],
1843 #define _POSIX_SOURCE
1844 #include <sys/types.h>
1845 #include <signal.h>],
1846 [struct sigaction act],
1848 AC_DEFINE(SVR4_ACTION)],
1849 [sigact_bad=unknown])])
1850 AC_MSG_RESULT($sigact_bad)
1853 dnl ---------------------------------------------------------------------------
1854 dnl Some machines require _POSIX_SOURCE to completely define struct termios.
1855 dnl If so, define SVR4_TERMIO
1856 AC_DEFUN([CF_STRUCT_TERMIOS],[
1857 if test $ac_cv_header_termios_h = yes ; then
1860 termios_bad=dunno ;;
1861 *) termios_bad=maybe ;;
1863 if test $termios_bad = maybe ; then
1864 AC_MSG_CHECKING(whether termios.h needs _POSIX_SOURCE)
1865 AC_TRY_COMPILE([#include <termios.h>],
1866 [struct termios foo; int x = foo.c_iflag],
1869 #define _POSIX_SOURCE
1870 #include <termios.h>],
1871 [struct termios foo; int x = foo.c_iflag],
1872 termios_bad=unknown,
1873 termios_bad=yes AC_DEFINE(SVR4_TERMIO))
1875 AC_MSG_RESULT($termios_bad)
1879 dnl ---------------------------------------------------------------------------
1880 dnl Shorthand macro for substituting things that the user may override
1881 dnl with an environment variable.
1883 dnl $1 = long/descriptive name
1884 dnl $2 = environment variable
1885 dnl $3 = default value
1886 AC_DEFUN([CF_SUBST],
1887 [AC_CACHE_VAL(cf_cv_subst_$2,[
1888 AC_MSG_CHECKING(for $1 (symbol $2))
1889 test -z "[$]$2" && $2=$3
1890 AC_MSG_RESULT([$]$2)
1892 cf_cv_subst_$2=[$]$2])
1893 $2=${cf_cv_subst_$2}
1895 dnl ---------------------------------------------------------------------------
1896 dnl Get the version-number for use in shared-library naming, etc.
1897 AC_DEFUN([CF_SUBST_NCURSES_VERSION],
1900 NCURSES_MAJOR="`egrep '^NCURSES_MAJOR[ ]*=' $srcdir/dist.mk | sed -e 's/^[^0-9]*//'`"
1901 NCURSES_MINOR="`egrep '^NCURSES_MINOR[ ]*=' $srcdir/dist.mk | sed -e 's/^[^0-9]*//'`"
1902 NCURSES_PATCH="`egrep '^NCURSES_PATCH[ ]*=' $srcdir/dist.mk | sed -e 's/^[^0-9]*//'`"
1904 cf_cv_abi_version=${NCURSES_MAJOR}
1905 cf_cv_rel_version=${NCURSES_MAJOR}.${NCURSES_MINOR}
1906 dnl Show the computed version, for logging
1907 AC_MSG_RESULT(Configuring NCURSES $cf_cv_rel_version ABI $cf_cv_abi_version (`date`))
1908 dnl We need these values in the generated headers
1909 AC_SUBST(NCURSES_MAJOR)
1910 AC_SUBST(NCURSES_MINOR)
1911 AC_SUBST(NCURSES_PATCH)
1912 dnl We need these values in the generated makefiles
1913 AC_SUBST(cf_cv_rel_version)
1914 AC_SUBST(cf_cv_abi_version)
1915 AC_SUBST(cf_cv_cc_bool_type)
1916 AC_SUBST(cf_cv_builtin_bool)
1917 AC_SUBST(cf_cv_type_of_bool)dnl
1919 dnl ---------------------------------------------------------------------------
1920 dnl Check if we can include <sys/time.h> with <sys/select.h>; this breaks on
1921 dnl older SCO configurations.
1922 AC_DEFUN([CF_SYS_TIME_SELECT],
1924 AC_MSG_CHECKING(if sys/time.h works with sys/select.h)
1925 AC_CACHE_VAL(cf_cv_sys_time_select,[
1927 #include <sys/types.h>
1929 #include <sys/time.h>
1931 #if HAVE_SYS_SELECT_H
1932 #include <sys/select.h>
1934 ],[],[cf_cv_sys_time_select=yes],
1935 [cf_cv_sys_time_select=no])
1937 AC_MSG_RESULT($cf_cv_sys_time_select)
1938 test $cf_cv_sys_time_select = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT)
1940 dnl ---------------------------------------------------------------------------
1941 dnl Determine the type we should use for chtype (and attr_t, which is treated
1942 dnl as the same thing). We want around 32 bits, so on most machines want a
1943 dnl long, but on newer 64-bit machines, probably want an int. If we're using
1944 dnl wide characters, we have to have a type compatible with that, as well.
1945 AC_DEFUN([CF_TYPEOF_CHTYPE],
1947 AC_REQUIRE([CF_UNSIGNED_LITERALS])
1948 AC_MSG_CHECKING([for type of chtype])
1949 AC_CACHE_VAL(cf_cv_typeof_chtype,[
1951 #if USE_WIDEC_SUPPORT
1952 #include <stddef.h> /* we want wchar_t */
1953 #define WANT_BITS 39
1955 #define WANT_BITS 31
1960 FILE *fp = fopen("cf_test.out", "w");
1962 char *result = "long";
1963 #if USE_WIDEC_SUPPORT
1965 * If wchar_t is smaller than a long, it must be an int or a
1966 * short. We prefer not to use a short anyway.
1968 if (sizeof(unsigned long) > sizeof(wchar_t))
1971 if (sizeof(unsigned long) > sizeof(unsigned int)) {
1974 for (n = 0; n < WANT_BITS; n++) {
1975 unsigned int y = (x >> n);
1976 if (y != 1 || x == 0) {
1982 * If x is nonzero, an int is big enough for the bits
1985 result = (x != 0) ? "int" : "long";
1993 [cf_cv_typeof_chtype=`cat cf_test.out`],
1994 [cf_cv_typeof_chtype=long],
1995 [cf_cv_typeof_chtype=long])
1998 AC_MSG_RESULT($cf_cv_typeof_chtype)
2000 AC_SUBST(cf_cv_typeof_chtype)
2001 AC_DEFINE_UNQUOTED(TYPEOF_CHTYPE,$cf_cv_typeof_chtype)
2004 test "$cf_cv_unsigned_literals" = yes && cf_cv_1UL="${cf_cv_1UL}U"
2005 test "$cf_cv_typeof_chtype" = long && cf_cv_1UL="${cf_cv_1UL}L"
2009 dnl ---------------------------------------------------------------------------
2011 AC_DEFUN([CF_TYPE_SIGACTION],
2013 AC_MSG_CHECKING([for type sigaction_t])
2014 AC_CACHE_VAL(cf_cv_type_sigaction,[
2016 #include <signal.h>],
2018 [cf_cv_type_sigaction=yes],
2019 [cf_cv_type_sigaction=no])])
2020 AC_MSG_RESULT($cf_cv_type_sigaction)
2021 test $cf_cv_type_sigaction = yes && AC_DEFINE(HAVE_TYPE_SIGACTION)
2023 dnl ---------------------------------------------------------------------------
2024 dnl Test if the compiler supports 'U' and 'L' suffixes. Only old compilers
2025 dnl won't, but they're still there.
2026 AC_DEFUN([CF_UNSIGNED_LITERALS],
2028 AC_MSG_CHECKING([if unsigned literals are legal])
2029 AC_CACHE_VAL(cf_cv_unsigned_literals,[
2030 AC_TRY_COMPILE([],[long x = 1L + 1UL + 1U + 1],
2031 [cf_cv_unsigned_literals=yes],
2032 [cf_cv_unsigned_literals=no])
2034 AC_MSG_RESULT($cf_cv_unsigned_literals)
2036 dnl ---------------------------------------------------------------------------
2037 dnl Make an uppercase version of a variable
2038 dnl $1=uppercase($2)
2039 AC_DEFUN([CF_UPPER],
2042 $1=`echo $2 | tr '[a-z]' '[A-Z]'`
2045 dnl ---------------------------------------------------------------------------
2046 dnl Compute the shift-mask that we'll use for wide-character indices. We use
2047 dnl all but the index portion of chtype for storing attributes.
2048 AC_DEFUN([CF_WIDEC_SHIFT],
2050 AC_REQUIRE([CF_TYPEOF_CHTYPE])
2051 AC_MSG_CHECKING([for number of bits in chtype])
2052 AC_CACHE_VAL(cf_cv_shift_limit,[
2057 FILE *fp = fopen("cf_test.out", "w");
2060 unsigned TYPEOF_CHTYPE x = 1L;
2061 for (n = 0; ; n++) {
2062 unsigned long y = (x >> n);
2063 if (y != 1 || x == 0)
2067 fprintf(fp, "%d", n);
2073 [cf_cv_shift_limit=`cat cf_test.out`],
2074 [cf_cv_shift_limit=32],
2075 [cf_cv_shift_limit=32])
2078 AC_MSG_RESULT($cf_cv_shift_limit)
2079 AC_SUBST(cf_cv_shift_limit)
2081 AC_MSG_CHECKING([for width of character-index])
2082 AC_CACHE_VAL(cf_cv_widec_shift,[
2083 if test ".$with_widec" = ".yes" ; then
2085 if ( expr $cf_cv_shift_limit \> $cf_attrs_width >/dev/null )
2087 cf_cv_widec_shift=`expr 16 + $cf_cv_shift_limit - $cf_attrs_width`
2089 cf_cv_widec_shift=16
2095 AC_MSG_RESULT($cf_cv_widec_shift)
2096 AC_SUBST(cf_cv_widec_shift)
2098 dnl ---------------------------------------------------------------------------
2099 dnl Wrapper for AC_ARG_WITH to ensure that user supplies a pathname, not just
2100 dnl defaulting to yes/no.
2102 dnl $1 = option name
2104 dnl $3 = environment variable to set
2105 dnl $4 = default value, shown in the help-message, must be a constant
2106 dnl $5 = default value, if it's an expression & cannot be in the help-message
2108 AC_DEFUN([CF_WITH_PATH],
2109 [AC_ARG_WITH($1,[$2 ](default: ifelse($4,,empty,$4)),,
2110 ifelse($4,,[withval="${$3}"],[withval="${$3-ifelse($5,,$4,$5)}"]))dnl
2111 CF_PATH_SYNTAX(withval)
2115 dnl ---------------------------------------------------------------------------
2116 dnl Process an option specifying a list of colon-separated paths.
2118 dnl $1 = option name
2120 dnl $3 = environment variable to set
2121 dnl $4 = default value, shown in the help-message, must be a constant
2122 dnl $5 = default value, if it's an expression & cannot be in the help-message
2124 AC_DEFUN([CF_WITH_PATHLIST],[
2125 AC_ARG_WITH($1,[$2 ](default: ifelse($4,,empty,$4)),,
2126 ifelse($4,,[withval="${$3}"],[withval="${$3-ifelse($5,,$4,$5)}"]))dnl
2128 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
2130 for cf_src_path in $withval
2132 CF_PATH_SYNTAX(cf_src_path)
2133 test -n "$cf_dst_path" && cf_dst_path="${cf_dst_path}:"
2134 cf_dst_path="${cf_dst_path}${cf_src_path}"
2138 eval $3="$cf_dst_path"