add support for reading config files other than the deafult one
[scrobby.git] / autogen.sh
blob8c901acace4e63bf7609a169ad8e827fe16acb33
1 #!/bin/sh
2 # Run this to set up the build system: configure, makefiles, etc.
3 # (at one point this was based on the version in enlightenment's cvs)
5 package="scrobby"
7 olddir="`pwd`"
8 srcdir="`dirname $0`"
9 test -z "$srcdir" && srcdir=.
10 cd "$srcdir"
11 DIE=
12 AM_VERSIONGREP="sed -e s/.*[^0-9\.]\([0-9]\.[0-9]\).*/\1/"
13 AC_VERSIONGREP="sed -e s/.*[^0-9\.]\([0-9]\.[0-9][0-9]\).*/\1/"
14 VERSIONMKINT="sed -e s/[^0-9]//"
15 if test -n "$AM_FORCE_VERSION"
16 then
17 AM_VERSIONS="$AM_FORCE_VERSION"
18 else
19 AM_VERSIONS='1.6 1.7 1.8 1.9'
21 if test -n "$AC_FORCE_VERSION"
22 then
23 AC_VERSIONS="$AC_FORCE_VERSION"
24 else
25 AC_VERSIONS='2.58 2.59'
28 versioned_bins ()
30 bin="$1"
31 needed_int=`echo $VERNEEDED | $VERSIONMKINT`
32 for i in $VERSIONS
34 i_int=`echo $i | $VERSIONMKINT`
35 if test $i_int -ge $needed_int
36 then
37 echo $bin-$i $bin$i $bin-$i_int $bin$i_int
39 done
40 echo $bin
43 for c in autoconf autoheader automake aclocal
45 uc=`echo $c | tr a-z A-Z`
46 eval "val=`echo '$'$uc`"
47 if test -n "$val"
48 then
49 echo "$uc=$val in environment, will not attempt to auto-detect"
50 continue
53 case "$c" in
54 autoconf|autoheader)
55 VERNEEDED=`fgrep AC_PREREQ configure.in | $AC_VERSIONGREP`
56 VERSIONS="$AC_VERSIONS"
57 pkg=autoconf
59 automake|aclocal)
60 VERNEEDED=`fgrep AUTOMAKE_OPTIONS Makefile.am | $AM_VERSIONGREP`
61 VERSIONS="$AM_VERSIONS"
62 pkg=automake
64 esac
65 printf "checking for $c ... "
66 for x in `versioned_bins $c`; do
67 ($x --version < /dev/null > /dev/null 2>&1) > /dev/null 2>&1
68 if test $? -eq 0
69 then
70 echo $x
71 eval $uc=$x
72 break
74 done
75 eval "val=`echo '$'$uc`"
76 if test -z "$val"
77 then
78 if test $c = $pkg
79 then
80 DIE="$DIE $c=$VERNEEDED"
81 else
82 DIE="$DIE $c($pkg)=$VERNEEDED"
85 done
87 if test -n "$LIBTOOLIZE"
88 then
89 echo "LIBTOOLIZE=$LIBTOOLIZE in environment," \
90 "will not attempt to auto-detect"
91 else
92 printf "checking for libtoolize ... "
93 for x in libtoolize glibtoolize
95 ($x --version < /dev/null > /dev/null 2>&1) > /dev/null 2>&1
96 if test $? -eq 0
97 then
98 echo $x
99 LIBTOOLIZE=$x
100 break
102 done
105 if test -z "$LIBTOOLIZE"
106 then
107 DIE="$DIE libtoolize(libtool)"
110 if test -n "$DIE"
111 then
112 echo "You must have the following installed to compile $package:"
113 for i in $DIE
115 printf ' '
116 echo $i | sed -e 's/(/ (from /' -e 's/=\(.*\)/ (>= \1)/'
117 done
118 echo "Download the appropriate package(s) for your system,"
119 echo "or get the source from one of the GNU ftp sites"
120 echo "listed in http://www.gnu.org/order/ftp.html"
121 exit 1
124 echo "Generating configuration files for $package, please wait...."
126 ACLOCAL_FLAGS="$ACLOCAL_FLAGS"
128 # /usr/share/aclocal is most likely included by default, already...
129 ac_local_paths='
130 /usr/local/share/aclocal
131 /sw/share/aclocal
132 /usr/pkg/share/aclocal
133 /opt/share/aclocal
134 /usr/gnu/share/aclocal
137 for i in $ac_local_paths; do
138 if test -d "$i"; then
139 ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I $i"
140 # we probably only want one of these...
141 break
143 done
145 echo " $ACLOCAL $ACLOCAL_FLAGS"
146 $ACLOCAL $ACLOCAL_FLAGS || exit 1
148 echo " $AUTOHEADER"
149 $AUTOHEADER || exit 1
151 echo " $LIBTOOLIZE --automake"
152 $LIBTOOLIZE --automake || exit 1
154 echo " $AUTOMAKE --add-missing $AUTOMAKE_FLAGS"
155 $AUTOMAKE --add-missing $AUTOMAKE_FLAGS || exit 1
157 echo " $AUTOCONF"
158 $AUTOCONF || exit 1
160 cd "$olddir"
161 if test x$NOCONFIGURE = x; then
162 "$srcdir"/configure "$@" || exit 1