Ignore:
Timestamp:
Feb 7, 2008 1:11:39 PM (16 years ago)
Author:
bennylp
Message:

Ticket #470, #471, and #472: Compile error when semaphore.h is not present, Compilation error if pthread_mutexattr_set_type() is not present, and Problem with setting up FD_SETSIZE

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/include/pj/config.h

    r1748 r1783  
    486486 * aware of this constant, to make sure that the program will not break when 
    487487 * the underlying implementation changes. 
    488  * 
    489  * For implementation based on select(), the value here will be used as the 
    490  * maximum number of socket handles passed to select() (i.e. FD_SETSIZE will  
    491  * be set to this value). 
    492  * 
    493  * Default: if FD_SETSIZE is defined and the value is greather than 256, 
    494  *          then it will be used.  Otherwise 256 (64 for WinCE). 
    495488 */ 
    496489#ifndef PJ_IOQUEUE_MAX_HANDLES 
     
    539532 
    540533/** 
     534 * Determine if FD_SETSIZE is changeable/set-able. If so, then we will 
     535 * set it to PJ_IOQUEUE_MAX_HANDLES. 
     536 */ 
     537/* This is awful, as we should actually check for __GLIBC__ rather than 
     538 * __GNUC__. But alas! Libc headers are not included yet at this stage. 
     539 */ 
     540#ifdef __GNUC__ 
     541#   define PJ_FD_SETSIZE_SETABLE        0 
     542#else 
     543#   define PJ_FD_SETSIZE_SETABLE        1 
     544#endif 
     545 
     546/** 
    541547 * Overrides FD_SETSIZE so it is consistent throughout the library. 
    542  * OS specific configuration header (compat/os_*) might have declared 
    543  * FD_SETSIZE, thus we only set if it hasn't been declared. 
     548 * We only do this if we detected that FD_SETSIZE is changeable. 
    544549 * 
    545550 * Default: #PJ_IOQUEUE_MAX_HANDLES 
    546551 */ 
    547 #ifndef FD_SETSIZE 
    548 #  define FD_SETSIZE                PJ_IOQUEUE_MAX_HANDLES 
    549 #endif 
     552#if PJ_FD_SETSIZE_SETABLE 
     553    /* Only override FD_SETSIZE if the value has not been set */ 
     554#   ifndef FD_SETSIZE 
     555#       define FD_SETSIZE               PJ_IOQUEUE_MAX_HANDLES 
     556#   endif 
     557#else 
     558    /* When FD_SETSIZE is not changeable, check if PJ_IOQUEUE_MAX_HANDLES 
     559     * is lower than FD_SETSIZE value. 
     560     */ 
     561#   ifdef FD_SETSIZE 
     562#       if PJ_IOQUEUE_MAX_HANDLES > FD_SETSIZE 
     563#           error "PJ_IOQUEUE_MAX_HANDLES is greater than FD_SETSIZE" 
     564#       endif 
     565#   endif 
     566#endif 
     567 
    550568 
    551569/** 
Note: See TracChangeset for help on using the changeset viewer.