source: trunk/ncurses/test/aclocal.m4@ 2783

Last change on this file since 2783 was 2621, checked in by bird, 20 years ago

GNU ncurses 5.5

File size: 36.8 KB
Line 
1dnl $Id: aclocal.m4,v 1.8 2005/02/27 00:02:01 tom Exp $
2dnl ---------------------------------------------------------------------------
3dnl ---------------------------------------------------------------------------
4dnl CF_ADD_CFLAGS version: 7 updated: 2004/04/25 17:48:30
5dnl -------------
6dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS
7dnl The second parameter if given makes this macro verbose.
8dnl
9dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS,
10dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily
11dnl confused by the quotes (which require backslashes to keep them usable).
12AC_DEFUN([CF_ADD_CFLAGS],
13[
14cf_fix_cppflags=no
15cf_new_cflags=
16cf_new_cppflags=
17cf_new_extra_cppflags=
18
19for cf_add_cflags in $1
20do
21case $cf_fix_cppflags in
22no)
23 case $cf_add_cflags in #(vi
24 -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
25 case $cf_add_cflags in
26 -D*)
27 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'`
28
29 test "${cf_add_cflags}" != "${cf_tst_cflags}" \
30 && test -z "${cf_tst_cflags}" \
31 && cf_fix_cppflags=yes
32
33 if test $cf_fix_cppflags = yes ; then
34 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
35 continue
36 elif test "${cf_tst_cflags}" = "\"'" ; then
37 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
38 continue
39 fi
40 ;;
41 esac
42 case "$CPPFLAGS" in
43 *$cf_add_cflags) #(vi
44 ;;
45 *) #(vi
46 cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
47 ;;
48 esac
49 ;;
50 *)
51 cf_new_cflags="$cf_new_cflags $cf_add_cflags"
52 ;;
53 esac
54 ;;
55yes)
56 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
57
58 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'`
59
60 test "${cf_add_cflags}" != "${cf_tst_cflags}" \
61 && test -z "${cf_tst_cflags}" \
62 && cf_fix_cppflags=no
63 ;;
64esac
65done
66
67if test -n "$cf_new_cflags" ; then
68 ifelse($2,,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)])
69 CFLAGS="$CFLAGS $cf_new_cflags"
70fi
71
72if test -n "$cf_new_cppflags" ; then
73 ifelse($2,,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)])
74 CPPFLAGS="$cf_new_cppflags $CPPFLAGS"
75fi
76
77if test -n "$cf_new_extra_cppflags" ; then
78 ifelse($2,,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)])
79 EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
80fi
81
82AC_SUBST(EXTRA_CPPFLAGS)
83
84])dnl
85dnl ---------------------------------------------------------------------------
86dnl CF_ADD_INCDIR version: 4 updated: 2002/12/21 14:25:52
87dnl -------------
88dnl Add an include-directory to $CPPFLAGS. Don't add /usr/include, since it's
89dnl redundant. We don't normally need to add -I/usr/local/include for gcc,
90dnl but old versions (and some misinstalled ones) need that. To make things
91dnl worse, gcc 3.x gives error messages if -I/usr/local/include is added to
92dnl the include-path).
93AC_DEFUN([CF_ADD_INCDIR],
94[
95for cf_add_incdir in $1
96do
97 while true
98 do
99 case $cf_add_incdir in
100 /usr/include) # (vi
101 ;;
102 /usr/local/include) # (vi
103 if test "$GCC" = yes
104 then
105 cf_save_CPPFLAGS="$CPPFLAGS"
106 CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
107 AC_TRY_COMPILE([#include <stdio.h>],
108 [printf("Hello")],
109 [],
110 [CPPFLAGS="$cf_save_CPPFLAGS"])
111 fi
112 ;;
113 *) # (vi
114 CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
115 ;;
116 esac
117 cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'`
118 test "$cf_top_incdir" = "$cf_add_incdir" && break
119 cf_add_incdir="$cf_top_incdir"
120 done
121done
122])dnl
123dnl ---------------------------------------------------------------------------
124dnl CF_ANSI_CC_CHECK version: 9 updated: 2001/12/30 17:53:34
125dnl ----------------
126dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES'
127dnl in the sharutils 4.2 distribution.
128AC_DEFUN([CF_ANSI_CC_CHECK],
129[
130AC_CACHE_CHECK(for ${CC-cc} option to accept ANSI C, cf_cv_ansi_cc,[
131cf_cv_ansi_cc=no
132cf_save_CFLAGS="$CFLAGS"
133cf_save_CPPFLAGS="$CPPFLAGS"
134# Don't try gcc -ansi; that turns off useful extensions and
135# breaks some systems' header files.
136# AIX -qlanglvl=ansi
137# Ultrix and OSF/1 -std1
138# HP-UX -Aa -D_HPUX_SOURCE
139# SVR4 -Xc
140# UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes)
141for cf_arg in "-DCC_HAS_PROTOS" \
142 "" \
143 -qlanglvl=ansi \
144 -std1 \
145 -Ae \
146 "-Aa -D_HPUX_SOURCE" \
147 -Xc
148do
149 CF_ADD_CFLAGS($cf_arg)
150 AC_TRY_COMPILE(
151[
152#ifndef CC_HAS_PROTOS
153#if !defined(__STDC__) || (__STDC__ != 1)
154choke me
155#endif
156#endif
157],[
158 int test (int i, double x);
159 struct s1 {int (*f) (int a);};
160 struct s2 {int (*f) (double a);};],
161 [cf_cv_ansi_cc="$cf_arg"; break])
162done
163CFLAGS="$cf_save_CFLAGS"
164CPPFLAGS="$cf_save_CPPFLAGS"
165])
166
167if test "$cf_cv_ansi_cc" != "no"; then
168if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then
169 CF_ADD_CFLAGS($cf_cv_ansi_cc)
170else
171 AC_DEFINE(CC_HAS_PROTOS)
172fi
173fi
174])dnl
175dnl ---------------------------------------------------------------------------
176dnl CF_ANSI_CC_REQD version: 3 updated: 1997/09/06 13:40:44
177dnl ---------------
178dnl For programs that must use an ANSI compiler, obtain compiler options that
179dnl will make it recognize prototypes. We'll do preprocessor checks in other
180dnl macros, since tools such as unproto can fake prototypes, but only part of
181dnl the preprocessor.
182AC_DEFUN([CF_ANSI_CC_REQD],
183[AC_REQUIRE([CF_ANSI_CC_CHECK])
184if test "$cf_cv_ansi_cc" = "no"; then
185 AC_ERROR(
186[Your compiler does not appear to recognize prototypes.
187You have the following choices:
188 a. adjust your compiler options
189 b. get an up-to-date compiler
190 c. use a wrapper such as unproto])
191fi
192])dnl
193dnl ---------------------------------------------------------------------------
194dnl CF_CHECK_CACHE version: 10 updated: 2004/05/23 13:03:31
195dnl --------------
196dnl Check if we're accidentally using a cache from a different machine.
197dnl Derive the system name, as a check for reusing the autoconf cache.
198dnl
199dnl If we've packaged config.guess and config.sub, run that (since it does a
200dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow
201dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM
202dnl which is useful in cross-compiles.
203dnl
204dnl Note: we would use $ac_config_sub, but that is one of the places where
205dnl autoconf 2.5x broke compatibility with autoconf 2.13
206AC_DEFUN([CF_CHECK_CACHE],
207[
208if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then
209 ifelse([$1],,[AC_CANONICAL_HOST],[$1])
210 system_name="$host_os"
211else
212 system_name="`(uname -s -r) 2>/dev/null`"
213 if test -z "$system_name" ; then
214 system_name="`(hostname) 2>/dev/null`"
215 fi
216fi
217test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name")
218AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
219
220test -z "$system_name" && system_name="$cf_cv_system_name"
221test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name)
222
223if test ".$system_name" != ".$cf_cv_system_name" ; then
224 AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name))
225 AC_ERROR("Please remove config.cache and try again.")
226fi
227])dnl
228dnl ---------------------------------------------------------------------------
229dnl CF_CURSES_ACS_MAP version: 3 updated: 2003/05/17 22:19:02
230dnl -----------------
231dnl Check for likely values of acs_map[]:
232AC_DEFUN([CF_CURSES_ACS_MAP],
233[
234AC_CACHE_CHECK(for alternate character set array, cf_cv_curses_acs_map,[
235cf_cv_curses_acs_map=unknown
236for name in acs_map _acs_map __acs_map _nc_acs_map
237do
238AC_TRY_LINK([
239#include <${cf_cv_ncurses_header-curses.h}>
240],[
241$name['k'] = ACS_PLUS
242],[cf_cv_curses_acs_map=$name; break])
243done
244])
245
246test "$cf_cv_curses_acs_map" != unknown && AC_DEFINE_UNQUOTED(CURSES_ACS_ARRAY,$cf_cv_curses_acs_map)
247])
248dnl ---------------------------------------------------------------------------
249dnl CF_CURSES_CHECK_TYPE version: 2 updated: 2003/03/01 23:40:33
250dnl --------------------
251dnl Check if curses.h defines the given type
252AC_DEFUN([CF_CURSES_CHECK_TYPE],
253[
254AC_MSG_CHECKING(for type $1 in ${cf_cv_ncurses_header-curses.h})
255AC_TRY_COMPILE([
256#ifndef _XOPEN_SOURCE_EXTENDED
257#define _XOPEN_SOURCE_EXTENDED
258#endif
259#include <${cf_cv_ncurses_header-curses.h}>],[
260$1 foo
261],cf_result=yes,cf_result=no)
262AC_MSG_RESULT($cf_result)
263if test $cf_result = yes ; then
264 CF_UPPER(cf_result,have_type_$1)
265 AC_DEFINE_UNQUOTED($cf_result)
266else
267 AC_DEFINE_UNQUOTED($1,$2)
268fi
269])dnl
270dnl ---------------------------------------------------------------------------
271dnl CF_CURSES_CPPFLAGS version: 7 updated: 2003/06/06 00:48:41
272dnl ------------------
273dnl Look for the curses headers.
274AC_DEFUN([CF_CURSES_CPPFLAGS],[
275
276AC_CACHE_CHECK(for extra include directories,cf_cv_curses_incdir,[
277cf_cv_curses_incdir=no
278case $host_os in #(vi
279hpux10.*|hpux11.*) #(vi
280 test -d /usr/include/curses_colr && \
281 cf_cv_curses_incdir="-I/usr/include/curses_colr"
282 ;;
283sunos3*|sunos4*)
284 test -d /usr/5lib && \
285 test -d /usr/5include && \
286 cf_cv_curses_incdir="-I/usr/5include"
287 ;;
288esac
289])
290test "$cf_cv_curses_incdir" != no && CPPFLAGS="$cf_cv_curses_incdir $CPPFLAGS"
291
292AC_CACHE_CHECK(if we have identified curses headers,cf_cv_ncurses_header,[
293cf_cv_ncurses_header=none
294for cf_header in \
295 curses.h \
296 ncurses.h \
297 ncurses/curses.h \
298 ncurses/ncurses.h
299do
300AC_TRY_COMPILE([#include <${cf_header}>],
301 [initscr(); tgoto("?", 0,0)],
302 [cf_cv_ncurses_header=$cf_header; break],[])
303done
304])
305
306if test "$cf_cv_ncurses_header" = none ; then
307 AC_MSG_ERROR(No curses header-files found)
308fi
309
310# cheat, to get the right #define's for HAVE_NCURSES_H, etc.
311AC_CHECK_HEADERS($cf_cv_ncurses_header)
312
313])dnl
314dnl ---------------------------------------------------------------------------
315dnl CF_CURSES_LIBS version: 23 updated: 2003/11/06 19:59:57
316dnl --------------
317dnl Look for the curses libraries. Older curses implementations may require
318dnl termcap/termlib to be linked as well. Call CF_CURSES_CPPFLAGS first.
319AC_DEFUN([CF_CURSES_LIBS],[
320
321AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
322AC_MSG_CHECKING(if we have identified curses libraries)
323AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
324 [initscr(); tgoto("?", 0,0)],
325 cf_result=yes,
326 cf_result=no)
327AC_MSG_RESULT($cf_result)
328
329if test "$cf_result" = no ; then
330case $host_os in #(vi
331freebsd*) #(vi
332 AC_CHECK_LIB(mytinfo,tgoto,[LIBS="-lmytinfo $LIBS"])
333 ;;
334hpux10.*|hpux11.*) #(vi
335 AC_CHECK_LIB(cur_colr,initscr,[
336 LIBS="-lcur_colr $LIBS"
337 ac_cv_func_initscr=yes
338 ],[
339 AC_CHECK_LIB(Hcurses,initscr,[
340 # HP's header uses __HP_CURSES, but user claims _HP_CURSES.
341 LIBS="-lHcurses $LIBS"
342 CPPFLAGS="-D__HP_CURSES -D_HP_CURSES $CPPFLAGS"
343 ac_cv_func_initscr=yes
344 ])])
345 ;;
346linux*) # Suse Linux does not follow /usr/lib convention
347 LIBS="$LIBS -L/lib"
348 ;;
349sunos3*|sunos4*)
350 test -d /usr/5lib && \
351 LIBS="$LIBS -L/usr/5lib -lcurses -ltermcap"
352 ac_cv_func_initscr=yes
353 ;;
354esac
355
356if test ".$ac_cv_func_initscr" != .yes ; then
357 cf_save_LIBS="$LIBS"
358 cf_term_lib=""
359 cf_curs_lib=""
360
361 if test ".${cf_cv_ncurses_version-no}" != .no
362 then
363 cf_check_list="ncurses curses cursesX"
364 else
365 cf_check_list="cursesX curses ncurses"
366 fi
367
368 # Check for library containing tgoto. Do this before curses library
369 # because it may be needed to link the test-case for initscr.
370 AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[
371 for cf_term_lib in $cf_check_list termcap termlib unknown
372 do
373 AC_CHECK_LIB($cf_term_lib,tgoto,[break])
374 done
375 ])
376
377 # Check for library containing initscr
378 test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS"
379 for cf_curs_lib in $cf_check_list xcurses jcurses unknown
380 do
381 AC_CHECK_LIB($cf_curs_lib,initscr,[break])
382 done
383 test $cf_curs_lib = unknown && AC_ERROR(no curses library found)
384
385 LIBS="-l$cf_curs_lib $cf_save_LIBS"
386 if test "$cf_term_lib" = unknown ; then
387 AC_MSG_CHECKING(if we can link with $cf_curs_lib library)
388 AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
389 [initscr()],
390 [cf_result=yes],
391 [cf_result=no])
392 AC_MSG_RESULT($cf_result)
393 test $cf_result = no && AC_ERROR(Cannot link curses library)
394 elif test "$cf_curs_lib" = "$cf_term_lib" ; then
395 :
396 elif test "$cf_term_lib" != predefined ; then
397 AC_MSG_CHECKING(if we need both $cf_curs_lib and $cf_term_lib libraries)
398 AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
399 [initscr(); tgoto((char *)0, 0, 0);],
400 [cf_result=no],
401 [
402 LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS"
403 AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
404 [initscr()],
405 [cf_result=yes],
406 [cf_result=error])
407 ])
408 AC_MSG_RESULT($cf_result)
409 fi
410fi
411fi
412
413])dnl
414dnl ---------------------------------------------------------------------------
415dnl CF_CURSES_WACS_MAP version: 3 updated: 2003/05/17 22:19:02
416dnl ------------------
417dnl Check for likely values of wacs_map[]:
418AC_DEFUN([CF_CURSES_WACS_MAP],
419[
420AC_CACHE_CHECK(for wide alternate character set array, cf_cv_curses_wacs_map,[
421 cf_cv_curses_wacs_map=unknown
422 for name in wacs_map _wacs_map __wacs_map _nc_wacs
423 do
424 AC_TRY_LINK([
425#ifndef _XOPEN_SOURCE_EXTENDED
426#define _XOPEN_SOURCE_EXTENDED
427#endif
428#include <${cf_cv_ncurses_header-curses.h}>],
429 [$name['k'] = *WACS_PLUS],
430 [cf_cv_curses_wacs_map=$name
431 break])
432 done])
433])
434dnl ---------------------------------------------------------------------------
435dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52
436dnl ----------
437dnl "dirname" is not portable, so we fake it with a shell script.
438AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl
439dnl ---------------------------------------------------------------------------
440dnl CF_FIND_LIBRARY version: 8 updated: 2004/11/23 20:14:58
441dnl ---------------
442dnl Look for a non-standard library, given parameters for AC_TRY_LINK. We
443dnl prefer a standard location, and use -L options only if we do not find the
444dnl library in the standard library location(s).
445dnl $1 = library name
446dnl $2 = library class, usually the same as library name
447dnl $3 = includes
448dnl $4 = code fragment to compile/link
449dnl $5 = corresponding function-name
450dnl $6 = flag, nonnull if failure should not cause an error-exit
451dnl
452dnl Sets the variable "$cf_libdir" as a side-effect, so we can see if we had
453dnl to use a -L option.
454AC_DEFUN([CF_FIND_LIBRARY],
455[
456 eval 'cf_cv_have_lib_'$1'=no'
457 cf_libdir=""
458 AC_CHECK_FUNC($5,
459 eval 'cf_cv_have_lib_'$1'=yes',[
460 cf_save_LIBS="$LIBS"
461 AC_MSG_CHECKING(for $5 in -l$1)
462 LIBS="-l$1 $LIBS"
463 AC_TRY_LINK([$3],[$4],
464 [AC_MSG_RESULT(yes)
465 eval 'cf_cv_have_lib_'$1'=yes'
466 ],
467 [AC_MSG_RESULT(no)
468 CF_LIBRARY_PATH(cf_search,$2)
469 for cf_libdir in $cf_search
470 do
471 AC_MSG_CHECKING(for -l$1 in $cf_libdir)
472 LIBS="-L$cf_libdir -l$1 $cf_save_LIBS"
473 AC_TRY_LINK([$3],[$4],
474 [AC_MSG_RESULT(yes)
475 eval 'cf_cv_have_lib_'$1'=yes'
476 break],
477 [AC_MSG_RESULT(no)
478 LIBS="$cf_save_LIBS"])
479 done
480 ])
481 ])
482eval 'cf_found_library=[$]cf_cv_have_lib_'$1
483ifelse($6,,[
484if test $cf_found_library = no ; then
485 AC_ERROR(Cannot link $1 library)
486fi
487])
488])dnl
489dnl ---------------------------------------------------------------------------
490dnl CF_FUNC_CURSES_VERSION version: 3 updated: 2003/05/17 22:19:02
491dnl ----------------------
492dnl Solaris has a data item 'curses_version', which confuses AC_CHECK_FUNCS.
493dnl It's a character string "SVR4", not documented.
494AC_DEFUN([CF_FUNC_CURSES_VERSION],
495[
496AC_CACHE_CHECK(for function curses_version, cf_cv_func_curses_version,[
497AC_TRY_RUN([
498#include <${cf_cv_ncurses_header-curses.h}>
499int main()
500{
501 char temp[1024];
502 sprintf(temp, "%s\n", curses_version());
503 exit(0);
504}]
505,[cf_cv_func_curses_version=yes]
506,[cf_cv_func_curses_version=no]
507,[cf_cv_func_curses_version=unknown])
508rm -f core])
509test "$cf_cv_func_curses_version" = yes && AC_DEFINE(HAVE_CURSES_VERSION)
510])
511dnl ---------------------------------------------------------------------------
512dnl CF_GNU_SOURCE version: 4 updated: 2004/12/03 20:43:00
513dnl -------------
514dnl Check if we must define _GNU_SOURCE to get a reasonable value for
515dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect
516dnl (or misfeature) of glibc2, which breaks portability of many applications,
517dnl since it is interwoven with GNU extensions.
518dnl
519dnl Well, yes we could work around it...
520AC_DEFUN([CF_GNU_SOURCE],
521[
522AC_REQUIRE([CF_INTEL_COMPILER])
523
524if test "$INTEL_COMPILER" = no ; then
525AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[
526AC_TRY_COMPILE([#include <sys/types.h>],[
527#ifndef _XOPEN_SOURCE
528make an error
529#endif],
530 [cf_cv_gnu_source=no],
531 [cf_save="$CPPFLAGS"
532 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
533 AC_TRY_COMPILE([#include <sys/types.h>],[
534#ifdef _XOPEN_SOURCE
535make an error
536#endif],
537 [cf_cv_gnu_source=no],
538 [cf_cv_gnu_source=yes])
539 CPPFLAGS="$cf_save"
540 ])
541])
542test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
543fi
544])dnl
545dnl ---------------------------------------------------------------------------
546dnl CF_HEADER_PATH version: 8 updated: 2002/11/10 14:46:59
547dnl --------------
548dnl Construct a search-list for a nonstandard header-file
549AC_DEFUN([CF_HEADER_PATH],
550[CF_SUBDIR_PATH($1,$2,include)
551test "$includedir" != NONE && \
552test "$includedir" != "/usr/include" && \
553test -d "$includedir" && {
554 test -d $includedir && $1="[$]$1 $includedir"
555 test -d $includedir/$2 && $1="[$]$1 $includedir/$2"
556}
557
558test "$oldincludedir" != NONE && \
559test "$oldincludedir" != "/usr/include" && \
560test -d "$oldincludedir" && {
561 test -d $oldincludedir && $1="[$]$1 $oldincludedir"
562 test -d $oldincludedir/$2 && $1="[$]$1 $oldincludedir/$2"
563}
564
565])dnl
566dnl ---------------------------------------------------------------------------
567dnl CF_INHERIT_SCRIPT version: 2 updated: 2003/03/01 23:50:42
568dnl -----------------
569dnl If we do not have a given script, look for it in the parent directory.
570AC_DEFUN([CF_INHERIT_SCRIPT],
571[
572test -f $1 || ( test -f ../$1 && cp ../$1 ./ )
573])dnl
574dnl ---------------------------------------------------------------------------
575dnl CF_INTEL_COMPILER version: 1 updated: 2004/12/03 20:27:48
576dnl -----------------
577dnl Check if the given compiler is really the Intel compiler for Linux.
578dnl It tries to imitate gcc, but does not return an error when it finds a
579dnl mismatch between prototypes, e.g., as exercised by CF_MISSING_CHECK.
580dnl
581dnl This macro should be run "soon" after AC_PROG_CC, to ensure that it is
582dnl not mistaken for gcc.
583AC_DEFUN([CF_INTEL_COMPILER],[
584AC_REQUIRE([AC_PROG_CC])
585
586INTEL_COMPILER=no
587
588if test "$GCC" = yes ; then
589 case $host_os in
590 linux*|gnu*)
591 AC_MSG_CHECKING(if this is really Intel compiler)
592 cf_save_CFLAGS="$CFLAGS"
593 CFLAGS="$CFLAGS -no-gcc"
594 AC_TRY_COMPILE([],[
595#ifdef __INTEL_COMPILER
596#else
597make an error
598#endif
599],[INTEL_COMPILER=yes
600cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc"
601],[])
602 CFLAGS="$cf_save_CFLAGS"
603 AC_MSG_RESULT($INTEL_COMPILER)
604 ;;
605 esac
606fi
607])dnl
608dnl ---------------------------------------------------------------------------
609dnl CF_LIBRARY_PATH version: 7 updated: 2002/11/10 14:46:59
610dnl ---------------
611dnl Construct a search-list for a nonstandard library-file
612AC_DEFUN([CF_LIBRARY_PATH],
613[CF_SUBDIR_PATH($1,$2,lib)])dnl
614dnl ---------------------------------------------------------------------------
615dnl CF_MSG_LOG version: 3 updated: 1997/09/07 14:05:52
616dnl ----------
617dnl Write a debug message to config.log, along with the line number in the
618dnl configure script.
619AC_DEFUN([CF_MSG_LOG],[
620echo "(line __oline__) testing $* ..." 1>&AC_FD_CC
621])dnl
622dnl ---------------------------------------------------------------------------
623dnl CF_NCURSES_CC_CHECK version: 3 updated: 2003/01/12 18:59:28
624dnl -------------------
625dnl Check if we can compile with ncurses' header file
626dnl $1 is the cache variable to set
627dnl $2 is the header-file to include
628dnl $3 is the root name (ncurses or ncursesw)
629AC_DEFUN([CF_NCURSES_CC_CHECK],[
630 AC_TRY_COMPILE([
631]ifelse($3,ncursesw,[
632#define _XOPEN_SOURCE_EXTENDED
633#undef HAVE_LIBUTF8_H /* in case we used CF_UTF8_LIB */
634#define HAVE_LIBUTF8_H /* to force ncurses' header file to use cchar_t */
635])[
636#include <$2>],[
637#ifdef NCURSES_VERSION
638]ifelse($3,ncursesw,[
639#ifndef WACS_BSSB
640 make an error
641#endif
642])[
643printf("%s\n", NCURSES_VERSION);
644#else
645#ifdef __NCURSES_H
646printf("old\n");
647#else
648 make an error
649#endif
650#endif
651 ]
652 ,[$1=$cf_header]
653 ,[$1=no])
654])dnl
655dnl ---------------------------------------------------------------------------
656dnl CF_NCURSES_CPPFLAGS version: 17 updated: 2003/11/06 19:59:57
657dnl -------------------
658dnl Look for the SVr4 curses clone 'ncurses' in the standard places, adjusting
659dnl the CPPFLAGS variable so we can include its header.
660dnl
661dnl The header files may be installed as either curses.h, or ncurses.h (would
662dnl be obsolete, except that some packagers prefer this name to distinguish it
663dnl from a "native" curses implementation). If not installed for overwrite,
664dnl the curses.h file would be in an ncurses subdirectory (e.g.,
665dnl /usr/include/ncurses), but someone may have installed overwriting the
666dnl vendor's curses. Only very old versions (pre-1.9.2d, the first autoconf'd
667dnl version) of ncurses don't define either __NCURSES_H or NCURSES_VERSION in
668dnl the header.
669dnl
670dnl If the installer has set $CFLAGS or $CPPFLAGS so that the ncurses header
671dnl is already in the include-path, don't even bother with this, since we cannot
672dnl easily determine which file it is. In this case, it has to be <curses.h>.
673dnl
674dnl The optional parameter gives the root name of the library, in case it is
675dnl not installed as the default curses library. That is how the
676dnl wide-character version of ncurses is installed.
677AC_DEFUN([CF_NCURSES_CPPFLAGS],
678[AC_REQUIRE([CF_WITH_CURSES_DIR])
679
680AC_PROVIDE([CF_CURSES_CPPFLAGS])dnl
681cf_ncuhdr_root=ifelse($1,,ncurses,$1)
682
683test -n "$cf_cv_curses_dir" && \
684test "$cf_cv_curses_dir" != "no" && \
685CPPFLAGS="-I$cf_cv_curses_dir/include -I$cf_cv_curses_dir/include/$cf_ncuhdr_root $CPPFLAGS"
686
687AC_CACHE_CHECK(for $cf_ncuhdr_root header in include-path, cf_cv_ncurses_h,[
688 cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h"
689 ( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h"
690 for cf_header in $cf_header_list
691 do
692 CF_NCURSES_CC_CHECK(cf_cv_ncurses_h,$cf_header,$1)
693 test "$cf_cv_ncurses_h" != no && break
694 done
695])
696
697if test "$cf_cv_ncurses_h" != no ; then
698 cf_cv_ncurses_header=$cf_cv_ncurses_h
699else
700AC_CACHE_CHECK(for $cf_ncuhdr_root include-path, cf_cv_ncurses_h2,[
701 test -n "$verbose" && echo
702 CF_HEADER_PATH(cf_search,$cf_ncuhdr_root)
703 test -n "$verbose" && echo search path $cf_search
704 cf_save2_CPPFLAGS="$CPPFLAGS"
705 for cf_incdir in $cf_search
706 do
707 CF_ADD_INCDIR($cf_incdir)
708 for cf_header in \
709 ncurses.h \
710 curses.h
711 do
712 CF_NCURSES_CC_CHECK(cf_cv_ncurses_h2,$cf_header,$1)
713 if test "$cf_cv_ncurses_h2" != no ; then
714 cf_cv_ncurses_h2=$cf_incdir/$cf_header
715 test -n "$verbose" && echo $ac_n " ... found $ac_c" 1>&AC_FD_MSG
716 break
717 fi
718 test -n "$verbose" && echo " ... tested $cf_incdir/$cf_header" 1>&AC_FD_MSG
719 done
720 CPPFLAGS="$cf_save2_CPPFLAGS"
721 test "$cf_cv_ncurses_h2" != no && break
722 done
723 test "$cf_cv_ncurses_h2" = no && AC_ERROR(not found)
724 ])
725
726 CF_DIRNAME(cf_1st_incdir,$cf_cv_ncurses_h2)
727 cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2`
728 if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then
729 cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header
730 fi
731 CF_ADD_INCDIR($cf_1st_incdir)
732
733fi
734
735AC_DEFINE(NCURSES)
736
737case $cf_cv_ncurses_header in # (vi
738*ncurses.h)
739 AC_DEFINE(HAVE_NCURSES_H)
740 ;;
741esac
742
743case $cf_cv_ncurses_header in # (vi
744ncurses/curses.h|ncurses/ncurses.h)
745 AC_DEFINE(HAVE_NCURSES_NCURSES_H)
746 ;;
747ncursesw/curses.h|ncursesw/ncurses.h)
748 AC_DEFINE(HAVE_NCURSESW_NCURSES_H)
749 ;;
750esac
751
752CF_NCURSES_VERSION
753])dnl
754dnl ---------------------------------------------------------------------------
755dnl CF_NCURSES_LIBS version: 12 updated: 2004/04/27 16:26:05
756dnl ---------------
757dnl Look for the ncurses library. This is a little complicated on Linux,
758dnl because it may be linked with the gpm (general purpose mouse) library.
759dnl Some distributions have gpm linked with (bsd) curses, which makes it
760dnl unusable with ncurses. However, we don't want to link with gpm unless
761dnl ncurses has a dependency, since gpm is normally set up as a shared library,
762dnl and the linker will record a dependency.
763dnl
764dnl The optional parameter gives the root name of the library, in case it is
765dnl not installed as the default curses library. That is how the
766dnl wide-character version of ncurses is installed.
767AC_DEFUN([CF_NCURSES_LIBS],
768[AC_REQUIRE([CF_NCURSES_CPPFLAGS])
769
770cf_nculib_root=ifelse($1,,ncurses,$1)
771 # This works, except for the special case where we find gpm, but
772 # ncurses is in a nonstandard location via $LIBS, and we really want
773 # to link gpm.
774cf_ncurses_LIBS=""
775cf_ncurses_SAVE="$LIBS"
776AC_CHECK_LIB(gpm,Gpm_Open,
777 [AC_CHECK_LIB(gpm,initscr,
778 [LIBS="$cf_ncurses_SAVE"],
779 [cf_ncurses_LIBS="-lgpm"])])
780
781case $host_os in #(vi
782freebsd*)
783 # This is only necessary if you are linking against an obsolete
784 # version of ncurses (but it should do no harm, since it's static).
785 if test "$cf_nculib_root" = ncurses ; then
786 AC_CHECK_LIB(mytinfo,tgoto,[cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS"])
787 fi
788 ;;
789esac
790
791LIBS="$cf_ncurses_LIBS $LIBS"
792
793if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
794then
795 LIBS="-L$cf_cv_curses_dir/lib -l$cf_nculib_root $LIBS"
796else
797 CF_FIND_LIBRARY($cf_nculib_root,$cf_nculib_root,
798 [#include <${cf_cv_ncurses_header-curses.h}>],
799 [initscr()],
800 initscr)
801fi
802
803if test -n "$cf_ncurses_LIBS" ; then
804 AC_MSG_CHECKING(if we can link $cf_nculib_root without $cf_ncurses_LIBS)
805 cf_ncurses_SAVE="$LIBS"
806 for p in $cf_ncurses_LIBS ; do
807 q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"`
808 if test "$q" != "$LIBS" ; then
809 LIBS="$q"
810 fi
811 done
812 AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
813 [initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);],
814 [AC_MSG_RESULT(yes)],
815 [AC_MSG_RESULT(no)
816 LIBS="$cf_ncurses_SAVE"])
817fi
818
819CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_nculib_root)
820AC_DEFINE_UNQUOTED($cf_nculib_ROOT)
821])dnl
822dnl ---------------------------------------------------------------------------
823dnl CF_NCURSES_VERSION version: 11 updated: 2003/11/06 19:59:57
824dnl ------------------
825dnl Check for the version of ncurses, to aid in reporting bugs, etc.
826dnl Call CF_CURSES_CPPFLAGS first, or CF_NCURSES_CPPFLAGS. We don't use
827dnl AC_REQUIRE since that does not work with the shell's if/then/else/fi.
828AC_DEFUN([CF_NCURSES_VERSION],
829[
830AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
831AC_CACHE_CHECK(for ncurses version, cf_cv_ncurses_version,[
832 cf_cv_ncurses_version=no
833 cf_tempfile=out$$
834 rm -f $cf_tempfile
835 AC_TRY_RUN([
836#include <${cf_cv_ncurses_header-curses.h}>
837#include <stdio.h>
838int main()
839{
840 FILE *fp = fopen("$cf_tempfile", "w");
841#ifdef NCURSES_VERSION
842# ifdef NCURSES_VERSION_PATCH
843 fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH);
844# else
845 fprintf(fp, "%s\n", NCURSES_VERSION);
846# endif
847#else
848# ifdef __NCURSES_H
849 fprintf(fp, "old\n");
850# else
851 make an error
852# endif
853#endif
854 exit(0);
855}],[
856 cf_cv_ncurses_version=`cat $cf_tempfile`],,[
857
858 # This will not work if the preprocessor splits the line after the
859 # Autoconf token. The 'unproto' program does that.
860 cat > conftest.$ac_ext <<EOF
861#include <${cf_cv_ncurses_header-curses.h}>
862#undef Autoconf
863#ifdef NCURSES_VERSION
864Autoconf NCURSES_VERSION
865#else
866#ifdef __NCURSES_H
867Autoconf "old"
868#endif
869;
870#endif
871EOF
872 cf_try="$ac_cpp conftest.$ac_ext 2>&AC_FD_CC | grep '^Autoconf ' >conftest.out"
873 AC_TRY_EVAL(cf_try)
874 if test -f conftest.out ; then
875 cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[[^"]]*"%%' -e 's%".*%%'`
876 test -n "$cf_out" && cf_cv_ncurses_version="$cf_out"
877 rm -f conftest.out
878 fi
879])
880 rm -f $cf_tempfile
881])
882test "$cf_cv_ncurses_version" = no || AC_DEFINE(NCURSES)
883])dnl
884dnl ---------------------------------------------------------------------------
885dnl CF_PATH_SYNTAX version: 9 updated: 2002/09/17 23:03:38
886dnl --------------
887dnl Check the argument to see that it looks like a pathname. Rewrite it if it
888dnl begins with one of the prefix/exec_prefix variables, and then again if the
889dnl result begins with 'NONE'. This is necessary to work around autoconf's
890dnl delayed evaluation of those symbols.
891AC_DEFUN([CF_PATH_SYNTAX],[
892case ".[$]$1" in #(vi
893.\[$]\(*\)*|.\'*\'*) #(vi
894 ;;
895..|./*|.\\*) #(vi
896 ;;
897.[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX
898 ;;
899.\[$]{*prefix}*) #(vi
900 eval $1="[$]$1"
901 case ".[$]$1" in #(vi
902 .NONE/*)
903 $1=`echo [$]$1 | sed -e s%NONE%$ac_default_prefix%`
904 ;;
905 esac
906 ;; #(vi
907.NONE/*)
908 $1=`echo [$]$1 | sed -e s%NONE%$ac_default_prefix%`
909 ;;
910*)
911 ifelse($2,,[AC_ERROR([expected a pathname, not \"[$]$1\"])],$2)
912 ;;
913esac
914])dnl
915dnl ---------------------------------------------------------------------------
916dnl CF_POSIX_C_SOURCE version: 3 updated: 2005/02/04 06:56:22
917dnl -----------------
918dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed.
919dnl
920dnl POSIX.1-1990 _POSIX_SOURCE
921dnl POSIX.1-1990 and _POSIX_SOURCE and
922dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2
923dnl Bindings Option
924dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L
925dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L
926dnl X/Open 2000 _POSIX_C_SOURCE=200112L
927dnl
928dnl Parameters:
929dnl $1 is the nominal value for _POSIX_C_SOURCE
930AC_DEFUN([CF_POSIX_C_SOURCE],
931[
932cf_POSIX_C_SOURCE=ifelse($1,,199506L,$1)
933AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[
934 CF_MSG_LOG(if the symbol is already defined go no further)
935 AC_TRY_COMPILE([#include <sys/types.h>],[
936#ifndef _POSIX_C_SOURCE
937make an error
938#endif],
939 [cf_cv_posix_c_source=no],
940 [cf_want_posix_source=no
941 case .$cf_POSIX_C_SOURCE in
942 .[[12]]??*)
943 cf_cv_posix_c_source="-U_POSIX_C_SOURCE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
944 ;;
945 .2)
946 cf_cv_posix_c_source="-U_POSIX_C_SOURCE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
947 cf_want_posix_source=yes
948 ;;
949 .*)
950 cf_want_posix_source=yes
951 ;;
952 esac
953 if test "$cf_want_posix_source" = yes ; then
954 AC_TRY_COMPILE([#include <sys/types.h>],[
955#ifdef _POSIX_SOURCE
956make an error
957#endif],[],
958 cf_cv_posix_c_source="$cf_cv_posix_c_source -U_POSIX_SOURCE -D_POSIX_SOURCE")
959 fi
960 CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE)
961 cf_save="$CPPFLAGS"
962 CPPFLAGS="$CPPFLAGS $cf_cv_posix_c_source"
963 CF_MSG_LOG(if the second compile does not leave our definition intact error)
964 AC_TRY_COMPILE([#include <sys/types.h>],[
965#ifndef _POSIX_C_SOURCE
966make an error
967#endif],,
968 [cf_cv_posix_c_source=no])
969 CPPFLAGS="$cf_save"
970 ])
971])
972test "$cf_cv_posix_c_source" != no && CPPFLAGS="$CPPFLAGS $cf_cv_posix_c_source"
973])dnl
974dnl ---------------------------------------------------------------------------
975dnl CF_SUBDIR_PATH version: 3 updated: 2002/12/29 18:30:46
976dnl --------------
977dnl Construct a search-list for a nonstandard header/lib-file
978dnl $1 = the variable to return as result
979dnl $2 = the package name
980dnl $3 = the subdirectory, e.g., bin, include or lib
981AC_DEFUN([CF_SUBDIR_PATH],
982[$1=""
983
984test -d [$]HOME && {
985 test -n "$verbose" && echo " ... testing $3-directories under [$]HOME"
986 test -d [$]HOME/$3 && $1="[$]$1 [$]HOME/$3"
987 test -d [$]HOME/$3/$2 && $1="[$]$1 [$]HOME/$3/$2"
988 test -d [$]HOME/$3/$2/$3 && $1="[$]$1 [$]HOME/$3/$2/$3"
989}
990
991# For other stuff under the home directory, it should be sufficient to put
992# a symbolic link for $HOME/$2 to the actual package location:
993test -d [$]HOME/$2 && {
994 test -n "$verbose" && echo " ... testing $3-directories under [$]HOME/$2"
995 test -d [$]HOME/$2/$3 && $1="[$]$1 [$]HOME/$2/$3"
996 test -d [$]HOME/$2/$3/$2 && $1="[$]$1 [$]HOME/$2/$3/$2"
997}
998
999test "$prefix" != /usr/local && \
1000test -d /usr/local && {
1001 test -n "$verbose" && echo " ... testing $3-directories under /usr/local"
1002 test -d /usr/local/$3 && $1="[$]$1 /usr/local/$3"
1003 test -d /usr/local/$3/$2 && $1="[$]$1 /usr/local/$3/$2"
1004 test -d /usr/local/$3/$2/$3 && $1="[$]$1 /usr/local/$3/$2/$3"
1005 test -d /usr/local/$2/$3 && $1="[$]$1 /usr/local/$2/$3"
1006 test -d /usr/local/$2/$3/$2 && $1="[$]$1 /usr/local/$2/$3/$2"
1007}
1008
1009test "$prefix" != NONE && \
1010test -d $prefix && {
1011 test -n "$verbose" && echo " ... testing $3-directories under $prefix"
1012 test -d $prefix/$3 && $1="[$]$1 $prefix/$3"
1013 test -d $prefix/$3/$2 && $1="[$]$1 $prefix/$3/$2"
1014 test -d $prefix/$3/$2/$3 && $1="[$]$1 $prefix/$3/$2/$3"
1015 test -d $prefix/$2/$3 && $1="[$]$1 $prefix/$2/$3"
1016 test -d $prefix/$2/$3/$2 && $1="[$]$1 $prefix/$2/$3/$2"
1017}
1018
1019test "$prefix" != /opt && \
1020test -d /opt && {
1021 test -n "$verbose" && echo " ... testing $3-directories under /opt"
1022 test -d /opt/$3 && $1="[$]$1 /opt/$3"
1023 test -d /opt/$3/$2 && $1="[$]$1 /opt/$3/$2"
1024 test -d /opt/$3/$2/$3 && $1="[$]$1 /opt/$3/$2/$3"
1025 test -d /opt/$2/$3 && $1="[$]$1 /opt/$2/$3"
1026 test -d /opt/$2/$3/$2 && $1="[$]$1 /opt/$2/$3/$2"
1027}
1028
1029test "$prefix" != /usr && \
1030test -d /usr && {
1031 test -n "$verbose" && echo " ... testing $3-directories under /usr"
1032 test -d /usr/$3 && $1="[$]$1 /usr/$3"
1033 test -d /usr/$3/$2 && $1="[$]$1 /usr/$3/$2"
1034 test -d /usr/$3/$2/$3 && $1="[$]$1 /usr/$3/$2/$3"
1035 test -d /usr/$2/$3 && $1="[$]$1 /usr/$2/$3"
1036}
1037])dnl
1038dnl ---------------------------------------------------------------------------
1039dnl CF_SYS_TIME_SELECT version: 4 updated: 2000/10/04 09:18:40
1040dnl ------------------
1041dnl Check if we can include <sys/time.h> with <sys/select.h>; this breaks on
1042dnl older SCO configurations.
1043AC_DEFUN([CF_SYS_TIME_SELECT],
1044[
1045AC_MSG_CHECKING(if sys/time.h works with sys/select.h)
1046AC_CACHE_VAL(cf_cv_sys_time_select,[
1047AC_TRY_COMPILE([
1048#include <sys/types.h>
1049#ifdef HAVE_SYS_TIME_H
1050#include <sys/time.h>
1051#endif
1052#ifdef HAVE_SYS_SELECT_H
1053#include <sys/select.h>
1054#endif
1055],[],[cf_cv_sys_time_select=yes],
1056 [cf_cv_sys_time_select=no])
1057 ])
1058AC_MSG_RESULT($cf_cv_sys_time_select)
1059test "$cf_cv_sys_time_select" = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT)
1060])dnl
1061dnl ---------------------------------------------------------------------------
1062dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59
1063dnl --------
1064dnl Make an uppercase version of a variable
1065dnl $1=uppercase($2)
1066AC_DEFUN([CF_UPPER],
1067[
1068$1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
1069])dnl
1070dnl ---------------------------------------------------------------------------
1071dnl CF_UTF8_LIB version: 4 updated: 2003/03/01 18:36:42
1072dnl -----------
1073dnl Check for multibyte support, and if not found, utf8 compatibility library
1074AC_DEFUN([CF_UTF8_LIB],
1075[
1076AC_CACHE_CHECK(for multibyte character support,cf_cv_utf8_lib,[
1077 cf_save_LIBS="$LIBS"
1078 AC_TRY_LINK([
1079#include <stdlib.h>],[putwc(0,0);],
1080 [cf_cv_utf8_lib=yes],
1081 [LIBS="-lutf8 $LIBS"
1082 AC_TRY_LINK([
1083#include <libutf8.h>],[putwc(0,0);],
1084 [cf_cv_utf8_lib=add-on],
1085 [cf_cv_utf8_lib=no])
1086 LIBS="$cf_save_LIBS"
1087])])
1088
1089# HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between
1090# ncurses/ncursesw:
1091if test "$cf_cv_utf8_lib" = "add-on" ; then
1092 AC_DEFINE(HAVE_LIBUTF8_H)
1093 LIBS="-lutf8 $LIBS"
1094fi
1095])dnl
1096dnl ---------------------------------------------------------------------------
1097dnl CF_VERBOSE version: 2 updated: 1997/09/05 10:45:14
1098dnl ----------
1099dnl Use AC_VERBOSE w/o the warnings
1100AC_DEFUN([CF_VERBOSE],
1101[test -n "$verbose" && echo " $1" 1>&AC_FD_MSG
1102])dnl
1103dnl ---------------------------------------------------------------------------
1104dnl CF_WITH_CURSES_DIR version: 2 updated: 2002/11/10 14:46:59
1105dnl ------------------
1106dnl Wrapper for AC_ARG_WITH to specify directory under which to look for curses
1107dnl libraries.
1108AC_DEFUN([CF_WITH_CURSES_DIR],[
1109AC_ARG_WITH(curses-dir,
1110 [ --with-curses-dir=DIR directory in which (n)curses is installed],
1111 [CF_PATH_SYNTAX(withval)
1112 cf_cv_curses_dir=$withval],
1113 [cf_cv_curses_dir=no])
1114])dnl
1115dnl ---------------------------------------------------------------------------
1116dnl CF_XOPEN_SOURCE version: 17 updated: 2005/02/06 12:07:45
1117dnl ---------------
1118dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
1119dnl or adapt to the vendor's definitions to get equivalent functionality.
1120dnl
1121dnl Parameters:
1122dnl $1 is the nominal value for _XOPEN_SOURCE
1123dnl $2 is the nominal value for _POSIX_C_SOURCE
1124AC_DEFUN([CF_XOPEN_SOURCE],[
1125
1126cf_XOPEN_SOURCE=ifelse($1,,500,$1)
1127cf_POSIX_C_SOURCE=ifelse($2,,199506L,$2)
1128
1129case $host_os in #(vi
1130aix[[45]]*) #(vi
1131 CPPFLAGS="$CPPFLAGS -D_ALL_SOURCE"
1132 ;;
1133freebsd*) #(vi
1134 # 5.x headers associate
1135 # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L
1136 # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L
1137 cf_POSIX_C_SOURCE=200112L
1138 cf_XOPEN_SOURCE=600
1139 CPPFLAGS="$CPPFLAGS -D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
1140 ;;
1141hpux*) #(vi
1142 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE"
1143 ;;
1144irix[[56]].*) #(vi
1145 CPPFLAGS="$CPPFLAGS -D_SGI_SOURCE"
1146 ;;
1147linux*|gnu*) #(vi
1148 CF_GNU_SOURCE
1149 ;;
1150mirbsd*) #(vi
1151 # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h>
1152 ;;
1153netbsd*) #(vi
1154 # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
1155 ;;
1156openbsd*) #(vi
1157 # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
1158 ;;
1159osf[[45]]*) #(vi
1160 CPPFLAGS="$CPPFLAGS -D_OSF_SOURCE"
1161 ;;
1162sco*) #(vi
1163 # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
1164 ;;
1165solaris*) #(vi
1166 CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
1167 ;;
1168*)
1169 AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
1170 AC_TRY_COMPILE([#include <sys/types.h>],[
1171#ifndef _XOPEN_SOURCE
1172make an error
1173#endif],
1174 [cf_cv_xopen_source=no],
1175 [cf_save="$CPPFLAGS"
1176 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
1177 AC_TRY_COMPILE([#include <sys/types.h>],[
1178#ifdef _XOPEN_SOURCE
1179make an error
1180#endif],
1181 [cf_cv_xopen_source=no],
1182 [cf_cv_xopen_source=$cf_XOPEN_SOURCE])
1183 CPPFLAGS="$cf_save"
1184 ])
1185])
1186test "$cf_cv_xopen_source" != no && CPPFLAGS="$CPPFLAGS -U_XOPEN_SOURCE -D_XOPEN_SOURCE=$cf_cv_xopen_source"
1187 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
1188 ;;
1189esac
1190])
Note: See TracBrowser for help on using the repository browser.