Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1 | For reasons which I just can't fathom gnulib doesn't use the expected tools to |
| 2 | find libraries but badly reinvents the wheel. This will trivially lead to host |
| 3 | contamination (explicit searches of /usr/lib) or incorrect RPATHs (bad |
| 4 | canonicalisation resulting in relative paths). |
| 5 | |
| 6 | Simply delete all the crazy, and replace with a single call to pkg-config. |
| 7 | |
| 8 | Upstream-Status: Inappropriate (upstream still refuse to consider pkg-config) |
| 9 | Signed-off-by: Ross Burton <ross.burton@intel.com> |
| 10 | |
| 11 | diff --git a/gnulib-local/m4/libcroco.m4 b/gnulib-local/m4/libcroco.m4 |
| 12 | index f79ea82f1..1f67274db 100644 |
| 13 | --- a/gettext-tools/gnulib-m4/libcroco.m4 |
| 14 | +++ b/gettext-tools/gnulib-m4/libcroco.m4 |
| 15 | @@ -8,6 +8,7 @@ dnl From Bruno Haible. |
| 16 | |
| 17 | AC_DEFUN([gl_LIBCROCO], |
| 18 | [ |
| 19 | + AC_REQUIRE([PKG_PROG_PKG_CONFIG]) |
| 20 | dnl libcroco depends on libglib. |
| 21 | AC_REQUIRE([gl_LIBGLIB]) |
| 22 | |
| 23 | @@ -23,65 +24,10 @@ AC_DEFUN([gl_LIBCROCO], |
| 24 | LTLIBCROCO= |
| 25 | INCCROCO= |
| 26 | if test "$gl_cv_libcroco_use_included" != yes; then |
| 27 | - dnl Figure out whether we can use a preinstalled libcroco-0.6, or have to |
| 28 | - dnl use the included one. |
| 29 | - AC_CACHE_VAL([gl_cv_libcroco], [ |
| 30 | - gl_cv_libcroco=no |
| 31 | - gl_cv_LIBCROCO= |
| 32 | - gl_cv_LTLIBCROCO= |
| 33 | - gl_cv_INCCROCO= |
| 34 | - gl_save_LIBS="$LIBS" |
| 35 | - dnl Search for libcroco and define LIBCROCO_0_6, LTLIBCROCO_0_6 and |
| 36 | - dnl INCCROCO_0_6 accordingly. |
| 37 | - dnl Don't use croco-0.6-config nor pkg-config, since it doesn't work when |
| 38 | - dnl cross-compiling or when the C compiler in use is different from the |
| 39 | - dnl one that built the library. |
| 40 | - AC_LIB_LINKFLAGS_BODY([croco-0.6], [glib-2.0]) |
| 41 | - LIBS="$gl_save_LIBS $LIBCROCO_0_6" |
| 42 | - AC_TRY_LINK([#include <libcroco-config.h>], |
| 43 | - [const char *version = LIBCROCO_VERSION; return !version;], |
| 44 | - [gl_cv_libcroco=yes |
| 45 | - gl_cv_LIBCROCO="$LIBCROCO_0_6" |
| 46 | - gl_cv_LTLIBCROCO="$LTLIBCROCO_0_6" |
| 47 | - ]) |
| 48 | - if test "$gl_cv_libcroco" != yes; then |
| 49 | - gl_save_CPPFLAGS="$CPPFLAGS" |
| 50 | - CPPFLAGS="$CPPFLAGS $INCCROCO_0_6" |
| 51 | - AC_TRY_LINK([#include <libcroco-config.h>], |
| 52 | - [const char *version = LIBCROCO_VERSION; return !version;], |
| 53 | - [gl_cv_libcroco=yes |
| 54 | - gl_cv_LIBCROCO="$LIBCROCO_0_6" |
| 55 | - gl_cv_LTLIBCROCO="$LTLIBCROCO_0_6" |
| 56 | - gl_cv_INCCROCO="$INCCROCO_0_6" |
| 57 | - ]) |
| 58 | - if test "$gl_cv_libcroco" != yes; then |
| 59 | - dnl Often the include files are installed in |
| 60 | - dnl /usr/include/libcroco-0.6/libcroco. |
| 61 | - AC_TRY_LINK([#include <libcroco-0.6/libcroco/libcroco-config.h>], |
| 62 | - [const char *version = LIBCROCO_VERSION; return !version;], |
| 63 | - [gl_ABSOLUTE_HEADER([libcroco-0.6/libcroco/libcroco-config.h]) |
| 64 | - libcroco_include_dir=`echo "$gl_cv_absolute_libcroco_0_6_libcroco_libcroco_config_h" | sed -e 's,.libcroco-config\.h$,,'` |
| 65 | - if test -d "$libcroco_include_dir"; then |
| 66 | - gl_cv_libcroco=yes |
| 67 | - gl_cv_LIBCROCO="$LIBCROCO_0_6" |
| 68 | - gl_cv_LTLIBCROCO="$LTLIBCROCO_0_6" |
| 69 | - gl_cv_INCCROCO="-I$libcroco_include_dir" |
| 70 | - fi |
| 71 | - ]) |
| 72 | - fi |
| 73 | - CPPFLAGS="$gl_save_CPPFLAGS" |
| 74 | - fi |
| 75 | - LIBS="$gl_save_LIBS" |
| 76 | - ]) |
| 77 | - AC_MSG_CHECKING([for libcroco]) |
| 78 | - AC_MSG_RESULT([$gl_cv_libcroco]) |
| 79 | - if test $gl_cv_libcroco = yes; then |
| 80 | - LIBCROCO="$gl_cv_LIBCROCO" |
| 81 | - LTLIBCROCO="$gl_cv_LTLIBCROCO" |
| 82 | - INCCROCO="$gl_cv_INCCROCO" |
| 83 | - else |
| 84 | - gl_cv_libcroco_use_included=yes |
| 85 | - fi |
| 86 | + PKG_CHECK_MODULES([CROCO], [libcroco-0.6]) |
| 87 | + LIBCROCO=$CROCO_LIBS |
| 88 | + LTLIBCROCO=$CROCO_LIBS |
| 89 | + INCCROCO=$CROCO_CFLAGS |
| 90 | fi |
| 91 | AC_SUBST([LIBCROCO]) |
| 92 | AC_SUBST([LTLIBCROCO]) |
| 93 | diff --git a/gnulib-local/m4/libglib.m4 b/gnulib-local/m4/libglib.m4 |
| 94 | index 42e55e6fd..ab25a5b22 100644 |
| 95 | --- a/gettext-tools/gnulib-m4/libglib.m4 |
| 96 | +++ b/gettext-tools/gnulib-m4/libglib.m4 |
| 97 | @@ -8,6 +8,7 @@ dnl From Bruno Haible. |
| 98 | |
| 99 | AC_DEFUN([gl_LIBGLIB], |
| 100 | [ |
| 101 | + AC_REQUIRE([PKG_PROG_PKG_CONFIG]) |
| 102 | AC_MSG_CHECKING([whether included glib is requested]) |
| 103 | AC_ARG_WITH([included-glib], |
| 104 | [ --with-included-glib use the glib2 included here], |
| 105 | @@ -20,76 +21,10 @@ AC_DEFUN([gl_LIBGLIB], |
| 106 | LTLIBGLIB= |
| 107 | INCGLIB= |
| 108 | if test "$gl_cv_libglib_use_included" != yes; then |
| 109 | - dnl Figure out whether we can use a preinstalled libglib-2.0, or have to use |
| 110 | - dnl the included one. |
| 111 | - AC_CACHE_VAL([gl_cv_libglib], [ |
| 112 | - gl_cv_libglib=no |
| 113 | - gl_cv_LIBGLIB= |
| 114 | - gl_cv_LTLIBGLIB= |
| 115 | - gl_cv_INCGLIB= |
| 116 | - gl_save_LIBS="$LIBS" |
| 117 | - dnl Search for libglib2 and define LIBGLIB_2_0, LTLIBGLIB_2_0 and |
| 118 | - dnl INCGLIB_2_0 accordingly. |
| 119 | - dnl Don't use glib-config nor pkg-config, since it doesn't work when |
| 120 | - dnl cross-compiling or when the C compiler in use is different from the |
| 121 | - dnl one that built the library. |
| 122 | - AC_LIB_LINKFLAGS_BODY([glib-2.0]) |
| 123 | - LIBS="$gl_save_LIBS $LIBGLIB_2_0" |
| 124 | - AC_TRY_LINK([#include <glib.h> |
| 125 | -#ifndef G_BEGIN_DECLS |
| 126 | -error this glib.h includes a glibconfig.h from a glib version 1.x |
| 127 | -#endif |
| 128 | -], |
| 129 | - [g_string_new ("foo");], |
| 130 | - [gl_cv_libglib=yes |
| 131 | - gl_cv_LIBGLIB="$LIBGLIB_2_0" |
| 132 | - gl_cv_LTLIBGLIB="$LTLIBGLIB_2_0" |
| 133 | - ]) |
| 134 | - if test "$gl_cv_libglib" != yes; then |
| 135 | - gl_save_CPPFLAGS="$CPPFLAGS" |
| 136 | - CPPFLAGS="$CPPFLAGS $INCGLIB_2_0" |
| 137 | - AC_TRY_LINK([#include <glib.h> |
| 138 | -#ifndef G_BEGIN_DECLS |
| 139 | -error this glib.h includes a glibconfig.h from a glib version 1.x |
| 140 | -#endif |
| 141 | -], |
| 142 | - [g_string_new ("foo");], |
| 143 | - [gl_cv_libglib=yes |
| 144 | - gl_cv_LIBGLIB="$LIBGLIB_2_0" |
| 145 | - gl_cv_LTLIBGLIB="$LTLIBGLIB_2_0" |
| 146 | - gl_cv_INCGLIB="$INCGLIB_2_0" |
| 147 | - ]) |
| 148 | - if test "$gl_cv_libglib" != yes; then |
| 149 | - dnl Often the include files are installed in /usr/include/glib-2.0 |
| 150 | - dnl and /usr/lib/glib-2.0/include. |
| 151 | - if test -n "$LIBGLIB_2_0_PREFIX"; then |
| 152 | - CPPFLAGS="$gl_save_CPPFLAGS -I$LIBGLIB_2_0_PREFIX/include/glib-2.0 -I$LIBGLIB_2_0_PREFIX/$acl_libdirstem/glib-2.0/include" |
| 153 | - AC_TRY_LINK([#include <glib.h> |
| 154 | -#ifndef G_BEGIN_DECLS |
| 155 | -error this glib.h includes a glibconfig.h from a glib version 1.x |
| 156 | -#endif |
| 157 | -], |
| 158 | - [g_string_new ("foo");], |
| 159 | - [gl_cv_libglib=yes |
| 160 | - gl_cv_LIBGLIB="$LIBGLIB_2_0" |
| 161 | - gl_cv_LTLIBGLIB="$LTLIBGLIB_2_0" |
| 162 | - gl_cv_INCGLIB="-I$LIBGLIB_2_0_PREFIX/include/glib-2.0 -I$LIBGLIB_2_0_PREFIX/$acl_libdirstem/glib-2.0/include" |
| 163 | - ]) |
| 164 | - fi |
| 165 | - fi |
| 166 | - CPPFLAGS="$gl_save_CPPFLAGS" |
| 167 | - fi |
| 168 | - LIBS="$gl_save_LIBS" |
| 169 | - ]) |
| 170 | - AC_MSG_CHECKING([for glib]) |
| 171 | - AC_MSG_RESULT([$gl_cv_libglib]) |
| 172 | - if test $gl_cv_libglib = yes; then |
| 173 | - LIBGLIB="$gl_cv_LIBGLIB" |
| 174 | - LTLIBGLIB="$gl_cv_LTLIBGLIB" |
| 175 | - INCGLIB="$gl_cv_INCGLIB" |
| 176 | - else |
| 177 | - gl_cv_libglib_use_included=yes |
| 178 | - fi |
| 179 | + PKG_CHECK_MODULES([GLIB], [glib-2.0]) |
| 180 | + LIBGLIB="$GLIB_LIBS" |
| 181 | + LTLIBGLIB="$GLIB_LIBS" |
| 182 | + INCGLIB="$GLIB_CFLAGS" |
| 183 | fi |
| 184 | AC_SUBST([LIBGLIB]) |
| 185 | AC_SUBST([LTLIBGLIB]) |
| 186 | diff --git a/gnulib-local/m4/libxml.m4 b/gnulib-local/m4/libxml.m4 |
| 187 | index 480c700d2..cb39309d5 100644 |
| 188 | --- a/gettext-tools/gnulib-m4/libxml.m4 |
| 189 | +++ b/gettext-tools/gnulib-m4/libxml.m4 |
| 190 | @@ -8,6 +8,7 @@ dnl From Bruno Haible. |
| 191 | |
| 192 | AC_DEFUN([gl_LIBXML], |
| 193 | [ |
| 194 | + AC_REQUIRE([PKG_PROG_PKG_CONFIG]) |
| 195 | AC_REQUIRE([AM_ICONV_LINK]) |
| 196 | |
| 197 | AC_MSG_CHECKING([whether included libxml is requested]) |
| 198 | @@ -22,100 +22,10 @@ AC_DEFUN([gl_LIBXML], |
| 199 | LTLIBXML= |
| 200 | INCXML= |
| 201 | if test "$gl_cv_libxml_use_included" != yes; then |
| 202 | - dnl Figure out whether we can use a preinstalled libxml2, or have to use |
| 203 | - dnl the included one. |
| 204 | - AC_CACHE_VAL([gl_cv_libxml], [ |
| 205 | - gl_cv_libxml=no |
| 206 | - gl_cv_LIBXML= |
| 207 | - gl_cv_LTLIBXML= |
| 208 | - gl_cv_INCXML= |
| 209 | - gl_save_LIBS="$LIBS" |
| 210 | - LIBS="$LIBS $LIBICONV" |
| 211 | - dnl Search for libxml2 and define LIBXML2, LTLIBXML2 and INCXML2 |
| 212 | - dnl accordingly. |
| 213 | - dnl Don't use xml2-config nor pkg-config, since it doesn't work when |
| 214 | - dnl cross-compiling or when the C compiler in use is different from the |
| 215 | - dnl one that built the library. |
| 216 | - dnl Use a test program that tries to invoke xmlFree. On Cygwin 1.7.x, |
| 217 | - dnl libxml2 is built in such a way that uses of xmlFree work fine with |
| 218 | - dnl -Wl,--enable-auto-import but lead to a link error with |
| 219 | - dnl -Wl,--disable-auto-import. |
| 220 | - AC_LIB_LINKFLAGS_BODY([xml2]) |
| 221 | - LIBS="$gl_save_LIBS $LIBXML2 $LIBICONV" |
| 222 | - AC_TRY_LINK([#include <libxml/xmlversion.h> |
| 223 | - #include <libxml/xmlmemory.h> |
| 224 | - #include <libxml/xpath.h> |
| 225 | - ], |
| 226 | - [xmlCheckVersion (0); |
| 227 | - xmlFree ((void *) 0); |
| 228 | - xmlXPathSetContextNode ((void *)0, (void *)0); |
| 229 | - ], |
| 230 | - [gl_cv_libxml=yes |
| 231 | - gl_cv_LIBXML="$LIBXML2 $LIBICONV" |
| 232 | - gl_cv_LTLIBXML="$LTLIBXML2 $LTLIBICONV" |
| 233 | - ]) |
| 234 | - if test "$gl_cv_libxml" != yes; then |
| 235 | - gl_save_CPPFLAGS="$CPPFLAGS" |
| 236 | - CPPFLAGS="$CPPFLAGS $INCXML2" |
| 237 | - AC_TRY_LINK([#include <libxml/xmlversion.h> |
| 238 | - #include <libxml/xmlmemory.h> |
| 239 | - #include <libxml/xpath.h> |
| 240 | - ], |
| 241 | - [xmlCheckVersion (0); |
| 242 | - xmlFree ((void *) 0); |
| 243 | - xmlXPathSetContextNode ((void *)0, (void *)0); |
| 244 | - ], |
| 245 | - [gl_cv_libxml=yes |
| 246 | - gl_cv_LIBXML="$LIBXML2 $LIBICONV" |
| 247 | - gl_cv_LTLIBXML="$LTLIBXML2 $LTLIBICONV" |
| 248 | - gl_cv_INCXML="$INCXML2" |
| 249 | - ]) |
| 250 | - if test "$gl_cv_libxml" != yes; then |
| 251 | - dnl Often the include files are installed in /usr/include/libxml2. |
| 252 | - dnl In libxml2-2.5, <libxml/xmlversion.h> is self-contained. |
| 253 | - dnl In libxml2-2.6, it includes <libxml/xmlexports.h> which is |
| 254 | - dnl self-contained. |
| 255 | - libxml2_include_dir= |
| 256 | - AC_TRY_CPP([#include <libxml2/libxml/xmlexports.h>], |
| 257 | - [gl_ABSOLUTE_HEADER([libxml2/libxml/xmlexports.h]) |
| 258 | - libxml2_include_dir=`echo "$gl_cv_absolute_libxml2_libxml_xmlexports_h" | sed -e 's,.libxml.xmlexports\.h$,,'` |
| 259 | - ]) |
| 260 | - if test -z "$libxml2_include_dir"; then |
| 261 | - AC_TRY_CPP([#include <libxml2/libxml/xmlversion.h>], |
| 262 | - [gl_ABSOLUTE_HEADER([libxml2/libxml/xmlversion.h]) |
| 263 | - libxml2_include_dir=`echo "$gl_cv_absolute_libxml2_libxml_xmlversion_h" | sed -e 's,.libxml.xmlversion\.h$,,'` |
| 264 | - ]) |
| 265 | - fi |
| 266 | - if test -n "$libxml2_include_dir" && test -d "$libxml2_include_dir"; then |
| 267 | - CPPFLAGS="$gl_save_CPPFLAGS -I$libxml2_include_dir" |
| 268 | - AC_TRY_LINK([#include <libxml/xmlversion.h> |
| 269 | - #include <libxml/xmlmemory.h> |
| 270 | - #include <libxml/xpath.h> |
| 271 | - ], |
| 272 | - [xmlCheckVersion (0); |
| 273 | - xmlFree ((void *) 0); |
| 274 | - xmlXPathSetContextNode ((void *)0, (void *)0); |
| 275 | - ], |
| 276 | - [gl_cv_libxml=yes |
| 277 | - gl_cv_LIBXML="$LIBXML2 $LIBICONV" |
| 278 | - gl_cv_LTLIBXML="$LTLIBXML2 $LTLIBICONV" |
| 279 | - gl_cv_INCXML="-I$libxml2_include_dir" |
| 280 | - ]) |
| 281 | - fi |
| 282 | - fi |
| 283 | - CPPFLAGS="$gl_save_CPPFLAGS" |
| 284 | - fi |
| 285 | - LIBS="$gl_save_LIBS" |
| 286 | - ]) |
| 287 | - AC_MSG_CHECKING([for libxml]) |
| 288 | - AC_MSG_RESULT([$gl_cv_libxml]) |
| 289 | - if test $gl_cv_libxml = yes; then |
| 290 | - LIBXML="$gl_cv_LIBXML" |
| 291 | - LTLIBXML="$gl_cv_LTLIBXML" |
| 292 | - INCXML="$gl_cv_INCXML" |
| 293 | - else |
| 294 | - gl_cv_libxml_use_included=yes |
| 295 | - fi |
| 296 | + PKG_CHECK_MODULES([XML], [libxml-2.0]) |
| 297 | + LIBXML=$XML_LIBS |
| 298 | + LTLIBXML=$XML_LIBS |
| 299 | + INCXML=$XML_CFLAGS |
| 300 | fi |
| 301 | AC_SUBST([LIBXML]) |
| 302 | AC_SUBST([LTLIBXML]) |
| 303 | diff --git a/gnulib-local/lib/term-styled-ostream.oo.c b/gnulib-local/lib/term-styled-ostream.oo.c |
| 304 | index 81a407467..218565329 100644 |
| 305 | --- a/gettext-tools/gnulib-lib/term-styled-ostream.oo.c |
| 306 | +++ b/gettext-tools/gnulib-lib/term-styled-ostream.oo.c |
| 307 | @@ -25,4 +25,4 @@ |
| 308 | -#include <cr-om-parser.h> |
| 309 | -#include <cr-sel-eng.h> |
| 310 | -#include <cr-style.h> |
| 311 | -#include <cr-rgb.h> |
| 312 | +#include <libcroco/cr-om-parser.h> |
| 313 | +#include <libcroco/cr-sel-eng.h> |
| 314 | +#include <libcroco/cr-style.h> |
| 315 | +#include <libcroco/cr-rgb.h> |
| 316 | @@ -31 +31 @@ |
| 317 | -# include <cr-fonts.h> |
| 318 | +# include <libcroco/cr-fonts.h> |
| 319 | @@ -33 +33 @@ |
| 320 | -#include <cr-string.h> |
| 321 | +#include <libcroco/cr-string.h> |