Skip to content

Commit 65876c2

Browse files
committed
Prototype of Python/SWIG bindings for log4cplus.
1 parent d35de01 commit 65876c2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+4072
-87
lines changed

Makefile.am

+1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ SUBDIRS = include src loggingserver tests
44
if QT
55
SUBDIRS += qt4debugappender
66
endif
7+
SUBDIRS += swig
78
pkgconfigdir = $(libdir)/pkgconfig
89
pkgconfig_DATA = log4cplus.pc

Makefile.in

+29-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Makefile.in generated by automake 1.12.3 from Makefile.am.
1+
# Makefile.in generated by automake 1.12.4 from Makefile.am.
22
# @configure_input@
33

44
# Copyright (C) 1994-2012 Free Software Foundation, Inc.
@@ -59,7 +59,8 @@ DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
5959
$(top_srcdir)/include/log4cplus/config.h.in \
6060
$(top_srcdir)/include/log4cplus/config/defines.hxx.in AUTHORS \
6161
COPYING ChangeLog INSTALL NEWS TODO ar-lib config.guess \
62-
config.sub depcomp install-sh ltmain.sh missing mkinstalldirs
62+
config.sub depcomp install-sh ltmain.sh missing mkinstalldirs \
63+
py-compile
6364
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
6465
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
6566
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@@ -80,8 +81,12 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
8081
$(top_srcdir)/m4/ax_gethostbyname_r.m4 \
8182
$(top_srcdir)/m4/ax_getaddrinfo.m4 \
8283
$(top_srcdir)/m4/ax_log4cplus_wrappers.m4 \
83-
$(top_srcdir)/m4/pkg.m4 $(top_srcdir)/tests/configure.m4 \
84-
$(top_srcdir)/configure.ac
84+
$(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/ax_pkg_swig.m4 \
85+
$(top_srcdir)/m4/ax_python_devel.m4 \
86+
$(top_srcdir)/m4/ax_swig_enable_cxx.m4 \
87+
$(top_srcdir)/m4/ax_swig_multi_module_support.m4 \
88+
$(top_srcdir)/m4/ax_swig_python.m4 \
89+
$(top_srcdir)/tests/configure.m4 $(top_srcdir)/configure.ac
8590
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
8691
$(ACLOCAL_M4)
8792
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
@@ -142,7 +147,7 @@ AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
142147
ETAGS = etags
143148
CTAGS = ctags
144149
CSCOPE = cscope
145-
DIST_SUBDIRS = include src loggingserver tests qt4debugappender
150+
DIST_SUBDIRS = include src loggingserver tests qt4debugappender swig
146151
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
147152
distdir = $(PACKAGE)-$(VERSION)
148153
top_distdir = $(distdir)
@@ -194,6 +199,8 @@ AUTOHEADER = @AUTOHEADER@
194199
AUTOM4TE = @AUTOM4TE@
195200
AUTOMAKE = @AUTOMAKE@
196201
AWK = @AWK@
202+
AX_SWIG_PYTHON_CPPFLAGS = @AX_SWIG_PYTHON_CPPFLAGS@
203+
AX_SWIG_PYTHON_OPT = @AX_SWIG_PYTHON_OPT@
197204
CC = @CC@
198205
CCDEPMODE = @CCDEPMODE@
199206
CFLAGS = @CFLAGS@
@@ -255,13 +262,25 @@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
255262
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
256263
PTHREAD_CXXFLAGS = @PTHREAD_CXXFLAGS@
257264
PTHREAD_LIBS = @PTHREAD_LIBS@
265+
PYTHON = @PYTHON@
266+
PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
267+
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
268+
PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@
269+
PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
270+
PYTHON_LDFLAGS = @PYTHON_LDFLAGS@
271+
PYTHON_PLATFORM = @PYTHON_PLATFORM@
272+
PYTHON_PREFIX = @PYTHON_PREFIX@
273+
PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
274+
PYTHON_VERSION = @PYTHON_VERSION@
258275
QT_CFLAGS = @QT_CFLAGS@
259276
QT_LIBS = @QT_LIBS@
260277
RANLIB = @RANLIB@
261278
SED = @SED@
262279
SET_MAKE = @SET_MAKE@
263280
SHELL = @SHELL@
264281
STRIP = @STRIP@
282+
SWIG = @SWIG@
283+
SWIG_LIB = @SWIG_LIB@
265284
VERSION = @VERSION@
266285
abs_builddir = @abs_builddir@
267286
abs_srcdir = @abs_srcdir@
@@ -306,9 +325,13 @@ mandir = @mandir@
306325
mkdir_p = @mkdir_p@
307326
oldincludedir = @oldincludedir@
308327
pdfdir = @pdfdir@
328+
pkgpyexecdir = @pkgpyexecdir@
329+
pkgpythondir = @pkgpythondir@
309330
prefix = @prefix@
310331
program_transform_name = @program_transform_name@
311332
psdir = @psdir@
333+
pyexecdir = @pyexecdir@
334+
pythondir = @pythondir@
312335
sbindir = @sbindir@
313336
sharedstatedir = @sharedstatedir@
314337
srcdir = @srcdir@
@@ -323,7 +346,7 @@ top_builddir = @top_builddir@
323346
top_srcdir = @top_srcdir@
324347
ACLOCAL_AMFLAGS = -I m4
325348
EXTRA_DIST = ChangeLog log4cplus.pc.in
326-
SUBDIRS = include src loggingserver tests $(am__append_1)
349+
SUBDIRS = include src loggingserver tests $(am__append_1) swig
327350
pkgconfigdir = $(libdir)/pkgconfig
328351
pkgconfig_DATA = log4cplus.pc
329352
all: all-recursive

acinclude.m4

+5
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,8 @@ m4_include([m4/ax_gethostbyname_r.m4])
1616
m4_include([m4/ax_getaddrinfo.m4])
1717
m4_include([m4/ax_log4cplus_wrappers.m4])
1818
m4_include([m4/pkg.m4])
19+
m4_include([m4/ax_pkg_swig.m4])
20+
m4_include([m4/ax_python_devel.m4])
21+
m4_include([m4/ax_swig_enable_cxx.m4])
22+
m4_include([m4/ax_swig_multi_module_support.m4])
23+
m4_include([m4/ax_swig_python.m4])

aclocal.m4

+222-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# generated automatically by aclocal 1.12.3 -*- Autoconf -*-
1+
# generated automatically by aclocal 1.12.4 -*- Autoconf -*-
22

33
# Copyright (C) 1996-2012 Free Software Foundation, Inc.
44

@@ -34,7 +34,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
3434
[am__api_version='1.12'
3535
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
3636
dnl require some minimum version. Point them to the right macro.
37-
m4_if([$1], [1.12.3], [],
37+
m4_if([$1], [1.12.4], [],
3838
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
3939
])
4040

@@ -50,7 +50,7 @@ m4_define([_AM_AUTOCONF_VERSION], [])
5050
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
5151
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
5252
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
53-
[AM_AUTOMAKE_VERSION([1.12.3])dnl
53+
[AM_AUTOMAKE_VERSION([1.12.4])dnl
5454
m4_ifndef([AC_AUTOCONF_VERSION],
5555
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
5656
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
@@ -778,6 +778,225 @@ AC_DEFUN([_AM_SET_OPTIONS],
778778
AC_DEFUN([_AM_IF_OPTION],
779779
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
780780

781+
# Copyright (C) 1999-2012 Free Software Foundation, Inc.
782+
#
783+
# This file is free software; the Free Software Foundation
784+
# gives unlimited permission to copy and/or distribute it,
785+
# with or without modifications, as long as this notice is preserved.
786+
787+
788+
# AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
789+
# ---------------------------------------------------------------------------
790+
# Adds support for distributing Python modules and packages. To
791+
# install modules, copy them to $(pythondir), using the python_PYTHON
792+
# automake variable. To install a package with the same name as the
793+
# automake package, install to $(pkgpythondir), or use the
794+
# pkgpython_PYTHON automake variable.
795+
#
796+
# The variables $(pyexecdir) and $(pkgpyexecdir) are provided as
797+
# locations to install python extension modules (shared libraries).
798+
# Another macro is required to find the appropriate flags to compile
799+
# extension modules.
800+
#
801+
# If your package is configured with a different prefix to python,
802+
# users will have to add the install directory to the PYTHONPATH
803+
# environment variable, or create a .pth file (see the python
804+
# documentation for details).
805+
#
806+
# If the MINIMUM-VERSION argument is passed, AM_PATH_PYTHON will
807+
# cause an error if the version of python installed on the system
808+
# doesn't meet the requirement. MINIMUM-VERSION should consist of
809+
# numbers and dots only.
810+
AC_DEFUN([AM_PATH_PYTHON],
811+
[
812+
dnl Find a Python interpreter. Python versions prior to 2.0 are not
813+
dnl supported. (2.0 was released on October 16, 2000).
814+
m4_define_default([_AM_PYTHON_INTERPRETER_LIST],
815+
[python python2 python3 python3.2 python3.1 python3.0 python2.7 dnl
816+
python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0])
817+
818+
AC_ARG_VAR([PYTHON], [the Python interpreter])
819+
820+
m4_if([$1],[],[
821+
dnl No version check is needed.
822+
# Find any Python interpreter.
823+
if test -z "$PYTHON"; then
824+
AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST, :)
825+
fi
826+
am_display_PYTHON=python
827+
], [
828+
dnl A version check is needed.
829+
if test -n "$PYTHON"; then
830+
# If the user set $PYTHON, use it and don't search something else.
831+
AC_MSG_CHECKING([whether $PYTHON version is >= $1])
832+
AM_PYTHON_CHECK_VERSION([$PYTHON], [$1],
833+
[AC_MSG_RESULT([yes])],
834+
[AC_MSG_RESULT([no])
835+
AC_MSG_ERROR([Python interpreter is too old])])
836+
am_display_PYTHON=$PYTHON
837+
else
838+
# Otherwise, try each interpreter until we find one that satisfies
839+
# VERSION.
840+
AC_CACHE_CHECK([for a Python interpreter with version >= $1],
841+
[am_cv_pathless_PYTHON],[
842+
for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do
843+
test "$am_cv_pathless_PYTHON" = none && break
844+
AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break])
845+
done])
846+
# Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON.
847+
if test "$am_cv_pathless_PYTHON" = none; then
848+
PYTHON=:
849+
else
850+
AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON])
851+
fi
852+
am_display_PYTHON=$am_cv_pathless_PYTHON
853+
fi
854+
])
855+
856+
if test "$PYTHON" = :; then
857+
dnl Run any user-specified action, or abort.
858+
m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])])
859+
else
860+
861+
dnl Query Python for its version number. Getting [:3] seems to be
862+
dnl the best way to do this; it's what "site.py" does in the standard
863+
dnl library.
864+
865+
AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version],
866+
[am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[[:3]])"`])
867+
AC_SUBST([PYTHON_VERSION], [$am_cv_python_version])
868+
869+
dnl Use the values of $prefix and $exec_prefix for the corresponding
870+
dnl values of PYTHON_PREFIX and PYTHON_EXEC_PREFIX. These are made
871+
dnl distinct variables so they can be overridden if need be. However,
872+
dnl general consensus is that you shouldn't need this ability.
873+
874+
AC_SUBST([PYTHON_PREFIX], ['${prefix}'])
875+
AC_SUBST([PYTHON_EXEC_PREFIX], ['${exec_prefix}'])
876+
877+
dnl At times (like when building shared libraries) you may want
878+
dnl to know which OS platform Python thinks this is.
879+
880+
AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform],
881+
[am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"`])
882+
AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform])
883+
884+
885+
dnl Set up 4 directories:
886+
887+
dnl pythondir -- where to install python scripts. This is the
888+
dnl site-packages directory, not the python standard library
889+
dnl directory like in previous automake betas. This behavior
890+
dnl is more consistent with lispdir.m4 for example.
891+
dnl Query distutils for this directory.
892+
AC_CACHE_CHECK([for $am_display_PYTHON script directory],
893+
[am_cv_python_pythondir],
894+
[if test "x$prefix" = xNONE
895+
then
896+
am_py_prefix=$ac_default_prefix
897+
else
898+
am_py_prefix=$prefix
899+
fi
900+
am_cv_python_pythondir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(0,0,prefix='$am_py_prefix'))" 2>/dev/null`
901+
case $am_cv_python_pythondir in
902+
$am_py_prefix*)
903+
am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'`
904+
am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,$PYTHON_PREFIX,"`
905+
;;
906+
*)
907+
case $am_py_prefix in
908+
/usr|/System*) ;;
909+
*)
910+
am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages
911+
;;
912+
esac
913+
;;
914+
esac
915+
])
916+
AC_SUBST([pythondir], [$am_cv_python_pythondir])
917+
918+
dnl pkgpythondir -- $PACKAGE directory under pythondir. Was
919+
dnl PYTHON_SITE_PACKAGE in previous betas, but this naming is
920+
dnl more consistent with the rest of automake.
921+
922+
AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE])
923+
924+
dnl pyexecdir -- directory for installing python extension modules
925+
dnl (shared libraries)
926+
dnl Query distutils for this directory.
927+
AC_CACHE_CHECK([for $am_display_PYTHON extension module directory],
928+
[am_cv_python_pyexecdir],
929+
[if test "x$exec_prefix" = xNONE
930+
then
931+
am_py_exec_prefix=$am_py_prefix
932+
else
933+
am_py_exec_prefix=$exec_prefix
934+
fi
935+
am_cv_python_pyexecdir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(1,0,prefix='$am_py_exec_prefix'))" 2>/dev/null`
936+
case $am_cv_python_pyexecdir in
937+
$am_py_exec_prefix*)
938+
am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'`
939+
am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"`
940+
;;
941+
*)
942+
case $am_py_exec_prefix in
943+
/usr|/System*) ;;
944+
*)
945+
am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages
946+
;;
947+
esac
948+
;;
949+
esac
950+
])
951+
AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir])
952+
953+
dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE)
954+
955+
AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE])
956+
957+
dnl Run any user-specified action.
958+
$2
959+
fi
960+
961+
])
962+
963+
964+
# AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
965+
# ---------------------------------------------------------------------------
966+
# Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION.
967+
# Run ACTION-IF-FALSE otherwise.
968+
# This test uses sys.hexversion instead of the string equivalent (first
969+
# word of sys.version), in order to cope with versions such as 2.2c1.
970+
# This supports Python 2.0 or higher. (2.0 was released on October 16, 2000).
971+
AC_DEFUN([AM_PYTHON_CHECK_VERSION],
972+
[prog="import sys
973+
# split strings by '.' and convert to numeric. Append some zeros
974+
# because we need at least 4 digits for the hex conversion.
975+
# map returns an iterator in Python 3.0 and a list in 2.x
976+
minver = list(map(int, '$2'.split('.'))) + [[0, 0, 0]]
977+
minverhex = 0
978+
# xrange is not present in Python 3.0 and range returns an iterator
979+
for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[[i]]
980+
sys.exit(sys.hexversion < minverhex)"
981+
AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])])
982+
983+
# Copyright (C) 2001-2012 Free Software Foundation, Inc.
984+
#
985+
# This file is free software; the Free Software Foundation
986+
# gives unlimited permission to copy and/or distribute it,
987+
# with or without modifications, as long as this notice is preserved.
988+
989+
# AM_RUN_LOG(COMMAND)
990+
# -------------------
991+
# Run COMMAND, save the exit status in ac_status, and log it.
992+
# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
993+
AC_DEFUN([AM_RUN_LOG],
994+
[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
995+
($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
996+
ac_status=$?
997+
echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
998+
(exit $ac_status); }])
999+
7811000
# Check to make sure that the build environment is sane. -*- Autoconf -*-
7821001

7831002
# Copyright (C) 1996-2012 Free Software Foundation, Inc.

0 commit comments

Comments
 (0)