1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-12-25 23:21:26 +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) {}
int main(void) { return 0; }
" 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_library_exists(history append_history "" HAVE_LIBHISTORY)
check_library_exists(readline readline "" HAVE_LIBREADLINE)
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(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)
check_c_source_compiles(
@ -306,6 +304,11 @@ target_include_directories(
)
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)
target_link_libraries(LibXml2 PRIVATE dl)
set(MODULE_LIBS "-ldl")

View File

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

View File

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