Set default values for mongoc-config.h.
Simplify if checking and setting default values for mongoc-config.h
include(CheckSymbolExists)
-if (ENABLE_SRV STREQUAL ON OR ENABLE_SRV STREQUAL AUTO)
-include(CheckSymbolExists)
- if (WIN32)
- set (RESOLV_LIBS Dnsapi)
- set (MONGOC_HAVE_DNSAPI 1)
+set (MONGOC_HAVE_DNSAPI 0)
set (MONGOC_HAVE_RES_NSEARCH 0)
set (MONGOC_HAVE_RES_NDESTROY 0)
set (MONGOC_HAVE_RES_NCLOSE 0)
set (MONGOC_HAVE_RES_SEARCH 0)
+
+if (ENABLE_SRV STREQUAL ON OR ENABLE_SRV STREQUAL AUTO)
+ if (WIN32)
+ set (RESOLV_LIBS Dnsapi)
+ set (MONGOC_HAVE_DNSAPI 1)
else ()
set (MONGOC_HAVE_DNSAPI 0)
# Thread-safe DNS query function for _mongoc_client_get_srv.
@@ -16,30 +17,17 @@ include(CheckSymbolExists)
check_symbol_exists (res_nsearch resolv.h MONGOC_HAVE_RES_NSEARCH)
if (MONGOC_HAVE_RES_NSEARCH)
set (RESOLV_LIBS resolv)
- set (MONGOC_HAVE_RES_SEARCH 0)
# We have res_nsearch. Call res_ndestroy (BSD/Mac) or res_nclose (Linux)?
check_symbol_exists (res_ndestroy resolv.h MONGOC_HAVE_RES_NDESTROY)
- if (MONGOC_HAVE_RES_NDESTROY)
- set (MONGOC_HAVE_RES_NCLOSE 0)
- else ()
- set (MONGOC_HAVE_RES_NDESTROY 0)
+ if (NOT MONGOC_HAVE_RES_NDESTROY)
check_symbol_exists (res_nclose resolv.h MONGOC_HAVE_RES_NCLOSE)
- if (NOT MONGOC_HAVE_RES_NCLOSE)
- set (MONGOC_HAVE_RES_NCLOSE 0)
- endif ()
endif ()
else ()
- set (MONGOC_HAVE_RES_NSEARCH 0)
- set (MONGOC_HAVE_RES_NDESTROY 0)
- set (MONGOC_HAVE_RES_NCLOSE 0)
-
# Thread-unsafe function.
check_symbol_exists (res_search resolv.h MONGOC_HAVE_RES_SEARCH)
if (MONGOC_HAVE_RES_SEARCH)
set (RESOLV_LIBS resolv)
- else ()
- set (MONGOC_HAVE_RES_SEARCH 0)
endif()
endif ()
endif ()
