+2005-04-17 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * stepmake/aclocal.m4 (STEPMAKE_PANGO_FT2): Define HAVE_PANGO16 too.
+
+ * lily/*: s/ifdef HAVE_*/if have/.
+
+ * SConstruct (test_lib): New function. Update pkg-config and some
+ other requirements.
+
+ * configure.in: Require pkg-config. Enforce REQUIRE and version for
+ freetype, pangof2t.
+
2005-04-16 Jan Nieuwenhuizen <janneke@gnu.org>
* po/lilypond.pot, ...: Update using bison-CVS.
def configure (target, source, env):
vre = re.compile ('^.*[^-.0-9]([0-9][0-9]*\.[0-9][.0-9]*).*$', re.DOTALL)
def get_version (program):
- command = '(%(program)s --version || %(program)s -V) 2>&1' % vars ()
+ command = '(pkg-config --modversion %(program)s || %(program)s --version || %(program)s -V) 2>&1' % vars ()
pipe = os.popen (command)
output = pipe.read ()
if pipe.close ():
return None
v = re.sub (vre, '\\1', output)
+ if v[-1] == '\n':
+ v = v[:-1]
return string.split (v, '.')
def test_program (lst, program, minimal, description, package):
print 'not found'
lst.append ((description, package, minimal, program,
'not installed'))
- return
+ return 0
sys.stdout.write (string.join (actual, '.'))
sys.stdout.write ('\n')
if actual < string.split (minimal, '.'):
lst.append ((description, package, minimal, program,
string.join (actual, '.')))
+ return 0
+ return 1
+
+ def test_lib (lst, program, minimal, description):
+ # FIXME: test for Debian or RPM (or -foo?) based dists
+ # to guess (or get correct!: apt-cache search?)
+ # package name.
+ #if os.system ('pkg-config --atleast-version=0 freetype2'):
+ # barf
+ if test_program (lst, program, minimal, description,
+ 'lib%(program)s-dev or %(program)s-devel'
+ % vars ()):
+ env.ParseConfig ('pkg-config --cflags --libs %(program)s'
+ % vars ())
+ return 1
+ return 0
for i in ['bash', 'perl', 'python', 'sh']:
sys.stdout.write ('Checking for %s... ' % i)
'bison')
test_program (required, 'flex', '0.0', 'Flex -- lexer generator', 'flex')
-
optional = []
test_program (optional, 'makeinfo', '4.7', 'Makeinfo tool', 'texinfo')
- test_program (optional, 'guile', '1.6', 'GUILE scheme',
- 'libguile-dev or guile-devel')
- test_program (optional, 'mftrace', '1.0.27', 'Metafont tracing Type1',
+ test_program (optional, 'guile', '1.6', 'GUILE scheme', 'guile')
+ test_program (optional, 'mftrace', '1.1.0', 'Metafont tracing Type1',
'mftrace')
test_program (optional, 'perl', '4.0',
'Perl practical efficient readonly language', 'perl')
defines = {
'DIRSEP' : "'%s'" % os.sep,
'PATHSEP' : "'%s'" % os.pathsep,
- 'TOPLEVEL_VERSION' : '"' + version + '"',
- 'PACKAGE': '"' + package.name + '"',
- 'DATADIR' : '"' + sharedir + '"',
- 'LILYPOND_DATADIR' : '"' + sharedir_package + '"',
- 'LOCAL_LILYPOND_DATADIR' : '"' + sharedir_package_version + '"',
- 'LOCALEDIR' : '"' + localedir + '"',
+ 'PACKAGE': '"%s"' % package.name,
+ 'DATADIR' : '"%s"' % sharedir,
+ 'PACKAGE_DATADIR' : '"%s"' % sharedir_package,
+ 'LOCALEDIR' : '"%s"' %localedir,
}
conf.env.Append (DEFINES = defines)
#this could happen after flower...
env.ParseConfig ('guile-config compile')
- ## FIXME: pkg-test to required/optional
- if os.system ('pkg-config --atleast-version=1.6.0 pango'):
- barf
- env.ParseConfig ('pkg-config --cflags --libs pango')
- conf.env['DEFINES']['HAVE_PANGO16'] = '1'
-
- if os.system ('pkg-config --atleast-version=1.6.0 pangoft2'):
- barf
- env.ParseConfig ('pkg-config --cflags --libs pangoft2')
- conf.env['DEFINES']['HAVE_PANGO_FT2'] = '1'
+ if test_lib (required, 'freetype2', '0.0',
+ 'Development files for FreeType 2 font engine'):
+ conf.env['DEFINES']['HAVE_FREETYPE2'] = '1'
+
+ if test_lib (required, 'pangoft2', '1.6.0',
+ 'Development files for pango, with fontconfig2'):
+ conf.env['DEFINES']['HAVE_PANGO_FT2'] = '1'
+ conf.env['DEFINES']['HAVE_PANGO16'] = '1'
+
+ if test_lib (optional, 'fontconfig', '2.2.0',
+ 'Development files for fontconfig'):
+ conf.env['DEFINES']['HAVE_FONTCONFIG'] = '1'
#this could happen only for compiling pango-*
if env['gui']:
- env.ParseConfig ('pkg-config --cflags --libs gtk+-2.0')
- env.ParseConfig ('pkg-config --cflags --libs pango')
+ test_lib (required, 'gtk+-2.0', '2.4.0',
+ 'Development files for GTK+')
+ if test_lib (required, 'pango', '1.6.0',
+ 'Development files for pango'):
+ conf.env['DEFINES']['HAVE_PANGO16'] = '1'
+
if conf.CheckCHeader ('pango/pangofc-fontmap.h'):
conf.env['DEFINES']['HAVE_PANGO_PANGOFC_FONTMAP_H'] = '1'
-
if conf.CheckLib ('pango-1.0',
'pango_fc_font_map_add_decoder_find_func'):
- conf.env['DEFINES']['HAVE_PANGO_CVS'] = '1'
+ conf.env['DEFINES']['HAVE_PANGO16'] = '1'
conf.env['DEFINES']['HAVE_PANGO_FC_FONT_MAP_ADD_DECODER_FIND_FUNC'] = '1'
if env['fast']:
esac
if [ ! -f aclocal.m4 -o stepmake/aclocal.m4 -nt aclocal.m4 ]; then
- echo "stepmake/aclocal.m4 is newer. Copying file."
+ echo "stepmake/aclocal.m4 is newer. Copying file."
cp -f stepmake/aclocal.m4 aclocal.m4
fi
if [ ! -f autogen.sh -o stepmake/autogen.sh -nt autogen.sh ]; then
- echo "stepmake/autogen.sh is newer. Copying file."
+ echo "stepmake/autogen.sh is newer. Copying file."
cp -f stepmake/autogen.sh autogen.sh
exec ./autogen.sh "$@"
fi
STEPMAKE_MAKEINFO(REQUIRED)
STEPMAKE_PYTHON_DEVEL(REQUIRED)
-STEPMAKE_PATH_PROG(GHOSTSCRIPT, gs, OPTIONAL, 8.15)
+STEPMAKE_PATH_PROG(GHOSTSCRIPT, gs, OPTIONAL, 8.14)
STEPMAKE_PROGS(MFTRACE, mftrace, REQUIRED, 1.1.1)
STEPMAKE_PATH_PROG(FONTFORGE, fontforge, REQUIRED, 20041208)
AC_CHECK_FUNCS([fopencookie funopen gettext isinf memmem snprintf vsnprintf])
AC_CHECK_HEADERS([utf8/wchar.h], LIBS="$LIBS -lutf8")
-
+STEPMAKE_PROGS(PKG_CONFIG, pkg-config, REQUIRED, 0.9.0)
if test "$gui_b" = "yes"; then
- STEPMAKE_GTK2
+ STEPMAKE_GTK2(gtk+-2.0, REQUIRED, 2.4.0)
+else
+ STEPMAKE_GTK2(gtk+-2.0, OPTIONAL, 2.4.0)
fi
-STEPMAKE_FREETYPE2
-STEPMAKE_PANGO_FT2
-STEPMAKE_FONTCONFIG
+STEPMAKE_FREETYPE2(freetype2, REQUIRED, 0)
+#STEPMAKE_PANGO(pango, REQUIRED, 1.6.0)
+STEPMAKE_PANGO_FT2(pangoft2, REQUIRED, 1.6.0)
+STEPMAKE_FONTCONFIG(fontconfig, OPTIONAL, 2.2.0)
## TTFTOOL stuff
AC_C_BIGENDIAN(TTFTOOL_ENDIAN="-DBIGENDIAN",
# perl for help2man.
STEPMAKE_PERL(OPTIONAL)
-
-
# New makeinfo for multi-page website docs Simply always require new
# makeinfo should avoid bug reports; if people want to build lily
# without the docs, they can find this comment and use an older
#include "config.hh"
-#ifdef HAVE_FONTCONFIG
+#if HAVE_FONTCONFIG
#include <fontconfig/fontconfig.h>
#include <sys/stat.h>
#include "font-metric.hh"
#include "config.hh"
-#ifdef HAVE_PANGO16
+#if HAVE_PANGO16
#include <pango/pango.h>
#include <pango/pangoft2.h>
#endif
Scheme_hash_table *otf_dict_;
File_path search_path_;
-#ifdef HAVE_PANGO_FT2
+#if HAVE_PANGO_FT2
PangoFT2FontMap *pango_ft2_fontmap_;
Scheme_hash_table *pango_dict_;
int pango_dpi_;
All_font_metrics (String search_path);
~All_font_metrics ();
-#ifdef HAVE_PANGO_FT2
+#if HAVE_PANGO_FT2
Pango_font *find_pango_font (PangoFontDescription *description,
Real magnification,
Real scale);
#include "config.hh"
-#ifdef HAVE_PANGO16
+#if HAVE_PANGO16
#include <pango/pango.h>
#include <pango/pangoft2.h>
%pure_parser
%locations
-/* FIXME: The third option is an alias that will be used to display
- the syntax error. There's a bug (reported with patch) in bison CVS
- that prints double backslashes
+/* The third option is an alias that will be used to display the
+ syntax error. Bison CVS now correctly handles backslash escapes.
+
+ FIXME: Bison needs to translate some of these, eg, STRING.
- bison.ly:1:5: error: syntax error, unexpected \\book", expecting '{'
- \book
- \book %expect \book error here
*/
/* Keyword tokens with plain escaped name. */
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
fi
])
-
AC_DEFUN(STEPMAKE_FREETYPE2, [
- PKG_CHECK_MODULES(FREETYPE2, freetype2 >= 0, have_freetype2=true, true)
- if $have_freetype2 ; then
+ PKG_CHECK_MODULES(FREETYPE2, $1 >= $3, have_freetype2=yes, true)
+ if test "$have_freetype2" = yes; then
AC_DEFINE(HAVE_FREETYPE2)
AC_SUBST(FREETYPE2_CFLAGS)
AC_SUBST(FREETYPE2_LIBS)
+ else
+ r="lib$1-dev or $1-devel"
+ ver="$(pkg-config --modversion $1)"
+ STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
fi
])
AC_DEFUN(STEPMAKE_GTK2, [
- PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= 2.4.0, have_gtk2=true, true)
- if $have_gtk2 ; then
+ PKG_CHECK_MODULES(GTK2, $1 >= $3, have_gtk2=yes, true)
+ if test "$have_gtk2" = yes ; then
AC_DEFINE(HAVE_GTK2)
AC_SUBST(GTK2_CFLAGS)
AC_SUBST(GTK2_LIBS)
+ else
+ r="lib$1-dev or $1-devel"
+ ver="$(pkg-config --modversion $1)"
+ STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
fi
])
AC_DEFUN(STEPMAKE_PANGO, [
- PKG_CHECK_MODULES(PANGO, pango >= 1.6.0, have_pango16=true, true)
- if $have_pango16 ; then
+ PKG_CHECK_MODULES(PANGO, $1 >= $3, have_pango16=yes, true)
+ if test "$have_pango16" = yes ; then
AC_DEFINE(HAVE_PANGO16)
PANGO_CFLAGS="$PANGO_CFLAGS $GTK2_CFLAGS"
PANGO_LIBS="$PANGO_LIBS $GTK2_LIBS"
AC_SUBST(PANGO_LIBS)
CPPFLAGS="$save_CPPFLAGS"
LIBS="$save_LIBS"
-fi
+ else
+ r="lib$1-dev or $1-devel"
+ ver="$(pkg-config --modversion $1)"
+ STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
+ fi
])
-
AC_DEFUN(STEPMAKE_PANGO_FT2, [
- PKG_CHECK_MODULES(PANGO_FT2, pangoft2 >= 1.6.0, have_pangoft2=true, true)
- if $have_pangoft2 ; then
+ PKG_CHECK_MODULES(PANGO_FT2, $1 >= $3, have_pangoft2=yes, true)
+ if test "$have_pangoft2" = yes ; then
+ AC_DEFINE(HAVE_PANGO16)
AC_DEFINE(HAVE_PANGO_FT2)
PANGO_FT2_CFLAGS="$PANGO_FT2_CFLAGS $GTK2_CFLAGS"
PANGO_FT2_LIBS="$PANGO_FT2_LIBS $GTK2_LIBS"
AC_SUBST(PANGO_FT2_LIBS)
CPPFLAGS="$save_CPPFLAGS"
LIBS="$save_LIBS"
-fi
+ else
+ r="lib$1-dev or $1-devel"
+ ver="$(pkg-config --modversion $1)"
+ STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
+ fi
])
AC_DEFUN(STEPMAKE_FONTCONFIG, [
- PKG_CHECK_MODULES(FONTCONFIG, fontconfig >= 2.2.0, have_fontconfig=true, true)
- if $have_fontconfig ; then
+ PKG_CHECK_MODULES(FONTCONFIG, $1 >= $3, have_fontconfig=yes, true)
+ if test "$have_fontconfig" = yes ; then
AC_DEFINE(HAVE_FONTCONFIG)
FONTCONFIG_CFLAGS="$FONTCONFIG_CFLAGS"
FONTCONFIG_LIBS="$FONTCONFIG_LIBS"
AC_SUBST(FONTCONFIG_LIBS)
CPPFLAGS="$save_CPPFLAGS"
LIBS="$save_LIBS"
-fi
+ else
+ r="lib$1-dev or $1-devel"
+ ver="$(pkg-config --modversion $1)"
+ STEPMAKE_ADD_ENTRY($2, ["$r >= $3 (installed: $ver)"])
+ fi
])
esac
if [ ! -f aclocal.m4 -o stepmake/aclocal.m4 -nt aclocal.m4 ]; then
- echo "stepmake/aclocal.m4 is newer. Copying file."
+ echo "stepmake/aclocal.m4 is newer. Copying file."
cp -f stepmake/aclocal.m4 aclocal.m4
fi
if [ ! -f autogen.sh -o stepmake/autogen.sh -nt autogen.sh ]; then
- echo "stepmake/autogen.sh is newer. Copying file."
+ echo "stepmake/autogen.sh is newer. Copying file."
cp -f stepmake/autogen.sh autogen.sh
exec ./autogen.sh "$@"
fi