From: Michael Poole Date: Wed, 5 Apr 2006 00:05:59 +0000 (+0000) Subject: Update configure.in; support both baz and tla; avoid using dirent. X-Git-Tag: v1.4.0-rc1~153 X-Git-Url: http://git.pk910.de/?p=srvx.git;a=commitdiff_plain;h=51982054ac8f75d5c0ff61a6086c0163118a51c4 Update configure.in; support both baz and tla; avoid using dirent. configure.in: Remove AC_PROG_RANLIB since we never use ranlib. Add AC_PROG_LIBTOOL since we do use libtool. Set GNU_ARCH and HAS_GNU_ARCH based on whether the system has baz or tla. Do not check for dirent.d_type. src/Makefile.am: Make the "checkversion" target conditional on HAS_GNU_ARCH, and use the detected $(GNU_ARCH). src/helpfile.c (language_read): Report error text when unable to open a language directory. (language_read_list): Always stat the language entry to determine whether it is a directory; Cygwin has no dirent.d_type and ReiserFS has a broken one. git-archimport-id: srvx@srvx.net--2006/srvx--devo--1.3--patch-3 --- diff --git a/ChangeLog b/ChangeLog index 4a5e591..555d770 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,31 @@ # arch-tag: automatic-ChangeLog--srvx@srvx.net--2006/srvx--devo--1.3 # +2006-04-05 00:05:59 GMT Michael Poole patch-3 + + Summary: + Update configure.in; support both baz and tla; avoid using dirent. + Revision: + srvx--devo--1.3--patch-3 + + configure.in: Remove AC_PROG_RANLIB since we never use ranlib. Add + AC_PROG_LIBTOOL since we do use libtool. Set GNU_ARCH and + HAS_GNU_ARCH based on whether the system has baz or tla. Do not + check for dirent.d_type. + + src/Makefile.am: Make the "checkversion" target conditional on + HAS_GNU_ARCH, and use the detected $(GNU_ARCH). + + src/helpfile.c (language_read): Report error text when unable to open a + language directory. + (language_read_list): Always stat the language entry to determine + whether it is a directory; Cygwin has no dirent.d_type and ReiserFS + has a broken one. + + modified files: + ChangeLog configure.in src/Makefile.am src/helpfile.c + + 2006-04-05 00:00:57 GMT Michael Poole patch-2 Summary: diff --git a/configure.in b/configure.in index 0769fb9..c1abe55 100644 --- a/configure.in +++ b/configure.in @@ -20,12 +20,16 @@ AC_C_INLINE dnl Checks for programs. AC_PROG_AWK AC_PROG_CC -AC_PROG_RANLIB AC_PROG_INSTALL +AC_PROG_LIBTOOL AC_PROG_LN_S AC_PROG_MAKE_SET AC_PROG_GCC_TRADITIONAL +dnl Look for a GNU Arch program +AC_CHECK_PROGS(GNU_ARCH, [baz tla]) +AM_CONDITIONAL(HAS_GNU_ARCH, test z$GNU_ARCH != z) + dnl nice that unixes can all follow a standard. case $target in *-freebsd2* | *-freebsdelf2* | *-freebsd*out3*) @@ -68,10 +72,6 @@ AC_STRUCT_TM dnl Would rather not bail on headers, BSD has alot of the functions elsewhere. -Jedi AC_CHECK_HEADERS(fcntl.h malloc.h netdb.h netinet/in.h sys/resource.h sys/timeb.h sys/times.h sys/param.h sys/socket.h sys/time.h sys/types.h sys/wait.h unistd.h getopt.h memory.h regex.h arpa/inet.h sys/mman.h sys/stat.h dirent.h,,) -dnl Cygwin does not have d_type in struct dirent. We use stat() as a fallback. -AC_CHECK_MEMBER([struct dirent.d_type], - [AC_DEFINE(HAVE_DIRENT_D_TYPE, 1, [Define if struct dirent exists and includes the d_type element.])],,[#include ]) - dnl portability stuff, hurray! -Jedi AC_CHECK_MEMBER([struct sockaddr.sa_len], [AC_DEFINE([HAVE_SOCKADDR_SA_LEN],,[Define if struct sockaddr has sa_len field])], diff --git a/src/Makefile.am b/src/Makefile.am index 2ac28aa..8cdf7bb 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -8,12 +8,13 @@ EXTRA_DIST = $(noinst_DATA) BUILT_SOURCES = arch-version.h noinst_HEADERS = arch-version.h +if HAS_GNU_ARCH .PHONY: checkversion arch-version.h: checkversion checkversion: - @tla logs -f >/dev/null || exit 0; \ + @$(GNU_ARCH) logs -f >/dev/null || exit 0; \ TMPFILE=`mktemp arch-version.h.XXXXXX` || exit 1 ; \ - echo "#define ARCH_VERSION \"`tla logs -f | tail -n 1`\"" >> $$TMPFILE ; \ + echo "#define ARCH_VERSION \"`$(GNU_ARCH) logs -f | tail -n 1`\"" >> $$TMPFILE ; \ if diff -q arch-version.h $$TMPFILE >/dev/null 2>&1 ; then \ rm $$TMPFILE ; \ else \ @@ -21,6 +22,7 @@ checkversion: rm -f arch-version.h ; \ mv $$TMPFILE arch-version.h ; \ fi +endif EXTRA_srvx_SOURCES = alloc-slab.c alloc-srvx.c proto-bahamut.c proto-common.c proto-p10.c mod-snoop.c mod-memoserv.c mod-helpserv.c mod-sockcheck.c srvx_LDADD = @MODULE_OBJS@ diff --git a/src/helpfile.c b/src/helpfile.c index 27fc614..38a61ec 100644 --- a/src/helpfile.c +++ b/src/helpfile.c @@ -171,8 +171,10 @@ static struct language *language_read(const char *name) /* Open the directory stream; if we can't, fail. */ snprintf(filename, sizeof(filename), "languages/%s", name); - if (!(dir = opendir(filename))) + if (!(dir = opendir(filename))) { + log_module(MAIN_LOG, LOG_ERROR, "Unable to open language directory languages/%s: %s", name, strerror(errno)); return NULL; + } if (!(lang = dict_find(languages, name, NULL))) lang = language_alloc(name); @@ -222,28 +224,25 @@ static struct language *language_read(const char *name) static void language_read_list(void) { + struct stat sbuf; struct dirent *dirent; DIR *dir; + char namebuf[MAXLEN]; if (!(dir = opendir("languages"))) return; while ((dirent = readdir(dir))) { if (dirent->d_name[0] == '.') continue; -#ifdef HAVE_DIRENT_D_TYPE - if (dirent->d_type != DT_DIR) + snprintf(namebuf, sizeof(namebuf), "languages/%s", dirent->d_name); + if (stat(namebuf, &sbuf) < 0) { + log_module(MAIN_LOG, LOG_INFO, "Skipping language entry '%s' (unable to stat).", dirent->d_name); + continue; + } + if (!S_ISDIR(sbuf.st_mode)) { + log_module(MAIN_LOG, LOG_INFO, "Skipping language entry '%s' (not directory).", dirent->d_name); continue; -#else - { - char namebuf[MAXLEN]; - struct stat sbuf; - snprintf(namebuf, sizeof(namebuf), "languages/%s", dirent->d_name); - if (stat(namebuf, &sbuf) < 0) - continue; - if (!S_ISDIR(sbuf.st_mode)) - continue; } -#endif language_alloc(dirent->d_name); } closedir(dir);