changed some things
[platform/upstream/gstreamer.git] / autogen.sh
1 #!/bin/sh
2 # Run this to generate all the initial makefiles, etc.
3
4 DIE=0
5 package=GStreamer
6 srcfile=gst/gstobject.h
7
8 (autoconf --version) < /dev/null > /dev/null 2>&1 || {
9         echo
10         echo "You must have autoconf installed to compile $package."
11         echo "Download the appropriate package for your distribution,"
12         echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/autoconf/"
13         DIE=1
14 }
15
16 # thomasvs added an autoconf version check
17 AC_MAJOR=2
18 AC_MINOR=52
19 AC_VERSION=$AC_MAJOR.$AC_MINOR
20 autoconfvermin=`(autoconf --version|head -n 1|sed 's/^.* //;s/\./ /g;';echo "$AC_MAJOR $AC_MINOR")|sort -n|head -n 1`
21
22 if test "x$autoconfvermin" != "x$AC_MAJOR $AC_MINOR"; then
23 # version is less than the minimum suitable version
24         echo
25         echo "You must have autoconf version $AC_VERSION or greater installed."
26         echo "Download the appropriate package for your distribution,"
27         echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/autoconf/"
28         DIE=1
29 fi
30
31 (automake --version) < /dev/null > /dev/null 2>&1 || {
32         echo
33         echo "You must have automake installed to compile $package."
34         echo "Download the appropriate package for your distribution,"
35         echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/automake/"
36         DIE=1
37 }
38 automakevermin=`(automake --version|head -n 1|sed 's/^.* //;s/\./ /g;';echo "1 5")|sort -n|head -n 1`
39 if test "x$automakevermin" != "x1 5"; then
40 # version is less than 1.5, the minimum suitable version
41         echo
42         echo "You must have automake version 1.5 or greater installed."
43         echo "Download the appropriate package for your distribution,"
44         echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/automake/"
45         DIE=1
46 fi
47
48 (pkg-config --version) < /dev/null > /dev/null 2>&1 || {
49         echo
50         echo "You must have pkg-config installed to compile $package."
51         echo "Download the appropriate package for your distribution,"
52         echo "or get the source tarball at:"
53         echo "http://www.freedesktop.org/software/pkgconfig/"
54         DIE=1
55 }
56
57 LT_MAJOR=1
58 LT_MINOR=4
59 LT_MICRO=0
60 LT_VERSION=$LT_MAJOR.$LT_MINOR.$LT_MICRO
61 (libtool --version) < /dev/null > /dev/null 2>&1 || {
62         echo
63         echo "You must have libtool installed to compile $package."
64         echo "Get the latest version from ftp://alpha.gnu.org/gnu/libtool/"
65         DIE=1
66 }
67
68 libtool_version=`libtool --version | sed 's/^.* \([0-9a-z\.]*\) .*$/\1/'`
69 libtool_major=`echo $libtool_version | cut -d. -f1`
70 libtool_minor=`echo $libtool_version | cut -d. -f2`
71 libtool_micro=`echo $libtool_version | cut -d. -f3`
72 if [ x$libtool_micro = x ]; then
73         libtool_micro=0
74 fi
75 if [ $libtool_major -le $LT_MAJOR ]; then
76         if [ $libtool_major -lt $LT_MAJOR ]; then
77                 echo
78                 echo "You must have libtool $LT_VERSION or greater to compile $package."
79                 echo "Get the latest version from ftp://alpha.gnu.org/gnu/libtool/"
80                 DIE=1
81         elif [ $libtool_minor -le $LT_MINOR ]; then
82                 if [ $libtool_minor -lt $LT_MINOR ]; then
83                         echo
84                         echo "You must have libtool $LT_VERSION or greater to compile $package."
85                         echo "Get the latest version from ftp://alpha.gnu.org/gnu/libtool/"
86                         DIE=1
87                 elif [ $libtool_micro -lt $LT_MICRO ]; then
88                         echo
89                         echo "You must have libtool $LT_VERSION or greater to compile $package."
90                         echo "Get the latest version from ftp://alpha.gnu.org/gnu/libtool/"
91                         DIE=1
92                 fi
93         fi
94 fi
95
96 if test "$DIE" -eq 1; then
97         exit 1
98 fi
99
100 test -f $srcfile || {
101         echo "You must run this script in the top-level $package directory"
102         exit 1
103 }
104
105 if test -z "$*"; then
106         echo "I am going to run ./configure with no arguments - if you wish "
107         echo "to pass any to it, please specify them on the $0 command line."
108 fi
109
110
111 libtoolize --copy --force
112 aclocal $ACLOCAL_FLAGS || {
113         echo
114         echo "aclocal failed - check that all needed development files are present on system"
115         exit 1
116 }
117 autoheader || {
118         echo
119         echo "autoheader failed"
120         exit 1
121 }
122 autoconf || {
123         echo
124         echo "autoconf failed"
125         #exit 1
126 }
127 automake --add-missing || {
128         echo
129         echo "automake failed"
130         #exit 1
131 }
132
133 # now remove the cache, because it can be considered dangerous in this case
134 rm -f config.cache
135
136 CONFIGURE_OPT='--enable-maintainer-mode --enable-plugin-builddir --enable-debug --enable-DEBUG'
137
138 echo
139 echo "./configure default flags: $CONFIGURE_OPT"
140 echo "using: $CONFIGURE_OPT $@"
141 echo
142
143 ./configure $CONFIGURE_OPT "$@" || {
144         echo
145         echo "configure failed"
146         exit 1
147 }
148
149 echo 
150 echo "Now type 'make' to compile $package."