[sane-devel] [PATCH v2 04/14] bldchn, checking for socklen_t more safe
Chris Bagwell
chris at cnpbagwell.com
Tue Jan 24 19:15:01 UTC 2012
On Mon, Jan 23, 2012 at 5:05 PM, Ruediger Meier <sweet_f_a at gmx.de> wrote:
> From: Ruediger Meier <ruediger.meier at ga-group.nl>
>
> Here I just want to fix conflicts for win32 systems. Generally I'd say
> that we should never "#define socklen_t int" within config.h. But this
> may decide somebody else.
>
> Note this patch may break the build on systems where socklen_t is
> available now but the right headers are not included yet. For example
> for win32 you need to add
> #ifdef HAVE_WS2TCPIP_H
> #include <ws2tcpip.h>
> #endif
> wherever socklen_t is used.
> ---
> configure | 14 +++++++++++---
> configure.in | 12 ++++++++++--
> 2 files changed, 21 insertions(+), 5 deletions(-)
>
> diff --git a/configure b/configure
> index 5da8db8..ba1df33 100755
> --- a/configure
> +++ b/configure
> @@ -8257,12 +8257,20 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
> { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_long_long" >&5
> $as_echo "$have_long_long" >&6; }
>
> -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for socklen_t in <sys/socket.h>" >&5
> -$as_echo_n "checking for socklen_t in <sys/socket.h>... " >&6; }
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for socklen_t" >&5
> +$as_echo_n "checking for socklen_t... " >&6; }
> cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> /* end confdefs.h. */
>
> -#include <sys/socket.h>
> +#ifdef HAVE_SYS_SOCKET_H
> +# include <sys/socket.h>
> +#endif
> +#ifdef HAVE_WINSOCK2_H
> +# include <winsock2.h>
> +#endif
> +#ifdef HAVE_WS2TCPIP_H
> +# include <ws2tcpip.h>
> +#endif"
>
> int
> main ()
> diff --git a/configure.in b/configure.in
> index 060b8b6..b30dd92 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -232,9 +232,17 @@ have_long_long=no
> AC_TRY_COMPILE([], [long long x; x = (long long)0;], AC_DEFINE(HAVE_LONG_LONG, 1, [Define if the long long type is available.]) have_long_long=yes)
> AC_MSG_RESULT($have_long_long)
>
> -AC_MSG_CHECKING([for socklen_t in <sys/socket.h>])
> +AC_MSG_CHECKING([for socklen_t])
> AC_TRY_COMPILE([
> -#include <sys/socket.h>
> +#ifdef HAVE_SYS_SOCKET_H
> +# include <sys/socket.h>
> +#endif
> +#ifdef HAVE_WINSOCK2_H
> +# include <winsock2.h>
> +#endif
> +#ifdef HAVE_WS2TCPIP_H
> +# include <ws2tcpip.h>
> +#endif"
> ],[socklen_t len],AC_MSG_RESULT(yes),
> [AC_MSG_RESULT(no); AC_DEFINE(socklen_t,int,
> [Define socklen_t as \'int\' if necessary.])])
Since we are changing this, maybe we should change to more proper
AC_CHECK_TYPES as well? That would require adding an "#ifndef
HAVE_SOCKELEN_T" towards bottom of acinclude.m4 to match it.
> --
> 1.7.6.1
>
>
> --
> sane-devel mailing list: sane-devel at lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
> Unsubscribe: Send mail with subject "unsubscribe your_password"
> to sane-devel-request at lists.alioth.debian.org
More information about the sane-devel
mailing list