]> The Tcpdump Group git mirrors - libpcap/commitdiff
On macOS, don't build programs any fatter than they need to be.
authorGuy Harris <[email protected]>
Sat, 22 Sep 2018 01:28:42 +0000 (18:28 -0700)
committerGuy Harris <[email protected]>
Sat, 22 Sep 2018 01:28:42 +0000 (18:28 -0700)
rpcapd need only be fat enough to run on all the platforms the target
OS version supports - no need, for example, to build it for PPC on Snow
Leopard or later, or to build it for 32-bit x86 on Lion or later - and
the test programs don't need to be fat at all.

This should fix GitHub issue #760.

Makefile.in
configure
configure.ac
rpcapd/Makefile.in

index 5bf218868cfb4b28007e5af272ccdfc13b83397b..b24f219462a29622d82a35293f9c8fafd6dc617c 100644 (file)
@@ -69,7 +69,7 @@ INSTALL_RPCAPD=@INSTALL_RPCAPD@
 EXTRA_NETWORK_LIBS=@EXTRA_NETWORK_LIBS@
 
 # Standard CFLAGS for building members of a shared library
-FULL_CFLAGS = $(CCOPT) $(SHLIB_CCOPT) $(INCLS) $(DEFS) $(CFLAGS)
+FULL_CFLAGS = $(CCOPT) @V_LIB_CCOPT_FAT@ $(SHLIB_CCOPT) $(INCLS) $(DEFS) $(CFLAGS)
 
 INSTALL = @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -417,7 +417,7 @@ libpcap.dylib: $(OBJ)
        MAJOR_VER=A; \
        COMPAT_VER=1; \
        CURRENT_VER=`sed 's/[^0-9.].*$$//' $(srcdir)/VERSION`; \
-       $(CC) -dynamiclib -undefined error $(LDFLAGS) \
+       $(CC) -dynamiclib -undefined error $(LDFLAGS) @V_LIB_LDFLAGS_FAT@ \
            -o libpcap.$$VER.dylib $(OBJ) $(ADDLOBJS) $(LIBS) \
            -install_name $(libdir)/libpcap.$$MAJOR_VER.dylib \
            -compatibility_version $$COMPAT_VER \
index 1075630bc7c46e6ad611b3d6f240e77de160996c..7694089e2e77c5e4acede63094ee76fcc694c1a4 100755 (executable)
--- a/configure
+++ b/configure
@@ -661,6 +661,10 @@ V_LEX
 V_INCLS
 V_FINDALLDEVS
 V_DEFS
+V_PROG_LDFLAGS_FAT
+V_PROG_CCOPT_FAT
+V_LIB_LDFLAGS_FAT
+V_LIB_CCOPT_FAT
 V_CCOPT
 MKDEP
 DEPENDENCY_CFLAG
@@ -8050,70 +8054,90 @@ fi
 
                darwin8.0123*)
                        #
-                       # Tiger, prior to Intel support.  Build for 32-bit
-                       # PowerPC and 64-bit PowerPC, with 32-bit PowerPC
-                       # first.  (I'm guessing that's what Apple does.)
+                       # Tiger, prior to Intel support.  Build
+                       # libraries and executables for 32-bit PowerPC
+                       # and 64-bit PowerPC, with 32-bit PowerPC first.
+                       # (I'm guessing that's what Apple does.)
                        #
-                       V_CCOPT="$V_CCOPT -arch ppc -arch ppc64"
-                       LDFLAGS="$LDFLAGS -arch ppc -arch ppc64"
+                       V_LIB_CCOPT_FAT="-arch ppc -arch ppc64"
+                       V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64"
+                       V_PROG_CCOPT_FAT="-arch ppc -arch ppc64"
+                       V_PROG_LDFLAGS_FAT="-arch ppc -arch ppc64"
                        ;;
 
                darwin8.456*)
                        #
-                       # Tiger, subsequent to Intel support but prior to
-                       # x86-64 support.  Build for 32-bit PowerPC, 64-bit
-                       # PowerPC, and x86, with 32-bit PowerPC first.
-                       # (I'm guessing that's what Apple does.)
+                       # Tiger, subsequent to Intel support but prior
+                       # to x86-64 support.  Build libraries and
+                       # executables for 32-bit PowerPC, 64-bit
+                       # PowerPC, and 32-bit x86, with 32-bit PowerPC
+                       # first.  (I'm guessing that's what Apple does.)
                        #
-                       V_CCOPT="$V_CCOPT -arch ppc -arch ppc64 -arch i386"
-                       LDFLAGS="$LDFLAGS -arch ppc -arch ppc64 -arch i386"
+                       V_LIB_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386"
+                       V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386"
+                       V_PROG_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386"
+                       V_PROG_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386"
                        ;;
 
                darwin8.*)
                        #
                        # All other Tiger, so subsequent to x86-64
-                       # support. Build for 32-bit PowerPC, 64-bit
-                       # PowerPC, x86, and x86-64, and with 32-bit PowerPC
-                       # first.  (I'm guessing that's what Apple does.)
+                       # support.  Build libraries and executables for
+                       # 32-bit PowerPC, 64-bit PowerPC, 32-bit x86,
+                       # and x86-64, with 32-bit PowerPC first.  (I'm
+                       # guessing that's what Apple does.)
                        #
-                       V_CCOPT="$V_CCOPT -arch ppc -arch ppc64 -arch i386 -arch x86_64"
-                       LDFLAGS="$LDFLAGS -arch ppc -arch ppc64 -arch i386 -arch x86_64"
+                       V_LIB_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
+                       V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
+                       V_PROG_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
+                       V_PROG_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
                        ;;
 
                darwin9.*)
                        #
-                       # Leopard.  Build for 32-bit PowerPC, 64-bit
-                       # PowerPC, x86, and x86-64, with 32-bit PowerPC
-                       # first.  (That's what Apple does.)
+                       # Leopard.  Build libraries for 32-bit PowerPC,
+                       # 64-bit PowerPC, 32-bit x86, and x86-64, with
+                       # 32-bit PowerPC first, and build executables
+                       # for 32-bit x86 and 32-bit PowerPC, with 32-bit
+                       # x86 first.  (That's what Apple does.)
                        #
-                       V_CCOPT="$V_CCOPT -arch ppc -arch ppc64 -arch i386 -arch x86_64"
-                       LDFLAGS="$LDFLAGS -arch ppc -arch ppc64 -arch i386 -arch x86_64"
+                       V_LIB_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
+                       V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
+                       V_PROG_CCOPT_FAT="-arch i386 -arch ppc"
+                       V_PROG_LDFLAGS_FAT="-arch i386 -arch ppc"
                        ;;
 
                darwin10.*)
                        #
-                       # Snow Leopard.  Build for x86-64, x86, and
-                       # 32-bit PowerPC, with x86-64 first.  (That's
-                       # what Apple does, even though Snow Leopard
-                       # doesn't run on PPC, so PPC libpcap runs under
-                       # Rosetta, and Rosetta doesn't support BPF
-                       # ioctls, so PPC programs can't do live
-                       # captures.)
+                       # Snow Leopard.  Build libraries for x86-64,
+                       # 32-bit x86, and 32-bit PowerPC, with x86-64
+                       # first, and build executables for x86-64 and
+                       # 32-bit x86, with x86-64 first.  (That's what
+                       # Apple does, even though Snow Leopard doesn't
+                       # run on PPC, so PPC libpcap runs under Rosetta,
+                       # and Rosetta doesn't support BPF ioctls, so PPC
+                       # programs can't do live captures.)
                        #
-                       V_CCOPT="$V_CCOPT -arch x86_64 -arch i386 -arch ppc"
-                       LDFLAGS="$LDFLAGS -arch x86_64 -arch i386 -arch ppc"
+                       V_LIB_CCOPT_FAT="-arch x86_64 -arch i386 -arch ppc"
+                       V_LIB_LDFLAGS_FAT="-arch x86_64 -arch i386 -arch ppc"
+                       V_PROG_CCOPT_FAT="-arch x86_64 -arch i386"
+                       V_PROG_LDFLAGS_FAT="-arch x86_64 -arch i386"
                        ;;
 
                darwin*)
                        #
-                       # Post-Snow Leopard.  Build for x86-64 and
-                       # x86, with x86-64 first.  (That's probably what
-                       # Apple does, given that Rosetta is gone.)
+                       # Post-Snow Leopard.  Build libraries for x86-64
+                       # and 32-bit x86, with x86-64 first, and build
+                       # executables only for x86-64.  (That's what
+                       # Apple does.)  This requires no special flags
+                       # for programs.
                        # XXX - update if and when Apple drops support
-                       # for 32-bit x86 code.
+                       # for 32-bit x86 code and if and when Apple adds
+                       # ARM-based Macs.  (You're on your own for iOS
+                       # etc.)
                        #
-                       V_CCOPT="$V_CCOPT -arch x86_64 -arch i386"
-                       LDFLAGS="$LDFLAGS -arch x86_64 -arch i386"
+                       V_LIB_CCOPT_FAT="-arch x86_64 -arch i386"
+                       V_LIB_LDFLAGS_FAT="-arch x86_64 -arch i386"
                        ;;
                esac
        fi
 
 
 
+
+
+
+
 
 
 
index f4de8bdbb02b75de939efa0ee74cdcecb37231e0..29222d873cef5b6306301d3bf5fff153bee399a8 100644 (file)
@@ -1608,70 +1608,90 @@ darwin*)
 
                darwin8.[0123]*)
                        #
-                       # Tiger, prior to Intel support.  Build for 32-bit
-                       # PowerPC and 64-bit PowerPC, with 32-bit PowerPC
-                       # first.  (I'm guessing that's what Apple does.)
+                       # Tiger, prior to Intel support.  Build
+                       # libraries and executables for 32-bit PowerPC
+                       # and 64-bit PowerPC, with 32-bit PowerPC first.
+                       # (I'm guessing that's what Apple does.)
                        #
-                       V_CCOPT="$V_CCOPT -arch ppc -arch ppc64"
-                       LDFLAGS="$LDFLAGS -arch ppc -arch ppc64"
+                       V_LIB_CCOPT_FAT="-arch ppc -arch ppc64"
+                       V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64"
+                       V_PROG_CCOPT_FAT="-arch ppc -arch ppc64"
+                       V_PROG_LDFLAGS_FAT="-arch ppc -arch ppc64"
                        ;;
 
                darwin8.[456]*)
                        #
-                       # Tiger, subsequent to Intel support but prior to
-                       # x86-64 support.  Build for 32-bit PowerPC, 64-bit
-                       # PowerPC, and x86, with 32-bit PowerPC first.
-                       # (I'm guessing that's what Apple does.)
+                       # Tiger, subsequent to Intel support but prior
+                       # to x86-64 support.  Build libraries and
+                       # executables for 32-bit PowerPC, 64-bit
+                       # PowerPC, and 32-bit x86, with 32-bit PowerPC
+                       # first.  (I'm guessing that's what Apple does.)
                        #
-                       V_CCOPT="$V_CCOPT -arch ppc -arch ppc64 -arch i386"
-                       LDFLAGS="$LDFLAGS -arch ppc -arch ppc64 -arch i386"
+                       V_LIB_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386"
+                       V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386"
+                       V_PROG_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386"
+                       V_PROG_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386"
                        ;;
 
                darwin8.*)
                        #
                        # All other Tiger, so subsequent to x86-64
-                       # support. Build for 32-bit PowerPC, 64-bit
-                       # PowerPC, x86, and x86-64, and with 32-bit PowerPC
-                       # first.  (I'm guessing that's what Apple does.)
+                       # support.  Build libraries and executables for
+                       # 32-bit PowerPC, 64-bit PowerPC, 32-bit x86,
+                       # and x86-64, with 32-bit PowerPC first.  (I'm
+                       # guessing that's what Apple does.)
                        #
-                       V_CCOPT="$V_CCOPT -arch ppc -arch ppc64 -arch i386 -arch x86_64"
-                       LDFLAGS="$LDFLAGS -arch ppc -arch ppc64 -arch i386 -arch x86_64"
+                       V_LIB_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
+                       V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
+                       V_PROG_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
+                       V_PROG_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
                        ;;
 
                darwin9.*)
                        #
-                       # Leopard.  Build for 32-bit PowerPC, 64-bit
-                       # PowerPC, x86, and x86-64, with 32-bit PowerPC
-                       # first.  (That's what Apple does.)
+                       # Leopard.  Build libraries for 32-bit PowerPC,
+                       # 64-bit PowerPC, 32-bit x86, and x86-64, with
+                       # 32-bit PowerPC first, and build executables
+                       # for 32-bit x86 and 32-bit PowerPC, with 32-bit
+                       # x86 first.  (That's what Apple does.)
                        #
-                       V_CCOPT="$V_CCOPT -arch ppc -arch ppc64 -arch i386 -arch x86_64"
-                       LDFLAGS="$LDFLAGS -arch ppc -arch ppc64 -arch i386 -arch x86_64"
+                       V_LIB_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
+                       V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
+                       V_PROG_CCOPT_FAT="-arch i386 -arch ppc"
+                       V_PROG_LDFLAGS_FAT="-arch i386 -arch ppc"
                        ;;
 
                darwin10.*)
                        #
-                       # Snow Leopard.  Build for x86-64, x86, and
-                       # 32-bit PowerPC, with x86-64 first.  (That's
-                       # what Apple does, even though Snow Leopard
-                       # doesn't run on PPC, so PPC libpcap runs under
-                       # Rosetta, and Rosetta doesn't support BPF
-                       # ioctls, so PPC programs can't do live
-                       # captures.)
+                       # Snow Leopard.  Build libraries for x86-64,
+                       # 32-bit x86, and 32-bit PowerPC, with x86-64
+                       # first, and build executables for x86-64 and
+                       # 32-bit x86, with x86-64 first.  (That's what
+                       # Apple does, even though Snow Leopard doesn't
+                       # run on PPC, so PPC libpcap runs under Rosetta,
+                       # and Rosetta doesn't support BPF ioctls, so PPC
+                       # programs can't do live captures.)
                        #
-                       V_CCOPT="$V_CCOPT -arch x86_64 -arch i386 -arch ppc"
-                       LDFLAGS="$LDFLAGS -arch x86_64 -arch i386 -arch ppc"
+                       V_LIB_CCOPT_FAT="-arch x86_64 -arch i386 -arch ppc"
+                       V_LIB_LDFLAGS_FAT="-arch x86_64 -arch i386 -arch ppc"
+                       V_PROG_CCOPT_FAT="-arch x86_64 -arch i386"
+                       V_PROG_LDFLAGS_FAT="-arch x86_64 -arch i386"
                        ;;
 
                darwin*)
                        #
-                       # Post-Snow Leopard.  Build for x86-64 and
-                       # x86, with x86-64 first.  (That's probably what
-                       # Apple does, given that Rosetta is gone.)
+                       # Post-Snow Leopard.  Build libraries for x86-64
+                       # and 32-bit x86, with x86-64 first, and build
+                       # executables only for x86-64.  (That's what
+                       # Apple does.)  This requires no special flags
+                       # for programs.
                        # XXX - update if and when Apple drops support
-                       # for 32-bit x86 code.
+                       # for 32-bit x86 code and if and when Apple adds
+                       # ARM-based Macs.  (You're on your own for iOS
+                       # etc.)
                        #
-                       V_CCOPT="$V_CCOPT -arch x86_64 -arch i386"
-                       LDFLAGS="$LDFLAGS -arch x86_64 -arch i386"
+                       V_LIB_CCOPT_FAT="-arch x86_64 -arch i386"
+                       V_LIB_LDFLAGS_FAT="-arch x86_64 -arch i386"
                        ;;
                esac
        fi
@@ -1866,6 +1886,10 @@ AC_CHECK_MEMBERS([dl_hp_ppa_info_t.dl_module_id_1],,,
     ])
 
 AC_SUBST(V_CCOPT)
+AC_SUBST(V_LIB_CCOPT_FAT)
+AC_SUBST(V_LIB_LDFLAGS_FAT)
+AC_SUBST(V_PROG_CCOPT_FAT)
+AC_SUBST(V_PROG_LDFLAGS_FAT)
 AC_SUBST(V_DEFS)
 AC_SUBST(V_FINDALLDEVS)
 AC_SUBST(V_INCLS)
index d3e02c1a9fc3ad397e2946f16a5a7b6baa5e3d26..1b530d5abf43eb7c060195808515ca4502d5be68 100644 (file)
@@ -66,7 +66,7 @@ PROG=libpcap
 RPCAPD_LIBS = @RPCAPD_LIBS@
 
 # Standard CFLAGS
-FULL_CFLAGS = $(CCOPT) $(INCLS) $(DEFS) $(CFLAGS)
+FULL_CFLAGS = $(CCOPT) @V_PROG_CCOPT_FAT@ $(INCLS) $(DEFS) $(CFLAGS)
 
 INSTALL = @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -98,7 +98,8 @@ MANADMIN = \
        rpcapd.manadmin.in
 
 rpcapd: $(OBJ) ../libpcap.a
-       $(CC) $(CCOPT) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJ) ../libpcap.a $(LIBS) $(RPCAPD_LIBS) $(PTHREAD_LIBS)
+       $(CC) $(CCOPT) $(CFLAGS) $(LDFLAGS) @V_PROG_LDFLAGS_FAT@ \
+           -o $@ $(OBJ) ../libpcap.a $(LIBS) $(RPCAPD_LIBS) $(PTHREAD_LIBS)
 clean:
        rm -f $(CLEANFILES)