## command -v doesn't work in zsh
## command -v "$1" 2>&1
## this test should work in ash, bash, pdksh (ksh), zsh
- type -p "$1" 2>/dev/null | tail -1 | awk '{print $NF}'
+ type -p "$1" 2>/dev/null | tail -n 1 | awk '{print $NF}'
])
# Get version string from executable ($1)
AC_DEFUN(STEPMAKE_GET_VERSION, [
- ## "$1" --version 2>&1 | grep -v '^$' | head -1 | awk '{print $NF}'
+ ## "$1" --version 2>&1 | grep -v '^$' | head -n 1 | awk '{print $NF}'
##
## ARG.
## Workaround for broken Debian gcc version string:
## Assume, and hunt for, dotted version multiplet.
changequote(<<, >>)dnl
- ("$1" --version || "$1" -V) 2>&1 | grep '[0-9]\.[0-9]' | head -1 | \
+ ("$1" --version || "$1" -V) 2>&1 | grep '[0-9]\.[0-9]' | head -n 1 | \
sed -e 's/.*[^-.0-9]\([0-9][0-9]*\.[0-9][.0-9]*\).*/\1/'
changequote([, ])dnl
])
if test "$num" -lt "$req"; then
STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
fi
+ vervar="`echo $1 | tr '[a-z]' '[A-Z]'`_VERSION"
+ eval `echo $vervar=$num`
+## AC_SUBST(`eval echo $vervar`)
])
# Check version of program ($1)
optimise_b=yes
profile_b=no
debug_b=yes
+ pipe_b=yes
AC_ARG_ENABLE(checking,
[ --enable-checking set runtime checks (assert calls). Default: on],
[ --enable-profiling compile with gprof support. Default: off],
[profile_b=$enableval])
+ AC_ARG_ENABLE(pipe,
+ [ --enable-pipe compile with -pipe. Default: on],
+ [pipe_b=$enableval])
if test "$checking_b" = no; then
# ugh
OPTIMIZE="-O2 -finline-functions"
fi
-
if test $profile_b = yes; then
EXTRA_LIBES="-pg"
OPTIMIZE="$OPTIMIZE -pg"
fi
- if test $debug_b = yes; then
+ if test $debug_b = yes; then
OPTIMIZE="$OPTIMIZE -g"
fi
-
-
+
AC_PROG_CC
STEPMAKE_OPTIONAL_REQUIRED(CC, cc, $1)
LD='$(CC)'
AC_SUBST(LD)
+ # If -pipe requested, test if it works and add to CFLAGS.
+ if test "$pipe_b" = yes; then
+ save_cflags="$CFLAGS"
+ CFLAGS="-pipe $CFLAGS";
+ AC_CACHE_CHECK([whether compiler understands -pipe],
+ [stepmake_cflags_pipe],
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[/* -pipe test */]])],
+ [stepmake_cflags_pipe=yes],
+ [stepmake_cflags_pipe=no]))
+ CFLAGS=$save_cflags
+ if test $stepmake_cflags_pipe = yes; then
+ OPTIMIZE="$OPTIMIZE -pipe"
+ fi
+ fi
+
CFLAGS="$CFLAGS $OPTIMIZE"
CPPFLAGS=${CPPFLAGS-""}
AC_MSG_RESULT([none])
;;
esac
+
AC_SUBST(cross_compiling)
AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
if test -n "$OPTIONAL$REQUIRED$UNSUPPORTED"; then
echo
echo "See INSTALL.txt for more information on how to build $PACKAGE_NAME"
- if [ -f config.cache ] ; then
+ if test -f config.cache ; then
echo "Remove config.cache before rerunning ./configure"
fi
fi
GCC_UNSUPPORTED=
STEPMAKE_CHECK_VERSION_UNSUPPORTED(CXX, GCC_UNSUPPORTED, 3.3)
if test -n "$GCC_UNSUPPORTED"; then
- AC_MSG_WARN([autoconf <= 2.57 with g++ >= 3.3 gettext test broken.])
- AC_MSG_WARN([Trying gcc, cross thumbs.])
+ AC_MSG_WARN([autoconf <= 2.59 with g++ >= 3.3 gettext test broken.])
+ AC_MSG_WARN([Trying gcc, cross fingers.])
AC_LANG_PUSH(C)
fi
AC_CHECK_LIB(intl, gettext)
])
+dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
+dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
+dnl also defines GSTUFF_PKG_ERRORS on error
+AC_DEFUN(PKG_CHECK_MODULES, [
+ succeeded=no
+
+ if test -z "$PKG_CONFIG"; then
+ AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+ fi
+
+ if test "$PKG_CONFIG" = "no" ; then
+ echo "*** The pkg-config script could not be found. Make sure it is"
+ echo "*** in your path, or set the PKG_CONFIG environment variable"
+ echo "*** to the full path to pkg-config."
+ echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
+ else
+ PKG_CONFIG_MIN_VERSION=0.9.0
+ if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
+ AC_MSG_CHECKING(for $2)
+
+ if $PKG_CONFIG --exists "$2" ; then
+ AC_MSG_RESULT(yes)
+ succeeded=yes
+
+ AC_MSG_CHECKING($1_CFLAGS)
+ $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
+ AC_MSG_RESULT($$1_CFLAGS)
+
+ AC_MSG_CHECKING($1_LIBS)
+ $1_LIBS=`$PKG_CONFIG --libs "$2"`
+ AC_MSG_RESULT($$1_LIBS)
+ else
+ $1_CFLAGS=""
+ $1_LIBS=""
+ ## If we have a custom action on failure, don't print errors, but
+ ## do set a variable so people can do so.
+ $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
+ ifelse([$4], ,echo $$1_PKG_ERRORS,)
+ fi
+
+ AC_SUBST($1_CFLAGS)
+ AC_SUBST($1_LIBS)
+ else
+ echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
+ echo "*** See http://www.freedesktop.org/software/pkgconfig"
+ fi
+ fi
+
+ if test $succeeded = yes; then
+ ifelse([$3], , :, [$3])
+ else
+ ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4])
+ fi
+])
+
+
+AC_DEFUN(STEPMAKE_FREETYPE2, [
+ PKG_CHECK_MODULES(FREETYPE2, freetype2 >= 0, have_freetype2=true, true)
+ if $have_freetype2 ; then
+ AC_DEFINE(HAVE_FREETYPE2)
+ AC_SUBST(FREETYPE2_CFLAGS)
+ AC_SUBST(FREETYPE2_LIBS)
+ fi
+])
+
+AC_DEFUN(STEPMAKE_GTK2, [
+ PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= 2.4.0, have_gtk2=true, true)
+ if $have_gtk2 ; then
+ AC_DEFINE(HAVE_GTK2)
+ AC_SUBST(GTK2_CFLAGS)
+ AC_SUBST(GTK2_LIBS)
+ fi
+])
+
+AC_DEFUN(STEPMAKE_PANGO, [
+ PKG_CHECK_MODULES(PANGO, pango >= 1.5.0, have_pango_cvs=true, true)
+ if $have_pango_cvs ; then
+ AC_DEFINE(HAVE_PANGO_CVS)
+ PANGO_CFLAGS="$PANGO_CFLAGS $GTK2_CFLAGS"
+ PANGO_LIBS="$PANGO_LIBS $GTK2_LIBS"
+ CPPFLAGS="$PANGO_CFLAGS $CPPFLAGS"
+ LIBS="$PANGO_LIBS $LIBS"
+ AC_CHECK_HEADERS([pango/pangofc-fontmap.h])
+ AC_CHECK_FUNCS([pango_fc_font_map_add_decoder_find_func])
+ AC_SUBST(PANGO_CFLAGS)
+ AC_SUBST(PANGO_LIBS)
+fi
+])