diff --git a/configure b/configure index 1794f5113a..86fc3270ee 100755 --- a/configure +++ b/configure @@ -669,6 +669,8 @@ BIND9_ISCCFG_BUILDINCLUDE BIND9_ISCCC_BUILDINCLUDE BIND9_ISC_BUILDINCLUDE BIND9_TOP_BUILDDIR +WRAP_NAME +WRAP_INTERPOSE LD_WRAP_TESTS KYUA UNITTESTS @@ -850,7 +852,6 @@ infodir docdir oldincludedir includedir -runstatedir localstatedir sharedstatedir sysconfdir @@ -1023,7 +1024,6 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' -runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1276,15 +1276,6 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; - -runstatedir | --runstatedir | --runstatedi | --runstated \ - | --runstate | --runstat | --runsta | --runst | --runs \ - | --run | --ru | --r) - ac_prev=runstatedir ;; - -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ - | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ - | --run=* | --ru=* | --r=*) - runstatedir=$ac_optarg ;; - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1422,7 +1413,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir runstatedir + libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1575,7 +1566,6 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -4019,7 +4009,7 @@ else We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -4065,7 +4055,7 @@ else We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -4089,7 +4079,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -4134,7 +4124,7 @@ else We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -4158,7 +4148,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -21814,6 +21804,166 @@ rm -f core conftest.err conftest.$ac_objext \ +WRAP_INTERPOSE= +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker support for '-z interpose' option" >&5 +$as_echo_n "checking for linker support for '-z interpose' option... " >&6; } + + + CCASFLAGS_interpose_ax_save_flags=$CCASFLAGS + + + + CFLAGS_interpose_ax_save_flags=$CFLAGS + + + + CPPFLAGS_interpose_ax_save_flags=$CPPFLAGS + + + + CXXFLAGS_interpose_ax_save_flags=$CXXFLAGS + + + + ERLCFLAGS_interpose_ax_save_flags=$ERLCFLAGS + + + + FCFLAGS_interpose_ax_save_flags=$FCFLAGS + + + + FCLIBS_interpose_ax_save_flags=$FCLIBS + + + + FFLAGS_interpose_ax_save_flags=$FFLAGS + + + + FLIBS_interpose_ax_save_flags=$FLIBS + + + + GCJFLAGS_interpose_ax_save_flags=$GCJFLAGS + + + + JAVACFLAGS_interpose_ax_save_flags=$JAVACFLAGS + + + + LDFLAGS_interpose_ax_save_flags=$LDFLAGS + + + + LIBS_interpose_ax_save_flags=$LIBS + + + + OBJCFLAGS_interpose_ax_save_flags=$OBJCFLAGS + + + + OBJCXXFLAGS_interpose_ax_save_flags=$OBJCXXFLAGS + + + + UPCFLAGS_interpose_ax_save_flags=$UPCFLAGS + + + + VALAFLAGS_interpose_ax_save_flags=$VALAFLAGS + + + +LDFLAGS="-Wl,-z,interpose" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + WRAP_INTERPOSE="-Wl,-z,interpose" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + + CCASFLAGS=$CCASFLAGS_interpose_ax_save_flags + + + CFLAGS=$CFLAGS_interpose_ax_save_flags + + + CPPFLAGS=$CPPFLAGS_interpose_ax_save_flags + + + CXXFLAGS=$CXXFLAGS_interpose_ax_save_flags + + + ERLCFLAGS=$ERLCFLAGS_interpose_ax_save_flags + + + FCFLAGS=$FCFLAGS_interpose_ax_save_flags + + + FCLIBS=$FCLIBS_interpose_ax_save_flags + + + FFLAGS=$FFLAGS_interpose_ax_save_flags + + + FLIBS=$FLIBS_interpose_ax_save_flags + + + GCJFLAGS=$GCJFLAGS_interpose_ax_save_flags + + + JAVACFLAGS=$JAVACFLAGS_interpose_ax_save_flags + + + LDFLAGS=$LDFLAGS_interpose_ax_save_flags + + + LIBS=$LIBS_interpose_ax_save_flags + + + OBJCFLAGS=$OBJCFLAGS_interpose_ax_save_flags + + + OBJCXXFLAGS=$OBJCXXFLAGS_interpose_ax_save_flags + + + UPCFLAGS=$UPCFLAGS_interpose_ax_save_flags + + + VALAFLAGS=$VALAFLAGS_interpose_ax_save_flags + + + + + + +WRAP_NAME='' +case $host in #( + *-darwin*) : + WRAP_NAME='${WRAP_NAME}' ;; #( + *) : + ;; +esac + + # # Check for i18n # diff --git a/configure.ac b/configure.ac index f657d81562..7132612ac4 100644 --- a/configure.ac +++ b/configure.ac @@ -2191,6 +2191,23 @@ AX_RESTORE_FLAGS([wrap]) AC_SUBST([LD_WRAP_TESTS]) +WRAP_INTERPOSE= +AC_MSG_CHECKING([for linker support for '-z interpose' option]) +AX_SAVE_FLAGS([interpose]) +LDFLAGS="-Wl,-z,interpose" +AC_LINK_IFELSE( + [AC_LANG_PROGRAM([],[])], + [WRAP_INTERPOSE="-Wl,-z,interpose" + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])]) +AX_RESTORE_FLAGS([interpose]) + +AC_SUBST([WRAP_INTERPOSE]) + +WRAP_NAME='' +AS_CASE([$host],[*-darwin*],[WRAP_NAME='${WRAP_NAME}']) +AC_SUBST([WRAP_NAME]) + # # Check for i18n # diff --git a/lib/ns/tests/Makefile.in b/lib/ns/tests/Makefile.in index 0ba61773ff..5fb2c1e394 100644 --- a/lib/ns/tests/Makefile.in +++ b/lib/ns/tests/Makefile.in @@ -15,7 +15,11 @@ VERSION=@BIND9_VERSION@ @BIND9_MAKE_INCLUDES@ +WRAP_INTERPOSE= @WRAP_INTERPOSE@ WRAP_OPTIONS = -Wl,--wrap=isc_nmhandle_unref +WRAP_NAME = -Wl,-install_name,${top_builddir}/lib/ns/tests/$@ +WRAP_RPATH = -Wl,-rpath,${top_builddir}/lib/ns/tests +WRAP_LIB = -L${top_builddir}/lib/ns/tests -lwrap CINCLUDES = -I. -Iinclude ${NS_INCLUDES} ${DNS_INCLUDES} ${ISC_INCLUDES} \ ${OPENSSL_CFLAGS} \ @@ -36,7 +40,7 @@ SO_LDFLAGS = @LDFLAGS@ @SO_LDFLAGS@ SO_OBJS = wrap.@O@ SO_SRCS = wrap.c -SO_TARGETS = libwrap.la +SO_TARGETS = libwrap.@SO@ OBJS = nstest.@O@ SRCS = nstest.c \ @@ -56,32 +60,32 @@ LD_WRAP_TESTS=@LD_WRAP_TESTS@ @BIND9_MAKE_RULES@ -libwrap.la: wrap.@O@ - ${LIBTOOL_MODE_LINK} @SO_LD@ ${SO_LDFLAGS} -Wl,-z,interpose -o $@ wrap.@O@ ${LIBS} +libwrap.@SO@: wrap.@O@ + ${LIBTOOL_MODE_LINK} @SO_LD@ ${SO_LDFLAGS} ${WRAP_INTERPOSE} @WRAP_NAME@ -o $@ wrap.@O@ ${LIBS} -listenlist_test@EXEEXT@: listenlist_test.@O@ nstest.@O@ libwrap.la ${NSDEPLIBS} ${ISCDEPLIBS} ${DNSDEPLIBS} +listenlist_test@EXEEXT@: listenlist_test.@O@ nstest.@O@ libwrap.@SO@ ${NSDEPLIBS} ${ISCDEPLIBS} ${DNSDEPLIBS} if test "${LD_WRAP_TESTS}" = true -a -z "${LIBTOOL}"; then WRAP="${WRAP_OPTIONS}"; fi; \ ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \ - ${LDFLAGS} $${WRAP} -Wl,-rpath=${top_builddir}/lib/ns/tests -o $@ listenlist_test.@O@ nstest.@O@ \ - libwrap.la ${NSLIBS} ${DNSLIBS} ${ISCLIBS} ${LIBS} + ${LDFLAGS} $${WRAP} ${WRAP_RPATH} -o $@ listenlist_test.@O@ nstest.@O@ \ + ${WRAP_LIB} ${NSLIBS} ${DNSLIBS} ${ISCLIBS} ${LIBS} -notify_test@EXEEXT@: notify_test.@O@ nstest.@O@ libwrap.la ${NSDEPLIBS} ${ISCDEPLIBS} ${DNSDEPLIBS} +notify_test@EXEEXT@: notify_test.@O@ nstest.@O@ libwrap.@SO@ ${NSDEPLIBS} ${ISCDEPLIBS} ${DNSDEPLIBS} if test "${LD_WRAP_TESTS}" = true -a -z "${LIBTOOL}"; then WRAP="${WRAP_OPTIONS}"; fi; \ ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \ - ${LDFLAGS} $${WRAP} -Wl,-rpath=${top_builddir}/lib/ns/tests -o $@ notify_test.@O@ nstest.@O@ libwrap.la \ - libwrap.la ${NSLIBS} ${DNSLIBS} ${ISCLIBS} ${LIBS} + ${LDFLAGS} $${WRAP} ${WRAP_RPATH} -o $@ notify_test.@O@ nstest.@O@ \ + ${WRAP_LIB} ${NSLIBS} ${DNSLIBS} ${ISCLIBS} ${LIBS} -plugin_test@EXEEXT@: plugin_test.@O@ nstest.@O@ libwrap.la ${NSDEPLIBS} ${ISCDEPLIBS} ${DNSDEPLIBS} +plugin_test@EXEEXT@: plugin_test.@O@ nstest.@O@ libwrap.@SO@ ${NSDEPLIBS} ${ISCDEPLIBS} ${DNSDEPLIBS} if test "${LD_WRAP_TESTS}" = true -a -z "${LIBTOOL}"; then WRAP="${WRAP_OPTIONS}"; fi; \ ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \ - ${LDFLAGS} $${WRAP} -Wl,-rpath=${top_builddir}/lib/ns/tests -o $@ plugin_test.@O@ nstest.@O@ \ - libwrap.la ${NSLIBS} ${DNSLIBS} ${ISCLIBS} ${LIBS} + ${LDFLAGS} $${WRAP} ${WRAP_RPATH} -o $@ plugin_test.@O@ nstest.@O@ \ + ${WRAP_LIB} ${NSLIBS} ${DNSLIBS} ${ISCLIBS} ${LIBS} -query_test@EXEEXT@: query_test.@O@ nstest.@O@ libwrap.la ${NSDEPLIBS} ${ISCDEPLIBS} ${DNSDEPLIBS} +query_test@EXEEXT@: query_test.@O@ nstest.@O@ libwrap.@SO@ ${NSDEPLIBS} ${ISCDEPLIBS} ${DNSDEPLIBS} if test "${LD_WRAP_TESTS}" = true -a -z "${LIBTOOL}"; then WRAP="${WRAP_OPTIONS}"; fi; \ ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \ - ${LDFLAGS} $${WRAP} -Wl,-rpath=${top_builddir}/lib/ns/tests -o $@ query_test.@O@ nstest.@O@ \ - libwrap.la ${NSLIBS} ${DNSLIBS} ${ISCLIBS} ${LIBS} + ${LDFLAGS} $${WRAP} ${WRAP_RPATH} -o $@ query_test.@O@ nstest.@O@ \ + ${WRAP_LIB} ${NSLIBS} ${DNSLIBS} ${ISCLIBS} ${LIBS} unit:: sh ${top_builddir}/unit/unittest.sh diff --git a/lib/ns/tests/notify_test.c b/lib/ns/tests/notify_test.c index bc94fcc01b..926bf246a0 100644 --- a/lib/ns/tests/notify_test.c +++ b/lib/ns/tests/notify_test.c @@ -39,6 +39,7 @@ #include "nstest.h" +#if defined(USE_LIBTOOL) || LD_WRAP static int _setup(void **state) { isc_result_t result; @@ -139,15 +140,20 @@ notify_start(void **state) { ns_test_cleanup_zone(); isc_nmhandle_unref(client->handle); } +#endif int main(void) { +#if defined(USE_LIBTOOL) || LD_WRAP const struct CMUnitTest tests[] = { cmocka_unit_test_setup_teardown(notify_start, _setup, _teardown), }; return (cmocka_run_group_tests(tests, NULL, NULL)); +#else + print_message("1..0 # Skip notify_test requires libtool or LD_WRAP\n"); +#endif } #else /* HAVE_CMOCKA && !__SANITIZE_ADDRESS__ */ diff --git a/lib/ns/tests/query_test.c b/lib/ns/tests/query_test.c index 3094ced2b8..d0b5bbf905 100644 --- a/lib/ns/tests/query_test.c +++ b/lib/ns/tests/query_test.c @@ -35,6 +35,7 @@ #include "nstest.h" +#if defined(USE_LIBTOOL) || LD_WRAP static int _setup(void **state) { isc_result_t result; @@ -588,9 +589,11 @@ ns__query_start_test(void **state) { run_start_test(&tests[i]); } } +#endif int main(void) { +#if defined(USE_LIBTOOL) || LD_WRAP const struct CMUnitTest tests[] = { cmocka_unit_test_setup_teardown(ns__query_sfcache_test, _setup, _teardown), @@ -599,6 +602,9 @@ main(void) { }; return (cmocka_run_group_tests(tests, NULL, NULL)); +#else + print_message("1..0 # Skip query_test requires libtool or LD_WRAP\n"); +#endif } #else /* HAVE_CMOCKA && !__SANITIZE_ADDRESS__ */