Bump to 1.14.1
[platform/upstream/augeas.git] / autogen.sh
1 #!/usr/bin/env bash
2 # Run this to generate all the initial makefiles, etc.
3
4 usage() {
5   echo >&2 "\
6 Usage: $0 [OPTION]...
7 Generate makefiles and other infrastructure needed for building
8
9
10 Options:
11  --gnulib-srcdir=DIRNAME  Specify the local directory where gnulib
12                           sources reside.  Use this if you already
13                           have gnulib sources on your machine, and
14                           do not want to waste your bandwidth downloading
15                           them again.
16  --help                   Print this message
17  any other option         Pass to the 'configure' script verbatim
18
19 Running without arguments will suffice in most cases.
20 "
21 }
22
23 BUILD_AUX=build/ac-aux
24 GNULIB_DIR=gnulib
25
26 set -e
27 srcdir=`dirname $0`
28 test -z "$srcdir" && srcdir=.
29
30 THEDIR=`pwd`
31 cd $srcdir
32
33 # Split out options for bootstrap and for configure
34 declare -a CF_ARGS
35 for option
36 do
37   case $option in
38   --help)
39     usage
40     exit;;
41   --gnulib-srcdir=*)
42     GNULIB_SRCDIR=$option;;
43   *)
44     CF_ARGS[${#CF_ARGS[@]}]=$option;;
45   esac
46 done
47
48 #Check for OSX
49 case `uname -s` in
50 Darwin) LIBTOOLIZE=glibtoolize;;
51 *) LIBTOOLIZE=libtoolize;;
52 esac
53
54
55 DIE=0
56
57 (autoconf --version) < /dev/null > /dev/null 2>&1 || {
58         echo
59         echo "You must have autoconf installed to compile augeas."
60         echo "Download the appropriate package for your distribution,"
61         echo "or see http://www.gnu.org/software/autoconf"
62         DIE=1
63 }
64
65 (automake --version) < /dev/null > /dev/null 2>&1 || {
66         echo
67         DIE=1
68         echo "You must have automake installed to compile augeas."
69         echo "Download the appropriate package for your distribution,"
70         echo "or see http://www.gnu.org/software/automake"
71 }
72
73 if test "$DIE" -eq 1; then
74         exit 1
75 fi
76
77 if test -z "${CF_ARGS[*]}"; then
78         echo "I am going to run ./configure with --enable-warnings - if you "
79         echo "wish to pass any extra arguments to it, please specify them on "
80         echo "the $0 command line."
81 fi
82
83 mkdir -p $BUILD_AUX
84
85 $LIBTOOLIZE --copy --force
86 ./bootstrap $GNULIB_SRCDIR
87 aclocal -I gnulib/m4
88 autoheader
89 automake --add-missing
90 autoconf
91
92 cd $THEDIR
93
94 if test x$OBJ_DIR != x; then
95     mkdir -p "$OBJ_DIR"
96     cd "$OBJ_DIR"
97 fi
98
99 $srcdir/configure "${CF_ARGS[@]}" && {
100     echo
101     echo "Now type 'make' to compile augeas."
102 }