build-sys: cleanup $vendordir use

- 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>
This commit is contained in:
Karel Zak 2020-05-25 13:44:22 +02:00
parent d5e8818e03
commit fee9910661
4 changed files with 32 additions and 34 deletions

View 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)

View 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}

View 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

View 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)