Add a "acinclude.m4" file that defines a "AC_ETHEREAL_STRUCT_SA_LEN"
[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 dnl Macros that test for specific features.
14 dnl This file is part of Autoconf.
15 dnl Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
16 dnl
17 dnl This program is free software; you can redistribute it and/or modify
18 dnl it under the terms of the GNU General Public License as published by
19 dnl the Free Software Foundation; either version 2, or (at your option)
20 dnl any later version.
21 dnl
22 dnl This program is distributed in the hope that it will be useful,
23 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
24 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25 dnl GNU General Public License for more details.
26 dnl
27 dnl You should have received a copy of the GNU General Public License
28 dnl along with this program; if not, write to the Free Software
29 dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
30 dnl 02111-1307, USA.
31 dnl
32 dnl As a special exception, the Free Software Foundation gives unlimited
33 dnl permission to copy, distribute and modify the configure scripts that
34 dnl are the output of Autoconf.  You need not follow the terms of the GNU
35 dnl General Public License when using or distributing such scripts, even
36 dnl though portions of the text of Autoconf appear in them.  The GNU
37 dnl General Public License (GPL) does govern all other use of the material
38 dnl that constitutes the Autoconf program.
39 dnl
40 dnl Certain portions of the Autoconf source text are designed to be copied
41 dnl (in certain cases, depending on the input) into the output of
42 dnl Autoconf.  We call these the "data" portions.  The rest of the Autoconf
43 dnl source text consists of comments plus executable code that decides which
44 dnl of the data portions to output in any given case.  We call these
45 dnl comments and executable code the "non-data" portions.  Autoconf never
46 dnl copies any of the non-data portions into its output.
47 dnl
48 dnl This special exception to the GPL applies to versions of Autoconf
49 dnl released by the Free Software Foundation.  When you make and
50 dnl distribute a modified version of Autoconf, you may extend this special
51 dnl exception to the GPL to apply to your modified version as well, *unless*
52 dnl your modified version has the potential to copy into its output some
53 dnl of the text that was the non-data portion of the version that you started
54 dnl with.  (In other words, unless your change moves or copies text from
55 dnl the non-data portions to the data portions.)  If your modification has
56 dnl such potential, you must delete any notice of this special exception
57 dnl to the GPL from your modified version.
58 dnl
59 dnl Written by David MacKenzie, with help from
60 dnl Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
61 dnl Roland McGrath, Noah Friedman, david d zuhn, and many others.
62
63 dnl AC_STRUCT_ST_BLKSIZE extracted from the file in qustion,
64 dnl "acspecific.m4" in GNU Autoconf 2.12, and turned into
65 dnl AC_ETHEREAL_STRUCT_SA_LEN, which checks if "struct sockaddr"
66 dnl has the 4.4BSD "sa_len" member, and defines HAVE_SA_LEN; that's
67 dnl what's in this file.
68 dnl Done by Guy Harris <guy@netapp.com> on 1998-11-14. 
69
70 dnl ### Checks for structure members
71
72
73 AC_DEFUN(AC_ETHEREAL_STRUCT_SA_LEN,
74 [AC_CACHE_CHECK([for sa_len in struct sockaddr], ac_cv_ethereal_struct_sa_len,
75 [AC_TRY_COMPILE([#include <sys/types.h>
76 #include <sys/socket.h>], [struct sockaddr s; s.sa_len;],
77 ac_cv_ethereal_struct_sa_len=yes, ac_cv_ethereal_struct_sa_len=no)])
78 if test $ac_cv_ethereal_struct_sa_len = yes; then
79   AC_DEFINE(HAVE_SA_LEN)
80 fi
81 ])
82
83 # Do all the work for Automake.  This macro actually does too much --
84 # some checks are only needed if your package does certain things.
85 # But this isn't really a big deal.
86
87 # serial 1
88
89 dnl Usage:
90 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
91
92 AC_DEFUN(AM_INIT_AUTOMAKE,
93 [AC_REQUIRE([AM_PROG_INSTALL])
94 PACKAGE=[$1]
95 AC_SUBST(PACKAGE)
96 VERSION=[$2]
97 AC_SUBST(VERSION)
98 dnl test to see if srcdir already configured
99 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
100   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
101 fi
102 ifelse([$3],,
103 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
104 AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
105 AC_REQUIRE([AM_SANITY_CHECK])
106 AC_REQUIRE([AC_ARG_PROGRAM])
107 dnl FIXME This is truly gross.
108 missing_dir=`cd $ac_aux_dir && pwd`
109 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
110 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
111 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
112 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
113 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
114 AC_REQUIRE([AC_PROG_MAKE_SET])])
115
116
117 # serial 1
118
119 AC_DEFUN(AM_PROG_INSTALL,
120 [AC_REQUIRE([AC_PROG_INSTALL])
121 test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
122 AC_SUBST(INSTALL_SCRIPT)dnl
123 ])
124
125 #
126 # Check to make sure that the build environment is sane.
127 #
128
129 AC_DEFUN(AM_SANITY_CHECK,
130 [AC_MSG_CHECKING([whether build environment is sane])
131 # Just in case
132 sleep 1
133 echo timestamp > conftestfile
134 # Do `set' in a subshell so we don't clobber the current shell's
135 # arguments.  Must try -L first in case configure is actually a
136 # symlink; some systems play weird games with the mod time of symlinks
137 # (eg FreeBSD returns the mod time of the symlink's containing
138 # directory).
139 if (
140    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
141    if test "[$]*" = "X"; then
142       # -L didn't work.
143       set X `ls -t $srcdir/configure conftestfile`
144    fi
145    if test "[$]*" != "X $srcdir/configure conftestfile" \
146       && test "[$]*" != "X conftestfile $srcdir/configure"; then
147
148       # If neither matched, then we have a broken ls.  This can happen
149       # if, for instance, CONFIG_SHELL is bash and it inherits a
150       # broken ls alias from the environment.  This has actually
151       # happened.  Such a system could not be considered "sane".
152       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
153 alias in your environment])
154    fi
155
156    test "[$]2" = conftestfile
157    )
158 then
159    # Ok.
160    :
161 else
162    AC_MSG_ERROR([newly created file is older than distributed files!
163 Check your system clock])
164 fi
165 rm -f conftest*
166 AC_MSG_RESULT(yes)])
167
168 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
169 dnl The program must properly implement --version.
170 AC_DEFUN(AM_MISSING_PROG,
171 [AC_MSG_CHECKING(for working $2)
172 # Run test in a subshell; some versions of sh will print an error if
173 # an executable is not found, even if stderr is redirected.
174 # Redirect stdin to placate older versions of autoconf.  Sigh.
175 if ($2 --version) < /dev/null > /dev/null 2>&1; then
176    $1=$2
177    AC_MSG_RESULT(found)
178 else
179    $1="$3/missing $2"
180    AC_MSG_RESULT(missing)
181 fi
182 AC_SUBST($1)])
183
184 # Configure paths for GTK+
185 # Owen Taylor     97-11-3
186
187 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
188 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
189 dnl
190 AC_DEFUN(AM_PATH_GTK,
191 [dnl 
192 dnl Get the cflags and libraries from the gtk-config script
193 dnl
194 AC_ARG_WITH(gtk-prefix,[  --with-gtk-prefix=PFX   Prefix where GTK is installed (optional)],
195             gtk_config_prefix="$withval", gtk_config_prefix="")
196 AC_ARG_WITH(gtk-exec-prefix,[  --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
197             gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
198 AC_ARG_ENABLE(gtktest, [  --disable-gtktest       Do not try to compile and run a test GTK program],
199                     , enable_gtktest=yes)
200
201   if test x$gtk_config_exec_prefix != x ; then
202      gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
203      if test x${GTK_CONFIG+set} != xset ; then
204         GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
205      fi
206   fi
207   if test x$gtk_config_prefix != x ; then
208      gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
209      if test x${GTK_CONFIG+set} != xset ; then
210         GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
211      fi
212   fi
213
214   AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
215   min_gtk_version=ifelse([$1], ,0.99.7,$1)
216   AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
217   no_gtk=""
218   if test "$GTK_CONFIG" = "no" ; then
219     no_gtk=yes
220   else
221     GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
222     GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
223     gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
224            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
225     gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
226            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
227     gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
228            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
229     if test "x$enable_gtktest" = "xyes" ; then
230       ac_save_CFLAGS="$CFLAGS"
231       ac_save_LIBS="$LIBS"
232       CFLAGS="$CFLAGS $GTK_CFLAGS"
233       LIBS="$LIBS $GTK_LIBS"
234 dnl
235 dnl Now check if the installed GTK is sufficiently new. (Also sanity
236 dnl checks the results of gtk-config to some extent
237 dnl
238       rm -f conf.gtktest
239       AC_TRY_RUN([
240 #include <gtk/gtk.h>
241 #include <stdio.h>
242
243 int 
244 main ()
245 {
246   int major, minor, micro;
247   char *tmp_version;
248
249   system ("touch conf.gtktest");
250
251   /* HP/UX 9 (%@#!) writes to sscanf strings */
252   tmp_version = g_strdup("$min_gtk_version");
253   if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
254      printf("%s, bad version string\n", "$min_gtk_version");
255      exit(1);
256    }
257
258   if ((gtk_major_version != $gtk_config_major_version) ||
259       (gtk_minor_version != $gtk_config_minor_version) ||
260       (gtk_micro_version != $gtk_config_micro_version))
261     {
262       printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", 
263              $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
264              gtk_major_version, gtk_minor_version, gtk_micro_version);
265       printf ("*** was found! If gtk-config was correct, then it is best\n");
266       printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
267       printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
268       printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
269       printf("*** required on your system.\n");
270       printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
271       printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
272       printf("*** before re-running configure\n");
273     } 
274   else
275     {
276       if ((gtk_major_version > major) ||
277         ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
278         ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
279       {
280         return 0;
281        }
282      else
283       {
284         printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
285                gtk_major_version, gtk_minor_version, gtk_micro_version);
286         printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
287                major, minor, micro);
288         printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
289         printf("***\n");
290         printf("*** If you have already installed a sufficiently new version, this error\n");
291         printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
292         printf("*** being found. The easiest way to fix this is to remove the old version\n");
293         printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
294         printf("*** correct copy of gtk-config. (In this case, you will have to\n");
295         printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
296         printf("*** so that the correct libraries are found at run-time))\n");
297       }
298     }
299   return 1;
300 }
301 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
302        CFLAGS="$ac_save_CFLAGS"
303        LIBS="$ac_save_LIBS"
304      fi
305   fi
306   if test "x$no_gtk" = x ; then
307      AC_MSG_RESULT(yes)
308      ifelse([$2], , :, [$2])     
309   else
310      AC_MSG_RESULT(no)
311      if test "$GTK_CONFIG" = "no" ; then
312        echo "*** The gtk-config script installed by GTK could not be found"
313        echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
314        echo "*** your path, or set the GTK_CONFIG environment variable to the"
315        echo "*** full path to gtk-config."
316      else
317        if test -f conf.gtktest ; then
318         :
319        else
320           echo "*** Could not run GTK test program, checking why..."
321           CFLAGS="$CFLAGS $GTK_CFLAGS"
322           LIBS="$LIBS $GTK_LIBS"
323           AC_TRY_LINK([
324 #include <gtk/gtk.h>
325 #include <stdio.h>
326 ],      [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
327         [ echo "*** The test program compiled, but did not run. This usually means"
328           echo "*** that the run-time linker is not finding GTK or finding the wrong"
329           echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
330           echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
331           echo "*** to the installed location  Also, make sure you have run ldconfig if that"
332           echo "*** is required on your system"
333           echo "***"
334           echo "*** If you have an old version installed, it is best to remove it, although"
335           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
336           echo "***"
337           echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
338           echo "*** came with the system with the command"
339           echo "***"
340           echo "***    rpm --erase --nodeps gtk gtk-devel" ],
341         [ echo "*** The test program failed to compile or link. See the file config.log for the"
342           echo "*** exact error that occured. This usually means GTK was incorrectly installed"
343           echo "*** or that you have moved GTK since it was installed. In the latter case, you"
344           echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
345           CFLAGS="$ac_save_CFLAGS"
346           LIBS="$ac_save_LIBS"
347        fi
348      fi
349      GTK_CFLAGS=""
350      GTK_LIBS=""
351      ifelse([$3], , :, [$3])
352   fi
353   AC_SUBST(GTK_CFLAGS)
354   AC_SUBST(GTK_LIBS)
355   rm -f conf.gtktest
356 ])
357
358 # Like AC_CONFIG_HEADER, but automatically create stamp file.
359
360 AC_DEFUN(AM_CONFIG_HEADER,
361 [AC_PREREQ([2.12])
362 AC_CONFIG_HEADER([$1])
363 dnl When config.status generates a header, we must update the stamp-h file.
364 dnl This file resides in the same directory as the config header
365 dnl that is generated.  We must strip everything past the first ":",
366 dnl and everything past the last "/".
367 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
368 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
369 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
370 <<am_indx=1
371 for am_file in <<$1>>; do
372   case " <<$>>CONFIG_HEADERS " in
373   *" <<$>>am_file "*<<)>>
374     echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
375     ;;
376   esac
377   am_indx=`expr "<<$>>am_indx" + 1`
378 done<<>>dnl>>)
379 changequote([,]))])
380