maint: update copyright
[gnulib.git] / m4 / libunistring-base.m4
index 54aa521..d003267 100644 (file)
@@ -1,34 +1,31 @@
-# libunistring-base.m4 serial 2
-dnl Copyright (C) 2010 Free Software Foundation, Inc.
+# libunistring-base.m4 serial 5
+dnl Copyright (C) 2010-2014 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
 
 dnl From Paolo Bonzini and Bruno Haible.
 
-dnl gl_LIBUNISTRING_LIBSOURCE([VERSION], [SourceFile])
-dnl Declares that SourceFile should be compiled, unless we are linking
-dnl with libunistring and its version is >= the given VERSION.
-dnl SourceFile should be relative to the lib directory and end in '.c'.
+dnl gl_LIBUNISTRING_MODULE([VERSION], [Module])
+dnl Declares that the source files of Module should be compiled, unless we
+dnl are linking with libunistring and its version is >= the given VERSION.
+dnl Defines an automake conditional LIBUNISTRING_COMPILE_$MODULE that is
+dnl true if the source files of Module should be compiled.
 dnl This macro is to be used for public libunistring API, not for
 dnl undocumented API.
 dnl
 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 SourceFile (even if SourceFile itself does not
+dnl functions defined in Module (even if the sources of Module itself do not
 dnl change).
 
-AC_DEFUN([gl_LIBUNISTRING_LIBSOURCE],
+AC_DEFUN([gl_LIBUNISTRING_MODULE],
 [
   AC_REQUIRE([gl_LIBUNISTRING_LIB_PREPARE])
   dnl Use the variables HAVE_LIBUNISTRING, LIBUNISTRING_VERSION from
   dnl gl_LIBUNISTRING_CORE if that macro has been run.
-  if gl_LIBUNISTRING_VERSION_CMP([$1])
-  then
-    m4_foreach_w([gl_source_file], [$2],
-      [AC_LIBOBJ(m4_bpatsubst(m4_defn([gl_source_file]), [\.c$], []))
-      ])
-  fi
+  AM_CONDITIONAL(AS_TR_CPP([LIBUNISTRING_COMPILE_$2]),
+    [gl_LIBUNISTRING_VERSION_CMP([$1])])
 ])
 
 dnl gl_LIBUNISTRING_LIBHEADER([VERSION], [HeaderFile])
@@ -39,8 +36,8 @@ dnl Prepares for substituting LIBUNISTRING_HEADERFILE (to HeaderFile or empty).
 dnl
 dnl When we are linking with the already installed libunistring and its version
 dnl is < VERSION, we create HeaderFile here, because we may compile functions
-dnl (via gl_LIBUNISTRING_LIBSOURCE above) that are not contained in the
-dnl installed version.
+dnl (via gl_LIBUNISTRING_MODULE above) that are not contained in the installed
+dnl version.
 dnl When we are linking with the already installed libunistring and its version
 dnl is > VERSION, we don't create HeaderFile here: it could cause compilation
 dnl errors in other libunistring header files if some types are missing.
@@ -53,8 +50,7 @@ AC_DEFUN([gl_LIBUNISTRING_LIBHEADER],
   AC_REQUIRE([gl_LIBUNISTRING_LIB_PREPARE])
   dnl Use the variables HAVE_LIBUNISTRING, LIBUNISTRING_VERSION from
   dnl gl_LIBUNISTRING_CORE if that macro has been run.
-  if gl_LIBUNISTRING_VERSION_CMP([$1])
-  then
+  if gl_LIBUNISTRING_VERSION_CMP([$1]); then
     LIBUNISTRING_[]AS_TR_CPP([$2])='$2'
   else
     LIBUNISTRING_[]AS_TR_CPP([$2])=
@@ -66,6 +62,9 @@ dnl Miscellaneous preparations/initializations.
 
 AC_DEFUN([gl_LIBUNISTRING_LIB_PREPARE],
 [
+  dnl Ensure that HAVE_LIBUNISTRING is fully determined at this point.
+  m4_ifdef([gl_LIBUNISTRING], [AC_REQUIRE([gl_LIBUNISTRING])])
+
   AC_REQUIRE([AC_PROG_AWK])
 
 dnl Sed expressions to extract the parts of a version number.
@@ -135,8 +134,7 @@ AC_DEFUN([gl_LIBUNISTRING_VERSION_CMP],
                }
            ])
        }
-  }
-])
+  }])
 
 dnl gl_LIBUNISTRING_ARG_OR_ZERO([ARG], [ORIG]) expands to ARG if it is not the
 dnl same as ORIG, otherwise to 0.