diff options
author | Yang Tse <yangsita@gmail.com> | 2012-11-23 17:57:00 +0100 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2012-11-23 17:57:00 +0100 |
commit | 665adcd4b7bcdb7deb638cdc499fbe71f8d777f2 (patch) | |
tree | 6317256953017d01d4a8d72fdcf0f7e992e998df | |
parent | 91dc73ef445c5d382a72db21468289ae8a9e80e3 (diff) | |
download | curl-665adcd4b7bcdb7deb638cdc499fbe71f8d777f2.tar.gz |
build: fix AIX compilation and usage
AIX sys/poll.h header file defines 'events' and 'revents' as C
preprocessor macros. Usage of these literals in libcurl's external
API was introduced in commit de24d7bd4c causing AIX build failures.
Appropriate inclusion of sys/poll.h by libcurl's external interface
fixes AIX build and usage issues while avoiding a SONAME bump.
-rw-r--r-- | acinclude.m4 | 42 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | include/curl/curlbuild.h.in | 9 | ||||
-rw-r--r-- | include/curl/curlrules.h | 3 |
4 files changed, 54 insertions, 2 deletions
diff --git a/acinclude.m4 b/acinclude.m4 index 930574542..ae9d8cdda 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -150,6 +150,7 @@ AC_DEFUN([CURL_CHECK_AIX_ALL_SOURCE], [ #endif]) AC_BEFORE([$0], [AC_SYS_LARGEFILE])dnl AC_BEFORE([$0], [CURL_CONFIGURE_REENTRANT])dnl + AC_BEFORE([$0], [CURL_CONFIGURE_PULL_SYS_POLL])dnl AC_MSG_CHECKING([if OS is AIX (to define _ALL_SOURCE)]) AC_EGREP_CPP([yes_this_is_aix],[ #ifdef _AIX @@ -2310,6 +2311,8 @@ AC_DEFUN([CURL_CONFIGURE_CURL_SOCKLEN_T], [ AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl # + AC_BEFORE([$0], [CURL_CONFIGURE_PULL_SYS_POLL])dnl + # AC_MSG_CHECKING([for curl_socklen_t data type]) curl_typeof_curl_socklen_t="unknown" for arg1 in int SOCKET; do @@ -2418,6 +2421,45 @@ AC_DEFUN([CURL_CONFIGURE_CURL_SOCKLEN_T], [ ]) +dnl CURL_CONFIGURE_PULL_SYS_POLL +dnl ------------------------------------------------- +dnl Find out if system header file sys/poll.h must be included by the +dnl external interface, making appropriate definitions for template file +dnl include/curl/curlbuild.h.in to properly configure and use the library. +dnl +dnl The need for the sys/poll.h inclusion arises mainly to properly +dnl interface AIX systems which define macros 'events' and 'revents'. + +AC_DEFUN([CURL_CONFIGURE_PULL_SYS_POLL], [ + AC_REQUIRE([CURL_INCLUDES_POLL])dnl + # + tst_poll_events_macro_defined="unknown" + # + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $curl_includes_poll + ]],[[ +#if defined(events) || defined(revents) + return 0; +#else + force compilation error +#endif + ]]) + ],[ + tst_poll_events_macro_defined="yes" + ],[ + tst_poll_events_macro_defined="no" + ]) + # + if test "$tst_poll_events_macro_defined" = "yes"; then + if test "x$ac_cv_header_sys_poll_h" = "xyes"; then + CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_POLL_H]) + fi + fi + # +]) + + dnl CURL_CHECK_FUNC_SELECT dnl ------------------------------------------------- dnl Test if the socket select() function is available, diff --git a/configure.ac b/configure.ac index d9642863b..d203db5f8 100644 --- a/configure.ac +++ b/configure.ac @@ -2948,6 +2948,8 @@ AC_CHECK_TYPE([bool],[ CURL_CONFIGURE_CURL_SOCKLEN_T +CURL_CONFIGURE_PULL_SYS_POLL + TYPE_IN_ADDR_T TYPE_SOCKADDR_STORAGE diff --git a/include/curl/curlbuild.h.in b/include/curl/curlbuild.h.in index fe348f40d..e29f195d2 100644 --- a/include/curl/curlbuild.h.in +++ b/include/curl/curlbuild.h.in @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -151,6 +151,13 @@ # include <sys/socket.h> #endif +/* Configure process defines this to 1 when it finds out that system */ +/* header file sys/poll.h must be included by the external interface. */ +#undef CURL_PULL_SYS_POLL_H +#ifdef CURL_PULL_SYS_POLL_H +# include <sys/poll.h> +#endif + /* The size of `long', as computed by sizeof. */ #undef CURL_SIZEOF_LONG diff --git a/include/curl/curlrules.h b/include/curl/curlrules.h index cbc12fdd2..4e9c88003 100644 --- a/include/curl/curlrules.h +++ b/include/curl/curlrules.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -248,6 +248,7 @@ typedef char #undef CURL_PULL_WS2TCPIP_H #undef CURL_PULL_SYS_TYPES_H #undef CURL_PULL_SYS_SOCKET_H +#undef CURL_PULL_SYS_POLL_H #undef CURL_PULL_STDINT_H #undef CURL_PULL_INTTYPES_H |