Code

dirty hack for archlinux
[ncmpc.git] / autogen.sh
1 #!/bin/sh
2 # Run this to set up the build system: configure, makefiles, etc.
3 # (based on the version in enlightenment's cvs)
5 package="ncmpc"
7 olddir=`pwd`
8 srcdir=`dirname $0`
9 test -z "$srcdir" && srcdir=.
11 cd "$srcdir"
12 DIE=0
14 echo "checking for autoconf... "
15 (autoconf --version) < /dev/null > /dev/null 2>&1 || {
16         echo
17         echo "You must have autoconf installed to compile $package."
18         echo "Download the appropriate package for your distribution,"
19         echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
20         DIE=0
21 }
23 VERSIONGREP="sed -e s/.*[^0-9\.]\([0-9]\.[0-9]\).*/\1/"
24 VERSIONMKINT="sed -e s/[^0-9]//"
26 # do we need automake?
27 if test -r Makefile.am; then
28   AM_NEEDED=`fgrep AUTOMAKE_OPTIONS Makefile.am | $VERSIONGREP`
29   if test -z $AM_NEEDED; then
30     echo -n "checking for automake... "
31     AUTOMAKE=automake
32     ACLOCAL=aclocal
33     if ($AUTOMAKE --version < /dev/null > /dev/null 2>&1); then
34       echo "no"
35       AUTOMAKE=
36     else
37       echo "yes"
38     fi
39   else
40     echo -n "checking for automake $AM_NEEDED or later... "
41     for am in automake-$AM_NEEDED automake$AM_NEEDED automake; do
42       ($am --version < /dev/null > /dev/null 2>&1) || continue
43       ver=`$am --version < /dev/null | head -n 1 | $VERSIONGREP | $VERSIONMKINT`
44       verneeded=`echo $AM_NEEDED | $VERSIONMKINT`
45       if test $ver -ge $verneeded; then
46         AUTOMAKE=$am
47         echo $AUTOMAKE
48         break
49       fi
50     done
51     test -z $AUTOMAKE &&  echo "no"
52     echo -n "checking for aclocal $AM_NEEDED or later... "
53     for ac in aclocal-$AM_NEEDED aclocal$AM_NEEDED aclocal; do
54       ($ac --version < /dev/null > /dev/null 2>&1) || continue
55       ver=`$ac --version < /dev/null | head -n 1 | $VERSIONGREP | $VERSIONMKINT`
56       verneeded=`echo $AM_NEEDED | $VERSIONMKINT`
57       if test $ver -ge $verneeded; then
58         ACLOCAL=$ac
59         echo $ACLOCAL
60         break
61       fi
62     done
63     test -z $ACLOCAL && echo "no"
64   fi
65   test -z $AUTOMAKE || test -z $ACLOCAL && {
66         echo
67         echo "You must have automake installed to compile $package."
68         echo "Download the appropriate package for your distribution,"
69         echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
70         #exit 1
71   }
72 fi
74 echo -n "checking for libtool... "
75 for LIBTOOLIZE in libtoolize glibtoolize nope; do
76   (which $LIBTOOLIZE) > /dev/null 2>&1 && break
77 done
78 if test x$LIBTOOLIZE = xnope; then
79   echo "nope."
80   LIBTOOLIZE=libtoolize
81 else
82   echo $LIBTOOLIZE
83 fi
84 ($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 || {
85         echo
86         echo "You must have libtool installed to compile $package."
87         echo "Download the appropriate package for your system,"
88         echo "or get the source from one of the GNU ftp sites"
89         echo "listed in http://www.gnu.org/order/ftp.html"
90         DIE=0
91 }
93 if test "$DIE" -eq 1; then
94         exit 1
95 fi
97 echo "Generating configuration files for $package, please wait...."
99 if [ -d m4 ] ; then
100   cat m4/*.m4 > acinclude.m4
101 fi
103 if [ -d /usr/local/share/aclocal ]; then
104         ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I /usr/local/share/aclocal"
105 fi
106 echo "  $ACLOCAL $ACLOCAL_FLAGS"
107 $ACLOCAL $ACLOCAL_FLAGS
109 echo "  autoheader"
110 autoheader
112 echo "  $LIBTOOLIZE --automake"
113 $LIBTOOLIZE --automake
115 echo "  $AUTOMAKE --add-missing $AUTOMAKE_FLAGS"
116 $AUTOMAKE --add-missing $AUTOMAKE_FLAGS 
118 echo "  autoconf"
119 autoconf
121 cd $olddir
122 $srcdir/configure "$@" && echo