1 # a silly hack that generates autoregen.sh but it's handy
2 echo "#!/bin/sh" > autoregen.sh
3 echo "./autogen.sh $@" >> autoregen.sh
6 # helper functions for autogen.sh
9 # print out a debug message if DEBUG is a defined variable
18 # check the version of a package
19 # first argument : package name (executable)
20 # second argument : optional path where to look for it instead
21 # third argument : source download url
22 # rest of arguments : major, minor, micro version
33 if test ! -z "$PKG_PATH"
39 debug "major $MAJOR minor $MINOR micro $MICRO"
41 if test ! -z "$MINOR"; then VERSION=$VERSION.$MINOR; else MINOR=0; fi
42 if test ! -z "$MICRO"; then VERSION=$VERSION.$MICRO; else MICRO=0; fi
44 debug "major $MAJOR minor $MINOR micro $MICRO"
46 test -z "$NOCHECK" && {
47 echo -n " checking for $1 >= $VERSION"
48 if test ! -z "$PKG_PATH"; then echo -n " (in $PKG_PATH)"; fi
51 # we set a var with the same name as the package, but stripped of
53 VAR=`echo $PACKAGE | sed 's/-//g'`
59 debug "checking version with $COMMAND"
60 ($COMMAND --version) < /dev/null > /dev/null 2>&1 ||
63 echo "You must have $PACKAGE installed to compile $package."
64 echo "Download the appropriate package for your distribution,"
65 echo "or get the source tarball at $URL"
68 # the following line is carefully crafted sed magic
69 #pkg_version=`$COMMAND --version|head -n 1|sed 's/^[a-zA-z\.\ ()]*//;s/ .*$//'`
70 pkg_version=`$COMMAND --version|head -n 1|sed 's/^.*) //'|sed 's/ (.*)//'`
71 debug "pkg_version $pkg_version"
72 # remove any non-digit characters from the version numbers to permit numeric
74 pkg_major=`echo $pkg_version | cut -d. -f1 | sed s/[a-zA-Z\-].*//g`
75 pkg_minor=`echo $pkg_version | cut -d. -f2 | sed s/[a-zA-Z\-].*//g`
76 pkg_micro=`echo $pkg_version | cut -d. -f3 | sed s/[a-zA-Z\-].*//g`
77 test -z "$pkg_minor" && pkg_minor=0
78 test -z "$pkg_micro" && pkg_micro=0
80 debug "found major $pkg_major minor $pkg_minor micro $pkg_micro"
82 #start checking the version
85 if [ ! "$pkg_major" -gt "$MAJOR" ]; then
86 debug "$pkg_major <= $MAJOR"
87 if [ "$pkg_major" -lt "$MAJOR" ]; then
89 elif [ ! "$pkg_minor" -gt "$MINOR" ]; then
90 if [ "$pkg_minor" -lt "$MINOR" ]; then
92 elif [ "$pkg_micro" -lt "$MICRO" ]; then
98 if test ! -z "$WRONG"; then
99 echo "found $pkg_version, not ok !"
101 echo "You must have $PACKAGE $VERSION or greater to compile $package."
102 echo "Get the latest version from $URL"
106 echo "found $pkg_version, ok."
107 # we set a var with the same name as the package, but stripped of
109 VAR=`echo $PACKAGE | sed 's/-//g'`
117 # normally aclocal is part of automake
118 # so we expect it to be in the same place as automake
119 # so if a different automake is supplied, we need to adapt as well
120 # so how's about replacing automake with aclocal in the set var,
121 # and saving that in $aclocal ?
122 # note, this will fail if the actual automake isn't called automake*
123 # or if part of the path before it contains it
124 if [ -z "$automake" ]; then
125 echo "Error: no automake variable set !"
128 aclocal=`echo $automake | sed s/automake/aclocal/`
129 debug "aclocal: $aclocal"
133 autoconf_2.52d_check ()
135 # autoconf 2.52d has a weird issue involving a yes:no error
136 # so don't allow it's use
137 test -z "$NOCHECK" && {
138 ac_version=`$autoconf --version|head -n 1|sed 's/^[a-zA-z\.\ ()]*//;s/ .*$//'`
139 if test "$ac_version" = "2.52d"; then
140 echo "autoconf 2.52d has an issue with our current build."
141 echo "We don't know who's to blame however. So until we do, get a"
142 echo "regular version. RPM's of a working version are on the gstreamer site."
152 # if set to 1, we need to print something helpful then die
154 if test "x$DIE" = "x1";
157 echo "- Please get the right tools before proceeding."
158 echo "- Alternatively, if you're sure we're wrong, run with --nocheck."
165 # we use getopt stuff here, copied things from the example example.bash
166 TEMP=`getopt -o h --long noconfigure,nocheck,debug,help,with-automake:,with-autoconf:,prefix:\
175 AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --noconfigure"
176 echo "+ configure run disabled"
180 AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --nocheck"
182 echo "+ autotools version check disabled"
187 AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --debug"
188 echo "+ debug output enabled"
192 CONFIGURE_EXT_OPT="$CONFIGURE_EXT_OPT --prefix=$2"
193 echo "+ passing --prefix=$2 to configure"
197 echo "autogen.sh (autogen options) -- (configure options)"
198 echo "autogen.sh help options: "
199 echo " --noconfigure don't run the configure script"
200 echo " --nocheck don't do version checks"
201 echo " --debug debug the autogen process"
202 echo " --prefix will be passed on to configure"
204 echo " --with-autoconf PATH use autoconf in PATH"
205 echo " --with-automake PATH use automake in PATH"
207 echo "to pass options to configure, put them as arguments after -- "
212 echo "+ using alternate automake in $2"
217 echo "+ using alternate autoconf in $2"
221 *) echo "Internal error !" ; exit 1 ;;
225 for arg do CONFIGURE_EXT_OPT="$CONFIGURE_EXT_OPT $arg"; done
226 if test ! -z "$CONFIGURE_EXT_OPT"
228 echo "+ options passed to configure: $CONFIGURE_EXT_OPT"
235 test -f $srcfile || {
236 echo "You must run this script in the top-level $package directory"
246 echo "+ running $tool $options..."