1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-01-13 13:17:36 +03:00

build: Only check for required headers

This commit is contained in:
Nick Wellnhofer 2024-07-22 15:21:36 +02:00
parent 3ef6661175
commit 0172ffa99b
3 changed files with 29 additions and 25 deletions

View File

@ -136,22 +136,20 @@ check_c_source_compiles("
f(void) {} f(void) {}
int main(void) { return 0; } int main(void) { return 0; }
" HAVE_FUNC_ATTRIBUTE_DESTRUCTOR) " HAVE_FUNC_ATTRIBUTE_DESTRUCTOR)
check_include_files(arpa/inet.h HAVE_ARPA_INET_H)
check_function_exists(class HAVE_CLASS)
check_include_files(dlfcn.h HAVE_DLFCN_H)
check_library_exists(dl dlopen "" HAVE_DLOPEN)
check_include_files(dl.h HAVE_DL_H)
check_symbol_exists(getentropy "sys/random.h" HAVE_DECL_GETENTROPY) check_symbol_exists(getentropy "sys/random.h" HAVE_DECL_GETENTROPY)
check_library_exists(history append_history "" HAVE_LIBHISTORY) check_library_exists(history append_history "" HAVE_LIBHISTORY)
check_library_exists(readline readline "" HAVE_LIBREADLINE) check_library_exists(readline readline "" HAVE_LIBREADLINE)
check_symbol_exists(mmap "sys/mman.h" HAVE_DECL_MMAP) check_symbol_exists(mmap "sys/mman.h" HAVE_DECL_MMAP)
check_include_files(netdb.h HAVE_NETDB_H)
check_include_files(netinet/in.h HAVE_NETINET_IN_H)
check_include_files(poll.h HAVE_POLL_H)
check_library_exists(dld shl_load "" HAVE_SHLLOAD)
check_include_files(stdint.h HAVE_STDINT_H) check_include_files(stdint.h HAVE_STDINT_H)
check_include_files(sys/select.h HAVE_SYS_SELECT_H)
check_include_files(sys/socket.h HAVE_SYS_SOCKET_H) if(LIBXML2_WITH_HTTP)
check_include_files(arpa/inet.h HAVE_ARPA_INET_H)
check_include_files(netdb.h HAVE_NETDB_H)
check_include_files(netinet/in.h HAVE_NETINET_IN_H)
check_include_files(poll.h HAVE_POLL_H)
check_include_files(sys/select.h HAVE_SYS_SELECT_H)
check_include_files(sys/socket.h HAVE_SYS_SOCKET_H)
endif()
if(LIBXML2_WITH_TLS) if(LIBXML2_WITH_TLS)
check_c_source_compiles( check_c_source_compiles(
@ -306,6 +304,11 @@ target_include_directories(
) )
if(LIBXML2_WITH_MODULES) if(LIBXML2_WITH_MODULES)
check_include_files(dlfcn.h HAVE_DLFCN_H)
check_library_exists(dl dlopen "" HAVE_DLOPEN)
check_include_files(dl.h HAVE_DL_H)
check_library_exists(dld shl_load "" HAVE_SHLLOAD)
if(HAVE_DLOPEN) if(HAVE_DLOPEN)
target_link_libraries(LibXml2 PRIVATE dl) target_link_libraries(LibXml2 PRIVATE dl)
set(MODULE_LIBS "-ldl") set(MODULE_LIBS "-ldl")

View File

@ -298,7 +298,6 @@ dnl
dnl Checks for header files. dnl Checks for header files.
dnl dnl
AC_CHECK_HEADERS([stdint.h]) AC_CHECK_HEADERS([stdint.h])
AC_CHECK_HEADERS([dl.h dlfcn.h])
AC_CHECK_HEADERS([glob.h]) AC_CHECK_HEADERS([glob.h])
AM_CONDITIONAL(WITH_GLOB, test "$ac_cv_header_glob_h" = "yes") AM_CONDITIONAL(WITH_GLOB, test "$ac_cv_header_glob_h" = "yes")
@ -662,6 +661,8 @@ if test "$with_modules" != "no" ; then
esac esac
if test "$WITH_MODULES" = "0"; then if test "$WITH_MODULES" = "0"; then
AC_CHECK_HEADERS([dl.h dlfcn.h])
_libs=$LIBS _libs=$LIBS
AC_SEARCH_LIBS([dlopen], [dl], [ AC_SEARCH_LIBS([dlopen], [dl], [
WITH_MODULES=1 WITH_MODULES=1

View File

@ -233,23 +233,23 @@ config_h.set_quoted('LOCALEDIR', dir_locale)
# header files # header files
xml_check_headers = [ xml_check_headers = [
'stdint.h', [ 'stdint.h', true ],
'dl.h', [ 'glob.h', true ],
'dlfcn.h',
'glob.h',
# http [ 'dl.h', want_modules ],
'sys/socket.h', [ 'dlfcn.h', want_modules ],
'netinet/in.h',
'arpa/inet.h', [ 'sys/socket.h', want_http ],
'netdb.h', [ 'netinet/in.h', want_http ],
'sys/select.h', [ 'arpa/inet.h', want_http ],
'poll.h', [ 'netdb.h', want_http ],
[ 'sys/select.h', want_http ],
[ 'poll.h', want_http ],
] ]
foreach header : xml_check_headers foreach header : xml_check_headers
if cc.has_header(header) if header[1] and cc.has_header(header[0])
config_h.set10('HAVE_' + header.underscorify().to_upper(), true) config_h.set10('HAVE_' + header[0].underscorify().to_upper(), true)
endif endif
endforeach endforeach