aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSelva Nair2017-01-18 15:42:52 -0500
committerDavid Sommerseth2017-01-20 17:55:14 +0100
commitf91ab283a407e25c4b32aecb390911b212ce2694 (patch)
treebe91ea98684abc0bc4bc8238ef8c8dd8765343a8
parent4cd4899e8e80efae03c584a760fd107251735723 (diff)
downloadopenvpn-f91ab283a407e25c4b32aecb390911b212ce2694.zip
openvpn-f91ab283a407e25c4b32aecb390911b212ce2694.tar.gz
Add a check for -Wl, --wrap support in linker
- Also make tests that require --wrap option to be conditional on this support [ DS: Removed AC_DEFINE([HAVE_LD_WRAP_SUPPORT],...) at commit time as we now see no real use for such a #define in config.h ] Signed-off-by: Selva Nair <selva.nair@gmail.com> Acked-by: Gert Doering <gert@greenie.muc.de> Acked-by: David Sommerseth <davids@openvpn.net> Message-Id: <1484772172-19758-1-git-send-email-selva.nair@gmail.com> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg13897.html Signed-off-by: David Sommerseth <davids@openvpn.net>
-rw-r--r--configure.ac25
-rw-r--r--tests/unit_tests/openvpn/Makefile.am6
2 files changed, 30 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 43487b0..8783109 100644
--- a/configure.ac
+++ b/configure.ac
@@ -582,6 +582,30 @@ AC_COMPILE_IFELSE(
[AC_MSG_RESULT([no])]
)
+saved_LDFLAGS="$LDFLAGS"
+LDFLAGS="$LDFLAGS -Wl,--wrap=exit"
+AC_MSG_CHECKING([linker supports --wrap])
+AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+ void exit(int);
+ void __real_exit(int);
+ void __wrap_exit(int i) {
+ __real_exit(i);
+ }
+ ]],
+ [[
+ exit(0);
+ ]]
+ )],
+ [
+ AC_MSG_RESULT([yes])
+ have_ld_wrap_support=yes
+ ],
+ [AC_MSG_RESULT([no])],
+)
+LDFLAGS="$saved_LDFLAGS"
+
dnl We emulate signals in Windows
AC_CHECK_DECLS(
[SIGHUP],
@@ -1244,6 +1268,7 @@ AM_CONDITIONAL([GIT_CHECKOUT], [test "${GIT_CHECKOUT}" = "yes"])
AM_CONDITIONAL([ENABLE_PLUGIN_AUTH_PAM], [test "${enable_plugin_auth_pam}" = "yes"])
AM_CONDITIONAL([ENABLE_PLUGIN_DOWN_ROOT], [test "${enable_plugin_down_root}" = "yes"])
AM_CONDITIONAL([ENABLE_CRYPTO], [test "${enable_crypto}" = "yes"])
+AM_CONDITIONAL([HAVE_LD_WRAP_SUPPORT], [test "${have_ld_wrap_support}" = "yes"])
plugindir="${with_plugindir}"
sampledir="\$(docdir)/sample"
diff --git a/tests/unit_tests/openvpn/Makefile.am b/tests/unit_tests/openvpn/Makefile.am
index fafe6b2..b902b20 100644
--- a/tests/unit_tests/openvpn/Makefile.am
+++ b/tests/unit_tests/openvpn/Makefile.am
@@ -1,6 +1,10 @@
AUTOMAKE_OPTIONS = foreign
-check_PROGRAMS = argv_testdriver buffer_testdriver
+check_PROGRAMS=
+
+if HAVE_LD_WRAP_SUPPORT
+check_PROGRAMS += argv_testdriver buffer_testdriver
+endif
if ENABLE_CRYPTO
check_PROGRAMS += tls_crypt_testdriver