3 # This script returns the flags to be fed to "aclocal" to ensure that
4 # it finds GLib's aclocal macros. (We assume GTK+ is installed in the
7 # aclocal will search, by default, only in a directory in the same
8 # tree where it was installed - e.g., if installed in "/usr/bin", it'll
9 # search only in "/usr/share/aclocal", and if installed in "/usr/local/bin",
10 # it'll search only in "/usr/local/share/aclocal".
12 # However, there is no guarantee that GLib has been installed there; if
13 # it's not, it won't find the GLib autoconf macros, and will complain
16 # So, if the "share/local" directory under the directory reported by
17 # "pkg-config --variable=prefix glib-2.0" isn't the same directory as
18 # the directory reported by "aclocal --print-ac-dir", we return a "-I"
19 # flag with the first of those directories as the argument.
21 # (If they *are* the same directory, and we supply that "-I" flag,
22 # "aclocal" will look in that directory twice, and get well and truly
23 # confused, reporting a ton of duplicate macro definitions.)
29 # OK, where will aclocal look by default?
31 aclocal_dir=`aclocal --print-ac-dir`
34 # And where do we want to make sure it looks?
36 glib_prefix=`pkg-config --variable=prefix glib-2.0 2>/dev/null`
38 if [ -z "$glib_prefix" ]
42 glib_aclocal_dir=$glib_prefix/share/aclocal
45 ac_missing_dir=`dirname $0`
46 echo "-I $ac_missing_dir/aclocal-fallback" | tr -d '\012' | tr -d '\015'
49 # If there's no "aclocal", the former will be empty; if there's no
50 # "pkg-config" or it doesn't know about glib-2.0, the latter will be
53 # Add the "-I" flag only if neither of those strings are empty, and
56 if [ ! -z "$aclocal_dir" -a ! -z "$glib_aclocal_dir" \
57 -a "$aclocal_dir" != "$glib_aclocal_dir" ]
59 echo " -I $glib_aclocal_dir" | tr -d '\012' | tr -d '\015'