From ef3b0ff8f11db1e1dddb3047dee8e2a313247395 Mon Sep 17 00:00:00 2001 From: Alan Brault Date: Mon, 2 May 2011 14:49:17 -0400 Subject: Move CFG_PATH out of duser.h and put into configure via --with-config-path --- Makefile.in | 1 + config.h.in | 3 ++ configure | 116 +++++++++++++++++++++++++++++++++++++++++++++++--------- configure.in | 27 +++++++------ include/duser.h | 1 - src/Makefile.in | 1 + 6 files changed, 118 insertions(+), 31 deletions(-) diff --git a/Makefile.in b/Makefile.in index bb846af..e99b3ee 100644 --- a/Makefile.in +++ b/Makefile.in @@ -111,6 +111,7 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CONFIGDIR = @CONFIGDIR@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ diff --git a/config.h.in b/config.h.in index afd6329..7533f1a 100644 --- a/config.h.in +++ b/config.h.in @@ -1,5 +1,8 @@ /* config.h.in. Generated from configure.in by autoheader. */ +/* duser configuration path */ +#undef CFG_PATH + /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H diff --git a/configure b/configure index 5879ab0..d3dfa6c 100755 --- a/configure +++ b/configure @@ -600,7 +600,8 @@ PACKAGE_VERSION='1.0.0' PACKAGE_STRING='duser 1.0.0' PACKAGE_BUGREPORT='jhunkeler@stsci.edu' -ac_unique_file="config.h.in" +ac_unique_file="src/duser.c" +ac_header_list= # Factoring default headers for most tests. ac_includes_default="\ #include @@ -637,9 +638,11 @@ ac_includes_default="\ # include #endif" +ac_func_list= ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS +CONFIGDIR LIBOBJS EGREP GREP @@ -736,6 +739,7 @@ ac_subst_files='' ac_user_opts=' enable_option_checking enable_dependency_tracking +with_config_path ' ac_precious_vars='build_alias host_alias @@ -1380,6 +1384,13 @@ Optional Features: --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-config-path= + specify the path for duser config files (default: + /usr/local/etc/duser) + Some influential environment variables: CC C compiler command CFLAGS C compiler flags @@ -1747,6 +1758,17 @@ $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi +ac_header_list="$ac_header_list fcntl.h" +ac_header_list="$ac_header_list limits.h" +ac_header_list="$ac_header_list stdlib.h" +ac_header_list="$ac_header_list string.h" +ac_header_list="$ac_header_list unistd.h" +ac_func_list="$ac_func_list memset" +ac_func_list="$ac_func_list strcasecmp" +ac_func_list="$ac_func_list strdup" +ac_func_list="$ac_func_list strerror" +ac_func_list="$ac_func_list strncasecmp" +ac_func_list="$ac_func_list strstr" # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false @@ -2487,10 +2509,10 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' - ac_config_headers="$ac_config_headers config.h" + # Checks for programs. ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -4470,8 +4492,7 @@ done - -for ac_header in fcntl.h limits.h stdlib.h string.h unistd.h +for ac_header in $ac_header_list do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then @@ -4622,6 +4643,30 @@ fi done + + + + + + + + + + + + + + + + + + + + + + + + # Checks for typedefs, structures, and compiler characteristics. { $as_echo "$as_me:$LINENO: checking for size_t" >&5 $as_echo_n "checking for size_t... " >&6; } @@ -4977,9 +5022,7 @@ fi - - -for ac_func in memset strcasecmp strdup strerror strncasecmp strstr +for ac_func in $ac_func_list do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -5080,27 +5123,64 @@ fi done -# Set compiler options based on platform. + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# Checks for currently used operating system. case "$host_os" in *linux*) - echo "===========================================================" - echo "Setting up build environment for ${target_cpu}${target_os}" - echo "===========================================================" CFLAGS="-O2 -Wall -Wextra -I../include" ;; *solaris*) - echo "===========================================================" - echo "Setting up build environment for ${target_cpu}${target_os}" - echo "===========================================================" - CFLAGS="-O2 -Wall -D_NLINUX_" + CFLAGS="-O2 -Wall -D_NLINUX_ -I../include" ;; *) - { { $as_echo "$as_me:$LINENO: error: duser does not currently support your platform" >&5 -$as_echo "$as_me: error: duser does not currently support your platform" >&2;} - { (exit 1); exit 1; }; } + CFLAGS="-O2 -Wall -Wextra -I../include" ;; esac +# Figure out where everything goes in the filesystem + +# Check whether --with-config-path was given. +if test "${with_config_path+set}" = set; then + withval=$with_config_path; CFGPATH="$withval" +else + CFGPATH="/usr/local/etc/duser" +fi + + + + +cat >>confdefs.h <<_ACEOF +#define CFG_PATH "$CFGPATH" +_ACEOF + + ac_config_files="$ac_config_files Makefile src/Makefile" cat >confcache <<\_ACEOF diff --git a/configure.in b/configure.in index 300a44b..7a97a17 100644 --- a/configure.in +++ b/configure.in @@ -7,8 +7,8 @@ AC_CANONICAL_TARGET AM_INIT_AUTOMAKE(1.11.1) -AC_CONFIG_SRCDIR([config.h.in]) AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_SRCDIR([src/duser.c]) # Checks for programs. AC_PROG_CC @@ -18,32 +18,35 @@ AC_PROG_INSTALL # Checks for libraries. # Checks for header files. -AC_CHECK_HEADERS([fcntl.h limits.h stdlib.h string.h unistd.h]) +AC_CHECK_HEADERS_ONCE([fcntl.h limits.h stdlib.h string.h unistd.h]) # Checks for typedefs, structures, and compiler characteristics. AC_TYPE_SIZE_T # Checks for library functions. AC_FUNC_MALLOC -AC_CHECK_FUNCS([memset strcasecmp strdup strerror strncasecmp strstr]) +AC_CHECK_FUNCS_ONCE([memset strcasecmp strdup strerror strncasecmp strstr]) -# Set compiler options based on platform. +# Checks for currently used operating system. case "$host_os" in *linux*) - echo "===========================================================" - echo "Setting up build environment for ${target_cpu}${target_os}" - echo "===========================================================" CFLAGS="-O2 -Wall -Wextra -I../include" ;; *solaris*) - echo "===========================================================" - echo "Setting up build environment for ${target_cpu}${target_os}" - echo "===========================================================" - CFLAGS="-O2 -Wall -D_NLINUX_" + CFLAGS="-O2 -Wall -D_NLINUX_ -I../include" ;; *) - AC_MSG_ERROR([duser does not currently support your platform]) + CFLAGS="-O2 -Wall -Wextra -I../include" ;; esac +# Figure out where everything goes in the filesystem +AC_ARG_WITH(config-path, + AC_HELP_STRING([--with-config-path=], + [specify the path for duser config files (default: /usr/local/etc/duser)]), + [CFGPATH="$withval"], [CFGPATH="/usr/local/etc/duser"]) +AC_SUBST(CONFIGDIR) + +AC_DEFINE_UNQUOTED([CFG_PATH], "$CFGPATH", [duser configuration path]) + AC_OUTPUT([Makefile src/Makefile]) diff --git a/include/duser.h b/include/duser.h index 2101e4b..c70eda5 100644 --- a/include/duser.h +++ b/include/duser.h @@ -23,7 +23,6 @@ #include #define REGEX_MAX 255 -#define CFG_PATH "/usr/local/etc/duser" #define SELF __FUNCTION__ #ifndef _NLINUX_ # define FMTLIST "%20s\t%5d%23s\n" diff --git a/src/Makefile.in b/src/Makefile.in index 498c72f..6dc339b 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -74,6 +74,7 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CONFIGDIR = @CONFIGDIR@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ -- cgit