From: guy Date: Tue, 17 Nov 1998 02:17:27 +0000 (+0000) Subject: Add a "acinclude.m4" file that defines a "AC_ETHEREAL_STRUCT_SA_LEN" X-Git-Url: http://git.samba.org/samba.git/?p=obnox%2Fwireshark%2Fwip.git;a=commitdiff_plain;h=69fa1398275aa35864ebd22acfc7dfe3f0151c15 Add a "acinclude.m4" file that defines a "AC_ETHEREAL_STRUCT_SA_LEN" macro (modeled after similar macros provided with "autoconf") to check whether "struct sockaddr" has an "sa_len" member, and defines or undefines "HAVE_SA_LEN" appropriately. Use it instead of "AC_LBL_SOCKADDR_SA_LEN", and use "HAVE_SA_LEN" instead of "HAVE_SOCKADDR_SA_LEN". git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@96 f5534014-38df-0310-8fa8-9805f1628bb7 --- diff --git a/Makefile.in b/Makefile.in index e509090d9f..1678de55ef 100644 --- a/Makefile.in +++ b/Makefile.in @@ -194,9 +194,9 @@ NROFF = nroff DATA = $(sysconf_DATA) DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \ -Makefile.in NEWS acconfig.h aclocal.m4 config.guess config.h.in \ -config.sub configure configure.in install-sh missing mkinstalldirs \ -stamp-h.in +Makefile.in NEWS acconfig.h acinclude.m4 aclocal.m4 config.guess \ +config.h.in config.sub configure configure.in install-sh missing \ +mkinstalldirs stamp-h.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) @@ -230,7 +230,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) cd $(top_builddir) \ && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status -$(ACLOCAL_M4): configure.in +$(ACLOCAL_M4): configure.in acinclude.m4 cd $(srcdir) && $(ACLOCAL) config.status: $(srcdir)/configure diff --git a/acconfig.h b/acconfig.h index e24f8eb258..49aaba9156 100644 --- a/acconfig.h +++ b/acconfig.h @@ -2,7 +2,7 @@ #undef VERSION -#undef HAVE_SOCKADDR_SA_LEN +#undef HAVE_SA_LEN #undef DATAFILE_DIR diff --git a/acinclude.m4 b/acinclude.m4 new file mode 100644 index 0000000000..e5b6615eca --- /dev/null +++ b/acinclude.m4 @@ -0,0 +1,69 @@ +dnl Macros that test for specific features. +dnl This file is part of Autoconf. +dnl Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc. +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2, or (at your option) +dnl any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +dnl 02111-1307, USA. +dnl +dnl As a special exception, the Free Software Foundation gives unlimited +dnl permission to copy, distribute and modify the configure scripts that +dnl are the output of Autoconf. You need not follow the terms of the GNU +dnl General Public License when using or distributing such scripts, even +dnl though portions of the text of Autoconf appear in them. The GNU +dnl General Public License (GPL) does govern all other use of the material +dnl that constitutes the Autoconf program. +dnl +dnl Certain portions of the Autoconf source text are designed to be copied +dnl (in certain cases, depending on the input) into the output of +dnl Autoconf. We call these the "data" portions. The rest of the Autoconf +dnl source text consists of comments plus executable code that decides which +dnl of the data portions to output in any given case. We call these +dnl comments and executable code the "non-data" portions. Autoconf never +dnl copies any of the non-data portions into its output. +dnl +dnl This special exception to the GPL applies to versions of Autoconf +dnl released by the Free Software Foundation. When you make and +dnl distribute a modified version of Autoconf, you may extend this special +dnl exception to the GPL to apply to your modified version as well, *unless* +dnl your modified version has the potential to copy into its output some +dnl of the text that was the non-data portion of the version that you started +dnl with. (In other words, unless your change moves or copies text from +dnl the non-data portions to the data portions.) If your modification has +dnl such potential, you must delete any notice of this special exception +dnl to the GPL from your modified version. +dnl +dnl Written by David MacKenzie, with help from +dnl Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor, +dnl Roland McGrath, Noah Friedman, david d zuhn, and many others. + +dnl AC_STRUCT_ST_BLKSIZE extracted from the file in qustion, +dnl "acspecific.m4" in GNU Autoconf 2.12, and turned into +dnl AC_ETHEREAL_STRUCT_SA_LEN, which checks if "struct sockaddr" +dnl has the 4.4BSD "sa_len" member, and defines HAVE_SA_LEN; that's +dnl what's in this file. +dnl Done by Guy Harris on 1998-11-14. + +dnl ### Checks for structure members + + +AC_DEFUN(AC_ETHEREAL_STRUCT_SA_LEN, +[AC_CACHE_CHECK([for sa_len in struct sockaddr], ac_cv_ethereal_struct_sa_len, +[AC_TRY_COMPILE([#include +#include ], [struct sockaddr s; s.sa_len;], +ac_cv_ethereal_struct_sa_len=yes, ac_cv_ethereal_struct_sa_len=no)]) +if test $ac_cv_ethereal_struct_sa_len = yes; then + AC_DEFINE(HAVE_SA_LEN) +fi +]) diff --git a/aclocal.m4 b/aclocal.m4 index 2052094092..aa8e872e78 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -10,6 +10,76 @@ dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A dnl PARTICULAR PURPOSE. +dnl Macros that test for specific features. +dnl This file is part of Autoconf. +dnl Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc. +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2, or (at your option) +dnl any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +dnl 02111-1307, USA. +dnl +dnl As a special exception, the Free Software Foundation gives unlimited +dnl permission to copy, distribute and modify the configure scripts that +dnl are the output of Autoconf. You need not follow the terms of the GNU +dnl General Public License when using or distributing such scripts, even +dnl though portions of the text of Autoconf appear in them. The GNU +dnl General Public License (GPL) does govern all other use of the material +dnl that constitutes the Autoconf program. +dnl +dnl Certain portions of the Autoconf source text are designed to be copied +dnl (in certain cases, depending on the input) into the output of +dnl Autoconf. We call these the "data" portions. The rest of the Autoconf +dnl source text consists of comments plus executable code that decides which +dnl of the data portions to output in any given case. We call these +dnl comments and executable code the "non-data" portions. Autoconf never +dnl copies any of the non-data portions into its output. +dnl +dnl This special exception to the GPL applies to versions of Autoconf +dnl released by the Free Software Foundation. When you make and +dnl distribute a modified version of Autoconf, you may extend this special +dnl exception to the GPL to apply to your modified version as well, *unless* +dnl your modified version has the potential to copy into its output some +dnl of the text that was the non-data portion of the version that you started +dnl with. (In other words, unless your change moves or copies text from +dnl the non-data portions to the data portions.) If your modification has +dnl such potential, you must delete any notice of this special exception +dnl to the GPL from your modified version. +dnl +dnl Written by David MacKenzie, with help from +dnl Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor, +dnl Roland McGrath, Noah Friedman, david d zuhn, and many others. + +dnl AC_STRUCT_ST_BLKSIZE extracted from the file in qustion, +dnl "acspecific.m4" in GNU Autoconf 2.12, and turned into +dnl AC_ETHEREAL_STRUCT_SA_LEN, which checks if "struct sockaddr" +dnl has the 4.4BSD "sa_len" member, and defines HAVE_SA_LEN; that's +dnl what's in this file. +dnl Done by Guy Harris on 1998-11-14. + +dnl ### Checks for structure members + + +AC_DEFUN(AC_ETHEREAL_STRUCT_SA_LEN, +[AC_CACHE_CHECK([for sa_len in struct sockaddr], ac_cv_ethereal_struct_sa_len, +[AC_TRY_COMPILE([#include +#include ], [struct sockaddr s; s.sa_len;], +ac_cv_ethereal_struct_sa_len=yes, ac_cv_ethereal_struct_sa_len=no)]) +if test $ac_cv_ethereal_struct_sa_len = yes; then + AC_DEFINE(HAVE_SA_LEN) +fi +]) + # Do all the work for Automake. This macro actually does too much -- # some checks are only needed if your package does certain things. # But this isn't really a big deal. diff --git a/capture.c b/capture.c index 4bb1c18634..a36123ce79 100644 --- a/capture.c +++ b/capture.c @@ -1,7 +1,7 @@ /* capture.c * Routines for packet capture windows * - * $Id: capture.c,v 1.10 1998/11/15 05:40:19 guy Exp $ + * $Id: capture.c,v 1.11 1998/11/17 02:17:27 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -126,7 +126,7 @@ get_interface_list() { ! strchr(ifr->ifr_name, ':')) { il = g_list_append(il, g_strdup(ifr->ifr_name)); } -#ifdef HAVE_SOCKADDR_SA_LEN +#ifdef HAVE_SA_LEN ifr = (struct ifreq *) ((char *) ifr + ifr->ifr_addr.sa_len + IFNAMSIZ); #else ifr = (struct ifreq *) ((char *) ifr + sizeof(struct ifreq)); diff --git a/config.h.in b/config.h.in index 66a8c35379..ad8d4c00ab 100644 --- a/config.h.in +++ b/config.h.in @@ -11,6 +11,8 @@ #undef VERSION +#undef HAVE_SA_LEN + #undef DATAFILE_DIR #undef NEED_SNPRINTF_H diff --git a/configure b/configure index 2ef8f15a3f..90b87a5aca 100755 --- a/configure +++ b/configure @@ -1694,20 +1694,54 @@ done # AC_C_CONST -# We need libpcap's AC_LBL_SOCKADDR_SA_LEN test for get_interface_list(). +# We need to know whether "struct sockaddr" has an "sa_len" member +# for get_interface_list(). + +echo $ac_n "checking for sa_len in struct sockaddr""... $ac_c" 1>&6 +echo "configure:1702: checking for sa_len in struct sockaddr" >&5 +if eval "test \"`echo '$''{'ac_cv_ethereal_struct_sa_len'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +int main() { +struct sockaddr s; s.sa_len; +; return 0; } +EOF +if { (eval echo configure:1715: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_ethereal_struct_sa_len=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_ethereal_struct_sa_len=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_ethereal_struct_sa_len" 1>&6 +if test $ac_cv_ethereal_struct_sa_len = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_SA_LEN 1 +EOF + +fi -AC_LBL_SOCKADDR_SA_LEN # We must know our byte order echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 -echo "configure:1704: checking whether byte ordering is bigendian" >&5 +echo "configure:1738: checking whether byte ordering is bigendian" >&5 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. cat > conftest.$ac_ext < #include @@ -1718,11 +1752,11 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:1722: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1756: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* # It does; now see whether it defined to BIG_ENDIAN or not. cat > conftest.$ac_ext < #include @@ -1733,7 +1767,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:1737: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1771: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_bigendian=yes else @@ -1753,7 +1787,7 @@ if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1804: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_c_bigendian=no else @@ -1792,13 +1826,13 @@ fi if test $ac_cv_prog_gcc = yes; then echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6 -echo "configure:1796: checking whether ${CC-cc} needs -traditional" >&5 +echo "configure:1830: checking whether ${CC-cc} needs -traditional" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_pattern="Autoconf.*'x'" cat > conftest.$ac_ext < Autoconf TIOCGETP @@ -1816,7 +1850,7 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat > conftest.$ac_ext < Autoconf TCGETA @@ -1838,12 +1872,12 @@ echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6 fi echo $ac_n "checking for socket""... $ac_c" 1>&6 -echo "configure:1842: checking for socket" >&5 +echo "configure:1876: checking for socket" >&5 if eval "test \"`echo '$''{'ac_cv_func_socket'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1904: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_socket=yes" else @@ -1892,12 +1926,12 @@ fi SNPRINTF_C="" SNPRINTF_O="" echo $ac_n "checking for snprintf""... $ac_c" 1>&6 -echo "configure:1896: checking for snprintf" >&5 +echo "configure:1930: checking for snprintf" >&5 if eval "test \"`echo '$''{'ac_cv_func_snprintf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1958: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_snprintf=yes" else @@ -1953,7 +1987,8 @@ fi -#AC_CONFIG_SUBDIRS(wiretap) +subdirs="wiretap" + trap '' 1 2 15 cat > confcache <<\EOF # This file is a shell script that caches the results of configure @@ -2055,7 +2090,7 @@ done ac_given_srcdir=$srcdir ac_given_INSTALL="$INSTALL" -trap 'rm -fr `echo "Makefile wiretap/Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +trap 'rm -fr `echo "Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then @@ -2332,3 +2368,100 @@ chmod +x $CONFIG_STATUS rm -fr confdefs* $ac_clean_files test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 +if test "$no_recursion" != yes; then + + # Remove --cache-file and --srcdir arguments so they do not pile up. + ac_sub_configure_args= + ac_prev= + for ac_arg in $ac_configure_args; do + if test -n "$ac_prev"; then + ac_prev= + continue + fi + case "$ac_arg" in + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + ;; + *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;; + esac + done + + for ac_config_dir in wiretap; do + + # Do not complain, so a configure script can configure whichever + # parts of a large source tree are present. + if test ! -d $srcdir/$ac_config_dir; then + continue + fi + + echo configuring in $ac_config_dir + + case "$srcdir" in + .) ;; + *) + if test -d ./$ac_config_dir || mkdir ./$ac_config_dir; then :; + else + { echo "configure: error: can not create `pwd`/$ac_config_dir" 1>&2; exit 1; } + fi + ;; + esac + + ac_popdir=`pwd` + cd $ac_config_dir + + # A "../" for each directory in /$ac_config_dir. + ac_dots=`echo $ac_config_dir|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'` + + case "$srcdir" in + .) # No --srcdir option. We are building in place. + ac_sub_srcdir=$srcdir ;; + /*) # Absolute path. + ac_sub_srcdir=$srcdir/$ac_config_dir ;; + *) # Relative path. + ac_sub_srcdir=$ac_dots$srcdir/$ac_config_dir ;; + esac + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_sub_srcdir/configure; then + ac_sub_configure=$ac_sub_srcdir/configure + elif test -f $ac_sub_srcdir/configure.in; then + ac_sub_configure=$ac_configure + else + echo "configure: warning: no configuration information is in $ac_config_dir" 1>&2 + ac_sub_configure= + fi + + # The recursion is here. + if test -n "$ac_sub_configure"; then + + # Make the cache file name correct relative to the subdirectory. + case "$cache_file" in + /*) ac_sub_cache_file=$cache_file ;; + *) # Relative path. + ac_sub_cache_file="$ac_dots$cache_file" ;; + esac + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo "running ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir" + # The eval makes quoting arguments work. + if eval ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir + then : + else + { echo "configure: error: $ac_sub_configure failed for $ac_config_dir" 1>&2; exit 1; } + fi + fi + + cd $ac_popdir + done +fi + diff --git a/configure.in b/configure.in index 1824227b98..f881c8e67a 100644 --- a/configure.in +++ b/configure.in @@ -1,4 +1,4 @@ -# $Id: configure.in,v 1.13 1998/11/17 02:02:46 guy Exp $ +# $Id: configure.in,v 1.14 1998/11/17 02:17:27 guy Exp $ dnl Process this file with autoconf to produce a configure script. AC_INIT(etypes.h) @@ -91,9 +91,10 @@ AC_CHECK_HEADERS(sys/sockio.h sys/types.h netinet/in.h) dnl Checks for typedefs, structures, and compiler characteristics. # AC_C_CONST -# We need libpcap's AC_LBL_SOCKADDR_SA_LEN test for get_interface_list(). +# We need to know whether "struct sockaddr" has an "sa_len" member +# for get_interface_list(). -AC_LBL_SOCKADDR_SA_LEN +AC_ETHEREAL_STRUCT_SA_LEN # We must know our byte order AC_C_BIGENDIAN