apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pque...@apache.org
Subject svn commit: r751531 - in /apr/apr/trunk: SConstruct build/aprconf.py build/aprenv.py
Date Sun, 08 Mar 2009 21:08:23 GMT
Author: pquerna
Date: Sun Mar  8 21:08:22 2009
New Revision: 751531

URL: http://svn.apache.org/viewvc?rev=751531&view=rev
Log:
Scons Updates.

* Add detection of IPv6
* Fix return code checking of TryRun's... Scons expects 1 as success (meh)
* Add ebcdic,  nonblock inherited check, tcp_nodelay, union semun,
  TCP_CORK/TCP_NOPUSH, getrlimit/setrlimit, in_addr, sockaddr_storage,
  rlimit struct, ... and more
* Add sctp check
* Add accept filter check

Submitted by: Ryan Phillips

Modified:
    apr/apr/trunk/SConstruct
    apr/apr/trunk/build/aprconf.py
    apr/apr/trunk/build/aprenv.py

Modified: apr/apr/trunk/SConstruct
URL: http://svn.apache.org/viewvc/apr/apr/trunk/SConstruct?rev=751531&r1=751530&r2=751531&view=diff
==============================================================================
--- apr/apr/trunk/SConstruct (original)
+++ apr/apr/trunk/SConstruct Sun Mar  8 21:08:22 2009
@@ -10,6 +10,7 @@
 vars.Add('maintainer_mode', 'Turn on debugging and compile time warnings', 0)
 vars.Add('profile', 'Turn on profiling for the build (GCC)', 0)
 vars.Add('lfs', 'Large file support on 32-bit platforms', 1)
+vars.Add('ipv6', 'IPv6 support', 1)
 vars.Add(EnumVariable('pool_debug', 'Turn on pools debugging', 'no',
                       allowed_values=('yes', 'no', 'verbose', 'verbose-alloc', 'lifetime',
'owner', 'all')))
 

Modified: apr/apr/trunk/build/aprconf.py
URL: http://svn.apache.org/viewvc/apr/apr/trunk/build/aprconf.py?rev=751531&r1=751530&r2=751531&view=diff
==============================================================================
--- apr/apr/trunk/build/aprconf.py (original)
+++ apr/apr/trunk/build/aprconf.py Sun Mar  8 21:08:22 2009
@@ -70,8 +70,118 @@
 }
     """
         result = context.TryRun(source, '.c')
+        context.Result(result[0] == 0)
+        return result[0] == 0
+
+    def Check_apr_ebcdic(self, context):
+        context.Message('Checking whether system uses EBCDIC.. ')
+        source = """
+int main(void) { 
+  return (unsigned char)'A' != (unsigned char)0xC1; 
+}"""
+        result = context.TryRun(source, '.c')
         context.Result(result[0])
         return result[0]
+        
+    def Check_apr_nonblock_inherited(self, context):
+        context.Message('Checking whether O_NONBLOCK setting is inherited from listening
sockets... ')
+        source = """
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#ifdef HAVE_NETINET_TCP_H
+#include <netinet/tcp.h>
+#endif
+#ifndef HAVE_SOCKLEN_T
+typedef int socklen_t;
+#endif
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+int main(void) {
+    int listen_s, connected_s, client_s;
+    int listen_port, rc;
+    struct sockaddr_in sa;
+    socklen_t sa_len;
+
+    listen_s = socket(AF_INET, SOCK_STREAM, 0);
+    if (listen_s < 0) {
+        perror("socket");
+        exit(1);
+    }
+    memset(&sa, 0, sizeof sa);
+    sa.sin_family = AF_INET;
+#ifdef BEOS
+    sa.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+#endif
+    /* leave port 0 to get ephemeral */
+    rc = bind(listen_s, (struct sockaddr *)&sa, sizeof sa);
+    if (rc < 0) {
+        perror("bind for ephemeral port");
+        exit(1);
+    }
+    /* find ephemeral port */
+    sa_len = sizeof(sa);
+    rc = getsockname(listen_s, (struct sockaddr *)&sa, &sa_len);
+    if (rc < 0) {
+        perror("getsockname");
+        exit(1);
+    }
+    listen_port = sa.sin_port;
+    rc = listen(listen_s, 5);
+    if (rc < 0) {
+        perror("listen");
+        exit(1);
+    }
+    rc = fcntl(listen_s, F_SETFL, O_NONBLOCK);
+    if (rc < 0) {
+        perror("fcntl(F_SETFL)");
+        exit(1);
+    }
+    client_s = socket(AF_INET, SOCK_STREAM, 0);
+    if (client_s < 0) {
+        perror("socket");
+        exit(1);
+    }
+    memset(&sa, 0, sizeof sa);
+    sa.sin_family = AF_INET;
+    sa.sin_port   = listen_port;
+#ifdef BEOS
+    sa.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+#endif
+    /* leave sin_addr all zeros to use loopback */
+    rc = connect(client_s, (struct sockaddr *)&sa, sizeof sa);
+    if (rc < 0) {
+        perror("connect");
+        exit(1);
+    }
+    sa_len = sizeof sa;
+    connected_s = accept(listen_s, (struct sockaddr *)&sa, &sa_len);
+    if (connected_s < 0) {
+        perror("accept");
+        exit(1);
+    }
+    rc = fcntl(connected_s, F_GETFL, 0);
+    if (rc < 0) {
+        perror("fcntl(F_GETFL)");
+        exit(1);
+    }
+    if (!(rc & O_NONBLOCK)) {
+        fprintf(stderr, "O_NONBLOCK is not set in the child.\n");
+        exit(1);
+    }
+    return 0;
+}"""
+        result = context.TryRun(source, '.c')
+        context.Result(result[0] == 0)
+        return result[0] == 0
 
     def Check_apr_largefile64(self, context):
         context.Message('Checking whether to enable -D_LARGEFILE64_SOURCE... ')
@@ -112,8 +222,8 @@
 }"""
         result = context.TryRun(source, '.c')
         self.env.Filter(CPPFLAGS = ['-D_LARGEFILE64_SOURCE'])
-        context.Result(result[0])
-        return result[0]
+        context.Result(result[0] == 0)
+        return result[0] == 0
 
 
     def Check_apr_mmap_mapping_dev_zero(self, context):
@@ -142,8 +252,8 @@
     }
         """
         result = context.TryRun(source, '.c')
-        context.Result(result[0])
-        return result[0]
+        context.Result(result[0] == 0)
+        return result[0] == 0
 
     def Check_apr_semaphores(self, context):
         context.Message('Checking for sem_open, sem_close, sem_unlink... ')
@@ -178,6 +288,113 @@
         context.Result(result)
         return result
 
+    def Check_apr_check_tcp_nodelay_inherited(self, context):
+        context.Message('Checking for tcp nodelay inherited... ')
+        source = """
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+int main(void) {
+    int listen_s, connected_s, client_s;
+    int listen_port, rc;
+    struct sockaddr_in sa;
+    socklen_t sa_len;
+    socklen_t option_len;
+    int option;
+
+    listen_s = socket(AF_INET, SOCK_STREAM, 0);
+    if (listen_s < 0) {
+        perror("socket");
+        exit(1);
+    }
+    option = 1;
+    rc = setsockopt(listen_s, IPPROTO_TCP, TCP_NODELAY, &option, sizeof option);
+    if (rc < 0) {
+        perror("setsockopt TCP_NODELAY");
+        exit(1);
+    }
+    memset(&sa, 0, sizeof sa);
+    sa.sin_family = AF_INET;
+#ifdef BEOS
+    sa.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+#endif
+    /* leave port 0 to get ephemeral */
+    rc = bind(listen_s, (struct sockaddr *)&sa, sizeof sa);
+    if (rc < 0) {
+        perror("bind for ephemeral port");
+        exit(1);
+    }
+    /* find ephemeral port */
+    sa_len = sizeof(sa);
+    rc = getsockname(listen_s, (struct sockaddr *)&sa, &sa_len);
+    if (rc < 0) {
+        perror("getsockname");
+        exit(1);
+    }
+    listen_port = sa.sin_port;
+    rc = listen(listen_s, 5);
+    if (rc < 0) {
+        perror("listen");
+        exit(1);
+    }
+    client_s = socket(AF_INET, SOCK_STREAM, 0);
+    if (client_s < 0) {
+        perror("socket");
+        exit(1);
+    }
+    memset(&sa, 0, sizeof sa);
+    sa.sin_family = AF_INET;
+    sa.sin_port   = listen_port;
+#ifdef BEOS
+    sa.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+#endif
+    /* leave sin_addr all zeros to use loopback */
+    rc = connect(client_s, (struct sockaddr *)&sa, sizeof sa);
+    if (rc < 0) {
+        perror("connect");
+        exit(1);
+    }
+    sa_len = sizeof sa;
+    connected_s = accept(listen_s, (struct sockaddr *)&sa, &sa_len);
+    if (connected_s < 0) {
+        perror("accept");
+        exit(1);
+    }
+    option_len = sizeof option;
+    rc = getsockopt(connected_s, IPPROTO_TCP, TCP_NODELAY, &option, &option_len);
+    if (rc < 0) {
+        perror("getsockopt");
+        exit(1);
+    }
+    if (!option) {
+        fprintf(stderr, "TCP_NODELAY is not set in the child.\n");
+        exit(1);
+    }
+    return 0;
+} """ 
+        result = context.TryRun(source, '.c') 
+        context.Result(result[0] == 0)
+        return result[0] == 0
+
+    def Check_apr_semun(self, context):
+        context.Message('Checking for semun... ')
+        source = """
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/sem.h>
+main()
+{
+    union semun arg;
+    semctl(0, 0, 0, arg);
+    exit(0);
+}
+        """
+        result = context.TryCompile(source, '.c')
+        context.Result(result)
+        return result
+
     def CheckFile(self, filename):
         return os.path.exists(filename)
 

Modified: apr/apr/trunk/build/aprenv.py
URL: http://svn.apache.org/viewvc/apr/apr/trunk/build/aprenv.py?rev=751531&r1=751530&r2=751531&view=diff
==============================================================================
--- apr/apr/trunk/build/aprenv.py (original)
+++ apr/apr/trunk/build/aprenv.py Sun Mar  8 21:08:22 2009
@@ -146,6 +146,14 @@
             self.autoconf.Check_apr_mmap_mapping_dev_zero,
         'Check_apr_semaphores':
             self.autoconf.Check_apr_semaphores,
+        'Check_apr_semun':
+            self.autoconf.Check_apr_semun,
+        'Check_apr_check_tcp_nodelay_inherited':
+            self.autoconf.Check_apr_check_tcp_nodelay_inherited,
+        'Check_apr_nonblock_inherited':
+            self.autoconf.Check_apr_nonblock_inherited,
+        'Check_apr_ebcdic':
+            self.autoconf.Check_apr_ebcdic,
         },
         config_h = 'include/arch/%s/apr_private.h' % (self['APR_PLATFORM']))
 
@@ -227,7 +235,6 @@
       else:
         subst['@%s@' % (s)] = 0
         
-
     sizeof_char = conf.CheckTypeSize('char')
     sizeof_int = self.critical_value(conf.CheckTypeSize, 4, 'int')
     subst['@int_value@'] = 'int'
@@ -416,25 +423,149 @@
     if mmap_results['mmap'] and \
        self.autoconf.CheckFile("/dev/zero") and \
        conf.Check_apr_mmap_mapping_dev_zero():
-           subst['@havemmapzero@'] = '1'
+           subst['@havemmapzero@'] = 1
     else:
-        subst['@havemmapzero@'] = '0'
+        subst['@havemmapzero@'] = 0
 
     # check for locking mechanisms
     if conf.Check_apr_semaphores():
-        subst['@hassysvser@'] = "1"
+        subst['@hassysvser@'] = 1
     else:
-        subst['@hassysvser@'] = "0"
+        subst['@hassysvser@'] = 0
 
     if conf.CheckDeclaration('F_SETLK', '#include <fcntl.h>'):
-        subst['@hasfcntlser@'] = '1'
+        subst['@hasfcntlser@'] = 1
     else:
-        subst['@hasfcntlser@'] = '0'
+        subst['@hasfcntlser@'] = 0
 
     if conf.CheckFunc('flock'):
-        subst['@hasflockser@'] = "1"
+        subst['@hasflockser@'] = 1
+    else:
+        subst['@hasflockser@'] = 0
+
+    apr_tcp_nopush_flag="0"
+    if conf.CheckDeclaration('TCP_CORK', '#include <netinet/tcp.h>'):
+        subst['@have_corkable_tcp@'] = 1
+        apr_tcp_nopush_flag="TCP_CORK"
+    else:
+        subst['@have_corkable_tcp@'] = 0
+
+    if conf.CheckDeclaration('TCP_NOPUSH', '#include <netinet/tcp.h>'):
+        subst['@apr_tcp_nopush_flag@'] = 3
+        subst['@have_corkable_tcp@'] = 1
+
+    subst['@apr_tcp_nopush_flag@'] = apr_tcp_nopush_flag
+
+    if conf.CheckFunc('flock'):
+        subst['@hasflockser@'] = 1
+    else:
+        subst['@hasflockser@'] = 0
+
+    if conf.CheckFunc('getrlimit'):
+        subst['@have_getrlimit@'] = 1
+    else:
+        subst['@have_getrlimit@'] = 0
+
+    if conf.CheckFunc('setrlimit'):
+        subst['@have_setrlimit@'] = 1
+    else:
+        subst['@have_setrlimit@'] = 0
+
+    if conf.CheckType('struct in_addr', includes='#include <netinet/in.h>'):
+        subst['@have_in_addr@'] = 1
+    else:
+        subst['@have_in_addr@'] = 0
+
+    if conf.CheckType('struct sockaddr_storage', includes='#include <netinet/in.h>'):
+        subst['@have_sa_storage@'] = 1
+    else:
+        subst['@have_sa_storage@'] = 0
+
+    if conf.CheckType('struct rlimit', includes='#include <sys/resource.h>'):
+        subst['@struct_rlimit@'] = 1
+    else:
+        subst['@struct_rlimit@'] = 0
+
+    if conf.Check_apr_semun():
+        subst['@have_union_semun@'] = 1
+    else:
+        subst['@have_union_semun@'] = 0
+
+    check_functions = [
+        'inet_addr',
+        'inet_network',
+        'memmove',
+        'sigaction',
+        'sigsuspend',
+        'sigwait',
+        'strdup',
+        'stricmp',
+        'strcasecmp',
+        'strncasecmp',
+        'strnicmp',
+        'strstr',
+        'memchr',
+        'iovec'
+    ]
+
+    for func in check_functions:
+        if conf.CheckFunc(func):
+            subst['@have_%s@' % func] = 1
+        else:
+            subst['@have_%s@' % func] = 0
+
+    # Set Features
+    # TODO: Not done yet
+    subst['@sharedmem@'] = 0
+    subst['@threads@'] = 0
+    subst['@sendfile@'] = 0
+    subst['@mmap@'] = 0
+    subst['@fork@'] = 0
+    subst['@rand@'] = 0
+    subst['@oc@'] = 0
+    subst['@aprdso@'] = 0
+    subst['@acceptfilter@'] = 0
+    subst['@have_unicode_fs@'] = 0
+    subst['@have_proc_invoked@'] = 0
+    subst['@aprlfs@'] = 0
+    subst['@osuuid@'] = 0
+    subst['@file_as_socket@'] = 1
+
+    # check for IPv6 (the user is allowed to disable this via commandline
+    # options
+    if self['ipv6']:
+        if conf.CheckType('struct sockaddr_in6', 
+                          includes='#include <netinet/in.h>') and \
+           conf.CheckFunc('getaddrinfo') and \
+           conf.CheckFunc('getnameinfo'):
+            subst['@have_ipv6@'] = 1
+    else:
+        subst['@have_ipv6@'] = 0
+
+    if conf.CheckDeclaration('IPPROTO_SCTP', '#include <netinet/in.h>'):
+        subst['@have_sctp@'] = 1
+    else:
+        subst['@have_sctp@'] = 0
+
+    if conf.CheckDeclaration('SO_ACCEPTFILTER', '#include <sys/socket.h>'):
+        subst['@acceptfilter@'] = 1
+    else:
+        subst['@acceptfilter@'] = 0
+
+    if conf.Check_apr_check_tcp_nodelay_inherited():
+        subst['@tcp_nodelay_inherited@'] = 1
+    else:
+        subst['@tcp_nodelay_inherited@'] = 0
+
+    if conf.Check_apr_nonblock_inherited():
+        subst['@o_nonblock_inherited@'] = 1
+    else:
+        subst['@o_nonblock_inherited@'] = 0
+
+    if conf.Check_apr_ebcdic():
+        subst['@apr_charset_ebcdic@'] = 1
     else:
-        subst['@hasflockser@'] = "0"
+        subst['@apr_charset_ebcdic@'] = 0
 
     self.SubstFile('include/apr.h', 'include/apr.h.in', SUBST_DICT = subst)
 



Mime
View raw message