Replace libmissing.la with portable libobj dir Commit 8e2b75c removed getopt from libmissing since modern systems include getopt_long(). That change resulted in libmissing being empty on macOS, and macOS "ar" requires at least one file to be added. Replace "libmissing.la" with the autoconf libobj directory "portable" (AC_CONFIG_LIBOBJ_DIR) as the directory for AC_REPLACE_FUNCS replacements. Move "src/libmissing/" to "portable/". Remove "libmissing" from SUBDIRS. Update "Makefile.am" CPPFLAGS and LDADD accordingly. Define the automake "subdir-objects" option since "$(LIBOBJS)" cannot be used outside of "portable" if "subdir-objects" is not set. Also, rename the macro def INET_NTOP_H to MUNGE_INET_NTOP_H. Reference: - https://www.eyrie.org/~eagle/notes/style/build.html - https://www.gnu.org/software/automake/manual/html_node/List-of-Automake-options.html https://github.com/dun/munge/issues/141 https://github.com/dun/munge/commit/fa5849f9313e2b0a656b5177b08088f94bfaab68 --- Make-inc.mk.orig +++ Make-inc.mk @@ -6,7 +6,6 @@ # Dependencies to ensure libraries get rebuilt. # $(top_builddir)/src/libcommon/libcommon.la \ -$(top_builddir)/src/libmissing/libmissing.la \ $(top_builddir)/src/libmunge/libmunge.la \ $(top_builddir)/src/libtap/libtap.la \ : force-dependency-check --- Makefile.am.orig +++ Makefile.am @@ -35,6 +35,9 @@ EXTRA_DIST = \ build-aux/gen-version \ build-aux/tap-driver.sh \ doc \ + portable/inet_ntop.h \ + portable/strlcat.h \ + portable/strlcpy.h \ $(TEMPLATE_FILES) \ # End of EXTRA_DIST @@ -65,7 +68,6 @@ MAINTAINERCLEANFILES = \ src/Makefile.in \ src/etc/Makefile.in \ src/libcommon/Makefile.in \ - src/libmissing/Makefile.in \ src/libmunge/Makefile.in \ src/munge/Makefile.in \ src/munged/Makefile.in \ --- configure.ac.orig +++ configure.ac @@ -12,6 +12,7 @@ AC_SUBST([DATE], m4_esyscmd([build-aux/gen-date])) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_LIBOBJ_DIR([portable]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_SRCDIR([src/libmunge/munge.h]) AC_REQUIRE_AUX_FILE([tap-driver.sh]) @@ -25,7 +26,7 @@ X_AC_WITH_LOGROTATEDDIR X_AC_WITH_PKGCONFIGDIR X_AC_HUMOR -AM_INIT_AUTOMAKE([1.12 foreign dist-xz no-dist-gzip]) +AM_INIT_AUTOMAKE([1.12 foreign dist-xz no-dist-gzip subdir-objects]) AM_MAINTAINER_MODE AM_SILENT_RULES([yes]) AC_USE_SYSTEM_EXTENSIONS @@ -121,7 +122,6 @@ AC_CONFIG_FILES( \ src/common/Makefile \ src/etc/Makefile \ src/libcommon/Makefile \ - src/libmissing/Makefile \ src/libmunge/Makefile \ src/libtap/Makefile \ src/munge/Makefile \ --- src/libmissing/inet_ntop.h.orig +++ portable/inet_ntop.h @@ -25,22 +25,22 @@ *****************************************************************************/ -#ifndef INET_NTOP_H -#define INET_NTOP_H +#ifndef MUNGE_INET_NTOP_H +#define MUNGE_INET_NTOP_H #if HAVE_CONFIG_H -# include "config.h" +#include "config.h" #endif /* HAVE_CONFIG_H */ #ifndef INET_ADDRSTRLEN -# define INET_ADDRSTRLEN 16 +#define INET_ADDRSTRLEN 16 #endif /* !INET_ADDRSTRLEN */ #if HAVE_INET_NTOP -# include +#include #else /* !HAVE_INET_NTOP */ -# include +#include const char *inet_ntop (int af, const void *src, char *dst, socklen_t cnt); #endif /* !HAVE_INET_NTOP */ -#endif /* !INET_NTOP_H */ +#endif /* !MUNGE_INET_NTOP_H */ --- src/libmissing/strlcat.h.orig +++ portable/strlcat.h @@ -1,8 +1,13 @@ +#ifndef MUNGE_STRLCAT_H +#define MUNGE_STRLCAT_H + #if HAVE_CONFIG_H -# include "config.h" +#include "config.h" #endif /* HAVE_CONFIG_H */ -#if !HAVE_STRLCAT +#if HAVE_STRLCAT +#include +#else /* !HAVE_STRLCAT */ size_t strlcat(char *dst, const char *src, size_t siz); /* * Appends src to string dst of size siz (unlike strncat, siz is the @@ -12,3 +17,5 @@ size_t strlcat(char *dst, const char *src, size_t siz); * If retval >= siz, truncation occurred. */ #endif /* !HAVE_STRLCAT */ + +#endif /* !MUNGE_STRLCAT_H */ --- src/libmissing/strlcpy.h.orig +++ portable/strlcpy.h @@ -1,8 +1,13 @@ +#ifndef MUNGE_STRLCPY_H +#define MUNGE_STRLCPY_H + #if HAVE_CONFIG_H -# include "config.h" +#include "config.h" #endif /* HAVE_CONFIG_H */ -#if !HAVE_STRLCPY +#if HAVE_STRLCPY +#include +#else /* !HAVE_STRLCPY */ size_t strlcpy(char *dst, const char *src, size_t siz); /* * Copy src to string dst of size siz. At most siz-1 characters @@ -10,3 +15,5 @@ size_t strlcpy(char *dst, const char *src, size_t siz); * Returns strlen(src); if retval >= siz, truncation occurred. */ #endif /* !HAVE_STRLCPY */ + +#endif /* !MUNGE_STRLCPY_H */ --- src/Makefile.am.orig +++ src/Makefile.am @@ -9,7 +9,6 @@ SUBDIRS = \ common \ etc \ libcommon \ - libmissing \ libmunge \ libtap \ munge \ --- src/munge/Makefile.am.orig +++ src/munge/Makefile.am @@ -41,13 +41,11 @@ bin_PROGRAMS = \ munge_CPPFLAGS = \ -I$(top_srcdir)/src/common \ -I$(top_srcdir)/src/libcommon \ - -I$(top_srcdir)/src/libmissing \ -I$(top_srcdir)/src/libmunge \ # End of munge_CPPFLAGS munge_LDADD = \ $(top_builddir)/src/libcommon/libcommon.la \ - $(top_builddir)/src/libmissing/libmissing.la \ $(top_builddir)/src/libmunge/libmunge.la \ # End of munge_LDADD @@ -69,13 +67,11 @@ remunge_CPPFLAGS = \ -DWITH_PTHREADS \ -I$(top_srcdir)/src/common \ -I$(top_srcdir)/src/libcommon \ - -I$(top_srcdir)/src/libmissing \ -I$(top_srcdir)/src/libmunge \ # End of remunge_CPPFLAGS remunge_LDADD = \ $(top_builddir)/src/libcommon/libcommon.la \ - $(top_builddir)/src/libmissing/libmissing.la \ $(top_builddir)/src/libmunge/libmunge.la \ $(LIBPTHREAD) \ # End of remunge_LDADD @@ -93,15 +89,15 @@ remunge_SOURCES = \ # End of remunge_SOURCES unmunge_CPPFLAGS = \ + -I$(top_srcdir)/portable \ -I$(top_srcdir)/src/common \ -I$(top_srcdir)/src/libcommon \ - -I$(top_srcdir)/src/libmissing \ -I$(top_srcdir)/src/libmunge \ # End of unmunge_CPPFLAGS unmunge_LDADD = \ + $(LIBOBJS) \ $(top_builddir)/src/libcommon/libcommon.la \ - $(top_builddir)/src/libmissing/libmissing.la \ $(top_builddir)/src/libmunge/libmunge.la \ # End of unmunge_LDADD --- src/munge/unmunge.c.orig +++ src/munge/unmunge.c @@ -48,9 +48,9 @@ #include #include #include "common.h" +#include "inet_ntop.h" #include "license.h" #include "log.h" -#include "missing.h" /* for inet_ntop() */ #include "read.h" #include "version.h" #include "xsignal.h" --- src/munged/Makefile.am.orig +++ src/munged/Makefile.am @@ -40,15 +40,15 @@ munged_CPPFLAGS = \ -DRUNSTATEDIR='"$(runstatedir)"' \ -DSYSCONFDIR='"$(sysconfdir)"' \ -DWITH_PTHREADS \ + -I$(top_srcdir)/portable \ -I$(top_srcdir)/src/common \ -I$(top_srcdir)/src/libcommon \ - -I$(top_srcdir)/src/libmissing \ -I$(top_srcdir)/src/libmunge \ # End of munged_CPPFLAGS munged_LDADD = \ + $(LIBOBJS) \ $(top_builddir)/src/libcommon/libcommon.la \ - $(top_builddir)/src/libmissing/libmissing.la \ $(top_builddir)/src/libmunge/libmunge.la \ $(LIBPTHREAD) \ $(LIBBZ2) \ --- src/munged/conf.c.orig +++ src/munged/conf.c @@ -29,7 +29,6 @@ # include #endif /* HAVE_CONFIG_H */ -#include /* for inet_ntop() */ #include #include #include @@ -45,11 +44,11 @@ #include #include "clock.h" #include "conf.h" +#include "inet_ntop.h" #include "license.h" #include "lock.h" #include "log.h" #include "md.h" -#include "missing.h" /* for inet_ntop() */ #include "munge_defs.h" #include "net.h" #include "path.h" --- src/munged/munged.c.orig +++ src/munged/munged.c @@ -58,12 +58,12 @@ #include "lock.h" #include "log.h" #include "md.h" -#include "missing.h" #include "munge_defs.h" #include "path.h" #include "random.h" #include "replay.h" #include "str.h" +#include "strlcpy.h" #include "timer.h" #include "xsignal.h" --- src/mungekey/Makefile.am.orig +++ src/mungekey/Makefile.am @@ -39,13 +39,11 @@ mungekey_CPPFLAGS = \ -DSYSCONFDIR='"$(sysconfdir)"' \ -I$(top_srcdir)/src/common \ -I$(top_srcdir)/src/libcommon \ - -I$(top_srcdir)/src/libmissing \ -I$(top_srcdir)/src/libmunge \ # End of mungekey_CPPFLAGS mungekey_LDADD = \ $(top_builddir)/src/libcommon/libcommon.la \ - $(top_builddir)/src/libmissing/libmissing.la \ $(top_builddir)/src/libmunge/libmunge.la \ $(CRYPTO_LIBS) \ # End of mungekey_LDADD --- src/mungekey/conf.c.orig +++ src/mungekey/conf.c @@ -40,7 +40,6 @@ #include "conf.h" #include "license.h" #include "log.h" -#include "missing.h" #include "munge_defs.h" #include "version.h"