Merge pull request #4324 from FernetMenta/wasapi
[vuplus_xbmc] / lib / enca / autogen.sh
1 #!/bin/sh
2 # @(#) $Id: autogen.sh,v 1.9 2004/11/17 18:11:49 yeti Exp $
3 # Run this to generate all the initial makefiles, etc.
4 # Tweaked by David Necas (Yeti) <yeti@physics.muni.cz> from various other
5 # autogen.sh's.  This file is in public domain.
6
7 DIE=0
8
9 PROJECT=Enca
10 ACLOCAL_FLAGS="-I m4"
11
12 (autoconf --version) < /dev/null > /dev/null 2>&1 || {
13   echo
14   echo "**ERROR**: You must have \`autoconf' installed to re-generate"
15   echo "all the $PROJECT Makefiles."
16   echo "Download the appropriate package for your distribution,"
17   echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/."
18   DIE=1
19   NO_AUTOCONF=yes
20 }
21
22 (grep "^AM_PROG_LIBTOOL" ./configure.ac >/dev/null) && {
23   (libtool --version) < /dev/null > /dev/null 2>&1 || {
24     echo
25     echo "**Error**: You must have \`libtool' installed."
26     echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.4.tar.gz"
27     echo "(or a newer version if it is available)"
28     DIE=1
29     NO_LIBTOOL=yes
30   }
31 }
32
33 (automake --version) < /dev/null > /dev/null 2>&1 || {
34   echo
35   echo "**ERROR**: You must have \`automake' installed to re-generate"
36   echo "all the $PROJECT Makefiles."
37   echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.8.3.tar.gz"
38   echo "(or a newer version if it is available) and read README.devel."
39   DIE=1
40   NO_AUTOMAKE=yes
41 }
42
43 version_check ( ) {
44     if [ "x$1" = "x" ] ; then
45         echo "INTERNAL ERROR: version_check was not provided a minimum version"
46         exit 1
47     fi
48     _min="$1"
49     if [ "x$2" = "x" ] ; then
50         echo "INTERNAL ERROR: version check was not provided a comparison version"
51         exit 1
52     fi
53     _cur="$2"
54
55     # needed to handle versions like 1.10 and 1.4-p6
56     _min="`echo ${_min}. | sed 's/[^0-9]/./g' | sed 's/\.\././g'`"
57     _cur="`echo ${_cur}. | sed 's/[^0-9]/./g' | sed 's/\.\././g'`"
58
59     _min_major="`echo $_min | cut -d. -f1`"
60     _min_minor="`echo $_min | cut -d. -f2`"
61     _min_patch="`echo $_min | cut -d. -f3`"
62
63     _cur_major="`echo $_cur | cut -d. -f1`"
64     _cur_minor="`echo $_cur | cut -d. -f2`"
65     _cur_patch="`echo $_cur | cut -d. -f3`"
66
67     if [ "x$_min_major" = "x" ] ; then
68         _min_major=0
69     fi
70     if [ "x$_min_minor" = "x" ] ; then
71         _min_minor=0
72     fi
73     if [ "x$_min_patch" = "x" ] ; then
74         _min_patch=0
75     fi
76     if [ "x$_cur_minor" = "x" ] ; then
77         _cur_major=0
78     fi
79     if [ "x$_cur_minor" = "x" ] ; then
80         _cur_minor=0
81     fi
82     if [ "x$_cur_patch" = "x" ] ; then
83         _cur_patch=0
84     fi
85
86     if [ $_min_major -lt $_cur_major ] ; then
87         return 0
88     elif [ $_min_major -eq $_cur_major ] ; then
89         if [ $_min_minor -lt $_cur_minor ] ; then
90             return 0
91         elif [ $_min_minor -eq $_cur_minor ] ; then
92             if [ $_min_patch -lt $_cur_patch ] ; then
93                 return 0
94             elif [ $_min_patch -eq $_cur_patch ] ; then
95                 return 0
96             fi
97         fi
98     fi
99     return 1
100 }
101
102
103 # The world is cruel.
104 if test -z "$NO_AUTOCONF"; then
105   AC_VERSION=`autoconf --version | sed -e '2,$ d' -e 's/ *([^()]*)$//' -e 's/.* \(.*\)/\1/' -e 's/-p[0-9]\+//'`
106   if ! version_check "2.52" "$AC_VERSION" ; then
107     echo
108     echo "**ERROR**: You need at least autoconf-2.52 installed to re-generate"
109     echo "all the $PROJECT Makefiles."
110     echo "Download the appropriate package for your distribution,"
111     echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/."
112     DIE=1
113   else
114     echo "Autoconf $AC_VERSION: OK"
115   fi
116 fi
117
118 if test -z "$NO_AUTOMAKE"; then
119   AM_VERSION=`automake --version | sed -e '2,$ d' -e 's/ *([^()]*)$//' -e 's/.* \(.*\)/\1/' -e 's/-p[0-9]\+//'`
120   if ! version_check "1.8" "$AM_VERSION" ; then
121     echo
122     echo "**ERROR**: You need at least automake-1.8 installed to re-generate"
123     echo "all the $PROJECT Makefiles."
124     echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.8.3.tar.gz"
125     echo "(or a newer version if it is available) and read README.devel."
126     DIE=1
127   else
128     echo "Automake $AM_VERSION: OK"
129   fi
130 fi
131
132 # if no automake, don't bother testing for aclocal
133 test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
134   echo
135   echo "**ERROR**: Missing \`aclocal'.  The version of \`automake'"
136   echo "installed doesn't appear recent enough."
137   echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.8.3.tar.gz"
138   echo "(or a newer version if it is available) and read README.devel."
139   DIE=1
140 }
141
142 if test -z "$NO_LIBTOOL"; then
143   LT_VERSION=`libtool --version | sed -e '2,$ d' -e 's/ *([^()]*)$//' -e 's/.* \(.*\)/\1/' -e 's/-p[0-9]\+//'`
144   if ! version_check "1.4" "$LT_VERSION" ; then
145     echo
146     echo "**ERROR**: You need at least libtool-1.4 installed to re-generate"
147     echo "all the $PROJECT Makefiles."
148     echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.4.tar.gz"
149     echo "(or a newer version if it is available) and read README.devel."
150     DIE=1
151   else
152     echo "Libtool $LT_VERSION: OK"
153   fi
154 fi
155
156 if test "$DIE" -eq 1; then
157   exit 1
158 fi
159
160 case $CC in
161 *xlc | *xlc\ * | *lcc | *lcc\ * )
162   am_opt=--include-deps;;
163 esac
164
165 dir=.
166 echo processing $dir
167 (cd $dir && \
168   libtoolize --force --copy && \
169   aclocal $ACLOCAL_FLAGS && \
170   autoheader && \
171   automake --add-missing $am_opt && \
172   autoconf) || {
173     echo "**ERROR**: Re-generating failed.  You are allowed to shoot $PROJECT maintainer."
174     echo "(BTW, why are you re-generating everything? Have you read README.devel?)"
175     exit 1
176   }
177
178 if test -z "$*"; then
179   echo "**Warning**: I am going to run \`configure' with no arguments."
180   echo "If you wish to pass any to it, please specify them on the"
181   echo "\`$0' command line."
182   echo
183 fi
184
185 ./configure "$@"