]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Add a check for -Wl, --wrap support in linker
authorSelva Nair <selva.nair@gmail.com>
Wed, 18 Jan 2017 20:42:52 +0000 (15:42 -0500)
committerDavid Sommerseth <davids@openvpn.net>
Fri, 20 Jan 2017 16:55:38 +0000 (17:55 +0100)
- 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>
(cherry picked from commit f91ab283a407e25c4b32aecb390911b212ce2694)

configure.ac
tests/unit_tests/openvpn/Makefile.am

index 43487b01dd55c04f27cf93f2ddac1698cae76a42..8783109f801ed767fb709b372af2aa6fab921c6c 100644 (file)
@@ -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"
index fafe6b27431911138e3224d4efa9f06b6f4c8293..b902b2098fc11c2a1ae214787bf2f6785b5fe0be 100644 (file)
@@ -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