new upstream 2.8.0
This commit is contained in:
parent
fc7f4b43c1
commit
b2b0c9995a
836 changed files with 137090 additions and 30018 deletions
134
m4/ax_c___attribute__.m4
Normal file
134
m4/ax_c___attribute__.m4
Normal file
|
@ -0,0 +1,134 @@
|
|||
# ===========================================================================
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_c___attribute__.html
|
||||
#
|
||||
# Downloaded into the Network UPS Tools (NUT) codebase from
|
||||
# http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_c___attribute__.m4
|
||||
# as of 2020-11-20 and adapted for attribute supports we needed
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_C___ATTRIBUTE__
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Provides a test for the compiler support of __attribute__ extensions.
|
||||
# Defines HAVE___ATTRIBUTE__ if it is found.
|
||||
# Also in particular defines
|
||||
# HAVE___ATTRIBUTE__UNUSED_ARG
|
||||
# HAVE___ATTRIBUTE__UNUSED_FUNC
|
||||
# HAVE___ATTRIBUTE__NORETURN
|
||||
# if support for respective values and use-cases of interest for NUT
|
||||
# codebase is found.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Stepan Kasal <skasal@redhat.com>
|
||||
# Copyright (c) 2008 Christian Haggstrom
|
||||
# Copyright (c) 2008 Ryan McCabe <ryan@numb.org>
|
||||
# Copyright (c) 2020 Jim Klimov <jimklimov+nut@gmail.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by the
|
||||
# Free Software Foundation; either version 2 of the License, or (at your
|
||||
# option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
# Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||
# gives unlimited permission to copy, distribute and modify the configure
|
||||
# scripts that are the output of Autoconf when processing the Macro. You
|
||||
# need not follow the terms of the GNU General Public License when using
|
||||
# or distributing such scripts, even though portions of the text of the
|
||||
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||
# all other use of the material that constitutes the Autoconf Macro.
|
||||
#
|
||||
# This special exception to the GPL applies to versions of the Autoconf
|
||||
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||
# modified version of the Autoconf Macro, you may extend this special
|
||||
# exception to the GPL to apply to your modified version as well.
|
||||
|
||||
#serial 9
|
||||
|
||||
AC_DEFUN([AX_C___ATTRIBUTE__], [
|
||||
AC_LANG_PUSH([C])
|
||||
AC_CACHE_CHECK([for __attribute__((unused)) for function arguments], [ax_cv___attribute__unused_arg],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[#include <stdlib.h>
|
||||
static void foo( int);
|
||||
static void
|
||||
foo(__attribute__ ((unused)) int i) {
|
||||
return;
|
||||
}
|
||||
]], [func(1);])],
|
||||
[ax_cv___attribute__unused_arg=yes],
|
||||
[ax_cv___attribute__unused_arg=no]
|
||||
)
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for __attribute__((unused)) for functions], [ax_cv___attribute__unused_func],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[#include <stdlib.h>
|
||||
static void foo(void) __attribute__ ((unused));
|
||||
static void
|
||||
foo(void) {
|
||||
return;
|
||||
}
|
||||
]], [])],
|
||||
[ax_cv___attribute__unused_func=yes],
|
||||
[ax_cv___attribute__unused_func=no]
|
||||
)
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for __attribute__((noreturn))], [ax_cv___attribute__noreturn],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[#include <stdlib.h>
|
||||
static void foo(void) __attribute__ ((noreturn));
|
||||
static void
|
||||
foo(void) {
|
||||
exit(1);
|
||||
}
|
||||
]], [foo();])],
|
||||
[ax_cv___attribute__noreturn=yes],
|
||||
[ax_cv___attribute__noreturn=no]
|
||||
)
|
||||
])
|
||||
AC_LANG_POP([C])
|
||||
|
||||
AC_CACHE_CHECK([for at least some __attribute__ support], [ax_cv___attribute__],
|
||||
[if test "$ax_cv___attribute__unused_arg" = "yes" \
|
||||
|| test "$ax_cv___attribute__unused_func" = "yes" \
|
||||
|| test "$ax_cv___attribute__noreturn" = "yes" \
|
||||
; then
|
||||
dnl # Some values did not error, support for keyword itself exists
|
||||
ax_cv___attribute__=yes
|
||||
else
|
||||
dnl # At least none of the options we are interested in work...
|
||||
ax_cv___attribute__=no
|
||||
fi
|
||||
])
|
||||
|
||||
if test "$ax_cv___attribute__unused_arg" = "yes"; then
|
||||
AC_DEFINE([HAVE___ATTRIBUTE__UNUSED_ARG], 1, [define if your compiler has __attribute__((unused)) for function arguments])
|
||||
fi
|
||||
|
||||
if test "$ax_cv___attribute__unused_func" = "yes"; then
|
||||
AC_DEFINE([HAVE___ATTRIBUTE__UNUSED_FUNC], 1, [define if your compiler has __attribute__((unused)) for functions])
|
||||
fi
|
||||
if test "$ax_cv___attribute__noreturn" = "yes"; then
|
||||
AC_DEFINE([HAVE___ATTRIBUTE__NORETURN], 1, [define if your compiler has __attribute__((noreturn))])
|
||||
fi
|
||||
|
||||
if test "$ax_cv___attribute__" = "yes"; then
|
||||
AC_DEFINE([HAVE___ATTRIBUTE__], 1, [define if your compiler has __attribute__])
|
||||
fi
|
||||
])
|
983
m4/ax_c_pragmas.m4
Normal file
983
m4/ax_c_pragmas.m4
Normal file
|
@ -0,0 +1,983 @@
|
|||
dnl Check for current compiler support of specific pragmas we use,
|
||||
dnl e.g. diagnostics management to keep warnings quiet sometimes
|
||||
|
||||
AC_DEFUN([AX_C_PRAGMAS], [
|
||||
if test -z "${nut_have_ax_c_pragmas_seen}"; then
|
||||
nut_have_ax_c_pragmas_seen="yes"
|
||||
|
||||
CFLAGS_SAVED="${CFLAGS}"
|
||||
CXXFLAGS_SAVED="${CXXFLAGS}"
|
||||
|
||||
dnl ### To be sure, bolt the language
|
||||
AC_LANG_PUSH([C])
|
||||
|
||||
dnl # This is expected to fail builds with unknown pragma names on GCC or CLANG at least
|
||||
AS_IF([test "${CLANG}" = "yes"],
|
||||
[CFLAGS="${CFLAGS_SAVED} -Werror=pragmas -Werror=unknown-pragmas -Werror=unknown-warning-option"
|
||||
CXXFLAGS="${CXXFLAGS_SAVED} -Werror=pragmas -Werror=unknown-pragmas -Werror=unknown-warning-option"],
|
||||
[AS_IF([test "${GCC}" = "yes"],
|
||||
dnl ### Despite the docs, this dies with lack of (apparently) support for
|
||||
dnl ### -Wunknown-warning(-options) on all GCC versions I tried (v5-v10)
|
||||
dnl ### [CFLAGS="${CFLAGS_SAVED} -Werror=pragmas -Werror=unknown-warning"],
|
||||
[CFLAGS="${CFLAGS_SAVED} -Wall -Wextra -Werror"
|
||||
CXXFLAGS="${CXXFLAGS_SAVED} -Wall -Wextra -Werror"],
|
||||
[CFLAGS="${CFLAGS_SAVED} -Wall -Wextra -Werror"
|
||||
CXXFLAGS="${CXXFLAGS_SAVED} -Wall -Wextra -Werror"])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic push and pop (outside functions)],
|
||||
[ax_cv__pragma__gcc__diags_push_pop_besidefunc],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic pop
|
||||
]], [])],
|
||||
[ax_cv__pragma__gcc__diags_push_pop_besidefunc=yes],
|
||||
[ax_cv__pragma__gcc__diags_push_pop_besidefunc=no]
|
||||
)]
|
||||
)
|
||||
|
||||
AC_CACHE_CHECK([for pragma clang diagnostic push and pop (outside functions)],
|
||||
[ax_cv__pragma__clang__diags_push_pop_besidefunc],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[
|
||||
#ifdef __clang__
|
||||
#endif
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic pop
|
||||
]], [])],
|
||||
[ax_cv__pragma__clang__diags_push_pop_besidefunc=yes],
|
||||
[ax_cv__pragma__clang__diags_push_pop_besidefunc=no]
|
||||
)]
|
||||
)
|
||||
|
||||
dnl # Currently our code uses these pragmas as close to lines that cause
|
||||
dnl # questions from linters as possible. GCC before 4.5 did not allow
|
||||
dnl # for diag pragmas inside function bodies, but also did not complain
|
||||
dnl # about messy code as new compilers do. For completeness, we support
|
||||
dnl # the possibility of defining larger-scoped pragmas around whole
|
||||
dnl # function bodies. In practice, we don't currently do that so in
|
||||
dnl # most cases the shorter names (without _INSIDEFUNC) are used with
|
||||
dnl # that implied meaning.
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic push and pop (inside functions)],
|
||||
[ax_cv__pragma__gcc__diags_push_pop_insidefunc],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[void func(void) {
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic pop
|
||||
}
|
||||
]], [])],
|
||||
[ax_cv__pragma__gcc__diags_push_pop_insidefunc=yes],
|
||||
[ax_cv__pragma__gcc__diags_push_pop_insidefunc=no]
|
||||
)]
|
||||
)
|
||||
|
||||
AC_CACHE_CHECK([for pragma clang diagnostic push and pop (inside functions)],
|
||||
[ax_cv__pragma__clang__diags_push_pop_insidefunc],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[void func(void) {
|
||||
#ifdef __clang__
|
||||
#endif
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
]], [])],
|
||||
[ax_cv__pragma__clang__diags_push_pop_insidefunc=yes],
|
||||
[ax_cv__pragma__clang__diags_push_pop_insidefunc=no]
|
||||
)]
|
||||
)
|
||||
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_push_pop_insidefunc" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_INSIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic push and pop inside function bodies])
|
||||
])
|
||||
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_push_pop_besidefunc" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic push and pop outside function bodies])
|
||||
])
|
||||
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_push_pop_besidefunc" = "yes" && test "$ax_cv__pragma__gcc__diags_push_pop_insidefunc" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP], 1, [define if your compiler has #pragma GCC diagnostic push and pop])
|
||||
])
|
||||
|
||||
AS_IF([test "$ax_cv__pragma__clang__diags_push_pop_insidefunc" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_CLANG_DIAGNOSTIC_PUSH_POP_INSIDEFUNC], 1, [define if your compiler has #pragma clang diagnostic push and pop inside function bodies])
|
||||
])
|
||||
|
||||
AS_IF([test "$ax_cv__pragma__clang__diags_push_pop_besidefunc" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_CLANG_DIAGNOSTIC_PUSH_POP_BESIDEFUNC], 1, [define if your compiler has #pragma clang diagnostic push and pop outside function bodies])
|
||||
])
|
||||
|
||||
AS_IF([test "$ax_cv__pragma__clang__diags_push_pop_besidefunc" = "yes" && test "$ax_cv__pragma__clang__diags_push_pop_insidefunc" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_CLANG_DIAGNOSTIC_PUSH_POP], 1, [define if your compiler has #pragma clang diagnostic push and pop])
|
||||
])
|
||||
|
||||
dnl Test for some clang-specific pragma support: primarily useful for older
|
||||
dnl clang (3.x) releases, so polluting NUT codebase only when unavoidable.
|
||||
dnl In most cases, GCC pragmas are usable by both; in a few others, direct
|
||||
dnl use of `#ifdef __clang__` suffices.
|
||||
AS_IF([test "${CLANG}" = "yes"], [
|
||||
AC_CACHE_CHECK([for pragma CLANG diagnostic ignored "-Wunreachable-code-return"],
|
||||
[ax_cv__pragma__clang__diags_ignored_unreachable_code_return],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[void func(void) {
|
||||
#pragma clang diagnostic ignored "-Wunreachable-code-return"
|
||||
}
|
||||
]], [])],
|
||||
[ax_cv__pragma__clang__diags_ignored_unreachable_code_return=yes],
|
||||
[ax_cv__pragma__clang__diags_ignored_unreachable_code_return=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__clang__diags_ignored_unreachable_code_return" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_CLANG_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_RETURN], 1, [define if your compiler has #pragma clang diagnostic ignored "-Wunreachable-code-return"])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma CLANG diagnostic ignored "-Wunreachable-code-return" (outside functions)],
|
||||
[ax_cv__pragma__clang__diags_ignored_unreachable_code_return_besidefunc],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#pragma clang diagnostic ignored "-Wunreachable-code-return"]], [])],
|
||||
[ax_cv__pragma__clang__diags_ignored_unreachable_code_return_besidefunc=yes],
|
||||
[ax_cv__pragma__clang__diags_ignored_unreachable_code_return_besidefunc=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__clang__diags_ignored_unreachable_code_return_besidefunc" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_CLANG_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_RETURN_BESIDEFUNC], 1, [define if your compiler has #pragma clang diagnostic ignored "-Wunreachable-code-return" (outside functions)])
|
||||
])
|
||||
]) dnl Special pragma support testing for clang
|
||||
|
||||
dnl Test common pragmas for GCC (and compatible) compilers
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wunused-function"],
|
||||
[ax_cv__pragma__gcc__diags_ignored_unused_function],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[void func(void) {
|
||||
#pragma GCC diagnostic ignored "-Wunused-function"
|
||||
}
|
||||
]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_unused_function=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_unused_function=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_unused_function" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNUSED_FUNCTION], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wunused-function"])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wformat-nonliteral"],
|
||||
[ax_cv__pragma__gcc__diags_ignored_format_nonliteral],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[void func(void) {
|
||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||
}
|
||||
]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_format_nonliteral=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_format_nonliteral=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_format_nonliteral" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wformat-nonliteral"])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wformat-nonliteral" (outside functions)],
|
||||
[ax_cv__pragma__gcc__diags_ignored_format_nonliteral_besidefunc],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wformat-nonliteral"]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_format_nonliteral_besidefunc=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_format_nonliteral_besidefunc=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_format_nonliteral_besidefunc" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wformat-nonliteral" (outside functions)])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wformat-security"],
|
||||
[ax_cv__pragma__gcc__diags_ignored_format_security],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[void func(void) {
|
||||
#pragma GCC diagnostic ignored "-Wformat-security"
|
||||
}
|
||||
]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_format_security=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_format_security=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_format_security" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wformat-security"])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wformat-security" (outside functions)],
|
||||
[ax_cv__pragma__gcc__diags_ignored_format_security_besidefunc],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wformat-security"]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_format_security_besidefunc=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_format_security_besidefunc=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_format_security_besidefunc" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wformat-security" (outside functions)])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wformat-truncation"],
|
||||
[ax_cv__pragma__gcc__diags_ignored_format_truncation],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[void func(void) {
|
||||
#pragma GCC diagnostic ignored "-Wformat-truncation"
|
||||
}
|
||||
]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_format_truncation=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_format_truncation=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_format_truncation" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wformat-truncation"])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wformat-truncation" (outside functions)],
|
||||
[ax_cv__pragma__gcc__diags_ignored_format_truncation_besidefunc],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wformat-truncation"]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_format_truncation_besidefunc=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_format_truncation_besidefunc=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_format_truncation_besidefunc" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wformat-truncation" (outside functions)])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wstringop-truncation"],
|
||||
[ax_cv__pragma__gcc__diags_ignored_stringop_truncation],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[void func(void) {
|
||||
#pragma GCC diagnostic ignored "-Wstringop-truncation"
|
||||
}
|
||||
]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_stringop_truncation=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_stringop_truncation=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_stringop_truncation" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRINGOP_TRUNCATION], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wstringop-truncation"])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wstringop-truncation" (outside functions)],
|
||||
[ax_cv__pragma__gcc__diags_ignored_stringop_truncation_besidefunc],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wstringop-truncation"]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_stringop_truncation_besidefunc=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_stringop_truncation_besidefunc=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_stringop_truncation_besidefunc" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRINGOP_TRUNCATION_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wstringop-truncation" (outside functions)])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wtype-limits"],
|
||||
[ax_cv__pragma__gcc__diags_ignored_type_limits],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[void func(void) {
|
||||
#pragma GCC diagnostic ignored "-Wtype-limits"
|
||||
}
|
||||
]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_type_limits=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_type_limits=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_type_limits" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wtype-limits"])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wtype-limits" (outside functions)],
|
||||
[ax_cv__pragma__gcc__diags_ignored_type_limits_besidefunc],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wtype-limits"]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_type_limits_besidefunc=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_type_limits_besidefunc=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_type_limits_besidefunc" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wtype-limits" (outside functions)])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Warray-bounds"],
|
||||
[ax_cv__pragma__gcc__diags_ignored_array_bounds],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[void func(void) {
|
||||
#pragma GCC diagnostic ignored "-Warray-bounds"
|
||||
}
|
||||
]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_array_bounds=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_array_bounds=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_array_bounds" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_ARRAY_BOUNDS], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Warray-bounds"])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Warray-bounds" (outside functions)],
|
||||
[ax_cv__pragma__gcc__diags_ignored_array_bounds_besidefunc],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Warray-bounds"]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_array_bounds_besidefunc=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_array_bounds_besidefunc=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_array_bounds_besidefunc" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_ARRAY_BOUNDS_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Warray-bounds" (outside functions)])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wtautological-type-limit-compare"],
|
||||
[ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[void func(void) {
|
||||
#pragma GCC diagnostic ignored "-Wtautological-type-limit-compare"
|
||||
}
|
||||
]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_TYPE_LIMIT_COMPARE], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wtautological-type-limit-compare"])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wtautological-type-limit-compare" (outside functions)],
|
||||
[ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare_besidefunc],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wtautological-type-limit-compare"]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare_besidefunc=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare_besidefunc=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare_besidefunc" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_TYPE_LIMIT_COMPARE_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wtautological-type-limit-compare" (outside functions)])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare"],
|
||||
[ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[void func(void) {
|
||||
#pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare"
|
||||
}
|
||||
]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare"])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" (outside functions)],
|
||||
[ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare_besidefunc],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare"]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare_besidefunc=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare_besidefunc=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare_besidefunc" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" (outside functions)])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wtautological-unsigned-zero-compare"],
|
||||
[ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[void func(void) {
|
||||
#pragma GCC diagnostic ignored "-Wtautological-unsigned-zero-compare"
|
||||
}
|
||||
]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wtautological-unsigned-zero-compare"])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wtautological-unsigned-zero-compare" (outside functions)],
|
||||
[ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare_besidefunc],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wtautological-unsigned-zero-compare"]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare_besidefunc=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare_besidefunc=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare_besidefunc" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wtautological-unsigned-zero-compare" (outside functions)])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wtautological-compare"],
|
||||
[ax_cv__pragma__gcc__diags_ignored_tautological_compare],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[void func(void) {
|
||||
#pragma GCC diagnostic ignored "-Wtautological-compare"
|
||||
}
|
||||
]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_tautological_compare=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_tautological_compare=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_tautological_compare" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_COMPARE], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wtautological-compare"])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wtautological-compare" (outside functions)],
|
||||
[ax_cv__pragma__gcc__diags_ignored_tautological_compare_besidefunc],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wtautological-compare"]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_tautological_compare_besidefunc=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_tautological_compare_besidefunc=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_tautological_compare_besidefunc" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_COMPARE_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wtautological-compare" (outside functions)])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wsign-compare"],
|
||||
[ax_cv__pragma__gcc__diags_ignored_sign_compare],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[void func(void) {
|
||||
#pragma GCC diagnostic ignored "-Wsign-compare"
|
||||
}
|
||||
]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_sign_compare=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_sign_compare=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_sign_compare" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_SIGN_COMPARE], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wsign-compare"])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wsign-compare" (outside functions)],
|
||||
[ax_cv__pragma__gcc__diags_ignored_sign_compare_besidefunc],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wsign-compare"]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_sign_compare_besidefunc=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_sign_compare_besidefunc=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_sign_compare_besidefunc" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_SIGN_COMPARE_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wsign-compare" (outside functions)])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wsign-conversion"],
|
||||
[ax_cv__pragma__gcc__diags_ignored_sign_conversion],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[void func(void) {
|
||||
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||
}
|
||||
]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_sign_conversion=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_sign_conversion=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_sign_conversion" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_SIGN_CONVERSION], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wsign-conversion"])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wsign-conversion" (outside functions)],
|
||||
[ax_cv__pragma__gcc__diags_ignored_sign_conversion_besidefunc],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wsign-conversion"]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_sign_conversion_besidefunc=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_sign_conversion_besidefunc=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_sign_conversion_besidefunc" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_SIGN_CONVERSION_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wsign-conversion" (outside functions)])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wunreachable-code-break"],
|
||||
[ax_cv__pragma__gcc__diags_ignored_unreachable_code_break],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[void func(void) {
|
||||
#pragma GCC diagnostic ignored "-Wunreachable-code-break"
|
||||
}
|
||||
]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_unreachable_code_break=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_unreachable_code_break=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code_break" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_BREAK], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wunreachable-code-break"])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wunreachable-code-break" (outside functions)],
|
||||
[ax_cv__pragma__gcc__diags_ignored_unreachable_code_break_besidefunc],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wunreachable-code-break"]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_unreachable_code_break_besidefunc=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_unreachable_code_break_besidefunc=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code_break_besidefunc" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_BREAK_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wunreachable-code-break" (outside functions)])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wunreachable-code-return"],
|
||||
[ax_cv__pragma__gcc__diags_ignored_unreachable_code_return],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[void func(void) {
|
||||
#pragma GCC diagnostic ignored "-Wunreachable-code-return"
|
||||
}
|
||||
]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_unreachable_code_return=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_unreachable_code_return=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code_return" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_RETURN], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wunreachable-code-return"])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wunreachable-code-return" (outside functions)],
|
||||
[ax_cv__pragma__gcc__diags_ignored_unreachable_code_return_besidefunc],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wunreachable-code-return"]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_unreachable_code_return_besidefunc=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_unreachable_code_return_besidefunc=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code_return_besidefunc" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_RETURN_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wunreachable-code-return" (outside functions)])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wunreachable-code"],
|
||||
[ax_cv__pragma__gcc__diags_ignored_unreachable_code],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[void func(void) {
|
||||
#pragma GCC diagnostic ignored "-Wunreachable-code"
|
||||
}
|
||||
]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_unreachable_code=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_unreachable_code=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wunreachable-code"])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wunreachable-code" (outside functions)],
|
||||
[ax_cv__pragma__gcc__diags_ignored_unreachable_code_besidefunc],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wunreachable-code"]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_unreachable_code_besidefunc=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_unreachable_code_besidefunc=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code_besidefunc" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wunreachable-code" (outside functions)])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wformat-overflow"],
|
||||
[ax_cv__pragma__gcc__diags_ignored_format_overflow],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[void func(void) {
|
||||
#pragma GCC diagnostic ignored "-Wformat-overflow"
|
||||
}
|
||||
]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_format_overflow=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_format_overflow=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_format_overflow" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_OVERFLOW], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wformat-overflow"])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wformat-overflow" (outside functions)],
|
||||
[ax_cv__pragma__gcc__diags_ignored_format_overflow_besidefunc],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wformat-overflow"]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_format_overflow_besidefunc=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_format_overflow_besidefunc=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_format_overflow_besidefunc" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_OVERFLOW_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wformat-overflow" (outside functions)])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wcovered-switch-default"],
|
||||
[ax_cv__pragma__gcc__diags_ignored_covered_switch_default],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[void func(void) {
|
||||
#pragma GCC diagnostic ignored "-Wcovered-switch-default"
|
||||
}
|
||||
]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_covered_switch_default=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_covered_switch_default=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_covered_switch_default" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wcovered-switch-default"])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wcovered-switch-default" (outside functions)],
|
||||
[ax_cv__pragma__gcc__diags_ignored_covered_switch_default_besidefunc],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wcovered-switch-default"]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_covered_switch_default_besidefunc=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_covered_switch_default_besidefunc=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_covered_switch_default_besidefunc" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wcovered-switch-default" (outside functions)])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wextra-semi-stmt"],
|
||||
[ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[void func(void) {
|
||||
#pragma GCC diagnostic ignored "-Wextra-semi-stmt"
|
||||
}
|
||||
]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXTRA_SEMI_STMT], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wextra-semi-stmt"])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wextra-semi-stmt" (outside functions)],
|
||||
[ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt_besidefunc],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wextra-semi-stmt"]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt_besidefunc=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt_besidefunc=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt_besidefunc" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXTRA_SEMI_STMT_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wextra-semi-stmt" (outside functions)])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wcast-align"],
|
||||
[ax_cv__pragma__gcc__diags_ignored_cast_align],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[void func(void) {
|
||||
#pragma GCC diagnostic ignored "-Wcast-align"
|
||||
}
|
||||
]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_cast_align=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_cast_align=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_cast_align" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CAST_ALIGN], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wcast-align"])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wcast-align" (outside functions)],
|
||||
[ax_cv__pragma__gcc__diags_ignored_cast_align_besidefunc],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wcast-align"]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_cast_align_besidefunc=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_cast_align_besidefunc=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_cast_align_besidefunc" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CAST_ALIGN_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wcast-align" (outside functions)])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wstrict-prototypes"],
|
||||
[ax_cv__pragma__gcc__diags_ignored_strict_prototypes],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[void func(void) {
|
||||
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
|
||||
}
|
||||
]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_strict_prototypes=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_strict_prototypes=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_strict_prototypes" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wstrict-prototypes"])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wstrict-prototypes" (outside functions)],
|
||||
[ax_cv__pragma__gcc__diags_ignored_strict_prototypes_besidefunc],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wstrict-prototypes"]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_strict_prototypes_besidefunc=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_strict_prototypes_besidefunc=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_strict_prototypes_besidefunc" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wstrict-prototypes" (outside functions)])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wassign-enum"],
|
||||
[ax_cv__pragma__gcc__diags_ignored_assign_enum],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[void func(void) {
|
||||
#pragma GCC diagnostic ignored "-Wassign-enum"
|
||||
}
|
||||
]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_assign_enum=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_assign_enum=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_assign_enum" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_ASSIGN_ENUM], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wassign-enum"])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wassign-enum" (outside functions)],
|
||||
[ax_cv__pragma__gcc__diags_ignored_assign_enum_besidefunc],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wassign-enum"]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_assign_enum_besidefunc=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_assign_enum_besidefunc=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_assign_enum_besidefunc" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_ASSIGN_ENUM_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wassign-enum" (outside functions)])
|
||||
])
|
||||
|
||||
AC_LANG_POP([C])
|
||||
|
||||
dnl ### Series of tests for C++ specific pragmas
|
||||
AC_LANG_PUSH([C++])
|
||||
|
||||
AC_CACHE_CHECK([for C++ pragma GCC diagnostic ignored "-Wc++98-compat-pedantic"],
|
||||
[ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[void func(void) {
|
||||
#pragma GCC diagnostic ignored "-Wc++98-compat-pedantic"
|
||||
}
|
||||
]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CXX98_COMPAT_PEDANTIC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wc++98-compat-pedantic"])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for C++ pragma GCC diagnostic ignored "-Wc++98-compat-pedantic" (outside functions)],
|
||||
[ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic_besidefunc],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wc++98-compat-pedantic"]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic_besidefunc=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic_besidefunc=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic_besidefunc" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CXX98_COMPAT_PEDANTIC_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wc++98-compat-pedantic" (outside functions)])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for C++ pragma GCC diagnostic ignored "-Wc++98-compat"],
|
||||
[ax_cv__pragma__gcc__diags_ignored_cxx98_compat],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[void func(void) {
|
||||
#pragma GCC diagnostic ignored "-Wc++98-compat"
|
||||
}
|
||||
]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_cxx98_compat=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_cxx98_compat=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CXX98_COMPAT], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wc++98-compat"])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for C++ pragma GCC diagnostic ignored "-Wc++98-compat" (outside functions)],
|
||||
[ax_cv__pragma__gcc__diags_ignored_cxx98_compat_besidefunc],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wc++98-compat"]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_cxx98_compat_besidefunc=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_cxx98_compat_besidefunc=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat_besidefunc" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CXX98_COMPAT_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wc++98-compat" (outside functions)])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for C++ pragma GCC diagnostic ignored "-Wglobal-constructors"],
|
||||
[ax_cv__pragma__gcc__diags_ignored_global_constructors],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[void func(void) {
|
||||
#pragma GCC diagnostic ignored "-Wglobal-constructors"
|
||||
}
|
||||
]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_global_constructors=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_global_constructors=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_global_constructors" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_GLOBAL_CONSTRUCTORS], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wglobal-constructors"])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for C++ pragma GCC diagnostic ignored "-Wglobal-constructors" (outside functions)],
|
||||
[ax_cv__pragma__gcc__diags_ignored_global_constructors_besidefunc],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wglobal-constructors"]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_global_constructors_besidefunc=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_global_constructors_besidefunc=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_global_constructors_besidefunc" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_GLOBAL_CONSTRUCTORS_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wglobal-constructors" (outside functions)])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for C++ pragma GCC diagnostic ignored "-Wexit-time-destructors"],
|
||||
[ax_cv__pragma__gcc__diags_ignored_exit_time_destructors],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[void func(void) {
|
||||
#pragma GCC diagnostic ignored "-Wexit-time-destructors"
|
||||
}
|
||||
]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_exit_time_destructors=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_exit_time_destructors=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_exit_time_destructors" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXIT_TIME_DESTRUCTORS], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wexit-time-destructors"])
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for C++ pragma GCC diagnostic ignored "-Wexit-time-destructors" (outside functions)],
|
||||
[ax_cv__pragma__gcc__diags_ignored_exit_time_destructors_besidefunc],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wexit-time-destructors"]], [])],
|
||||
[ax_cv__pragma__gcc__diags_ignored_exit_time_destructors_besidefunc=yes],
|
||||
[ax_cv__pragma__gcc__diags_ignored_exit_time_destructors_besidefunc=no]
|
||||
)]
|
||||
)
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_exit_time_destructors_besidefunc" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXIT_TIME_DESTRUCTORS_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wexit-time-destructors" (outside functions)])
|
||||
])
|
||||
|
||||
AC_LANG_POP([C++])
|
||||
|
||||
dnl # Meta-macros for simpler use-cases where we pick
|
||||
dnl # equivalent-effect macros for different compiler versions
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_push_pop_insidefunc" = "yes"],[
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_format_security" = "yes" || test "$ax_cv__pragma__gcc__diags_ignored_format_nonliteral" = "yes" ],[
|
||||
AC_DEFINE([HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL], 1, [define if your compiler has pragmas for GCC diagnostic ignored "-Wformat-nonliteral" or "-Wformat-security" and for push-pop support])
|
||||
])
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_format_truncation" = "yes" || test "$ax_cv__pragma__gcc__diags_ignored_stringop_truncation" = "yes" ],[
|
||||
AC_DEFINE([HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION], 1, [define if your compiler has pragmas for GCC diagnostic ignored "-Wformat-truncation" or "-Werror=stringop-truncation" and for push-pop support])
|
||||
])
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code" = "yes" || test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code_break" = "yes" ],[
|
||||
AC_DEFINE([HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE], 1, [define if your compiler has pragmas for GCC diagnostic ignored "-Wunreachable-code(-break)" and for push-pop support])
|
||||
])
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic" = "yes" || test "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat" = "yes" ],[
|
||||
AC_DEFINE([HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_CXX98_COMPAT], 1, [define if your compiler has pragmas for GCC diagnostic ignored "-Wc++98-compat(-pedantic)" and for push-pop support])
|
||||
])
|
||||
])
|
||||
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_push_pop_besidefunc" = "yes"],[
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_format_security" = "yes" || test "$ax_cv__pragma__gcc__diags_ignored_format_nonliteral" = "yes" ],[
|
||||
AC_DEFINE([HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL_BESIDEFUNC], 1, [define if your compiler has pragmas for GCC diagnostic ignored "-Wformat-nonliteral" or "-Wformat-security" and for push-pop support (outside function bodies)])
|
||||
])
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_format_truncation" = "yes" || test "$ax_cv__pragma__gcc__diags_ignored_stringop_truncation" = "yes" ],[
|
||||
AC_DEFINE([HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION_BESIDEFUNC], 1, [define if your compiler has pragmas for GCC diagnostic ignored "-Wformat-truncation" or "-Werror=stringop-truncation" and for push-pop support (outside function bodies)])
|
||||
])
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code" = "yes" || test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code_break" = "yes" ],[
|
||||
AC_DEFINE([HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_BESIDEFUNC], 1, [define if your compiler has pragmas for GCC diagnostic ignored "-Wunreachable-code(-break)" and for push-pop support (outside function bodies)])
|
||||
])
|
||||
AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic" = "yes" || test "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat" = "yes" ],[
|
||||
AC_DEFINE([HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_CXX98_COMPAT_BESIDEFUNC], 1, [define if your compiler has pragmas for GCC diagnostic ignored "-Wc++98-compat(-pedantic)" and for push-pop support (outside function bodies)])
|
||||
])
|
||||
])
|
||||
|
||||
dnl ### Sanity check if the CLI options actually work:
|
||||
AC_CACHE_CHECK([for pragma BOGUSforTest],
|
||||
[ax_cv__pragma__bogus],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[void func(void) {
|
||||
#pragma BOGUSforTest
|
||||
}
|
||||
]], [])],
|
||||
[ax_cv__pragma__bogus=yes],
|
||||
[ax_cv__pragma__bogus=no]
|
||||
)]
|
||||
)
|
||||
|
||||
AC_CACHE_CHECK([for pragma BOGUSforTest (outside functions)],
|
||||
[ax_cv__pragma__bogus_besidefunc],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#pragma BOGUSforTest]], [])],
|
||||
[ax_cv__pragma__bogus_besidefunc=yes],
|
||||
[ax_cv__pragma__bogus_besidefunc=no]
|
||||
)]
|
||||
)
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-WBOGUSforTest"],
|
||||
[ax_cv__pragma__bogus_diag],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[void func(void) {
|
||||
#pragma GCC diagnostic ignored "-WBOGUSforTest"
|
||||
}
|
||||
]], [])],
|
||||
[ax_cv__pragma__bogus_diag=yes],
|
||||
[ax_cv__pragma__bogus_diag=no]
|
||||
)]
|
||||
)
|
||||
|
||||
AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-WBOGUSforTest" (outside functions)],
|
||||
[ax_cv__pragma__bogus_diag_besidefunc],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-WBOGUSforTest"]], [])],
|
||||
[ax_cv__pragma__bogus_diag_besidefunc=yes],
|
||||
[ax_cv__pragma__bogus_diag_besidefunc=no]
|
||||
)]
|
||||
)
|
||||
|
||||
AS_IF([test "${ax_cv__pragma__bogus}" != "no"],
|
||||
[AC_MSG_WARN([A bogus test that was expected to fail did not! ax_cv__pragma__bogus=$ax_cv__pragma__bogus (not 'no')])])
|
||||
|
||||
AS_IF([test "${ax_cv__pragma__bogus_besidefunc}" != "no"],
|
||||
[AC_MSG_WARN([A bogus test that was expected to fail did not! ax_cv__pragma__bogus_besidefunc=$ax_cv__pragma__bogus_besidefunc (not 'no')])])
|
||||
|
||||
AS_IF([test "${ax_cv__pragma__bogus_diag}" != "no"],
|
||||
[AC_MSG_WARN([A bogus test that was expected to fail did not! ax_cv__pragma__bogus_diag=$ax_cv__pragma__bogus_diag (not 'no')])])
|
||||
|
||||
AS_IF([test "${ax_cv__pragma__bogus_diag_besidefunc}" != "no"],
|
||||
[AC_MSG_WARN([A bogus test that was expected to fail did not! ax_cv__pragma__bogus_diag_besidefunc=$ax_cv__pragma__bogus_diag_besidefunc (not 'no')])])
|
||||
|
||||
CFLAGS="${CFLAGS_SAVED}"
|
||||
CXXFLAGS="${CXXFLAGS_SAVED}"
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([AX_C_PRINTF_STRING_NULL], [
|
||||
if test -z "${nut_have_ax_c_printf_string_null_seen}"; then
|
||||
nut_have_ax_c_printf_string_null_seen="yes"
|
||||
AC_REQUIRE([AX_RUN_OR_LINK_IFELSE])dnl
|
||||
|
||||
dnl ### To be sure, bolt the language
|
||||
AC_LANG_PUSH([C])
|
||||
|
||||
AC_CACHE_CHECK([for practical support to pritnf("%s", NULL)],
|
||||
[ax_cv__printf_string_null],
|
||||
[AX_RUN_OR_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM([dnl
|
||||
#include <stdio.h>
|
||||
#include <strings.h>
|
||||
], [dnl
|
||||
char buf[128];
|
||||
char *s = NULL;
|
||||
int res = snprintf(buf, sizeof(buf), "%s", s);
|
||||
buf[sizeof(buf)-1] = '\0';
|
||||
if (res < 0) {
|
||||
printf(stderr, "FAILED to snprintf() a NULL string argument");
|
||||
exit 1;
|
||||
}
|
||||
if (buf[0] == '\0')
|
||||
printf(stderr, "RETURNED empty string from snprintf() with a NULL string argument");
|
||||
exit 0;
|
||||
}
|
||||
if (strcasestr(buf, 'null') == NULL)
|
||||
printf(stderr, "RETURNED some string from snprintf() with a NULL string argument: '%s'", buf);
|
||||
exit 0;
|
||||
}
|
||||
printf(stderr, "SUCCESS: RETURNED a string that contains something like 'null' from snprintf() with a NULL string argument: '%s'", buf);
|
||||
exit 0;
|
||||
])],
|
||||
[ax_cv__printf_string_null=yes],
|
||||
[ax_cv__printf_string_null=no]
|
||||
)]
|
||||
)
|
||||
|
||||
AS_IF([test "$ax_cv__printf_string_null" = "yes"],[
|
||||
AC_DEFINE([HAVE_PRINTF_STRING_NULL], 1, [define if your libc can printf("%s", NULL) sanely])
|
||||
])
|
||||
|
||||
AC_LANG_POP([C])
|
||||
fi
|
||||
])
|
61
m4/ax_check_compile_flag.m4
Normal file
61
m4/ax_check_compile_flag.m4
Normal file
|
@ -0,0 +1,61 @@
|
|||
# ===========================================================================
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Check whether the given FLAG works with the current language's compiler
|
||||
# or gives an error. (Warnings, however, are ignored)
|
||||
#
|
||||
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
|
||||
# success/failure.
|
||||
#
|
||||
# If EXTRA-FLAGS is defined, it is added to the current language's default
|
||||
# flags (e.g. CFLAGS) when the check is done. The check is thus made with
|
||||
# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
|
||||
# force the compiler to issue an error when a bad flag is given.
|
||||
#
|
||||
# INPUT gives an alternative input source to AC_COMPILE_IFELSE.
|
||||
#
|
||||
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
|
||||
# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
|
||||
#
|
||||
# NOTE: This implementation was extended with check for compiler complaints
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
|
||||
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
|
||||
# Copyright (c) 2022 Jim Klimov <jimklimov+nut@gmail.com>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 6
|
||||
|
||||
AC_DEFUN([AX_CHECK_COMPILE_FLAG],
|
||||
[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
|
||||
AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
|
||||
AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
|
||||
ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
|
||||
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
|
||||
AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
|
||||
[dnl Toolkit per se did not return an error code; but did it complain?
|
||||
dnl Below are a few strings typical for some versions of GCC and CLANG
|
||||
dnl This relies on AC_COMPILE_IFELSE implementation retaining conftest.err
|
||||
AS_IF([grep -E '(unrecognized.* option|did you mean|unknown argument:)' < conftest.err >/dev/null 2>/dev/null],
|
||||
[AS_VAR_SET(CACHEVAR,[no])],dnl Hit a complaint, flag is not supported after all
|
||||
[AS_VAR_SET(CACHEVAR,[yes])])],
|
||||
[AS_VAR_SET(CACHEVAR,[no])])
|
||||
_AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
|
||||
AS_VAR_IF(CACHEVAR,yes,
|
||||
[m4_default([$2], :)],
|
||||
[m4_default([$3], :)])
|
||||
AS_VAR_POPDEF([CACHEVAR])dnl
|
||||
])dnl AX_CHECK_COMPILE_FLAGS
|
0
m4/ax_compare_version.m4
Executable file → Normal file
0
m4/ax_compare_version.m4
Executable file → Normal file
21
m4/ax_run_or_link_ifelse.m4
Normal file
21
m4/ax_run_or_link_ifelse.m4
Normal file
|
@ -0,0 +1,21 @@
|
|||
dnl By default, AC_RUN_IFELSE() fails if it detects cross-compilation
|
||||
dnl but it provides the fourth argument to customize the handling.
|
||||
dnl In our case, we would fall back to trying just to link then -
|
||||
dnl the result would not be as relevant regarding run-time behavior
|
||||
dnl of the code, but at least we would know that API and ABI are ok.
|
||||
|
||||
dnl Per original /usr/share/autoconf/autoconf/general.m4 which makes
|
||||
dnl a similar wrapper:
|
||||
dnl # AC_TRY_RUN(PROGRAM,
|
||||
dnl # [ACTION-IF-TRUE], [ACTION-IF-FALSE],
|
||||
dnl # [ACTION-IF-CROSS-COMPILING = RUNTIME-ERROR])
|
||||
dnl # -------------------------------------------------------
|
||||
AC_DEFUN([AX_RUN_OR_LINK_IFELSE],
|
||||
[
|
||||
AC_RUN_IFELSE([$1], [$2], [$3],
|
||||
[
|
||||
AC_MSG_WARN([Current build is a cross-build, so not running test binaries, just linking them])
|
||||
AC_LINK_IFELSE([$1], [$2], [$3])
|
||||
]
|
||||
)
|
||||
])
|
2549
m4/libtool.m4
vendored
2549
m4/libtool.m4
vendored
File diff suppressed because it is too large
Load diff
127
m4/ltoptions.m4
vendored
127
m4/ltoptions.m4
vendored
|
@ -1,14 +1,14 @@
|
|||
# Helper functions for option handling. -*- Autoconf -*-
|
||||
#
|
||||
# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software
|
||||
# Foundation, Inc.
|
||||
# Written by Gary V. Vaughan, 2004
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 7 ltoptions.m4
|
||||
# serial 8 ltoptions.m4
|
||||
|
||||
# This is to help aclocal find these macros, as it can't see m4_define.
|
||||
AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
|
||||
|
@ -29,7 +29,7 @@ m4_define([_LT_SET_OPTION],
|
|||
[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
|
||||
m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
|
||||
_LT_MANGLE_DEFUN([$1], [$2]),
|
||||
[m4_warning([Unknown $1 option `$2'])])[]dnl
|
||||
[m4_warning([Unknown $1 option '$2'])])[]dnl
|
||||
])
|
||||
|
||||
|
||||
|
@ -75,13 +75,15 @@ m4_if([$1],[LT_INIT],[
|
|||
dnl
|
||||
dnl If no reference was made to various pairs of opposing options, then
|
||||
dnl we run the default mode handler for the pair. For example, if neither
|
||||
dnl `shared' nor `disable-shared' was passed, we enable building of shared
|
||||
dnl 'shared' nor 'disable-shared' was passed, we enable building of shared
|
||||
dnl archives by default:
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
|
||||
[_LT_ENABLE_FAST_INSTALL])
|
||||
[_LT_ENABLE_FAST_INSTALL])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4],
|
||||
[_LT_WITH_AIX_SONAME([aix])])
|
||||
])
|
||||
])# _LT_SET_OPTIONS
|
||||
|
||||
|
@ -112,7 +114,7 @@ AU_DEFUN([AC_LIBTOOL_DLOPEN],
|
|||
[_LT_SET_OPTION([LT_INIT], [dlopen])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you
|
||||
put the `dlopen' option into LT_INIT's first parameter.])
|
||||
put the 'dlopen' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
|
@ -148,7 +150,7 @@ AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
|
|||
_LT_SET_OPTION([LT_INIT], [win32-dll])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you
|
||||
put the `win32-dll' option into LT_INIT's first parameter.])
|
||||
put the 'win32-dll' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
|
@ -157,9 +159,9 @@ dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
|
|||
|
||||
# _LT_ENABLE_SHARED([DEFAULT])
|
||||
# ----------------------------
|
||||
# implement the --enable-shared flag, and supports the `shared' and
|
||||
# `disable-shared' LT_INIT options.
|
||||
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
|
||||
# implement the --enable-shared flag, and supports the 'shared' and
|
||||
# 'disable-shared' LT_INIT options.
|
||||
# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'.
|
||||
m4_define([_LT_ENABLE_SHARED],
|
||||
[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
|
||||
AC_ARG_ENABLE([shared],
|
||||
|
@ -172,14 +174,14 @@ AC_ARG_ENABLE([shared],
|
|||
*)
|
||||
enable_shared=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
|
||||
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
|
||||
for pkg in $enableval; do
|
||||
IFS="$lt_save_ifs"
|
||||
IFS=$lt_save_ifs
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_shared=yes
|
||||
fi
|
||||
done
|
||||
IFS="$lt_save_ifs"
|
||||
IFS=$lt_save_ifs
|
||||
;;
|
||||
esac],
|
||||
[enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
|
||||
|
@ -211,9 +213,9 @@ dnl AC_DEFUN([AM_DISABLE_SHARED], [])
|
|||
|
||||
# _LT_ENABLE_STATIC([DEFAULT])
|
||||
# ----------------------------
|
||||
# implement the --enable-static flag, and support the `static' and
|
||||
# `disable-static' LT_INIT options.
|
||||
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
|
||||
# implement the --enable-static flag, and support the 'static' and
|
||||
# 'disable-static' LT_INIT options.
|
||||
# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'.
|
||||
m4_define([_LT_ENABLE_STATIC],
|
||||
[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
|
||||
AC_ARG_ENABLE([static],
|
||||
|
@ -226,14 +228,14 @@ AC_ARG_ENABLE([static],
|
|||
*)
|
||||
enable_static=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
|
||||
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
|
||||
for pkg in $enableval; do
|
||||
IFS="$lt_save_ifs"
|
||||
IFS=$lt_save_ifs
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_static=yes
|
||||
fi
|
||||
done
|
||||
IFS="$lt_save_ifs"
|
||||
IFS=$lt_save_ifs
|
||||
;;
|
||||
esac],
|
||||
[enable_static=]_LT_ENABLE_STATIC_DEFAULT)
|
||||
|
@ -265,9 +267,9 @@ dnl AC_DEFUN([AM_DISABLE_STATIC], [])
|
|||
|
||||
# _LT_ENABLE_FAST_INSTALL([DEFAULT])
|
||||
# ----------------------------------
|
||||
# implement the --enable-fast-install flag, and support the `fast-install'
|
||||
# and `disable-fast-install' LT_INIT options.
|
||||
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
|
||||
# implement the --enable-fast-install flag, and support the 'fast-install'
|
||||
# and 'disable-fast-install' LT_INIT options.
|
||||
# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'.
|
||||
m4_define([_LT_ENABLE_FAST_INSTALL],
|
||||
[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
|
||||
AC_ARG_ENABLE([fast-install],
|
||||
|
@ -280,14 +282,14 @@ AC_ARG_ENABLE([fast-install],
|
|||
*)
|
||||
enable_fast_install=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
|
||||
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
|
||||
for pkg in $enableval; do
|
||||
IFS="$lt_save_ifs"
|
||||
IFS=$lt_save_ifs
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_fast_install=yes
|
||||
fi
|
||||
done
|
||||
IFS="$lt_save_ifs"
|
||||
IFS=$lt_save_ifs
|
||||
;;
|
||||
esac],
|
||||
[enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
|
||||
|
@ -304,14 +306,14 @@ AU_DEFUN([AC_ENABLE_FAST_INSTALL],
|
|||
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
|
||||
the `fast-install' option into LT_INIT's first parameter.])
|
||||
the 'fast-install' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
AU_DEFUN([AC_DISABLE_FAST_INSTALL],
|
||||
[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
|
||||
the `disable-fast-install' option into LT_INIT's first parameter.])
|
||||
the 'disable-fast-install' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
|
@ -319,11 +321,64 @@ dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
|
|||
dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
|
||||
|
||||
|
||||
# _LT_WITH_AIX_SONAME([DEFAULT])
|
||||
# ----------------------------------
|
||||
# implement the --with-aix-soname flag, and support the `aix-soname=aix'
|
||||
# and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT
|
||||
# is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'.
|
||||
m4_define([_LT_WITH_AIX_SONAME],
|
||||
[m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl
|
||||
shared_archive_member_spec=
|
||||
case $host,$enable_shared in
|
||||
power*-*-aix[[5-9]]*,yes)
|
||||
AC_MSG_CHECKING([which variant of shared library versioning to provide])
|
||||
AC_ARG_WITH([aix-soname],
|
||||
[AS_HELP_STRING([--with-aix-soname=aix|svr4|both],
|
||||
[shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])],
|
||||
[case $withval in
|
||||
aix|svr4|both)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([Unknown argument to --with-aix-soname])
|
||||
;;
|
||||
esac
|
||||
lt_cv_with_aix_soname=$with_aix_soname],
|
||||
[AC_CACHE_VAL([lt_cv_with_aix_soname],
|
||||
[lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT)
|
||||
with_aix_soname=$lt_cv_with_aix_soname])
|
||||
AC_MSG_RESULT([$with_aix_soname])
|
||||
if test aix != "$with_aix_soname"; then
|
||||
# For the AIX way of multilib, we name the shared archive member
|
||||
# based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o',
|
||||
# and 'shr.imp' or 'shr_64.imp', respectively, for the Import File.
|
||||
# Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag,
|
||||
# the AIX toolchain works better with OBJECT_MODE set (default 32).
|
||||
if test 64 = "${OBJECT_MODE-32}"; then
|
||||
shared_archive_member_spec=shr_64
|
||||
else
|
||||
shared_archive_member_spec=shr
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
with_aix_soname=aix
|
||||
;;
|
||||
esac
|
||||
|
||||
_LT_DECL([], [shared_archive_member_spec], [0],
|
||||
[Shared archive member basename, for filename based shared library versioning on AIX])dnl
|
||||
])# _LT_WITH_AIX_SONAME
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])])
|
||||
|
||||
|
||||
# _LT_WITH_PIC([MODE])
|
||||
# --------------------
|
||||
# implement the --with-pic flag, and support the `pic-only' and `no-pic'
|
||||
# implement the --with-pic flag, and support the 'pic-only' and 'no-pic'
|
||||
# LT_INIT options.
|
||||
# MODE is either `yes' or `no'. If omitted, it defaults to `both'.
|
||||
# MODE is either 'yes' or 'no'. If omitted, it defaults to 'both'.
|
||||
m4_define([_LT_WITH_PIC],
|
||||
[AC_ARG_WITH([pic],
|
||||
[AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
|
||||
|
@ -334,19 +389,17 @@ m4_define([_LT_WITH_PIC],
|
|||
*)
|
||||
pic_mode=default
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
|
||||
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
|
||||
for lt_pkg in $withval; do
|
||||
IFS="$lt_save_ifs"
|
||||
IFS=$lt_save_ifs
|
||||
if test "X$lt_pkg" = "X$lt_p"; then
|
||||
pic_mode=yes
|
||||
fi
|
||||
done
|
||||
IFS="$lt_save_ifs"
|
||||
IFS=$lt_save_ifs
|
||||
;;
|
||||
esac],
|
||||
[pic_mode=default])
|
||||
|
||||
test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
|
||||
[pic_mode=m4_default([$1], [default])])
|
||||
|
||||
_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
|
||||
])# _LT_WITH_PIC
|
||||
|
@ -359,7 +412,7 @@ AU_DEFUN([AC_LIBTOOL_PICMODE],
|
|||
[_LT_SET_OPTION([LT_INIT], [pic-only])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you
|
||||
put the `pic-only' option into LT_INIT's first parameter.])
|
||||
put the 'pic-only' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
|
|
7
m4/ltsugar.m4
vendored
7
m4/ltsugar.m4
vendored
|
@ -1,6 +1,7 @@
|
|||
# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
|
||||
#
|
||||
# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software
|
||||
# Foundation, Inc.
|
||||
# Written by Gary V. Vaughan, 2004
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
|
@ -33,7 +34,7 @@ m4_define([_lt_join],
|
|||
# ------------
|
||||
# Manipulate m4 lists.
|
||||
# These macros are necessary as long as will still need to support
|
||||
# Autoconf-2.59 which quotes differently.
|
||||
# Autoconf-2.59, which quotes differently.
|
||||
m4_define([lt_car], [[$1]])
|
||||
m4_define([lt_cdr],
|
||||
[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
|
||||
|
@ -44,7 +45,7 @@ m4_define([lt_unquote], $1)
|
|||
|
||||
# lt_append(MACRO-NAME, STRING, [SEPARATOR])
|
||||
# ------------------------------------------
|
||||
# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
|
||||
# Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'.
|
||||
# Note that neither SEPARATOR nor STRING are expanded; they are appended
|
||||
# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
|
||||
# No SEPARATOR is output if MACRO-NAME was previously undefined (different
|
||||
|
|
12
m4/ltversion.m4
vendored
12
m4/ltversion.m4
vendored
|
@ -1,6 +1,6 @@
|
|||
# ltversion.m4 -- version numbers -*- Autoconf -*-
|
||||
#
|
||||
# Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc.
|
||||
# Written by Scott James Remnant, 2004
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
|
@ -9,15 +9,15 @@
|
|||
|
||||
# @configure_input@
|
||||
|
||||
# serial 3337 ltversion.m4
|
||||
# serial 4179 ltversion.m4
|
||||
# This file is part of GNU Libtool
|
||||
|
||||
m4_define([LT_PACKAGE_VERSION], [2.4.2])
|
||||
m4_define([LT_PACKAGE_REVISION], [1.3337])
|
||||
m4_define([LT_PACKAGE_VERSION], [2.4.6])
|
||||
m4_define([LT_PACKAGE_REVISION], [2.4.6])
|
||||
|
||||
AC_DEFUN([LTVERSION_VERSION],
|
||||
[macro_version='2.4.2'
|
||||
macro_revision='1.3337'
|
||||
[macro_version='2.4.6'
|
||||
macro_revision='2.4.6'
|
||||
_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
|
||||
_LT_DECL(, macro_revision, 0)
|
||||
])
|
||||
|
|
7
m4/lt~obsolete.m4
vendored
7
m4/lt~obsolete.m4
vendored
|
@ -1,6 +1,7 @@
|
|||
# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
|
||||
#
|
||||
# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software
|
||||
# Foundation, Inc.
|
||||
# Written by Scott James Remnant, 2004.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
|
@ -11,7 +12,7 @@
|
|||
|
||||
# These exist entirely to fool aclocal when bootstrapping libtool.
|
||||
#
|
||||
# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
|
||||
# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN),
|
||||
# which have later been changed to m4_define as they aren't part of the
|
||||
# exported API, or moved to Autoconf or Automake where they belong.
|
||||
#
|
||||
|
@ -25,7 +26,7 @@
|
|||
# included after everything else. This provides aclocal with the
|
||||
# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
|
||||
# because those macros already exist, or will be overwritten later.
|
||||
# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
|
||||
# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
|
||||
#
|
||||
# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
|
||||
# Yes, that means every name once taken will need to remain here until
|
||||
|
|
|
@ -1,9 +1,21 @@
|
|||
dnl simplified declaration of some feature options
|
||||
|
||||
dnl Working With External Software (might name a variant or other contextual arg)
|
||||
dnl https://www.gnu.org/software/autoconf/manual/autoconf-2.66/html_node/External-Software.html#External-Software
|
||||
AC_DEFUN([NUT_ARG_WITH],
|
||||
[ AC_ARG_WITH($1,
|
||||
AC_HELP_STRING([--with-$1], [$2 ($3)]),
|
||||
AS_HELP_STRING([--with-$1], [$2 ($3)]),
|
||||
[nut_with_$1="${withval}"],
|
||||
[nut_with_$1="$3"]
|
||||
)
|
||||
])
|
||||
|
||||
dnl Enable a feature (might name a variant), or yes/no
|
||||
dnl https://www.gnu.org/software/autoconf/manual/autoconf-2.66/html_node/Package-Options.html
|
||||
AC_DEFUN([NUT_ARG_ENABLE],
|
||||
[ AC_ARG_ENABLE($1,
|
||||
AS_HELP_STRING([--enable-$1], [$2 ($3)]),
|
||||
[nut_enable_$1="${enableval}"],
|
||||
[nut_enable_$1="$3"]
|
||||
)
|
||||
])
|
||||
|
|
|
@ -1,12 +1,24 @@
|
|||
dnl Check for LIBUSB compiler flags. On success, set nut_have_libusb="yes"
|
||||
dnl and set LIBUSB_CFLAGS and LIBUSB_LDFLAGS. On failure, set
|
||||
dnl nut_have_libusb="no". This macro can be run multiple times, but will
|
||||
dnl do the checking only once.
|
||||
dnl Check for tools used in generation of documentation final-format files
|
||||
dnl such as the basically required MAN, and optional HTML (single or chunked).
|
||||
dnl On success, set nut_have_asciidoc="yes" (meaning we can do at least some
|
||||
dnl documentation generation) and lots of automake macros and configure vars.
|
||||
dnl On failure, set nut_have_asciidoc="no" (meaning we can't generate even a
|
||||
dnl manpage, which is a requirement for proceeding to the other formats).
|
||||
dnl This macro can be run multiple times, but will do the checking only once.
|
||||
dnl Also note that this routine currently only checks the basic presence (and
|
||||
dnl versions) of the required software; the configure script has additional
|
||||
dnl functional checks (ability to build doc files) based on --with-doc request
|
||||
dnl so as to not waste time on doc-types not requested by maintainer, and done
|
||||
dnl in ways more intimate to NUT (using its tracked docs).
|
||||
|
||||
AC_DEFUN([NUT_CHECK_ASCIIDOC],
|
||||
AC_DEFUN([NUT_CHECK_ASCIIDOC],
|
||||
[
|
||||
if test -z "${nut_have_asciidoc_seen}"; then
|
||||
nut_have_asciidoc_seen=yes
|
||||
# Note: this is for both asciidoc and a2x at this time
|
||||
ASCIIDOC_MIN_VERSION="8.6.3"
|
||||
# Note: this is checked in the configure script if PDF is of interest at all
|
||||
DBLATEX_MIN_VERSION="0.2.5"
|
||||
|
||||
AC_PATH_PROGS([ASCIIDOC], [asciidoc])
|
||||
if test -n "${ASCIIDOC}"; then
|
||||
|
@ -16,6 +28,7 @@ if test -z "${nut_have_asciidoc_seen}"; then
|
|||
ASCIIDOC_VERSION="${ASCIIDOC_VERSION##* }"
|
||||
AC_MSG_RESULT(${ASCIIDOC_VERSION} found)
|
||||
fi
|
||||
AM_CONDITIONAL([MANUALUPDATE], [test -n "${ASCIIDOC}"])
|
||||
|
||||
AC_PATH_PROGS([A2X], [a2x])
|
||||
if test -n "${A2X}"; then
|
||||
|
@ -50,10 +63,74 @@ if test -z "${nut_have_asciidoc_seen}"; then
|
|||
XMLLINT_VERSION="`${XMLLINT} --version 2>/dev/null`"
|
||||
dnl strip 'xmllint version ' from version string
|
||||
XMLLINT_VERSION="${XMLLINT_VERSION##* }"
|
||||
if test -z "${XMLLINT_VERSION}" ; then
|
||||
dnl Some releases also report what flags they were compiled with as
|
||||
dnl part of the version info, so the last-line match finds nothing.
|
||||
dnl Also some builds return version data to stderr.
|
||||
XMLLINT_VERSION="`${XMLLINT} --version 2>&1 | grep version`"
|
||||
XMLLINT_VERSION="${XMLLINT_VERSION##* }"
|
||||
fi
|
||||
AC_MSG_RESULT(${XMLLINT_VERSION} found)
|
||||
fi
|
||||
|
||||
AC_PATH_PROGS([SOURCE_HIGHLIGHT], [source-highlight])
|
||||
AM_CONDITIONAL([HAVE_SOURCE_HIGHLIGHT], [test -n "$SOURCE_HIGHLIGHT"])
|
||||
|
||||
dnl check for spell checking deps
|
||||
AC_PATH_PROGS([ASPELL], [aspell])
|
||||
AM_CONDITIONAL([HAVE_ASPELL], [test -n "$ASPELL"])
|
||||
|
||||
dnl Note that a common "nut_have_asciidoc" variable is in fact a flag
|
||||
dnl that we have several tools needed for the documentation generation
|
||||
dnl TODO? Rename the script variable and makefile flags to reflect this?
|
||||
AC_MSG_CHECKING([if asciidoc version can build manpages (minimum required ${ASCIIDOC_MIN_VERSION})])
|
||||
AX_COMPARE_VERSION([${ASCIIDOC_VERSION}], [ge], [${ASCIIDOC_MIN_VERSION}], [
|
||||
AC_MSG_RESULT(yes)
|
||||
nut_have_asciidoc="yes"
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
nut_have_asciidoc="no"
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([if a2x version can build manpages (minimum required ${ASCIIDOC_MIN_VERSION})])
|
||||
AX_COMPARE_VERSION([${A2X_VERSION}], [ge], [${ASCIIDOC_MIN_VERSION}], [
|
||||
AC_MSG_RESULT(yes)
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
nut_have_asciidoc="no"
|
||||
])
|
||||
|
||||
dnl TODO: test for docbook-xsl files (maybe build a test man page?)
|
||||
dnl https://github.com/networkupstools/nut/issues/162
|
||||
AC_MSG_CHECKING([if xsltproc is present (mandatory for man page regeneration)])
|
||||
if test -n "${XSLTPROC}"; then
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
nut_have_asciidoc="no"
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([if xmllint is present (mandatory for man page regeneration)])
|
||||
if test -n "${XMLLINT}"; then
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
nut_have_asciidoc="no"
|
||||
fi
|
||||
|
||||
dnl Notes: we also keep HAVE_ASCIIDOC for implicit targets, such as manpage
|
||||
dnl building
|
||||
AM_CONDITIONAL([HAVE_ASCIIDOC], [test "${nut_have_asciidoc}" = "yes"])
|
||||
|
||||
AC_MSG_CHECKING([if we have all the tools mandatory for man page regeneration])
|
||||
AC_MSG_RESULT([${nut_have_asciidoc}])
|
||||
|
||||
AC_MSG_CHECKING([if source-highlight is present (preferable for documentation generation)])
|
||||
if test -n "${SOURCE_HIGHLIGHT}"; then
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
fi
|
||||
])
|
||||
|
|
34
m4/nut_check_cppcheck.m4
Normal file
34
m4/nut_check_cppcheck.m4
Normal file
|
@ -0,0 +1,34 @@
|
|||
dnl Check for "cppcheck" analysis tools
|
||||
|
||||
AC_DEFUN([NUT_CHECK_CPPCHECK],
|
||||
[
|
||||
if test -z "${nut_have_cppcheck_seen}"; then
|
||||
dnl NOTE: Did not really investigate suitable CPPCHECK_MIN_VERSION
|
||||
dnl values, just using current available as the baseline; maybe
|
||||
dnl older releases are also okay (if someone proves so).
|
||||
dnl The oldest available on the NUT CI build farm was 1.6 that worked.
|
||||
nut_have_cppcheck_seen=yes
|
||||
CPPCHECK_MIN_VERSION="1.0"
|
||||
|
||||
AC_PATH_PROGS([CPPCHECK], [cppcheck])
|
||||
if test -n "${CPPCHECK}"; then
|
||||
AC_MSG_CHECKING([for cppcheck version])
|
||||
CPPCHECK_VERSION="`${CPPCHECK} --version 2>/dev/null`"
|
||||
dnl strip 'cppcheck ' from version string
|
||||
CPPCHECK_VERSION="${CPPCHECK_VERSION##* }"
|
||||
AC_MSG_RESULT(${CPPCHECK_VERSION} found)
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([if cppcheck version is okay (minimum required ${CPPCHECK_MIN_VERSION})])
|
||||
AX_COMPARE_VERSION([${CPPCHECK_VERSION}], [ge], [${CPPCHECK_MIN_VERSION}], [
|
||||
AC_MSG_RESULT(yes)
|
||||
nut_have_cppcheck="yes"
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
nut_have_cppcheck="no"
|
||||
])
|
||||
|
||||
dnl Notes: we also keep HAVE_CPPCHECK for implicit targets
|
||||
AM_CONDITIONAL([HAVE_CPPCHECK], [test "${nut_have_cppcheck}" = "yes"])
|
||||
fi
|
||||
])
|
193
m4/nut_check_headers_windows.m4
Normal file
193
m4/nut_check_headers_windows.m4
Normal file
|
@ -0,0 +1,193 @@
|
|||
dnl This code was lifted and adapted for NUT from cURL project:
|
||||
dnl https://github.com/curl/curl/blob/83245d9ff352b742753cff1216781ff041e4e987/acinclude.m4#L172
|
||||
dnl https://github.com/curl/curl/blob/83245d9ff352b742753cff1216781ff041e4e987/acinclude.m4#L207
|
||||
dnl https://github.com/curl/curl/blob/83245d9ff352b742753cff1216781ff041e4e987/acinclude.m4#L238
|
||||
dnl https://github.com/curl/curl/blob/83245d9ff352b742753cff1216781ff041e4e987/acinclude.m4#L275
|
||||
dnl https://github.com/curl/curl/blob/83245d9ff352b742753cff1216781ff041e4e987/acinclude.m4#L312
|
||||
|
||||
dnl NUT_CHECK_HEADER_WINDOWS
|
||||
dnl -------------------------------------------------
|
||||
dnl Check for compilable and valid windows.h header
|
||||
|
||||
AC_DEFUN([NUT_CHECK_HEADER_WINDOWS], [
|
||||
AC_CACHE_CHECK([for windows.h], [nut_cv_header_windows_h], [
|
||||
AC_LANG_PUSH([C])
|
||||
AC_COMPILE_IFELSE([
|
||||
AC_LANG_PROGRAM([[
|
||||
#undef inline
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <windows.h>
|
||||
]],[[
|
||||
#if defined(__CYGWIN__) || defined(__CEGCC__)
|
||||
HAVE_WINDOWS_H shall not be defined.
|
||||
#else
|
||||
int dummy=2*WINVER;
|
||||
#endif
|
||||
]])
|
||||
],[
|
||||
nut_cv_header_windows_h="yes"
|
||||
],[
|
||||
nut_cv_header_windows_h="no"
|
||||
])
|
||||
AC_LANG_POP([C])
|
||||
])
|
||||
case "$nut_cv_header_windows_h" in
|
||||
yes)
|
||||
AC_DEFINE_UNQUOTED(HAVE_WINDOWS_H, 1,
|
||||
[Define to 1 if you have the windows.h header file.])
|
||||
;;
|
||||
esac
|
||||
])
|
||||
|
||||
|
||||
dnl NUT_CHECK_NATIVE_WINDOWS
|
||||
dnl -------------------------------------------------
|
||||
dnl Check if building a native Windows target
|
||||
|
||||
AC_DEFUN([NUT_CHECK_NATIVE_WINDOWS], [
|
||||
AC_REQUIRE([NUT_CHECK_HEADER_WINDOWS])dnl
|
||||
AC_CACHE_CHECK([whether build target is a native Windows one], [nut_cv_native_windows], [
|
||||
if test "$nut_cv_header_windows_h" = "no"; then
|
||||
nut_cv_native_windows="no"
|
||||
else
|
||||
AC_LANG_PUSH([C])
|
||||
AC_COMPILE_IFELSE([
|
||||
AC_LANG_PROGRAM([[
|
||||
]],[[
|
||||
#if defined(__MINGW32__) || defined(__MINGW32CE__) || \
|
||||
(defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64)))
|
||||
int dummy=1;
|
||||
#else
|
||||
Not a native Windows build target.
|
||||
#endif
|
||||
]])
|
||||
],[
|
||||
nut_cv_native_windows="yes"
|
||||
],[
|
||||
nut_cv_native_windows="no"
|
||||
])
|
||||
AC_LANG_POP([C])
|
||||
fi
|
||||
])
|
||||
AM_CONDITIONAL(DOING_NATIVE_WINDOWS, test "x$nut_cv_native_windows" = xyes)
|
||||
])
|
||||
|
||||
|
||||
dnl NUT_CHECK_HEADER_WINSOCK
|
||||
dnl -------------------------------------------------
|
||||
dnl Check for compilable and valid winsock.h header
|
||||
|
||||
AC_DEFUN([NUT_CHECK_HEADER_WINSOCK], [
|
||||
AC_REQUIRE([NUT_CHECK_HEADER_WINDOWS])dnl
|
||||
AC_CACHE_CHECK([for winsock.h], [nut_cv_header_winsock_h], [
|
||||
AC_LANG_PUSH([C])
|
||||
AC_COMPILE_IFELSE([
|
||||
AC_LANG_PROGRAM([[
|
||||
#undef inline
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#include <winsock.h>
|
||||
]],[[
|
||||
#if defined(__CYGWIN__) || defined(__CEGCC__)
|
||||
HAVE_WINSOCK_H shall not be defined.
|
||||
#else
|
||||
int dummy=WSACleanup();
|
||||
#endif
|
||||
]])
|
||||
],[
|
||||
nut_cv_header_winsock_h="yes"
|
||||
],[
|
||||
nut_cv_header_winsock_h="no"
|
||||
])
|
||||
AC_LANG_POP([C])
|
||||
])
|
||||
case "$nut_cv_header_winsock_h" in
|
||||
yes)
|
||||
AC_DEFINE_UNQUOTED(HAVE_WINSOCK_H, 1,
|
||||
[Define to 1 if you have the winsock.h header file.])
|
||||
;;
|
||||
esac
|
||||
])
|
||||
|
||||
|
||||
dnl NUT_CHECK_HEADER_WINSOCK2
|
||||
dnl -------------------------------------------------
|
||||
dnl Check for compilable and valid winsock2.h header
|
||||
|
||||
AC_DEFUN([NUT_CHECK_HEADER_WINSOCK2], [
|
||||
AC_REQUIRE([NUT_CHECK_HEADER_WINDOWS])dnl
|
||||
AC_CACHE_CHECK([for winsock2.h], [nut_cv_header_winsock2_h], [
|
||||
AC_LANG_PUSH([C])
|
||||
AC_COMPILE_IFELSE([
|
||||
AC_LANG_PROGRAM([[
|
||||
#undef inline
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#include <winsock2.h>
|
||||
]],[[
|
||||
#if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__)
|
||||
HAVE_WINSOCK2_H shall not be defined.
|
||||
#else
|
||||
int dummy=2*IPPROTO_ESP;
|
||||
#endif
|
||||
]])
|
||||
],[
|
||||
nut_cv_header_winsock2_h="yes"
|
||||
],[
|
||||
nut_cv_header_winsock2_h="no"
|
||||
])
|
||||
AC_LANG_POP([C])
|
||||
])
|
||||
case "$nut_cv_header_winsock2_h" in
|
||||
yes)
|
||||
AC_DEFINE_UNQUOTED(HAVE_WINSOCK2_H, 1,
|
||||
[Define to 1 if you have the winsock2.h header file.])
|
||||
;;
|
||||
esac
|
||||
])
|
||||
|
||||
|
||||
dnl NUT_CHECK_HEADER_WS2TCPIP
|
||||
dnl -------------------------------------------------
|
||||
dnl Check for compilable and valid ws2tcpip.h header
|
||||
|
||||
AC_DEFUN([NUT_CHECK_HEADER_WS2TCPIP], [
|
||||
AC_REQUIRE([NUT_CHECK_HEADER_WINSOCK2])dnl
|
||||
AC_CACHE_CHECK([for ws2tcpip.h], [nut_cv_header_ws2tcpip_h], [
|
||||
AC_LANG_PUSH([C])
|
||||
AC_COMPILE_IFELSE([
|
||||
AC_LANG_PROGRAM([[
|
||||
#undef inline
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
]],[[
|
||||
#if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__)
|
||||
HAVE_WS2TCPIP_H shall not be defined.
|
||||
#else
|
||||
int dummy=2*IP_PKTINFO;
|
||||
#endif
|
||||
]])
|
||||
],[
|
||||
nut_cv_header_ws2tcpip_h="yes"
|
||||
],[
|
||||
nut_cv_header_ws2tcpip_h="no"
|
||||
])
|
||||
AC_LANG_POP([C])
|
||||
])
|
||||
case "$nut_cv_header_ws2tcpip_h" in
|
||||
yes)
|
||||
AC_DEFINE_UNQUOTED(HAVE_WS2TCPIP_H, 1,
|
||||
[Define to 1 if you have the ws2tcpip.h header file.])
|
||||
;;
|
||||
esac
|
||||
])
|
|
@ -1,4 +1,4 @@
|
|||
dnl Check for LIBAVAHI compiler flags. On success, set nut_have_neon="yes"
|
||||
dnl Check for LIBAVAHI compiler flags. On success, set nut_have_avahi="yes"
|
||||
dnl and set LIBAVAHI_CFLAGS and LIBAVAHI_LIBS. On failure, set
|
||||
dnl nut_have_avahi="no". This macro can be run multiple times, but will
|
||||
dnl do the checking only once.
|
||||
|
@ -7,25 +7,29 @@ AC_DEFUN([NUT_CHECK_LIBAVAHI],
|
|||
[
|
||||
if test -z "${nut_have_avahi_seen}"; then
|
||||
nut_have_avahi_seen=yes
|
||||
NUT_CHECK_PKGCONFIG
|
||||
|
||||
dnl save CFLAGS and LIBS
|
||||
CFLAGS_ORIG="${CFLAGS}"
|
||||
LIBS_ORIG="${LIBS}"
|
||||
|
||||
dnl See which version of the avahi library (if any) is installed
|
||||
AC_MSG_CHECKING(for avahi-core version via pkg-config (0.6.30 minimum required))
|
||||
AVAHI_CORE_VERSION="`pkg-config --silence-errors --modversion avahi-core 2>/dev/null`"
|
||||
if test "$?" != "0" -o -z "${AVAHI_CORE_VERSION}"; then
|
||||
AVAHI_CORE_VERSION="none"
|
||||
fi
|
||||
AC_MSG_RESULT(${AVAHI_CORE_VERSION} found)
|
||||
AS_IF([test x"$have_PKG_CONFIG" = xyes],
|
||||
[dnl See which version of the avahi library (if any) is installed
|
||||
AC_MSG_CHECKING(for avahi-core version via pkg-config (0.6.30 minimum required))
|
||||
AVAHI_CORE_VERSION="`$PKG_CONFIG --silence-errors --modversion avahi-core 2>/dev/null`"
|
||||
if test "$?" != "0" -o -z "${AVAHI_CORE_VERSION}"; then
|
||||
AVAHI_CORE_VERSION="none"
|
||||
fi
|
||||
AC_MSG_RESULT(${AVAHI_CORE_VERSION} found)
|
||||
|
||||
AC_MSG_CHECKING(for avahi-client version via pkg-config (0.6.30 minimum required))
|
||||
AVAHI_CLIENT_VERSION="`pkg-config --silence-errors --modversion avahi-client 2>/dev/null`"
|
||||
if test "$?" != "0" -o -z "${AVAHI_CLIENT_VERSION}"; then
|
||||
AVAHI_CLIENT_VERSION="none"
|
||||
fi
|
||||
AC_MSG_RESULT(${AVAHI_CLIENT_VERSION} found)
|
||||
AC_MSG_CHECKING(for avahi-client version via pkg-config (0.6.30 minimum required))
|
||||
AVAHI_CLIENT_VERSION="`$PKG_CONFIG --silence-errors --modversion avahi-client 2>/dev/null`"
|
||||
if test "$?" != "0" -o -z "${AVAHI_CLIENT_VERSION}"; then
|
||||
AVAHI_CLIENT_VERSION="none"
|
||||
fi
|
||||
AC_MSG_RESULT(${AVAHI_CLIENT_VERSION} found)
|
||||
], [AC_MSG_NOTICE([can not check avahi settings via pkg-config])]
|
||||
)
|
||||
|
||||
AC_MSG_CHECKING(for avahi cflags)
|
||||
AC_ARG_WITH(avahi-includes,
|
||||
|
@ -39,7 +43,12 @@ if test -z "${nut_have_avahi_seen}"; then
|
|||
CFLAGS="${withval}"
|
||||
;;
|
||||
esac
|
||||
], [CFLAGS="`pkg-config --silence-errors --cflags avahi-core avahi-client 2>/dev/null`"])
|
||||
], [
|
||||
AS_IF([test x"$have_PKG_CONFIG" = xyes],
|
||||
[CFLAGS="`$PKG_CONFIG --silence-errors --cflags avahi-core avahi-client 2>/dev/null`" || CFLAGS="-I/usr/local/include -I/usr/include -L/usr/local/lib -L/usr/lib"],
|
||||
[CFLAGS="-I/usr/local/include -I/usr/include -L/usr/local/lib -L/usr/lib"]
|
||||
)]
|
||||
)
|
||||
AC_MSG_RESULT([${CFLAGS}])
|
||||
|
||||
AC_MSG_CHECKING(for avahi ldflags)
|
||||
|
@ -54,7 +63,12 @@ if test -z "${nut_have_avahi_seen}"; then
|
|||
LIBS="${withval}"
|
||||
;;
|
||||
esac
|
||||
], [LIBS="`pkg-config --silence-errors --libs avahi-core avahi-client 2>/dev/null`"])
|
||||
], [
|
||||
AS_IF([test x"$have_PKG_CONFIG" = xyes],
|
||||
[LIBS="`$PKG_CONFIG --silence-errors --libs avahi-core avahi-client 2>/dev/null`" || LIBS="-lavahi-core -lavahi-client"],
|
||||
[LIBS="-lavahi-core -lavahi-client"]
|
||||
)]
|
||||
)
|
||||
AC_MSG_RESULT([${LIBS}])
|
||||
|
||||
dnl check if avahi-core is usable
|
||||
|
|
|
@ -8,25 +8,36 @@ AC_DEFUN([NUT_CHECK_LIBFREEIPMI],
|
|||
[
|
||||
if test -z "${nut_have_libfreeipmi_seen}"; then
|
||||
nut_have_libfreeipmi_seen=yes
|
||||
NUT_CHECK_PKGCONFIG
|
||||
|
||||
dnl save CFLAGS and LIBS
|
||||
CFLAGS_ORIG="${CFLAGS}"
|
||||
LIBS_ORIG="${LIBS}"
|
||||
|
||||
AC_MSG_CHECKING(for FreeIPMI version via pkg-config)
|
||||
dnl pkg-config support requires Freeipmi 1.0.5, released on Thu Jun 30 2011
|
||||
dnl but NUT should only require 0.8.5 (for nut-scanner) and 1.0.1 (for
|
||||
dnl nut-ipmipsu) (comment from upstream Al Chu)
|
||||
FREEIPMI_VERSION="`pkg-config --silence-errors --modversion libfreeipmi 2>/dev/null`"
|
||||
if test "$?" = "0" -a -n "${FREEIPMI_VERSION}"; then
|
||||
CFLAGS="`pkg-config --silence-errors --cflags libfreeipmi libipmimonitoring 2>/dev/null`"
|
||||
LIBS="`pkg-config --silence-errors --libs libfreeipmi libipmimonitoring 2>/dev/null`"
|
||||
else
|
||||
FREEIPMI_VERSION="none"
|
||||
CFLAGS=""
|
||||
LIBS="-lfreeipmi -lipmimonitoring"
|
||||
fi
|
||||
AC_MSG_RESULT(${FREEIPMI_VERSION} found)
|
||||
AS_IF([test x"$have_PKG_CONFIG" = xyes],
|
||||
[dnl pkg-config support requires Freeipmi 1.0.5, released on Thu Jun 30 2011
|
||||
dnl but NUT should only require 0.8.5 (for nut-scanner) and 1.0.1 (for
|
||||
dnl nut-ipmipsu) (comment from upstream Al Chu)
|
||||
AC_MSG_CHECKING(for FreeIPMI version via pkg-config)
|
||||
FREEIPMI_VERSION="`$PKG_CONFIG --silence-errors --modversion libfreeipmi 2>/dev/null`"
|
||||
if test "$?" != "0" -o -z "${FREEIPMI_VERSION}"; then
|
||||
FREEIPMI_VERSION="none"
|
||||
fi
|
||||
AC_MSG_RESULT(${FREEIPMI_VERSION} found)
|
||||
],
|
||||
[FREEIPMI_VERSION="none"
|
||||
AC_MSG_NOTICE([can not check FreeIPMI settings via pkg-config])
|
||||
]
|
||||
)
|
||||
|
||||
AS_IF([test x"$FREEIPMI_VERSION" != xnone],
|
||||
[CFLAGS="`$PKG_CONFIG --silence-errors --cflags libfreeipmi libipmimonitoring 2>/dev/null`"
|
||||
LIBS="`$PKG_CONFIG --silence-errors --libs libfreeipmi libipmimonitoring 2>/dev/null`"
|
||||
],
|
||||
[CFLAGS=""
|
||||
LIBS="-lfreeipmi -lipmimonitoring"
|
||||
]
|
||||
)
|
||||
|
||||
dnl allow overriding FreeIPMI settings if the user knows best
|
||||
AC_MSG_CHECKING(for FreeIPMI cflags)
|
||||
|
|
|
@ -1,44 +1,87 @@
|
|||
dnl Check for LIBGD compiler flags. On success, set nut_have_libgd="yes"
|
||||
dnl and set LIBGD_CFLAGS and LIBGD_LDFLAGS. On failure, set
|
||||
dnl nut_have_libgd="no". This macro can be run multiple times, but will
|
||||
dnl do the checking only once.
|
||||
dnl do the checking only once.
|
||||
|
||||
AC_DEFUN([NUT_CHECK_LIBGD],
|
||||
AC_DEFUN([NUT_CHECK_LIBGD],
|
||||
[
|
||||
if test -z "${nut_have_libgd_seen}"; then
|
||||
nut_have_libgd_seen=yes
|
||||
NUT_CHECK_PKGCONFIG
|
||||
|
||||
CFLAGS_ORIG="${CFLAGS}"
|
||||
LDFLAGS_ORIG="${LDFLAGS}"
|
||||
LIBS_ORIG="${LIBS}"
|
||||
|
||||
dnl Initial defaults. These are only used if gdlib-config is
|
||||
dnl unusable and the user fails to pass better values in --with
|
||||
dnl arguments
|
||||
CFLAGS=""
|
||||
LDFLAGS="-L/usr/X11R6/lib"
|
||||
LIBS="-lgd -lpng -lz -ljpeg -lfreetype -lm -lXpm -lX11"
|
||||
LDFLAGS=""
|
||||
LIBS=""
|
||||
|
||||
AC_MSG_CHECKING(for gd version via gdlib-config)
|
||||
GD_VERSION=`gdlib-config --version 2>/dev/null`
|
||||
if test "$?" != "0" -o -z "${GD_VERSION}"; then
|
||||
GD_VERSION="none"
|
||||
fi
|
||||
AC_MSG_RESULT(${GD_VERSION} found)
|
||||
AS_IF([test x"$have_PKG_CONFIG" = xyes],
|
||||
[AC_MSG_CHECKING(for gd version via pkg-config)
|
||||
GD_VERSION="`$PKG_CONFIG --silence-errors --modversion gdlib 2>/dev/null`"
|
||||
if test "$?" != "0" -o -z "${GD_VERSION}"; then
|
||||
GD_VERSION="none"
|
||||
fi
|
||||
AC_MSG_RESULT(${GD_VERSION} found)
|
||||
],
|
||||
[GD_VERSION="none"
|
||||
AC_MSG_NOTICE([can not check libgd settings via pkg-config])
|
||||
]
|
||||
)
|
||||
|
||||
case "${GD_VERSION}" in
|
||||
none)
|
||||
;;
|
||||
2.0.5 | 2.0.6 | 2.0.7)
|
||||
AC_MSG_WARN([[gd ${GD_VERSION} detected, unable to use gdlib-config script]])
|
||||
AC_MSG_WARN([[If gd detection fails, upgrade gd or use --with-gd-includes and --with-gd-libs]])
|
||||
;;
|
||||
*)
|
||||
CFLAGS="`gdlib-config --includes 2>/dev/null`"
|
||||
LDFLAGS="`gdlib-config --ldflags 2>/dev/null`"
|
||||
LIBS="`gdlib-config --libs 2>/dev/null`"
|
||||
;;
|
||||
esac
|
||||
AS_IF([test x"$GD_VERSION" != xnone],
|
||||
[CFLAGS="`$PKG_CONFIG --silence-errors --cflags gdlib 2>/dev/null`"
|
||||
LIBS="`$PKG_CONFIG --silence-errors --libs gdlib 2>/dev/null`"
|
||||
],
|
||||
[dnl Initial defaults. These are only used if gdlib-config is
|
||||
dnl unusable and the user fails to pass better values in --with
|
||||
dnl arguments
|
||||
CFLAGS=""
|
||||
LDFLAGS="-L/usr/X11R6/lib"
|
||||
LIBS="-lgd -lpng -lz -ljpeg -lfreetype -lm -lXpm -lX11"
|
||||
|
||||
dnl By default seek in PATH
|
||||
AC_PATH_PROGS([GDLIB_CONFIG], [gdlib-config], [none])
|
||||
AC_ARG_WITH(gdlib-config,
|
||||
AS_HELP_STRING([@<:@--with-gdlib-config=/path/to/gdlib-config@:>@],
|
||||
[path to program that reports GDLIB configuration]),
|
||||
[
|
||||
case "${withval}" in
|
||||
"") ;;
|
||||
yes|no)
|
||||
AC_MSG_ERROR(invalid option --with(out)-gdlib-config - see docs/configure.txt)
|
||||
;;
|
||||
*)
|
||||
GDLIB_CONFIG="${withval}"
|
||||
;;
|
||||
esac
|
||||
])
|
||||
|
||||
AS_IF([test x"$GDLIB_CONFIG" != xnone],
|
||||
[AC_MSG_CHECKING(for gd version via ${GDLIB_CONFIG})
|
||||
GD_VERSION="`${GDLIB_CONFIG} --version 2>/dev/null`"
|
||||
if test "$?" != "0" -o -z "${GD_VERSION}"; then
|
||||
GD_VERSION="none"
|
||||
fi
|
||||
AC_MSG_RESULT(${GD_VERSION} found)
|
||||
], [GD_VERSION="none"]
|
||||
)
|
||||
|
||||
case "${GD_VERSION}" in
|
||||
none)
|
||||
;;
|
||||
2.0.5 | 2.0.6 | 2.0.7)
|
||||
AC_MSG_WARN([[gd ${GD_VERSION} detected, unable to use ${GDLIB_CONFIG} script]])
|
||||
AC_MSG_WARN([[If gd detection fails, upgrade gd or use --with-gd-includes and --with-gd-libs]])
|
||||
;;
|
||||
*)
|
||||
CFLAGS="`${GDLIB_CONFIG} --includes 2>/dev/null`"
|
||||
LDFLAGS="`${GDLIB_CONFIG} --ldflags 2>/dev/null`"
|
||||
LIBS="`${GDLIB_CONFIG} --libs 2>/dev/null`"
|
||||
;;
|
||||
esac
|
||||
]
|
||||
)
|
||||
|
||||
dnl Now allow overriding gd settings if the user knows best
|
||||
AC_MSG_CHECKING(for gd include flags)
|
||||
|
@ -74,7 +117,21 @@ if test -z "${nut_have_libgd_seen}"; then
|
|||
|
||||
dnl check if gd is usable
|
||||
AC_CHECK_HEADERS(gd.h gdfontmb.h, [nut_have_libgd=yes], [nut_have_libgd=no], [AC_INCLUDES_DEFAULT])
|
||||
AC_SEARCH_LIBS(gdImagePng, gd, [], [nut_have_libgd=no])
|
||||
AC_SEARCH_LIBS(gdImagePng, gd, [], [
|
||||
dnl If using pkg-config, query additionally for Libs.private
|
||||
dnl to pull -L/usr/X11R6/lib or whatever current OS wants
|
||||
AC_MSG_CHECKING([for more gd library flags])
|
||||
AS_IF([test -n "${with_gd_libs}" || test x"$have_PKG_CONFIG" != xyes], [nut_have_libgd=no], [
|
||||
_LIBS_PRIVATE="`$PKG_CONFIG --silence-errors --libs gdlib --static 2>/dev/null`"
|
||||
AS_IF([test -z "${_LIBS_PRIVATE}"], [nut_have_libgd=no], [
|
||||
AC_MSG_CHECKING([with gdlib.pc Libs.private])
|
||||
LDFLAGS="$LDFLAGS $_LIBS_PRIVATE"
|
||||
unset ac_cv_search_gdImagePng
|
||||
AC_SEARCH_LIBS(gdImagePng, gd, [], [nut_have_libgd=no])
|
||||
])
|
||||
unset _LIBS_PRIVATE
|
||||
])
|
||||
])
|
||||
|
||||
if test "${nut_have_libgd}" = "yes"; then
|
||||
AC_DEFINE(HAVE_LIBGD, 1, [Define if you have Boutell's libgd installed])
|
||||
|
|
187
m4/nut_check_libmodbus.m4
Normal file
187
m4/nut_check_libmodbus.m4
Normal file
|
@ -0,0 +1,187 @@
|
|||
dnl Check for LIBMODBUS compiler flags. On success, set nut_have_libmodbus="yes"
|
||||
dnl and set LIBMODBUS_CFLAGS and LIBMODBUS_LIBS. On failure, set
|
||||
dnl nut_have_libmodbus="no". This macro can be run multiple times, but will
|
||||
dnl do the checking only once.
|
||||
|
||||
AC_DEFUN([NUT_CHECK_LIBMODBUS],
|
||||
[
|
||||
if test -z "${nut_have_libmodbus_seen}"; then
|
||||
nut_have_libmodbus_seen=yes
|
||||
|
||||
dnl save CFLAGS and LIBS
|
||||
CFLAGS_ORIG="${CFLAGS}"
|
||||
LIBS_ORIG="${LIBS}"
|
||||
NUT_CHECK_PKGCONFIG
|
||||
|
||||
AS_IF([test x"$have_PKG_CONFIG" = xyes],
|
||||
[AC_MSG_CHECKING(for libmodbus version via pkg-config)
|
||||
LIBMODBUS_VERSION="`$PKG_CONFIG --silence-errors --modversion libmodbus 2>/dev/null`"
|
||||
if test "$?" != "0" -o -z "${LIBMODBUS_VERSION}"; then
|
||||
LIBMODBUS_VERSION="none"
|
||||
fi
|
||||
AC_MSG_RESULT(${LIBMODBUS_VERSION} found)
|
||||
],
|
||||
[LIBMODBUS_VERSION="none"
|
||||
AC_MSG_NOTICE([can not check libmodbus settings via pkg-config])
|
||||
]
|
||||
)
|
||||
|
||||
AS_IF([test x"$LIBMODBUS_VERSION" != xnone],
|
||||
[CFLAGS="`$PKG_CONFIG --silence-errors --cflags libmodbus 2>/dev/null`"
|
||||
LIBS="`$PKG_CONFIG --silence-errors --libs libmodbus 2>/dev/null`"
|
||||
],
|
||||
[CFLAGS="-I/usr/include/modbus"
|
||||
LIBS="-lmodbus"
|
||||
]
|
||||
)
|
||||
|
||||
AC_MSG_CHECKING(for libmodbus cflags)
|
||||
AC_ARG_WITH(modbus-includes,
|
||||
AS_HELP_STRING([@<:@--with-modbus-includes=CFLAGS@:>@], [include flags for the libmodbus library]),
|
||||
[
|
||||
case "${withval}" in
|
||||
yes|no)
|
||||
AC_MSG_ERROR(invalid option --with(out)-modbus-includes - see docs/configure.txt)
|
||||
;;
|
||||
*)
|
||||
CFLAGS="${withval}"
|
||||
;;
|
||||
esac
|
||||
], [])
|
||||
AC_MSG_RESULT([${CFLAGS}])
|
||||
|
||||
AC_MSG_CHECKING(for libmodbus ldflags)
|
||||
AC_ARG_WITH(modbus-libs,
|
||||
AS_HELP_STRING([@<:@--with-modbus-libs=LIBS@:>@], [linker flags for the libmodbus library]),
|
||||
[
|
||||
case "${withval}" in
|
||||
yes|no)
|
||||
AC_MSG_ERROR(invalid option --with(out)-modbus-libs - see docs/configure.txt)
|
||||
;;
|
||||
*)
|
||||
LIBS="${withval}"
|
||||
;;
|
||||
esac
|
||||
], [])
|
||||
AC_MSG_RESULT([${LIBS}])
|
||||
|
||||
dnl check if libmodbus is usable
|
||||
AC_CHECK_HEADERS(modbus.h, [nut_have_libmodbus=yes], [nut_have_libmodbus=no], [AC_INCLUDES_DEFAULT])
|
||||
AC_CHECK_FUNCS(modbus_new_rtu, [], [nut_have_libmodbus=no])
|
||||
AC_CHECK_FUNCS(modbus_new_tcp, [], [nut_have_libmodbus=no])
|
||||
AC_CHECK_FUNCS(modbus_set_byte_timeout, [], [nut_have_libmodbus=no])
|
||||
AC_CHECK_FUNCS(modbus_set_response_timeout, [], [nut_have_libmodbus=no])
|
||||
|
||||
dnl modbus_set_byte_timeout() and modbus_set_response_timeout()
|
||||
dnl in 3.0.x and 3.1.x have different args (since ~2013): the
|
||||
dnl older version used to accept timeout as a struct timeval
|
||||
dnl instead of seconds and microseconds. Detect which we use?..
|
||||
AS_IF([test x"$nut_have_libmodbus" = xyes],
|
||||
[dnl Do not rely on versions if we can test actual API
|
||||
AX_C_PRAGMAS
|
||||
AC_LANG_PUSH([C])
|
||||
AC_CACHE_CHECK([types of arguments for modbus_set_byte_timeout],
|
||||
[nut_cv_func_modbus_set_byte_timeout_args],
|
||||
[nut_cv_func_modbus_set_byte_timeout_args="unknown"
|
||||
AC_COMPILE_IFELSE(
|
||||
[dnl Try purely the old API (timeval)
|
||||
AC_LANG_PROGRAM([
|
||||
#include <time.h>
|
||||
#include <modbus.h>
|
||||
], [modbus_t *ctx; struct timeval to = (struct timeval){0};
|
||||
modbus_set_byte_timeout(ctx, &to);])
|
||||
], [nut_cv_func_modbus_set_byte_timeout_args="timeval"
|
||||
dnl Try the old API in more detail: check
|
||||
dnl if we can just assign uint32's for new
|
||||
dnl code into timeval fields (exist+numeric)?
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([
|
||||
#include <time.h>
|
||||
#include <stdint.h>
|
||||
#include <modbus.h>
|
||||
], [modbus_t *ctx; uint32_t to_sec = 10, to_usec = 50;
|
||||
struct timeval to = (struct timeval){0};
|
||||
/* TODO: Clarify and detect warning names and
|
||||
* so pragmas for signed/unsigned assignment (e.g.
|
||||
* for timeval definitions that have "long" fields)
|
||||
*/
|
||||
#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_SIGN_COMPARE
|
||||
# pragma GCC diagnostic ignored "-Wsign-compare"
|
||||
#endif
|
||||
#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_SIGN_CONVERSION
|
||||
# pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||
#endif
|
||||
to.tv_sec = to_sec;
|
||||
to.tv_usec = to_usec;
|
||||
modbus_set_byte_timeout(ctx, &to);
|
||||
])
|
||||
], [nut_cv_func_modbus_set_byte_timeout_args="timeval_numeric_fields"])
|
||||
],
|
||||
|
||||
[dnl Try another API variant: new API with
|
||||
dnl fields of struct timeval as numbers
|
||||
dnl (checks they exist, and are compatible
|
||||
dnl numeric types so compiler can convert)
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([
|
||||
#include <time.h>
|
||||
#include <stdint.h>
|
||||
#include <modbus.h>
|
||||
], [modbus_t *ctx; struct timeval to = (struct timeval){0};
|
||||
/* TODO: Clarify and detect warning names and
|
||||
* so pragmas for signed/unsigned assignment (e.g.
|
||||
* for timeval definitions that have "long" fields)
|
||||
*/
|
||||
#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_SIGN_COMPARE
|
||||
# pragma GCC diagnostic ignored "-Wsign-compare"
|
||||
#endif
|
||||
#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_SIGN_CONVERSION
|
||||
# pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||
#endif
|
||||
uint32_t to_sec = to.tv_sec, to_usec = to.tv_usec;
|
||||
modbus_set_byte_timeout(ctx, to_sec, to_usec);
|
||||
])
|
||||
], [nut_cv_func_modbus_set_byte_timeout_args="sec_usec_uint32_cast_timeval_fields"],
|
||||
[dnl Try another API variant: new API purely (two uint32's)
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([
|
||||
#include <stdint.h>
|
||||
#include <modbus.h>
|
||||
], [modbus_t *ctx; uint32_t to_sec = 0, to_usec = 0;
|
||||
modbus_set_byte_timeout(ctx, to_sec, to_usec);])
|
||||
], [nut_cv_func_modbus_set_byte_timeout_args="sec_usec_uint32"])
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
dnl NOTE: We could add similar tests to above for
|
||||
dnl other time-related methods, but for now keep
|
||||
dnl it simple -- and assume some same approach
|
||||
dnl applies to the same generation of the library.
|
||||
AC_LANG_POP([C])
|
||||
AC_MSG_RESULT([Found types to use for modbus_set_byte_timeout: ${nut_cv_func_modbus_set_byte_timeout_args}])
|
||||
dnl NOTE: code should check for having a token name defined e.g.:
|
||||
dnl #ifdef NUT_MODBUS_TIMEOUT_ARG_sec_usec_uint32
|
||||
dnl Alas, we can't pass variables as macro name to AC_DEFINE
|
||||
COMMENT="Define to specify timeout method args approach for libmodbus"
|
||||
AS_CASE(["${nut_cv_func_modbus_set_byte_timeout_args}"],
|
||||
[timeval_numeric_fields], [AC_DEFINE([NUT_MODBUS_TIMEOUT_ARG_timeval_numeric_fields], 1, [${COMMENT}])],
|
||||
[timeval], [AC_DEFINE([NUT_MODBUS_TIMEOUT_ARG_timeval], 1, [${COMMENT}])],
|
||||
[sec_usec_uint32_cast_timeval_fields], [AC_DEFINE([NUT_MODBUS_TIMEOUT_ARG_sec_usec_uint32_cast_timeval_fields], 1, [${COMMENT}])],
|
||||
[sec_usec_uint32], [AC_DEFINE([NUT_MODBUS_TIMEOUT_ARG_sec_usec_uint32], 1, [${COMMENT}])],
|
||||
[dnl default
|
||||
AC_MSG_WARN([Cannot find proper types to use for modbus_set_byte_timeout])
|
||||
nut_have_libmodbus=no]
|
||||
)
|
||||
])
|
||||
|
||||
AS_IF([test x"${nut_have_libmodbus}" = x"yes"],
|
||||
[LIBMODBUS_CFLAGS="${CFLAGS}"
|
||||
LIBMODBUS_LIBS="${LIBS}"]
|
||||
)
|
||||
|
||||
dnl restore original CFLAGS and LIBS
|
||||
CFLAGS="${CFLAGS_ORIG}"
|
||||
LIBS="${LIBS_ORIG}"
|
||||
fi
|
||||
])
|
|
@ -7,18 +7,27 @@ AC_DEFUN([NUT_CHECK_LIBNEON],
|
|||
[
|
||||
if test -z "${nut_have_neon_seen}"; then
|
||||
nut_have_neon_seen=yes
|
||||
NUT_CHECK_PKGCONFIG
|
||||
|
||||
dnl save CFLAGS and LIBS
|
||||
CFLAGS_ORIG="${CFLAGS}"
|
||||
LIBS_ORIG="${LIBS}"
|
||||
|
||||
dnl See which version of the neon library (if any) is installed
|
||||
AC_MSG_CHECKING(for libneon version via pkg-config (0.25.0 minimum required))
|
||||
NEON_VERSION="`pkg-config --silence-errors --modversion neon 2>/dev/null`"
|
||||
if test "$?" != "0" -o -z "${NEON_VERSION}"; then
|
||||
NEON_VERSION="none"
|
||||
fi
|
||||
AC_MSG_RESULT(${NEON_VERSION} found)
|
||||
AS_IF([test x"$have_PKG_CONFIG" = xyes],
|
||||
[dnl See which version of the neon library (if any) is installed
|
||||
dnl FIXME : Support detection of cflags/ldflags below by legacy
|
||||
dnl discovery if pkgconfig is not there
|
||||
AC_MSG_CHECKING(for libneon version via pkg-config (0.25.0 minimum required))
|
||||
NEON_VERSION="`$PKG_CONFIG --silence-errors --modversion neon 2>/dev/null`"
|
||||
if test "$?" != "0" -o -z "${NEON_VERSION}"; then
|
||||
NEON_VERSION="none"
|
||||
fi
|
||||
AC_MSG_RESULT(${NEON_VERSION} found)
|
||||
],
|
||||
[NEON_VERSION="none"
|
||||
AC_MSG_NOTICE([can not check libneon settings via pkg-config])
|
||||
]
|
||||
)
|
||||
|
||||
AC_MSG_CHECKING(for libneon cflags)
|
||||
AC_ARG_WITH(neon-includes,
|
||||
|
@ -32,7 +41,12 @@ if test -z "${nut_have_neon_seen}"; then
|
|||
CFLAGS="${withval}"
|
||||
;;
|
||||
esac
|
||||
], [CFLAGS="`pkg-config --silence-errors --cflags neon 2>/dev/null`"])
|
||||
], [
|
||||
AS_IF([test x"$have_PKG_CONFIG" = xyes],
|
||||
[CFLAGS="`$PKG_CONFIG --silence-errors --cflags neon 2>/dev/null`" || CFLAGS="-I/usr/include/neon -I/usr/local/include/neon"],
|
||||
[CFLAGS="-I/usr/include/neon -I/usr/local/include/neon"]
|
||||
)]
|
||||
)
|
||||
AC_MSG_RESULT([${CFLAGS}])
|
||||
|
||||
AC_MSG_CHECKING(for libneon ldflags)
|
||||
|
@ -47,7 +61,12 @@ if test -z "${nut_have_neon_seen}"; then
|
|||
LIBS="${withval}"
|
||||
;;
|
||||
esac
|
||||
], [LIBS="`pkg-config --silence-errors --libs neon 2>/dev/null`"])
|
||||
], [
|
||||
AS_IF([test x"$have_PKG_CONFIG" = xyes],
|
||||
[LIBS="`$PKG_CONFIG --silence-errors --libs neon 2>/dev/null`" || LIBS="-lneon"],
|
||||
[LIBS="-lneon"]
|
||||
)]
|
||||
)
|
||||
AC_MSG_RESULT([${LIBS}])
|
||||
|
||||
dnl check if neon is usable
|
||||
|
|
|
@ -1,25 +1,83 @@
|
|||
dnl Check for LIBNETSNMP compiler flags. On success, set
|
||||
dnl nut_have_libnetsnmp="yes" and set LIBNETSNMP_CFLAGS and
|
||||
dnl LIBNETSNMP_LIBS. On failure, set nut_have_libnetsnmp="no".
|
||||
dnl This macro can be run multiple times, but will do the checking only
|
||||
dnl once.
|
||||
dnl This macro can be run multiple times, but will do the
|
||||
dnl checking only once.
|
||||
|
||||
AC_DEFUN([NUT_CHECK_LIBNETSNMP],
|
||||
[
|
||||
if test -z "${nut_have_libnetsnmp_seen}"; then
|
||||
nut_have_libnetsnmp_seen=yes
|
||||
NUT_CHECK_PKGCONFIG
|
||||
AC_LANG_PUSH([C])
|
||||
|
||||
dnl save CFLAGS and LIBS
|
||||
CFLAGS_ORIG="${CFLAGS}"
|
||||
LIBS_ORIG="${LIBS}"
|
||||
|
||||
dnl See which version of the Net-SNMP library (if any) is installed
|
||||
AC_MSG_CHECKING(for Net-SNMP version via net-snmp-config)
|
||||
SNMP_VERSION=`net-snmp-config --version 2>/dev/null`
|
||||
if test "$?" != "0" -o -z "${SNMP_VERSION}"; then
|
||||
SNMP_VERSION="none"
|
||||
dnl We prefer to get info from pkg-config (for suitable arch/bitness as
|
||||
dnl specified in args for that mechanism), unless (legacy) a particular
|
||||
dnl --with-net-snmp-config=... was requested. If there is no pkg-config
|
||||
dnl info, we fall back to detecting and running a NET_SNMP_CONFIG as well.
|
||||
|
||||
dnl By default seek in PATH, but which variant (if several are provided)?
|
||||
AC_CHECK_SIZEOF([void *])
|
||||
NET_SNMP_CONFIG="none"
|
||||
AS_CASE(["${ac_cv_sizeof_void_p}"],
|
||||
[4],[AC_PATH_PROGS([NET_SNMP_CONFIG], [net-snmp-config-32 net-snmp-config], [none])],
|
||||
[8],[AC_PATH_PROGS([NET_SNMP_CONFIG], [net-snmp-config-64 net-snmp-config], [none])],
|
||||
[AC_PATH_PROGS([NET_SNMP_CONFIG], [net-snmp-config], [none])]
|
||||
)
|
||||
|
||||
prefer_NET_SNMP_CONFIG=false
|
||||
AC_ARG_WITH(net-snmp-config,
|
||||
AS_HELP_STRING([@<:@--with-net-snmp-config=/path/to/net-snmp-config@:>@],
|
||||
[path to program that reports Net-SNMP configuration]),
|
||||
[
|
||||
case "${withval}" in
|
||||
""|yes) prefer_NET_SNMP_CONFIG=true ;;
|
||||
no)
|
||||
dnl AC_MSG_ERROR(invalid option --with(out)-net-snmp-config - see docs/configure.txt)
|
||||
prefer_NET_SNMP_CONFIG=false
|
||||
;;
|
||||
*)
|
||||
NET_SNMP_CONFIG="${withval}"
|
||||
prefer_NET_SNMP_CONFIG=true
|
||||
;;
|
||||
esac
|
||||
])
|
||||
|
||||
if test x"$have_PKG_CONFIG" = xyes && ! "${prefer_NET_SNMP_CONFIG}" ; then
|
||||
AC_MSG_CHECKING(for Net-SNMP version via pkg-config)
|
||||
dnl TODO? Loop over possible/historic pkg names, like
|
||||
dnl netsnmp, net-snmp, ucd-snmp, libsnmp, snmp...
|
||||
SNMP_VERSION="`$PKG_CONFIG --silence-errors --modversion netsnmp 2>/dev/null`"
|
||||
if test "$?" = "0" -a -n "${SNMP_VERSION}" ; then
|
||||
AC_MSG_RESULT(${SNMP_VERSION} found)
|
||||
else
|
||||
AC_MSG_RESULT(none found)
|
||||
prefer_NET_SNMP_CONFIG=true
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$NET_SNMP_CONFIG" = none ; then
|
||||
prefer_NET_SNMP_CONFIG=false
|
||||
fi
|
||||
|
||||
if "${prefer_NET_SNMP_CONFIG}" ; then
|
||||
dnl See which version of the Net-SNMP library (if any) is installed
|
||||
AC_MSG_CHECKING(for Net-SNMP version via ${NET_SNMP_CONFIG})
|
||||
SNMP_VERSION="`${NET_SNMP_CONFIG} --version 2>/dev/null`"
|
||||
if test "$?" != "0" -o -z "${SNMP_VERSION}"; then
|
||||
SNMP_VERSION="none"
|
||||
prefer_NET_SNMP_CONFIG=false
|
||||
fi
|
||||
AC_MSG_RESULT(${SNMP_VERSION} found)
|
||||
fi
|
||||
|
||||
if test x"$have_PKG_CONFIG" != xyes && ! "${prefer_NET_SNMP_CONFIG}" ; then
|
||||
AC_MSG_WARN([did not find either net-snmp-config or pkg-config for net-snmp])
|
||||
fi
|
||||
AC_MSG_RESULT(${SNMP_VERSION} found)
|
||||
|
||||
AC_MSG_CHECKING(for Net-SNMP cflags)
|
||||
AC_ARG_WITH(snmp-includes,
|
||||
|
@ -33,7 +91,13 @@ if test -z "${nut_have_libnetsnmp_seen}"; then
|
|||
CFLAGS="${withval}"
|
||||
;;
|
||||
esac
|
||||
], [CFLAGS="`net-snmp-config --base-cflags 2>/dev/null`"])
|
||||
], [AS_IF(["${prefer_NET_SNMP_CONFIG}"],
|
||||
[CFLAGS="`${NET_SNMP_CONFIG} --base-cflags 2>/dev/null`"],
|
||||
[AS_IF([test x"$have_PKG_CONFIG" = xyes],
|
||||
[CFLAGS="`$PKG_CONFIG --silence-errors --cflags netsnmp 2>/dev/null`"]
|
||||
)]
|
||||
)]
|
||||
)
|
||||
AC_MSG_RESULT([${CFLAGS}])
|
||||
|
||||
AC_MSG_CHECKING(for Net-SNMP libs)
|
||||
|
@ -48,17 +112,211 @@ if test -z "${nut_have_libnetsnmp_seen}"; then
|
|||
LIBS="${withval}"
|
||||
;;
|
||||
esac
|
||||
], [LIBS="`net-snmp-config --libs 2>/dev/null`"])
|
||||
], [AS_IF(["${prefer_NET_SNMP_CONFIG}"],
|
||||
[LIBS="`${NET_SNMP_CONFIG} --libs 2>/dev/null`"],
|
||||
[AS_IF([test x"$have_PKG_CONFIG" = xyes],
|
||||
[LIBS="`$PKG_CONFIG --silence-errors --libs netsnmp 2>/dev/null`"],
|
||||
[LIBS="-lnetsnmp"])]
|
||||
)]
|
||||
)
|
||||
AC_MSG_RESULT([${LIBS}])
|
||||
|
||||
dnl Check if the Net-SNMP library is usable
|
||||
AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [nut_have_libnetsnmp=yes], [nut_have_libnetsnmp=no], [AC_INCLUDES_DEFAULT])
|
||||
AC_CHECK_FUNCS(init_snmp, [], [nut_have_libnetsnmp=no])
|
||||
|
||||
if test "${nut_have_libnetsnmp}" = "yes"; then
|
||||
AS_IF([test "${nut_have_libnetsnmp}" = "yes"], [
|
||||
LIBNETSNMP_CFLAGS="${CFLAGS}"
|
||||
LIBNETSNMP_LIBS="${LIBS}"
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([for defined usmAESPrivProtocol])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
|
||||
#include <net-snmp/net-snmp-config.h>
|
||||
#include <net-snmp/net-snmp-includes.h>
|
||||
oid * pProto = usmAESPrivProtocol;
|
||||
],
|
||||
[]
|
||||
)],
|
||||
[AC_MSG_RESULT([yes])
|
||||
AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmAESPrivProtocol, 1, [Variable or macro by this name is resolvable])
|
||||
],
|
||||
[AC_MSG_RESULT([no])
|
||||
AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmAESPrivProtocol, 0, [Variable or macro by this name is not resolvable])
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([for defined usmAES128PrivProtocol])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
|
||||
#include <net-snmp/net-snmp-config.h>
|
||||
#include <net-snmp/net-snmp-includes.h>
|
||||
oid * pProto = usmAES128PrivProtocol;
|
||||
],
|
||||
[]
|
||||
)],
|
||||
[AC_MSG_RESULT([yes])
|
||||
AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmAES128PrivProtocol, 1, [Variable or macro by this name is resolvable])
|
||||
],
|
||||
[AC_MSG_RESULT([no])
|
||||
AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmAES128PrivProtocol, 0, [Variable or macro by this name is not resolvable])
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([for defined usmDESPrivProtocol])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
|
||||
#include <net-snmp/net-snmp-config.h>
|
||||
#include <net-snmp/net-snmp-includes.h>
|
||||
oid * pProto = usmDESPrivProtocol;
|
||||
#ifdef NETSNMP_DISABLE_DES
|
||||
#error "NETSNMP_DISABLE_DES is defined"
|
||||
#endif
|
||||
],
|
||||
[]
|
||||
)],
|
||||
[AC_MSG_RESULT([yes])
|
||||
AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmDESPrivProtocol, 1, [Variable or macro by this name is resolvable])
|
||||
],
|
||||
[AC_MSG_RESULT([no])
|
||||
AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmDESPrivProtocol, 0, [Variable or macro by this name is not resolvable])
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([for defined usmHMAC256SHA384AuthProtocol])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
|
||||
#include <net-snmp/net-snmp-config.h>
|
||||
#include <net-snmp/net-snmp-includes.h>
|
||||
oid * pProto = usmHMAC256SHA384AuthProtocol;
|
||||
#ifndef HAVE_EVP_SHA384
|
||||
#error "HAVE_EVP_SHA384 is NOT defined"
|
||||
#endif
|
||||
],
|
||||
[]
|
||||
)],
|
||||
[AC_MSG_RESULT([yes])
|
||||
AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmHMAC256SHA384AuthProtocol, 1, [Variable or macro by this name is resolvable])
|
||||
],
|
||||
[AC_MSG_RESULT([no])
|
||||
AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmHMAC256SHA384AuthProtocol, 0, [Variable or macro by this name is not resolvable])
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([for defined usmHMAC384SHA512AuthProtocol])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
|
||||
#include <net-snmp/net-snmp-config.h>
|
||||
#include <net-snmp/net-snmp-includes.h>
|
||||
oid * pProto = usmHMAC384SHA512AuthProtocol;
|
||||
#ifndef HAVE_EVP_SHA384
|
||||
#error "HAVE_EVP_SHA384 is NOT defined"
|
||||
#endif
|
||||
],
|
||||
[]
|
||||
)],
|
||||
[AC_MSG_RESULT([yes])
|
||||
AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmHMAC384SHA512AuthProtocol, 1, [Variable or macro by this name is resolvable])
|
||||
],
|
||||
[AC_MSG_RESULT([no])
|
||||
AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmHMAC384SHA512AuthProtocol, 0, [Variable or macro by this name is not resolvable])
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([for defined usmHMAC192SHA256AuthProtocol])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
|
||||
#include <net-snmp/net-snmp-config.h>
|
||||
#include <net-snmp/net-snmp-includes.h>
|
||||
oid * pProto = usmHMAC192SHA256AuthProtocol;
|
||||
#ifndef HAVE_EVP_SHA224
|
||||
#error "HAVE_EVP_SHA224 is NOT defined"
|
||||
#endif
|
||||
],
|
||||
[]
|
||||
)],
|
||||
[AC_MSG_RESULT([yes])
|
||||
AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmHMAC192SHA256AuthProtocol, 1, [Variable or macro by this name is resolvable])
|
||||
],
|
||||
[AC_MSG_RESULT([no])
|
||||
AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmHMAC192SHA256AuthProtocol, 0, [Variable or macro by this name is not resolvable])
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([for defined usmAES192PrivProtocol])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
|
||||
#include <net-snmp/net-snmp-config.h>
|
||||
#include <net-snmp/net-snmp-includes.h>
|
||||
oid * pProto = usmAES192PrivProtocol;
|
||||
#ifndef NETSNMP_DRAFT_BLUMENTHAL_AES_04
|
||||
#error "NETSNMP_DRAFT_BLUMENTHAL_AES_04 is NOT defined"
|
||||
#endif
|
||||
],
|
||||
[]
|
||||
)],
|
||||
[AC_MSG_RESULT([yes])
|
||||
AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmAES192PrivProtocol, 1, [Variable or macro by this name is resolvable])
|
||||
],
|
||||
[AC_MSG_RESULT([no])
|
||||
AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmAES192PrivProtocol, 0, [Variable or macro by this name is not resolvable])
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([for defined usmAES256PrivProtocol])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
|
||||
#include <net-snmp/net-snmp-config.h>
|
||||
#include <net-snmp/net-snmp-includes.h>
|
||||
oid * pProto = usmAES256PrivProtocol;
|
||||
#ifndef NETSNMP_DRAFT_BLUMENTHAL_AES_04
|
||||
#error "NETSNMP_DRAFT_BLUMENTHAL_AES_04 is NOT defined"
|
||||
#endif
|
||||
],
|
||||
[]
|
||||
)],
|
||||
[AC_MSG_RESULT([yes])
|
||||
AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmAES256PrivProtocol, 1, [Variable or macro by this name is resolvable])
|
||||
],
|
||||
[AC_MSG_RESULT([no])
|
||||
AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmAES256PrivProtocol, 0, [Variable or macro by this name is not resolvable])
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([for defined usmHMACMD5AuthProtocol])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
|
||||
#include <net-snmp/net-snmp-config.h>
|
||||
#include <net-snmp/net-snmp-includes.h>
|
||||
oid * pProto = usmHMACMD5AuthProtocol;
|
||||
#ifdef NETSNMP_DISABLE_MD5
|
||||
#error "NETSNMP_DISABLE_MD5 is defined"
|
||||
#endif
|
||||
],
|
||||
[]
|
||||
)],
|
||||
[AC_MSG_RESULT([yes])
|
||||
AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmHMACMD5AuthProtocol, 1, [Variable or macro by this name is resolvable])
|
||||
],
|
||||
[AC_MSG_RESULT([no])
|
||||
AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmHMACMD5AuthProtocol, 0, [Variable or macro by this name is not resolvable])
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([for defined usmHMACSHA1AuthProtocol])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
|
||||
#include <net-snmp/net-snmp-config.h>
|
||||
#include <net-snmp/net-snmp-includes.h>
|
||||
oid * pProto = usmHMACSHA1AuthProtocol;
|
||||
],
|
||||
[]
|
||||
)],
|
||||
[AC_MSG_RESULT([yes])
|
||||
AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmHMACSHA1AuthProtocol, 1, [Variable or macro by this name is resolvable])
|
||||
],
|
||||
[AC_MSG_RESULT([no])
|
||||
AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmHMACSHA1AuthProtocol, 0, [Variable or macro by this name is not resolvable])
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([for defined NETSNMP_DRAFT_BLUMENTHAL_AES_04])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
|
||||
#include <net-snmp/net-snmp-config.h>
|
||||
#include <net-snmp/net-snmp-includes.h>
|
||||
int num = NETSNMP_DRAFT_BLUMENTHAL_AES_04 + 1; /* if defined, NETSNMP_DRAFT_BLUMENTHAL_AES_04 is 1 */
|
||||
],
|
||||
[]
|
||||
)],
|
||||
[AC_MSG_RESULT([yes])
|
||||
AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_DRAFT_BLUMENTHAL_AES_04, 1, [Variable or macro by this name is resolvable])
|
||||
],
|
||||
[AC_MSG_RESULT([no])
|
||||
AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_DRAFT_BLUMENTHAL_AES_04, 0, [Variable or macro by this name is not resolvable])
|
||||
])
|
||||
|
||||
])
|
||||
AC_LANG_POP([C])
|
||||
|
||||
dnl restore original CFLAGS and LIBS
|
||||
CFLAGS="${CFLAGS_ORIG}"
|
||||
|
|
|
@ -3,26 +3,50 @@ dnl nut_have_libnss="yes" and nut_ssl_lib="Mozilla NSS", and define WITH_SSL,
|
|||
dnl WITH_NSS, LIBSSL_CFLAGS and LIBSSL_LIBS. On failure, set nut_have_libnss="no".
|
||||
dnl This macro can be run multiple times, but will do the checking only once.
|
||||
|
||||
AC_DEFUN([NUT_CHECK_LIBNSS],
|
||||
AC_DEFUN([NUT_CHECK_LIBNSS],
|
||||
[
|
||||
if test -z "${nut_have_libnss_seen}"; then
|
||||
nut_have_libnss_seen=yes
|
||||
NUT_CHECK_PKGCONFIG
|
||||
|
||||
dnl save CFLAGS and LIBS
|
||||
CFLAGS_ORIG="${CFLAGS}"
|
||||
LIBS_ORIG="${LIBS}"
|
||||
REQUIRES_ORIG="${REQUIRES}"
|
||||
|
||||
AC_MSG_CHECKING(for Mozilla NSS version via pkg-config)
|
||||
NSS_VERSION="`pkg-config --silence-errors --modversion nss 2>/dev/null`"
|
||||
if test "$?" = "0" -a -n "${NSS_VERSION}"; then
|
||||
CFLAGS="`pkg-config --silence-errors --cflags nss 2>/dev/null`"
|
||||
LIBS="`pkg-config --silence-errors --libs nss 2>/dev/null`"
|
||||
else
|
||||
NSS_VERSION="none"
|
||||
CFLAGS=""
|
||||
LIBS="-lnss3 -lnssutil3 -lsmime3 -lssl3 -lplds4 -lplc4 -lnspr4"
|
||||
SAVED_GCC="$GCC"
|
||||
SAVED_CC="$CC"
|
||||
if ( test "${GCC}" = "yes" )
|
||||
then
|
||||
case "$CFLAGS$LDFLAGS" in
|
||||
*-m32*) CC="$CC -m32" ;;
|
||||
*-m64*) CC="$CC -m64" ;;
|
||||
esac
|
||||
fi
|
||||
AC_MSG_RESULT(${NSS_VERSION} found)
|
||||
|
||||
AS_IF([test x"$have_PKG_CONFIG" = xyes],
|
||||
[AC_MSG_CHECKING(for Mozilla NSS version via pkg-config)
|
||||
NSS_VERSION="`$PKG_CONFIG --silence-errors --modversion nss 2>/dev/null`"
|
||||
if test "$?" != "0" -o -z "${NSS_VERSION}"; then
|
||||
NSS_VERSION="none"
|
||||
fi
|
||||
AC_MSG_RESULT(${NSS_VERSION} found)
|
||||
],
|
||||
[NSS_VERSION="none"
|
||||
AC_MSG_NOTICE([can not check libnss settings via pkg-config])
|
||||
]
|
||||
)
|
||||
|
||||
AS_IF([test x"$NSS_VERSION" != xnone],
|
||||
[CFLAGS="`$PKG_CONFIG --silence-errors --cflags nss 2>/dev/null`"
|
||||
LIBS="`$PKG_CONFIG --silence-errors --libs nss 2>/dev/null`"
|
||||
REQUIRES="nss"
|
||||
],
|
||||
[CFLAGS=""
|
||||
LIBS="-lnss3 -lnssutil3 -lsmime3 -lssl3 -lplds4 -lplc4 -lnspr4"
|
||||
REQUIRES="nss"
|
||||
]
|
||||
)
|
||||
|
||||
dnl allow overriding NSS settings if the user knows best
|
||||
AC_MSG_CHECKING(for Mozilla NSS cflags)
|
||||
|
@ -56,10 +80,14 @@ if test -z "${nut_have_libnss_seen}"; then
|
|||
AC_MSG_RESULT([${LIBS}])
|
||||
|
||||
dnl check if NSS is usable: we need both the runtime and headers
|
||||
dnl NOTE that caller may have to specify PKG_CONFIG_PATH including
|
||||
dnl their bitness variant if it is not prioritized in their default
|
||||
dnl setting built in by OS distribution; the .../pkgconfig/nss.pc
|
||||
dnl tends to specify the libdir which is CPU Arch dependent.
|
||||
AC_CHECK_FUNCS(NSS_Init, [nut_have_libnss=yes], [nut_have_libnss=no])
|
||||
dnl libc6 also provides an nss.h file, so also check for ssl.h
|
||||
AC_CHECK_HEADERS([nss.h ssl.h], [], [nut_have_libnss=no], [AC_INCLUDES_DEFAULT])
|
||||
|
||||
|
||||
if test "${nut_have_libnss}" = "yes"; then
|
||||
nut_with_ssl="yes"
|
||||
nut_ssl_lib="(Mozilla NSS)"
|
||||
|
@ -67,10 +95,14 @@ if test -z "${nut_have_libnss_seen}"; then
|
|||
AC_DEFINE(WITH_NSS, 1, [Define to enable SSL support using Mozilla NSS])
|
||||
LIBSSL_CFLAGS="${CFLAGS}"
|
||||
LIBSSL_LIBS="${LIBS}"
|
||||
LIBSSL_REQUIRES="${REQUIRES}"
|
||||
fi
|
||||
|
||||
dnl restore original CFLAGS and LIBS
|
||||
CFLAGS="${CFLAGS_ORIG}"
|
||||
LIBS="${LIBS_ORIG}"
|
||||
REQUIRES="${REQUIRES_ORIG}"
|
||||
GCC="$SAVED_GCC"
|
||||
CC="$SAVED_CC"
|
||||
fi
|
||||
])
|
||||
|
|
|
@ -8,22 +8,36 @@ AC_DEFUN([NUT_CHECK_LIBOPENSSL],
|
|||
[
|
||||
if test -z "${nut_have_libopenssl_seen}"; then
|
||||
nut_have_libopenssl_seen=yes
|
||||
NUT_CHECK_PKGCONFIG
|
||||
|
||||
dnl save CFLAGS and LIBS
|
||||
CFLAGS_ORIG="${CFLAGS}"
|
||||
LIBS_ORIG="${LIBS}"
|
||||
REQUIRES_ORIG="${REQUIRES}"
|
||||
|
||||
AC_MSG_CHECKING(for OpenSSL version via pkg-config)
|
||||
OPENSSL_VERSION="`pkg-config --silence-errors --modversion openssl 2>/dev/null`"
|
||||
if test "$?" = "0" -a -n "${OPENSSL_VERSION}"; then
|
||||
CFLAGS="`pkg-config --silence-errors --cflags openssl 2>/dev/null`"
|
||||
LIBS="`pkg-config --silence-errors --libs openssl 2>/dev/null`"
|
||||
else
|
||||
OPENSSL_VERSION="none"
|
||||
CFLAGS=""
|
||||
LIBS="-lssl -lcrypto"
|
||||
fi
|
||||
AC_MSG_RESULT(${OPENSSL_VERSION} found)
|
||||
AS_IF([test x"$have_PKG_CONFIG" = xyes],
|
||||
[AC_MSG_CHECKING(for OpenSSL version via pkg-config)
|
||||
OPENSSL_VERSION="`$PKG_CONFIG --silence-errors --modversion openssl 2>/dev/null`"
|
||||
if test "$?" != "0" -o -z "${OPENSSL_VERSION}"; then
|
||||
OPENSSL_VERSION="none"
|
||||
fi
|
||||
AC_MSG_RESULT(${OPENSSL_VERSION} found)
|
||||
],
|
||||
[OPENSSL_VERSION="none"
|
||||
AC_MSG_NOTICE([can not check OpenSSL settings via pkg-config])
|
||||
]
|
||||
)
|
||||
|
||||
AS_IF([test x"$OPENSSL_VERSION" != xnone],
|
||||
[CFLAGS="`$PKG_CONFIG --silence-errors --cflags openssl 2>/dev/null`"
|
||||
LIBS="`$PKG_CONFIG --silence-errors --libs openssl 2>/dev/null`"
|
||||
REQUIRES="openssl"
|
||||
],
|
||||
[CFLAGS=""
|
||||
LIBS="-lssl -lcrypto"
|
||||
REQUIRES="openssl"
|
||||
]
|
||||
)
|
||||
|
||||
dnl allow overriding OpenSSL settings if the user knows best
|
||||
AC_MSG_CHECKING(for OpenSSL cflags)
|
||||
|
@ -58,7 +72,7 @@ if test -z "${nut_have_libopenssl_seen}"; then
|
|||
|
||||
dnl check if openssl is usable
|
||||
AC_CHECK_HEADERS(openssl/ssl.h, [nut_have_openssl=yes], [nut_have_openssl=no], [AC_INCLUDES_DEFAULT])
|
||||
AC_CHECK_FUNCS(SSL_library_init, [], [nut_have_openssl=no])
|
||||
AC_CHECK_FUNCS(SSL_CTX_new, [], [nut_have_openssl=no])
|
||||
|
||||
if test "${nut_have_openssl}" = "yes"; then
|
||||
nut_with_ssl="yes"
|
||||
|
@ -67,10 +81,12 @@ if test -z "${nut_have_libopenssl_seen}"; then
|
|||
AC_DEFINE(WITH_OPENSSL, 1, [Define to enable SSL support using OpenSSL])
|
||||
LIBSSL_CFLAGS="${CFLAGS}"
|
||||
LIBSSL_LIBS="${LIBS}"
|
||||
LIBSSL_REQUIRES="${REQUIRES}"
|
||||
fi
|
||||
|
||||
dnl restore original CFLAGS and LIBS
|
||||
CFLAGS="${CFLAGS_ORIG}"
|
||||
LIBS="${LIBS_ORIG}"
|
||||
REQUIRES="${REQUIRES_ORIG}"
|
||||
fi
|
||||
])
|
||||
|
|
|
@ -7,24 +7,53 @@ AC_DEFUN([NUT_CHECK_LIBPOWERMAN],
|
|||
[
|
||||
if test -z "${nut_have_libpowerman_seen}"; then
|
||||
nut_have_libpowerman_seen=yes
|
||||
NUT_CHECK_PKGCONFIG
|
||||
|
||||
dnl save CFLAGS and LIBS
|
||||
CFLAGS_ORIG="${CFLAGS}"
|
||||
LIBS_ORIG="${LIBS}"
|
||||
|
||||
AC_MSG_CHECKING(for libpowerman cflags)
|
||||
AS_IF([test x"$have_PKG_CONFIG" = xyes],
|
||||
[AC_MSG_CHECKING([for LLNC libpowerman version via pkg-config])
|
||||
POWERMAN_VERSION="`$PKG_CONFIG --silence-errors --modversion libpowerman 2>/dev/null`"
|
||||
dnl Unlike other pkg-config enabled projects we use,
|
||||
dnl libpowerman (at least on Debian) delivers an empty
|
||||
dnl "Version:" tag in /usr/lib/pkgconfig/libpowerman.pc
|
||||
dnl (and it is the only file in that dir, others going
|
||||
dnl to /usr/lib/x86_64-linux-gnu/pkgconfig/ or similar
|
||||
dnl for other architectures). Empty is not an error here!
|
||||
if test "$?" != "0" ; then # -o -z "${POWERMAN_VERSION}"; then
|
||||
POWERMAN_VERSION="none"
|
||||
fi
|
||||
AC_MSG_RESULT(['${POWERMAN_VERSION}' found])
|
||||
],
|
||||
[POWERMAN_VERSION="none"
|
||||
AC_MSG_NOTICE([can not check LLNC libpowerman settings via pkg-config])
|
||||
]
|
||||
)
|
||||
|
||||
AS_IF([test x"$POWERMAN_VERSION" != xnone],
|
||||
[CFLAGS="`$PKG_CONFIG --silence-errors --cflags libpowerman 2>/dev/null`"
|
||||
LIBS="`$PKG_CONFIG --silence-errors --libs libpowerman 2>/dev/null`"
|
||||
],
|
||||
[CFLAGS=""
|
||||
LIBS=""
|
||||
]
|
||||
)
|
||||
|
||||
AC_MSG_CHECKING([for libpowerman cflags])
|
||||
AC_ARG_WITH(powerman-includes,
|
||||
AS_HELP_STRING([@<:@--with-powerman-includes=CFLAGS@:>@], [include flags for the libpowerman library]),
|
||||
[
|
||||
case "${withval}" in
|
||||
yes|no)
|
||||
AC_MSG_ERROR(invalid option --with(out)-powerman-includes - see docs/configure.txt)
|
||||
AC_MSG_ERROR([invalid option --with(out)-powerman-includes - see docs/configure.txt])
|
||||
;;
|
||||
*)
|
||||
CFLAGS="${withval}"
|
||||
;;
|
||||
esac
|
||||
], [CFLAGS="`pkg-config --silence-errors --cflags libpowerman 2>/dev/null`"])
|
||||
], [])
|
||||
AC_MSG_RESULT([${CFLAGS}])
|
||||
|
||||
AC_MSG_CHECKING(for libpowerman libs)
|
||||
|
@ -39,12 +68,23 @@ if test -z "${nut_have_libpowerman_seen}"; then
|
|||
LIBS="${withval}"
|
||||
;;
|
||||
esac
|
||||
], [LIBS="`pkg-config --silence-errors --libs libpowerman 2>/dev/null`"])
|
||||
], [])
|
||||
AC_MSG_RESULT([${LIBS}])
|
||||
|
||||
dnl check if libpowerman is usable
|
||||
AC_CHECK_HEADERS(libpowerman.h, [nut_have_libpowerman=yes], [nut_have_libpowerman=no], [AC_INCLUDES_DEFAULT])
|
||||
AC_CHECK_FUNCS(pm_connect, [], [nut_have_libpowerman=no])
|
||||
AC_CHECK_FUNCS(pm_connect, [], [
|
||||
dnl Some systems may just have libpowerman in their
|
||||
dnl standard paths, but not the pkg-config data
|
||||
AS_IF([test "${nut_have_libpowerman}" = "yes" && test "$POWERMAN_VERSION" = "none" && test -z "$LIBS"],
|
||||
[AC_MSG_CHECKING([if libpowerman is just present in path])
|
||||
LIBS="-L/usr/lib -L/usr/local/lib -lpowerman"
|
||||
unset ac_cv_func_pm_connect || true
|
||||
AC_CHECK_FUNCS(pm_connect, [], [nut_have_libpowerman=no])
|
||||
AC_MSG_RESULT([${nut_have_libpowerman}])
|
||||
], [nut_have_libpowerman=no]
|
||||
)]
|
||||
)
|
||||
|
||||
if test "${nut_have_libpowerman}" = "yes"; then
|
||||
LIBPOWERMAN_CFLAGS="${CFLAGS}"
|
||||
|
|
|
@ -1,48 +1,173 @@
|
|||
dnl Check for LIBUSB compiler flags. On success, set nut_have_libusb="yes"
|
||||
dnl and set LIBUSB_CFLAGS and LIBUSB_LIBS. On failure, set
|
||||
dnl Check for LIBUSB 1.0 or 0.1 (and, if found, fill 'nut_usb_lib' with its
|
||||
dnl approximate version) and its compiler flags. On success, set
|
||||
dnl nut_have_libusb="yes" and set LIBUSB_CFLAGS and LIBUSB_LIBS. On failure, set
|
||||
dnl nut_have_libusb="no". This macro can be run multiple times, but will
|
||||
dnl do the checking only once.
|
||||
dnl By default, if both libusb 1.0 and libusb 0.1 are available and appear to be
|
||||
dnl usable, libusb 1.0 takes precedence.
|
||||
dnl An optional argument with value 'libusb-1.0' or 'libusb-0.1' can be used to
|
||||
dnl restrict checks to a specific version.
|
||||
|
||||
AC_DEFUN([NUT_CHECK_LIBUSB],
|
||||
[
|
||||
if test -z "${nut_have_libusb_seen}"; then
|
||||
nut_have_libusb_seen=yes
|
||||
NUT_CHECK_PKGCONFIG
|
||||
|
||||
dnl save CFLAGS and LIBS
|
||||
CFLAGS_ORIG="${CFLAGS}"
|
||||
LIBS_ORIG="${LIBS}"
|
||||
CFLAGS=""
|
||||
LIBS=""
|
||||
|
||||
AC_MSG_CHECKING(for libusb version via pkg-config)
|
||||
LIBUSB_VERSION="`pkg-config --silence-errors --modversion libusb 2>/dev/null`"
|
||||
if test "$?" = "0" -a -n "${LIBUSB_VERSION}"; then
|
||||
CFLAGS="`pkg-config --silence-errors --cflags libusb 2>/dev/null`"
|
||||
LIBS="`pkg-config --silence-errors --libs libusb 2>/dev/null`"
|
||||
else
|
||||
AC_MSG_CHECKING(via libusb-config)
|
||||
LIBUSB_VERSION="`libusb-config --version 2>/dev/null`"
|
||||
if test "$?" = "0" -a -n "${LIBUSB_VERSION}"; then
|
||||
CFLAGS="`libusb-config --cflags 2>/dev/null`"
|
||||
LIBS="`libusb-config --libs 2>/dev/null`"
|
||||
else
|
||||
dnl Magic-format string to hold chosen libusb version and its config-source
|
||||
nut_usb_lib=""
|
||||
|
||||
dnl TOTHINK: What if there are more than 0.1 and 1.0 to juggle?
|
||||
dnl TODO? Add libusb-compat (1.0 code with 0.1's API) to the mix?
|
||||
AS_IF([test x"$have_PKG_CONFIG" = xyes],
|
||||
[AC_MSG_CHECKING([for libusb-1.0 version via pkg-config])
|
||||
LIBUSB_1_0_VERSION="`$PKG_CONFIG --silence-errors --modversion libusb-1.0 2>/dev/null`" \
|
||||
&& test -n "${LIBUSB_1_0_VERSION}" \
|
||||
|| LIBUSB_1_0_VERSION="none"
|
||||
AC_MSG_RESULT([${LIBUSB_1_0_VERSION} found])
|
||||
|
||||
AC_MSG_CHECKING([for libusb(-0.1) version via pkg-config])
|
||||
LIBUSB_0_1_VERSION="`$PKG_CONFIG --silence-errors --modversion libusb 2>/dev/null`" \
|
||||
&& test -n "${LIBUSB_0_1_VERSION}" \
|
||||
|| LIBUSB_0_1_VERSION="none"
|
||||
AC_MSG_RESULT([${LIBUSB_0_1_VERSION} found])
|
||||
],
|
||||
[LIBUSB_0_1_VERSION="none"
|
||||
LIBUSB_1_0_VERSION="none"
|
||||
AC_MSG_NOTICE([can not check libusb settings via pkg-config])
|
||||
]
|
||||
)
|
||||
|
||||
dnl Note: it seems the script was only shipped for libusb-0.1
|
||||
dnl So we don't separate into LIBUSB_0_1_CONFIG and LIBUSB_1_0_CONFIG
|
||||
AC_PATH_PROGS([LIBUSB_CONFIG], [libusb-config], [none])
|
||||
|
||||
AC_ARG_WITH(libusb-config,
|
||||
AS_HELP_STRING([@<:@--with-libusb-config=/path/to/libusb-config@:>@],
|
||||
[path to program that reports LibUSB configuration]), dnl ...for LibUSB-0.1
|
||||
[
|
||||
AS_CASE(["${withval}"],
|
||||
[""], [], dnl empty arg
|
||||
[yes|no], [
|
||||
dnl MAYBE bump preference of script over pkg-config?
|
||||
AC_MSG_ERROR([invalid option --with(out)-libusb-config - see docs/configure.txt])
|
||||
],
|
||||
[dnl default
|
||||
LIBUSB_CONFIG="${withval}"
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
AS_IF([test x"${LIBUSB_CONFIG}" != xnone],
|
||||
[AC_MSG_CHECKING([via ${LIBUSB_CONFIG}])
|
||||
LIBUSB_CONFIG_VERSION="`$LIBUSB_CONFIG --version 2>/dev/null`" \
|
||||
&& test -n "${LIBUSB_CONFIG_VERSION}" \
|
||||
|| LIBUSB_CONFIG_VERSION="none"
|
||||
AC_MSG_RESULT([${LIBUSB_CONFIG_VERSION} found])
|
||||
], [LIBUSB_CONFIG_VERSION="none"]
|
||||
)
|
||||
|
||||
dnl By default, prefer newest available, and if anything is known
|
||||
dnl to pkg-config, prefer that. Otherwise, fall back to script data:
|
||||
AS_IF([test x"${LIBUSB_1_0_VERSION}" != xnone],
|
||||
[LIBUSB_VERSION="${LIBUSB_1_0_VERSION}"
|
||||
nut_usb_lib="(libusb-1.0)"
|
||||
],
|
||||
[AS_IF([test x"${LIBUSB_0_1_VERSION}" != xnone],
|
||||
[LIBUSB_VERSION="${LIBUSB_0_1_VERSION}"
|
||||
nut_usb_lib="(libusb-0.1)"
|
||||
],
|
||||
[LIBUSB_VERSION="${LIBUSB_CONFIG_VERSION}"
|
||||
AS_IF([test x"${LIBUSB_CONFIG_VERSION}" != xnone],
|
||||
[dnl TODO: This assumes 0.1; check for 1.0+ somehow?
|
||||
nut_usb_lib="(libusb-0.1-config)"],
|
||||
[nut_usb_lib=""]
|
||||
)]
|
||||
)]
|
||||
)
|
||||
|
||||
dnl Pick up the default or caller-provided choice here from
|
||||
dnl NUT_ARG_WITH(usb, ...) in the main configure.ac script
|
||||
AC_MSG_CHECKING([for libusb preferred version])
|
||||
AS_CASE(["${nut_with_usb}"],
|
||||
[auto], [], dnl Use preference picked above
|
||||
[yes], [], dnl Use preference from above, fail in the end if none found
|
||||
[no], [], dnl Try to find, report in the end if that is discarded; TODO: not waste time?
|
||||
[libusb-1.0|1.0], [
|
||||
dnl NOTE: Assuming there is no libusb-config-1.0 or similar script, never saw one
|
||||
AS_IF([test x"${LIBUSB_1_0_VERSION}" = xnone],
|
||||
[AC_MSG_ERROR([option --with-usb=${withval} was required, but this library version was not detected])
|
||||
])
|
||||
LIBUSB_VERSION="${LIBUSB_1_0_VERSION}"
|
||||
nut_usb_lib="(libusb-1.0)"
|
||||
],
|
||||
[libusb-0.1|0.1], [
|
||||
AS_IF([test x"${LIBUSB_0_1_VERSION}" = xnone \
|
||||
&& test x"${LIBUSB_CONFIG_VERSION}" = xnone],
|
||||
[AC_MSG_ERROR([option --with-usb=${withval} was required, but this library version was not detected])
|
||||
])
|
||||
AS_IF([test x"${LIBUSB_0_1_VERSION}" != xnone],
|
||||
[LIBUSB_VERSION="${LIBUSB_0_1_VERSION}"
|
||||
nut_usb_lib="(libusb-0.1)"
|
||||
],
|
||||
[LIBUSB_VERSION="${LIBUSB_CONFIG_VERSION}"
|
||||
nut_usb_lib="(libusb-0.1-config)"
|
||||
])
|
||||
],
|
||||
[dnl default
|
||||
AC_MSG_ERROR([invalid option value --with-usb=${withval} - see docs/configure.txt])
|
||||
]
|
||||
)
|
||||
AC_MSG_RESULT([${LIBUSB_VERSION} ${nut_usb_lib}])
|
||||
|
||||
AS_IF([test x"${LIBUSB_1_0_VERSION}" != xnone && test x"${nut_usb_lib}" != x"(libusb-1.0)" ],
|
||||
[AC_MSG_NOTICE([libusb-1.0 support was detected, but another was chosen ${nut_usb_lib}])]
|
||||
)
|
||||
|
||||
dnl FIXME? Detect and report all CFLAGS/LIBS that we can,
|
||||
dnl and *then* pick one set of values to use?
|
||||
AS_CASE([${nut_usb_lib}],
|
||||
["(libusb-1.0)"], [
|
||||
CFLAGS="`$PKG_CONFIG --silence-errors --cflags libusb-1.0 2>/dev/null`"
|
||||
LIBS="`$PKG_CONFIG --silence-errors --libs libusb-1.0 2>/dev/null`"
|
||||
],
|
||||
["(libusb-0.1)"], [
|
||||
CFLAGS="`$PKG_CONFIG --silence-errors --cflags libusb 2>/dev/null`"
|
||||
LIBS="`$PKG_CONFIG --silence-errors --libs libusb 2>/dev/null`"
|
||||
],
|
||||
["(libusb-0.1-config)"], [
|
||||
CFLAGS="`$LIBUSB_CONFIG --cflags 2>/dev/null`"
|
||||
LIBS="`$LIBUSB_CONFIG --libs 2>/dev/null`"
|
||||
],
|
||||
[dnl default, for other versions or "none"
|
||||
AC_MSG_WARN([Defaulting libusb configuration])
|
||||
LIBUSB_VERSION="none"
|
||||
CFLAGS=""
|
||||
LIBS="-lusb"
|
||||
fi
|
||||
fi
|
||||
AC_MSG_RESULT(${LIBUSB_VERSION} found)
|
||||
]
|
||||
)
|
||||
|
||||
dnl check optional user-provided values for cflags/ldflags
|
||||
dnl and publish what we end up using
|
||||
AC_MSG_CHECKING(for libusb cflags)
|
||||
AC_ARG_WITH(usb-includes,
|
||||
AS_HELP_STRING([@<:@--with-usb-includes=CFLAGS@:>@], [include flags for the libusb library]),
|
||||
[
|
||||
case "${withval}" in
|
||||
yes|no)
|
||||
AC_MSG_ERROR(invalid option --with(out)-usb-includes - see docs/configure.txt)
|
||||
;;
|
||||
*)
|
||||
CFLAGS="${withval}"
|
||||
;;
|
||||
esac
|
||||
AS_CASE(["${withval}"],
|
||||
[yes|no], [
|
||||
AC_MSG_ERROR(invalid option --with(out)-usb-includes - see docs/configure.txt)
|
||||
],
|
||||
[dnl default
|
||||
CFLAGS="${withval}"
|
||||
]
|
||||
)
|
||||
], [])
|
||||
AC_MSG_RESULT([${CFLAGS}])
|
||||
|
||||
|
@ -50,28 +175,159 @@ if test -z "${nut_have_libusb_seen}"; then
|
|||
AC_ARG_WITH(usb-libs,
|
||||
AS_HELP_STRING([@<:@--with-usb-libs=LIBS@:>@], [linker flags for the libusb library]),
|
||||
[
|
||||
case "${withval}" in
|
||||
yes|no)
|
||||
AC_MSG_ERROR(invalid option --with(out)-usb-libs - see docs/configure.txt)
|
||||
;;
|
||||
*)
|
||||
LIBS="${withval}"
|
||||
;;
|
||||
esac
|
||||
AS_CASE(["${withval}"],
|
||||
[yes|no], [
|
||||
AC_MSG_ERROR(invalid option --with(out)-usb-libs - see docs/configure.txt)
|
||||
],
|
||||
[dnl default
|
||||
LIBS="${withval}"
|
||||
]
|
||||
)
|
||||
], [])
|
||||
AC_MSG_RESULT([${LIBS}])
|
||||
|
||||
dnl check if libusb is usable
|
||||
AC_CHECK_HEADERS(usb.h, [nut_have_libusb=yes], [nut_have_libusb=no], [AC_INCLUDES_DEFAULT])
|
||||
AC_CHECK_FUNCS(usb_init, [], [nut_have_libusb=no])
|
||||
dnl TODO: Consult chosen nut_usb_lib value and/or nut_with_usb argument
|
||||
dnl (with "auto" we may use a 0.1 if present and working while a 1.0 is
|
||||
dnl present but useless)
|
||||
dnl Check if libusb is usable
|
||||
AC_LANG_PUSH([C])
|
||||
if test -n "${LIBUSB_VERSION}"; then
|
||||
dnl Test specifically for libusb-1.0 via pkg-config, else fall back below
|
||||
test -n "$PKG_CONFIG" \
|
||||
&& test x"${nut_usb_lib}" = x"(libusb-1.0)" \
|
||||
&& $PKG_CONFIG --silence-errors --atleast-version=1.0 libusb-1.0 2>/dev/null
|
||||
if test "$?" = "0"; then
|
||||
dnl libusb 1.0: libusb_set_auto_detach_kernel_driver
|
||||
AC_CHECK_HEADERS(libusb.h, [nut_have_libusb=yes], [nut_have_libusb=no], [AC_INCLUDES_DEFAULT])
|
||||
AC_CHECK_FUNCS(libusb_init, [], [nut_have_libusb=no])
|
||||
AC_CHECK_FUNCS(libusb_strerror, [], [nut_have_libusb=no; nut_have_libusb_strerror=no])
|
||||
if test "${nut_have_libusb_strerror}" = "no"; then
|
||||
AC_MSG_WARN([libusb_strerror() not found; install libusbx to use libusb 1.0 API. See https://github.com/networkupstools/nut/issues/509])
|
||||
fi
|
||||
if test "${nut_have_libusb}" = "yes"; then
|
||||
dnl This function is fairly old, but check for it anyway:
|
||||
AC_CHECK_FUNCS(libusb_kernel_driver_active)
|
||||
dnl Check for libusb "force driver unbind" availability
|
||||
AC_CHECK_FUNCS(libusb_set_auto_detach_kernel_driver)
|
||||
dnl libusb 1.0: libusb_detach_kernel_driver
|
||||
dnl FreeBSD 10.1-10.3 have this, but not libusb_set_auto_detach_kernel_driver
|
||||
AC_CHECK_FUNCS(libusb_detach_kernel_driver)
|
||||
AC_CHECK_FUNCS(libusb_detach_kernel_driver_np)
|
||||
|
||||
if test "${nut_have_libusb}" = "yes"; then
|
||||
dnl Check for libusb "force driver unbind" availability
|
||||
AC_CHECK_FUNCS(usb_detach_kernel_driver_np)
|
||||
dnl From libusb-0.1 - check these to have valid config.h definitions
|
||||
dnl Note: confusingly, FreeBSD does find both as defined
|
||||
dnl (despite being spread across usb.h and libusb.h),
|
||||
dnl so our source code has to care :\
|
||||
AC_CHECK_FUNCS(usb_detach_kernel_driver_np)
|
||||
fi
|
||||
else
|
||||
dnl libusb 0.1, or missing pkg-config :
|
||||
AC_CHECK_HEADERS(usb.h, [nut_have_libusb=yes], [nut_have_libusb=no], [AC_INCLUDES_DEFAULT])
|
||||
AC_CHECK_FUNCS(usb_init, [], [
|
||||
dnl Some systems may just have libusb in their standard
|
||||
dnl paths, but not the pkg-config or libusb-config data
|
||||
AS_IF([test "${nut_have_libusb}" = "yes" && test "$LIBUSB_VERSION" = "none" && test -z "$LIBS"],
|
||||
[AC_MSG_CHECKING([if libusb is just present in path])
|
||||
LIBS="-L/usr/lib -L/usr/local/lib -lusb"
|
||||
unset ac_cv_func_usb_init || true
|
||||
AC_CHECK_FUNCS(usb_init, [], [nut_have_libusb=no])
|
||||
AC_MSG_RESULT([${nut_have_libusb}])
|
||||
], [nut_have_libusb=no]
|
||||
)]
|
||||
)
|
||||
dnl Check for libusb "force driver unbind" availability
|
||||
if test "${nut_have_libusb}" = "yes"; then
|
||||
AC_CHECK_FUNCS(usb_detach_kernel_driver_np)
|
||||
|
||||
dnl From libusb-1.0 - check these to have valid config.h definitions
|
||||
AC_CHECK_FUNCS(libusb_kernel_driver_active)
|
||||
AC_CHECK_FUNCS(libusb_set_auto_detach_kernel_driver)
|
||||
AC_CHECK_FUNCS(libusb_detach_kernel_driver)
|
||||
AC_CHECK_FUNCS(libusb_detach_kernel_driver_np)
|
||||
fi
|
||||
fi
|
||||
else
|
||||
nut_have_libusb=no
|
||||
fi
|
||||
|
||||
AS_IF([test "${nut_have_libusb}" = "yes"], [
|
||||
dnl ----------------------------------------------------------------------
|
||||
dnl additional USB-related checks
|
||||
|
||||
dnl Solaris 10/11 USB handling (need librt and libusb runtime path)
|
||||
dnl Should we check for `uname -o == illumos` to avoid legacy here?
|
||||
dnl Or better yet, perform some active capability tests for need of
|
||||
dnl workarounds or not? e.g. OpenIndiana should include a capable
|
||||
dnl version of libusb-1.0.23+ tailored with NUT tests in mind...
|
||||
dnl HPUX, since v11, needs an explicit activation of pthreads
|
||||
dnl TODO: There are reports about FreeBSD error-code
|
||||
dnl handling in libusb-0.1 port returning "-1" always,
|
||||
dnl instead of differing codes like on other systems.
|
||||
dnl Should we check for that below?..
|
||||
dnl https://github.com/networkupstools/nut/issues/490
|
||||
AS_CASE(["${target_os}"],
|
||||
[solaris2.1*], [
|
||||
AC_MSG_CHECKING([for Solaris 10 / 11 specific configuration for usb drivers])
|
||||
AC_SEARCH_LIBS(nanosleep, rt)
|
||||
LIBS="-R/usr/sfw/lib ${LIBS}"
|
||||
dnl FIXME: Sun's libusb doesn't support timeout (so blocks notification)
|
||||
dnl and need to call libusb close upon reconnection
|
||||
dnl TODO: Somehow test for susceptible versions?
|
||||
AC_DEFINE(SUN_LIBUSB, 1, [Define to 1 for Sun version of the libusb.])
|
||||
SUN_LIBUSB=1
|
||||
AC_MSG_RESULT([${LIBS}])
|
||||
],
|
||||
[hpux11*], [
|
||||
CFLAGS="${CFLAGS} -lpthread"
|
||||
]
|
||||
)
|
||||
])
|
||||
AC_LANG_POP([C])
|
||||
|
||||
AS_IF([test "${nut_have_libusb}" = "yes"], [
|
||||
LIBUSB_CFLAGS="${CFLAGS}"
|
||||
LIBUSB_LIBS="${LIBS}"
|
||||
], [
|
||||
AS_CASE(["${nut_with_usb}"],
|
||||
[no|auto], [],
|
||||
[yes|1.0|0.1|libusb-1.0|libusb-0.1],
|
||||
[dnl Explicitly choosing a library implies 'yes' (i.e. fail if not found), not 'auto'.
|
||||
AC_MSG_ERROR([USB drivers requested, but libusb not found.])
|
||||
]
|
||||
)
|
||||
])
|
||||
|
||||
if test "${nut_with_usb}" = "no"; then
|
||||
if test -n "${nut_usb_lib}" && test "${nut_usb_lib}" != none ; then
|
||||
AC_MSG_NOTICE([libusb was detected ${nut_usb_lib}, but a build without USB drivers was requested])
|
||||
fi
|
||||
nut_usb_lib=""
|
||||
else
|
||||
nut_with_usb="${nut_have_libusb}"
|
||||
fi
|
||||
|
||||
dnl AC_MSG_NOTICE([DEBUG: nut_have_libusb='${nut_have_libusb}'])
|
||||
dnl AC_MSG_NOTICE([DEBUG: nut_with_usb='${nut_with_usb}'])
|
||||
dnl AC_MSG_NOTICE([DEBUG: nut_usb_lib='${nut_usb_lib}'])
|
||||
|
||||
dnl Note: AC_DEFINE specifies a verbatim "value" so we pre-calculate it!
|
||||
dnl Source code should be careful to use "#if" and not "#ifdef" when
|
||||
dnl checking these values during the build. And both must be defined
|
||||
dnl with some value.
|
||||
AS_IF([test "${nut_with_usb}" = "yes" && test "${nut_usb_lib}" = "(libusb-1.0)"],
|
||||
[AC_DEFINE([WITH_LIBUSB_1_0], [1],
|
||||
[Define to 1 for version 1.0 of the libusb (via pkg-config).])],
|
||||
[AC_DEFINE([WITH_LIBUSB_1_0], [0],
|
||||
[Define to 1 for version 1.0 of the libusb (via pkg-config).])]
|
||||
)
|
||||
|
||||
AS_IF([test "${nut_with_usb}" = "yes" && test "${nut_usb_lib}" = "(libusb-0.1)" -o "${nut_usb_lib}" = "(libusb-0.1-config)"],
|
||||
[AC_DEFINE([WITH_LIBUSB_0_1], [1],
|
||||
[Define to 1 for version 0.1 of the libusb (via pkg-config or libusb-config).])],
|
||||
[AC_DEFINE([WITH_LIBUSB_0_1], [0],
|
||||
[Define to 1 for version 0.1 of the libusb (via pkg-config or libusb-config).])]
|
||||
)
|
||||
|
||||
dnl restore original CFLAGS and LIBS
|
||||
CFLAGS="${CFLAGS_ORIG}"
|
||||
LIBS="${LIBS_ORIG}"
|
||||
|
|
|
@ -18,6 +18,7 @@ if test -z "${nut_have_libwrap_seen}"; then
|
|||
dnl The line below does not work on Solaris 10.
|
||||
dnl AC_SEARCH_LIBS(request_init, wrap, [], [nut_have_libwrap=no])
|
||||
AC_MSG_CHECKING(for library containing request_init)
|
||||
AC_LANG_PUSH([C])
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||
#include <tcpd.h>
|
||||
int allow_severity = 0, deny_severity = 0;
|
||||
|
@ -35,6 +36,7 @@ int allow_severity = 0, deny_severity = 0;
|
|||
nut_have_libwrap=no
|
||||
])
|
||||
])
|
||||
AC_LANG_POP([C])
|
||||
|
||||
if test "${nut_have_libwrap}" = "yes"; then
|
||||
AC_DEFINE(HAVE_WRAP, 1, [Define to enable libwrap support])
|
||||
|
|
91
m4/nut_check_pkgconfig.m4
Normal file
91
m4/nut_check_pkgconfig.m4
Normal file
|
@ -0,0 +1,91 @@
|
|||
dnl Check for LIBPOWERMAN compiler flags. On success, set nut_have_libpowerman="yes"
|
||||
dnl and set LIBPOWERMAN_CFLAGS and LIBPOWERMAN_LIBS. On failure, set
|
||||
dnl nut_have_libpowerman="no". This macro can be run multiple times, but will
|
||||
dnl do the checking only once.
|
||||
|
||||
AC_DEFUN([NUT_CHECK_PKGCONFIG],
|
||||
[
|
||||
AS_IF([test -z "${nut_have_pkg_config_seen}"], [
|
||||
nut_have_pkg_config_seen=yes
|
||||
|
||||
dnl Note that PKG_CONFIG may be a filename, path,
|
||||
dnl or either with args - so no quoting here
|
||||
AC_MSG_CHECKING([whether usable PKG_CONFIG was already detected by autoconf])
|
||||
AS_IF([test -n "${PKG_CONFIG-}" && test x"${PKG_CONFIG-}" != x"false" && $PKG_CONFIG --help 2>&1 | grep -E '(--cflags|--libs)' >/dev/null],
|
||||
[AC_MSG_RESULT([yes: ${PKG_CONFIG}])
|
||||
have_PKG_CONFIG=yes
|
||||
],
|
||||
[AC_MSG_RESULT([no])
|
||||
PKG_CONFIG=false
|
||||
have_PKG_CONFIG=no
|
||||
]
|
||||
)
|
||||
|
||||
AS_IF([test x"${PKG_CONFIG-}" = x"false"],
|
||||
[dnl Some systems have older autotools without direct macro support for PKG_CONF*
|
||||
have_PKG_CONFIG=yes
|
||||
AC_PATH_PROG(dummy_PKG_CONFIG, pkg-config)
|
||||
|
||||
AC_ARG_WITH(pkg-config,
|
||||
AS_HELP_STRING([@<:@--with-pkg-config=/path/to/gdlib-config@:>@],
|
||||
[path to program that reports development package configuration]),
|
||||
[
|
||||
case "${withval}" in
|
||||
"") ;;
|
||||
yes|no)
|
||||
AC_MSG_ERROR(invalid option --with(out)-pkg-config - see docs/configure.txt)
|
||||
;;
|
||||
*)
|
||||
dummy_PKG_CONFIG="${withval}"
|
||||
;;
|
||||
esac
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([whether usable PKG_CONFIG is present in PATH or was set by caller])
|
||||
AS_IF([test x"$dummy_PKG_CONFIG" = xno || test -z "$dummy_PKG_CONFIG"],
|
||||
[AC_MSG_RESULT([no])
|
||||
PKG_CONFIG=false
|
||||
have_PKG_CONFIG=no
|
||||
],
|
||||
[AS_IF([$dummy_PKG_CONFIG --help 2>&1 | grep -E '(--cflags|--libs)' >/dev/null],
|
||||
[AC_MSG_RESULT([yes: ${dummy_PKG_CONFIG}])
|
||||
have_PKG_CONFIG=yes
|
||||
PKG_CONFIG="$dummy_PKG_CONFIG"
|
||||
],
|
||||
[AC_MSG_RESULT([no])
|
||||
PKG_CONFIG=false
|
||||
have_PKG_CONFIG=no
|
||||
]
|
||||
)]
|
||||
)]
|
||||
)
|
||||
|
||||
have_PKG_CONFIG_MACROS=no
|
||||
AS_IF([test x"$have_PKG_CONFIG" = xyes],
|
||||
[AC_MSG_NOTICE([checking for autoconf macro support of pkg-config (${PKG_CONFIG})])
|
||||
dummy_RES=0
|
||||
ifdef([PKG_PROG_PKG_CONFIG], [], [dummy_RES=1])
|
||||
ifdef([PKG_CHECK_MODULES], [], [dummy_RES=2])
|
||||
AS_IF([test "${dummy_RES}" = 0],
|
||||
[AC_MSG_NOTICE([checking for autoconf macro support of pkg-config module checker])
|
||||
dnl The m4 macro below may be not defined if pkg-config package is not
|
||||
dnl installed. Use of ifdef (here and below for e.g. CPPUNIT check)
|
||||
dnl allows to avoid shell syntax errors in generated configure script
|
||||
dnl by defining a dummy macro in-place.
|
||||
ifdef([PKG_CHECK_MODULES], [], [AC_DEFUN([PKG_CHECK_MODULES], [false])])
|
||||
PKG_CHECK_MODULES([dummy_PKG_CONFIG], [pkg-config], [have_PKG_CONFIG_MACROS=yes])
|
||||
]
|
||||
)]
|
||||
)
|
||||
|
||||
AS_IF([test x"$have_PKG_CONFIG" = xno],
|
||||
[AC_MSG_WARN([pkg-config program is needed to look for further dependencies (will be skipped)])
|
||||
PKG_CONFIG="false"
|
||||
],
|
||||
[AS_IF([test x"$have_PKG_CONFIG_MACROS" = xno],
|
||||
[AC_MSG_WARN([pkg-config macros are needed to look for further dependencies, but in some cases pkg-config program can be used directly])]
|
||||
)]
|
||||
)
|
||||
|
||||
]) dnl if nut_have_pkg_config_seen
|
||||
])
|
128
m4/nut_check_python.m4
Normal file
128
m4/nut_check_python.m4
Normal file
|
@ -0,0 +1,128 @@
|
|||
dnl Check for python binary program names per language version
|
||||
dnl to embed into scripts and Make rules
|
||||
|
||||
AC_DEFUN([NUT_CHECK_PYTHON],
|
||||
[
|
||||
AS_IF([test -z "${nut_with_python}"], [
|
||||
NUT_ARG_WITH([python], [Use a particular program name of the python interpeter], [auto])
|
||||
|
||||
PYTHON=""
|
||||
AS_CASE([${nut_with_python}],
|
||||
[auto|yes|""], [AC_CHECK_PROGS([PYTHON], [python python3 python2], [_python_runtime])],
|
||||
[no], [PYTHON="no"],
|
||||
[PYTHON="${nut_with_python}"]
|
||||
)
|
||||
|
||||
dnl Default to calling a basename from PATH, only use a specific full pathname
|
||||
dnl if provided by the caller:
|
||||
AS_CASE([${PYTHON}],
|
||||
[_python_runtime], [
|
||||
PYTHON="/usr/bin/env python"
|
||||
AC_MSG_WARN([A python program name was not detected during configuration, will default to '$PYTHON' (scripts will fail if that is not in PATH at run time)])],
|
||||
[no], [],
|
||||
[/*" "*" "*], [
|
||||
AC_MSG_WARN([A python program name is not a single token (was specified with more than one argument?), so shebangs can be not reliable])
|
||||
],
|
||||
[/*], [],
|
||||
[*" "*" "*], [
|
||||
AC_MSG_WARN([A python program name is not a single token (was specified with more than one argument?), so shebangs can be not reliable])
|
||||
PYTHON="/usr/bin/env ${PYTHON}"
|
||||
],
|
||||
[*" "*], [
|
||||
AC_MSG_WARN([A python program name is not a single token (was specified with an argument?), so /usr/bin/env shebangs can be not reliable])
|
||||
PYTHON="/usr/bin/env ${PYTHON}"
|
||||
],
|
||||
[*], [PYTHON="/usr/bin/env ${PYTHON}"]
|
||||
)
|
||||
|
||||
AC_MSG_CHECKING([python interpeter to call])
|
||||
AC_MSG_RESULT([${PYTHON}])
|
||||
AC_SUBST([PYTHON], [${PYTHON}])
|
||||
AM_CONDITIONAL([HAVE_PYTHON], [test "${PYTHON}" != "no"])
|
||||
AS_IF([test -n "${PYTHON}"], [export PYTHON])
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([NUT_CHECK_PYTHON2],
|
||||
[
|
||||
AS_IF([test -z "${nut_with_python2}"], [
|
||||
NUT_ARG_WITH([python2], [Use a particular program name of the python2 interpeter for code that needs that version and is not compatible with python3], [auto])
|
||||
|
||||
PYTHON2=""
|
||||
AS_CASE([${nut_with_python2}],
|
||||
[auto|yes|""], [AC_CHECK_PROGS([PYTHON2], [python2 python2.7 python-2.7 python], [_python2_runtime])],
|
||||
[no], [PYTHON2="no"],
|
||||
[PYTHON2="${nut_with_python2}"]
|
||||
)
|
||||
|
||||
dnl Default to calling a basename from PATH, only use a specific full pathname
|
||||
dnl if provided by the caller:
|
||||
AS_CASE([${PYTHON2}],
|
||||
[_python2_runtime], [
|
||||
PYTHON2="/usr/bin/env python2"
|
||||
AC_MSG_WARN([A python2 program name was not detected during configuration, will default to '$PYTHON2' (scripts will fail if that is not in PATH at run time)])],
|
||||
[no], [],
|
||||
[/*" "*" "*], [
|
||||
AC_MSG_WARN([A python2 program name is not a single token (was specified with more than one argument?), so shebangs can be not reliable])
|
||||
],
|
||||
[/*], [],
|
||||
[*" "*" "*], [
|
||||
AC_MSG_WARN([A python2 program name is not a single token (was specified with more than one argument?), so shebangs can be not reliable])
|
||||
PYTHON2="/usr/bin/env ${PYTHON2}"
|
||||
],
|
||||
[*" "*], [
|
||||
AC_MSG_WARN([A python2 program name is not a single token (was specified with an argument?), so /usr/bin/env shebangs can be not reliable])
|
||||
PYTHON2="/usr/bin/env ${PYTHON2}"
|
||||
],
|
||||
[*], [PYTHON2="/usr/bin/env ${PYTHON2}"]
|
||||
)
|
||||
|
||||
AC_MSG_CHECKING([python2 interpeter to call])
|
||||
AC_MSG_RESULT([${PYTHON2}])
|
||||
AC_SUBST([PYTHON2], [${PYTHON2}])
|
||||
AM_CONDITIONAL([HAVE_PYTHON2], [test "${PYTHON2}" != "no"])
|
||||
AS_IF([test -n "${PYTHON2}"], [export PYTHON2])
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([NUT_CHECK_PYTHON3],
|
||||
[
|
||||
AS_IF([test -z "${nut_with_python3}"], [
|
||||
NUT_ARG_WITH([python3], [Use a particular program name of the python3 interpeter for code that needs that version and is not compatible with python2], [auto])
|
||||
|
||||
PYTHON3=""
|
||||
AS_CASE([${nut_with_python3}],
|
||||
[auto|yes|""], [AC_CHECK_PROGS([PYTHON3], [python3 python3.9 python-3.9 python3.7 python-3.7 python3.5 python-3.5 python], [_python3_runtime])],
|
||||
[no], [PYTHON3="no"],
|
||||
[PYTHON3="${nut_with_python3}"]
|
||||
)
|
||||
|
||||
dnl Default to calling a basename from PATH, only use a specific full pathname
|
||||
dnl if provided by the caller:
|
||||
AS_CASE([${PYTHON3}],
|
||||
[_python3_runtime], [
|
||||
PYTHON3="/usr/bin/env python3"
|
||||
AC_MSG_WARN([A python3 program name was not detected during configuration, will default to '$PYTHON3' (scripts will fail if that is not in PATH at run time)])],
|
||||
[no], [],
|
||||
[/*" "*" "*], [
|
||||
AC_MSG_WARN([A python3 program name is not a single token (was specified with more than one argument?), so shebangs can be not reliable])
|
||||
],
|
||||
[/*], [],
|
||||
[*" "*" "*], [
|
||||
AC_MSG_WARN([A python3 program name is not a single token (was specified with more than one argument?), so shebangs can be not reliable])
|
||||
PYTHON3="/usr/bin/env ${PYTHON3}"
|
||||
],
|
||||
[*" "*], [
|
||||
AC_MSG_WARN([A python3 program name is not a single token (was specified with an argument?), so /usr/bin/env shebangs can be not reliable])
|
||||
PYTHON3="/usr/bin/env ${PYTHON3}"
|
||||
],
|
||||
[*], [PYTHON3="/usr/bin/env ${PYTHON3}"]
|
||||
)
|
||||
|
||||
AC_MSG_CHECKING([python3 interpeter to call])
|
||||
AC_MSG_RESULT([${PYTHON3}])
|
||||
AC_SUBST([PYTHON3], [${PYTHON3}])
|
||||
AM_CONDITIONAL([HAVE_PYTHON3], [test "${PYTHON3}" != "no"])
|
||||
AS_IF([test -n "${PYTHON3}"], [export PYTHON3])
|
||||
])
|
||||
])
|
241
m4/nut_compiler_family.m4
Normal file
241
m4/nut_compiler_family.m4
Normal file
|
@ -0,0 +1,241 @@
|
|||
dnl detect if current compiler is clang or gcc (or...)
|
||||
|
||||
AC_DEFUN([NUT_COMPILER_FAMILY],
|
||||
[
|
||||
AC_CACHE_CHECK([if CC compiler family is GCC],
|
||||
[nut_cv_GCC],
|
||||
[AS_IF([test -n "$CC"],
|
||||
[AS_IF([$CC --version 2>&1 | grep 'Free Software Foundation' > /dev/null],
|
||||
[nut_cv_GCC=yes],[nut_cv_GCC=no])],
|
||||
[AC_MSG_ERROR([CC is not set])]
|
||||
)])
|
||||
|
||||
AC_CACHE_CHECK([if CXX compiler family is GCC],
|
||||
[nut_cv_GXX],
|
||||
[AS_IF([test -n "$CXX"],
|
||||
[AS_IF([$CXX --version 2>&1 | grep 'Free Software Foundation' > /dev/null],
|
||||
[nut_cv_GXX=yes],[nut_cv_GXX=no])],
|
||||
[AC_MSG_ERROR([CXX is not set])]
|
||||
)])
|
||||
|
||||
AC_CACHE_CHECK([if CPP preprocessor family is GCC],
|
||||
[nut_cv_GPP],
|
||||
[AS_IF([test -n "$CPP"],
|
||||
[AS_IF([$CPP --version 2>&1 | grep 'Free Software Foundation' > /dev/null],
|
||||
[nut_cv_GPP=yes],[nut_cv_GPP=no])],
|
||||
[AC_MSG_ERROR([CPP is not set])]
|
||||
)])
|
||||
|
||||
AS_IF([test "x$GCC" = "x" && test "$nut_cv_GCC" = yes], [GCC=yes])
|
||||
AS_IF([test "x$GXX" = "x" && test "$nut_cv_GXX" = yes], [GXX=yes])
|
||||
AS_IF([test "x$GPP" = "x" && test "$nut_cv_GPP" = yes], [GPP=yes])
|
||||
|
||||
AC_CACHE_CHECK([if CC compiler family is clang],
|
||||
[nut_cv_CLANGCC],
|
||||
[AS_IF([test -n "$CC"],
|
||||
[AS_IF([$CC --version 2>&1 | grep -E '(clang version|Apple LLVM version .*clang-)' > /dev/null],
|
||||
[nut_cv_CLANGCC=yes],[nut_cv_CLANGCC=no])],
|
||||
[AC_MSG_ERROR([CC is not set])]
|
||||
)])
|
||||
|
||||
AC_CACHE_CHECK([if CXX compiler family is clang],
|
||||
[nut_cv_CLANGXX],
|
||||
[AS_IF([test -n "$CXX"],
|
||||
[AS_IF([$CXX --version 2>&1 | grep -E '(clang version|Apple LLVM version .*clang-)' > /dev/null],
|
||||
[nut_cv_CLANGXX=yes],[nut_cv_CLANGXX=no])],
|
||||
[AC_MSG_ERROR([CXX is not set])]
|
||||
)])
|
||||
|
||||
AC_CACHE_CHECK([if CPP preprocessor family is clang],
|
||||
[nut_cv_CLANGPP],
|
||||
[AS_IF([test -n "$CPP"],
|
||||
[AS_IF([$CPP --version 2>&1 | grep -E '(clang version|Apple LLVM version .*clang-)' > /dev/null],
|
||||
[nut_cv_CLANGPP=yes],[nut_cv_CLANGPP=no])],
|
||||
[AC_MSG_ERROR([CPP is not set])]
|
||||
)])
|
||||
|
||||
AS_IF([test "x$CLANGCC" = "x" && test "$nut_cv_CLANGCC" = yes], [CLANGCC=yes])
|
||||
AS_IF([test "x$CLANGXX" = "x" && test "$nut_cv_CLANGXX" = yes], [CLANGXX=yes])
|
||||
AS_IF([test "x$CLANGPP" = "x" && test "$nut_cv_CLANGPP" = yes], [CLANGPP=yes])
|
||||
])
|
||||
|
||||
AC_DEFUN([NUT_CHECK_COMPILE_FLAG],
|
||||
[
|
||||
dnl Note: with this line uncommented, builds report
|
||||
dnl sed: 0: conftest.c: No such file or directory
|
||||
dnl so seemingly try to parse the method without args:
|
||||
dnl### AC_REQUIRE([AX_RUN_OR_LINK_IFELSE])
|
||||
|
||||
dnl Note: per https://stackoverflow.com/questions/52557417/how-to-check-support-compile-flag-in-autoconf-for-clang
|
||||
dnl the -Werror below is needed to detect "warnings" about unsupported options
|
||||
COMPILERFLAG="$1"
|
||||
|
||||
dnl We also try to run an actual build since tools called from that might
|
||||
dnl complain if they are forwarded unknown flags accepted by the front-end.
|
||||
SAVED_CFLAGS="$CFLAGS"
|
||||
SAVED_CXXFLAGS="$CXXFLAGS"
|
||||
|
||||
AC_LANG_PUSH([C])
|
||||
AX_CHECK_COMPILE_FLAG([${COMPILERFLAG}],
|
||||
[CFLAGS="$CFLAGS ${COMPILERFLAG}"
|
||||
AX_RUN_OR_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
|
||||
[], [CFLAGS="$SAVED_CFLAGS"])
|
||||
], [], [-Werror])
|
||||
AC_LANG_POP([C])
|
||||
|
||||
AC_LANG_PUSH([C++])
|
||||
AX_CHECK_COMPILE_FLAG([${COMPILERFLAG}],
|
||||
[CXXFLAGS="$CXXFLAGS ${COMPILERFLAG}"
|
||||
AX_RUN_OR_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
|
||||
[], [CXXFLAGS="$SAVED_CXXFLAGS"])
|
||||
], [], [-Werror])
|
||||
AC_LANG_POP([C++])
|
||||
])
|
||||
|
||||
AC_DEFUN([NUT_COMPILER_FAMILY_FLAGS],
|
||||
[
|
||||
AC_MSG_NOTICE([Detecting support for additional compiler flags])
|
||||
|
||||
dnl -Qunused-arguments:
|
||||
dnl Do not die due to `clang: error: argument unused during compilation: '-I .'`
|
||||
dnl -Wno-unknown-warning-option: Do not die (on older clang releases) due to
|
||||
dnl error: unknown warning option '-Wno-double-promotion'; did you mean
|
||||
dnl '-Wno-documentation'? [-Werror,-Wunknown-warning-option]
|
||||
dnl -fcolor-diagnostics: help find where bugs are in the wall of text (clang)
|
||||
dnl -fdiagnostics-color=ARG: help find where bugs are in the wall of text (gcc)
|
||||
|
||||
dnl First check for this to avoid failing on unused include paths etc:
|
||||
NUT_CHECK_COMPILE_FLAG([-Qunused-arguments])
|
||||
|
||||
m4_foreach_w([TESTCOMPILERFLAG], [
|
||||
-Wno-reserved-identifier
|
||||
], [
|
||||
NUT_CHECK_COMPILE_FLAG([TESTCOMPILERFLAG])
|
||||
])
|
||||
|
||||
dnl Note: each m4_foreach_w arg must be named uniquely
|
||||
dnl Note: Seems -fcolor-diagnostics is clang-only and sometimes
|
||||
dnl gcc blindly accepts it in test and fails to use later.
|
||||
AS_IF([test x"${nut_enable_Wcolor}" = xyes], [
|
||||
m4_foreach_w([TESTCOMPILERFLAG_COLOR], [
|
||||
-fdiagnostics-color=always
|
||||
], [
|
||||
NUT_CHECK_COMPILE_FLAG([TESTCOMPILERFLAG_COLOR])
|
||||
])
|
||||
], [AC_MSG_NOTICE([NOT checking for options to request colorized compiler output (pass --enable-Wcolor for that)])])
|
||||
|
||||
dnl Last check for this to avoid accepting anything regardless of support.
|
||||
dnl NOTE that some toolkit versions accept this option blindly and without
|
||||
dnl really supporting it (but not erroring out on it, either):
|
||||
dnl cc1: note: unrecognized command-line option '-Wno-unknown-warning-option'
|
||||
dnl may have been intended to silence earlier diagnostics
|
||||
NUT_CHECK_COMPILE_FLAG([-Wno-unknown-warning-option])
|
||||
|
||||
dnl # Older "brute-forced" settings:
|
||||
dnl AS_IF([test "x$CLANGCC" = xyes], [CFLAGS="$CFLAGS -Wno-unknown-warning-option"])
|
||||
dnl AS_IF([test "x$CLANGXX" = xyes], [CXXFLAGS="$CXXFLAGS -Wno-unknown-warning-option"])
|
||||
|
||||
dnl # Despite the internet lore, practical GCC versions seen so far
|
||||
dnl # (4.x-10.x) do not know of this CLI option, with varied results
|
||||
dnl # from "cc1: note: unrecognized command-line option '-Wno-unknown-warning'
|
||||
dnl # may have been intended to silence earlier diagnostics"
|
||||
dnl # to "cc1: error: unrecognized command line option '-Wno-unknown-warning'
|
||||
dnl # [-Werror]"... so we do not pass it by default:
|
||||
dnl AS_IF([test "x$GCC" = xyes], [CFLAGS="$CFLAGS -Wno-unknown-warning"])
|
||||
dnl AS_IF([test "x$GXX" = xyes], [CXXFLAGS="$CXXFLAGS -Wno-unknown-warning"])
|
||||
|
||||
dnl # There should be no need to include standard system paths (and possibly
|
||||
dnl # confuse the compiler assumptions - along with its provided headers)...
|
||||
dnl # ideally; in practice however cppunit, net-snmp and some system include
|
||||
dnl # files do cause grief to picky compiler settings (more so from third
|
||||
dnl # party packages shipped via /usr/local/... namespace):
|
||||
AS_IF([test "x$CLANGCC" = xyes -o "x$GCC" = xyes], [
|
||||
dnl # CFLAGS="-isystem /usr/include $CFLAGS"
|
||||
AS_IF([test -d /usr/local/include],
|
||||
[CFLAGS="-isystem /usr/local/include $CFLAGS"])
|
||||
AS_IF([test -d /usr/pkg/include],
|
||||
[CFLAGS="-isystem /usr/pkg/include $CFLAGS"])
|
||||
])
|
||||
AS_IF([test "x$CLANGXX" = xyes -o "x$GXX" = xyes], [
|
||||
dnl # CXXFLAGS="-isystem /usr/include $CXXFLAGS"
|
||||
AS_IF([test -d /usr/local/include],
|
||||
[CXXFLAGS="-isystem /usr/local/include $CXXFLAGS"])
|
||||
AS_IF([test -d /usr/pkg/include],
|
||||
[CXXFLAGS="-isystem /usr/pkg/include $CXXFLAGS"])
|
||||
])
|
||||
|
||||
dnl # Default to avoid noisy warnings on older compilers
|
||||
dnl # (gcc-4.x, clang-3.x) due to their preference of
|
||||
dnl # ANSI C (C89/C90) out of the box. While NUT codebase
|
||||
dnl # currently can build in that mode, reliability of
|
||||
dnl # results is uncertain - third-party and/or system
|
||||
dnl # headers and libs seemingly no longer care for C90
|
||||
dnl # on modern systems, and we have no recent data from
|
||||
dnl # truly legacy systems which have no choice.
|
||||
dnl # Some distributions and platforms also have problems
|
||||
dnl # building in "strict C" mode, so for the GNU-compatible
|
||||
dnl # compilers we default to the GNU C/C++ dialects.
|
||||
AS_IF([test "x$GCC" = xyes -o "x$CLANGCC" = xyes],
|
||||
[AS_CASE(["${CFLAGS}"], [-std=*], [],
|
||||
[AC_LANG_PUSH([C])
|
||||
AX_CHECK_COMPILE_FLAG([-std=gnu99],
|
||||
[AC_MSG_NOTICE([Defaulting C standard support to GNU C99 on a GCC or CLANG compatible compiler])
|
||||
CFLAGS="$CFLAGS -std=gnu99"
|
||||
], [], [-Werror])
|
||||
AC_LANG_POP([C])
|
||||
])
|
||||
])
|
||||
|
||||
dnl # Note: this might upset some very old compilers
|
||||
dnl # but then by default we wouldn't build C++ parts
|
||||
AS_IF([test "x$GCC" = xyes -o "x$CLANGCC" = xyes],
|
||||
[AS_CASE(["${CXXFLAGS}"], [-std=*], [],
|
||||
[AC_LANG_PUSH([C++])
|
||||
AX_CHECK_COMPILE_FLAG([-std=gnu++11],
|
||||
[AC_MSG_NOTICE([Defaulting C++ standard support to GNU C++11 on a GCC or CLANG compatible compiler])
|
||||
CXXFLAGS="$CXXFLAGS -std=gnu++11"
|
||||
], [], [-Werror])
|
||||
AC_LANG_POP([C++])
|
||||
])
|
||||
])
|
||||
|
||||
])
|
||||
|
||||
AC_DEFUN([NUT_COMPILER_FAMILY_FLAGS_DEFAULT_STANDARD],
|
||||
[
|
||||
dnl # Default to avoid noisy warnings on older compilers
|
||||
dnl # (gcc-4.x, clang-3.x) due to their preference of
|
||||
dnl # ANSI C (C89/C90) out of the box. While NUT codebase
|
||||
dnl # currently can build in that mode, reliability of
|
||||
dnl # results is uncertain - third-party and/or system
|
||||
dnl # headers and libs seemingly no longer care for C90
|
||||
dnl # on modern systems, and we have no recent data from
|
||||
dnl # truly legacy systems which have no choice.
|
||||
dnl # Some distributions and platforms also have problems
|
||||
dnl # building in "strict C" mode, so for the GNU-compatible
|
||||
dnl # compilers we default to the GNU C/C++ dialects.
|
||||
AS_IF([test "x$GCC" = xyes -o "x$CLANGCC" = xyes],
|
||||
[AS_CASE(["${CFLAGS}"], [*-std=*], [],
|
||||
[AC_LANG_PUSH([C])
|
||||
AX_CHECK_COMPILE_FLAG([-std=gnu99],
|
||||
[AC_MSG_NOTICE([Defaulting C standard support to GNU C99 on a GCC or CLANG compatible compiler])
|
||||
CFLAGS="$CFLAGS -std=gnu99"
|
||||
], [], [-Werror])
|
||||
AC_LANG_POP([C])
|
||||
])
|
||||
])
|
||||
|
||||
dnl # Note: this might upset some very old compilers
|
||||
dnl # but then by default we wouldn't build C++ parts
|
||||
AS_IF([test "x$GCC" = xyes -o "x$CLANGCC" = xyes],
|
||||
[AS_CASE(["${CXXFLAGS}"], [*-std=*], [],
|
||||
[AC_LANG_PUSH([C++])
|
||||
AX_CHECK_COMPILE_FLAG([-std=gnu++11],
|
||||
[AC_MSG_NOTICE([Defaulting C++ standard support to GNU C++11 on a GCC or CLANG compatible compiler])
|
||||
CXXFLAGS="$CXXFLAGS -std=gnu++11"
|
||||
], [], [-Werror])
|
||||
AC_LANG_POP([C++])
|
||||
])
|
||||
])
|
||||
|
||||
])
|
96
m4/nut_func_getnameinfo_argtypes.m4
Normal file
96
m4/nut_func_getnameinfo_argtypes.m4
Normal file
|
@ -0,0 +1,96 @@
|
|||
dnl This code was lifted and adapted for NUT from cURL project:
|
||||
dnl https://github.com/curl/curl/blob/e3657644d695373e9cf9ab9b4f1571afda7fd041/acinclude.m4#L228
|
||||
|
||||
dnl NUT_FUNC_GETNAMEINFO_ARGTYPES
|
||||
dnl -------------------------------------------------
|
||||
dnl Check the type to be passed to five of the arguments
|
||||
dnl of getnameinfo function, and define those types in
|
||||
dnl macros GETNAMEINFO_TYPE_ARG1, GETNAMEINFO_TYPE_ARG2,
|
||||
dnl GETNAMEINFO_TYPE_ARG46 (4 and 6) and GETNAMEINFO_TYPE_ARG7.
|
||||
dnl As seen from the loop, these vary a lot between OSes...
|
||||
dnl Order of attempts in the loop below was updated to first
|
||||
dnl try and quickly match current X/Open definition at
|
||||
dnl https://pubs.opengroup.org/onlinepubs/9699919799/functions/getnameinfo.html
|
||||
dnl for modern conforming OSes.
|
||||
|
||||
AC_DEFUN([NUT_FUNC_GETNAMEINFO_ARGTYPES], [
|
||||
AC_REQUIRE([NUT_CHECK_HEADER_WS2TCPIP])dnl
|
||||
AC_REQUIRE([NUT_TYPE_SOCKLEN_T])dnl
|
||||
AC_CHECK_HEADERS(sys/types.h sys/socket.h netdb.h)
|
||||
AC_LANG_PUSH([C])
|
||||
AC_CACHE_CHECK([types of arguments for getnameinfo],
|
||||
[nut_cv_func_getnameinfo_args], [
|
||||
nut_cv_func_getnameinfo_args="unknown"
|
||||
for gni_arg1 in 'const struct sockaddr *' 'struct sockaddr *' 'void *'; do
|
||||
for gni_arg2 in 'socklen_t' 'size_t' 'int'; do
|
||||
for gni_arg46 in 'socklen_t' 'size_t' 'int' 'unsigned int'; do
|
||||
for gni_arg7 in 'int' 'unsigned int'; do
|
||||
AC_COMPILE_IFELSE([
|
||||
AC_LANG_PROGRAM([
|
||||
#undef inline
|
||||
#ifdef HAVE_WINDOWS_H
|
||||
# ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# endif
|
||||
# if (!defined(_WIN32_WINNT)) || (_WIN32_WINNT < 0x0501)
|
||||
# undef _WIN32_WINNT
|
||||
# define _WIN32_WINNT 0x0501
|
||||
# endif
|
||||
# include <windows.h>
|
||||
# ifdef HAVE_WINSOCK2_H
|
||||
# include <winsock2.h>
|
||||
# ifdef HAVE_WS2TCPIP_H
|
||||
# include <ws2tcpip.h>
|
||||
# endif
|
||||
# endif
|
||||
# define GNICALLCONV WSAAPI
|
||||
#else
|
||||
# ifdef HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
# endif
|
||||
# ifdef HAVE_SYS_SOCKET_H
|
||||
# include <sys/socket.h>
|
||||
# endif
|
||||
# ifdef HAVE_NETDB_H
|
||||
# include <netdb.h>
|
||||
# endif
|
||||
# define GNICALLCONV
|
||||
#endif
|
||||
extern int GNICALLCONV getnameinfo($gni_arg1, $gni_arg2,
|
||||
char *, $gni_arg46,
|
||||
char *, $gni_arg46,
|
||||
$gni_arg7);
|
||||
],[
|
||||
$gni_arg2 salen=0;
|
||||
$gni_arg46 hostlen=0;
|
||||
$gni_arg46 servlen=0;
|
||||
$gni_arg7 flags=0;
|
||||
int res = getnameinfo(0, salen, 0, hostlen, 0, servlen, flags);
|
||||
])
|
||||
],[
|
||||
nut_cv_func_getnameinfo_args="$gni_arg1,$gni_arg2,$gni_arg46,$gni_arg7"
|
||||
break 4
|
||||
])
|
||||
done
|
||||
done
|
||||
done
|
||||
done
|
||||
])
|
||||
AC_LANG_POP([C])
|
||||
if test "$nut_cv_func_getnameinfo_args" = "unknown"; then
|
||||
AC_MSG_WARN([Cannot find proper types to use for getnameinfo args])
|
||||
else
|
||||
gni_prev_IFS=$IFS; IFS=','
|
||||
set dummy `echo "$nut_cv_func_getnameinfo_args" | sed 's/\*/\*/g'`
|
||||
IFS=$gni_prev_IFS
|
||||
shift
|
||||
AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG1, $[1],
|
||||
[Define to the type of arg 1 for getnameinfo.])
|
||||
AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG2, $[2],
|
||||
[Define to the type of arg 2 for getnameinfo.])
|
||||
AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG46, $[3],
|
||||
[Define to the type of args 4 and 6 for getnameinfo.])
|
||||
AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG7, $[4],
|
||||
[Define to the type of arg 7 for getnameinfo.])
|
||||
fi
|
||||
])
|
|
@ -30,4 +30,13 @@ AC_DEFUN([NUT_REPORT_FEATURE],
|
|||
AC_DEFUN([NUT_PRINT_FEATURE_REPORT],
|
||||
[
|
||||
cat conf_nut_report_feature
|
||||
|
||||
echo "------------------"
|
||||
echo "Compiler settings:"
|
||||
printf 'CC \t:%s\n' "$CC"
|
||||
printf 'CFLAGS \t:%s\n' "$CFLAGS"
|
||||
printf 'CXX \t:%s\n' "$CXX"
|
||||
printf 'CXXFLAGS\t:%s\n' "$CXXFLAGS"
|
||||
printf 'CPP \t:%s\n' "$CPP"
|
||||
printf 'CPPFLAGS\t:%s\n' "$CPPFLAGS"
|
||||
])
|
||||
|
|
77
m4/nut_stash_warnings.m4
Normal file
77
m4/nut_stash_warnings.m4
Normal file
|
@ -0,0 +1,77 @@
|
|||
dnl Callers like CI or developers can enable various warning flags
|
||||
dnl including those that would be fatal to the configure script
|
||||
dnl itself passing (autotools probing code is rather sloppy by
|
||||
dnl strict standards). These routines try to stash away the warning
|
||||
dnl flags from CFLAGS and CXXFLAGS passed by user, to re-apply in
|
||||
dnl the end of configure script run.
|
||||
|
||||
AC_DEFUN([NUT_STASH_WARNINGS],
|
||||
[
|
||||
dnl WARNING: This code assumes that there are no whitespaces
|
||||
dnl inside C*FLAGS values (e.g. no spacey include paths)
|
||||
CFLAGS_STASHED_WARNINGS=""
|
||||
CPPFLAGS_STASHED_WARNINGS=""
|
||||
CXXFLAGS_STASHED_WARNINGS=""
|
||||
|
||||
AS_IF([test -z "$CFLAGS"],[],[
|
||||
TMP=""
|
||||
for V in ${CFLAGS} ; do
|
||||
case "$V" in
|
||||
-W*|-*pedantic*) CFLAGS_STASHED_WARNINGS="${CFLAGS_STASHED_WARNINGS} ${V}" ;;
|
||||
*) TMP="${TMP} ${V}" ;;
|
||||
esac
|
||||
done
|
||||
CFLAGS="$TMP"
|
||||
])
|
||||
AS_IF([test -n "${CFLAGS_STASHED_WARNINGS}"],
|
||||
[AC_MSG_NOTICE([Stashed CFLAGS warnings to not confuse autotools probes: ${CFLAGS_STASHED_WARNINGS}])])
|
||||
|
||||
AS_IF([test -z "$CPPFLAGS"],[],[
|
||||
TMP=""
|
||||
for V in ${CPPFLAGS} ; do
|
||||
case "$V" in
|
||||
-W*|-*pedantic*) CPPFLAGS_STASHED_WARNINGS="${CPPFLAGS_STASHED_WARNINGS} ${V}" ;;
|
||||
*) TMP="${TMP} ${V}" ;;
|
||||
esac
|
||||
done
|
||||
CPPFLAGS="$TMP"
|
||||
])
|
||||
AS_IF([test -n "${CPPFLAGS_STASHED_WARNINGS}"],
|
||||
[AC_MSG_NOTICE([Stashed CPPFLAGS warnings to not confuse autotools probes: ${CPPFLAGS_STASHED_WARNINGS}])])
|
||||
|
||||
|
||||
AS_IF([test -z "$CXXFLAGS"],[],[
|
||||
TMP=""
|
||||
for V in ${CXXFLAGS} ; do
|
||||
case "$V" in
|
||||
-W*|-*pedantic*) CXXFLAGS_STASHED_WARNINGS="${CXXFLAGS_STASHED_WARNINGS} ${V}" ;;
|
||||
*) TMP="${TMP} ${V}" ;;
|
||||
esac
|
||||
done
|
||||
CXXFLAGS="$TMP"
|
||||
])
|
||||
AS_IF([test -n "${CXXFLAGS_STASHED_WARNINGS}"],
|
||||
[AC_MSG_NOTICE([Stashed CXXFLAGS warnings to not confuse autotools probes: ${CXXFLAGS_STASHED_WARNINGS}])])
|
||||
|
||||
])
|
||||
|
||||
AC_DEFUN([NUT_POP_WARNINGS],
|
||||
[
|
||||
AS_IF([test -n "${CFLAGS_STASHED_WARNINGS}"],[
|
||||
AC_MSG_NOTICE([Applying back the stashed CFLAGS warnings])
|
||||
CFLAGS="${CFLAGS} ${CFLAGS_STASHED_WARNINGS}"
|
||||
AC_MSG_NOTICE([Ended up with: '${CFLAGS}'])
|
||||
])
|
||||
|
||||
AS_IF([test -n "${CPPFLAGS_STASHED_WARNINGS}"],[
|
||||
AC_MSG_NOTICE([Applying back the stashed CPPFLAGS warnings])
|
||||
CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_STASHED_WARNINGS}"
|
||||
AC_MSG_NOTICE([Ended up with: '${CPPFLAGS}'])
|
||||
])
|
||||
|
||||
AS_IF([test -n "${CXXFLAGS_STASHED_WARNINGS}"],[
|
||||
AC_MSG_NOTICE([Applying back the stashed CXXFLAGS warnings])
|
||||
CXXFLAGS="${CXXFLAGS} ${CXXFLAGS_STASHED_WARNINGS}"
|
||||
AC_MSG_NOTICE([Ended up with: '${CXXFLAGS}'])
|
||||
])
|
||||
])
|
|
@ -7,29 +7,65 @@ dnl This code gets around. This instance came from rsync 2.5.6.
|
|||
|
||||
AC_DEFUN([NUT_TYPE_SOCKLEN_T],
|
||||
[
|
||||
AC_REQUIRE([NUT_CHECK_HEADER_WS2TCPIP])dnl
|
||||
HEADERS_SOCKLEN_T='
|
||||
#undef inline
|
||||
#ifdef HAVE_WINDOWS_H
|
||||
# ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# endif
|
||||
# if (!defined(_WIN32_WINNT)) || (_WIN32_WINNT < 0x0501)
|
||||
# undef _WIN32_WINNT
|
||||
# define _WIN32_WINNT 0x0501
|
||||
# endif
|
||||
# include <windows.h>
|
||||
# ifdef HAVE_WINSOCK2_H
|
||||
# include <winsock2.h>
|
||||
# ifdef HAVE_WS2TCPIP_H
|
||||
# include <ws2tcpip.h>
|
||||
# endif
|
||||
# endif
|
||||
# define GNICALLCONV WSAAPI
|
||||
# define GNICALLLINK WINSOCK_API_LINKAGE
|
||||
#else
|
||||
# ifdef HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
# endif
|
||||
# ifdef HAVE_SYS_SOCKET_H
|
||||
# include <sys/socket.h>
|
||||
# endif
|
||||
# ifdef HAVE_NETDB_H
|
||||
# include <netdb.h>
|
||||
# endif
|
||||
# define GNICALLCONV
|
||||
# define GNICALLLINK
|
||||
#endif
|
||||
'
|
||||
AC_CHECK_TYPE([socklen_t], ,[
|
||||
AC_MSG_CHECKING([for socklen_t equivalent])
|
||||
AC_CACHE_VAL([nut_cv_socklen_t_equiv],
|
||||
[
|
||||
# Systems have either "struct sockaddr *" or
|
||||
# "void *" as the second argument to getpeername
|
||||
AC_LANG_PUSH([C])
|
||||
nut_cv_socklen_t_equiv=
|
||||
for arg2 in "struct sockaddr" void; do
|
||||
for t in int size_t unsigned long "unsigned long"; do
|
||||
AC_TRY_COMPILE([
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
int getpeername (int, $arg2 *, $t *);
|
||||
],[
|
||||
$t len;
|
||||
for arg1 in "int" "SOCKET"; do
|
||||
for arg2 in "struct sockaddr" void; do
|
||||
for arg3 in int size_t unsigned long "unsigned long"; do
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([${HEADERS_SOCKLEN_T}
|
||||
GNICALLLINK int GNICALLCONV getpeername ($arg1, $arg2 *, $arg3 *);
|
||||
],[
|
||||
$arg3 len;
|
||||
getpeername(0,0,&len);
|
||||
],[
|
||||
nut_cv_socklen_t_equiv="$t"
|
||||
])],
|
||||
[
|
||||
nut_cv_socklen_t_equiv="$arg3"
|
||||
break
|
||||
])
|
||||
done
|
||||
done
|
||||
done
|
||||
AC_LANG_POP([C])
|
||||
|
||||
if test "x$nut_cv_socklen_t_equiv" = x; then
|
||||
AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
|
||||
|
@ -38,6 +74,5 @@ AC_DEFUN([NUT_TYPE_SOCKLEN_T],
|
|||
AC_MSG_RESULT($nut_cv_socklen_t_equiv)
|
||||
AC_DEFINE_UNQUOTED(socklen_t, $nut_cv_socklen_t_equiv,
|
||||
[type to use in place of socklen_t if not defined])],
|
||||
[#include <sys/types.h>
|
||||
#include <sys/socket.h>])
|
||||
[${HEADERS_SOCKLEN_T}])
|
||||
])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue