mirror of https://github.com/wolfSSL/wolfssh.git
M4 Update
1. Update the m4 files we updated in wolfSSL. 2. Update the configure.ac.pull/347/head
parent
d2f98af161
commit
dbea6e6a47
|
@ -10,6 +10,7 @@ AC_CONFIG_AUX_DIR([build-aux])
|
|||
: ${CFLAGS=""}
|
||||
|
||||
AC_CANONICAL_HOST
|
||||
AC_CANONICAL_TARGET
|
||||
|
||||
AM_INIT_AUTOMAKE([1.11 -Wall -Werror -Wno-portability foreign tar-ustar subdir-objects no-define color-tests])
|
||||
|
||||
|
@ -45,8 +46,7 @@ AC_PROG_CC
|
|||
AM_PROG_CC_C_O
|
||||
AC_PROG_INSTALL
|
||||
|
||||
# Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
# Checks for type sizes.
|
||||
AC_CHECK_SIZEOF([long long])
|
||||
AC_CHECK_SIZEOF([long])
|
||||
AC_CHECK_SIZEOF([off_t])
|
||||
|
|
|
@ -33,7 +33,9 @@
|
|||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 8
|
||||
#serial 8.1
|
||||
# Local update: Make the increment of enable-jobserver so it isn't executable
|
||||
# and is more posix syntax.
|
||||
|
||||
AC_DEFUN([AX_AM_JOBSERVER], [
|
||||
AC_REQUIRE([AX_COUNT_CPUS])
|
||||
|
@ -45,7 +47,7 @@ AC_DEFUN([AX_AM_JOBSERVER], [
|
|||
],, [enable_jobserver=m4_ifval([$1],[$1],[yes])])
|
||||
if test "x$enable_jobserver" = "xyes"; then
|
||||
enable_jobserver=$CPU_COUNT
|
||||
((enable_jobserver++))
|
||||
: $((enable_jobserver+=1))
|
||||
fi
|
||||
m4_pattern_allow(AM_MAKEFLAGS)
|
||||
if test "x$enable_jobserver" != "xno"; then
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# DESCRIPTION
|
||||
#
|
||||
# Creates a generic PACKAGE-config file that has all the things that you
|
||||
# want, hmm, well, atleast it has --cflags, --version, --libs. Ahhm, did
|
||||
# want, hmm, well, at least it has --cflags, --version, --libs. Ahhm, did
|
||||
# you see ax_path_generic in the autoconf-archive? ;-)
|
||||
#
|
||||
# this macros saves you all the typing for a pkg-config.in script, you
|
||||
|
@ -78,7 +78,7 @@ echo 'package="'$P'"' >>$F
|
|||
echo 'version="'$V'"' >>$F
|
||||
echo 'libs="'$L'"' >>$F
|
||||
echo ' ' >>$F
|
||||
# in the order of occurence a standard automake Makefile
|
||||
# in the order of occurrence a standard automake Makefile
|
||||
echo 'prefix="'$prefix'"' >>$F
|
||||
echo 'exec_prefix="'$exec_prefix'"' >>$F
|
||||
echo 'bindir="'$bindir'"' >>$F
|
||||
|
|
|
@ -60,8 +60,11 @@
|
|||
# AX_APPEND_COMPILE_FLAGS([-Wlogical-op],,[$ax_append_compile_cflags_extra])
|
||||
# AX_APPEND_COMPILE_FLAGS([-fstack-check],,[$ax_append_compile_cflags_extra]) -- problems with fastmath stack size checks
|
||||
# AX_APPEND_COMPILE_FLAGS([-floop-parallelize-all],,[$ax_append_compile_cflags_extra]) -- causes RSA verify problem on x64
|
||||
# AX_APPEND_COMPILE_FLAGS([-Wunreachable-code],,[$ax_append_compile_cflags_extra]) -- older clang and when gcc had it are buggy
|
||||
# AX_APPEND_COMPILE_FLAGS([-fPIE],,[$ax_append_compile_cflags_extra]) -- Flag for executables not libraries
|
||||
|
||||
#serial 4
|
||||
#serial 4.2
|
||||
# changes: deleted the clearing of CFLAGS
|
||||
|
||||
AC_DEFUN([AX_HARDEN_LINKER_FLAGS], [
|
||||
AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG])
|
||||
|
@ -100,63 +103,66 @@
|
|||
|
||||
ac_cv_warnings_as_errors=no
|
||||
ax_append_compile_cflags_extra=
|
||||
AX_APPEND_COMPILE_FLAGS([-Werror],[ax_append_compile_cflags_extra])
|
||||
AS_IF([test "x$ac_cv_vcs_checkout" = "xyes"],
|
||||
[AX_APPEND_COMPILE_FLAGS([-Werror],[AM_CFLAGS])
|
||||
ac_cv_warnings_as_errors="yes"])
|
||||
AS_IF([test "$ac_cv_vcs_checkout" = "yes"],[
|
||||
AX_APPEND_COMPILE_FLAGS([-Werror])
|
||||
ac_cv_warnings_as_errors=yes
|
||||
],[
|
||||
AX_APPEND_COMPILE_FLAGS([-Werror],[ax_append_compile_cflags_extra])
|
||||
])
|
||||
|
||||
dnl The main configure script handles setting the debugging flags.
|
||||
dnl AS_IF([test "$ax_enable_debug" = "yes"], [
|
||||
dnl AX_APPEND_COMPILE_FLAGS([-g],[AM_CFLAGS])
|
||||
dnl AX_APPEND_COMPILE_FLAGS([-ggdb],[AM_CFLAGS],[$ax_append_compile_cflags_extra])
|
||||
dnl AX_APPEND_COMPILE_FLAGS([-O0],[AM_CFLAGS],[$ax_append_compile_cflags_extra])
|
||||
dnl ],[])
|
||||
AS_IF([test "$ax_enable_debug" = "yes"], [
|
||||
AX_APPEND_COMPILE_FLAGS([-g])
|
||||
AX_APPEND_COMPILE_FLAGS([-ggdb],,[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-O0],,[$ax_append_compile_cflags_extra])
|
||||
],[])
|
||||
|
||||
AX_APPEND_COMPILE_FLAGS([-Wno-pragmas],[AM_CFLAGS],[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wno-pragmas],,[$ax_append_compile_cflags_extra])
|
||||
|
||||
AX_APPEND_COMPILE_FLAGS([-Wall],[AM_CFLAGS],[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wno-strict-aliasing],[AM_CFLAGS],[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wextra],[AM_CFLAGS],[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wunknown-pragmas],[AM_CFLAGS],[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wthis-test-should-fail],[AM_CFLAGS],[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wall],,[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wno-strict-aliasing],,[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wextra],,[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wunknown-pragmas],,[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wthis-test-should-fail],,[$ax_append_compile_cflags_extra])
|
||||
dnl Anything below this comment please keep sorted.
|
||||
AS_IF([test "x$CC" != "xclang"],
|
||||
[AX_APPEND_COMPILE_FLAGS([--param=ssp-buffer-size=1],[AM_CFLAGS],[$ax_append_compile_cflags_extra])])
|
||||
AX_APPEND_COMPILE_FLAGS([-Waddress],[AM_CFLAGS],[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Warray-bounds],[AM_CFLAGS],[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wbad-function-cast],[AM_CFLAGS],[$ax_append_compile_cflags_extra])
|
||||
AS_IF([test "$CC" = "clang"],[],[
|
||||
AX_APPEND_COMPILE_FLAGS([--param=ssp-buffer-size=1],,[$ax_append_compile_cflags_extra])
|
||||
])
|
||||
AX_APPEND_COMPILE_FLAGS([-Waddress],,[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Warray-bounds],,[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wbad-function-cast],,[$ax_append_compile_cflags_extra])
|
||||
dnl Not in use -Wc++-compat
|
||||
AX_APPEND_COMPILE_FLAGS([-Wchar-subscripts],[AM_CFLAGS],[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wcomment],[AM_CFLAGS],[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wfloat-equal],[AM_CFLAGS],[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wformat-security],[AM_CFLAGS],[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wformat=2],[AM_CFLAGS],[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wmaybe-uninitialized],[AM_CFLAGS],[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wmissing-field-initializers],[AM_CFLAGS],[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wmissing-noreturn],[AM_CFLAGS],[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wmissing-prototypes],[AM_CFLAGS],[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wnested-externs],[AM_CFLAGS],[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wnormalized=id],[AM_CFLAGS],[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Woverride-init],[AM_CFLAGS],[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wpointer-arith],[AM_CFLAGS],[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wpointer-sign],[AM_CFLAGS],[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wredundant-decls],[AM_CFLAGS],[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wshadow],[AM_CFLAGS],[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wshorten-64-to-32],[AM_CFLAGS],[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wsign-compare],[AM_CFLAGS],[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wstrict-overflow=1],[AM_CFLAGS],[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wstrict-prototypes],[AM_CFLAGS],[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wswitch-enum],[AM_CFLAGS],[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wundef],[AM_CFLAGS],[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wunused],[AM_CFLAGS],[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wunused-result],[AM_CFLAGS],[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wunused-variable],[AM_CFLAGS],[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wwrite-strings],[AM_CFLAGS],[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-fwrapv],[AM_CFLAGS],[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wchar-subscripts],,[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wcomment],,[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wfloat-equal],,[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wformat-security],,[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wformat=2],,[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wmaybe-uninitialized],,[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wmissing-field-initializers],,[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wmissing-noreturn],,[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wmissing-prototypes],,[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wnested-externs],,[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wnormalized=id],,[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Woverride-init],,[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wpointer-arith],,[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wpointer-sign],,[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wredundant-decls],,[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wshadow],,[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wshorten-64-to-32],,[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wsign-compare],,[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wstrict-overflow=1],,[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wstrict-prototypes],,[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wswitch-enum],,[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wundef],,[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wunused],,[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wunused-result],,[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wunused-variable],,[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wwrite-strings],,[$ax_append_compile_cflags_extra])
|
||||
AX_APPEND_COMPILE_FLAGS([-fwrapv],,[$ax_append_compile_cflags_extra])
|
||||
AC_LANG_POP
|
||||
])
|
||||
|
||||
AC_DEFUN([AX_HARDEN_CXX_COMPILER_FLAGS], [
|
||||
AC_REQUIRE_DEFINED([AX_APPEND_COMPILE_FLAGS])
|
||||
AC_REQUIRE([AX_HARDEN_CC_COMPILER_FLAGS])
|
||||
AC_LANG_PUSH([C++])
|
||||
|
||||
|
|
269
m4/ax_pthread.m4
269
m4/ax_pthread.m4
|
@ -14,20 +14,24 @@
|
|||
# flags that are needed. (The user can also force certain compiler
|
||||
# flags/libs to be tested by setting these environment variables.)
|
||||
#
|
||||
# Also sets PTHREAD_CC to any special C compiler that is needed for
|
||||
# multi-threaded programs (defaults to the value of CC otherwise). (This
|
||||
# is necessary on AIX to use the special cc_r compiler alias.)
|
||||
# Also sets PTHREAD_CC and PTHREAD_CXX to any special C compiler that is
|
||||
# needed for multi-threaded programs (defaults to the value of CC
|
||||
# respectively CXX otherwise). (This is necessary on e.g. AIX to use the
|
||||
# special cc_r/CC_r compiler alias.)
|
||||
#
|
||||
# NOTE: You are assumed to not only compile your program with these flags,
|
||||
# but also to link with them as well. For example, you might link with
|
||||
# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
|
||||
# $PTHREAD_CXX $CXXFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
|
||||
#
|
||||
# If you are only building threaded programs, you may wish to use these
|
||||
# variables in your default LIBS, CFLAGS, and CC:
|
||||
#
|
||||
# LIBS="$PTHREAD_LIBS $LIBS"
|
||||
# CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
# CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
|
||||
# CC="$PTHREAD_CC"
|
||||
# CXX="$PTHREAD_CXX"
|
||||
#
|
||||
# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
|
||||
# has a nonstandard name, this macro defines PTHREAD_CREATE_JOINABLE to
|
||||
|
@ -55,6 +59,7 @@
|
|||
#
|
||||
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
|
||||
# Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG>
|
||||
# Copyright (c) 2019 Marc Stevens <marc.stevens@cwi.nl>
|
||||
#
|
||||
# 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
|
||||
|
@ -82,11 +87,11 @@
|
|||
# modified version of the Autoconf Macro, you may extend this special
|
||||
# exception to the GPL to apply to your modified version as well.
|
||||
|
||||
#serial 24
|
||||
#serial 30
|
||||
|
||||
AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
|
||||
AC_DEFUN([AX_PTHREAD], [
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
AC_REQUIRE([AC_CANONICAL_TARGET])
|
||||
AC_REQUIRE([AC_PROG_CC])
|
||||
AC_REQUIRE([AC_PROG_SED])
|
||||
AC_LANG_PUSH([C])
|
||||
|
@ -104,6 +109,7 @@ if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then
|
|||
ax_pthread_save_CFLAGS="$CFLAGS"
|
||||
ax_pthread_save_LIBS="$LIBS"
|
||||
AS_IF([test "x$PTHREAD_CC" != "x"], [CC="$PTHREAD_CC"])
|
||||
AS_IF([test "x$PTHREAD_CXX" != "x"], [CXX="$PTHREAD_CXX"])
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
AC_MSG_CHECKING([for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS])
|
||||
|
@ -123,10 +129,12 @@ fi
|
|||
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
|
||||
# libraries is broken (non-POSIX).
|
||||
|
||||
# Create a list of thread flags to try. Items starting with a "-" are
|
||||
# C compiler flags, and other items are library names, except for "none"
|
||||
# which indicates that we try without any flags at all, and "pthread-config"
|
||||
# which is a program returning the flags for the Pth emulation library.
|
||||
# Create a list of thread flags to try. Items with a "," contain both
|
||||
# C compiler flags (before ",") and linker flags (after ","). Other items
|
||||
# starting with a "-" are C compiler flags, and remaining items are
|
||||
# library names, except for "none" which indicates that we try without
|
||||
# any flags at all, and "pthread-config" which is a program returning
|
||||
# the flags for the Pth emulation library.
|
||||
|
||||
ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
|
||||
|
||||
|
@ -150,7 +158,7 @@ ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --
|
|||
# --thread-safe: KAI C++
|
||||
# pthread-config: use pthread-config program (for GNU Pth library)
|
||||
|
||||
case $host_os in
|
||||
case $target_os in
|
||||
|
||||
freebsd*)
|
||||
|
||||
|
@ -194,36 +202,10 @@ case $host_os in
|
|||
# that too in a future libc.) So we'll check first for the
|
||||
# standard Solaris way of linking pthreads (-mt -lpthread).
|
||||
|
||||
ax_pthread_flags="-mt,pthread pthread $ax_pthread_flags"
|
||||
ax_pthread_flags="-mt,-lpthread pthread $ax_pthread_flags"
|
||||
;;
|
||||
esac
|
||||
|
||||
# GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC)
|
||||
|
||||
AS_IF([test "x$GCC" = "xyes"],
|
||||
[ax_pthread_flags="-pthread -pthreads $ax_pthread_flags"])
|
||||
|
||||
# The presence of a feature test macro requesting re-entrant function
|
||||
# definitions is, on some systems, a strong hint that pthreads support is
|
||||
# correctly enabled
|
||||
|
||||
case $host_os in
|
||||
darwin* | hpux* | linux* | osf* | solaris*)
|
||||
ax_pthread_check_macro="_REENTRANT"
|
||||
;;
|
||||
|
||||
aix*)
|
||||
ax_pthread_check_macro="_THREAD_SAFE"
|
||||
;;
|
||||
|
||||
*)
|
||||
ax_pthread_check_macro="--"
|
||||
;;
|
||||
esac
|
||||
AS_IF([test "x$ax_pthread_check_macro" = "x--"],
|
||||
[ax_pthread_check_cond=0],
|
||||
[ax_pthread_check_cond="!defined($ax_pthread_check_macro)"])
|
||||
|
||||
# Are we compiling with Clang?
|
||||
|
||||
AC_CACHE_CHECK([whether $CC is Clang],
|
||||
|
@ -242,83 +224,47 @@ AC_CACHE_CHECK([whether $CC is Clang],
|
|||
])
|
||||
ax_pthread_clang="$ax_cv_PTHREAD_CLANG"
|
||||
|
||||
ax_pthread_clang_warning=no
|
||||
|
||||
# Clang needs special handling, because older versions handle the -pthread
|
||||
# option in a rather... idiosyncratic way
|
||||
# GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC)
|
||||
|
||||
if test "x$ax_pthread_clang" = "xyes"; then
|
||||
# Note that for GCC and Clang -pthread generally implies -lpthread,
|
||||
# except when -nostdlib is passed.
|
||||
# This is problematic using libtool to build C++ shared libraries with pthread:
|
||||
# [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25460
|
||||
# [2] https://bugzilla.redhat.com/show_bug.cgi?id=661333
|
||||
# [3] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=468555
|
||||
# To solve this, first try -pthread together with -lpthread for GCC
|
||||
|
||||
# Clang takes -pthread; it has never supported any other flag
|
||||
AS_IF([test "x$GCC" = "xyes"],
|
||||
[ax_pthread_flags="-pthread,-lpthread -pthread -pthreads $ax_pthread_flags"])
|
||||
|
||||
# (Note 1: This will need to be revisited if a system that Clang
|
||||
# supports has POSIX threads in a separate library. This tends not
|
||||
# to be the way of modern systems, but it's conceivable.)
|
||||
# Clang takes -pthread (never supported any other flag), but we'll try with -lpthread first
|
||||
|
||||
# (Note 2: On some systems, notably Darwin, -pthread is not needed
|
||||
# to get POSIX threads support; the API is always present and
|
||||
# active. We could reasonably leave PTHREAD_CFLAGS empty. But
|
||||
# -pthread does define _REENTRANT, and while the Darwin headers
|
||||
# ignore this macro, third-party headers might not.)
|
||||
AS_IF([test "x$ax_pthread_clang" = "xyes"],
|
||||
[ax_pthread_flags="-pthread,-lpthread -pthread"])
|
||||
|
||||
PTHREAD_CFLAGS="-pthread"
|
||||
PTHREAD_LIBS=
|
||||
|
||||
ax_pthread_ok=yes
|
||||
# The presence of a feature test macro requesting re-entrant function
|
||||
# definitions is, on some systems, a strong hint that pthreads support is
|
||||
# correctly enabled
|
||||
|
||||
# However, older versions of Clang make a point of warning the user
|
||||
# that, in an invocation where only linking and no compilation is
|
||||
# taking place, the -pthread option has no effect ("argument unused
|
||||
# during compilation"). They expect -pthread to be passed in only
|
||||
# when source code is being compiled.
|
||||
#
|
||||
# Problem is, this is at odds with the way Automake and most other
|
||||
# C build frameworks function, which is that the same flags used in
|
||||
# compilation (CFLAGS) are also used in linking. Many systems
|
||||
# supported by AX_PTHREAD require exactly this for POSIX threads
|
||||
# support, and in fact it is often not straightforward to specify a
|
||||
# flag that is used only in the compilation phase and not in
|
||||
# linking. Such a scenario is extremely rare in practice.
|
||||
#
|
||||
# Even though use of the -pthread flag in linking would only print
|
||||
# a warning, this can be a nuisance for well-run software projects
|
||||
# that build with -Werror. So if the active version of Clang has
|
||||
# this misfeature, we search for an option to squash it.
|
||||
case $target_os in
|
||||
darwin* | hpux* | linux* | osf* | solaris*)
|
||||
ax_pthread_check_macro="_REENTRANT"
|
||||
;;
|
||||
|
||||
AC_CACHE_CHECK([whether Clang needs flag to prevent "argument unused" warning when linking with -pthread],
|
||||
[ax_cv_PTHREAD_CLANG_NO_WARN_FLAG],
|
||||
[ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown
|
||||
# Create an alternate version of $ac_link that compiles and
|
||||
# links in two steps (.c -> .o, .o -> exe) instead of one
|
||||
# (.c -> exe), because the warning occurs only in the second
|
||||
# step
|
||||
ax_pthread_save_ac_link="$ac_link"
|
||||
ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g'
|
||||
ax_pthread_link_step=`$as_echo "$ac_link" | sed "$ax_pthread_sed"`
|
||||
ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)"
|
||||
ax_pthread_save_CFLAGS="$CFLAGS"
|
||||
for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do
|
||||
AS_IF([test "x$ax_pthread_try" = "xunknown"], [break])
|
||||
CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS"
|
||||
ac_link="$ax_pthread_save_ac_link"
|
||||
AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])],
|
||||
[ac_link="$ax_pthread_2step_ac_link"
|
||||
AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])],
|
||||
[break])
|
||||
])
|
||||
done
|
||||
ac_link="$ax_pthread_save_ac_link"
|
||||
CFLAGS="$ax_pthread_save_CFLAGS"
|
||||
AS_IF([test "x$ax_pthread_try" = "x"], [ax_pthread_try=no])
|
||||
ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try"
|
||||
])
|
||||
aix*)
|
||||
ax_pthread_check_macro="_THREAD_SAFE"
|
||||
;;
|
||||
|
||||
case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in
|
||||
no | unknown) ;;
|
||||
*) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;;
|
||||
esac
|
||||
*)
|
||||
ax_pthread_check_macro="--"
|
||||
;;
|
||||
esac
|
||||
AS_IF([test "x$ax_pthread_check_macro" = "x--"],
|
||||
[ax_pthread_check_cond=0],
|
||||
[ax_pthread_check_cond="!defined($ax_pthread_check_macro)"])
|
||||
|
||||
fi # $ax_pthread_clang = yes
|
||||
|
||||
if test "x$ax_pthread_ok" = "xno"; then
|
||||
for ax_pthread_try_flag in $ax_pthread_flags; do
|
||||
|
@ -328,10 +274,10 @@ for ax_pthread_try_flag in $ax_pthread_flags; do
|
|||
AC_MSG_CHECKING([whether pthreads work without any flags])
|
||||
;;
|
||||
|
||||
-mt,pthread)
|
||||
AC_MSG_CHECKING([whether pthreads work with -mt -lpthread])
|
||||
PTHREAD_CFLAGS="-mt"
|
||||
PTHREAD_LIBS="-lpthread"
|
||||
*,*)
|
||||
PTHREAD_CFLAGS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\1/"`
|
||||
PTHREAD_LIBS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\2/"`
|
||||
AC_MSG_CHECKING([whether pthreads work with "$PTHREAD_CFLAGS" and "$PTHREAD_LIBS"])
|
||||
;;
|
||||
|
||||
-*)
|
||||
|
@ -368,10 +314,16 @@ for ax_pthread_try_flag in $ax_pthread_flags; do
|
|||
# We try pthread_create on general principles.
|
||||
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
|
||||
dnl# if $ax_pthread_check_cond
|
||||
dnl# error "$ax_pthread_check_macro must be defined"
|
||||
dnl# endif
|
||||
static void routine(void *a) { a = 0; }
|
||||
# if $ax_pthread_check_cond
|
||||
# error "$ax_pthread_check_macro must be defined"
|
||||
# endif
|
||||
static void *some_global = NULL;
|
||||
static void routine(void *a)
|
||||
{
|
||||
/* To avoid any unused-parameter or
|
||||
unused-but-set-parameter warning. */
|
||||
some_global = a;
|
||||
}
|
||||
static void *start_routine(void *a) { return a; }],
|
||||
[pthread_t th; pthread_attr_t attr;
|
||||
pthread_create(&th, 0, start_routine, 0);
|
||||
|
@ -393,6 +345,80 @@ dnl# endif
|
|||
done
|
||||
fi
|
||||
|
||||
|
||||
# Clang needs special handling, because older versions handle the -pthread
|
||||
# option in a rather... idiosyncratic way
|
||||
|
||||
if test "x$ax_pthread_clang" = "xyes"; then
|
||||
|
||||
# Clang takes -pthread; it has never supported any other flag
|
||||
|
||||
# (Note 1: This will need to be revisited if a system that Clang
|
||||
# supports has POSIX threads in a separate library. This tends not
|
||||
# to be the way of modern systems, but it's conceivable.)
|
||||
|
||||
# (Note 2: On some systems, notably Darwin, -pthread is not needed
|
||||
# to get POSIX threads support; the API is always present and
|
||||
# active. We could reasonably leave PTHREAD_CFLAGS empty. But
|
||||
# -pthread does define _REENTRANT, and while the Darwin headers
|
||||
# ignore this macro, third-party headers might not.)
|
||||
|
||||
# However, older versions of Clang make a point of warning the user
|
||||
# that, in an invocation where only linking and no compilation is
|
||||
# taking place, the -pthread option has no effect ("argument unused
|
||||
# during compilation"). They expect -pthread to be passed in only
|
||||
# when source code is being compiled.
|
||||
#
|
||||
# Problem is, this is at odds with the way Automake and most other
|
||||
# C build frameworks function, which is that the same flags used in
|
||||
# compilation (CFLAGS) are also used in linking. Many systems
|
||||
# supported by AX_PTHREAD require exactly this for POSIX threads
|
||||
# support, and in fact it is often not straightforward to specify a
|
||||
# flag that is used only in the compilation phase and not in
|
||||
# linking. Such a scenario is extremely rare in practice.
|
||||
#
|
||||
# Even though use of the -pthread flag in linking would only print
|
||||
# a warning, this can be a nuisance for well-run software projects
|
||||
# that build with -Werror. So if the active version of Clang has
|
||||
# this misfeature, we search for an option to squash it.
|
||||
|
||||
AC_CACHE_CHECK([whether Clang needs flag to prevent "argument unused" warning when linking with -pthread],
|
||||
[ax_cv_PTHREAD_CLANG_NO_WARN_FLAG],
|
||||
[ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown
|
||||
# Create an alternate version of $ac_link that compiles and
|
||||
# links in two steps (.c -> .o, .o -> exe) instead of one
|
||||
# (.c -> exe), because the warning occurs only in the second
|
||||
# step
|
||||
ax_pthread_save_ac_link="$ac_link"
|
||||
ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g'
|
||||
ax_pthread_link_step=`AS_ECHO(["$ac_link"]) | sed "$ax_pthread_sed"`
|
||||
ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)"
|
||||
ax_pthread_save_CFLAGS="$CFLAGS"
|
||||
for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do
|
||||
AS_IF([test "x$ax_pthread_try" = "xunknown"], [break])
|
||||
CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS"
|
||||
ac_link="$ax_pthread_save_ac_link"
|
||||
AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])],
|
||||
[ac_link="$ax_pthread_2step_ac_link"
|
||||
AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])],
|
||||
[break])
|
||||
])
|
||||
done
|
||||
ac_link="$ax_pthread_save_ac_link"
|
||||
CFLAGS="$ax_pthread_save_CFLAGS"
|
||||
AS_IF([test "x$ax_pthread_try" = "x"], [ax_pthread_try=no])
|
||||
ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try"
|
||||
])
|
||||
|
||||
case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in
|
||||
no | unknown) ;;
|
||||
*) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;;
|
||||
esac
|
||||
|
||||
fi # $ax_pthread_clang = yes
|
||||
|
||||
|
||||
|
||||
# Various other checks:
|
||||
if test "x$ax_pthread_ok" = "xyes"; then
|
||||
ax_pthread_save_CFLAGS="$CFLAGS"
|
||||
|
@ -424,7 +450,7 @@ if test "x$ax_pthread_ok" = "xyes"; then
|
|||
AC_CACHE_CHECK([whether more special flags are required for pthreads],
|
||||
[ax_cv_PTHREAD_SPECIAL_FLAGS],
|
||||
[ax_cv_PTHREAD_SPECIAL_FLAGS=no
|
||||
case $host_os in
|
||||
case $target_os in
|
||||
solaris*)
|
||||
ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS"
|
||||
;;
|
||||
|
@ -438,7 +464,8 @@ if test "x$ax_pthread_ok" = "xyes"; then
|
|||
AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
|
||||
[ax_cv_PTHREAD_PRIO_INHERIT],
|
||||
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
|
||||
[[int i = PTHREAD_PRIO_INHERIT;]])],
|
||||
[[int i = PTHREAD_PRIO_INHERIT;
|
||||
return i;]])],
|
||||
[ax_cv_PTHREAD_PRIO_INHERIT=yes],
|
||||
[ax_cv_PTHREAD_PRIO_INHERIT=no])
|
||||
])
|
||||
|
@ -453,25 +480,35 @@ if test "x$ax_pthread_ok" = "xyes"; then
|
|||
|
||||
# More AIX lossage: compile with *_r variant
|
||||
if test "x$GCC" != "xyes"; then
|
||||
case $host_os in
|
||||
case $target_os in
|
||||
aix*)
|
||||
AS_CASE(["x/$CC"],
|
||||
[x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6],
|
||||
[#handle absolute path differently from PATH based program lookup
|
||||
AS_CASE(["x$CC"],
|
||||
[x/*],
|
||||
[AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])],
|
||||
[AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])])
|
||||
[
|
||||
AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])
|
||||
AS_IF([test "x${CXX}" != "x"], [AS_IF([AS_EXECUTABLE_P([${CXX}_r])],[PTHREAD_CXX="${CXX}_r"])])
|
||||
],
|
||||
[
|
||||
AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])
|
||||
AS_IF([test "x${CXX}" != "x"], [AC_CHECK_PROGS([PTHREAD_CXX],[${CXX}_r],[$CXX])])
|
||||
]
|
||||
)
|
||||
])
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
|
||||
test -n "$PTHREAD_CXX" || PTHREAD_CXX="$CXX"
|
||||
|
||||
AC_SUBST([PTHREAD_LIBS])
|
||||
AC_SUBST([PTHREAD_CFLAGS])
|
||||
AC_SUBST([PTHREAD_CC])
|
||||
AC_SUBST([PTHREAD_CXX])
|
||||
|
||||
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
|
||||
if test "x$ax_pthread_ok" = "xyes"; then
|
||||
|
|
|
@ -45,7 +45,10 @@
|
|||
# (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 6
|
||||
#serial 6.1
|
||||
#
|
||||
# Added tweak for git. The base repo's .git is a directory. Any worktree's
|
||||
# .git is a file. Use -e to check for either dir or file.
|
||||
|
||||
AC_DEFUN([AX_VCS_SYSTEM],
|
||||
[AC_PREREQ([2.63])dnl
|
||||
|
@ -54,7 +57,7 @@ AC_DEFUN([AX_VCS_SYSTEM],
|
|||
AS_IF([test -d ".bzr"],[ac_cv_vcs_system="bazaar"])
|
||||
AS_IF([test -d ".svn"],[ac_cv_vcs_system="svn"])
|
||||
AS_IF([test -d ".hg"],[ac_cv_vcs_system="mercurial"])
|
||||
AS_IF([test -d ".git"],[ac_cv_vcs_system="git"])
|
||||
AS_IF([test -e ".git"],[ac_cv_vcs_system="git"])
|
||||
])
|
||||
AC_DEFINE_UNQUOTED([VCS_SYSTEM],["$ac_cv_vcs_system"],[VCS system])
|
||||
])
|
||||
|
|
Loading…
Reference in New Issue