Make ADDLOBJ be the list of additional objects to link in when building
a shared libpcap and add into the archive when making an archive library. Make V_LIBS in the configure script, and LIBS in the Makefile, a list of additional libraries with which to link a shared libpcap and with which to link applications built with a non-shared libpcap.
This commit is contained in:
parent
4da1fd6159
commit
95c97b9b6f
15
Makefile.in
15
Makefile.in
|
@ -48,10 +48,9 @@ CC = @CC@
|
|||
CCOPT = @V_CCOPT@
|
||||
INCLS = -I. @V_INCLS@
|
||||
DEFS = @DEFS@ @V_DEFS@
|
||||
ADDLOBJ = @ADDLOBJ@
|
||||
LIBS = @V_LIBS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
DAGLIBS = @DAGLIBS@
|
||||
DEPLIBS = @DEPLIBS@
|
||||
DYEXT = @DYEXT@
|
||||
PROG=libpcap
|
||||
|
||||
|
@ -315,7 +314,7 @@ all: libpcap.a shared pcap-config
|
|||
|
||||
libpcap.a: $(OBJ)
|
||||
@rm -f $@
|
||||
$(AR) rc $@ $(OBJ) $(LIBS)
|
||||
$(AR) rc $@ $(OBJ) $(ADDLOBJ)
|
||||
$(RANLIB) $@
|
||||
|
||||
shared: libpcap.$(DYEXT)
|
||||
|
@ -324,10 +323,8 @@ libpcap.so: $(OBJ)
|
|||
@rm -f $@
|
||||
VER=`cat $(srcdir)/VERSION`; \
|
||||
MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
|
||||
$(CC) -shared -Wl,-soname,$@.$$MAJOR_VER $(LDFLAGS) -o $@.$$VER \
|
||||
$(OBJ) $(DAGLIBS)
|
||||
@V_SHLIB_CMD@ @V_SHLIB_OPT@ @V_SONAME_OPT@$@.$$MAJOR_VER $(LDFLAGS) \
|
||||
-o $@.$$VER $(OBJ) $(DAGLIBS)
|
||||
-o $@.$$VER $(OBJ) $(ADDLOBJ) $(LIBS)
|
||||
|
||||
#
|
||||
# The following rule succeeds, but the result is untested.
|
||||
|
@ -354,7 +351,7 @@ libpcap.dylib: $(OBJ)
|
|||
COMPAT_VER=1; \
|
||||
CURRENT_VER=`sed 's/[^0-9.].*$$//' $(srcdir)/VERSION`; \
|
||||
$(CC) -dynamiclib -undefined error $(LDFLAGS) \
|
||||
-o libpcap.$$VER.dylib $(OBJ) \
|
||||
-o libpcap.$$VER.dylib $(OBJ) $(ADDLOBJ) $(LIBS) \
|
||||
-install_name $(libdir)/libpcap.$$MAJOR_VER.dylib \
|
||||
-compatibility_version $$COMPAT_VER \
|
||||
-current_version $$CURRENT_VER
|
||||
|
@ -370,7 +367,7 @@ libpcap.dylib: $(OBJ)
|
|||
#
|
||||
libpcap.sl: $(OBJ)
|
||||
@rm -f $@
|
||||
ld -b $(LDFLAGS) -o $@ +h $@.1 $(OBJ) $(LIBS)
|
||||
ld -b $(LDFLAGS) -o $@ +h $@.1 $(OBJ) $(ADDLOBJ) $(LIBS)
|
||||
|
||||
scanner.c: $(srcdir)/scanner.l
|
||||
@rm -f $@
|
||||
|
@ -427,7 +424,7 @@ pcap-config: $(srcdir)/pcap-config.in Makefile
|
|||
@rm -f $@ $@.tmp
|
||||
sed -e 's|@includedir[@]|$(includedir)|g' \
|
||||
-e 's|@libdir[@]|$(libdir)|g' \
|
||||
-e 's|@DEPLIBS[@]|$(DEPLIBS)|g' \
|
||||
-e 's|@LIBS[@]|$(LIBS)|g' \
|
||||
$(srcdir)/pcap-config.in >$@.tmp
|
||||
mv $@.tmp $@
|
||||
chmod a+x $@
|
||||
|
|
|
@ -688,10 +688,9 @@ V_PCAP
|
|||
V_SHLIB_CMD
|
||||
V_SHLIB_OPT
|
||||
V_SONAME_OPT
|
||||
ADDLOBJ
|
||||
SSRC
|
||||
DYEXT
|
||||
DAGLIBS
|
||||
DEPLIBS
|
||||
MAN_FILE_FORMATS
|
||||
MAN_MISC_INFO
|
||||
PCAP_SUPPORT_USB
|
||||
|
@ -3141,7 +3140,7 @@ _ACEOF
|
|||
# Note: spaces after V_SONAME_OPT are significant; GCC's
|
||||
# option is "-Wl,-soname,{soname}", with the soname part
|
||||
# of the option, while other C compiler drivers take it
|
||||
# as a regular optio with the soname following the option.
|
||||
# as a regular option with the soname following the option.
|
||||
#
|
||||
case "$host_os" in
|
||||
|
||||
|
@ -7969,7 +7968,7 @@ fi
|
|||
|
||||
if test $ac_cv_lbl_dag_api = yes; then
|
||||
V_INCLS="$V_INCLS -I$dag_include_dir"
|
||||
V_LIBS="$V_LIBS $dagapi_obj $dagopts_obj $dagreg_obj"
|
||||
ADDLOBJ="$dagapi_obj $dagopts_obj $dagreg_obj"
|
||||
if test $V_PCAP != dag ; then
|
||||
SSRC="pcap-dag.c"
|
||||
fi
|
||||
|
@ -8194,7 +8193,7 @@ cat >>confdefs.h <<\_ACEOF
|
|||
#define HAVE_DAG_STREAMS_API 1
|
||||
_ACEOF
|
||||
|
||||
DAGLIBS="-ldag"
|
||||
V_LIBS="$V_LIBS -ldag"
|
||||
fi
|
||||
|
||||
|
||||
|
@ -8520,7 +8519,7 @@ _ACEOF
|
|||
|
||||
# We need "-lodm" and "-lcfg", as libpcap requires them on
|
||||
# AIX.
|
||||
DEPLIBS="-lodm -lcfg"
|
||||
V_LIBS="-lodm -lcfg"
|
||||
;;
|
||||
|
||||
darwin*)
|
||||
|
@ -9129,7 +9128,6 @@ ln -s ${srcdir}/bpf/net net
|
|||
|
||||
|
||||
|
||||
|
||||
{ echo "$as_me:$LINENO: checking for USB sniffing support" >&5
|
||||
echo $ECHO_N "checking for USB sniffing support... $ECHO_C" >&6; }
|
||||
case "$host_os" in
|
||||
|
@ -10252,10 +10250,9 @@ V_PCAP!$V_PCAP$ac_delim
|
|||
V_SHLIB_CMD!$V_SHLIB_CMD$ac_delim
|
||||
V_SHLIB_OPT!$V_SHLIB_OPT$ac_delim
|
||||
V_SONAME_OPT!$V_SONAME_OPT$ac_delim
|
||||
ADDLOBJ!$ADDLOBJ$ac_delim
|
||||
SSRC!$SSRC$ac_delim
|
||||
DYEXT!$DYEXT$ac_delim
|
||||
DAGLIBS!$DAGLIBS$ac_delim
|
||||
DEPLIBS!$DEPLIBS$ac_delim
|
||||
MAN_FILE_FORMATS!$MAN_FILE_FORMATS$ac_delim
|
||||
MAN_MISC_INFO!$MAN_MISC_INFO$ac_delim
|
||||
PCAP_SUPPORT_USB!$PCAP_SUPPORT_USB$ac_delim
|
||||
|
@ -10268,7 +10265,7 @@ INSTALL_DATA!$INSTALL_DATA$ac_delim
|
|||
LTLIBOBJS!$LTLIBOBJS$ac_delim
|
||||
_ACEOF
|
||||
|
||||
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 88; then
|
||||
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 87; then
|
||||
break
|
||||
elif $ac_last_try; then
|
||||
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
|
||||
|
|
|
@ -744,7 +744,7 @@ fi
|
|||
|
||||
if test $ac_cv_lbl_dag_api = yes; then
|
||||
V_INCLS="$V_INCLS -I$dag_include_dir"
|
||||
V_LIBS="$V_LIBS $dagapi_obj $dagopts_obj $dagreg_obj"
|
||||
ADDLOBJ="$dagapi_obj $dagopts_obj $dagreg_obj"
|
||||
if test $V_PCAP != dag ; then
|
||||
SSRC="pcap-dag.c"
|
||||
fi
|
||||
|
@ -763,7 +763,7 @@ if test $ac_cv_lbl_dag_api = yes; then
|
|||
|
||||
if test "$dag_streams" = 1; then
|
||||
AC_DEFINE(HAVE_DAG_STREAMS_API, 1, [define if you have streams capable DAG API])
|
||||
DAGLIBS="-ldag"
|
||||
V_LIBS="$V_LIBS -ldag"
|
||||
fi
|
||||
|
||||
AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
|
||||
|
@ -905,7 +905,7 @@ aix*)
|
|||
|
||||
# We need "-lodm" and "-lcfg", as libpcap requires them on
|
||||
# AIX.
|
||||
DEPLIBS="-lodm -lcfg"
|
||||
V_LIBS="-lodm -lcfg"
|
||||
;;
|
||||
|
||||
darwin*)
|
||||
|
@ -1048,10 +1048,9 @@ AC_SUBST(V_SHLIB_CMD)
|
|||
AC_SUBST(V_SHLIB_OPT)
|
||||
AC_SUBST(V_SONAME_OPT)
|
||||
AC_SUBST(V_YACC)
|
||||
AC_SUBST(ADDLOBJ)
|
||||
AC_SUBST(SSRC)
|
||||
AC_SUBST(DYEXT)
|
||||
AC_SUBST(DAGLIBS)
|
||||
AC_SUBST(DEPLIBS)
|
||||
AC_SUBST(MAN_FILE_FORMATS)
|
||||
AC_SUBST(MAN_MISC_INFO)
|
||||
|
||||
|
|
|
@ -32,28 +32,28 @@ done
|
|||
if [ "$static" = 1 ]
|
||||
then
|
||||
#
|
||||
# Include DEPLIBS so that the flags include libraries containing
|
||||
# Include LIBS so that the flags include libraries containing
|
||||
# routines that libpcap uses.
|
||||
#
|
||||
if [ "$show_cflags" = 1 -a "$show_libs" = 1 ]
|
||||
then
|
||||
echo "-I @includedir@ -L @libdir@ -lpcap @DEPLIBS@"
|
||||
echo "-I @includedir@ -L @libdir@ -lpcap @LIBS@"
|
||||
elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ]
|
||||
then
|
||||
echo "-I @includedir@ -L @libdir@ @DEPLIBS@"
|
||||
echo "-I @includedir@ -L @libdir@ @LIBS@"
|
||||
elif [ "$show_cflags" = 1 ]
|
||||
then
|
||||
echo "-I @includedir@"
|
||||
elif [ "$show_libs" = 1 ]
|
||||
then
|
||||
echo "-L @libdir@ -lpcap @DEPLIBS@"
|
||||
echo "-L @libdir@ -lpcap @LIBS@"
|
||||
elif [ "$show_additional_libs" = 1 ]
|
||||
then
|
||||
echo "@DEPLIBS@"
|
||||
echo "@LIBS@"
|
||||
fi
|
||||
else
|
||||
#
|
||||
# Omit DEPLIBS - libpcap is assumed to be linked with those
|
||||
# Omit LIBS - libpcap is assumed to be linked with those
|
||||
# libraries, so there's no need to do so explicitly.
|
||||
#
|
||||
if [ "$show_cflags" = 1 -a "$show_libs" = 1 ]
|
||||
|
|
Reference in New Issue