freebsd-dev/contrib/byacc/aclocal.m4
Jung-uk Kim 3e794565fc MFV: r313101
Update byacc to 20170201.
2017-02-02 20:00:01 +00:00

1455 lines
44 KiB
Plaintext

dnl $Id: aclocal.m4,v 1.42 2017/02/01 10:12:21 tom Exp $
dnl Macros for byacc configure script (Thomas E. Dickey)
dnl ---------------------------------------------------------------------------
dnl Copyright 2004-2016,2017 Thomas E. Dickey
dnl
dnl Permission is hereby granted, free of charge, to any person obtaining a
dnl copy of this software and associated documentation files (the
dnl "Software"), to deal in the Software without restriction, including
dnl without limitation the rights to use, copy, modify, merge, publish,
dnl distribute, distribute with modifications, sublicense, and/or sell
dnl copies of the Software, and to permit persons to whom the Software is
dnl furnished to do so, subject to the following conditions:
dnl
dnl The above copyright notice and this permission notice shall be included
dnl in all copies or portions of the Software.
dnl
dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
dnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
dnl THE USE OR OTHER DEALINGS IN THE SOFTWARE.
dnl
dnl Except as contained in this notice, the name(s) of the above copyright
dnl holders shall not be used in advertising or otherwise to promote the
dnl sale, use or other dealings in this Software without prior written
dnl authorization.
dnl ---------------------------------------------------------------------------
dnl ---------------------------------------------------------------------------
dnl CF_ACVERSION_CHECK version: 5 updated: 2014/06/04 19:11:49
dnl ------------------
dnl Conditionally generate script according to whether we're using a given autoconf.
dnl
dnl $1 = version to compare against
dnl $2 = code to use if AC_ACVERSION is at least as high as $1.
dnl $3 = code to use if AC_ACVERSION is older than $1.
define([CF_ACVERSION_CHECK],
[
ifdef([AC_ACVERSION], ,[ifdef([AC_AUTOCONF_VERSION],[m4_copy([AC_AUTOCONF_VERSION],[AC_ACVERSION])],[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])])dnl
ifdef([m4_version_compare],
[m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])],
[CF_ACVERSION_COMPARE(
AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])),
AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl
dnl ---------------------------------------------------------------------------
dnl CF_ACVERSION_COMPARE version: 3 updated: 2012/10/03 18:39:53
dnl --------------------
dnl CF_ACVERSION_COMPARE(MAJOR1, MINOR1, TERNARY1,
dnl MAJOR2, MINOR2, TERNARY2,
dnl PRINTABLE2, not FOUND, FOUND)
define([CF_ACVERSION_COMPARE],
[ifelse(builtin([eval], [$2 < $5]), 1,
[ifelse([$8], , ,[$8])],
[ifelse([$9], , ,[$9])])])dnl
dnl ---------------------------------------------------------------------------
dnl CF_ADD_CFLAGS version: 12 updated: 2015/04/12 15:39:00
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
(-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C)
case $cf_add_cflags in
(-D*)
cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'`
test "x${cf_add_cflags}" != "x${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)
;;
(*)
case $cf_add_cflags in
(-D*)
cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags)
;;
esac
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 "x${cf_add_cflags}" != "x${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="$CPPFLAGS $cf_new_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_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_OPTION version: 5 updated: 2015/05/10 19:52:14
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 ---------------------------------------------------------------------------
dnl CF_CC_ENV_FLAGS version: 6 updated: 2016/08/29 20:57:00
dnl ---------------
dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content
dnl into CC. This will not help with broken scripts that wrap the compiler
dnl with options, but eliminates a more common category of user confusion.
dnl
dnl In particular, it addresses the problem of being able to run the C
dnl preprocessor in a consistent manner.
dnl
dnl Caveat: this also disallows blanks in the pathname for the compiler, but
dnl the nuisance of having inconsistent settings for compiler and preprocessor
dnl outweighs that limitation.
AC_DEFUN([CF_CC_ENV_FLAGS],
[
# This should have been defined by AC_PROG_CC
: ${CC:=cc}
AC_MSG_CHECKING(\$CC variable)
case "$CC" in
(*[[\ \ ]]-*)
AC_MSG_RESULT(broken)
AC_MSG_WARN(your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options)
# humor him...
cf_flags=`echo "$CC" | sed -e 's/^.*[[ ]]\(-[[^ ]]\)/\1/'`
CC=`echo "$CC " | sed -e 's/[[ ]]-[[^ ]].*$//' -e 's/[[ ]]*$//'`
for cf_arg in $cf_flags
do
case "x$cf_arg" in
(x-[[IUDfgOW]]*)
CF_ADD_CFLAGS($cf_flags)
;;
(*)
CC="$CC $cf_arg"
;;
esac
done
CF_VERBOSE(resulting CC: '$CC')
CF_VERBOSE(resulting CFLAGS: '$CFLAGS')
CF_VERBOSE(resulting CPPFLAGS: '$CPPFLAGS')
;;
(*)
AC_MSG_RESULT(ok)
;;
esac
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_CHECK_CACHE version: 12 updated: 2012/10/02 20:55:03
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",[Define to the 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))
AC_MSG_ERROR("Please remove config.cache and try again.")
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_CLANG_COMPILER version: 2 updated: 2013/11/19 19:23:35
dnl -----------------
dnl Check if the given compiler is really clang. clang's C driver defines
dnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does
dnl not ignore some gcc options.
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 = CLANG_COMPILER (default)
dnl $3 = CFLAGS (default) or CXXFLAGS
AC_DEFUN([CF_CLANG_COMPILER],[
ifelse([$2],,CLANG_COMPILER,[$2])=no
if test "$ifelse([$1],,[$1],GCC)" = yes ; then
AC_MSG_CHECKING(if this is really Clang ifelse([$1],GXX,C++,C) compiler)
cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])"
ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -Qunused-arguments"
AC_TRY_COMPILE([],[
#ifdef __clang__
#else
make an error
#endif
],[ifelse([$2],,CLANG_COMPILER,[$2])=yes
cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments"
],[])
ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2]))
fi
])
dnl ---------------------------------------------------------------------------
dnl CF_DISABLE_ECHO version: 13 updated: 2015/04/18 08:56:57
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 do not 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=''
SHOW_CC=''
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_DISABLE_LEAKS version: 7 updated: 2012/10/02 20:55:03
dnl ----------------
dnl Combine no-leak checks with the libraries or tools that are used for the
dnl checks.
AC_DEFUN([CF_DISABLE_LEAKS],[
AC_REQUIRE([CF_WITH_DMALLOC])
AC_REQUIRE([CF_WITH_DBMALLOC])
AC_REQUIRE([CF_WITH_VALGRIND])
AC_MSG_CHECKING(if you want to perform memory-leak testing)
AC_ARG_ENABLE(leaks,
[ --disable-leaks test: free permanent memory, analyze leaks],
[if test "x$enableval" = xno; then with_no_leaks=yes; else with_no_leaks=no; fi],
: ${with_no_leaks:=no})
AC_MSG_RESULT($with_no_leaks)
if test "$with_no_leaks" = yes ; then
AC_DEFINE(NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.])
AC_DEFINE(YY_NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.])
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_GCC_ATTRIBUTES version: 17 updated: 2015/04/12 15:39: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
#line __oline__ "${as_me:-configure}"
#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
cf_printf_attribute=no
cf_scanf_attribute=no
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
(printf)
cf_printf_attribute=yes
cat >conftest.h <<EOF
#define GCC_$cf_ATTRIBUTE 1
EOF
;;
(scanf)
cf_scanf_attribute=yes
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
case $cf_attribute in
(noreturn)
AC_DEFINE_UNQUOTED(GCC_NORETURN,$cf_directive,[Define to noreturn-attribute for gcc])
;;
(printf)
cf_value='/* nothing */'
if test "$cf_printf_attribute" != no ; then
cf_value='__attribute__((format(printf,fmt,var)))'
AC_DEFINE(GCC_PRINTF,1,[Define to 1 if the compiler supports gcc-like printf attribute.])
fi
AC_DEFINE_UNQUOTED(GCC_PRINTFLIKE(fmt,var),$cf_value,[Define to printf-attribute for gcc])
;;
(scanf)
cf_value='/* nothing */'
if test "$cf_scanf_attribute" != no ; then
cf_value='__attribute__((format(scanf,fmt,var)))'
AC_DEFINE(GCC_SCANF,1,[Define to 1 if the compiler supports gcc-like scanf attribute.])
fi
AC_DEFINE_UNQUOTED(GCC_SCANFLIKE(fmt,var),$cf_value,[Define to sscanf-attribute for gcc])
;;
(unused)
AC_DEFINE_UNQUOTED(GCC_UNUSED,$cf_directive,[Define to unused-attribute for gcc])
;;
esac
fi
done
else
fgrep define conftest.i >>confdefs.h
fi
rm -rf conftest*
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_GCC_VERSION version: 7 updated: 2012/10/18 06:46:33
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 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC[[^)]]*) //' -e 's/^.*(Debian[[^)]]*) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
test -z "$GCC_VERSION" && GCC_VERSION=unknown
AC_MSG_RESULT($GCC_VERSION)
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_GCC_WARNINGS version: 32 updated: 2015/04/12 15:39: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)
CF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS)
cat > conftest.$ac_ext <<EOF
#line __oline__ "${as_me:-configure}"
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 #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 #279: controlling expression is constant
AC_CHECKING([for $CC warning options])
cf_save_CFLAGS="$CFLAGS"
EXTRA_CFLAGS="-Wall"
for cf_opt in \
wd1419 \
wd1683 \
wd1684 \
wd193 \
wd593 \
wd279 \
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=
cf_warn_CONST=""
test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
cf_gcc_warnings="Wignored-qualifiers Wlogical-op Wvarargs"
test "x$CLANG_COMPILER" = xyes && cf_gcc_warnings=
for cf_opt in W Wall \
Wbad-function-cast \
Wcast-align \
Wcast-qual \
Wdeclaration-after-statement \
Wextra \
Winline \
Wmissing-declarations \
Wmissing-prototypes \
Wnested-externs \
Wpointer-arith \
Wshadow \
Wstrict-prototypes \
Wundef $cf_gcc_warnings $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
(Wcast-qual)
CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES"
;;
(Winline)
case $GCC_VERSION in
([[34]].*)
CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
continue;;
esac
;;
(Wpointer-arith)
case $GCC_VERSION in
([[12]].*)
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 -rf conftest*
AC_SUBST(EXTRA_CFLAGS)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_GNU_SOURCE version: 7 updated: 2016/08/05 05:15:37
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"
])
])
if test "$cf_cv_gnu_source" = yes
then
AC_CACHE_CHECK(if we should also define _DEFAULT_SOURCE,cf_cv_default_source,[
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
AC_TRY_COMPILE([#include <sys/types.h>],[
#ifdef _DEFAULT_SOURCE
make an error
#endif],
[cf_cv_default_source=no],
[cf_cv_default_source=yes])
])
test "$cf_cv_default_source" = yes && CPPFLAGS="$CPPFLAGS -D_DEFAULT_SOURCE"
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_INTEL_COMPILER version: 7 updated: 2015/04/12 15:39:00
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],[
AC_REQUIRE([AC_CANONICAL_HOST])
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"
],[])
ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2]))
;;
esac
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_MAKE_DOCS version: 4 updated: 2015/07/04 21:43:03
dnl ------------
dnl $1 = name(s) to generate rules for
dnl $2 = suffix of corresponding manpages used as input.
dnl
dnl This works best if called at the end of configure.in, following CF_WITH_MAN2HTML
define([CF_MAKE_DOCS],[
test -z "$cf_make_docs" && cf_make_docs=0
cf_output=makefile
test -f "$cf_output" || cf_output=Makefile
if test "$cf_make_docs" = 0
then
cat >>$cf_output <<CF_EOF
################################################################################
## generated by $0
.SUFFIXES : .html .$2 .man .ps .pdf .txt
${NROFF_NOTE}.$2.txt :
${NROFF_NOTE} [\$](SHELL) -c "tbl [\$]*.$2 | nroff -man | col -bx" >[\$]@
${GROFF_NOTE}.ps.pdf :
${GROFF_NOTE} ps2pdf [\$]*.ps
${GROFF_NOTE}
${GROFF_NOTE}.$2.ps :
${GROFF_NOTE} [\$](SHELL) -c "tbl [\$]*.$2 | groff -man" >[\$]@
${GROFF_NOTE}
${GROFF_NOTE}.$2.txt :
${GROFF_NOTE} GROFF_NO_SGR=stupid [\$](SHELL) -c "tbl [\$]*.$2 | nroff -Tascii -man | col -bx" >[\$]@
${MAN2HTML_NOTE}.$2.html :
${MAN2HTML_NOTE} ./${MAN2HTML_TEMP} [\$]* $2 man >[\$]@
CF_EOF
cf_make_docs=1
fi
for cf_name in $1
do
cat >>$cf_output <<CF_EOF
################################################################################
${NROFF_NOTE}docs docs-$cf_name :: $cf_name.txt
${MAN2HTML_NOTE}docs docs-$cf_name :: $cf_name.html
${GROFF_NOTE}docs docs-$cf_name :: $cf_name.pdf
${GROFF_NOTE}docs docs-$cf_name :: $cf_name.ps
${GROFF_NOTE}docs docs-$cf_name :: $cf_name.txt
clean \\
docs-clean ::
${NROFF_NOTE} rm -f $cf_name.txt
${MAN2HTML_NOTE} rm -f $cf_name.html
${GROFF_NOTE} rm -f $cf_name.pdf
${GROFF_NOTE} rm -f $cf_name.ps
${GROFF_NOTE} rm -f $cf_name.txt
${NROFF_NOTE}$cf_name.txt : $cf_name.$2
${MAN2HTML_NOTE}$cf_name.html : $cf_name.$2
${GROFF_NOTE}$cf_name.pdf : $cf_name.ps
${GROFF_NOTE}$cf_name.ps : $cf_name.$2
${GROFF_NOTE}$cf_name.txt : $cf_name.$2
CF_EOF
done
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_MAKE_TAGS version: 6 updated: 2010/10/23 15:52:32
dnl ------------
dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have
dnl a monocase filesystem.
AC_DEFUN([CF_MAKE_TAGS],[
AC_REQUIRE([CF_MIXEDCASE_FILENAMES])
AC_CHECK_PROGS(CTAGS, exctags ctags)
AC_CHECK_PROGS(ETAGS, exetags etags)
AC_CHECK_PROG(MAKE_LOWER_TAGS, ${CTAGS:-ctags}, yes, no)
if test "$cf_cv_mixedcase" = yes ; then
AC_CHECK_PROG(MAKE_UPPER_TAGS, ${ETAGS:-etags}, yes, no)
else
MAKE_UPPER_TAGS=no
fi
if test "$MAKE_UPPER_TAGS" = yes ; then
MAKE_UPPER_TAGS=
else
MAKE_UPPER_TAGS="#"
fi
if test "$MAKE_LOWER_TAGS" = yes ; then
MAKE_LOWER_TAGS=
else
MAKE_LOWER_TAGS="#"
fi
AC_SUBST(CTAGS)
AC_SUBST(ETAGS)
AC_SUBST(MAKE_UPPER_TAGS)
AC_SUBST(MAKE_LOWER_TAGS)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_MIXEDCASE_FILENAMES version: 7 updated: 2015/04/12 15:39:00
dnl ----------------------
dnl Check if the file-system supports mixed-case filenames. If we're able to
dnl create a lowercase name and see it as uppercase, it doesn't support that.
AC_DEFUN([CF_MIXEDCASE_FILENAMES],
[
AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[
if test "$cross_compiling" = yes ; then
case $target_alias in
(*-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw*|*-uwin*)
cf_cv_mixedcase=no
;;
(*)
cf_cv_mixedcase=yes
;;
esac
else
rm -f conftest CONFTEST
echo test >conftest
if test -f CONFTEST ; then
cf_cv_mixedcase=no
else
cf_cv_mixedcase=yes
fi
rm -f conftest CONFTEST
fi
])
test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if filesystem supports mixed-case filenames.])
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_MKSTEMP version: 10 updated: 2017/01/21 11:12:16
dnl ----------
dnl Check for a working mkstemp. This creates two files, checks that they are
dnl successfully created and distinct (AmigaOS apparently fails on the last).
AC_DEFUN([CF_MKSTEMP],[
AC_CHECK_HEADERS( \
unistd.h \
)
AC_CACHE_CHECK(for working mkstemp, cf_cv_func_mkstemp,[
rm -rf conftest*
AC_TRY_RUN([
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
int main(void)
{
char *tmpl = "conftestXXXXXX";
char name[2][80];
int n;
int result = 0;
int fd;
struct stat sb;
umask(077);
for (n = 0; n < 2; ++n) {
strcpy(name[n], tmpl);
if ((fd = mkstemp(name[n])) >= 0) {
if (!strcmp(name[n], tmpl)
|| stat(name[n], &sb) != 0
|| (sb.st_mode & S_IFMT) != S_IFREG
|| (sb.st_mode & 077) != 0) {
result = 1;
}
close(fd);
}
}
if (result == 0
&& !strcmp(name[0], name[1]))
result = 1;
${cf_cv_main_return:-return}(result);
}
],[cf_cv_func_mkstemp=yes
],[cf_cv_func_mkstemp=no
],[cf_cv_func_mkstemp=maybe])
])
if test "x$cf_cv_func_mkstemp" = xmaybe ; then
AC_CHECK_FUNC(mkstemp)
fi
if test "x$cf_cv_func_mkstemp" = xyes || test "x$ac_cv_func_mkstemp" = xyes ; then
AC_DEFINE(HAVE_MKSTEMP,1,[Define to 1 if mkstemp() is available and working.])
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_MSG_LOG version: 5 updated: 2010/10/23 15:52:32
dnl ----------
dnl Write a debug message to config.log, along with the line number in the
dnl configure script.
AC_DEFUN([CF_MSG_LOG],[
echo "${as_me:-configure}:__oline__: testing $* ..." 1>&AC_FD_CC
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_NO_LEAKS_OPTION version: 6 updated: 2015/04/12 15:39:00
dnl ------------------
dnl see CF_WITH_NO_LEAKS
AC_DEFUN([CF_NO_LEAKS_OPTION],[
AC_MSG_CHECKING(if you want to use $1 for testing)
AC_ARG_WITH($1,
[$2],
[AC_DEFINE_UNQUOTED($3,1,"Define to 1 if you want to use $1 for testing.")ifelse([$4],,[
$4
])
: ${with_cflags:=-g}
: ${with_no_leaks:=yes}
with_$1=yes],
[with_$1=])
AC_MSG_RESULT(${with_$1:-no})
case .$with_cflags in
(.*-g*)
case .$CFLAGS in
(.*-g*)
;;
(*)
CF_ADD_CFLAGS([-g])
;;
esac
;;
esac
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_PATH_SYNTAX version: 16 updated: 2015/04/18 08:56:57
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],[
if test "x$prefix" != xNONE; then
cf_path_syntax="$prefix"
else
cf_path_syntax="$ac_default_prefix"
fi
case ".[$]$1" in
(.\[$]\(*\)*|.\'*\'*)
;;
(..|./*|.\\*)
;;
(.[[a-zA-Z]]:[[\\/]]*) # OS/2 EMX
;;
(.\[$]{*prefix}*|.\[$]{*dir}*)
eval $1="[$]$1"
case ".[$]$1" in
(.NONE/*)
$1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
;;
esac
;;
(.no|.NONE/*)
$1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
;;
(*)
ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2)
;;
esac
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_POSIX_C_SOURCE version: 9 updated: 2015/04/12 15:39:00
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
(.[[12]]??*)
cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
;;
(.2)
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"
CF_ADD_CFLAGS($cf_cv_posix_c_source)
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_PROG_AWK version: 1 updated: 2006/09/16 11:40:59
dnl -----------
dnl Check for awk, ensure that the check found something.
AC_DEFUN([CF_PROG_AWK],
[
AC_PROG_AWK
test -z "$AWK" && AC_MSG_ERROR(No awk program found)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_PROG_CC version: 4 updated: 2014/07/12 18:57:58
dnl ----------
dnl standard check for CC, plus followup sanity checks
dnl $1 = optional parameter to pass to AC_PROG_CC to specify compiler name
AC_DEFUN([CF_PROG_CC],[
ifelse($1,,[AC_PROG_CC],[AC_PROG_CC($1)])
CF_GCC_VERSION
CF_ACVERSION_CHECK(2.52,
[AC_PROG_CC_STDC],
[CF_ANSI_CC_REQD])
CF_CC_ENV_FLAGS
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_PROG_GROFF version: 2 updated: 2015/07/04 11:16:27
dnl -------------
dnl Check if groff is available, for cases (such as html output) where nroff
dnl is not enough.
AC_DEFUN([CF_PROG_GROFF],[
AC_PATH_PROG(GROFF_PATH,groff,no)
AC_PATH_PROG(NROFF_PATH,nroff,no)
if test "x$GROFF_PATH" = xno
then
NROFF_NOTE=
GROFF_NOTE="#"
else
NROFF_NOTE="#"
GROFF_NOTE=
fi
AC_SUBST(GROFF_NOTE)
AC_SUBST(NROFF_NOTE)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_PROG_LINT version: 3 updated: 2016/05/22 15:25:54
dnl ------------
AC_DEFUN([CF_PROG_LINT],
[
AC_CHECK_PROGS(LINT, lint cppcheck splint)
AC_SUBST(LINT_OPTS)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50
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],
[
$1=`echo "$2" | \
sed -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[[ ]]/ /g' \
-e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'`
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_TRY_XOPEN_SOURCE version: 1 updated: 2011/10/30 17:09:50
dnl -------------------
dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we
dnl can define it successfully.
AC_DEFUN([CF_TRY_XOPEN_SOURCE],[
AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
AC_TRY_COMPILE([
#include <stdlib.h>
#include <string.h>
#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 <stdlib.h>
#include <string.h>
#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)
cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
CF_ADD_CFLAGS($cf_temp_xopen_source)
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_VERBOSE version: 3 updated: 2007/07/29 09:55:12
dnl ----------
dnl Use AC_VERBOSE w/o the warnings
AC_DEFUN([CF_VERBOSE],
[test -n "$verbose" && echo " $1" 1>&AC_FD_MSG
CF_MSG_LOG([$1])
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_WITH_DBMALLOC version: 7 updated: 2010/06/21 17:26:47
dnl ----------------
dnl Configure-option for dbmalloc. The optional parameter is used to override
dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests.
AC_DEFUN([CF_WITH_DBMALLOC],[
CF_NO_LEAKS_OPTION(dbmalloc,
[ --with-dbmalloc test: use Conor Cahill's dbmalloc library],
[USE_DBMALLOC])
if test "$with_dbmalloc" = yes ; then
AC_CHECK_HEADER(dbmalloc.h,
[AC_CHECK_LIB(dbmalloc,[debug_malloc]ifelse([$1],,[],[,$1]))])
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_WITH_DMALLOC version: 7 updated: 2010/06/21 17:26:47
dnl ---------------
dnl Configure-option for dmalloc. The optional parameter is used to override
dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests.
AC_DEFUN([CF_WITH_DMALLOC],[
CF_NO_LEAKS_OPTION(dmalloc,
[ --with-dmalloc test: use Gray Watson's dmalloc library],
[USE_DMALLOC])
if test "$with_dmalloc" = yes ; then
AC_CHECK_HEADER(dmalloc.h,
[AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse([$1],,[],[,$1]))])
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_WITH_MAN2HTML version: 5 updated: 2015/08/20 04:51:36
dnl ----------------
dnl Check for man2html and groff. Optionally prefer man2html over groff.
dnl Generate a shell script which hides the differences between the two.
dnl
dnl We name that "man2html.tmp".
dnl
dnl The shell script can be removed later, e.g., using "make distclean".
AC_DEFUN([CF_WITH_MAN2HTML],[
AC_REQUIRE([CF_PROG_GROFF])
AC_MSG_CHECKING(for program to convert manpage to html)
AC_ARG_WITH(man2html,
[ --with-man2html=XXX use XXX rather than groff],
[cf_man2html=$withval],
[cf_man2html=$GROFF_PATH])
cf_with_groff=no
case $cf_man2html in
(yes)
AC_MSG_RESULT(man2html)
AC_PATH_PROG(cf_man2html,man2html,no)
;;
(no|groff|*/groff*)
cf_with_groff=yes
cf_man2html=$GROFF_PATH
AC_MSG_RESULT($cf_man2html)
;;
(*)
AC_MSG_RESULT($cf_man2html)
;;
esac
MAN2HTML_TEMP="man2html.tmp"
cat >$MAN2HTML_TEMP <<CF_EOF
#!$SHELL
# Temporary script generated by CF_WITH_MAN2HTML
# Convert inputs to html, sending result to standard output.
#
# Parameters:
# \${1} = rootname of file to convert
# \${2} = suffix of file to convert, e.g., "1"
# \${3} = macros to use, e.g., "man"
#
ROOT=\[$]1
TYPE=\[$]2
MACS=\[$]3
unset LANG
unset LC_ALL
unset LC_CTYPE
unset LANGUAGE
GROFF_NO_SGR=stupid
export GROFF_NO_SGR
CF_EOF
if test "x$cf_with_groff" = xyes
then
MAN2HTML_NOTE="$GROFF_NOTE"
MAN2HTML_PATH="$GROFF_PATH"
cat >>$MAN2HTML_TEMP <<CF_EOF
$SHELL -c "tbl \${ROOT}.\${TYPE} | $GROFF_PATH -P -o0 -I\${ROOT}_ -Thtml -\${MACS}"
CF_EOF
else
MAN2HTML_NOTE=""
CF_PATH_SYNTAX(cf_man2html)
MAN2HTML_PATH="$cf_man2html"
AC_MSG_CHECKING(for $cf_man2html top/bottom margins)
# for this example, expect 3 lines of content, the remainder is head/foot
cat >conftest.in <<CF_EOF
.TH HEAD1 HEAD2 HEAD3 HEAD4 HEAD5
.SH SECTION
MARKER
CF_EOF
LC_ALL=C LC_CTYPE=C LANG=C LANGUAGE=C nroff -man conftest.in >conftest.out
cf_man2html_1st=`fgrep -n MARKER conftest.out |sed -e 's/^[[^0-9]]*://' -e 's/:.*//'`
cf_man2html_top=`expr $cf_man2html_1st - 2`
cf_man2html_bot=`wc -l conftest.out |sed -e 's/[[^0-9]]//g'`
cf_man2html_bot=`expr $cf_man2html_bot - 2 - $cf_man2html_top`
cf_man2html_top_bot="-topm=$cf_man2html_top -botm=$cf_man2html_bot"
AC_MSG_RESULT($cf_man2html_top_bot)
AC_MSG_CHECKING(for pagesize to use)
for cf_block in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
do
cat >>conftest.in <<CF_EOF
.nf
0
1
2
3
4
5
6
7
8
9
CF_EOF
done
LC_ALL=C LC_CTYPE=C LANG=C LANGUAGE=C nroff -man conftest.in >conftest.out
cf_man2html_page=`fgrep -n HEAD1 conftest.out |tail -n 1 |sed -e 's/^[[^0-9]]*://' -e 's/:.*//'`
test -z "$cf_man2html_page" && cf_man2html_page=99999
test "$cf_man2html_page" -gt 100 && cf_man2html_page=99999
rm -rf conftest*
AC_MSG_RESULT($cf_man2html_page)
cat >>$MAN2HTML_TEMP <<CF_EOF
: \${MAN2HTML_PATH=$MAN2HTML_PATH}
MAN2HTML_OPTS="\$MAN2HTML_OPTS -index -title="\$ROOT\(\$TYPE\)" -compress -pgsize $cf_man2html_page"
case \${TYPE} in
(ms)
tbl \${ROOT}.\${TYPE} | nroff -\${MACS} | \$MAN2HTML_PATH -topm=0 -botm=0 \$MAN2HTML_OPTS
;;
(*)
tbl \${ROOT}.\${TYPE} | nroff -\${MACS} | \$MAN2HTML_PATH $cf_man2html_top_bot \$MAN2HTML_OPTS
;;
esac
CF_EOF
fi
chmod 700 $MAN2HTML_TEMP
AC_SUBST(MAN2HTML_NOTE)
AC_SUBST(MAN2HTML_PATH)
AC_SUBST(MAN2HTML_TEMP)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_WITH_VALGRIND version: 1 updated: 2006/12/14 18:00:21
dnl ----------------
AC_DEFUN([CF_WITH_VALGRIND],[
CF_NO_LEAKS_OPTION(valgrind,
[ --with-valgrind test: use valgrind],
[USE_VALGRIND])
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_WITH_WARNINGS version: 5 updated: 2004/07/23 14:40:34
dnl ----------------
dnl Combine the checks for gcc features into a configure-script option
dnl
dnl Parameters:
dnl $1 - see CF_GCC_WARNINGS
AC_DEFUN([CF_WITH_WARNINGS],
[
if ( test "$GCC" = yes || test "$GXX" = yes )
then
AC_MSG_CHECKING(if you want to check for gcc warnings)
AC_ARG_WITH(warnings,
[ --with-warnings test: turn on gcc warnings],
[cf_opt_with_warnings=$withval],
[cf_opt_with_warnings=no])
AC_MSG_RESULT($cf_opt_with_warnings)
if test "$cf_opt_with_warnings" != no ; then
CF_GCC_ATTRIBUTES
CF_GCC_WARNINGS([$1])
fi
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_XOPEN_SOURCE version: 52 updated: 2016/08/27 12:21:42
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([AC_CANONICAL_HOST])
cf_XOPEN_SOURCE=ifelse([$1],,500,[$1])
cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2])
cf_xopen_source=
case $host_os in
(aix[[4-7]]*)
cf_xopen_source="-D_ALL_SOURCE"
;;
(msys)
cf_XOPEN_SOURCE=600
;;
(darwin[[0-8]].*)
cf_xopen_source="-D_APPLE_C_SOURCE"
;;
(darwin*)
cf_xopen_source="-D_DARWIN_C_SOURCE"
cf_XOPEN_SOURCE=
;;
(freebsd*|dragonfly*)
# 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
cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
;;
(hpux11*)
cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500"
;;
(hpux*)
cf_xopen_source="-D_HPUX_SOURCE"
;;
(irix[[56]].*)
cf_xopen_source="-D_SGI_SOURCE"
cf_XOPEN_SOURCE=
;;
(linux*|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin)
CF_GNU_SOURCE
;;
(minix*)
cf_xopen_source="-D_NETBSD_SOURCE" # POSIX.1-2001 features are ifdef'd with this...
;;
(mirbsd*)
# setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <sys/select.h> and other headers which use u_int / u_short types
cf_XOPEN_SOURCE=
CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
;;
(netbsd*)
cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
;;
(openbsd[[4-9]]*)
# setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw
cf_xopen_source="-D_BSD_SOURCE"
cf_XOPEN_SOURCE=600
;;
(openbsd*)
# setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
;;
(osf[[45]]*)
cf_xopen_source="-D_OSF_SOURCE"
;;
(nto-qnx*)
cf_xopen_source="-D_QNX_SOURCE"
;;
(sco*)
# setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
;;
(solaris2.*)
cf_xopen_source="-D__EXTENSIONS__"
cf_cv_xopen_source=broken
;;
(sysv4.2uw2.*) # Novell/SCO UnixWare 2.x (tested on 2.1.2)
cf_XOPEN_SOURCE=
cf_POSIX_C_SOURCE=
;;
(*)
CF_TRY_XOPEN_SOURCE
CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
;;
esac
if test -n "$cf_xopen_source" ; then
CF_ADD_CFLAGS($cf_xopen_source,true)
fi
dnl In anything but the default case, we may have system-specific setting
dnl which is still not guaranteed to provide all of the entrypoints that
dnl _XOPEN_SOURCE would yield.
if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then
AC_MSG_CHECKING(if _XOPEN_SOURCE really is set)
AC_TRY_COMPILE([#include <stdlib.h>],[
#ifndef _XOPEN_SOURCE
make an error
#endif],
[cf_XOPEN_SOURCE_set=yes],
[cf_XOPEN_SOURCE_set=no])
AC_MSG_RESULT($cf_XOPEN_SOURCE_set)
if test $cf_XOPEN_SOURCE_set = yes
then
AC_TRY_COMPILE([#include <stdlib.h>],[
#if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE
make an error
#endif],
[cf_XOPEN_SOURCE_set_ok=yes],
[cf_XOPEN_SOURCE_set_ok=no])
if test $cf_XOPEN_SOURCE_set_ok = no
then
AC_MSG_WARN(_XOPEN_SOURCE is lower than requested)
fi
else
CF_TRY_XOPEN_SOURCE
fi
fi
])