]> The Tcpdump Group git mirrors - libpcap/commitdiff
Make ADDLOBJ be the list of additional objects to link in when building
authorGuy Harris <[email protected]>
Fri, 22 May 2009 23:14:08 +0000 (16:14 -0700)
committerGuy Harris <[email protected]>
Fri, 22 May 2009 23:14:08 +0000 (16:14 -0700)
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.

Makefile.in
configure
configure.in
pcap-config.in

index f8d86da085dc0f9b22662d64a23cbef114c83afa..d0bc5496c125d387a9211790d029080efa0c1f70 100644 (file)
@@ -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 [email protected] $(OBJ) $(LIBS)
+       ld -b $(LDFLAGS) -o $@ +h [email protected] $(OBJ) $(ADDLOBJ) $(LIBS)
 
 scanner.c: $(srcdir)/scanner.l
        @rm -f $@
@@ -427,7 +424,7 @@ pcap-config: $(srcdir)/pcap-config.in Makefile
        @rm -f $@ [email protected]
        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 >[email protected]
        mv [email protected] $@
        chmod a+x $@
index 3dab25a7871f1d7569c867fde8d1f130ca75d21d..3068f968ed0d88cc06a07c6d903f3d171490f360 100755 (executable)
--- a/configure
+++ b/configure
@@ -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
index 7802dbae5fb1ac91a04f70bb1fff6c8cb8343c7a..149bd57055cd69a6c7b6224cff3a01040e88a464 100644 (file)
@@ -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)
 
index d30bf333b9341ff28644b2f4dd3fe83b332fd385..a3c6e99e2bf67fbcac1967fd965aa47ecf867ac5 100644 (file)
@@ -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 ]