summaryrefslogtreecommitdiff
path: root/m4/libunistring-base.m4
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2023-04-23 13:25:42 +0200
committerBruno Haible <bruno@clisp.org>2023-04-23 13:35:30 +0200
commite46a05b5ee1cbe2d6d0c2ac679b71ad3fd2f7c2d (patch)
treeb3eb9f5427f3e860f9b5aca0bfc9fbbaab6ac4ea /m4/libunistring-base.m4
parent934167a39654699eca26869c96b875092dc16976 (diff)
downloadgnulib-e46a05b5ee1cbe2d6d0c2ac679b71ad3fd2f7c2d.tar.gz
libunistring: Fix build on Windows, when a libunistring is installed.
* lib/unicase.in.h: Include <unistring/woe32dll.h>. (unicase_empty_prefix_context, unicase_empty_suffix_context): Declare with GNULIB_UNICASE_..._DLL_VARIABLE. * lib/unictype.in.h: Include <unistring/woe32dll.h>. (UC_CATEGORY_*, UC_PROPERTY_*): Declare with GNULIB_UNICTYPE_..._DLL_VARIABLE. * lib/uninorm.in.h: Include <unistring/woe32dll.h>. (unicode_normalization_form uninorm_nf*): Declare with GNULIB_UNINORM_..._DLL_VARIABLE. * m4/libunistring-base.m4 (gl_LIBUNISTRING_MODULE_WITH_VARIABLE): New macro. (gl_LIBUNISTRING_LIB_PREPARE): Set HAVE_UNISTRING_WOE32DLL_H. * m4/unicase_h.m4: New file. * m4/unictype_h.m4: New file. * m4/uninorm_h.m4: New file. * modules/unicase/base (Files): Add m4/unicase_h.m4. (configure.ac): Bump version number. Invoke gl_UNICASE_H, gl_UNICASE_H_REQUIRE_DEFAULTS. (Makefile.am): Substitute all GNULIB_UNICASE_*_DLL_VARIABLE. * modules/unicase/empty-*-context (configure.ac): Invoke gl_UNICASE_H_REQUIRE_DEFAULTS. Use gl_LIBUNISTRING_MODULE_WITH_VARIABLE. * modules/unictype/base (Files): Add m4/unictype_h.m4. (configure.ac): Bump version number. Invoke gl_UNICTYPE_H, gl_UNICTYPE_H_REQUIRE_DEFAULTS. (Makefile.am): Substitute all GNULIB_UNICTYPE_*_DLL_VARIABLE. * modules/unictype/category-* (configure.ac): Invoke gl_UNICTYPE_H_REQUIRE_DEFAULTS. Use gl_LIBUNISTRING_MODULE_WITH_VARIABLE. * modules/unictype/property-* (configure.ac): Likewise. * modules/uninorm/base (Files): Add m4/uninorm_h.m4. (configure.ac): Bump version number. Invoke gl_UNINORM_H, gl_UNINORM_H_REQUIRE_DEFAULTS. (Makefile.am): Substitute all GNULIB_UNINORM_*_DLL_VARIABLE. * modules/uninorm/nf* (configure.ac): Invoke gl_UNINORM_H_REQUIRE_DEFAULTS. Use gl_LIBUNISTRING_MODULE_WITH_VARIABLE.
Diffstat (limited to 'm4/libunistring-base.m4')
-rw-r--r--m4/libunistring-base.m453
1 files changed, 52 insertions, 1 deletions
diff --git a/m4/libunistring-base.m4 b/m4/libunistring-base.m4
index fc6d02399c..6dd184a789 100644
--- a/m4/libunistring-base.m4
+++ b/m4/libunistring-base.m4
@@ -1,4 +1,4 @@
-# libunistring-base.m4 serial 7
+# libunistring-base.m4 serial 8
dnl Copyright (C) 2010-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -18,6 +18,8 @@ dnl You have to bump the VERSION argument to the next projected version
dnl number each time you make a change that affects the behaviour of the
dnl functions defined in Module (even if the sources of Module itself do not
dnl change).
+dnl
+dnl This macro invocation must not occur in macros that are AC_REQUIREd.
AC_DEFUN([gl_LIBUNISTRING_MODULE],
[
@@ -28,6 +30,35 @@ AC_DEFUN([gl_LIBUNISTRING_MODULE],
[gl_LIBUNISTRING_VERSION_CMP([$1])])
])
+dnl gl_LIBUNISTRING_MODULE_WITH_VARIABLE([VERSION], [Module])
+dnl is like gl_LIBUNISTRING_MODULE([VERSION], [Module]), except that it also
+dnl defines an AC_SUBSTed autoconf variable GNULIB_$MODULE_DLL_VARIABLE.
+dnl What's the expansion of this autoconf variable?
+dnl - When building libunistring, it expands to LIBUNISTRING_DLL_VARIABLE.
+dnl (This is necessary because this token must be present in the .h files
+dnl when the .h files get installed.)
+dnl - When building gnulib or application code it expands to
+dnl - LIBUNISTRING_DLL_VARIABLE by default,
+dnl - empty if the automake conditional LIBUNISTRING_COMPILE_$MODULE
+dnl evaluates to true.
+dnl (This is necessary because when the conditional evaluates to false,
+dnl the application code expects to use the declared variable from the
+dnl installed libunistring; it's in this case that the
+dnl LIBUNISTRING_DLL_VARIABLE macro from the installed
+dnl <unistring/woe32dll.h> must be used.)
+dnl
+dnl This macro invocation must not occur in macros that are AC_REQUIREd.
+
+AC_DEFUN([gl_LIBUNISTRING_MODULE_WITH_VARIABLE],
+[
+ gl_LIBUNISTRING_MODULE([$1], [$2])
+ m4_ifndef([gl_IN_LIBUNISTRING],
+ [if test -z "${AS_TR_CPP([LIBUNISTRING_COMPILE_$2])_TRUE}"; then
+ GL_MODULE_INDICATOR_PREFIX[]_GNULIB_[]AS_TR_CPP([$2_DLL_VARIABLE])=
+ fi
+ ])
+])
+
dnl gl_LIBUNISTRING_LIBHEADER([VERSION], [HeaderFile])
dnl Declares that HeaderFile should be created, unless we are linking
dnl with libunistring and its version is >= the given VERSION.
@@ -95,6 +126,26 @@ changequote([,])
LIBUNISTRING_VERSION_MINOR=`echo "$LIBUNISTRING_VERSION" | sed -n -e "$gl_libunistring_sed_extract_minor"`
LIBUNISTRING_VERSION_SUBMINOR=`echo "$LIBUNISTRING_VERSION" | sed -n -e "$gl_libunistring_sed_extract_subminor"`
fi
+
+ dnl Determine whether <unistring/woe32dll.h> from an installed libunistring
+ dnl is available.
+ m4_ifdef([gl_IN_LIBUNISTRING],
+ [dnl In libunistring, all .h files that declare variables need to
+ dnl #include <unistring/woe32dll.h>. This references the file
+ dnl unistring/woe32dll.h in libunistring.
+ HAVE_UNISTRING_WOE32DLL_H=1
+ ],
+ [dnl In gnulib or in applications, we need a #include <unistring/woe32dll.h>
+ dnl if and only if an installed libunistring is available.
+ if test "$HAVE_LIBUNISTRING" = yes; then
+ AC_CHECK_HEADERS([unistring/woe32dll.h],
+ [HAVE_UNISTRING_WOE32DLL_H=1],
+ [HAVE_UNISTRING_WOE32DLL_H=0])
+ else
+ HAVE_UNISTRING_WOE32DLL_H=0
+ fi
+ ])
+ AC_SUBST([HAVE_UNISTRING_WOE32DLL_H])
])
dnl gl_LIBUNISTRING_VERSION_CMP([VERSION])