Add a script, "aclocal-flags", which figures out where
[obnox/wireshark/wip.git] / aclocal-flags
1 #!/bin/sh
2 #
3 # This script returns the flags to be fed to "aclocal" to ensure that
4 # it finds GTK+'s aclocal macros.
5 #
6 # aclocal will search, by default, only in a directory in the same
7 # tree where it was installed - e.g., if installed in "/usr/bin", it'll
8 # search only in "/usr/share/aclocal", and if installed in "/usr/local/bin",
9 # it'll search only in "/usr/local/share/aclocal".
10 #
11 # However, there is no guarantee that GTK+ has been installed there; if
12 # it's not, it won't find the GTK+ autoconf macros, and will complain
13 # bitterly.
14 #
15 # So, if the "share/local" directory under the directory reported by
16 # "gtk-config --prefix" isn't the same directory as the directory
17 # reported by "aclocal --print-ac-dir", we return a "-I" flag with
18 # the first of those directories as the argument.
19 #
20 # (If they *are* the same directory, and we supply that "-I" flag,
21 # "aclocal" will look in that directory twice, and get well and truly
22 # confused, reporting a ton of duplicate macro definitions.)
23 #
24 # $Id: aclocal-flags,v 1.1 2000/07/26 08:03:40 guy Exp $
25 #
26
27 #
28 # OK, where will aclocal look by default?
29 #
30 aclocal_dir=`aclocal --print-ac-dir`
31
32 #
33 # And where do we want to make sure it looks?
34 #
35 gtk_aclocal_dir=`gtk-config --prefix`/share/aclocal
36
37 #
38 # If there's no "aclocal", the former will be empty; if there's no
39 # "gtk-config", the latter will be empty.
40 #
41 # Add the "-I" flag only if neither of those strings are empty, and
42 # they're different.
43 #
44 if [ ! -z "$aclocal_dir" -a ! -z "$gtk_aclocal_dir" \
45     -a "$aclocal_dir" != "$gtk_aclocal_dir" ]
46 then
47         echo "-I $gtk_aclocal_dir"
48 fi
49 exit 0