1#!/bin/sh
2
3warn() {
4echo -e "\tWARNING: $@" 1>&2
5}
6
7# init
8
9LIBTOOLIZE=libtoolize
10ACLOCAL=aclocal
11AUTOCONF=autoconf
12AUTOHEADER=autoheader
13AUTOMAKE=automake
14
15case `uname -s` in
16Darwin)
17LIBTOOLIZE=glibtoolize
18;;
19FreeBSD)
20ACLOCAL_ARGS="$ACLOCAL_ARGS -I /usr/local/share/aclocal/"
21;;
22esac
23
24
25# libtoolize
26echo "Searching libtoolize..."
27if [ `which $LIBTOOLIZE` ] ; then
28echo -e "\tFOUND: libtoolize -> $LIBTOOLIZE"
29else
30warn "Cannot Found libtoolize... input libtool command"
31  read LIBTOOLIZE
32  LIBTOOLIZE=`which $LIBTOOLIZE`
33  if [ `which $LIBTOOLIZE` ] ; then
34echo -e "\tSET: libtoolize -> $LIBTOOLIZE"
35  else
36warn "$LIBTOOLIZE: Command not found."
37    exit 1;
38  fi
39fi
40
41# aclocal
42echo "Searching aclocal..."
43if [ `which $ACLOCAL` ] ; then
44echo -e "\tFOUND: aclocal -> $ACLOCAL"
45else
46warn "Cannot Found aclocal... input aclocal command"
47  read ACLOCAL
48  ACLOCAL=`which $ACLOCAL`
49  if [ `which $ACLOCAL` ] ; then
50echo -e "\tSET: aclocal -> $ACLOCAL"
51  else
52warn "$ACLOCAL: Command not found."
53    exit 1;
54  fi
55fi
56
57# automake
58echo "Searching automake..."
59if [ `which $AUTOMAKE` ] ; then
60echo -e "\tFOUND: automake -> $AUTOMAKE"
61else
62warn "Cannot Found automake... input automake command"
63  read AUTOMAKE
64  ACLOCAL=`which $AUTOMAKE`
65  if [ `which $AUTOMAKE` ] ; then
66echo -e "\tSET: automake -> $AUTOMAKE"
67  else
68warn "$AUTOMAKE: Command not found."
69    exit 1;
70  fi
71fi
72
73# autoheader
74echo "Searching autoheader..."
75if [ `which $AUTOHEADER` ] ; then
76echo -e "\tFOUND: autoheader -> $AUTOHEADER"
77else
78warn "Cannot Found autoheader... input autoheader command"
79  read AUTOHEADER
80  ACLOCAL=`which $AUTOHEADER`
81  if [ `which $AUTOHEADER` ] ; then
82echo -e "\tSET: autoheader -> $AUTOHEADER"
83  else
84warn "$AUTOHEADER: Command not found."
85    exit 1;
86  fi
87fi
88
89# autoconf
90echo "Searching autoconf..."
91if [ `which $AUTOCONF` ] ; then
92echo -e "\tFOUND: autoconf -> $AUTOCONF"
93else
94warn "Cannot Found autoconf... input autoconf command"
95  read AUTOCONF
96  ACLOCAL=`which $AUTOCONF`
97  if [ `which $AUTOCONF` ] ; then
98echo -e "\tSET: autoconf -> $AUTOCONF"
99  else
100warn "$AUTOCONF: Command not found."
101    exit 1;
102  fi
103fi
104
105echo "Running libtoolize ..."
106$LIBTOOLIZE --force --copy
107echo "Running aclocal ..."
108$ACLOCAL ${ACLOCAL_ARGS} -I .
109echo "Running autoheader..."
110$AUTOHEADER
111echo "Running automake ..."
112$AUTOMAKE --add-missing --copy
113echo "Running autoconf ..."
114$AUTOCONF
115
116mkdir m4 2> /dev/null
117
118