]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
build-sys: cleanup $vendordir use
authorKarel Zak <kzak@redhat.com>
Mon, 25 May 2020 11:44:22 +0000 (13:44 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 25 May 2020 11:44:22 +0000 (13:44 +0200)
- use --with-vendordir= (rather than --enable) to be compatible with
  another package stuuf

- add USE_VENDORDIR automake condition

- add vendordir to global AM_CPPFLAGS to avoid binary specific cflags
  modifications

Signed-off-by: Karel Zak <kzak@redhat.com>
Makefile.am
configure.ac
login-utils/Makemodule.am
login-utils/logindefs.c

index 20e6fe1c07ee01739583db146c29ccaab63112ec..75964bab31d64666ac2eca8bfdbe5c82b0dfd562 100644 (file)
@@ -5,6 +5,11 @@ AM_CPPFLAGS = \
        -D_PATH_RUNSTATEDIR=\"${runstatedir}\" \
        -D_PATH_SYSCONFSTATICDIR=\"${sysconfstaticdir}\"
 
+if USE_VENDORDIR
+AM_CPPFLAGS += \
+       -D_PATH_VENDORDIR=\"${vendordir}\"
+endif
+
 AM_CFLAGS = -fsigned-char $(WARN_CFLAGS)
 AM_LDFLAGS = $(ASAN_LDFLAGS)
 
@@ -151,6 +156,12 @@ else
 edit_cmd += -e 's|@LIBCRYPTSETUP[@]||g'
 endif
 
+if USE_VENDORDIR
+edit_cmd += -e 's|@vendordir[@]|$(vendordir)|g'
+else
+edit_cmd += -e 's|@vendordir[@]||g'
+endif
+
 CLEANFILES += $(PATHFILES)
 EXTRA_DIST += $(PATHFILES:=.in)
 
index d031624da4fced92493bef77e3acfec97f58679f..cc98ef695c914058335d27a1d5a40071f186c8fa 100644 (file)
@@ -2316,7 +2316,6 @@ AC_ARG_WITH([econf],
 
 have_econf=no
 AS_IF([test "x$with_econf" != xno], [
-  # new version -- all libsystemd-* libs merged into libsystemd
   PKG_CHECK_MODULES([ECONF], [libeconf], [have_econf=yes], [have_econf=no])
     AS_CASE([$with_econf:$have_econf],
     [yes:no],
@@ -2327,12 +2326,15 @@ AS_IF([test "x$with_econf" != xno], [
 ])
 AM_CONDITIONAL([HAVE_ECONF], [test "x$have_econf" = xyes])
 
-AC_ARG_ENABLE([vendordir],
-  AS_HELP_STRING([--enable-vendordir=DIR], [Direcotry for istribution provided configuration files]),,
-  []
+AC_ARG_WITH([vendordir],
+  AS_HELP_STRING([--with-vendordir=DIR], [Direcotry for distribution provided configuration files]),
+  [], []
 )
-AC_SUBST([vendordir], [$enable_vendordir])
-AM_CONDITIONAL([HAVE_VENDORDIR], [test "x$enable_vendordir" != x])
+AC_SUBST([vendordir], [$with_vendordir])
+AM_CONDITIONAL([USE_VENDORDIR], [test "x$with_vendordir" != x])
+AS_IF([test "x$with_vendordir" != x], [
+  AC_DEFINE([USE_VENDORDIR], [1], [Define to 1 to use vendordir])
+])
 
 
 AC_ARG_WITH([bashcompletiondir],
@@ -2596,7 +2598,7 @@ AC_MSG_RESULT([
        usrbin_execdir:    ${usrbin_execdir}
        usrsbin_execdir:   ${usrsbin_execdir}
        usrlib_execdir:    ${usrlib_execdir}
-        vendordir:         ${enable_vendordir}
+        vendordir:         ${with_vendordir}
 
        compiler:          ${CC}
        cflags:            ${CFLAGS}
index 08977a3438de1c15286bf88bca32d742c0d959e3..e3fac7e3d4107fd2a06575aaa87a3ca30300b095 100644 (file)
@@ -44,9 +44,6 @@ login_SOURCES = \
        login-utils/logindefs.c \
        login-utils/logindefs.h
 login_LDADD = $(LDADD) libcommon.la -lpam
-if HAVE_VENDORDIR
-login_CFLAGS = $(AM_CFLAGS) -DHAVE_VENDORDIR -DVENDORDIR=\"@vendordir@\"
-endif
 if HAVE_LINUXPAM
 login_LDADD += -lpam_misc
 endif
@@ -127,9 +124,6 @@ chfn_SOURCES = \
        login-utils/logindefs.h \
        $(chfn_chsh_sources)
 chfn_CFLAGS = $(chfn_chsh_cflags)
-if HAVE_VENDORDIR
-chfn_CFLAGS += -DHAVE_VENDORDIR -DVENDORDIR=\"@vendordir@\"
-endif
 chfn_LDFLAGS = $(chfn_chsh_ldflags)
 chfn_LDADD = $(LDADD) $(chfn_chsh_ldadd)
 if HAVE_ECONF
@@ -153,9 +147,6 @@ su_SOURCES = \
        login-utils/logindefs.c \
        login-utils/logindefs.h
 su_CFLAGS = $(SUID_CFLAGS) $(AM_CFLAGS)
-if HAVE_VENDORDIR
-su_CFLAGS += -DHAVE_VENDORDIR -DVENDORDIR=\"@vendordir@\"
-endif
 su_LDFLAGS = $(SUID_LDFLAGS) $(AM_LDFLAGS)
 su_LDADD = $(LDADD) libcommon.la -lpam
 if HAVE_LINUXPAM
@@ -195,9 +186,6 @@ endif
 if HAVE_ECONF
 runuser_LDADD += -leconf
 endif
-if HAVE_VENDORDIR
-runuser_CFLAGS = $(AM_CFLAGS) -DHAVE_VENDORDIR -DVENDORDIR=\"@vendordir@\"
-endif
 endif # BUILD_RUNUSER
 
 
@@ -222,9 +210,6 @@ lslogins_SOURCES = \
        login-utils/logindefs.h
 lslogins_LDADD = $(LDADD) libcommon.la libsmartcols.la
 lslogins_CFLAGS = $(AM_CFLAGS) -I$(ul_libsmartcols_incdir)
-if HAVE_VENDORDIR
-lslogins_CFLAGS += -DHAVE_VENDORDIR -DVENDORDIR=\"@vendordir@\"
-endif
 if HAVE_SELINUX
 lslogins_LDADD += -lselinux
 endif
@@ -267,9 +252,6 @@ test_logindefs_SOURCES = \
        login-utils/logindefs.c \
        login-utils/logindefs.h
 test_logindefs_CPPFLAGS = -DTEST_PROGRAM $(AM_CPPFLAGS)
-if HAVE_VENDORDIR
-test_logindefs_CPPFLAGS += -DHAVE_VENDORDIR -DVENDORDIR=\"@vendordir@\"
-endif
 if HAVE_ECONF
 test_logindefs_LDADD = -leconf
 endif
index 8445379ca88ed183571eb46c5fe40f1d284f0d76..3448e1fb1d2056dc9951f0cfb9e8e0ce1dc54446 100644 (file)
@@ -235,7 +235,7 @@ const char *getlogindefs_str(const char *name, const char *dflt)
        return ptr->value;
 }
 
-#else
+#else /* !HAVE_LIBECONF */
 
 #include <libeconf.h>
 
@@ -247,10 +247,6 @@ void free_getlogindefs_data(void)
        file = NULL;
 }
 
-#ifndef VENDORDIR
-#define VENDORDIR NULL
-#endif
-
 static void load_defaults(void)
 {
        econf_err error;
@@ -258,8 +254,15 @@ static void load_defaults(void)
        if (file != NULL)
                free_getlogindefs_data();
 
-       if ((error = econf_readDirs(&file, VENDORDIR, "/etc",
-                                   "login", "defs", "= \t", "#")))
+       error = econf_readDirs(&file,
+#if USE_VENDORDIR
+                       _PATH_VENDORDIR,
+#else
+                       NULL,
+#endif
+                       "/etc", "login", "defs", "= \t", "#");
+
+       if (error)
          syslog(LOG_NOTICE, _("Error reading login.defs: %s"),
                 econf_errString(error));
 
@@ -275,8 +278,8 @@ void logindefs_load_file(const char *filename)
 
        logindefs_loader = NULL; /* No recursion */
 
-#if HAVE_VENDORDIR
-       if (asprintf (&path, VENDORDIR"/%s", filename) == -1)
+#if USE_VENDORDIR
+       if (asprintf (&path, _PATH_VENDORDIR"/%s", filename) == -1)
                return;
        if (!econf_readFile(&file_l, path, "= \t", "#")) {
                if (file == NULL)