Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Commit

Permalink
Autoconf: Add autogen.sh, remove configure and config.h.in
Browse files Browse the repository at this point in the history
Put autoconf-generated files in the release tarball.

The minimum required version of autoconf is currently 2.69.

If version 2.69 or later is already installed and there is no
autoconf default, it may be necessary to set the AUTORECONF
environment variable to enable the one to use, like:
AUTORECONF=autoreconf-2.69 ./autogen.sh
or
AUTORECONF=autoreconf-2.71 ./autogen.sh

(backported from commit 15e642a)
  • Loading branch information
fxlb committed Jan 29, 2024
1 parent ec947b8 commit 243be46
Show file tree
Hide file tree
Showing 10 changed files with 100 additions and 10,265 deletions.
2 changes: 2 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ linux_task:
- apt list --installed 'lib*-dev'
- echo '$ git clone [...] libpcap.git'
- git -C .. clone --depth ${CIRRUS_CLONE_DEPTH} --branch=master --quiet ${LIBPCAP_GIT}
- ./autogen.sh
- ./configure --quiet # build the Makefile
- make releasecheck
- make whitespacecheck
Expand Down Expand Up @@ -90,4 +91,5 @@ coverity_task:
- apt-get -qy install libssl-dev libsmi2-dev libcap-ng-dev libpcap-dev >/dev/null
- apt-get -qy install git curl wget ruby rubygems ruby-json >/dev/null # for the coverity script
- apt list --installed 'lib*-dev'
- ./autogen.sh
- ./.ci-coverity-scan-build.sh
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ Makefile
*.o
libnetdissect.a
config.h
config.h.in
config.log
config.cache
config.status
configure
.devel
os-proto.h
stamp-h
Expand Down
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ DayOfTheWeek, Month DD, YYYY / The Tcpdump Group
Autoconf: Fix --static-pcap-only test on Solaris 10.
autoconf: Add some warning flags for clang 13 or newer.
Autoconf: Update config.{guess,sub}, timestamps 2024-01-01.
Autoconf: Add autogen.sh, remove configure and config.h.in and put
these generated files in the release tarball.
configure: Apply autoupdate 2.69.
CMake: improve the comment before project(tcpdump C).
Do not require vsnprintf().
Expand Down
25 changes: 21 additions & 4 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,27 @@ the generally available GNU C compiler (GCC) or Clang.

After libpcap has been built (either install it with `make install` or
make sure both the libpcap and tcpdump source trees are in the same
directory), run `./configure` (a shell script). `configure` will
directory), do the following steps:

* If you build from a git clone rather than from a release archive,
run `./autogen.sh` (a shell script). The autogen.sh script will
build the `configure` and `config.h.in` files.

On some system, you may need to set the `AUTORECONF` variable, like:
`AUTORECONF=autoreconf-2.69 ./autogen.sh`
to select the `autoreconf` version you want to use.

* Run `./configure` (a shell script). The configure script will
determine your system attributes and generate an appropriate `Makefile`
from `Makefile.in`. Now build tcpdump by running `make`.
from `Makefile.in`. The configure script has a number of options to
control the configuration of tcpdump; `./configure --help` will show
them.

* Next, build tcpdump by running `make`.

On OpenBSD, you may need to set, before the `make`, the `AUTOCONF_VERSION`
variable like:
`AUTOCONF_VERSION=2.69 make`

If everything builds fine, `su` and type `make install`. This will install
tcpdump and the manual entry. Any user will be able to use tcpdump to
Expand Down Expand Up @@ -62,15 +80,14 @@ ascii_strcasecmp.c - locale-independent case-independent string comparison
routines
atime.awk - TCP ack awk script
atm.h - ATM traffic type definitions
autogen.sh - build configure and config.h.in (run this first)
bpf_dump.c - BPF program printing routines, in case libpcap doesn't
have them
chdlc.h - Cisco HDLC definitions
cpack.c - functions to extract packed data
cpack.h - declarations of functions to extract packed data
config.guess - autoconf support
config.h.in - autoconf input
config.sub - autoconf support
configure - configure script (run this first)
configure.ac - configure script source
doc/README.* - some building documentation
ethertype.h - Ethernet type value definitions
Expand Down
55 changes: 45 additions & 10 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ EXTRA_DIST = \
README.md \
VERSION \
aclocal.m4 \
autogen.sh \
atime.awk \
bpf_dump.c \
cmake/Modules/FindCRYPTO.cmake \
Expand All @@ -352,9 +353,7 @@ EXTRA_DIST = \
cmake_uninstall.cmake.in \
cmakeconfig.h.in \
config.guess \
config.h.in \
config.sub \
configure \
configure.ac \
doc/README.aix.md \
doc/README.NetBSD.md \
Expand Down Expand Up @@ -386,7 +385,7 @@ EXTRA_DIST = \
stime.awk \
tcpdump.1.in

TEST_DIST= `git ls-files tests | grep -v 'tests/\..*'`
TEST_DIST= `git -C "$$DIR" ls-files tests | grep -v 'tests/\..*'`

RELEASE_FILES = $(CSRC) $(HDR) $(LIBNETDISSECT_SRC) $(EXTRA_DIST) $(TEST_DIST)

Expand Down Expand Up @@ -446,7 +445,8 @@ clean:

distclean:
rm -f $(CLEANFILES) Makefile config.cache config.log config.status \
config.h os-proto.h stamp-h stamp-h.in $(PROG).1 \
config.h config.h.in config.h.in~ configure configure~ configure.ac~ \
os-proto.h stamp-h stamp-h.in $(PROG).1 \
libnetdissect.a tests/.failed tests/.passed \
tests/failure-outputs.txt
rm -rf autom4te.cache tests/DIFF tests/NEW
Expand All @@ -463,17 +463,52 @@ tags: $(TAGFILES)
TAGS: $(TAGFILES)
etags $(TAGFILES)

#
# Use git archive piped to tar to construct a subdirectory whose name
# is tcpdump-{release}, containing all the checked-in source files,
# and then run autoreconf in that directory to generate the configure
# script and other files from that source. Then remove autom4te.cache,
# construct the release tarball from that subdirectory, and remove
# the subdirectory.
#
# The --format=tar is to force git archive to write a non-compressed
# archive, in case the platform's tar command doesn't have built-in
# decompression.
#
# The ^{tree} is there to force git archive not to write out the
# "helpful" global extended pax header with a commit ID, as not all
# versions of tar can handle that (Solaris tar can't, for example).
# (It turns HEAD, or a tag, both of which are apparently "tree-ish"es,
# into a tree; apparently, unlike HEAD, or a tag, which have a commit
# ID associated with them, the tree associated with them doesn't have
# a commit ID, so no commit ID is available to write, and thus
# git archive doesn't write one.)
#
releasetar:
@TAG=$(PROG)-`cat VERSION` && \
if git show-ref --tags --quiet --verify -- "refs/tags/$$TAG"; then \
git archive --prefix="$$TAG"/ -o "$$TAG".tar.gz "$$TAG" \
$(RELEASE_FILES) && \
if [ ! -d .git ]; then echo 'Not in a git clone, stop.'; exit 1; fi && \
TMPTESTFILE=`mktemp -t tmptestfile_XXXXXXXX` && \
rm -f "$$TMPTESTFILE" && \
AUTORECONF_DIR=`dirname "$$TMPTESTFILE"`/"$(PROG)"_build_autoreconf_$$$$ && \
DIR=`pwd` && \
rm -rf "$$AUTORECONF_DIR" && \
mkdir "$$AUTORECONF_DIR" && \
cd "$$AUTORECONF_DIR" && \
if git -C "$$DIR" show-ref --tags --quiet --verify -- "refs/tags/$$TAG"; then \
(git -C "$$DIR" archive --format=tar --prefix="$$TAG"/ "$$TAG^{tree}" $(RELEASE_FILES) | \
tar xf -) && \
echo "Archive build from tag $$TAG."; \
else \
git archive --prefix="$$TAG"/ -o "$$TAG".tar.gz HEAD \
$(RELEASE_FILES) && \
(git -C "$$DIR" archive --format=tar --prefix="$$TAG"/ "HEAD^{tree}" $(RELEASE_FILES) | \
tar xf -) && \
echo "No $$TAG tag. Archive build from HEAD."; \
fi
fi && \
(cd "$$TAG" && "$${AUTORECONF:-autoreconf}" && rm -rf autom4te.cache) && \
tar cf "$$DIR/$$TAG".tar "$$TAG" && \
rm -f "$$DIR/$$TAG".tar.gz && \
gzip --best "$$DIR/$$TAG".tar && \
cd "$$DIR" && \
rm -rf "$$AUTORECONF_DIR"

releasecheck: releasetar
@TAG=$(PROG)-`cat VERSION` && \
Expand Down
25 changes: 25 additions & 0 deletions autogen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/sh -e

: "${AUTORECONF:=autoreconf}"

AUTORECONFVERSION=`$AUTORECONF --version 2>&1 | grep "^autoreconf" | sed 's/.*) *//'`

maj=`echo "$AUTORECONFVERSION" | cut -d. -f1`
min=`echo "$AUTORECONFVERSION" | cut -d. -f2`
# The minimum required version of autoconf is currently 2.69.
if [ "$maj" = "" ] || [ "$min" = "" ] || \
[ "$maj" -lt 2 ] || [ "$maj" -eq 2 -a "$min" -lt 69 ]; then
cat >&2 <<-EOF
Please install the 'autoconf' package version 2.69 or later.
If version 2.69 or later is already installed and there is no
autoconf default, it may be necessary to set the AUTORECONF
environment variable to enable the one to use, like:
AUTORECONF=autoreconf-2.69 ./autogen.sh
or
AUTORECONF=autoreconf-2.71 ./autogen.sh
EOF
exit 1
fi

echo "$AUTORECONF identification: $AUTORECONFVERSION"
"$AUTORECONF" -f
2 changes: 2 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,13 @@ esac
if [ "$CMAKE" = no ]; then
if [ "$BUILD_LIBPCAP" = yes ]; then
echo "Using PKG_CONFIG_PATH=$PKG_CONFIG_PATH"
run_after_echo ./autogen.sh
run_after_echo ./configure --with-crypto="$CRYPTO" \
--enable-smb="$SMB" --prefix="$PREFIX"
LD_LIBRARY_PATH="$PREFIX/lib"
export LD_LIBRARY_PATH
else
run_after_echo ./autogen.sh
run_after_echo ./configure --with-crypto="$CRYPTO" \
--enable-smb="$SMB" --prefix="$PREFIX" --disable-local-libpcap
fi
Expand Down
4 changes: 1 addition & 3 deletions build_matrix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,12 @@ build_tcpdump() {
fi
run_after_echo rm -rf "$PREFIX"/bin/tcpdump*
run_after_echo git status -suall
# Cancel changes in configure
run_after_echo git checkout configure
done
done
done
}

touch .devel configure
touch .devel
for CC in $MATRIX_CC; do
export CC
discard_cc_cache
Expand Down
Loading

0 comments on commit 243be46

Please sign in to comment.