This should fix the issue around compiling cyassl with a C++ compiler.

This commit is contained in:
Brian Aker 2012-10-19 00:30:21 -04:00
parent d99c5d8e06
commit afe043ee6c
7 changed files with 250 additions and 130 deletions

View File

@ -23,7 +23,7 @@ EXTRA_DIST+= $(example_DATA)
EXTRA_DIST+= $(doc_DATA)
ACLOCAL_AMFLAGS= -I m4 --install
ACLOCAL_AMFLAGS= -I m4
EXTRA_DIST+= lib/dummy
@ -54,6 +54,29 @@ include sslSniffer/sslSnifferTest/include.am
TESTS += $(check_PROGRAMS)
test: check
maintainer-clean-local:
-rm Makefile.in
-rm aclocal.m4
-rm build-aux/config.guess
-rm build-aux/config.sub
-rm build-aux/depcomp
-rm build-aux/install-sh
-rm build-aux/ltmain.sh
-rm build-aux/missing
-rmdir build-aux
-rm configure
-rm config.log
-rm config.status
-rm config.in
-rm m4/libtool.m4
-rm m4/ltoptions.m4
-rm m4/ltsugar.m4
-rm m4/ltversion.m4
-rm m4/lt~obsolete.m4
find . -type f -name '*~' -exec rm -f '{}' \;
-rm -f @PACKAGE@-*.tar.gz
-rm -f @PACKAGE@-*.rpm
# !!!! first line of rule has to start with a hard (real) tab, not spaces
egs:
$(MAKE) examples/client/client; \

View File

@ -8,18 +8,19 @@
AC_INIT([cyassl],[2.4.0],[http://www.yassl.com])
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_TARGET
AC_USE_SYSTEM_EXTENSIONS
AM_INIT_AUTOMAKE(-Wall -Werror -Wno-portability foreign tar-ustar subdir-objects)
AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability foreign tar-ustar subdir-objects])
AC_CANONICAL_HOST
AC_CANONICAL_BUILD
AC_PREREQ([2.61])
AC_CONFIG_MACRO_DIR(m4)
AC_CONFIG_HEADERS([config.h:config.in])dnl Keep filename to 8.3 for MS-DOS.
@ -39,9 +40,6 @@ CYASSL_LIBRARY_VERSION=3:3:0
# +- increment if interfaces have been added, removed or changed
AC_SUBST(CYASSL_LIBRARY_VERSION)
# Make sure configure doesn't add to CFLAGS
CFLAGS="$CFLAGS $C_EXTRA_FLAGS"
LT_INIT([win32-dll])
LT_LANG([C++])
LT_LANG([C])
@ -65,7 +63,7 @@ AC_CHECK_HEADERS([stddef.h])
AC_CHECK_HEADERS([sys/ioctl.h])
AC_CHECK_HEADERS([sys/socket.h])
AC_CHECK_HEADERS([sys/time.h])
AC_CHECK_HEADERS(errno.h)
AC_CHECK_HEADERS([errno.h])
AC_CHECK_LIB(network,socket)
AC_CHECK_SIZEOF(long long, 8)
AC_CHECK_SIZEOF(long, 4)
@ -94,19 +92,11 @@ DEBUG_CFLAGS="-g -DDEBUG -DDEBUG_CYASSL"
# DEBUG
AC_ARG_ENABLE(debug,
[ --enable-debug Enable CyaSSL debugging support (default: disabled)],
[ ENABLED_DEBUG=$enableval ],
[ ENABLED_DEBUG=no ]
)
if test "$ENABLED_DEBUG" = "yes"
then
# Full debug. Very slow in some cases
AM_CFLAGS="$DEBUG_CFLAGS $AM_CFLAGS"
else
# Optimized version. No debug
AM_CFLAGS="$AM_CFLAGS -DNDEBUG"
fi
AX_DEBUG
AS_IF([ test "$ax_enable_debug" = "yes" ],[
AM_CFLAGS="$DEBUG_CFLAGS $AM_CFLAGS" ],[
AM_CFLAGS="$AM_CFLAGS -DNDEBUG"
])
# SMALL BUILD
@ -683,23 +673,6 @@ AX_PTHREAD([
LIB_SOCKET_NSL
dnl Various GCC warnings that should never fire for release quality code
GCCWARNINGS="-Wall -fno-strict-aliasing -W -Wfloat-equal -Wundef \
-Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
-Wwrite-strings -Wredundant-decls -Wchar-subscripts -Wcomment \
-Wformat=2 -Wwrite-strings -Wmissing-declarations -Wredundant-decls \
-Wnested-externs -Wbad-function-cast -Wswitch-enum -Winit-self \
-Wmissing-field-initializers -Wdeclaration-after-statement \
-Wold-style-definition -Waddress -Wmissing-noreturn -Wnormalized=id \
-Woverride-init -Wstrict-overflow=1 -Wextra -Wstack-protector -Wformat \
-Wformat-security -Wpointer-sign -Wshadow -Wswitch-default"
case "$host_os" in
*linux*)
GCCWARNINGS="$GCCWARNINGS -Warray-bounds"
;;
esac
AC_ARG_ENABLE(gcc-hardening,
AS_HELP_STRING(--enable-gcc-hardening, Enable compiler security checks (default: disabled)),
[if test x$enableval = xyes; then

View File

@ -1457,6 +1457,8 @@ int rsa_test(void)
if (ret != 0) return -491;
FreeDecodedCert(&cert);
#else
(void)bytes2;
#endif
fclose(file2);

View File

@ -273,6 +273,8 @@ void client_test(void* args)
#ifndef NO_PSK
if (usePsk)
CyaSSL_CTX_set_psk_client_callback(ctx, my_psk_client_cb);
#else
(void)usePsk;
#endif
#ifdef OPENSSL_EXTRA

61
m4/ax_debug.m4 Normal file
View File

@ -0,0 +1,61 @@
# ===========================================================================
# https://github.com/BrianAker/ddm4/
# ===========================================================================
#
# SYNOPSIS
#
# AX_DEBUG()
#
# DESCRIPTION
#
# --enable-debug
#
# LICENSE
#
# Copyright (C) 2012 Brian Aker
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
#
# * The names of its contributors may not be used to endorse or
# promote products derived from this software without specific prior
# written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#serial 2
AC_DEFUN([AX_DEBUG],[
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],
[Add debug code/turns off optimizations (yes|no) @<:@default=no@:>@])],[
ax_enable_debug=yes
AC_DEFINE(DEBUG, [ 1 ], [Define to 1 to enable debugging code.])
],[
ax_enable_debug=no
AC_DEFINE(DEBUG, [ 0 ], [Define to 1 to enable debugging code.])
])
AC_MSG_CHECKING([for debug])
AC_MSG_RESULT([$ax_enable_debug])
])

View File

@ -1,10 +1,13 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_append_flag.html
# https://github.com/BrianAker/ddm4/
# ===========================================================================
#
# SYNOPSIS
#
# AX_HARDEN_COMPILER_FLAGS
# AX_HARDEN_COMPILER_FLAGS()
# AX_HARDEN_LINKER_FLAGS()
# AX_HARDEN_CC_COMPILER_FLAGS()
# AX_HARDEN_CXX_COMPILER_FLAGS()
#
# DESCRIPTION
#
@ -52,114 +55,163 @@
# AX_APPEND_COMPILE_FLAGS([-Wstack-protector]) -- Issues on 32bit compile
# AX_APPEND_COMPILE_FLAGS([-fstack-protector-all]) -- Issues on 32bit compile
# AX_APPEND_COMPILE_FLAGS([-Wlong-long]) -- Don't turn on for compatibility issues memcached_stat_st
# AX_APPEND_COMPILE_FLAGS([-Wold-style-definition]) -- Mixed with -Werror either before or after is a problem because tests use main() instead of main(void)
# AX_APPEND_COMPILE_FLAGS([-std=c99]) -- problem seeing DT_REG from dirent.h on some systems
# AX_APPEND_COMPILE_FLAGS([-Wlogical-op]) -- doesn't like strchr argument in mygetopt for now
# AX_APPEND_COMPILE_FLAGS([-Wold-style-definition],,[$ax_append_compile_flags_extra])
# AX_APPEND_COMPILE_FLAGS([-std=c99],,[$ax_append_compile_flags_extra])
# AX_APPEND_COMPILE_FLAGS([-Wlogical-op],,[$ax_append_compile_flags_extra])
#serial 3
#serial 2
AC_DEFUN([AX_HARDEN_LINKER_FLAGS], [
AC_REQUIRE([AX_CHECK_LINK_FLAG])
AC_REQUIRE([AX_VCS_CHECKOUT])
AC_REQUIRE([AX_DEBUG])
AC_REQUIRE([AX_CXX_COMPILER_VERSION])
AS_IF([test "$ac_cv_vcs_checkout" = yes], [
ax_append_compile_flags_extra=
AS_IF([test "$CLANG" = "yes"],[ax_append_compile_flags_extra="-Werror"])
AS_IF([test "$ac_cv_vcs_checkout" = "yes"], [
AX_CHECK_LINK_FLAG([-Werror])
ax_append_compile_flags_extra=
])
AX_CHECK_LINK_FLAG([-z relro -z now])
AX_CHECK_LINK_FLAG([-z relro -z now],,[$ax_append_compile_flags_extra])
AX_CHECK_LINK_FLAG([-pie],,[$ax_append_compile_flags_extra])
])
AC_DEFUN([AX_HARDEN_C_COMPILER_FLAGS], [
AC_DEFUN([AX_HARDEN_CC_COMPILER_FLAGS], [
AC_REQUIRE([AX_APPEND_COMPILE_FLAGS])
AC_REQUIRE([AX_HARDEN_LINKER_FLAGS])
AC_LANG_PUSH([C])
AS_IF([test "$ax_with_debug" = yes], [
AX_APPEND_COMPILE_FLAGS([-O0])],[])
CFLAGS=
ac_cv_warnings_as_errors=no
AS_IF([test "$ac_cv_vcs_checkout" = yes], [
AX_APPEND_COMPILE_FLAGS([-Werror])
ac_cv_warnings_as_errors=yes
AX_APPEND_COMPILE_FLAGS([-g])
AS_IF([test "$ax_enable_debug" = "yes"], [
AX_APPEND_COMPILE_FLAGS([-ggdb],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-O0],,[$ax_append_compile_flags_extra])
],[
AX_APPEND_COMPILE_FLAGS([-O2],,[$ax_append_compile_flags_extra])
])
AX_APPEND_COMPILE_FLAGS([-Wall])
AX_APPEND_COMPILE_FLAGS([-Wextra])
AX_APPEND_COMPILE_FLAGS([-Wbad-function-cast])
AX_APPEND_COMPILE_FLAGS([-Wmissing-prototypes])
AX_APPEND_COMPILE_FLAGS([-Wnested-externs])
AX_APPEND_COMPILE_FLAGS([-Woverride-init])
AX_APPEND_COMPILE_FLAGS([-Wstrict-prototypes])
AX_APPEND_COMPILE_FLAGS([-Wno-strict-aliasing])
AX_APPEND_COMPILE_FLAGS([-Wfloat-equal])
AX_APPEND_COMPILE_FLAGS([-Wundef])
AX_APPEND_COMPILE_FLAGS([-Wpointer-arith])
AX_APPEND_COMPILE_FLAGS([-Wwrite-strings])
AX_APPEND_COMPILE_FLAGS([-Wredundant-decls])
AX_APPEND_COMPILE_FLAGS([-Wchar-subscripts])
AX_APPEND_COMPILE_FLAGS([-Wcomment])
AX_APPEND_COMPILE_FLAGS([-Wformat=2])
AX_APPEND_COMPILE_FLAGS([-Wmissing-declarations])
AX_APPEND_COMPILE_FLAGS([-Wswitch-enum])
AX_APPEND_COMPILE_FLAGS([-Winit-self])
AX_APPEND_COMPILE_FLAGS([-Wmissing-field-initializers])
AX_APPEND_COMPILE_FLAGS([-Wdeclaration-after-statement])
AX_APPEND_COMPILE_FLAGS([-Waddress])
AX_APPEND_COMPILE_FLAGS([-Wmissing-noreturn])
AX_APPEND_COMPILE_FLAGS([-Wnormalized=id])
AX_APPEND_COMPILE_FLAGS([-Wstrict-overflow=1])
AX_APPEND_COMPILE_FLAGS([-Wformat])
AX_APPEND_COMPILE_FLAGS([-Wformat-security])
AX_APPEND_COMPILE_FLAGS([-Wpointer-sign])
AX_APPEND_COMPILE_FLAGS([-Wshadow])
AX_APPEND_COMPILE_FLAGS([-Wswitch-default])
AX_APPEND_COMPILE_FLAGS([-Warray-bounds])
ac_cv_warnings_as_errors=no
AS_IF([test "$ac_cv_vcs_checkout" = "yes"], [
AX_APPEND_COMPILE_FLAGS([-Werror],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-fstack-check],,[$ax_append_compile_flags_extra])
ac_cv_warnings_as_errors=yes
],[
AX_APPEND_COMPILE_FLAGS([-Wno-pragmas],,[$ax_append_compile_flags_extra])
])
AX_APPEND_COMPILE_FLAGS([-Wall],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wno-strict-aliasing],,,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wextra],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wunknown-pragmas],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wthis-test-should-fail],,[$ax_append_compile_flags_extra])
dnl Anything below this comment please keep sorted.
AX_APPEND_COMPILE_FLAGS([--param=ssp-buffer-size=1],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Waddress],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Warray-bounds],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wbad-function-cast],,[$ax_append_compile_flags_extra])
dnl Not in use -Wc++-compat
AX_APPEND_COMPILE_FLAGS([-Wchar-subscripts],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wcomment],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wfloat-equal],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wformat-security],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wformat=2],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wmaybe-uninitialized],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wmissing-field-initializers],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wmissing-noreturn],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wmissing-prototypes],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wnested-externs],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wnormalized=id],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Woverride-init],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wpointer-arith],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wpointer-sign],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wredundant-decls],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wshadow],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wshorten-64-to-32],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wsign-compare],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wstrict-overflow=1],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wstrict-prototypes],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wswitch-enum],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wundef],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wunused-result],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wunused-variable],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wwrite-strings],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-floop-parallelize-all],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-fwrapv],,[$ax_append_compile_flags_extra])
AC_LANG_POP
])
AC_DEFUN([AX_HARDEN_CC_COMPILER_FLAGS], [
AC_REQUIRE([AX_HARDEN_C_COMPILER_FLAGS])
AC_DEFUN([AX_HARDEN_CXX_COMPILER_FLAGS], [
AC_REQUIRE([AX_HARDEN_CC_COMPILER_FLAGS])
AC_LANG_PUSH([C++])
CXXFLAGS=
AS_IF([test "$ax_with_debug" = yes], [
AX_APPEND_COMPILE_FLAGS([-O0])],[
AX_APPEND_COMPILE_FLAGS([-O2])
AX_APPEND_COMPILE_FLAGS([-D_FORTIFY_SOURCE=2])
AX_APPEND_COMPILE_FLAGS([-g],,[$ax_append_compile_flags_extra])
AS_IF([test "$ax_enable_debug" = "yes" ], [
AX_APPEND_COMPILE_FLAGS([-O0],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-ggdb],,[$ax_append_compile_flags_extra])
],[
AX_APPEND_COMPILE_FLAGS([-O2],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-D_FORTIFY_SOURCE=2],,[$ax_append_compile_flags_extra])
])
AS_IF([test "$ac_cv_vcs_checkout" = yes], [
AX_APPEND_COMPILE_FLAGS([-Werror])
AS_IF([test "$ac_cv_vcs_checkout" = "yes" ], [
AX_APPEND_COMPILE_FLAGS([-Werror],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-fstack-check],,[$ax_append_compile_flags_extra])
],[
AX_APPEND_COMPILE_FLAGS([-Wno-pragmas],,[$ax_append_compile_flags_extra])
])
AX_APPEND_COMPILE_FLAGS([-Wall])
AX_APPEND_COMPILE_FLAGS([-Wextra])
AX_APPEND_COMPILE_FLAGS([-Wpragmas])
AX_APPEND_COMPILE_FLAGS([--paramssp-buffer-size=1])
AX_APPEND_COMPILE_FLAGS([-Waddress])
AX_APPEND_COMPILE_FLAGS([-Warray-bounds])
AX_APPEND_COMPILE_FLAGS([-Wchar-subscripts])
AX_APPEND_COMPILE_FLAGS([-Wcomment])
AX_APPEND_COMPILE_FLAGS([-Wctor-dtor-privacy])
AX_APPEND_COMPILE_FLAGS([-Wfloat-equal])
AX_APPEND_COMPILE_FLAGS([-Wformat=2])
AX_APPEND_COMPILE_FLAGS([-Wmaybe-uninitialized])
AX_APPEND_COMPILE_FLAGS([-Wmissing-field-initializers])
AX_APPEND_COMPILE_FLAGS([-Wmissing-noreturn])
AX_APPEND_COMPILE_FLAGS([-Wnon-virtual-dtor])
AX_APPEND_COMPILE_FLAGS([-Wnormalized=id])
AX_APPEND_COMPILE_FLAGS([-Woverloaded-virtual])
AX_APPEND_COMPILE_FLAGS([-Wpointer-arith])
AX_APPEND_COMPILE_FLAGS([-Wredundant-decls])
AX_APPEND_COMPILE_FLAGS([-Wshadow])
AX_APPEND_COMPILE_FLAGS([-Wshorten-64-to-32])
AX_APPEND_COMPILE_FLAGS([-Wsign-compare])
AX_APPEND_COMPILE_FLAGS([-Wstrict-overflow=1])
AX_APPEND_COMPILE_FLAGS([-Wswitch-enum])
AX_APPEND_COMPILE_FLAGS([-Wundef])
AX_APPEND_COMPILE_FLAGS([-Wunused-result])
AX_APPEND_COMPILE_FLAGS([-Wunused-variable])
AX_APPEND_COMPILE_FLAGS([-Wwrite-strings])
AX_APPEND_COMPILE_FLAGS([-floop-parallelize-all])
AX_APPEND_COMPILE_FLAGS([-fwrapv])
AX_APPEND_COMPILE_FLAGS([-ggdb])
AX_APPEND_COMPILE_FLAGS([-Wall],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wno-strict-aliasing],,,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wextra],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wunknown-pragmas],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wthis-test-should-fail],,[$ax_append_compile_flags_extra])
dnl Anything below this comment please keep sorted.
AX_APPEND_COMPILE_FLAGS([--param=ssp-buffer-size=1],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Waddress],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Warray-bounds],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wchar-subscripts],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wcomment],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wctor-dtor-privacy],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wfloat-equal],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wformat=2],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wmaybe-uninitialized],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wmissing-field-initializers],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wmissing-noreturn],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wnon-virtual-dtor],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wnormalized=id],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Woverloaded-virtual],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wpointer-arith],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wredundant-decls],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wshadow],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wshorten-64-to-32],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wsign-compare],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wstrict-overflow=1],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wswitch-enum],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wundef],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wc++11-compat],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wunused-result],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wunused-variable],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wwrite-strings],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-Wformat-security],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-floop-parallelize-all],,[$ax_append_compile_flags_extra])
AX_APPEND_COMPILE_FLAGS([-fwrapv],,[$ax_append_compile_flags_extra])
AC_LANG_POP
])
AC_DEFUN([AX_HARDEN_COMPILER_FLAGS], [
AC_REQUIRE([AX_HARDEN_CXX_COMPILER_FLAGS],,[$ax_append_compile_flags_extra])
])
AC_DEFUN([AX_CC_OTHER_FLAGS], [
AC_REQUIRE([AX_APPEND_COMPILE_FLAGS])
AC_REQUIRE([AX_HARDEN_LINKER_FLAGS])
AC_LANG_PUSH([C])
AX_APPEND_COMPILE_FLAGS([-pipe],,[$ax_append_compile_flags_extra])
AC_LANG_POP
])

View File

@ -82,7 +82,7 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 16
#serial 18
AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
AC_DEFUN([AX_PTHREAD], [
@ -145,8 +145,8 @@ ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mt
# --thread-safe: KAI C++
# pthread-config: use pthread-config program (for GNU Pth library)
case "${host_cpu}-${host_os}" in
*solaris*)
case ${host_os} in
solaris*)
# On Solaris (at least, for some versions), libc contains stubbed
# (non-functional) versions of the pthreads routines, so link-based
@ -159,7 +159,7 @@ case "${host_cpu}-${host_os}" in
ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
;;
*-darwin*)
darwin*)
ax_pthread_flags="-pthread $ax_pthread_flags"
;;
esac
@ -254,9 +254,16 @@ if test "x$ax_pthread_ok" = xyes; then
AC_MSG_CHECKING([if more special flags are required for pthreads])
flag=no
case "${host_cpu}-${host_os}" in
*-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
*solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
case ${host_os} in
aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";;
osf* | hpux*) flag="-D_REENTRANT";;
solaris*)
if test "$GCC" = "yes"; then
flag="-D_REENTRANT"
else
flag="-mt -D_REENTRANT"
fi
;;
esac
AC_MSG_RESULT(${flag})
if test "x$flag" != xno; then