Blame glm4/libunistring-base.m4

rpm-build 858c0f
# libunistring-base.m4 serial 5
rpm-build 858c0f
dnl Copyright (C) 2010-2017 Free Software Foundation, Inc.
rpm-build 858c0f
dnl This file is free software; the Free Software Foundation
rpm-build 858c0f
dnl gives unlimited permission to copy and/or distribute it,
rpm-build 858c0f
dnl with or without modifications, as long as this notice is preserved.
rpm-build 858c0f
rpm-build 858c0f
dnl From Paolo Bonzini and Bruno Haible.
rpm-build 858c0f
rpm-build 858c0f
dnl gl_LIBUNISTRING_MODULE([VERSION], [Module])
rpm-build 858c0f
dnl Declares that the source files of Module should be compiled, unless we
rpm-build 858c0f
dnl are linking with libunistring and its version is >= the given VERSION.
rpm-build 858c0f
dnl Defines an automake conditional LIBUNISTRING_COMPILE_$MODULE that is
rpm-build 858c0f
dnl true if the source files of Module should be compiled.
rpm-build 858c0f
dnl This macro is to be used for public libunistring API, not for
rpm-build 858c0f
dnl undocumented API.
rpm-build 858c0f
dnl
rpm-build 858c0f
dnl You have to bump the VERSION argument to the next projected version
rpm-build 858c0f
dnl number each time you make a change that affects the behaviour of the
rpm-build 858c0f
dnl functions defined in Module (even if the sources of Module itself do not
rpm-build 858c0f
dnl change).
rpm-build 858c0f
rpm-build 858c0f
AC_DEFUN([gl_LIBUNISTRING_MODULE],
rpm-build 858c0f
[
rpm-build 858c0f
  AC_REQUIRE([gl_LIBUNISTRING_LIB_PREPARE])
rpm-build 858c0f
  dnl Use the variables HAVE_LIBUNISTRING, LIBUNISTRING_VERSION from
rpm-build 858c0f
  dnl gl_LIBUNISTRING_CORE if that macro has been run.
rpm-build 858c0f
  AM_CONDITIONAL(AS_TR_CPP([LIBUNISTRING_COMPILE_$2]),
rpm-build 858c0f
    [gl_LIBUNISTRING_VERSION_CMP([$1])])
rpm-build 858c0f
])
rpm-build 858c0f
rpm-build 858c0f
dnl gl_LIBUNISTRING_LIBHEADER([VERSION], [HeaderFile])
rpm-build 858c0f
dnl Declares that HeaderFile should be created, unless we are linking
rpm-build 858c0f
dnl with libunistring and its version is >= the given VERSION.
rpm-build 858c0f
dnl HeaderFile should be relative to the lib directory and end in '.h'.
rpm-build 858c0f
dnl Prepares for substituting LIBUNISTRING_HEADERFILE (to HeaderFile or empty).
rpm-build 858c0f
dnl
rpm-build 858c0f
dnl When we are linking with the already installed libunistring and its version
rpm-build 858c0f
dnl is < VERSION, we create HeaderFile here, because we may compile functions
rpm-build 858c0f
dnl (via gl_LIBUNISTRING_MODULE above) that are not contained in the installed
rpm-build 858c0f
dnl version.
rpm-build 858c0f
dnl When we are linking with the already installed libunistring and its version
rpm-build 858c0f
dnl is > VERSION, we don't create HeaderFile here: it could cause compilation
rpm-build 858c0f
dnl errors in other libunistring header files if some types are missing.
rpm-build 858c0f
dnl
rpm-build 858c0f
dnl You have to bump the VERSION argument to the next projected version
rpm-build 858c0f
dnl number each time you make a non-comment change to the HeaderFile.
rpm-build 858c0f
rpm-build 858c0f
AC_DEFUN([gl_LIBUNISTRING_LIBHEADER],
rpm-build 858c0f
[
rpm-build 858c0f
  AC_REQUIRE([gl_LIBUNISTRING_LIB_PREPARE])
rpm-build 858c0f
  dnl Use the variables HAVE_LIBUNISTRING, LIBUNISTRING_VERSION from
rpm-build 858c0f
  dnl gl_LIBUNISTRING_CORE if that macro has been run.
rpm-build 858c0f
  if gl_LIBUNISTRING_VERSION_CMP([$1]); then
rpm-build 858c0f
    LIBUNISTRING_[]AS_TR_CPP([$2])='$2'
rpm-build 858c0f
  else
rpm-build 858c0f
    LIBUNISTRING_[]AS_TR_CPP([$2])=
rpm-build 858c0f
  fi
rpm-build 858c0f
  AC_SUBST([LIBUNISTRING_]AS_TR_CPP([$2]))
rpm-build 858c0f
])
rpm-build 858c0f
rpm-build 858c0f
dnl Miscellaneous preparations/initializations.
rpm-build 858c0f
rpm-build 858c0f
AC_DEFUN([gl_LIBUNISTRING_LIB_PREPARE],
rpm-build 858c0f
[
rpm-build 858c0f
  dnl Ensure that HAVE_LIBUNISTRING is fully determined at this point.
rpm-build 858c0f
  m4_ifdef([gl_LIBUNISTRING], [AC_REQUIRE([gl_LIBUNISTRING])])
rpm-build 858c0f
rpm-build 858c0f
  AC_REQUIRE([AC_PROG_AWK])
rpm-build 858c0f
rpm-build 858c0f
dnl Sed expressions to extract the parts of a version number.
rpm-build 858c0f
changequote(,)
rpm-build 858c0f
gl_libunistring_sed_extract_major='/^[0-9]/{s/^\([0-9]*\).*/\1/p;q;}
rpm-build 858c0f
i\
rpm-build 858c0f
0
rpm-build 858c0f
q
rpm-build 858c0f
'
rpm-build 858c0f
gl_libunistring_sed_extract_minor='/^[0-9][0-9]*[.][0-9]/{s/^[0-9]*[.]\([0-9]*\).*/\1/p;q;}
rpm-build 858c0f
i\
rpm-build 858c0f
0
rpm-build 858c0f
q
rpm-build 858c0f
'
rpm-build 858c0f
gl_libunistring_sed_extract_subminor='/^[0-9][0-9]*[.][0-9][0-9]*[.][0-9]/{s/^[0-9]*[.][0-9]*[.]\([0-9]*\).*/\1/p;q;}
rpm-build 858c0f
i\
rpm-build 858c0f
0
rpm-build 858c0f
q
rpm-build 858c0f
'
rpm-build 858c0f
changequote([,])
rpm-build 858c0f
rpm-build 858c0f
  if test "$HAVE_LIBUNISTRING" = yes; then
rpm-build 858c0f
    LIBUNISTRING_VERSION_MAJOR=`echo "$LIBUNISTRING_VERSION" | sed -n -e "$gl_libunistring_sed_extract_major"`
rpm-build 858c0f
    LIBUNISTRING_VERSION_MINOR=`echo "$LIBUNISTRING_VERSION" | sed -n -e "$gl_libunistring_sed_extract_minor"`
rpm-build 858c0f
    LIBUNISTRING_VERSION_SUBMINOR=`echo "$LIBUNISTRING_VERSION" | sed -n -e "$gl_libunistring_sed_extract_subminor"`
rpm-build 858c0f
  fi
rpm-build 858c0f
])
rpm-build 858c0f
rpm-build 858c0f
dnl gl_LIBUNISTRING_VERSION_CMP([VERSION])
rpm-build 858c0f
dnl Expands to a shell statement that evaluates to true if LIBUNISTRING_VERSION
rpm-build 858c0f
dnl is less than the VERSION argument.
rpm-build 858c0f
AC_DEFUN([gl_LIBUNISTRING_VERSION_CMP],
rpm-build 858c0f
[ { test "$HAVE_LIBUNISTRING" != yes \
rpm-build 858c0f
    || {
rpm-build 858c0f
         dnl AS_LITERAL_IF exists and works fine since autoconf-2.59 at least.
rpm-build 858c0f
         AS_LITERAL_IF([$1],
rpm-build 858c0f
           [dnl This is the optimized variant, that assumes the argument is a literal:
rpm-build 858c0f
            m4_pushdef([requested_version_major],
rpm-build 858c0f
              [gl_LIBUNISTRING_ARG_OR_ZERO(m4_bpatsubst([$1], [^\([0-9]*\).*], [\1]), [])])
rpm-build 858c0f
            m4_pushdef([requested_version_minor],
rpm-build 858c0f
              [gl_LIBUNISTRING_ARG_OR_ZERO(m4_bpatsubst([$1], [^[0-9]*[.]\([0-9]*\).*], [\1]), [$1])])
rpm-build 858c0f
            m4_pushdef([requested_version_subminor],
rpm-build 858c0f
              [gl_LIBUNISTRING_ARG_OR_ZERO(m4_bpatsubst([$1], [^[0-9]*[.][0-9]*[.]\([0-9]*\).*], [\1]), [$1])])
rpm-build 858c0f
            test $LIBUNISTRING_VERSION_MAJOR -lt requested_version_major \
rpm-build 858c0f
            || { test $LIBUNISTRING_VERSION_MAJOR -eq requested_version_major \
rpm-build 858c0f
                 && { test $LIBUNISTRING_VERSION_MINOR -lt requested_version_minor \
rpm-build 858c0f
                      || { test $LIBUNISTRING_VERSION_MINOR -eq requested_version_minor \
rpm-build 858c0f
                           && test $LIBUNISTRING_VERSION_SUBMINOR -lt requested_version_subminor
rpm-build 858c0f
                         }
rpm-build 858c0f
                    }
rpm-build 858c0f
               }
rpm-build 858c0f
            m4_popdef([requested_version_subminor])
rpm-build 858c0f
            m4_popdef([requested_version_minor])
rpm-build 858c0f
            m4_popdef([requested_version_major])
rpm-build 858c0f
           ],
rpm-build 858c0f
           [dnl This is the unoptimized variant:
rpm-build 858c0f
            requested_version_major=`echo '$1' | sed -n -e "$gl_libunistring_sed_extract_major"`
rpm-build 858c0f
            requested_version_minor=`echo '$1' | sed -n -e "$gl_libunistring_sed_extract_minor"`
rpm-build 858c0f
            requested_version_subminor=`echo '$1' | sed -n -e "$gl_libunistring_sed_extract_subminor"`
rpm-build 858c0f
            test $LIBUNISTRING_VERSION_MAJOR -lt $requested_version_major \
rpm-build 858c0f
            || { test $LIBUNISTRING_VERSION_MAJOR -eq $requested_version_major \
rpm-build 858c0f
                 && { test $LIBUNISTRING_VERSION_MINOR -lt $requested_version_minor \
rpm-build 858c0f
                      || { test $LIBUNISTRING_VERSION_MINOR -eq $requested_version_minor \
rpm-build 858c0f
                           && test $LIBUNISTRING_VERSION_SUBMINOR -lt $requested_version_subminor
rpm-build 858c0f
                         }
rpm-build 858c0f
                    }
rpm-build 858c0f
               }
rpm-build 858c0f
           ])
rpm-build 858c0f
       }
rpm-build 858c0f
  }])
rpm-build 858c0f
rpm-build 858c0f
dnl gl_LIBUNISTRING_ARG_OR_ZERO([ARG], [ORIG]) expands to ARG if it is not the
rpm-build 858c0f
dnl same as ORIG, otherwise to 0.
rpm-build 858c0f
m4_define([gl_LIBUNISTRING_ARG_OR_ZERO], [m4_if([$1], [$2], [0], [$1])])