diff options
| author | hmeland | 1999-05-23 10:29:01 +0000 |
|---|---|---|
| committer | hmeland | 1999-05-23 10:29:01 +0000 |
| commit | 0ff91239775d3126e730690f87a05c0353b33684 (patch) | |
| tree | 7dd8b83da4d10f4296681fcf1f4a1e582e431a83 | |
| parent | 4f941e48519edca8dba1e67ef9bab63028f430ed (diff) | |
| download | mailman-0ff91239775d3126e730690f87a05c0353b33684.tar.gz mailman-0ff91239775d3126e730690f87a05c0353b33684.tar.zst mailman-0ff91239775d3126e730690f87a05c0353b33684.zip | |
Stole GNU sh-utils-1.16 configure.in code to check for syslog()
outside of the default libs.
Ran autoconf (from autoconf-2.13) to update configure.
src/common.[ch] now has #ifdefs around syslog-using code -- thus,
Mailman will compile, but _without any syslog calls_ if configure
couldn't find syslog().
| -rwxr-xr-x | configure | 118 | ||||
| -rw-r--r-- | configure.in | 12 | ||||
| -rw-r--r-- | src/common.c | 2 | ||||
| -rw-r--r-- | src/common.h | 4 |
4 files changed, 70 insertions, 66 deletions
@@ -1,6 +1,6 @@ #! /bin/sh -# From configure.in Revision: 1.30 +# From configure.in Revision: 1.31 # Guess values for system-dependent variables and create Makefiles. # Generated automatically using autoconf version 2.13 @@ -1359,7 +1359,7 @@ echo "$ac_t""$URL" 1>&6 rm -f conftest.out conftest.py # Checks for libraries. -for ac_func in strerror +for ac_func in strerror setregid syslog do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:1366: checking for $ac_func" >&5 @@ -1414,65 +1414,59 @@ else fi done -for ac_func in setregid -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1421: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then +if test $ac_cv_func_syslog = no; then + # syslog is not in the default libraries. See if it's in some other. + for lib in bsd socket inet; do + echo $ac_n "checking for syslog in -l$lib""... $ac_c" 1>&6 +echo "configure:1422: checking for syslog in -l$lib" >&5 +ac_lib_var=`echo $lib'_'syslog | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - cat > conftest.$ac_ext <<EOF -#line 1426 "configure" + ac_save_LIBS="$LIBS" +LIBS="-l$lib $LIBS" +cat > conftest.$ac_ext <<EOF +#line 1430 "configure" #include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include <assert.h> /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char $ac_func(); +char syslog(); int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif - +syslog() ; return 0; } EOF -if { (eval echo configure:1449: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1441: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" + eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - eval "ac_cv_func_$ac_func=no" + eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* -fi +LIBS="$ac_save_LIBS" -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 + cat >> confdefs.h <<\EOF +#define HAVE_SYSLOG 1 EOF - + + LIBS="$LIBS -l$lib"; break else echo "$ac_t""no" 1>&6 fi -done + done +fi # Checks for header files. echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1476: checking how to run the C preprocessor" >&5 +echo "configure:1470: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1487,13 +1481,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 1491 "configure" +#line 1485 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1497: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1491: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1504,13 +1498,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 1508 "configure" +#line 1502 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1514: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1508: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1521,13 +1515,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext <<EOF -#line 1525 "configure" +#line 1519 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1531: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1525: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1552,12 +1546,12 @@ fi echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1556: checking for ANSI C header files" >&5 +echo "configure:1550: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1561 "configure" +#line 1555 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -1565,7 +1559,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1569: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1563: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1582,7 +1576,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 1586 "configure" +#line 1580 "configure" #include "confdefs.h" #include <string.h> EOF @@ -1600,7 +1594,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 1604 "configure" +#line 1598 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -1621,7 +1615,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 1625 "configure" +#line 1619 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1632,7 +1626,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1636: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1630: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1659,17 +1653,17 @@ for ac_hdr in syslog.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1663: checking for $ac_hdr" >&5 +echo "configure:1657: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1668 "configure" +#line 1662 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1673: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1667: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1698,12 +1692,12 @@ done # Checks for typedefs, structures, and compiler characteristics. echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:1702: checking for uid_t in sys/types.h" >&5 +echo "configure:1696: checking for uid_t in sys/types.h" >&5 if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1707 "configure" +#line 1701 "configure" #include "confdefs.h" #include <sys/types.h> EOF @@ -1732,7 +1726,7 @@ EOF fi echo $ac_n "checking type of array argument to getgroups""... $ac_c" 1>&6 -echo "configure:1736: checking type of array argument to getgroups" >&5 +echo "configure:1730: checking type of array argument to getgroups" >&5 if eval "test \"`echo '$''{'ac_cv_type_getgroups'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1740,7 +1734,7 @@ else ac_cv_type_getgroups=cross else cat > conftest.$ac_ext <<EOF -#line 1744 "configure" +#line 1738 "configure" #include "confdefs.h" /* Thanks to Mike Rendell for this test. */ @@ -1765,7 +1759,7 @@ main() } EOF -if { (eval echo configure:1769: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1763: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_type_getgroups=gid_t else @@ -1779,7 +1773,7 @@ fi if test $ac_cv_type_getgroups = cross; then cat > conftest.$ac_ext <<EOF -#line 1783 "configure" +#line 1777 "configure" #include "confdefs.h" #include <unistd.h> EOF @@ -1805,12 +1799,12 @@ EOF # Checks for library functions. echo $ac_n "checking for vprintf""... $ac_c" 1>&6 -echo "configure:1809: checking for vprintf" >&5 +echo "configure:1803: checking for vprintf" >&5 if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1814 "configure" +#line 1808 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char vprintf(); below. */ @@ -1833,7 +1827,7 @@ vprintf(); ; return 0; } EOF -if { (eval echo configure:1837: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1831: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_vprintf=yes" else @@ -1857,12 +1851,12 @@ fi if test "$ac_cv_func_vprintf" != yes; then echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 -echo "configure:1861: checking for _doprnt" >&5 +echo "configure:1855: checking for _doprnt" >&5 if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1866 "configure" +#line 1860 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char _doprnt(); below. */ @@ -1885,7 +1879,7 @@ _doprnt(); ; return 0; } EOF -if { (eval echo configure:1889: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1883: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func__doprnt=yes" else diff --git a/configure.in b/configure.in index e92ae991c..c222a1b8c 100644 --- a/configure.in +++ b/configure.in @@ -15,7 +15,7 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. dnl Process this file with autoconf to produce a configure script. -AC_REVISION($Revision: 1467 $) +AC_REVISION($Revision: 1651 $) AC_PREREQ(2.0) AC_INIT(src/alias-wrapper.c) @@ -357,8 +357,14 @@ AC_MSG_RESULT($URL) rm -f conftest.out conftest.py # Checks for libraries. -AC_CHECK_FUNCS(strerror) -AC_CHECK_FUNCS(setregid) +AC_CHECK_FUNCS(strerror setregid syslog) +if test $ac_cv_func_syslog = no; then + # syslog is not in the default libraries. See if it's in some other. + for lib in bsd socket inet; do + AC_CHECK_LIB($lib, syslog, [AC_DEFINE(HAVE_SYSLOG) + LIBS="$LIBS -l$lib"; break]) + done +fi # Checks for header files. AC_HEADER_STDC diff --git a/src/common.c b/src/common.c index ec054219e..cddefb915 100644 --- a/src/common.c +++ b/src/common.c @@ -65,12 +65,14 @@ fatal(const char* ident, int exitcode, const char* format, ...) vsprintf(log_entry, format, arg_ptr); va_end(arg_ptr); +#ifdef HAVE_SYSLOG /* Write to the console, maillog is often mostly ignored, and root * should definitely know about any problems. */ openlog(ident, LOG_CONS, LOG_MAIL); syslog(LOG_ERR, "%s", log_entry); closelog(); +#endif /* HAVE_SYSLOG */ #ifdef HELPFUL /* If we're running as a CGI script, we also want to write the log diff --git a/src/common.h b/src/common.h index c963032f2..0db351754 100644 --- a/src/common.h +++ b/src/common.h @@ -19,7 +19,9 @@ #include <stdlib.h> #include <stdarg.h> +#ifdef HAVE_SYSLOG_H #include <syslog.h> +#endif /* HAVE_SYSLOG_H */ #include <stdio.h> #include <string.h> #include <errno.h> @@ -45,7 +47,7 @@ extern const char* logident; #define EXECVE_FAILURE 4 #define MAIL_USAGE_ERROR 5 #define MAIL_ILLEGAL_COMMAND 6 - +#define ADDALIAS_USAGE_ERROR 7 /* |
