diff options
author | Christoph Reiter <reiter.christoph@gmail.com> | 2019-11-10 19:51:33 +0100 |
---|---|---|
committer | Christoph Reiter <reiter.christoph@gmail.com> | 2019-11-11 20:50:28 +0000 |
commit | bd3bb463adf6952bcad5de967181a950ca105111 (patch) | |
tree | 3a476e7f0ab8f255f269a21a4ddc676d74354008 /m4 | |
parent | ef3d27ce94ea822b7de84afd3ead58192d477af5 (diff) | |
download | gobject-introspection-bd3bb463adf6952bcad5de967181a950ca105111.tar.gz |
autotools: Make INTROSPECTION_GIRDIR/INTROSPECTION_TYPELIBDIR respect prefix/datadir/libdir
The provided m4 macro uses pkg-config for setting INTROSPECTION_GIRDIR and INTROSPECTION_TYPELIBDIR
which can be used to install the generated gir/typelib files into. Up until now this always used
the prefix encoded in the g-i .pc file and ignored the prefix provided by the autotools project using it.
This can be fixed by passing "--define-variable=datadir=/mydatadir" to pkg-config. To get the real value of
datadir include a copy of AS_AC_EXPAND in our m4 and use it to expand the variables we need so we can
pass the real paths to pkg-config which will use them to generate the new girdir/typelibdir paths.
The reason this hasn't been much of a problem is that the example autotools code suggested using
"girdir = $(datadir)/gir-1.0" and "typelibsdir = $(libdir)/girepository-1.0" and not using the variables defined
by our macro, so not many projects used it. Now both ways should work.
See !133
Diffstat (limited to 'm4')
-rw-r--r-- | m4/introspection.m4 | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/m4/introspection.m4 b/m4/introspection.m4 index d89c3d90..0513a4c8 100644 --- a/m4/introspection.m4 +++ b/m4/introspection.m4 @@ -8,6 +8,47 @@ dnl # serial 1 +dnl This is a copy of AS_AC_EXPAND +dnl +dnl (C) 2003, 2004, 2005 Thomas Vander Stichele <thomas at apestaart dot org> +dnl Copying and distribution of this file, with or without modification, +dnl are permitted in any medium without royalty provided the copyright +dnl notice and this notice are preserved. +m4_define([_GOBJECT_INTROSPECTION_AS_AC_EXPAND], +[ + EXP_VAR=[$1] + FROM_VAR=[$2] + + dnl first expand prefix and exec_prefix if necessary + prefix_save=$prefix + exec_prefix_save=$exec_prefix + + dnl if no prefix given, then use /usr/local, the default prefix + if test "x$prefix" = "xNONE"; then + prefix="$ac_default_prefix" + fi + dnl if no exec_prefix given, then use prefix + if test "x$exec_prefix" = "xNONE"; then + exec_prefix=$prefix + fi + + full_var="$FROM_VAR" + dnl loop until it doesn't change anymore + while true; do + new_full_var="`eval echo $full_var`" + if test "x$new_full_var" = "x$full_var"; then break; fi + full_var=$new_full_var + done + + dnl clean up + full_var=$new_full_var + AC_SUBST([$1], "$full_var") + + dnl restore prefix and exec_prefix + prefix=$prefix_save + exec_prefix=$exec_prefix_save +]) + m4_define([_GOBJECT_INTROSPECTION_CHECK_INTERNAL], [ AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first @@ -50,6 +91,11 @@ m4_define([_GOBJECT_INTROSPECTION_CHECK_INTERNAL], AC_MSG_RESULT([$found_introspection]) + dnl expand datadir/libdir so we can pass them to pkg-config + dnl and get paths relative to our target directories + _GOBJECT_INTROSPECTION_AS_AC_EXPAND(_GI_EXP_DATADIR, "$datadir") + _GOBJECT_INTROSPECTION_AS_AC_EXPAND(_GI_EXP_LIBDIR, "$libdir") + INTROSPECTION_SCANNER= INTROSPECTION_COMPILER= INTROSPECTION_GENERATE= @@ -59,8 +105,8 @@ m4_define([_GOBJECT_INTROSPECTION_CHECK_INTERNAL], INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0` INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0` INTROSPECTION_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0` - INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0` - INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)" + INTROSPECTION_GIRDIR=`$PKG_CONFIG --define-variable=datadir="${_GI_EXP_DATADIR}" --variable=girdir gobject-introspection-1.0` + INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --define-variable=libdir="${_GI_EXP_LIBDIR}" --variable=typelibdir gobject-introspection-1.0)" INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0` INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0` INTROSPECTION_MAKEFILE=`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection |