From 2a6f7d1f45438eae0b46636d43da07b36db53273 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sun, 17 Apr 2005 09:38:04 +0000 Subject: [PATCH] * stepmake/aclocal.m4 (STEPMAKE_PANGO_FT2): Define HAVE_PANGO16 too. * SConstruct (test_lib): New function. Update pkg-config and some other requirements. * configure.in: Require pkg-config. Enforce REQUIRE and version for freetype, pangof2t. --- ChangeLog | 12 ++++++ SConstruct | 71 ++++++++++++++++++++------------ autogen.sh | 4 +- configure.in | 17 ++++---- lily/font-config.cc | 2 +- lily/include/all-font-metrics.hh | 6 +-- lily/include/pango-font.hh | 2 +- lily/parser.yy | 10 ++--- stepmake/aclocal.m4 | 52 +++++++++++++++-------- stepmake/autogen.sh | 4 +- 10 files changed, 113 insertions(+), 67 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9059d85ba9..8c8708dd50 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2005-04-17 Jan Nieuwenhuizen + + * 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 * po/lilypond.pot, ...: Update using bison-CVS. diff --git a/SConstruct b/SConstruct index 6246d5268e..a432db898c 100644 --- a/SConstruct +++ b/SConstruct @@ -237,12 +237,14 @@ def list_sort (lst): 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): @@ -252,12 +254,28 @@ def configure (target, source, env): 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) @@ -283,12 +301,10 @@ def configure (target, source, env): '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') @@ -315,12 +331,10 @@ def configure (target, source, env): 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) @@ -378,27 +392,32 @@ def configure (target, source, env): #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']: diff --git a/autogen.sh b/autogen.sh index 6678367b65..1d4c1b61ef 100755 --- a/autogen.sh +++ b/autogen.sh @@ -8,12 +8,12 @@ case $1 in 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 diff --git a/configure.in b/configure.in index 2ca40bae7d..b99fff5fa3 100644 --- a/configure.in +++ b/configure.in @@ -54,7 +54,7 @@ STEPMAKE_GUILE_DEVEL(REQUIRED, 1.6.5) 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) @@ -69,14 +69,17 @@ AC_FUNC_VPRINTF 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", @@ -90,8 +93,6 @@ STEPMAKE_GUILE(OPTIONAL) # 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 diff --git a/lily/font-config.cc b/lily/font-config.cc index aac1eeb709..b9ba8b41a3 100644 --- a/lily/font-config.cc +++ b/lily/font-config.cc @@ -8,7 +8,7 @@ #include "config.hh" -#ifdef HAVE_FONTCONFIG +#if HAVE_FONTCONFIG #include #include diff --git a/lily/include/all-font-metrics.hh b/lily/include/all-font-metrics.hh index f7af1bb4b9..a9982d7ba5 100644 --- a/lily/include/all-font-metrics.hh +++ b/lily/include/all-font-metrics.hh @@ -13,7 +13,7 @@ #include "font-metric.hh" #include "config.hh" -#ifdef HAVE_PANGO16 +#if HAVE_PANGO16 #include #include #endif @@ -28,7 +28,7 @@ class All_font_metrics 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_; @@ -39,7 +39,7 @@ public: 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); diff --git a/lily/include/pango-font.hh b/lily/include/pango-font.hh index 68a55f65b8..b8119b746a 100644 --- a/lily/include/pango-font.hh +++ b/lily/include/pango-font.hh @@ -11,7 +11,7 @@ #include "config.hh" -#ifdef HAVE_PANGO16 +#if HAVE_PANGO16 #include #include diff --git a/lily/parser.yy b/lily/parser.yy index 3623abc0c6..f55a4c76e4 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -257,13 +257,11 @@ or %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. */ diff --git a/stepmake/aclocal.m4 b/stepmake/aclocal.m4 index b05f9a4cac..31ddaed991 100644 --- a/stepmake/aclocal.m4 +++ b/stepmake/aclocal.m4 @@ -1095,9 +1095,6 @@ AC_DEFUN(PKG_CHECK_MODULES, [ 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 @@ -1108,28 +1105,35 @@ AC_DEFUN(PKG_CHECK_MODULES, [ 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" @@ -1142,13 +1146,17 @@ AC_DEFUN(STEPMAKE_PANGO, [ 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" @@ -1163,12 +1171,16 @@ AC_DEFUN(STEPMAKE_PANGO_FT2, [ 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" @@ -1181,5 +1193,9 @@ AC_DEFUN(STEPMAKE_FONTCONFIG, [ 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 ]) diff --git a/stepmake/autogen.sh b/stepmake/autogen.sh index 6678367b65..1d4c1b61ef 100755 --- a/stepmake/autogen.sh +++ b/stepmake/autogen.sh @@ -8,12 +8,12 @@ case $1 in 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 -- 2.39.2