1 # a silly hack that generates autoregen.sh but it's handy
2 # Remove the old autoregen.sh first to create a new file,
3 # as the current one may be being read by the shell executing
5 if [ -f "autoregen.sh" ]; then
8 echo "#!/bin/sh" > autoregen.sh
9 echo "./autogen.sh $@ \$@" >> autoregen.sh
12 # helper functions for autogen.sh
15 # print out a debug message if DEBUG is a defined variable
24 # check the version of a package
25 # first argument : package name (executable)
26 # second argument : optional path where to look for it instead
27 # third argument : source download url
28 # rest of arguments : major, minor, micro version
29 # all consecutive ones : suggestions for binaries to use
30 # (if not specified in second argument)
39 # for backwards compatibility, we let PKG_PATH=PACKAGE when PKG_PATH null
40 if test -z "$PKG_PATH"; then PKG_PATH=$PACKAGE; fi
41 debug "major $MAJOR minor $MINOR micro $MICRO"
43 if test ! -z "$MINOR"; then VERSION=$VERSION.$MINOR; else MINOR=0; fi
44 if test ! -z "$MICRO"; then VERSION=$VERSION.$MICRO; else MICRO=0; fi
46 debug "major $MAJOR minor $MINOR micro $MICRO"
48 for SUGGESTION in $PKG_PATH; do
51 # don't check if asked not to
52 test -z "$NOCHECK" && {
53 echo -n " checking for $COMMAND >= $VERSION ... "
55 # we set a var with the same name as the package, but stripped of
57 VAR=`echo $PACKAGE | sed 's/-//g'`
63 debug "checking version with $COMMAND"
64 ($COMMAND --version) < /dev/null > /dev/null 2>&1 ||
69 # strip everything that's not a digit, then use cut to get the first field
70 pkg_version=`$COMMAND --version|head -n 1|sed 's/^.*)[^0-9]*//'|cut -d' ' -f1`
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_major" && pkg_major=0
78 test -z "$pkg_minor" && pkg_minor=0
79 test -z "$pkg_micro" && pkg_micro=0
80 debug "found major $pkg_major minor $pkg_minor micro $pkg_micro"
82 #start checking the version
88 if [ ! "$pkg_major" -gt "$MAJOR" ]; then
89 debug "major: $pkg_major <= $MAJOR"
90 if [ "$pkg_major" -lt "$MAJOR" ]; then
91 debug "major: $pkg_major < $MAJOR"
93 elif [ ! "$pkg_minor" -gt "$MINOR" ]; then
94 debug "minor: $pkg_minor <= $MINOR"
95 if [ "$pkg_minor" -lt "$MINOR" ]; then
96 debug "minor: $pkg_minor < $MINOR"
98 elif [ "$pkg_micro" -lt "$MICRO" ]; then
99 debug "micro: $pkg_micro < $MICRO"
105 if test ! -z "$WRONG"; then
106 echo "found $pkg_version, not ok !"
109 echo "found $pkg_version, ok."
110 # we set a var with the same name as the package, but stripped of
112 VAR=`echo $PACKAGE | sed 's/-//g'`
120 echo "You must have $PACKAGE installed to compile $package."
121 echo "Download the appropriate package for your distribution,"
122 echo "or get the source tarball at $URL"
128 # normally aclocal is part of automake
129 # so we expect it to be in the same place as automake
130 # so if a different automake is supplied, we need to adapt as well
131 # so how's about replacing automake with aclocal in the set var,
132 # and saving that in $aclocal ?
133 # note, this will fail if the actual automake isn't called automake*
134 # or if part of the path before it contains it
135 if [ -z "$automake" ]; then
136 echo "Error: no automake variable set !"
139 aclocal=`echo $automake | sed s/automake/aclocal/`
140 debug "aclocal: $aclocal"
141 if [ "$aclocal" != "aclocal" ];
143 CONFIGURE_DEF_OPT="$CONFIGURE_DEF_OPT --with-aclocal=$aclocal"
145 if [ ! -x `which $aclocal` ]; then
146 echo "Error: cannot execute $aclocal !"
154 # same here - autoheader is part of autoconf
155 # use the same voodoo
156 if [ -z "$autoconf" ]; then
157 echo "Error: no autoconf variable set !"
160 autoheader=`echo $autoconf | sed s/autoconf/autoheader/`
161 debug "autoheader: $autoheader"
162 if [ "$autoheader" != "autoheader" ];
164 CONFIGURE_DEF_OPT="$CONFIGURE_DEF_OPT --with-autoheader=$autoheader"
166 if [ ! -x `which $autoheader` ]; then
167 echo "Error: cannot execute $autoheader !"
173 autoconf_2_52d_check ()
175 # autoconf 2.52d has a weird issue involving a yes:no error
176 # so don't allow it's use
177 test -z "$NOCHECK" && {
178 ac_version=`$autoconf --version|head -n 1|sed 's/^[a-zA-Z\.\ ()]*//;s/ .*$//'`
179 if test "$ac_version" = "2.52d"; then
180 echo "autoconf 2.52d has an issue with our current build."
181 echo "We don't know who's to blame however. So until we do, get a"
182 echo "regular version. RPM's of a working version are on the gstreamer site."
192 # if set to 1, we need to print something helpful then die
194 if test "x$DIE" = "x1";
197 echo "- Please get the right tools before proceeding."
198 echo "- Alternatively, if you're sure we're wrong, run with --nocheck."
205 if test "x$1" = "x"; then
209 while test "x$1" != "x" ; do
210 optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
214 AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --noconfigure"
215 echo "+ configure run disabled"
219 AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --nocheck"
221 echo "+ autotools version check disabled"
226 AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --debug"
227 echo "+ debug output enabled"
231 CONFIGURE_EXT_OPT="$CONFIGURE_EXT_OPT --prefix=$optarg"
232 echo "+ passing --prefix=$optarg to configure"
238 CONFIGURE_EXT_OPT="$CONFIGURE_EXT_OPT --prefix=$1"
239 echo "+ passing --prefix=$1 to configure"
244 echo "autogen.sh (autogen options) -- (configure options)"
245 echo "autogen.sh help options: "
246 echo " --noconfigure don't run the configure script"
247 echo " --nocheck don't do version checks"
248 echo " --debug debug the autogen process"
249 echo " --prefix will be passed on to configure"
251 echo " --with-autoconf PATH use autoconf in PATH"
252 echo " --with-automake PATH use automake in PATH"
254 echo "to pass options to configure, put them as arguments after -- "
259 echo "+ using alternate automake in $optarg"
260 CONFIGURE_DEF_OPT="$CONFIGURE_DEF_OPT --with-automake=$AUTOMAKE"
265 echo "+ using alternate autoconf in $optarg"
266 CONFIGURE_DEF_OPT="$CONFIGURE_DEF_OPT --with-autoconf=$AUTOCONF"
269 --disable*|--enable*|--with*)
270 echo "+ passing option $1 to configure"
271 CONFIGURE_EXT_OPT="$CONFIGURE_EXT_OPT $1"
275 *) echo "- ignoring unknown autogen.sh argument $1"; shift ;;
279 for arg do CONFIGURE_EXT_OPT="$CONFIGURE_EXT_OPT $arg"; done
280 if test ! -z "$CONFIGURE_EXT_OPT"
282 echo "+ options passed to configure: $CONFIGURE_EXT_OPT"
289 test -f $srcfile || {
290 echo "You must run this script in the top-level $package directory"
301 echo "+ running $tool $options..."