Avoid polluting cygwin namespace.
[libsigsegv/ericb.git] / autogen.sh
bloba30abdf57560368498ecd1347e5ce2fbe32a70be
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 ${GNULIB_SRCDIR:+--reference} $GNULIB_SRCDIR \
51 git://git.savannah.gnu.org/gnulib.git
53 # Now it should contain a gnulib-tool.
54 if test -f gnulib/gnulib-tool; then
55 GNULIB_TOOL=`pwd`/gnulib/gnulib-tool
56 else
57 echo "** warning: gnulib-tool not found" 1>&2
60 # Skip the gnulib-tool step if gnulib-tool was not found.
61 if test -n "$GNULIB_TOOL"; then
62 $GNULIB_TOOL --copy-file m4/relocatable-lib.m4
63 # Fetch config.guess, config.sub.
64 for file in config.guess config.sub; do
65 $GNULIB_TOOL --copy-file build-aux/$file; chmod a+x build-aux/$file
66 done
70 # Generate aclocal.m4.
71 aclocal -I m4
72 # Generate configure.
73 autoconf
74 # Generate config.h.in.
75 autoheader && touch config.h.in
76 # Generate Makefile.in, src/Makefile.in, tests/Makefile.in, and some
77 # build-aux/* files.
78 automake --add-missing --copy
80 # Generate config.h.msvc, src/sigsegv.h.msvc.
81 ./configure \
82 && make config.h.msvc \
83 && (cd src && make sigsegv.h.msvc) \
84 && make distclean