libOggFLAC.m4: Remove libOggFLAC.m4 as it's buggy.
[mpd-mk.git] / autogen.sh
blobdfd33c0ee7f2a579fa3b251a425919d6af6fc65b
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="mpd"
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.10'
21 if test -n "$AC_FORCE_VERSION"
22 then
23 AC_VERSIONS="$AC_FORCE_VERSION"
24 else
25 AC_VERSIONS='2.60 2.61'
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 '[:lower:]' '[:upper:]'`
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.ac | $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 "$DIE"
88 then
89 echo "You must have the following installed to compile $package:"
90 for i in $DIE
92 printf ' '
93 echo $i | sed -e 's/(/ (from /' -e 's/=\(.*\)/ (>= \1)/'
94 done
95 echo "Download the appropriate package(s) for your system,"
96 echo "or get the source from one of the GNU ftp sites"
97 echo "listed in http://www.gnu.org/order/ftp.html"
98 exit 1
101 echo "Generating configuration files for $package, please wait...."
103 ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I m4"
105 # /usr/share/aclocal is most likely included by default, already...
106 ac_local_paths='
107 /usr/local/share/aclocal
108 /sw/share/aclocal
109 /usr/pkg/share/aclocal
110 /opt/share/aclocal
111 /usr/gnu/share/aclocal
114 for i in $ac_local_paths; do
115 if test -d "$i"; then
116 ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I $i"
117 # we probably only want one of these...
118 break
120 done
122 echo " $ACLOCAL $ACLOCAL_FLAGS"
123 $ACLOCAL $ACLOCAL_FLAGS || exit 1
125 echo " $AUTOHEADER"
126 $AUTOHEADER || exit 1
128 echo " $AUTOMAKE --add-missing $AUTOMAKE_FLAGS"
129 $AUTOMAKE --add-missing $AUTOMAKE_FLAGS || exit 1
131 echo " $AUTOCONF"
132 $AUTOCONF || exit 1
134 cd "$olddir"
135 if test x$NOCONFIGURE = x; then
136 "$srcdir"/configure "$@" || exit 1