Changeset 1783 for pjproject/trunk


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

Location:
pjproject/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/aconfigure

    r1738 r1783  
    11#! /bin/sh 
    22# Guess values for system-dependent variables and create Makefiles. 
    3 # Generated by GNU Autoconf 2.61 for pjproject 0.7. 
     3# Generated by GNU Autoconf 2.61 for pjproject 0.8. 
    44# 
    55# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 
     
    573573PACKAGE_NAME='pjproject' 
    574574PACKAGE_TARNAME='pjproject' 
    575 PACKAGE_VERSION='0.7' 
    576 PACKAGE_STRING='pjproject 0.7' 
     575PACKAGE_VERSION='0.8' 
     576PACKAGE_STRING='pjproject 0.8' 
    577577PACKAGE_BUGREPORT='' 
    578578 
     
    12131213  # This message is too long to be a string in the A/UX 3.1 sh. 
    12141214  cat <<_ACEOF 
    1215 \`configure' configures pjproject 0.7 to adapt to many kinds of systems. 
     1215\`configure' configures pjproject 0.8 to adapt to many kinds of systems. 
    12161216 
    12171217Usage: $0 [OPTION]... [VAR=VALUE]... 
     
    12791279if test -n "$ac_init_help"; then 
    12801280  case $ac_init_help in 
    1281      short | recursive ) echo "Configuration of pjproject 0.7:";; 
     1281     short | recursive ) echo "Configuration of pjproject 0.8:";; 
    12821282   esac 
    12831283  cat <<\_ACEOF 
     
    13771377if $ac_init_version; then 
    13781378  cat <<\_ACEOF 
    1379 pjproject configure 0.7 
     1379pjproject configure 0.8 
    13801380generated by GNU Autoconf 2.61 
    13811381 
     
    13911391running configure, to aid debugging if configure makes a mistake. 
    13921392 
    1393 It was created by pjproject $as_me 0.7, which was 
     1393It was created by pjproject $as_me 0.8, which was 
    13941394generated by GNU Autoconf 2.61.  Invocation command line was 
    13951395 
     
    65746574 
    65756575 
     6576if test "${ac_cv_header_semaphore_h+set}" = set; then 
     6577  { echo "$as_me:$LINENO: checking for semaphore.h" >&5 
     6578echo $ECHO_N "checking for semaphore.h... $ECHO_C" >&6; } 
     6579if test "${ac_cv_header_semaphore_h+set}" = set; then 
     6580  echo $ECHO_N "(cached) $ECHO_C" >&6 
     6581fi 
     6582{ echo "$as_me:$LINENO: result: $ac_cv_header_semaphore_h" >&5 
     6583echo "${ECHO_T}$ac_cv_header_semaphore_h" >&6; } 
     6584else 
     6585  # Is the header compilable? 
     6586{ echo "$as_me:$LINENO: checking semaphore.h usability" >&5 
     6587echo $ECHO_N "checking semaphore.h usability... $ECHO_C" >&6; } 
     6588cat >conftest.$ac_ext <<_ACEOF 
     6589/* confdefs.h.  */ 
     6590_ACEOF 
     6591cat confdefs.h >>conftest.$ac_ext 
     6592cat >>conftest.$ac_ext <<_ACEOF 
     6593/* end confdefs.h.  */ 
     6594$ac_includes_default 
     6595#include <semaphore.h> 
     6596_ACEOF 
     6597rm -f conftest.$ac_objext 
     6598if { (ac_try="$ac_compile" 
     6599case "(($ac_try" in 
     6600  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 
     6601  *) ac_try_echo=$ac_try;; 
     6602esac 
     6603eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 
     6604  (eval "$ac_compile") 2>conftest.er1 
     6605  ac_status=$? 
     6606  grep -v '^ *+' conftest.er1 >conftest.err 
     6607  rm -f conftest.er1 
     6608  cat conftest.err >&5 
     6609  echo "$as_me:$LINENO: \$? = $ac_status" >&5 
     6610  (exit $ac_status); } && { 
     6611         test -z "$ac_c_werror_flag" || 
     6612         test ! -s conftest.err 
     6613       } && test -s conftest.$ac_objext; then 
     6614  ac_header_compiler=yes 
     6615else 
     6616  echo "$as_me: failed program was:" >&5 
     6617sed 's/^/| /' conftest.$ac_ext >&5 
     6618 
     6619        ac_header_compiler=no 
     6620fi 
     6621 
     6622rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 
     6623{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 
     6624echo "${ECHO_T}$ac_header_compiler" >&6; } 
     6625 
     6626# Is the header present? 
     6627{ echo "$as_me:$LINENO: checking semaphore.h presence" >&5 
     6628echo $ECHO_N "checking semaphore.h presence... $ECHO_C" >&6; } 
     6629cat >conftest.$ac_ext <<_ACEOF 
     6630/* confdefs.h.  */ 
     6631_ACEOF 
     6632cat confdefs.h >>conftest.$ac_ext 
     6633cat >>conftest.$ac_ext <<_ACEOF 
     6634/* end confdefs.h.  */ 
     6635#include <semaphore.h> 
     6636_ACEOF 
     6637if { (ac_try="$ac_cpp conftest.$ac_ext" 
     6638case "(($ac_try" in 
     6639  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 
     6640  *) ac_try_echo=$ac_try;; 
     6641esac 
     6642eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 
     6643  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 
     6644  ac_status=$? 
     6645  grep -v '^ *+' conftest.er1 >conftest.err 
     6646  rm -f conftest.er1 
     6647  cat conftest.err >&5 
     6648  echo "$as_me:$LINENO: \$? = $ac_status" >&5 
     6649  (exit $ac_status); } >/dev/null && { 
     6650         test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || 
     6651         test ! -s conftest.err 
     6652       }; then 
     6653  ac_header_preproc=yes 
     6654else 
     6655  echo "$as_me: failed program was:" >&5 
     6656sed 's/^/| /' conftest.$ac_ext >&5 
     6657 
     6658  ac_header_preproc=no 
     6659fi 
     6660 
     6661rm -f conftest.err conftest.$ac_ext 
     6662{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 
     6663echo "${ECHO_T}$ac_header_preproc" >&6; } 
     6664 
     6665# So?  What about this header? 
     6666case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in 
     6667  yes:no: ) 
     6668    { echo "$as_me:$LINENO: WARNING: semaphore.h: accepted by the compiler, rejected by the preprocessor!" >&5 
     6669echo "$as_me: WARNING: semaphore.h: accepted by the compiler, rejected by the preprocessor!" >&2;} 
     6670    { echo "$as_me:$LINENO: WARNING: semaphore.h: proceeding with the compiler's result" >&5 
     6671echo "$as_me: WARNING: semaphore.h: proceeding with the compiler's result" >&2;} 
     6672    ac_header_preproc=yes 
     6673    ;; 
     6674  no:yes:* ) 
     6675    { echo "$as_me:$LINENO: WARNING: semaphore.h: present but cannot be compiled" >&5 
     6676echo "$as_me: WARNING: semaphore.h: present but cannot be compiled" >&2;} 
     6677    { echo "$as_me:$LINENO: WARNING: semaphore.h:     check for missing prerequisite headers?" >&5 
     6678echo "$as_me: WARNING: semaphore.h:     check for missing prerequisite headers?" >&2;} 
     6679    { echo "$as_me:$LINENO: WARNING: semaphore.h: see the Autoconf documentation" >&5 
     6680echo "$as_me: WARNING: semaphore.h: see the Autoconf documentation" >&2;} 
     6681    { echo "$as_me:$LINENO: WARNING: semaphore.h:     section \"Present But Cannot Be Compiled\"" >&5 
     6682echo "$as_me: WARNING: semaphore.h:     section \"Present But Cannot Be Compiled\"" >&2;} 
     6683    { echo "$as_me:$LINENO: WARNING: semaphore.h: proceeding with the preprocessor's result" >&5 
     6684echo "$as_me: WARNING: semaphore.h: proceeding with the preprocessor's result" >&2;} 
     6685    { echo "$as_me:$LINENO: WARNING: semaphore.h: in the future, the compiler will take precedence" >&5 
     6686echo "$as_me: WARNING: semaphore.h: in the future, the compiler will take precedence" >&2;} 
     6687 
     6688    ;; 
     6689esac 
     6690{ echo "$as_me:$LINENO: checking for semaphore.h" >&5 
     6691echo $ECHO_N "checking for semaphore.h... $ECHO_C" >&6; } 
     6692if test "${ac_cv_header_semaphore_h+set}" = set; then 
     6693  echo $ECHO_N "(cached) $ECHO_C" >&6 
     6694else 
     6695  ac_cv_header_semaphore_h=$ac_header_preproc 
     6696fi 
     6697{ echo "$as_me:$LINENO: result: $ac_cv_header_semaphore_h" >&5 
     6698echo "${ECHO_T}$ac_cv_header_semaphore_h" >&6; } 
     6699 
     6700fi 
     6701if test $ac_cv_header_semaphore_h = yes; then 
     6702  cat >>confdefs.h <<\_ACEOF 
     6703#define PJ_HAS_SEMAPHORE_H 1 
     6704_ACEOF 
     6705 
     6706fi 
     6707 
     6708 
    65766709if test "${ac_cv_header_setjmp_h+set}" = set; then 
    65776710  { echo "$as_me:$LINENO: checking for setjmp.h" >&5 
     
    95569689_ACEOF 
    95579690 
     9691                   ac_rwmutex="yes" 
    95589692                   { echo "$as_me:$LINENO: result: yes" >&5 
    95599693echo "${ECHO_T}yes" >&6; } 
     
    95669700_ACEOF 
    95679701 
     9702                   ac_rwmutex="no" 
    95689703                   { echo "$as_me:$LINENO: result: no" >&5 
     9704echo "${ECHO_T}no" >&6; } 
     9705fi 
     9706 
     9707rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 
     9708 
     9709if test "$ac_rwmutex" = "no"; then 
     9710    { echo "$as_me:$LINENO: checking if pthread_rwlock_t is available with _POSIX_READER_WRITER_LOCKS" >&5 
     9711echo $ECHO_N "checking if pthread_rwlock_t is available with _POSIX_READER_WRITER_LOCKS... $ECHO_C" >&6; } 
     9712    cat >conftest.$ac_ext <<_ACEOF 
     9713/* confdefs.h.  */ 
     9714_ACEOF 
     9715cat confdefs.h >>conftest.$ac_ext 
     9716cat >>conftest.$ac_ext <<_ACEOF 
     9717/* end confdefs.h.  */ 
     9718#define _POSIX_READER_WRITER_LOCKS 
     9719                                         #include <pthread.h> 
     9720int 
     9721main () 
     9722{ 
     9723pthread_rwlock_t *x; 
     9724  ; 
     9725  return 0; 
     9726} 
     9727_ACEOF 
     9728rm -f conftest.$ac_objext 
     9729if { (ac_try="$ac_compile" 
     9730case "(($ac_try" in 
     9731  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 
     9732  *) ac_try_echo=$ac_try;; 
     9733esac 
     9734eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 
     9735  (eval "$ac_compile") 2>conftest.er1 
     9736  ac_status=$? 
     9737  grep -v '^ *+' conftest.er1 >conftest.err 
     9738  rm -f conftest.er1 
     9739  cat conftest.err >&5 
     9740  echo "$as_me:$LINENO: \$? = $ac_status" >&5 
     9741  (exit $ac_status); } && { 
     9742         test -z "$ac_c_werror_flag" || 
     9743         test ! -s conftest.err 
     9744       } && test -s conftest.$ac_objext; then 
     9745  cat >>confdefs.h <<\_ACEOF 
     9746#define PJ_EMULATE_RWMUTEX 0 
     9747_ACEOF 
     9748 
     9749                       CFLAGS="$CFLAGS -D_POSIX_THREADS -D_POSIX_READER_WRITER_LOCKS" 
     9750                       { echo "$as_me:$LINENO: result: yes" >&5 
     9751echo "${ECHO_T}yes" >&6; } 
     9752else 
     9753  echo "$as_me: failed program was:" >&5 
     9754sed 's/^/| /' conftest.$ac_ext >&5 
     9755 
     9756        cat >>confdefs.h <<\_ACEOF 
     9757#define PJ_EMULATE_RWMUTEX 1 
     9758_ACEOF 
     9759 
     9760                       { echo "$as_me:$LINENO: result: no" >&5 
     9761echo "${ECHO_T}no" >&6; } 
     9762fi 
     9763 
     9764rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 
     9765fi 
     9766 
     9767{ echo "$as_me:$LINENO: checking if pthread_mutexattr_settype() is available" >&5 
     9768echo $ECHO_N "checking if pthread_mutexattr_settype() is available... $ECHO_C" >&6; } 
     9769cat >conftest.$ac_ext <<_ACEOF 
     9770/* confdefs.h.  */ 
     9771_ACEOF 
     9772cat confdefs.h >>conftest.$ac_ext 
     9773cat >>conftest.$ac_ext <<_ACEOF 
     9774/* end confdefs.h.  */ 
     9775#include <pthread.h> 
     9776int 
     9777main () 
     9778{ 
     9779pthread_mutexattr_settype(0,PTHREAD_MUTEX_FAST_NP); 
     9780  ; 
     9781  return 0; 
     9782} 
     9783_ACEOF 
     9784rm -f conftest.$ac_objext 
     9785if { (ac_try="$ac_compile" 
     9786case "(($ac_try" in 
     9787  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 
     9788  *) ac_try_echo=$ac_try;; 
     9789esac 
     9790eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 
     9791  (eval "$ac_compile") 2>conftest.er1 
     9792  ac_status=$? 
     9793  grep -v '^ *+' conftest.er1 >conftest.err 
     9794  rm -f conftest.er1 
     9795  cat conftest.err >&5 
     9796  echo "$as_me:$LINENO: \$? = $ac_status" >&5 
     9797  (exit $ac_status); } && { 
     9798         test -z "$ac_c_werror_flag" || 
     9799         test ! -s conftest.err 
     9800       } && test -s conftest.$ac_objext; then 
     9801  cat >>confdefs.h <<\_ACEOF 
     9802#define PJ_HAS_PTHREAD_MUTEXATTR_SETTYPE 1 
     9803_ACEOF 
     9804 
     9805                   { echo "$as_me:$LINENO: result: yes" >&5 
     9806echo "${ECHO_T}yes" >&6; } 
     9807else 
     9808  echo "$as_me: failed program was:" >&5 
     9809sed 's/^/| /' conftest.$ac_ext >&5 
     9810 
     9811        { echo "$as_me:$LINENO: result: no" >&5 
     9812echo "${ECHO_T}no" >&6; } 
     9813fi 
     9814 
     9815rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 
     9816 
     9817{ echo "$as_me:$LINENO: checking if pthread_mutexattr_t has recursive member" >&5 
     9818echo $ECHO_N "checking if pthread_mutexattr_t has recursive member... $ECHO_C" >&6; } 
     9819cat >conftest.$ac_ext <<_ACEOF 
     9820/* confdefs.h.  */ 
     9821_ACEOF 
     9822cat confdefs.h >>conftest.$ac_ext 
     9823cat >>conftest.$ac_ext <<_ACEOF 
     9824/* end confdefs.h.  */ 
     9825#include <pthread.h> 
     9826int 
     9827main () 
     9828{ 
     9829pthread_mutexattr_t attr; 
     9830                                     attr.recursive=1; 
     9831  ; 
     9832  return 0; 
     9833} 
     9834_ACEOF 
     9835rm -f conftest.$ac_objext 
     9836if { (ac_try="$ac_compile" 
     9837case "(($ac_try" in 
     9838  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; 
     9839  *) ac_try_echo=$ac_try;; 
     9840esac 
     9841eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 
     9842  (eval "$ac_compile") 2>conftest.er1 
     9843  ac_status=$? 
     9844  grep -v '^ *+' conftest.er1 >conftest.err 
     9845  rm -f conftest.er1 
     9846  cat conftest.err >&5 
     9847  echo "$as_me:$LINENO: \$? = $ac_status" >&5 
     9848  (exit $ac_status); } && { 
     9849         test -z "$ac_c_werror_flag" || 
     9850         test ! -s conftest.err 
     9851       } && test -s conftest.$ac_objext; then 
     9852  cat >>confdefs.h <<\_ACEOF 
     9853#define PJ_PTHREAD_MUTEXATTR_T_HAS_RECURSIVE 1 
     9854_ACEOF 
     9855 
     9856                   { echo "$as_me:$LINENO: result: yes" >&5 
     9857echo "${ECHO_T}yes" >&6; } 
     9858else 
     9859  echo "$as_me: failed program was:" >&5 
     9860sed 's/^/| /' conftest.$ac_ext >&5 
     9861 
     9862        { echo "$as_me:$LINENO: result: no" >&5 
    95699863echo "${ECHO_T}no" >&6; } 
    95709864fi 
     
    1119311487# values after options handling. 
    1119411488ac_log=" 
    11195 This file was extended by pjproject $as_me 0.7, which was 
     11489This file was extended by pjproject $as_me 0.8, which was 
    1119611490generated by GNU Autoconf 2.61.  Invocation command line was 
    1119711491 
     
    1124211536cat >>$CONFIG_STATUS <<_ACEOF 
    1124311537ac_cs_version="\\ 
    11244 pjproject config.status 0.7 
     11538pjproject config.status 0.8 
    1124511539configured by $0, generated by GNU Autoconf 2.61, 
    1124611540  with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" 
  • pjproject/trunk/aconfigure.ac

    r1738 r1783  
    1 AC_INIT(pjproject,0.7) 
     1AC_INIT(pjproject,0.8) 
    22 
    33host_orig="$host" 
     
    147147AC_CHECK_HEADER(net/if.h,[AC_DEFINE(PJ_HAS_NET_IF_H,1)]) 
    148148AC_CHECK_HEADER(ifaddrs.h,[AC_DEFINE(PJ_HAS_IFADDRS_H,1)]) 
     149AC_CHECK_HEADER(semaphore.h,[AC_DEFINE(PJ_HAS_SEMAPHORE_H,1)]) 
    149150AC_CHECK_HEADER(setjmp.h,[AC_DEFINE(PJ_HAS_SETJMP_H,1)]) 
    150151AC_CHECK_HEADER(stdarg.h,[AC_DEFINE(PJ_HAS_STDARG_H,1)]) 
     
    269270                                   [pthread_rwlock_t *x;])], 
    270271                  [AC_DEFINE(PJ_EMULATE_RWMUTEX,0) 
     272                   ac_rwmutex="yes" 
    271273                   AC_MSG_RESULT(yes)], 
    272274                  [AC_DEFINE(PJ_EMULATE_RWMUTEX,1) 
     275                   ac_rwmutex="no" 
    273276                   AC_MSG_RESULT(no)]) 
     277 
     278dnl # If rwmutex is not detected, check again but this time 
     279dnl # with _POSIX_READER_WRITER_LOCKS defined (newlib needs this) 
     280if test "$ac_rwmutex" = "no"; then 
     281    AC_MSG_CHECKING([if pthread_rwlock_t is available with _POSIX_READER_WRITER_LOCKS]) 
     282    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#define _POSIX_READER_WRITER_LOCKS 
     283                                         #include <pthread.h>]], 
     284                                       [pthread_rwlock_t *x;])], 
     285                      [AC_DEFINE(PJ_EMULATE_RWMUTEX,0) 
     286                       CFLAGS="$CFLAGS -D_POSIX_THREADS -D_POSIX_READER_WRITER_LOCKS" 
     287                       AC_MSG_RESULT(yes)], 
     288                      [AC_DEFINE(PJ_EMULATE_RWMUTEX,1) 
     289                       AC_MSG_RESULT(no)]) 
     290fi 
     291 
     292dnl # Do we have pthread_mutexattr_settype()? 
     293AC_MSG_CHECKING([if pthread_mutexattr_settype() is available]) 
     294AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>], 
     295                                   [pthread_mutexattr_settype(0,PTHREAD_MUTEX_FAST_NP);])], 
     296                  [AC_DEFINE(PJ_HAS_PTHREAD_MUTEXATTR_SETTYPE,1) 
     297                   AC_MSG_RESULT(yes)], 
     298                  [AC_MSG_RESULT(no)]) 
     299 
     300dnl # Does pthread_mutexattr_t has "recursive" member? 
     301AC_MSG_CHECKING([if pthread_mutexattr_t has recursive member]) 
     302AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>], 
     303                                   [[pthread_mutexattr_t attr; 
     304                                     attr.recursive=1;]])], 
     305                  [AC_DEFINE(PJ_PTHREAD_MUTEXATTR_T_HAS_RECURSIVE,1) 
     306                   AC_MSG_RESULT(yes)], 
     307                  [AC_MSG_RESULT(no)]) 
    274308 
    275309AC_SUBST(ac_os_objs) 
  • pjproject/trunk/pjlib/include/pj/compat/os_auto.h.in

    r1738 r1783  
    5555#undef PJ_HAS_NET_IF_H 
    5656#undef PJ_HAS_IFADDRS_H 
     57#undef PJ_HAS_SEMAPHORE_H 
    5758#undef PJ_HAS_SETJMP_H 
    5859#undef PJ_HAS_STDARG_H 
     
    7980#undef PJ_SOCK_HAS_INET_NTOP 
    8081#undef PJ_SOCK_HAS_GETADDRINFO 
     82 
     83/* On these OSes, semaphore feature depends on semaphore.h */ 
     84#if defined(PJ_HAS_SEMAPHORE_H) && PJ_HAS_SEMAPHORE_H!=0 
     85#   define PJ_HAS_SEMAPHORE     1 
     86#else 
     87#   define PJ_HAS_SEMAPHORE     0 
     88#endif 
     89 
     90/* Do we have pthread_mutexattr_settype()? */ 
     91#undef PJ_HAS_PTHREAD_MUTEXATTR_SETTYPE 
     92 
     93/* Does pthread_mutexattr_t has "recursive" member?  */ 
     94#undef PJ_PTHREAD_MUTEXATTR_T_HAS_RECURSIVE 
    8195 
    8296/* Set 1 if native sockaddr_in has sin_len member.  
  • 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/** 
  • pjproject/trunk/pjlib/include/pj/sock_select.h

    r1405 r1783  
    5555typedef struct pj_fd_set_t 
    5656{ 
    57     pj_sock_t   data[FD_SETSIZE + 4];  /**< Opaque buffer for fd_set */ 
     57    pj_sock_t data[PJ_IOQUEUE_MAX_HANDLES+ 4]; /**< Opaque buffer for fd_set */ 
    5858} pj_fd_set_t; 
    5959 
  • pjproject/trunk/pjlib/src/pj/os_core_unix.c

    r1589 r1783  
    3535#include <pj/errno.h> 
    3636 
    37 #if defined(PJ_HAS_SEMAPHORE) && PJ_HAS_SEMAPHORE != 0 
     37#if defined(PJ_HAS_SEMAPHORE_H) && PJ_HAS_SEMAPHORE_H != 0 
    3838#  include <semaphore.h> 
    3939#endif 
     
    949949 
    950950    if (type == PJ_MUTEX_SIMPLE) { 
    951 #if defined(PJ_LINUX) && PJ_LINUX!=0 
     951#if (defined(PJ_LINUX) && PJ_LINUX!=0) || \ 
     952    defined(PJ_HAS_PTHREAD_MUTEXATTR_SETTYPE) 
    952953        rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_FAST_NP); 
    953 #elif defined(PJ_RTEMS) && PJ_RTEMS!=0 
     954#elif (defined(PJ_RTEMS) && PJ_RTEMS!=0) || \ 
     955       defined(PJ_PTHREAD_MUTEXATTR_T_HAS_RECURSIVE) 
    954956        /* Nothing to do, default is simple */ 
    955957#else 
     
    957959#endif 
    958960    } else { 
    959 #if defined(PJ_LINUX) && PJ_LINUX!=0 
     961#if (defined(PJ_LINUX) && PJ_LINUX!=0) || \ 
     962     defined(PJ_HAS_PTHREAD_MUTEXATTR_SETTYPE) 
    960963        rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP); 
    961 #elif defined(PJ_RTEMS) && PJ_RTEMS!=0 
     964#elif (defined(PJ_RTEMS) && PJ_RTEMS!=0) || \ 
     965       defined(PJ_PTHREAD_MUTEXATTR_T_HAS_RECURSIVE) 
    962966        // Phil Torre <ptorre@zetron.com>: 
    963967        // The RTEMS implementation of POSIX mutexes doesn't include  
    964968        // pthread_mutexattr_settype(), so what follows is a hack 
    965969        // until I get RTEMS patched to support the set/get functions. 
     970        // 
     971        // More info: 
     972        //   newlib's pthread also lacks pthread_mutexattr_settype(), 
     973        //   but it seems to have mutexattr.recursive. 
    966974        PJ_TODO(FIX_RTEMS_RECURSIVE_MUTEX_TYPE) 
    967975        attr.recursive = 1; 
     
    12401248 */ 
    12411249#if defined(PJ_EMULATE_RWMUTEX) && PJ_EMULATE_RWMUTEX!=0 
    1242 #  include "os_rwmutex.c" 
     1250    /* We need semaphore functionality to emulate rwmutex */ 
     1251#   if !defined(PJ_HAS_SEMAPHORE) || PJ_HAS_SEMAPHORE==0 
     1252#       error "Semaphore support needs to be enabled to emulate rwmutex" 
     1253#   endif 
     1254#   include "os_rwmutex.c" 
    12431255#else 
    12441256struct pj_rwmutex_t 
  • pjproject/trunk/pjlib/src/pj/sock_select.c

    r974 r1783  
    3434#   pragma warning(disable: 4018)    // Signed/unsigned mismatch in FD_* 
    3535#   pragma warning(disable: 4389)    // Signed/unsigned mismatch in FD_* 
     36#endif 
     37 
     38/* Now that we have access to OS'es <sys/select>, lets check again that 
     39 * PJ_IOQUEUE_MAX_HANDLES is not greater than FD_SETSIZE 
     40 */ 
     41#if PJ_IOQUEUE_MAX_HANDLES > FD_SETSIZE 
     42#   error "PJ_IOQUEUE_MAX_HANDLES cannot be greater than FD_SETSIZE" 
    3643#endif 
    3744 
Note: See TracChangeset for help on using the changeset viewer.