]> git.puffer.fish Git - matthieu/frr.git/commitdiff
build: try to use -D option for ar and ranlib
authorDavid Lamparter <equinox@diac24.net>
Sun, 7 Oct 2018 00:49:20 +0000 (02:49 +0200)
committerDavid Lamparter <equinox@opensourcerouting.org>
Fri, 19 Oct 2018 11:13:42 +0000 (13:13 +0200)
The -D option zeroes out timestamps in .a files and has become the
default on recent distributions to enable reproducible builds.

This also shuts up the "u ignored because D is default" warning that is
showing up on some distributions.

Signed-off-by: David Lamparter <equinox@diac24.net>
Makefile.am
configure.ac

index 4cbf111b0422478cce0b2753f3dc638d4359b993..474f8ab5b57c3e2a2569c445f69387b7d03a0bb3 100644 (file)
@@ -19,6 +19,10 @@ AM_LDFLAGS = \
 DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\" -DCONFDATE=$(CONFDATE)
 LIBCAP = @LIBCAP@
 
+AR_FLAGS = @AR_FLAGS@
+ARFLAGS = @ARFLAGS@
+RANLIB = @RANLIB@
+
 # these two targets are provided to easily grab autoconf/Makefile variables
 # you can use either:
 #   eval `make VARFD=3 shvar-CFLAGS 3>&1 1>&2`
index f498a65129f441a764c40492e4a95b0002ad6049..fad306a4fb3d008d7962f4af79752f2da98ee9c3 100755 (executable)
@@ -323,6 +323,32 @@ fi
 AC_SUBST(AC_LDFLAGS)
 AM_CONDITIONAL([STATIC_BIN], [test "x$enable_static_bin" = "xyes"])
 
+dnl $AR and $RANLIB are set by LT_INIT above
+AC_MSG_CHECKING([whether $AR supports D option])
+if $AR crD conftest.a; then
+  AC_MSG_RESULT([yes])
+  dnl ARFLAGS is for automake, AR_FLAGS for libtool m-(
+  ARFLAGS="crD"
+  AR_FLAGS="crD"
+else
+  AC_MSG_RESULT([no])
+  ARFLAGS="cru"
+  AR_FLAGS="cru"
+fi
+AC_SUBST(ARFLAGS)
+AC_SUBST(AR_FLAGS)
+
+AC_MSG_CHECKING([whether $RANLIB supports D option])
+if $RANLIB -D conftest.a; then
+  AC_MSG_RESULT([yes])
+  RANLIB="$RANLIB -D"
+else
+  AC_MSG_RESULT([no])
+fi
+AC_SUBST(RANLIB)
+
+test -f conftest.a && rm conftest.a
+
 dnl ----------------------
 dnl Packages configuration
 dnl ----------------------