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 !"
174 autoconf_2_52d_check ()
176 # autoconf 2.52d has a weird issue involving a yes:no error
177 # so don't allow it's use
178 test -z "$NOCHECK" && {
179 ac_version=`$autoconf --version|head -n 1|sed 's/^[a-zA-Z\.\ ()]*//;s/ .*$//'`
180 if test "$ac_version" = "2.52d"; then
181 echo "autoconf 2.52d has an issue with our current build."
182 echo "We don't know who's to blame however. So until we do, get a"
183 echo "regular version. RPM's of a working version are on the gstreamer site."
193 # if set to 1, we need to print something helpful then die
195 if test "x$DIE" = "x1";
198 echo "- Please get the right tools before proceeding."
199 echo "- Alternatively, if you're sure we're wrong, run with --nocheck."
206 if test "x$1" = "x"; then
210 while test "x$1" != "x" ; do
211 optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
215 AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --noconfigure"
216 echo "+ configure run disabled"
220 AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --nocheck"
222 echo "+ autotools version check disabled"
227 AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --debug"
228 echo "+ debug output enabled"
232 echo "autogen.sh (autogen options) -- (configure options)"
233 echo "autogen.sh help options: "
234 echo " --noconfigure don't run the configure script"
235 echo " --nocheck don't do version checks"
236 echo " --debug debug the autogen process"
238 echo " --with-autoconf PATH use autoconf in PATH"
239 echo " --with-automake PATH use automake in PATH"
241 echo "Any argument either not in the above list or after a '--' will be "
242 echo "passed to ./configure."
247 echo "+ using alternate automake in $optarg"
248 CONFIGURE_DEF_OPT="$CONFIGURE_DEF_OPT --with-automake=$AUTOMAKE"
253 echo "+ using alternate autoconf in $optarg"
254 CONFIGURE_DEF_OPT="$CONFIGURE_DEF_OPT --with-autoconf=$AUTOCONF"
259 echo "+ passing argument $1 to configure"
260 CONFIGURE_EXT_OPT="$CONFIGURE_EXT_OPT $1"
266 for arg do CONFIGURE_EXT_OPT="$CONFIGURE_EXT_OPT $arg"; done
267 if test ! -z "$CONFIGURE_EXT_OPT"
269 echo "+ options passed to configure: $CONFIGURE_EXT_OPT"
276 test -f $srcfile || {
277 echo "You must run this script in the top-level $package directory"
287 echo "+ running $tool $options..."
298 if test -d .git; then
299 # install pre-commit hook for doing clean commits
300 for hook in pre-commit; do
301 if test ! \( -x .git/hooks/$hook -a -L .git/hooks/$hook \); then
302 echo "+ Installing git $hook hook"
303 rm -f .git/hooks/$hook
304 ln -s ../../common/hooks/$hook.hook .git/hooks/$hook || {
305 # if we couldn't create a symbolic link, try doing a plain cp
306 if cp common/hooks/pre-commit.hook .git/hooks/pre-commit; then
307 chmod +x .git/hooks/pre-commit;
309 echo "********** Couldn't install git $hook hook **********";