Changeset 1975

Show
Ignore:
Timestamp:
08/12/2007 23:44:17 (3 years ago)
Author:
chris
Message:

Fix getopt reset for solaris and maybe other platforms. See
 http://lists.debian.org/debian-glibc/2004/10/msg00070.html.
(merges [1930] [1974] plus local change for Win32)

Location:
box/chris/general
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • box/chris/general/configure.ac

    r1678 r1975  
    4242AC_DEFINE_UNQUOTED([PERL_EXECUTABLE], ["$TARGET_PERL"],  
    4343        [Location of the perl executable]) 
     44 
     45AC_CHECK_PROGS([AR],     [ar],     
     46        [AC_MSG_ERROR([[cannot find ar executable]])]) 
     47AC_CHECK_PROGS([RANLIB], [ranlib], 
     48        [AC_MSG_ERROR([[cannot find ranlib executable]])]) 
    4449 
    4550### Checks for libraries. 
     
    138143AC_CHECK_TYPES([u_int8_t, u_int16_t, u_int32_t, u_int64_t]) 
    139144AC_CHECK_TYPES([uint8_t, uint16_t, uint32_t, uint64_t]) 
     145 
    140146AC_HEADER_STDBOOL 
    141147AC_C_CONST 
     
    147153AC_TYPE_PID_T 
    148154AC_TYPE_SIZE_T 
     155 
    149156AC_CHECK_MEMBERS([struct stat.st_flags]) 
    150157AC_CHECK_MEMBERS([struct stat.st_mtimespec]) 
     
    153160  #include <netinet/in.h> 
    154161  ]]) 
     162 
    155163AC_CHECK_DECLS([INFTIM],,, [[#include <poll.h>]]) 
    156164AC_CHECK_DECLS([SO_PEERCRED],,, [[#include <sys/socket.h>]]) 
    157165AC_CHECK_DECLS([O_BINARY],,,) 
     166 
     167AC_CHECK_DECLS([optreset],,, [[#include <getopt.h>]]) 
     168AC_CHECK_DECL([dirfd], 
     169        [], 
     170        AC_DEFINE([dirfd(x)], [(x)->d_fd], [dirfd() replacement for Solaris]), 
     171        [#include <getopt.h>]) 
     172 
    158173AC_HEADER_TIME 
    159174AC_STRUCT_TM 
  • box/chris/general/lib/server/Daemon.cpp

    r1855 r1975  
    277277        // unfortunately glibc and BSD differ on this point! 
    278278        // http://www.ussg.iu.edu/hypermail/linux/kernel/0305.3/0262.html 
    279         #ifdef __GLIBC__ 
    280                 optind = 0; 
    281         #else 
     279        #if HAVE_DECL_OPTRESET == 1 || defined WIN32 
    282280                optind = 1; 
    283281                optreset = 1; 
     282        #elif defined __GLIBC__ 
     283                optind = 0; 
     284        #else // Solaris, any others? 
     285                optind = 1; 
    284286        #endif 
    285287