Reorganize source tree (#349)

Originally started by Daniel Stenberg (@bagder) with #123, this patch reorganizes the c-ares source tree to have a more modern layout.  It also fixes out of tree builds for autotools, and automatically builds the tests if tests are enabled.  All tests are passing which tests each of the supported build systems (autotools, cmake, nmake, mingw gmake).  There may be some edge cases that will have to be caught later on for things I'm not aware of.

Fix By: Brad House (@bradh352)
pull/354/head
Brad House 4 years ago committed by GitHub
parent abe1ff1ff3
commit 0bf721cdd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      .travis.yml
  2. 165
      CMakeLists.txt
  3. 158
      Makefile.am
  4. 33
      Makefile.m32
  5. 59
      Makefile.msvc
  6. 4
      appveyor.yml
  7. 2
      buildconf
  8. 23
      configure.ac
  9. 17
      docs/CMakeLists.txt
  10. 51
      docs/Makefile.am
  11. 90
      docs/Makefile.inc
  12. 0
      docs/acountry.1
  13. 0
      docs/adig.1
  14. 0
      docs/ahost.1
  15. 0
      docs/ares_cancel.3
  16. 0
      docs/ares_create_query.3
  17. 0
      docs/ares_destroy.3
  18. 0
      docs/ares_destroy_options.3
  19. 0
      docs/ares_dup.3
  20. 0
      docs/ares_expand_name.3
  21. 0
      docs/ares_expand_string.3
  22. 0
      docs/ares_fds.3
  23. 0
      docs/ares_free_data.3
  24. 0
      docs/ares_free_hostent.3
  25. 0
      docs/ares_free_string.3
  26. 0
      docs/ares_freeaddrinfo.3
  27. 0
      docs/ares_get_servers.3
  28. 0
      docs/ares_get_servers_ports.3
  29. 0
      docs/ares_getaddrinfo.3
  30. 0
      docs/ares_gethostbyaddr.3
  31. 0
      docs/ares_gethostbyname.3
  32. 0
      docs/ares_gethostbyname_file.3
  33. 0
      docs/ares_getnameinfo.3
  34. 0
      docs/ares_getsock.3
  35. 0
      docs/ares_inet_ntop.3
  36. 0
      docs/ares_inet_pton.3
  37. 0
      docs/ares_init.3
  38. 0
      docs/ares_init_options.3
  39. 0
      docs/ares_library_cleanup.3
  40. 0
      docs/ares_library_init.3
  41. 0
      docs/ares_library_init_android.3
  42. 0
      docs/ares_library_initialized.3
  43. 0
      docs/ares_mkquery.3
  44. 0
      docs/ares_parse_a_reply.3
  45. 0
      docs/ares_parse_aaaa_reply.3
  46. 0
      docs/ares_parse_mx_reply.3
  47. 0
      docs/ares_parse_naptr_reply.3
  48. 0
      docs/ares_parse_ns_reply.3
  49. 0
      docs/ares_parse_ptr_reply.3
  50. 0
      docs/ares_parse_soa_reply.3
  51. 0
      docs/ares_parse_srv_reply.3
  52. 0
      docs/ares_parse_txt_reply.3
  53. 0
      docs/ares_process.3
  54. 0
      docs/ares_query.3
  55. 0
      docs/ares_save_options.3
  56. 0
      docs/ares_search.3
  57. 0
      docs/ares_send.3
  58. 0
      docs/ares_set_local_dev.3
  59. 0
      docs/ares_set_local_ip4.3
  60. 0
      docs/ares_set_local_ip6.3
  61. 0
      docs/ares_set_servers.3
  62. 0
      docs/ares_set_servers_csv.3
  63. 0
      docs/ares_set_servers_ports.3
  64. 0
      docs/ares_set_servers_ports_csv.3
  65. 0
      docs/ares_set_socket_callback.3
  66. 0
      docs/ares_set_socket_configure_callback.3
  67. 0
      docs/ares_set_socket_functions.3
  68. 0
      docs/ares_set_sortlist.3
  69. 0
      docs/ares_strerror.3
  70. 0
      docs/ares_timeout.3
  71. 0
      docs/ares_version.3
  72. 8
      include/CMakeLists.txt
  73. 7
      include/Makefile.am
  74. 0
      include/ares.h
  75. 0
      include/ares_build.h.cmake
  76. 0
      include/ares_build.h.dist
  77. 0
      include/ares_build.h.in
  78. 0
      include/ares_rules.h
  79. 0
      include/ares_version.h
  80. 12
      maketgz
  81. 2
      src/CMakeLists.txt
  82. 2
      src/Makefile.am
  83. 115
      src/lib/CMakeLists.txt
  84. 72
      src/lib/Makefile.am
  85. 79
      src/lib/Makefile.inc
  86. 0
      src/lib/ares__close_sockets.c
  87. 0
      src/lib/ares__get_hostent.c
  88. 0
      src/lib/ares__parse_into_addrinfo.c
  89. 0
      src/lib/ares__read_line.c
  90. 0
      src/lib/ares__readaddrinfo.c
  91. 0
      src/lib/ares__sortaddrinfo.c
  92. 0
      src/lib/ares__timeval.c
  93. 0
      src/lib/ares_android.c
  94. 0
      src/lib/ares_android.h
  95. 0
      src/lib/ares_cancel.c
  96. 0
      src/lib/ares_config.h.cmake
  97. 0
      src/lib/ares_create_query.c
  98. 0
      src/lib/ares_data.c
  99. 0
      src/lib/ares_data.h
  100. 0
      src/lib/ares_destroy.c
  101. Some files were not shown because too many files have changed in this diff Show More

@ -37,7 +37,7 @@ matrix:
env: BUILD_TYPE=lsan
- os: linux
compiler: clang
env: BUILD_TYPE=analyse
env: BUILD_TYPE=analyze
- os: linux
compiler: gcc
env: BUILD_TYPE=valgrind
@ -64,7 +64,7 @@ install:
before_script:
- |
if [ "$BUILD_TYPE" = "coverage" ]; then
export CONFIG_OPTS="--enable-debug --disable-shared --enable-code-coverage"
export CONFIG_OPTS="--enable-debug --disable-shared --enable-code-coverage --enable-tests"
fi
- |
if [ "$BUILD_TYPE" = "asan" ]; then
@ -86,9 +86,9 @@ before_script:
export LDFLAGS="-fsanitize=undefined"
fi
- |
if [ "$BUILD_TYPE" = "analyse" ]; then
if [ "$BUILD_TYPE" = "analyze" ]; then
export SCAN_WRAP="scan-build-7 --status-bugs"
export CONFIG_OPTS="--enable-debug"
export CONFIG_OPTS="--enable-debug --disable-tests"
export CXX="clang++-7"
export CC="clang-7"
fi
@ -100,7 +100,7 @@ before_script:
fi
- |
if [ "$BUILD_TYPE" = "ios" ]; then
export CONFIG_OPTS=--host=arm-apple-darwin10
export CONFIG_OPTS="--host=arm-apple-darwin10 --disable-tests"
export DEVPATH=`xcode-select -print-path`/Platforms/iPhoneOS.platform/Developer
export IOSFLAGS="-isysroot $DEVPATH/SDKs/iPhoneOS.sdk -arch armv7 -miphoneos-version-min=8.0.0"
export CFLAGS=$IOSFLAGS

@ -548,11 +548,8 @@ IF (HAVE_WINDOWS_H)
SET (CARES_HAVE_WINDOWS_H 1)
ENDIF()
# Write ares_build.h configuration file. This is an installed file.
CONFIGURE_FILE (ares_build.h.cmake ${PROJECT_BINARY_DIR}/ares_build.h)
# Write ares_config.h configuration file. This is used only for the build.
CONFIGURE_FILE (ares_config.h.cmake ${PROJECT_BINARY_DIR}/ares_config.h)
# Record toplevel CMakeLists.txt path
set(CARES_TOPLEVEL_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
# TRANSFORM_MAKEFILE_INC
@ -586,124 +583,21 @@ function(TRANSFORM_MAKEFILE_INC INPUT_FILE OUTPUT_FILE)
file(WRITE ${OUTPUT_FILE} ${MAKEFILE_INC_TEXT})
endfunction()
# run the function...
transform_makefile_inc("Makefile.inc" "${PROJECT_BINARY_DIR}/Makefile.inc.cmake")
include(${PROJECT_BINARY_DIR}/Makefile.inc.cmake)
# Build the dynamic/shared library
IF (CARES_SHARED)
ADD_LIBRARY (${PROJECT_NAME} SHARED ${CSOURCES})
# Convert CARES_LIB_VERSIONINFO libtool version format into VERSION and SOVERSION
# Convert from ":" separated into CMake list format using ";"
STRING (REPLACE ":" ";" CARES_LIB_VERSIONINFO ${CARES_LIB_VERSIONINFO})
LIST (GET CARES_LIB_VERSIONINFO 0 CARES_LIB_VERSION_CURRENT)
LIST (GET CARES_LIB_VERSIONINFO 1 CARES_LIB_VERSION_REVISION)
LIST (GET CARES_LIB_VERSIONINFO 2 CARES_LIB_VERSION_AGE)
MATH (EXPR CARES_LIB_VERSION_MAJOR "${CARES_LIB_VERSION_CURRENT} - ${CARES_LIB_VERSION_AGE}")
SET (CARES_LIB_VERSION_MINOR "${CARES_LIB_VERSION_AGE}")
SET (CARES_LIB_VERSION_RELEASE "${CARES_LIB_VERSION_REVISION}")
SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES
EXPORT_NAME cares
OUTPUT_NAME cares
COMPILE_PDB_NAME cares
COMPILE_PDB_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
SOVERSION ${CARES_LIB_VERSION_MAJOR}
VERSION "${CARES_LIB_VERSION_MAJOR}.${CARES_LIB_VERSION_MINOR}.${CARES_LIB_VERSION_RELEASE}"
)
TARGET_INCLUDE_DIRECTORIES (${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>")
TARGET_INCLUDE_DIRECTORIES (${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>")
TARGET_INCLUDE_DIRECTORIES (${PROJECT_NAME} PUBLIC "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
TARGET_COMPILE_DEFINITIONS (${PROJECT_NAME} PRIVATE HAVE_CONFIG_H=1 CARES_BUILDING_LIBRARY)
TARGET_LINK_LIBRARIES (${PROJECT_NAME} PUBLIC ${CARES_DEPENDENT_LIBS})
IF (CARES_INSTALL)
INSTALL (TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}-targets
COMPONENT Library
${TARGETS_INST_DEST}
)
INSTALL(FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/cares.pdb
DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT Library
OPTIONAL
)
ENDIF ()
SET (STATIC_SUFFIX "_static")
# For chain building: add alias targets that look like import libs that would be returned by find_package(c-ares).
ADD_LIBRARY (${PROJECT_NAME}::cares_shared ALIAS ${PROJECT_NAME})
ADD_LIBRARY (${PROJECT_NAME}::cares ALIAS ${PROJECT_NAME})
ENDIF ()
# Build the static library
IF (CARES_STATIC)
SET (LIBNAME ${PROJECT_NAME}${STATIC_SUFFIX})
ADD_LIBRARY (${LIBNAME} STATIC ${CSOURCES})
SET_TARGET_PROPERTIES (${LIBNAME} PROPERTIES
EXPORT_NAME cares${STATIC_SUFFIX}
OUTPUT_NAME cares${STATIC_SUFFIX}
COMPILE_PDB_NAME cares${STATIC_SUFFIX}
COMPILE_PDB_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
)
IF (CARES_STATIC_PIC)
SET_TARGET_PROPERTIES (${LIBNAME} PROPERTIES POSITION_INDEPENDENT_CODE True)
ENDIF ()
# Directory for includes
ADD_SUBDIRECTORY (include)
TARGET_INCLUDE_DIRECTORIES (${LIBNAME} PUBLIC "$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>")
TARGET_INCLUDE_DIRECTORIES (${LIBNAME} PUBLIC "$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>")
TARGET_INCLUDE_DIRECTORIES (${LIBNAME} PUBLIC "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
TARGET_COMPILE_DEFINITIONS (${LIBNAME}
PUBLIC CARES_STATICLIB
PRIVATE HAVE_CONFIG_H=1
)
TARGET_LINK_LIBRARIES (${LIBNAME} PUBLIC ${CARES_DEPENDENT_LIBS})
IF (CARES_INSTALL)
INSTALL (TARGETS ${LIBNAME} EXPORT ${PROJECT_NAME}-targets COMPONENT Devel
${TARGETS_INST_DEST}
)
INSTALL(FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/cares${STATIC_SUFFIX}.pdb
DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT Library
OPTIONAL
)
ENDIF ()
# Directory for lib and tools
ADD_SUBDIRECTORY (src)
# For chain building: add alias targets that look like import libs that would be returned by find_package(c-ares).
ADD_LIBRARY (${PROJECT_NAME}::cares_static ALIAS ${LIBNAME})
IF (NOT TARGET ${PROJECT_NAME}::cares)
# Only use static for the generic alias if shared lib wasn't built.
ADD_LIBRARY (${PROJECT_NAME}::cares ALIAS ${LIBNAME})
ENDIF ()
ENDIF ()
# Docs
ADD_SUBDIRECTORY (docs)
# Tests
IF (CARES_BUILD_TESTS OR CARES_BUILD_CONTAINER_TESTS)
ENABLE_TESTING ()
ADD_SUBDIRECTORY (test)
ENDIF ()
# Headers and Man Pages installation target
IF (CARES_INSTALL)
SET (CARES_HEADERS ares.h ares_version.h ares_dns.h "${PROJECT_BINARY_DIR}/ares_build.h" ares_rules.h)
INSTALL (FILES ${CARES_HEADERS} COMPONENT Devel DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
# ManPages
FILE (GLOB DevelManPages "." "*.3")
INSTALL (FILES ${DevelManPages}
DESTINATION ${CMAKE_INSTALL_MANDIR}/man3
COMPONENT Devel
)
ENDIF ()
# Export targets
IF (CARES_INSTALL)
@ -730,53 +624,15 @@ IF (CARES_INSTALL)
INSTALL (FILES "${CMAKE_CURRENT_BINARY_DIR}/libcares.pc" COMPONENT Devel DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
ENDIF ()
# Legacy chain-building variables (provided for compatibility with old code).
# Don't use these, external code should be updated to refer to the aliases directly (e.g., Cares::cares).
SET (CARES_FOUND 1 CACHE INTERNAL "CARES LIBRARY FOUND")
SET (CARES_LIBRARIES ${PROJECT_NAME}::cares CACHE INTERNAL "CARES LIBRARIES")
IF (CARES_BUILD_TOOLS)
# Build ahost
ADD_EXECUTABLE (ahost ahost.c ${SAMPLESOURCES})
TARGET_COMPILE_DEFINITIONS (ahost PRIVATE HAVE_CONFIG_H=1)
TARGET_LINK_LIBRARIES (ahost PRIVATE ${PROJECT_NAME})
IF (CARES_INSTALL)
INSTALL (TARGETS ahost COMPONENT Tools ${TARGETS_INST_DEST})
ENDIF ()
# Build adig
ADD_EXECUTABLE (adig adig.c ${SAMPLESOURCES})
TARGET_COMPILE_DEFINITIONS (adig PRIVATE HAVE_CONFIG_H=1)
TARGET_LINK_LIBRARIES (adig PRIVATE ${PROJECT_NAME})
IF (CARES_INSTALL)
INSTALL (TARGETS adig COMPONENT Tools ${TARGETS_INST_DEST})
ENDIF ()
# Build acountry
ADD_EXECUTABLE (acountry acountry.c ${SAMPLESOURCES})
TARGET_COMPILE_DEFINITIONS (acountry PRIVATE HAVE_CONFIG_H=1)
TARGET_LINK_LIBRARIES (acountry PRIVATE ${PROJECT_NAME})
IF (CARES_INSTALL)
INSTALL (TARGETS acountry COMPONENT Tools ${TARGETS_INST_DEST})
ENDIF ()
# Install Man Pages
IF (CARES_INSTALL)
FILE (GLOB ToolManPages "." "*.1")
INSTALL (FILES ${ToolManPages}
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1
COMPONENT Tools
)
ENDIF ()
ENDIF ()
IF (CARES_INSTALL)
# Package creation
set( CPACK_PACKAGE_NAME ${PROJECT_NAME} )
set( CPACK_PACKAGE_VENDOR "Daniel Stenberg" ) # Github project owner
set( CPACK_PACKAGE_DESCRIPTION_SUMMARY "A C library for asynchronous DNS requests" )
@ -877,7 +733,6 @@ IF (CARES_INSTALL)
set( CPACK_NSIS_URL_INFO_ABOUT ${CPACK_PACKAGE_HOMEPAGE_URL} )
endif()
# This must always be last!
include( CPack )
ENDIF ()

@ -1,56 +1,27 @@
AUTOMAKE_OPTIONS = foreign nostdinc
ACLOCAL_AMFLAGS = -I m4
# Specify our include paths here, and do it relative to $(top_srcdir) and
# $(top_builddir), to ensure that these paths which belong to the library
# being currently built and tested are searched before the library which
# might possibly already be installed in the system.
#
# When using the low-level hard-hacking memory leak tracking code from
# libcurl the generated curl/curlbuild.h file must also be reachable.
# Using the libcurl lowlevel code from within c-ares library is ugly and
# only works when c-ares is built and linked with a similarly debug-build
# libcurl, but we do this anyway for convenience.
#
# $(top_builddir)/../include/curl for generated curlbuild.h included from curl.h
# $(top_builddir)/../include is for libcurl's generated curl/curlbuild.h file
# $(top_srcdir)/../include is for libcurl's external include files
# $(top_builddir)/../lib is for libcurl's generated lib/curl_config.h file
# $(top_srcdir)/../lib is for libcurl's lib/setup.h and other "private" files
# $(top_builddir) is for c-ares's generated ares_config.h file
# $(top_srcdir) is for c-ares's ares_setup.h and other "c-ares-private" files
AM_CPPFLAGS = -I$(top_builddir) \
-I$(top_srcdir)
lib_LTLIBRARIES = libcares.la
man_MANS = $(MANPAGES)
AUTOMAKE_OPTIONS = foreign nostdinc 1.9.6
ACLOCAL_AMFLAGS = -I m4 --install
MSVCFILES = vc/vc6aws.dsw vc/acountry/vc6acountry.dsp vc/adig/vc6adig.dsp \
vc/ahost/vc6ahost.dsp vc/cares/vc6cares.dsp vc/cares/vc6cares.dsw \
msvc_ver.inc
PROGS = ahost adig acountry
noinst_PROGRAMS =$(PROGS)
# adig and ahost are just sample programs and thus not mentioned with the
# regular sources and headers
EXTRA_DIST = AUTHORS CHANGES README.cares Makefile.inc Makefile.dj \
Makefile.m32 Makefile.netware Makefile.msvc Makefile.Watcom $(man_MANS) \
config-win32.h RELEASE-NOTES libcares.pc.in buildconf get_ver.awk maketgz \
TODO ares_build.h.in cares.rc README.msvc $(MSVCFILES) \
$(CSOURCES) $(HHEADERS) config-dos.h acountry.1 adig.1 ahost.1 INSTALL.md \
CMakeLists.txt ares_build.h.cmake ares_config.h.cmake c-ares-config.cmake.in \
libcares.pc.cmake README.md LICENSE.md RELEASE-PROCEDURE.md
EXTRA_DIST = AUTHORS CHANGES README.cares $(man_MANS) RELEASE-NOTES \
libcares.pc.in buildconf get_ver.awk maketgz TODO README.msvc \
$(MSVCFILES) INSTALL.md README.md LICENSE.md \
CMakeLists.txt \
Makefile.dj Makefile.m32 Makefile.netware Makefile.msvc Makefile.Watcom \
AUTHORS CONTRIBUTING.md SECURITY.md TODO
CLEANFILES = $(PDFPAGES) $(HTMLPAGES)
DISTCLEANFILES = ares_build.h
DISTCLEANFILES = include/ares_build.h
DIST_SUBDIRS = test
DIST_SUBDIRS = include src test docs
SUBDIRS = @BUILD_SUBDIRS@
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libcares.pc
@ -84,112 +55,9 @@ CARES_VERSION_INFO = -version-info 6:1:4
# set age to 0. (c:r:a=0)
#
AM_LDFLAGS =
libcares_la_LDFLAGS_EXTRA =
if CARES_LT_SHLIB_USE_VERSION_INFO
libcares_la_LDFLAGS_EXTRA += $(CARES_VERSION_INFO)
endif
if CARES_LT_SHLIB_USE_NO_UNDEFINED
libcares_la_LDFLAGS_EXTRA += -no-undefined
endif
if CARES_LT_SHLIB_USE_MIMPURE_TEXT
libcares_la_LDFLAGS_EXTRA += -mimpure-text
endif
libcares_la_LDFLAGS = $(AM_LDFLAGS) $(libcares_la_LDFLAGS_EXTRA)
# Add -Werror if defined
CFLAGS += @CARES_CFLAG_EXTRAS@
if USE_CPPFLAG_CARES_STATICLIB
AM_CPPFLAGS += $(CPPFLAG_CARES_STATICLIB)
endif
libcares_la_CFLAGS_EXTRA =
libcares_la_CPPFLAGS_EXTRA = -DCARES_BUILDING_LIBRARY
if DOING_CARES_SYMBOL_HIDING
libcares_la_CFLAGS_EXTRA += $(CFLAG_CARES_SYMBOL_HIDING)
libcares_la_CPPFLAGS_EXTRA += -DCARES_SYMBOL_HIDING
endif
@CODE_COVERAGE_RULES@
libcares_la_LDFLAGS += $(CODE_COVERAGE_LDFLAGS)
libcares_la_CFLAGS_EXTRA += $(CODE_COVERAGE_CFLAGS)
libcares_la_CFLAGS = $(AM_CFLAGS) $(libcares_la_CFLAGS_EXTRA)
libcares_la_CPPFLAGS = $(AM_CPPFLAGS) $(libcares_la_CPPFLAGS_EXTRA)
# Makefile.inc provides the CSOURCES and HHEADERS defines
include Makefile.inc
libcares_la_SOURCES = $(CSOURCES) $(HHEADERS)
# where to install the c-ares headers
libcares_ladir = $(includedir)
# what headers to install on 'make install':
libcares_la_HEADERS = ares.h ares_version.h ares_dns.h \
ares_build.h ares_rules.h
ahost_SOURCES = ahost.c $(SAMPLESOURCES) $(SAMPLEHEADERS)
ahost_LDADD = $(top_builddir)/libcares.la
ahost_CFLAGS = $(AM_CFLAGS)
ahost_CPPFLAGS = $(AM_CPPFLAGS)
adig_SOURCES = adig.c $(SAMPLESOURCES) $(SAMPLEHEADERS)
adig_LDADD = $(top_builddir)/libcares.la
adig_CFLAGS = $(AM_CFLAGS)
adig_CPPFLAGS = $(AM_CPPFLAGS)
acountry_SOURCES = acountry.c $(SAMPLESOURCES) $(SAMPLEHEADERS)
acountry_LDADD = $(top_builddir)/libcares.la
acountry_CFLAGS = $(AM_CFLAGS)
acountry_CPPFLAGS = $(AM_CPPFLAGS)
SOURCEDMANDIR = man3
SOURCEDMANPAGES = ares_init.3
clean-local: clean-sourced-manpages
clean-sourced-manpages:
@srcdmandir='$(SOURCEDMANDIR)'; \
echo "rm -rf $(top_builddir)/$$srcdmandir"; \
rm -rf $(top_builddir)/$$srcdmandir
sourced-manpages: clean-sourced-manpages
@srcdmandir='$(SOURCEDMANDIR)'; \
srcdmanfiles='$(SOURCEDMANPAGES)'; \
mkdir $(top_builddir)/$$srcdmandir; \
for file in $$srcdmanfiles; do \
if test -f $(top_srcdir)/$$file; then \
echo "cp $(top_srcdir)/$$file $(top_builddir)/$$srcdmandir/$$file"; \
cp $(top_srcdir)/$$file $(top_builddir)/$$srcdmandir/$$file; \
fi; \
done
MAN2HTML = roffit --mandir=. < $< >$@
SUFFIXES = .3 .html
html: sourced-manpages $(HTMLPAGES)
.3.html:
$(MAN2HTML)
pdf: sourced-manpages $(PDFPAGES)
.3.pdf:
@(foo=`echo $@ | sed -e 's/\.[0-9]$$//g'`; \
groff -Tps -man $< >$$foo.ps; \
ps2pdf $$foo.ps $@; \
rm $$foo.ps; \
echo "converted $< to $@")
# Make files named *.dist replace the file without .dist extension
dist-hook:

@ -8,7 +8,7 @@
########################################################
## Nothing more to do below this line!
LIB = libcares.a
LIB = src/lib/libcares.a
AR = $(CROSSPREFIX)ar
CC = $(CROSSPREFIX)gcc
@ -17,15 +17,15 @@ RANLIB = $(CROSSPREFIX)ranlib
#RM = rm -f
CP = cp -afv
CFLAGS = $(CARES_CFLAG_EXTRAS) -O2 -Wall -I. -D_WIN32_WINNT=0x0600
CFLAGS = $(CARES_CFLAG_EXTRAS) -O2 -Wall -I./include -I./src/lib -D_WIN32_WINNT=0x0600
CFLAGS += -DCARES_STATICLIB
LDFLAGS = $(CARES_LDFLAG_EXTRAS) -s
LIBS = -lwsock32
# Makefile.inc provides the CSOURCES and HHEADERS defines
include Makefile.inc
include src/lib/Makefile.inc
OBJLIB := $(patsubst %.c,%.o,$(strip $(CSOURCES)))
OBJLIB := $(patsubst %.c,src/lib/%.o,$(strip $(CSOURCES)))
$(LIB): $(OBJLIB)
@ -34,21 +34,21 @@ $(LIB): $(OBJLIB)
all: $(LIB) demos
demos: adig.exe ahost.exe acountry.exe
demos: src/tools/adig.exe src/tools/ahost.exe src/tools/acountry.exe
tags:
etags *.[ch]
%.exe: %.o ares_getopt.o $(LIB)
%.exe: %.o src/tools/ares_getopt.o $(LIB)
$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
$(OBJLIB): ares.h ares_dns.h ares_private.h ares_build.h ares_rules.h
$(OBJLIB): include/ares.h src/lib/ares_dns.h include/ares_build.h
.c.o:
$(CC) $(CFLAGS) -c $<
$(CC) $(CFLAGS) -o $@ -c $<
ares_build.h:
$(CP) ares_build.h.dist ares_build.h
include/ares_build.h:
$(CP) include/ares_build.h.dist include/ares_build.h
check:
@ -59,18 +59,19 @@ install:
${INSTALL} -m 644 $(LIB) ${DESTDIR}${libdir}
${RANLIB} ${DESTDIR}${libdir}/$(LIB)
chmod u-w ${DESTDIR}${libdir}/$(LIB)
${INSTALL} -m 444 ${srcdir}/ares.h ${DESTDIR}${includedir}
${INSTALL} -m 444 ${srcdir}/ares_build.h ${DESTDIR}${includedir}
${INSTALL} -m 444 ${srcdir}/ares_rules.h ${DESTDIR}${includedir}
${INSTALL} -m 444 ${srcdir}/include/ares.h ${DESTDIR}${includedir}
${INSTALL} -m 444 ${srcdir}/include/ares_build.h ${DESTDIR}${includedir}
${INSTALL} -m 444 ${srcdir}/include/ares_rules.h ${DESTDIR}${includedir}
${INSTALL} -m 444 ${srcdir}/include/ares_version.h ${DESTDIR}${includedir}
(for man in $(MANPAGES); do \
${INSTALL} -m 444 ${srcdir}/$${man} ${DESTDIR}${mandir}/man3; \
done)
clean:
$(RM) ares_getopt.o $(OBJLIB) $(LIB) adig.exe ahost.exe acountry.exe
$(RM) src/tools/ares_getopt.o $(OBJLIB) $(LIB) src/tools/adig.exe src/tools/ahost.exe src/tools/acountry.exe
distclean: clean
$(RM) config.cache config.log config.status Makefile
ifeq "$(wildcard ares_build.h.dist)" "ares_build.h.dist"
$(RM) ares_build.h
ifeq "$(wildcard include/ares_build.h.dist)" "include/ares_build.h.dist"
$(RM) include/ares_build.h
endif

@ -80,7 +80,7 @@ USE_WATT32 = 0
# Verify that current subdir is the c-ares source one
# ----------------------------------------------------
!IF ! EXIST(.\ares_init.c)
!IF ! EXIST(.\src\lib\ares_init.c)
! MESSAGE Can not process Makefile.msvc from outside of c-ares source subdirectory.
! MESSAGE Change to the subdirectory where Makefile.msvc is found, and try again.
! ERROR See previous message.
@ -212,7 +212,7 @@ RT_ERROR_CHECKING = /RTCsu
CC_CMD_REL = cl.exe /nologo $(RTLIB) /DNDEBUG /O2
CC_CMD_DBG = cl.exe /nologo $(RTLIBD) /D_DEBUG /Od /Zi $(RT_ERROR_CHECKING)
CC_CFLAGS = $(CFLAGS) /I. /W3 /EHsc /FD
CC_CFLAGS = $(CFLAGS) /I.\src\lib /I.\include /W3 /EHsc /FD
RC_CMD_REL = rc.exe /l 0x409 /d "NDEBUG"
RC_CMD_DBG = rc.exe /l 0x409 /d "_DEBUG"
@ -280,7 +280,8 @@ RC_CMD = $(RC_CMD_DBG)
# Makefile.inc provides lists of source files
# --------------------------------------------
!INCLUDE .\Makefile.inc
!INCLUDE .\src\lib\Makefile.inc
!INCLUDE .\src\tools\Makefile.inc
# ----------------------------
# Build lists of object files
@ -308,6 +309,7 @@ CARES_OBJS = $(CARES_OBJS) $(CARES_OBJDIR)\cares.res
!ERROR Problem generating PROG1_OBJS list.
!ENDIF
PROG1_OBJS = $(PROG1_OBJS:.c=.obj)
PROG1_OBJS = $(PROG1_OBJS:/=\)
PROG1_OBJS = $(PROG1_OBJS) $(PROG1_OBJDIR)\acountry.obj
!IF [ECHO PROG2_OBJS=^$(PROG2_OBJDIR)\$(SAMPLESOURCES: = $(PROG2_OBJDIR^)\) > .\prog2_objs.inc] == 0
@ -318,6 +320,7 @@ PROG1_OBJS = $(PROG1_OBJS) $(PROG1_OBJDIR)\acountry.obj
!ERROR Problem generating PROG2_OBJS list.
!ENDIF
PROG2_OBJS = $(PROG2_OBJS:.c=.obj)
PROG2_OBJS = $(PROG2_OBJS:/=\)
PROG2_OBJS = $(PROG2_OBJS) $(PROG2_OBJDIR)\adig.obj
!IF [ECHO PROG3_OBJS=^$(PROG3_OBJDIR)\$(SAMPLESOURCES: = $(PROG3_OBJDIR^)\) > .\prog3_objs.inc] == 0
@ -328,10 +331,12 @@ PROG2_OBJS = $(PROG2_OBJS) $(PROG2_OBJDIR)\adig.obj
!ERROR Problem generating PROG3_OBJS list.
!ENDIF
PROG3_OBJS = $(PROG3_OBJS:.c=.obj)
PROG3_OBJS = $(PROG3_OBJS:/=\)
PROG3_OBJS = $(PROG3_OBJS) $(PROG3_OBJDIR)\ahost.obj
!ENDIF
# --------------------------------
# Only our custom inference rules
# --------------------------------
@ -339,21 +344,33 @@ PROG3_OBJS = $(PROG3_OBJS) $(PROG3_OBJDIR)\ahost.obj
.SUFFIXES:
.SUFFIXES: .c .rc
{$(SRCDIR)}.rc{$(CARES_OBJDIR)}.res:
{$(SRCDIR)\src\lib}.rc{$(CARES_OBJDIR)}.res:
$(RC_CMD) /Fo $@ $<
{$(SRCDIR)}.c{$(CARES_OBJDIR)}.obj:
{$(SRCDIR)\src\lib}.c{$(CARES_OBJDIR)}.obj:
$(CC_CMD) $(CC_CFLAGS) $(CARES_CFLAGS) /Fo$@ /Fd$(@D)\ /c $<
{$(SRCDIR)}.c{$(PROG1_OBJDIR)}.obj:
{$(SRCDIR)\src\tools}.c{$(PROG1_OBJDIR)}.obj:
$(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /Fo$@ /Fd$(@D)\ /c $<
{$(SRCDIR)}.c{$(PROG2_OBJDIR)}.obj:
{$(SRCDIR)\src\tools}.c{$(PROG2_OBJDIR)}.obj:
$(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /Fo$@ /Fd$(@D)\ /c $<
{$(SRCDIR)}.c{$(PROG3_OBJDIR)}.obj:
{$(SRCDIR)\src\tools}.c{$(PROG3_OBJDIR)}.obj:
$(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /Fo$@ /Fd$(@D)\ /c $<
# Hack Alert! we reference ../lib/ files in the Makefile.inc for tools as they
# share some files with the library itself. We need to hack around that here.
{$(SRCDIR)\src\lib}.c{$(PROG1_OBJDIR)\..\lib}.obj:
$(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /Fo$(PROG1_OBJDIR)\$(@F) /Fd$(PROG1_OBJDIR)\ /c $<
{$(SRCDIR)\src\lib}.c{$(PROG2_OBJDIR)\..\lib}.obj:
$(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /Fo$(PROG2_OBJDIR)\$(@F) /Fd$(PROG2_OBJDIR)\ /c $<
{$(SRCDIR)\src\lib}.c{$(PROG3_OBJDIR)\..\lib}.obj:
$(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /Fo$(PROG3_OBJDIR)\$(@F) /Fd$(PROG3_OBJDIR)\ /c $<
# ------------------------------------------------------------- #
# ------------------------------------------------------------- #
# Default target when no CFG library type has been specified, #
@ -389,22 +406,26 @@ install:
ALL: c-ares acountry adig ahost
@
c-ares: $(HHEADERS) $(CSOURCES) $(CARES_OBJDIR) $(CARES_OBJS) $(CARES_OUTDIR)
# $(HHEADERS) $(CSOURCES)
c-ares: $(CARES_OBJDIR) $(CARES_OBJS) $(CARES_OUTDIR)
$(CARES_LINK) $(CARES_LFLAGS) /out:$(CARES_OUTDIR)\$(CARES_TARGET) $(CARES_OBJS)
! IF "$(USE_RES_FILE)" == "TRUE"
@if exist $(CARES_OUTDIR)\$(CARES_TARGET).manifest mt -nologo -manifest $(CARES_OUTDIR)\$(CARES_TARGET).manifest -outputresource:$(CARES_OUTDIR)\$(CARES_TARGET);2
! ENDIF
acountry: c-ares acountry.c $(SAMPLESOURCES) $(SAMPLEHEADERS) $(PROG1_OBJDIR) $(PROG1_OBJS) $(PROG1_OUTDIR)
$(SPROG_LINK) $(SPROG_LFLAGS) /out:$(PROG1_OUTDIR)\acountry.exe $(PROG1_OBJS)
# acountry.c $(SAMPLESOURCES) $(SAMPLEHEADERS)
acountry: c-ares $(PROG1_OBJDIR) $(PROG1_OBJS) $(PROG1_OUTDIR)
$(SPROG_LINK) $(SPROG_LFLAGS) /out:$(PROG1_OUTDIR)\acountry.exe $(PROG1_OBJS:..\lib=)
@if exist $(PROG1_OUTDIR)\acountry.exe.manifest mt -nologo -manifest $(PROG1_OUTDIR)\acountry.exe.manifest -outputresource:$(PROG1_OUTDIR)\acountry.exe;1
adig: c-ares adig.c $(SAMPLESOURCES) $(SAMPLEHEADERS) $(PROG2_OBJDIR) $(PROG2_OBJS) $(PROG2_OUTDIR)
$(SPROG_LINK) $(SPROG_LFLAGS) /out:$(PROG2_OUTDIR)\adig.exe $(PROG2_OBJS)
# adig.c $(SAMPLESOURCES) $(SAMPLEHEADERS)
adig: c-ares $(PROG2_OBJDIR) $(PROG2_OBJS) $(PROG2_OUTDIR)
$(SPROG_LINK) $(SPROG_LFLAGS) /out:$(PROG2_OUTDIR)\adig.exe $(PROG2_OBJS:..\lib=)
@if exist $(PROG2_OUTDIR)\adig.exe.manifest mt -nologo -manifest $(PROG2_OUTDIR)\adig.exe.manifest -outputresource:$(PROG2_OUTDIR)\adig.exe;1
ahost: c-ares ahost.c $(SAMPLESOURCES) $(SAMPLEHEADERS) $(PROG3_OBJDIR) $(PROG3_OBJS) $(PROG3_OUTDIR)
$(SPROG_LINK) $(SPROG_LFLAGS) /out:$(PROG3_OUTDIR)\ahost.exe $(PROG3_OBJS)
# ahost.c $(SAMPLESOURCES) $(SAMPLEHEADERS)
ahost: c-ares $(PROG3_OBJDIR) $(PROG3_OBJS) $(PROG3_OUTDIR)
$(SPROG_LINK) $(SPROG_LFLAGS) /out:$(PROG3_OUTDIR)\ahost.exe $(PROG3_OBJS:..\lib=)
@if exist $(PROG3_OUTDIR)\ahost.exe.manifest mt -nologo -manifest $(PROG3_OUTDIR)\ahost.exe.manifest -outputresource:$(PROG3_OUTDIR)\ahost.exe;1
$(CARES_OUTDIR): $(CARES_DIR)
@ -444,10 +465,10 @@ install:
@if not exist "$(INSTALL_DIR_LIB)" mkdir "$(INSTALL_DIR_LIB)"
@if not exist "$(INSTALL_DIR_INC)" mkdir "$(INSTALL_DIR_INC)"
@copy /y $(CARES_OUTDIR)\*.* "$(INSTALL_DIR_LIB)" >NUL
@copy /y $(SRCDIR)\ares.h "$(INSTALL_DIR_INC)" >NUL
@copy /y $(SRCDIR)\ares_build.h "$(INSTALL_DIR_INC)" >NUL
@copy /y $(SRCDIR)\ares_rules.h "$(INSTALL_DIR_INC)" >NUL
@copy /y $(SRCDIR)\ares_version.h "$(INSTALL_DIR_INC)" >NUL
@copy /y $(SRCDIR)\include\ares.h "$(INSTALL_DIR_INC)" >NUL
@copy /y $(SRCDIR)\include\ares_build.h "$(INSTALL_DIR_INC)" >NUL
@copy /y $(SRCDIR)\include\ares_rules.h "$(INSTALL_DIR_INC)" >NUL
@copy /y $(SRCDIR)\include\ares_version.h "$(INSTALL_DIR_INC)" >NUL
@echo Installed c-ares $(CFG)
!ENDIF

@ -61,13 +61,13 @@ before_build:
- if "%COMPILER%" == "MSVC" call "%MSVC_SETUP_PATH%" %MSVC_SETUP_ARG%
build_script:
- if "%BUILDTOOL%" == "NMAKE" copy ares_build.h.dist ares_build.h
- if "%BUILDTOOL%" == "NMAKE" copy .\include\ares_build.h.dist .\include\ares_build.h
- if "%BUILDTOOL%" == "NMAKE" nmake /NOLOGO /f .\Makefile.msvc
- if "%BUILDTOOL%" == "CMAKE" mkdir C:\projects\build-cares
- if "%BUILDTOOL%" == "CMAKE" cd C:\projects\build-cares
- if "%BUILDTOOL%" == "CMAKE" cmake -GNinja -DCMAKE_BUILD_TYPE=%configuration% -DCMAKE_INSTALL_PREFIX=C:\projects\build-cares\test_install -DCARES_STATIC=ON -DCARES_STATIC_PIC=ON -DCARES_BUILD_TESTS=ON %CMAKE_EXTRA_OPTIONS% %APPVEYOR_BUILD_FOLDER%
- if "%BUILDTOOL%" == "CMAKE" ninja install
- if "%BUILDTOOL%" == "MAKE" copy ares_build.h.dist ares_build.h
- if "%BUILDTOOL%" == "MAKE" copy .\include\ares_build.h.dist .\include\ares_build.h
- if "%BUILDTOOL%" == "MAKE" mingw32-make.exe -f Makefile.m32 demos
test_script:

@ -59,7 +59,7 @@ removethis(){
# Ensure that buildconf runs from the subdirectory where configure.ac lives
#
if test ! -f configure.ac ||
test ! -f ares_init.c ||
test ! -f src/lib/ares_init.c ||
test ! -f m4/cares-functions.m4; then
echo "Can not run buildconf from outside of c-ares source subdirectory!"
echo "Change to the subdirectory where buildconf is found, and try again."

@ -7,8 +7,8 @@ XC_OVR_ZZ50
XC_OVR_ZZ60
CARES_OVERRIDE_AUTOCONF
AC_CONFIG_SRCDIR([ares_ipv6.h])
AC_CONFIG_HEADERS([ares_config.h ares_build.h])
AC_CONFIG_SRCDIR([src/lib/ares_ipv6.h])
AC_CONFIG_HEADERS([src/lib/ares_config.h include/ares_build.h])
AC_CONFIG_MACRO_DIR([m4])
AM_MAINTAINER_MODE
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
@ -69,10 +69,6 @@ AC_SUBST([AR])
AX_CODE_COVERAGE
dnl Remove non-configure distributed ares_build.h
if test -f ${srcdir}/ares_build.h; then
rm -f ${srcdir}/ares_build.h
fi
dnl
dnl Detect the canonical host and target build environment
@ -105,6 +101,7 @@ esac
XC_LIBTOOL
#
# Automake conditionals based on libtool related checks
#
@ -881,10 +878,22 @@ if test "x$build_tests" = "xyes" ; then
fi
AC_MSG_RESULT([$build_tests])
BUILD_SUBDIRS="include src docs"
if test "x$build_tests" = "xyes" ; then
AC_CONFIG_SUBDIRS([test])
BUILD_SUBDIRS="${BUILD_SUBDIRS} test"
fi
AC_CONFIG_FILES([Makefile libcares.pc])
AC_SUBST(BUILD_SUBDIRS)
AC_CONFIG_FILES([Makefile \
include/Makefile \
src/Makefile \
src/lib/Makefile \
src/tools/Makefile \
docs/Makefile \
libcares.pc ])
AC_OUTPUT
XC_AMEND_DISTCLEAN(['.'])

@ -0,0 +1,17 @@
# Headers and Man Pages installation target
IF (CARES_INSTALL)
# ManPages
FILE (GLOB DevelManPages "." "*.3")
INSTALL (FILES ${DevelManPages}
DESTINATION ${CMAKE_INSTALL_MANDIR}/man3
COMPONENT Devel
)
IF (CARES_BUILD_TOOLS)
FILE (GLOB ToolManPages "." "*.1")
INSTALL (FILES ${ToolManPages}
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1
COMPONENT Tools
)
ENDIF ()
ENDIF ()

@ -0,0 +1,51 @@
#***************************************************************************
###########################################################################
AUTOMAKE_OPTIONS = foreign subdir-objects no-dependencies
include Makefile.inc
man_MANS = $(MANPAGES)
EXTRA_DIST = $(MANPAGES) ahost.1 adig.1 acountry.1 Makefile.inc CMakeLists.txt
SOURCEDMANDIR = man3
SOURCEDMANPAGES = ares_init.3
clean-local: clean-sourced-manpages
clean-sourced-manpages:
@srcdmandir='$(SOURCEDMANDIR)'; \
echo "rm -rf $(top_builddir)/$$srcdmandir"; \
rm -rf $(top_builddir)/$$srcdmandir
sourced-manpages: clean-sourced-manpages
@srcdmandir='$(SOURCEDMANDIR)'; \
srcdmanfiles='$(SOURCEDMANPAGES)'; \
mkdir $(top_builddir)/$$srcdmandir; \
for file in $$srcdmanfiles; do \
if test -f $(top_srcdir)/$$file; then \
echo "cp $(top_srcdir)/$$file $(top_builddir)/$$srcdmandir/$$file"; \
cp $(top_srcdir)/$$file $(top_builddir)/$$srcdmandir/$$file; \
fi; \
done
MAN2HTML = roffit --mandir=. < $< >$@
SUFFIXES = .3 .html
html: sourced-manpages $(HTMLPAGES)
.3.html:
$(MAN2HTML)
pdf: sourced-manpages $(PDFPAGES)
.3.pdf:
@(foo=`echo $@ | sed -e 's/\.[0-9]$$//g'`; \
groff -Tps -man $< >$$foo.ps; \
ps2pdf $$foo.ps $@; \
rm $$foo.ps; \
echo "converted $< to $@")

@ -1,85 +1,3 @@
CSOURCES = ares__close_sockets.c \
ares__get_hostent.c \
ares__parse_into_addrinfo.c \
ares__readaddrinfo.c \
ares__sortaddrinfo.c \
ares__read_line.c \
ares__timeval.c \
ares_android.c \
ares_cancel.c \
ares_data.c \
ares_destroy.c \
ares_expand_name.c \
ares_expand_string.c \
ares_fds.c \
ares_free_hostent.c \
ares_free_string.c \
ares_freeaddrinfo.c \
ares_getaddrinfo.c \
ares_getenv.c \
ares_gethostbyaddr.c \
ares_gethostbyname.c \
ares_getnameinfo.c \
ares_getsock.c \
ares_init.c \
ares_library_init.c \
ares_llist.c \
ares_mkquery.c \
ares_create_query.c \
ares_nowarn.c \
ares_options.c \
ares_parse_a_reply.c \
ares_parse_aaaa_reply.c \
ares_parse_mx_reply.c \
ares_parse_naptr_reply.c \
ares_parse_ns_reply.c \
ares_parse_ptr_reply.c \
ares_parse_soa_reply.c \
ares_parse_srv_reply.c \
ares_parse_txt_reply.c \
ares_platform.c \
ares_process.c \
ares_query.c \
ares_search.c \
ares_send.c \
ares_strcasecmp.c \
ares_strdup.c \
ares_strerror.c \
ares_strsplit.c \
ares_timeout.c \
ares_version.c \
ares_writev.c \
bitncmp.c \
inet_net_pton.c \
inet_ntop.c \
windows_port.c
HHEADERS = ares.h \
ares_android.h \
ares_build.h \
ares_data.h \
ares_dns.h \
ares_getenv.h \
ares_inet_net_pton.h \
ares_iphlpapi.h \
ares_ipv6.h \
ares_library_init.h \
ares_llist.h \
ares_nowarn.h \
ares_platform.h \
ares_private.h \
ares_rules.h \
ares_strcasecmp.h \
ares_strdup.h \
ares_strsplit.h \
ares_version.h \
ares_writev.h \
bitncmp.h \
nameser.h \
ares_setup.h \
setup_once.h
MANPAGES = ares_cancel.3 \
ares_create_query.3 \
ares_destroy.3 \
@ -251,11 +169,3 @@ PDFPAGES = ares_cancel.pdf \
ares_strerror.pdf \
ares_timeout.pdf \
ares_version.pdf
SAMPLESOURCES = ares_getopt.c \
ares_nowarn.c \
ares_strcasecmp.c
SAMPLEHEADERS = ares_getopt.h \
ares_nowarn.h \
ares_strcasecmp.h

@ -0,0 +1,8 @@
# Write ares_build.h configuration file. This is an installed file.
CONFIGURE_FILE (ares_build.h.cmake ${PROJECT_BINARY_DIR}/ares_build.h)
# Headers installation target
IF (CARES_INSTALL)
SET (CARES_HEADERS ares.h ares_version.h "${PROJECT_BINARY_DIR}/ares_build.h" ares_rules.h)
INSTALL (FILES ${CARES_HEADERS} COMPONENT Devel DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
ENDIF ()

@ -0,0 +1,7 @@
AUTOMAKE_OPTIONS = foreign nostdinc 1.9.6
ACLOCAL_AMFLAGS = -I m4 --install
# what headers to install on 'make install':
include_HEADERS = ares.h ares_version.h ares_build.h ares_rules.h
EXTRA_DIST = ares_build.h.cmake ares_build.h.in ares_build.h.dist CMakeLists.txt

@ -7,7 +7,7 @@ if($version eq "") {
exit;
}
if(!-f "ares.h") {
if(!-f "include/ares.h") {
print "run this script in the ares source root dir\n";
exit;
}
@ -18,9 +18,9 @@ $major += 0;
$minor += 0;
$patch += 0;
open(VER, "<ares_version.h") ||
die "can't open ares_version.h";
open(NEWV, ">ares_version.h.dist");
open(VER, "<include/ares_version.h") ||
die "can't open include/ares_version.h";
open(NEWV, ">include/ares_version.h.dist");
while(<VER>) {
$_ =~ s/^\#define ARES_VERSION_MAJOR .*/\#define ARES_VERSION_MAJOR $major/;
$_ =~ s/^\#define ARES_VERSION_MINOR .*/\#define ARES_VERSION_MINOR $minor/;
@ -31,7 +31,7 @@ while(<VER>) {
}
close(VER);
close(NEWV);
print "ares_version.h.dist created\n";
print "include/ares_version.h.dist created\n";
if(!-f "configure") {
print "running buildconf\n";
@ -64,6 +64,6 @@ print "running make dist\n";
print "removing temporary configure.ac file\n";
`rm configure.ac.dist`;
print "removing temporary ares_version.h file\n";
`rm ares_version.h.dist`;
`rm include/ares_version.h.dist`;
print "NOTE: now tag this release!\n";

@ -0,0 +1,2 @@
ADD_SUBDIRECTORY (lib)
ADD_SUBDIRECTORY (tools)

@ -0,0 +1,2 @@
EXTRA_DIST=CMakeLists.txt
SUBDIRS=lib tools

@ -0,0 +1,115 @@
# Transform Makefile.inc
transform_makefile_inc("Makefile.inc" "${PROJECT_BINARY_DIR}/src/lib/Makefile.inc.cmake")
include(${PROJECT_BINARY_DIR}/src/lib/Makefile.inc.cmake)
# Write ares_config.h configuration file. This is used only for the build.
CONFIGURE_FILE (ares_config.h.cmake ${PROJECT_BINARY_DIR}/ares_config.h)
# Build the dynamic/shared library
IF (CARES_SHARED)
ADD_LIBRARY (${PROJECT_NAME} SHARED ${CSOURCES})
# Convert CARES_LIB_VERSIONINFO libtool version format into VERSION and SOVERSION
# Convert from ":" separated into CMake list format using ";"
STRING (REPLACE ":" ";" CARES_LIB_VERSIONINFO ${CARES_LIB_VERSIONINFO})
LIST (GET CARES_LIB_VERSIONINFO 0 CARES_LIB_VERSION_CURRENT)
LIST (GET CARES_LIB_VERSIONINFO 1 CARES_LIB_VERSION_REVISION)
LIST (GET CARES_LIB_VERSIONINFO 2 CARES_LIB_VERSION_AGE)
MATH (EXPR CARES_LIB_VERSION_MAJOR "${CARES_LIB_VERSION_CURRENT} - ${CARES_LIB_VERSION_AGE}")
SET (CARES_LIB_VERSION_MINOR "${CARES_LIB_VERSION_AGE}")
SET (CARES_LIB_VERSION_RELEASE "${CARES_LIB_VERSION_REVISION}")
SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES
EXPORT_NAME cares
OUTPUT_NAME cares
COMPILE_PDB_NAME cares
COMPILE_PDB_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
SOVERSION ${CARES_LIB_VERSION_MAJOR}
VERSION "${CARES_LIB_VERSION_MAJOR}.${CARES_LIB_VERSION_MINOR}.${CARES_LIB_VERSION_RELEASE}"
)
TARGET_INCLUDE_DIRECTORIES (${PROJECT_NAME}
PUBLIC "$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>"
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>"
"$<BUILD_INTERFACE:${CARES_TOPLEVEL_DIR}/include>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}"
)
TARGET_COMPILE_DEFINITIONS (${PROJECT_NAME} PRIVATE HAVE_CONFIG_H=1 CARES_BUILDING_LIBRARY)
TARGET_LINK_LIBRARIES (${PROJECT_NAME} PUBLIC ${CARES_DEPENDENT_LIBS})
IF (CARES_INSTALL)
INSTALL (TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}-targets
COMPONENT Library
${TARGETS_INST_DEST}
)
INSTALL(FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/cares.pdb
DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT Library
OPTIONAL
)
ENDIF ()
SET (STATIC_SUFFIX "_static")
# For chain building: add alias targets that look like import libs that would be returned by find_package(c-ares).
ADD_LIBRARY (${PROJECT_NAME}::cares_shared ALIAS ${PROJECT_NAME})
ADD_LIBRARY (${PROJECT_NAME}::cares ALIAS ${PROJECT_NAME})
ENDIF ()
# Build the static library
IF (CARES_STATIC)
SET (LIBNAME ${PROJECT_NAME}${STATIC_SUFFIX})
ADD_LIBRARY (${LIBNAME} STATIC ${CSOURCES})
SET_TARGET_PROPERTIES (${LIBNAME} PROPERTIES
EXPORT_NAME cares${STATIC_SUFFIX}
OUTPUT_NAME cares${STATIC_SUFFIX}
COMPILE_PDB_NAME cares${STATIC_SUFFIX}
COMPILE_PDB_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
)
IF (CARES_STATIC_PIC)
SET_TARGET_PROPERTIES (${LIBNAME} PROPERTIES POSITION_INDEPENDENT_CODE True)
ENDIF ()
TARGET_INCLUDE_DIRECTORIES (${LIBNAME}
PUBLIC "$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>"
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>"
"$<BUILD_INTERFACE:${CARES_TOPLEVEL_DIR}/include>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}"
)
TARGET_COMPILE_DEFINITIONS (${LIBNAME}
PUBLIC CARES_STATICLIB
PRIVATE HAVE_CONFIG_H=1
)
TARGET_LINK_LIBRARIES (${LIBNAME} PUBLIC ${CARES_DEPENDENT_LIBS})
IF (CARES_INSTALL)
INSTALL (TARGETS ${LIBNAME} EXPORT ${PROJECT_NAME}-targets COMPONENT Devel
${TARGETS_INST_DEST}
)
INSTALL(FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/cares${STATIC_SUFFIX}.pdb
DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT Library
OPTIONAL
)
ENDIF ()
# For chain building: add alias targets that look like import libs that would be returned by find_package(c-ares).
ADD_LIBRARY (${PROJECT_NAME}::cares_static ALIAS ${LIBNAME})
IF (NOT TARGET ${PROJECT_NAME}::cares)
# Only use static for the generic alias if shared lib wasn't built.
ADD_LIBRARY (${PROJECT_NAME}::cares ALIAS ${LIBNAME})
ENDIF ()
ENDIF ()

@ -0,0 +1,72 @@
AUTOMAKE_OPTIONS = foreign subdir-objects nostdinc 1.9.6
ACLOCAL_AMFLAGS = -I m4 --install
# Specify our include paths here, and do it relative to $(top_srcdir) and
# $(top_builddir), to ensure that these paths which belong to the library
# being currently built and tested are searched before the library which
# might possibly already be installed in the system.
AM_CPPFLAGS = -I$(top_builddir)/include \
-I$(top_builddir)/src/lib \
-I$(top_srcdir)/include
lib_LTLIBRARIES = libcares.la
man_MANS = $(MANPAGES)
# adig and ahost are just sample programs and thus not mentioned with the
# regular sources and headers
EXTRA_DIST = Makefile.inc config-win32.h CMakeLists.txt \
ares_config.h.in ares_config.h.cmake cares.rc \
$(CSOURCES) $(HHEADERS) config-dos.h
DISTCLEANFILES = ares_config.h
DIST_SUBDIRS =
AM_LDFLAGS =
libcares_la_LDFLAGS_EXTRA =
if CARES_LT_SHLIB_USE_VERSION_INFO
libcares_la_LDFLAGS_EXTRA += $(CARES_VERSION_INFO)
endif
if CARES_LT_SHLIB_USE_NO_UNDEFINED
libcares_la_LDFLAGS_EXTRA += -no-undefined
endif
if CARES_LT_SHLIB_USE_MIMPURE_TEXT
libcares_la_LDFLAGS_EXTRA += -mimpure-text
endif
libcares_la_LDFLAGS = $(AM_LDFLAGS) $(libcares_la_LDFLAGS_EXTRA)
# Add -Werror if defined
CFLAGS += @CARES_CFLAG_EXTRAS@
if USE_CPPFLAG_CARES_STATICLIB
AM_CPPFLAGS += $(CPPFLAG_CARES_STATICLIB)
endif
libcares_la_CFLAGS_EXTRA =
libcares_la_CPPFLAGS_EXTRA = -DCARES_BUILDING_LIBRARY
if DOING_CARES_SYMBOL_HIDING
libcares_la_CFLAGS_EXTRA += $(CFLAG_CARES_SYMBOL_HIDING)
libcares_la_CPPFLAGS_EXTRA += -DCARES_SYMBOL_HIDING
endif
@CODE_COVERAGE_RULES@
libcares_la_LDFLAGS += $(CODE_COVERAGE_LDFLAGS)
libcares_la_CFLAGS_EXTRA += $(CODE_COVERAGE_CFLAGS)
libcares_la_CFLAGS = $(AM_CFLAGS) $(libcares_la_CFLAGS_EXTRA)
libcares_la_CPPFLAGS = $(AM_CPPFLAGS) $(libcares_la_CPPFLAGS_EXTRA)
# Makefile.inc provides the CSOURCES and HHEADERS defines
include Makefile.inc
libcares_la_SOURCES = $(CSOURCES) $(HHEADERS)

@ -0,0 +1,79 @@
CSOURCES = ares__close_sockets.c \
ares__get_hostent.c \
ares__parse_into_addrinfo.c \
ares__readaddrinfo.c \
ares__sortaddrinfo.c \
ares__read_line.c \
ares__timeval.c \
ares_android.c \
ares_cancel.c \
ares_data.c \
ares_destroy.c \
ares_expand_name.c \
ares_expand_string.c \
ares_fds.c \
ares_free_hostent.c \
ares_free_string.c \
ares_freeaddrinfo.c \
ares_getaddrinfo.c \
ares_getenv.c \
ares_gethostbyaddr.c \
ares_gethostbyname.c \
ares_getnameinfo.c \
ares_getsock.c \
ares_init.c \
ares_library_init.c \
ares_llist.c \
ares_mkquery.c \
ares_create_query.c \
ares_nowarn.c \
ares_options.c \
ares_parse_a_reply.c \
ares_parse_aaaa_reply.c \
ares_parse_mx_reply.c \
ares_parse_naptr_reply.c \
ares_parse_ns_reply.c \
ares_parse_ptr_reply.c \
ares_parse_soa_reply.c \
ares_parse_srv_reply.c \
ares_parse_txt_reply.c \
ares_platform.c \
ares_process.c \
ares_query.c \
ares_search.c \
ares_send.c \
ares_strcasecmp.c \
ares_strdup.c \
ares_strerror.c \
ares_strsplit.c \
ares_timeout.c \
ares_version.c \
ares_writev.c \
bitncmp.c \
inet_net_pton.c \
inet_ntop.c \
windows_port.c
HHEADERS = ares_android.h \
ares_data.h \
ares_dns.h \
ares_getenv.h \
ares_inet_net_pton.h \
ares_iphlpapi.h \
ares_ipv6.h \
ares_library_init.h \
ares_llist.h \
ares_nowarn.h \
ares_platform.h \
ares_private.h \
ares_strcasecmp.h \
ares_strdup.h \
ares_strsplit.h \
ares_writev.h \
bitncmp.h \
nameser.h \
ares_setup.h \
setup_once.h

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save