From 56d96e2260ada51e31cceded0dc9b46937c0cb64 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Tue, 20 Oct 2020 17:17:46 -0400 Subject: Add --disable-rpath to configure (fixes #422) --- ChangeLog | 6 ++++++ TODO | 1 - autoconf.mk.in | 1 + autofiles.sums | 2 +- configure | 27 +++++++++++++++++++++++++++ configure.ac | 17 +++++++++++++++++ make/libtool.mk | 2 +- 7 files changed, 53 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2071b467..2fbf7fad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2020-10-20 Jay Berkenbilt + + * Build option: add --disable-rpath option to ./configure, which + disables passing -rpath to the linker when building shared + libraries with libtool. Fixes #422. + 2020-10-18 Jay Berkenbilt * Note that InputSource::unreadCh is deprecated and will be diff --git a/TODO b/TODO index 2b0492d6..6ff6299c 100644 --- a/TODO +++ b/TODO @@ -6,7 +6,6 @@ Candidates for upcoming release * Add --warning-exit-0 option. Search for --no-warn in the docs. * Easy build/test - * #422: disable rpath when building RPM * #352: building standalone executables (lambda layer) * #460: potential malware in fuzzer seed corpus * Consider building workflow on a schedule to detect build rot. This diff --git a/autoconf.mk.in b/autoconf.mk.in index cbf57efc..2836b4f1 100644 --- a/autoconf.mk.in +++ b/autoconf.mk.in @@ -23,6 +23,7 @@ LIBS=@LIBS@ CPPFLAGS=@CPPFLAGS@ CXX=@CXX@ CXXFLAGS=@CXXFLAGS@ $(CXXWFLAGS) $(WFLAGS) +RPATH=@RPATH@ AR=@AR@ RANLIB=@RANLIB@ DLLTOOL=@DLLTOOL@ diff --git a/autofiles.sums b/autofiles.sums index c0c1cc30..68d99e36 100644 --- a/autofiles.sums +++ b/autofiles.sums @@ -1,4 +1,4 @@ -d2cb3f80935a7e6e265a04da6ba9c0df4eabae3de33c6a48384a9fa50a15143b configure.ac +cc3c7947646412e7c3152c3ef238226ede1c2199328a38df93debee26184b087 configure.ac d3f9ee6f6f0846888d9a10fd3dad2e4b1258be84205426cf04d7cef02d61dad7 aclocal.m4 cf2c764639c4c94abc183a0976eca6ae500b80790ea25e3d0af97b23587363b7 libqpdf/qpdf/qpdf-config.h.in 5297971a0ef90bcd5563eb3f7127a032bb76d3ae2af7258bf13479caf8983a60 m4/ax_cxx_compile_stdcxx.m4 diff --git a/configure b/configure index 2b21fc79..12cf68cc 100755 --- a/configure +++ b/configure @@ -670,6 +670,7 @@ PKG_CONFIG WINDOWS_WORDSIZE IS_32BIT RANDOM_DEVICE +RPATH LT_SONAME LT_AGE LT_REVISION @@ -775,6 +776,7 @@ with_aix_soname with_gnu_ld with_sysroot enable_libtool_lock +enable_rpath enable_insecure_random enable_os_secure_random with_random @@ -1458,6 +1460,8 @@ Optional Features: --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) + --enable-rpath whether to pass -rpath to the linker when building + libraries --enable-insecure-random whether to use stdlib's random number generator (default is no) @@ -16213,6 +16217,29 @@ LT_REVISION=1 LT_SONAME=$(expr $LT_CURRENT - $LT_AGE) +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for whether to use -rpath" >&5 +$as_echo_n "checking for whether to use -rpath... " >&6; } +# Check whether --enable-rpath was given. +if test "${enable_rpath+set}" = set; then : + enableval=$enable_rpath; if test "$enableval" = "yes"; then + qpdf_USE_RPATH=1; + else + qpdf_USE_RPATH=0; + fi +else + qpdf_USE_RPATH=1 +fi + +if test "$qpdf_USE_RPATH" = "1"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + RPATH='-rpath $(libdir)' +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fvisibility=hidden" >&5 $as_echo_n "checking for -fvisibility=hidden... " >&6; } try_flags=-fvisibility=hidden diff --git a/configure.ac b/configure.ac index bd2ee15a..136e51b7 100644 --- a/configure.ac +++ b/configure.ac @@ -61,6 +61,23 @@ AC_SUBST(LT_AGE) LT_SONAME=$(expr $LT_CURRENT - $LT_AGE) AC_SUBST(LT_SONAME) +AC_MSG_CHECKING(for whether to use -rpath) +AC_ARG_ENABLE(rpath, + AS_HELP_STRING([--enable-rpath], + [whether to pass -rpath to the linker when building libraries]), + [if test "$enableval" = "yes"; then + qpdf_USE_RPATH=1; + else + qpdf_USE_RPATH=0; + fi], [qpdf_USE_RPATH=1]) +if test "$qpdf_USE_RPATH" = "1"; then + AC_MSG_RESULT(yes) + RPATH='-rpath $(libdir)' +else + AC_MSG_RESULT(no) +fi +AC_SUBST(RPATH) + AC_MSG_CHECKING(for -fvisibility=hidden) try_flags=-fvisibility=hidden oCXXFLAGS=$CXXFLAGS diff --git a/make/libtool.mk b/make/libtool.mk index 1ab92b75..6a2bbc1a 100644 --- a/make/libtool.mk +++ b/make/libtool.mk @@ -95,7 +95,7 @@ define makelib $(LIBTOOL) --mode=link \ $(CXX) $(CXXFLAGS) $(LD_VERSION_FLAGS) \ -o $(2) $(1) $(3) $(4) \ - -rpath $(libdir) -version-info $(5):$(6):$(7) -no-undefined + $(RPATH) -version-info $(5):$(6):$(7) -no-undefined endef # 1 2 3 4 5 -- cgit v1.2.3-70-g09d2