aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunk@stsci.edu>2011-09-16 13:04:03 -0400
committerJoseph Hunkeler <jhunk@stsci.edu>2011-09-16 13:04:03 -0400
commit4af2842fc43143d76020b8cc3f4ece4a9922aa55 (patch)
tree9c6519a45cf7e2fd523a2c5baa95b4e0d531adc7
parentb5a75739bb208be9dadcf87beda8ccd33f73f2a1 (diff)
downloadduser-4af2842fc43143d76020b8cc3f4ece4a9922aa55.tar.gz
Instead of detecting the host type, you may use --enable-compat instead.
Enabling compat will build and link against a static library containing string functions not found in older version of glibc.
-rw-r--r--Makefile.am4
-rw-r--r--Makefile.in5
-rw-r--r--compat/Makefile.am2
-rw-r--r--compat/Makefile.in2
-rwxr-xr-xconfigure90
-rw-r--r--configure.in27
-rw-r--r--include/config.h.in3
-rw-r--r--src/Makefile.am10
-rw-r--r--src/Makefile.in6
9 files changed, 85 insertions, 64 deletions
diff --git a/Makefile.am b/Makefile.am
index 8f217a3..995c298 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1 +1,5 @@
+if HAVE_COMPAT
SUBDIRS = compat src
+else
+SUBDIRS = src
+endif
diff --git a/Makefile.in b/Makefile.in
index 6a74efa..a504d36 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -66,7 +66,7 @@ AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
distdir dist dist-all distcheck
ETAGS = etags
CTAGS = ctags
-DIST_SUBDIRS = $(SUBDIRS)
+DIST_SUBDIRS = src compat
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
@@ -219,7 +219,8 @@ target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-SUBDIRS = compat src
+@HAVE_COMPAT_FALSE@SUBDIRS = src
+@HAVE_COMPAT_TRUE@SUBDIRS = compat src
all: all-recursive
.SUFFIXES:
diff --git a/compat/Makefile.am b/compat/Makefile.am
index 88a2689..ddabced 100644
--- a/compat/Makefile.am
+++ b/compat/Makefile.am
@@ -1,6 +1,6 @@
noinst_LIBRARIES = libdusercompat.a
-AM_CPPFLAGS = -I$(top_srcdir)/include/compat
+AM_CFLAGS = -I$(top_srcdir)/include/compat
libdusercompat_a_SOURCES= strcasestr.c \
strchrnul.c
diff --git a/compat/Makefile.in b/compat/Makefile.in
index f54ed4e..d47ed4c 100644
--- a/compat/Makefile.in
+++ b/compat/Makefile.in
@@ -186,7 +186,7 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
noinst_LIBRARIES = libdusercompat.a
-AM_CPPFLAGS = -I$(top_srcdir)/include/compat
+AM_CFLAGS = -I$(top_srcdir)/include/compat
libdusercompat_a_SOURCES = strcasestr.c \
strchrnul.c
diff --git a/configure b/configure
index 302c69b..4e2e699 100755
--- a/configure
+++ b/configure
@@ -791,6 +791,8 @@ ac_subst_vars='am__EXEEXT_FALSE
am__EXEEXT_TRUE
LTLIBOBJS
CONFIGDIR
+HAVE_COMPAT_FALSE
+HAVE_COMPAT_TRUE
LIBOBJS
LIBTOOL_DEPS
CPP
@@ -911,8 +913,8 @@ with_pic
enable_fast_install
with_gnu_ld
enable_libtool_lock
+enable_compat
with_config_path
-enable_warnings
'
ac_precious_vars='build_alias
host_alias
@@ -1561,7 +1563,7 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
- --enable-warnings Enable all sorts of warnings for debugging.
+ --enable-compat Enables built-in glibc string functions
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -2685,9 +2687,12 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+ac_config_files="$ac_config_files Makefile compat/Makefile src/Makefile"
+
ac_config_headers="$ac_config_headers include/config.h"
+CFLAGS=""
# Checks for programs.
ac_ext=c
@@ -4812,13 +4817,13 @@ if test "${lt_cv_nm_interface+set}" = set; then
else
lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext
- (eval echo "\"\$as_me:4815: $ac_compile\"" >&5)
+ (eval echo "\"\$as_me:4820: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5
- (eval echo "\"\$as_me:4818: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval echo "\"\$as_me:4823: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5
- (eval echo "\"\$as_me:4821: output\"" >&5)
+ (eval echo "\"\$as_me:4826: output\"" >&5)
cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
@@ -6024,7 +6029,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 6027 "configure"' > conftest.$ac_ext
+ echo '#line 6032 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -7847,11 +7852,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:7850: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7855: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:7854: \$? = $ac_status" >&5
+ echo "$as_me:7859: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -8186,11 +8191,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:8189: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:8194: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:8193: \$? = $ac_status" >&5
+ echo "$as_me:8198: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -8291,11 +8296,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:8294: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:8299: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:8298: \$? = $ac_status" >&5
+ echo "$as_me:8303: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -8346,11 +8351,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:8349: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:8354: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:8353: \$? = $ac_status" >&5
+ echo "$as_me:8358: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -11149,7 +11154,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11152 "configure"
+#line 11157 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11245,7 +11250,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11248 "configure"
+#line 11253 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12115,18 +12120,29 @@ fi
done
-# Detect if the host operating system is SunOS/Solaris as it behaves slightly different
-# than GNU/Linux
-case "$host_os" in
- *sunos*|solaris*)
+# Check whether --enable-compat was given.
+if test "${enable_compat+set}" = set; then
+ enableval=$enable_compat; case "${enableval}" in
+ yes) compat=true ;;
+ no) compat=false ;;
+ *) { { $as_echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-compat" >&5
+$as_echo "$as_me: error: bad value ${enableval} for --enable-compat" >&2;}
+ { (exit 1); exit 1; }; } ;;
+ esac
+else
+ compat=false
+fi
+
+ if test x$compat = xtrue; then
+ HAVE_COMPAT_TRUE=
+ HAVE_COMPAT_FALSE='#'
+else
+ HAVE_COMPAT_TRUE='#'
+ HAVE_COMPAT_FALSE=
+fi
+
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SOLARIS 1
-_ACEOF
- ;;
- *)
-esac
# Figure out where everything goes in the filesystem
@@ -12145,15 +12161,6 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
-# Compiler Warnings Options
-# Check whether --enable-warnings was given.
-if test "${enable_warnings+set}" = set; then
- enableval=$enable_warnings; CFLAGS="$CFLAGS -Wcast-qual -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wredundant-decls -Wshadow -Wwrite-strings -W -Wno-unused"
-fi
-
-
-ac_config_files="$ac_config_files Makefile compat/Makefile src/Makefile"
-
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
@@ -12273,6 +12280,13 @@ $as_echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
+if test -z "${HAVE_COMPAT_TRUE}" && test -z "${HAVE_COMPAT_FALSE}"; then
+ { { $as_echo "$as_me:$LINENO: error: conditional \"HAVE_COMPAT\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+$as_echo "$as_me: error: conditional \"HAVE_COMPAT\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
: ${CONFIG_STATUS=./config.status}
ac_write_fail=0
@@ -13036,12 +13050,12 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
for ac_config_target in $ac_config_targets
do
case $ac_config_target in
- "include/config.h") CONFIG_HEADERS="$CONFIG_HEADERS include/config.h" ;;
- "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
- "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"compat/Makefile") CONFIG_FILES="$CONFIG_FILES compat/Makefile" ;;
"src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
+ "include/config.h") CONFIG_HEADERS="$CONFIG_HEADERS include/config.h" ;;
+ "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+ "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
*) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
diff --git a/configure.in b/configure.in
index bcf5ee2..033acf0 100644
--- a/configure.in
+++ b/configure.in
@@ -7,8 +7,10 @@ AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE(1.11.1)
+AC_CONFIG_FILES([Makefile compat/Makefile src/Makefile])
AC_CONFIG_HEADERS([include/config.h])
AC_CONFIG_SRCDIR([src/duser.c])
+CFLAGS=""
# Checks for programs.
AC_PROG_CC
@@ -35,14 +37,16 @@ AC_TYPE_SIZE_T
AC_FUNC_MALLOC
AC_CHECK_FUNCS([memset strcasecmp strdup strerror strncasecmp strstr])
-# Detect if the host operating system is SunOS/Solaris as it behaves slightly different
-# than GNU/Linux
-case "$host_os" in
- *sunos*|solaris*)
- AC_DEFINE([HAVE_SOLARIS], 1, [host operating system is solaris])
- ;;
- *)
-esac
+AC_ARG_ENABLE([compat],
+[ --enable-compat Enables built-in glibc string functions],
+ [case "${enableval}" in
+ yes) compat=true ;;
+ no) compat=false ;;
+ *) AC_MSG_ERROR([bad value ${enableval} for --enable-compat]) ;;
+ esac],[compat=false])
+ AM_CONDITIONAL([HAVE_COMPAT], [test x$compat = xtrue])
+
+
# Figure out where everything goes in the filesystem
AC_ARG_WITH(config-path,
@@ -53,9 +57,4 @@ AC_SUBST(CONFIGDIR)
AC_DEFINE_UNQUOTED([CFG_PATH], "$CFGPATH", [duser configuration path])
-# Compiler Warnings Options
-AC_ARG_ENABLE(warnings,
-AC_HELP_STRING([--enable-warnings],[Enable all sorts of warnings for debugging.]),
-[CFLAGS="$CFLAGS -Wcast-qual -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wredundant-decls -Wshadow -Wwrite-strings -W -Wno-unused"],[])
-
-AC_OUTPUT([Makefile compat/Makefile src/Makefile])
+AC_OUTPUT
diff --git a/include/config.h.in b/include/config.h.in
index 65ae69b..e9d8cb4 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -25,9 +25,6 @@
/* Define to 1 if you have the `memset' function. */
#undef HAVE_MEMSET
-/* host operating system is solaris */
-#undef HAVE_SOLARIS
-
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
diff --git a/src/Makefile.am b/src/Makefile.am
index db132b6..7605342 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,8 +1,12 @@
sbin_PROGRAMS= duser
+duser_POSIX=-D__USE_POSIX
+AM_CFLAGS=${duser_POSIX} --std=c99 -O2 -pedantic -Wall -Wextra
+if HAVE_COMPAT
+duser_LDFLAGS=-L$(top_srcdir)/compat -ldusercompat
+else
+duser_LDFLAGS=
+endif
-AM_CPPFLAGS= -I$(top_srcdir)/include
-
-duser_LDFLAGS= -L$(top_srcdir)/compat
duser_SOURCES= duser.c \
user.c \
util.c \
diff --git a/src/Makefile.in b/src/Makefile.in
index 7f1b5d6..1ab745e 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -189,8 +189,10 @@ target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-AM_CPPFLAGS = -I$(top_srcdir)/include
-duser_LDFLAGS = -L$(top_srcdir)/compat
+duser_POSIX = -D__USE_POSIX
+AM_CFLAGS = ${duser_POSIX} --std=c99 -O2 -pedantic -Wall -Wextra
+@HAVE_COMPAT_FALSE@duser_LDFLAGS =
+@HAVE_COMPAT_TRUE@duser_LDFLAGS = -L$(top_srcdir)/compat -ldusercompat
duser_SOURCES = duser.c \
user.c \
util.c \