mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-03-24 06:50:08 +03:00
build: Define XML_SYSCONFDIR in config.h
Rename SYSCONFDIR macro to XML_SYSCONFDIR. Use AX_RECURSIVE_EVAL with Autotools. This is GPL v2 with Autoconf exception which shouldn't be a problem. Finally support meson.
This commit is contained in:
parent
0dc26910c1
commit
a5764b56d2
@ -292,8 +292,6 @@ endif()
|
||||
add_library(LibXml2 ${LIBXML2_HDRS} ${LIBXML2_SRCS})
|
||||
add_library(LibXml2::LibXml2 ALIAS LibXml2)
|
||||
|
||||
target_compile_definitions(LibXml2 PRIVATE SYSCONFDIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}")
|
||||
|
||||
target_include_directories(
|
||||
LibXml2
|
||||
PUBLIC
|
||||
@ -423,6 +421,8 @@ if(MSVC)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(XML_SYSCONFDIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}")
|
||||
|
||||
install(FILES ${LIBXML2_HDRS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libxml2/libxml COMPONENT development)
|
||||
|
||||
install(
|
||||
@ -447,7 +447,6 @@ if(LIBXML2_WITH_PROGRAMS)
|
||||
)
|
||||
foreach(PROGRAM ${PROGRAMS})
|
||||
add_executable(LibXml2::${PROGRAM} ALIAS ${PROGRAM})
|
||||
target_compile_definitions(${PROGRAM} PRIVATE SYSCONFDIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}")
|
||||
target_link_libraries(${PROGRAM} LibXml2)
|
||||
if(HAVE_LIBHISTORY)
|
||||
target_link_libraries(${PROGRAM} history)
|
||||
@ -476,7 +475,6 @@ if(LIBXML2_WITH_TESTS)
|
||||
)
|
||||
foreach(TEST ${TESTS})
|
||||
add_executable(${TEST} ${TEST}.c)
|
||||
target_compile_definitions(${TEST} PRIVATE SYSCONFDIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}")
|
||||
target_link_libraries(${TEST} LibXml2)
|
||||
endforeach()
|
||||
if(Threads_FOUND)
|
||||
|
@ -54,10 +54,10 @@
|
||||
#define XML_URN_PUBID "urn:publicid:"
|
||||
#define XML_CATAL_BREAK ((xmlChar *) -1)
|
||||
#ifndef XML_XML_DEFAULT_CATALOG
|
||||
#define XML_XML_DEFAULT_CATALOG "file://" SYSCONFDIR "/xml/catalog"
|
||||
#define XML_XML_DEFAULT_CATALOG "file://" XML_SYSCONFDIR "/xml/catalog"
|
||||
#endif
|
||||
#ifndef XML_SGML_DEFAULT_CATALOG
|
||||
#define XML_SGML_DEFAULT_CATALOG "file://" SYSCONFDIR "/sgml/catalog"
|
||||
#define XML_SGML_DEFAULT_CATALOG "file://" XML_SYSCONFDIR "/sgml/catalog"
|
||||
#endif
|
||||
|
||||
static xmlChar *xmlCatalogNormalizePublic(const xmlChar *pubID);
|
||||
|
@ -34,5 +34,8 @@
|
||||
/* Version number of package */
|
||||
#cmakedefine VERSION "@VERSION@"
|
||||
|
||||
/* System configuration directory (/etc) */
|
||||
#cmakedefine XML_SYSCONFDIR "@XML_SYSCONFDIR@"
|
||||
|
||||
/* TLS specifier */
|
||||
#cmakedefine XML_THREAD_LOCAL @XML_THREAD_LOCAL@
|
||||
|
@ -1085,6 +1085,10 @@ AC_SUBST(XML_PRIVATE_LIBS)
|
||||
AC_SUBST(XML_PRIVATE_CFLAGS)
|
||||
AC_SUBST(XML_INCLUDEDIR)
|
||||
|
||||
AX_RECURSIVE_EVAL(["$sysconfdir"], [XML_SYSCONFDIR])
|
||||
AC_DEFINE_UNQUOTED([XML_SYSCONFDIR], ["$XML_SYSCONFDIR"],
|
||||
[System configuration directory (/etc)])
|
||||
|
||||
# keep on one line for cygwin c.f. #130896
|
||||
AC_CONFIG_FILES([Makefile include/Makefile include/libxml/Makefile include/private/Makefile doc/Makefile doc/devhelp/Makefile example/Makefile fuzz/Makefile python/Makefile python/tests/Makefile xstc/Makefile include/libxml/xmlversion.h libxml-2.0.pc libxml2-config.cmake])
|
||||
AC_CONFIG_FILES([python/setup.py], [chmod +x python/setup.py])
|
||||
|
9
libxml.h
9
libxml.h
@ -29,15 +29,6 @@
|
||||
#include "config.h"
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
/*
|
||||
* Due to some Autotools limitations, this variable must be passed as
|
||||
* compiler flag. Define a default value if the macro wasn't set by the
|
||||
* build system.
|
||||
*/
|
||||
#ifndef SYSCONFDIR
|
||||
#define SYSCONFDIR "/etc"
|
||||
#endif
|
||||
|
||||
#if !defined(_WIN32) && \
|
||||
!defined(__CYGWIN__) && \
|
||||
(defined(__clang__) || \
|
||||
|
56
m4/ax_recursive_eval.m4
Normal file
56
m4/ax_recursive_eval.m4
Normal file
@ -0,0 +1,56 @@
|
||||
# ===========================================================================
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_recursive_eval.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_RECURSIVE_EVAL(VALUE, RESULT)
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Interpolate the VALUE in loop until it doesn't change, and set the
|
||||
# result to $RESULT. WARNING: It's easy to get an infinite loop with some
|
||||
# unsane input.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Alexandre Duret-Lutz <adl@gnu.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by the
|
||||
# Free Software Foundation; either version 2 of the License, or (at your
|
||||
# option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
# Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||
# gives unlimited permission to copy, distribute and modify the configure
|
||||
# scripts that are the output of Autoconf when processing the Macro. You
|
||||
# need not follow the terms of the GNU General Public License when using
|
||||
# or distributing such scripts, even though portions of the text of the
|
||||
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||
# all other use of the material that constitutes the Autoconf Macro.
|
||||
#
|
||||
# This special exception to the GPL applies to versions of the Autoconf
|
||||
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||
# modified version of the Autoconf Macro, you may extend this special
|
||||
# exception to the GPL to apply to your modified version as well.
|
||||
|
||||
#serial 1
|
||||
|
||||
AC_DEFUN([AX_RECURSIVE_EVAL],
|
||||
[_lcl_receval="$1"
|
||||
$2=`(test "x$prefix" = xNONE && prefix="$ac_default_prefix"
|
||||
test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
|
||||
_lcl_receval_old=''
|
||||
while test "[$]_lcl_receval_old" != "[$]_lcl_receval"; do
|
||||
_lcl_receval_old="[$]_lcl_receval"
|
||||
eval _lcl_receval="\"[$]_lcl_receval\""
|
||||
done
|
||||
echo "[$]_lcl_receval")`])
|
@ -231,6 +231,8 @@ config_h.set_quoted('PACKAGE_BIN_DIR', dir_bin)
|
||||
config_h.set_quoted('PACKAGE_LIB_DIR', dir_lib)
|
||||
config_h.set_quoted('PACKAGE_DATA_DIR', dir_data)
|
||||
config_h.set_quoted('LOCALEDIR', dir_locale)
|
||||
config_h.set_quoted('XML_SYSCONFDIR',
|
||||
get_option('prefix') / get_option('sysconfdir'))
|
||||
|
||||
# header files
|
||||
xml_check_headers = [
|
||||
|
@ -3389,7 +3389,8 @@ static int urip_rlen;
|
||||
*/
|
||||
static int
|
||||
uripMatch(const char * URI) {
|
||||
if ((URI == NULL) || (!strcmp(URI, "file://" SYSCONFDIR "/xml/catalog")))
|
||||
if ((URI == NULL) ||
|
||||
(!strcmp(URI, "file://" XML_SYSCONFDIR "/xml/catalog")))
|
||||
return(0);
|
||||
/* Verify we received the escaped URL */
|
||||
if (strcmp(urip_rcvsURLs[urip_current], URI))
|
||||
@ -3408,7 +3409,8 @@ uripMatch(const char * URI) {
|
||||
*/
|
||||
static void *
|
||||
uripOpen(const char * URI) {
|
||||
if ((URI == NULL) || (!strcmp(URI, "file://" SYSCONFDIR "/xml/catalog")))
|
||||
if ((URI == NULL) ||
|
||||
(!strcmp(URI, "file://" XML_SYSCONFDIR "/xml/catalog")))
|
||||
return(NULL);
|
||||
/* Verify we received the escaped URL */
|
||||
if (strcmp(urip_rcvsURLs[urip_current], URI))
|
||||
|
@ -14,5 +14,7 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define XML_SYSCONFDIR "/etc"
|
||||
|
||||
#endif /* __LIBXML_WIN32_CONFIG__ */
|
||||
|
||||
|
@ -50,7 +50,7 @@ static char *filename = NULL;
|
||||
|
||||
|
||||
#ifndef XML_SGML_DEFAULT_CATALOG
|
||||
#define XML_SGML_DEFAULT_CATALOG SYSCONFDIR "/sgml/catalog"
|
||||
#define XML_SGML_DEFAULT_CATALOG XML_SYSCONFDIR "/sgml/catalog"
|
||||
#endif
|
||||
|
||||
/************************************************************************
|
||||
|
Loading…
x
Reference in New Issue
Block a user