some build changes vga is put in broken because of an undef in my build, please check
[platform/upstream/gstreamer.git] / autogen.sh
1 #!/bin/bash
2 # Run this to generate all the initial makefiles, etc.
3
4 DIE=0
5 package=gstreamer-plugins
6 srcfile=gst/sinesrc/gstsinesrc.c
7 #DEBUG=defined
8 if test "x$1" = "x-d"; then echo "+ debug output enabled"; DEBUG=defined; fi
9
10 debug ()
11 # print out a debug message if DEBUG is a defined variable
12 {
13   if test ! -z "$DEBUG"
14   then
15     echo "DEBUG: $1"
16   fi
17 }
18
19 version_check ()
20 # check the version of a package
21 # first argument : package name (executable)
22 # second argument : source download url
23 # rest of arguments : major, minor, micro version
24 {
25   PACKAGE=$1
26   URL=$2
27   MAJOR=$3
28   MINOR=$4
29   MICRO=$5
30
31   WRONG=
32
33   debug "major $MAJOR minor $MINOR micro $MICRO"
34   VERSION=$MAJOR
35   if test ! -z "$MINOR"; then VERSION=$VERSION.$MINOR; else MINOR=0; fi
36   if test ! -z "$MICRO"; then VERSION=$VERSION.$MICRO; else MICRO=0; fi
37
38   debug "major $MAJOR minor $MINOR micro $MICRO"
39   echo -n "+ checking for $1 >= $VERSION ... "
40   ($PACKAGE --version) < /dev/null > /dev/null 2>&1 || 
41   {
42         echo
43         echo "You must have $PACKAGE installed to compile $package."
44         echo "Download the appropriate package for your distribution,"
45         echo "or get the source tarball at $URL"
46         return 1
47   }
48   # the following line is carefully crafted sed magic
49   pkg_version=`$PACKAGE --version|head -n 1|sed 's/^[a-zA-z\.\ ()]*//;s/ .*$//'`
50   debug "pkg_version $pkg_version"
51   pkg_major=`echo $pkg_version | cut -d. -f1`
52   pkg_minor=`echo $pkg_version | cut -d. -f2`
53   pkg_micro=`echo $pkg_version | cut -d. -f3`
54   test -z "$pkg_minor" && pkg_minor=0
55   test -z "$pkg_micro" && pkg_micro=0
56
57   debug "found major $pkg_major minor $pkg_minor micro $pkg_micro"
58
59   #start checking the version
60   debug "version check"
61
62   if [ ! "$pkg_major" \> "$MAJOR" ]; then
63     debug "$pkg_major <= $MAJOR"
64     if [ "$pkg_major" \< "$MAJOR" ]; then
65       WRONG=1
66     elif [ ! "$pkg_minor" \> "$MINOR" ]; then
67       if [ "$pkg_minor" \< "$MINOR" ]; then
68         WRONG=1
69       elif [ "$pkg_micro" \< "$MICRO" ]; then
70         WRONG=1
71       fi
72     fi
73   fi
74
75   if test ! -z "$WRONG"; then
76     echo "found $pkg_version, not ok !"
77     echo
78     echo "You must have $PACKAGE $VERSION or greater to compile $package."
79     echo "Get the latest version from $URL"
80     return 1
81   else
82     echo "found $pkg_version, ok."
83   fi
84 }
85
86 # autoconf 2.52d has a weird issue involving a yes:no error
87 # so don't allow it's use
88 ac_version=`autoconf --version|head -n 1|sed 's/^[a-zA-z\.\ ()]*//;s/ .*$//'`
89 if test "$ac_version" = "2.52d"; then
90   echo "autoconf 2.52d has an issue with our current build."
91   echo "We don't know who's to blame however.  So until we do, get a"
92   echo "regular version.  RPM's of a working version are on the gstreamer site."
93   exit 1
94 fi
95
96
97 version_check "autoconf" "ftp://ftp.gnu.org/pub/gnu/autoconf/" 2 52 || DIE=1
98 version_check "automake" "ftp://ftp.gnu.org/pub/gnu/automake/" 1 5 || DIE=1
99 version_check "libtool" "ftp://ftp.gnu.org/pub/gnu/libtool/" 1 4 0 || DIE=1
100 version_check "pkg-config" "http://www.freedesktop.org/software/pkgconfig" 0 8 0 || DIE=1
101
102 if test "$DIE" -eq 1; then
103         exit 1
104 fi
105
106 test -f $srcfile || {
107         echo "You must run this script in the top-level $package directory"
108         exit 1
109 }
110
111 if test -z "$*"; then
112         echo "I am going to run ./configure with no arguments - if you wish "
113         echo "to pass any to it, please specify them on the $0 command line."
114 fi
115
116 echo "+ creating acinclude.m4"
117 cat m4/*.m4 > acinclude.m4
118
119 echo "+ running aclocal ..."
120 aclocal $ACLOCAL_FLAGS || {
121         echo
122         echo "aclocal failed - check that all needed development files are present on system"
123         exit 1
124 }
125
126 # FIXME : why does libtoolize keep complaining about aclocal ?
127 echo "+ running libtoolize ..."
128 libtoolize --copy --force
129
130 echo "+ running autoheader ... "
131 autoheader || {
132         echo
133         echo "autoheader failed"
134         exit 1
135 }
136 echo "+ running autoconf ... "
137 autoconf || {
138         echo
139         echo "autoconf failed"
140         exit 1
141 }
142 echo "+ running automake ... "
143 automake -a -c || {
144         echo
145         echo "automake failed"
146         exit 1
147 }
148
149 # now remove the cache, because it can be considered dangerous in this case
150 #echo "+ removing config.cache ... "
151 #rm -f config.cache
152
153 CONFIGURE_OPT='--enable-maintainer-mode --enable-plugin-builddir --enable-debug --enable-DEBUG'
154
155 echo "+ running configure ... "
156 echo "./configure default flags: $CONFIGURE_OPT"
157 echo "using: $CONFIGURE_OPT $@"
158 echo
159
160 ./configure $CONFIGURE_OPT "$@" || {
161         echo
162         echo "configure failed"
163         exit 1
164 }
165
166 echo 
167 echo "Now type 'make' to compile $package."