Browse Source

fix #356, disable TLS for uClibc

pull/363/head
Max Lv 9 years ago
parent
commit
2b1eef1197
14 changed files with 184 additions and 39 deletions
  1. 11
      Makefile.in
  2. 1
      aclocal.m4
  3. 3
      config.h.in
  4. 54
      configure
  5. 3
      configure.ac
  6. 11
      libcork/Makefile.in
  7. 4
      libcork/include/libcork/config/gcc.h
  8. 11
      libev/Makefile.in
  9. 11
      libipset/Makefile.in
  10. 11
      libudns/Makefile.in
  11. 74
      m4/ax_tls.m4
  12. 4
      openwrt/Makefile
  13. 4
      src/Makefile.am
  14. 21
      src/Makefile.in

11
Makefile.in

@ -60,11 +60,12 @@ DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \
auto/missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \
$(top_srcdir)/m4/inet_ntop.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/openssl.m4 $(top_srcdir)/m4/polarssl.m4 \
$(top_srcdir)/libev/libev.m4 $(top_srcdir)/configure.ac
$(top_srcdir)/m4/ax_tls.m4 $(top_srcdir)/m4/inet_ntop.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/openssl.m4 \
$(top_srcdir)/m4/polarssl.m4 $(top_srcdir)/libev/libev.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \

1
aclocal.m4

@ -1163,6 +1163,7 @@ AC_SUBST([am__untar])
]) # _AM_PROG_TAR
m4_include([m4/acx_pthread.m4])
m4_include([m4/ax_tls.m4])
m4_include([m4/inet_ntop.m4])
m4_include([m4/libtool.m4])
m4_include([m4/ltoptions.m4])

3
config.h.in

@ -298,6 +298,9 @@
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
/* If the compiler supports a TLS storage class define it to that here */
#undef TLS
/* Use Apple CommonCrypto library */
#undef USE_CRYPTO_APPLECC

54
configure

@ -12851,6 +12851,60 @@ case $host in
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for thread local storage (TLS) class" >&5
$as_echo_n "checking for thread local storage (TLS) class... " >&6; }
if ${ac_cv_tls+:} false; then :
$as_echo_n "(cached) " >&6
else
for ax_tls_keyword in __thread '__declspec(thread)' none; do
case $ax_tls_keyword in #(
none) :
ac_cv_tls=none ; break ;; #(
*) :
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdlib.h>
static void
foo(void) {
static $ax_tls_keyword int bar;
exit(1);
}
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_tls=$ax_tls_keyword ; break
else
ac_cv_tls=none
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ;;
esac
done
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_tls" >&5
$as_echo "$ac_cv_tls" >&6; }
if test "$ac_cv_tls" != "none"; then :
cat >>confdefs.h <<_ACEOF
#define TLS $ac_cv_tls
_ACEOF
:
else
:
fi
case "${with_crypto_library}" in
openssl)

3
configure.ac

@ -53,6 +53,9 @@ case $host in
;;
esac
dnl Checks for TLS
AX_TLS([:], [:])
dnl Checks for crypto library
case "${with_crypto_library}" in
openssl)

11
libcork/Makefile.in

@ -73,11 +73,12 @@ subdir = libcork
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in COPYING
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \
$(top_srcdir)/m4/inet_ntop.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/openssl.m4 $(top_srcdir)/m4/polarssl.m4 \
$(top_srcdir)/libev/libev.m4 $(top_srcdir)/configure.ac
$(top_srcdir)/m4/ax_tls.m4 $(top_srcdir)/m4/inet_ntop.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/openssl.m4 \
$(top_srcdir)/m4/polarssl.m4 $(top_srcdir)/libev/libev.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d

4
libcork/include/libcork/config/gcc.h

@ -75,10 +75,10 @@
#endif
/* Thread-local storage has been available since GCC 3.3, but not on Mac
* OS X. */
* OS X. Also disable TLS for uClibc*/
#if !(defined(__APPLE__) && defined(__MACH__))
#if CORK_CONFIG_GCC_VERSION >= 30300
#if CORK_CONFIG_GCC_VERSION >= 30300 && defined(TLS)
#define CORK_CONFIG_HAVE_THREAD_STORAGE_CLASS 1
#else
#define CORK_CONFIG_HAVE_THREAD_STORAGE_CLASS 0

11
libev/Makefile.in

@ -57,11 +57,12 @@ DIST_COMMON = README $(noinst_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \
$(top_srcdir)/m4/inet_ntop.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/openssl.m4 $(top_srcdir)/m4/polarssl.m4 \
$(top_srcdir)/libev/libev.m4 $(top_srcdir)/configure.ac
$(top_srcdir)/m4/ax_tls.m4 $(top_srcdir)/m4/inet_ntop.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/openssl.m4 \
$(top_srcdir)/m4/polarssl.m4 $(top_srcdir)/libev/libev.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d

11
libipset/Makefile.in

@ -73,11 +73,12 @@ subdir = libipset
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \
$(top_srcdir)/m4/inet_ntop.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/openssl.m4 $(top_srcdir)/m4/polarssl.m4 \
$(top_srcdir)/libev/libev.m4 $(top_srcdir)/configure.ac
$(top_srcdir)/m4/ax_tls.m4 $(top_srcdir)/m4/inet_ntop.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/openssl.m4 \
$(top_srcdir)/m4/polarssl.m4 $(top_srcdir)/libev/libev.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d

11
libudns/Makefile.in

@ -73,11 +73,12 @@ subdir = libudns
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in NEWS TODO
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \
$(top_srcdir)/m4/inet_ntop.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/openssl.m4 $(top_srcdir)/m4/polarssl.m4 \
$(top_srcdir)/libev/libev.m4 $(top_srcdir)/configure.ac
$(top_srcdir)/m4/ax_tls.m4 $(top_srcdir)/m4/inet_ntop.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/openssl.m4 \
$(top_srcdir)/m4/polarssl.m4 $(top_srcdir)/libev/libev.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d

74
m4/ax_tls.m4

@ -0,0 +1,74 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_tls.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_TLS([action-if-found], [action-if-not-found])
#
# DESCRIPTION
#
# Provides a test for the compiler support of thread local storage (TLS)
# extensions. Defines TLS if it is found. Currently knows about GCC/ICC
# and MSVC. I think SunPro uses the same as GCC, and Borland apparently
# supports either.
#
# LICENSE
#
# Copyright (c) 2008 Alan Woodland <ajw05@aber.ac.uk>
# Copyright (c) 2010 Diego Elio Petteno` <flameeyes@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 3 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 <http://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 11
AC_DEFUN([AX_TLS], [
AC_MSG_CHECKING([for thread local storage (TLS) class])
AC_CACHE_VAL([ac_cv_tls],
[for ax_tls_keyword in __thread '__declspec(thread)' none; do
AS_CASE([$ax_tls_keyword],
[none], [ac_cv_tls=none ; break],
[AC_TRY_COMPILE(
[#include <stdlib.h>
static void
foo(void) {
static ] $ax_tls_keyword [ int bar;
exit(1);
}],
[],
[ac_cv_tls=$ax_tls_keyword ; break],
ac_cv_tls=none
)])
done
])
AC_MSG_RESULT([$ac_cv_tls])
AS_IF([test "$ac_cv_tls" != "none"],
[AC_DEFINE_UNQUOTED([TLS],[$ac_cv_tls],[If the compiler supports a TLS storage class define it to that here])
m4_ifnblank([$1],[$1])],
[m4_ifnblank([$2],[$2])])
])

4
openwrt/Makefile

@ -28,14 +28,14 @@ define Package/shadowsocks-libev
$(call Package/shadowsocks-libev/Default)
TITLE+= (OpenSSL)
VARIANT:=openssl
DEPENDS:=+libopenssl
DEPENDS:=+libopenssl +libpthread
endef
define Package/shadowsocks-libev-polarssl
$(call Package/shadowsocks-libev/Default)
TITLE+= (PolarSSL)
VARIANT:=polarssl
DEPENDS:=+libpolarssl
DEPENDS:=+libpolarssl +libpthread
endef
define Package/shadowsocks-libev/description

4
src/Makefile.am

@ -1,6 +1,7 @@
VERSION_INFO = 1:0:0
AM_CFLAGS = -g -O2 -Wall -Werror -Wno-deprecated-declarations -fno-strict-aliasing -std=gnu99 -D_GNU_SOURCE
AM_CFLAGS += $(PTHREAD_CFLAGS)
AM_CFLAGS += -I$(top_srcdir)/libev
AM_CFLAGS += -I$(top_srcdir)/libudns
AM_CFLAGS += -I$(top_srcdir)/libipset/include
@ -9,7 +10,8 @@ AM_CFLAGS += -I$(top_srcdir)/libsodium/src/libsodium/include
AM_LDFLAGS = -static
SS_COMMON_LIBS = $(top_builddir)/libev/libev.la \
SS_COMMON_LIBS = $(PTHREAD_LIBS) \
$(top_builddir)/libev/libev.la \
$(top_builddir)/libipset/libipset.la \
$(top_builddir)/libcork/libcork.la \
$(top_builddir)/libsodium/src/libsodium/libsodium.la \

21
src/Makefile.in

@ -64,11 +64,12 @@ DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \
$(top_srcdir)/m4/inet_ntop.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/openssl.m4 $(top_srcdir)/m4/polarssl.m4 \
$(top_srcdir)/libev/libev.m4 $(top_srcdir)/configure.ac
$(top_srcdir)/m4/ax_tls.m4 $(top_srcdir)/m4/inet_ntop.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/openssl.m4 \
$(top_srcdir)/m4/polarssl.m4 $(top_srcdir)/libev/libev.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@ -106,7 +107,8 @@ am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \
"$(DESTDIR)$(includedir)"
LTLIBRARIES = $(lib_LTLIBRARIES)
am__DEPENDENCIES_1 =
am__DEPENDENCIES_2 = $(top_builddir)/libev/libev.la \
am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) \
$(top_builddir)/libev/libev.la \
$(top_builddir)/libipset/libipset.la \
$(top_builddir)/libcork/libcork.la \
$(top_builddir)/libsodium/src/libsodium/libsodium.la \
@ -355,12 +357,13 @@ top_srcdir = @top_srcdir@
VERSION_INFO = 1:0:0
AM_CFLAGS = -g -O2 -Wall -Werror -Wno-deprecated-declarations \
-fno-strict-aliasing -std=gnu99 -D_GNU_SOURCE \
-I$(top_srcdir)/libev -I$(top_srcdir)/libudns \
-I$(top_srcdir)/libipset/include \
$(PTHREAD_CFLAGS) -I$(top_srcdir)/libev \
-I$(top_srcdir)/libudns -I$(top_srcdir)/libipset/include \
-I$(top_srcdir)/libcork/include \
-I$(top_srcdir)/libsodium/src/libsodium/include
AM_LDFLAGS = -static
SS_COMMON_LIBS = $(top_builddir)/libev/libev.la \
SS_COMMON_LIBS = $(PTHREAD_LIBS) \
$(top_builddir)/libev/libev.la \
$(top_builddir)/libipset/libipset.la \
$(top_builddir)/libcork/libcork.la \
$(top_builddir)/libsodium/src/libsodium/libsodium.la \

Loading…
Cancel
Save