Improve OpenBSD support: Allow faster VMA determination.
[libsigsegv/ericb.git] / autogen.sh
blob71d9a43524f2834e0e58a3417c1d47d9f2b109f7
1 #!/bin/sh
2 # Convenience script for regenerating all autogeneratable files that are
3 # omitted from the version control repository. In particular, this script
4 # also regenerates all aclocal.m4, config.h.in, Makefile.in, configure files
5 # with new versions of autoconf or automake.
7 # This script requires autoconf-2.63..2.68 and automake-1.11 in the PATH.
8 # If the option --skip-gnulib is not given, it also requires either
9 # - the GNULIB_TOOL environment variable pointing to the gnulib-tool script
10 # in a gnulib checkout, or
11 # - an internet connection.
13 # Copyright (C) 2009-2010 Free Software Foundation, Inc.
15 # This program is free software: you can redistribute it and/or modify
16 # it under the terms of the GNU General Public License as published by
17 # the Free Software Foundation; either version 3 of the License, or
18 # (at your option) any later version.
20 # This program is distributed in the hope that it will be useful,
21 # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 # GNU General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with this program. If not, see <http://www.gnu.org/licenses/>.
28 # Usage: ./autogen.sh [--skip-gnulib]
30 # Usage from a CVS checkout: ./autogen.sh
31 # This uses an up-to-date gnulib checkout.
33 # Usage from a released tarball: ./autogen.sh --skip-gnulib
34 # This does not use a gnulib checkout.
36 skip_gnulib=false
37 while :; do
38 case "$1" in
39 --skip-gnulib) skip_gnulib=true; shift;;
40 *) break ;;
41 esac
42 done
44 if test $skip_gnulib = false; then
45 if test -z "$GNULIB_TOOL"; then
46 # Check out gnulib in a subdirectory 'gnulib'.
47 if test -d gnulib; then
48 (cd gnulib && git pull)
49 else
50 git clone git://git.savannah.gnu.org/gnulib.git
52 # Now it should contain a gnulib-tool.
53 if test -f gnulib/gnulib-tool; then
54 GNULIB_TOOL=`pwd`/gnulib/gnulib-tool
55 else
56 echo "** warning: gnulib-tool not found" 1>&2
59 # Skip the gnulib-tool step if gnulib-tool was not found.
60 if test -n "$GNULIB_TOOL"; then
61 $GNULIB_TOOL --copy-file m4/relocatable-lib.m4
62 # Fetch config.guess, config.sub.
63 for file in config.guess config.sub; do
64 $GNULIB_TOOL --copy-file build-aux/$file; chmod a+x build-aux/$file
65 done
69 # Generate aclocal.m4.
70 aclocal -I m4
71 # Generate configure.
72 autoconf
73 # Generate config.h.in.
74 autoheader && touch config.h.in
75 # Generate Makefile.in, src/Makefile.in, tests/Makefile.in, and some
76 # build-aux/* files.
77 automake --add-missing --copy
79 # Generate config.h.msvc, src/sigsegv.h.msvc.
80 ./configure \
81 && make config.h.msvc \
82 && (cd src && make sigsegv.h.msvc) \
83 && make distclean