1#!/bin/sh
2# Run this to generate all the initial makefiles, etc.
3
4LIBTOOLIZE_FLAGS="--copy --force"
5AUTOMAKE_FLAGS="--add-missing --copy --foreign"
6
7ARGV0=$0
8ARGS="$@"
9
10
11run() {
12	echo "$ARGV0: running \`$@' $ARGS"
13	$@ $ARGS
14}
15
16## jump out if one of the programs returns 'false'
17set -e
18
19## on macosx glibtoolize, others have libtool
20if test x$LIBTOOLIZE = x; then
21  if test \! "x`which glibtoolize 2> /dev/null | grep -v '^no'`" = x; then
22    LIBTOOLIZE=glibtoolize
23  elif test \! "x`which libtoolize-1.5 2> /dev/null | grep -v '^no'`" = x; then
24    LIBTOOLIZE=libtoolize-1.5
25  elif test \! "x`which libtoolize 2> /dev/null | grep -v '^no'`" = x; then
26    LIBTOOLIZE=libtoolize
27  else
28    echo "libtoolize 1.5.x wasn't found, exiting"; exit 0
29  fi
30fi
31
32## suse has aclocal and aclocal-1.9
33if test x$ACLOCAL = x; then
34  if test \! "x`which aclocal-1.9 2> /dev/null | grep -v '^no'`" = x; then
35    ACLOCAL=aclocal-1.9
36  elif test \! "x`which aclocal19 2> /dev/null | grep -v '^no'`" = x; then
37    ACLOCAL=aclocal19
38  elif test \! "x`which aclocal 2> /dev/null | grep -v '^no'`" = x; then
39    ACLOCAL=aclocal
40  else
41    echo "automake 1.9.x (aclocal) wasn't found, exiting"; exit 0
42  fi
43fi
44
45if test x$AUTOMAKE = x; then
46  if test \! "x`which automake-1.9 2> /dev/null | grep -v '^no'`" = x; then
47    AUTOMAKE=automake-1.9
48  elif test \! "x`which automake19 2> /dev/null | grep -v '^no'`" = x; then
49    AUTOMAKE=automake19
50  elif test \! "x`which automake 2> /dev/null | grep -v '^no'`" = x; then
51    AUTOMAKE=automake
52  else
53    echo "automake 1.9.x wasn't found, exiting"; exit 0
54  fi
55fi
56
57
58## macosx has autoconf-2.59 and autoconf-2.60
59if test x$AUTOCONF = x; then
60  if test \! "x`which autoconf-2.59 2> /dev/null | grep -v '^no'`" = x; then
61    AUTOCONF=autoconf-2.59
62  elif test \! "x`which autoconf259 2> /dev/null | grep -v '^no'`" = x; then
63    AUTOCONF=autoconf259
64  elif test \! "x`which autoconf 2> /dev/null | grep -v '^no'`" = x; then
65    AUTOCONF=autoconf
66  else
67    echo "autoconf 2.59+ wasn't found, exiting"; exit 0
68  fi
69fi
70
71if test x$AUTOHEADER = x; then
72  if test \! "x`which autoheader-2.59 2> /dev/null | grep -v '^no'`" = x; then
73    AUTOHEADER=autoheader-2.59
74  elif test \! "x`which autoheader259 2> /dev/null | grep -v '^no'`" = x; then
75    AUTOHEADER=autoheader259
76  elif test \! "x`which autoheader 2> /dev/null | grep -v '^no'`" = x; then
77    AUTOHEADER=autoheader
78  else
79    echo "autoconf 2.59+ (autoheader) wasn't found, exiting"; exit 0
80  fi
81fi
82
83mkdir -p m4
84run $LIBTOOLIZE $LIBTOOLIZE_FLAGS
85run $ACLOCAL $ACLOCAL_FLAGS -I m4
86run $AUTOHEADER
87run $AUTOMAKE $AUTOMAKE_FLAGS
88run $AUTOCONF
89
90if test "$ARGS" = "" ; then
91  echo "Now type './configure ...' and 'make' to compile."
92fi
93