More updates from Hannes Gredler.
[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.2 2000/11/22 04:03:22 gram 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_prefix=`gtk-config --prefix`
36
37 if [ -z "$gtk_prefix" ]
38 then
39         gtk_aclocal_dir=""
40 else
41         gtk_aclocal_dir=$gtk_prefix/share/aclocal
42 fi
43
44 #
45 # If there's no "aclocal", the former will be empty; if there's no
46 # "gtk-config", the latter will be empty.
47 #
48 # Add the "-I" flag only if neither of those strings are empty, and
49 # they're different.
50 #
51 if [ ! -z "$aclocal_dir" -a ! -z "$gtk_aclocal_dir" \
52     -a "$aclocal_dir" != "$gtk_aclocal_dir" ]
53 then
54         echo "-I $gtk_aclocal_dir"
55 fi
56 exit 0