dect
/
libpcap
Archived
13
0
Fork 0

Add a way to have pcap-config supply the appropriate rpath flag, if any.

This commit is contained in:
Guy Harris 2009-06-09 10:50:31 -07:00
parent fcc6ea3b28
commit db68de2198
4 changed files with 28 additions and 3 deletions

View File

@ -425,6 +425,7 @@ pcap-config: $(srcdir)/pcap-config.in Makefile
sed -e 's|@includedir[@]|$(includedir)|g' \
-e 's|@libdir[@]|$(libdir)|g' \
-e 's|@LIBS[@]|$(LIBS)|g' \
-e 's|@V_RPATH_OPT[@]|$(V_RPATH_OPT)|g' \
$(srcdir)/pcap-config.in >$@.tmp
mv $@.tmp $@
chmod a+x $@

7
aclocal.m4 vendored
View File

@ -95,7 +95,9 @@ AC_DEFUN(AC_LBL_C_INIT,
# On platforms where we build a shared library, add options
# to generate position-independent code, if necessary
# (it's the default in Darwin/OS X), and define the
# appropriate options for building the shared library.
# appropriate options for building the shared library
# and for specifying, at link time, a directory to add
# to the run-time search path.
#
case "$host_os" in
@ -104,6 +106,7 @@ AC_DEFUN(AC_LBL_C_INIT,
V_SHLIB_CMD="\$(CC)"
V_SHLIB_OPT="-shared"
V_SONAME_OPT="-Wl,-soname,"
V_RPATH_OPT="-Wl,-rpath,"
;;
esac
else
@ -195,6 +198,7 @@ AC_DEFUN(AC_LBL_C_INIT,
V_SHLIB_CMD="\$(CC)"
V_SHLIB_OPT="-shared"
V_SONAME_OPT="-Wl,-soname,"
V_RPATH_OPT="-Wl,-rpath,"
;;
solaris*)
@ -202,6 +206,7 @@ AC_DEFUN(AC_LBL_C_INIT,
V_SHLIB_CMD="\$(CC)"
V_SHLIB_OPT="-G"
V_SONAME_OPT="-h "
V_RPATH_OPT="-R"
;;
esac
fi

View File

@ -988,6 +988,14 @@ irix*)
linux*|freebsd*|netbsd*|openbsd*|dragonfly*)
DYEXT="so"
V_CCOPT="$V_CCOPT -fPIC"
#
# Compiler assumed to be GCC; run-time linker may require a -R
# flag.
#
if test "$libdir" != "/usr/lib"; then
V_RFLAGS=-Wl,-R$libdir
fi
;;
osf*)
@ -1055,6 +1063,7 @@ AC_SUBST(V_PCAP)
AC_SUBST(V_SHLIB_CMD)
AC_SUBST(V_SHLIB_OPT)
AC_SUBST(V_SONAME_OPT)
AC_SUBST(V_RPATH_OPT)
AC_SUBST(V_YACC)
AC_SUBST(ADDLOBJ)
AC_SUBST(SSRC)

View File

@ -29,6 +29,16 @@ do
esac
shift
done
if [ "@V_RPATH_OPT@" != "" ]
then
#
# If libdir isn't /usr/lib, add it to the run-time linker path.
#
if [ "@libdir@" != "/usr/lib ]
then
RPATH=@V_RPATH_OPT@@libdir@
fi
fi
if [ "$static" = 1 ]
then
#
@ -58,7 +68,7 @@ else
#
if [ "$show_cflags" = 1 -a "$show_libs" = 1 ]
then
echo "-I@includedir@ -L@libdir@ -lpcap"
echo "-I@includedir@ -L@libdir@ $RPATH -lpcap"
elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ]
then
echo "-I@includedir@"
@ -67,6 +77,6 @@ else
echo "-I@includedir@"
elif [ "$show_libs" = 1 ]
then
echo "-L@libdir@ -lpcap"
echo "-L@libdir@ $RPATH -lpcap"
fi
fi