Update configure.in; support both baz and tla; avoid using dirent.
authorMichael Poole <mdpoole@troilus.org>
Wed, 5 Apr 2006 00:05:59 +0000 (00:05 +0000)
committerMichael Poole <mdpoole@troilus.org>
Wed, 5 Apr 2006 00:05:59 +0000 (00:05 +0000)
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

ChangeLog
configure.in
src/Makefile.am
src/helpfile.c

index 4a5e591bd49858448a6e4b6da0212b144b89eef6..555d770b298e10bdac846b747f4f78e10e318d5b 100644 (file)
--- 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 <mdpoole@troilus.org>     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 <mdpoole@troilus.org>     patch-2
 
     Summary:
index 0769fb9da56ff0d6f2c5f2a4e2fdaf2a912a45d8..c1abe5548248e6871e770f72ce306f4d19aacff2 100644 (file)
@@ -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 <dirent.h>])
-
 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])],
index 2ac28aad5190ecb42f14e4ec90689da836b8e704..8cdf7bb98c21ddaa2b198ec9cf032e6101d5d087 100644 (file)
@@ -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@
index 27fc614b16564b9c51acacd6b812c16d0745f135..38a61ec6877d03c8e511e4bba9ec2f26a9a4f632 100644 (file)
@@ -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);