Skip to content

Commit

Permalink
Merge pull request #43 from zdenop/upstream-rpath
Browse files Browse the repository at this point in the history
configure: add option '--disable-rpath' (Issue #42)
  • Loading branch information
agl committed Apr 7, 2014
2 parents b3aa8d8 + 818376e commit 0693dcd
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
28 changes: 25 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ AC_INIT([jbig2enc], [0.28], [agl@imperialviolet.org], [jbig2enc-0.28],
[https://github.com/agl/jbig2enc])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([-Wall -Werror foreign no-dependencies])

# this should fix automake 1.12 build and compatible with automake 1.11
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
LT_INIT

AC_PROG_CXX
AC_PROG_LIBTOOL

Expand All @@ -26,9 +31,6 @@ GENERIC_RELEASE=$GENERIC_MAJOR_VERSION.$GENERIC_MINOR_VERSION
AC_SUBST(GENERIC_RELEASE)
AC_SUBST(GENERIC_VERSION)

# this should fix automake 1.12 build and compatible with automake 1.11
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])

# default conditional
AM_CONDITIONAL(MINGW, false)

Expand All @@ -51,6 +53,26 @@ case $host_os in
;;
esac

# Check if rpath is disabled
AC_MSG_CHECKING(whether to use rpath)
AC_ARG_ENABLE(rpath,
[AC_HELP_STRING([--disable-rpath],
[Patches libtool to not use rpath in the libraries produced.])],
[enable_rpath="$enableval"], [enable_rpath="yes"])
AC_MSG_RESULT($enable_rpath)

AM_CONDITIONAL([ENABLE_RPATH], [test "x$enable_rpath" = "xyes"])

AC_CONFIG_COMMANDS([libtool-rpath-patch],
[if test "$libtool_patch_use_rpath" = "no"; then
sed < libtool > libtool-2 's/^hardcode_libdir_flag_spec.*$'/'hardcode_libdir_flag_spec=""/'
mv libtool-2 libtool
sed < libtool > libtool-2 's/^runpath_var=LD_RUN_PATH$'/'runpath_var=DIE_RPATH_DIE/'
mv libtool-2 libtool
chmod 755 libtool
fi],
[libtool_patch_use_rpath=$enable_rpath])

AC_CHECK_LIB([lept], [findFileFormatStream], [], [
echo "Error! Leptonica not detected."
exit -1
Expand Down
4 changes: 4 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
AM_CXXFLAGS = -Wall
AM_LDFLAGS = -Wl,-E
if ENABLE_RPATH
AM_LDFLAGS += -Wl,-rpath -Wl,$(libdir)
endif

lib_LTLIBRARIES = libjbig2enc.la
libjbig2enc_la_SOURCES = jbig2enc.cc jbig2arith.cc jbig2sym.cc jbig2comparator.cc
Expand Down

1 comment on commit 0693dcd

@jsonn
Copy link

@jsonn jsonn commented on 0693dcd Dec 9, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I wrote in the issue, this is plainly broken. Unrelated: why do you force exporting all symbols with -E?

Please sign in to comment.