From cc0a4994f07b61952a77549fffa1711014f936be Mon Sep 17 00:00:00 2001 From: Sebastien Estienne Date: Thu, 4 Aug 2005 00:45:33 +0000 Subject: [PATCH] * add some autoconf check for pygtk and gtk.glade * moved autoconf/automake doxygen macro in common/ * remove autogenerated py-compile git-svn-id: file:///home/lennart/svn/public/avahi/trunk@224 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- Makefile.am | 6 +- avahi-utils/Makefile.am | 6 +- avahi-utils/avahi-publish-service.in | 5 +- avahi-utils/avahi/Makefile.am | 3 + bootstrap.sh | 2 +- common/Makefile.am | 4 ++ acinclude.m4 => common/doxygen.m4 | 0 aminclude.am => common/doxygen.mk | 0 configure.ac | 55 ++++++++++++++++- py-compile | 92 ---------------------------- 10 files changed, 70 insertions(+), 103 deletions(-) create mode 100644 common/Makefile.am rename acinclude.m4 => common/doxygen.m4 (100%) rename aminclude.am => common/doxygen.mk (100%) delete mode 100755 py-compile diff --git a/Makefile.am b/Makefile.am index 9e826b3..874b9fc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -17,10 +17,12 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA. -include aminclude.am +ACLOCAL_AMFLAGS = -I common + +include $(srcdir)/common/doxygen.mk EXTRA_DIST = bootstrap.sh LICENSE $(DX_CONFIG) -SUBDIRS = avahi-common avahi-core avahi-discover avahi-client avahi-daemon initscript avahi-dnsconfd avahi-utils examples +SUBDIRS = common avahi-common avahi-core avahi-discover avahi-client avahi-daemon initscript avahi-dnsconfd avahi-utils examples pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = avahi-core.pc diff --git a/avahi-utils/Makefile.am b/avahi-utils/Makefile.am index 54ac083..64781d2 100644 --- a/avahi-utils/Makefile.am +++ b/avahi-utils/Makefile.am @@ -19,10 +19,8 @@ SUBDIRS=avahi -avahiscriptsdir = $(bindir) - if HAVE_PYTHON -avahiscripts_SCRIPTS = avahi-publish-address avahi-publish-service avahi-dump-all +bin_SCRIPTS = avahi-publish-address avahi-publish-service avahi-dump-all endif -EXTRA_DITS = avahi-publish-address.in avahi-publish-service.in avahi-dump-all.in +CLEANFILES = $(bin_SCRIPTS) diff --git a/avahi-utils/avahi-publish-service.in b/avahi-utils/avahi-publish-service.in index ee0be76..123e376 100755 --- a/avahi-utils/avahi-publish-service.in +++ b/avahi-utils/avahi-publish-service.in @@ -36,7 +36,7 @@ def usage(retval = 0): try: opts, args = getopt.getopt(sys.argv[1:], "d:H:", ["help", "domain=", "host="]) except getopt.GetoptError: - usage(2) + pass domain = "" host = "" @@ -52,8 +52,7 @@ for o, a in opts: host = a if len(args) < 3: - sys.stderr.write("Invalid number of arguments\n") - sys.exit(1) + usage(2) name = args[0] stype = args[1] diff --git a/avahi-utils/avahi/Makefile.am b/avahi-utils/avahi/Makefile.am index 248bf69..5ea7a6a 100644 --- a/avahi-utils/avahi/Makefile.am +++ b/avahi-utils/avahi/Makefile.am @@ -24,3 +24,6 @@ avahi_PYTHON = __init__.py SimpleGladeApp.py endif EXTRA_DIST = __init__.py SimpleGladeApp.py + +clean-local: + rm -rf *.pyc *.pyo diff --git a/bootstrap.sh b/bootstrap.sh index 3fb4fbe..acb153d 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -36,7 +36,7 @@ else rm -rf autom4te.cache rm -f config.cache - run_versioned aclocal 1.9 + run_versioned aclocal 1.9 -I common libtoolize -c --force autoheader run_versioned automake 1.9 -a -c --foreign diff --git a/common/Makefile.am b/common/Makefile.am new file mode 100644 index 0000000..4a04a6d --- /dev/null +++ b/common/Makefile.am @@ -0,0 +1,4 @@ +EXTRA_DIST = \ + doxygen.m4 \ + doxygen.mk + diff --git a/acinclude.m4 b/common/doxygen.m4 similarity index 100% rename from acinclude.m4 rename to common/doxygen.m4 diff --git a/aminclude.am b/common/doxygen.mk similarity index 100% rename from aminclude.am rename to common/doxygen.mk diff --git a/configure.ac b/configure.ac index 65d771f..4d12a0c 100644 --- a/configure.ac +++ b/configure.ac @@ -96,6 +96,9 @@ if test "x$ENABLE_GTK" = "xyes"; then fi AM_CONDITIONAL(ENABLE_GTK, test "x$ENABLE_GTK" = "xyes") +# +# Doxygen +# DX_HTML_FEATURE(ON) DX_CHM_FEATURE(OFF) DX_CHI_FEATURE(OFF) @@ -106,6 +109,9 @@ DX_PDF_FEATURE(OFF) DX_PS_FEATURE(OFF) DX_INIT_DOXYGEN(avahi, doxygen.cfg, doxygen) +# +# D-BUS +# AC_ARG_ENABLE(dbus, AC_HELP_STRING([--enable-dbus],[use DBus (default=yes)]), [case "${enableval}" in @@ -135,12 +141,18 @@ fi AM_CONDITIONAL(ENABLE_DBUS, test "x$ENABLE_DBUS" = "xyes") +# +# Expat +# AC_CHECK_LIB(expat, XML_ParserCreate, [ AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false) ], have_expat=false) if ! $have_expat ; then AC_MSG_ERROR([*** libexpat not found ***]) fi +# +# LibDaemon +# PKG_CHECK_MODULES(LIBDAEMON, [ libdaemon >= 0.5 ]) AC_SUBST(LIBDAEMON_CFLAGS) AC_SUBST(LIBDAEMON_LIBS) @@ -216,9 +228,49 @@ avahi_socket="${avahi_runtime_dir}/avahi-daemon/socket" AC_SUBST(avahi_runtime_dir) AC_SUBST(avahi_socket) -AM_PATH_PYTHON(2.4, [HAVE_PYTHON=yes], [HAVE_PYTHON=no]) +# +# Python stuff +# +AC_SUBST(PYGTK_REQ, 2.6.0) + +AM_PATH_PYTHON(2.4) +AM_PYTHON_CHECK_VERSION("$PYTHON", 2.4, [HAVE_PYTHON=yes], [HAVE_PYTHON=no]) AM_CONDITIONAL(HAVE_PYTHON, [test "x$HAVE_PYTHON" = xyes ]) +# check for pygtk +PKG_CHECK_MODULES(PYGTK, pygtk-2.0 >= $PYGTK_REQ) +PYGTK_DIR="`$PKG_CONFIG --variable=pyexecdir pygtk-2.0`" +AC_SUBST(PYGTK_DIR) +AC_MSG_NOTICE(Using pygtk installed in $PYGTK_DIR) +PYGTK_VERSION="`$PKG_CONFIG --modversion pygtk-2.0`" +if test "x$PYGTK_VERSION" = "x2.5.2" +then + AC_MSG_ERROR([PyGTK 2.5.2 contains known bugs, please install other version]) +fi +export PYTHONPATH=$PYGTK_DIR:$PYTHONPATH + +# check for gtk.glade +AC_MSG_CHECKING(for gtk.glade) +prog=" +import sys +try: + import gtk.glade +except RuntimeError: + sys.exit(0) +except ImportError: + sys.exit(1) +sys.exit(0) +" + +if $PYTHON -c "$prog" 1>&AC_FD_CC 2>&AC_FD_CC +then + AC_MSG_RESULT(found) +else + AC_MSG_RESULT(not found) + AC_MSG_ERROR([You need to have python libglade bindings installed]) +fi + +dnl ========================================================================== AC_CONFIG_FILES([ Makefile avahi-core.pc @@ -240,6 +292,7 @@ avahi-utils/avahi-publish-service avahi-utils/avahi-publish-address avahi-utils/avahi-discover examples/Makefile +common/Makefile ]) AC_OUTPUT diff --git a/py-compile b/py-compile deleted file mode 100755 index 4c84b67..0000000 --- a/py-compile +++ /dev/null @@ -1,92 +0,0 @@ -#!/bin/sh - -# py-compile - Compile a Python program -# Copyright 2000, 2001 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# called as "py-compile [--basedir DIR] PY_FILES ... - -if [ -z "$PYTHON" ]; then - PYTHON=python -fi - -basedir= - -case "$1" in - --basedir) - basedir=$2 - shift 2 - ;; - --help) - echo "Usage: py-compile [--basedir DIR] PY_FILES ..." - echo "Byte compile some python scripts. This should be performed" - echo "after they have been moved to the final installation location" - exit 0 - ;; - --version) - echo "py-compile version 0.0" - exit 0 - ;; -esac - -if [ $# = 0 ]; then - echo "No files given to $0" 1>&2 - exit 1 -fi - -# if basedir was given, then it should be prepended to filenames before -# byte compilation. -if [ -z "$basedir" ]; then - trans="path = file" -else - trans="path = os.path.join('$basedir', file)" -fi - -$PYTHON -c " -import sys, os, string, py_compile - -files = '''$*''' -print 'Byte-compiling python modules...' -for file in string.split(files): - $trans - if not os.path.exists(path) or not (len(path) >= 3 and path[-3:] == '.py'): - continue - print file, - sys.stdout.flush() - py_compile.compile(path) -print" || exit $? - -# this will fail for python < 1.5, but that doesn't matter ... -$PYTHON -O -c " -import sys, os, string, py_compile - -files = '''$*''' -print 'Byte-compiling python modules (optimized versions) ...' -for file in string.split(files): - $trans - if not os.path.exists(path) or not (len(path) >= 3 and path[-3:] == '.py'): - continue - print file, - sys.stdout.flush() - py_compile.compile(path) -print" 2>/dev/null || : - -- 2.39.5