From d4480c979dd01528b1ae7e971553d108f4f606a5 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Sat, 13 Jun 2009 18:13:00 +0000 Subject: initial step towards decoupling c-ares from libcurl for DOS --- ares/Makefile.dj | 62 +++++++++----------- ares/config.dos | 176 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 205 insertions(+), 33 deletions(-) create mode 100644 ares/config.dos diff --git a/ares/Makefile.dj b/ares/Makefile.dj index c146b2126..7ba303ff6 100644 --- a/ares/Makefile.dj +++ b/ares/Makefile.dj @@ -4,42 +4,17 @@ # # $Id$ + TOPDIR = .. include ../packages/DOS/common.dj - include Makefile.inc -CFLAGS += -DWATT32 -DHAVE_AF_INET6 -DHAVE_PF_INET6 -DHAVE_IOCTLSOCKET \ - -DHAVE_IOCTLSOCKET_FIONBIO -DHAVE_STRUCT_IN6_ADDR \ - -DHAVE_SOCKADDR_IN6_SIN6_SCOPE_ID -DHAVE_SYS_TIME_H \ - -DHAVE_STRUCT_SOCKADDR_IN6 -DHAVE_STRUCT_ADDRINFO \ - -DHAVE_ARPA_NAMESER_H -DHAVE_ARPA_INET_H -DHAVE_SYS_SOCKET_H \ - -DHAVE_SYS_UIO_H -DHAVE_NETINET_IN_H -DHAVE_NETINET_TCP_H \ - -DNS_INADDRSZ=4 -DHAVE_RECV -DHAVE_SEND -DHAVE_GETTIMEOFDAY \ - -DSEND_TYPE_ARG1='int' -DSEND_QUAL_ARG2='const' \ - -DSEND_TYPE_ARG2='void*' -DSEND_TYPE_ARG3='int' \ - -DSEND_TYPE_ARG4='int' -DSEND_TYPE_RETV='int' \ - -DRECV_TYPE_ARG1='int' -DRECV_TYPE_ARG2='void*' \ - -DRECV_TYPE_ARG3='int' -DRECV_TYPE_ARG4='int' \ - -DRECV_TYPE_RETV='int' -DHAVE_STRUCT_TIMEVAL \ - -Dselect=select_s -UHAVE_CONFIG_H \ - -DRECVFROM_TYPE_ARG1='int' -DRECVFROM_TYPE_ARG2='void' \ - -DRECVFROM_TYPE_ARG3='int' -DRECVFROM_TYPE_ARG4='int' \ - -DRECVFROM_TYPE_ARG6='int' -DRECVFROM_TYPE_RETV='int' \ - -DRECVFROM_TYPE_ARG5='struct sockaddr' -DHAVE_RECVFROM \ - -DRECVFROM_TYPE_ARG2_IS_VOID -DHAVE_STRDUP -DHAVE_NETDB_H \ - -DHAVE_STRCASECMP -DHAVE_STRNCASECMP -DHAVE_GETHOSTNAME \ - -DHAVE_LIMITS_H +CFLAGS += -DHAVE_CONFIG_H -DWATT32 LDFLAGS = -s -ifeq ($(USE_DEBUG),1) - CFLAGS += -DDEBUGBUILD -endif - ifeq ($(USE_CURLDEBUG),1) - CFLAGS += -DCURLDEBUG EX_LIBS = ../lib/libcurl.a OBJ_HACK = $(OBJECTS) else @@ -62,12 +37,15 @@ EX_LIBS += $(WATT32_ROOT)/lib/libwatt.a OBJECTS = $(addprefix $(OBJ_DIR)/, $(CSOURCES:.c=.o)) -all: $(OBJ_DIR) libcares.a ahost.exe adig.exe acountry.exe +all: $(OBJ_DIR) config.h libcares.a ahost.exe adig.exe acountry.exe @echo Welcome to c-ares. libcares.a: $(OBJECTS) ar rs $@ $? +config.h: config.dos + $(COPY) $^ $@ + ahost.exe: ahost.c $(OBJ_DIR)/ares_getopt.o $(OBJ_HACK) $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^ $(EX_LIBS) @@ -77,12 +55,30 @@ adig.exe: adig.c $(OBJ_DIR)/ares_getopt.o $(OBJ_HACK) acountry.exe: acountry.c $(OBJ_DIR)/ares_getopt.o $(OBJ_HACK) $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^ $(EX_LIBS) -clean: - rm -f $(OBJECTS) $(OBJ_DIR)/ares_getopt.o libcares.a +# clean generated files +# +genclean: + - $(DELETE) config.h -vclean realclean: clean - rm -f ahost.exe adig.exe acountry.exe depend.dj - - rmdir $(OBJ_DIR) +# clean object files and subdir +# +objclean: genclean + - $(DELETE) $(OBJ_DIR)$(DS)*.o + - $(RMDIR) $(OBJ_DIR) + +# clean without removing built library and programs +# +clean: objclean + - $(DELETE) depend.dj + +# clean everything +# +realclean vclean: clean + - $(DELETE) libcares.a + - $(DELETE) acountry.exe + - $(DELETE) adig.exe + - $(DELETE) ahost.exe + - $(DELETE) libcares.a -include depend.dj diff --git a/ares/config.dos b/ares/config.dos new file mode 100644 index 000000000..98b176545 --- /dev/null +++ b/ares/config.dos @@ -0,0 +1,176 @@ +#ifndef HEADER_CONFIG_DOS_H +#define HEADER_CONFIG_DOS_H + +/* $Id$ */ + +/* ================================================================ */ +/* ares/config.dos - Hand crafted config file for DOS */ +/* ================================================================ */ + +#if defined(DJGPP) + #define OS "MSDOS/djgpp" +#elif defined(__HIGHC__) + #define OS "MSDOS/HighC" +#elif defined(__WATCOMC__) + #define OS "MSDOS/Watcom" +#else + #define OS "MSDOS/?" +#endif + +#define PACKAGE "c-ares" + +#define HAVE_FCNTL_H 1 +#define HAVE_GETADDRINFO 1 +#define HAVE_GETNAMEINFO 1 +#define HAVE_GETPROTOBYNAME 1 +#define HAVE_GETTIMEOFDAY 1 +#define HAVE_IO_H 1 +#define HAVE_IOCTL 1 +#define HAVE_IOCTL_FIONBIO 1 +#define HAVE_IOCTLSOCKET 1 +#define HAVE_IOCTLSOCKET_FIONBIO 1 +#define HAVE_LIMITS_H 1 +#define HAVE_LOCALE_H 1 +#define HAVE_LONGLONG 1 +#define HAVE_MEMORY_H 1 +#define HAVE_NET_IF_H 1 +#define HAVE_PROCESS_H 1 +#define HAVE_RECV 1 +#define HAVE_RECVFROM 1 +#define HAVE_SELECT 1 +#define HAVE_SEND 1 +#define HAVE_SETJMP_H 1 +#define HAVE_SETLOCALE 1 +#define HAVE_SETMODE 1 +#define HAVE_SIGNAL 1 +#define HAVE_SOCKET 1 +#define HAVE_SPNEGO 1 +#define HAVE_STRDUP 1 +#define HAVE_STRICMP 1 +#define HAVE_STRTOLL 1 +#define HAVE_STRUCT_TIMEVAL 1 +#define HAVE_STRUCT_IN6_ADDR 1 +#define HAVE_SYS_IOCTL_H 1 +#define HAVE_SYS_SOCKET_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_TERMIOS_H 1 +#define HAVE_TIME_H 1 +#define HAVE_UNISTD_H 1 + +#define NEED_MALLOC_H 1 + +#define RETSIGTYPE void +#define SIZEOF_LONG_DOUBLE 16 +#define STDC_HEADERS 1 +#define TIME_WITH_SYS_TIME 1 + +/* Qualifiers for send(), recv(), recvfrom() and getnameinfo(). */ + +#define SEND_TYPE_ARG1 int +#define SEND_QUAL_ARG2 const +#define SEND_TYPE_ARG2 void * +#define SEND_TYPE_ARG3 int +#define SEND_TYPE_ARG4 int +#define SEND_TYPE_RETV int + +#define RECV_TYPE_ARG1 int +#define RECV_TYPE_ARG2 void * +#define RECV_TYPE_ARG3 int +#define RECV_TYPE_ARG4 int +#define RECV_TYPE_RETV int + +#define RECVFROM_TYPE_ARG1 int +#define RECVFROM_TYPE_ARG2 void +#define RECVFROM_TYPE_ARG3 int +#define RECVFROM_TYPE_ARG4 int +#define RECVFROM_TYPE_ARG5 struct sockaddr +#define RECVFROM_TYPE_ARG6 int +#define RECVFROM_TYPE_RETV int +#define RECVFROM_TYPE_ARG2_IS_VOID 1 + +#define GETNAMEINFO_QUAL_ARG1 const +#define GETNAMEINFO_TYPE_ARG1 struct sockaddr * +#define GETNAMEINFO_TYPE_ARG2 int +#define GETNAMEINFO_TYPE_ARG46 int +#define GETNAMEINFO_TYPE_ARG7 int + +#define BSD + +/* USE_ZLIB on cmd-line */ +#ifdef USE_ZLIB + #define HAVE_ZLIB_H 1 + #define HAVE_LIBZ 1 +#endif + +/* USE_SSLEAY on cmd-line */ +#ifdef USE_SSLEAY + #define HAVE_CRYPTO_CLEANUP_ALL_EX_DATA 1 + #define HAVE_OPENSSL_ENGINE_H 1 + #define OPENSSL_NO_KRB5 1 + #define USE_OPENSSL 1 +#endif + +/* to disable LDAP */ +#define CURL_DISABLE_LDAP 1 + +#define in_addr_t u_long + +#if defined(__HIGHC__) || \ + (defined(__GNUC__) && (__GNUC__ < 4)) +#define ssize_t int +#endif + +#define CURL_CA_BUNDLE getenv("CURL_CA_BUNDLE") + +/* Target HAVE_x section */ + +#if defined(DJGPP) + #define HAVE_BASENAME 1 + #define HAVE_STRCASECMP 1 + #define HAVE_STRNCASECMP 1 + #define HAVE_SIGACTION 1 + #define HAVE_SIGSETJMP 1 + #define HAVE_SYS_TIME_H 1 + #define HAVE_VARIADIC_MACROS_GCC 1 + + #if (DJGPP_MINOR >= 4) + #define HAVE_STRLCAT 1 + #endif + + /* Because djgpp <= 2.03 doesn't have snprintf() etc. */ + #if (DJGPP_MINOR < 4) + #define _MPRINTF_REPLACE + #endif + +#elif defined(__WATCOMC__) + #define HAVE_STRCASECMP 1 + +#elif defined(__HIGHC__) + #define HAVE_SYS_TIME_H 1 +#endif + +#ifdef WATT32 + #define HAVE_AF_INET6 1 + #define HAVE_ARPA_INET_H 1 + #define HAVE_ARPA_NAMESER_H 1 + #define HAVE_GETHOSTNAME 1 + #define HAVE_NETDB_H 1 + #define HAVE_NETINET_IN_H 1 + #define HAVE_NETINET_TCP_H 1 + #define HAVE_PF_INET6 1 + #define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 + #define HAVE_STRUCT_ADDRINFO 1 + #define HAVE_STRUCT_IN6_ADDR 1 + #define HAVE_STRUCT_SOCKADDR_IN6 1 + #define HAVE_SYS_SOCKET_H 1 + #define HAVE_SYS_UIO_H 1 + #define NS_INADDRSZ 4 + #define HAVE_STRUCT_SOCKADDR_IN6 1 +#endif + +#undef word +#undef byte + +#endif /* HEADER_CONFIG_DOS_H */ + -- cgit v1.2.3