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"
30 COMMAND="$PKG_PATH/$PACKAGE"
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 debug "pkg_version $pkg_version"
66 # remove any non-digit characters from the version numbers to permit numeric
68 pkg_major=`echo $pkg_version | cut -d. -f1 | sed s/[a-zA-Z\-].*//g`
69 pkg_minor=`echo $pkg_version | cut -d. -f2 | sed s/[a-zA-Z\-].*//g`
70 pkg_micro=`echo $pkg_version | cut -d. -f3 | sed s/[a-zA-Z\-].*//g`
71 test -z "$pkg_minor" && pkg_minor=0
72 test -z "$pkg_micro" && pkg_micro=0
74 debug "found major $pkg_major minor $pkg_minor micro $pkg_micro"
76 #start checking the version
79 if [ ! "$pkg_major" -gt "$MAJOR" ]; then
80 debug "$pkg_major <= $MAJOR"
81 if [ "$pkg_major" -lt "$MAJOR" ]; then
83 elif [ ! "$pkg_minor" -gt "$MINOR" ]; then
84 if [ "$pkg_minor" -lt "$MINOR" ]; then
86 elif [ "$pkg_micro" -lt "$MICRO" ]; then
92 if test ! -z "$WRONG"; then
93 echo "found $pkg_version, not ok !"
95 echo "You must have $PACKAGE $VERSION or greater to compile $package."
96 echo "Get the latest version from $URL"
100 echo "found $pkg_version, ok."
101 # we set a var with the same name as the package, but stripped of
103 VAR=`echo $PACKAGE | sed 's/-//g'`
109 autoconf_2.52d_check ()
111 # autoconf 2.52d has a weird issue involving a yes:no error
112 # so don't allow it's use
113 test -z "$NOCHECK" && {
114 ac_version=`$autoconf --version|head -n 1|sed 's/^[a-zA-z\.\ ()]*//;s/ .*$//'`
115 if test "$ac_version" = "2.52d"; then
116 echo "autoconf 2.52d has an issue with our current build."
117 echo "We don't know who's to blame however. So until we do, get a"
118 echo "regular version. RPM's of a working version are on the gstreamer site."
128 # if set to 1, we need to print something helpful then die
130 if test "x$DIE" = "x1";
133 echo "- Please get the right tools before proceeding."
134 echo "- Alternatively, if you're sure we're wrong, run with --nocheck."
141 # we use getopt stuff here, copied things from the example example.bash
142 TEMP=`getopt -o h --long noconfigure,nocheck,debug,help,with-automake:,with-autoconf:,prefix:\
151 AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --noconfigure"
152 echo "+ configure run disabled"
156 AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --nocheck"
158 echo "+ autotools version check disabled"
163 AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --debug"
164 echo "+ debug output enabled"
168 CONFIGURE_EXT_OPT="$CONFIGURE_EXT_OPT --prefix=$2"
169 echo "+ passing --prefix=$2 to configure"
173 echo "autogen.sh (autogen options) -- (configure options)"
174 echo "autogen.sh help options: "
175 echo " --noconfigure don't run the configure script"
176 echo " --nocheck don't do version checks"
177 echo " --debug debug the autogen process"
178 echo " --prefix will be passed on to configure"
180 echo " --with-autoconf PATH use autoconf in PATH"
181 echo " --with-automake PATH use automake in PATH"
183 echo "to pass options to configure, put them as arguments after -- "
188 echo "+ using alternate automake in $2"
193 echo "+ using alternate autoconf in $2"
197 *) echo "Internal error !" ; exit 1 ;;
201 for arg do CONFIGURE_EXT_OPT="$CONFIGURE_EXT_OPT $arg"; done
202 if test ! -z "$CONFIGURE_EXT_OPT"
204 echo "+ options passed to configure: $CONFIGURE_EXT_OPT"
211 test -f $srcfile || {
212 echo "You must run this script in the top-level $package directory"
222 echo "+ running $tool $options..."