Make cpp variadic arguments check into a macro and move to sudo.m4.
Also move the PVS-Studio.cfg generation to sudo.m4.
This commit is contained in:
99
configure
vendored
99
configure
vendored
@@ -8776,6 +8776,38 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
|
||||
|
||||
|
||||
|
||||
|
||||
if test X"$enable_pvs_studio" = X"yes"; then
|
||||
# Determine preprocessor type
|
||||
case "$CC" in
|
||||
*clang*) preprocessor=clang;;
|
||||
*gcc*) preprocessor=gcc;;
|
||||
*) case `$CC --version 2>&1` in
|
||||
*clang*) preprocessor=clang;;
|
||||
*gcc*) preprocessor=gcc;;
|
||||
*) as_fn_error $? "Compiler must be gcc or clang for PVS-Studio." "$LINENO" 5;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
# Determine platform (currently linux or macos)
|
||||
case "$host" in
|
||||
x86_64-*-linux*) pvs_platform=linux64;;
|
||||
*86-*-linux*) pvs_platform=linux32;;
|
||||
*-*-darwin*) pvs_platform=macos;;
|
||||
*) as_fn_error $? "PVS-Studio does not support $host." "$LINENO" 5;;
|
||||
esac
|
||||
|
||||
# Create a basic PVS-Studio.cfg file
|
||||
cat > PVS-Studio.cfg <<-EOF
|
||||
preprocessor = $preprocessor
|
||||
platform = $pvs_platform
|
||||
analysis-mode = 4
|
||||
language = C
|
||||
EOF
|
||||
fi
|
||||
|
||||
|
||||
case "$host_os" in
|
||||
aix4.[23]|aix4.[23].*|aix[5-9]*)
|
||||
|
||||
@@ -18574,37 +18606,6 @@ fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if test X"$enable_pvs_studio" = X"yes"; then
|
||||
# Determine preprocessor type
|
||||
case "$CC" in
|
||||
*clang*) preprocessor=clang;;
|
||||
*gcc*) preprocessor=gcc;;
|
||||
*)
|
||||
case `$CC --version 2>&1` in
|
||||
*clang*) preprocessor=clang;;
|
||||
*gcc*) preprocessor=gcc;;
|
||||
*) as_fn_error $? "Compiler must be gcc or clang for PVS-Studio." "$LINENO" 5;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
# Determine platform (currently linux or macos)
|
||||
case "$host" in
|
||||
x86_64-*-linux*) pvs_platform=linux64;;
|
||||
*86-*-linux*) pvs_platform=linux32;;
|
||||
*-*-darwin*) pvs_platform=macos;;
|
||||
*) as_fn_error $? "PVS-Studio does not support $host." "$LINENO" 5;;
|
||||
esac
|
||||
|
||||
# create basic PVS-Studio.cfg file
|
||||
cat > PVS-Studio.cfg <<-EOF
|
||||
preprocessor = $preprocessor
|
||||
platform = $pvs_platform
|
||||
analysis-mode = 4
|
||||
language = C
|
||||
EOF
|
||||
fi
|
||||
|
||||
if test X"$enable_intercept" = X"no"; then
|
||||
intercept_file=disabled
|
||||
fi
|
||||
@@ -18905,9 +18906,15 @@ printf "%s\n" "#define volatile /**/" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
if test X"$ac_cv_build_prog_cc_c99" = X"no"; then
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for variadic macro support in cpp" >&5
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for variadic macro support in cpp" >&5
|
||||
printf %s "checking for variadic macro support in cpp... " >&6; }
|
||||
if test ${sudo_cv_cpp_variadic_macros+y}
|
||||
then :
|
||||
printf %s "(cached) " >&6
|
||||
else case e in #(
|
||||
e)
|
||||
sudo_cv_cpp_variadic_macros=yes
|
||||
if test X"$ac_cv_build_prog_cc_c99" = X"no"; then
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
$ac_includes_default
|
||||
@@ -18920,21 +18927,30 @@ int
|
||||
main (void)
|
||||
{
|
||||
sudo_fprintf(stderr, "a %s", "test");
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"
|
||||
then :
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
printf "%s\n" "yes" >&6; }
|
||||
|
||||
else case e in #(
|
||||
e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
printf "%s\n" "no" >&6; }
|
||||
e) sudo_cv_cpp_variadic_macros=no ;;
|
||||
esac
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_cpp_variadic_macros" >&5
|
||||
printf "%s\n" "$sudo_cv_cpp_variadic_macros" >&6; }
|
||||
if test X"$sudo_cv_cpp_variadic_macros" = X"no"; then
|
||||
|
||||
printf "%s\n" "#define NO_VARIADIC_MACROS 1" >>confdefs.h
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: your C preprocessor doesn't support variadic macros, debugging support will be limited" >&5
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: your C preprocessor doesn't support variadic macros, debugging support will be limited" >&5
|
||||
printf "%s\n" "$as_me: WARNING: your C preprocessor doesn't support variadic macros, debugging support will be limited" >&2;}
|
||||
|
||||
for _sym in sudo_debug_printf_nvm_v1; do
|
||||
@@ -18942,11 +18958,8 @@ printf "%s\n" "$as_me: WARNING: your C preprocessor doesn't support variadic mac
|
||||
"
|
||||
done
|
||||
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
for ac_prog in gawk mawk nawk awk
|
||||
do
|
||||
|
51
configure.ac
51
configure.ac
@@ -1645,6 +1645,11 @@ dnl
|
||||
AC_CANONICAL_HOST
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
dnl
|
||||
dnl Relies on CC host being set
|
||||
dnl
|
||||
SUDO_PVS_STUDIO_CFG
|
||||
|
||||
dnl
|
||||
dnl On AIX we need to force libtool to install .so files for the plugins
|
||||
dnl instead of a .a file that contains the .so. We do this by enabling
|
||||
@@ -2303,37 +2308,6 @@ case "$host" in
|
||||
;;
|
||||
esac
|
||||
|
||||
if test X"$enable_pvs_studio" = X"yes"; then
|
||||
# Determine preprocessor type
|
||||
case "$CC" in
|
||||
*clang*) preprocessor=clang;;
|
||||
*gcc*) preprocessor=gcc;;
|
||||
*)
|
||||
case `$CC --version 2>&1` in
|
||||
*clang*) preprocessor=clang;;
|
||||
*gcc*) preprocessor=gcc;;
|
||||
*) AC_MSG_ERROR([Compiler must be gcc or clang for PVS-Studio.]);;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
# Determine platform (currently linux or macos)
|
||||
case "$host" in
|
||||
x86_64-*-linux*) pvs_platform=linux64;;
|
||||
*86-*-linux*) pvs_platform=linux32;;
|
||||
*-*-darwin*) pvs_platform=macos;;
|
||||
*) AC_MSG_ERROR([PVS-Studio does not support $host.]);;
|
||||
esac
|
||||
|
||||
# create basic PVS-Studio.cfg file
|
||||
cat > PVS-Studio.cfg <<-EOF
|
||||
preprocessor = $preprocessor
|
||||
platform = $pvs_platform
|
||||
analysis-mode = 4
|
||||
language = C
|
||||
EOF
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl Library preloading to support NOEXEC
|
||||
dnl
|
||||
@@ -2404,20 +2378,7 @@ dnl
|
||||
AC_C_CONST
|
||||
AC_C_INLINE
|
||||
AC_C_VOLATILE
|
||||
if test X"$ac_cv_prog_cc_c99" = X"no"; then
|
||||
AC_MSG_CHECKING([for variadic macro support in cpp])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
|
||||
#if defined(__GNUC__) && __GNUC__ == 2
|
||||
# define sudo_fprintf(fp, fmt...) fprintf((fp), (fmt))
|
||||
#else
|
||||
# define sudo_fprintf(fp, ...) fprintf((fp), __VA_ARGS__)
|
||||
#endif], [sudo_fprintf(stderr, "a %s", "test");])], [AC_MSG_RESULT([yes])],
|
||||
[AC_MSG_RESULT([no])
|
||||
AC_DEFINE([NO_VARIADIC_MACROS], [1], [Define if your C preprocessor does not support variadic macros.])
|
||||
AC_MSG_WARN([your C preprocessor doesn't support variadic macros, debugging support will be limited])
|
||||
SUDO_APPEND_COMPAT_EXP(sudo_debug_printf_nvm_v1)
|
||||
])
|
||||
fi
|
||||
SUDO_CPP_VARIADIC_MACROS
|
||||
|
||||
dnl
|
||||
dnl Program checks
|
||||
|
56
m4/sudo.m4
56
m4/sudo.m4
@@ -548,6 +548,62 @@ if test $maildir = no; then
|
||||
fi
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl Create PVS-Studio.cfg for supported platforms or throw an error.
|
||||
dnl
|
||||
AC_DEFUN([SUDO_PVS_STUDIO_CFG], [
|
||||
if test X"$enable_pvs_studio" = X"yes"; then
|
||||
# Determine preprocessor type
|
||||
case "$CC" in
|
||||
*clang*) preprocessor=clang;;
|
||||
*gcc*) preprocessor=gcc;;
|
||||
*) case `$CC --version 2>&1` in
|
||||
*clang*) preprocessor=clang;;
|
||||
*gcc*) preprocessor=gcc;;
|
||||
*) AC_MSG_ERROR([Compiler must be gcc or clang for PVS-Studio.]);;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
# Determine platform (currently linux or macos)
|
||||
case "$host" in
|
||||
x86_64-*-linux*) pvs_platform=linux64;;
|
||||
*86-*-linux*) pvs_platform=linux32;;
|
||||
*-*-darwin*) pvs_platform=macos;;
|
||||
*) AC_MSG_ERROR([PVS-Studio does not support $host.]);;
|
||||
esac
|
||||
|
||||
# Create a basic PVS-Studio.cfg file
|
||||
cat > PVS-Studio.cfg <<-EOF
|
||||
preprocessor = $preprocessor
|
||||
platform = $pvs_platform
|
||||
analysis-mode = 4
|
||||
language = C
|
||||
EOF
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([SUDO_CPP_VARIADIC_MACROS],
|
||||
[AC_CACHE_CHECK([for variadic macro support in cpp],
|
||||
[sudo_cv_cpp_variadic_macros], [
|
||||
sudo_cv_cpp_variadic_macros=yes
|
||||
if test X"$ac_cv_prog_cc_c99" = X"no"; then
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
|
||||
#if defined(__GNUC__) && __GNUC__ == 2
|
||||
# define sudo_fprintf(fp, fmt...) fprintf((fp), (fmt))
|
||||
#else
|
||||
# define sudo_fprintf(fp, ...) fprintf((fp), __VA_ARGS__)
|
||||
#endif], [sudo_fprintf(stderr, "a %s", "test");
|
||||
])], [], [sudo_cv_cpp_variadic_macros=no])
|
||||
fi
|
||||
])
|
||||
if test X"$sudo_cv_cpp_variadic_macros" = X"no"; then
|
||||
AC_DEFINE([NO_VARIADIC_MACROS], [1], [Define if your C preprocessor does not support variadic macros.])
|
||||
AC_MSG_WARN([your C preprocessor doesn't support variadic macros, debugging support will be limited])
|
||||
SUDO_APPEND_COMPAT_EXP(sudo_debug_printf_nvm_v1)
|
||||
fi
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl private versions of AC_DEFINE and AC_DEFINE_UNQUOTED that don't support
|
||||
dnl tracing that we use to define paths for pathnames.h so autoheader doesn't
|
||||
|
Reference in New Issue
Block a user