• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2# Run this to set up the build system: configure, makefiles, etc.
3# (based on the version in enlightenment's cvs)
4
5package="libsndfile"
6
7olddir=`pwd`
8srcdir=`dirname $0`
9test -z "$srcdir" && srcdir=.
10
11cd "$srcdir"
12DIE=0
13
14printf "checking for autogen ... "
15result="yes"
16(autogen --version) < /dev/null > /dev/null 2>&1 || {
17        echo
18        echo "You must have GNU autogen installed to compile $package."
19        echo "Download the appropriate package for your distribution,"
20        echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
21		result="no"
22        DIE=1
23}
24echo $result
25
26printf "checking for autoconf ... "
27result="yes"
28(autoconf --version) < /dev/null > /dev/null 2>&1 || {
29        echo
30        echo "You must have autoconf installed to compile $package."
31        echo "Download the appropriate package for your distribution,"
32        echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
33		result="no"
34        DIE=1
35}
36echo $result
37
38VERSIONGREP="sed -e s/.*[^0-9\.]\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/"
39VERSIONMKMAJ="sed -e s/\([0-9][0-9]*\)[^0-9].*/\\1/"
40VERSIONMKMIN="sed -e s/.*[0-9][0-9]*\.//"
41
42# do we need automake?
43if test -r Makefile.am; then
44  AM_OPTIONS=`fgrep AUTOMAKE_OPTIONS Makefile.am`
45  AM_NEEDED=`echo $AM_OPTIONS | $VERSIONGREP`
46  if test x"$AM_NEEDED" = "x$AM_OPTIONS"; then
47    AM_NEEDED=""
48  fi
49  if test -z $AM_NEEDED; then
50    printf "checking for automake ... "
51    AUTOMAKE=automake
52    ACLOCAL=aclocal
53    if ($AUTOMAKE --version < /dev/null > /dev/null 2>&1); then
54      echo "yes"
55    else
56      echo "no"
57      AUTOMAKE=
58    fi
59  else
60    printf "checking for automake $AM_NEEDED or later ... "
61    majneeded=`echo $AM_NEEDED | $VERSIONMKMAJ`
62    minneeded=`echo $AM_NEEDED | $VERSIONMKMIN`
63    for am in automake-$AM_NEEDED automake$AM_NEEDED \
64	automake automake-1.7 automake-1.8 automake-1.9 automake-1.10; do
65      ($am --version < /dev/null > /dev/null 2>&1) || continue
66      ver=`$am --version < /dev/null | head -n 1 | $VERSIONGREP`
67      maj=`echo $ver | $VERSIONMKMAJ`
68      min=`echo $ver | $VERSIONMKMIN`
69      if test $maj -eq $majneeded -a $min -ge $minneeded; then
70        AUTOMAKE=$am
71        echo $AUTOMAKE
72        break
73      fi
74    done
75    test -z $AUTOMAKE &&  echo "no"
76    printf "checking for aclocal $AM_NEEDED or later ... "
77    for ac in aclocal-$AM_NEEDED aclocal$AM_NEEDED \
78	aclocal aclocal-1.7 aclocal-1.8 aclocal-1.9 aclocal-1.10; do
79      ($ac --version < /dev/null > /dev/null 2>&1) || continue
80      ver=`$ac --version < /dev/null | head -n 1 | $VERSIONGREP`
81      maj=`echo $ver | $VERSIONMKMAJ`
82      min=`echo $ver | $VERSIONMKMIN`
83      if test $maj -eq $majneeded -a $min -ge $minneeded; then
84        ACLOCAL=$ac
85        echo $ACLOCAL
86        break
87      fi
88    done
89    test -z $ACLOCAL && echo "no"
90  fi
91  test -z $AUTOMAKE || test -z $ACLOCAL && {
92        echo
93        echo "You must have automake installed to compile $package."
94        echo "Download the appropriate package for your distribution,"
95        echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
96        exit 1
97  }
98fi
99
100printf "checking for libtool ... "
101for LIBTOOLIZE in libtoolize glibtoolize nope; do
102  ($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 && break
103done
104if test x$LIBTOOLIZE = xnope; then
105  echo "nope."
106  LIBTOOLIZE=libtoolize
107else
108  echo $LIBTOOLIZE
109fi
110($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 || {
111	echo
112	echo "You must have libtool installed to compile $package."
113	echo "Download the appropriate package for your system,"
114	echo "or get the source from one of the GNU ftp sites"
115	echo "listed in http://www.gnu.org/order/ftp.html"
116	DIE=1
117}
118
119printf "checking for pkg-config ... "
120result="yes"
121(pkg-config --version) < /dev/null > /dev/null 2>&1 || {
122        echo
123        echo "You must have pkg-config installed to compile $package."
124        echo "Download the appropriate package for your distribution."
125		result="no"
126        DIE=1
127}
128echo $result
129
130
131printf "checking for python ... "
132result="yes"
133(python --version) < /dev/null > /dev/null 2>&1 || {
134        echo
135        echo "You must have Python installed to compile $package."
136        echo "Download the appropriate package for your distribution,"
137        echo "or get the source tarball at http://python.org/"
138		result="no"
139        DIE=1
140}
141echo $result
142
143if test "$DIE" -eq 1; then
144        exit 1
145fi
146
147echo "Generating configuration files for $package, please wait ... "
148
149echo "  $ACLOCAL $ACLOCAL_FLAGS"
150$ACLOCAL $ACLOCAL_FLAGS || exit 1
151echo "  $LIBTOOLIZE --automake --force"
152$LIBTOOLIZE --automake --force || exit 1
153echo "  autoheader"
154autoheader || exit 1
155echo "  $AUTOMAKE --add-missing $AUTOMAKE_FLAGS"
156$AUTOMAKE --add-missing $AUTOMAKE_FLAGS || exit 1
157echo "  autoconf"
158autoconf || exit 1
159
160# Generate the src/cmake-config.h.in from src/config.h.in.
161# CMake process src/cmake-config.h to create src/config.h.
162rm -f src/config.h src/cmake-config.h
163
164cd $olddir
165
166if test -d .git/ ; then
167	fprecommit=.git/hooks/pre-commit
168	if test ! -f $fprecommit ; then
169		echo
170		echo "Installing git pre-commit hook for this project."
171		printf "#/bin/sh\nexec Scripts/git-pre-commit-hook\n" > $fprecommit
172		chmod u+x $fprecommit
173		echo
174		fi
175	fi
176
177