mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
First step trying to avoid the multiple header inclusion and recursion nightmare.
Reintroduce checking for HAVE_MSG_NOSIGNAL in configure script, so that we don't depend on header inclusion order for a valid check.
This commit is contained in:
parent
c10d15aa0f
commit
77b3bc239d
33
acinclude.m4
33
acinclude.m4
@ -926,6 +926,39 @@ AC_DEFUN([CURL_CHECK_FUNC_SEND], [
|
||||
]) # AC_DEFUN
|
||||
|
||||
|
||||
dnl CURL_CHECK_MSG_NOSIGNAL
|
||||
dnl -------------------------------------------------
|
||||
dnl Check for MSG_NOSIGNAL
|
||||
|
||||
AC_DEFUN([CURL_CHECK_MSG_NOSIGNAL], [
|
||||
AC_CHECK_HEADERS(sys/types.h sys/socket.h)
|
||||
AC_CACHE_CHECK([for MSG_NOSIGNAL], [ac_cv_msg_nosignal], [
|
||||
AC_COMPILE_IFELSE([
|
||||
AC_LANG_PROGRAM([
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
],[
|
||||
int flag=MSG_NOSIGNAL;
|
||||
])
|
||||
],[
|
||||
ac_cv_msg_nosignal="yes"
|
||||
],[
|
||||
ac_cv_msg_nosignal="no"
|
||||
])
|
||||
])
|
||||
case "$ac_cv_msg_nosignal" in
|
||||
yes)
|
||||
AC_DEFINE_UNQUOTED(HAVE_MSG_NOSIGNAL, 1,
|
||||
[Define to 1 if you have the MSG_NOSIGNAL flag.])
|
||||
;;
|
||||
esac
|
||||
]) # AC_DEFUN
|
||||
|
||||
|
||||
dnl CURL_CHECK_NONBLOCKING_SOCKET
|
||||
dnl -------------------------------------------------
|
||||
dnl Check for how to set a socket to non-blocking state. There seems to exist
|
||||
|
@ -8,7 +8,8 @@ ares_expand_string.c ares_parse_ptr_reply.c ares_parse_aaaa_reply.c \
|
||||
ares_getnameinfo.c inet_net_pton.c bitncmp.c inet_ntop.c
|
||||
|
||||
HHEADERS = ares.h ares_private.h setup.h ares_dns.h ares_version.h \
|
||||
nameser.h inet_net_pton.h inet_ntop.h ares_ipv6.h bitncmp.h
|
||||
nameser.h inet_net_pton.h inet_ntop.h ares_ipv6.h bitncmp.h \
|
||||
setup_once.h
|
||||
|
||||
MANPAGES= ares_destroy.3 ares_expand_name.3 ares_expand_string.3 ares_fds.3 \
|
||||
ares_free_hostent.3 ares_free_string.3 ares_gethostbyaddr.3 \
|
||||
|
@ -904,6 +904,39 @@ AC_DEFUN([CURL_CHECK_FUNC_SEND], [
|
||||
]) # AC_DEFUN
|
||||
|
||||
|
||||
dnl CURL_CHECK_MSG_NOSIGNAL
|
||||
dnl -------------------------------------------------
|
||||
dnl Check for MSG_NOSIGNAL
|
||||
|
||||
AC_DEFUN([CURL_CHECK_MSG_NOSIGNAL], [
|
||||
AC_CHECK_HEADERS(sys/types.h sys/socket.h)
|
||||
AC_CACHE_CHECK([for MSG_NOSIGNAL], [ac_cv_msg_nosignal], [
|
||||
AC_COMPILE_IFELSE([
|
||||
AC_LANG_PROGRAM([
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
],[
|
||||
int flag=MSG_NOSIGNAL;
|
||||
])
|
||||
],[
|
||||
ac_cv_msg_nosignal="yes"
|
||||
],[
|
||||
ac_cv_msg_nosignal="no"
|
||||
])
|
||||
])
|
||||
case "$ac_cv_msg_nosignal" in
|
||||
yes)
|
||||
AC_DEFINE_UNQUOTED(HAVE_MSG_NOSIGNAL, 1,
|
||||
[Define to 1 if you have the MSG_NOSIGNAL flag.])
|
||||
;;
|
||||
esac
|
||||
]) # AC_DEFUN
|
||||
|
||||
|
||||
dnl CURL_CHECK_NONBLOCKING_SOCKET
|
||||
dnl -------------------------------------------------
|
||||
dnl Check for how to set a socket to non-blocking state. There seems to exist
|
||||
|
@ -179,6 +179,8 @@ CURL_CHECK_FUNC_RECV
|
||||
|
||||
CURL_CHECK_FUNC_SEND
|
||||
|
||||
CURL_CHECK_MSG_NOSIGNAL
|
||||
|
||||
dnl check for AF_INET6
|
||||
CARES_CHECK_CONSTANT(
|
||||
[
|
||||
|
@ -149,4 +149,12 @@ int ares_strcasecmp(const char *s1, const char *s2);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Include macros and defines that should only be processed once.
|
||||
*/
|
||||
|
||||
#ifndef __SETUP_ONCE_H
|
||||
#include "setup_once.h"
|
||||
#endif
|
||||
|
||||
#endif /* __ARES_SETUP_H */
|
||||
|
99
ares/setup_once.h
Normal file
99
ares/setup_once.h
Normal file
@ -0,0 +1,99 @@
|
||||
#ifndef __SETUP_ONCE_H
|
||||
#define __SETUP_ONCE_H
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/* Copyright (C) 2004 - 2006 by Daniel Stenberg et al
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software and its
|
||||
* documentation for any purpose and without fee is hereby granted, provided
|
||||
* that the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of M.I.T. not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. M.I.T. makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as is"
|
||||
* without express or implied warranty.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* If we have the MSG_NOSIGNAL define, make sure we use
|
||||
* it as the fourth argument of send() and recv()
|
||||
*/
|
||||
|
||||
#ifdef HAVE_MSG_NOSIGNAL
|
||||
#define SEND_4TH_ARG MSG_NOSIGNAL
|
||||
#else
|
||||
#define SEND_4TH_ARG 0
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* The definitions for the return type and arguments types
|
||||
* of functions recv() and send() belong and come from the
|
||||
* configuration file. Do not define them in any other place.
|
||||
*
|
||||
* HAVE_RECV is defined if you have a function named recv()
|
||||
* which is used to read incoming data from sockets. If your
|
||||
* function has another name then don't define HAVE_RECV.
|
||||
*
|
||||
* If HAVE_RECV is defined then RECV_TYPE_ARG1, RECV_TYPE_ARG2,
|
||||
* RECV_TYPE_ARG3, RECV_TYPE_ARG4 and RECV_TYPE_RETV must also
|
||||
* be defined.
|
||||
*
|
||||
* HAVE_SEND is defined if you have a function named send()
|
||||
* which is used to write outgoing data on a connected socket.
|
||||
* If yours has another name then don't define HAVE_SEND.
|
||||
*
|
||||
* If HAVE_SEND is defined then SEND_TYPE_ARG1, SEND_QUAL_ARG2,
|
||||
* SEND_TYPE_ARG2, SEND_TYPE_ARG3, SEND_TYPE_ARG4 and
|
||||
* SEND_TYPE_RETV must also be defined.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_RECV
|
||||
#if !defined(RECV_TYPE_ARG1) || \
|
||||
!defined(RECV_TYPE_ARG2) || \
|
||||
!defined(RECV_TYPE_ARG3) || \
|
||||
!defined(RECV_TYPE_ARG4) || \
|
||||
!defined(RECV_TYPE_RETV)
|
||||
/* */
|
||||
Error Missing_definition_of_return_and_arguments_types_of_recv
|
||||
/* */
|
||||
#else
|
||||
#define sread(x,y,z) (ssize_t)recv((RECV_TYPE_ARG1)(x), \
|
||||
(RECV_TYPE_ARG2)(y), \
|
||||
(RECV_TYPE_ARG3)(z), \
|
||||
(RECV_TYPE_ARG4)(SEND_4TH_ARG))
|
||||
#endif
|
||||
#else /* HAVE_RECV */
|
||||
#ifdef DJGPP
|
||||
#define sread(x,y,z) (ssize_t)read_s((int)(x), (char *)(y), (int)(z))
|
||||
#endif
|
||||
#endif /* HAVE_RECV */
|
||||
|
||||
#ifdef HAVE_SEND
|
||||
#if !defined(SEND_TYPE_ARG1) || \
|
||||
!defined(SEND_QUAL_ARG2) || \
|
||||
!defined(SEND_TYPE_ARG2) || \
|
||||
!defined(SEND_TYPE_ARG3) || \
|
||||
!defined(SEND_TYPE_ARG4) || \
|
||||
!defined(SEND_TYPE_RETV)
|
||||
/* */
|
||||
Error Missing_definition_of_return_and_arguments_types_of_send
|
||||
/* */
|
||||
#else
|
||||
#define swrite(x,y,z) (ssize_t)send((SEND_TYPE_ARG1)(x), \
|
||||
(SEND_TYPE_ARG2)(y), \
|
||||
(SEND_TYPE_ARG3)(z), \
|
||||
(SEND_TYPE_ARG4)(SEND_4TH_ARG))
|
||||
#endif
|
||||
#else /* HAVE_SEND */
|
||||
#ifdef DJGPP
|
||||
#define swrite(x,y,z) (ssize_t)write_s((int)(x), (char *)(y), (int)(z))
|
||||
#endif
|
||||
#endif /* HAVE_SEND */
|
||||
|
||||
|
||||
#endif /* __SETUP_ONCE_H */
|
||||
|
@ -1568,6 +1568,8 @@ CURL_CHECK_FUNC_RECV
|
||||
|
||||
CURL_CHECK_FUNC_SEND
|
||||
|
||||
CURL_CHECK_MSG_NOSIGNAL
|
||||
|
||||
dnl Checks for library functions.
|
||||
dnl AC_PROG_GCC_TRADITIONAL
|
||||
AC_TYPE_SIGNAL
|
||||
|
@ -18,6 +18,6 @@ HHEADERS = arpa_telnet.h netrc.h file.h timeval.h base64.h hostip.h \
|
||||
share.h md5.h http_digest.h http_negotiate.h http_ntlm.h ca-bundle.h \
|
||||
inet_pton.h strtoofft.h strerror.h inet_ntop.h curlx.h memory.h \
|
||||
setup.h transfer.h select.h easyif.h multiif.h parsedate.h sslgen.h \
|
||||
gtls.h tftp.h sockaddr.h splay.h strdup.h
|
||||
gtls.h tftp.h sockaddr.h splay.h strdup.h setup_once.h
|
||||
|
||||
|
||||
|
79
lib/setup.h
79
lib/setup.h
@ -193,14 +193,6 @@ typedef unsigned char bool;
|
||||
#define curlassert(x)
|
||||
#endif
|
||||
|
||||
#ifdef MSG_NOSIGNAL
|
||||
/* If we have the MSG_NOSIGNAL define, we make sure to use that in the forth
|
||||
argument to send() and recv() */
|
||||
#define SEND_4TH_ARG MSG_NOSIGNAL
|
||||
#define HAVE_MSG_NOSIGNAL 1 /* we have MSG_NOSIGNAL */
|
||||
#else
|
||||
#define SEND_4TH_ARG 0
|
||||
#endif /* MSG_NOSIGNAL */
|
||||
|
||||
/* To make large file support transparent even on Windows */
|
||||
#if defined(WIN32) && (SIZEOF_CURL_OFF_T > 4)
|
||||
@ -214,70 +206,9 @@ typedef unsigned char bool;
|
||||
#define struct_stat struct stat
|
||||
#endif /* Win32 with large file support */
|
||||
|
||||
/*
|
||||
* The definitions for the return type and arguments types
|
||||
* of functions recv() and send() belong and come from the
|
||||
* configuration file. Do not define them in any other place.
|
||||
*
|
||||
* HAVE_RECV is defined if you have a function named recv()
|
||||
* which is used to read incoming data from sockets. If your
|
||||
* function has another name then don't define HAVE_RECV.
|
||||
*
|
||||
* If HAVE_RECV is defined then RECV_TYPE_ARG1, RECV_TYPE_ARG2,
|
||||
* RECV_TYPE_ARG3, RECV_TYPE_ARG4 and RECV_TYPE_RETV must also
|
||||
* be defined.
|
||||
*
|
||||
* HAVE_SEND is defined if you have a function named send()
|
||||
* which is used to write outgoing data on a connected socket.
|
||||
* If yours has another name then don't define HAVE_SEND.
|
||||
*
|
||||
* If HAVE_SEND is defined then SEND_TYPE_ARG1, SEND_QUAL_ARG2,
|
||||
* SEND_TYPE_ARG2, SEND_TYPE_ARG3, SEND_TYPE_ARG4 and
|
||||
* SEND_TYPE_RETV must also be defined.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_RECV
|
||||
#if !defined(RECV_TYPE_ARG1) || \
|
||||
!defined(RECV_TYPE_ARG2) || \
|
||||
!defined(RECV_TYPE_ARG3) || \
|
||||
!defined(RECV_TYPE_ARG4) || \
|
||||
!defined(RECV_TYPE_RETV)
|
||||
/* */
|
||||
Error: Missing definition of return and arguments types of recv().
|
||||
/* */
|
||||
#else
|
||||
#define sread(x,y,z) (ssize_t)recv((RECV_TYPE_ARG1)(x), (RECV_TYPE_ARG2)(y), (RECV_TYPE_ARG3)(z), (RECV_TYPE_ARG4)(SEND_4TH_ARG))
|
||||
#endif
|
||||
#else /* HAVE_RECV */
|
||||
#ifdef DJGPP
|
||||
#define sread(x,y,z) (ssize_t)read_s((int)(x), (char *)(y), (int)(z))
|
||||
#endif
|
||||
#endif /* HAVE_RECV */
|
||||
|
||||
#ifdef HAVE_SEND
|
||||
#if !defined(SEND_TYPE_ARG1) || \
|
||||
!defined(SEND_QUAL_ARG2) || \
|
||||
!defined(SEND_TYPE_ARG2) || \
|
||||
!defined(SEND_TYPE_ARG3) || \
|
||||
!defined(SEND_TYPE_ARG4) || \
|
||||
!defined(SEND_TYPE_RETV)
|
||||
/* */
|
||||
Error: Missing definition of return and arguments types of send().
|
||||
/* */
|
||||
#else
|
||||
#define swrite(x,y,z) (ssize_t)send((SEND_TYPE_ARG1)(x), (SEND_TYPE_ARG2)(y), (SEND_TYPE_ARG3)(z), (SEND_TYPE_ARG4)(SEND_4TH_ARG))
|
||||
#endif
|
||||
#else /* HAVE_SEND */
|
||||
#ifdef DJGPP
|
||||
#define swrite(x,y,z) (ssize_t)write_s((int)(x), (char *)(y), (int)(z))
|
||||
#endif
|
||||
#endif /* HAVE_SEND */
|
||||
|
||||
|
||||
/* Below we define four functions. They should
|
||||
/* Below we define some functions. They should
|
||||
1. close a socket
|
||||
2. read from a socket
|
||||
3. write to a socket
|
||||
|
||||
4. set the SIGALRM signal timeout
|
||||
5. set dir/file naming defines
|
||||
@ -428,4 +359,12 @@ typedef int curl_socket_t;
|
||||
#define DEBUGF(x)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Include macros and defines that should only be processed once.
|
||||
*/
|
||||
|
||||
#ifndef __SETUP_ONCE_H
|
||||
#include "setup_once.h"
|
||||
#endif
|
||||
|
||||
#endif /* __LIB_CURL_SETUP_H */
|
||||
|
106
lib/setup_once.h
Normal file
106
lib/setup_once.h
Normal file
@ -0,0 +1,106 @@
|
||||
#ifndef __SETUP_ONCE_H
|
||||
#define __SETUP_ONCE_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2006, 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
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
* If we have the MSG_NOSIGNAL define, make sure we use
|
||||
* it as the fourth argument of send() and recv()
|
||||
*/
|
||||
|
||||
#ifdef HAVE_MSG_NOSIGNAL
|
||||
#define SEND_4TH_ARG MSG_NOSIGNAL
|
||||
#else
|
||||
#define SEND_4TH_ARG 0
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* The definitions for the return type and arguments types
|
||||
* of functions recv() and send() belong and come from the
|
||||
* configuration file. Do not define them in any other place.
|
||||
*
|
||||
* HAVE_RECV is defined if you have a function named recv()
|
||||
* which is used to read incoming data from sockets. If your
|
||||
* function has another name then don't define HAVE_RECV.
|
||||
*
|
||||
* If HAVE_RECV is defined then RECV_TYPE_ARG1, RECV_TYPE_ARG2,
|
||||
* RECV_TYPE_ARG3, RECV_TYPE_ARG4 and RECV_TYPE_RETV must also
|
||||
* be defined.
|
||||
*
|
||||
* HAVE_SEND is defined if you have a function named send()
|
||||
* which is used to write outgoing data on a connected socket.
|
||||
* If yours has another name then don't define HAVE_SEND.
|
||||
*
|
||||
* If HAVE_SEND is defined then SEND_TYPE_ARG1, SEND_QUAL_ARG2,
|
||||
* SEND_TYPE_ARG2, SEND_TYPE_ARG3, SEND_TYPE_ARG4 and
|
||||
* SEND_TYPE_RETV must also be defined.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_RECV
|
||||
#if !defined(RECV_TYPE_ARG1) || \
|
||||
!defined(RECV_TYPE_ARG2) || \
|
||||
!defined(RECV_TYPE_ARG3) || \
|
||||
!defined(RECV_TYPE_ARG4) || \
|
||||
!defined(RECV_TYPE_RETV)
|
||||
/* */
|
||||
Error Missing_definition_of_return_and_arguments_types_of_recv
|
||||
/* */
|
||||
#else
|
||||
#define sread(x,y,z) (ssize_t)recv((RECV_TYPE_ARG1)(x), \
|
||||
(RECV_TYPE_ARG2)(y), \
|
||||
(RECV_TYPE_ARG3)(z), \
|
||||
(RECV_TYPE_ARG4)(SEND_4TH_ARG))
|
||||
#endif
|
||||
#else /* HAVE_RECV */
|
||||
#ifdef DJGPP
|
||||
#define sread(x,y,z) (ssize_t)read_s((int)(x), (char *)(y), (int)(z))
|
||||
#endif
|
||||
#endif /* HAVE_RECV */
|
||||
|
||||
#ifdef HAVE_SEND
|
||||
#if !defined(SEND_TYPE_ARG1) || \
|
||||
!defined(SEND_QUAL_ARG2) || \
|
||||
!defined(SEND_TYPE_ARG2) || \
|
||||
!defined(SEND_TYPE_ARG3) || \
|
||||
!defined(SEND_TYPE_ARG4) || \
|
||||
!defined(SEND_TYPE_RETV)
|
||||
/* */
|
||||
Error Missing_definition_of_return_and_arguments_types_of_send
|
||||
/* */
|
||||
#else
|
||||
#define swrite(x,y,z) (ssize_t)send((SEND_TYPE_ARG1)(x), \
|
||||
(SEND_TYPE_ARG2)(y), \
|
||||
(SEND_TYPE_ARG3)(z), \
|
||||
(SEND_TYPE_ARG4)(SEND_4TH_ARG))
|
||||
#endif
|
||||
#else /* HAVE_SEND */
|
||||
#ifdef DJGPP
|
||||
#define swrite(x,y,z) (ssize_t)write_s((int)(x), (char *)(y), (int)(z))
|
||||
#endif
|
||||
#endif /* HAVE_SEND */
|
||||
|
||||
|
||||
#endif /* __SETUP_ONCE_H */
|
||||
|
Loading…
Reference in New Issue
Block a user