a2b30f56809dae6c1a0257ac822af128f5f3848d
[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 (automake --version) < /dev/null > /dev/null 2>&1 || {
17         echo
18         echo "You must have automake 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/automake/"
21         DIE=1
22 }
23 automakevermin=`(automake --version|head -n 1|sed 's/^.* //;s/\./ /g;';echo "1 4")|sort -n|head -n 1`
24 automakevergood=`(automake --version|head -n 1|sed 's/^.* //;s/\./ /g;';echo "1 4f")|sort -n|head -n 1`
25 if test "x$automakevermin" != "x1 4"; then
26 # version is less than 1.4, the minimum suitable version
27         echo
28         echo "You must have automake version 1.4 or greater installed."
29         echo "Download the appropriate package for your distribution,"
30         echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/automake/"
31         DIE=1
32 else
33 if test "x$automakevergood" != "x1 4f"; then
34 echo "Checking for patched automake"
35 # version is less than 1.4f, the version with the patch applied
36 # check that patch is applied
37 cat > autogen.patch.tmp <<EOF
38 --- 1
39 +++ 2
40 @@ -2383,8 +2383,8 @@
41         # to all possible directories, and use it.  If DIST_SUBDIRS is
42         # defined, just use it.
43         local (\$dist_subdir_name);
44 -       if (&variable_defined ('DIST_SUBDIRS')
45 -           || &variable_conditions ('SUBDIRS'))
46 +       if (&variable_conditions ('SUBDIRS')
47 +           || &variable_defined ('DIST_SUBDIRS'))
48         {
49             \$dist_subdir_name = 'DIST_SUBDIRS';
50             if (! &variable_defined ('DIST_SUBDIRS'))
51 EOF
52         patch -s -f --dry-run `which automake` <autogen.patch.tmp || {
53                 echo "Detected automake version 1.4 (or near) without patch."
54                 echo "Your version of automake needs a patch applied in order to operate correctly."
55                 echo "Read the README file for an explanation."
56                 DIE=1
57         }
58 rm autogen.patch.tmp
59 fi
60 fi
61
62
63 (libtool --version) < /dev/null > /dev/null 2>&1 || {
64         echo
65         echo "You must have libtool installed to compile $package."
66         echo "Get the latest version from ftp://alpha.gnu.org/gnu/libtool/"
67         DIE=1
68 }
69
70 libtool_version=`libtool --version | sed 's/^.* \([0-9\.]*\) .*$/\1/'`
71 libtool_major=`echo $libtool_version | cut -d. -f1`
72 libtool_minor=`echo $libtool_version | cut -d. -f2`
73 libtool_micro=`echo $libtool_version | cut -d. -f3`
74 if [ x$libtool_micro = x ]; then
75         libtool_micro=0
76 fi
77 if [ $libtool_major -le 1 ]; then
78         if [ $libtool_major -lt 1 ]; then
79                 echo
80                 echo "You must have libtool 1.3.5 or greater to compile $package."
81                 echo "Get the latest version from ftp://alpha.gnu.org/gnu/libtool/"
82                 DIE=1
83         elif [ $libtool_minor -le 3 ]; then
84                 if [ $libtool_minor -lt 3 ]; then
85                         echo
86                         echo "You must have libtool 1.3.5 or greater to compile $package."
87                         echo "Get the latest version from ftp://alpha.gnu.org/gnu/libtool/"
88                         DIE=1
89                 elif [ $libtool_micro -lt 5 ]; then
90                         echo
91                         echo "You must have libtool 1.3.5 or greater to compile $package."
92                         echo "Get the latest version from ftp://alpha.gnu.org/gnu/libtool/"
93                         DIE=1
94                 fi
95         fi
96 fi
97
98 if test "$DIE" -eq 1; then
99         exit 1
100 fi
101
102 test -f $srcfile || {
103         echo "You must run this script in the top-level $package directory"
104         exit 1
105 }
106
107 if test -z "$*"; then
108         echo "I am going to run ./configure with no arguments - if you wish "
109         echo "to pass any to it, please specify them on the $0 command line."
110 fi
111
112 libtoolize --copy --force
113 aclocal $ACLOCAL_FLAGS || {
114         echo
115         echo "aclocal failed - check that all needed development files are present on system"
116         exit 1
117 }
118 autoheader || {
119         echo
120         echo "autoheader failed"
121         exit 1
122 }
123 autoconf || {
124         echo
125         echo "autoconf failed"
126         exit 1
127 }
128 automake --add-missing || {
129         echo
130         echo "automake failed"
131         exit 1
132 }
133
134 # now remove the cache, because it can be considered dangerous in this case
135 rm -f config.cache
136
137 # The new configure options for busy application developers (Hadess)
138 #./configure --enable-maintainer-mode --enable-debug --enable-debug-verbose 
139
140 ./configure --enable-maintainer-mode --enable-plugin-srcdir --enable-debug --enable-debug-verbose "$@" || {
141         echo
142         echo "configure failed"
143         exit 1
144 }
145
146 echo 
147 echo "Now type 'make' to compile $package."