Check if the operating system provides a working ntohll
[awesomized/libmemcached] / config / bootstrap
1 #!/usr/bin/env bash
2 # Taken from lighthttpd server (BSD). Thanks Jan!
3 # Run this to generate all the initial makefiles, etc.
4
5 die() { echo "$@"; exit 1; }
6
7 # LIBTOOLIZE=${LIBTOOLIZE:-libtoolize}
8 LIBTOOLIZE_FLAGS=" --automake --copy --force"
9 # ACLOCAL=${ACLOCAL:-aclocal}
10 # AUTOHEADER=${AUTOHEADER:-autoheader}
11 # AUTOMAKE=${AUTOMAKE:-automake}
12 AUTOMAKE_FLAGS="--add-missing --copy --force"
13 # AUTOCONF=${AUTOCONF:-autoconf}
14
15 ARGV0=$0
16 ARGS="$@"
17
18
19 run() {
20 echo "$ARGV0: running \`$@' $ARGS"
21 $@ $ARGS
22 }
23
24 ## jump out if one of the programs returns 'false'
25 set -e
26
27 ## We do not currently support glibtoolize
28 if test x$LIBTOOLIZE = x; then
29 if test \! "x`which glibtoolize 2> /dev/null | grep -v '^no'`" = x; then
30 LIBTOOLIZE=glibtoolize
31 elif test \! "x`which libtoolize-1.5 2> /dev/null | grep -v '^no'`" = x; then
32 LIBTOOLIZE=libtoolize-1.5
33 elif test \! "x`which libtoolize 2> /dev/null | grep -v '^no'`" = x; then
34 LIBTOOLIZE=libtoolize
35 else
36 echo "libtoolize 1.5.x wasn't found, exiting"; exit 0
37 fi
38 fi
39
40 ## suse has aclocal and aclocal-1.9
41 if test x$ACLOCAL = x; then
42 if test \! "x`which aclocal-1.10 2> /dev/null | grep -v '^no'`" = x; then
43 ACLOCAL=aclocal-1.10
44 elif test \! "x`which aclocal-1.9 2> /dev/null | grep -v '^no'`" = x; then
45 ACLOCAL=aclocal-1.9
46 elif test \! "x`which aclocal19 2> /dev/null | grep -v '^no'`" = x; then
47 ACLOCAL=aclocal19
48 elif test \! "x`which aclocal 2> /dev/null | grep -v '^no'`" = x; then
49 ACLOCAL=aclocal
50 else
51 echo "automake 1.9.x (aclocal) wasn't found, exiting"; exit 0
52 fi
53 fi
54
55 if test x$AUTOMAKE = x; then
56 if test \! "x`which automake-1.10 2> /dev/null | grep -v '^no'`" = x; then
57 AUTOMAKE=automake-1.10
58 elif test \! "x`which automake-1.9 2> /dev/null | grep -v '^no'`" = x; then
59 AUTOMAKE=automake-1.9
60 elif test \! "x`which automake19 2> /dev/null | grep -v '^no'`" = x; then
61 AUTOMAKE=automake19
62 elif test \! "x`which automake 2> /dev/null | grep -v '^no'`" = x; then
63 AUTOMAKE=automake
64 else
65 echo "automake 1.9.x wasn't found, exiting"; exit 0
66 fi
67 fi
68
69
70 ## macosx has autoconf-2.59 and autoconf-2.60
71 if test x$AUTOCONF = x; then
72 if test \! "x`which autoconf-2.59 2> /dev/null | grep -v '^no'`" = x; then
73 AUTOCONF=autoconf-2.59
74 elif test \! "x`which autoconf259 2> /dev/null | grep -v '^no'`" = x; then
75 AUTOCONF=autoconf259
76 elif test \! "x`which autoconf 2> /dev/null | grep -v '^no'`" = x; then
77 AUTOCONF=autoconf
78 else
79 echo "autoconf 2.59+ wasn't found, exiting"; exit 0
80 fi
81 fi
82
83 if test x$AUTOHEADER = x; then
84 if test \! "x`which autoheader-2.59 2> /dev/null | grep -v '^no'`" = x; then
85 AUTOHEADER=autoheader-2.59
86 elif test \! "x`which autoheader259 2> /dev/null | grep -v '^no'`" = x; then
87 AUTOHEADER=autoheader259
88 elif test \! "x`which autoheader 2> /dev/null | grep -v '^no'`" = x; then
89 AUTOHEADER=autoheader
90 else
91 echo "autoconf 2.59+ (autoheader) wasn't found, exiting"; exit 0
92 fi
93 fi
94
95
96 run $ACLOCAL $ACLOCAL_FLAGS || die "Can't execute aclocal"
97 run $AUTOHEADER || die "Can't execute autoheader"
98
99 # --force means overwrite ltmain.sh script if it already exists
100 run $LIBTOOLIZE $LIBTOOLIZE_FLAGS || die "Can't execute libtoolize"
101
102 # --add-missing instructs automake to install missing auxiliary files
103 # and --force to overwrite them if they already exist
104 run $AUTOMAKE $AUTOMAKE_FLAGS || die "Can't execute automake"
105 run $AUTOCONF || die "Can't execute autoconf"