aclocal.m4 revision 2eaa94a1
12eaa94a1Schristosdnl $XTermId: aclocal.m4,v 1.254 2008/12/30 17:01:41 tom Exp $
2d522f475Smrgdnl
3d522f475Smrgdnl $XFree86: xc/programs/xterm/aclocal.m4,v 3.65 2006/06/19 00:36:50 dickey Exp $
4d522f475Smrgdnl
5d522f475Smrgdnl ---------------------------------------------------------------------------
6d522f475Smrgdnl
7d522f475Smrgdnl Copyright 1997-2007,2008 by Thomas E. Dickey
8d522f475Smrgdnl
9d522f475Smrgdnl                         All Rights Reserved
10d522f475Smrgdnl
11d522f475Smrgdnl Permission to use, copy, modify, and distribute this software and its
12d522f475Smrgdnl documentation for any purpose and without fee is hereby granted,
13d522f475Smrgdnl provided that the above copyright notice appear in all copies and that
14d522f475Smrgdnl both that copyright notice and this permission notice appear in
15d522f475Smrgdnl supporting documentation, and that the name of the above listed
16d522f475Smrgdnl copyright holder(s) not be used in advertising or publicity pertaining
17d522f475Smrgdnl to distribution of the software without specific, written prior
18d522f475Smrgdnl permission.
19d522f475Smrgdnl
20d522f475Smrgdnl THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
21d522f475Smrgdnl TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
22d522f475Smrgdnl AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
23d522f475Smrgdnl LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
24d522f475Smrgdnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
25d522f475Smrgdnl ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
26d522f475Smrgdnl OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
27d522f475Smrgdnl
28d522f475Smrgdnl ---------------------------------------------------------------------------
29d522f475Smrgdnl ---------------------------------------------------------------------------
30d522f475Smrgdnl AM_LANGINFO_CODESET version: 3 updated: 2002/10/27 23:21:42
31d522f475Smrgdnl -------------------
32d522f475Smrgdnl Inserted as requested by gettext 0.10.40
33d522f475Smrgdnl File from /usr/share/aclocal
34d522f475Smrgdnl codeset.m4
35d522f475Smrgdnl ====================
36d522f475Smrgdnl serial AM1
37d522f475Smrgdnl
38d522f475Smrgdnl From Bruno Haible.
39d522f475SmrgAC_DEFUN([AM_LANGINFO_CODESET],
40d522f475Smrg[
41d522f475Smrg  AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
42d522f475Smrg    [AC_TRY_LINK([#include <langinfo.h>],
43d522f475Smrg      [char* cs = nl_langinfo(CODESET);],
44d522f475Smrg      am_cv_langinfo_codeset=yes,
45d522f475Smrg      am_cv_langinfo_codeset=no)
46d522f475Smrg    ])
47d522f475Smrg  if test $am_cv_langinfo_codeset = yes; then
48d522f475Smrg    AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
49d522f475Smrg      [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
50d522f475Smrg  fi
51d522f475Smrg])dnl
52d522f475Smrgdnl ---------------------------------------------------------------------------
53d522f475Smrgdnl CF_ADD_CFLAGS version: 7 updated: 2004/04/25 17:48:30
54d522f475Smrgdnl -------------
55d522f475Smrgdnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS
56d522f475Smrgdnl The second parameter if given makes this macro verbose.
57d522f475Smrgdnl
58d522f475Smrgdnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS,
59d522f475Smrgdnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily
60d522f475Smrgdnl confused by the quotes (which require backslashes to keep them usable).
61d522f475SmrgAC_DEFUN([CF_ADD_CFLAGS],
62d522f475Smrg[
63d522f475Smrgcf_fix_cppflags=no
64d522f475Smrgcf_new_cflags=
65d522f475Smrgcf_new_cppflags=
66d522f475Smrgcf_new_extra_cppflags=
67d522f475Smrg
68d522f475Smrgfor cf_add_cflags in $1
69d522f475Smrgdo
70d522f475Smrgcase $cf_fix_cppflags in
71d522f475Smrgno)
72d522f475Smrg	case $cf_add_cflags in #(vi
73d522f475Smrg	-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
74d522f475Smrg		case $cf_add_cflags in
75d522f475Smrg		-D*)
76d522f475Smrg			cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'`
77d522f475Smrg
78d522f475Smrg			test "${cf_add_cflags}" != "${cf_tst_cflags}" \
79d522f475Smrg			&& test -z "${cf_tst_cflags}" \
80d522f475Smrg			&& cf_fix_cppflags=yes
81d522f475Smrg
82d522f475Smrg			if test $cf_fix_cppflags = yes ; then
83d522f475Smrg				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
84d522f475Smrg				continue
85d522f475Smrg			elif test "${cf_tst_cflags}" = "\"'" ; then
86d522f475Smrg				cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
87d522f475Smrg				continue
88d522f475Smrg			fi
89d522f475Smrg			;;
90d522f475Smrg		esac
91d522f475Smrg		case "$CPPFLAGS" in
92d522f475Smrg		*$cf_add_cflags) #(vi
93d522f475Smrg			;;
94d522f475Smrg		*) #(vi
95d522f475Smrg			cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
96d522f475Smrg			;;
97d522f475Smrg		esac
98d522f475Smrg		;;
99d522f475Smrg	*)
100d522f475Smrg		cf_new_cflags="$cf_new_cflags $cf_add_cflags"
101d522f475Smrg		;;
102d522f475Smrg	esac
103d522f475Smrg	;;
104d522f475Smrgyes)
105d522f475Smrg	cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
106d522f475Smrg
107d522f475Smrg	cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'`
108d522f475Smrg
109d522f475Smrg	test "${cf_add_cflags}" != "${cf_tst_cflags}" \
110d522f475Smrg	&& test -z "${cf_tst_cflags}" \
111d522f475Smrg	&& cf_fix_cppflags=no
112d522f475Smrg	;;
113d522f475Smrgesac
114d522f475Smrgdone
115d522f475Smrg
116d522f475Smrgif test -n "$cf_new_cflags" ; then
117d522f475Smrg	ifelse($2,,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)])
118d522f475Smrg	CFLAGS="$CFLAGS $cf_new_cflags"
119d522f475Smrgfi
120d522f475Smrg
121d522f475Smrgif test -n "$cf_new_cppflags" ; then
122d522f475Smrg	ifelse($2,,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)])
123d522f475Smrg	CPPFLAGS="$cf_new_cppflags $CPPFLAGS"
124d522f475Smrgfi
125d522f475Smrg
126d522f475Smrgif test -n "$cf_new_extra_cppflags" ; then
127d522f475Smrg	ifelse($2,,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)])
128d522f475Smrg	EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
129d522f475Smrgfi
130d522f475Smrg
131d522f475SmrgAC_SUBST(EXTRA_CPPFLAGS)
132d522f475Smrg
133d522f475Smrg])dnl
134d522f475Smrgdnl ---------------------------------------------------------------------------
135d522f475Smrgdnl CF_ANSI_CC_CHECK version: 9 updated: 2001/12/30 17:53:34
136d522f475Smrgdnl ----------------
137d522f475Smrgdnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES'
138d522f475Smrgdnl in the sharutils 4.2 distribution.
139d522f475SmrgAC_DEFUN([CF_ANSI_CC_CHECK],
140d522f475Smrg[
141d522f475SmrgAC_CACHE_CHECK(for ${CC-cc} option to accept ANSI C, cf_cv_ansi_cc,[
142d522f475Smrgcf_cv_ansi_cc=no
143d522f475Smrgcf_save_CFLAGS="$CFLAGS"
144d522f475Smrgcf_save_CPPFLAGS="$CPPFLAGS"
145d522f475Smrg# Don't try gcc -ansi; that turns off useful extensions and
146d522f475Smrg# breaks some systems' header files.
147d522f475Smrg# AIX			-qlanglvl=ansi
148d522f475Smrg# Ultrix and OSF/1	-std1
149d522f475Smrg# HP-UX			-Aa -D_HPUX_SOURCE
150d522f475Smrg# SVR4			-Xc
151d522f475Smrg# UnixWare 1.2		(cannot use -Xc, since ANSI/POSIX clashes)
152d522f475Smrgfor cf_arg in "-DCC_HAS_PROTOS" \
153d522f475Smrg	"" \
154d522f475Smrg	-qlanglvl=ansi \
155d522f475Smrg	-std1 \
156d522f475Smrg	-Ae \
157d522f475Smrg	"-Aa -D_HPUX_SOURCE" \
158d522f475Smrg	-Xc
159d522f475Smrgdo
160d522f475Smrg	CF_ADD_CFLAGS($cf_arg)
161d522f475Smrg	AC_TRY_COMPILE(
162d522f475Smrg[
163d522f475Smrg#ifndef CC_HAS_PROTOS
164d522f475Smrg#if !defined(__STDC__) || (__STDC__ != 1)
165d522f475Smrgchoke me
166d522f475Smrg#endif
167d522f475Smrg#endif
168d522f475Smrg],[
169d522f475Smrg	int test (int i, double x);
170d522f475Smrg	struct s1 {int (*f) (int a);};
171d522f475Smrg	struct s2 {int (*f) (double a);};],
172d522f475Smrg	[cf_cv_ansi_cc="$cf_arg"; break])
173d522f475Smrgdone
174d522f475SmrgCFLAGS="$cf_save_CFLAGS"
175d522f475SmrgCPPFLAGS="$cf_save_CPPFLAGS"
176d522f475Smrg])
177d522f475Smrg
178d522f475Smrgif test "$cf_cv_ansi_cc" != "no"; then
179d522f475Smrgif test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then
180d522f475Smrg	CF_ADD_CFLAGS($cf_cv_ansi_cc)
181d522f475Smrgelse
182d522f475Smrg	AC_DEFINE(CC_HAS_PROTOS)
183d522f475Smrgfi
184d522f475Smrgfi
185d522f475Smrg])dnl
186d522f475Smrgdnl ---------------------------------------------------------------------------
187d522f475Smrgdnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31
188d522f475Smrgdnl --------------
189d522f475Smrgdnl Allow user to disable a normally-on option.
190d522f475SmrgAC_DEFUN([CF_ARG_DISABLE],
191d522f475Smrg[CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl
192d522f475Smrgdnl ---------------------------------------------------------------------------
193d522f475Smrgdnl CF_ARG_ENABLE version: 3 updated: 1999/03/30 17:24:31
194d522f475Smrgdnl -------------
195d522f475Smrgdnl Allow user to enable a normally-off option.
196d522f475SmrgAC_DEFUN([CF_ARG_ENABLE],
197d522f475Smrg[CF_ARG_OPTION($1,[$2],[$3],[$4],no)])dnl
198d522f475Smrgdnl ---------------------------------------------------------------------------
199d522f475Smrgdnl CF_ARG_OPTION version: 3 updated: 1997/10/18 14:42:41
200d522f475Smrgdnl -------------
201d522f475Smrgdnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus
202d522f475Smrgdnl values.
203d522f475Smrgdnl
204d522f475Smrgdnl Parameters:
205d522f475Smrgdnl $1 = option name
206d522f475Smrgdnl $2 = help-string
207d522f475Smrgdnl $3 = action to perform if option is not default
208d522f475Smrgdnl $4 = action if perform if option is default
209d522f475Smrgdnl $5 = default option value (either 'yes' or 'no')
210d522f475SmrgAC_DEFUN([CF_ARG_OPTION],
211d522f475Smrg[AC_ARG_ENABLE($1,[$2],[test "$enableval" != ifelse($5,no,yes,no) && enableval=ifelse($5,no,no,yes)
212d522f475Smrg  if test "$enableval" != "$5" ; then
213d522f475Smrgifelse($3,,[    :]dnl
214d522f475Smrg,[    $3]) ifelse($4,,,[
215d522f475Smrg  else
216d522f475Smrg    $4])
217d522f475Smrg  fi],[enableval=$5 ifelse($4,,,[
218d522f475Smrg  $4
219d522f475Smrg])dnl
220d522f475Smrg  ])])dnl
221d522f475Smrgdnl ---------------------------------------------------------------------------
222d522f475Smrgdnl CF_CHECK_CACHE version: 11 updated: 2008/03/23 14:45:59
223d522f475Smrgdnl --------------
224d522f475Smrgdnl Check if we're accidentally using a cache from a different machine.
225d522f475Smrgdnl Derive the system name, as a check for reusing the autoconf cache.
226d522f475Smrgdnl
227d522f475Smrgdnl If we've packaged config.guess and config.sub, run that (since it does a
228d522f475Smrgdnl better job than uname).  Normally we'll use AC_CANONICAL_HOST, but allow
229d522f475Smrgdnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM
230d522f475Smrgdnl which is useful in cross-compiles.
231d522f475Smrgdnl
232d522f475Smrgdnl Note: we would use $ac_config_sub, but that is one of the places where
233d522f475Smrgdnl autoconf 2.5x broke compatibility with autoconf 2.13
234d522f475SmrgAC_DEFUN([CF_CHECK_CACHE],
235d522f475Smrg[
236d522f475Smrgif test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then
237d522f475Smrg	ifelse([$1],,[AC_CANONICAL_HOST],[$1])
238d522f475Smrg	system_name="$host_os"
239d522f475Smrgelse
240d522f475Smrg	system_name="`(uname -s -r) 2>/dev/null`"
241d522f475Smrg	if test -z "$system_name" ; then
242d522f475Smrg		system_name="`(hostname) 2>/dev/null`"
243d522f475Smrg	fi
244d522f475Smrgfi
245d522f475Smrgtest -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name")
246d522f475SmrgAC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
247d522f475Smrg
248d522f475Smrgtest -z "$system_name" && system_name="$cf_cv_system_name"
249d522f475Smrgtest -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name)
250d522f475Smrg
251d522f475Smrgif test ".$system_name" != ".$cf_cv_system_name" ; then
252d522f475Smrg	AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name))
253d522f475Smrg	AC_MSG_ERROR("Please remove config.cache and try again.")
254d522f475Smrgfi
255d522f475Smrg])dnl
256d522f475Smrgdnl ---------------------------------------------------------------------------
257d522f475Smrgdnl CF_CHECK_CFLAGS version: 2 updated: 2001/12/30 19:09:58
258d522f475Smrgdnl ---------------
259d522f475Smrgdnl Conditionally add to $CFLAGS and $CPPFLAGS values which are derived from
260d522f475Smrgdnl a build-configuration such as imake.  These have the pitfall that they
261d522f475Smrgdnl often contain compiler-specific options which we cannot use, mixed with
262d522f475Smrgdnl preprocessor options that we usually can.
263d522f475SmrgAC_DEFUN([CF_CHECK_CFLAGS],
264d522f475Smrg[
265d522f475SmrgCF_VERBOSE(checking additions to CFLAGS)
266d522f475Smrgcf_check_cflags="$CFLAGS"
267d522f475Smrgcf_check_cppflags="$CPPFLAGS"
268d522f475SmrgCF_ADD_CFLAGS($1,yes)
269d522f475Smrgif test "$cf_check_cflags" != "$CFLAGS" ; then
270d522f475SmrgAC_TRY_LINK([#include <stdio.h>],[printf("Hello world");],,
271d522f475Smrg	[CF_VERBOSE(test-compile failed.  Undoing change to \$CFLAGS)
272d522f475Smrg	 if test "$cf_check_cppflags" != "$CPPFLAGS" ; then
273d522f475Smrg		 CF_VERBOSE(but keeping change to \$CPPFLAGS)
274d522f475Smrg	 fi
275d522f475Smrg	 CFLAGS="$cf_check_flags"])
276d522f475Smrgfi
277d522f475Smrg])dnl
278d522f475Smrgdnl ---------------------------------------------------------------------------
2792eaa94a1Schristosdnl CF_CHECK_ERRNO version: 10 updated: 2008/08/22 16:33:22
280d522f475Smrgdnl --------------
281d522f475Smrgdnl Check for data that is usually declared in <stdio.h> or <errno.h>, e.g.,
282d522f475Smrgdnl the 'errno' variable.  Define a DECL_xxx symbol if we must declare it
283d522f475Smrgdnl ourselves.
284d522f475Smrgdnl
285d522f475Smrgdnl $1 = the name to check
2862eaa94a1Schristosdnl $2 = the assumed type
287d522f475SmrgAC_DEFUN([CF_CHECK_ERRNO],
288d522f475Smrg[
289d522f475SmrgAC_CACHE_CHECK(if external $1 is declared, cf_cv_dcl_$1,[
290d522f475Smrg    AC_TRY_COMPILE([
291d522f475Smrg#ifdef HAVE_STDLIB_H
292d522f475Smrg#include <stdlib.h>
293d522f475Smrg#endif
294d522f475Smrg#include <stdio.h>
295d522f475Smrg#include <sys/types.h>
296d522f475Smrg#include <errno.h> ],
2972eaa94a1Schristos    ifelse($2,,int,$2) x = (ifelse($2,,int,$2)) $1,
298d522f475Smrg    [cf_cv_dcl_$1=yes],
299d522f475Smrg    [cf_cv_dcl_$1=no])
300d522f475Smrg])
301d522f475Smrg
302d522f475Smrgif test "$cf_cv_dcl_$1" = no ; then
303d522f475Smrg    CF_UPPER(cf_result,decl_$1)
304d522f475Smrg    AC_DEFINE_UNQUOTED($cf_result)
305d522f475Smrgfi
306d522f475Smrg
307d522f475Smrg# It's possible (for near-UNIX clones) that the data doesn't exist
3082eaa94a1SchristosCF_CHECK_EXTERN_DATA($1,ifelse($2,,int,$2))
309d522f475Smrg])dnl
310d522f475Smrgdnl ---------------------------------------------------------------------------
311d522f475Smrgdnl CF_CHECK_EXTERN_DATA version: 3 updated: 2001/12/30 18:03:23
312d522f475Smrgdnl --------------------
313d522f475Smrgdnl Check for existence of external data in the current set of libraries.  If
314d522f475Smrgdnl we can modify it, it's real enough.
315d522f475Smrgdnl $1 = the name to check
316d522f475Smrgdnl $2 = its type
317d522f475SmrgAC_DEFUN([CF_CHECK_EXTERN_DATA],
318d522f475Smrg[
319d522f475SmrgAC_CACHE_CHECK(if external $1 exists, cf_cv_have_$1,[
320d522f475Smrg    AC_TRY_LINK([
321d522f475Smrg#undef $1
322d522f475Smrgextern $2 $1;
323d522f475Smrg],
324d522f475Smrg    [$1 = 2],
325d522f475Smrg    [cf_cv_have_$1=yes],
326d522f475Smrg    [cf_cv_have_$1=no])
327d522f475Smrg])
328d522f475Smrg
329d522f475Smrgif test "$cf_cv_have_$1" = yes ; then
330d522f475Smrg    CF_UPPER(cf_result,have_$1)
331d522f475Smrg    AC_DEFINE_UNQUOTED($cf_result)
332d522f475Smrgfi
333d522f475Smrg
334d522f475Smrg])dnl
335d522f475Smrgdnl ---------------------------------------------------------------------------
336d522f475Smrgdnl CF_DISABLE_ECHO version: 10 updated: 2003/04/17 22:27:11
337d522f475Smrgdnl ---------------
338d522f475Smrgdnl You can always use "make -n" to see the actual options, but it's hard to
339d522f475Smrgdnl pick out/analyze warning messages when the compile-line is long.
340d522f475Smrgdnl
341d522f475Smrgdnl Sets:
342d522f475Smrgdnl	ECHO_LT - symbol to control if libtool is verbose
343d522f475Smrgdnl	ECHO_LD - symbol to prefix "cc -o" lines
344d522f475Smrgdnl	RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o)
345d522f475Smrgdnl	SHOW_CC - symbol to put before explicit "cc -c" lines
346d522f475Smrgdnl	ECHO_CC - symbol to put before any "cc" line
347d522f475Smrgdnl
348d522f475SmrgAC_DEFUN([CF_DISABLE_ECHO],[
349d522f475SmrgAC_MSG_CHECKING(if you want to see long compiling messages)
350d522f475SmrgCF_ARG_DISABLE(echo,
351d522f475Smrg	[  --disable-echo          display "compiling" commands],
352d522f475Smrg	[
353d522f475Smrg    ECHO_LT='--silent'
354d522f475Smrg    ECHO_LD='@echo linking [$]@;'
355d522f475Smrg    RULE_CC='	@echo compiling [$]<'
356d522f475Smrg    SHOW_CC='	@echo compiling [$]@'
357d522f475Smrg    ECHO_CC='@'
358d522f475Smrg],[
359d522f475Smrg    ECHO_LT=''
360d522f475Smrg    ECHO_LD=''
361d522f475Smrg    RULE_CC='# compiling'
362d522f475Smrg    SHOW_CC='# compiling'
363d522f475Smrg    ECHO_CC=''
364d522f475Smrg])
365d522f475SmrgAC_MSG_RESULT($enableval)
366d522f475SmrgAC_SUBST(ECHO_LT)
367d522f475SmrgAC_SUBST(ECHO_LD)
368d522f475SmrgAC_SUBST(RULE_CC)
369d522f475SmrgAC_SUBST(SHOW_CC)
370d522f475SmrgAC_SUBST(ECHO_CC)
371d522f475Smrg])dnl
372d522f475Smrgdnl ---------------------------------------------------------------------------
373d522f475Smrgdnl CF_ENABLE_NARROWPROTO version: 3 updated: 2006/02/12 17:46:00
374d522f475Smrgdnl ---------------------
375d522f475Smrgdnl If this is not set properly, Xaw's scrollbars will not work.
376d522f475Smrgdnl The so-called "modular" configuration for X.org omits most of the
377d522f475Smrgdnl configure checks that would be needed to provide compatibility with
378d522f475Smrgdnl older X builds.  This one breaks things noticeably.
379d522f475SmrgAC_DEFUN([CF_ENABLE_NARROWPROTO],
380d522f475Smrg[
381d522f475SmrgAC_MSG_CHECKING(if you want narrow prototypes for X libraries)
382d522f475Smrg
383d522f475Smrgcase `$ac_config_guess` in #(vi
384d522f475Smrg*cygwin*|*freebsd*|*gnu*|*irix5*|*irix6*|*linux-gnu*|*netbsd*|*openbsd*|*qnx*|*sco*|*sgi*) #(vi
385d522f475Smrg	cf_default_narrowproto=yes
386d522f475Smrg	;;
387d522f475Smrg*)
388d522f475Smrg	cf_default_narrowproto=no
389d522f475Smrg	;;
390d522f475Smrgesac
391d522f475Smrg
392d522f475SmrgCF_ARG_OPTION(narrowproto,
393d522f475Smrg	[  --enable-narrowproto    enable narrow prototypes for X libraries],
394d522f475Smrg	[enable_narrowproto=$enableval],
395d522f475Smrg	[enable_narrowproto=$cf_default_narrowproto],
396d522f475Smrg	[$cf_default_narrowproto])
397d522f475SmrgAC_MSG_RESULT($enable_narrowproto)
398d522f475Smrg])
399d522f475Smrgdnl ---------------------------------------------------------------------------
400d522f475Smrgdnl CF_ERRNO version: 5 updated: 1997/11/30 12:44:39
401d522f475Smrgdnl --------
402d522f475Smrgdnl Check if 'errno' is declared in <errno.h>
403d522f475SmrgAC_DEFUN([CF_ERRNO],
404d522f475Smrg[
405d522f475SmrgCF_CHECK_ERRNO(errno)
406d522f475Smrg])dnl
407d522f475Smrgdnl ---------------------------------------------------------------------------
408d522f475Smrgdnl CF_FUNC_MEMMOVE version: 7 updated: 2006/12/16 12:33:30
409d522f475Smrgdnl ---------------
410d522f475Smrgdnl Check for memmove, or a bcopy that can handle overlapping copy.  If neither
411d522f475Smrgdnl is found, add our own version of memmove to the list of objects.
412d522f475SmrgAC_DEFUN([CF_FUNC_MEMMOVE],
413d522f475Smrg[
414d522f475SmrgAC_CHECK_FUNC(memmove,,[
415d522f475SmrgAC_CHECK_FUNC(bcopy,[
416d522f475Smrg	AC_CACHE_CHECK(if bcopy does overlapping moves,cf_cv_good_bcopy,[
417d522f475Smrg		AC_TRY_RUN([
418d522f475Smrgint main() {
419d522f475Smrg	static char data[] = "abcdefghijklmnopqrstuwwxyz";
420d522f475Smrg	char temp[40];
421d522f475Smrg	bcopy(data, temp, sizeof(data));
422d522f475Smrg	bcopy(temp+10, temp, 15);
423d522f475Smrg	bcopy(temp+5, temp+15, 10);
424d522f475Smrg	${cf_cv_main_return:-return} (strcmp(temp, "klmnopqrstuwwxypqrstuwwxyz"));
425d522f475Smrg}
426d522f475Smrg		],
427d522f475Smrg		[cf_cv_good_bcopy=yes],
428d522f475Smrg		[cf_cv_good_bcopy=no],
429d522f475Smrg		[cf_cv_good_bcopy=unknown])
430d522f475Smrg		])
431d522f475Smrg	],[cf_cv_good_bcopy=no])
432d522f475Smrg	if test "$cf_cv_good_bcopy" = yes ; then
433d522f475Smrg		AC_DEFINE(USE_OK_BCOPY)
434d522f475Smrg	else
435d522f475Smrg		AC_DEFINE(USE_MY_MEMMOVE)
436d522f475Smrg	fi
437d522f475Smrg])])dnl
438d522f475Smrgdnl ---------------------------------------------------------------------------
439d522f475Smrgdnl CF_FUNC_TGETENT version: 11 updated: 2007/03/14 16:43:48
440d522f475Smrgdnl ---------------
441d522f475Smrgdnl Check for tgetent function in termcap library.  If we cannot find this,
442d522f475Smrgdnl we'll use the $LINES and $COLUMNS environment variables to pass screen
443d522f475Smrgdnl size information to subprocesses.  (We cannot use terminfo's compatibility
444d522f475Smrgdnl function, since it cannot provide the termcap-format data).
445d522f475Smrgdnl
446d522f475Smrgdnl If the --disable-full-tgetent option is given, we'll settle for the first
447d522f475Smrgdnl tgetent function we find.  Since the search list in that case does not
448d522f475Smrgdnl include the termcap library, that allows us to default to terminfo.
449d522f475SmrgAC_DEFUN([CF_FUNC_TGETENT],
450d522f475Smrg[
451d522f475Smrg# compute a reasonable value for $TERM to give tgetent(), since we may be
452d522f475Smrg# running in 'screen', which sets $TERMCAP to a specific entry that is not
453d522f475Smrg# necessarily in /etc/termcap - unsetenv is not portable, so we cannot simply
454d522f475Smrg# discard $TERMCAP.
455d522f475Smrgcf_TERMVAR=vt100
456d522f475Smrgtest -n "$TERMCAP" && cf_TERMVAR="$TERM"
457d522f475Smrgtest -z "$cf_TERMVAR" && cf_TERMVAR=vt100
458d522f475Smrg
459d522f475SmrgAC_MSG_CHECKING(if we want full tgetent function)
460d522f475SmrgCF_ARG_DISABLE(full-tgetent,
461d522f475Smrg	[  --disable-full-tgetent  disable check for full tgetent function],
462d522f475Smrg	cf_full_tgetent=no,
463d522f475Smrg	cf_full_tgetent=yes,yes)
464d522f475SmrgAC_MSG_RESULT($cf_full_tgetent)
465d522f475Smrg
466d522f475Smrgif test "$cf_full_tgetent" = yes ; then
467d522f475Smrg	cf_test_message="full tgetent"
468d522f475Smrgelse
469d522f475Smrg	cf_test_message="tgetent"
470d522f475Smrgfi
471d522f475Smrg
472d522f475SmrgAC_CACHE_CHECK(for $cf_test_message function,cf_cv_lib_tgetent,[
473d522f475Smrgcf_save_LIBS="$LIBS"
474d522f475Smrgcf_cv_lib_tgetent=no
475d522f475Smrgif test "$cf_full_tgetent" = yes ; then
476d522f475Smrg	cf_TERMLIB="termcap termlib ncurses curses"
477d522f475Smrg	cf_TERMTST="buffer[[0]] == 0"
478d522f475Smrgelse
479d522f475Smrg	cf_TERMLIB="termlib ncurses curses"
480d522f475Smrg	cf_TERMTST="0"
481d522f475Smrgfi
482d522f475Smrgfor cf_termlib in '' $cf_TERMLIB ; do
483d522f475Smrg	LIBS="$cf_save_LIBS"
484d522f475Smrg	test -n "$cf_termlib" && LIBS="$LIBS -l$cf_termlib"
485d522f475Smrg	AC_TRY_RUN([
486d522f475Smrg/* terminfo implementations ignore the buffer argument, making it useless for
487d522f475Smrg * the xterm application, which uses this information to make a new TERMCAP
488d522f475Smrg * environment variable.
489d522f475Smrg */
490d522f475Smrgint main()
491d522f475Smrg{
492d522f475Smrg	char buffer[1024];
493d522f475Smrg	buffer[0] = 0;
494d522f475Smrg	tgetent(buffer, "$cf_TERMVAR");
495d522f475Smrg	${cf_cv_main_return:-return} ($cf_TERMTST); }],
496d522f475Smrg	[echo "yes, there is a termcap/tgetent in $cf_termlib" 1>&AC_FD_CC
497d522f475Smrg	 if test -n "$cf_termlib" ; then
498d522f475Smrg	 	cf_cv_lib_tgetent="-l$cf_termlib"
499d522f475Smrg	 else
500d522f475Smrg	 	cf_cv_lib_tgetent=yes
501d522f475Smrg	 fi
502d522f475Smrg	 break],
503d522f475Smrg	[echo "no, there is no termcap/tgetent in $cf_termlib" 1>&AC_FD_CC],
504d522f475Smrg	[echo "cross-compiling, cannot verify if a termcap/tgetent is present in $cf_termlib" 1>&AC_FD_CC])
505d522f475Smrgdone
506d522f475SmrgLIBS="$cf_save_LIBS"
507d522f475Smrg])
508d522f475Smrg
509d522f475Smrg# If we found a working tgetent(), set LIBS and check for termcap.h.
510d522f475Smrg# (LIBS cannot be set inside AC_CACHE_CHECK; the commands there should
511d522f475Smrg# not have side effects other than setting the cache variable, because
512d522f475Smrg# they are not executed when a cached value exists.)
513d522f475Smrgif test "$cf_cv_lib_tgetent" != no ; then
514d522f475Smrg	test "$cf_cv_lib_tgetent" != yes && LIBS="$LIBS $cf_cv_lib_tgetent"
515d522f475Smrg	AC_DEFINE(USE_TERMCAP)
516d522f475Smrg	AC_TRY_COMPILE([
517d522f475Smrg#include <termcap.h>],[
518d522f475Smrg#ifdef NCURSES_VERSION
519d522f475Smrgmake an error
520d522f475Smrg#endif],[AC_DEFINE(HAVE_TERMCAP_H)])
521d522f475Smrgelse
522d522f475Smrg        # If we didn't find a tgetent() that supports the buffer
523d522f475Smrg        # argument, look again to see whether we can find even
524d522f475Smrg        # a crippled one.  A crippled tgetent() is still useful to
525d522f475Smrg        # validate values for the TERM environment variable given to
526d522f475Smrg        # child processes.
527d522f475Smrg	AC_CACHE_CHECK(for partial tgetent function,cf_cv_lib_part_tgetent,[
528d522f475Smrg	cf_cv_lib_part_tgetent=no
529d522f475Smrg	for cf_termlib in $cf_TERMLIB ; do
530d522f475Smrg		LIBS="$cf_save_LIBS -l$cf_termlib"
531d522f475Smrg		AC_TRY_LINK([],[tgetent(0, "$cf_TERMVAR")],
532d522f475Smrg			[echo "there is a terminfo/tgetent in $cf_termlib" 1>&AC_FD_CC
533d522f475Smrg			 cf_cv_lib_part_tgetent="-l$cf_termlib"
534d522f475Smrg			 break])
535d522f475Smrg	done
536d522f475Smrg	LIBS="$cf_save_LIBS"
537d522f475Smrg	])
538d522f475Smrg
539d522f475Smrg	if test "$cf_cv_lib_part_tgetent" != no ; then
540d522f475Smrg		LIBS="$LIBS $cf_cv_lib_part_tgetent"
541d522f475Smrg		AC_CHECK_HEADERS(termcap.h)
542d522f475Smrg
543d522f475Smrg                # If this is linking against ncurses, we'll trigger the
544d522f475Smrg                # ifdef in resize.c that turns the termcap stuff back off.
545d522f475Smrg		AC_DEFINE(USE_TERMINFO)
546d522f475Smrg	fi
547d522f475Smrgfi
548d522f475Smrg])dnl
549d522f475Smrgdnl ---------------------------------------------------------------------------
550d522f475Smrgdnl CF_GCC_ATTRIBUTES version: 11 updated: 2007/07/29 09:55:12
551d522f475Smrgdnl -----------------
552d522f475Smrgdnl Test for availability of useful gcc __attribute__ directives to quiet
553d522f475Smrgdnl compiler warnings.  Though useful, not all are supported -- and contrary
554d522f475Smrgdnl to documentation, unrecognized directives cause older compilers to barf.
555d522f475SmrgAC_DEFUN([CF_GCC_ATTRIBUTES],
556d522f475Smrg[
557d522f475Smrgif test "$GCC" = yes
558d522f475Smrgthen
559d522f475Smrgcat > conftest.i <<EOF
560d522f475Smrg#ifndef GCC_PRINTF
561d522f475Smrg#define GCC_PRINTF 0
562d522f475Smrg#endif
563d522f475Smrg#ifndef GCC_SCANF
564d522f475Smrg#define GCC_SCANF 0
565d522f475Smrg#endif
566d522f475Smrg#ifndef GCC_NORETURN
567d522f475Smrg#define GCC_NORETURN /* nothing */
568d522f475Smrg#endif
569d522f475Smrg#ifndef GCC_UNUSED
570d522f475Smrg#define GCC_UNUSED /* nothing */
571d522f475Smrg#endif
572d522f475SmrgEOF
573d522f475Smrgif test "$GCC" = yes
574d522f475Smrgthen
575d522f475Smrg	AC_CHECKING([for $CC __attribute__ directives])
576d522f475Smrgcat > conftest.$ac_ext <<EOF
577d522f475Smrg#line __oline__ "${as_me-configure}"
578d522f475Smrg#include "confdefs.h"
579d522f475Smrg#include "conftest.h"
580d522f475Smrg#include "conftest.i"
581d522f475Smrg#if	GCC_PRINTF
582d522f475Smrg#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
583d522f475Smrg#else
584d522f475Smrg#define GCC_PRINTFLIKE(fmt,var) /*nothing*/
585d522f475Smrg#endif
586d522f475Smrg#if	GCC_SCANF
587d522f475Smrg#define GCC_SCANFLIKE(fmt,var)  __attribute__((format(scanf,fmt,var)))
588d522f475Smrg#else
589d522f475Smrg#define GCC_SCANFLIKE(fmt,var)  /*nothing*/
590d522f475Smrg#endif
591d522f475Smrgextern void wow(char *,...) GCC_SCANFLIKE(1,2);
592d522f475Smrgextern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
593d522f475Smrgextern void foo(void) GCC_NORETURN;
594d522f475Smrgint main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; }
595d522f475SmrgEOF
596d522f475Smrg	for cf_attribute in scanf printf unused noreturn
597d522f475Smrg	do
598d522f475Smrg		CF_UPPER(cf_ATTRIBUTE,$cf_attribute)
599d522f475Smrg		cf_directive="__attribute__(($cf_attribute))"
600d522f475Smrg		echo "checking for $CC $cf_directive" 1>&AC_FD_CC
601d522f475Smrg		case $cf_attribute in
602d522f475Smrg		scanf|printf)
603d522f475Smrg		cat >conftest.h <<EOF
604d522f475Smrg#define GCC_$cf_ATTRIBUTE 1
605d522f475SmrgEOF
606d522f475Smrg			;;
607d522f475Smrg		*)
608d522f475Smrg		cat >conftest.h <<EOF
609d522f475Smrg#define GCC_$cf_ATTRIBUTE $cf_directive
610d522f475SmrgEOF
611d522f475Smrg			;;
612d522f475Smrg		esac
613d522f475Smrg		if AC_TRY_EVAL(ac_compile); then
614d522f475Smrg			test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute)
615d522f475Smrg			cat conftest.h >>confdefs.h
616d522f475Smrg		fi
617d522f475Smrg	done
618d522f475Smrgelse
619d522f475Smrg	fgrep define conftest.i >>confdefs.h
620d522f475Smrgfi
621d522f475Smrgrm -rf conftest*
622d522f475Smrgfi
623d522f475Smrg])dnl
624d522f475Smrgdnl ---------------------------------------------------------------------------
625d522f475Smrgdnl CF_GCC_VERSION version: 4 updated: 2005/08/27 09:53:42
626d522f475Smrgdnl --------------
627d522f475Smrgdnl Find version of gcc
628d522f475SmrgAC_DEFUN([CF_GCC_VERSION],[
629d522f475SmrgAC_REQUIRE([AC_PROG_CC])
630d522f475SmrgGCC_VERSION=none
631d522f475Smrgif test "$GCC" = yes ; then
632d522f475Smrg	AC_MSG_CHECKING(version of $CC)
633d522f475Smrg	GCC_VERSION="`${CC} --version| sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
634d522f475Smrg	test -z "$GCC_VERSION" && GCC_VERSION=unknown
635d522f475Smrg	AC_MSG_RESULT($GCC_VERSION)
636d522f475Smrgfi
637d522f475Smrg])dnl
638d522f475Smrgdnl ---------------------------------------------------------------------------
6392eaa94a1Schristosdnl CF_GCC_WARNINGS version: 23 updated: 2008/07/26 17:54:02
640d522f475Smrgdnl ---------------
641d522f475Smrgdnl Check if the compiler supports useful warning options.  There's a few that
642d522f475Smrgdnl we don't use, simply because they're too noisy:
643d522f475Smrgdnl
644d522f475Smrgdnl	-Wconversion (useful in older versions of gcc, but not in gcc 2.7.x)
645d522f475Smrgdnl	-Wredundant-decls (system headers make this too noisy)
646d522f475Smrgdnl	-Wtraditional (combines too many unrelated messages, only a few useful)
647d522f475Smrgdnl	-Wwrite-strings (too noisy, but should review occasionally).  This
648d522f475Smrgdnl		is enabled for ncurses using "--enable-const".
649d522f475Smrgdnl	-pedantic
650d522f475Smrgdnl
651d522f475Smrgdnl Parameter:
652d522f475Smrgdnl	$1 is an optional list of gcc warning flags that a particular
653d522f475Smrgdnl		application might want to use, e.g., "no-unused" for
654d522f475Smrgdnl		-Wno-unused
655d522f475Smrgdnl Special:
656d522f475Smrgdnl	If $with_ext_const is "yes", add a check for -Wwrite-strings
657d522f475Smrgdnl
658d522f475SmrgAC_DEFUN([CF_GCC_WARNINGS],
659d522f475Smrg[
660d522f475SmrgAC_REQUIRE([CF_GCC_VERSION])
661d522f475SmrgCF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)
662d522f475Smrg
663d522f475Smrgcat > conftest.$ac_ext <<EOF
664d522f475Smrg#line __oline__ "${as_me-configure}"
665d522f475Smrgint main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
666d522f475SmrgEOF
667d522f475Smrg
668d522f475Smrgif test "$INTEL_COMPILER" = yes
669d522f475Smrgthen
670d522f475Smrg# The "-wdXXX" options suppress warnings:
671d522f475Smrg# remark #1419: external declaration in primary source file
672d522f475Smrg# remark #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
673d522f475Smrg# remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
674d522f475Smrg# remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
675d522f475Smrg# remark #193: zero used for undefined preprocessing identifier
676d522f475Smrg# remark #593: variable "curs_sb_left_arrow" was set but never used
677d522f475Smrg# remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
678d522f475Smrg# remark #869: parameter "tw" was never referenced
679d522f475Smrg# remark #981: operands are evaluated in unspecified order
680d522f475Smrg# warning #269: invalid format string conversion
681d522f475Smrg
682d522f475Smrg	AC_CHECKING([for $CC warning options])
683d522f475Smrg	cf_save_CFLAGS="$CFLAGS"
684d522f475Smrg	EXTRA_CFLAGS="-Wall"
685d522f475Smrg	for cf_opt in \
686d522f475Smrg		wd1419 \
687d522f475Smrg		wd1682 \
688d522f475Smrg		wd1683 \
689d522f475Smrg		wd1684 \
690d522f475Smrg		wd193 \
691d522f475Smrg		wd279 \
692d522f475Smrg		wd593 \
693d522f475Smrg		wd810 \
694d522f475Smrg		wd869 \
695d522f475Smrg		wd981
696d522f475Smrg	do
697d522f475Smrg		CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
698d522f475Smrg		if AC_TRY_EVAL(ac_compile); then
699d522f475Smrg			test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
700d522f475Smrg			EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
701d522f475Smrg		fi
702d522f475Smrg	done
703d522f475Smrg	CFLAGS="$cf_save_CFLAGS"
704d522f475Smrg
705d522f475Smrgelif test "$GCC" = yes
706d522f475Smrgthen
707d522f475Smrg	AC_CHECKING([for $CC warning options])
708d522f475Smrg	cf_save_CFLAGS="$CFLAGS"
709d522f475Smrg	EXTRA_CFLAGS="-W -Wall"
710d522f475Smrg	cf_warn_CONST=""
711d522f475Smrg	test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
712d522f475Smrg	for cf_opt in \
713d522f475Smrg		Wbad-function-cast \
714d522f475Smrg		Wcast-align \
715d522f475Smrg		Wcast-qual \
716d522f475Smrg		Winline \
717d522f475Smrg		Wmissing-declarations \
718d522f475Smrg		Wmissing-prototypes \
719d522f475Smrg		Wnested-externs \
720d522f475Smrg		Wpointer-arith \
721d522f475Smrg		Wshadow \
722d522f475Smrg		Wstrict-prototypes \
723d522f475Smrg		Wundef $cf_warn_CONST $1
724d522f475Smrg	do
725d522f475Smrg		CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
726d522f475Smrg		if AC_TRY_EVAL(ac_compile); then
727d522f475Smrg			test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
728d522f475Smrg			case $cf_opt in #(vi
729d522f475Smrg			Wcast-qual) #(vi
730d522f475Smrg				CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES"
731d522f475Smrg				;;
732d522f475Smrg			Winline) #(vi
733d522f475Smrg				case $GCC_VERSION in
7342eaa94a1Schristos				[[34]].*)
735d522f475Smrg					CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
736d522f475Smrg					continue;;
737d522f475Smrg				esac
738d522f475Smrg				;;
739d522f475Smrg			esac
740d522f475Smrg			EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
741d522f475Smrg		fi
742d522f475Smrg	done
743d522f475Smrg	CFLAGS="$cf_save_CFLAGS"
744d522f475Smrgfi
745d522f475Smrgrm -f conftest*
746d522f475Smrg
747d522f475SmrgAC_SUBST(EXTRA_CFLAGS)
748d522f475Smrg])dnl
749d522f475Smrgdnl ---------------------------------------------------------------------------
750d522f475Smrgdnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07
751d522f475Smrgdnl -------------
752d522f475Smrgdnl Check if we must define _GNU_SOURCE to get a reasonable value for
753d522f475Smrgdnl _XOPEN_SOURCE, upon which many POSIX definitions depend.  This is a defect
754d522f475Smrgdnl (or misfeature) of glibc2, which breaks portability of many applications,
755d522f475Smrgdnl since it is interwoven with GNU extensions.
756d522f475Smrgdnl
757d522f475Smrgdnl Well, yes we could work around it...
758d522f475SmrgAC_DEFUN([CF_GNU_SOURCE],
759d522f475Smrg[
760d522f475SmrgAC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[
761d522f475SmrgAC_TRY_COMPILE([#include <sys/types.h>],[
762d522f475Smrg#ifndef _XOPEN_SOURCE
763d522f475Smrgmake an error
764d522f475Smrg#endif],
765d522f475Smrg	[cf_cv_gnu_source=no],
766d522f475Smrg	[cf_save="$CPPFLAGS"
767d522f475Smrg	 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
768d522f475Smrg	 AC_TRY_COMPILE([#include <sys/types.h>],[
769d522f475Smrg#ifdef _XOPEN_SOURCE
770d522f475Smrgmake an error
771d522f475Smrg#endif],
772d522f475Smrg	[cf_cv_gnu_source=no],
773d522f475Smrg	[cf_cv_gnu_source=yes])
774d522f475Smrg	CPPFLAGS="$cf_save"
775d522f475Smrg	])
776d522f475Smrg])
777d522f475Smrgtest "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
778d522f475Smrg])dnl
779d522f475Smrgdnl ---------------------------------------------------------------------------
780d522f475Smrgdnl CF_HELP_MESSAGE version: 3 updated: 1998/01/14 10:56:23
781d522f475Smrgdnl ---------------
782d522f475Smrgdnl Insert text into the help-message, for readability, from AC_ARG_WITH.
783d522f475SmrgAC_DEFUN([CF_HELP_MESSAGE],
784d522f475Smrg[AC_DIVERT_HELP([$1])dnl
785d522f475Smrg])dnl
786d522f475Smrgdnl ---------------------------------------------------------------------------
787d522f475Smrgdnl CF_IMAKE_CFLAGS version: 30 updated: 2008/03/23 15:04:54
788d522f475Smrgdnl ---------------
789d522f475Smrgdnl Use imake to obtain compiler flags.  We could, in principle, write tests to
790d522f475Smrgdnl get these, but if imake is properly configured there is no point in doing
791d522f475Smrgdnl this.
792d522f475Smrgdnl
793d522f475Smrgdnl Parameters (used in constructing a sample Imakefile):
794d522f475Smrgdnl	$1 = optional value to append to $IMAKE_CFLAGS
795d522f475Smrgdnl	$2 = optional value to append to $IMAKE_LOADFLAGS
796d522f475SmrgAC_DEFUN([CF_IMAKE_CFLAGS],
797d522f475Smrg[
798d522f475SmrgAC_PATH_PROGS(IMAKE,xmkmf imake)
799d522f475Smrg
800d522f475Smrgif test -n "$IMAKE" ; then
801d522f475Smrg
802d522f475Smrgcase $IMAKE in # (vi
803d522f475Smrg*/imake)
804d522f475Smrg	cf_imake_opts="-DUseInstalled=YES" # (vi
805d522f475Smrg	;;
806d522f475Smrg*/util/xmkmf)
807d522f475Smrg	# A single parameter tells xmkmf where the config-files are:
808d522f475Smrg	cf_imake_opts="`echo $IMAKE|sed -e s,/config/util/xmkmf,,`" # (vi
809d522f475Smrg	;;
810d522f475Smrg*)
811d522f475Smrg	cf_imake_opts=
812d522f475Smrg	;;
813d522f475Smrgesac
814d522f475Smrg
815d522f475Smrg# If it's installed properly, imake (or its wrapper, xmkmf) will point to the
816d522f475Smrg# config directory.
817d522f475Smrgif mkdir conftestdir; then
818d522f475Smrg	CDPATH=; export CDPATH
819d522f475Smrg	cf_makefile=`cd $srcdir;pwd`/Imakefile
820d522f475Smrg	cd conftestdir
821d522f475Smrg
822d522f475Smrg	cat >fix_cflags.sed <<'CF_EOF'
823d522f475Smrgs/\\//g
824d522f475Smrgs/[[ 	]][[ 	]]*/ /g
825d522f475Smrgs/"//g
826d522f475Smrg:pack
827d522f475Smrgs/\(=[[^ ]][[^ ]]*\) \([[^-]]\)/\1	\2/g
828d522f475Smrgt pack
829d522f475Smrgs/\(-D[[a-zA-Z0-9_]][[a-zA-Z0-9_]]*\)=\([[^\'0-9 ]][[^ ]]*\)/\1='\\"\2\\"'/g
830d522f475Smrgs/^IMAKE[[ ]]/IMAKE_CFLAGS="/
831d522f475Smrgs/	/ /g
832d522f475Smrgs/$/"/
833d522f475SmrgCF_EOF
834d522f475Smrg
835d522f475Smrg	cat >fix_lflags.sed <<'CF_EOF'
836d522f475Smrgs/^IMAKE[[ 	]]*/IMAKE_LOADFLAGS="/
837d522f475Smrgs/$/"/
838d522f475SmrgCF_EOF
839d522f475Smrg
840d522f475Smrg	echo >./Imakefile
841d522f475Smrg	test -f $cf_makefile && cat $cf_makefile >>./Imakefile
842d522f475Smrg
843d522f475Smrg	cat >> ./Imakefile <<'CF_EOF'
844d522f475Smrgfindstddefs:
845d522f475Smrg	@echo IMAKE ${ALLDEFINES}ifelse($1,,,[ $1])       | sed -f fix_cflags.sed
846d522f475Smrg	@echo IMAKE ${EXTRA_LOAD_FLAGS}ifelse($2,,,[ $2]) | sed -f fix_lflags.sed
847d522f475SmrgCF_EOF
848d522f475Smrg
849d522f475Smrg	if ( $IMAKE $cf_imake_opts 1>/dev/null 2>&AC_FD_CC && test -f Makefile)
850d522f475Smrg	then
851d522f475Smrg		CF_VERBOSE(Using $IMAKE $cf_imake_opts)
852d522f475Smrg	else
853d522f475Smrg		# sometimes imake doesn't have the config path compiled in.  Find it.
854d522f475Smrg		cf_config=
855d522f475Smrg		for cf_libpath in $X_LIBS $LIBS ; do
856d522f475Smrg			case $cf_libpath in # (vi
857d522f475Smrg			-L*)
858d522f475Smrg				cf_libpath=`echo .$cf_libpath | sed -e 's/^...//'`
859d522f475Smrg				cf_libpath=$cf_libpath/X11/config
860d522f475Smrg				if test -d $cf_libpath ; then
861d522f475Smrg					cf_config=$cf_libpath
862d522f475Smrg					break
863d522f475Smrg				fi
864d522f475Smrg				;;
865d522f475Smrg			esac
866d522f475Smrg		done
867d522f475Smrg		if test -z "$cf_config" ; then
868d522f475Smrg			AC_MSG_WARN(Could not find imake config-directory)
869d522f475Smrg		else
870d522f475Smrg			cf_imake_opts="$cf_imake_opts -I$cf_config"
871d522f475Smrg			if ( $IMAKE -v $cf_imake_opts 2>&AC_FD_CC)
872d522f475Smrg			then
873d522f475Smrg				CF_VERBOSE(Using $IMAKE $cf_config)
874d522f475Smrg			else
875d522f475Smrg				AC_MSG_WARN(Cannot run $IMAKE)
876d522f475Smrg			fi
877d522f475Smrg		fi
878d522f475Smrg	fi
879d522f475Smrg
880d522f475Smrg	# GNU make sometimes prints "make[1]: Entering...", which
881d522f475Smrg	# would confuse us.
882d522f475Smrg	eval `make findstddefs 2>/dev/null | grep -v make`
883d522f475Smrg
884d522f475Smrg	cd ..
885d522f475Smrg	rm -rf conftestdir
886d522f475Smrg
887d522f475Smrg	# We use ${ALLDEFINES} rather than ${STD_DEFINES} because the former
888d522f475Smrg	# declares XTFUNCPROTO there.  However, some vendors (e.g., SGI) have
889d522f475Smrg	# modified it to support site.cf, adding a kludge for the /usr/include
890d522f475Smrg	# directory.  Try to filter that out, otherwise gcc won't find its
891d522f475Smrg	# headers.
892d522f475Smrg	if test -n "$GCC" ; then
893d522f475Smrg	    if test -n "$IMAKE_CFLAGS" ; then
894d522f475Smrg		cf_nostdinc=""
895d522f475Smrg		cf_std_incl=""
896d522f475Smrg		cf_cpp_opts=""
897d522f475Smrg		for cf_opt in $IMAKE_CFLAGS
898d522f475Smrg		do
899d522f475Smrg		    case "$cf_opt" in
900d522f475Smrg		    -nostdinc) #(vi
901d522f475Smrg			cf_nostdinc="$cf_opt"
902d522f475Smrg			;;
903d522f475Smrg		    -I/usr/include) #(vi
904d522f475Smrg			cf_std_incl="$cf_opt"
905d522f475Smrg			;;
906d522f475Smrg		    *) #(vi
907d522f475Smrg			cf_cpp_opts="$cf_cpp_opts $cf_opt"
908d522f475Smrg			;;
909d522f475Smrg		    esac
910d522f475Smrg		done
911d522f475Smrg		if test -z "$cf_nostdinc" ; then
912d522f475Smrg		    IMAKE_CFLAGS="$cf_cpp_opts $cf_std_incl"
913d522f475Smrg		elif test -z "$cf_std_incl" ; then
914d522f475Smrg		    IMAKE_CFLAGS="$cf_cpp_opts $cf_nostdinc"
915d522f475Smrg		else
916d522f475Smrg		    CF_VERBOSE(suppressed \"$cf_nostdinc\" and \"$cf_std_incl\")
917d522f475Smrg		    IMAKE_CFLAGS="$cf_cpp_opts"
918d522f475Smrg		fi
919d522f475Smrg	    fi
920d522f475Smrg	fi
921d522f475Smrgfi
922d522f475Smrg
923d522f475Smrg# Some imake configurations define PROJECTROOT with an empty value.  Remove
924d522f475Smrg# the empty definition.
925d522f475Smrgcase $IMAKE_CFLAGS in
926d522f475Smrg*-DPROJECTROOT=/*)
927d522f475Smrg	;;
928d522f475Smrg*)
929d522f475Smrg	IMAKE_CFLAGS=`echo "$IMAKE_CFLAGS" |sed -e "s,-DPROJECTROOT=[[ 	]], ,"`
930d522f475Smrg	;;
931d522f475Smrgesac
932d522f475Smrg
933d522f475Smrgfi
934d522f475Smrg
935d522f475SmrgCF_VERBOSE(IMAKE_CFLAGS $IMAKE_CFLAGS)
936d522f475SmrgCF_VERBOSE(IMAKE_LOADFLAGS $IMAKE_LOADFLAGS)
937d522f475Smrg
938d522f475SmrgAC_SUBST(IMAKE_CFLAGS)
939d522f475SmrgAC_SUBST(IMAKE_LOADFLAGS)
940d522f475Smrg])dnl
941d522f475Smrgdnl ---------------------------------------------------------------------------
942d522f475Smrgdnl CF_INPUT_METHOD version: 3 updated: 2000/04/11 23:46:57
943d522f475Smrgdnl ---------------
944d522f475Smrgdnl Check if the X libraries support input-method
945d522f475SmrgAC_DEFUN([CF_INPUT_METHOD],
946d522f475Smrg[
947d522f475SmrgAC_CACHE_CHECK([if X libraries support input-method],cf_cv_input_method,[
948d522f475SmrgAC_TRY_LINK([
949d522f475Smrg#include <X11/IntrinsicP.h>
950d522f475Smrg#include <X11/Xatom.h>
951d522f475Smrg#include <X11/Xutil.h>
952d522f475Smrg#include <X11/Xmu/Atoms.h>
953d522f475Smrg#include <X11/Xmu/Converters.h>
954d522f475Smrg#include <X11/Xaw/XawImP.h>
955d522f475Smrg],[
956d522f475Smrg{
957d522f475Smrg	XIM xim;
958d522f475Smrg	XIMStyles *xim_styles = 0;
959d522f475Smrg	XIMStyle input_style;
960d522f475Smrg	Widget w = 0;
961d522f475Smrg
962d522f475Smrg	XSetLocaleModifiers("@im=none");
963d522f475Smrg	xim = XOpenIM(XtDisplay(w), NULL, NULL, NULL);
964d522f475Smrg	XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL);
965d522f475Smrg	XCloseIM(xim);
966d522f475Smrg	input_style = (XIMPreeditNothing | XIMStatusNothing);
967d522f475Smrg}
968d522f475Smrg],
969d522f475Smrg[cf_cv_input_method=yes],
970d522f475Smrg[cf_cv_input_method=no])])
971d522f475Smrg])dnl
972d522f475Smrgdnl ---------------------------------------------------------------------------
973d522f475Smrgdnl CF_INTEL_COMPILER version: 3 updated: 2005/08/06 18:37:29
974d522f475Smrgdnl -----------------
975d522f475Smrgdnl Check if the given compiler is really the Intel compiler for Linux.  It
976d522f475Smrgdnl tries to imitate gcc, but does not return an error when it finds a mismatch
977d522f475Smrgdnl between prototypes, e.g., as exercised by CF_MISSING_CHECK.
978d522f475Smrgdnl
979d522f475Smrgdnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
980d522f475Smrgdnl ensure that it is not mistaken for gcc/g++.  It is normally invoked from
981d522f475Smrgdnl the wrappers for gcc and g++ warnings.
982d522f475Smrgdnl
983d522f475Smrgdnl $1 = GCC (default) or GXX
984d522f475Smrgdnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
985d522f475Smrgdnl $3 = CFLAGS (default) or CXXFLAGS
986d522f475SmrgAC_DEFUN([CF_INTEL_COMPILER],[
987d522f475Smrgifelse($2,,INTEL_COMPILER,[$2])=no
988d522f475Smrg
989d522f475Smrgif test "$ifelse($1,,[$1],GCC)" = yes ; then
990d522f475Smrg	case $host_os in
991d522f475Smrg	linux*|gnu*)
992d522f475Smrg		AC_MSG_CHECKING(if this is really Intel ifelse($1,GXX,C++,C) compiler)
993d522f475Smrg		cf_save_CFLAGS="$ifelse($3,,CFLAGS,[$3])"
994d522f475Smrg		ifelse($3,,CFLAGS,[$3])="$ifelse($3,,CFLAGS,[$3]) -no-gcc"
995d522f475Smrg		AC_TRY_COMPILE([],[
996d522f475Smrg#ifdef __INTEL_COMPILER
997d522f475Smrg#else
998d522f475Smrgmake an error
999d522f475Smrg#endif
1000d522f475Smrg],[ifelse($2,,INTEL_COMPILER,[$2])=yes
1001d522f475Smrgcf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc"
1002d522f475Smrg],[])
1003d522f475Smrg		ifelse($3,,CFLAGS,[$3])="$cf_save_CFLAGS"
1004d522f475Smrg		AC_MSG_RESULT($ifelse($2,,INTEL_COMPILER,[$2]))
1005d522f475Smrg		;;
1006d522f475Smrg	esac
1007d522f475Smrgfi
1008d522f475Smrg])dnl
1009d522f475Smrgdnl ---------------------------------------------------------------------------
1010d522f475Smrgdnl CF_LASTLOG version: 4 updated: 2002/10/27 23:21:42
1011d522f475Smrgdnl ----------
1012d522f475Smrgdnl Check for header defining _PATH_LASTLOG, or failing that, see if the lastlog
1013d522f475Smrgdnl file exists.
1014d522f475SmrgAC_DEFUN([CF_LASTLOG],
1015d522f475Smrg[
1016d522f475SmrgAC_CHECK_HEADERS(lastlog.h paths.h)
1017d522f475SmrgAC_CACHE_CHECK(for lastlog path,cf_cv_path_lastlog,[
1018d522f475SmrgAC_TRY_COMPILE([
1019d522f475Smrg#include <sys/types.h>
1020d522f475Smrg#ifdef HAVE_LASTLOG_H
1021d522f475Smrg#include <lastlog.h>
1022d522f475Smrg#else
1023d522f475Smrg#ifdef HAVE_PATHS_H
1024d522f475Smrg#include <paths.h>
1025d522f475Smrg#endif
1026d522f475Smrg#endif],[char *path = _PATH_LASTLOG],
1027d522f475Smrg	[cf_cv_path_lastlog="_PATH_LASTLOG"],
1028d522f475Smrg	[if test -f /usr/adm/lastlog ; then
1029d522f475Smrg	 	cf_cv_path_lastlog=/usr/adm/lastlog
1030d522f475Smrg	else
1031d522f475Smrg		cf_cv_path_lastlog=no
1032d522f475Smrg	fi])
1033d522f475Smrg])
1034d522f475Smrgtest $cf_cv_path_lastlog != no && AC_DEFINE(USE_LASTLOG)
1035d522f475Smrg])dnl
1036d522f475Smrgdnl ---------------------------------------------------------------------------
1037d522f475Smrgdnl CF_MSG_LOG version: 4 updated: 2007/07/29 09:55:12
1038d522f475Smrgdnl ----------
1039d522f475Smrgdnl Write a debug message to config.log, along with the line number in the
1040d522f475Smrgdnl configure script.
1041d522f475SmrgAC_DEFUN([CF_MSG_LOG],[
1042d522f475Smrgecho "${as_me-configure}:__oline__: testing $* ..." 1>&AC_FD_CC
1043d522f475Smrg])dnl
1044d522f475Smrgdnl ---------------------------------------------------------------------------
1045d522f475Smrgdnl CF_PATH_PROG version: 6 updated: 2004/01/26 20:58:41
1046d522f475Smrgdnl ------------
1047d522f475Smrgdnl Check for a given program, defining corresponding symbol.
1048d522f475Smrgdnl	$1 = environment variable, which is suffixed by "_PATH" in the #define.
1049d522f475Smrgdnl	$2 = program name to find.
1050d522f475Smrgdnl	$3 = optional list of additional program names to test.
1051d522f475Smrgdnl
1052d522f475Smrgdnl If there is more than one token in the result, #define the remaining tokens
1053d522f475Smrgdnl to $1_ARGS.  We need this for 'install' in particular.
1054d522f475Smrgdnl
1055d522f475Smrgdnl FIXME: we should allow this to be overridden by environment variables
1056d522f475Smrgdnl
1057d522f475SmrgAC_DEFUN([CF_PATH_PROG],[
1058d522f475Smrgtest -z "[$]$1" && $1=$2
1059d522f475SmrgAC_PATH_PROGS($1,[$]$1 $2 $3,[$]$1)
1060d522f475Smrg
1061d522f475Smrgcf_path_prog=""
1062d522f475Smrgcf_path_args=""
1063d522f475SmrgIFS="${IFS= 	}"; cf_save_ifs="$IFS"
1064d522f475Smrgcase $host_os in #(vi
1065d522f475Smrgos2*) #(vi
1066d522f475Smrg	IFS="${IFS};"
1067d522f475Smrg	;;
1068d522f475Smrg*)
1069d522f475Smrg	IFS="${IFS}:"
1070d522f475Smrg	;;
1071d522f475Smrgesac
1072d522f475Smrg
1073d522f475Smrgfor cf_temp in $ac_cv_path_$1
1074d522f475Smrgdo
1075d522f475Smrg	if test -z "$cf_path_prog" ; then
1076d522f475Smrg		if test "$with_full_paths" = yes ; then
1077d522f475Smrg			CF_PATH_SYNTAX(cf_temp,break)
1078d522f475Smrg			cf_path_prog="$cf_temp"
1079d522f475Smrg		else
1080d522f475Smrg			cf_path_prog="`basename $cf_temp`"
1081d522f475Smrg		fi
1082d522f475Smrg	elif test -z "$cf_path_args" ; then
1083d522f475Smrg		cf_path_args="$cf_temp"
1084d522f475Smrg	else
1085d522f475Smrg		cf_path_args="$cf_path_args $cf_temp"
1086d522f475Smrg	fi
1087d522f475Smrgdone
1088d522f475SmrgIFS="$cf_save_ifs"
1089d522f475Smrg
1090d522f475Smrgif test -n "$cf_path_prog" ; then
1091d522f475Smrg	CF_MSG_LOG(defining path for ${cf_path_prog})
1092d522f475Smrg	AC_DEFINE_UNQUOTED($1_PATH,"$cf_path_prog")
1093d522f475Smrg	test -n "$cf_path_args" && AC_DEFINE_UNQUOTED($1_ARGS,"$cf_path_args")
1094d522f475Smrgfi
1095d522f475Smrg])dnl
1096d522f475Smrgdnl ---------------------------------------------------------------------------
1097d522f475Smrgdnl CF_PATH_SYNTAX version: 12 updated: 2008/03/23 14:45:59
1098d522f475Smrgdnl --------------
1099d522f475Smrgdnl Check the argument to see that it looks like a pathname.  Rewrite it if it
1100d522f475Smrgdnl begins with one of the prefix/exec_prefix variables, and then again if the
1101d522f475Smrgdnl result begins with 'NONE'.  This is necessary to work around autoconf's
1102d522f475Smrgdnl delayed evaluation of those symbols.
1103d522f475SmrgAC_DEFUN([CF_PATH_SYNTAX],[
1104d522f475Smrgif test "x$prefix" != xNONE; then
1105d522f475Smrg  cf_path_syntax="$prefix"
1106d522f475Smrgelse
1107d522f475Smrg  cf_path_syntax="$ac_default_prefix"
1108d522f475Smrgfi
1109d522f475Smrg
1110d522f475Smrgcase ".[$]$1" in #(vi
1111d522f475Smrg.\[$]\(*\)*|.\'*\'*) #(vi
1112d522f475Smrg  ;;
1113d522f475Smrg..|./*|.\\*) #(vi
1114d522f475Smrg  ;;
1115d522f475Smrg.[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX
1116d522f475Smrg  ;;
1117d522f475Smrg.\[$]{*prefix}*) #(vi
1118d522f475Smrg  eval $1="[$]$1"
1119d522f475Smrg  case ".[$]$1" in #(vi
1120d522f475Smrg  .NONE/*)
1121d522f475Smrg    $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
1122d522f475Smrg    ;;
1123d522f475Smrg  esac
1124d522f475Smrg  ;; #(vi
1125d522f475Smrg.no|.NONE/*)
1126d522f475Smrg  $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
1127d522f475Smrg  ;;
1128d522f475Smrg*)
1129d522f475Smrg  ifelse($2,,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2)
1130d522f475Smrg  ;;
1131d522f475Smrgesac
1132d522f475Smrg])dnl
1133d522f475Smrgdnl ---------------------------------------------------------------------------
1134d522f475Smrgdnl CF_POSIX_C_SOURCE version: 6 updated: 2005/07/14 20:25:10
1135d522f475Smrgdnl -----------------
1136d522f475Smrgdnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed.
1137d522f475Smrgdnl
1138d522f475Smrgdnl	POSIX.1-1990				_POSIX_SOURCE
1139d522f475Smrgdnl	POSIX.1-1990 and			_POSIX_SOURCE and
1140d522f475Smrgdnl		POSIX.2-1992 C-Language			_POSIX_C_SOURCE=2
1141d522f475Smrgdnl		Bindings Option
1142d522f475Smrgdnl	POSIX.1b-1993				_POSIX_C_SOURCE=199309L
1143d522f475Smrgdnl	POSIX.1c-1996				_POSIX_C_SOURCE=199506L
1144d522f475Smrgdnl	X/Open 2000				_POSIX_C_SOURCE=200112L
1145d522f475Smrgdnl
1146d522f475Smrgdnl Parameters:
1147d522f475Smrgdnl	$1 is the nominal value for _POSIX_C_SOURCE
1148d522f475SmrgAC_DEFUN([CF_POSIX_C_SOURCE],
1149d522f475Smrg[
1150d522f475Smrgcf_POSIX_C_SOURCE=ifelse($1,,199506L,$1)
1151d522f475Smrg
1152d522f475Smrgcf_save_CFLAGS="$CFLAGS"
1153d522f475Smrgcf_save_CPPFLAGS="$CPPFLAGS"
1154d522f475Smrg
1155d522f475SmrgCF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE)
1156d522f475SmrgCF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE)
1157d522f475Smrg
1158d522f475SmrgAC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[
1159d522f475Smrg	CF_MSG_LOG(if the symbol is already defined go no further)
1160d522f475Smrg	AC_TRY_COMPILE([#include <sys/types.h>],[
1161d522f475Smrg#ifndef _POSIX_C_SOURCE
1162d522f475Smrgmake an error
1163d522f475Smrg#endif],
1164d522f475Smrg	[cf_cv_posix_c_source=no],
1165d522f475Smrg	[cf_want_posix_source=no
1166d522f475Smrg	 case .$cf_POSIX_C_SOURCE in #(vi
1167d522f475Smrg	 .[[12]]??*) #(vi
1168d522f475Smrg		cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
1169d522f475Smrg		;;
1170d522f475Smrg	 .2) #(vi
1171d522f475Smrg		cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
1172d522f475Smrg		cf_want_posix_source=yes
1173d522f475Smrg		;;
1174d522f475Smrg	 .*)
1175d522f475Smrg		cf_want_posix_source=yes
1176d522f475Smrg		;;
1177d522f475Smrg	 esac
1178d522f475Smrg	 if test "$cf_want_posix_source" = yes ; then
1179d522f475Smrg		AC_TRY_COMPILE([#include <sys/types.h>],[
1180d522f475Smrg#ifdef _POSIX_SOURCE
1181d522f475Smrgmake an error
1182d522f475Smrg#endif],[],
1183d522f475Smrg		cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE")
1184d522f475Smrg	 fi
1185d522f475Smrg	 CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE)
1186d522f475Smrg	 CFLAGS="$cf_trim_CFLAGS"
1187d522f475Smrg	 CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source"
1188d522f475Smrg	 CF_MSG_LOG(if the second compile does not leave our definition intact error)
1189d522f475Smrg	 AC_TRY_COMPILE([#include <sys/types.h>],[
1190d522f475Smrg#ifndef _POSIX_C_SOURCE
1191d522f475Smrgmake an error
1192d522f475Smrg#endif],,
1193d522f475Smrg	 [cf_cv_posix_c_source=no])
1194d522f475Smrg	 CFLAGS="$cf_save_CFLAGS"
1195d522f475Smrg	 CPPFLAGS="$cf_save_CPPFLAGS"
1196d522f475Smrg	])
1197d522f475Smrg])
1198d522f475Smrg
1199d522f475Smrgif test "$cf_cv_posix_c_source" != no ; then
1200d522f475Smrg	CFLAGS="$cf_trim_CFLAGS"
1201d522f475Smrg	CPPFLAGS="$cf_trim_CPPFLAGS"
1202d522f475Smrg	if test "$cf_cv_cc_u_d_options" = yes ; then
1203d522f475Smrg		cf_temp_posix_c_source=`echo "$cf_cv_posix_c_source" | \
1204d522f475Smrg				sed -e 's/-D/-U/g' -e 's/=[[^ 	]]*//g'`
1205d522f475Smrg		CPPFLAGS="$CPPFLAGS $cf_temp_posix_c_source"
1206d522f475Smrg	fi
1207d522f475Smrg	CPPFLAGS="$CPPFLAGS $cf_cv_posix_c_source"
1208d522f475Smrgfi
1209d522f475Smrg
1210d522f475Smrg])dnl
1211d522f475Smrgdnl ---------------------------------------------------------------------------
1212d522f475Smrgdnl CF_POSIX_SAVED_IDS version: 7 updated: 2007/03/14 16:43:53
1213d522f475Smrgdnl ------------------
1214d522f475Smrgdnl
1215d522f475Smrgdnl Check first if saved-ids are always supported.  Some systems
1216d522f475Smrgdnl may require runtime checks.
1217d522f475SmrgAC_DEFUN([CF_POSIX_SAVED_IDS],
1218d522f475Smrg[
1219d522f475SmrgAC_CHECK_HEADERS( \
1220d522f475Smrgsys/param.h \
1221d522f475Smrg)
1222d522f475Smrg
1223d522f475SmrgAC_CACHE_CHECK(if POSIX saved-ids are supported,cf_cv_posix_saved_ids,[
1224d522f475SmrgAC_TRY_LINK(
1225d522f475Smrg[
1226d522f475Smrg#include <unistd.h>
1227d522f475Smrg#ifdef HAVE_SYS_PARAM_H
1228d522f475Smrg#include <sys/param.h>		/* this may define "BSD" */
1229d522f475Smrg#endif
1230d522f475Smrg],[
1231d522f475Smrg#if defined(_POSIX_SAVED_IDS) && (_POSIX_SAVED_IDS > 0)
1232d522f475Smrg	void *p = (void *) seteuid;
1233d522f475Smrg	int x = seteuid(geteuid());
1234d522f475Smrg#elif defined(BSD) && (BSD >= 199103)
1235d522f475Smrg/* The BSD's may implement the runtime check - and it fails.
1236d522f475Smrg * However, saved-ids work almost like POSIX (close enough for most uses).
1237d522f475Smrg */
1238d522f475Smrg#else
1239d522f475Smrgmake an error
1240d522f475Smrg#endif
1241d522f475Smrg],[cf_cv_posix_saved_ids=yes
1242d522f475Smrg],[
1243d522f475SmrgAC_TRY_RUN([
1244d522f475Smrg#ifdef HAVE_STDLIB_H
1245d522f475Smrg#include <stdlib.h>
1246d522f475Smrg#endif
1247d522f475Smrg#include <unistd.h>
1248d522f475Smrgint main()
1249d522f475Smrg{
1250d522f475Smrg	void *p = (void *) seteuid;
1251d522f475Smrg	long code = sysconf(_SC_SAVED_IDS);
1252d522f475Smrg	${cf_cv_main_return:-return}  ((code > 0) ? 0 : 1);
1253d522f475Smrg}],
1254d522f475Smrg	cf_cv_posix_saved_ids=yes,
1255d522f475Smrg	cf_cv_posix_saved_ids=no,
1256d522f475Smrg	cf_cv_posix_saved_ids=unknown)
1257d522f475Smrg])
1258d522f475Smrg])
1259d522f475Smrg
1260d522f475Smrgtest "$cf_cv_posix_saved_ids" = yes && AC_DEFINE(HAVE_POSIX_SAVED_IDS)
1261d522f475Smrg])
1262d522f475Smrgdnl ---------------------------------------------------------------------------
1263d522f475Smrgdnl CF_POSIX_WAIT version: 2 updated: 2000/05/29 16:16:04
1264d522f475Smrgdnl -------------
1265d522f475Smrgdnl Check for POSIX wait support
1266d522f475SmrgAC_DEFUN([CF_POSIX_WAIT],
1267d522f475Smrg[
1268d522f475SmrgAC_REQUIRE([AC_HEADER_SYS_WAIT])
1269d522f475SmrgAC_CACHE_CHECK(for POSIX wait functions,cf_cv_posix_wait,[
1270d522f475SmrgAC_TRY_LINK([
1271d522f475Smrg#include <stdlib.h>
1272d522f475Smrg#include <stdio.h>
1273d522f475Smrg#include <sys/types.h>
1274d522f475Smrg#ifdef HAVE_SYS_WAIT_H
1275d522f475Smrg#include <sys/wait.h>
1276d522f475Smrg#endif
1277d522f475Smrg],[
1278d522f475Smrg	int stat_loc;
1279d522f475Smrg	pid_t pid = waitpid(-1, &stat_loc, WNOHANG|WUNTRACED);
1280d522f475Smrg	pid_t pid2 = wait(&stat_loc);
1281d522f475Smrg],
1282d522f475Smrg[cf_cv_posix_wait=yes],
1283d522f475Smrg[cf_cv_posix_wait=no])
1284d522f475Smrg])
1285d522f475Smrgtest "$cf_cv_posix_wait" = yes && AC_DEFINE(USE_POSIX_WAIT)
1286d522f475Smrg])dnl
1287d522f475Smrgdnl ---------------------------------------------------------------------------
1288d522f475Smrgdnl CF_PROCFS_CWD version: 2 updated: 2007/03/12 20:39:04
1289d522f475Smrgdnl -------------
1290d522f475Smrgdnl Find /proc tree (may be in a different place) which implements the "cwd"
1291d522f475Smrgdnl link.
1292d522f475SmrgAC_DEFUN([CF_PROCFS_CWD],[
1293d522f475SmrgAC_CACHE_CHECK(for proc tree with cwd-support,cf_cv_procfs_cwd,[
1294d522f475Smrgcf_cv_procfs_cwd=no
1295d522f475Smrgfor cf_path in /proc /compat/linux/proc /usr/compat/linux/proc
1296d522f475Smrgdo
1297d522f475Smrg	if test -d $cf_path && \
1298d522f475Smrg	   test -d $cf_path/$$ && \
1299d522f475Smrg	   ( test -d $cf_path/$$/cwd || \
1300d522f475Smrg	     test -L $cf_path/$$/cwd ); then
1301d522f475Smrg		cf_cv_procfs_cwd=$cf_path
1302d522f475Smrg		break
1303d522f475Smrg	fi
1304d522f475Smrgdone
1305d522f475Smrg])
1306d522f475Smrg])dnl
1307d522f475Smrgdnl ---------------------------------------------------------------------------
1308d522f475Smrgdnl CF_PROG_CC_U_D version: 1 updated: 2005/07/14 16:59:30
1309d522f475Smrgdnl --------------
1310d522f475Smrgdnl Check if C (preprocessor) -U and -D options are processed in the order
1311d522f475Smrgdnl given rather than by type of option.  Some compilers insist on apply all
1312d522f475Smrgdnl of the -U options after all of the -D options.  Others allow mixing them,
1313d522f475Smrgdnl and may predefine symbols that conflict with those we define.
1314d522f475SmrgAC_DEFUN([CF_PROG_CC_U_D],
1315d522f475Smrg[
1316d522f475SmrgAC_CACHE_CHECK(if $CC -U and -D options work together,cf_cv_cc_u_d_options,[
1317d522f475Smrg	cf_save_CPPFLAGS="$CPPFLAGS"
1318d522f475Smrg	CPPFLAGS="-UU_D_OPTIONS -DU_D_OPTIONS -DD_U_OPTIONS -UD_U_OPTIONS"
1319d522f475Smrg	AC_TRY_COMPILE([],[
1320d522f475Smrg#ifndef U_D_OPTIONS
1321d522f475Smrgmake an undefined-error
1322d522f475Smrg#endif
1323d522f475Smrg#ifdef  D_U_OPTIONS
1324d522f475Smrgmake a defined-error
1325d522f475Smrg#endif
1326d522f475Smrg	],[
1327d522f475Smrg	cf_cv_cc_u_d_options=yes],[
1328d522f475Smrg	cf_cv_cc_u_d_options=no])
1329d522f475Smrg	CPPFLAGS="$cf_save_CPPFLAGS"
1330d522f475Smrg])
1331d522f475Smrg])dnl
1332d522f475Smrgdnl ---------------------------------------------------------------------------
1333d522f475Smrgdnl CF_PROG_EXT version: 10 updated: 2004/01/03 19:28:18
1334d522f475Smrgdnl -----------
1335d522f475Smrgdnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX.
1336d522f475SmrgAC_DEFUN([CF_PROG_EXT],
1337d522f475Smrg[
1338d522f475SmrgAC_REQUIRE([CF_CHECK_CACHE])
1339d522f475Smrgcase $cf_cv_system_name in
1340d522f475Smrgos2*)
1341d522f475Smrg    CFLAGS="$CFLAGS -Zmt"
1342d522f475Smrg    CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__"
1343d522f475Smrg    CXXFLAGS="$CXXFLAGS -Zmt"
1344d522f475Smrg    # autoconf's macro sets -Zexe and suffix both, which conflict:w
1345d522f475Smrg    LDFLAGS="$LDFLAGS -Zmt -Zcrtdll"
1346d522f475Smrg    ac_cv_exeext=.exe
1347d522f475Smrg    ;;
1348d522f475Smrgesac
1349d522f475Smrg
1350d522f475SmrgAC_EXEEXT
1351d522f475SmrgAC_OBJEXT
1352d522f475Smrg
1353d522f475SmrgPROG_EXT="$EXEEXT"
1354d522f475SmrgAC_SUBST(PROG_EXT)
1355d522f475Smrgtest -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT")
1356d522f475Smrg])dnl
1357d522f475Smrgdnl ---------------------------------------------------------------------------
1358d522f475Smrgdnl CF_REGEX version: 3 updated: 1997/11/01 14:26:01
1359d522f475Smrgdnl --------
1360d522f475Smrgdnl Attempt to determine if we've got one of the flavors of regular-expression
1361d522f475Smrgdnl code that we can support.
1362d522f475SmrgAC_DEFUN([CF_REGEX],
1363d522f475Smrg[
1364d522f475SmrgAC_MSG_CHECKING([for regular-expression headers])
1365d522f475SmrgAC_CACHE_VAL(cf_cv_regex,[
1366d522f475SmrgAC_TRY_LINK([#include <sys/types.h>
1367d522f475Smrg#include <regex.h>],[
1368d522f475Smrg	regex_t *p;
1369d522f475Smrg	int x = regcomp(p, "", 0);
1370d522f475Smrg	int y = regexec(p, "", 0, 0, 0);
1371d522f475Smrg	regfree(p);
1372d522f475Smrg	],[cf_cv_regex="regex.h"],[
1373d522f475Smrg	AC_TRY_LINK([#include <regexp.h>],[
1374d522f475Smrg		char *p = compile("", "", "", 0);
1375d522f475Smrg		int x = step("", "");
1376d522f475Smrg	],[cf_cv_regex="regexp.h"],[
1377d522f475Smrg		cf_save_LIBS="$LIBS"
1378d522f475Smrg		LIBS="-lgen $LIBS"
1379d522f475Smrg		AC_TRY_LINK([#include <regexpr.h>],[
1380d522f475Smrg			char *p = compile("", "", "");
1381d522f475Smrg			int x = step("", "");
1382d522f475Smrg		],[cf_cv_regex="regexpr.h"],[LIBS="$cf_save_LIBS"])])])
1383d522f475Smrg])
1384d522f475SmrgAC_MSG_RESULT($cf_cv_regex)
1385d522f475Smrgcase $cf_cv_regex in
1386d522f475Smrg	regex.h)   AC_DEFINE(HAVE_REGEX_H_FUNCS) ;;
1387d522f475Smrg	regexp.h)  AC_DEFINE(HAVE_REGEXP_H_FUNCS) ;;
1388d522f475Smrg	regexpr.h) AC_DEFINE(HAVE_REGEXPR_H_FUNCS) ;;
1389d522f475Smrgesac
1390d522f475Smrg])dnl
1391d522f475Smrgdnl ---------------------------------------------------------------------------
1392d522f475Smrgdnl CF_REMOVE_DEFINE version: 2 updated: 2005/07/09 16:12:18
1393d522f475Smrgdnl ----------------
1394d522f475Smrgdnl Remove all -U and -D options that refer to the given symbol from a list
1395d522f475Smrgdnl of C compiler options.  This works around the problem that not all
1396d522f475Smrgdnl compilers process -U and -D options from left-to-right, so a -U option
1397d522f475Smrgdnl cannot be used to cancel the effect of a preceding -D option.
1398d522f475Smrgdnl
1399d522f475Smrgdnl $1 = target (which could be the same as the source variable)
1400d522f475Smrgdnl $2 = source (including '$')
1401d522f475Smrgdnl $3 = symbol to remove
1402d522f475Smrgdefine([CF_REMOVE_DEFINE],
1403d522f475Smrg[
1404d522f475Smrg# remove $3 symbol from $2
1405d522f475Smrg$1=`echo "$2" | \
1406d522f475Smrg	sed	-e 's/-[[UD]]$3\(=[[^ 	]]*\)\?[[ 	]]/ /g' \
1407d522f475Smrg		-e 's/-[[UD]]$3\(=[[^ 	]]*\)\?[$]//g'`
1408d522f475Smrg])dnl
1409d522f475Smrgdnl ---------------------------------------------------------------------------
1410d522f475Smrgdnl CF_SIGWINCH version: 1 updated: 2006/04/02 16:41:09
1411d522f475Smrgdnl -----------
1412d522f475Smrgdnl Use this macro after CF_XOPEN_SOURCE, but do not require it (not all
1413d522f475Smrgdnl programs need this test).
1414d522f475Smrgdnl
1415d522f475Smrgdnl This is really a MacOS X 10.4.3 workaround.  Defining _POSIX_C_SOURCE
1416d522f475Smrgdnl forces SIGWINCH to be undefined (breaks xterm, ncurses).  Oddly, the struct
1417d522f475Smrgdnl winsize declaration is left alone - we may revisit this if Apple choose to
1418d522f475Smrgdnl break that part of the interface as well.
1419d522f475SmrgAC_DEFUN([CF_SIGWINCH],
1420d522f475Smrg[
1421d522f475SmrgAC_CACHE_CHECK(if SIGWINCH is defined,cf_cv_define_sigwinch,[
1422d522f475Smrg	AC_TRY_COMPILE([
1423d522f475Smrg#include <sys/types.h>
1424d522f475Smrg#include <sys/signal.h>
1425d522f475Smrg],[int x = SIGWINCH],
1426d522f475Smrg	[cf_cv_define_sigwinch=yes],
1427d522f475Smrg	[AC_TRY_COMPILE([
1428d522f475Smrg#undef _XOPEN_SOURCE
1429d522f475Smrg#undef _POSIX_SOURCE
1430d522f475Smrg#undef _POSIX_C_SOURCE
1431d522f475Smrg#include <sys/types.h>
1432d522f475Smrg#include <sys/signal.h>
1433d522f475Smrg],[int x = SIGWINCH],
1434d522f475Smrg	[cf_cv_define_sigwinch=maybe],
1435d522f475Smrg	[cf_cv_define_sigwinch=no])
1436d522f475Smrg])
1437d522f475Smrg])
1438d522f475Smrg
1439d522f475Smrgif test "$cf_cv_define_sigwinch" = maybe ; then
1440d522f475SmrgAC_CACHE_CHECK(for actual SIGWINCH definition,cf_cv_fixup_sigwinch,[
1441d522f475Smrgcf_cv_fixup_sigwinch=unknown
1442d522f475Smrgcf_sigwinch=32
1443d522f475Smrgwhile test $cf_sigwinch != 1
1444d522f475Smrgdo
1445d522f475Smrg	AC_TRY_COMPILE([
1446d522f475Smrg#undef _XOPEN_SOURCE
1447d522f475Smrg#undef _POSIX_SOURCE
1448d522f475Smrg#undef _POSIX_C_SOURCE
1449d522f475Smrg#include <sys/types.h>
1450d522f475Smrg#include <sys/signal.h>
1451d522f475Smrg],[
1452d522f475Smrg#if SIGWINCH != $cf_sigwinch
1453d522f475Smrgmake an error
1454d522f475Smrg#endif
1455d522f475Smrgint x = SIGWINCH],
1456d522f475Smrg	[cf_cv_fixup_sigwinch=$cf_sigwinch
1457d522f475Smrg	 break])
1458d522f475Smrg
1459d522f475Smrgcf_sigwinch=`expr $cf_sigwinch - 1`
1460d522f475Smrgdone
1461d522f475Smrg])
1462d522f475Smrg
1463d522f475Smrg	if test "$cf_cv_fixup_sigwinch" != unknown ; then
1464d522f475Smrg		CPPFLAGS="$CPPFLAGS -DSIGWINCH=$cf_cv_fixup_sigwinch"
1465d522f475Smrg	fi
1466d522f475Smrgfi
1467d522f475Smrg])dnl
1468d522f475Smrgdnl ---------------------------------------------------------------------------
1469d522f475Smrgdnl CF_SIG_ATOMIC_T version: 2 updated: 2005/09/18 17:27:12
1470d522f475Smrgdnl ---------------
1471d522f475Smrgdnl signal handler, but there are some gcc depedencies in that recommendation.
1472d522f475Smrgdnl Try anyway.
1473d522f475SmrgAC_DEFUN([CF_SIG_ATOMIC_T],
1474d522f475Smrg[
1475d522f475SmrgAC_MSG_CHECKING(for signal global datatype)
1476d522f475SmrgAC_CACHE_VAL(cf_cv_sig_atomic_t,[
1477d522f475Smrg	for cf_type in \
1478d522f475Smrg		"volatile sig_atomic_t" \
1479d522f475Smrg		"sig_atomic_t" \
1480d522f475Smrg		"int"
1481d522f475Smrg	do
1482d522f475Smrg	AC_TRY_COMPILE([
1483d522f475Smrg#include <sys/types.h>
1484d522f475Smrg#include <signal.h>
1485d522f475Smrg#include <stdio.h>
1486d522f475Smrg
1487d522f475Smrgextern $cf_type x;
1488d522f475Smrg$cf_type x;
1489d522f475Smrgstatic void handler(int sig)
1490d522f475Smrg{
1491d522f475Smrg	x = 5;
1492d522f475Smrg}],
1493d522f475Smrg		[signal(SIGINT, handler);
1494d522f475Smrg		 x = 1],
1495d522f475Smrg		[cf_cv_sig_atomic_t=$cf_type],
1496d522f475Smrg		[cf_cv_sig_atomic_t=no])
1497d522f475Smrg		test "$cf_cv_sig_atomic_t" != no && break
1498d522f475Smrg	done
1499d522f475Smrg	])
1500d522f475SmrgAC_MSG_RESULT($cf_cv_sig_atomic_t)
1501d522f475Smrgtest "$cf_cv_sig_atomic_t" != no && AC_DEFINE_UNQUOTED(SIG_ATOMIC_T, $cf_cv_sig_atomic_t)
1502d522f475Smrg])dnl
1503d522f475Smrgdnl ---------------------------------------------------------------------------
1504d522f475Smrgdnl CF_SIZE_T version: 4 updated: 2000/01/22 00:19:54
1505d522f475Smrgdnl ---------
1506d522f475Smrgdnl	On both Ultrix and CLIX, I find size_t defined in <stdio.h>
1507d522f475SmrgAC_DEFUN([CF_SIZE_T],
1508d522f475Smrg[
1509d522f475SmrgAC_MSG_CHECKING(for size_t in <sys/types.h> or <stdio.h>)
1510d522f475SmrgAC_CACHE_VAL(cf_cv_type_size_t,[
1511d522f475Smrg	AC_TRY_COMPILE([
1512d522f475Smrg#include <sys/types.h>
1513d522f475Smrg#ifdef STDC_HEADERS
1514d522f475Smrg#include <stdlib.h>
1515d522f475Smrg#include <stddef.h>
1516d522f475Smrg#endif
1517d522f475Smrg#include <stdio.h>],
1518d522f475Smrg		[size_t x],
1519d522f475Smrg		[cf_cv_type_size_t=yes],
1520d522f475Smrg		[cf_cv_type_size_t=no])
1521d522f475Smrg	])
1522d522f475SmrgAC_MSG_RESULT($cf_cv_type_size_t)
1523d522f475Smrgtest $cf_cv_type_size_t = no && AC_DEFINE(size_t, unsigned)
1524d522f475Smrg])dnl
1525d522f475Smrgdnl ---------------------------------------------------------------------------
1526d522f475Smrgdnl CF_STRUCT_LASTLOG version: 1 updated: 2006/03/12 17:46:43
1527d522f475Smrgdnl -----------------
1528d522f475Smrgdnl Check for header defining struct lastlog, ensure that its .ll_time member
1529d522f475Smrgdnl is compatible with time().
1530d522f475SmrgAC_DEFUN([CF_STRUCT_LASTLOG],
1531d522f475Smrg[
1532d522f475SmrgAC_CHECK_HEADERS(lastlog.h)
1533d522f475SmrgAC_CACHE_CHECK(for struct lastlog,cf_cv_struct_lastlog,[
1534d522f475SmrgAC_TRY_RUN([
1535d522f475Smrg#include <sys/types.h>
1536d522f475Smrg#include <time.h>
1537d522f475Smrg#include <lastlog.h>
1538d522f475Smrg
1539d522f475Smrgint main()
1540d522f475Smrg{
1541d522f475Smrg	struct lastlog data;
1542d522f475Smrg	return (sizeof(data.ll_time) != sizeof(time_t));
1543d522f475Smrg}],[
1544d522f475Smrgcf_cv_struct_lastlog=yes],[
1545d522f475Smrgcf_cv_struct_lastlog=no],[
1546d522f475Smrgcf_cv_struct_lastlog=unknown])])
1547d522f475Smrg
1548d522f475Smrgtest $cf_cv_struct_lastlog != no && AC_DEFINE(USE_STRUCT_LASTLOG)
1549d522f475Smrg])dnl
1550d522f475Smrgdnl ---------------------------------------------------------------------------
1551d522f475Smrgdnl CF_SVR4 version: 3 updated: 2000/05/31 10:16:52
1552d522f475Smrgdnl -------
1553d522f475Smrgdnl Check if this is an SVR4 system.  We need the definition for xterm
1554d522f475SmrgAC_DEFUN([CF_SVR4],
1555d522f475Smrg[
1556d522f475SmrgAC_CHECK_LIB(elf, elf_begin,[
1557d522f475SmrgAC_CACHE_CHECK(if this is an SVR4 system, cf_cv_svr4,[
1558d522f475SmrgAC_TRY_COMPILE([
1559d522f475Smrg#include <elf.h>
1560d522f475Smrg#include <sys/termio.h>
1561d522f475Smrg],[
1562d522f475Smrgstatic struct termio d_tio;
1563d522f475Smrg	d_tio.c_cc[VINTR] = 0;
1564d522f475Smrg	d_tio.c_cc[VQUIT] = 0;
1565d522f475Smrg	d_tio.c_cc[VERASE] = 0;
1566d522f475Smrg	d_tio.c_cc[VKILL] = 0;
1567d522f475Smrg	d_tio.c_cc[VEOF] = 0;
1568d522f475Smrg	d_tio.c_cc[VEOL] = 0;
1569d522f475Smrg	d_tio.c_cc[VMIN] = 0;
1570d522f475Smrg	d_tio.c_cc[VTIME] = 0;
1571d522f475Smrg	d_tio.c_cc[VLNEXT] = 0;
1572d522f475Smrg],
1573d522f475Smrg[cf_cv_svr4=yes],
1574d522f475Smrg[cf_cv_svr4=no])
1575d522f475Smrg])
1576d522f475Smrg])
1577d522f475Smrgtest "$cf_cv_svr4" = yes && AC_DEFINE(SVR4)
1578d522f475Smrg])dnl
1579d522f475Smrgdnl ---------------------------------------------------------------------------
1580d522f475Smrgdnl CF_SYSV version: 13 updated: 2006/08/20 14:55:37
1581d522f475Smrgdnl -------
1582d522f475Smrgdnl Check if this is a SYSV platform, e.g., as used in <X11/Xos.h>, and whether
1583d522f475Smrgdnl defining it will be helpful.  The following features are used to check:
1584d522f475Smrgdnl
1585d522f475Smrgdnl a) bona-fide SVSV doesn't use const for sys_errlist[].  Since this is a
1586d522f475Smrgdnl legacy (pre-ANSI) feature, const should not apply.  Modern systems only
1587d522f475Smrgdnl declare strerror().  Xos.h declares the legacy form of str_errlist[], and
1588d522f475Smrgdnl a compile-time error will result from trying to assign to a const array.
1589d522f475Smrgdnl
1590d522f475Smrgdnl b) compile with headers that exist on SYSV hosts.
1591d522f475Smrgdnl
1592d522f475Smrgdnl c) compile with type definitions that differ on SYSV hosts from standard C.
1593d522f475SmrgAC_DEFUN([CF_SYSV],
1594d522f475Smrg[
1595d522f475SmrgAC_CHECK_HEADERS( \
1596d522f475Smrgtermios.h \
1597d522f475Smrgstdlib.h \
1598d522f475SmrgX11/Intrinsic.h \
1599d522f475Smrg)
1600d522f475Smrg
1601d522f475SmrgAC_REQUIRE([CF_SYS_ERRLIST])
1602d522f475Smrg
1603d522f475SmrgAC_CACHE_CHECK(if we should define SYSV,cf_cv_sysv,[
1604d522f475SmrgAC_TRY_COMPILE([
1605d522f475Smrg#undef  SYSV
1606d522f475Smrg#define SYSV 1			/* get Xos.h to declare sys_errlist[] */
1607d522f475Smrg#ifdef HAVE_STDLIB_H
1608d522f475Smrg#include <stdlib.h>		/* look for wchar_t */
1609d522f475Smrg#endif
1610d522f475Smrg#ifdef HAVE_X11_INTRINSIC_H
1611d522f475Smrg#include <X11/Intrinsic.h>	/* Intrinsic.h has other traps... */
1612d522f475Smrg#endif
1613d522f475Smrg#ifdef HAVE_TERMIOS_H		/* needed for HPUX 10.20 */ 
1614d522f475Smrg#include <termios.h> 
1615d522f475Smrg#define STRUCT_TERMIOS struct termios 
1616d522f475Smrg#else 
1617d522f475Smrg#define STRUCT_TERMIOS struct termio 
1618d522f475Smrg#endif 
1619d522f475Smrg#include <curses.h>
1620d522f475Smrg#include <term.h>		/* eliminate most BSD hacks */
1621d522f475Smrg#include <errno.h>		/* declare sys_errlist on older systems */
1622d522f475Smrg#include <sys/termio.h>		/* eliminate most of the remaining ones */
1623d522f475Smrg],[
1624d522f475Smrgstatic STRUCT_TERMIOS d_tio;
1625d522f475Smrg	d_tio.c_cc[VINTR] = 0;
1626d522f475Smrg	d_tio.c_cc[VQUIT] = 0;
1627d522f475Smrg	d_tio.c_cc[VERASE] = 0;
1628d522f475Smrg	d_tio.c_cc[VKILL] = 0;
1629d522f475Smrg	d_tio.c_cc[VEOF] = 0;
1630d522f475Smrg	d_tio.c_cc[VEOL] = 0;
1631d522f475Smrg	d_tio.c_cc[VMIN] = 0;
1632d522f475Smrg	d_tio.c_cc[VTIME] = 0;
1633d522f475Smrg#if defined(HAVE_SYS_ERRLIST) && !defined(DECL_SYS_ERRLIST)
1634d522f475Smrgsys_errlist[0] = "";		/* Cygwin mis-declares this */
1635d522f475Smrg#endif
1636d522f475Smrg],
1637d522f475Smrg[cf_cv_sysv=yes],
1638d522f475Smrg[cf_cv_sysv=no])
1639d522f475Smrg])
1640d522f475Smrgtest "$cf_cv_sysv" = yes && AC_DEFINE(SYSV)
1641d522f475Smrg])dnl
1642d522f475Smrgdnl ---------------------------------------------------------------------------
1643d522f475Smrgdnl CF_SYSV_UTMP version: 5 updated: 2001/12/27 12:55:07
1644d522f475Smrgdnl ------------
1645d522f475Smrgdnl Check if this is a SYSV flavor of UTMP
1646d522f475SmrgAC_DEFUN([CF_SYSV_UTMP],
1647d522f475Smrg[
1648d522f475SmrgAC_CACHE_CHECK(if $cf_cv_have_utmp is SYSV flavor,cf_cv_sysv_utmp,[
1649d522f475Smrgtest "$cf_cv_have_utmp" = "utmp" && cf_prefix="ut" || cf_prefix="utx"
1650d522f475SmrgAC_TRY_LINK([
1651d522f475Smrg#include <sys/types.h>
1652d522f475Smrg#include <${cf_cv_have_utmp}.h>],[
1653d522f475Smrgstruct $cf_cv_have_utmp x;
1654d522f475Smrg	set${cf_prefix}ent ();
1655d522f475Smrg	get${cf_prefix}id(&x);
1656d522f475Smrg	put${cf_prefix}line(&x);
1657d522f475Smrg	end${cf_prefix}ent();],
1658d522f475Smrg	[cf_cv_sysv_utmp=yes],
1659d522f475Smrg	[cf_cv_sysv_utmp=no])
1660d522f475Smrg])
1661d522f475Smrgtest $cf_cv_sysv_utmp = yes && AC_DEFINE(USE_SYSV_UTMP)
1662d522f475Smrg])dnl
1663d522f475Smrgdnl ---------------------------------------------------------------------------
1664d522f475Smrgdnl CF_SYS_ERRLIST version: 6 updated: 2001/12/30 13:03:23
1665d522f475Smrgdnl --------------
1666d522f475Smrgdnl Check for declaration of sys_nerr and sys_errlist in one of stdio.h and
1667d522f475Smrgdnl errno.h.  Declaration of sys_errlist on BSD4.4 interferes with our
1668d522f475Smrgdnl declaration.  Reported by Keith Bostic.
1669d522f475SmrgAC_DEFUN([CF_SYS_ERRLIST],
1670d522f475Smrg[
1671d522f475Smrg    CF_CHECK_ERRNO(sys_nerr)
1672d522f475Smrg    CF_CHECK_ERRNO(sys_errlist)
1673d522f475Smrg])dnl
1674d522f475Smrgdnl ---------------------------------------------------------------------------
1675d522f475Smrgdnl CF_TERMIO_C_ISPEED version: 2 updated: 2000/05/29 16:16:04
1676d522f475Smrgdnl ------------------
1677d522f475Smrgdnl Check for SGI's broken redefinition of baud rates introduced in IRIX 6.5
1678d522f475Smrgdnl (there doesn't appear to be a useful predefined symbol).
1679d522f475SmrgAC_DEFUN([CF_TERMIO_C_ISPEED],
1680d522f475Smrg[
1681d522f475SmrgAC_CACHE_CHECK(for IRIX 6.5 baud-rate redefinitions,cf_cv_termio_c_ispeed,[
1682d522f475SmrgAC_TRY_COMPILE([
1683d522f475Smrg#include <sys/types.h>
1684d522f475Smrg#include <sys/termio.h>],[
1685d522f475Smrgstruct termio foo;
1686d522f475Smrgfoo.c_ispeed = B38400;
1687d522f475Smrgfoo.c_ospeed = B9600;
1688d522f475Smrg],[cf_cv_termio_c_ispeed=yes
1689d522f475Smrg],[cf_cv_termio_c_ispeed=no])
1690d522f475Smrg])
1691d522f475Smrgtest "$cf_cv_termio_c_ispeed" = yes && AC_DEFINE(HAVE_TERMIO_C_ISPEED)
1692d522f475Smrg])dnl
1693d522f475Smrgdnl ---------------------------------------------------------------------------
1694d522f475Smrgdnl CF_TTY_GROUP version: 7 updated: 2007/03/14 16:43:59
1695d522f475Smrgdnl ------------
1696d522f475Smrgdnl Check if the system has a tty-group defined.  This is used in xterm when
1697d522f475Smrgdnl setting pty ownership.
1698d522f475SmrgAC_DEFUN([CF_TTY_GROUP],
1699d522f475Smrg[
1700d522f475SmrgAC_MSG_CHECKING(for explicit tty group name)
1701d522f475SmrgAC_ARG_WITH(tty-group,
1702d522f475Smrg	[  --with-tty-group=XXX    use XXX for the tty-group],
1703d522f475Smrg	[cf_tty_group=$withval],
1704d522f475Smrg	[cf_tty_group=auto...])
1705d522f475Smrgtest -z "$cf_tty_group"    && cf_tty_group=auto...
1706d522f475Smrgtest "$cf_tty_group" = yes && cf_tty_group=auto...
1707d522f475SmrgAC_MSG_RESULT($cf_tty_group)
1708d522f475Smrg
1709d522f475Smrgif test "$cf_tty_group" = "auto..." ; then
1710d522f475SmrgAC_CACHE_CHECK(for tty group name,cf_cv_tty_group_name,[
1711d522f475Smrg
1712d522f475Smrg# If we are configuring as root, it is hard to get a clue about the tty group.
1713d522f475Smrg# But we'll guess based on how our connection is set up - assuming it is done
1714d522f475Smrg# properly.
1715d522f475Smrg
1716d522f475Smrgcf_uid=`id | sed -e 's/^[^=]*=//' -e 's/(.*$//'`
1717d522f475Smrg# )vi
1718d522f475Smrgif test "$cf_uid" != 0 ; then
1719d522f475Smrgcf_cv_tty_group_name=
1720d522f475Smrgcf_tty_name=`tty`
1721d522f475Smrgtest "$cf_tty_name" = "not a tty" && cf_tty_name=/dev/tty
1722d522f475Smrgtest -z "$cf_tty_name" && cf_tty_name=/dev/tty
1723d522f475Smrgif test -c "$cf_tty_name"
1724d522f475Smrgthen
1725d522f475Smrg	cf_option="-l -L"
1726d522f475Smrg
1727d522f475Smrg	# Expect listing to have fields like this:
1728d522f475Smrg	#-rwxrwxrwx   1 user      group       34293 Jul 18 16:29 pathname
1729d522f475Smrg	ls $cf_option $cf_tty_name >conftest.out
1730d522f475Smrg	read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest <conftest.out
1731d522f475Smrg	if test -z "$cf_rest" ; then
1732d522f475Smrg		cf_option="$cf_option -g"
1733d522f475Smrg		ls $cf_option $cf_tty_name >conftest.out
1734d522f475Smrg		read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest <conftest.out
1735d522f475Smrg	fi
1736d522f475Smrg	rm -f conftest.out
1737d522f475Smrg	cf_cv_tty_group_name=$cf_grp
1738d522f475Smrgfi
1739d522f475Smrgfi
1740d522f475Smrg
1741d522f475Smrg# If we cannot deduce the tty group, fall back on hardcoded cases
1742d522f475Smrg
1743d522f475Smrgif test -z "$cf_cv_tty_group_name"
1744d522f475Smrgthen
1745d522f475Smrgcase $host_os in #(vi
1746d522f475Smrgosf*) #(vi
1747d522f475Smrg	cf_cv_tty_group_name="terminal"
1748d522f475Smrg	;;
1749d522f475Smrg*)
1750d522f475Smrg	cf_cv_tty_group_name="unknown"
1751d522f475Smrg	if ( egrep '^tty:' /etc/group 2>/dev/null 1>/dev/null ) then
1752d522f475Smrg		cf_cv_tty_group_name="tty"
1753d522f475Smrg	fi
1754d522f475Smrg	;;
1755d522f475Smrgesac
1756d522f475Smrgfi
1757d522f475Smrg])
1758d522f475Smrgcf_tty_group="$cf_cv_tty_group_name"
1759d522f475Smrgelse
1760d522f475Smrg	# if configure option, always do this
1761d522f475Smrg	AC_DEFINE(USE_TTY_GROUP)
1762d522f475Smrgfi
1763d522f475Smrg
1764d522f475SmrgAC_DEFINE_UNQUOTED(TTY_GROUP_NAME,"$cf_tty_group")
1765d522f475Smrg
1766d522f475Smrg# This is only a double-check that the group-name we obtained above really
1767d522f475Smrg# does apply to the device.  We cannot perform this test if we are in batch
1768d522f475Smrg# mode, or if we are cross-compiling.
1769d522f475Smrg
1770d522f475SmrgAC_CACHE_CHECK(if we may use the $cf_tty_group group,cf_cv_tty_group,[
1771d522f475Smrgcf_tty_name=`tty`
1772d522f475Smrgif test "$cf_tty_name" != "not a tty"
1773d522f475Smrgthen
1774d522f475SmrgAC_TRY_RUN([
1775d522f475Smrg#include <unistd.h>
1776d522f475Smrg#include <sys/types.h>
1777d522f475Smrg#include <sys/stat.h>
1778d522f475Smrg#include <grp.h>
1779d522f475Smrgint main()
1780d522f475Smrg{
1781d522f475Smrg	struct stat sb;
1782d522f475Smrg	struct group *ttygrp = getgrnam(TTY_GROUP_NAME);
1783d522f475Smrg	char *name = ttyname(0);
1784d522f475Smrg
1785d522f475Smrg	endgrent();
1786d522f475Smrg	if (ttygrp != 0
1787d522f475Smrg	 && name != 0
1788d522f475Smrg	 && stat(name, &sb) == 0
1789d522f475Smrg	 && sb.st_gid != getgid()
1790d522f475Smrg	 && sb.st_gid == ttygrp->gr_gid) {
1791d522f475Smrg		${cf_cv_main_return:-return} (0);
1792d522f475Smrg	}
1793d522f475Smrg	${cf_cv_main_return:-return} (1);
1794d522f475Smrg}
1795d522f475Smrg	],
1796d522f475Smrg	[cf_cv_tty_group=yes],
1797d522f475Smrg	[cf_cv_tty_group=no],
1798d522f475Smrg	[cf_cv_tty_group=unknown])
1799d522f475Smrgelif test "$cross_compiling" = yes; then
1800d522f475Smrg	cf_cv_tty_group=unknown
1801d522f475Smrgelse
1802d522f475Smrg	cf_cv_tty_group=yes
1803d522f475Smrgfi
1804d522f475Smrg])
1805d522f475Smrg
1806d522f475Smrgif test $cf_cv_tty_group = no ; then
1807d522f475Smrg	AC_MSG_WARN(Cannot use $cf_tty_group group)
1808d522f475Smrgelse
1809d522f475Smrg	AC_DEFINE(USE_TTY_GROUP)
1810d522f475Smrgfi
1811d522f475Smrg])dnl
1812d522f475Smrgdnl ---------------------------------------------------------------------------
18132eaa94a1Schristosdnl CF_TYPE_FD_MASK version: 2 updated: 2008/03/25 20:59:57
1814d522f475Smrgdnl ---------------
1815d522f475Smrgdnl Check for the declaration of fd_mask, which is like fd_set, associated
1816d522f475Smrgdnl with select().  The check for fd_set should have pulled in this as well,
1817d522f475Smrgdnl but there is a special case for Mac OS X, possibly other BSD-derived
1818d522f475Smrgdnl platforms.
1819d522f475SmrgAC_DEFUN([CF_TYPE_FD_MASK],
1820d522f475Smrg[
1821d522f475SmrgAC_REQUIRE([CF_TYPE_FD_SET])
1822d522f475Smrg
1823d522f475SmrgAC_CACHE_CHECK(for declaration of fd_mask,cf_cv_type_fd_mask,[
1824d522f475Smrg    if test x$cf_cv_type_fd_set = xX11/Xpoll.h ; then
1825d522f475Smrg        AC_TRY_COMPILE([
1826d522f475Smrg#include <X11/Xpoll.h>],[fd_mask x],,
1827d522f475Smrg        [CF_MSG_LOG(if we must define CSRG_BASED)
1828d522f475Smrg# Xosdefs.h on Mac OS X may not define this (but it should).
1829d522f475Smrg            AC_TRY_COMPILE([
1830d522f475Smrg#define CSRG_BASED
1831d522f475Smrg#include <X11/Xpoll.h>],[fd_mask x],
1832d522f475Smrg        cf_cv_type_fd_mask=CSRG_BASED)])
1833d522f475Smrg    else
1834d522f475Smrg        cf_cv_type_fd_mask=$cf_cv_type_fd_set
1835d522f475Smrg    fi
1836d522f475Smrg])
1837d522f475Smrgif test x$cf_cv_type_fd_mask = xCSRG_BASED ; then
1838d522f475Smrg    AC_DEFINE(CSRG_BASED)
1839d522f475Smrgfi
1840d522f475Smrg])dnl
1841d522f475Smrgdnl ---------------------------------------------------------------------------
1842d522f475Smrgdnl CF_TYPE_FD_SET version: 4 updated: 2008/03/25 20:56:03
1843d522f475Smrgdnl --------------
1844d522f475Smrgdnl Check for the declaration of fd_set.  Some platforms declare it in
1845d522f475Smrgdnl <sys/types.h>, and some in <sys/select.h>, which requires <sys/types.h>.
1846d522f475Smrgdnl Finally, if we are using this for an X application, Xpoll.h may include
1847d522f475Smrgdnl <sys/select.h>, so we don't want to do it twice.
1848d522f475SmrgAC_DEFUN([CF_TYPE_FD_SET],
1849d522f475Smrg[
1850d522f475SmrgAC_CHECK_HEADERS(X11/Xpoll.h)
1851d522f475Smrg
1852d522f475SmrgAC_CACHE_CHECK(for declaration of fd_set,cf_cv_type_fd_set,
1853d522f475Smrg	[CF_MSG_LOG(sys/types alone)
1854d522f475SmrgAC_TRY_COMPILE([
1855d522f475Smrg#include <sys/types.h>],
1856d522f475Smrg	[fd_set x],
1857d522f475Smrg	[cf_cv_type_fd_set=sys/types.h],
1858d522f475Smrg	[CF_MSG_LOG(X11/Xpoll.h)
1859d522f475SmrgAC_TRY_COMPILE([
1860d522f475Smrg#ifdef HAVE_X11_XPOLL_H
1861d522f475Smrg#include <X11/Xpoll.h>
1862d522f475Smrg#endif],
1863d522f475Smrg	[fd_set x],
1864d522f475Smrg	[cf_cv_type_fd_set=X11/Xpoll.h],
1865d522f475Smrg	[CF_MSG_LOG(sys/select.h)
1866d522f475SmrgAC_TRY_COMPILE([
1867d522f475Smrg#include <sys/types.h>
1868d522f475Smrg#include <sys/select.h>],
1869d522f475Smrg	[fd_set x],
1870d522f475Smrg	[cf_cv_type_fd_set=sys/select.h],
1871d522f475Smrg	[cf_cv_type_fd_set=unknown])])])])
1872d522f475Smrgif test $cf_cv_type_fd_set = sys/select.h ; then
1873d522f475Smrg	AC_DEFINE(USE_SYS_SELECT_H)
1874d522f475Smrgfi
1875d522f475Smrg])
1876d522f475Smrgdnl ---------------------------------------------------------------------------
1877d522f475Smrgdnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59
1878d522f475Smrgdnl --------
1879d522f475Smrgdnl Make an uppercase version of a variable
1880d522f475Smrgdnl $1=uppercase($2)
1881d522f475SmrgAC_DEFUN([CF_UPPER],
1882d522f475Smrg[
1883d522f475Smrg$1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
1884d522f475Smrg])dnl
1885d522f475Smrgdnl ---------------------------------------------------------------------------
1886d522f475Smrgdnl CF_UTEMPTER version: 2 updated: 2000/01/22 22:50:59
1887d522f475Smrgdnl -----------
1888d522f475Smrgdnl Try to link with utempter library
1889d522f475SmrgAC_DEFUN([CF_UTEMPTER],
1890d522f475Smrg[
1891d522f475SmrgAC_CACHE_CHECK(if we can link with utempter library,cf_cv_have_utempter,[
1892d522f475Smrgcf_save_LIBS="$LIBS"
1893d522f475SmrgLIBS="-lutempter $LIBS"
1894d522f475SmrgAC_TRY_LINK([
1895d522f475Smrg#include <utempter.h>
1896d522f475Smrg],[
1897d522f475Smrg	addToUtmp("/dev/tty", 0, 1);
1898d522f475Smrg	removeFromUtmp();
1899d522f475Smrg],[
1900d522f475Smrg	cf_cv_have_utempter=yes],[
1901d522f475Smrg	cf_cv_have_utempter=no])
1902d522f475SmrgLIBS="$cf_save_LIBS"
1903d522f475Smrg])
1904d522f475Smrgif test "$cf_cv_have_utempter" = yes ; then
1905d522f475Smrg	AC_DEFINE(USE_UTEMPTER)
1906d522f475Smrg	LIBS="-lutempter $LIBS"
1907d522f475Smrgfi
1908d522f475Smrg])dnl
1909d522f475Smrgdnl ---------------------------------------------------------------------------
1910d522f475Smrgdnl CF_UTMP version: 9 updated: 2008/01/25 17:18:00
1911d522f475Smrgdnl -------
1912d522f475Smrgdnl Check for UTMP/UTMPX headers
1913d522f475SmrgAC_DEFUN([CF_UTMP],
1914d522f475Smrg[
1915d522f475SmrgAC_REQUIRE([CF_LASTLOG])
1916d522f475Smrg
1917d522f475SmrgAC_CACHE_CHECK(for utmp implementation,cf_cv_have_utmp,[
1918d522f475Smrg	cf_cv_have_utmp=no
1919d522f475Smrgfor cf_header in utmpx utmp ; do
1920d522f475Smrgcf_utmp_includes="
1921d522f475Smrg#include <sys/types.h>
1922d522f475Smrg#include <${cf_header}.h>
1923d522f475Smrg#define getutent getutxent
1924d522f475Smrg#ifdef USE_LASTLOG
1925d522f475Smrg#include <lastlog.h>	/* may conflict with utmpx.h on Linux */
1926d522f475Smrg#endif
1927d522f475Smrg"
1928d522f475Smrg	AC_TRY_COMPILE([$cf_utmp_includes],
1929d522f475Smrg	[struct $cf_header x;
1930d522f475Smrg	 char *name = x.ut_name; /* utmp.h and compatible definitions */
1931d522f475Smrg	],
1932d522f475Smrg	[cf_cv_have_utmp=$cf_header
1933d522f475Smrg	 break],
1934d522f475Smrg	[
1935d522f475Smrg	AC_TRY_COMPILE([$cf_utmp_includes],
1936d522f475Smrg	[struct $cf_header x;
1937d522f475Smrg	 char *name = x.ut_user; /* utmpx.h must declare this */
1938d522f475Smrg	],
1939d522f475Smrg	[cf_cv_have_utmp=$cf_header
1940d522f475Smrg	 break
1941d522f475Smrg	])])
1942d522f475Smrgdone
1943d522f475Smrg])
1944d522f475Smrg
1945d522f475Smrgif test $cf_cv_have_utmp != no ; then
1946d522f475Smrg	AC_DEFINE(HAVE_UTMP)
1947d522f475Smrg	test $cf_cv_have_utmp = utmpx && AC_DEFINE(UTMPX_FOR_UTMP)
1948d522f475Smrg	CF_UTMP_UT_HOST
1949d522f475Smrg	CF_UTMP_UT_SYSLEN
1950d522f475Smrg	CF_UTMP_UT_NAME
1951d522f475Smrg	CF_UTMP_UT_XSTATUS
1952d522f475Smrg	CF_UTMP_UT_XTIME
1953d522f475Smrg	CF_UTMP_UT_SESSION
1954d522f475Smrg	CF_SYSV_UTMP
1955d522f475Smrgfi
1956d522f475Smrg])dnl
1957d522f475Smrgdnl ---------------------------------------------------------------------------
1958d522f475Smrgdnl CF_UTMP_GROUP version: 1 updated: 2005/10/06 20:29:29
1959d522f475Smrgdnl -------------
1960d522f475Smrgdnl Find the utmp/utmpx file and determine its group to allow setgid programs
1961d522f475Smrgdnl to manipulate it, e.g., when there is no intermediary.
1962d522f475SmrgAC_DEFUN([CF_UTMP_GROUP],[
1963d522f475SmrgAC_REQUIRE([CF_UTMP])
1964d522f475Smrgif test $cf_cv_have_utmp != no ; then
1965d522f475SmrgAC_CACHE_CHECK(for utmp/utmpx group,cf_cv_utmp_group,[
1966d522f475Smrgfor cf_utmp_path in /var/adm /var/run
1967d522f475Smrgdo
1968d522f475Smrg	for cf_utmp_file in utmpx utmp
1969d522f475Smrg	do
1970d522f475Smrg		if test -f $cf_utmp_path/$cf_utmp_file
1971d522f475Smrg		then
1972d522f475Smrg			cf_cv_utmp_group=root
1973d522f475Smrg
1974d522f475Smrg			cf_option="-l -L"
1975d522f475Smrg
1976d522f475Smrg			# Expect listing to have fields like this:
1977d522f475Smrg			#-r--r--r--   1 user      group       34293 Jul 18 16:29 pathname
1978d522f475Smrg			ls $cf_option $cf_utmp_path/$cf_utmp_file >conftest
1979d522f475Smrg			read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest <conftest
1980d522f475Smrg			if test -z "$cf_rest" ; then
1981d522f475Smrg				cf_option="$cf_option -g"
1982d522f475Smrg				ls $cf_option $cf_utmp_path/$cf_utmp_file >conftest
1983d522f475Smrg				read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest <conftest
1984d522f475Smrg			fi
1985d522f475Smrg			rm -f conftest
1986d522f475Smrg
1987d522f475Smrg			# If we have a pathname, and the date fields look right, assume we've
1988d522f475Smrg			# captured the group as well.
1989d522f475Smrg			if test -n "$cf_rest" ; then
1990d522f475Smrg				cf_test=`echo "${cf_date2}${cf_date3}" | sed -e 's/[[0-9:]]//g'`
1991d522f475Smrg				if test -z "$cf_test" ; then
1992d522f475Smrg					cf_cv_utmp_group=$cf_grp;
1993d522f475Smrg				fi
1994d522f475Smrg			fi
1995d522f475Smrg			break
1996d522f475Smrg		fi
1997d522f475Smrg	done
1998d522f475Smrg	test -n "$cf_cv_utmp_group" && break
1999d522f475Smrgdone
2000d522f475Smrg])
2001d522f475Smrgelse
2002d522f475Smrg	AC_MSG_ERROR(cannot find utmp group)
2003d522f475Smrgfi
2004d522f475Smrg])dnl
2005d522f475Smrgdnl ---------------------------------------------------------------------------
2006d522f475Smrgdnl CF_UTMP_UT_HOST version: 7 updated: 2007/03/13 19:17:11
2007d522f475Smrgdnl ---------------
2008d522f475Smrgdnl Check if UTMP/UTMPX struct defines ut_host member
2009d522f475SmrgAC_DEFUN([CF_UTMP_UT_HOST],
2010d522f475Smrg[
2011d522f475Smrgif test $cf_cv_have_utmp != no ; then
2012d522f475SmrgAC_MSG_CHECKING(if ${cf_cv_have_utmp}.ut_host is declared)
2013d522f475SmrgAC_CACHE_VAL(cf_cv_have_utmp_ut_host,[
2014d522f475Smrg	AC_TRY_COMPILE([
2015d522f475Smrg#include <sys/types.h>
2016d522f475Smrg#include <${cf_cv_have_utmp}.h>],
2017d522f475Smrg	[struct $cf_cv_have_utmp x; char *y = &x.ut_host[0]],
2018d522f475Smrg	[cf_cv_have_utmp_ut_host=yes],
2019d522f475Smrg	[cf_cv_have_utmp_ut_host=no])
2020d522f475Smrg	])
2021d522f475SmrgAC_MSG_RESULT($cf_cv_have_utmp_ut_host)
2022d522f475Smrgtest $cf_cv_have_utmp_ut_host != no && AC_DEFINE(HAVE_UTMP_UT_HOST)
2023d522f475Smrgfi
2024d522f475Smrg])dnl
2025d522f475Smrgdnl ---------------------------------------------------------------------------
2026d522f475Smrgdnl CF_UTMP_UT_NAME version: 4 updated: 2007/03/13 19:17:11
2027d522f475Smrgdnl ---------------
2028d522f475Smrgdnl Check if UTMP/UTMPX struct defines ut_name member
2029d522f475SmrgAC_DEFUN([CF_UTMP_UT_NAME],
2030d522f475Smrg[
2031d522f475Smrgif test $cf_cv_have_utmp != no ; then
2032d522f475SmrgAC_CACHE_CHECK(if ${cf_cv_have_utmp}.ut_name is declared,cf_cv_have_utmp_ut_name,[
2033d522f475Smrg	cf_cv_have_utmp_ut_name=no
2034d522f475Smrgcf_utmp_includes="
2035d522f475Smrg#include <sys/types.h>
2036d522f475Smrg#include <${cf_cv_have_utmp}.h>
2037d522f475Smrg#define getutent getutxent
2038d522f475Smrg#ifdef USE_LASTLOG
2039d522f475Smrg#include <lastlog.h>		/* may conflict with utmpx.h on Linux */
2040d522f475Smrg#endif
2041d522f475Smrg"
2042d522f475Smrgfor cf_header in ut_name ut_user ; do
2043d522f475Smrg	AC_TRY_COMPILE([$cf_utmp_includes],
2044d522f475Smrg	[struct $cf_cv_have_utmp x;
2045d522f475Smrg	 char *name = x.$cf_header;
2046d522f475Smrg	],
2047d522f475Smrg	[cf_cv_have_utmp_ut_name=$cf_header
2048d522f475Smrg	 break])
2049d522f475Smrgdone
2050d522f475Smrg])
2051d522f475Smrg
2052d522f475Smrgcase $cf_cv_have_utmp_ut_name in #(vi
2053d522f475Smrgno) #(vi
2054d522f475Smrg	AC_MSG_ERROR(Cannot find declaration for ut.ut_name)
2055d522f475Smrg	;;
2056d522f475Smrgut_user)
2057d522f475Smrg	AC_DEFINE(ut_name,ut_user)
2058d522f475Smrg	;;
2059d522f475Smrgesac
2060d522f475Smrgfi
2061d522f475Smrg])dnl
2062d522f475Smrgdnl ---------------------------------------------------------------------------
2063d522f475Smrgdnl CF_UTMP_UT_SESSION version: 5 updated: 2007/03/13 19:17:11
2064d522f475Smrgdnl ------------------
2065d522f475Smrgdnl Check if UTMP/UTMPX struct defines ut_session member
2066d522f475SmrgAC_DEFUN([CF_UTMP_UT_SESSION],
2067d522f475Smrg[
2068d522f475Smrgif test $cf_cv_have_utmp != no ; then
2069d522f475SmrgAC_CACHE_CHECK(if ${cf_cv_have_utmp}.ut_session is declared, cf_cv_have_utmp_ut_session,[
2070d522f475Smrg	AC_TRY_COMPILE([
2071d522f475Smrg#include <sys/types.h>
2072d522f475Smrg#include <${cf_cv_have_utmp}.h>],
2073d522f475Smrg	[struct $cf_cv_have_utmp x; long y = x.ut_session],
2074d522f475Smrg	[cf_cv_have_utmp_ut_session=yes],
2075d522f475Smrg	[cf_cv_have_utmp_ut_session=no])
2076d522f475Smrg])
2077d522f475Smrgif test $cf_cv_have_utmp_ut_session != no ; then
2078d522f475Smrg	AC_DEFINE(HAVE_UTMP_UT_SESSION)
2079d522f475Smrgfi
2080d522f475Smrgfi
2081d522f475Smrg])dnl
2082d522f475Smrgdnl ---------------------------------------------------------------------------
2083d522f475Smrgdnl CF_UTMP_UT_SYSLEN version: 1 updated: 2008/01/25 17:18:00
2084d522f475Smrgdnl -----------------
2085d522f475Smrgdnl Check if UTMP/UTMPX struct defines ut_syslen member
2086d522f475SmrgAC_DEFUN([CF_UTMP_UT_SYSLEN],
2087d522f475Smrg[
2088d522f475Smrgif test $cf_cv_have_utmp != no ; then
2089d522f475SmrgAC_MSG_CHECKING(if ${cf_cv_have_utmp}.ut_syslen is declared)
2090d522f475SmrgAC_CACHE_VAL(cf_cv_have_utmp_ut_syslen,[
2091d522f475Smrg	AC_TRY_COMPILE([
2092d522f475Smrg#include <sys/types.h>
2093d522f475Smrg#include <${cf_cv_have_utmp}.h>],
2094d522f475Smrg	[struct $cf_cv_have_utmp x; int y = x.ut_syslen],
2095d522f475Smrg	[cf_cv_have_utmp_ut_syslen=yes],
2096d522f475Smrg	[cf_cv_have_utmp_ut_syslen=no])
2097d522f475Smrg	])
2098d522f475SmrgAC_MSG_RESULT($cf_cv_have_utmp_ut_syslen)
2099d522f475Smrgtest $cf_cv_have_utmp_ut_syslen != no && AC_DEFINE(HAVE_UTMP_UT_SYSLEN)
2100d522f475Smrgfi
2101d522f475Smrg])dnl
2102d522f475Smrgdnl ---------------------------------------------------------------------------
2103d522f475Smrgdnl CF_UTMP_UT_XSTATUS version: 3 updated: 2001/12/27 12:55:07
2104d522f475Smrgdnl ------------------
2105d522f475Smrgdnl Check for known variants on the UTMP/UTMPX struct's exit-status as reported
2106d522f475Smrgdnl by various people:
2107d522f475Smrgdnl
2108d522f475Smrgdnl	ut_exit.__e_exit (HPUX 11 - David Ellement, also in glibc2)
2109d522f475Smrgdnl	ut_exit.e_exit (SVR4)
2110d522f475Smrgdnl	ut_exit.ut_e_exit (os390 - Greg Smith)
2111d522f475Smrgdnl	ut_exit.ut_exit (Tru64 4.0f - Jeremie Petit, 4.0e - Tomas Vanhala)
2112d522f475Smrgdnl
2113d522f475Smrgdnl Note: utmp_xstatus is not a conventional compatibility definition in the
2114d522f475Smrgdnl system header files.
2115d522f475SmrgAC_DEFUN([CF_UTMP_UT_XSTATUS],
2116d522f475Smrg[
2117d522f475Smrgif test $cf_cv_have_utmp != no ; then
2118d522f475SmrgAC_CACHE_CHECK(for exit-status in $cf_cv_have_utmp,cf_cv_have_utmp_ut_xstatus,[
2119d522f475Smrgfor cf_result in \
2120d522f475Smrg	ut_exit.__e_exit \
2121d522f475Smrg	ut_exit.e_exit \
2122d522f475Smrg	ut_exit.ut_e_exit \
2123d522f475Smrg	ut_exit.ut_exit
2124d522f475Smrgdo
2125d522f475SmrgAC_TRY_COMPILE([
2126d522f475Smrg#include <sys/types.h>
2127d522f475Smrg#include <${cf_cv_have_utmp}.h>],
2128d522f475Smrg	[struct $cf_cv_have_utmp x; long y = x.$cf_result = 0],
2129d522f475Smrg	[cf_cv_have_utmp_ut_xstatus=$cf_result
2130d522f475Smrg	 break],
2131d522f475Smrg	[cf_cv_have_utmp_ut_xstatus=no])
2132d522f475Smrgdone
2133d522f475Smrg])
2134d522f475Smrgif test $cf_cv_have_utmp_ut_xstatus != no ; then
2135d522f475Smrg	AC_DEFINE(HAVE_UTMP_UT_XSTATUS)
2136d522f475Smrg	AC_DEFINE_UNQUOTED(ut_xstatus,$cf_cv_have_utmp_ut_xstatus)
2137d522f475Smrgfi
2138d522f475Smrgfi
2139d522f475Smrg])dnl
2140d522f475Smrgdnl ---------------------------------------------------------------------------
2141d522f475Smrgdnl CF_UTMP_UT_XTIME version: 7 updated: 2007/03/13 19:17:11
2142d522f475Smrgdnl ----------------
2143d522f475Smrgdnl Check if UTMP/UTMPX struct defines ut_xtime member
2144d522f475SmrgAC_DEFUN([CF_UTMP_UT_XTIME],
2145d522f475Smrg[
2146d522f475Smrgif test $cf_cv_have_utmp != no ; then
2147d522f475SmrgAC_CACHE_CHECK(if ${cf_cv_have_utmp}.ut_xtime is declared, cf_cv_have_utmp_ut_xtime,[
2148d522f475Smrg	AC_TRY_COMPILE([
2149d522f475Smrg#include <sys/types.h>
2150d522f475Smrg#include <${cf_cv_have_utmp}.h>],
2151d522f475Smrg	[struct $cf_cv_have_utmp x; long y = x.ut_xtime = 0],
2152d522f475Smrg	[cf_cv_have_utmp_ut_xtime=yes],
2153d522f475Smrg	[AC_TRY_COMPILE([
2154d522f475Smrg#include <sys/types.h>
2155d522f475Smrg#include <${cf_cv_have_utmp}.h>],
2156d522f475Smrg	[struct $cf_cv_have_utmp x; long y = x.ut_tv.tv_sec],
2157d522f475Smrg	[cf_cv_have_utmp_ut_xtime=define],
2158d522f475Smrg	[cf_cv_have_utmp_ut_xtime=no])
2159d522f475Smrg	])
2160d522f475Smrg])
2161d522f475Smrgif test $cf_cv_have_utmp_ut_xtime != no ; then
2162d522f475Smrg	AC_DEFINE(HAVE_UTMP_UT_XTIME)
2163d522f475Smrg	if test $cf_cv_have_utmp_ut_xtime = define ; then
2164d522f475Smrg		AC_DEFINE(ut_xtime,ut_tv.tv_sec)
2165d522f475Smrg	fi
2166d522f475Smrgfi
2167d522f475Smrgfi
2168d522f475Smrg])dnl
2169d522f475Smrgdnl ---------------------------------------------------------------------------
2170d522f475Smrgdnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12
2171d522f475Smrgdnl ----------
2172d522f475Smrgdnl Use AC_VERBOSE w/o the warnings
2173d522f475SmrgAC_DEFUN([CF_VERBOSE],
2174d522f475Smrg[test -n "$verbose" && echo "	$1" 1>&AC_FD_MSG
2175d522f475SmrgCF_MSG_LOG([$1])
2176d522f475Smrg])dnl
2177d522f475Smrgdnl ---------------------------------------------------------------------------
2178d522f475Smrgdnl CF_WITH_IMAKE_CFLAGS version: 8 updated: 2005/11/02 15:04:41
2179d522f475Smrgdnl --------------------
2180d522f475Smrgdnl xterm and similar programs build more readily when propped up with imake's
2181d522f475Smrgdnl hand-tuned definitions.  If we do not use imake, provide fallbacks for the
2182d522f475Smrgdnl most common definitions that we're not likely to do by autoconf tests.
2183d522f475SmrgAC_DEFUN([CF_WITH_IMAKE_CFLAGS],[
2184d522f475SmrgAC_REQUIRE([CF_ENABLE_NARROWPROTO])
2185d522f475Smrg
2186d522f475SmrgAC_MSG_CHECKING(if we should use imake to help)
2187d522f475SmrgCF_ARG_DISABLE(imake,
2188d522f475Smrg	[  --disable-imake         disable use of imake for definitions],
2189d522f475Smrg	[enable_imake=no],
2190d522f475Smrg	[enable_imake=yes])
2191d522f475SmrgAC_MSG_RESULT($enable_imake)
2192d522f475Smrg
2193d522f475Smrgif test "$enable_imake" = yes ; then
2194d522f475Smrg	CF_IMAKE_CFLAGS(ifelse($1,,,$1))
2195d522f475Smrgfi
2196d522f475Smrg
2197d522f475Smrgif test -n "$IMAKE" && test -n "$IMAKE_CFLAGS" ; then
2198d522f475Smrg	CF_ADD_CFLAGS($IMAKE_CFLAGS)
2199d522f475Smrgelse
2200d522f475Smrg	IMAKE_CFLAGS=
2201d522f475Smrg	IMAKE_LOADFLAGS=
2202d522f475Smrg	CF_VERBOSE(make fallback definitions)
2203d522f475Smrg
2204d522f475Smrg	# We prefer config.guess' values when we can get them, to avoid
2205d522f475Smrg	# inconsistent results with uname (AIX for instance).  However,
2206d522f475Smrg	# config.guess is not always consistent either.
2207d522f475Smrg	case $host_os in
2208d522f475Smrg	*[[0-9]].[[0-9]]*)
2209d522f475Smrg		UNAME_RELEASE="$host_os"
2210d522f475Smrg		;;
2211d522f475Smrg	*)
2212d522f475Smrg		UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
2213d522f475Smrg		;;
2214d522f475Smrg	esac
2215d522f475Smrg
2216d522f475Smrg	case .$UNAME_RELEASE in
2217d522f475Smrg	*[[0-9]].[[0-9]]*)
2218d522f475Smrg		OSMAJORVERSION=`echo "$UNAME_RELEASE" |sed -e 's/^[[^0-9]]*//' -e 's/\..*//'`
2219d522f475Smrg		OSMINORVERSION=`echo "$UNAME_RELEASE" |sed -e 's/^[[^0-9]]*//' -e 's/^[[^.]]*\.//' -e 's/\..*//' -e 's/[[^0-9]].*//' `
2220d522f475Smrg		test -z "$OSMAJORVERSION" && OSMAJORVERSION=1
2221d522f475Smrg		test -z "$OSMINORVERSION" && OSMINORVERSION=0
2222d522f475Smrg		IMAKE_CFLAGS="-DOSMAJORVERSION=$OSMAJORVERSION -DOSMINORVERSION=$OSMINORVERSION $IMAKE_CFLAGS"
2223d522f475Smrg		;;
2224d522f475Smrg	esac
2225d522f475Smrg
2226d522f475Smrg	# FUNCPROTO is standard with X11R6, but XFree86 drops it, leaving some
2227d522f475Smrg	# fallback/fragments for NeedPrototypes, etc.
2228d522f475Smrg	IMAKE_CFLAGS="-DFUNCPROTO=15 $IMAKE_CFLAGS"
2229d522f475Smrg
2230d522f475Smrg	# If this is not set properly, Xaw's scrollbars will not work
2231d522f475Smrg	if test "$enable_narrowproto" = yes ; then
2232d522f475Smrg		IMAKE_CFLAGS="-DNARROWPROTO=1 $IMAKE_CFLAGS"
2233d522f475Smrg	fi
2234d522f475Smrg
2235d522f475Smrg	# Other special definitions:
2236d522f475Smrg	case $host_os in
2237d522f475Smrg	aix*)
2238d522f475Smrg		# imake on AIX 5.1 defines AIXV3.  really.
2239d522f475Smrg		IMAKE_CFLAGS="-DAIXV3 -DAIXV4 $IMAKE_CFLAGS"
2240d522f475Smrg		;;
2241d522f475Smrg	irix[[56]].*) #(vi
2242d522f475Smrg		# these are needed to make SIGWINCH work in xterm
2243d522f475Smrg		IMAKE_CFLAGS="-DSYSV -DSVR4 $IMAKE_CFLAGS"
2244d522f475Smrg		;;
2245d522f475Smrg	esac
2246d522f475Smrg
2247d522f475Smrg	CF_ADD_CFLAGS($IMAKE_CFLAGS)
2248d522f475Smrg
2249d522f475Smrg	AC_SUBST(IMAKE_CFLAGS)
2250d522f475Smrg	AC_SUBST(IMAKE_LOADFLAGS)
2251d522f475Smrgfi
2252d522f475Smrg])dnl
2253d522f475Smrgdnl ---------------------------------------------------------------------------
2254d522f475Smrgdnl CF_WITH_PATH version: 8 updated: 2007/05/13 13:16:35
2255d522f475Smrgdnl ------------
2256d522f475Smrgdnl Wrapper for AC_ARG_WITH to ensure that user supplies a pathname, not just
2257d522f475Smrgdnl defaulting to yes/no.
2258d522f475Smrgdnl
2259d522f475Smrgdnl $1 = option name
2260d522f475Smrgdnl $2 = help-text
2261d522f475Smrgdnl $3 = environment variable to set
2262d522f475Smrgdnl $4 = default value, shown in the help-message, must be a constant
2263d522f475Smrgdnl $5 = default value, if it's an expression & cannot be in the help-message
2264d522f475Smrgdnl
2265d522f475SmrgAC_DEFUN([CF_WITH_PATH],
2266d522f475Smrg[AC_ARG_WITH($1,[$2 ](default: ifelse($4,,empty,$4)),,
2267d522f475Smrgifelse($4,,[withval="${$3}"],[withval="${$3-ifelse($5,,$4,$5)}"]))dnl
2268d522f475Smrgif ifelse($5,,true,[test -n "$5"]) ; then
2269d522f475SmrgCF_PATH_SYNTAX(withval)
2270d522f475Smrgfi
2271d522f475Smrg$3="$withval"
2272d522f475SmrgAC_SUBST($3)dnl
2273d522f475Smrg])dnl
2274d522f475Smrgdnl ---------------------------------------------------------------------------
2275d522f475Smrgdnl CF_WITH_PCRE version: 3 updated: 2006/02/12 17:28:56
2276d522f475Smrgdnl ------------
2277d522f475Smrgdnl Add PCRE (Perl-compatible regular expressions) to the build if it is
2278d522f475Smrgdnl available and the user requests it.  Assume the application will otherwise
2279d522f475Smrgdnl use the POSIX interface.
2280d522f475Smrgdnl
2281d522f475Smrgdnl TODO allow $withval to specify package location
2282d522f475SmrgAC_DEFUN([CF_WITH_PCRE],
2283d522f475Smrg[
2284d522f475SmrgAC_MSG_CHECKING(if you want to use PCRE for regular-expressions)
2285d522f475SmrgAC_ARG_WITH(pcre,
2286d522f475Smrg	[  --with-pcre             use PCRE for regular-expressions])
2287d522f475Smrgtest -z "$with_pcre" && with_pcre=no
2288d522f475SmrgAC_MSG_RESULT($with_pcre)
2289d522f475Smrg
2290d522f475Smrgif test "$with_pcre" != no ; then
2291d522f475Smrg	AC_CHECK_LIB(pcre,pcre_compile,
2292d522f475Smrg		[AC_CHECK_HEADER(pcreposix.h,
2293d522f475Smrg			[AC_CHECK_LIB(pcreposix,pcreposix_regcomp,
2294d522f475Smrg				[AC_DEFINE(HAVE_LIB_PCRE)
2295d522f475Smrg				 AC_DEFINE(HAVE_PCREPOSIX_H)
2296d522f475Smrg				 LIBS="-lpcreposix -lpcre $LIBS"],
2297d522f475Smrg				AC_MSG_ERROR(Cannot find PCRE POSIX library),
2298d522f475Smrg				"-lpcre")],
2299d522f475Smrg			AC_MSG_ERROR(Cannot find PCRE POSIX header))],
2300d522f475Smrg		AC_MSG_ERROR(Cannot find PCRE library))
2301d522f475Smrgfi
2302d522f475Smrg])dnl
2303d522f475Smrgdnl ---------------------------------------------------------------------------
2304d522f475Smrgdnl CF_XKB_BELL_EXT version: 2 updated: 2003/05/18 17:28:57
2305d522f475Smrgdnl ---------------
2306d522f475Smrgdnl Check for XKB bell extension
2307d522f475SmrgAC_DEFUN([CF_XKB_BELL_EXT],[
2308d522f475SmrgAC_CACHE_CHECK(for XKB Bell extension, cf_cv_xkb_bell_ext,[
2309d522f475SmrgAC_TRY_LINK([
2310d522f475Smrg#include <X11/XKBlib.h>		/* has the prototype */
2311d522f475Smrg#include <X11/extensions/XKBbells.h>	/* has the XkbBI_xxx definitions */
2312d522f475Smrg],[
2313d522f475Smrgint x = XkbBI_Info
2314d522f475Smrg	|XkbBI_MinorError
2315d522f475Smrg	|XkbBI_MajorError
2316d522f475Smrg	|XkbBI_TerminalBell
2317d522f475Smrg	|XkbBI_MarginBell;
2318d522f475Smrg],[cf_cv_xkb_bell_ext=yes],[cf_cv_xkb_bell_ext=no])
2319d522f475Smrg])
2320d522f475Smrg
2321d522f475Smrgtest "$cf_cv_xkb_bell_ext" = yes && AC_DEFINE(HAVE_XKB_BELL_EXT)
2322d522f475Smrg])
2323d522f475Smrgdnl ---------------------------------------------------------------------------
23242eaa94a1Schristosdnl CF_XOPEN_SOURCE version: 28 updated: 2008/12/27 12:30:03
2325d522f475Smrgdnl ---------------
2326d522f475Smrgdnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
2327d522f475Smrgdnl or adapt to the vendor's definitions to get equivalent functionality,
2328d522f475Smrgdnl without losing the common non-POSIX features.
2329d522f475Smrgdnl
2330d522f475Smrgdnl Parameters:
2331d522f475Smrgdnl	$1 is the nominal value for _XOPEN_SOURCE
2332d522f475Smrgdnl	$2 is the nominal value for _POSIX_C_SOURCE
2333d522f475SmrgAC_DEFUN([CF_XOPEN_SOURCE],[
2334d522f475Smrg
2335d522f475SmrgAC_REQUIRE([CF_PROG_CC_U_D])
2336d522f475Smrg
2337d522f475Smrgcf_XOPEN_SOURCE=ifelse($1,,500,$1)
2338d522f475Smrgcf_POSIX_C_SOURCE=ifelse($2,,199506L,$2)
2339d522f475Smrg
2340d522f475Smrgcase $host_os in #(vi
23412eaa94a1Schristosaix[[456]]*) #(vi
2342d522f475Smrg	CPPFLAGS="$CPPFLAGS -D_ALL_SOURCE"
2343d522f475Smrg	;;
23442eaa94a1Schristosfreebsd*|dragonfly*) #(vi
2345d522f475Smrg	# 5.x headers associate
2346d522f475Smrg	#	_XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L
2347d522f475Smrg	#	_XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L
2348d522f475Smrg	cf_POSIX_C_SOURCE=200112L
2349d522f475Smrg	cf_XOPEN_SOURCE=600
2350d522f475Smrg	CPPFLAGS="$CPPFLAGS -D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
2351d522f475Smrg	;;
2352d522f475Smrghpux*) #(vi
2353d522f475Smrg	CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE"
2354d522f475Smrg	;;
2355d522f475Smrgirix[[56]].*) #(vi
2356d522f475Smrg	CPPFLAGS="$CPPFLAGS -D_SGI_SOURCE"
2357d522f475Smrg	;;
23582eaa94a1Schristoslinux*|gnu*|mint*|k*bsd*-gnu) #(vi
2359d522f475Smrg	CF_GNU_SOURCE
2360d522f475Smrg	;;
2361d522f475Smrgmirbsd*) #(vi
2362d522f475Smrg	# setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h>
2363d522f475Smrg	;;
2364d522f475Smrgnetbsd*) #(vi
2365d522f475Smrg	# setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
2366d522f475Smrg	;;
2367d522f475Smrgopenbsd*) #(vi
2368d522f475Smrg	# setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
2369d522f475Smrg	;;
2370d522f475Smrgosf[[45]]*) #(vi
2371d522f475Smrg	CPPFLAGS="$CPPFLAGS -D_OSF_SOURCE"
2372d522f475Smrg	;;
2373d522f475Smrgnto-qnx*) #(vi
2374d522f475Smrg	CPPFLAGS="$CPPFLAGS -D_QNX_SOURCE"
2375d522f475Smrg	;;
2376d522f475Smrgsco*) #(vi
2377d522f475Smrg	# setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
2378d522f475Smrg	;;
2379d522f475Smrgsolaris*) #(vi
2380d522f475Smrg	CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
2381d522f475Smrg	;;
2382d522f475Smrg*)
2383d522f475Smrg	AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
2384d522f475Smrg	AC_TRY_COMPILE([#include <sys/types.h>],[
2385d522f475Smrg#ifndef _XOPEN_SOURCE
2386d522f475Smrgmake an error
2387d522f475Smrg#endif],
2388d522f475Smrg	[cf_cv_xopen_source=no],
2389d522f475Smrg	[cf_save="$CPPFLAGS"
2390d522f475Smrg	 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
2391d522f475Smrg	 AC_TRY_COMPILE([#include <sys/types.h>],[
2392d522f475Smrg#ifdef _XOPEN_SOURCE
2393d522f475Smrgmake an error
2394d522f475Smrg#endif],
2395d522f475Smrg	[cf_cv_xopen_source=no],
2396d522f475Smrg	[cf_cv_xopen_source=$cf_XOPEN_SOURCE])
2397d522f475Smrg	CPPFLAGS="$cf_save"
2398d522f475Smrg	])
2399d522f475Smrg])
2400d522f475Smrg	if test "$cf_cv_xopen_source" != no ; then
2401d522f475Smrg		CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE)
2402d522f475Smrg		CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE)
2403d522f475Smrg		test "$cf_cv_cc_u_d_options" = yes && \
2404d522f475Smrg			CPPFLAGS="$CPPFLAGS -U_XOPEN_SOURCE"
2405d522f475Smrg		CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_cv_xopen_source"
2406d522f475Smrg	fi
2407d522f475Smrg	CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
2408d522f475Smrg	;;
2409d522f475Smrgesac
2410d522f475Smrg])
2411d522f475Smrgdnl ---------------------------------------------------------------------------
2412d522f475Smrgdnl CF_X_ATHENA version: 12 updated: 2004/06/15 21:14:41
2413d522f475Smrgdnl -----------
2414d522f475Smrgdnl Check for Xaw (Athena) libraries
2415d522f475Smrgdnl
2416d522f475Smrgdnl Sets $cf_x_athena according to the flavor of Xaw which is used.
2417d522f475SmrgAC_DEFUN([CF_X_ATHENA],
2418d522f475Smrg[AC_REQUIRE([CF_X_TOOLKIT])
2419d522f475Smrgcf_x_athena=${cf_x_athena-Xaw}
2420d522f475Smrg
2421d522f475SmrgAC_MSG_CHECKING(if you want to link with Xaw 3d library)
2422d522f475Smrgwithval=
2423d522f475SmrgAC_ARG_WITH(Xaw3d,
2424d522f475Smrg	[  --with-Xaw3d            link with Xaw 3d library])
2425d522f475Smrgif test "$withval" = yes ; then
2426d522f475Smrg	cf_x_athena=Xaw3d
2427d522f475Smrg	AC_MSG_RESULT(yes)
2428d522f475Smrgelse
2429d522f475Smrg	AC_MSG_RESULT(no)
2430d522f475Smrgfi
2431d522f475Smrg
2432d522f475SmrgAC_MSG_CHECKING(if you want to link with neXT Athena library)
2433d522f475Smrgwithval=
2434d522f475SmrgAC_ARG_WITH(neXtaw,
2435d522f475Smrg	[  --with-neXtaw           link with neXT Athena library])
2436d522f475Smrgif test "$withval" = yes ; then
2437d522f475Smrg	cf_x_athena=neXtaw
2438d522f475Smrg	AC_MSG_RESULT(yes)
2439d522f475Smrgelse
2440d522f475Smrg	AC_MSG_RESULT(no)
2441d522f475Smrgfi
2442d522f475Smrg
2443d522f475SmrgAC_MSG_CHECKING(if you want to link with Athena-Plus library)
2444d522f475Smrgwithval=
2445d522f475SmrgAC_ARG_WITH(XawPlus,
2446d522f475Smrg	[  --with-XawPlus          link with Athena-Plus library])
2447d522f475Smrgif test "$withval" = yes ; then
2448d522f475Smrg	cf_x_athena=XawPlus
2449d522f475Smrg	AC_MSG_RESULT(yes)
2450d522f475Smrgelse
2451d522f475Smrg	AC_MSG_RESULT(no)
2452d522f475Smrgfi
2453d522f475Smrg
2454d522f475SmrgAC_CHECK_LIB(Xext,XextCreateExtension,
2455d522f475Smrg	[LIBS="-lXext $LIBS"])
2456d522f475Smrg
2457d522f475Smrgcf_x_athena_lib=""
2458d522f475Smrg
2459d522f475SmrgCF_X_ATHENA_CPPFLAGS($cf_x_athena)
2460d522f475SmrgCF_X_ATHENA_LIBS($cf_x_athena)
2461d522f475Smrg])dnl
2462d522f475Smrgdnl ---------------------------------------------------------------------------
2463d522f475Smrgdnl CF_X_ATHENA_CPPFLAGS version: 2 updated: 2002/10/09 20:00:37
2464d522f475Smrgdnl --------------------
2465d522f475Smrgdnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of
2466d522f475Smrgdnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw.
2467d522f475SmrgAC_DEFUN([CF_X_ATHENA_CPPFLAGS],
2468d522f475Smrg[
2469d522f475Smrgcf_x_athena_root=ifelse($1,,Xaw,$1)
2470d522f475Smrgcf_x_athena_include=""
2471d522f475Smrg
2472d522f475Smrgfor cf_path in default \
2473d522f475Smrg	/usr/contrib/X11R6 \
2474d522f475Smrg	/usr/contrib/X11R5 \
2475d522f475Smrg	/usr/lib/X11R5 \
2476d522f475Smrg	/usr/local
2477d522f475Smrgdo
2478d522f475Smrg	if test -z "$cf_x_athena_include" ; then
2479d522f475Smrg		cf_save="$CPPFLAGS"
2480d522f475Smrg		cf_test=X11/$cf_x_athena_root/SimpleMenu.h
2481d522f475Smrg		if test $cf_path != default ; then
2482d522f475Smrg			CPPFLAGS="-I$cf_path/include $cf_save"
2483d522f475Smrg			AC_MSG_CHECKING(for $cf_test in $cf_path)
2484d522f475Smrg		else
2485d522f475Smrg			AC_MSG_CHECKING(for $cf_test)
2486d522f475Smrg		fi
2487d522f475Smrg		AC_TRY_COMPILE([
2488d522f475Smrg#include <X11/Intrinsic.h>
2489d522f475Smrg#include <$cf_test>],[],
2490d522f475Smrg			[cf_result=yes],
2491d522f475Smrg			[cf_result=no])
2492d522f475Smrg		AC_MSG_RESULT($cf_result)
2493d522f475Smrg		if test "$cf_result" = yes ; then
2494d522f475Smrg			cf_x_athena_include=$cf_path
2495d522f475Smrg			break
2496d522f475Smrg		else
2497d522f475Smrg			CPPFLAGS="$cf_save"
2498d522f475Smrg		fi
2499d522f475Smrg	fi
2500d522f475Smrgdone
2501d522f475Smrg
2502d522f475Smrgif test -z "$cf_x_athena_include" ; then
2503d522f475Smrg	AC_MSG_WARN(
2504d522f475Smrg[Unable to successfully find Athena header files with test program])
2505d522f475Smrgelif test "$cf_x_athena_include" != default ; then
2506d522f475Smrg	CPPFLAGS="$CPPFLAGS -I$cf_x_athena_include"
2507d522f475Smrgfi
2508d522f475Smrg])
2509d522f475Smrgdnl ---------------------------------------------------------------------------
2510d522f475Smrgdnl CF_X_ATHENA_LIBS version: 7 updated: 2008/03/23 14:46:03
2511d522f475Smrgdnl ----------------
2512d522f475Smrgdnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of
2513d522f475Smrgdnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw.
2514d522f475SmrgAC_DEFUN([CF_X_ATHENA_LIBS],
2515d522f475Smrg[AC_REQUIRE([CF_X_TOOLKIT])
2516d522f475Smrgcf_x_athena_root=ifelse($1,,Xaw,$1)
2517d522f475Smrgcf_x_athena_lib=""
2518d522f475Smrg
2519d522f475Smrgfor cf_path in default \
2520d522f475Smrg	/usr/contrib/X11R6 \
2521d522f475Smrg	/usr/contrib/X11R5 \
2522d522f475Smrg	/usr/lib/X11R5 \
2523d522f475Smrg	/usr/local
2524d522f475Smrgdo
2525d522f475Smrg	for cf_lib in \
2526d522f475Smrg		"-l$cf_x_athena_root -lXmu" \
2527d522f475Smrg		"-l$cf_x_athena_root -lXpm -lXmu" \
2528d522f475Smrg		"-l${cf_x_athena_root}_s -lXmu_s"
2529d522f475Smrg	do
2530d522f475Smrg		if test -z "$cf_x_athena_lib" ; then
2531d522f475Smrg			cf_save="$LIBS"
2532d522f475Smrg			cf_test=XawSimpleMenuAddGlobalActions
2533d522f475Smrg			if test $cf_path != default ; then
2534d522f475Smrg				LIBS="-L$cf_path/lib $cf_lib $LIBS"
2535d522f475Smrg				AC_MSG_CHECKING(for $cf_lib in $cf_path)
2536d522f475Smrg			else
2537d522f475Smrg				LIBS="$cf_lib $LIBS"
2538d522f475Smrg				AC_MSG_CHECKING(for $cf_test in $cf_lib)
2539d522f475Smrg			fi
2540d522f475Smrg			AC_TRY_LINK([],[$cf_test()],
2541d522f475Smrg				[cf_result=yes],
2542d522f475Smrg				[cf_result=no])
2543d522f475Smrg			AC_MSG_RESULT($cf_result)
2544d522f475Smrg			if test "$cf_result" = yes ; then
2545d522f475Smrg				cf_x_athena_lib="$cf_lib"
2546d522f475Smrg				break
2547d522f475Smrg			fi
2548d522f475Smrg			LIBS="$cf_save"
2549d522f475Smrg		fi
2550d522f475Smrg	done
2551d522f475Smrgdone
2552d522f475Smrg
2553d522f475Smrgif test -z "$cf_x_athena_lib" ; then
2554d522f475Smrg	AC_MSG_ERROR(
2555d522f475Smrg[Unable to successfully link Athena library (-l$cf_x_athena_root) with test program])
2556d522f475Smrgfi
2557d522f475Smrg
2558d522f475SmrgCF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena)
2559d522f475SmrgAC_DEFINE_UNQUOTED($cf_x_athena_LIBS)
2560d522f475Smrg])
2561d522f475Smrgdnl ---------------------------------------------------------------------------
2562d522f475Smrgdnl CF_X_FREETYPE version: 18 updated: 2007/03/21 18:06:17
2563d522f475Smrgdnl -------------
2564d522f475Smrgdnl Check for X FreeType headers and libraries (XFree86 4.x, etc).
2565d522f475Smrgdnl
2566d522f475Smrgdnl First check for the appropriate config program, since the developers for
2567d522f475Smrgdnl these libraries change their configuration (and config program) more or
2568d522f475Smrgdnl less randomly.  If we cannot find the config program, do not bother trying
2569d522f475Smrgdnl to guess the latest variation of include/lib directories.
2570d522f475Smrgdnl
2571d522f475Smrgdnl If either or both of these configure-script options are not given, rely on
2572d522f475Smrgdnl the output of the config program to provide the cflags/libs options:
2573d522f475Smrgdnl	--with-freetype-cflags
2574d522f475Smrgdnl	--with-freetype-libs
2575d522f475SmrgAC_DEFUN([CF_X_FREETYPE],
2576d522f475Smrg[
2577d522f475Smrgcf_extra_freetype_libs=
2578d522f475SmrgFREETYPE_CONFIG=
2579d522f475SmrgFREETYPE_PARAMS=
2580d522f475Smrg
2581d522f475SmrgAC_MSG_CHECKING(if you specified -D/-I options for FreeType)
2582d522f475SmrgAC_ARG_WITH(freetype-cflags,
2583d522f475Smrg	[  --with-freetype-cflags  -D/-I options for compiling with FreeType],
2584d522f475Smrg[cf_cv_x_freetype_incs="$with_freetype_cflags"],
2585d522f475Smrg[cf_cv_x_freetype_incs=no])
2586d522f475SmrgAC_MSG_RESULT($cf_cv_x_freetype_incs)
2587d522f475Smrg
2588d522f475Smrg
2589d522f475SmrgAC_MSG_CHECKING(if you specified -L/-l options for FreeType)
2590d522f475SmrgAC_ARG_WITH(freetype-libs,
2591d522f475Smrg	[  --with-freetype-libs    -L/-l options to link FreeType],
2592d522f475Smrg[cf_cv_x_freetype_libs="$with_freetype_libs"],
2593d522f475Smrg[cf_cv_x_freetype_libs=no])
2594d522f475SmrgAC_MSG_RESULT($cf_cv_x_freetype_libs)
2595d522f475Smrg
2596d522f475SmrgAC_PATH_PROG(FREETYPE_PKG_CONFIG, pkg-config, none)
2597d522f475Smrgif test "$FREETYPE_PKG_CONFIG" != none && "$FREETYPE_PKG_CONFIG" --exists xft; then
2598d522f475Smrg	FREETYPE_CONFIG=$FREETYPE_PKG_CONFIG
2599d522f475Smrg	FREETYPE_PARAMS=xft
2600d522f475Smrgelse
2601d522f475Smrg	AC_PATH_PROG(FREETYPE_XFT_CONFIG, xft-config, none)
2602d522f475Smrg	if test "$FREETYPE_XFT_CONFIG" != none; then
2603d522f475Smrg		FREETYPE_CONFIG=$FREETYPE_XFT_CONFIG
2604d522f475Smrg	else
2605d522f475Smrg		cf_extra_freetype_libs="-lXft"
2606d522f475Smrg		AC_PATH_PROG(FREETYPE_OLD_CONFIG, freetype-config, none)
2607d522f475Smrg		if test "$FREETYPE_OLD_CONFIG" != none; then
2608d522f475Smrg			FREETYPE_CONFIG=$FREETYPE_OLD_CONFIG
2609d522f475Smrg		fi
2610d522f475Smrg	fi
2611d522f475Smrgfi
2612d522f475Smrg
2613d522f475Smrgif test -n "$FREETYPE_CONFIG" ; then
2614d522f475Smrg
2615d522f475Smrgif test "$cf_cv_x_freetype_incs" = no ; then
2616d522f475SmrgAC_MSG_CHECKING(for $FREETYPE_CONFIG cflags)
2617d522f475Smrgcf_cv_x_freetype_incs="`$FREETYPE_CONFIG $FREETYPE_PARAMS --cflags 2>/dev/null`"
2618d522f475SmrgAC_MSG_RESULT($cf_cv_x_freetype_incs)
2619d522f475Smrgfi
2620d522f475Smrg
2621d522f475Smrgif test "$cf_cv_x_freetype_libs" = no ; then
2622d522f475SmrgAC_MSG_CHECKING(for $FREETYPE_CONFIG libs)
2623d522f475Smrgcf_cv_x_freetype_libs="$cf_extra_freetype_libs `$FREETYPE_CONFIG $FREETYPE_PARAMS --libs 2>/dev/null`"
2624d522f475SmrgAC_MSG_RESULT($cf_cv_x_freetype_libs)
2625d522f475Smrgfi
2626d522f475Smrg
2627d522f475Smrgfi
2628d522f475Smrg
2629d522f475Smrgif test "$cf_cv_x_freetype_incs" = no ; then
2630d522f475Smrg	cf_cv_x_freetype_incs=
2631d522f475Smrgfi
2632d522f475Smrg
2633d522f475Smrgif test "$cf_cv_x_freetype_libs" = no ; then
2634d522f475Smrg	cf_cv_x_freetype_libs=-lXft
2635d522f475Smrgfi
2636d522f475Smrg
2637d522f475SmrgAC_MSG_CHECKING(if we can link with FreeType libraries)
2638d522f475Smrg
2639d522f475Smrgcf_save_LIBS="$LIBS"
2640d522f475Smrgcf_save_INCS="$CPPFLAGS"
2641d522f475Smrg
2642d522f475SmrgLIBS="$cf_cv_x_freetype_libs $LIBS"
2643d522f475SmrgCPPFLAGS="$cf_cv_x_freetype_incs $CPPFLAGS"
2644d522f475Smrg
2645d522f475SmrgAC_TRY_LINK([
2646d522f475Smrg#include <X11/Xlib.h>
2647d522f475Smrg#include <X11/extensions/Xrender.h>
2648d522f475Smrg#include <X11/Xft/Xft.h>],[
2649d522f475Smrg	XftPattern  *pat = XftNameParse ("name");],
2650d522f475Smrg	[cf_cv_found_freetype=yes],
2651d522f475Smrg	[cf_cv_found_freetype=no])
2652d522f475SmrgAC_MSG_RESULT($cf_cv_found_freetype)
2653d522f475Smrg
2654d522f475SmrgLIBS="$cf_save_LIBS"
2655d522f475SmrgCPPFLAGS="$cf_save_INCS"
2656d522f475Smrg
2657d522f475Smrgif test "$cf_cv_found_freetype" = yes ; then
2658d522f475Smrg	LIBS="$cf_cv_x_freetype_libs $LIBS"
2659d522f475Smrg	CF_ADD_CFLAGS($cf_cv_x_freetype_incs)
2660d522f475Smrg	AC_DEFINE(XRENDERFONT)
2661d522f475Smrg
2662d522f475SmrgAC_CHECK_FUNCS( \
2663d522f475Smrg	XftDrawCharSpec \
2664d522f475Smrg	XftDrawSetClip \
2665d522f475Smrg	XftDrawSetClipRectangles \
2666d522f475Smrg)
2667d522f475Smrg
2668d522f475Smrgelse
2669d522f475Smrg	AC_MSG_WARN(No libraries found for FreeType)
2670d522f475Smrg	CPPFLAGS=`echo "$CPPFLAGS" | sed -e s/-DXRENDERFONT//`
2671d522f475Smrgfi
2672d522f475Smrg
2673d522f475Smrg# FIXME: revisit this if needed
2674d522f475SmrgAC_SUBST(XRENDERFONT)
2675d522f475SmrgAC_SUBST(HAVE_TYPE_FCCHAR32)
2676d522f475SmrgAC_SUBST(HAVE_TYPE_XFTCHARSPEC)
2677d522f475Smrg])
2678d522f475Smrgdnl ---------------------------------------------------------------------------
2679d522f475Smrgdnl CF_X_TOOLKIT version: 12 updated: 2008/03/23 15:04:54
2680d522f475Smrgdnl ------------
2681d522f475Smrgdnl Check for X Toolkit libraries
2682d522f475Smrgdnl
2683d522f475SmrgAC_DEFUN([CF_X_TOOLKIT],
2684d522f475Smrg[
2685d522f475SmrgAC_REQUIRE([AC_PATH_XTRA])
2686d522f475SmrgAC_REQUIRE([CF_CHECK_CACHE])
2687d522f475Smrg
2688d522f475Smrg# SYSTEM_NAME=`echo "$cf_cv_system_name"|tr ' ' -`
2689d522f475Smrg
2690d522f475Smrgcf_have_X_LIBS=no
2691d522f475Smrg
2692d522f475SmrgLDFLAGS="$X_LIBS $LDFLAGS"
2693d522f475SmrgCF_CHECK_CFLAGS($X_CFLAGS)
2694d522f475Smrg
2695d522f475SmrgAC_CHECK_FUNC(XOpenDisplay,,[
2696d522f475SmrgAC_CHECK_LIB(X11,XOpenDisplay,
2697d522f475Smrg	[LIBS="-lX11 $LIBS"],,
2698d522f475Smrg	[$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])])
2699d522f475Smrg
2700d522f475SmrgAC_CHECK_FUNC(XtAppInitialize,,[
2701d522f475SmrgAC_CHECK_LIB(Xt, XtAppInitialize,
2702d522f475Smrg	[AC_DEFINE(HAVE_LIBXT)
2703d522f475Smrg	 cf_have_X_LIBS=Xt
2704d522f475Smrg	 LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS"],,
2705d522f475Smrg	[$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])])
2706d522f475Smrg
2707d522f475Smrgif test $cf_have_X_LIBS = no ; then
2708d522f475Smrg	AC_MSG_WARN(
2709d522f475Smrg[Unable to successfully link X Toolkit library (-lXt) with
2710d522f475Smrgtest program.  You will have to check and add the proper libraries by hand
2711d522f475Smrgto makefile.])
2712d522f475Smrgfi
2713d522f475Smrg])dnl
2714