From 98dc6db2fc17166e04ffebe294928620eb604c44 Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Mon, 4 Aug 2008 14:45:02 +0000 Subject: Fixed build error on FreeBSD (cannot use if is not included) git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2190 74dad513-b988-da41-8d7b-12977e46ad98 --- aconfigure | 193 +++++++++++++++++++++++------------ aconfigure.ac | 7 +- pjlib/include/pj/compat/os_auto.h.in | 1 + pjlib/include/pj/compat/socket.h | 5 + 4 files changed, 138 insertions(+), 68 deletions(-) diff --git a/aconfigure b/aconfigure index 4e8e2e50..065dbb91 100755 --- a/aconfigure +++ b/aconfigure @@ -5558,18 +5558,18 @@ _ACEOF fi -if test "${ac_cv_header_netinet_in_h+set}" = set; then - echo "$as_me:$LINENO: checking for netinet/in.h" >&5 -echo $ECHO_N "checking for netinet/in.h... $ECHO_C" >&6 -if test "${ac_cv_header_netinet_in_h+set}" = set; then +if test "${ac_cv_header_netinet_in_systm_h+set}" = set; then + echo "$as_me:$LINENO: checking for netinet/in_systm.h" >&5 +echo $ECHO_N "checking for netinet/in_systm.h... $ECHO_C" >&6 +if test "${ac_cv_header_netinet_in_systm_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi -echo "$as_me:$LINENO: result: $ac_cv_header_netinet_in_h" >&5 -echo "${ECHO_T}$ac_cv_header_netinet_in_h" >&6 +echo "$as_me:$LINENO: result: $ac_cv_header_netinet_in_systm_h" >&5 +echo "${ECHO_T}$ac_cv_header_netinet_in_systm_h" >&6 else # Is the header compilable? -echo "$as_me:$LINENO: checking netinet/in.h usability" >&5 -echo $ECHO_N "checking netinet/in.h usability... $ECHO_C" >&6 +echo "$as_me:$LINENO: checking netinet/in_systm.h usability" >&5 +echo $ECHO_N "checking netinet/in_systm.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -5577,7 +5577,7 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -#include +#include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -5613,15 +5613,15 @@ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? -echo "$as_me:$LINENO: checking netinet/in.h presence" >&5 -echo $ECHO_N "checking netinet/in.h presence... $ECHO_C" >&6 +echo "$as_me:$LINENO: checking netinet/in_systm.h presence" >&5 +echo $ECHO_N "checking netinet/in_systm.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include +#include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 @@ -5655,25 +5655,25 @@ echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) - { echo "$as_me:$LINENO: WARNING: netinet/in.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: netinet/in.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: netinet/in.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: netinet/in.h: proceeding with the compiler's result" >&2;} + { echo "$as_me:$LINENO: WARNING: netinet/in_systm.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: netinet/in_systm.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: netinet/in_systm.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: netinet/in_systm.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) - { echo "$as_me:$LINENO: WARNING: netinet/in.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: netinet/in.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: netinet/in.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: netinet/in.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: netinet/in.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: netinet/in.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: netinet/in.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: netinet/in.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: netinet/in.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: netinet/in.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: netinet/in.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: netinet/in.h: in the future, the compiler will take precedence" >&2;} + { echo "$as_me:$LINENO: WARNING: netinet/in_systm.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: netinet/in_systm.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: netinet/in_systm.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: netinet/in_systm.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: netinet/in_systm.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: netinet/in_systm.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: netinet/in_systm.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: netinet/in_systm.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: netinet/in_systm.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: netinet/in_systm.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: netinet/in_systm.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: netinet/in_systm.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## @@ -5684,37 +5684,37 @@ _ASBOX sed "s/^/$as_me: WARNING: /" >&2 ;; esac -echo "$as_me:$LINENO: checking for netinet/in.h" >&5 -echo $ECHO_N "checking for netinet/in.h... $ECHO_C" >&6 -if test "${ac_cv_header_netinet_in_h+set}" = set; then +echo "$as_me:$LINENO: checking for netinet/in_systm.h" >&5 +echo $ECHO_N "checking for netinet/in_systm.h... $ECHO_C" >&6 +if test "${ac_cv_header_netinet_in_systm_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_cv_header_netinet_in_h=$ac_header_preproc + ac_cv_header_netinet_in_systm_h=$ac_header_preproc fi -echo "$as_me:$LINENO: result: $ac_cv_header_netinet_in_h" >&5 -echo "${ECHO_T}$ac_cv_header_netinet_in_h" >&6 +echo "$as_me:$LINENO: result: $ac_cv_header_netinet_in_systm_h" >&5 +echo "${ECHO_T}$ac_cv_header_netinet_in_systm_h" >&6 fi -if test $ac_cv_header_netinet_in_h = yes; then +if test $ac_cv_header_netinet_in_systm_h = yes; then cat >>confdefs.h <<\_ACEOF -#define PJ_HAS_NETINET_IN_H 1 +#define PJ_HAS_NETINET_IN_SYSTM_H 1 _ACEOF fi -if test "${ac_cv_header_netinet_ip_h+set}" = set; then - echo "$as_me:$LINENO: checking for netinet/ip.h" >&5 -echo $ECHO_N "checking for netinet/ip.h... $ECHO_C" >&6 -if test "${ac_cv_header_netinet_ip_h+set}" = set; then +if test "${ac_cv_header_netinet_in_h+set}" = set; then + echo "$as_me:$LINENO: checking for netinet/in.h" >&5 +echo $ECHO_N "checking for netinet/in.h... $ECHO_C" >&6 +if test "${ac_cv_header_netinet_in_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi -echo "$as_me:$LINENO: result: $ac_cv_header_netinet_ip_h" >&5 -echo "${ECHO_T}$ac_cv_header_netinet_ip_h" >&6 +echo "$as_me:$LINENO: result: $ac_cv_header_netinet_in_h" >&5 +echo "${ECHO_T}$ac_cv_header_netinet_in_h" >&6 else # Is the header compilable? -echo "$as_me:$LINENO: checking netinet/ip.h usability" >&5 -echo $ECHO_N "checking netinet/ip.h usability... $ECHO_C" >&6 +echo "$as_me:$LINENO: checking netinet/in.h usability" >&5 +echo $ECHO_N "checking netinet/in.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -5722,7 +5722,7 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -#include +#include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -5758,15 +5758,15 @@ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? -echo "$as_me:$LINENO: checking netinet/ip.h presence" >&5 -echo $ECHO_N "checking netinet/ip.h presence... $ECHO_C" >&6 +echo "$as_me:$LINENO: checking netinet/in.h presence" >&5 +echo $ECHO_N "checking netinet/in.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include +#include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 @@ -5800,25 +5800,25 @@ echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) - { echo "$as_me:$LINENO: WARNING: netinet/ip.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: netinet/ip.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: netinet/ip.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: netinet/ip.h: proceeding with the compiler's result" >&2;} + { echo "$as_me:$LINENO: WARNING: netinet/in.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: netinet/in.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: netinet/in.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: netinet/in.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) - { echo "$as_me:$LINENO: WARNING: netinet/ip.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: netinet/ip.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: netinet/ip.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: netinet/ip.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: netinet/ip.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: netinet/ip.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: netinet/ip.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: netinet/ip.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: netinet/ip.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: netinet/ip.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: netinet/ip.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: netinet/ip.h: in the future, the compiler will take precedence" >&2;} + { echo "$as_me:$LINENO: WARNING: netinet/in.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: netinet/in.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: netinet/in.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: netinet/in.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: netinet/in.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: netinet/in.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: netinet/in.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: netinet/in.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: netinet/in.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: netinet/in.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: netinet/in.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: netinet/in.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## @@ -5829,17 +5829,76 @@ _ASBOX sed "s/^/$as_me: WARNING: /" >&2 ;; esac +echo "$as_me:$LINENO: checking for netinet/in.h" >&5 +echo $ECHO_N "checking for netinet/in.h... $ECHO_C" >&6 +if test "${ac_cv_header_netinet_in_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_netinet_in_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_netinet_in_h" >&5 +echo "${ECHO_T}$ac_cv_header_netinet_in_h" >&6 + +fi +if test $ac_cv_header_netinet_in_h = yes; then + cat >>confdefs.h <<\_ACEOF +#define PJ_HAS_NETINET_IN_H 1 +_ACEOF + +fi + + echo "$as_me:$LINENO: checking for netinet/ip.h" >&5 echo $ECHO_N "checking for netinet/ip.h... $ECHO_C" >&6 if test "${ac_cv_header_netinet_ip_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_cv_header_netinet_ip_h=$ac_header_preproc + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#if PJ_HAS_NETINET_IN_SYSTM_H + # include + #endif + + +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_netinet_ip_h=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_netinet_ip_h=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_header_netinet_ip_h" >&5 echo "${ECHO_T}$ac_cv_header_netinet_ip_h" >&6 - -fi if test $ac_cv_header_netinet_ip_h = yes; then cat >>confdefs.h <<\_ACEOF #define PJ_HAS_NETINET_IP_H 1 diff --git a/aconfigure.ac b/aconfigure.ac index 808bc61f..c53f8628 100644 --- a/aconfigure.ac +++ b/aconfigure.ac @@ -142,8 +142,13 @@ AC_CHECK_HEADER(fcntl.h,[AC_DEFINE(PJ_HAS_FCNTL_H,1)]) AC_CHECK_HEADER(linux/socket.h,[AC_DEFINE(PJ_HAS_LINUX_SOCKET_H,1)]) AC_CHECK_HEADER(malloc.h,[AC_DEFINE(PJ_HAS_MALLOC_H,1)]) AC_CHECK_HEADER(netdb.h,[AC_DEFINE(PJ_HAS_NETDB_H,1)]) +AC_CHECK_HEADER(netinet/in_systm.h,[AC_DEFINE(PJ_HAS_NETINET_IN_SYSTM_H,1)]) AC_CHECK_HEADER(netinet/in.h,[AC_DEFINE(PJ_HAS_NETINET_IN_H,1)]) -AC_CHECK_HEADER(netinet/ip.h,[AC_DEFINE(PJ_HAS_NETINET_IP_H,1)]) +AC_CHECK_HEADER(netinet/ip.h,[AC_DEFINE(PJ_HAS_NETINET_IP_H,1)],[], + [#if PJ_HAS_NETINET_IN_SYSTM_H + # include + #endif + ]) AC_CHECK_HEADER(ifaddrs.h,[AC_DEFINE(PJ_HAS_IFADDRS_H,1)]) AC_CHECK_HEADER(semaphore.h,[AC_DEFINE(PJ_HAS_SEMAPHORE_H,1)]) AC_CHECK_HEADER(setjmp.h,[AC_DEFINE(PJ_HAS_SETJMP_H,1)]) diff --git a/pjlib/include/pj/compat/os_auto.h.in b/pjlib/include/pj/compat/os_auto.h.in index c963179d..d9b37d28 100644 --- a/pjlib/include/pj/compat/os_auto.h.in +++ b/pjlib/include/pj/compat/os_auto.h.in @@ -50,6 +50,7 @@ #undef PJ_HAS_LINUX_SOCKET_H #undef PJ_HAS_MALLOC_H #undef PJ_HAS_NETDB_H +#undef PJ_HAS_NETINET_IN_SYSTM_H #undef PJ_HAS_NETINET_IN_H #undef PJ_HAS_NETINET_IP_H #undef PJ_HAS_NET_IF_H diff --git a/pjlib/include/pj/compat/socket.h b/pjlib/include/pj/compat/socket.h index 4551ad8f..eb0f870e 100644 --- a/pjlib/include/pj/compat/socket.h +++ b/pjlib/include/pj/compat/socket.h @@ -91,6 +91,11 @@ # include #endif +#if defined(PJ_HAS_NETINET_IN_SYSTM_H) && PJ_HAS_NETINET_IN_SYSTM_H != 0 +/* Required to include netinet/ip.h in FreeBSD 7.0 */ +# include +#endif + #if defined(PJ_HAS_NETINET_IP_H) && PJ_HAS_NETINET_IP_H != 0 /* To pull in IPTOS_* constants */ # include -- cgit v1.2.3