2009-01-06 13:10:20 -07:00
|
|
|
dnl $XTermId: aclocal.m4,v 1.254 2008/12/30 17:01:41 tom Exp $
|
2006-11-26 04:11:12 -07:00
|
|
|
dnl
|
|
|
|
dnl $XFree86: xc/programs/xterm/aclocal.m4,v 3.65 2006/06/19 00:36:50 dickey Exp $
|
|
|
|
dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl
|
2008-03-19 15:15:46 -06:00
|
|
|
dnl Copyright 1997-2007,2008 by Thomas E. Dickey
|
2006-11-26 04:11:12 -07:00
|
|
|
dnl
|
|
|
|
dnl All Rights Reserved
|
|
|
|
dnl
|
|
|
|
dnl Permission to use, copy, modify, and distribute this software and its
|
|
|
|
dnl documentation for any purpose and without fee is hereby granted,
|
|
|
|
dnl provided that the above copyright notice appear in all copies and that
|
|
|
|
dnl both that copyright notice and this permission notice appear in
|
|
|
|
dnl supporting documentation, and that the name of the above listed
|
|
|
|
dnl copyright holder(s) not be used in advertising or publicity pertaining
|
|
|
|
dnl to distribution of the software without specific, written prior
|
|
|
|
dnl permission.
|
|
|
|
dnl
|
|
|
|
dnl THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
|
|
|
|
dnl TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
|
|
dnl AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
|
|
|
|
dnl LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
dnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
dnl ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
dnl OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl AM_LANGINFO_CODESET version: 3 updated: 2002/10/27 23:21:42
|
|
|
|
dnl -------------------
|
|
|
|
dnl Inserted as requested by gettext 0.10.40
|
|
|
|
dnl File from /usr/share/aclocal
|
|
|
|
dnl codeset.m4
|
|
|
|
dnl ====================
|
|
|
|
dnl serial AM1
|
|
|
|
dnl
|
|
|
|
dnl From Bruno Haible.
|
|
|
|
AC_DEFUN([AM_LANGINFO_CODESET],
|
|
|
|
[
|
|
|
|
AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
|
|
|
|
[AC_TRY_LINK([#include <langinfo.h>],
|
|
|
|
[char* cs = nl_langinfo(CODESET);],
|
|
|
|
am_cv_langinfo_codeset=yes,
|
|
|
|
am_cv_langinfo_codeset=no)
|
|
|
|
])
|
|
|
|
if test $am_cv_langinfo_codeset = yes; then
|
|
|
|
AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
|
|
|
|
[Define if you have <langinfo.h> and nl_langinfo(CODESET).])
|
|
|
|
fi
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl CF_ADD_CFLAGS version: 7 updated: 2004/04/25 17:48:30
|
|
|
|
dnl -------------
|
|
|
|
dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS
|
|
|
|
dnl The second parameter if given makes this macro verbose.
|
|
|
|
dnl
|
|
|
|
dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS,
|
|
|
|
dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily
|
|
|
|
dnl confused by the quotes (which require backslashes to keep them usable).
|
|
|
|
AC_DEFUN([CF_ADD_CFLAGS],
|
|
|
|
[
|
|
|
|
cf_fix_cppflags=no
|
|
|
|
cf_new_cflags=
|
|
|
|
cf_new_cppflags=
|
|
|
|
cf_new_extra_cppflags=
|
|
|
|
|
|
|
|
for cf_add_cflags in $1
|
|
|
|
do
|
|
|
|
case $cf_fix_cppflags in
|
|
|
|
no)
|
|
|
|
case $cf_add_cflags in #(vi
|
|
|
|
-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
|
|
|
|
case $cf_add_cflags in
|
|
|
|
-D*)
|
|
|
|
cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'`
|
|
|
|
|
|
|
|
test "${cf_add_cflags}" != "${cf_tst_cflags}" \
|
|
|
|
&& test -z "${cf_tst_cflags}" \
|
|
|
|
&& cf_fix_cppflags=yes
|
|
|
|
|
|
|
|
if test $cf_fix_cppflags = yes ; then
|
|
|
|
cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
|
|
|
|
continue
|
|
|
|
elif test "${cf_tst_cflags}" = "\"'" ; then
|
|
|
|
cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
case "$CPPFLAGS" in
|
|
|
|
*$cf_add_cflags) #(vi
|
|
|
|
;;
|
|
|
|
*) #(vi
|
|
|
|
cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
cf_new_cflags="$cf_new_cflags $cf_add_cflags"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
yes)
|
|
|
|
cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
|
|
|
|
|
|
|
|
cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'`
|
|
|
|
|
|
|
|
test "${cf_add_cflags}" != "${cf_tst_cflags}" \
|
|
|
|
&& test -z "${cf_tst_cflags}" \
|
|
|
|
&& cf_fix_cppflags=no
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
if test -n "$cf_new_cflags" ; then
|
|
|
|
ifelse($2,,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)])
|
|
|
|
CFLAGS="$CFLAGS $cf_new_cflags"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test -n "$cf_new_cppflags" ; then
|
|
|
|
ifelse($2,,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)])
|
|
|
|
CPPFLAGS="$cf_new_cppflags $CPPFLAGS"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test -n "$cf_new_extra_cppflags" ; then
|
|
|
|
ifelse($2,,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)])
|
|
|
|
EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_SUBST(EXTRA_CPPFLAGS)
|
|
|
|
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl CF_ANSI_CC_CHECK version: 9 updated: 2001/12/30 17:53:34
|
|
|
|
dnl ----------------
|
|
|
|
dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES'
|
|
|
|
dnl in the sharutils 4.2 distribution.
|
|
|
|
AC_DEFUN([CF_ANSI_CC_CHECK],
|
|
|
|
[
|
|
|
|
AC_CACHE_CHECK(for ${CC-cc} option to accept ANSI C, cf_cv_ansi_cc,[
|
|
|
|
cf_cv_ansi_cc=no
|
|
|
|
cf_save_CFLAGS="$CFLAGS"
|
|
|
|
cf_save_CPPFLAGS="$CPPFLAGS"
|
|
|
|
# Don't try gcc -ansi; that turns off useful extensions and
|
|
|
|
# breaks some systems' header files.
|
|
|
|
# AIX -qlanglvl=ansi
|
|
|
|
# Ultrix and OSF/1 -std1
|
|
|
|
# HP-UX -Aa -D_HPUX_SOURCE
|
|
|
|
# SVR4 -Xc
|
|
|
|
# UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes)
|
|
|
|
for cf_arg in "-DCC_HAS_PROTOS" \
|
|
|
|
"" \
|
|
|
|
-qlanglvl=ansi \
|
|
|
|
-std1 \
|
|
|
|
-Ae \
|
|
|
|
"-Aa -D_HPUX_SOURCE" \
|
|
|
|
-Xc
|
|
|
|
do
|
|
|
|
CF_ADD_CFLAGS($cf_arg)
|
|
|
|
AC_TRY_COMPILE(
|
|
|
|
[
|
|
|
|
#ifndef CC_HAS_PROTOS
|
|
|
|
#if !defined(__STDC__) || (__STDC__ != 1)
|
|
|
|
choke me
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
],[
|
|
|
|
int test (int i, double x);
|
|
|
|
struct s1 {int (*f) (int a);};
|
|
|
|
struct s2 {int (*f) (double a);};],
|
|
|
|
[cf_cv_ansi_cc="$cf_arg"; break])
|
|
|
|
done
|
|
|
|
CFLAGS="$cf_save_CFLAGS"
|
|
|
|
CPPFLAGS="$cf_save_CPPFLAGS"
|
|
|
|
])
|
|
|
|
|
|
|
|
if test "$cf_cv_ansi_cc" != "no"; then
|
|
|
|
if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then
|
|
|
|
CF_ADD_CFLAGS($cf_cv_ansi_cc)
|
|
|
|
else
|
|
|
|
AC_DEFINE(CC_HAS_PROTOS)
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31
|
|
|
|
dnl --------------
|
|
|
|
dnl Allow user to disable a normally-on option.
|
|
|
|
AC_DEFUN([CF_ARG_DISABLE],
|
|
|
|
[CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl CF_ARG_ENABLE version: 3 updated: 1999/03/30 17:24:31
|
|
|
|
dnl -------------
|
|
|
|
dnl Allow user to enable a normally-off option.
|
|
|
|
AC_DEFUN([CF_ARG_ENABLE],
|
|
|
|
[CF_ARG_OPTION($1,[$2],[$3],[$4],no)])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl CF_ARG_OPTION version: 3 updated: 1997/10/18 14:42:41
|
|
|
|
dnl -------------
|
|
|
|
dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus
|
|
|
|
dnl values.
|
|
|
|
dnl
|
|
|
|
dnl Parameters:
|
|
|
|
dnl $1 = option name
|
|
|
|
dnl $2 = help-string
|
|
|
|
dnl $3 = action to perform if option is not default
|
|
|
|
dnl $4 = action if perform if option is default
|
|
|
|
dnl $5 = default option value (either 'yes' or 'no')
|
|
|
|
AC_DEFUN([CF_ARG_OPTION],
|
|
|
|
[AC_ARG_ENABLE($1,[$2],[test "$enableval" != ifelse($5,no,yes,no) && enableval=ifelse($5,no,no,yes)
|
|
|
|
if test "$enableval" != "$5" ; then
|
|
|
|
ifelse($3,,[ :]dnl
|
|
|
|
,[ $3]) ifelse($4,,,[
|
|
|
|
else
|
|
|
|
$4])
|
|
|
|
fi],[enableval=$5 ifelse($4,,,[
|
|
|
|
$4
|
|
|
|
])dnl
|
|
|
|
])])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
2008-08-25 12:05:56 -06:00
|
|
|
dnl CF_CHECK_CACHE version: 11 updated: 2008/03/23 14:45:59
|
2006-11-26 04:11:12 -07:00
|
|
|
dnl --------------
|
|
|
|
dnl Check if we're accidentally using a cache from a different machine.
|
|
|
|
dnl Derive the system name, as a check for reusing the autoconf cache.
|
|
|
|
dnl
|
|
|
|
dnl If we've packaged config.guess and config.sub, run that (since it does a
|
|
|
|
dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow
|
|
|
|
dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM
|
|
|
|
dnl which is useful in cross-compiles.
|
|
|
|
dnl
|
|
|
|
dnl Note: we would use $ac_config_sub, but that is one of the places where
|
|
|
|
dnl autoconf 2.5x broke compatibility with autoconf 2.13
|
|
|
|
AC_DEFUN([CF_CHECK_CACHE],
|
|
|
|
[
|
|
|
|
if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then
|
|
|
|
ifelse([$1],,[AC_CANONICAL_HOST],[$1])
|
|
|
|
system_name="$host_os"
|
|
|
|
else
|
|
|
|
system_name="`(uname -s -r) 2>/dev/null`"
|
|
|
|
if test -z "$system_name" ; then
|
|
|
|
system_name="`(hostname) 2>/dev/null`"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name")
|
|
|
|
AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
|
|
|
|
|
|
|
|
test -z "$system_name" && system_name="$cf_cv_system_name"
|
|
|
|
test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name)
|
|
|
|
|
|
|
|
if test ".$system_name" != ".$cf_cv_system_name" ; then
|
|
|
|
AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name))
|
2008-08-25 12:05:56 -06:00
|
|
|
AC_MSG_ERROR("Please remove config.cache and try again.")
|
2006-11-26 04:11:12 -07:00
|
|
|
fi
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl CF_CHECK_CFLAGS version: 2 updated: 2001/12/30 19:09:58
|
|
|
|
dnl ---------------
|
|
|
|
dnl Conditionally add to $CFLAGS and $CPPFLAGS values which are derived from
|
|
|
|
dnl a build-configuration such as imake. These have the pitfall that they
|
|
|
|
dnl often contain compiler-specific options which we cannot use, mixed with
|
|
|
|
dnl preprocessor options that we usually can.
|
|
|
|
AC_DEFUN([CF_CHECK_CFLAGS],
|
|
|
|
[
|
|
|
|
CF_VERBOSE(checking additions to CFLAGS)
|
|
|
|
cf_check_cflags="$CFLAGS"
|
|
|
|
cf_check_cppflags="$CPPFLAGS"
|
|
|
|
CF_ADD_CFLAGS($1,yes)
|
|
|
|
if test "$cf_check_cflags" != "$CFLAGS" ; then
|
|
|
|
AC_TRY_LINK([#include <stdio.h>],[printf("Hello world");],,
|
|
|
|
[CF_VERBOSE(test-compile failed. Undoing change to \$CFLAGS)
|
|
|
|
if test "$cf_check_cppflags" != "$CPPFLAGS" ; then
|
|
|
|
CF_VERBOSE(but keeping change to \$CPPFLAGS)
|
|
|
|
fi
|
|
|
|
CFLAGS="$cf_check_flags"])
|
|
|
|
fi
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
2009-01-06 13:10:20 -07:00
|
|
|
dnl CF_CHECK_ERRNO version: 10 updated: 2008/08/22 16:33:22
|
2006-11-26 04:11:12 -07:00
|
|
|
dnl --------------
|
|
|
|
dnl Check for data that is usually declared in <stdio.h> or <errno.h>, e.g.,
|
|
|
|
dnl the 'errno' variable. Define a DECL_xxx symbol if we must declare it
|
|
|
|
dnl ourselves.
|
|
|
|
dnl
|
|
|
|
dnl $1 = the name to check
|
2009-01-06 13:10:20 -07:00
|
|
|
dnl $2 = the assumed type
|
2006-11-26 04:11:12 -07:00
|
|
|
AC_DEFUN([CF_CHECK_ERRNO],
|
|
|
|
[
|
|
|
|
AC_CACHE_CHECK(if external $1 is declared, cf_cv_dcl_$1,[
|
|
|
|
AC_TRY_COMPILE([
|
|
|
|
#ifdef HAVE_STDLIB_H
|
|
|
|
#include <stdlib.h>
|
|
|
|
#endif
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <errno.h> ],
|
2009-01-06 13:10:20 -07:00
|
|
|
ifelse($2,,int,$2) x = (ifelse($2,,int,$2)) $1,
|
2006-11-26 04:11:12 -07:00
|
|
|
[cf_cv_dcl_$1=yes],
|
|
|
|
[cf_cv_dcl_$1=no])
|
|
|
|
])
|
|
|
|
|
|
|
|
if test "$cf_cv_dcl_$1" = no ; then
|
|
|
|
CF_UPPER(cf_result,decl_$1)
|
|
|
|
AC_DEFINE_UNQUOTED($cf_result)
|
|
|
|
fi
|
|
|
|
|
|
|
|
# It's possible (for near-UNIX clones) that the data doesn't exist
|
2009-01-06 13:10:20 -07:00
|
|
|
CF_CHECK_EXTERN_DATA($1,ifelse($2,,int,$2))
|
2006-11-26 04:11:12 -07:00
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl CF_CHECK_EXTERN_DATA version: 3 updated: 2001/12/30 18:03:23
|
|
|
|
dnl --------------------
|
|
|
|
dnl Check for existence of external data in the current set of libraries. If
|
|
|
|
dnl we can modify it, it's real enough.
|
|
|
|
dnl $1 = the name to check
|
|
|
|
dnl $2 = its type
|
|
|
|
AC_DEFUN([CF_CHECK_EXTERN_DATA],
|
|
|
|
[
|
|
|
|
AC_CACHE_CHECK(if external $1 exists, cf_cv_have_$1,[
|
|
|
|
AC_TRY_LINK([
|
|
|
|
#undef $1
|
|
|
|
extern $2 $1;
|
|
|
|
],
|
|
|
|
[$1 = 2],
|
|
|
|
[cf_cv_have_$1=yes],
|
|
|
|
[cf_cv_have_$1=no])
|
|
|
|
])
|
|
|
|
|
|
|
|
if test "$cf_cv_have_$1" = yes ; then
|
|
|
|
CF_UPPER(cf_result,have_$1)
|
|
|
|
AC_DEFINE_UNQUOTED($cf_result)
|
|
|
|
fi
|
|
|
|
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl CF_DISABLE_ECHO version: 10 updated: 2003/04/17 22:27:11
|
|
|
|
dnl ---------------
|
|
|
|
dnl You can always use "make -n" to see the actual options, but it's hard to
|
|
|
|
dnl pick out/analyze warning messages when the compile-line is long.
|
|
|
|
dnl
|
|
|
|
dnl Sets:
|
|
|
|
dnl ECHO_LT - symbol to control if libtool is verbose
|
|
|
|
dnl ECHO_LD - symbol to prefix "cc -o" lines
|
|
|
|
dnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o)
|
|
|
|
dnl SHOW_CC - symbol to put before explicit "cc -c" lines
|
|
|
|
dnl ECHO_CC - symbol to put before any "cc" line
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([CF_DISABLE_ECHO],[
|
|
|
|
AC_MSG_CHECKING(if you want to see long compiling messages)
|
|
|
|
CF_ARG_DISABLE(echo,
|
|
|
|
[ --disable-echo display "compiling" commands],
|
|
|
|
[
|
|
|
|
ECHO_LT='--silent'
|
|
|
|
ECHO_LD='@echo linking [$]@;'
|
|
|
|
RULE_CC=' @echo compiling [$]<'
|
|
|
|
SHOW_CC=' @echo compiling [$]@'
|
|
|
|
ECHO_CC='@'
|
|
|
|
],[
|
|
|
|
ECHO_LT=''
|
|
|
|
ECHO_LD=''
|
|
|
|
RULE_CC='# compiling'
|
|
|
|
SHOW_CC='# compiling'
|
|
|
|
ECHO_CC=''
|
|
|
|
])
|
|
|
|
AC_MSG_RESULT($enableval)
|
|
|
|
AC_SUBST(ECHO_LT)
|
|
|
|
AC_SUBST(ECHO_LD)
|
|
|
|
AC_SUBST(RULE_CC)
|
|
|
|
AC_SUBST(SHOW_CC)
|
|
|
|
AC_SUBST(ECHO_CC)
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl CF_ENABLE_NARROWPROTO version: 3 updated: 2006/02/12 17:46:00
|
|
|
|
dnl ---------------------
|
|
|
|
dnl If this is not set properly, Xaw's scrollbars will not work.
|
|
|
|
dnl The so-called "modular" configuration for X.org omits most of the
|
|
|
|
dnl configure checks that would be needed to provide compatibility with
|
|
|
|
dnl older X builds. This one breaks things noticeably.
|
|
|
|
AC_DEFUN([CF_ENABLE_NARROWPROTO],
|
|
|
|
[
|
|
|
|
AC_MSG_CHECKING(if you want narrow prototypes for X libraries)
|
|
|
|
|
|
|
|
case `$ac_config_guess` in #(vi
|
|
|
|
*cygwin*|*freebsd*|*gnu*|*irix5*|*irix6*|*linux-gnu*|*netbsd*|*openbsd*|*qnx*|*sco*|*sgi*) #(vi
|
|
|
|
cf_default_narrowproto=yes
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
cf_default_narrowproto=no
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
CF_ARG_OPTION(narrowproto,
|
|
|
|
[ --enable-narrowproto enable narrow prototypes for X libraries],
|
|
|
|
[enable_narrowproto=$enableval],
|
|
|
|
[enable_narrowproto=$cf_default_narrowproto],
|
|
|
|
[$cf_default_narrowproto])
|
|
|
|
AC_MSG_RESULT($enable_narrowproto)
|
|
|
|
])
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl CF_ERRNO version: 5 updated: 1997/11/30 12:44:39
|
|
|
|
dnl --------
|
|
|
|
dnl Check if 'errno' is declared in <errno.h>
|
|
|
|
AC_DEFUN([CF_ERRNO],
|
|
|
|
[
|
|
|
|
CF_CHECK_ERRNO(errno)
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
2007-06-15 13:29:55 -06:00
|
|
|
dnl CF_FUNC_MEMMOVE version: 7 updated: 2006/12/16 12:33:30
|
2006-11-26 04:11:12 -07:00
|
|
|
dnl ---------------
|
|
|
|
dnl Check for memmove, or a bcopy that can handle overlapping copy. If neither
|
|
|
|
dnl is found, add our own version of memmove to the list of objects.
|
|
|
|
AC_DEFUN([CF_FUNC_MEMMOVE],
|
|
|
|
[
|
|
|
|
AC_CHECK_FUNC(memmove,,[
|
|
|
|
AC_CHECK_FUNC(bcopy,[
|
|
|
|
AC_CACHE_CHECK(if bcopy does overlapping moves,cf_cv_good_bcopy,[
|
|
|
|
AC_TRY_RUN([
|
|
|
|
int main() {
|
|
|
|
static char data[] = "abcdefghijklmnopqrstuwwxyz";
|
|
|
|
char temp[40];
|
|
|
|
bcopy(data, temp, sizeof(data));
|
|
|
|
bcopy(temp+10, temp, 15);
|
|
|
|
bcopy(temp+5, temp+15, 10);
|
2007-06-15 13:29:55 -06:00
|
|
|
${cf_cv_main_return:-return} (strcmp(temp, "klmnopqrstuwwxypqrstuwwxyz"));
|
2006-11-26 04:11:12 -07:00
|
|
|
}
|
|
|
|
],
|
|
|
|
[cf_cv_good_bcopy=yes],
|
|
|
|
[cf_cv_good_bcopy=no],
|
|
|
|
[cf_cv_good_bcopy=unknown])
|
|
|
|
])
|
|
|
|
],[cf_cv_good_bcopy=no])
|
|
|
|
if test "$cf_cv_good_bcopy" = yes ; then
|
|
|
|
AC_DEFINE(USE_OK_BCOPY)
|
|
|
|
else
|
|
|
|
AC_DEFINE(USE_MY_MEMMOVE)
|
|
|
|
fi
|
|
|
|
])])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
2007-06-15 13:29:55 -06:00
|
|
|
dnl CF_FUNC_TGETENT version: 11 updated: 2007/03/14 16:43:48
|
2006-11-26 04:11:12 -07:00
|
|
|
dnl ---------------
|
|
|
|
dnl Check for tgetent function in termcap library. If we cannot find this,
|
|
|
|
dnl we'll use the $LINES and $COLUMNS environment variables to pass screen
|
|
|
|
dnl size information to subprocesses. (We cannot use terminfo's compatibility
|
|
|
|
dnl function, since it cannot provide the termcap-format data).
|
|
|
|
dnl
|
|
|
|
dnl If the --disable-full-tgetent option is given, we'll settle for the first
|
|
|
|
dnl tgetent function we find. Since the search list in that case does not
|
|
|
|
dnl include the termcap library, that allows us to default to terminfo.
|
|
|
|
AC_DEFUN([CF_FUNC_TGETENT],
|
|
|
|
[
|
|
|
|
# compute a reasonable value for $TERM to give tgetent(), since we may be
|
|
|
|
# running in 'screen', which sets $TERMCAP to a specific entry that is not
|
|
|
|
# necessarily in /etc/termcap - unsetenv is not portable, so we cannot simply
|
|
|
|
# discard $TERMCAP.
|
|
|
|
cf_TERMVAR=vt100
|
|
|
|
test -n "$TERMCAP" && cf_TERMVAR="$TERM"
|
|
|
|
test -z "$cf_TERMVAR" && cf_TERMVAR=vt100
|
|
|
|
|
|
|
|
AC_MSG_CHECKING(if we want full tgetent function)
|
|
|
|
CF_ARG_DISABLE(full-tgetent,
|
|
|
|
[ --disable-full-tgetent disable check for full tgetent function],
|
|
|
|
cf_full_tgetent=no,
|
|
|
|
cf_full_tgetent=yes,yes)
|
|
|
|
AC_MSG_RESULT($cf_full_tgetent)
|
|
|
|
|
|
|
|
if test "$cf_full_tgetent" = yes ; then
|
|
|
|
cf_test_message="full tgetent"
|
|
|
|
else
|
|
|
|
cf_test_message="tgetent"
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_CACHE_CHECK(for $cf_test_message function,cf_cv_lib_tgetent,[
|
|
|
|
cf_save_LIBS="$LIBS"
|
|
|
|
cf_cv_lib_tgetent=no
|
|
|
|
if test "$cf_full_tgetent" = yes ; then
|
|
|
|
cf_TERMLIB="termcap termlib ncurses curses"
|
|
|
|
cf_TERMTST="buffer[[0]] == 0"
|
|
|
|
else
|
|
|
|
cf_TERMLIB="termlib ncurses curses"
|
|
|
|
cf_TERMTST="0"
|
|
|
|
fi
|
|
|
|
for cf_termlib in '' $cf_TERMLIB ; do
|
|
|
|
LIBS="$cf_save_LIBS"
|
|
|
|
test -n "$cf_termlib" && LIBS="$LIBS -l$cf_termlib"
|
|
|
|
AC_TRY_RUN([
|
|
|
|
/* terminfo implementations ignore the buffer argument, making it useless for
|
|
|
|
* the xterm application, which uses this information to make a new TERMCAP
|
|
|
|
* environment variable.
|
|
|
|
*/
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
char buffer[1024];
|
|
|
|
buffer[0] = 0;
|
|
|
|
tgetent(buffer, "$cf_TERMVAR");
|
2007-06-15 13:29:55 -06:00
|
|
|
${cf_cv_main_return:-return} ($cf_TERMTST); }],
|
2006-11-26 04:11:12 -07:00
|
|
|
[echo "yes, there is a termcap/tgetent in $cf_termlib" 1>&AC_FD_CC
|
|
|
|
if test -n "$cf_termlib" ; then
|
|
|
|
cf_cv_lib_tgetent="-l$cf_termlib"
|
|
|
|
else
|
|
|
|
cf_cv_lib_tgetent=yes
|
|
|
|
fi
|
|
|
|
break],
|
|
|
|
[echo "no, there is no termcap/tgetent in $cf_termlib" 1>&AC_FD_CC],
|
|
|
|
[echo "cross-compiling, cannot verify if a termcap/tgetent is present in $cf_termlib" 1>&AC_FD_CC])
|
|
|
|
done
|
|
|
|
LIBS="$cf_save_LIBS"
|
|
|
|
])
|
|
|
|
|
|
|
|
# If we found a working tgetent(), set LIBS and check for termcap.h.
|
|
|
|
# (LIBS cannot be set inside AC_CACHE_CHECK; the commands there should
|
|
|
|
# not have side effects other than setting the cache variable, because
|
|
|
|
# they are not executed when a cached value exists.)
|
|
|
|
if test "$cf_cv_lib_tgetent" != no ; then
|
|
|
|
test "$cf_cv_lib_tgetent" != yes && LIBS="$LIBS $cf_cv_lib_tgetent"
|
|
|
|
AC_DEFINE(USE_TERMCAP)
|
|
|
|
AC_TRY_COMPILE([
|
|
|
|
#include <termcap.h>],[
|
|
|
|
#ifdef NCURSES_VERSION
|
|
|
|
make an error
|
|
|
|
#endif],[AC_DEFINE(HAVE_TERMCAP_H)])
|
|
|
|
else
|
|
|
|
# If we didn't find a tgetent() that supports the buffer
|
|
|
|
# argument, look again to see whether we can find even
|
|
|
|
# a crippled one. A crippled tgetent() is still useful to
|
|
|
|
# validate values for the TERM environment variable given to
|
|
|
|
# child processes.
|
|
|
|
AC_CACHE_CHECK(for partial tgetent function,cf_cv_lib_part_tgetent,[
|
|
|
|
cf_cv_lib_part_tgetent=no
|
|
|
|
for cf_termlib in $cf_TERMLIB ; do
|
|
|
|
LIBS="$cf_save_LIBS -l$cf_termlib"
|
|
|
|
AC_TRY_LINK([],[tgetent(0, "$cf_TERMVAR")],
|
|
|
|
[echo "there is a terminfo/tgetent in $cf_termlib" 1>&AC_FD_CC
|
|
|
|
cf_cv_lib_part_tgetent="-l$cf_termlib"
|
|
|
|
break])
|
|
|
|
done
|
|
|
|
LIBS="$cf_save_LIBS"
|
|
|
|
])
|
|
|
|
|
|
|
|
if test "$cf_cv_lib_part_tgetent" != no ; then
|
|
|
|
LIBS="$LIBS $cf_cv_lib_part_tgetent"
|
|
|
|
AC_CHECK_HEADERS(termcap.h)
|
|
|
|
|
|
|
|
# If this is linking against ncurses, we'll trigger the
|
|
|
|
# ifdef in resize.c that turns the termcap stuff back off.
|
|
|
|
AC_DEFINE(USE_TERMINFO)
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
2008-03-19 15:15:46 -06:00
|
|
|
dnl CF_GCC_ATTRIBUTES version: 11 updated: 2007/07/29 09:55:12
|
2006-11-26 04:11:12 -07:00
|
|
|
dnl -----------------
|
|
|
|
dnl Test for availability of useful gcc __attribute__ directives to quiet
|
|
|
|
dnl compiler warnings. Though useful, not all are supported -- and contrary
|
|
|
|
dnl to documentation, unrecognized directives cause older compilers to barf.
|
|
|
|
AC_DEFUN([CF_GCC_ATTRIBUTES],
|
|
|
|
[
|
|
|
|
if test "$GCC" = yes
|
|
|
|
then
|
|
|
|
cat > conftest.i <<EOF
|
|
|
|
#ifndef GCC_PRINTF
|
|
|
|
#define GCC_PRINTF 0
|
|
|
|
#endif
|
|
|
|
#ifndef GCC_SCANF
|
|
|
|
#define GCC_SCANF 0
|
|
|
|
#endif
|
|
|
|
#ifndef GCC_NORETURN
|
|
|
|
#define GCC_NORETURN /* nothing */
|
|
|
|
#endif
|
|
|
|
#ifndef GCC_UNUSED
|
|
|
|
#define GCC_UNUSED /* nothing */
|
|
|
|
#endif
|
|
|
|
EOF
|
|
|
|
if test "$GCC" = yes
|
|
|
|
then
|
|
|
|
AC_CHECKING([for $CC __attribute__ directives])
|
|
|
|
cat > conftest.$ac_ext <<EOF
|
2008-03-19 15:15:46 -06:00
|
|
|
#line __oline__ "${as_me-configure}"
|
2006-11-26 04:11:12 -07:00
|
|
|
#include "confdefs.h"
|
|
|
|
#include "conftest.h"
|
|
|
|
#include "conftest.i"
|
|
|
|
#if GCC_PRINTF
|
|
|
|
#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
|
|
|
|
#else
|
|
|
|
#define GCC_PRINTFLIKE(fmt,var) /*nothing*/
|
|
|
|
#endif
|
|
|
|
#if GCC_SCANF
|
|
|
|
#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
|
|
|
|
#else
|
|
|
|
#define GCC_SCANFLIKE(fmt,var) /*nothing*/
|
|
|
|
#endif
|
|
|
|
extern void wow(char *,...) GCC_SCANFLIKE(1,2);
|
|
|
|
extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
|
|
|
|
extern void foo(void) GCC_NORETURN;
|
|
|
|
int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; }
|
|
|
|
EOF
|
|
|
|
for cf_attribute in scanf printf unused noreturn
|
|
|
|
do
|
|
|
|
CF_UPPER(cf_ATTRIBUTE,$cf_attribute)
|
|
|
|
cf_directive="__attribute__(($cf_attribute))"
|
|
|
|
echo "checking for $CC $cf_directive" 1>&AC_FD_CC
|
|
|
|
case $cf_attribute in
|
|
|
|
scanf|printf)
|
|
|
|
cat >conftest.h <<EOF
|
|
|
|
#define GCC_$cf_ATTRIBUTE 1
|
|
|
|
EOF
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
cat >conftest.h <<EOF
|
|
|
|
#define GCC_$cf_ATTRIBUTE $cf_directive
|
|
|
|
EOF
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
if AC_TRY_EVAL(ac_compile); then
|
|
|
|
test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute)
|
|
|
|
cat conftest.h >>confdefs.h
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
else
|
|
|
|
fgrep define conftest.i >>confdefs.h
|
|
|
|
fi
|
|
|
|
rm -rf conftest*
|
|
|
|
fi
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl CF_GCC_VERSION version: 4 updated: 2005/08/27 09:53:42
|
|
|
|
dnl --------------
|
|
|
|
dnl Find version of gcc
|
|
|
|
AC_DEFUN([CF_GCC_VERSION],[
|
|
|
|
AC_REQUIRE([AC_PROG_CC])
|
|
|
|
GCC_VERSION=none
|
|
|
|
if test "$GCC" = yes ; then
|
|
|
|
AC_MSG_CHECKING(version of $CC)
|
|
|
|
GCC_VERSION="`${CC} --version| sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
|
|
|
|
test -z "$GCC_VERSION" && GCC_VERSION=unknown
|
|
|
|
AC_MSG_RESULT($GCC_VERSION)
|
|
|
|
fi
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
2008-08-25 12:05:56 -06:00
|
|
|
dnl CF_GCC_WARNINGS version: 23 updated: 2008/07/26 17:54:02
|
2006-11-26 04:11:12 -07:00
|
|
|
dnl ---------------
|
|
|
|
dnl Check if the compiler supports useful warning options. There's a few that
|
|
|
|
dnl we don't use, simply because they're too noisy:
|
|
|
|
dnl
|
|
|
|
dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x)
|
|
|
|
dnl -Wredundant-decls (system headers make this too noisy)
|
|
|
|
dnl -Wtraditional (combines too many unrelated messages, only a few useful)
|
|
|
|
dnl -Wwrite-strings (too noisy, but should review occasionally). This
|
|
|
|
dnl is enabled for ncurses using "--enable-const".
|
|
|
|
dnl -pedantic
|
|
|
|
dnl
|
|
|
|
dnl Parameter:
|
|
|
|
dnl $1 is an optional list of gcc warning flags that a particular
|
|
|
|
dnl application might want to use, e.g., "no-unused" for
|
|
|
|
dnl -Wno-unused
|
|
|
|
dnl Special:
|
|
|
|
dnl If $with_ext_const is "yes", add a check for -Wwrite-strings
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([CF_GCC_WARNINGS],
|
|
|
|
[
|
|
|
|
AC_REQUIRE([CF_GCC_VERSION])
|
|
|
|
CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)
|
|
|
|
|
|
|
|
cat > conftest.$ac_ext <<EOF
|
2008-03-19 15:15:46 -06:00
|
|
|
#line __oline__ "${as_me-configure}"
|
2006-11-26 04:11:12 -07:00
|
|
|
int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
|
|
|
|
EOF
|
|
|
|
|
|
|
|
if test "$INTEL_COMPILER" = yes
|
|
|
|
then
|
|
|
|
# The "-wdXXX" options suppress warnings:
|
|
|
|
# remark #1419: external declaration in primary source file
|
|
|
|
# remark #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
|
|
|
|
# remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
|
|
|
|
# remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
|
|
|
|
# remark #193: zero used for undefined preprocessing identifier
|
|
|
|
# remark #593: variable "curs_sb_left_arrow" was set but never used
|
|
|
|
# remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
|
|
|
|
# remark #869: parameter "tw" was never referenced
|
|
|
|
# remark #981: operands are evaluated in unspecified order
|
|
|
|
# warning #269: invalid format string conversion
|
|
|
|
|
|
|
|
AC_CHECKING([for $CC warning options])
|
|
|
|
cf_save_CFLAGS="$CFLAGS"
|
|
|
|
EXTRA_CFLAGS="-Wall"
|
2007-08-25 12:53:27 -06:00
|
|
|
for cf_opt in \
|
2006-11-26 04:11:12 -07:00
|
|
|
wd1419 \
|
|
|
|
wd1682 \
|
|
|
|
wd1683 \
|
|
|
|
wd1684 \
|
|
|
|
wd193 \
|
|
|
|
wd279 \
|
|
|
|
wd593 \
|
|
|
|
wd810 \
|
|
|
|
wd869 \
|
|
|
|
wd981
|
|
|
|
do
|
|
|
|
CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
|
|
|
|
if AC_TRY_EVAL(ac_compile); then
|
|
|
|
test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
|
|
|
|
EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
CFLAGS="$cf_save_CFLAGS"
|
|
|
|
|
|
|
|
elif test "$GCC" = yes
|
|
|
|
then
|
|
|
|
AC_CHECKING([for $CC warning options])
|
|
|
|
cf_save_CFLAGS="$CFLAGS"
|
|
|
|
EXTRA_CFLAGS="-W -Wall"
|
|
|
|
cf_warn_CONST=""
|
|
|
|
test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
|
|
|
|
for cf_opt in \
|
|
|
|
Wbad-function-cast \
|
|
|
|
Wcast-align \
|
|
|
|
Wcast-qual \
|
|
|
|
Winline \
|
|
|
|
Wmissing-declarations \
|
|
|
|
Wmissing-prototypes \
|
|
|
|
Wnested-externs \
|
|
|
|
Wpointer-arith \
|
|
|
|
Wshadow \
|
|
|
|
Wstrict-prototypes \
|
|
|
|
Wundef $cf_warn_CONST $1
|
|
|
|
do
|
|
|
|
CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
|
|
|
|
if AC_TRY_EVAL(ac_compile); then
|
|
|
|
test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
|
|
|
|
case $cf_opt in #(vi
|
|
|
|
Wcast-qual) #(vi
|
|
|
|
CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES"
|
|
|
|
;;
|
|
|
|
Winline) #(vi
|
|
|
|
case $GCC_VERSION in
|
2008-08-25 12:05:56 -06:00
|
|
|
[[34]].*)
|
2006-11-26 04:11:12 -07:00
|
|
|
CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
|
|
|
|
continue;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
CFLAGS="$cf_save_CFLAGS"
|
|
|
|
fi
|
|
|
|
rm -f conftest*
|
|
|
|
|
|
|
|
AC_SUBST(EXTRA_CFLAGS)
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07
|
|
|
|
dnl -------------
|
|
|
|
dnl Check if we must define _GNU_SOURCE to get a reasonable value for
|
|
|
|
dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect
|
|
|
|
dnl (or misfeature) of glibc2, which breaks portability of many applications,
|
|
|
|
dnl since it is interwoven with GNU extensions.
|
|
|
|
dnl
|
|
|
|
dnl Well, yes we could work around it...
|
|
|
|
AC_DEFUN([CF_GNU_SOURCE],
|
|
|
|
[
|
|
|
|
AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[
|
|
|
|
AC_TRY_COMPILE([#include <sys/types.h>],[
|
|
|
|
#ifndef _XOPEN_SOURCE
|
|
|
|
make an error
|
|
|
|
#endif],
|
|
|
|
[cf_cv_gnu_source=no],
|
|
|
|
[cf_save="$CPPFLAGS"
|
|
|
|
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
|
|
|
|
AC_TRY_COMPILE([#include <sys/types.h>],[
|
|
|
|
#ifdef _XOPEN_SOURCE
|
|
|
|
make an error
|
|
|
|
#endif],
|
|
|
|
[cf_cv_gnu_source=no],
|
|
|
|
[cf_cv_gnu_source=yes])
|
|
|
|
CPPFLAGS="$cf_save"
|
|
|
|
])
|
|
|
|
])
|
|
|
|
test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl CF_HELP_MESSAGE version: 3 updated: 1998/01/14 10:56:23
|
|
|
|
dnl ---------------
|
|
|
|
dnl Insert text into the help-message, for readability, from AC_ARG_WITH.
|
|
|
|
AC_DEFUN([CF_HELP_MESSAGE],
|
|
|
|
[AC_DIVERT_HELP([$1])dnl
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
2008-08-25 12:05:56 -06:00
|
|
|
dnl CF_IMAKE_CFLAGS version: 30 updated: 2008/03/23 15:04:54
|
2006-11-26 04:11:12 -07:00
|
|
|
dnl ---------------
|
|
|
|
dnl Use imake to obtain compiler flags. We could, in principle, write tests to
|
|
|
|
dnl get these, but if imake is properly configured there is no point in doing
|
|
|
|
dnl this.
|
|
|
|
dnl
|
|
|
|
dnl Parameters (used in constructing a sample Imakefile):
|
|
|
|
dnl $1 = optional value to append to $IMAKE_CFLAGS
|
|
|
|
dnl $2 = optional value to append to $IMAKE_LOADFLAGS
|
|
|
|
AC_DEFUN([CF_IMAKE_CFLAGS],
|
|
|
|
[
|
|
|
|
AC_PATH_PROGS(IMAKE,xmkmf imake)
|
|
|
|
|
|
|
|
if test -n "$IMAKE" ; then
|
|
|
|
|
|
|
|
case $IMAKE in # (vi
|
|
|
|
*/imake)
|
|
|
|
cf_imake_opts="-DUseInstalled=YES" # (vi
|
|
|
|
;;
|
|
|
|
*/util/xmkmf)
|
|
|
|
# A single parameter tells xmkmf where the config-files are:
|
|
|
|
cf_imake_opts="`echo $IMAKE|sed -e s,/config/util/xmkmf,,`" # (vi
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
cf_imake_opts=
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# If it's installed properly, imake (or its wrapper, xmkmf) will point to the
|
|
|
|
# config directory.
|
|
|
|
if mkdir conftestdir; then
|
|
|
|
CDPATH=; export CDPATH
|
|
|
|
cf_makefile=`cd $srcdir;pwd`/Imakefile
|
|
|
|
cd conftestdir
|
|
|
|
|
|
|
|
cat >fix_cflags.sed <<'CF_EOF'
|
|
|
|
s/\\//g
|
2007-08-25 12:53:27 -06:00
|
|
|
s/[[ ]][[ ]]*/ /g
|
2006-11-26 04:11:12 -07:00
|
|
|
s/"//g
|
2007-08-25 12:53:27 -06:00
|
|
|
:pack
|
|
|
|
s/\(=[[^ ]][[^ ]]*\) \([[^-]]\)/\1 \2/g
|
|
|
|
t pack
|
|
|
|
s/\(-D[[a-zA-Z0-9_]][[a-zA-Z0-9_]]*\)=\([[^\'0-9 ]][[^ ]]*\)/\1='\\"\2\\"'/g
|
|
|
|
s/^IMAKE[[ ]]/IMAKE_CFLAGS="/
|
|
|
|
s/ / /g
|
2006-11-26 04:11:12 -07:00
|
|
|
s/$/"/
|
|
|
|
CF_EOF
|
|
|
|
|
|
|
|
cat >fix_lflags.sed <<'CF_EOF'
|
|
|
|
s/^IMAKE[[ ]]*/IMAKE_LOADFLAGS="/
|
|
|
|
s/$/"/
|
|
|
|
CF_EOF
|
|
|
|
|
|
|
|
echo >./Imakefile
|
|
|
|
test -f $cf_makefile && cat $cf_makefile >>./Imakefile
|
|
|
|
|
|
|
|
cat >> ./Imakefile <<'CF_EOF'
|
|
|
|
findstddefs:
|
2007-06-15 13:29:55 -06:00
|
|
|
@echo IMAKE ${ALLDEFINES}ifelse($1,,,[ $1]) | sed -f fix_cflags.sed
|
|
|
|
@echo IMAKE ${EXTRA_LOAD_FLAGS}ifelse($2,,,[ $2]) | sed -f fix_lflags.sed
|
2006-11-26 04:11:12 -07:00
|
|
|
CF_EOF
|
|
|
|
|
|
|
|
if ( $IMAKE $cf_imake_opts 1>/dev/null 2>&AC_FD_CC && test -f Makefile)
|
|
|
|
then
|
|
|
|
CF_VERBOSE(Using $IMAKE $cf_imake_opts)
|
|
|
|
else
|
|
|
|
# sometimes imake doesn't have the config path compiled in. Find it.
|
|
|
|
cf_config=
|
|
|
|
for cf_libpath in $X_LIBS $LIBS ; do
|
|
|
|
case $cf_libpath in # (vi
|
|
|
|
-L*)
|
|
|
|
cf_libpath=`echo .$cf_libpath | sed -e 's/^...//'`
|
|
|
|
cf_libpath=$cf_libpath/X11/config
|
|
|
|
if test -d $cf_libpath ; then
|
|
|
|
cf_config=$cf_libpath
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
if test -z "$cf_config" ; then
|
2008-08-25 12:05:56 -06:00
|
|
|
AC_MSG_WARN(Could not find imake config-directory)
|
2006-11-26 04:11:12 -07:00
|
|
|
else
|
|
|
|
cf_imake_opts="$cf_imake_opts -I$cf_config"
|
|
|
|
if ( $IMAKE -v $cf_imake_opts 2>&AC_FD_CC)
|
|
|
|
then
|
|
|
|
CF_VERBOSE(Using $IMAKE $cf_config)
|
|
|
|
else
|
2008-08-25 12:05:56 -06:00
|
|
|
AC_MSG_WARN(Cannot run $IMAKE)
|
2006-11-26 04:11:12 -07:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# GNU make sometimes prints "make[1]: Entering...", which
|
|
|
|
# would confuse us.
|
|
|
|
eval `make findstddefs 2>/dev/null | grep -v make`
|
|
|
|
|
|
|
|
cd ..
|
|
|
|
rm -rf conftestdir
|
|
|
|
|
2007-06-15 13:29:55 -06:00
|
|
|
# We use ${ALLDEFINES} rather than ${STD_DEFINES} because the former
|
2006-11-26 04:11:12 -07:00
|
|
|
# declares XTFUNCPROTO there. However, some vendors (e.g., SGI) have
|
|
|
|
# modified it to support site.cf, adding a kludge for the /usr/include
|
|
|
|
# directory. Try to filter that out, otherwise gcc won't find its
|
|
|
|
# headers.
|
|
|
|
if test -n "$GCC" ; then
|
|
|
|
if test -n "$IMAKE_CFLAGS" ; then
|
|
|
|
cf_nostdinc=""
|
|
|
|
cf_std_incl=""
|
|
|
|
cf_cpp_opts=""
|
|
|
|
for cf_opt in $IMAKE_CFLAGS
|
|
|
|
do
|
|
|
|
case "$cf_opt" in
|
|
|
|
-nostdinc) #(vi
|
|
|
|
cf_nostdinc="$cf_opt"
|
|
|
|
;;
|
|
|
|
-I/usr/include) #(vi
|
|
|
|
cf_std_incl="$cf_opt"
|
|
|
|
;;
|
|
|
|
*) #(vi
|
|
|
|
cf_cpp_opts="$cf_cpp_opts $cf_opt"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
if test -z "$cf_nostdinc" ; then
|
|
|
|
IMAKE_CFLAGS="$cf_cpp_opts $cf_std_incl"
|
|
|
|
elif test -z "$cf_std_incl" ; then
|
|
|
|
IMAKE_CFLAGS="$cf_cpp_opts $cf_nostdinc"
|
|
|
|
else
|
|
|
|
CF_VERBOSE(suppressed \"$cf_nostdinc\" and \"$cf_std_incl\")
|
|
|
|
IMAKE_CFLAGS="$cf_cpp_opts"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Some imake configurations define PROJECTROOT with an empty value. Remove
|
|
|
|
# the empty definition.
|
|
|
|
case $IMAKE_CFLAGS in
|
|
|
|
*-DPROJECTROOT=/*)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
IMAKE_CFLAGS=`echo "$IMAKE_CFLAGS" |sed -e "s,-DPROJECTROOT=[[ ]], ,"`
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
CF_VERBOSE(IMAKE_CFLAGS $IMAKE_CFLAGS)
|
|
|
|
CF_VERBOSE(IMAKE_LOADFLAGS $IMAKE_LOADFLAGS)
|
|
|
|
|
|
|
|
AC_SUBST(IMAKE_CFLAGS)
|
|
|
|
AC_SUBST(IMAKE_LOADFLAGS)
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl CF_INPUT_METHOD version: 3 updated: 2000/04/11 23:46:57
|
|
|
|
dnl ---------------
|
|
|
|
dnl Check if the X libraries support input-method
|
|
|
|
AC_DEFUN([CF_INPUT_METHOD],
|
|
|
|
[
|
|
|
|
AC_CACHE_CHECK([if X libraries support input-method],cf_cv_input_method,[
|
|
|
|
AC_TRY_LINK([
|
|
|
|
#include <X11/IntrinsicP.h>
|
|
|
|
#include <X11/Xatom.h>
|
|
|
|
#include <X11/Xutil.h>
|
|
|
|
#include <X11/Xmu/Atoms.h>
|
|
|
|
#include <X11/Xmu/Converters.h>
|
|
|
|
#include <X11/Xaw/XawImP.h>
|
|
|
|
],[
|
|
|
|
{
|
|
|
|
XIM xim;
|
|
|
|
XIMStyles *xim_styles = 0;
|
|
|
|
XIMStyle input_style;
|
|
|
|
Widget w = 0;
|
|
|
|
|
|
|
|
XSetLocaleModifiers("@im=none");
|
|
|
|
xim = XOpenIM(XtDisplay(w), NULL, NULL, NULL);
|
|
|
|
XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL);
|
|
|
|
XCloseIM(xim);
|
|
|
|
input_style = (XIMPreeditNothing | XIMStatusNothing);
|
|
|
|
}
|
|
|
|
],
|
|
|
|
[cf_cv_input_method=yes],
|
|
|
|
[cf_cv_input_method=no])])
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl CF_INTEL_COMPILER version: 3 updated: 2005/08/06 18:37:29
|
|
|
|
dnl -----------------
|
|
|
|
dnl Check if the given compiler is really the Intel compiler for Linux. It
|
|
|
|
dnl tries to imitate gcc, but does not return an error when it finds a mismatch
|
|
|
|
dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK.
|
|
|
|
dnl
|
|
|
|
dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
|
|
|
|
dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from
|
|
|
|
dnl the wrappers for gcc and g++ warnings.
|
|
|
|
dnl
|
|
|
|
dnl $1 = GCC (default) or GXX
|
|
|
|
dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
|
|
|
|
dnl $3 = CFLAGS (default) or CXXFLAGS
|
|
|
|
AC_DEFUN([CF_INTEL_COMPILER],[
|
|
|
|
ifelse($2,,INTEL_COMPILER,[$2])=no
|
|
|
|
|
|
|
|
if test "$ifelse($1,,[$1],GCC)" = yes ; then
|
|
|
|
case $host_os in
|
|
|
|
linux*|gnu*)
|
|
|
|
AC_MSG_CHECKING(if this is really Intel ifelse($1,GXX,C++,C) compiler)
|
|
|
|
cf_save_CFLAGS="$ifelse($3,,CFLAGS,[$3])"
|
|
|
|
ifelse($3,,CFLAGS,[$3])="$ifelse($3,,CFLAGS,[$3]) -no-gcc"
|
|
|
|
AC_TRY_COMPILE([],[
|
|
|
|
#ifdef __INTEL_COMPILER
|
|
|
|
#else
|
|
|
|
make an error
|
|
|
|
#endif
|
|
|
|
],[ifelse($2,,INTEL_COMPILER,[$2])=yes
|
|
|
|
cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc"
|
|
|
|
],[])
|
|
|
|
ifelse($3,,CFLAGS,[$3])="$cf_save_CFLAGS"
|
|
|
|
AC_MSG_RESULT($ifelse($2,,INTEL_COMPILER,[$2]))
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl CF_LASTLOG version: 4 updated: 2002/10/27 23:21:42
|
|
|
|
dnl ----------
|
|
|
|
dnl Check for header defining _PATH_LASTLOG, or failing that, see if the lastlog
|
|
|
|
dnl file exists.
|
|
|
|
AC_DEFUN([CF_LASTLOG],
|
|
|
|
[
|
|
|
|
AC_CHECK_HEADERS(lastlog.h paths.h)
|
|
|
|
AC_CACHE_CHECK(for lastlog path,cf_cv_path_lastlog,[
|
|
|
|
AC_TRY_COMPILE([
|
|
|
|
#include <sys/types.h>
|
|
|
|
#ifdef HAVE_LASTLOG_H
|
|
|
|
#include <lastlog.h>
|
|
|
|
#else
|
|
|
|
#ifdef HAVE_PATHS_H
|
|
|
|
#include <paths.h>
|
|
|
|
#endif
|
|
|
|
#endif],[char *path = _PATH_LASTLOG],
|
|
|
|
[cf_cv_path_lastlog="_PATH_LASTLOG"],
|
|
|
|
[if test -f /usr/adm/lastlog ; then
|
|
|
|
cf_cv_path_lastlog=/usr/adm/lastlog
|
|
|
|
else
|
|
|
|
cf_cv_path_lastlog=no
|
|
|
|
fi])
|
|
|
|
])
|
|
|
|
test $cf_cv_path_lastlog != no && AC_DEFINE(USE_LASTLOG)
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
2008-03-19 15:15:46 -06:00
|
|
|
dnl CF_MSG_LOG version: 4 updated: 2007/07/29 09:55:12
|
2006-11-26 04:11:12 -07:00
|
|
|
dnl ----------
|
|
|
|
dnl Write a debug message to config.log, along with the line number in the
|
|
|
|
dnl configure script.
|
|
|
|
AC_DEFUN([CF_MSG_LOG],[
|
2008-03-19 15:15:46 -06:00
|
|
|
echo "${as_me-configure}:__oline__: testing $* ..." 1>&AC_FD_CC
|
2006-11-26 04:11:12 -07:00
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl CF_PATH_PROG version: 6 updated: 2004/01/26 20:58:41
|
|
|
|
dnl ------------
|
|
|
|
dnl Check for a given program, defining corresponding symbol.
|
|
|
|
dnl $1 = environment variable, which is suffixed by "_PATH" in the #define.
|
|
|
|
dnl $2 = program name to find.
|
|
|
|
dnl $3 = optional list of additional program names to test.
|
|
|
|
dnl
|
|
|
|
dnl If there is more than one token in the result, #define the remaining tokens
|
|
|
|
dnl to $1_ARGS. We need this for 'install' in particular.
|
|
|
|
dnl
|
|
|
|
dnl FIXME: we should allow this to be overridden by environment variables
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([CF_PATH_PROG],[
|
|
|
|
test -z "[$]$1" && $1=$2
|
|
|
|
AC_PATH_PROGS($1,[$]$1 $2 $3,[$]$1)
|
|
|
|
|
|
|
|
cf_path_prog=""
|
|
|
|
cf_path_args=""
|
|
|
|
IFS="${IFS= }"; cf_save_ifs="$IFS"
|
|
|
|
case $host_os in #(vi
|
|
|
|
os2*) #(vi
|
|
|
|
IFS="${IFS};"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
IFS="${IFS}:"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
for cf_temp in $ac_cv_path_$1
|
|
|
|
do
|
|
|
|
if test -z "$cf_path_prog" ; then
|
|
|
|
if test "$with_full_paths" = yes ; then
|
|
|
|
CF_PATH_SYNTAX(cf_temp,break)
|
|
|
|
cf_path_prog="$cf_temp"
|
|
|
|
else
|
|
|
|
cf_path_prog="`basename $cf_temp`"
|
|
|
|
fi
|
|
|
|
elif test -z "$cf_path_args" ; then
|
|
|
|
cf_path_args="$cf_temp"
|
|
|
|
else
|
|
|
|
cf_path_args="$cf_path_args $cf_temp"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
IFS="$cf_save_ifs"
|
|
|
|
|
|
|
|
if test -n "$cf_path_prog" ; then
|
|
|
|
CF_MSG_LOG(defining path for ${cf_path_prog})
|
|
|
|
AC_DEFINE_UNQUOTED($1_PATH,"$cf_path_prog")
|
|
|
|
test -n "$cf_path_args" && AC_DEFINE_UNQUOTED($1_ARGS,"$cf_path_args")
|
|
|
|
fi
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
2008-08-25 12:05:56 -06:00
|
|
|
dnl CF_PATH_SYNTAX version: 12 updated: 2008/03/23 14:45:59
|
2006-11-26 04:11:12 -07:00
|
|
|
dnl --------------
|
|
|
|
dnl Check the argument to see that it looks like a pathname. Rewrite it if it
|
|
|
|
dnl begins with one of the prefix/exec_prefix variables, and then again if the
|
|
|
|
dnl result begins with 'NONE'. This is necessary to work around autoconf's
|
|
|
|
dnl delayed evaluation of those symbols.
|
|
|
|
AC_DEFUN([CF_PATH_SYNTAX],[
|
2007-06-15 13:29:55 -06:00
|
|
|
if test "x$prefix" != xNONE; then
|
|
|
|
cf_path_syntax="$prefix"
|
|
|
|
else
|
|
|
|
cf_path_syntax="$ac_default_prefix"
|
|
|
|
fi
|
|
|
|
|
2006-11-26 04:11:12 -07:00
|
|
|
case ".[$]$1" in #(vi
|
|
|
|
.\[$]\(*\)*|.\'*\'*) #(vi
|
|
|
|
;;
|
|
|
|
..|./*|.\\*) #(vi
|
|
|
|
;;
|
|
|
|
.[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX
|
|
|
|
;;
|
|
|
|
.\[$]{*prefix}*) #(vi
|
|
|
|
eval $1="[$]$1"
|
|
|
|
case ".[$]$1" in #(vi
|
|
|
|
.NONE/*)
|
2007-06-15 13:29:55 -06:00
|
|
|
$1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
|
2006-11-26 04:11:12 -07:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;; #(vi
|
|
|
|
.no|.NONE/*)
|
2007-06-15 13:29:55 -06:00
|
|
|
$1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
|
2006-11-26 04:11:12 -07:00
|
|
|
;;
|
|
|
|
*)
|
2008-08-25 12:05:56 -06:00
|
|
|
ifelse($2,,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2)
|
2006-11-26 04:11:12 -07:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl CF_POSIX_C_SOURCE version: 6 updated: 2005/07/14 20:25:10
|
|
|
|
dnl -----------------
|
|
|
|
dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed.
|
|
|
|
dnl
|
|
|
|
dnl POSIX.1-1990 _POSIX_SOURCE
|
|
|
|
dnl POSIX.1-1990 and _POSIX_SOURCE and
|
|
|
|
dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2
|
|
|
|
dnl Bindings Option
|
|
|
|
dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L
|
|
|
|
dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L
|
|
|
|
dnl X/Open 2000 _POSIX_C_SOURCE=200112L
|
|
|
|
dnl
|
|
|
|
dnl Parameters:
|
|
|
|
dnl $1 is the nominal value for _POSIX_C_SOURCE
|
|
|
|
AC_DEFUN([CF_POSIX_C_SOURCE],
|
|
|
|
[
|
|
|
|
cf_POSIX_C_SOURCE=ifelse($1,,199506L,$1)
|
|
|
|
|
|
|
|
cf_save_CFLAGS="$CFLAGS"
|
|
|
|
cf_save_CPPFLAGS="$CPPFLAGS"
|
|
|
|
|
|
|
|
CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE)
|
|
|
|
CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE)
|
|
|
|
|
|
|
|
AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[
|
|
|
|
CF_MSG_LOG(if the symbol is already defined go no further)
|
|
|
|
AC_TRY_COMPILE([#include <sys/types.h>],[
|
|
|
|
#ifndef _POSIX_C_SOURCE
|
|
|
|
make an error
|
|
|
|
#endif],
|
|
|
|
[cf_cv_posix_c_source=no],
|
|
|
|
[cf_want_posix_source=no
|
|
|
|
case .$cf_POSIX_C_SOURCE in #(vi
|
|
|
|
.[[12]]??*) #(vi
|
|
|
|
cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
|
|
|
|
;;
|
|
|
|
.2) #(vi
|
|
|
|
cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
|
|
|
|
cf_want_posix_source=yes
|
|
|
|
;;
|
|
|
|
.*)
|
|
|
|
cf_want_posix_source=yes
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
if test "$cf_want_posix_source" = yes ; then
|
|
|
|
AC_TRY_COMPILE([#include <sys/types.h>],[
|
|
|
|
#ifdef _POSIX_SOURCE
|
|
|
|
make an error
|
|
|
|
#endif],[],
|
|
|
|
cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE")
|
|
|
|
fi
|
|
|
|
CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE)
|
|
|
|
CFLAGS="$cf_trim_CFLAGS"
|
|
|
|
CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source"
|
|
|
|
CF_MSG_LOG(if the second compile does not leave our definition intact error)
|
|
|
|
AC_TRY_COMPILE([#include <sys/types.h>],[
|
|
|
|
#ifndef _POSIX_C_SOURCE
|
|
|
|
make an error
|
|
|
|
#endif],,
|
|
|
|
[cf_cv_posix_c_source=no])
|
|
|
|
CFLAGS="$cf_save_CFLAGS"
|
|
|
|
CPPFLAGS="$cf_save_CPPFLAGS"
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
if test "$cf_cv_posix_c_source" != no ; then
|
|
|
|
CFLAGS="$cf_trim_CFLAGS"
|
|
|
|
CPPFLAGS="$cf_trim_CPPFLAGS"
|
|
|
|
if test "$cf_cv_cc_u_d_options" = yes ; then
|
|
|
|
cf_temp_posix_c_source=`echo "$cf_cv_posix_c_source" | \
|
|
|
|
sed -e 's/-D/-U/g' -e 's/=[[^ ]]*//g'`
|
|
|
|
CPPFLAGS="$CPPFLAGS $cf_temp_posix_c_source"
|
|
|
|
fi
|
|
|
|
CPPFLAGS="$CPPFLAGS $cf_cv_posix_c_source"
|
|
|
|
fi
|
|
|
|
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
2007-06-15 13:29:55 -06:00
|
|
|
dnl CF_POSIX_SAVED_IDS version: 7 updated: 2007/03/14 16:43:53
|
2006-11-26 04:11:12 -07:00
|
|
|
dnl ------------------
|
|
|
|
dnl
|
|
|
|
dnl Check first if saved-ids are always supported. Some systems
|
|
|
|
dnl may require runtime checks.
|
|
|
|
AC_DEFUN([CF_POSIX_SAVED_IDS],
|
|
|
|
[
|
|
|
|
AC_CHECK_HEADERS( \
|
|
|
|
sys/param.h \
|
|
|
|
)
|
|
|
|
|
|
|
|
AC_CACHE_CHECK(if POSIX saved-ids are supported,cf_cv_posix_saved_ids,[
|
|
|
|
AC_TRY_LINK(
|
|
|
|
[
|
|
|
|
#include <unistd.h>
|
|
|
|
#ifdef HAVE_SYS_PARAM_H
|
|
|
|
#include <sys/param.h> /* this may define "BSD" */
|
|
|
|
#endif
|
|
|
|
],[
|
|
|
|
#if defined(_POSIX_SAVED_IDS) && (_POSIX_SAVED_IDS > 0)
|
|
|
|
void *p = (void *) seteuid;
|
|
|
|
int x = seteuid(geteuid());
|
|
|
|
#elif defined(BSD) && (BSD >= 199103)
|
|
|
|
/* The BSD's may implement the runtime check - and it fails.
|
|
|
|
* However, saved-ids work almost like POSIX (close enough for most uses).
|
|
|
|
*/
|
|
|
|
#else
|
|
|
|
make an error
|
|
|
|
#endif
|
|
|
|
],[cf_cv_posix_saved_ids=yes
|
|
|
|
],[
|
|
|
|
AC_TRY_RUN([
|
|
|
|
#ifdef HAVE_STDLIB_H
|
|
|
|
#include <stdlib.h>
|
|
|
|
#endif
|
|
|
|
#include <unistd.h>
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
void *p = (void *) seteuid;
|
|
|
|
long code = sysconf(_SC_SAVED_IDS);
|
2007-06-15 13:29:55 -06:00
|
|
|
${cf_cv_main_return:-return} ((code > 0) ? 0 : 1);
|
2006-11-26 04:11:12 -07:00
|
|
|
}],
|
|
|
|
cf_cv_posix_saved_ids=yes,
|
|
|
|
cf_cv_posix_saved_ids=no,
|
|
|
|
cf_cv_posix_saved_ids=unknown)
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
test "$cf_cv_posix_saved_ids" = yes && AC_DEFINE(HAVE_POSIX_SAVED_IDS)
|
|
|
|
])
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl CF_POSIX_WAIT version: 2 updated: 2000/05/29 16:16:04
|
|
|
|
dnl -------------
|
|
|
|
dnl Check for POSIX wait support
|
|
|
|
AC_DEFUN([CF_POSIX_WAIT],
|
|
|
|
[
|
|
|
|
AC_REQUIRE([AC_HEADER_SYS_WAIT])
|
|
|
|
AC_CACHE_CHECK(for POSIX wait functions,cf_cv_posix_wait,[
|
|
|
|
AC_TRY_LINK([
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#ifdef HAVE_SYS_WAIT_H
|
|
|
|
#include <sys/wait.h>
|
|
|
|
#endif
|
|
|
|
],[
|
|
|
|
int stat_loc;
|
|
|
|
pid_t pid = waitpid(-1, &stat_loc, WNOHANG|WUNTRACED);
|
|
|
|
pid_t pid2 = wait(&stat_loc);
|
|
|
|
],
|
|
|
|
[cf_cv_posix_wait=yes],
|
|
|
|
[cf_cv_posix_wait=no])
|
|
|
|
])
|
|
|
|
test "$cf_cv_posix_wait" = yes && AC_DEFINE(USE_POSIX_WAIT)
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
2007-06-15 13:29:55 -06:00
|
|
|
dnl CF_PROCFS_CWD version: 2 updated: 2007/03/12 20:39:04
|
|
|
|
dnl -------------
|
|
|
|
dnl Find /proc tree (may be in a different place) which implements the "cwd"
|
|
|
|
dnl link.
|
|
|
|
AC_DEFUN([CF_PROCFS_CWD],[
|
|
|
|
AC_CACHE_CHECK(for proc tree with cwd-support,cf_cv_procfs_cwd,[
|
|
|
|
cf_cv_procfs_cwd=no
|
|
|
|
for cf_path in /proc /compat/linux/proc /usr/compat/linux/proc
|
|
|
|
do
|
|
|
|
if test -d $cf_path && \
|
|
|
|
test -d $cf_path/$$ && \
|
|
|
|
( test -d $cf_path/$$/cwd || \
|
|
|
|
test -L $cf_path/$$/cwd ); then
|
|
|
|
cf_cv_procfs_cwd=$cf_path
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
])
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
2006-11-26 04:11:12 -07:00
|
|
|
dnl CF_PROG_CC_U_D version: 1 updated: 2005/07/14 16:59:30
|
|
|
|
dnl --------------
|
|
|
|
dnl Check if C (preprocessor) -U and -D options are processed in the order
|
|
|
|
dnl given rather than by type of option. Some compilers insist on apply all
|
|
|
|
dnl of the -U options after all of the -D options. Others allow mixing them,
|
|
|
|
dnl and may predefine symbols that conflict with those we define.
|
|
|
|
AC_DEFUN([CF_PROG_CC_U_D],
|
|
|
|
[
|
|
|
|
AC_CACHE_CHECK(if $CC -U and -D options work together,cf_cv_cc_u_d_options,[
|
|
|
|
cf_save_CPPFLAGS="$CPPFLAGS"
|
|
|
|
CPPFLAGS="-UU_D_OPTIONS -DU_D_OPTIONS -DD_U_OPTIONS -UD_U_OPTIONS"
|
|
|
|
AC_TRY_COMPILE([],[
|
|
|
|
#ifndef U_D_OPTIONS
|
|
|
|
make an undefined-error
|
|
|
|
#endif
|
|
|
|
#ifdef D_U_OPTIONS
|
|
|
|
make a defined-error
|
|
|
|
#endif
|
|
|
|
],[
|
|
|
|
cf_cv_cc_u_d_options=yes],[
|
|
|
|
cf_cv_cc_u_d_options=no])
|
|
|
|
CPPFLAGS="$cf_save_CPPFLAGS"
|
|
|
|
])
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl CF_PROG_EXT version: 10 updated: 2004/01/03 19:28:18
|
|
|
|
dnl -----------
|
|
|
|
dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX.
|
|
|
|
AC_DEFUN([CF_PROG_EXT],
|
|
|
|
[
|
|
|
|
AC_REQUIRE([CF_CHECK_CACHE])
|
|
|
|
case $cf_cv_system_name in
|
|
|
|
os2*)
|
|
|
|
CFLAGS="$CFLAGS -Zmt"
|
|
|
|
CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__"
|
|
|
|
CXXFLAGS="$CXXFLAGS -Zmt"
|
|
|
|
# autoconf's macro sets -Zexe and suffix both, which conflict:w
|
|
|
|
LDFLAGS="$LDFLAGS -Zmt -Zcrtdll"
|
|
|
|
ac_cv_exeext=.exe
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
AC_EXEEXT
|
|
|
|
AC_OBJEXT
|
|
|
|
|
|
|
|
PROG_EXT="$EXEEXT"
|
|
|
|
AC_SUBST(PROG_EXT)
|
|
|
|
test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT")
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl CF_REGEX version: 3 updated: 1997/11/01 14:26:01
|
|
|
|
dnl --------
|
|
|
|
dnl Attempt to determine if we've got one of the flavors of regular-expression
|
|
|
|
dnl code that we can support.
|
|
|
|
AC_DEFUN([CF_REGEX],
|
|
|
|
[
|
|
|
|
AC_MSG_CHECKING([for regular-expression headers])
|
|
|
|
AC_CACHE_VAL(cf_cv_regex,[
|
|
|
|
AC_TRY_LINK([#include <sys/types.h>
|
|
|
|
#include <regex.h>],[
|
|
|
|
regex_t *p;
|
|
|
|
int x = regcomp(p, "", 0);
|
|
|
|
int y = regexec(p, "", 0, 0, 0);
|
|
|
|
regfree(p);
|
|
|
|
],[cf_cv_regex="regex.h"],[
|
|
|
|
AC_TRY_LINK([#include <regexp.h>],[
|
|
|
|
char *p = compile("", "", "", 0);
|
|
|
|
int x = step("", "");
|
|
|
|
],[cf_cv_regex="regexp.h"],[
|
|
|
|
cf_save_LIBS="$LIBS"
|
|
|
|
LIBS="-lgen $LIBS"
|
|
|
|
AC_TRY_LINK([#include <regexpr.h>],[
|
|
|
|
char *p = compile("", "", "");
|
|
|
|
int x = step("", "");
|
|
|
|
],[cf_cv_regex="regexpr.h"],[LIBS="$cf_save_LIBS"])])])
|
|
|
|
])
|
|
|
|
AC_MSG_RESULT($cf_cv_regex)
|
|
|
|
case $cf_cv_regex in
|
|
|
|
regex.h) AC_DEFINE(HAVE_REGEX_H_FUNCS) ;;
|
|
|
|
regexp.h) AC_DEFINE(HAVE_REGEXP_H_FUNCS) ;;
|
|
|
|
regexpr.h) AC_DEFINE(HAVE_REGEXPR_H_FUNCS) ;;
|
|
|
|
esac
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl CF_REMOVE_DEFINE version: 2 updated: 2005/07/09 16:12:18
|
|
|
|
dnl ----------------
|
|
|
|
dnl Remove all -U and -D options that refer to the given symbol from a list
|
|
|
|
dnl of C compiler options. This works around the problem that not all
|
|
|
|
dnl compilers process -U and -D options from left-to-right, so a -U option
|
|
|
|
dnl cannot be used to cancel the effect of a preceding -D option.
|
|
|
|
dnl
|
|
|
|
dnl $1 = target (which could be the same as the source variable)
|
|
|
|
dnl $2 = source (including '$')
|
|
|
|
dnl $3 = symbol to remove
|
|
|
|
define([CF_REMOVE_DEFINE],
|
|
|
|
[
|
|
|
|
# remove $3 symbol from $2
|
|
|
|
$1=`echo "$2" | \
|
|
|
|
sed -e 's/-[[UD]]$3\(=[[^ ]]*\)\?[[ ]]/ /g' \
|
|
|
|
-e 's/-[[UD]]$3\(=[[^ ]]*\)\?[$]//g'`
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl CF_SIGWINCH version: 1 updated: 2006/04/02 16:41:09
|
|
|
|
dnl -----------
|
|
|
|
dnl Use this macro after CF_XOPEN_SOURCE, but do not require it (not all
|
|
|
|
dnl programs need this test).
|
|
|
|
dnl
|
|
|
|
dnl This is really a MacOS X 10.4.3 workaround. Defining _POSIX_C_SOURCE
|
|
|
|
dnl forces SIGWINCH to be undefined (breaks xterm, ncurses). Oddly, the struct
|
|
|
|
dnl winsize declaration is left alone - we may revisit this if Apple choose to
|
|
|
|
dnl break that part of the interface as well.
|
|
|
|
AC_DEFUN([CF_SIGWINCH],
|
|
|
|
[
|
|
|
|
AC_CACHE_CHECK(if SIGWINCH is defined,cf_cv_define_sigwinch,[
|
|
|
|
AC_TRY_COMPILE([
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/signal.h>
|
|
|
|
],[int x = SIGWINCH],
|
|
|
|
[cf_cv_define_sigwinch=yes],
|
|
|
|
[AC_TRY_COMPILE([
|
|
|
|
#undef _XOPEN_SOURCE
|
|
|
|
#undef _POSIX_SOURCE
|
|
|
|
#undef _POSIX_C_SOURCE
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/signal.h>
|
|
|
|
],[int x = SIGWINCH],
|
|
|
|
[cf_cv_define_sigwinch=maybe],
|
|
|
|
[cf_cv_define_sigwinch=no])
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
if test "$cf_cv_define_sigwinch" = maybe ; then
|
|
|
|
AC_CACHE_CHECK(for actual SIGWINCH definition,cf_cv_fixup_sigwinch,[
|
|
|
|
cf_cv_fixup_sigwinch=unknown
|
|
|
|
cf_sigwinch=32
|
|
|
|
while test $cf_sigwinch != 1
|
|
|
|
do
|
|
|
|
AC_TRY_COMPILE([
|
|
|
|
#undef _XOPEN_SOURCE
|
|
|
|
#undef _POSIX_SOURCE
|
|
|
|
#undef _POSIX_C_SOURCE
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/signal.h>
|
|
|
|
],[
|
|
|
|
#if SIGWINCH != $cf_sigwinch
|
|
|
|
make an error
|
|
|
|
#endif
|
|
|
|
int x = SIGWINCH],
|
|
|
|
[cf_cv_fixup_sigwinch=$cf_sigwinch
|
|
|
|
break])
|
|
|
|
|
|
|
|
cf_sigwinch=`expr $cf_sigwinch - 1`
|
|
|
|
done
|
|
|
|
])
|
|
|
|
|
|
|
|
if test "$cf_cv_fixup_sigwinch" != unknown ; then
|
|
|
|
CPPFLAGS="$CPPFLAGS -DSIGWINCH=$cf_cv_fixup_sigwinch"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl CF_SIG_ATOMIC_T version: 2 updated: 2005/09/18 17:27:12
|
|
|
|
dnl ---------------
|
|
|
|
dnl signal handler, but there are some gcc depedencies in that recommendation.
|
|
|
|
dnl Try anyway.
|
|
|
|
AC_DEFUN([CF_SIG_ATOMIC_T],
|
|
|
|
[
|
|
|
|
AC_MSG_CHECKING(for signal global datatype)
|
|
|
|
AC_CACHE_VAL(cf_cv_sig_atomic_t,[
|
|
|
|
for cf_type in \
|
|
|
|
"volatile sig_atomic_t" \
|
|
|
|
"sig_atomic_t" \
|
|
|
|
"int"
|
|
|
|
do
|
|
|
|
AC_TRY_COMPILE([
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <signal.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
extern $cf_type x;
|
|
|
|
$cf_type x;
|
|
|
|
static void handler(int sig)
|
|
|
|
{
|
|
|
|
x = 5;
|
|
|
|
}],
|
|
|
|
[signal(SIGINT, handler);
|
|
|
|
x = 1],
|
|
|
|
[cf_cv_sig_atomic_t=$cf_type],
|
|
|
|
[cf_cv_sig_atomic_t=no])
|
|
|
|
test "$cf_cv_sig_atomic_t" != no && break
|
|
|
|
done
|
|
|
|
])
|
|
|
|
AC_MSG_RESULT($cf_cv_sig_atomic_t)
|
|
|
|
test "$cf_cv_sig_atomic_t" != no && AC_DEFINE_UNQUOTED(SIG_ATOMIC_T, $cf_cv_sig_atomic_t)
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl CF_SIZE_T version: 4 updated: 2000/01/22 00:19:54
|
|
|
|
dnl ---------
|
|
|
|
dnl On both Ultrix and CLIX, I find size_t defined in <stdio.h>
|
|
|
|
AC_DEFUN([CF_SIZE_T],
|
|
|
|
[
|
|
|
|
AC_MSG_CHECKING(for size_t in <sys/types.h> or <stdio.h>)
|
|
|
|
AC_CACHE_VAL(cf_cv_type_size_t,[
|
|
|
|
AC_TRY_COMPILE([
|
|
|
|
#include <sys/types.h>
|
|
|
|
#ifdef STDC_HEADERS
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#endif
|
|
|
|
#include <stdio.h>],
|
|
|
|
[size_t x],
|
|
|
|
[cf_cv_type_size_t=yes],
|
|
|
|
[cf_cv_type_size_t=no])
|
|
|
|
])
|
|
|
|
AC_MSG_RESULT($cf_cv_type_size_t)
|
|
|
|
test $cf_cv_type_size_t = no && AC_DEFINE(size_t, unsigned)
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl CF_STRUCT_LASTLOG version: 1 updated: 2006/03/12 17:46:43
|
|
|
|
dnl -----------------
|
|
|
|
dnl Check for header defining struct lastlog, ensure that its .ll_time member
|
|
|
|
dnl is compatible with time().
|
|
|
|
AC_DEFUN([CF_STRUCT_LASTLOG],
|
|
|
|
[
|
|
|
|
AC_CHECK_HEADERS(lastlog.h)
|
|
|
|
AC_CACHE_CHECK(for struct lastlog,cf_cv_struct_lastlog,[
|
|
|
|
AC_TRY_RUN([
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include <lastlog.h>
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
struct lastlog data;
|
|
|
|
return (sizeof(data.ll_time) != sizeof(time_t));
|
|
|
|
}],[
|
|
|
|
cf_cv_struct_lastlog=yes],[
|
|
|
|
cf_cv_struct_lastlog=no],[
|
|
|
|
cf_cv_struct_lastlog=unknown])])
|
|
|
|
|
|
|
|
test $cf_cv_struct_lastlog != no && AC_DEFINE(USE_STRUCT_LASTLOG)
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl CF_SVR4 version: 3 updated: 2000/05/31 10:16:52
|
|
|
|
dnl -------
|
|
|
|
dnl Check if this is an SVR4 system. We need the definition for xterm
|
|
|
|
AC_DEFUN([CF_SVR4],
|
|
|
|
[
|
|
|
|
AC_CHECK_LIB(elf, elf_begin,[
|
|
|
|
AC_CACHE_CHECK(if this is an SVR4 system, cf_cv_svr4,[
|
|
|
|
AC_TRY_COMPILE([
|
|
|
|
#include <elf.h>
|
|
|
|
#include <sys/termio.h>
|
|
|
|
],[
|
|
|
|
static struct termio d_tio;
|
|
|
|
d_tio.c_cc[VINTR] = 0;
|
|
|
|
d_tio.c_cc[VQUIT] = 0;
|
|
|
|
d_tio.c_cc[VERASE] = 0;
|
|
|
|
d_tio.c_cc[VKILL] = 0;
|
|
|
|
d_tio.c_cc[VEOF] = 0;
|
|
|
|
d_tio.c_cc[VEOL] = 0;
|
|
|
|
d_tio.c_cc[VMIN] = 0;
|
|
|
|
d_tio.c_cc[VTIME] = 0;
|
|
|
|
d_tio.c_cc[VLNEXT] = 0;
|
|
|
|
],
|
|
|
|
[cf_cv_svr4=yes],
|
|
|
|
[cf_cv_svr4=no])
|
|
|
|
])
|
|
|
|
])
|
|
|
|
test "$cf_cv_svr4" = yes && AC_DEFINE(SVR4)
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
2007-06-15 13:29:55 -06:00
|
|
|
dnl CF_SYSV version: 13 updated: 2006/08/20 14:55:37
|
2006-11-26 04:11:12 -07:00
|
|
|
dnl -------
|
|
|
|
dnl Check if this is a SYSV platform, e.g., as used in <X11/Xos.h>, and whether
|
|
|
|
dnl defining it will be helpful. The following features are used to check:
|
|
|
|
dnl
|
2007-06-15 13:29:55 -06:00
|
|
|
dnl a) bona-fide SVSV doesn't use const for sys_errlist[]. Since this is a
|
2006-11-26 04:11:12 -07:00
|
|
|
dnl legacy (pre-ANSI) feature, const should not apply. Modern systems only
|
|
|
|
dnl declare strerror(). Xos.h declares the legacy form of str_errlist[], and
|
|
|
|
dnl a compile-time error will result from trying to assign to a const array.
|
|
|
|
dnl
|
|
|
|
dnl b) compile with headers that exist on SYSV hosts.
|
|
|
|
dnl
|
|
|
|
dnl c) compile with type definitions that differ on SYSV hosts from standard C.
|
|
|
|
AC_DEFUN([CF_SYSV],
|
|
|
|
[
|
|
|
|
AC_CHECK_HEADERS( \
|
|
|
|
termios.h \
|
|
|
|
stdlib.h \
|
|
|
|
X11/Intrinsic.h \
|
|
|
|
)
|
|
|
|
|
|
|
|
AC_REQUIRE([CF_SYS_ERRLIST])
|
|
|
|
|
|
|
|
AC_CACHE_CHECK(if we should define SYSV,cf_cv_sysv,[
|
|
|
|
AC_TRY_COMPILE([
|
|
|
|
#undef SYSV
|
|
|
|
#define SYSV 1 /* get Xos.h to declare sys_errlist[] */
|
|
|
|
#ifdef HAVE_STDLIB_H
|
|
|
|
#include <stdlib.h> /* look for wchar_t */
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_X11_INTRINSIC_H
|
|
|
|
#include <X11/Intrinsic.h> /* Intrinsic.h has other traps... */
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_TERMIOS_H /* needed for HPUX 10.20 */
|
|
|
|
#include <termios.h>
|
|
|
|
#define STRUCT_TERMIOS struct termios
|
|
|
|
#else
|
|
|
|
#define STRUCT_TERMIOS struct termio
|
|
|
|
#endif
|
|
|
|
#include <curses.h>
|
|
|
|
#include <term.h> /* eliminate most BSD hacks */
|
|
|
|
#include <errno.h> /* declare sys_errlist on older systems */
|
|
|
|
#include <sys/termio.h> /* eliminate most of the remaining ones */
|
|
|
|
],[
|
|
|
|
static STRUCT_TERMIOS d_tio;
|
|
|
|
d_tio.c_cc[VINTR] = 0;
|
|
|
|
d_tio.c_cc[VQUIT] = 0;
|
|
|
|
d_tio.c_cc[VERASE] = 0;
|
|
|
|
d_tio.c_cc[VKILL] = 0;
|
|
|
|
d_tio.c_cc[VEOF] = 0;
|
|
|
|
d_tio.c_cc[VEOL] = 0;
|
|
|
|
d_tio.c_cc[VMIN] = 0;
|
|
|
|
d_tio.c_cc[VTIME] = 0;
|
|
|
|
#if defined(HAVE_SYS_ERRLIST) && !defined(DECL_SYS_ERRLIST)
|
|
|
|
sys_errlist[0] = ""; /* Cygwin mis-declares this */
|
|
|
|
#endif
|
|
|
|
],
|
|
|
|
[cf_cv_sysv=yes],
|
|
|
|
[cf_cv_sysv=no])
|
|
|
|
])
|
|
|
|
test "$cf_cv_sysv" = yes && AC_DEFINE(SYSV)
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl CF_SYSV_UTMP version: 5 updated: 2001/12/27 12:55:07
|
|
|
|
dnl ------------
|
|
|
|
dnl Check if this is a SYSV flavor of UTMP
|
|
|
|
AC_DEFUN([CF_SYSV_UTMP],
|
|
|
|
[
|
|
|
|
AC_CACHE_CHECK(if $cf_cv_have_utmp is SYSV flavor,cf_cv_sysv_utmp,[
|
|
|
|
test "$cf_cv_have_utmp" = "utmp" && cf_prefix="ut" || cf_prefix="utx"
|
|
|
|
AC_TRY_LINK([
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <${cf_cv_have_utmp}.h>],[
|
|
|
|
struct $cf_cv_have_utmp x;
|
|
|
|
set${cf_prefix}ent ();
|
|
|
|
get${cf_prefix}id(&x);
|
|
|
|
put${cf_prefix}line(&x);
|
|
|
|
end${cf_prefix}ent();],
|
|
|
|
[cf_cv_sysv_utmp=yes],
|
|
|
|
[cf_cv_sysv_utmp=no])
|
|
|
|
])
|
|
|
|
test $cf_cv_sysv_utmp = yes && AC_DEFINE(USE_SYSV_UTMP)
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl CF_SYS_ERRLIST version: 6 updated: 2001/12/30 13:03:23
|
|
|
|
dnl --------------
|
|
|
|
dnl Check for declaration of sys_nerr and sys_errlist in one of stdio.h and
|
|
|
|
dnl errno.h. Declaration of sys_errlist on BSD4.4 interferes with our
|
|
|
|
dnl declaration. Reported by Keith Bostic.
|
|
|
|
AC_DEFUN([CF_SYS_ERRLIST],
|
|
|
|
[
|
|
|
|
CF_CHECK_ERRNO(sys_nerr)
|
|
|
|
CF_CHECK_ERRNO(sys_errlist)
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl CF_TERMIO_C_ISPEED version: 2 updated: 2000/05/29 16:16:04
|
|
|
|
dnl ------------------
|
|
|
|
dnl Check for SGI's broken redefinition of baud rates introduced in IRIX 6.5
|
|
|
|
dnl (there doesn't appear to be a useful predefined symbol).
|
|
|
|
AC_DEFUN([CF_TERMIO_C_ISPEED],
|
|
|
|
[
|
|
|
|
AC_CACHE_CHECK(for IRIX 6.5 baud-rate redefinitions,cf_cv_termio_c_ispeed,[
|
|
|
|
AC_TRY_COMPILE([
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/termio.h>],[
|
|
|
|
struct termio foo;
|
|
|
|
foo.c_ispeed = B38400;
|
|
|
|
foo.c_ospeed = B9600;
|
|
|
|
],[cf_cv_termio_c_ispeed=yes
|
|
|
|
],[cf_cv_termio_c_ispeed=no])
|
|
|
|
])
|
|
|
|
test "$cf_cv_termio_c_ispeed" = yes && AC_DEFINE(HAVE_TERMIO_C_ISPEED)
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
2007-06-15 13:29:55 -06:00
|
|
|
dnl CF_TTY_GROUP version: 7 updated: 2007/03/14 16:43:59
|
2006-11-26 04:11:12 -07:00
|
|
|
dnl ------------
|
|
|
|
dnl Check if the system has a tty-group defined. This is used in xterm when
|
|
|
|
dnl setting pty ownership.
|
|
|
|
AC_DEFUN([CF_TTY_GROUP],
|
|
|
|
[
|
|
|
|
AC_MSG_CHECKING(for explicit tty group name)
|
|
|
|
AC_ARG_WITH(tty-group,
|
|
|
|
[ --with-tty-group=XXX use XXX for the tty-group],
|
|
|
|
[cf_tty_group=$withval],
|
|
|
|
[cf_tty_group=auto...])
|
|
|
|
test -z "$cf_tty_group" && cf_tty_group=auto...
|
|
|
|
test "$cf_tty_group" = yes && cf_tty_group=auto...
|
|
|
|
AC_MSG_RESULT($cf_tty_group)
|
|
|
|
|
|
|
|
if test "$cf_tty_group" = "auto..." ; then
|
|
|
|
AC_CACHE_CHECK(for tty group name,cf_cv_tty_group_name,[
|
|
|
|
|
|
|
|
# If we are configuring as root, it is hard to get a clue about the tty group.
|
|
|
|
# But we'll guess based on how our connection is set up - assuming it is done
|
|
|
|
# properly.
|
|
|
|
|
|
|
|
cf_uid=`id | sed -e 's/^[^=]*=//' -e 's/(.*$//'`
|
|
|
|
# )vi
|
|
|
|
if test "$cf_uid" != 0 ; then
|
|
|
|
cf_cv_tty_group_name=
|
|
|
|
cf_tty_name=`tty`
|
|
|
|
test "$cf_tty_name" = "not a tty" && cf_tty_name=/dev/tty
|
|
|
|
test -z "$cf_tty_name" && cf_tty_name=/dev/tty
|
|
|
|
if test -c "$cf_tty_name"
|
|
|
|
then
|
|
|
|
cf_option="-l -L"
|
|
|
|
|
|
|
|
# Expect listing to have fields like this:
|
|
|
|
#-rwxrwxrwx 1 user group 34293 Jul 18 16:29 pathname
|
|
|
|
ls $cf_option $cf_tty_name >conftest.out
|
|
|
|
read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest <conftest.out
|
|
|
|
if test -z "$cf_rest" ; then
|
|
|
|
cf_option="$cf_option -g"
|
|
|
|
ls $cf_option $cf_tty_name >conftest.out
|
|
|
|
read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest <conftest.out
|
|
|
|
fi
|
|
|
|
rm -f conftest.out
|
|
|
|
cf_cv_tty_group_name=$cf_grp
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# If we cannot deduce the tty group, fall back on hardcoded cases
|
|
|
|
|
|
|
|
if test -z "$cf_cv_tty_group_name"
|
|
|
|
then
|
|
|
|
case $host_os in #(vi
|
|
|
|
osf*) #(vi
|
|
|
|
cf_cv_tty_group_name="terminal"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
cf_cv_tty_group_name="unknown"
|
|
|
|
if ( egrep '^tty:' /etc/group 2>/dev/null 1>/dev/null ) then
|
|
|
|
cf_cv_tty_group_name="tty"
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
cf_tty_group="$cf_cv_tty_group_name"
|
|
|
|
else
|
|
|
|
# if configure option, always do this
|
|
|
|
AC_DEFINE(USE_TTY_GROUP)
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_DEFINE_UNQUOTED(TTY_GROUP_NAME,"$cf_tty_group")
|
|
|
|
|
|
|
|
# This is only a double-check that the group-name we obtained above really
|
|
|
|
# does apply to the device. We cannot perform this test if we are in batch
|
|
|
|
# mode, or if we are cross-compiling.
|
|
|
|
|
|
|
|
AC_CACHE_CHECK(if we may use the $cf_tty_group group,cf_cv_tty_group,[
|
|
|
|
cf_tty_name=`tty`
|
|
|
|
if test "$cf_tty_name" != "not a tty"
|
|
|
|
then
|
|
|
|
AC_TRY_RUN([
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <grp.h>
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
struct stat sb;
|
|
|
|
struct group *ttygrp = getgrnam(TTY_GROUP_NAME);
|
|
|
|
char *name = ttyname(0);
|
|
|
|
|
|
|
|
endgrent();
|
|
|
|
if (ttygrp != 0
|
|
|
|
&& name != 0
|
|
|
|
&& stat(name, &sb) == 0
|
|
|
|
&& sb.st_gid != getgid()
|
|
|
|
&& sb.st_gid == ttygrp->gr_gid) {
|
2007-06-15 13:29:55 -06:00
|
|
|
${cf_cv_main_return:-return} (0);
|
2006-11-26 04:11:12 -07:00
|
|
|
}
|
2007-06-15 13:29:55 -06:00
|
|
|
${cf_cv_main_return:-return} (1);
|
2006-11-26 04:11:12 -07:00
|
|
|
}
|
|
|
|
],
|
|
|
|
[cf_cv_tty_group=yes],
|
|
|
|
[cf_cv_tty_group=no],
|
|
|
|
[cf_cv_tty_group=unknown])
|
|
|
|
elif test "$cross_compiling" = yes; then
|
|
|
|
cf_cv_tty_group=unknown
|
|
|
|
else
|
|
|
|
cf_cv_tty_group=yes
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
|
|
|
if test $cf_cv_tty_group = no ; then
|
|
|
|
AC_MSG_WARN(Cannot use $cf_tty_group group)
|
|
|
|
else
|
|
|
|
AC_DEFINE(USE_TTY_GROUP)
|
|
|
|
fi
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
2008-08-25 12:05:56 -06:00
|
|
|
dnl CF_TYPE_FD_MASK version: 2 updated: 2008/03/25 20:59:57
|
|
|
|
dnl ---------------
|
|
|
|
dnl Check for the declaration of fd_mask, which is like fd_set, associated
|
|
|
|
dnl with select(). The check for fd_set should have pulled in this as well,
|
|
|
|
dnl but there is a special case for Mac OS X, possibly other BSD-derived
|
|
|
|
dnl platforms.
|
|
|
|
AC_DEFUN([CF_TYPE_FD_MASK],
|
|
|
|
[
|
|
|
|
AC_REQUIRE([CF_TYPE_FD_SET])
|
|
|
|
|
|
|
|
AC_CACHE_CHECK(for declaration of fd_mask,cf_cv_type_fd_mask,[
|
|
|
|
if test x$cf_cv_type_fd_set = xX11/Xpoll.h ; then
|
|
|
|
AC_TRY_COMPILE([
|
|
|
|
#include <X11/Xpoll.h>],[fd_mask x],,
|
|
|
|
[CF_MSG_LOG(if we must define CSRG_BASED)
|
|
|
|
# Xosdefs.h on Mac OS X may not define this (but it should).
|
|
|
|
AC_TRY_COMPILE([
|
|
|
|
#define CSRG_BASED
|
|
|
|
#include <X11/Xpoll.h>],[fd_mask x],
|
|
|
|
cf_cv_type_fd_mask=CSRG_BASED)])
|
|
|
|
else
|
|
|
|
cf_cv_type_fd_mask=$cf_cv_type_fd_set
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
if test x$cf_cv_type_fd_mask = xCSRG_BASED ; then
|
|
|
|
AC_DEFINE(CSRG_BASED)
|
|
|
|
fi
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl CF_TYPE_FD_SET version: 4 updated: 2008/03/25 20:56:03
|
2006-11-26 04:11:12 -07:00
|
|
|
dnl --------------
|
|
|
|
dnl Check for the declaration of fd_set. Some platforms declare it in
|
|
|
|
dnl <sys/types.h>, and some in <sys/select.h>, which requires <sys/types.h>.
|
|
|
|
dnl Finally, if we are using this for an X application, Xpoll.h may include
|
|
|
|
dnl <sys/select.h>, so we don't want to do it twice.
|
|
|
|
AC_DEFUN([CF_TYPE_FD_SET],
|
|
|
|
[
|
2008-08-25 12:05:56 -06:00
|
|
|
AC_CHECK_HEADERS(X11/Xpoll.h)
|
|
|
|
|
2006-11-26 04:11:12 -07:00
|
|
|
AC_CACHE_CHECK(for declaration of fd_set,cf_cv_type_fd_set,
|
2008-08-25 12:05:56 -06:00
|
|
|
[CF_MSG_LOG(sys/types alone)
|
2006-11-26 04:11:12 -07:00
|
|
|
AC_TRY_COMPILE([
|
|
|
|
#include <sys/types.h>],
|
|
|
|
[fd_set x],
|
|
|
|
[cf_cv_type_fd_set=sys/types.h],
|
2008-08-25 12:05:56 -06:00
|
|
|
[CF_MSG_LOG(X11/Xpoll.h)
|
2006-11-26 04:11:12 -07:00
|
|
|
AC_TRY_COMPILE([
|
|
|
|
#ifdef HAVE_X11_XPOLL_H
|
|
|
|
#include <X11/Xpoll.h>
|
|
|
|
#endif],
|
|
|
|
[fd_set x],
|
|
|
|
[cf_cv_type_fd_set=X11/Xpoll.h],
|
2008-08-25 12:05:56 -06:00
|
|
|
[CF_MSG_LOG(sys/select.h)
|
2006-11-26 04:11:12 -07:00
|
|
|
AC_TRY_COMPILE([
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/select.h>],
|
|
|
|
[fd_set x],
|
|
|
|
[cf_cv_type_fd_set=sys/select.h],
|
|
|
|
[cf_cv_type_fd_set=unknown])])])])
|
|
|
|
if test $cf_cv_type_fd_set = sys/select.h ; then
|
|
|
|
AC_DEFINE(USE_SYS_SELECT_H)
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59
|
|
|
|
dnl --------
|
|
|
|
dnl Make an uppercase version of a variable
|
|
|
|
dnl $1=uppercase($2)
|
|
|
|
AC_DEFUN([CF_UPPER],
|
|
|
|
[
|
|
|
|
$1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl CF_UTEMPTER version: 2 updated: 2000/01/22 22:50:59
|
|
|
|
dnl -----------
|
|
|
|
dnl Try to link with utempter library
|
|
|
|
AC_DEFUN([CF_UTEMPTER],
|
|
|
|
[
|
|
|
|
AC_CACHE_CHECK(if we can link with utempter library,cf_cv_have_utempter,[
|
|
|
|
cf_save_LIBS="$LIBS"
|
|
|
|
LIBS="-lutempter $LIBS"
|
|
|
|
AC_TRY_LINK([
|
|
|
|
#include <utempter.h>
|
|
|
|
],[
|
|
|
|
addToUtmp("/dev/tty", 0, 1);
|
|
|
|
removeFromUtmp();
|
|
|
|
],[
|
|
|
|
cf_cv_have_utempter=yes],[
|
|
|
|
cf_cv_have_utempter=no])
|
|
|
|
LIBS="$cf_save_LIBS"
|
|
|
|
])
|
|
|
|
if test "$cf_cv_have_utempter" = yes ; then
|
|
|
|
AC_DEFINE(USE_UTEMPTER)
|
|
|
|
LIBS="-lutempter $LIBS"
|
|
|
|
fi
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
2008-03-19 15:15:46 -06:00
|
|
|
dnl CF_UTMP version: 9 updated: 2008/01/25 17:18:00
|
2006-11-26 04:11:12 -07:00
|
|
|
dnl -------
|
|
|
|
dnl Check for UTMP/UTMPX headers
|
|
|
|
AC_DEFUN([CF_UTMP],
|
|
|
|
[
|
|
|
|
AC_REQUIRE([CF_LASTLOG])
|
|
|
|
|
|
|
|
AC_CACHE_CHECK(for utmp implementation,cf_cv_have_utmp,[
|
|
|
|
cf_cv_have_utmp=no
|
|
|
|
for cf_header in utmpx utmp ; do
|
|
|
|
cf_utmp_includes="
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <${cf_header}.h>
|
|
|
|
#define getutent getutxent
|
|
|
|
#ifdef USE_LASTLOG
|
|
|
|
#include <lastlog.h> /* may conflict with utmpx.h on Linux */
|
|
|
|
#endif
|
|
|
|
"
|
|
|
|
AC_TRY_COMPILE([$cf_utmp_includes],
|
|
|
|
[struct $cf_header x;
|
|
|
|
char *name = x.ut_name; /* utmp.h and compatible definitions */
|
|
|
|
],
|
|
|
|
[cf_cv_have_utmp=$cf_header
|
|
|
|
break],
|
|
|
|
[
|
|
|
|
AC_TRY_COMPILE([$cf_utmp_includes],
|
|
|
|
[struct $cf_header x;
|
|
|
|
char *name = x.ut_user; /* utmpx.h must declare this */
|
|
|
|
],
|
|
|
|
[cf_cv_have_utmp=$cf_header
|
|
|
|
break
|
|
|
|
])])
|
|
|
|
done
|
|
|
|
])
|
|
|
|
|
|
|
|
if test $cf_cv_have_utmp != no ; then
|
|
|
|
AC_DEFINE(HAVE_UTMP)
|
|
|
|
test $cf_cv_have_utmp = utmpx && AC_DEFINE(UTMPX_FOR_UTMP)
|
|
|
|
CF_UTMP_UT_HOST
|
2008-03-19 15:15:46 -06:00
|
|
|
CF_UTMP_UT_SYSLEN
|
2006-11-26 04:11:12 -07:00
|
|
|
CF_UTMP_UT_NAME
|
|
|
|
CF_UTMP_UT_XSTATUS
|
|
|
|
CF_UTMP_UT_XTIME
|
|
|
|
CF_UTMP_UT_SESSION
|
|
|
|
CF_SYSV_UTMP
|
|
|
|
fi
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl CF_UTMP_GROUP version: 1 updated: 2005/10/06 20:29:29
|
|
|
|
dnl -------------
|
|
|
|
dnl Find the utmp/utmpx file and determine its group to allow setgid programs
|
|
|
|
dnl to manipulate it, e.g., when there is no intermediary.
|
|
|
|
AC_DEFUN([CF_UTMP_GROUP],[
|
|
|
|
AC_REQUIRE([CF_UTMP])
|
|
|
|
if test $cf_cv_have_utmp != no ; then
|
|
|
|
AC_CACHE_CHECK(for utmp/utmpx group,cf_cv_utmp_group,[
|
|
|
|
for cf_utmp_path in /var/adm /var/run
|
|
|
|
do
|
|
|
|
for cf_utmp_file in utmpx utmp
|
|
|
|
do
|
|
|
|
if test -f $cf_utmp_path/$cf_utmp_file
|
|
|
|
then
|
|
|
|
cf_cv_utmp_group=root
|
|
|
|
|
|
|
|
cf_option="-l -L"
|
|
|
|
|
|
|
|
# Expect listing to have fields like this:
|
|
|
|
#-r--r--r-- 1 user group 34293 Jul 18 16:29 pathname
|
|
|
|
ls $cf_option $cf_utmp_path/$cf_utmp_file >conftest
|
|
|
|
read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest <conftest
|
|
|
|
if test -z "$cf_rest" ; then
|
|
|
|
cf_option="$cf_option -g"
|
|
|
|
ls $cf_option $cf_utmp_path/$cf_utmp_file >conftest
|
|
|
|
read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest <conftest
|
|
|
|
fi
|
|
|
|
rm -f conftest
|
|
|
|
|
|
|
|
# If we have a pathname, and the date fields look right, assume we've
|
|
|
|
# captured the group as well.
|
|
|
|
if test -n "$cf_rest" ; then
|
|
|
|
cf_test=`echo "${cf_date2}${cf_date3}" | sed -e 's/[[0-9:]]//g'`
|
|
|
|
if test -z "$cf_test" ; then
|
|
|
|
cf_cv_utmp_group=$cf_grp;
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
test -n "$cf_cv_utmp_group" && break
|
|
|
|
done
|
|
|
|
])
|
|
|
|
else
|
|
|
|
AC_MSG_ERROR(cannot find utmp group)
|
|
|
|
fi
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
2007-06-15 13:29:55 -06:00
|
|
|
dnl CF_UTMP_UT_HOST version: 7 updated: 2007/03/13 19:17:11
|
2006-11-26 04:11:12 -07:00
|
|
|
dnl ---------------
|
|
|
|
dnl Check if UTMP/UTMPX struct defines ut_host member
|
|
|
|
AC_DEFUN([CF_UTMP_UT_HOST],
|
|
|
|
[
|
|
|
|
if test $cf_cv_have_utmp != no ; then
|
2007-06-15 13:29:55 -06:00
|
|
|
AC_MSG_CHECKING(if ${cf_cv_have_utmp}.ut_host is declared)
|
2006-11-26 04:11:12 -07:00
|
|
|
AC_CACHE_VAL(cf_cv_have_utmp_ut_host,[
|
|
|
|
AC_TRY_COMPILE([
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <${cf_cv_have_utmp}.h>],
|
|
|
|
[struct $cf_cv_have_utmp x; char *y = &x.ut_host[0]],
|
|
|
|
[cf_cv_have_utmp_ut_host=yes],
|
|
|
|
[cf_cv_have_utmp_ut_host=no])
|
|
|
|
])
|
|
|
|
AC_MSG_RESULT($cf_cv_have_utmp_ut_host)
|
|
|
|
test $cf_cv_have_utmp_ut_host != no && AC_DEFINE(HAVE_UTMP_UT_HOST)
|
|
|
|
fi
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
2007-06-15 13:29:55 -06:00
|
|
|
dnl CF_UTMP_UT_NAME version: 4 updated: 2007/03/13 19:17:11
|
2006-11-26 04:11:12 -07:00
|
|
|
dnl ---------------
|
|
|
|
dnl Check if UTMP/UTMPX struct defines ut_name member
|
|
|
|
AC_DEFUN([CF_UTMP_UT_NAME],
|
|
|
|
[
|
|
|
|
if test $cf_cv_have_utmp != no ; then
|
2007-06-15 13:29:55 -06:00
|
|
|
AC_CACHE_CHECK(if ${cf_cv_have_utmp}.ut_name is declared,cf_cv_have_utmp_ut_name,[
|
2006-11-26 04:11:12 -07:00
|
|
|
cf_cv_have_utmp_ut_name=no
|
|
|
|
cf_utmp_includes="
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <${cf_cv_have_utmp}.h>
|
|
|
|
#define getutent getutxent
|
|
|
|
#ifdef USE_LASTLOG
|
|
|
|
#include <lastlog.h> /* may conflict with utmpx.h on Linux */
|
|
|
|
#endif
|
|
|
|
"
|
|
|
|
for cf_header in ut_name ut_user ; do
|
|
|
|
AC_TRY_COMPILE([$cf_utmp_includes],
|
|
|
|
[struct $cf_cv_have_utmp x;
|
|
|
|
char *name = x.$cf_header;
|
|
|
|
],
|
|
|
|
[cf_cv_have_utmp_ut_name=$cf_header
|
|
|
|
break])
|
|
|
|
done
|
|
|
|
])
|
|
|
|
|
|
|
|
case $cf_cv_have_utmp_ut_name in #(vi
|
|
|
|
no) #(vi
|
|
|
|
AC_MSG_ERROR(Cannot find declaration for ut.ut_name)
|
|
|
|
;;
|
|
|
|
ut_user)
|
|
|
|
AC_DEFINE(ut_name,ut_user)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
2007-06-15 13:29:55 -06:00
|
|
|
dnl CF_UTMP_UT_SESSION version: 5 updated: 2007/03/13 19:17:11
|
2006-11-26 04:11:12 -07:00
|
|
|
dnl ------------------
|
|
|
|
dnl Check if UTMP/UTMPX struct defines ut_session member
|
|
|
|
AC_DEFUN([CF_UTMP_UT_SESSION],
|
|
|
|
[
|
|
|
|
if test $cf_cv_have_utmp != no ; then
|
2007-06-15 13:29:55 -06:00
|
|
|
AC_CACHE_CHECK(if ${cf_cv_have_utmp}.ut_session is declared, cf_cv_have_utmp_ut_session,[
|
2006-11-26 04:11:12 -07:00
|
|
|
AC_TRY_COMPILE([
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <${cf_cv_have_utmp}.h>],
|
|
|
|
[struct $cf_cv_have_utmp x; long y = x.ut_session],
|
|
|
|
[cf_cv_have_utmp_ut_session=yes],
|
|
|
|
[cf_cv_have_utmp_ut_session=no])
|
|
|
|
])
|
|
|
|
if test $cf_cv_have_utmp_ut_session != no ; then
|
|
|
|
AC_DEFINE(HAVE_UTMP_UT_SESSION)
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
2008-03-19 15:15:46 -06:00
|
|
|
dnl CF_UTMP_UT_SYSLEN version: 1 updated: 2008/01/25 17:18:00
|
|
|
|
dnl -----------------
|
|
|
|
dnl Check if UTMP/UTMPX struct defines ut_syslen member
|
|
|
|
AC_DEFUN([CF_UTMP_UT_SYSLEN],
|
|
|
|
[
|
|
|
|
if test $cf_cv_have_utmp != no ; then
|
|
|
|
AC_MSG_CHECKING(if ${cf_cv_have_utmp}.ut_syslen is declared)
|
|
|
|
AC_CACHE_VAL(cf_cv_have_utmp_ut_syslen,[
|
|
|
|
AC_TRY_COMPILE([
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <${cf_cv_have_utmp}.h>],
|
|
|
|
[struct $cf_cv_have_utmp x; int y = x.ut_syslen],
|
|
|
|
[cf_cv_have_utmp_ut_syslen=yes],
|
|
|
|
[cf_cv_have_utmp_ut_syslen=no])
|
|
|
|
])
|
|
|
|
AC_MSG_RESULT($cf_cv_have_utmp_ut_syslen)
|
|
|
|
test $cf_cv_have_utmp_ut_syslen != no && AC_DEFINE(HAVE_UTMP_UT_SYSLEN)
|
|
|
|
fi
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
2006-11-26 04:11:12 -07:00
|
|
|
dnl CF_UTMP_UT_XSTATUS version: 3 updated: 2001/12/27 12:55:07
|
|
|
|
dnl ------------------
|
|
|
|
dnl Check for known variants on the UTMP/UTMPX struct's exit-status as reported
|
|
|
|
dnl by various people:
|
|
|
|
dnl
|
|
|
|
dnl ut_exit.__e_exit (HPUX 11 - David Ellement, also in glibc2)
|
|
|
|
dnl ut_exit.e_exit (SVR4)
|
|
|
|
dnl ut_exit.ut_e_exit (os390 - Greg Smith)
|
|
|
|
dnl ut_exit.ut_exit (Tru64 4.0f - Jeremie Petit, 4.0e - Tomas Vanhala)
|
|
|
|
dnl
|
|
|
|
dnl Note: utmp_xstatus is not a conventional compatibility definition in the
|
|
|
|
dnl system header files.
|
|
|
|
AC_DEFUN([CF_UTMP_UT_XSTATUS],
|
|
|
|
[
|
|
|
|
if test $cf_cv_have_utmp != no ; then
|
|
|
|
AC_CACHE_CHECK(for exit-status in $cf_cv_have_utmp,cf_cv_have_utmp_ut_xstatus,[
|
|
|
|
for cf_result in \
|
|
|
|
ut_exit.__e_exit \
|
|
|
|
ut_exit.e_exit \
|
|
|
|
ut_exit.ut_e_exit \
|
|
|
|
ut_exit.ut_exit
|
|
|
|
do
|
|
|
|
AC_TRY_COMPILE([
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <${cf_cv_have_utmp}.h>],
|
|
|
|
[struct $cf_cv_have_utmp x; long y = x.$cf_result = 0],
|
|
|
|
[cf_cv_have_utmp_ut_xstatus=$cf_result
|
|
|
|
break],
|
|
|
|
[cf_cv_have_utmp_ut_xstatus=no])
|
|
|
|
done
|
|
|
|
])
|
|
|
|
if test $cf_cv_have_utmp_ut_xstatus != no ; then
|
|
|
|
AC_DEFINE(HAVE_UTMP_UT_XSTATUS)
|
|
|
|
AC_DEFINE_UNQUOTED(ut_xstatus,$cf_cv_have_utmp_ut_xstatus)
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
2007-06-15 13:29:55 -06:00
|
|
|
dnl CF_UTMP_UT_XTIME version: 7 updated: 2007/03/13 19:17:11
|
2006-11-26 04:11:12 -07:00
|
|
|
dnl ----------------
|
|
|
|
dnl Check if UTMP/UTMPX struct defines ut_xtime member
|
|
|
|
AC_DEFUN([CF_UTMP_UT_XTIME],
|
|
|
|
[
|
|
|
|
if test $cf_cv_have_utmp != no ; then
|
2007-06-15 13:29:55 -06:00
|
|
|
AC_CACHE_CHECK(if ${cf_cv_have_utmp}.ut_xtime is declared, cf_cv_have_utmp_ut_xtime,[
|
2006-11-26 04:11:12 -07:00
|
|
|
AC_TRY_COMPILE([
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <${cf_cv_have_utmp}.h>],
|
|
|
|
[struct $cf_cv_have_utmp x; long y = x.ut_xtime = 0],
|
|
|
|
[cf_cv_have_utmp_ut_xtime=yes],
|
|
|
|
[AC_TRY_COMPILE([
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <${cf_cv_have_utmp}.h>],
|
|
|
|
[struct $cf_cv_have_utmp x; long y = x.ut_tv.tv_sec],
|
|
|
|
[cf_cv_have_utmp_ut_xtime=define],
|
|
|
|
[cf_cv_have_utmp_ut_xtime=no])
|
|
|
|
])
|
|
|
|
])
|
|
|
|
if test $cf_cv_have_utmp_ut_xtime != no ; then
|
|
|
|
AC_DEFINE(HAVE_UTMP_UT_XTIME)
|
|
|
|
if test $cf_cv_have_utmp_ut_xtime = define ; then
|
|
|
|
AC_DEFINE(ut_xtime,ut_tv.tv_sec)
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
2008-03-19 15:15:46 -06:00
|
|
|
dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12
|
2006-11-26 04:11:12 -07:00
|
|
|
dnl ----------
|
|
|
|
dnl Use AC_VERBOSE w/o the warnings
|
|
|
|
AC_DEFUN([CF_VERBOSE],
|
|
|
|
[test -n "$verbose" && echo " $1" 1>&AC_FD_MSG
|
2008-03-19 15:15:46 -06:00
|
|
|
CF_MSG_LOG([$1])
|
2006-11-26 04:11:12 -07:00
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl CF_WITH_IMAKE_CFLAGS version: 8 updated: 2005/11/02 15:04:41
|
|
|
|
dnl --------------------
|
|
|
|
dnl xterm and similar programs build more readily when propped up with imake's
|
|
|
|
dnl hand-tuned definitions. If we do not use imake, provide fallbacks for the
|
|
|
|
dnl most common definitions that we're not likely to do by autoconf tests.
|
|
|
|
AC_DEFUN([CF_WITH_IMAKE_CFLAGS],[
|
|
|
|
AC_REQUIRE([CF_ENABLE_NARROWPROTO])
|
|
|
|
|
|
|
|
AC_MSG_CHECKING(if we should use imake to help)
|
|
|
|
CF_ARG_DISABLE(imake,
|
|
|
|
[ --disable-imake disable use of imake for definitions],
|
|
|
|
[enable_imake=no],
|
|
|
|
[enable_imake=yes])
|
|
|
|
AC_MSG_RESULT($enable_imake)
|
|
|
|
|
|
|
|
if test "$enable_imake" = yes ; then
|
|
|
|
CF_IMAKE_CFLAGS(ifelse($1,,,$1))
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test -n "$IMAKE" && test -n "$IMAKE_CFLAGS" ; then
|
|
|
|
CF_ADD_CFLAGS($IMAKE_CFLAGS)
|
|
|
|
else
|
|
|
|
IMAKE_CFLAGS=
|
|
|
|
IMAKE_LOADFLAGS=
|
|
|
|
CF_VERBOSE(make fallback definitions)
|
|
|
|
|
|
|
|
# We prefer config.guess' values when we can get them, to avoid
|
|
|
|
# inconsistent results with uname (AIX for instance). However,
|
|
|
|
# config.guess is not always consistent either.
|
|
|
|
case $host_os in
|
|
|
|
*[[0-9]].[[0-9]]*)
|
|
|
|
UNAME_RELEASE="$host_os"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case .$UNAME_RELEASE in
|
|
|
|
*[[0-9]].[[0-9]]*)
|
|
|
|
OSMAJORVERSION=`echo "$UNAME_RELEASE" |sed -e 's/^[[^0-9]]*//' -e 's/\..*//'`
|
|
|
|
OSMINORVERSION=`echo "$UNAME_RELEASE" |sed -e 's/^[[^0-9]]*//' -e 's/^[[^.]]*\.//' -e 's/\..*//' -e 's/[[^0-9]].*//' `
|
|
|
|
test -z "$OSMAJORVERSION" && OSMAJORVERSION=1
|
|
|
|
test -z "$OSMINORVERSION" && OSMINORVERSION=0
|
|
|
|
IMAKE_CFLAGS="-DOSMAJORVERSION=$OSMAJORVERSION -DOSMINORVERSION=$OSMINORVERSION $IMAKE_CFLAGS"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# FUNCPROTO is standard with X11R6, but XFree86 drops it, leaving some
|
|
|
|
# fallback/fragments for NeedPrototypes, etc.
|
|
|
|
IMAKE_CFLAGS="-DFUNCPROTO=15 $IMAKE_CFLAGS"
|
|
|
|
|
|
|
|
# If this is not set properly, Xaw's scrollbars will not work
|
|
|
|
if test "$enable_narrowproto" = yes ; then
|
|
|
|
IMAKE_CFLAGS="-DNARROWPROTO=1 $IMAKE_CFLAGS"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Other special definitions:
|
|
|
|
case $host_os in
|
|
|
|
aix*)
|
|
|
|
# imake on AIX 5.1 defines AIXV3. really.
|
|
|
|
IMAKE_CFLAGS="-DAIXV3 -DAIXV4 $IMAKE_CFLAGS"
|
|
|
|
;;
|
|
|
|
irix[[56]].*) #(vi
|
|
|
|
# these are needed to make SIGWINCH work in xterm
|
|
|
|
IMAKE_CFLAGS="-DSYSV -DSVR4 $IMAKE_CFLAGS"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
CF_ADD_CFLAGS($IMAKE_CFLAGS)
|
|
|
|
|
|
|
|
AC_SUBST(IMAKE_CFLAGS)
|
|
|
|
AC_SUBST(IMAKE_LOADFLAGS)
|
|
|
|
fi
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
2007-08-25 12:53:27 -06:00
|
|
|
dnl CF_WITH_PATH version: 8 updated: 2007/05/13 13:16:35
|
2006-11-26 04:11:12 -07:00
|
|
|
dnl ------------
|
|
|
|
dnl Wrapper for AC_ARG_WITH to ensure that user supplies a pathname, not just
|
|
|
|
dnl defaulting to yes/no.
|
|
|
|
dnl
|
|
|
|
dnl $1 = option name
|
|
|
|
dnl $2 = help-text
|
|
|
|
dnl $3 = environment variable to set
|
|
|
|
dnl $4 = default value, shown in the help-message, must be a constant
|
|
|
|
dnl $5 = default value, if it's an expression & cannot be in the help-message
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([CF_WITH_PATH],
|
|
|
|
[AC_ARG_WITH($1,[$2 ](default: ifelse($4,,empty,$4)),,
|
|
|
|
ifelse($4,,[withval="${$3}"],[withval="${$3-ifelse($5,,$4,$5)}"]))dnl
|
2007-08-25 12:53:27 -06:00
|
|
|
if ifelse($5,,true,[test -n "$5"]) ; then
|
2006-11-26 04:11:12 -07:00
|
|
|
CF_PATH_SYNTAX(withval)
|
2007-08-25 12:53:27 -06:00
|
|
|
fi
|
2006-11-26 04:11:12 -07:00
|
|
|
$3="$withval"
|
|
|
|
AC_SUBST($3)dnl
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl CF_WITH_PCRE version: 3 updated: 2006/02/12 17:28:56
|
|
|
|
dnl ------------
|
|
|
|
dnl Add PCRE (Perl-compatible regular expressions) to the build if it is
|
|
|
|
dnl available and the user requests it. Assume the application will otherwise
|
|
|
|
dnl use the POSIX interface.
|
|
|
|
dnl
|
|
|
|
dnl TODO allow $withval to specify package location
|
|
|
|
AC_DEFUN([CF_WITH_PCRE],
|
|
|
|
[
|
|
|
|
AC_MSG_CHECKING(if you want to use PCRE for regular-expressions)
|
|
|
|
AC_ARG_WITH(pcre,
|
|
|
|
[ --with-pcre use PCRE for regular-expressions])
|
|
|
|
test -z "$with_pcre" && with_pcre=no
|
|
|
|
AC_MSG_RESULT($with_pcre)
|
|
|
|
|
|
|
|
if test "$with_pcre" != no ; then
|
|
|
|
AC_CHECK_LIB(pcre,pcre_compile,
|
|
|
|
[AC_CHECK_HEADER(pcreposix.h,
|
|
|
|
[AC_CHECK_LIB(pcreposix,pcreposix_regcomp,
|
|
|
|
[AC_DEFINE(HAVE_LIB_PCRE)
|
|
|
|
AC_DEFINE(HAVE_PCREPOSIX_H)
|
|
|
|
LIBS="-lpcreposix -lpcre $LIBS"],
|
|
|
|
AC_MSG_ERROR(Cannot find PCRE POSIX library),
|
|
|
|
"-lpcre")],
|
|
|
|
AC_MSG_ERROR(Cannot find PCRE POSIX header))],
|
|
|
|
AC_MSG_ERROR(Cannot find PCRE library))
|
|
|
|
fi
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl CF_XKB_BELL_EXT version: 2 updated: 2003/05/18 17:28:57
|
|
|
|
dnl ---------------
|
|
|
|
dnl Check for XKB bell extension
|
|
|
|
AC_DEFUN([CF_XKB_BELL_EXT],[
|
|
|
|
AC_CACHE_CHECK(for XKB Bell extension, cf_cv_xkb_bell_ext,[
|
|
|
|
AC_TRY_LINK([
|
|
|
|
#include <X11/XKBlib.h> /* has the prototype */
|
|
|
|
#include <X11/extensions/XKBbells.h> /* has the XkbBI_xxx definitions */
|
|
|
|
],[
|
|
|
|
int x = XkbBI_Info
|
|
|
|
|XkbBI_MinorError
|
|
|
|
|XkbBI_MajorError
|
|
|
|
|XkbBI_TerminalBell
|
|
|
|
|XkbBI_MarginBell;
|
|
|
|
],[cf_cv_xkb_bell_ext=yes],[cf_cv_xkb_bell_ext=no])
|
|
|
|
])
|
|
|
|
|
|
|
|
test "$cf_cv_xkb_bell_ext" = yes && AC_DEFINE(HAVE_XKB_BELL_EXT)
|
|
|
|
])
|
|
|
|
dnl ---------------------------------------------------------------------------
|
2009-01-06 13:10:20 -07:00
|
|
|
dnl CF_XOPEN_SOURCE version: 28 updated: 2008/12/27 12:30:03
|
2006-11-26 04:11:12 -07:00
|
|
|
dnl ---------------
|
|
|
|
dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
|
|
|
|
dnl or adapt to the vendor's definitions to get equivalent functionality,
|
|
|
|
dnl without losing the common non-POSIX features.
|
|
|
|
dnl
|
|
|
|
dnl Parameters:
|
|
|
|
dnl $1 is the nominal value for _XOPEN_SOURCE
|
|
|
|
dnl $2 is the nominal value for _POSIX_C_SOURCE
|
|
|
|
AC_DEFUN([CF_XOPEN_SOURCE],[
|
|
|
|
|
|
|
|
AC_REQUIRE([CF_PROG_CC_U_D])
|
|
|
|
|
|
|
|
cf_XOPEN_SOURCE=ifelse($1,,500,$1)
|
|
|
|
cf_POSIX_C_SOURCE=ifelse($2,,199506L,$2)
|
|
|
|
|
|
|
|
case $host_os in #(vi
|
2009-01-06 13:10:20 -07:00
|
|
|
aix[[456]]*) #(vi
|
2006-11-26 04:11:12 -07:00
|
|
|
CPPFLAGS="$CPPFLAGS -D_ALL_SOURCE"
|
|
|
|
;;
|
2008-08-25 12:05:56 -06:00
|
|
|
freebsd*|dragonfly*) #(vi
|
2006-11-26 04:11:12 -07:00
|
|
|
# 5.x headers associate
|
|
|
|
# _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L
|
|
|
|
# _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L
|
|
|
|
cf_POSIX_C_SOURCE=200112L
|
|
|
|
cf_XOPEN_SOURCE=600
|
|
|
|
CPPFLAGS="$CPPFLAGS -D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
|
|
|
|
;;
|
|
|
|
hpux*) #(vi
|
|
|
|
CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE"
|
|
|
|
;;
|
|
|
|
irix[[56]].*) #(vi
|
|
|
|
CPPFLAGS="$CPPFLAGS -D_SGI_SOURCE"
|
|
|
|
;;
|
2009-01-06 13:10:20 -07:00
|
|
|
linux*|gnu*|mint*|k*bsd*-gnu) #(vi
|
2006-11-26 04:11:12 -07:00
|
|
|
CF_GNU_SOURCE
|
|
|
|
;;
|
|
|
|
mirbsd*) #(vi
|
|
|
|
# setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h>
|
|
|
|
;;
|
|
|
|
netbsd*) #(vi
|
|
|
|
# setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
|
|
|
|
;;
|
|
|
|
openbsd*) #(vi
|
|
|
|
# setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
|
|
|
|
;;
|
|
|
|
osf[[45]]*) #(vi
|
|
|
|
CPPFLAGS="$CPPFLAGS -D_OSF_SOURCE"
|
|
|
|
;;
|
|
|
|
nto-qnx*) #(vi
|
|
|
|
CPPFLAGS="$CPPFLAGS -D_QNX_SOURCE"
|
|
|
|
;;
|
|
|
|
sco*) #(vi
|
|
|
|
# setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
|
|
|
|
;;
|
|
|
|
solaris*) #(vi
|
|
|
|
CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
|
|
|
|
AC_TRY_COMPILE([#include <sys/types.h>],[
|
|
|
|
#ifndef _XOPEN_SOURCE
|
|
|
|
make an error
|
|
|
|
#endif],
|
|
|
|
[cf_cv_xopen_source=no],
|
|
|
|
[cf_save="$CPPFLAGS"
|
|
|
|
CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
|
|
|
|
AC_TRY_COMPILE([#include <sys/types.h>],[
|
|
|
|
#ifdef _XOPEN_SOURCE
|
|
|
|
make an error
|
|
|
|
#endif],
|
|
|
|
[cf_cv_xopen_source=no],
|
|
|
|
[cf_cv_xopen_source=$cf_XOPEN_SOURCE])
|
|
|
|
CPPFLAGS="$cf_save"
|
|
|
|
])
|
|
|
|
])
|
|
|
|
if test "$cf_cv_xopen_source" != no ; then
|
|
|
|
CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE)
|
|
|
|
CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE)
|
|
|
|
test "$cf_cv_cc_u_d_options" = yes && \
|
|
|
|
CPPFLAGS="$CPPFLAGS -U_XOPEN_SOURCE"
|
|
|
|
CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_cv_xopen_source"
|
|
|
|
fi
|
|
|
|
CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
])
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl CF_X_ATHENA version: 12 updated: 2004/06/15 21:14:41
|
|
|
|
dnl -----------
|
|
|
|
dnl Check for Xaw (Athena) libraries
|
|
|
|
dnl
|
|
|
|
dnl Sets $cf_x_athena according to the flavor of Xaw which is used.
|
|
|
|
AC_DEFUN([CF_X_ATHENA],
|
|
|
|
[AC_REQUIRE([CF_X_TOOLKIT])
|
|
|
|
cf_x_athena=${cf_x_athena-Xaw}
|
|
|
|
|
|
|
|
AC_MSG_CHECKING(if you want to link with Xaw 3d library)
|
|
|
|
withval=
|
|
|
|
AC_ARG_WITH(Xaw3d,
|
|
|
|
[ --with-Xaw3d link with Xaw 3d library])
|
|
|
|
if test "$withval" = yes ; then
|
|
|
|
cf_x_athena=Xaw3d
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_MSG_CHECKING(if you want to link with neXT Athena library)
|
|
|
|
withval=
|
|
|
|
AC_ARG_WITH(neXtaw,
|
|
|
|
[ --with-neXtaw link with neXT Athena library])
|
|
|
|
if test "$withval" = yes ; then
|
|
|
|
cf_x_athena=neXtaw
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_MSG_CHECKING(if you want to link with Athena-Plus library)
|
|
|
|
withval=
|
|
|
|
AC_ARG_WITH(XawPlus,
|
|
|
|
[ --with-XawPlus link with Athena-Plus library])
|
|
|
|
if test "$withval" = yes ; then
|
|
|
|
cf_x_athena=XawPlus
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_CHECK_LIB(Xext,XextCreateExtension,
|
|
|
|
[LIBS="-lXext $LIBS"])
|
|
|
|
|
|
|
|
cf_x_athena_lib=""
|
|
|
|
|
|
|
|
CF_X_ATHENA_CPPFLAGS($cf_x_athena)
|
|
|
|
CF_X_ATHENA_LIBS($cf_x_athena)
|
|
|
|
])dnl
|
|
|
|
dnl ---------------------------------------------------------------------------
|
|
|
|
dnl CF_X_ATHENA_CPPFLAGS version: 2 updated: 2002/10/09 20:00:37
|
|
|
|
dnl --------------------
|
|
|
|
dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of
|
|
|
|
dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw.
|
|
|
|
AC_DEFUN([CF_X_ATHENA_CPPFLAGS],
|
|
|
|
[
|
|
|
|
cf_x_athena_root=ifelse($1,,Xaw,$1)
|
|
|
|
cf_x_athena_include=""
|
|
|
|
|
|
|
|
for cf_path in default \
|
|
|
|
/usr/contrib/X11R6 \
|
|
|
|
/usr/contrib/X11R5 \
|
|
|
|
/usr/lib/X11R5 \
|
|
|
|
/usr/local
|
|
|
|
do
|
|
|
|
if test -z "$cf_x_athena_include" ; then
|
|
|
|
cf_save="$CPPFLAGS"
|
|
|
|
cf_test=X11/$cf_x_athena_root/SimpleMenu.h
|
|
|
|
if test $cf_path != default ; then
|
|
|
|
CPPFLAGS="-I$cf_path/include $cf_save"
|
|
|
|
AC_MSG_CHECKING(for $cf_test in $cf_path)
|
|
|
|
else
|
|
|
|
AC_MSG_CHECKING(for $cf_test)
|
|
|
|
fi
|
|
|
|
AC_TRY_COMPILE([
|
|
|
|
#include <X11/Intrinsic.h>
|
|
|
|
#include <$cf_test>],[],
|
|
|
|
[cf_result=yes],
|
|
|
|
[cf_result=no])
|
|
|
|
AC_MSG_RESULT($cf_result)
|
|
|
|
if test "$cf_result" = yes ; then
|
|
|
|
cf_x_athena_include=$cf_path
|
|
|
|
break
|
|
|
|
else
|
|
|
|
CPPFLAGS="$cf_save"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if test -z "$cf_x_athena_include" ; then
|
|
|
|
AC_MSG_WARN(
|
|
|
|
[Unable to successfully find Athena header files with test program])
|
|
|
|
elif test "$cf_x_athena_include" != default ; then
|
|
|
|
CPPFLAGS="$CPPFLAGS -I$cf_x_athena_include"
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
dnl ---------------------------------------------------------------------------
|
2008-08-25 12:05:56 -06:00
|
|
|
dnl CF_X_ATHENA_LIBS version: 7 updated: 2008/03/23 14:46:03
|
2006-11-26 04:11:12 -07:00
|
|
|
dnl ----------------
|
|
|
|
dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of
|
|
|
|
dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw.
|
|
|
|
AC_DEFUN([CF_X_ATHENA_LIBS],
|
|
|
|
[AC_REQUIRE([CF_X_TOOLKIT])
|
|
|
|
cf_x_athena_root=ifelse($1,,Xaw,$1)
|
|
|
|
cf_x_athena_lib=""
|
|
|
|
|
|
|
|
for cf_path in default \
|
|
|
|
/usr/contrib/X11R6 \
|
|
|
|
/usr/contrib/X11R5 \
|
|
|
|
/usr/lib/X11R5 \
|
|
|
|
/usr/local
|
|
|
|
do
|
|
|
|
for cf_lib in \
|
|
|
|
"-l$cf_x_athena_root -lXmu" \
|
|
|
|
"-l$cf_x_athena_root -lXpm -lXmu" \
|
|
|
|
"-l${cf_x_athena_root}_s -lXmu_s"
|
|
|
|
do
|
|
|
|
if test -z "$cf_x_athena_lib" ; then
|
|
|
|
cf_save="$LIBS"
|
|
|
|
cf_test=XawSimpleMenuAddGlobalActions
|
|
|
|
if test $cf_path != default ; then
|
|
|
|
LIBS="-L$cf_path/lib $cf_lib $LIBS"
|
|
|
|
AC_MSG_CHECKING(for $cf_lib in $cf_path)
|
|
|
|
else
|
|
|
|
LIBS="$cf_lib $LIBS"
|
|
|
|
AC_MSG_CHECKING(for $cf_test in $cf_lib)
|
|
|
|
fi
|
|
|
|
AC_TRY_LINK([],[$cf_test()],
|
|
|
|
[cf_result=yes],
|
|
|
|
[cf_result=no])
|
|
|
|
AC_MSG_RESULT($cf_result)
|
|
|
|
if test "$cf_result" = yes ; then
|
|
|
|
cf_x_athena_lib="$cf_lib"
|
|
|
|
break
|
|
|
|
fi
|
2007-06-15 13:29:55 -06:00
|
|
|
LIBS="$cf_save"
|
2006-11-26 04:11:12 -07:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
if test -z "$cf_x_athena_lib" ; then
|
2008-08-25 12:05:56 -06:00
|
|
|
AC_MSG_ERROR(
|
2006-11-26 04:11:12 -07:00
|
|
|
[Unable to successfully link Athena library (-l$cf_x_athena_root) with test program])
|
|
|
|
fi
|
|
|
|
|
|
|
|
CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena)
|
|
|
|
AC_DEFINE_UNQUOTED($cf_x_athena_LIBS)
|
|
|
|
])
|
|
|
|
dnl ---------------------------------------------------------------------------
|
2007-06-15 13:29:55 -06:00
|
|
|
dnl CF_X_FREETYPE version: 18 updated: 2007/03/21 18:06:17
|
2006-11-26 04:11:12 -07:00
|
|
|
dnl -------------
|
|
|
|
dnl Check for X FreeType headers and libraries (XFree86 4.x, etc).
|
|
|
|
dnl
|
|
|
|
dnl First check for the appropriate config program, since the developers for
|
|
|
|
dnl these libraries change their configuration (and config program) more or
|
|
|
|
dnl less randomly. If we cannot find the config program, do not bother trying
|
|
|
|
dnl to guess the latest variation of include/lib directories.
|
|
|
|
dnl
|
|
|
|
dnl If either or both of these configure-script options are not given, rely on
|
2007-06-15 13:29:55 -06:00
|
|
|
dnl the output of the config program to provide the cflags/libs options:
|
2006-11-26 04:11:12 -07:00
|
|
|
dnl --with-freetype-cflags
|
|
|
|
dnl --with-freetype-libs
|
|
|
|
AC_DEFUN([CF_X_FREETYPE],
|
|
|
|
[
|
|
|
|
cf_extra_freetype_libs=
|
|
|
|
FREETYPE_CONFIG=
|
|
|
|
FREETYPE_PARAMS=
|
|
|
|
|
2007-06-15 13:29:55 -06:00
|
|
|
AC_MSG_CHECKING(if you specified -D/-I options for FreeType)
|
|
|
|
AC_ARG_WITH(freetype-cflags,
|
|
|
|
[ --with-freetype-cflags -D/-I options for compiling with FreeType],
|
|
|
|
[cf_cv_x_freetype_incs="$with_freetype_cflags"],
|
|
|
|
[cf_cv_x_freetype_incs=no])
|
|
|
|
AC_MSG_RESULT($cf_cv_x_freetype_incs)
|
|
|
|
|
|
|
|
|
|
|
|
AC_MSG_CHECKING(if you specified -L/-l options for FreeType)
|
|
|
|
AC_ARG_WITH(freetype-libs,
|
|
|
|
[ --with-freetype-libs -L/-l options to link FreeType],
|
|
|
|
[cf_cv_x_freetype_libs="$with_freetype_libs"],
|
|
|
|
[cf_cv_x_freetype_libs=no])
|
|
|
|
AC_MSG_RESULT($cf_cv_x_freetype_libs)
|
|
|
|
|
2006-11-26 04:11:12 -07:00
|
|
|
AC_PATH_PROG(FREETYPE_PKG_CONFIG, pkg-config, none)
|
|
|
|
if test "$FREETYPE_PKG_CONFIG" != none && "$FREETYPE_PKG_CONFIG" --exists xft; then
|
|
|
|
FREETYPE_CONFIG=$FREETYPE_PKG_CONFIG
|
|
|
|
FREETYPE_PARAMS=xft
|
|
|
|
else
|
|
|
|
AC_PATH_PROG(FREETYPE_XFT_CONFIG, xft-config, none)
|
|
|
|
if test "$FREETYPE_XFT_CONFIG" != none; then
|
|
|
|
FREETYPE_CONFIG=$FREETYPE_XFT_CONFIG
|
|
|
|
else
|
|
|
|
cf_extra_freetype_libs="-lXft"
|
|
|
|
AC_PATH_PROG(FREETYPE_OLD_CONFIG, freetype-config, none)
|
|
|
|
if test "$FREETYPE_OLD_CONFIG" != none; then
|
|
|
|
FREETYPE_CONFIG=$FREETYPE_OLD_CONFIG
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test -n "$FREETYPE_CONFIG" ; then
|
|
|
|
|
2007-06-15 13:29:55 -06:00
|
|
|
if test "$cf_cv_x_freetype_incs" = no ; then
|
|
|
|
AC_MSG_CHECKING(for $FREETYPE_CONFIG cflags)
|
|
|
|
cf_cv_x_freetype_incs="`$FREETYPE_CONFIG $FREETYPE_PARAMS --cflags 2>/dev/null`"
|
|
|
|
AC_MSG_RESULT($cf_cv_x_freetype_incs)
|
|
|
|
fi
|
2006-11-26 04:11:12 -07:00
|
|
|
|
2007-06-15 13:29:55 -06:00
|
|
|
if test "$cf_cv_x_freetype_libs" = no ; then
|
|
|
|
AC_MSG_CHECKING(for $FREETYPE_CONFIG libs)
|
2006-11-26 04:11:12 -07:00
|
|
|
cf_cv_x_freetype_libs="$cf_extra_freetype_libs `$FREETYPE_CONFIG $FREETYPE_PARAMS --libs 2>/dev/null`"
|
2007-06-15 13:29:55 -06:00
|
|
|
AC_MSG_RESULT($cf_cv_x_freetype_libs)
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test "$cf_cv_x_freetype_incs" = no ; then
|
|
|
|
cf_cv_x_freetype_incs=
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test "$cf_cv_x_freetype_libs" = no ; then
|
|
|
|
cf_cv_x_freetype_libs=-lXft
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_MSG_CHECKING(if we can link with FreeType libraries)
|
|
|
|
|
|
|
|
cf_save_LIBS="$LIBS"
|
|
|
|
cf_save_INCS="$CPPFLAGS"
|
2006-11-26 04:11:12 -07:00
|
|
|
|
|
|
|
LIBS="$cf_cv_x_freetype_libs $LIBS"
|
|
|
|
CPPFLAGS="$cf_cv_x_freetype_incs $CPPFLAGS"
|
|
|
|
|
|
|
|
AC_TRY_LINK([
|
|
|
|
#include <X11/Xlib.h>
|
|
|
|
#include <X11/extensions/Xrender.h>
|
|
|
|
#include <X11/Xft/Xft.h>],[
|
2007-06-15 13:29:55 -06:00
|
|
|
XftPattern *pat = XftNameParse ("name");],
|
|
|
|
[cf_cv_found_freetype=yes],
|
|
|
|
[cf_cv_found_freetype=no])
|
|
|
|
AC_MSG_RESULT($cf_cv_found_freetype)
|
2006-11-26 04:11:12 -07:00
|
|
|
|
2007-06-15 13:29:55 -06:00
|
|
|
LIBS="$cf_save_LIBS"
|
|
|
|
CPPFLAGS="$cf_save_INCS"
|
|
|
|
|
|
|
|
if test "$cf_cv_found_freetype" = yes ; then
|
2006-11-26 04:11:12 -07:00
|
|
|
LIBS="$cf_cv_x_freetype_libs $LIBS"
|
|
|
|
CF_ADD_CFLAGS($cf_cv_x_freetype_incs)
|
|
|
|
AC_DEFINE(XRENDERFONT)
|
2007-06-15 13:29:55 -06:00
|
|
|
|
|
|
|
AC_CHECK_FUNCS( \
|
|
|
|
XftDrawCharSpec \
|
|
|
|
XftDrawSetClip \
|
|
|
|
XftDrawSetClipRectangles \
|
|
|
|
)
|
2006-11-26 04:11:12 -07:00
|
|
|
|
|
|
|
else
|
2007-06-15 13:29:55 -06:00
|
|
|
AC_MSG_WARN(No libraries found for FreeType)
|
2006-11-26 04:11:12 -07:00
|
|
|
CPPFLAGS=`echo "$CPPFLAGS" | sed -e s/-DXRENDERFONT//`
|
|
|
|
fi
|
|
|
|
|
|
|
|
# FIXME: revisit this if needed
|
|
|
|
AC_SUBST(XRENDERFONT)
|
|
|
|
AC_SUBST(HAVE_TYPE_FCCHAR32)
|
|
|
|
AC_SUBST(HAVE_TYPE_XFTCHARSPEC)
|
|
|
|
])
|
|
|
|
dnl ---------------------------------------------------------------------------
|
2008-08-25 12:05:56 -06:00
|
|
|
dnl CF_X_TOOLKIT version: 12 updated: 2008/03/23 15:04:54
|
2006-11-26 04:11:12 -07:00
|
|
|
dnl ------------
|
|
|
|
dnl Check for X Toolkit libraries
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([CF_X_TOOLKIT],
|
|
|
|
[
|
|
|
|
AC_REQUIRE([AC_PATH_XTRA])
|
|
|
|
AC_REQUIRE([CF_CHECK_CACHE])
|
|
|
|
|
|
|
|
# SYSTEM_NAME=`echo "$cf_cv_system_name"|tr ' ' -`
|
|
|
|
|
|
|
|
cf_have_X_LIBS=no
|
|
|
|
|
|
|
|
LDFLAGS="$X_LIBS $LDFLAGS"
|
|
|
|
CF_CHECK_CFLAGS($X_CFLAGS)
|
|
|
|
|
|
|
|
AC_CHECK_FUNC(XOpenDisplay,,[
|
|
|
|
AC_CHECK_LIB(X11,XOpenDisplay,
|
|
|
|
[LIBS="-lX11 $LIBS"],,
|
|
|
|
[$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])])
|
|
|
|
|
|
|
|
AC_CHECK_FUNC(XtAppInitialize,,[
|
|
|
|
AC_CHECK_LIB(Xt, XtAppInitialize,
|
|
|
|
[AC_DEFINE(HAVE_LIBXT)
|
|
|
|
cf_have_X_LIBS=Xt
|
2007-06-15 13:29:55 -06:00
|
|
|
LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS"],,
|
2006-11-26 04:11:12 -07:00
|
|
|
[$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])])
|
|
|
|
|
|
|
|
if test $cf_have_X_LIBS = no ; then
|
2008-08-25 12:05:56 -06:00
|
|
|
AC_MSG_WARN(
|
2006-11-26 04:11:12 -07:00
|
|
|
[Unable to successfully link X Toolkit library (-lXt) with
|
|
|
|
test program. You will have to check and add the proper libraries by hand
|
|
|
|
to makefile.])
|
|
|
|
fi
|
|
|
|
])dnl
|