## 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:
## gcc (GCC) 3.1.1 20020606 (Debian prerelease)
##
+ ## -V: Workaround for python
+ ##
## Assume, and hunt for, dotted version multiplet.
+
changequote(<<, >>)dnl
- "$1" --version 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
])
req=`STEPMAKE_NUMERIC_VERSION($3)`
AC_MSG_RESULT([$ver])
if test "$num" -lt "$req"; then
- STEPMAKE_ADD_ENTRY($2, ["$r $3 (installed: $ver)"])
+ 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)
+# If version is greater than or equals unsupported ($3),
+# add entry to unsupported list ($2, 'UNSUPPORTED')
+AC_DEFUN(STEPMAKE_CHECK_VERSION_UNSUPPORTED, [
+ r="`eval echo '$'"$1"`"
+ AC_MSG_CHECKING([$r version])
+ exe=`STEPMAKE_GET_EXECUTABLE($r)`
+ ver=`STEPMAKE_GET_VERSION($exe)`
+ num=`STEPMAKE_NUMERIC_VERSION($ver)`
+ sup=`STEPMAKE_NUMERIC_VERSION($3)`
+ AC_MSG_RESULT([$ver])
+ if test "$num" -ge "$sup"; then
+ STEPMAKE_ADD_ENTRY($2, ["$r < $3 (installed: $ver)"])
fi
])
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)
AC_SUBST(REQUIRED)
AC_CONFIG_FILES([$CONFIGFILE.make:config.make.in])
-AC_OUTPUT
-
+ AC_OUTPUT
if test -n "$OPTIONAL"; then
echo
echo "ERROR: Please install required programs: $REQUIRED"
fi
- if test -n "$OPTIONAL$REQUIRED"; then
+ if test -n "$UNSUPPORTED"; then
+ echo
+ echo "ERROR: Please use older version of programs: $UNSUPPORTED"
+ fi
+
+ if test -n "$OPTIONAL$REQUIRED$UNSUPPORTED"; then
echo
echo "See INSTALL.txt for more information on how to build $PACKAGE_NAME"
- echo "Remove config.cache before rerunning ./configure"
+ if test -f config.cache ; then
+ echo "Remove config.cache before rerunning ./configure"
+ fi
fi
- if test -n "$REQUIRED"; then
+ if test -n "$REQUIRED$UNSUPPORTED"; then
rm -f $srcdir/GNUmakefile
exit 1
fi
fi
])
-
AC_DEFUN(STEPMAKE_GETTEXT, [
presome=${prefix}
if test "$prefix" = "NONE"; then
AC_SUBST(localedir)
AC_DEFINE_UNQUOTED(LOCALEDIR, ["${LOCALEDIR}"])
+ # ouch. autoconf <= 2.57's gettext check fails for
+ # g++ >= 3.3 (with -std=gnu++98, the default).
+ # While the check is OK for g++ -std=c++98,
+ # LilyPond needs GNU g++, so who is to blame here?
+ # Use a workaround until this is resolved:
+ # for g++ >= 3.3, select C language.
+ GCC_UNSUPPORTED=
+ STEPMAKE_CHECK_VERSION_UNSUPPORTED(CXX, GCC_UNSUPPORTED, 3.3)
+ if test -n "$GCC_UNSUPPORTED"; then
+ 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)
AC_CHECK_FUNCS(gettext)
+ if test -n "$GCC_UNSUPPORTED"; then
+ AC_LANG_POP(C)
+ fi
])
AC_PATH_PROG(BASH, bash, $SHELL)
fi
AC_SUBST(SHELL)
-
- STEPMAKE_PATH_PROG(PYTHON, python, REQUIRED)
+
+ STEPMAKE_PYTHON(REQUIRED, 1.5)
if expr "$MAKE" : '.*\(echo\)' >/dev/null; then
$MAKE -v 2> /dev/null | grep GNU > /dev/null
])
+AC_DEFUN(STEPMAKE_PYTHON, [
+ unset pv
+ AC_MSG_CHECKING([for python])
+ for python in $PYTHON python python2 python2.3 python2.2 python2.1 python2.0; do
+ AC_MSG_RESULT([$python])
+ if ! $python -V > /dev/null 2>&1 ; then
+ #AC_MSG_WARN([cannot execute $python])
+ PYTHON='echo no python'
+ else
+ unset pv
+ STEPMAKE_CHECK_VERSION(python, pv, $2)
+ if test -z "$pv"; then
+ PYTHON=$python
+ break
+ fi
+ fi
+ done
+ if test -n "$pv"; then
+ STEPMAKE_ADD_ENTRY($1, $pv)
+ fi
+ AC_PATH_PROG(PYTHON, $PYTHON)
+ AC_SUBST(PYTHON)
+])
+
AC_DEFUN(STEPMAKE_PYTHON_DEVEL, [
- AC_CHECK_HEADERS([python2.2/Python.h python2.1/Python.h python2.0/Python.h python2/Python.h python/Python.h python1.5/Python.h Python.h],[PYTHON_HEADER=yes])
+ unset PYTHON_HEADER PYTHON_INCLUDE
+ if test -n "$PYTHON"; then
+ changequote(<<, >>)dnl
+ # alternatively, for python >= 2.0
+ # 'import sys, distutils.sysconfig; sys.stdout.write (distutils.sysconfig.get_python_inc ())'
+ PYTHON_INCLUDE=`$PYTHON -c 'import sys; sys.stdout.write ("%s/include/python%s" % (sys.prefix, sys.version[:3]))'`
+ changequote([, ])dnl
+ fi
+
+ ##AC_CHECK_HEADERS([Python.h],[PYTHON_HEADER=yes])
+ if test -z "$PYTHON_HEADER"; then
+ #URG -- how to extend include path?
+ ac_compile="$ac_compile -I$PYTHON_INCLUDE"
+ ac_cpp="$ac_cpp -I$PYTHON_INCLUDE"
+ CPPFLAGS="$CPPFLAGS -I$PYTHON_INCLUDE"
+ AC_CHECK_HEADERS([Python.h],[PYTHON_HEADER=yes])
+ fi
+
if test -z "$PYTHON_HEADER"; then
- warn='python.h (python-devel, python-dev or libpython-dev package)'
+ warn="$PYTHON_INCLUDE/Python.h (python-devel, python-dev or libpython-dev package)"
STEPMAKE_ADD_ENTRY($1, $warn)
fi
])
])
+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
+])