1 # helper functions for autogen.sh
4 # print out a debug message if DEBUG is a defined variable
13 # check the version of a package
14 # first argument : package name (executable)
15 # second argument : optional path where to look for it instead
16 # third argument : source download url
17 # rest of arguments : major, minor, micro version
28 if test ! -z "$PKG_PATH"
34 debug "major $MAJOR minor $MINOR micro $MICRO"
36 if test ! -z "$MINOR"; then VERSION=$VERSION.$MINOR; else MINOR=0; fi
37 if test ! -z "$MICRO"; then VERSION=$VERSION.$MICRO; else MICRO=0; fi
39 debug "major $MAJOR minor $MINOR micro $MICRO"
41 test -z "$NOCHECK" && {
42 echo -n " checking for $1 >= $VERSION"
43 if test ! -z "$PKG_PATH"; then echo -n " (in $PKG_PATH)"; fi
46 # we set a var with the same name as the package, but stripped of
48 VAR=`echo $PACKAGE | sed 's/-//g'`
54 debug "checking version with $COMMAND"
55 ($COMMAND --version) < /dev/null > /dev/null 2>&1 ||
58 echo "You must have $PACKAGE installed to compile $package."
59 echo "Download the appropriate package for your distribution,"
60 echo "or get the source tarball at $URL"
63 # the following line is carefully crafted sed magic
64 #pkg_version=`$COMMAND --version|head -n 1|sed 's/^[a-zA-z\.\ ()]*//;s/ .*$//'`
65 pkg_version=`$COMMAND --version|head -n 1|sed 's/^.*) //'|sed 's/ (.*)//'`
66 debug "pkg_version $pkg_version"
67 # remove any non-digit characters from the version numbers to permit numeric
69 pkg_major=`echo $pkg_version | cut -d. -f1 | sed s/[a-zA-Z\-].*//g`
70 pkg_minor=`echo $pkg_version | cut -d. -f2 | sed s/[a-zA-Z\-].*//g`
71 pkg_micro=`echo $pkg_version | cut -d. -f3 | sed s/[a-zA-Z\-].*//g`
72 test -z "$pkg_minor" && pkg_minor=0
73 test -z "$pkg_micro" && pkg_micro=0
75 debug "found major $pkg_major minor $pkg_minor micro $pkg_micro"
77 #start checking the version
80 if [ ! "$pkg_major" -gt "$MAJOR" ]; then
81 debug "$pkg_major <= $MAJOR"
82 if [ "$pkg_major" -lt "$MAJOR" ]; then
84 elif [ ! "$pkg_minor" -gt "$MINOR" ]; then
85 if [ "$pkg_minor" -lt "$MINOR" ]; then
87 elif [ "$pkg_micro" -lt "$MICRO" ]; then
93 if test ! -z "$WRONG"; then
94 echo "found $pkg_version, not ok !"
96 echo "You must have $PACKAGE $VERSION or greater to compile $package."
97 echo "Get the latest version from $URL"
101 echo "found $pkg_version, ok."
102 # we set a var with the same name as the package, but stripped of
104 VAR=`echo $PACKAGE | sed 's/-//g'`
110 autoconf_2.52d_check ()
112 # autoconf 2.52d has a weird issue involving a yes:no error
113 # so don't allow it's use
114 test -z "$NOCHECK" && {
115 ac_version=`$autoconf --version|head -n 1|sed 's/^[a-zA-z\.\ ()]*//;s/ .*$//'`
116 if test "$ac_version" = "2.52d"; then
117 echo "autoconf 2.52d has an issue with our current build."
118 echo "We don't know who's to blame however. So until we do, get a"
119 echo "regular version. RPM's of a working version are on the gstreamer site."
129 # if set to 1, we need to print something helpful then die
131 if test "x$DIE" = "x1";
134 echo "- Please get the right tools before proceeding."
135 echo "- Alternatively, if you're sure we're wrong, run with --nocheck."
142 # we use getopt stuff here, copied things from the example example.bash
143 TEMP=`getopt -o h --long noconfigure,nocheck,debug,help,with-automake:,with-autoconf:,prefix:\
152 AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --noconfigure"
153 echo "+ configure run disabled"
157 AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --nocheck"
159 echo "+ autotools version check disabled"
164 AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --debug"
165 echo "+ debug output enabled"
169 CONFIGURE_EXT_OPT="$CONFIGURE_EXT_OPT --prefix=$2"
170 echo "+ passing --prefix=$2 to configure"
174 echo "autogen.sh (autogen options) -- (configure options)"
175 echo "autogen.sh help options: "
176 echo " --noconfigure don't run the configure script"
177 echo " --nocheck don't do version checks"
178 echo " --debug debug the autogen process"
179 echo " --prefix will be passed on to configure"
181 echo " --with-autoconf PATH use autoconf in PATH"
182 echo " --with-automake PATH use automake in PATH"
184 echo "to pass options to configure, put them as arguments after -- "
189 echo "+ using alternate automake in $2"
194 echo "+ using alternate autoconf in $2"
198 *) echo "Internal error !" ; exit 1 ;;
202 for arg do CONFIGURE_EXT_OPT="$CONFIGURE_EXT_OPT $arg"; done
203 if test ! -z "$CONFIGURE_EXT_OPT"
205 echo "+ options passed to configure: $CONFIGURE_EXT_OPT"
212 test -f $srcfile || {
213 echo "You must run this script in the top-level $package directory"
223 echo "+ running $tool $options..."