[Pkg-shadow-devel] [PATCH 3/7] build-sys: clean up configure.ac

Sami Kerola kerolasa at iki.fi
Fri Aug 30 06:04:24 UTC 2013


This change makes quoting consistent, and updates some of the macros to
follow current best practices.

Signed-off-by: Sami Kerola <kerolasa at iki.fi>
---
 .gitignore          |   7 +-
 Makefile.am         |   2 +-
 configure.ac        | 528 +++++++++++++++++++++++++++++-----------------------
 libmisc/Makefile.am |   2 +-
 src/Makefile.am     |   4 +-
 5 files changed, 296 insertions(+), 247 deletions(-)

diff --git a/.gitignore b/.gitignore
index 4a1f96e..6bcef30 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,22 +17,17 @@ Makefile.in
 /ABOUT-NLS
 /aclocal.m4
 /autom4te.cache
-/config.guess
+/build-aux
 /config.h
 /config.h.in
 /config.log
 /config.rpath
 /config.status
-/config.sub
 /configure
-/depcomp
-/install-sh
 /libtool
 /ltmain.sh
 /m4
-/missing
 /stamp-h1
-/ylwrap
 
 /po/*.header
 /po/*.sed
diff --git a/Makefile.am b/Makefile.am
index 7492f07..45ad0a9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,7 +2,7 @@
 
 EXTRA_DIST = NEWS README TODO shadow.spec.in
 
-AUTOMAKE_OPTIONS = 1.5 dist-bzip2 foreign
+ACLOCAL_AMFLAGS = -I m4
 
 SUBDIRS = po man libmisc lib src \
 	contrib doc etc
diff --git a/configure.ac b/configure.ac
index 1005516..0b09cc6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,14 +1,19 @@
 dnl Process this file with autoconf to produce a configure script.
-AC_INIT
-AM_INIT_AUTOMAKE(shadow, 4.2)
+AC_INIT([shadow],
+	[4.2],
+	[pkg-shadow-devel at lists.alioth.debian.org], [],
+	[http://pkg-shadow.alioth.debian.org/])
 AC_CONFIG_HEADERS([config.h])
 
 dnl Some hacks...
-test "$prefix" = "NONE" && prefix="/usr"
-test "$prefix" = "/usr" && exec_prefix=""
+AS_IF([test "$prefix" = "NONE"], [prefix="/usr"])
+AS_IF([test "$prefix" = "/usr"], [exec_prefix=""])
 
+AC_CONFIG_AUX_DIR([build-aux])
+AC_CONFIG_MACRO_DIR([m4])
 AC_USE_SYSTEM_EXTENSIONS
 
+AM_INIT_AUTOMAKE([foreign 1.10 tar-pax dist-bzip2])
 AC_DISABLE_SHARED([])
 AC_ENABLE_STATIC([])
 
@@ -16,7 +21,7 @@ AM_MAINTAINER_MODE
 
 dnl Checks for programs.
 AC_PROG_CC
-AC_SEARCH_LIBS([strerror],[cposix])
+AC_SEARCH_LIBS([strerror], [cposix])
 AC_PROG_LN_S
 AC_PROG_YACC
 LT_INIT
@@ -29,20 +34,69 @@ AC_HEADER_STDC
 AC_HEADER_SYS_WAIT
 AC_HEADER_STDBOOL
 
-AC_CHECK_HEADERS(errno.h fcntl.h limits.h unistd.h sys/time.h utmp.h \
-	utmpx.h termios.h termio.h sgtty.h sys/ioctl.h syslog.h paths.h \
-	utime.h ulimit.h sys/resource.h gshadow.h lastlog.h \
-	locale.h rpc/key_prot.h netdb.h acl/libacl.h attr/libattr.h \
-	attr/error_context.h)
+AC_CHECK_HEADERS([ \
+	acl/libacl.h \
+	attr/error_context.h \
+	attr/libattr.h \
+	errno.h \
+	fcntl.h \
+	gshadow.h \
+	lastlog.h \
+	limits.h \
+	locale.h \
+	netdb.h \
+	paths.h \
+	rpc/key_prot.h \
+	sgtty.h \
+	sys/ioctl.h \
+	sys/resource.h \
+	sys/time.h \
+	syslog.h \
+	termio.h \
+	termios.h \
+	ulimit.h \
+	unistd.h \
+	utime.h \
+	utmp.h \
+	utmpx.h
+])
 
 dnl shadow now uses the libc's shadow implementation
-AC_CHECK_HEADER([shadow.h],,[AC_MSG_ERROR([You need a libc with shadow.h])])
-
-AC_CHECK_FUNCS(l64a fchmod fchown fsync futimes getgroups gethostname getspnam \
-	gettimeofday getusershell getutent initgroups lchown lckpwdf lstat \
-	lutimes memcpy memset setgroups sigaction strchr updwtmp updwtmpx innetgr \
-	getpwnam_r getpwuid_r getgrnam_r getgrgid_r getspnam_r getaddrinfo \
-	ruserok)
+AC_CHECK_HEADER([shadow.h], [], [AC_MSG_ERROR([You need a libc with shadow.h])])
+
+AC_CHECK_FUNCS([ \
+	fchmod \
+	fchown \
+	fsync \
+	futimes \
+	getaddrinfo \
+	getgrgid_r \
+	getgrnam_r \
+	getgroups \
+	gethostname \
+	getpwnam_r \
+	getpwuid_r \
+	getspnam \
+	getspnam_r \
+	gettimeofday \
+	getusershell \
+	getutent \
+	initgroups \
+	innetgr \
+	l64a \
+	lchown \
+	lckpwdf \
+	lstat \
+	lutimes \
+	memcpy \
+	memset \
+	ruserok \
+	setgroups \
+	sigaction \
+	strchr \
+	updwtmp \
+	updwtmpx
+])
 AC_SYS_LARGEFILE
 
 dnl Checks for typedefs, structures, and compiler characteristics.
@@ -70,13 +124,12 @@ AC_CHECK_MEMBERS([struct utmp.ut_type,
                   struct utmp.ut_addr_v6,
                   struct utmp.ut_time,
                   struct utmp.ut_xtime,
-                  struct utmp.ut_tv],,,[[#include <utmp.h>]])
+                  struct utmp.ut_tv], [], [], [[#include <utmp.h>]])
 dnl There are dependencies:
 dnl If UTMPX has to be used, the utmp structure shall have a ut_id field.
-if test "$ac_cv_header_utmpx_h" = "yes" &&
-   test "$ac_cv_member_struct_utmp_ut_id" != "yes"; then
-	AC_MSG_ERROR(Systems with UTMPX and no ut_id field in the utmp structure are not supported)
-fi
+AS_IF([test "$ac_cv_header_utmpx_h" = "yes" && test "$ac_cv_member_struct_utmp_ut_id" != "yes"], [
+	AC_MSG_ERROR([Systems with UTMPX and no ut_id field in the utmp structure are not supported])
+])
 
 AC_CHECK_MEMBERS([struct utmpx.ut_name,
                   struct utmpx.ut_host,
@@ -84,9 +137,9 @@ AC_CHECK_MEMBERS([struct utmpx.ut_name,
                   struct utmpx.ut_addr,
                   struct utmpx.ut_addr_v6,
                   struct utmpx.ut_time,
-                  struct utmpx.ut_xtime],,,[[#include <utmpx.h>]])
+                  struct utmpx.ut_xtime], [], [],[[#include <utmpx.h>]])
 
-if test "$ac_cv_header_lastlog_h" = "yes"; then
+AS_IF([test "$ac_cv_header_lastlog_h" = "yes"], [
 	AC_CACHE_CHECK(for ll_host in struct lastlog,
 		ac_cv_struct_lastlog_ll_host,
 		AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <lastlog.h>],
@@ -97,36 +150,49 @@ if test "$ac_cv_header_lastlog_h" = "yes"; then
 		)
 	)
 
-	if test "$ac_cv_struct_lastlog_ll_host" = "yes"; then
-		AC_DEFINE(HAVE_LL_HOST, 1,
+	AS_IF([test "$ac_cv_struct_lastlog_ll_host" = "yes"], [
+		AC_DEFINE([HAVE_LL_HOST], [1],
 			[Define if struct lastlog has ll_host])
-	fi
-fi
+	])
+])
 
 dnl Checks for library functions.
 AC_TYPE_GETGROUPS
-AC_DIAGNOSE([obsolete],[your code may safely assume C89 semantics that RETSIGTYPE is void.
+AC_DIAGNOSE([obsolete], [your code may safely assume C89 semantics that RETSIGTYPE is void.
 Remove this warning and the `AC_CACHE_CHECK' when you adjust the code.])dnl
-AC_CACHE_CHECK([return type of signal handlers],[ac_cv_type_signal],[AC_COMPILE_IFELSE(
+AC_CACHE_CHECK([return type of signal handlers], [ac_cv_type_signal], [AC_COMPILE_IFELSE(
 [AC_LANG_PROGRAM([#include <sys/types.h>
 #include <signal.h>
 ],
 		 [return *(signal (0, 0)) (0) == 1;])],
 		   [ac_cv_type_signal=int],
 		   [ac_cv_type_signal=void])])
-AC_DEFINE_UNQUOTED([RETSIGTYPE],[$ac_cv_type_signal],[Define as the return type of signal handlers
+AC_DEFINE_UNQUOTED([RETSIGTYPE], [$ac_cv_type_signal], [Define as the return type of signal handlers
 		    (`int' or `void').])
 
 AC_FUNC_UTIME_NULL
 AC_FUNC_STRFTIME
-AC_REPLACE_FUNCS(mkdir putgrent putpwent putspent rename rmdir)
-AC_REPLACE_FUNCS(sgetgrent sgetpwent sgetspent)
-AC_REPLACE_FUNCS(snprintf strcasecmp strdup strerror strstr)
+AC_REPLACE_FUNCS([
+	mkdir \
+	putgrent \
+	putpwent \
+	putspent \
+	rename \
+	rmdir \
+	sgetgrent \
+	sgetpwent \
+	sgetspent \
+	snprintf \
+	strcasecmp \
+	strdup \
+	strerror \
+	strstr
+])
 
-AC_CHECK_FUNC(setpgrp)
+AC_CHECK_FUNC([setpgrp])
 
-if test "$ac_cv_header_shadow_h" = "yes"; then
-	AC_CACHE_CHECK(for working shadow group support,
+AS_IF([test "$ac_cv_header_shadow_h" = "yes"], [
+	AC_CACHE_CHECK([for working shadow group support],
 		ac_cv_libc_shadowgrp,
 		AC_RUN_IFELSE([AC_LANG_SOURCE([
 				#include <shadow.h>
@@ -143,32 +209,28 @@ if test "$ac_cv_header_shadow_h" = "yes"; then
 		)
 	)
 
-	if test "$ac_cv_libc_shadowgrp" = "yes"; then
-		AC_DEFINE(HAVE_SHADOWGRP, 1, [Have working shadow group support in libc])
-	fi
-fi
+	AS_IF([test "$ac_cv_libc_shadowgrp" = "yes"], [
+		AC_DEFINE([HAVE_SHADOWGRP], [1], [Have working shadow group support in libc])
+	])
+])
 
 AC_CACHE_CHECK([location of shared mail directory], shadow_cv_maildir,
 [for shadow_cv_maildir in /var/mail /var/spool/mail /usr/spool/mail /usr/mail none; do
-	if test -d $shadow_cv_maildir; then
-		break
-	fi
+	AS_IF([test -d $shadow_cv_maildir], [break])
 done])
-if test $shadow_cv_maildir != none; then
-	AC_DEFINE_UNQUOTED(MAIL_SPOOL_DIR, "$shadow_cv_maildir",
+AS_IF([test $shadow_cv_maildir != none], [
+	AC_DEFINE_UNQUOTED([MAIL_SPOOL_DIR], ["$shadow_cv_maildir"],
 		[Location of system mail spool directory.])
-fi
+])
 
 AC_CACHE_CHECK([location of user mail file], shadow_cv_mailfile,
 [for shadow_cv_mailfile in Mailbox mailbox Mail mail .mail none; do
-	if test -f $HOME/$shadow_cv_mailfile; then
-		break
-	fi
+	AS_IF([test -f $HOME/$shadow_cv_mailfile], [break])
 done])
-if test $shadow_cv_mailfile != none; then
-	AC_DEFINE_UNQUOTED(MAIL_SPOOL_FILE, "$shadow_cv_mailfile",
+AS_IF([test $shadow_cv_mailfile != none], [
+	AC_DEFINE_UNQUOTED([MAIL_SPOOL_FILE], ["$shadow_cv_mailfile"],
 		[Name of user's mail spool file if stored in user's home directory.])
-fi
+])
 
 AC_CACHE_CHECK([location of utmp], shadow_cv_utmpdir,
 [for shadow_cv_utmpdir in /var/run /var/adm /usr/adm /etc none; do
@@ -176,167 +238,160 @@ AC_CACHE_CHECK([location of utmp], shadow_cv_utmpdir,
 		break
 	fi
 done])
-if test "$shadow_cv_utmpdir" = "none"; then
-	AC_MSG_WARN(utmp file not found)
-fi
-AC_DEFINE_UNQUOTED(_UTMP_FILE, "$shadow_cv_utmpdir/utmp",
+AS_IF([test "$shadow_cv_utmpdir" = "none"], [
+	AC_MSG_WARN([utmp file not found])
+])
+AC_DEFINE_UNQUOTED([_UTMP_FILE], ["$shadow_cv_utmpdir/utmp"],
 	[Path for utmp file.])
 
 AC_CACHE_CHECK([location of faillog/lastlog/wtmp], shadow_cv_logdir,
 [for shadow_cv_logdir in /var/log /var/adm /usr/adm /etc; do
-	if test -d $shadow_cv_logdir; then
-		break
-	fi
+	AS_IF([test -d $shadow_cv_logdir], [break])
 done])
-AC_DEFINE_UNQUOTED(_WTMP_FILE, "$shadow_cv_logdir/wtmp",
+AC_DEFINE_UNQUOTED([_WTMP_FILE], ["$shadow_cv_logdir/wtmp"],
 	[Path for wtmp file.])
-AC_DEFINE_UNQUOTED(LASTLOG_FILE, "$shadow_cv_logdir/lastlog",
+AC_DEFINE_UNQUOTED([LASTLOG_FILE], ["$shadow_cv_logdir/lastlog"],
 	[Path for lastlog file.])
-AC_DEFINE_UNQUOTED(FAILLOG_FILE, "$shadow_cv_logdir/faillog",
+AC_DEFINE_UNQUOTED([FAILLOG_FILE], ["$shadow_cv_logdir/faillog"],
 	[Path for faillog file.])
 
 AC_CACHE_CHECK([location of the passwd program], shadow_cv_passwd_dir,
-[if test -f /usr/bin/passwd; then
-	shadow_cv_passwd_dir=/usr/bin
-else
-	shadow_cv_passwd_dir=/bin
-fi])
-AC_DEFINE_UNQUOTED(PASSWD_PROGRAM, "$shadow_cv_passwd_dir/passwd",
+	[AS_IF([test -f /usr/bin/passwd],
+		[shadow_cv_passwd_dir=/usr/bin],
+		[shadow_cv_passwd_dir=/bin])
+	])
+AC_DEFINE_UNQUOTED([PASSWD_PROGRAM], ["$shadow_cv_passwd_dir/passwd"],
 	[Path to passwd program.])
 
 dnl XXX - quick hack, should disappear before anyone notices :).
-AC_DEFINE(USE_SYSLOG, 1, [Define to use syslog().])
-if test "$ac_cv_func_ruserok" = "yes"; then
-	AC_DEFINE(RLOGIN, 1, [Define if login should support the -r flag for rlogind.])
-	AC_DEFINE(RUSEROK, 0, [Define to the ruserok() "success" return value (0 or 1).])
-fi
+AC_DEFINE([USE_SYSLOG], [1], [Define to use syslog().])
+AS_IF([test "$ac_cv_func_ruserok" = "yes"], [
+	AC_DEFINE([RLOGIN], [1], [Define if login should support the -r flag for rlogind.])
+	AC_DEFINE([RUSEROK], [0], [Define to the ruserok() "success" return value (0 or 1).])
+])
 
-AC_ARG_ENABLE(shadowgrp,
+AC_ARG_ENABLE([shadowgrp],
 	[AS_HELP_STRING([--enable-shadowgrp],[enable shadow group support @<:@default=yes@:>@])],
-	[case "${enableval}" in
-	 yes) enable_shadowgrp="yes" ;;
-	  no) enable_shadowgrp="no" ;;
-	   *) AC_MSG_ERROR(bad value ${enableval} for --enable-shadowgrp) ;;
-	 esac],
+	[AS_CASE([${enableval}],
+		[yes], [enable_shadowgrp="yes"],
+		[no], [enable_shadowgrp="no"],
+		[AC_MSG_ERROR([bad value ${enableval} for --enable-shadowgrp])]
+	)],
 	[enable_shadowgrp="yes"]
 )
 
-AC_ARG_ENABLE(man,
+AC_ARG_ENABLE([man],
 	[AS_HELP_STRING([--enable-man],[regenerate roff man pages from Docbook @<:@default=no@:>@])],
 	[enable_man="${enableval}"],
 	[enable_man="no"]
 )
 
-AC_ARG_ENABLE(account-tools-setuid,
+AC_ARG_ENABLE([account-tools-setuid],
 	[AS_HELP_STRING([--enable-account-tools-setuid],[Install the user and group management tools setuid and authenticate the callers. This requires --with-pam.])],
-	[case "${enableval}" in
-	 yes) enable_acct_tools_setuid="yes" ;;
-	  no) enable_acct_tools_setuid="no" ;;
-	   *) AC_MSG_ERROR(bad value ${enableval} for --enable-account-tools-setuid)
-	   ;;
-	 esac],
+	[AS_CASE([${enableval}],
+		[yes], [enable_acct_tools_setuid="yes"],
+		[no], [enable_acct_tools_setuid="no"],
+		[AC_MSG_ERROR([bad value ${enableval} for --enable-account-tools-setuid])]
+	)],
 	[enable_acct_tools_setuid="maybe"]
 )
 
-AC_ARG_ENABLE(utmpx,
-	[AS_HELP_STRING([--enable-utmpx],[enable loggin in utmpx / wtmpx @<:@default=no@:>@])],
-	[case "${enableval}" in
-	 yes) enable_utmpx="yes" ;;
-	  no) enable_utmpx="no" ;;
-	   *) AC_MSG_ERROR(bad value ${enableval} for --enable-utmpx) ;;
-	 esac],
+AC_ARG_ENABLE([utmpx],
+	[AS_HELP_STRING([--enable-utmpx],
+			[enable loggin in utmpx / wtmpx @<:@default=no@:>@])],
+	[AS_CASE(["${enableval}"],
+		[yes], [enable_utmpx="yes"]
+		[no], [enable_utmpx="no"]
+		[AC_MSG_ERROR([bad value ${enableval} for --enable-utmpx])]
+	)],
 	[enable_utmpx="no"]
 )
 
-AC_ARG_ENABLE(subordinate-ids,
+AC_ARG_ENABLE([subordinate-ids],
 	[AS_HELP_STRING([--enable-subordinate-ids],[support subordinate ids @<:@default=yes@:>@])],
 	[enable_subids="${enableval}"],
 	[enable_subids="maybe"]
 )
 
-AC_ARG_WITH(audit, 
+AC_ARG_WITH([audit], 
 	[AS_HELP_STRING([--with-audit],[use auditing support @<:@default=yes if found@:>@])],
 	[with_audit=$withval], [with_audit=maybe])
-AC_ARG_WITH(libpam,
+AC_ARG_WITH([libpam],
 	[AS_HELP_STRING([--with-libpam],[use libpam for PAM support @<:@default=yes if found@:>@])],
 	[with_libpam=$withval], [with_libpam=maybe])
-AC_ARG_WITH(selinux,
+AC_ARG_WITH([selinux],
 	[AS_HELP_STRING([--with-selinux],[use SELinux support @<:@default=yes if found@:>@])],
 	[with_selinux=$withval], [with_selinux=maybe])
-AC_ARG_WITH(acl,
+AC_ARG_WITH([acl],
 	[AS_HELP_STRING([--with-acl],[use ACL support @<:@default=yes if found@:>@])],
 	[with_acl=$withval], [with_acl=maybe])
-AC_ARG_WITH(attr,
+AC_ARG_WITH([attr],
 	[AS_HELP_STRING([--with-attr],[use Extended Attribute support @<:@default=yes if found@:>@])],
 	[with_attr=$withval], [with_attr=maybe])
-AC_ARG_WITH(skey,
+AC_ARG_WITH([skey],
 	[AS_HELP_STRING([--with-skey],[use S/Key support @<:@default=no@:>@])],
 	[with_skey=$withval], [with_skey=no])
-AC_ARG_WITH(tcb,
+AC_ARG_WITH([tcb],
 	[AS_HELP_STRING([--with-tcb],[use tcb support (incomplete) @<:@default=yes if found@:>@])],
 	[with_tcb=$withval], [with_tcb=maybe])
-AC_ARG_WITH(libcrack,
+AC_ARG_WITH([libcrack],
 	[AS_HELP_STRING([--with-libcrack],[use libcrack @<:@default=no@:>@])],
 	[with_libcrack=$withval], [with_libcrack=no])
-AC_ARG_WITH(sha-crypt,
+AC_ARG_WITH([sha-crypt],
 	[AS_HELP_STRING([--with-sha-crypt],[allow the SHA256 and SHA512 password encryption algorithms @<:@default=yes@:>@])],
 	[with_sha_crypt=$withval], [with_sha_crypt=yes])
-AC_ARG_WITH(nscd,
+AC_ARG_WITH([nscd],
 	[AS_HELP_STRING([--with-nscd],[enable support for nscd @<:@default=yes@:>@])],
 	[with_nscd=$withval], [with_nscd=yes])
-AC_ARG_WITH(group-name-max-length,
+AC_ARG_WITH([group-name-max-length],
 	[AS_HELP_STRING([--with-group-name-max-length],[set max group name length @<:@default=16@:>@])],
 	[with_group_name_max_length=$withval], [with_group_name_max_length=yes])
 
-if test "$with_group_name_max_length" = "no" ; then
-	with_group_name_max_length=0
-elif test "$with_group_name_max_length" = "yes" ; then
-	with_group_name_max_length=16
-fi
-AC_DEFINE_UNQUOTED(GROUP_NAME_MAX_LENGTH, $with_group_name_max_length, [max group name length])
-AC_SUBST(GROUP_NAME_MAX_LENGTH)
+AS_IF([test "$with_group_name_max_length" = "no"], [with_group_name_max_length=0],
+	[test "$with_group_name_max_length" = "yes"], [with_group_name_max_length=16])
+
+AC_DEFINE_UNQUOTED([GROUP_NAME_MAX_LENGTH], [$with_group_name_max_length], [max group name length])
+AC_SUBST([GROUP_NAME_MAX_LENGTH])
 GROUP_NAME_MAX_LENGTH="$with_group_name_max_length"
 
-AM_CONDITIONAL(USE_SHA_CRYPT, test "x$with_sha_crypt" = "xyes")
-if test "$with_sha_crypt" = "yes"; then
-	AC_DEFINE(USE_SHA_CRYPT, 1, [Define to allow the SHA256 and SHA512 password encryption algorithms])
-fi
+AM_CONDITIONAL([USE_SHA_CRYPT], [test "x$with_sha_crypt" = "xyes"])
+AS_IF([test "$with_sha_crypt" = "yes"], [
+	AC_DEFINE([USE_SHA_CRYPT], [1], [Define to allow the SHA256 and SHA512 password encryption algorithms])
+])
 
-if test "$with_nscd" = "yes"; then
-	AC_CHECK_FUNC(posix_spawn,
-	              [AC_DEFINE(USE_NSCD, 1, [Define to support flushing of nscd caches])],
-	              [AC_MSG_ERROR([posix_spawn is needed for nscd support])])
-fi
+AS_IF([test "$with_nscd" = "yes"], [
+	AC_CHECK_FUNC([posix_spawn],
+		      [AC_DEFINE([USE_NSCD], [1], [Define to support flushing of nscd caches])],
+		      [AC_MSG_ERROR([posix_spawn is needed for nscd support])])
+])
 
 dnl Check for some functions in libc first, only if not found check for
 dnl other libraries.  This should prevent linking libnsl if not really
 dnl needed (Linux glibc, Irix), but still link it if needed (Solaris).
 
-AC_SEARCH_LIBS(inet_ntoa, inet)
-AC_SEARCH_LIBS(socket, socket)
-AC_SEARCH_LIBS(gethostbyname, nsl)
+AC_SEARCH_LIBS([inet_ntoa], [inet])
+AC_SEARCH_LIBS([socket], [socket])
+AC_SEARCH_LIBS([gethostbyname], [nsl])
 
-if test "$enable_shadowgrp" = "yes"; then
-	AC_DEFINE(SHADOWGRP, 1, [Define to support the shadow group file.])
-fi
-AM_CONDITIONAL(SHADOWGRP, test "x$enable_shadowgrp" = "xyes")
+AS_IF([test "$enable_shadowgrp" = "yes"], [
+	AC_DEFINE([SHADOWGRP], [1], [Define to support the shadow group file.])
+])
+AM_CONDITIONAL([SHADOWGRP], [test "x$enable_shadowgrp" = "xyes"])
 
-if test "$enable_man" = "yes"; then
+AS_IF([test "$enable_man" = "yes"], [
 	dnl
 	dnl Check for xsltproc
 	dnl
 	AC_PATH_PROG([XSLTPROC], [xsltproc])
-	if test -z "$XSLTPROC"; then
-		enable_man=no
-	fi
+	AS_IF([test -z "$XSLTPROC"], [enable_man=no])
 
 	dnl check for DocBook DTD and stylesheets in the local catalog.
 	JH_CHECK_XML_CATALOG([-//OASIS//DTD DocBook XML V4.1.2//EN],
 		[DocBook XML DTD V4.1.2], [], enable_man=no)
 	JH_CHECK_XML_CATALOG([http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl],
 		[DocBook XSL Stylesheets >= 1.70.1], [], enable_man=no)
-fi
-AM_CONDITIONAL(ENABLE_REGENERATE_MAN, test "x$enable_man" != "xno")
+])
+AM_CONDITIONAL([ENABLE_REGENERATE_MAN], [test "x$enable_man" != "xno"])
 
 if test "$enable_subids" != "no"; then
 	dnl
@@ -383,7 +438,7 @@ if test "$with_acl" != "no"; then
 		elif test "$acl_lib" = "no" ; then
 			with_acl="no"
 		else
-			AC_DEFINE(WITH_ACL, 1,
+			AC_DEFINE([WITH_ACL], [1],
 			          [Build shadow with ACL support])
 			LIBACL="-lacl"
 			with_acl="yes"
@@ -393,14 +448,14 @@ if test "$with_acl" != "no"; then
 	fi
 fi
 
-AC_SUBST(LIBATTR)
+AC_SUBST([LIBATTR])
 if test "$with_attr" != "no"; then
-	AC_CHECK_HEADERS(attr/libattr.h attr/error_context.h, [attr_header="yes"], [attr_header="no"])
+	AC_CHECK_HEADERS([attr/libattr.h attr/error_context.h], [attr_header="yes"], [attr_header="no"])
 	if test "$attr_header$with_attr" = "noyes" ; then
 		AC_MSG_ERROR([attr/libattr.h or attr/error_context.h is missing])
 	elif test "$attr_header" = "yes" ; then
-		AC_CHECK_LIB(attr, attr_copy_file,
-		             [AC_CHECK_LIB(attr, attr_copy_fd,
+		AC_CHECK_LIB([attr], [attr_copy_file],
+		             [AC_CHECK_LIB([attr], [attr_copy_fd],
 		                           [attr_lib="yes"],
 		                           [attr_lib="no"])],
 		             [attr_lib="no"])
@@ -409,7 +464,7 @@ if test "$with_attr" != "no"; then
 		elif test "$attr_lib" = "no" ; then
 			with_attr="no"
 		else
-			AC_DEFINE(WITH_ATTR, 1,
+			AC_DEFINE([WITH_ATTR], [1],
 			          [Build shadow with Extended Attributes support])
 			LIBATTR="-lattr"
 			with_attr="yes"
@@ -419,29 +474,29 @@ if test "$with_attr" != "no"; then
 	fi
 fi
 
-AC_SUBST(LIBAUDIT)
+AC_SUBST([LIBAUDIT])
 if test "$with_audit" != "no"; then
-	AC_CHECK_HEADER(libaudit.h, [audit_header="yes"], [audit_header="no"])
+	AC_CHECK_HEADER([libaudit.h], [audit_header="yes"], [audit_header="no"])
 	if test "$audit_header$with_audit" = "noyes" ; then
 		AC_MSG_ERROR([libaudit.h is missing])
 	elif test "$audit_header" = "yes"; then
-		AC_CHECK_DECL(AUDIT_ADD_USER,,[audit_header="no"],[#include <libaudit.h>])
-		AC_CHECK_DECL(AUDIT_DEL_USER,,[audit_header="no"],[#include <libaudit.h>])
-		AC_CHECK_DECL(AUDIT_ADD_GROUP,,[audit_header="no"],[#include <libaudit.h>])
-		AC_CHECK_DECL(AUDIT_DEL_GROUP,,[audit_header="no"],[#include <libaudit.h>])
+		AC_CHECK_DECL([AUDIT_ADD_USER], [], [audit_header="no"], [#include <libaudit.h>])
+		AC_CHECK_DECL([AUDIT_DEL_USER], [], [audit_header="no"], [#include <libaudit.h>])
+		AC_CHECK_DECL([AUDIT_ADD_GROUP], [], [audit_header="no"], [#include <libaudit.h>])
+		AC_CHECK_DECL([AUDIT_DEL_GROUP], [], [audit_header="no"], [#include <libaudit.h>])
 		if test "$audit_header$with_audit" = "noyes" ; then
 			AC_MSG_ERROR([AUDIT_ADD_USER AUDIT_DEL_USER AUDIT_ADD_GROUP or AUDIT_DEL_GROUP missing from libaudit.h])
 		fi
 	fi
 	if test "$audit_header" = "yes"; then
-		AC_CHECK_LIB(audit, audit_log_acct_message,
+		AC_CHECK_LIB([audit], [audit_log_acct_message],
 		             [audit_lib="yes"], [audit_lib="no"])
 		if test "$audit_lib$with_audit" = "noyes" ; then
 			AC_MSG_ERROR([libaudit not found])
 		elif test "$audit_lib" = "no" ; then
 			with_audit="no"
 		else
-			AC_DEFINE(WITH_AUDIT, 1,
+			AC_DEFINE([WITH_AUDIT], [1],
 			          [Define if you want to enable Audit messages])
 			LIBAUDIT="-laudit"
 			with_audit="yes"
@@ -451,44 +506,44 @@ if test "$with_audit" != "no"; then
 	fi
 fi
 
-AC_SUBST(LIBCRACK)
-if test "$with_libcrack" = "yes"; then
-	echo "checking cracklib flavour, don't be surprised by the results"
-	AC_CHECK_LIB(crack, FascistCheck,
-		[LIBCRACK=-lcrack AC_DEFINE(HAVE_LIBCRACK, 1, [Defined if you have libcrack.])])
-	AC_CHECK_LIB(crack, FascistHistory,
-		AC_DEFINE(HAVE_LIBCRACK_HIST, 1, [Defined if you have the ts&szs cracklib.]))
-	AC_CHECK_LIB(crack, FascistHistoryPw,
-		AC_DEFINE(HAVE_LIBCRACK_PW, 1, [Defined if it includes *Pw functions.]))
-fi
+AC_SUBST([LIBCRACK])
+AS_IF([test "$with_libcrack" = "yes"], [
+	AS_ECHO([checking cracklib flavour, do not be surprised by the results])
+	AC_CHECK_LIB([crack], [FascistCheck],
+		[LIBCRACK=-lcrack AC_DEFINE([HAVE_LIBCRACK], [1], [Defined if you have libcrack.])])
+	AC_CHECK_LIB([crack], [FascistHistory],
+		AC_DEFINE([HAVE_LIBCRACK_HIST], [1], [Defined if you have the ts&szs cracklib.]))
+	AC_CHECK_LIB([crack], [FascistHistoryPw],
+		AC_DEFINE([HAVE_LIBCRACK_PW], [1], [Defined if it includes *Pw functions.]))
+])
 
-AC_SUBST(LIBSELINUX)
-AC_SUBST(LIBSEMANAGE)
+AC_SUBST([LIBSELINUX])
+AC_SUBST([LIBSEMANAGE])
 if test "$with_selinux" != "no"; then
-	AC_CHECK_HEADERS(selinux/selinux.h, [selinux_header="yes"], [selinux_header="no"])
+	AC_CHECK_HEADERS([selinux/selinux.h], [selinux_header="yes"], [selinux_header="no"])
 	if test "$selinux_header$with_selinux" = "noyes" ; then
 		AC_MSG_ERROR([selinux/selinux.h is missing])
 	fi
 
-	AC_CHECK_HEADERS(semanage/semanage.h, [semanage_header="yes"], [semanage_header="no"])
+	AC_CHECK_HEADERS([semanage/semanage.h], [semanage_header="yes"], [semanage_header="no"])
 	if test "$semanage_header$with_selinux" = "noyes" ; then
 		AC_MSG_ERROR([semanage/semanage.h is missing])
 	fi
 
 	if test "$selinux_header$semanage_header" = "yesyes" ; then
-		AC_CHECK_LIB(selinux, is_selinux_enabled, [selinux_lib="yes"], [selinux_lib="no"])
+		AC_CHECK_LIB([selinux], [is_selinux_enabled], [selinux_lib="yes"], [selinux_lib="no"])
 		if test "$selinux_lib$with_selinux" = "noyes" ; then
 			AC_MSG_ERROR([libselinux not found])
 		fi
 
-		AC_CHECK_LIB(semanage, semanage_connect, [semanage_lib="yes"], [semanage_lib="no"])
+		AC_CHECK_LIB([semanage], [semanage_connect], [semanage_lib="yes"], [semanage_lib="no"])
 		if test "$semanage_lib$with_selinux" = "noyes" ; then
 			AC_MSG_ERROR([libsemanage not found])
 		fi
 
 		if test "$selinux_lib$semanage_lib" == "yesyes" ; then
-			AC_DEFINE(WITH_SELINUX, 1,
-			          [Build shadow with SELinux support])
+			AC_DEFINE([WITH_SELINUX], [1],
+				  [Build shadow with SELinux support])
 			LIBSELINUX="-lselinux"
 			LIBSEMANAGE="-lsemanage"
 			with_selinux="yes"
@@ -500,19 +555,19 @@ if test "$with_selinux" != "no"; then
 	fi
 fi
 
-AC_SUBST(LIBTCB)
+AC_SUBST([LIBTCB])
 if test "$with_tcb" != "no"; then
-	AC_CHECK_HEADERS(tcb.h, [tcb_header="yes"], [tcb_header="no"])
+	AC_CHECK_HEADERS([tcb.h], [tcb_header="yes"], [tcb_header="no"])
 	if test "$tcb_header$with_tcb" = "noyes" ; then
 		AC_MSG_ERROR([tcb.h is missing])
 	elif test "$tcb_header" = "yes" ; then
-		AC_CHECK_LIB(tcb, tcb_is_suspect, [tcb_lib="yes"], [tcb_lib="no"])
+		AC_CHECK_LIB([tcb], [tcb_is_suspect], [tcb_lib="yes"], [tcb_lib="no"])
 		if test "$tcb_lib$with_tcb" = "noyes" ; then
 			AC_MSG_ERROR([libtcb not found])
 		elif test "$tcb_lib" = "no" ; then
 			with_tcb="no"
 		else
-			AC_DEFINE(WITH_TCB, 1, [Build shadow with tcb support (incomplete)])
+			AC_DEFINE([WITH_TCB], [1], [Build shadow with tcb support (incomplete)])
 			LIBTCB="-ltcb"
 			with_tcb="yes"
 		fi
@@ -520,35 +575,35 @@ if test "$with_tcb" != "no"; then
 		with_tcb="no"
 	fi
 fi
-AM_CONDITIONAL(WITH_TCB, test x$with_tcb = xyes)
+AM_CONDITIONAL([WITH_TCB], [test x$with_tcb = xyes])
 
-AC_SUBST(LIBPAM)
+AC_SUBST([LIBPAM])
 if test "$with_libpam" != "no"; then
-	AC_CHECK_LIB(pam, pam_start,
-	             [pam_lib="yes"], [pam_lib="no"])
+	AC_CHECK_LIB([pam], [pam_start],
+		     [pam_lib="yes"], [pam_lib="no"])
 	if test "$pam_lib$with_libpam" = "noyes" ; then
-		AC_MSG_ERROR(libpam not found)
+		AC_MSG_ERROR([libpam not found])
 	fi
 
 	LIBPAM="-lpam"
 	pam_conv_function="no"
 
-	AC_CHECK_LIB(pam, openpam_ttyconv,
-	             [pam_conv_function="openpam_ttyconv"],
-	             AC_CHECK_LIB(pam_misc, misc_conv,
-	                          [pam_conv_function="misc_conv"; LIBPAM="$LIBPAM -lpam_misc"])
-	            )
+	AC_CHECK_LIB([pam], [openpam_ttyconv],
+		     [pam_conv_function="openpam_ttyconv"],
+		     AC_CHECK_LIB([pam_misc], [misc_conv],
+				  [pam_conv_function="misc_conv"; LIBPAM="$LIBPAM -lpam_misc"])
+		    )
 
 	if test "$pam_conv_function$with_libpam" = "noyes" ; then
-		AC_MSG_ERROR(PAM conversation function not found)
+		AC_MSG_ERROR([PAM conversation function not found])
 	fi
 
 	pam_headers_found=no
-	AC_CHECK_HEADERS( [security/openpam.h security/pam_misc.h],
-	                 [ pam_headers_found=yes ; break ], [],
-	                 [ #include <security/pam_appl.h> ] )
+	AC_CHECK_HEADERS([security/openpam.h security/pam_misc.h],
+			 [pam_headers_found=yes; break], [],
+			 [#include <security/pam_appl.h>])
 	if test "$pam_headers_found$with_libpam" = "noyes" ; then
-	                AC_MSG_ERROR(PAM headers not found)
+			AC_MSG_ERROR([PAM headers not found])
 	fi
 
 
@@ -562,36 +617,36 @@ fi
 dnl Now with_libpam is either yes or no
 if test "$with_libpam" = "yes"; then
 	AC_CHECK_DECLS([PAM_ESTABLISH_CRED,
-	                PAM_DELETE_CRED,
-	                PAM_NEW_AUTHTOK_REQD,
-	                PAM_DATA_SILENT],
-	               [], [], [#include <security/pam_appl.h>])
+			PAM_DELETE_CRED,
+			PAM_NEW_AUTHTOK_REQD,
+			PAM_DATA_SILENT],
+		       [], [], [#include <security/pam_appl.h>])
 
 
 	save_libs=$LIBS
 	LIBS="$LIBS $LIBPAM"
 	# We do not use AC_CHECK_FUNCS to avoid duplicated definition with
 	# Linux PAM.
-	AC_CHECK_FUNC(pam_fail_delay, [AC_DEFINE(HAS_PAM_FAIL_DELAY, 1, [Define to 1 if you have the declaration of 'pam_fail_delay'])])
+	AC_CHECK_FUNC([pam_fail_delay], [AC_DEFINE([HAS_PAM_FAIL_DELAY], [1], [Define to 1 if you have the declaration of 'pam_fail_delay'])])
 	LIBS=$save_libs
 
-	AC_DEFINE(USE_PAM, 1, [Define to support Pluggable Authentication Modules])
-	AC_DEFINE_UNQUOTED(SHADOW_PAM_CONVERSATION, [$pam_conv_function],[PAM converstation to use])
-	AM_CONDITIONAL(USE_PAM, [true])
+	AC_DEFINE([USE_PAM], [1], [Define to support Pluggable Authentication Modules])
+	AC_DEFINE_UNQUOTED([SHADOW_PAM_CONVERSATION], [$pam_conv_function], [PAM converstation to use])
+	AM_CONDITIONAL([USE_PAM], [true])
 
-	AC_MSG_CHECKING(use login and su access checking if PAM not used)
-	AC_MSG_RESULT(no)
+	AC_MSG_CHECKING([use login and su access checking if PAM not used])
+	AC_MSG_RESULT([no])
 else
-	AC_DEFINE(SU_ACCESS, 1, [Define to support /etc/suauth su access control.])
-	AM_CONDITIONAL(USE_PAM, [false])
-	AC_MSG_CHECKING(use login and su access checking if PAM not used)
-	AC_MSG_RESULT(yes)
+	AC_DEFINE([SU_ACCESS], [1], [Define to support /etc/suauth su access control.])
+	AM_CONDITIONAL([USE_PAM], [false])
+	AC_MSG_CHECKING([use login and su access checking if PAM not used])
+	AC_MSG_RESULT([yes])
 fi
 
 if test "$enable_acct_tools_setuid" != "no"; then
 	if test "$with_libpam" != "yes"; then
 		if test "$enable_acct_tools_setuid" = "yes"; then
-			AC_MSG_ERROR(PAM support is required for --enable-account-tools-setuid)
+			AC_MSG_ERROR([PAM support is required for --enable-account-tools-setuid])
 		else
 			enable_acct_tools_setuid="no"
 		fi
@@ -599,42 +654,40 @@ if test "$enable_acct_tools_setuid" != "no"; then
 		enable_acct_tools_setuid="yes"
 	fi
 	if test "$enable_acct_tools_setuid" = "yes"; then
-		AC_DEFINE(ACCT_TOOLS_SETUID,
-		          1,
-		          [Define if account management tools should be installed setuid and authenticate the callers])
+		AC_DEFINE([ACCT_TOOLS_SETUID], [1],
+			  [Define if account management tools should be installed setuid and authenticate the callers])
 	fi
 fi
-AM_CONDITIONAL(ACCT_TOOLS_SETUID, test "x$enable_acct_tools_setuid" = "xyes")
+AM_CONDITIONAL([ACCT_TOOLS_SETUID], [test "x$enable_acct_tools_setuid" = "xyes"])
 
-AC_SUBST(LIBSKEY)
-AC_SUBST(LIBMD)
+AC_SUBST([LIBSKEY])
+AC_SUBST([LIBMD])
 if test "$with_skey" = "yes"; then
-	AC_CHECK_LIB(md, MD5Init, [LIBMD=-lmd])
-	AC_CHECK_LIB(skey, skeychallenge, [LIBSKEY=-lskey],
+	AC_CHECK_LIB([md], [MD5Init], [LIBMD=-lmd])
+	AC_CHECK_LIB([skey], [skeychallenge], [LIBSKEY=-lskey],
 		[AC_MSG_ERROR([liskey missing. You can download S/Key source code from http://rsync1.it.gentoo.org/gentoo/distfiles/skey-1.1.5.tar.bz2])])
-	AC_DEFINE(SKEY, 1, [Define to support S/Key logins.])
+	AC_DEFINE([SKEY], [1], [Define to support S/Key logins.])
 	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 		#include <stdio.h>
 		#include <skey.h>
 	]], [[
 		skeychallenge((void*)0, (void*)0, (void*)0, 0);
-	]])],[AC_DEFINE(SKEY_BSD_STYLE, 1, [Define to support newer BSD S/Key API])],[])
+	]])], [AC_DEFINE([SKEY_BSD_STYLE], [1], [Define to support newer BSD S/Key API])], [])
 fi
 
 if test "$enable_utmpx" = "yes"; then
 	if test "$ac_cv_header_utmpx_h" != "yes"; then
 		AC_MSG_ERROR([The utmpx.h header file is required for utmpx support.])
 	fi
-	AC_DEFINE(USE_UTMPX,
-	          1,
-	          [Define if utmpx should be used])
+	AC_DEFINE([USE_UTMPX], [1],
+		  [Define if utmpx should be used])
 fi
 
-AC_DEFINE_UNQUOTED(SHELL, ["$SHELL"], [The default shell.])
+AC_DEFINE_UNQUOTED([SHELL], ["$SHELL"], [The default shell.])
 
-AM_GNU_GETTEXT_VERSION(0.16)
+AM_GNU_GETTEXT_VERSION([0.16])
 AM_GNU_GETTEXT([external], [need-ngettext])
-AM_CONDITIONAL(USE_NLS, test "x$USE_NLS" = "xyes")
+AM_CONDITIONAL([USE_NLS], [test "x$USE_NLS" = "xyes"])
 
 AC_CONFIG_FILES([
 	Makefile
@@ -671,22 +724,23 @@ AC_CONFIG_FILES([
 ])
 AC_OUTPUT
 
-echo
-echo "shadow will be compiled with the following features:"
-echo
-echo "	auditing support:		$with_audit"
-echo "	CrackLib support:		$with_libcrack"
-echo "	PAM support:			$with_libpam"
-if test "$with_libpam" = "yes"; then
-echo "	suid account management tools:	$enable_acct_tools_setuid"
-fi
-echo "	SELinux support:		$with_selinux"
-echo "	ACL support:			$with_acl"
-echo "	Extended Attributes support:	$with_attr"
-echo "	tcb support (incomplete):	$with_tcb"
-echo "	shadow group support:		$enable_shadowgrp"
-echo "	S/Key support:			$with_skey"
-echo "	SHA passwords encryption:	$with_sha_crypt"
-echo "	nscd support:			$with_nscd"
-echo "	subordinate IDs support:	$enable_subids"
-echo
+AC_MSG_RESULT([
+shadow will be compiled with the following features:
+
+	auditing support:		$with_audit
+	CrackLib support:		$with_libcrack
+	PAM support:			$with_libpam])
+AS_IF([test $with_libpam = yes], [AC_MSG_RESULT([\
+	suid account management tools:	$enable_acct_tools_setuid])])
+AC_MSG_RESULT([\
+	SELinux support:		$with_selinux
+	ACL support:			$with_acl
+	Extended Attributes support:	$with_attr
+	tcb support (incomplete):	$with_tcb
+	shadow group support:		$enable_shadowgrp
+	S/Key support:			$with_skey
+	SHA passwords encryption:	$with_sha_crypt
+	nscd support:			$with_nscd
+	subordinate IDs support:	$enable_subids
+
+])
diff --git a/libmisc/Makefile.am b/libmisc/Makefile.am
index 76f3c05..e0b6d8c 100644
--- a/libmisc/Makefile.am
+++ b/libmisc/Makefile.am
@@ -1,7 +1,7 @@
 
 EXTRA_DIST = .indent.pro xgetXXbyYY.c
 
-INCLUDES = -I$(top_srcdir)/lib
+AM_CPPFLAGS = -I$(top_srcdir)/lib
 
 noinst_LIBRARIES = libmisc.a
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 25e288d..8c078a9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -7,7 +7,7 @@ usbindir = ${prefix}/sbin
 suidperms = 4755
 sgidperms = 2755
 
-INCLUDES = \
+AM_CPPFLAGS = \
 	-I${top_srcdir}/lib \
 	-I$(top_srcdir)/libmisc
 
@@ -66,7 +66,7 @@ LDADD          = $(INTLLIBS) \
 		 $(LIBTCB) \
 		 $(top_builddir)/libmisc/libmisc.a \
 		 $(top_builddir)/lib/libshadow.la
-AM_CPPFLAGS    = -DLOCALEDIR=\"$(datadir)/locale\"
+AM_CPPFLAGS   += -DLOCALEDIR=\"$(datadir)/locale\"
 
 if ACCT_TOOLS_SETUID
 LIBPAM_SUID  = $(LIBPAM)
-- 
1.8.4




More information about the Pkg-shadow-devel mailing list