fi
fi])
-dnl
-dnl Check for flex, default to lex
-dnl Require flex 2.4 or higher
-dnl Check for bison, default to yacc
-dnl Default to lex/yacc if both flex and bison are not available
-dnl Define the yy prefix string if using flex and bison
-dnl
-dnl usage:
-dnl
-dnl AC_LBL_LEX_AND_YACC(lex, yacc, yyprefix)
-dnl
-dnl results:
-dnl
-dnl $1 (lex set)
-dnl $2 (yacc appended)
-dnl $3 (optional flex and bison -P prefix)
-dnl
-AC_DEFUN(AC_LBL_LEX_AND_YACC,
- [AC_ARG_WITH(flex, [ --without-flex don't use flex])
- AC_ARG_WITH(bison, [ --without-bison don't use bison])
- if test "$with_flex" = no ; then
- $1=lex
- else
- AC_CHECK_PROGS($1, flex, lex)
- fi
- if test "$$1" = flex ; then
- # The -V flag was added in 2.4
- AC_MSG_CHECKING(for flex 2.4 or higher)
- AC_CACHE_VAL(ac_cv_lbl_flex_v24,
- if flex -V >/dev/null 2>&1; then
- ac_cv_lbl_flex_v24=yes
- else
- ac_cv_lbl_flex_v24=no
- fi)
- AC_MSG_RESULT($ac_cv_lbl_flex_v24)
- if test $ac_cv_lbl_flex_v24 = no ; then
- s="2.4 or higher required"
- AC_MSG_WARN(ignoring obsolete flex executable ($s))
- $1=lex
- fi
- fi
- if test "$with_bison" = no ; then
- $2=yacc
- else
- AC_CHECK_PROGS($2, bison, yacc)
- fi
- if test "$$2" = bison ; then
- $2="$$2 -y"
- fi
- if test "$$1" != lex -a "$$2" = yacc -o "$$1" = lex -a "$$2" != yacc ; then
- AC_MSG_WARN(don't have both flex and bison; reverting to lex/yacc)
- $1=lex
- $2=yacc
- fi
- if test "$$1" = flex -a -n "$3" ; then
- $1="$$1 -P$3"
- $2="$$2 -p $3"
- fi])
-
dnl
dnl Checks to see if union wait is used with WEXITSTATUS()
dnl
fi
])
-dnl
-dnl Checks for portable prototype declaration macro
-AC_DEFUN(AC_CHECK_PORTABLE_PROTO, [
- AC_MSG_CHECKING(for __P)
- AC_CACHE_VAL($1,
- AC_TRY_COMPILE([
-# include <unistd.h>],
- [int f __P(())],
- $1=yes,
- $1=no))
- AC_MSG_RESULT($$1)
- if test $$1 = yes; then
- AC_DEFINE(HAVE_PORTABLE_PROTOTYPE)
- fi
-])
-
-dnl checks for u_intXX_t
-AC_DEFUN(AC_CHECK_BITTYPES, [
- $1=yes
-dnl check for u_int8_t
- AC_MSG_CHECKING(for u_int8_t)
- AC_CACHE_VAL(ac_cv_u_int8_t,
- AC_TRY_COMPILE([
-# include <sys/types.h>],
- [u_int8_t i],
- ac_cv_u_int8_t=yes,
- ac_cv_u_int8_t=no))
- AC_MSG_RESULT($ac_cv_u_int8_t)
- if test $ac_cv_u_int8_t = yes; then
- AC_DEFINE(HAVE_U_INT8_T)
- else
- $1=no
- fi
-dnl check for u_int16_t
- AC_MSG_CHECKING(for u_int16_t)
- AC_CACHE_VAL(ac_cv_u_int16_t,
- AC_TRY_COMPILE([
-# include <sys/types.h>],
- [u_int16_t i],
- ac_cv_u_int16_t=yes,
- ac_cv_u_int16_t=no))
- AC_MSG_RESULT($ac_cv_u_int16_t)
- if test $ac_cv_u_int16_t = yes; then
- AC_DEFINE(HAVE_U_INT16_T)
- else
- $1=no
- fi
-dnl check for u_int32_t
- AC_MSG_CHECKING(for u_int32_t)
- AC_CACHE_VAL(ac_cv_u_int32_t,
- AC_TRY_COMPILE([
-# include <sys/types.h>],
- [u_int32_t i],
- ac_cv_u_int32_t=yes,
- ac_cv_u_int32_t=no))
- AC_MSG_RESULT($ac_cv_u_int32_t)
- if test $ac_cv_u_int32_t = yes; then
- AC_DEFINE(HAVE_U_INT32_T)
- else
- $1=no
- fi
-dnl check for u_int64_t
- AC_MSG_CHECKING(for u_int64_t)
- AC_CACHE_VAL(ac_cv_u_int64_t,
- AC_TRY_COMPILE([
-# include <sys/types.h>],
- [u_int64_t i],
- ac_cv_u_int64_t=yes,
- ac_cv_u_int64_t=no))
- AC_MSG_RESULT($ac_cv_u_int64_t)
- if test $ac_cv_u_int64_t = yes; then
- AC_DEFINE(HAVE_U_INT64_T)
- else
- $1=no
- fi
-])
-
dnl
dnl Checks for addrinfo structure
AC_DEFUN(AC_STRUCT_ADDRINFO, [
AC_MSG_RESULT($ac_cv___attribute__)
])
+
+dnl
+dnl Test whether __attribute__((format)) can be applied to function
+dnl pointers
+dnl
+
+AC_DEFUN(AC_C___ATTRIBUTE___FORMAT_FUNCTION_POINTER, [
+AC_MSG_CHECKING([whether __attribute__((format)) can be applied to function pointers])
+AC_CACHE_VAL(ac_cv___attribute___format_function_pointer, [
+AC_COMPILE_IFELSE(
+ AC_LANG_SOURCE([[
+#include <stdlib.h>
+
+extern int (*foo)(const char *fmt, ...)
+ __attribute__ ((format (printf, 1, 2)));
+
+int
+main(int argc, char **argv)
+{
+ (*foo)("%s", "test");
+}
+ ]]),
+ac_cv___attribute___format_function_pointer=yes,
+ac_cv___attribute___format_function_pointer=no)])
+if test "$ac_cv___attribute___format_function_pointer" = "yes"; then
+ AC_DEFINE(__ATTRIBUTE___FORMAT_OK_FOR_FUNCTION_POINTERS, 1,
+ [define if your compiler allows __attribute__((format)) to be applied to function pointers])
+fi
+AC_MSG_RESULT($ac_cv___attribute___format_function_pointer)
+])
+
AC_DEFUN(AC_LBL_SSLEAY,
[
#
{ echo "$as_me:$LINENO: result: $ac_cv___attribute__" >&5
echo "${ECHO_T}$ac_cv___attribute__" >&6; }
+if test "$ac_cv___attribute__" = "yes"; then
+
+{ echo "$as_me:$LINENO: checking whether __attribute__((format)) can be applied to function pointers" >&5
+echo $ECHO_N "checking whether __attribute__((format)) can be applied to function pointers... $ECHO_C" >&6; }
+if test "${ac_cv___attribute___format_function_pointer+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+#include <stdlib.h>
+
+extern int (*foo)(const char *fmt, ...)
+ __attribute__ ((format (printf, 1, 2)));
+
+int
+main(int argc, char **argv)
+{
+ (*foo)("%s", "test");
+}
+
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv___attribute___format_function_pointer=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv___attribute___format_function_pointer=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+if test "$ac_cv___attribute___format_function_pointer" = "yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define __ATTRIBUTE___FORMAT_OK_FOR_FUNCTION_POINTERS 1
+_ACEOF
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv___attribute___format_function_pointer" >&5
+echo "${ECHO_T}$ac_cv___attribute___format_function_pointer" >&6; }
+
+fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
fi
-
-for ac_func in getaddrinfo getnameinfo
+for ac_func in getnameinfo
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
{ echo "$as_me:$LINENO: checking for $ac_func" >&5
-
{ echo "$as_me:$LINENO: checking for addrinfo" >&5
echo $ECHO_N "checking for addrinfo... $ECHO_C" >&6; }
if test "${ac_cv_addrinfo+set}" = set; then
AC_LBL_C_INIT(V_CCOPT, V_INCLS)
AC_LBL_C_INLINE
AC_C___ATTRIBUTE__
+if test "$ac_cv___attribute__" = "yes"; then
+ AC_C___ATTRIBUTE___FORMAT_FUNCTION_POINTER
+fi
AC_CHECK_HEADERS(fcntl.h rpc/rpcent.h netdnet/dnetdb.h)
AC_CHECK_HEADERS(net/pfvar.h, , , [#include <sys/types.h>
#include <sys/socket.h>
fi
fi
])
- AC_REPLACE_FUNCS(getaddrinfo getnameinfo)
+ AC_REPLACE_FUNCS(getnameinfo)
fi
AC_CACHE_CHECK([for dnet_htoa declaration in netdnet/dnetdb.h],
AC_CHECK_SIZEOF(long, 4)
AC_CHECK_SIZEOF(long long, 8)
-dnl
-dnl Checks for u_intXX_t
-dnl AC_CHECK_BITTYPES(ac_cv_bittypes)
-dnl if test "$ac_cv_bittypes" = no; then
-dnl missing_includes=yes
-dnl fi
-
dnl
dnl Checks for addrinfo structure
AC_STRUCT_ADDRINFO(ac_cv_addrinfo)
int (*ndo_printf)(netdissect_options *,
const char *fmt, ...)
- __attribute__ ((format (printf, 2, 3)));
+#ifdef __ATTRIBUTE___FORMAT_OK_FOR_FUNCTION_POINTERS
+ __attribute__ ((format (printf, 2, 3)))
+#endif
+ ;
void (*ndo_error)(netdissect_options *,
const char *fmt, ...)
- __attribute__ ((format (printf, 2, 3)));
+#ifdef __ATTRIBUTE___FORMAT_OK_FOR_FUNCTION_POINTERS
+ __attribute__ ((format (printf, 2, 3)))
+#endif
+ ;
void (*ndo_warning)(netdissect_options *,
const char *fmt, ...)
- __attribute__ ((format (printf, 2, 3)));
+#ifdef __ATTRIBUTE___FORMAT_OK_FOR_FUNCTION_POINTERS
+ __attribute__ ((format (printf, 2, 3)))
+#endif
+ ;
};
#define PT_VAT 1 /* Visual Audio Tool */