From f79427b320e9cd26b19e73c72599f434aee74e9e Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Thu, 17 Jul 2003 08:35:30 +0000 Subject: [PATCH] * configure.in: Use lily/main.cc as identifying source file. * lily/accidental-engraver.cc: Compile fix: include protected-scm.hh. * config.hh.in: * python/midi.c: Remove /Python.h ifdef tree. * configure.in: Require PYTHON >= 2.0. * stepmake/aclocal.m4 (STEPMAKE_PYTHON_DEVEL): Rewrite. Ask $PYTHON for include dir location. (STEPMAKE_PYTHON): New function. Use --- ChangeLog | 19 ++++++++++++++ config.hh.in | 18 ------------- configure.in | 5 +++- lily/accidental-engraver.cc | 1 + python/midi.c | 22 +--------------- stepmake/aclocal.m4 | 52 +++++++++++++++++++++++++++++++++---- 6 files changed, 72 insertions(+), 45 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6ed263f099..640b5b3852 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2003-07-17 Jan Nieuwenhuizen + + * configure.in: Use lily/main.cc as identifying source file. + + * lily/accidental-engraver.cc: Compile fix: include protected-scm.hh. + + * config.hh.in: + * python/midi.c: Remove /Python.h ifdef tree. + + * configure.in: Require PYTHON >= 2.0. + + * stepmake/aclocal.m4 (STEPMAKE_PYTHON_DEVEL): Rewrite. Ask + $PYTHON for include dir location. + (STEPMAKE_PYTHON): New function. Use + + PYTHON=foo ./configure + + to override. + 2003-07-17 Han-Wen Nienhuys * make/lilypond.redhat.spec.in (Group): change ftp.cs.uu.nl to diff --git a/config.hh.in b/config.hh.in index 71848269c4..64bbf775fd 100644 --- a/config.hh.in +++ b/config.hh.in @@ -48,24 +48,6 @@ /* define if you have kpse_find_tfm */ #define HAVE_KPSE_FIND_TFM 0 -/* define if you have python2.2/Python.h header */ -#define HAVE_PYTHON2_2_PYTHON_H 0 - -/* define if you have python2.1/Python.h header */ -#define HAVE_PYTHON2_1_PYTHON_H 0 - -/* define if you have python2.0/Python.h header */ -#define HAVE_PYTHON2_0_PYTHON_H 0 - -/* define if you have python2/Python.h header */ -#define HAVE_PYTHON2_PYTHON_H 0 - -/* define if you have python1.5/Python.h */ -#define HAVE_PYTHON1_5_PYTHON_H 0 - -/* define if you have python/Python.h header */ -#define HAVE_PYTHON_PYTHON_H 0 - /* define if you have Python.h header */ #define HAVE_PYTHON_H 0 diff --git a/configure.in b/configure.in index 7acae1843d..8dd486c886 100644 --- a/configure.in +++ b/configure.in @@ -12,7 +12,9 @@ AC_CONFIG_AUX_DIR([stepmake/bin]) STEPMAKE_INIT # List a file that identifies your package. -AC_CONFIG_SRCDIR([make/lilypond.lsm.in]) +## huh, lsm.in silently [re]moved? +##AC_CONFIG_SRCDIR([make/lilypond.lsm.in]) +AC_CONFIG_SRCDIR([lily/main.cc]) # Move to aclocal.m4? AC_CONFIG_HEADER([$CONFIGFILE.h:config.hh.in]) @@ -24,6 +26,7 @@ AC_CONFIG_SUBDIRS(stepmake) # must come before any header checks STEPMAKE_COMPILE +STEPMAKE_PYTHON(REQUIRED,2.0) STEPMAKE_GCC(REQUIRED, 2.8) STEPMAKE_CXX(REQUIRED) STEPMAKE_GXX(REQUIRED, 2.95) diff --git a/lily/accidental-engraver.cc b/lily/accidental-engraver.cc index 095ed8d0d0..2395847889 100644 --- a/lily/accidental-engraver.cc +++ b/lily/accidental-engraver.cc @@ -17,6 +17,7 @@ #include "arpeggio.hh" #include "warn.hh" #include "translator-group.hh" +#include "protected-scm.hh" /** diff --git a/python/midi.c b/python/midi.c index f387a758f1..5ce8ba78f9 100644 --- a/python/midi.c +++ b/python/midi.c @@ -10,7 +10,7 @@ /* -python2 +python import midi s = open ("s.midi").read () midi.parse_track (s) @@ -19,27 +19,7 @@ midi.parse (s) */ #include "config.h" - -/* urg */ -#if HAVE_PYTHON2_PYTHON_H -#include -#elif HAVE_PYTHON2_2_PYTHON_H -#include -#elif HAVE_PYTHON2_1_PYTHON_H -#include -#elif HAVE_PYTHON2_0_PYTHON_H -#include -#elif HAVE_PYTHON1_5_PYTHON_H -#include -#elif HAVE_PYTHON_PYTHON_H -#define assert(x) -#include -#elif HAVE_PYTHON_H -#define assert(x) #include -#else -#error Need Python.h -#endif #if 0 int x = 0; diff --git a/stepmake/aclocal.m4 b/stepmake/aclocal.m4 index fe8d1a9f8c..a4c8fddd70 100644 --- a/stepmake/aclocal.m4 +++ b/stepmake/aclocal.m4 @@ -23,10 +23,12 @@ AC_DEFUN(STEPMAKE_GET_VERSION, [ ## 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 -1 | \ sed -e 's/.*[^-.0-9]\([0-9][0-9]*\.[0-9][.0-9]*\).*/\1/' changequote([, ])dnl ]) @@ -640,8 +642,8 @@ AC_DEFUN(STEPMAKE_INIT, [ 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 @@ -878,10 +880,50 @@ AC_DEFUN(STEPMAKE_PERL, [ ]) +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_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 ]) -- 2.39.2