Update copyright notices.
[gmpc-autoplaylist.git] / autogen.sh
blobbf3801a761601e2c3782473d245a856b0a562a11
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="gmpc-autoplaylist"
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 case `uname` in
16 FreeBSD)
17 AM_VERSIONS='1.4 1.5 1.9'
18 AC_VERSIONS='2.53 2.59'
20 #OpenBSD)
21 #Needs works
22 # AM_VERSIONS='1.4 1.8 1.9'
23 # AC_VERSIONS='2.13 2.52 2.57 2.59'
24 #;;
26 # Use * here not to limit systems we do not have a case for.
27 # wrappers should pick these up without the need of our help.
28 #AM_VERSIONS='1.4 1.5 1.6 1.7 1.8 1.9 1.10'
29 #AC_VERSIONS='2.13 2.58 2.59 2.60'
30 AM_VERSIONS=''
31 AC_VERSIONS=''
33 esac
34 if test -n "$AM_FORCE_VERSION"
35 then
36 AM_VERSIONS="$AM_FORCE_VERSION"
37 else
38 $AM_VERSIONS
40 if test -n "$AC_FORCE_VERSION"
41 then
42 AC_VERSIONS="$AC_FORCE_VERSION"
43 else
44 $AC_VERSIONS
47 versioned_bins ()
49 bin="$1"
50 needed_int=`echo $VERNEEDED | $VERSIONMKINT`
51 for i in $VERSIONS
53 i_int=`echo $i | $VERSIONMKINT`
54 if test $i_int -ge $needed_int
55 then
56 echo $bin-$i $bin$i $bin-$i_int $bin$i_int
58 done
59 echo $bin
62 for c in autoconf autoheader automake aclocal
64 uc=`echo $c | tr a-z A-Z`
65 eval "val=`echo '$'$uc`"
66 if test -n "$val"
67 then
68 echo "$uc=$val in environment, will not attempt to auto-detect"
69 continue
72 case "$c" in
73 autoconf|autoheader)
74 VERNEEDED=`fgrep AC_PREREQ configure.ac | $AC_VERSIONGREP`
75 VERSIONS="$AC_VERSIONS"
76 pkg=autoconf
78 automake|aclocal)
79 VERNEEDED=`fgrep AUTOMAKE_OPTIONS Makefile.am | $AM_VERSIONGREP`
80 VERSIONS="$AM_VERSIONS"
81 pkg=automake
83 esac
84 printf "checking for $c ... "
85 for x in `versioned_bins $c`; do
86 ($x --version < /dev/null > /dev/null 2>&1) > /dev/null 2>&1
87 if test $? -eq 0
88 then
89 echo $x
90 eval $uc=$x
91 break
93 done
94 eval "val=`echo '$'$uc`"
95 if test -z "$val"
96 then
97 if test $c = $pkg
98 then
99 DIE="$DIE $c=$VERNEEDED"
100 else
101 DIE="$DIE $c($pkg)=$VERNEEDED"
104 done
106 if test -n "$LIBTOOLIZE"
107 then
108 echo "LIBTOOLIZE=$LIBTOOLIZE in environment," \
109 "will not attempt to auto-detect"
110 else
111 printf "checking for libtoolize ... "
112 for x in libtoolize glibtoolize
114 ($x --version < /dev/null > /dev/null 2>&1) > /dev/null 2>&1
115 if test $? -eq 0
116 then
117 echo $x
118 LIBTOOLIZE=$x
119 break
121 done
124 if test -z "$LIBTOOLIZE"
125 then
126 DIE="$DIE libtoolize(libtool)"
129 if test -n "$DIE"
130 then
131 echo "You must have the following installed to compile $package:"
132 for i in $DIE
134 printf ' '
135 echo $i | sed -e 's/(/ (from /' -e 's/=\(.*\)/ (>= \1)/'
136 done
137 echo "Download the appropriate package(s) for your system,"
138 echo "or get the source from one of the GNU ftp sites"
139 echo "listed in http://www.gnu.org/order/ftp.html"
140 exit 1
143 echo "Generating configuration files for $package, please wait...."
145 ACLOCAL_FLAGS="$ACLOCAL_FLAGS"
147 # /usr/share/aclocal is most likely included by default, already...
148 ac_local_paths='
149 /usr/local/share/aclocal
150 /sw/share/aclocal
151 /usr/pkg/share/aclocal
152 /opt/share/aclocal
153 /usr/gnu/share/aclocal
156 for i in $ac_local_paths; do
157 if test -d "$i"; then
158 ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I $i"
159 # we probably only want one of these...
160 break
162 done
164 echo " $ACLOCAL $ACLOCAL_FLAGS"
165 $ACLOCAL $ACLOCAL_FLAGS
167 echo " $AUTOHEADER"
168 $AUTOHEADER
170 echo " $LIBTOOLIZE --automake"
171 $LIBTOOLIZE --automake
173 echo " $AUTOMAKE --add-missing $AUTOMAKE_FLAGS"
174 $AUTOMAKE --add-missing $AUTOMAKE_FLAGS
176 echo " $AUTOCONF"
177 $AUTOCONF
179 cd "$olddir"
180 if test x$NOCONFIGURE = x; then
181 "$srcdir"/configure "$@" && echo