1 | dnl $Id: aclocal.m4,v 1.8 2005/02/27 00:02:01 tom Exp $
|
---|
2 | dnl ---------------------------------------------------------------------------
|
---|
3 | dnl ---------------------------------------------------------------------------
|
---|
4 | dnl CF_ADD_CFLAGS version: 7 updated: 2004/04/25 17:48:30
|
---|
5 | dnl -------------
|
---|
6 | dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS
|
---|
7 | dnl The second parameter if given makes this macro verbose.
|
---|
8 | dnl
|
---|
9 | dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS,
|
---|
10 | dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily
|
---|
11 | dnl confused by the quotes (which require backslashes to keep them usable).
|
---|
12 | AC_DEFUN([CF_ADD_CFLAGS],
|
---|
13 | [
|
---|
14 | cf_fix_cppflags=no
|
---|
15 | cf_new_cflags=
|
---|
16 | cf_new_cppflags=
|
---|
17 | cf_new_extra_cppflags=
|
---|
18 |
|
---|
19 | for cf_add_cflags in $1
|
---|
20 | do
|
---|
21 | case $cf_fix_cppflags in
|
---|
22 | no)
|
---|
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 | ;;
|
---|
55 | yes)
|
---|
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 | ;;
|
---|
64 | esac
|
---|
65 | done
|
---|
66 |
|
---|
67 | if test -n "$cf_new_cflags" ; then
|
---|
68 | ifelse($2,,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)])
|
---|
69 | CFLAGS="$CFLAGS $cf_new_cflags"
|
---|
70 | fi
|
---|
71 |
|
---|
72 | if test -n "$cf_new_cppflags" ; then
|
---|
73 | ifelse($2,,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)])
|
---|
74 | CPPFLAGS="$cf_new_cppflags $CPPFLAGS"
|
---|
75 | fi
|
---|
76 |
|
---|
77 | if 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"
|
---|
80 | fi
|
---|
81 |
|
---|
82 | AC_SUBST(EXTRA_CPPFLAGS)
|
---|
83 |
|
---|
84 | ])dnl
|
---|
85 | dnl ---------------------------------------------------------------------------
|
---|
86 | dnl CF_ADD_INCDIR version: 4 updated: 2002/12/21 14:25:52
|
---|
87 | dnl -------------
|
---|
88 | dnl Add an include-directory to $CPPFLAGS. Don't add /usr/include, since it's
|
---|
89 | dnl redundant. We don't normally need to add -I/usr/local/include for gcc,
|
---|
90 | dnl but old versions (and some misinstalled ones) need that. To make things
|
---|
91 | dnl worse, gcc 3.x gives error messages if -I/usr/local/include is added to
|
---|
92 | dnl the include-path).
|
---|
93 | AC_DEFUN([CF_ADD_INCDIR],
|
---|
94 | [
|
---|
95 | for cf_add_incdir in $1
|
---|
96 | do
|
---|
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
|
---|
121 | done
|
---|
122 | ])dnl
|
---|
123 | dnl ---------------------------------------------------------------------------
|
---|
124 | dnl CF_ANSI_CC_CHECK version: 9 updated: 2001/12/30 17:53:34
|
---|
125 | dnl ----------------
|
---|
126 | dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES'
|
---|
127 | dnl in the sharutils 4.2 distribution.
|
---|
128 | AC_DEFUN([CF_ANSI_CC_CHECK],
|
---|
129 | [
|
---|
130 | AC_CACHE_CHECK(for ${CC-cc} option to accept ANSI C, cf_cv_ansi_cc,[
|
---|
131 | cf_cv_ansi_cc=no
|
---|
132 | cf_save_CFLAGS="$CFLAGS"
|
---|
133 | cf_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)
|
---|
141 | for cf_arg in "-DCC_HAS_PROTOS" \
|
---|
142 | "" \
|
---|
143 | -qlanglvl=ansi \
|
---|
144 | -std1 \
|
---|
145 | -Ae \
|
---|
146 | "-Aa -D_HPUX_SOURCE" \
|
---|
147 | -Xc
|
---|
148 | do
|
---|
149 | CF_ADD_CFLAGS($cf_arg)
|
---|
150 | AC_TRY_COMPILE(
|
---|
151 | [
|
---|
152 | #ifndef CC_HAS_PROTOS
|
---|
153 | #if !defined(__STDC__) || (__STDC__ != 1)
|
---|
154 | choke 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])
|
---|
162 | done
|
---|
163 | CFLAGS="$cf_save_CFLAGS"
|
---|
164 | CPPFLAGS="$cf_save_CPPFLAGS"
|
---|
165 | ])
|
---|
166 |
|
---|
167 | if test "$cf_cv_ansi_cc" != "no"; then
|
---|
168 | if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then
|
---|
169 | CF_ADD_CFLAGS($cf_cv_ansi_cc)
|
---|
170 | else
|
---|
171 | AC_DEFINE(CC_HAS_PROTOS)
|
---|
172 | fi
|
---|
173 | fi
|
---|
174 | ])dnl
|
---|
175 | dnl ---------------------------------------------------------------------------
|
---|
176 | dnl CF_ANSI_CC_REQD version: 3 updated: 1997/09/06 13:40:44
|
---|
177 | dnl ---------------
|
---|
178 | dnl For programs that must use an ANSI compiler, obtain compiler options that
|
---|
179 | dnl will make it recognize prototypes. We'll do preprocessor checks in other
|
---|
180 | dnl macros, since tools such as unproto can fake prototypes, but only part of
|
---|
181 | dnl the preprocessor.
|
---|
182 | AC_DEFUN([CF_ANSI_CC_REQD],
|
---|
183 | [AC_REQUIRE([CF_ANSI_CC_CHECK])
|
---|
184 | if test "$cf_cv_ansi_cc" = "no"; then
|
---|
185 | AC_ERROR(
|
---|
186 | [Your compiler does not appear to recognize prototypes.
|
---|
187 | You 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])
|
---|
191 | fi
|
---|
192 | ])dnl
|
---|
193 | dnl ---------------------------------------------------------------------------
|
---|
194 | dnl CF_CHECK_CACHE version: 10 updated: 2004/05/23 13:03:31
|
---|
195 | dnl --------------
|
---|
196 | dnl Check if we're accidentally using a cache from a different machine.
|
---|
197 | dnl Derive the system name, as a check for reusing the autoconf cache.
|
---|
198 | dnl
|
---|
199 | dnl If we've packaged config.guess and config.sub, run that (since it does a
|
---|
200 | dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow
|
---|
201 | dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM
|
---|
202 | dnl which is useful in cross-compiles.
|
---|
203 | dnl
|
---|
204 | dnl Note: we would use $ac_config_sub, but that is one of the places where
|
---|
205 | dnl autoconf 2.5x broke compatibility with autoconf 2.13
|
---|
206 | AC_DEFUN([CF_CHECK_CACHE],
|
---|
207 | [
|
---|
208 | if 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"
|
---|
211 | else
|
---|
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
|
---|
216 | fi
|
---|
217 | test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name")
|
---|
218 | AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
|
---|
219 |
|
---|
220 | test -z "$system_name" && system_name="$cf_cv_system_name"
|
---|
221 | test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name)
|
---|
222 |
|
---|
223 | if 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.")
|
---|
226 | fi
|
---|
227 | ])dnl
|
---|
228 | dnl ---------------------------------------------------------------------------
|
---|
229 | dnl CF_CURSES_ACS_MAP version: 3 updated: 2003/05/17 22:19:02
|
---|
230 | dnl -----------------
|
---|
231 | dnl Check for likely values of acs_map[]:
|
---|
232 | AC_DEFUN([CF_CURSES_ACS_MAP],
|
---|
233 | [
|
---|
234 | AC_CACHE_CHECK(for alternate character set array, cf_cv_curses_acs_map,[
|
---|
235 | cf_cv_curses_acs_map=unknown
|
---|
236 | for name in acs_map _acs_map __acs_map _nc_acs_map
|
---|
237 | do
|
---|
238 | AC_TRY_LINK([
|
---|
239 | #include <${cf_cv_ncurses_header-curses.h}>
|
---|
240 | ],[
|
---|
241 | $name['k'] = ACS_PLUS
|
---|
242 | ],[cf_cv_curses_acs_map=$name; break])
|
---|
243 | done
|
---|
244 | ])
|
---|
245 |
|
---|
246 | test "$cf_cv_curses_acs_map" != unknown && AC_DEFINE_UNQUOTED(CURSES_ACS_ARRAY,$cf_cv_curses_acs_map)
|
---|
247 | ])
|
---|
248 | dnl ---------------------------------------------------------------------------
|
---|
249 | dnl CF_CURSES_CHECK_TYPE version: 2 updated: 2003/03/01 23:40:33
|
---|
250 | dnl --------------------
|
---|
251 | dnl Check if curses.h defines the given type
|
---|
252 | AC_DEFUN([CF_CURSES_CHECK_TYPE],
|
---|
253 | [
|
---|
254 | AC_MSG_CHECKING(for type $1 in ${cf_cv_ncurses_header-curses.h})
|
---|
255 | AC_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)
|
---|
262 | AC_MSG_RESULT($cf_result)
|
---|
263 | if test $cf_result = yes ; then
|
---|
264 | CF_UPPER(cf_result,have_type_$1)
|
---|
265 | AC_DEFINE_UNQUOTED($cf_result)
|
---|
266 | else
|
---|
267 | AC_DEFINE_UNQUOTED($1,$2)
|
---|
268 | fi
|
---|
269 | ])dnl
|
---|
270 | dnl ---------------------------------------------------------------------------
|
---|
271 | dnl CF_CURSES_CPPFLAGS version: 7 updated: 2003/06/06 00:48:41
|
---|
272 | dnl ------------------
|
---|
273 | dnl Look for the curses headers.
|
---|
274 | AC_DEFUN([CF_CURSES_CPPFLAGS],[
|
---|
275 |
|
---|
276 | AC_CACHE_CHECK(for extra include directories,cf_cv_curses_incdir,[
|
---|
277 | cf_cv_curses_incdir=no
|
---|
278 | case $host_os in #(vi
|
---|
279 | hpux10.*|hpux11.*) #(vi
|
---|
280 | test -d /usr/include/curses_colr && \
|
---|
281 | cf_cv_curses_incdir="-I/usr/include/curses_colr"
|
---|
282 | ;;
|
---|
283 | sunos3*|sunos4*)
|
---|
284 | test -d /usr/5lib && \
|
---|
285 | test -d /usr/5include && \
|
---|
286 | cf_cv_curses_incdir="-I/usr/5include"
|
---|
287 | ;;
|
---|
288 | esac
|
---|
289 | ])
|
---|
290 | test "$cf_cv_curses_incdir" != no && CPPFLAGS="$cf_cv_curses_incdir $CPPFLAGS"
|
---|
291 |
|
---|
292 | AC_CACHE_CHECK(if we have identified curses headers,cf_cv_ncurses_header,[
|
---|
293 | cf_cv_ncurses_header=none
|
---|
294 | for cf_header in \
|
---|
295 | curses.h \
|
---|
296 | ncurses.h \
|
---|
297 | ncurses/curses.h \
|
---|
298 | ncurses/ncurses.h
|
---|
299 | do
|
---|
300 | AC_TRY_COMPILE([#include <${cf_header}>],
|
---|
301 | [initscr(); tgoto("?", 0,0)],
|
---|
302 | [cf_cv_ncurses_header=$cf_header; break],[])
|
---|
303 | done
|
---|
304 | ])
|
---|
305 |
|
---|
306 | if test "$cf_cv_ncurses_header" = none ; then
|
---|
307 | AC_MSG_ERROR(No curses header-files found)
|
---|
308 | fi
|
---|
309 |
|
---|
310 | # cheat, to get the right #define's for HAVE_NCURSES_H, etc.
|
---|
311 | AC_CHECK_HEADERS($cf_cv_ncurses_header)
|
---|
312 |
|
---|
313 | ])dnl
|
---|
314 | dnl ---------------------------------------------------------------------------
|
---|
315 | dnl CF_CURSES_LIBS version: 23 updated: 2003/11/06 19:59:57
|
---|
316 | dnl --------------
|
---|
317 | dnl Look for the curses libraries. Older curses implementations may require
|
---|
318 | dnl termcap/termlib to be linked as well. Call CF_CURSES_CPPFLAGS first.
|
---|
319 | AC_DEFUN([CF_CURSES_LIBS],[
|
---|
320 |
|
---|
321 | AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
|
---|
322 | AC_MSG_CHECKING(if we have identified curses libraries)
|
---|
323 | AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
|
---|
324 | [initscr(); tgoto("?", 0,0)],
|
---|
325 | cf_result=yes,
|
---|
326 | cf_result=no)
|
---|
327 | AC_MSG_RESULT($cf_result)
|
---|
328 |
|
---|
329 | if test "$cf_result" = no ; then
|
---|
330 | case $host_os in #(vi
|
---|
331 | freebsd*) #(vi
|
---|
332 | AC_CHECK_LIB(mytinfo,tgoto,[LIBS="-lmytinfo $LIBS"])
|
---|
333 | ;;
|
---|
334 | hpux10.*|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 | ;;
|
---|
346 | linux*) # Suse Linux does not follow /usr/lib convention
|
---|
347 | LIBS="$LIBS -L/lib"
|
---|
348 | ;;
|
---|
349 | sunos3*|sunos4*)
|
---|
350 | test -d /usr/5lib && \
|
---|
351 | LIBS="$LIBS -L/usr/5lib -lcurses -ltermcap"
|
---|
352 | ac_cv_func_initscr=yes
|
---|
353 | ;;
|
---|
354 | esac
|
---|
355 |
|
---|
356 | if 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
|
---|
410 | fi
|
---|
411 | fi
|
---|
412 |
|
---|
413 | ])dnl
|
---|
414 | dnl ---------------------------------------------------------------------------
|
---|
415 | dnl CF_CURSES_WACS_MAP version: 3 updated: 2003/05/17 22:19:02
|
---|
416 | dnl ------------------
|
---|
417 | dnl Check for likely values of wacs_map[]:
|
---|
418 | AC_DEFUN([CF_CURSES_WACS_MAP],
|
---|
419 | [
|
---|
420 | AC_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 | ])
|
---|
434 | dnl ---------------------------------------------------------------------------
|
---|
435 | dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52
|
---|
436 | dnl ----------
|
---|
437 | dnl "dirname" is not portable, so we fake it with a shell script.
|
---|
438 | AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl
|
---|
439 | dnl ---------------------------------------------------------------------------
|
---|
440 | dnl CF_FIND_LIBRARY version: 8 updated: 2004/11/23 20:14:58
|
---|
441 | dnl ---------------
|
---|
442 | dnl Look for a non-standard library, given parameters for AC_TRY_LINK. We
|
---|
443 | dnl prefer a standard location, and use -L options only if we do not find the
|
---|
444 | dnl library in the standard library location(s).
|
---|
445 | dnl $1 = library name
|
---|
446 | dnl $2 = library class, usually the same as library name
|
---|
447 | dnl $3 = includes
|
---|
448 | dnl $4 = code fragment to compile/link
|
---|
449 | dnl $5 = corresponding function-name
|
---|
450 | dnl $6 = flag, nonnull if failure should not cause an error-exit
|
---|
451 | dnl
|
---|
452 | dnl Sets the variable "$cf_libdir" as a side-effect, so we can see if we had
|
---|
453 | dnl to use a -L option.
|
---|
454 | AC_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 | ])
|
---|
482 | eval 'cf_found_library=[$]cf_cv_have_lib_'$1
|
---|
483 | ifelse($6,,[
|
---|
484 | if test $cf_found_library = no ; then
|
---|
485 | AC_ERROR(Cannot link $1 library)
|
---|
486 | fi
|
---|
487 | ])
|
---|
488 | ])dnl
|
---|
489 | dnl ---------------------------------------------------------------------------
|
---|
490 | dnl CF_FUNC_CURSES_VERSION version: 3 updated: 2003/05/17 22:19:02
|
---|
491 | dnl ----------------------
|
---|
492 | dnl Solaris has a data item 'curses_version', which confuses AC_CHECK_FUNCS.
|
---|
493 | dnl It's a character string "SVR4", not documented.
|
---|
494 | AC_DEFUN([CF_FUNC_CURSES_VERSION],
|
---|
495 | [
|
---|
496 | AC_CACHE_CHECK(for function curses_version, cf_cv_func_curses_version,[
|
---|
497 | AC_TRY_RUN([
|
---|
498 | #include <${cf_cv_ncurses_header-curses.h}>
|
---|
499 | int 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])
|
---|
508 | rm -f core])
|
---|
509 | test "$cf_cv_func_curses_version" = yes && AC_DEFINE(HAVE_CURSES_VERSION)
|
---|
510 | ])
|
---|
511 | dnl ---------------------------------------------------------------------------
|
---|
512 | dnl CF_GNU_SOURCE version: 4 updated: 2004/12/03 20:43:00
|
---|
513 | dnl -------------
|
---|
514 | dnl Check if we must define _GNU_SOURCE to get a reasonable value for
|
---|
515 | dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect
|
---|
516 | dnl (or misfeature) of glibc2, which breaks portability of many applications,
|
---|
517 | dnl since it is interwoven with GNU extensions.
|
---|
518 | dnl
|
---|
519 | dnl Well, yes we could work around it...
|
---|
520 | AC_DEFUN([CF_GNU_SOURCE],
|
---|
521 | [
|
---|
522 | AC_REQUIRE([CF_INTEL_COMPILER])
|
---|
523 |
|
---|
524 | if test "$INTEL_COMPILER" = no ; then
|
---|
525 | AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[
|
---|
526 | AC_TRY_COMPILE([#include <sys/types.h>],[
|
---|
527 | #ifndef _XOPEN_SOURCE
|
---|
528 | make 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
|
---|
535 | make an error
|
---|
536 | #endif],
|
---|
537 | [cf_cv_gnu_source=no],
|
---|
538 | [cf_cv_gnu_source=yes])
|
---|
539 | CPPFLAGS="$cf_save"
|
---|
540 | ])
|
---|
541 | ])
|
---|
542 | test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
|
---|
543 | fi
|
---|
544 | ])dnl
|
---|
545 | dnl ---------------------------------------------------------------------------
|
---|
546 | dnl CF_HEADER_PATH version: 8 updated: 2002/11/10 14:46:59
|
---|
547 | dnl --------------
|
---|
548 | dnl Construct a search-list for a nonstandard header-file
|
---|
549 | AC_DEFUN([CF_HEADER_PATH],
|
---|
550 | [CF_SUBDIR_PATH($1,$2,include)
|
---|
551 | test "$includedir" != NONE && \
|
---|
552 | test "$includedir" != "/usr/include" && \
|
---|
553 | test -d "$includedir" && {
|
---|
554 | test -d $includedir && $1="[$]$1 $includedir"
|
---|
555 | test -d $includedir/$2 && $1="[$]$1 $includedir/$2"
|
---|
556 | }
|
---|
557 |
|
---|
558 | test "$oldincludedir" != NONE && \
|
---|
559 | test "$oldincludedir" != "/usr/include" && \
|
---|
560 | test -d "$oldincludedir" && {
|
---|
561 | test -d $oldincludedir && $1="[$]$1 $oldincludedir"
|
---|
562 | test -d $oldincludedir/$2 && $1="[$]$1 $oldincludedir/$2"
|
---|
563 | }
|
---|
564 |
|
---|
565 | ])dnl
|
---|
566 | dnl ---------------------------------------------------------------------------
|
---|
567 | dnl CF_INHERIT_SCRIPT version: 2 updated: 2003/03/01 23:50:42
|
---|
568 | dnl -----------------
|
---|
569 | dnl If we do not have a given script, look for it in the parent directory.
|
---|
570 | AC_DEFUN([CF_INHERIT_SCRIPT],
|
---|
571 | [
|
---|
572 | test -f $1 || ( test -f ../$1 && cp ../$1 ./ )
|
---|
573 | ])dnl
|
---|
574 | dnl ---------------------------------------------------------------------------
|
---|
575 | dnl CF_INTEL_COMPILER version: 1 updated: 2004/12/03 20:27:48
|
---|
576 | dnl -----------------
|
---|
577 | dnl Check if the given compiler is really the Intel compiler for Linux.
|
---|
578 | dnl It tries to imitate gcc, but does not return an error when it finds a
|
---|
579 | dnl mismatch between prototypes, e.g., as exercised by CF_MISSING_CHECK.
|
---|
580 | dnl
|
---|
581 | dnl This macro should be run "soon" after AC_PROG_CC, to ensure that it is
|
---|
582 | dnl not mistaken for gcc.
|
---|
583 | AC_DEFUN([CF_INTEL_COMPILER],[
|
---|
584 | AC_REQUIRE([AC_PROG_CC])
|
---|
585 |
|
---|
586 | INTEL_COMPILER=no
|
---|
587 |
|
---|
588 | if 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
|
---|
597 | make an error
|
---|
598 | #endif
|
---|
599 | ],[INTEL_COMPILER=yes
|
---|
600 | cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc"
|
---|
601 | ],[])
|
---|
602 | CFLAGS="$cf_save_CFLAGS"
|
---|
603 | AC_MSG_RESULT($INTEL_COMPILER)
|
---|
604 | ;;
|
---|
605 | esac
|
---|
606 | fi
|
---|
607 | ])dnl
|
---|
608 | dnl ---------------------------------------------------------------------------
|
---|
609 | dnl CF_LIBRARY_PATH version: 7 updated: 2002/11/10 14:46:59
|
---|
610 | dnl ---------------
|
---|
611 | dnl Construct a search-list for a nonstandard library-file
|
---|
612 | AC_DEFUN([CF_LIBRARY_PATH],
|
---|
613 | [CF_SUBDIR_PATH($1,$2,lib)])dnl
|
---|
614 | dnl ---------------------------------------------------------------------------
|
---|
615 | dnl CF_MSG_LOG version: 3 updated: 1997/09/07 14:05:52
|
---|
616 | dnl ----------
|
---|
617 | dnl Write a debug message to config.log, along with the line number in the
|
---|
618 | dnl configure script.
|
---|
619 | AC_DEFUN([CF_MSG_LOG],[
|
---|
620 | echo "(line __oline__) testing $* ..." 1>&AC_FD_CC
|
---|
621 | ])dnl
|
---|
622 | dnl ---------------------------------------------------------------------------
|
---|
623 | dnl CF_NCURSES_CC_CHECK version: 3 updated: 2003/01/12 18:59:28
|
---|
624 | dnl -------------------
|
---|
625 | dnl Check if we can compile with ncurses' header file
|
---|
626 | dnl $1 is the cache variable to set
|
---|
627 | dnl $2 is the header-file to include
|
---|
628 | dnl $3 is the root name (ncurses or ncursesw)
|
---|
629 | AC_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 | ])[
|
---|
643 | printf("%s\n", NCURSES_VERSION);
|
---|
644 | #else
|
---|
645 | #ifdef __NCURSES_H
|
---|
646 | printf("old\n");
|
---|
647 | #else
|
---|
648 | make an error
|
---|
649 | #endif
|
---|
650 | #endif
|
---|
651 | ]
|
---|
652 | ,[$1=$cf_header]
|
---|
653 | ,[$1=no])
|
---|
654 | ])dnl
|
---|
655 | dnl ---------------------------------------------------------------------------
|
---|
656 | dnl CF_NCURSES_CPPFLAGS version: 17 updated: 2003/11/06 19:59:57
|
---|
657 | dnl -------------------
|
---|
658 | dnl Look for the SVr4 curses clone 'ncurses' in the standard places, adjusting
|
---|
659 | dnl the CPPFLAGS variable so we can include its header.
|
---|
660 | dnl
|
---|
661 | dnl The header files may be installed as either curses.h, or ncurses.h (would
|
---|
662 | dnl be obsolete, except that some packagers prefer this name to distinguish it
|
---|
663 | dnl from a "native" curses implementation). If not installed for overwrite,
|
---|
664 | dnl the curses.h file would be in an ncurses subdirectory (e.g.,
|
---|
665 | dnl /usr/include/ncurses), but someone may have installed overwriting the
|
---|
666 | dnl vendor's curses. Only very old versions (pre-1.9.2d, the first autoconf'd
|
---|
667 | dnl version) of ncurses don't define either __NCURSES_H or NCURSES_VERSION in
|
---|
668 | dnl the header.
|
---|
669 | dnl
|
---|
670 | dnl If the installer has set $CFLAGS or $CPPFLAGS so that the ncurses header
|
---|
671 | dnl is already in the include-path, don't even bother with this, since we cannot
|
---|
672 | dnl easily determine which file it is. In this case, it has to be <curses.h>.
|
---|
673 | dnl
|
---|
674 | dnl The optional parameter gives the root name of the library, in case it is
|
---|
675 | dnl not installed as the default curses library. That is how the
|
---|
676 | dnl wide-character version of ncurses is installed.
|
---|
677 | AC_DEFUN([CF_NCURSES_CPPFLAGS],
|
---|
678 | [AC_REQUIRE([CF_WITH_CURSES_DIR])
|
---|
679 |
|
---|
680 | AC_PROVIDE([CF_CURSES_CPPFLAGS])dnl
|
---|
681 | cf_ncuhdr_root=ifelse($1,,ncurses,$1)
|
---|
682 |
|
---|
683 | test -n "$cf_cv_curses_dir" && \
|
---|
684 | test "$cf_cv_curses_dir" != "no" && \
|
---|
685 | CPPFLAGS="-I$cf_cv_curses_dir/include -I$cf_cv_curses_dir/include/$cf_ncuhdr_root $CPPFLAGS"
|
---|
686 |
|
---|
687 | AC_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 |
|
---|
697 | if test "$cf_cv_ncurses_h" != no ; then
|
---|
698 | cf_cv_ncurses_header=$cf_cv_ncurses_h
|
---|
699 | else
|
---|
700 | AC_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 |
|
---|
733 | fi
|
---|
734 |
|
---|
735 | AC_DEFINE(NCURSES)
|
---|
736 |
|
---|
737 | case $cf_cv_ncurses_header in # (vi
|
---|
738 | *ncurses.h)
|
---|
739 | AC_DEFINE(HAVE_NCURSES_H)
|
---|
740 | ;;
|
---|
741 | esac
|
---|
742 |
|
---|
743 | case $cf_cv_ncurses_header in # (vi
|
---|
744 | ncurses/curses.h|ncurses/ncurses.h)
|
---|
745 | AC_DEFINE(HAVE_NCURSES_NCURSES_H)
|
---|
746 | ;;
|
---|
747 | ncursesw/curses.h|ncursesw/ncurses.h)
|
---|
748 | AC_DEFINE(HAVE_NCURSESW_NCURSES_H)
|
---|
749 | ;;
|
---|
750 | esac
|
---|
751 |
|
---|
752 | CF_NCURSES_VERSION
|
---|
753 | ])dnl
|
---|
754 | dnl ---------------------------------------------------------------------------
|
---|
755 | dnl CF_NCURSES_LIBS version: 12 updated: 2004/04/27 16:26:05
|
---|
756 | dnl ---------------
|
---|
757 | dnl Look for the ncurses library. This is a little complicated on Linux,
|
---|
758 | dnl because it may be linked with the gpm (general purpose mouse) library.
|
---|
759 | dnl Some distributions have gpm linked with (bsd) curses, which makes it
|
---|
760 | dnl unusable with ncurses. However, we don't want to link with gpm unless
|
---|
761 | dnl ncurses has a dependency, since gpm is normally set up as a shared library,
|
---|
762 | dnl and the linker will record a dependency.
|
---|
763 | dnl
|
---|
764 | dnl The optional parameter gives the root name of the library, in case it is
|
---|
765 | dnl not installed as the default curses library. That is how the
|
---|
766 | dnl wide-character version of ncurses is installed.
|
---|
767 | AC_DEFUN([CF_NCURSES_LIBS],
|
---|
768 | [AC_REQUIRE([CF_NCURSES_CPPFLAGS])
|
---|
769 |
|
---|
770 | cf_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.
|
---|
774 | cf_ncurses_LIBS=""
|
---|
775 | cf_ncurses_SAVE="$LIBS"
|
---|
776 | AC_CHECK_LIB(gpm,Gpm_Open,
|
---|
777 | [AC_CHECK_LIB(gpm,initscr,
|
---|
778 | [LIBS="$cf_ncurses_SAVE"],
|
---|
779 | [cf_ncurses_LIBS="-lgpm"])])
|
---|
780 |
|
---|
781 | case $host_os in #(vi
|
---|
782 | freebsd*)
|
---|
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 | ;;
|
---|
789 | esac
|
---|
790 |
|
---|
791 | LIBS="$cf_ncurses_LIBS $LIBS"
|
---|
792 |
|
---|
793 | if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
|
---|
794 | then
|
---|
795 | LIBS="-L$cf_cv_curses_dir/lib -l$cf_nculib_root $LIBS"
|
---|
796 | else
|
---|
797 | CF_FIND_LIBRARY($cf_nculib_root,$cf_nculib_root,
|
---|
798 | [#include <${cf_cv_ncurses_header-curses.h}>],
|
---|
799 | [initscr()],
|
---|
800 | initscr)
|
---|
801 | fi
|
---|
802 |
|
---|
803 | if 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"])
|
---|
817 | fi
|
---|
818 |
|
---|
819 | CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_nculib_root)
|
---|
820 | AC_DEFINE_UNQUOTED($cf_nculib_ROOT)
|
---|
821 | ])dnl
|
---|
822 | dnl ---------------------------------------------------------------------------
|
---|
823 | dnl CF_NCURSES_VERSION version: 11 updated: 2003/11/06 19:59:57
|
---|
824 | dnl ------------------
|
---|
825 | dnl Check for the version of ncurses, to aid in reporting bugs, etc.
|
---|
826 | dnl Call CF_CURSES_CPPFLAGS first, or CF_NCURSES_CPPFLAGS. We don't use
|
---|
827 | dnl AC_REQUIRE since that does not work with the shell's if/then/else/fi.
|
---|
828 | AC_DEFUN([CF_NCURSES_VERSION],
|
---|
829 | [
|
---|
830 | AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
|
---|
831 | AC_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>
|
---|
838 | int 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
|
---|
864 | Autoconf NCURSES_VERSION
|
---|
865 | #else
|
---|
866 | #ifdef __NCURSES_H
|
---|
867 | Autoconf "old"
|
---|
868 | #endif
|
---|
869 | ;
|
---|
870 | #endif
|
---|
871 | EOF
|
---|
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 | ])
|
---|
882 | test "$cf_cv_ncurses_version" = no || AC_DEFINE(NCURSES)
|
---|
883 | ])dnl
|
---|
884 | dnl ---------------------------------------------------------------------------
|
---|
885 | dnl CF_PATH_SYNTAX version: 9 updated: 2002/09/17 23:03:38
|
---|
886 | dnl --------------
|
---|
887 | dnl Check the argument to see that it looks like a pathname. Rewrite it if it
|
---|
888 | dnl begins with one of the prefix/exec_prefix variables, and then again if the
|
---|
889 | dnl result begins with 'NONE'. This is necessary to work around autoconf's
|
---|
890 | dnl delayed evaluation of those symbols.
|
---|
891 | AC_DEFUN([CF_PATH_SYNTAX],[
|
---|
892 | case ".[$]$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 | ;;
|
---|
913 | esac
|
---|
914 | ])dnl
|
---|
915 | dnl ---------------------------------------------------------------------------
|
---|
916 | dnl CF_POSIX_C_SOURCE version: 3 updated: 2005/02/04 06:56:22
|
---|
917 | dnl -----------------
|
---|
918 | dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed.
|
---|
919 | dnl
|
---|
920 | dnl POSIX.1-1990 _POSIX_SOURCE
|
---|
921 | dnl POSIX.1-1990 and _POSIX_SOURCE and
|
---|
922 | dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2
|
---|
923 | dnl Bindings Option
|
---|
924 | dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L
|
---|
925 | dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L
|
---|
926 | dnl X/Open 2000 _POSIX_C_SOURCE=200112L
|
---|
927 | dnl
|
---|
928 | dnl Parameters:
|
---|
929 | dnl $1 is the nominal value for _POSIX_C_SOURCE
|
---|
930 | AC_DEFUN([CF_POSIX_C_SOURCE],
|
---|
931 | [
|
---|
932 | cf_POSIX_C_SOURCE=ifelse($1,,199506L,$1)
|
---|
933 | AC_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
|
---|
937 | make 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
|
---|
956 | make 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
|
---|
966 | make an error
|
---|
967 | #endif],,
|
---|
968 | [cf_cv_posix_c_source=no])
|
---|
969 | CPPFLAGS="$cf_save"
|
---|
970 | ])
|
---|
971 | ])
|
---|
972 | test "$cf_cv_posix_c_source" != no && CPPFLAGS="$CPPFLAGS $cf_cv_posix_c_source"
|
---|
973 | ])dnl
|
---|
974 | dnl ---------------------------------------------------------------------------
|
---|
975 | dnl CF_SUBDIR_PATH version: 3 updated: 2002/12/29 18:30:46
|
---|
976 | dnl --------------
|
---|
977 | dnl Construct a search-list for a nonstandard header/lib-file
|
---|
978 | dnl $1 = the variable to return as result
|
---|
979 | dnl $2 = the package name
|
---|
980 | dnl $3 = the subdirectory, e.g., bin, include or lib
|
---|
981 | AC_DEFUN([CF_SUBDIR_PATH],
|
---|
982 | [$1=""
|
---|
983 |
|
---|
984 | test -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:
|
---|
993 | test -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 |
|
---|
999 | test "$prefix" != /usr/local && \
|
---|
1000 | test -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 |
|
---|
1009 | test "$prefix" != NONE && \
|
---|
1010 | test -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 |
|
---|
1019 | test "$prefix" != /opt && \
|
---|
1020 | test -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 |
|
---|
1029 | test "$prefix" != /usr && \
|
---|
1030 | test -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
|
---|
1038 | dnl ---------------------------------------------------------------------------
|
---|
1039 | dnl CF_SYS_TIME_SELECT version: 4 updated: 2000/10/04 09:18:40
|
---|
1040 | dnl ------------------
|
---|
1041 | dnl Check if we can include <sys/time.h> with <sys/select.h>; this breaks on
|
---|
1042 | dnl older SCO configurations.
|
---|
1043 | AC_DEFUN([CF_SYS_TIME_SELECT],
|
---|
1044 | [
|
---|
1045 | AC_MSG_CHECKING(if sys/time.h works with sys/select.h)
|
---|
1046 | AC_CACHE_VAL(cf_cv_sys_time_select,[
|
---|
1047 | AC_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 | ])
|
---|
1058 | AC_MSG_RESULT($cf_cv_sys_time_select)
|
---|
1059 | test "$cf_cv_sys_time_select" = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT)
|
---|
1060 | ])dnl
|
---|
1061 | dnl ---------------------------------------------------------------------------
|
---|
1062 | dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59
|
---|
1063 | dnl --------
|
---|
1064 | dnl Make an uppercase version of a variable
|
---|
1065 | dnl $1=uppercase($2)
|
---|
1066 | AC_DEFUN([CF_UPPER],
|
---|
1067 | [
|
---|
1068 | $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
|
---|
1069 | ])dnl
|
---|
1070 | dnl ---------------------------------------------------------------------------
|
---|
1071 | dnl CF_UTF8_LIB version: 4 updated: 2003/03/01 18:36:42
|
---|
1072 | dnl -----------
|
---|
1073 | dnl Check for multibyte support, and if not found, utf8 compatibility library
|
---|
1074 | AC_DEFUN([CF_UTF8_LIB],
|
---|
1075 | [
|
---|
1076 | AC_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:
|
---|
1091 | if test "$cf_cv_utf8_lib" = "add-on" ; then
|
---|
1092 | AC_DEFINE(HAVE_LIBUTF8_H)
|
---|
1093 | LIBS="-lutf8 $LIBS"
|
---|
1094 | fi
|
---|
1095 | ])dnl
|
---|
1096 | dnl ---------------------------------------------------------------------------
|
---|
1097 | dnl CF_VERBOSE version: 2 updated: 1997/09/05 10:45:14
|
---|
1098 | dnl ----------
|
---|
1099 | dnl Use AC_VERBOSE w/o the warnings
|
---|
1100 | AC_DEFUN([CF_VERBOSE],
|
---|
1101 | [test -n "$verbose" && echo " $1" 1>&AC_FD_MSG
|
---|
1102 | ])dnl
|
---|
1103 | dnl ---------------------------------------------------------------------------
|
---|
1104 | dnl CF_WITH_CURSES_DIR version: 2 updated: 2002/11/10 14:46:59
|
---|
1105 | dnl ------------------
|
---|
1106 | dnl Wrapper for AC_ARG_WITH to specify directory under which to look for curses
|
---|
1107 | dnl libraries.
|
---|
1108 | AC_DEFUN([CF_WITH_CURSES_DIR],[
|
---|
1109 | AC_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
|
---|
1115 | dnl ---------------------------------------------------------------------------
|
---|
1116 | dnl CF_XOPEN_SOURCE version: 17 updated: 2005/02/06 12:07:45
|
---|
1117 | dnl ---------------
|
---|
1118 | dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
|
---|
1119 | dnl or adapt to the vendor's definitions to get equivalent functionality.
|
---|
1120 | dnl
|
---|
1121 | dnl Parameters:
|
---|
1122 | dnl $1 is the nominal value for _XOPEN_SOURCE
|
---|
1123 | dnl $2 is the nominal value for _POSIX_C_SOURCE
|
---|
1124 | AC_DEFUN([CF_XOPEN_SOURCE],[
|
---|
1125 |
|
---|
1126 | cf_XOPEN_SOURCE=ifelse($1,,500,$1)
|
---|
1127 | cf_POSIX_C_SOURCE=ifelse($2,,199506L,$2)
|
---|
1128 |
|
---|
1129 | case $host_os in #(vi
|
---|
1130 | aix[[45]]*) #(vi
|
---|
1131 | CPPFLAGS="$CPPFLAGS -D_ALL_SOURCE"
|
---|
1132 | ;;
|
---|
1133 | freebsd*) #(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 | ;;
|
---|
1141 | hpux*) #(vi
|
---|
1142 | CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE"
|
---|
1143 | ;;
|
---|
1144 | irix[[56]].*) #(vi
|
---|
1145 | CPPFLAGS="$CPPFLAGS -D_SGI_SOURCE"
|
---|
1146 | ;;
|
---|
1147 | linux*|gnu*) #(vi
|
---|
1148 | CF_GNU_SOURCE
|
---|
1149 | ;;
|
---|
1150 | mirbsd*) #(vi
|
---|
1151 | # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h>
|
---|
1152 | ;;
|
---|
1153 | netbsd*) #(vi
|
---|
1154 | # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
|
---|
1155 | ;;
|
---|
1156 | openbsd*) #(vi
|
---|
1157 | # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
|
---|
1158 | ;;
|
---|
1159 | osf[[45]]*) #(vi
|
---|
1160 | CPPFLAGS="$CPPFLAGS -D_OSF_SOURCE"
|
---|
1161 | ;;
|
---|
1162 | sco*) #(vi
|
---|
1163 | # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
|
---|
1164 | ;;
|
---|
1165 | solaris*) #(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
|
---|
1172 | make 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
|
---|
1179 | make an error
|
---|
1180 | #endif],
|
---|
1181 | [cf_cv_xopen_source=no],
|
---|
1182 | [cf_cv_xopen_source=$cf_XOPEN_SOURCE])
|
---|
1183 | CPPFLAGS="$cf_save"
|
---|
1184 | ])
|
---|
1185 | ])
|
---|
1186 | test "$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 | ;;
|
---|
1189 | esac
|
---|
1190 | ])
|
---|