Removed unused variable and fixed call to add_item_to_tree, as reported
[obnox/wireshark/wip.git] / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.3
2
3 dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
4 dnl This Makefile.in is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
7
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 dnl PARTICULAR PURPOSE.
12
13 # Do all the work for Automake.  This macro actually does too much --
14 # some checks are only needed if your package does certain things.
15 # But this isn't really a big deal.
16
17 # serial 1
18
19 dnl Usage:
20 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
21
22 AC_DEFUN(AM_INIT_AUTOMAKE,
23 [AC_REQUIRE([AM_PROG_INSTALL])
24 PACKAGE=[$1]
25 AC_SUBST(PACKAGE)
26 VERSION=[$2]
27 AC_SUBST(VERSION)
28 dnl test to see if srcdir already configured
29 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
30   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
31 fi
32 ifelse([$3],,
33 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
34 AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
35 AC_REQUIRE([AM_SANITY_CHECK])
36 AC_REQUIRE([AC_ARG_PROGRAM])
37 dnl FIXME This is truly gross.
38 missing_dir=`cd $ac_aux_dir && pwd`
39 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
40 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
41 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
42 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
43 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
44 AC_REQUIRE([AC_PROG_MAKE_SET])])
45
46
47 # serial 1
48
49 AC_DEFUN(AM_PROG_INSTALL,
50 [AC_REQUIRE([AC_PROG_INSTALL])
51 test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
52 AC_SUBST(INSTALL_SCRIPT)dnl
53 ])
54
55 #
56 # Check to make sure that the build environment is sane.
57 #
58
59 AC_DEFUN(AM_SANITY_CHECK,
60 [AC_MSG_CHECKING([whether build environment is sane])
61 # Just in case
62 sleep 1
63 echo timestamp > conftestfile
64 # Do `set' in a subshell so we don't clobber the current shell's
65 # arguments.  Must try -L first in case configure is actually a
66 # symlink; some systems play weird games with the mod time of symlinks
67 # (eg FreeBSD returns the mod time of the symlink's containing
68 # directory).
69 if (
70    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
71    if test "[$]*" = "X"; then
72       # -L didn't work.
73       set X `ls -t $srcdir/configure conftestfile`
74    fi
75    if test "[$]*" != "X $srcdir/configure conftestfile" \
76       && test "[$]*" != "X conftestfile $srcdir/configure"; then
77
78       # If neither matched, then we have a broken ls.  This can happen
79       # if, for instance, CONFIG_SHELL is bash and it inherits a
80       # broken ls alias from the environment.  This has actually
81       # happened.  Such a system could not be considered "sane".
82       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
83 alias in your environment])
84    fi
85
86    test "[$]2" = conftestfile
87    )
88 then
89    # Ok.
90    :
91 else
92    AC_MSG_ERROR([newly created file is older than distributed files!
93 Check your system clock])
94 fi
95 rm -f conftest*
96 AC_MSG_RESULT(yes)])
97
98 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
99 dnl The program must properly implement --version.
100 AC_DEFUN(AM_MISSING_PROG,
101 [AC_MSG_CHECKING(for working $2)
102 # Run test in a subshell; some versions of sh will print an error if
103 # an executable is not found, even if stderr is redirected.
104 # Redirect stdin to placate older versions of autoconf.  Sigh.
105 if ($2 --version) < /dev/null > /dev/null 2>&1; then
106    $1=$2
107    AC_MSG_RESULT(found)
108 else
109    $1="$3/missing $2"
110    AC_MSG_RESULT(missing)
111 fi
112 AC_SUBST($1)])
113
114 # Configure paths for GTK+
115 # Owen Taylor     97-11-3
116
117 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
118 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
119 dnl
120 AC_DEFUN(AM_PATH_GTK,
121 [dnl 
122 dnl Get the cflags and libraries from the gtk-config script
123 dnl
124 AC_ARG_WITH(gtk-prefix,[  --with-gtk-prefix=PFX   Prefix where GTK is installed (optional)],
125             gtk_config_prefix="$withval", gtk_config_prefix="")
126 AC_ARG_WITH(gtk-exec-prefix,[  --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
127             gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
128 AC_ARG_ENABLE(gtktest, [  --disable-gtktest       Do not try to compile and run a test GTK program],
129                     , enable_gtktest=yes)
130
131   if test x$gtk_config_exec_prefix != x ; then
132      gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
133      if test x${GTK_CONFIG+set} != xset ; then
134         GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
135      fi
136   fi
137   if test x$gtk_config_prefix != x ; then
138      gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
139      if test x${GTK_CONFIG+set} != xset ; then
140         GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
141      fi
142   fi
143
144   AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
145   min_gtk_version=ifelse([$1], ,0.99.7,$1)
146   AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
147   no_gtk=""
148   if test "$GTK_CONFIG" = "no" ; then
149     no_gtk=yes
150   else
151     GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
152     GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
153     gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
154            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
155     gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
156            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
157     gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
158            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
159     if test "x$enable_gtktest" = "xyes" ; then
160       ac_save_CFLAGS="$CFLAGS"
161       ac_save_LIBS="$LIBS"
162       CFLAGS="$CFLAGS $GTK_CFLAGS"
163       LIBS="$LIBS $GTK_LIBS"
164 dnl
165 dnl Now check if the installed GTK is sufficiently new. (Also sanity
166 dnl checks the results of gtk-config to some extent
167 dnl
168       rm -f conf.gtktest
169       AC_TRY_RUN([
170 #include <gtk/gtk.h>
171 #include <stdio.h>
172
173 int 
174 main ()
175 {
176   int major, minor, micro;
177
178   system ("touch conf.gtktest");
179
180   if (sscanf("$min_gtk_version", "%d.%d.%d", &major, &minor, &micro) != 3) {
181      printf("%s, bad version string\n", "$min_gtk_version");
182      exit(1);
183    }
184
185   if ((gtk_major_version != $gtk_config_major_version) ||
186       (gtk_minor_version != $gtk_config_minor_version) ||
187       (gtk_micro_version != $gtk_config_micro_version))
188     {
189       printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", 
190              $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
191              gtk_major_version, gtk_minor_version, gtk_micro_version);
192       printf ("*** was found! If gtk-config was correct, then it is best\n");
193       printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
194       printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
195       printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
196       printf("*** required on your system.\n");
197       printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
198       printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
199       printf("*** before re-running configure\n");
200     } 
201   else
202     {
203       if ((gtk_major_version > major) ||
204         ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
205         ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
206       {
207         return 0;
208        }
209      else
210       {
211         printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
212                gtk_major_version, gtk_minor_version, gtk_micro_version);
213         printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
214                major, minor, micro);
215         printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
216         printf("***\n");
217         printf("*** If you have already installed a sufficiently new version, this error\n");
218         printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
219         printf("*** being found. The easiest way to fix this is to remove the old version\n");
220         printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
221         printf("*** correct copy of gtk-config. (In this case, you will have to\n");
222         printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
223         printf("*** so that the correct libraries are found at run-time))\n");
224       }
225     }
226   return 1;
227 }
228 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
229        CFLAGS="$ac_save_CFLAGS"
230        LIBS="$ac_save_LIBS"
231      fi
232   fi
233   if test "x$no_gtk" = x ; then
234      AC_MSG_RESULT(yes)
235      ifelse([$2], , :, [$2])     
236   else
237      AC_MSG_RESULT(no)
238      if test "$GTK_CONFIG" = "no" ; then
239        echo "*** The gtk-config script installed by GTK could not be found"
240        echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
241        echo "*** your path, or set the GTK_CONFIG environment variable to the"
242        echo "*** full path to gtk-config."
243      else
244        if test -f conf.gtktest ; then
245         :
246        else
247           echo "*** Could not run GTK test program, checking why..."
248           CFLAGS="$CFLAGS $GTK_CFLAGS"
249           LIBS="$LIBS $GTK_LIBS"
250           AC_TRY_LINK([
251 #include <gtk/gtk.h>
252 #include <stdio.h>
253 ],      [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
254         [ echo "*** The test program compiled, but did not run. This usually means"
255           echo "*** that the run-time linker is not finding GTK or finding the wrong"
256           echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
257           echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
258           echo "*** to the installed location  Also, make sure you have run ldconfig if that"
259           echo "*** is required on your system"
260           echo "***"
261           echo "*** If you have an old version installed, it is best to remove it, although"
262           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
263           echo "***"
264           echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
265           echo "*** came with the system with the command"
266           echo "***"
267           echo "***    rpm --erase --nodeps gtk gtk-devel" ],
268         [ echo "*** The test program failed to compile or link. See the file config.log for the"
269           echo "*** exact error that occured. This usually means GTK was incorrectly installed"
270           echo "*** or that you have moved GTK since it was installed. In the latter case, you"
271           echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
272           CFLAGS="$ac_save_CFLAGS"
273           LIBS="$ac_save_LIBS"
274        fi
275      fi
276      GTK_CFLAGS=""
277      GTK_LIBS=""
278      ifelse([$3], , :, [$3])
279   fi
280   AC_SUBST(GTK_CFLAGS)
281   AC_SUBST(GTK_LIBS)
282   rm -f conf.gtktest
283 ])
284
285 dnl This was copied from the libpcap 0.4a6 source.
286 dnl ftp://ftp.ee.lbl.gov
287
288 dnl
289 dnl Checks to see if the sockaddr struct has the 4.4 BSD sa_len member
290 dnl
291 dnl usage:
292 dnl
293 dnl AC_LBL_SOCKADDR_SA_LEN
294 dnl
295 dnl results:
296 dnl
297 dnl HAVE_SOCKADDR_SA_LEN (defined)
298 dnl
299 AC_DEFUN(AC_LBL_SOCKADDR_SA_LEN,
300     [AC_MSG_CHECKING(if sockaddr struct has sa_len member)
301     AC_CACHE_VAL(ac_cv_lbl_sockaddr_has_sa_len,
302     AC_TRY_COMPILE([
303 #   include <sys/types.h>
304 #   include <sys/socket.h>],
305     [u_int i = sizeof(((struct sockaddr *)0)->sa_len)],
306     ac_cv_lbl_sockaddr_has_sa_len=yes,
307     ac_cv_lbl_sockaddr_has_sa_len=no))
308     AC_MSG_RESULT($ac_cv_lbl_sockaddr_has_sa_len)
309     if test $ac_cv_lbl_sockaddr_has_sa_len = yes ; then
310         AC_DEFINE(HAVE_SOCKADDR_SA_LEN)
311     fi])
312
313 # Like AC_CONFIG_HEADER, but automatically create stamp file.
314
315 AC_DEFUN(AM_CONFIG_HEADER,
316 [AC_PREREQ([2.12])
317 AC_CONFIG_HEADER([$1])
318 dnl When config.status generates a header, we must update the stamp-h file.
319 dnl This file resides in the same directory as the config header
320 dnl that is generated.  We must strip everything past the first ":",
321 dnl and everything past the last "/".
322 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
323 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
324 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
325 <<am_indx=1
326 for am_file in <<$1>>; do
327   case " <<$>>CONFIG_HEADERS " in
328   *" <<$>>am_file "*<<)>>
329     echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
330     ;;
331   esac
332   am_indx=`expr "<<$>>am_indx" + 1`
333 done<<>>dnl>>)
334 changequote([,]))])
335