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 ac_version=`$autoconf --version|head -n 1|sed 's/^[a-zA-z\.\ ()]*//;s/ .*$//'`
114 if test "$ac_version" = "2.52d"; then
115 echo "autoconf 2.52d has an issue with our current build."
116 echo "We don't know who's to blame however. So until we do, get a"
117 echo "regular version. RPM's of a working version are on the gstreamer site."
125 # if set to 1, we need to print something helpful then die
127 if test "x$DIE" = "x1";
130 echo "- Please get the right tools before proceeding."
131 echo "- Alternatively, if you're sure we're wrong, run with --nocheck."
138 # we use getopt stuff here, copied things from the example example.bash
139 TEMP=`getopt -o h --long noconfigure,nocheck,debug,help,with-automake:,with-autoconf:,prefix:\
148 AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --noconfigure"
149 echo "+ configure run disabled"
153 AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --nocheck"
155 echo "+ autotools version check disabled"
160 AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --debug"
161 echo "+ debug output enabled"
165 CONFIGURE_EXT_OPT="$CONFIGURE_EXT_OPT --prefix=$2"
166 echo "+ passing --prefix=$2 to configure"
170 echo "autogen.sh (autogen options) -- (configure options)"
171 echo "autogen.sh help options: "
172 echo " --noconfigure don't run the configure script"
173 echo " --nocheck don't do version checks"
174 echo " --debug debug the autogen process"
175 echo " --prefix will be passed on to configure"
177 echo " --with-autoconf PATH use autoconf in PATH"
178 echo " --with-automake PATH use automake in PATH"
180 echo "to pass options to configure, put them as arguments after -- "
185 echo "+ using alternate automake in $2"
190 echo "+ using alternate autoconf in $2"
194 *) echo "Internal error !" ; exit 1 ;;
198 for arg do CONFIGURE_EXT_OPT="$CONFIGURE_EXT_OPT $arg"; done
199 if test ! -z "$CONFIGURE_EXT_OPT"
201 echo "+ options passed to configure: $CONFIGURE_EXT_OPT"
208 test -f $srcfile || {
209 echo "You must run this script in the top-level $package directory"
219 echo "+ running $tool $options..."