From 86d31a1929327a580aa781a85657c570a2cff7f4 Mon Sep 17 00:00:00 2001 From: saal Date: Tue, 12 Jun 2007 13:24:17 +0000 Subject: mise à jour de IvyCpy pour utilisation ivy-c 3.8 migration de CVS vers repository svn --- Doxyfile | 230 ++ GNUmakefile.in | 66 +- README | 23 + aclocal.m4 | 2173 +++++++++++++++--- configure | 5656 ++++++++++++++++++++++++++++++++++++---------- configure.in | 26 +- debian/changelog | 7 + debian/control | 13 +- debian/copyright | 11 +- debian/ivycpy.3 | 13 +- docs/dev/how2build.html | 6 +- docs/examples/pyhello.py | 2 +- docs/examples/testIvy.py | 26 +- docs/html/index_tpl.html | 2 +- ivy.py | 225 -- ivycpy.i | 1149 ---------- ivycpy_namer.sed | 3 - list.h | 77 - src/IvyCTest.py | 601 +++++ src/IvyCpy.py | 646 ++++++ src/Message.xml | 14 + src/Utils.py | 105 + src/XmlParser.py | 449 ++++ src/ivycpy.docfile | 1594 +++++++++++++ src/ivycpy.i | 1595 +++++++++++++ src/ivycpy_namer.sed | 3 + src/list.h | 77 + 27 files changed, 11753 insertions(+), 3039 deletions(-) create mode 100644 Doxyfile create mode 100644 README delete mode 100644 ivy.py delete mode 100644 ivycpy.i delete mode 100644 ivycpy_namer.sed delete mode 100644 list.h create mode 100644 src/IvyCTest.py create mode 100644 src/IvyCpy.py create mode 100644 src/Message.xml create mode 100644 src/Utils.py create mode 100644 src/XmlParser.py create mode 100644 src/ivycpy.docfile create mode 100644 src/ivycpy.i create mode 100644 src/ivycpy_namer.sed create mode 100644 src/list.h diff --git a/Doxyfile b/Doxyfile new file mode 100644 index 0000000..23d59a1 --- /dev/null +++ b/Doxyfile @@ -0,0 +1,230 @@ +# Doxyfile 1.5.1 + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = IvyCpy +PROJECT_NUMBER = "version 2" +OUTPUT_DIRECTORY = ./doc +CREATE_SUBDIRS = NO +OUTPUT_LANGUAGE = French +USE_WINDOWS_ENCODING = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = +ALWAYS_DETAILED_SEC = YES +INLINE_INHERITED_MEMB = YES +FULL_PATH_NAMES = YES +STRIP_FROM_PATH = +STRIP_FROM_INC_PATH = +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = YES +MULTILINE_CPP_IS_BRIEF = NO +DETAILS_AT_TOP = NO +INHERIT_DOCS = YES +SEPARATE_MEMBER_PAGES = NO +TAB_SIZE = 8 +ALIASES = +OPTIMIZE_OUTPUT_FOR_C = NO +OPTIMIZE_OUTPUT_JAVA = YES +BUILTIN_STL_SUPPORT = NO +DISTRIBUTE_GROUP_DOC = NO +SUBGROUPING = YES +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +EXTRACT_LOCAL_CLASSES = YES +EXTRACT_LOCAL_METHODS = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = YES +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = NO +SORT_BRIEF_DOCS = NO +SORT_BY_SCOPE_NAME = NO +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +SHOW_DIRECTORIES = YES +FILE_VERSION_FILTER = +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = NO +WARN_FORMAT = "$file:$line: $text" +WARN_LOGFILE = +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = ./src/ivycpy.docfile \ + ./src/IvyCpy.py \ + ./src/IvyCTest.py \ + ./src/Message.xml \ + ./src/Utils.py \ + ./src/XmlParser.py +FILE_PATTERNS = +RECURSIVE = NO +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = +INPUT_FILTER = +FILTER_PATTERNS = +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = YES +INLINE_SOURCES = YES +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = YES +REFERENCES_RELATION = YES +REFERENCES_LINK_SOURCE = YES +USE_HTAGS = NO +VERBATIM_HEADERS = YES +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = NO +COLS_IN_ALPHA_INDEX = 5 +IGNORE_PREFIX = +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = NO +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +BINARY_TOC = NO +TOC_EXPAND = NO +DISABLE_INDEX = NO +ENUM_VALUES_PER_LINE = 4 +GENERATE_TREEVIEW = YES +TREEVIEW_WIDTH = 250 +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +USE_PDFLATEX = NO +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = NO +XML_OUTPUT = xml +XML_SCHEMA = +XML_DTD = +XML_PROGRAMLISTING = YES +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- +TAGFILES = +GENERATE_TAGFILE = +ALLEXTERNALS = YES +EXTERNAL_GROUPS = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = YES +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = NO +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = NO +TEMPLATE_RELATIONS = NO +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = NO +CALLER_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +DOT_PATH = +DOTFILE_DIRS = +MAX_DOT_GRAPH_WIDTH = 1024 +MAX_DOT_GRAPH_HEIGHT = 1024 +MAX_DOT_GRAPH_DEPTH = 0 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = YES +DOT_CLEANUP = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- +SEARCHENGINE = YES diff --git a/GNUmakefile.in b/GNUmakefile.in index e1e02c9..86a47e9 100644 --- a/GNUmakefile.in +++ b/GNUmakefile.in @@ -9,6 +9,8 @@ VPATH := @srcdir@ PACKAGE := @PACKAGE@ VERSION := @VERSION@ +DOCUMENTATION := doc + STATIC_EXAMPLES := pyhello.py testtk.py EXAMPLES := $(addprefix docs/examples/, env.sh) DOCS := $(addprefix docs/html/, index.html) # ivycpy_wrap.html @@ -54,6 +56,9 @@ INSTALL_DATA := @INSTALL_DATA@ PYTHON_COMPILER := @PYTHON_COMPILER@ +DOXYGEN := @DOXYGEN@ +DOCDIR := @DOCDIR@ + UMASK ?= 022 INSTALL_DIR := $(SHELL) $(top_srcdir)/mkinstalldirs @@ -83,9 +88,13 @@ CFLAGS = @CFLAGS@ $(CC_OPTIONS) LDFLAGS = @LDFLAGS@ $(LD_OPTIONS) LDLIBS = $(LIBRARIES) @LIBS@ -default: _ivycpy.so ivycpy.pyc $(DOCS) $(EXAMPLES) $(DEBIANSTUFF) +default: src/_ivycpy.so src/ivycpy.pyc $(DOCS) $(EXAMPLES) $(DEBIANSTUFF) $(DOCUMENTATION) -_ivycpy.so: ivycpy_wrap.o +# documentation +doc: + $(DOXYGEN) + +src/_ivycpy.so: src/ivycpy_wrap.o $(LINK.o) $(CC_SHARED_OPTIONS) $^ -o $@ -livy $(LDLIBS) -lc #ivycpy_wrap_neat.o: CFLAGS += $(CC_PIC_OPTIONS) @@ -96,19 +105,19 @@ _ivycpy.so: ivycpy_wrap.o # ivycpy_wrap_neat.c: ivycpy_wrap.c # >$@ sed -f ivycpy_namer.sed $< -ivycpy_wrap.o: CFLAGS += $(CC_PIC_OPTIONS) -ivycpy_wrap.o: ivycpy_wrap.c +#ivycpy_wrap.o: CFLAGS += $(CC_PIC_OPTIONS) +src/ivycpy_wrap.o: src/ivycpy_wrap.c # wrapper code generated by swig # original .py is moved toward _swig.py -ivycpy_wrap.c: ivycpy.i +src/ivycpy_wrap.c: src/ivycpy.i $(SWIG) -python $< # -dhtml - mv ivycpy.py ivycpy_swig.py + mv src/ivycpy.py src/ivycpy_swig.py # then _swig.py is patched to suited names in ivycpy.py -ivycpy.py: ivycpy.i - >$@ sed -f ivycpy_namer.sed ivycpy_swig.py +src/ivycpy.py: src/ivycpy.i + >$@ sed -f src/ivycpy_namer.sed src/ivycpy_swig.py # testing include and defines @@ -142,17 +151,31 @@ debian/copyright: docs/copyright # building compiled version of Python modules # this step builds also the examples scripts -ivycpy.pyc: ivycpy.py - python $(PYTHON_COMPILER) -l . +src/ivycpy.pyc: src/ivycpy.py + python $(PYTHON_COMPILER) -l ./src + python $(PYTHON_COMPILER) docs/examples + +src/IvyCpy.pyc: src/IvyCpy.py + python $(PYTHON_COMPILER) -l ./src + python $(PYTHON_COMPILER) docs/examples + +src/IvyCTest.pyc: src/IvyCTest.py + python $(PYTHON_COMPILER) -l ./src + python $(PYTHON_COMPILER) docs/examples + +src/XmlParser.pyc: src/XmlParser.py + python $(PYTHON_COMPILER) -l ./src python $(PYTHON_COMPILER) docs/examples -ivy.pyc: ivy.py - python $(PYTHON_COMPILER) -l . +src/Utils.pyc: src/Utils.py + python $(PYTHON_COMPILER) -l ./src python $(PYTHON_COMPILER) docs/examples -install:: _ivycpy.so ivycpy.py ivycpy.pyc ivy.py ivy.pyc +install:: src/_ivycpy.so src/ivycpy.py src/ivycpy.pyc src/IvyCpy.py src/IvyCpy.pyc src/IvyCTest.pyc src/XmlParser.pyc src/Utils.pyc $(INSTALL_DIR) $(pythondir) - $(INSTALL_DATA) _ivycpy.so ivycpy.py ivycpy.pyc ivy.py ivy.pyc $(pythondir) + $(INSTALL_DATA) src/_ivycpy.so src/*.py src/*.pyc src/Message.xml $(pythondir) + $(INSTALL_DIR) $(DOCDIR) + $(INSTALL_DATA) doc/html/*.* $(DOCDIR) # install of docs requires o exclude service file : CVS, .cvsignore install:: $(DOCS) $(EXAMPLES) @@ -165,20 +188,23 @@ install:: $(DOCS) $(EXAMPLES) .PHONY: default install VERSION clean: - $(RM) core a.out *.o - $(RM) _ivycpy.so ivycpy*.py - $(RM) ivycpy_wrap.c - find . -name '*.pyc' -exec $(RM) {} ";" + $(RM) core src/a.out src/*.o + $(RM) src/_ivycpy.so src/ivycpy*.py + $(RM) src/ivycpy_wrap.c + find ./src -name '*.pyc' -exec $(RM) {} ";" + $(RM) -r doc realclean: clean - $(RM) ivycpy_wrap*.c + $(RM) src/ivycpy_wrap*.c $(RM) $(EXAMPLES) $(DOCS) + $(RM) -r doc distclean: realclean - $(RM) ivycpy_wrap*.* + $(RM) src/ivycpy_wrap*.* $(RM) GNUmakefile config.log config.status config.cache $(RM) *.debhelper $(RM) -r debian/tmp + $(RM) -r doc .PHONY: clean realclean distclean diff --git a/README b/README new file mode 100644 index 0000000..fd34fd6 --- /dev/null +++ b/README @@ -0,0 +1,23 @@ +Suivi Macro des versions de IvyCpy : +---------------------------------------- + +IvyCpy est un wrapper au dessus de ivy-c : + +IvyCpy V1.x (taggué jusqu'a V0_6_5final) fonctionnait avec 3.2 <= ivy-c <= 3.5 + +branche V2.0 : IvyCpy encours d'adaptation pour 3.8 <= ivy-c + + +Methode compilation : +--------------------- + +source /opt/env/swig-1.3.25.csh +setenv CPPFLAGS "-I/opt/swig-1.3.25/include -I/home/cousy/dev/debian/ivy-c-3.6/src" +setenv LDFLAGS "-L/opt/swig-1.3.25/lib -L/home/cousy/dev/debian/ivy-c-3.6/src" + +./configure --prefix=/home/cousy/dev/debian/IvyCpy/install_0.6.5 --with-tcl=/usr/lib/tcl8.3/ + +dans GNUMakefile changer LDLIBS en LDLIBS = $(LIBRARIES) -lc `pcre-config --libs` + +make +make install diff --git a/aclocal.m4 b/aclocal.m4 index 37f59ca..2fccc25 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,6 +1,6 @@ -dnl aclocal.m4 generated automatically by aclocal 1.4-p4 +dnl aclocal.m4 generated automatically by aclocal 1.4-p6 -dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -10,6 +10,825 @@ dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A dnl PARTICULAR PURPOSE. +# lib-prefix.m4 serial 4 (gettext-0.14.2) +dnl Copyright (C) 2001-2005 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. + +dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and +dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't +dnl require excessive bracketing. +ifdef([AC_HELP_STRING], +[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], +[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) + +dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed +dnl to access previously installed libraries. The basic assumption is that +dnl a user will want packages to use other packages he previously installed +dnl with the same --prefix option. +dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate +dnl libraries, but is otherwise very convenient. +AC_DEFUN([AC_LIB_PREFIX], +[ + AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + dnl By default, look in $includedir and $libdir. + use_additional=yes + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + AC_LIB_ARG_WITH([lib-prefix], +[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib + --without-lib-prefix don't search for libraries in includedir and libdir], +[ + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + else + additional_includedir="$withval/include" + additional_libdir="$withval/lib" + fi + fi +]) + if test $use_additional = yes; then + dnl Potentially add $additional_includedir to $CPPFLAGS. + dnl But don't add it + dnl 1. if it's the standard /usr/include, + dnl 2. if it's already present in $CPPFLAGS, + dnl 3. if it's /usr/local/include and we are using GCC on Linux, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + for x in $CPPFLAGS; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + dnl Really add $additional_includedir to $CPPFLAGS. + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" + fi + fi + fi + fi + dnl Potentially add $additional_libdir to $LDFLAGS. + dnl But don't add it + dnl 1. if it's the standard /usr/lib, + dnl 2. if it's already present in $LDFLAGS, + dnl 3. if it's /usr/local/lib and we are using GCC on Linux, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_libdir" != "X/usr/lib"; then + haveit= + for x in $LDFLAGS; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test "X$additional_libdir" = "X/usr/local/lib"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LDFLAGS. + LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" + fi + fi + fi + fi + fi +]) + +dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, +dnl acl_final_exec_prefix, containing the values to which $prefix and +dnl $exec_prefix will expand at the end of the configure script. +AC_DEFUN([AC_LIB_PREPARE_PREFIX], +[ + dnl Unfortunately, prefix and exec_prefix get only finally determined + dnl at the end of configure. + if test "X$prefix" = "XNONE"; then + acl_final_prefix="$ac_default_prefix" + else + acl_final_prefix="$prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + acl_final_exec_prefix='${prefix}' + else + acl_final_exec_prefix="$exec_prefix" + fi + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" + prefix="$acl_save_prefix" +]) + +dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the +dnl variables prefix and exec_prefix bound to the values they will have +dnl at the end of the configure script. +AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], +[ + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + $1 + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" +]) + +# lib-link.m4 serial 6 (gettext-0.14.3) +dnl Copyright (C) 2001-2005 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. + +AC_PREREQ(2.50) + +dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and +dnl the libraries corresponding to explicit and implicit dependencies. +dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and +dnl augments the CPPFLAGS variable. +AC_DEFUN([AC_LIB_LINKFLAGS], +[ + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + define([Name],[translit([$1],[./-], [___])]) + define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ + AC_LIB_LINKFLAGS_BODY([$1], [$2]) + ac_cv_lib[]Name[]_libs="$LIB[]NAME" + ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" + ac_cv_lib[]Name[]_cppflags="$INC[]NAME" + ]) + LIB[]NAME="$ac_cv_lib[]Name[]_libs" + LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" + INC[]NAME="$ac_cv_lib[]Name[]_cppflags" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) + AC_SUBST([LIB]NAME) + AC_SUBST([LTLIB]NAME) + dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the + dnl results of this search when this library appears as a dependency. + HAVE_LIB[]NAME=yes + undefine([Name]) + undefine([NAME]) +]) + +dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode) +dnl searches for libname and the libraries corresponding to explicit and +dnl implicit dependencies, together with the specified include files and +dnl the ability to compile and link the specified testcode. If found, it +dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and +dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and +dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs +dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. +AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], +[ + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + define([Name],[translit([$1],[./-], [___])]) + define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + + dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME + dnl accordingly. + AC_LIB_LINKFLAGS_BODY([$1], [$2]) + + dnl Add $INC[]NAME to CPPFLAGS before performing the following checks, + dnl because if the user has installed lib[]Name and not disabled its use + dnl via --without-lib[]Name-prefix, he wants to use it. + ac_save_CPPFLAGS="$CPPFLAGS" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) + + AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ + ac_save_LIBS="$LIBS" + LIBS="$LIBS $LIB[]NAME" + AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no]) + LIBS="$ac_save_LIBS" + ]) + if test "$ac_cv_lib[]Name" = yes; then + HAVE_LIB[]NAME=yes + AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.]) + AC_MSG_CHECKING([how to link with lib[]$1]) + AC_MSG_RESULT([$LIB[]NAME]) + else + HAVE_LIB[]NAME=no + dnl If $LIB[]NAME didn't lead to a usable library, we don't need + dnl $INC[]NAME either. + CPPFLAGS="$ac_save_CPPFLAGS" + LIB[]NAME= + LTLIB[]NAME= + fi + AC_SUBST([HAVE_LIB]NAME) + AC_SUBST([LIB]NAME) + AC_SUBST([LTLIB]NAME) + undefine([Name]) + undefine([NAME]) +]) + +dnl Determine the platform dependent parameters needed to use rpath: +dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator, +dnl hardcode_direct, hardcode_minus_L. +AC_DEFUN([AC_LIB_RPATH], +[ + dnl Tell automake >= 1.10 to complain if config.rpath is missing. + m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])]) + AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS + AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld + AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host + AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir + AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [ + CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ + ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh + . ./conftest.sh + rm -f ./conftest.sh + acl_cv_rpath=done + ]) + wl="$acl_cv_wl" + libext="$acl_cv_libext" + shlibext="$acl_cv_shlibext" + hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" + hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" + hardcode_direct="$acl_cv_hardcode_direct" + hardcode_minus_L="$acl_cv_hardcode_minus_L" + dnl Determine whether the user wants rpath handling at all. + AC_ARG_ENABLE(rpath, + [ --disable-rpath do not hardcode runtime library paths], + :, enable_rpath=yes) +]) + +dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and +dnl the libraries corresponding to explicit and implicit dependencies. +dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. +AC_DEFUN([AC_LIB_LINKFLAGS_BODY], +[ + define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + dnl By default, look in $includedir and $libdir. + use_additional=yes + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + AC_LIB_ARG_WITH([lib$1-prefix], +[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib + --without-lib$1-prefix don't search for lib$1 in includedir and libdir], +[ + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + else + additional_includedir="$withval/include" + additional_libdir="$withval/lib" + fi + fi +]) + dnl Search the library and its dependencies in $additional_libdir and + dnl $LDFLAGS. Using breadth-first-seach. + LIB[]NAME= + LTLIB[]NAME= + INC[]NAME= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='$1 $2' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + dnl See if it was already located by an earlier AC_LIB_LINKFLAGS + dnl or AC_LIB_HAVE_LINKFLAGS call. + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" + else + dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined + dnl that this library doesn't exist. So just drop it. + : + fi + else + dnl Search the library lib$name in $additional_libdir and $LDFLAGS + dnl and the already constructed $LIBNAME/$LTLIBNAME. + found_dir= + found_la= + found_so= + found_a= + if test $use_additional = yes; then + if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then + found_dir="$additional_libdir" + found_so="$additional_libdir/lib$name.$shlibext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + else + if test -f "$additional_libdir/lib$name.$libext"; then + found_dir="$additional_libdir" + found_a="$additional_libdir/lib$name.$libext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then + found_dir="$dir" + found_so="$dir/lib$name.$shlibext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + else + if test -f "$dir/lib$name.$libext"; then + found_dir="$dir" + found_a="$dir/lib$name.$libext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + dnl Found the library. + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + dnl Linking with a shared library. We attempt to hardcode its + dnl directory into the executable's runpath, unless it's the + dnl standard /usr/lib. + if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then + dnl No hardcoding is needed. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + dnl Use an explicit option to hardcode DIR into the resulting + dnl binary. + dnl Potentially add DIR to ltrpathdirs. + dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + dnl The hardcoding into $LIBNAME is system dependent. + if test "$hardcode_direct" = yes; then + dnl Using DIR/libNAME.so during linking hardcodes DIR into the + dnl resulting binary. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then + dnl Use an explicit option to hardcode DIR into the resulting + dnl binary. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + dnl Potentially add DIR to rpathdirs. + dnl The rpathdirs will be appended to $LIBNAME at the end. + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + dnl Rely on "-L$found_dir". + dnl But don't add it if it's already contained in the LDFLAGS + dnl or the already constructed $LIBNAME + haveit= + for x in $LDFLAGS $LIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" + fi + if test "$hardcode_minus_L" != no; then + dnl FIXME: Not sure whether we should use + dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" + dnl here. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH + dnl here, because this doesn't fit in flags passed to the + dnl compiler. So give up. No hardcoding. This affects only + dnl very old systems. + dnl FIXME: Not sure whether we should use + dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" + dnl here. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + dnl Linking with a static library. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" + else + dnl We shouldn't come here, but anyway it's good to have a + dnl fallback. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" + fi + fi + dnl Assume the include files are nearby. + additional_includedir= + case "$found_dir" in + */lib | */lib/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + dnl Potentially add $additional_includedir to $INCNAME. + dnl But don't add it + dnl 1. if it's the standard /usr/include, + dnl 2. if it's /usr/local/include and we are using GCC on Linux, + dnl 3. if it's already present in $CPPFLAGS or the already + dnl constructed $INCNAME, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INC[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + dnl Really add $additional_includedir to $INCNAME. + INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + dnl Look for dependencies. + if test -n "$found_la"; then + dnl Read the .la file. It defines the variables + dnl dlname, library_names, old_library, dependency_libs, current, + dnl age, revision, installed, dlopen, dlpreopen, libdir. + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + dnl We use only dependency_libs. + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. + dnl But don't add it + dnl 1. if it's the standard /usr/lib, + dnl 2. if it's /usr/local/lib and we are using GCC on Linux, + dnl 3. if it's already present in $LDFLAGS or the already + dnl constructed $LIBNAME, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_libdir" != "X/usr/lib"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/lib"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LIBNAME. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LTLIBNAME. + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + dnl Potentially add DIR to rpathdirs. + dnl The rpathdirs will be appended to $LIBNAME at the end. + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + dnl Potentially add DIR to ltrpathdirs. + dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + dnl Handle this in the next round. + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + dnl Handle this in the next round. Throw away the .la's + dnl directory; it is already contained in a preceding -L + dnl option. + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + dnl Most likely an immediate library name. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" + ;; + esac + done + fi + else + dnl Didn't find the library; assume it is in the system directories + dnl known to the linker and runtime loader. (All the system + dnl directories known to the linker should also be known to the + dnl runtime loader, otherwise the system is severely misconfigured.) + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$hardcode_libdir_separator"; then + dnl Weird platform: only the last -rpath option counts, the user must + dnl pass all path elements in one option. We can arrange that for a + dnl single library, but not when more than one $LIBNAMEs are used. + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" + done + dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl. + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" + else + dnl The -rpath options are cumulative. + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + dnl When using libtool, the option that works for both libraries and + dnl executables is -R. The -R options are cumulative. + for found_dir in $ltrpathdirs; do + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" + done + fi +]) + +dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, +dnl unless already present in VAR. +dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes +dnl contains two or three consecutive elements that belong together. +AC_DEFUN([AC_LIB_APPENDTOVAR], +[ + for element in [$2]; do + haveit= + for x in $[$1]; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + [$1]="${[$1]}${[$1]:+ }$element" + fi + done +]) + +# lib-ld.m4 serial 3 (gettext-0.13) +dnl Copyright (C) 1996-2003 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Subroutines of libtool.m4, +dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision +dnl with libtool.m4. + +dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. +AC_DEFUN([AC_LIB_PROG_LD_GNU], +[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld, +[# I'd rather use --version here, but apparently some GNU ld's only accept -v. +case `$LD -v 2>&1 conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by GCC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]* | [A-Za-z]:[\\/]*)] + [re_direlt='/[^/][^/]*/\.\./'] + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(acl_cv_path_LD, +[if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + acl_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in + *GNU* | *'with BFD'*) + test "$with_gnu_ld" != no && break ;; + *) + test "$with_gnu_ld" != yes && break ;; + esac + fi + done + IFS="$ac_save_ifs" +else + acl_cv_path_LD="$LD" # Let the user override the test with a path. +fi]) +LD="$acl_cv_path_LD" +if test -n "$LD"; then + AC_MSG_RESULT($LD) +else + AC_MSG_RESULT(no) +fi +test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) +AC_LIB_PROG_LD_GNU +]) + dnl # -*- shell-script -*- dnl ########################################################################### dnl # @@ -2097,7 +2916,7 @@ AC_DEFUN(SC_PATH_TCLCONFIG, [ AC_MSG_CHECKING([for Tcl configuration]) AC_CACHE_VAL(ac_cv_c_tclconfig,[ - # First check to see if --with-tclconfig was specified. + # First check to see if --with-tcl was specified. if test x"${with_tclconfig}" != x ; then if test -f "${with_tclconfig}/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)` @@ -2110,10 +2929,16 @@ AC_DEFUN(SC_PATH_TCLCONFIG, [ if test x"${ac_cv_c_tclconfig}" = x ; then for i in \ ../tcl \ + `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ + `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \ `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \ ../../tcl \ + `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ + `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \ `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \ ../../../tcl \ + `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ + `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \ `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do if test -f "$i/unix/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd $i/unix; pwd)` @@ -2124,8 +2949,11 @@ AC_DEFUN(SC_PATH_TCLCONFIG, [ # check in a few common install locations if test x"${ac_cv_c_tclconfig}" = x ; then - for i in `ls -d ${prefix}/lib 2>/dev/null` \ - `ls -d /usr/local/lib 2>/dev/null` ; do + for i in `ls -d ${libdir} 2>/dev/null` \ + `ls -d /usr/local/lib 2>/dev/null` \ + `ls -d /usr/contrib/lib 2>/dev/null` \ + `ls -d /usr/lib 2>/dev/null` \ + ; do if test -f "$i/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd $i; pwd)` break @@ -2134,9 +2962,11 @@ AC_DEFUN(SC_PATH_TCLCONFIG, [ fi # check in a few other private locations - if test x"${ac_cv_c_tcliconfig}" = x ; then + if test x"${ac_cv_c_tclconfig}" = x ; then for i in \ ${srcdir}/../tcl \ + `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ + `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \ `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do if test -f "$i/unix/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd $i/unix; pwd)` @@ -2203,10 +3033,16 @@ AC_DEFUN(SC_PATH_TKCONFIG, [ if test x"${ac_cv_c_tkconfig}" = x ; then for i in \ ../tk \ + `ls -dr ../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ + `ls -dr ../tk[[8-9]].[[0-9]] 2>/dev/null` \ `ls -dr ../tk[[8-9]].[[0-9]]* 2>/dev/null` \ ../../tk \ + `ls -dr ../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ + `ls -dr ../../tk[[8-9]].[[0-9]] 2>/dev/null` \ `ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \ ../../../tk \ + `ls -dr ../../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ + `ls -dr ../../../tk[[8-9]].[[0-9]] 2>/dev/null` \ `ls -dr ../../../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do if test -f "$i/unix/tkConfig.sh" ; then ac_cv_c_tkconfig=`(cd $i/unix; pwd)` @@ -2216,8 +3052,11 @@ AC_DEFUN(SC_PATH_TKCONFIG, [ fi # check in a few common install locations if test x"${ac_cv_c_tkconfig}" = x ; then - for i in `ls -d ${prefix}/lib 2>/dev/null` \ - `ls -d /usr/local/lib 2>/dev/null` ; do + for i in `ls -d ${libdir} 2>/dev/null` \ + `ls -d /usr/local/lib 2>/dev/null` \ + `ls -d /usr/contrib/lib 2>/dev/null` \ + `ls -d /usr/lib 2>/dev/null` \ + ; do if test -f "$i/tkConfig.sh" ; then ac_cv_c_tkconfig=`(cd $i; pwd)` break @@ -2228,6 +3067,8 @@ AC_DEFUN(SC_PATH_TKCONFIG, [ if test x"${ac_cv_c_tkconfig}" = x ; then for i in \ ${srcdir}/../tk \ + `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ + `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]] 2>/dev/null` \ `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do if test -f "$i/unix/tkConfig.sh" ; then ac_cv_c_tkconfig=`(cd $i/unix; pwd)` @@ -2280,17 +3121,44 @@ AC_DEFUN(SC_LOAD_TCLCONFIG, [ fi # - # The eval is required to do the TCL_DBGX substitution in the - # TCL_LIB_FILE variable + # If the TCL_BIN_DIR is the build directory (not the install directory), + # then set the common variable name to the value of the build variables. + # For example, the variable TCL_LIB_SPEC will be set to the value + # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC + # instead of TCL_BUILD_LIB_SPEC since it will work with both an + # installed and uninstalled version of Tcl. + # + + if test -f $TCL_BIN_DIR/Makefile ; then + TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC} + TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC} + TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH} + fi + + # + # eval is required to do the TCL_DBGX substitution # - eval TCL_LIB_FILE=${TCL_LIB_FILE} - eval TCL_LIB_FLAG=${TCL_LIB_FLAG} + eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\"" + eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\"" + eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\"" + eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\"" + eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\"" + eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\"" + + AC_SUBST(TCL_VERSION) AC_SUBST(TCL_BIN_DIR) - AC_SUBST(TCL_SRC_DIR) AC_SUBST(TCL_INC_DIR) + AC_SUBST(TCL_SRC_DIR) + AC_SUBST(TCL_LIB_FILE) + AC_SUBST(TCL_LIB_FLAG) + AC_SUBST(TCL_LIB_SPEC) + + AC_SUBST(TCL_STUB_LIB_FILE) + AC_SUBST(TCL_STUB_LIB_FLAG) + AC_SUBST(TCL_STUB_LIB_SPEC) ]) #------------------------------------------------------------------------ @@ -2310,15 +3178,16 @@ AC_DEFUN(SC_LOAD_TCLCONFIG, [ #------------------------------------------------------------------------ AC_DEFUN(SC_LOAD_TKCONFIG, [ - AC_MSG_CHECKING([for existence of $TCLCONFIG]) + AC_MSG_CHECKING([for existence of $TK_BIN_DIR/tkConfig.sh]) if test -f "$TK_BIN_DIR/tkConfig.sh" ; then - AC_MSG_CHECKING([loading $TK_BIN_DIR/tkConfig.sh]) + AC_MSG_RESULT([loading]) . $TK_BIN_DIR/tkConfig.sh else AC_MSG_RESULT([could not find $TK_BIN_DIR/tkConfig.sh]) fi + AC_SUBST(TK_VERSION) AC_SUBST(TK_BIN_DIR) AC_SUBST(TK_SRC_DIR) AC_SUBST(TK_LIB_DIR) @@ -2326,34 +3195,6 @@ AC_DEFUN(SC_LOAD_TKCONFIG, [ ]) #------------------------------------------------------------------------ -# SC_ENABLE_GCC -- -# -# Allows the use of GCC if available -# -# Arguments: -# none -# -# Results: -# -# Adds the following arguments to configure: -# --enable-gcc -# -# Sets the following vars: -# CC Command to use for the compiler -#------------------------------------------------------------------------ - -AC_DEFUN(SC_ENABLE_GCC, [ - AC_ARG_ENABLE(gcc, [ --enable-gcc allow use of gcc if available [--disable-gcc]], - [ok=$enableval], [ok=no]) - if test "$ok" = "yes"; then - CC=gcc - AC_PROG_CC - else - CC=${CC-cc} - fi -]) - -#------------------------------------------------------------------------ # SC_ENABLE_SHARED -- # # Allows the building of shared libraries @@ -2398,9 +3239,54 @@ AC_DEFUN(SC_ENABLE_SHARED, [ ]) #------------------------------------------------------------------------ +# SC_ENABLE_FRAMEWORK -- +# +# Allows the building of shared libraries into frameworks +# +# Arguments: +# none +# +# Results: +# +# Adds the following arguments to configure: +# --enable-framework=yes|no +# +# Sets the following vars: +# FRAMEWORK_BUILD Value of 1 or 0 +#------------------------------------------------------------------------ + +AC_DEFUN(SC_ENABLE_FRAMEWORK, [ + AC_MSG_CHECKING([how to package libraries]) + AC_ARG_ENABLE(framework, + [ --enable-framework package shared libraries in MacOSX frameworks [--disable-framework]], + [tcl_ok=$enableval], [tcl_ok=no]) + + if test "${enable_framework+set}" = set; then + enableval="$enable_framework" + tcl_ok=$enableval + else + tcl_ok=no + fi + + if test "$tcl_ok" = "yes" ; then + AC_MSG_RESULT([framework]) + FRAMEWORK_BUILD=1 + if test "${SHARED_BUILD}" = "0" ; then + AC_MSG_WARN("Frameworks can only be built if --enable-shared is yes") + FRAMEWORK_BUILD=0 + fi + else + AC_MSG_RESULT([standard shared library]) + FRAMEWORK_BUILD=0 + fi +]) + +#------------------------------------------------------------------------ # SC_ENABLE_THREADS -- # -# Specify if thread support should be enabled +# Specify if thread support should be enabled. TCL_THREADS is +# checked so that if you are compiling an extension against a +# threaded core, your extension must be compiled threaded as well. # # Arguments: # none @@ -2425,11 +3311,21 @@ AC_DEFUN(SC_ENABLE_THREADS, [ AC_ARG_ENABLE(threads, [ --enable-threads build with threads], [tcl_ok=$enableval], [tcl_ok=no]) - if test "$tcl_ok" = "yes"; then - AC_MSG_RESULT(yes) + if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then + if test "${TCL_THREADS}" = 1; then + AC_MSG_RESULT([yes (threaded core)]) + else + AC_MSG_RESULT([yes]) + fi TCL_THREADS=1 AC_DEFINE(TCL_THREADS) + # USE_THREAD_ALLOC tells us to try the special thread-based + # allocator that significantly reduces lock contention + AC_DEFINE(USE_THREAD_ALLOC) AC_DEFINE(_REENTRANT) + if test "`uname -s`" = "SunOS" ; then + AC_DEFINE(_POSIX_PTHREAD_SEMANTICS) + fi AC_DEFINE(_THREAD_SAFE) AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no) if test "$tcl_ok" = "no"; then @@ -2452,8 +3348,14 @@ AC_DEFUN(SC_ENABLE_THREADS, [ else AC_CHECK_LIB(c,pthread_mutex_init,tcl_ok=yes,tcl_ok=no) if test "$tcl_ok" = "no"; then - TCL_THREADS=0 - AC_MSG_WARN("Don t know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile...") + AC_CHECK_LIB(c_r,pthread_mutex_init,tcl_ok=yes,tcl_ok=no) + if test "$tcl_ok" = "yes"; then + # The space is needed + THREADS_LIBS=" -pthread" + else + TCL_THREADS=0 + AC_MSG_WARN("Don t know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile...") + fi fi fi fi @@ -2461,22 +3363,66 @@ AC_DEFUN(SC_ENABLE_THREADS, [ # Does the pthread-implementation provide # 'pthread_attr_setstacksize' ? + ac_saved_libs=$LIBS + LIBS="$LIBS $THREADS_LIBS" AC_CHECK_FUNCS(pthread_attr_setstacksize) + AC_CHECK_FUNCS(pthread_atfork) + LIBS=$ac_saved_libs + AC_CHECK_FUNCS(readdir_r) + if test "x$ac_cv_func_readdir_r" = "xyes"; then + AC_MSG_CHECKING([how many args readdir_r takes]) + # IRIX 5.3 has a 2 arg version of readdir_r + # while other systems have a 3 arg version. + AC_CACHE_VAL(tcl_cv_two_arg_readdir_r, + AC_TRY_COMPILE([#include +#include +#ifdef NO_DIRENT_H +# include /* logic from tcl/compat/dirent.h * +# define dirent direct * */ +#else +# include +#endif +], [readdir_r(NULL, NULL);], + tcl_cv_two_arg_readdir_r=yes, tcl_cv_two_arg_readdir_r=no)) + AC_CACHE_VAL(tcl_cv_three_arg_readdir_r, + AC_TRY_COMPILE([#include +#include +#ifdef NO_DIRENT_H +# include /* logic from tcl/compat/dirent.h * +# define dirent direct * */ +#else +# include +#endif +], [readdir_r(NULL, NULL, NULL);], + tcl_cv_three_arg_readdir_r=yes, tcl_cv_three_arg_readdir_r=no)) + if test "x$tcl_cv_two_arg_readdir_r" = "xyes" ; then + AC_MSG_RESULT([2]) + AC_DEFINE(HAVE_TWO_ARG_READDIR_R) + elif test "x$tcl_cv_three_arg_readdir_r" = "xyes" ; then + AC_MSG_RESULT([3]) + AC_DEFINE(HAVE_THREE_ARG_READDIR_R) + else + AC_MSG_ERROR([unknown number of args for readdir_r]) + fi + fi else TCL_THREADS=0 AC_MSG_RESULT([no (default)]) fi + AC_SUBST(TCL_THREADS) ]) #------------------------------------------------------------------------ # SC_ENABLE_SYMBOLS -- # -# Specify if debugging symbols should be used +# Specify if debugging symbols should be used. +# Memory (TCL_MEM_DEBUG) and compile (TCL_COMPILE_DEBUG) debugging +# can also be enabled. # # Arguments: # none # -# Requires the following vars to be set: +# Requires the following vars to be set in the Makefile: # CFLAGS_DEBUG # CFLAGS_OPTIMIZE # LDFLAGS_DEBUG @@ -2488,10 +3434,10 @@ AC_DEFUN(SC_ENABLE_THREADS, [ # --enable-symbols # # Defines the following vars: -# CFLAGS_DEFAULT Sets to CFLAGS_DEBUG if true -# Sets to CFLAGS_OPTIMIZE if false -# LDFLAGS_DEFAULT Sets to LDFLAGS_DEBUG if true -# Sets to LDFLAGS_OPTIMIZE if false +# CFLAGS_DEFAULT Sets to $(CFLAGS_DEBUG) if true +# Sets to $(CFLAGS_OPTIMIZE) if false +# LDFLAGS_DEFAULT Sets to $(LDFLAGS_DEBUG) if true +# Sets to $(LDFLAGS_OPTIMIZE) if false # DBGX Debug library extension # #------------------------------------------------------------------------ @@ -2499,19 +3445,152 @@ AC_DEFUN(SC_ENABLE_THREADS, [ AC_DEFUN(SC_ENABLE_SYMBOLS, [ AC_MSG_CHECKING([for build with symbols]) AC_ARG_ENABLE(symbols, [ --enable-symbols build with debugging symbols [--disable-symbols]], [tcl_ok=$enableval], [tcl_ok=no]) - if test "$tcl_ok" = "yes"; then - CFLAGS_DEFAULT="${CFLAGS_DEBUG}" - LDFLAGS_DEFAULT="${LDFLAGS_DEBUG}" - DBGX=g - AC_MSG_RESULT([yes]) - else - CFLAGS_DEFAULT="${CFLAGS_OPTIMIZE}" - LDFLAGS_DEFAULT="${LDFLAGS_OPTIMIZE}" +# FIXME: Currently, LDFLAGS_DEFAULT is not used, it should work like CFLAGS_DEFAULT. + if test "$tcl_ok" = "no"; then + CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)' + LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)' DBGX="" AC_MSG_RESULT([no]) + else + CFLAGS_DEFAULT='$(CFLAGS_DEBUG)' + LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)' + DBGX=g + if test "$tcl_ok" = "yes"; then + AC_MSG_RESULT([yes (standard debugging)]) + fi + fi + AC_SUBST(CFLAGS_DEFAULT) + AC_SUBST(LDFLAGS_DEFAULT) + + if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then + AC_DEFINE(TCL_MEM_DEBUG) + fi + + if test "$tcl_ok" = "compile" -o "$tcl_ok" = "all"; then + AC_DEFINE(TCL_COMPILE_DEBUG) + AC_DEFINE(TCL_COMPILE_STATS) + fi + + if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then + if test "$tcl_ok" = "all"; then + AC_MSG_RESULT([enabled symbols mem compile debugging]) + else + AC_MSG_RESULT([enabled $tcl_ok debugging]) + fi fi ]) +#------------------------------------------------------------------------ +# SC_ENABLE_LANGINFO -- +# +# Allows use of modern nl_langinfo check for better l10n. +# This is only relevant for Unix. +# +# Arguments: +# none +# +# Results: +# +# Adds the following arguments to configure: +# --enable-langinfo=yes|no (default is yes) +# +# Defines the following vars: +# HAVE_LANGINFO Triggers use of nl_langinfo if defined. +# +#------------------------------------------------------------------------ + +AC_DEFUN(SC_ENABLE_LANGINFO, [ + AC_ARG_ENABLE(langinfo, + [ --enable-langinfo use nl_langinfo if possible to determine + encoding at startup, otherwise use old heuristic], + [langinfo_ok=$enableval], [langinfo_ok=yes]) + + HAVE_LANGINFO=0 + if test "$langinfo_ok" = "yes"; then + if test "$langinfo_ok" = "yes"; then + AC_CHECK_HEADER(langinfo.h,[langinfo_ok=yes],[langinfo_ok=no]) + fi + fi + AC_MSG_CHECKING([whether to use nl_langinfo]) + if test "$langinfo_ok" = "yes"; then + AC_TRY_COMPILE([#include ], + [nl_langinfo(CODESET);],[langinfo_ok=yes],[langinfo_ok=no]) + if test "$langinfo_ok" = "no"; then + langinfo_ok="no (could not compile with nl_langinfo)"; + fi + if test "$langinfo_ok" = "yes"; then + AC_DEFINE(HAVE_LANGINFO) + fi + fi + AC_MSG_RESULT([$langinfo_ok]) +]) + +#-------------------------------------------------------------------- +# SC_CONFIG_MANPAGES +# +# Decide whether to use symlinks for linking the manpages, +# whether to compress the manpages after installation, and +# whether to add a package name suffix to the installed +# manpages to avoidfile name clashes. +# If compression is enabled also find out what file name suffix +# the given compression program is using. +# +# Arguments: +# none +# +# Results: +# +# Adds the following arguments to configure: +# --enable-man-symlinks +# --enable-man-compression=PROG +# --enable-man-suffix[=STRING] +# +# Defines the following variable: +# +# MAN_FLAGS - The apropriate flags for installManPage +# according to the user's selection. +# +#-------------------------------------------------------------------- +AC_DEFUN(SC_CONFIG_MANPAGES, [ + + AC_MSG_CHECKING([whether to use symlinks for manpages]) + AC_ARG_ENABLE(man-symlinks, + [ --enable-man-symlinks use symlinks for the manpages], + test "$enableval" != "no" && MAN_FLAGS="$MAN_FLAGS --symlinks", + enableval="no") + AC_MSG_RESULT([$enableval]) + + AC_MSG_CHECKING([whether to compress the manpages]) + AC_ARG_ENABLE(man-compression, + [ --enable-man-compression=PROG + compress the manpages with PROG], + test "$enableval" = "yes" && AC_MSG_ERROR([missing argument to --enable-man-compression]) + test "$enableval" != "no" && MAN_FLAGS="$MAN_FLAGS --compress $enableval", + enableval="no") + AC_MSG_RESULT([$enableval]) + if test "$enableval" != "no"; then + AC_MSG_CHECKING([for compressed file suffix]) + touch TeST + $enableval TeST + Z=`ls TeST* | sed 's/^....//'` + rm -f TeST* + MAN_FLAGS="$MAN_FLAGS --extension $Z" + AC_MSG_RESULT([$Z]) + fi + + AC_MSG_CHECKING([whether to add a package name suffix for the manpages]) + AC_ARG_ENABLE(man-suffix, + [ --enable-man-suffix=STRING + use STRING as a suffix to manpage file names + (default: $1)], + test "$enableval" = "yes" && enableval="$1" + test "$enableval" != "no" && MAN_FLAGS="$MAN_FLAGS --suffix $enableval", + enableval="no") + AC_MSG_RESULT([$enableval]) + + AC_SUBST(MAN_FLAGS) +]) + #-------------------------------------------------------------------- # SC_CONFIG_CFLAGS # @@ -2523,7 +3602,7 @@ AC_DEFUN(SC_ENABLE_SYMBOLS, [ # # Results: # -# Defines the following vars: +# Defines and substitutes the following vars: # # DL_OBJS - Name of the object file that implements dynamic # loading for Tcl on this system. @@ -2535,15 +3614,30 @@ AC_DEFUN(SC_ENABLE_SYMBOLS, [ # LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib", # that tell the run-time dynamic linker where to look # for shared libraries such as libtcl.so. Depends on +# the variable LIB_RUNTIME_DIR in the Makefile. Could +# be the same as CC_SEARCH_FLAGS if ${CC} is used to link. +# CC_SEARCH_FLAGS-Flags to pass to ${CC}, such as "-Wl,-rpath,/usr/local/tcl/lib", +# that tell the run-time dynamic linker where to look +# for shared libraries such as libtcl.so. Depends on # the variable LIB_RUNTIME_DIR in the Makefile. -# MAKE_LIB - Command to execute to build the Tcl library; -# differs depending on whether or not Tcl is being -# compiled as a shared library. +# MAKE_LIB - Command to execute to build the a library; +# differs when building shared or static. +# MAKE_STUB_LIB - +# Command to execute to build a stub library. +# INSTALL_LIB - Command to execute to install a library; +# differs when building shared or static. +# INSTALL_STUB_LIB - +# Command to execute to install a stub library. +# STLIB_LD - Base command to use for combining object files +# into a static library. # SHLIB_CFLAGS - Flags to pass to cc when compiling the components # of a shared library (may request position-independent # code, among other things). # SHLIB_LD - Base command to use for combining object files # into a shared library. +# SHLIB_LD_FLAGS -Flags to pass when building a shared library. This +# differes from the SHLIB_CFLAGS as it is not used +# when building object files or executables. # SHLIB_LD_LIBS - Dependent libraries for the linker to scan when # creating shared libraries. This symbol typically # goes at the end of the "ld" commands that build @@ -2558,15 +3652,20 @@ AC_DEFUN(SC_ENABLE_SYMBOLS, [ # SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable # extensions. An empty string means we don't know how # to use shared libraries on this platform. -# TCL_LIB_FILE - Name of the file that contains the Tcl library, such -# as libtcl7.8.so or libtcl7.8.a. -# TCL_LIB_SUFFIX -Specifies everything that comes after the "libtcl" -# in the shared library name, using the $VERSION variable +# TCL_SHLIB_LD_EXTRAS - Additional element which are added to SHLIB_LD_LIBS +# TK_SHLIB_LD_EXTRAS for the build of Tcl and Tk, but not recorded in the +# tclConfig.sh, since they are only used for the build +# of Tcl and Tk. +# Examples: MacOS X records the library version and +# compatibility version in the shared library. But +# of course the Tcl version of this is only used for Tcl. +# LIB_SUFFIX - Specifies everything that comes after the "libfoo" +# in a static or shared library name, using the $VERSION variable # to put the version in the right place. This is used # by platforms that need non-standard library names. # Examples: ${VERSION}.so.1.1 on NetBSD, since it needs # to have a version after the .so, and ${VERSION}.a -# on AIX, since the Tcl shared library needs to have +# on AIX, since a shared library needs to have # a .a extension whereas shared objects for loadable # extensions have a .so extension. Defaults to # ${VERSION}${SHLIB_SUFFIX}. @@ -2584,13 +3683,8 @@ AC_DEFUN(SC_ENABLE_SYMBOLS, [ # Flags used when running the compiler in debug mode # CFLAGS_OPTIMIZE - # Flags used when running the compiler in optimize mode +# CFLAGS - Additional CFLAGS added as necessary (usually 64-bit) # -# EXTRA_CFLAGS -# -# Subst's the following vars: -# DL_LIBS -# CFLAGS_DEBUG -# CFLAGS_OPTIMIZE #-------------------------------------------------------------------- AC_DEFUN(SC_CONFIG_CFLAGS, [ @@ -2643,29 +3737,26 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ if test "`uname -s`" = "AIX" ; then system=AIX-`uname -v`.`uname -r` fi + if test "`uname -s`" = "NetBSD" -a -f /etc/debian_version ; then + system=NetBSD-Debian + fi AC_MSG_RESULT($system) fi fi - AC_MSG_CHECKING([if gcc is being used]) - if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then - using_gcc="yes" - else - using_gcc="no" - fi - - AC_MSG_RESULT([$using_gcc ($CC)]) - # Step 2: check for existence of -ldl library. This is needed because # Linux can use either -ldl or -ldld for dynamic loading. AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no) + # Require ranlib early so we can override it in special cases below. + + AC_REQUIRE([AC_PROG_RANLIB]) + # Step 3: set configuration options based on system name and version. do64bit_ok=no - fullSrcDir=`cd $srcdir; pwd` - EXTRA_CFLAGS="" + LDFLAGS_ORIG="$LDFLAGS" TCL_EXPORT_FILE_SUFFIX="" UNSHARED_LIB_SUFFIX="" TCL_TRIM_DOTS='`echo ${VERSION} | tr -d .`' @@ -2673,69 +3764,96 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ TCL_LIB_VERSIONS_OK=ok CFLAGS_DEBUG=-g CFLAGS_OPTIMIZE=-O - if test "$using_gcc" = "yes" ; then - CFLAGS_WARNING="-Wall -Wconversion -Wno-implicit-int" + if test "$GCC" = "yes" ; then + CFLAGS_WARNING="-Wall -Wno-implicit-int -fno-strict-aliasing" else CFLAGS_WARNING="" fi TCL_NEEDS_EXP_FILE=0 TCL_BUILD_EXP_FILE="" TCL_EXP_FILE="" - STLIB_LD="ar cr" +dnl FIXME: Replace AC_CHECK_PROG with AC_CHECK_TOOL once cross compiling is fixed. +dnl AC_CHECK_TOOL(AR, ar) + AC_CHECK_PROG(AR, ar, ar) + if test "${AR}" = "" ; then + AC_MSG_ERROR([Required archive tool 'ar' not found on PATH.]) + fi + STLIB_LD='${AR} cr' + LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH" + PLAT_OBJS="" + SHLIB_LD_FLAGS="-Wl,-soname,\${TCL_LIB_FILE}.0" case $system in AIX-5.*) - if test "${TCL_THREADS}" = "1" -a "$using_gcc" = "no" ; then + if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then # AIX requires the _r compiler when gcc isn't being used if test "${CC}" != "cc_r" ; then CC=${CC}_r fi AC_MSG_RESULT(Using $CC for compiling with threads) fi + LIBS="$LIBS -lc" # AIX-5 uses ELF style dynamic libraries SHLIB_CFLAGS="" - SHLIB_LD="/usr/ccs/bin/ld -G -z text" - # Note: need the LIBS below, otherwise Tk won't find Tcl's # symbols when dynamically loaded into tclsh. - SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" - # AIX-5 has dl* in libc.so - DL_LIBS="" - LDFLAGS="" - if test "$using_gcc" = "yes" ; then - LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' - else - LD_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}' - fi + LD_LIBRARY_PATH_VAR="LIBPATH" + + # Check to enable 64-bit flags for compiler/linker if test "$do64bit" = "yes" ; then - if test "$using_gcc" = "no" ; then - do64bit_ok=yes - EXTRA_CFLAGS="-q64" - LDFLAGS="-q64" - else + if test "$GCC" = "yes" ; then AC_MSG_WARN("64bit mode not supported with GCC on $system") + else + do64bit_ok=yes + CFLAGS="$CFLAGS -q64" + LDFLAGS="$LDFLAGS -q64" + RANLIB="${RANLIB} -X64" + AR="${AR} -X64" + SHLIB_LD_FLAGS="-b64" + fi + fi + + if test "`uname -m`" = "ia64" ; then + # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC + SHLIB_LD="/usr/ccs/bin/ld -G -z text" + # AIX-5 has dl* in libc.so + DL_LIBS="" + if test "$GCC" = "yes" ; then + CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' + else + CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}' fi + LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' + else + SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry ${SHLIB_LD_FLAGS}" + DL_LIBS="-ldl" + CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} + TCL_NEEDS_EXP_FILE=1 + TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.exp' fi ;; AIX-*) - if test "${TCL_THREADS}" = "1" -a "$using_gcc" = "no" ; then + if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then # AIX requires the _r compiler when gcc isn't being used if test "${CC}" != "cc_r" ; then CC=${CC}_r fi AC_MSG_RESULT(Using $CC for compiling with threads) fi + LIBS="$LIBS -lc" SHLIB_CFLAGS="" - SHLIB_LD="$fullSrcDir/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" - LDFLAGS="" - LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} + LD_LIBRARY_PATH_VAR="LIBPATH" TCL_NEEDS_EXP_FILE=1 TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.exp' @@ -2745,6 +3863,21 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ DL_LIBS="-lld" fi + # Check to enable 64-bit flags for compiler/linker + if test "$do64bit" = "yes" ; then + if test "$GCC" = "yes" ; then + AC_MSG_WARN("64bit mode not supported with GCC on $system") + else + do64bit_ok=yes + CFLAGS="$CFLAGS -q64" + LDFLAGS="$LDFLAGS -q64" + RANLIB="${RANLIB} -X64" + AR="${AR} -X64" + SHLIB_LD_FLAGS="-b64" + fi + fi + SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry ${SHLIB_LD_FLAGS}" + # On AIX <=v4 systems, libbsd.a has to be linked in to support # non-blocking file IO. This library has to be linked in after # the MATH_LIBS or it breaks the pow() function. The way to @@ -2763,6 +3896,21 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ AC_DEFINE(USE_DELTA_FOR_TZ) fi ;; + BeOS*) + SHLIB_CFLAGS="-fPIC" + SHLIB_LD="${CC} -nostart" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + + #----------------------------------------------------------- + # Check for inet_ntoa in -lbind, for BeOS (which also needs + # -lsocket, even if the network functions are in -lnet which + # is always linked to, for compatibility. + #----------------------------------------------------------- + AC_CHECK_LIB(bind, inet_ntoa, [LIBS="$LIBS -lbind -lsocket"]) + ;; BSD/OS-2.1*|BSD/OS-3*) SHLIB_CFLAGS="" SHLIB_LD="shlicc -r" @@ -2770,7 +3918,7 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" - LDFLAGS="" + CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; BSD/OS-4.*) @@ -2780,7 +3928,8 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" - LDFLAGS="-export-dynamic" + LDFLAGS="$LDFLAGS -export-dynamic" + CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; dgux*) @@ -2790,10 +3939,63 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" - LDFLAGS="" + CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; - HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*|HP-UX-*.11.*) + HP-UX-*.11.*) + # Use updated header definitions where possible + AC_DEFINE(_XOPEN_SOURCE) # Use the XOPEN network library + AC_DEFINE(_XOPEN_SOURCE_EXTENDED) # Use the XOPEN network library + LIBS="$LIBS -lxnet" # Use the XOPEN network library + + SHLIB_SUFFIX=".sl" + AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no) + if test "$tcl_ok" = yes; then + SHLIB_CFLAGS="+z" + SHLIB_LD="ld -b" + SHLIB_LD_LIBS='${LIBS}' + DL_OBJS="tclLoadShl.o" + DL_LIBS="-ldld" + LDFLAGS="$LDFLAGS -Wl,-E" + CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.' + LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.' + LD_LIBRARY_PATH_VAR="SHLIB_PATH" + fi + if test "$GCC" = "yes" ; then + SHLIB_LD="gcc -shared" + SHLIB_LD_LIBS='${LIBS}' + LD_SEARCH_FLAGS='' + CC_SEARCH_FLAGS='' + fi + + # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc + #CFLAGS="$CFLAGS +DAportable" + + # Check to enable 64-bit flags for compiler/linker + if test "$do64bit" = "yes" ; then + if test "$GCC" = "yes" ; then + hpux_arch=`gcc -dumpmachine` + case $hpux_arch in + hppa64*) + # 64-bit gcc in use. Fix flags for GNU ld. + do64bit_ok=yes + SHLIB_LD="gcc -shared" + SHLIB_LD_LIBS='${LIBS}' + LD_SEARCH_FLAGS='' + CC_SEARCH_FLAGS='' + ;; + *) + AC_MSG_WARN("64bit mode not supported with GCC on $system") + ;; + esac + else + do64bit_ok=yes + CFLAGS="$CFLAGS +DD64" + LDFLAGS="$LDFLAGS +DD64" + fi + fi + ;; + HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*) SHLIB_SUFFIX=".sl" AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no) if test "$tcl_ok" = yes; then @@ -2802,8 +4004,10 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ SHLIB_LD_LIBS="" DL_OBJS="tclLoadShl.o" DL_LIBS="-ldld" - LDFLAGS="-Wl,-E" - LD_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.' + LDFLAGS="$LDFLAGS -Wl,-E" + CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.' + LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.' + LD_LIBRARY_PATH_VAR="SHLIB_PATH" fi ;; IRIX-4.*) @@ -2813,8 +4017,9 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ SHLIB_LD_LIBS='${LIBS}' DL_OBJS="tclLoadAout.o" DL_LIBS="" - LDFLAGS="-Wl,-D,08000000" - LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + LDFLAGS="$LDFLAGS -Wl,-D,08000000" + CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a' ;; IRIX-5.*) @@ -2824,72 +4029,101 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" - LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' - EXTRA_CFLAGS="" - LDFLAGS="" + CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' ;; - IRIX-6.*|IRIX64-6.5*) + IRIX-6.*) SHLIB_CFLAGS="" SHLIB_LD="ld -n32 -shared -rdata_shared" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" - LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' - if test "$using_gcc" = "yes" ; then - EXTRA_CFLAGS="-mabi=n32" - LDFLAGS="-mabi=n32" + CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' + if test "$GCC" = "yes" ; then + CFLAGS="$CFLAGS -mabi=n32" + LDFLAGS="$LDFLAGS -mabi=n32" else case $system in IRIX-6.3) # Use to build 6.2 compatible binaries on 6.3. - EXTRA_CFLAGS="-n32 -D_OLD_TERMIOS" + CFLAGS="$CFLAGS -n32 -D_OLD_TERMIOS" ;; *) - EXTRA_CFLAGS="-n32" + CFLAGS="$CFLAGS -n32" ;; esac - LDFLAGS="-n32" + LDFLAGS="$LDFLAGS -n32" fi ;; IRIX64-6.*) SHLIB_CFLAGS="" - SHLIB_LD="ld -32 -shared -rdata_shared" + SHLIB_LD="ld -n32 -shared -rdata_shared" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" - LDFLAGS="" - LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' + + # Check to enable 64-bit flags for compiler/linker + + if test "$do64bit" = "yes" ; then + if test "$GCC" = "yes" ; then + AC_MSG_WARN([64bit mode not supported by gcc]) + else + do64bit_ok=yes + SHLIB_LD="ld -64 -shared -rdata_shared" + CFLAGS="$CFLAGS -64" + LDFLAGS="$LDFLAGS -64" + fi + fi ;; Linux*) SHLIB_CFLAGS="-fPIC" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" + CFLAGS_OPTIMIZE=-O2 # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings # when you inline the string and math operations. Turn this off to # get rid of the warnings. - - CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES" + #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES" if test "$have_dl" = yes; then SHLIB_LD="${CC} -shared" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" - LDFLAGS="-rdynamic" - LD_SEARCH_FLAGS='' + LDFLAGS="$LDFLAGS -Wl,--export-dynamic" + CC_SEARCH_FLAGS="" + LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} else AC_CHECK_HEADER(dld.h, [ SHLIB_LD="ld -shared" DL_OBJS="tclLoadDld.o" DL_LIBS="-ldld" - LDFLAGS="" + CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS=""]) fi if test "`uname -m`" = "alpha" ; then - EXTRA_CFLAGS="-mieee" + CFLAGS="$CFLAGS -mieee" + fi + + # The combo of gcc + glibc has a bug related + # to inlining of functions like strtod(). The + # -fno-builtin flag should address this problem + # but it does not work. The -fno-inline flag + # is kind of overkill but it works. + # Disable inlining only when one of the + # files in compat/*.c is being linked in. + if test x"${LIBOBJS}" != x ; then + CFLAGS="$CFLAGS -fno-inline" fi + + # XIM peeking works under XFree86. + AC_DEFINE(PEEK_XCLOSEIM) + ;; GNU*) SHLIB_CFLAGS="-fPIC" @@ -2898,20 +4132,21 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ if test "$have_dl" = yes; then SHLIB_LD="${CC} -shared" - DL_OBJS="" + DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" - LDFLAGS="-rdynamic" - LD_SEARCH_FLAGS="" + LDFLAGS="$LDFLAGS -Wl,--export-dynamic" + CC_SEARCH_FLAGS="" + LD_SEARCH_FLAGS="${CC_SEARCH_FLAGS}" else AC_CHECK_HEADER(dld.h, [ SHLIB_LD="ld -shared" - DL_OBJS="" + DL_OBJS="tclLoadDld.o" DL_LIBS="-ldld" - LDFLAGS="" + CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS=""]) fi if test "`uname -m`" = "alpha" ; then - EXTRA_CFLAGS="-mieee" + CFLAGS="$CFLAGS -mieee" fi ;; MP-RAS-02*) @@ -2921,7 +4156,7 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" - LDFLAGS="" + CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; MP-RAS-*) @@ -2931,7 +4166,19 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" - LDFLAGS="-Wl,-Bexport" + LDFLAGS="$LDFLAGS -Wl,-Bexport" + CC_SEARCH_FLAGS="" + LD_SEARCH_FLAGS="" + ;; + NetBSD-Debian) + SHLIB_CFLAGS="-fPIC" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + + SHLIB_LD="${CC} -shared" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + LDFLAGS="$LDFLAGS -Wl,--export-dynamic" LD_SEARCH_FLAGS="" ;; NetBSD-*|FreeBSD-[[1-2]].*|OpenBSD-*) @@ -2939,13 +4186,13 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ AC_CHECK_HEADER(dlfcn.h, [ # NetBSD/SPARC needs -fPIC, -fpic will not do. SHLIB_CFLAGS="-fPIC" - SHLIB_LD="${CC} -shared" + SHLIB_LD="ld -Bshareable -x" SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" - LDFLAGS="" - LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' AC_MSG_CHECKING(for ELF) AC_EGREP_CPP(yes, [ #ifdef __ELF__ @@ -2953,9 +4200,9 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ #endif ], AC_MSG_RESULT(yes) - SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.so', + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so', AC_MSG_RESULT(no) - SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.so.1.0' + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0' ) ], [ SHLIB_CFLAGS="" @@ -2964,37 +4211,86 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ SHLIB_SUFFIX=".a" DL_OBJS="tclLoadAout.o" DL_LIBS="" - LDFLAGS="" - LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' ]) + + # FreeBSD doesn't handle version numbers with dots. + + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + TCL_LIB_VERSIONS_OK=nodots + ;; + OpenBSD-*) + SHLIB_LD="${CC} -shared" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + CC_SEARCH_FLAGS="" + LD_SEARCH_FLAGS="" + AC_MSG_CHECKING(for ELF) + AC_EGREP_CPP(yes, [ +#ifdef __ELF__ + yes +#endif + ], + [AC_MSG_RESULT(yes) + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'], + [AC_MSG_RESULT(no) + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'] + ) + + # OpenBSD doesn't do version numbers with dots. + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + TCL_LIB_VERSIONS_OK=nodots ;; FreeBSD-*) # FreeBSD 3.* and greater have ELF. SHLIB_CFLAGS="-fPIC" SHLIB_LD="ld -Bshareable -x" - SHLIB_LD_LIBS="" + SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" - LDFLAGS="-export-dynamic" - LD_SEARCH_FLAGS="" - - # FreeBSD doesn't handle version numbers with dots. - - UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' - TCL_LIB_VERSIONS_OK=nodots + LDFLAGS="$LDFLAGS -export-dynamic" + CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' + if test "${TCL_THREADS}" = "1" ; then + # The -pthread needs to go in the CFLAGS, not LIBS + LIBS=`echo $LIBS | sed s/-pthread//` + CFLAGS="$CFLAGS -pthread" + LDFLAGS="$LDFLAGS -pthread" + fi + case $system in + FreeBSD-3.*) + # FreeBSD-3 doesn't handle version numbers with dots. + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so' + TCL_LIB_VERSIONS_OK=nodots + ;; + esac ;; Rhapsody-*|Darwin-*) SHLIB_CFLAGS="-fno-common" - SHLIB_LD="cc -dynamiclib \${LDFLAGS} -compatibility_version ${TCL_MAJOR_VERSION} -current_version \${VERSION} -install_name \${LIB_RUNTIME_DIR}/\${TCL_LIB_FILE}" - SHLIB_LD_LIBS="" + SHLIB_LD="cc -dynamiclib \${LDFLAGS}" + TCL_SHLIB_LD_EXTRAS="-compatibility_version ${TCL_VERSION} -current_version \${VERSION} -install_name \${DYLIB_INSTALL_DIR}/\${TCL_LIB_FILE} -prebind -seg1addr 0xa000000" + TK_SHLIB_LD_EXTRAS="-compatibility_version ${TK_VERSION} -current_version \${VERSION} -install_name \${DYLIB_INSTALL_DIR}/\${TK_LIB_FILE} -prebind -seg1addr 0xb000000" + SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".dylib" DL_OBJS="tclLoadDyld.o" + PLAT_OBJS=\$\(MAC\_OSX_OBJS\) DL_LIBS="" - LDFLAGS="" + LDFLAGS="$LDFLAGS -prebind" + CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" - CFLAGS_OPTIMIZE="-O3" + CFLAGS_OPTIMIZE="-Os" + LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH" + AC_DEFINE(MAC_OSX_TCL) + AC_DEFINE(HAVE_CFBUNDLE) + AC_DEFINE(USE_VFORK) + AC_DEFINE(TCL_DEFAULT_ENCODING,"utf-8") + LIBS="$LIBS -framework CoreFoundation" ;; NEXTSTEP-*) SHLIB_CFLAGS="" @@ -3003,7 +4299,7 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ SHLIB_SUFFIX=".so" DL_OBJS="tclLoadNext.o" DL_LIBS="" - LDFLAGS="" + CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; OS/390-*) @@ -3019,46 +4315,70 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ SHLIB_SUFFIX=".so" DL_OBJS="tclLoadOSF.o" DL_LIBS="" - LDFLAGS="" + CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; OSF1-1.*) # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2 SHLIB_CFLAGS="-fPIC" - SHLIB_LD="ld -shared" + if test "$SHARED_BUILD" = "1" ; then + SHLIB_LD="ld -shared" + else + SHLIB_LD="ld -non_shared" + fi SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" - LDFLAGS="" + CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; OSF1-V*) # Digital OSF/1 SHLIB_CFLAGS="" - SHLIB_LD='ld -shared -expect_unresolved "*"' + if test "$SHARED_BUILD" = "1" ; then + SHLIB_LD='ld -shared -expect_unresolved "*"' + else + SHLIB_LD='ld -non_shared -expect_unresolved "*"' + fi SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" - LDFLAGS="" - LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' - if test "$using_gcc" = "no" ; then - EXTRA_CFLAGS="-DHAVE_TZSET -std1" + CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' + if test "$GCC" = "yes" ; then + CFLAGS="$CFLAGS -mieee" + else + CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee" fi # see pthread_intro(3) for pthread support on osf1, k.furukawa if test "${TCL_THREADS}" = "1" ; then - EXTRA_CFLAGS="${EXTRA_CFLAGS} -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64" - if test "$using_gcc" = "no" ; then - EXTRA_CFLAGS="${EXTRA_CFLAGS} -pthread" - LDFLAGS="-pthread" - else - LIBS=`echo $LIBS | sed s/-lpthreads//` + CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE" + CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64" + LIBS=`echo $LIBS | sed s/-lpthreads//` + if test "$GCC" = "yes" ; then LIBS="$LIBS -lpthread -lmach -lexc" + else + CFLAGS="$CFLAGS -pthread" + LDFLAGS="$LDFLAGS -pthread" fi fi ;; + QNX-6*) + # QNX RTP + # This may work for all QNX, but it was only reported for v6. + SHLIB_CFLAGS="-fPIC" + SHLIB_LD="ld -Bshareable -x" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + # dlopen is in -lc on QNX + DL_LIBS="" + CC_SEARCH_FLAGS="" + LD_SEARCH_FLAGS="" + ;; RISCos-*) SHLIB_CFLAGS="-G 0" SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0" @@ -3066,25 +4386,27 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ SHLIB_SUFFIX=".a" DL_OBJS="tclLoadAout.o" DL_LIBS="" - LDFLAGS="-Wl,-D,08000000" - LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + LDFLAGS="$LDFLAGS -Wl,-D,08000000" + CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} ;; SCO_SV-3.2*) # Note, dlopen is available only on SCO 3.2.5 and greater. However, # this test works, since "uname -s" was non-standard in 3.2.4 and # below. - if test "$using_gcc" = "yes" ; then + if test "$GCC" = "yes" ; then SHLIB_CFLAGS="-fPIC -melf" - LDFLAGS="-melf -Wl,-Bexport" + LDFLAGS="$LDFLAGS -melf -Wl,-Bexport" else SHLIB_CFLAGS="-Kpic -belf" - LDFLAGS="-belf -Wl,-Bexport" + LDFLAGS="$LDFLAGS -belf -Wl,-Bexport" fi SHLIB_LD="ld -G" SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" + CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; SINIX*5.4*) @@ -3094,7 +4416,7 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" - LDFLAGS="" + CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; SunOS-4*) @@ -3104,8 +4426,8 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" - LDFLAGS="" - LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} # SunOS can't handle version numbers with dots in them in library # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it @@ -3117,8 +4439,14 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ TCL_LIB_VERSIONS_OK=nodots ;; SunOS-5.[[0-6]]*) + + # Note: If _REENTRANT isn't defined, then Solaris + # won't define thread-safe library routines. + + AC_DEFINE(_REENTRANT) + AC_DEFINE(_POSIX_PTHREAD_SEMANTICS) + SHLIB_CFLAGS="-KPIC" - SHLIB_LD="/usr/ccs/bin/ld -G -z text" # Note: need the LIBS below, otherwise Tk won't find Tcl's # symbols when dynamically loaded into tclsh. @@ -3127,28 +4455,41 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" - LDFLAGS="" - LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' + if test "$GCC" = "yes" ; then + SHLIB_LD="$CC -shared" + CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' + LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} + else + SHLIB_LD="/usr/ccs/bin/ld -G -z text" + CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' + LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} + fi ;; SunOS-5*) + + # Note: If _REENTRANT isn't defined, then Solaris + # won't define thread-safe library routines. + + AC_DEFINE(_REENTRANT) + AC_DEFINE(_POSIX_PTHREAD_SEMANTICS) + SHLIB_CFLAGS="-KPIC" - SHLIB_LD="/usr/ccs/bin/ld -G -z text" - LDFLAGS="" + # Check to enable 64-bit flags for compiler/linker if test "$do64bit" = "yes" ; then arch=`isainfo` if test "$arch" = "sparcv9 sparc" ; then - if test "$using_gcc" = "no" ; then + if test "$GCC" = "yes" ; then + AC_MSG_WARN("64bit mode not supported with GCC on $system") + else do64bit_ok=yes if test "$do64bitVIS" = "yes" ; then - EXTRA_CFLAGS="-xarch=v9a" - LDFLAGS="-xarch=v9a" + CFLAGS="$CFLAGS -xarch=v9a" + LDFLAGS="$LDFLAGS -xarch=v9a" else - EXTRA_CFLAGS="-xarch=v9" - LDFLAGS="-xarch=v9" + CFLAGS="$CFLAGS -xarch=v9" + LDFLAGS="$LDFLAGS -xarch=v9" fi - else - AC_MSG_WARN("64bit mode not supported with GCC on $system") fi else AC_MSG_WARN("64bit mode only supported sparcv9 system") @@ -3162,9 +4503,13 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" - if test "$using_gcc" = "yes" ; then - LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' + if test "$GCC" = "yes" ; then + SHLIB_LD="$CC -shared" + CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' + LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} else + SHLIB_LD="/usr/ccs/bin/ld -G -z text" + CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' fi ;; @@ -3175,10 +4520,11 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ SHLIB_LD_LIBS='${LIBS}' DL_OBJS="tclLoadAout.o" DL_LIBS="" - LDFLAGS="-Wl,-D,08000000" - LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' - if test "$using_gcc" = "no" ; then - EXTRA_CFLAGS="-DHAVE_TZSET -std1" + LDFLAGS="$LDFLAGS -Wl,-D,08000000" + CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} + if test "$GCC" != "yes" ; then + CFLAGS="$CFLAGS -DHAVE_TZSET -std1" fi ;; UNIX_SV* | UnixWare-5*) @@ -3192,15 +4538,11 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ # that don't grok the -Bexport option. Test that it does. hold_ldflags=$LDFLAGS AC_MSG_CHECKING(for ld accepts -Bexport flag) - LDFLAGS="${LDFLAGS} -Wl,-Bexport" - AC_TRY_LINK(, [int i;], found=yes, found=no) - LDFLAGS=$hold_ldflags + LDFLAGS="$LDFLAGS -Wl,-Bexport" + AC_TRY_LINK(, [int i;], [found=yes], + [LDFLAGS=$hold_ldflags found=no]) AC_MSG_RESULT($found) - if test $found = yes; then - LDFLAGS="-Wl,-Bexport" - else - LDFLAGS="" - fi + CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; esac @@ -3304,7 +4646,8 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ SHLIB_SUFFIX="" DL_OBJS="tclLoadNone.o" DL_LIBS="" - LDFLAGS="" + LDFLAGS="$LDFLAGS_ORIG" + CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" BUILD_DLTEST="" fi @@ -3314,7 +4657,7 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ # standard manufacturer compiler. if test "$DL_OBJS" != "tclLoadNone.o" ; then - if test "$using_gcc" = "yes" ; then + if test "$GCC" = "yes" ; then case $system in AIX-*) ;; @@ -3346,10 +4689,76 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ UNSHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a' fi + if test "${SHARED_BUILD}" = "1" && test "${SHLIB_SUFFIX}" != "" ; then + LIB_SUFFIX=${SHARED_LIB_SUFFIX} + MAKE_LIB='${SHLIB_LD} -o [$]@ ${SHLIB_LD_FLAGS} ${OBJS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}' + INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE)' + else + LIB_SUFFIX=${UNSHARED_LIB_SUFFIX} + + if test "$RANLIB" = "" ; then + MAKE_LIB='$(STLIB_LD) [$]@ ${OBJS}' + INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE)' + else + MAKE_LIB='${STLIB_LD} [$]@ ${OBJS} ; ${RANLIB} [$]@' + INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE) ; (cd $(LIB_INSTALL_DIR) ; $(RANLIB) $(LIB_FILE))' + fi + +dnl Not at all clear what this was doing in Tcl's configure.in +dnl or why it was needed was needed. In any event, this sort of +dnl things needs to be done in the big loop above. +dnl REMOVE THIS BLOCK LATER! (mdejong) +dnl case $system in +dnl BSD/OS*) +dnl ;; +dnl AIX-[[1-4]].*) +dnl ;; +dnl *) +dnl SHLIB_LD_LIBS="" +dnl ;; +dnl esac + fi + + + # Stub lib does not depend on shared/static configuration + if test "$RANLIB" = "" ; then + MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS}' + INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) $(LIB_INSTALL_DIR)/$(STUB_LIB_FILE)' + else + MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS} ; ${RANLIB} [$]@' + INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) $(LIB_INSTALL_DIR)/$(STUB_LIB_FILE) ; (cd $(LIB_INSTALL_DIR) ; $(RANLIB) $(STUB_LIB_FILE))' + fi + + AC_SUBST(DL_LIBS) + + AC_SUBST(DL_OBJS) + AC_SUBST(PLAT_OBJS) + AC_SUBST(CFLAGS) AC_SUBST(CFLAGS_DEBUG) AC_SUBST(CFLAGS_OPTIMIZE) AC_SUBST(CFLAGS_WARNING) + + AC_SUBST(LDFLAGS) + AC_SUBST(LDFLAGS_DEBUG) + AC_SUBST(LDFLAGS_OPTIMIZE) + AC_SUBST(CC_SEARCH_FLAGS) + AC_SUBST(LD_SEARCH_FLAGS) + + AC_SUBST(STLIB_LD) + AC_SUBST(SHLIB_LD) + AC_SUBST(TCL_SHLIB_LD_EXTRAS) + AC_SUBST(TK_SHLIB_LD_EXTRAS) + AC_SUBST(SHLIB_LD_FLAGS) + AC_SUBST(SHLIB_LD_LIBS) + AC_SUBST(SHLIB_CFLAGS) + AC_SUBST(SHLIB_SUFFIX) + + AC_SUBST(MAKE_LIB) + AC_SUBST(MAKE_STUB_LIB) + AC_SUBST(INSTALL_LIB) + AC_SUBST(INSTALL_STUB_LIB) + AC_SUBST(RANLIB) ]) #-------------------------------------------------------------------- @@ -3357,7 +4766,9 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ # # Determine which interface to use to talk to the serial port. # Note that #include lines must begin in leftmost column for -# some compilers to recognize them as preprocessor directives. +# some compilers to recognize them as preprocessor directives, +# and some build environments have stdin not pointing at a +# pseudo-terminal (usually /dev/null instead.) # # Arguments: # none @@ -3365,6 +4776,7 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ # Results: # # Defines only one of the following vars: +# HAVE_SYS_MODEM_H # USE_TERMIOS # USE_TERMIO # USE_SGTTY @@ -3372,13 +4784,13 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ #-------------------------------------------------------------------- AC_DEFUN(SC_SERIAL_PORT, [ + AC_CHECK_HEADERS(sys/modem.h) AC_MSG_CHECKING([termios vs. termio vs. sgtty]) - + AC_CACHE_VAL(tcl_cv_api_serial, [ AC_TRY_RUN([ #include -main() -{ +int main() { struct termios t; if (tcgetattr(0, &t) == 0) { cfsetospeed(&t, 0); @@ -3386,32 +4798,25 @@ main() return 0; } return 1; -}], tk_ok=termios, tk_ok=no, tk_ok=no) - - if test $tk_ok = termios; then - AC_DEFINE(USE_TERMIOS) - else +}], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no) + if test $tcl_cv_api_serial = no ; then AC_TRY_RUN([ #include -main() -{ +int main() { struct termio t; if (ioctl(0, TCGETA, &t) == 0) { t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB; return 0; } return 1; - }], tk_ok=termio, tk_ok=no, tk_ok=no) - - if test $tk_ok = termio; then - AC_DEFINE(USE_TERMIO) - else +}], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no) + fi + if test $tcl_cv_api_serial = no ; then AC_TRY_RUN([ #include -main() -{ +int main() { struct sgttyb t; if (ioctl(0, TIOCGETP, &t) == 0) { t.sg_ospeed = 0; @@ -3419,17 +4824,14 @@ main() return 0; } return 1; -}], tk_ok=sgtty, tk_ok=none, tk_ok=none) - - if test $tk_ok = sgtty; then - AC_DEFINE(USE_SGTTY) - else +}], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=no, tcl_cv_api_serial=no) + fi + if test $tcl_cv_api_serial = no ; then AC_TRY_RUN([ #include #include -main() -{ +int main() { struct termios t; if (tcgetattr(0, &t) == 0 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) { @@ -3438,17 +4840,14 @@ main() return 0; } return 1; -}], tk_ok=termios, tk_ok=no, tk_ok=no) - - if test $tk_ok = termios; then - AC_DEFINE(USE_TERMIOS) - else +}], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no) + fi + if test $tcl_cv_api_serial = no; then AC_TRY_RUN([ #include #include -main() -{ +int main() { struct termio t; if (ioctl(0, TCGETA, &t) == 0 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) { @@ -3456,17 +4855,14 @@ main() return 0; } return 1; - }], tk_ok=termio, tk_ok=no, tk_ok=no) - - if test $tk_ok = termio; then - AC_DEFINE(USE_TERMIO) - else + }], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no) + fi + if test $tcl_cv_api_serial = no; then AC_TRY_RUN([ #include #include -main() -{ +int main() { struct sgttyb t; if (ioctl(0, TIOCGETP, &t) == 0 || errno == ENOTTY || errno == ENXIO || errno == EINVAL) { @@ -3475,17 +4871,14 @@ main() return 0; } return 1; -}], tk_ok=sgtty, tk_ok=none, tk_ok=none) - - if test $tk_ok = sgtty; then - AC_DEFINE(USE_SGTTY) - fi - fi - fi - fi - fi - fi - AC_MSG_RESULT($tk_ok) +}], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=none, tcl_cv_api_serial=none) + fi]) + case $tcl_cv_api_serial in + termios) AC_DEFINE(USE_TERMIOS);; + termio) AC_DEFINE(USE_TERMIO);; + sgtty) AC_DEFINE(USE_SGTTY);; + esac + AC_MSG_RESULT($tcl_cv_api_serial) ]) #-------------------------------------------------------------------- @@ -3507,7 +4900,7 @@ main() # NO_DIRENT_H # NO_ERRNO_H # NO_VALUES_H -# NO_LIMITS_H +# HAVE_LIMITS_H or NO_LIMITS_H # NO_STDLIB_H # NO_STRING_H # NO_SYS_WAIT_H @@ -3520,7 +4913,6 @@ main() #-------------------------------------------------------------------- AC_DEFUN(SC_MISSING_POSIX_HEADERS, [ - AC_MSG_CHECKING(dirent.h) AC_TRY_LINK([#include #include ], [ @@ -3551,7 +4943,8 @@ closedir(d); AC_CHECK_HEADER(errno.h, , [AC_DEFINE(NO_ERRNO_H)]) AC_CHECK_HEADER(float.h, , [AC_DEFINE(NO_FLOAT_H)]) AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H)]) - AC_CHECK_HEADER(limits.h, , [AC_DEFINE(NO_LIMITS_H)]) + AC_CHECK_HEADER(limits.h, + [AC_DEFINE(HAVE_LIMITS_H)], [AC_DEFINE(NO_LIMITS_H)]) AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0) AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0) AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0) @@ -3614,28 +5007,27 @@ AC_DEFUN(SC_PATH_X, [ fi if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then AC_MSG_CHECKING(for X11 header files) - XINCLUDES="# no special path needed" - AC_TRY_CPP([#include ], , XINCLUDES="nope") - if test "$XINCLUDES" = nope; then + found_xincludes="no" + AC_TRY_CPP([#include ], found_xincludes="yes", found_xincludes="no") + if test "$found_xincludes" = "no"; then dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/X11R6/include /usr/X11R5/include /usr/include/X11R5 /usr/include/X11R4 /usr/openwin/include /usr/X11/include /usr/sww/include" for i in $dirs ; do if test -r $i/X11/Intrinsic.h; then AC_MSG_RESULT($i) XINCLUDES=" -I$i" + found_xincludes="yes" break fi done fi else if test "$x_includes" != ""; then - XINCLUDES=-I$x_includes - else - XINCLUDES="# no special path needed" + XINCLUDES="-I$x_includes" + found_xincludes="yes" fi fi - if test "$XINCLUDES" = nope; then + if test found_xincludes = "no"; then AC_MSG_RESULT(couldn't find any!) - XINCLUDES="# no include files found" fi if test "$no_x" = yes; then @@ -3756,47 +5148,56 @@ AC_DEFUN(SC_TIME_HANDLER, [ AC_HEADER_TIME AC_STRUCT_TIMEZONE + AC_CHECK_FUNCS(gmtime_r localtime_r) + AC_MSG_CHECKING([tm_tzadj in struct tm]) - AC_TRY_COMPILE([#include ], [struct tm tm; tm.tm_tzadj;], - [AC_DEFINE(HAVE_TM_TZADJ) - AC_MSG_RESULT(yes)], - AC_MSG_RESULT(no)) + AC_CACHE_VAL(tcl_cv_member_tm_tzadj, + AC_TRY_COMPILE([#include ], [struct tm tm; tm.tm_tzadj;], + tcl_cv_member_tm_tzadj=yes, tcl_cv_member_tm_tzadj=no)) + AC_MSG_RESULT($tcl_cv_member_tm_tzadj) + if test $tcl_cv_member_tm_tzadj = yes ; then + AC_DEFINE(HAVE_TM_TZADJ) + fi AC_MSG_CHECKING([tm_gmtoff in struct tm]) - AC_TRY_COMPILE([#include ], [struct tm tm; tm.tm_gmtoff;], - [AC_DEFINE(HAVE_TM_GMTOFF) - AC_MSG_RESULT(yes)], - AC_MSG_RESULT(no)) + AC_CACHE_VAL(tcl_cv_member_tm_gmtoff, + AC_TRY_COMPILE([#include ], [struct tm tm; tm.tm_gmtoff;], + tcl_cv_member_tm_gmtoff=yes, tcl_cv_member_tm_gmtoff=no)) + AC_MSG_RESULT($tcl_cv_member_tm_gmtoff) + if test $tcl_cv_member_tm_gmtoff = yes ; then + AC_DEFINE(HAVE_TM_GMTOFF) + fi # # Its important to include time.h in this check, as some systems # (like convex) have timezone functions, etc. # - have_timezone=no AC_MSG_CHECKING([long timezone variable]) - AC_TRY_COMPILE([#include ], + AC_CACHE_VAL(tcl_cv_var_timezone, + AC_TRY_COMPILE([#include ], [extern long timezone; timezone += 1; exit (0);], - [have_timezone=yes + tcl_cv_timezone_long=yes, tcl_cv_timezone_long=no)) + AC_MSG_RESULT($tcl_cv_timezone_long) + if test $tcl_cv_timezone_long = yes ; then + AC_DEFINE(HAVE_TIMEZONE_VAR) + else + # + # On some systems (eg IRIX 6.2), timezone is a time_t and not a long. + # + AC_MSG_CHECKING([time_t timezone variable]) + AC_CACHE_VAL(tcl_cv_timezone_time, + AC_TRY_COMPILE([#include ], + [extern time_t timezone; + timezone += 1; + exit (0);], + tcl_cv_timezone_time=yes, tcl_cv_timezone_time=no)) + AC_MSG_RESULT($tcl_cv_timezone_time) + if test $tcl_cv_timezone_time = yes ; then AC_DEFINE(HAVE_TIMEZONE_VAR) - AC_MSG_RESULT(yes)], - AC_MSG_RESULT(no)) - - # - # On some systems (eg IRIX 6.2), timezone is a time_t and not a long. - # - if test "$have_timezone" = no; then - AC_MSG_CHECKING([time_t timezone variable]) - AC_TRY_COMPILE([#include ], - [extern time_t timezone; - timezone += 1; - exit (0);], - [AC_DEFINE(HAVE_TIMEZONE_VAR) - AC_MSG_RESULT(yes)], - AC_MSG_RESULT(no)) + fi fi - ]) #-------------------------------------------------------------------- @@ -3823,24 +5224,28 @@ AC_DEFUN(SC_BUGGY_STRTOD, [ AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0) if test "$tcl_strtod" = 1; then AC_MSG_CHECKING([for Solaris2.4/Tru64 strtod bugs]) - AC_TRY_RUN([ - extern double strtod(); - int main() - { - char *string = "NaN", *spaceString = " "; - char *term; - double value; - value = strtod(string, &term); - if ((term != string) && (term[-1] == 0)) { - exit(1); - } - value = strtod(spaceString, &term); - if (term == (spaceString+1)) { - exit(1); - } - exit(0); - }], tcl_ok=1, tcl_ok=0, tcl_ok=0) - if test "$tcl_ok" = 1; then + AC_CACHE_VAL(tcl_cv_strtod_buggy,[ + AC_TRY_RUN([ + extern double strtod(); + int main() { + char *infString="Inf", *nanString="NaN", *spaceString=" "; + char *term; + double value; + value = strtod(infString, &term); + if ((term != infString) && (term[-1] == 0)) { + exit(1); + } + value = strtod(nanString, &term); + if ((term != nanString) && (term[-1] == 0)) { + exit(1); + } + value = strtod(spaceString, &term); + if (term == (spaceString+1)) { + exit(1); + } + exit(0); + }], tcl_cv_strtod_buggy=1, tcl_cv_strtod_buggy=0, tcl_cv_strtod_buggy=0)]) + if test "$tcl_cv_strtod_buggy" = 1; then AC_MSG_RESULT(ok) else AC_MSG_RESULT(buggy) @@ -3936,3 +5341,123 @@ AC_DEFUN(SC_TCL_LINK_LIBS, [ AC_SUBST(MATH_LIBS) ]) +#-------------------------------------------------------------------- +# SC_TCL_EARLY_FLAGS +# +# Check for what flags are needed to be passed so the correct OS +# features are available. +# +# Arguments: +# None +# +# Results: +# +# Might define the following vars: +# _ISOC99_SOURCE +# _LARGEFILE64_SOURCE +# +#-------------------------------------------------------------------- + +AC_DEFUN(SC_TCL_EARLY_FLAG,[ + AC_CACHE_VAL([tcl_cv_flag_]translit($1,[A-Z],[a-z]), + AC_TRY_COMPILE([$2], $3, [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no, + AC_TRY_COMPILE([[#define ]$1[ 1 +]$2], $3, + [tcl_cv_flag_]translit($1,[A-Z],[a-z])=yes, + [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no))) + if test ["x${tcl_cv_flag_]translit($1,[A-Z],[a-z])[}" = "xyes"] ; then + AC_DEFINE($1) + tcl_flags="$tcl_flags $1" + fi]) + +AC_DEFUN(SC_TCL_EARLY_FLAGS,[ + AC_MSG_CHECKING([for required early compiler flags]) + tcl_flags="" + SC_TCL_EARLY_FLAG(_ISOC99_SOURCE,[#include ], + [char *p = (char *)strtoll; char *q = (char *)strtoull;]) + SC_TCL_EARLY_FLAG(_LARGEFILE64_SOURCE,[#include ], + [struct stat64 buf; int i = stat64("/", &buf);]) + if test "x${tcl_flags}" = "x" ; then + AC_MSG_RESULT(none) + else + AC_MSG_RESULT(${tcl_flags}) + fi]) + +#-------------------------------------------------------------------- +# SC_TCL_64BIT_FLAGS +# +# Check for what is defined in the way of 64-bit features. +# +# Arguments: +# None +# +# Results: +# +# Might define the following vars: +# TCL_WIDE_INT_IS_LONG +# TCL_WIDE_INT_TYPE +# HAVE_STRUCT_DIRENT64 +# HAVE_STRUCT_STAT64 +# HAVE_TYPE_OFF64_T +# +#-------------------------------------------------------------------- + +AC_DEFUN(SC_TCL_64BIT_FLAGS, [ + AC_MSG_CHECKING([for 64-bit integer type]) + AC_CACHE_VAL(tcl_cv_type_64bit,[ + tcl_cv_type_64bit=none + # See if the compiler knows natively about __int64 + AC_TRY_COMPILE(,[__int64 value = (__int64) 0;], + tcl_type_64bit=__int64, tcl_type_64bit="long long") + # See if we should use long anyway Note that we substitute in the + # type that is our current guess for a 64-bit type inside this check + # program, so it should be modified only carefully... + AC_TRY_COMPILE(,[switch (0) { + case 1: case (sizeof(]${tcl_type_64bit}[)==sizeof(long)): ; + }],tcl_cv_type_64bit=${tcl_type_64bit})]) + if test "${tcl_cv_type_64bit}" = none ; then + AC_DEFINE(TCL_WIDE_INT_IS_LONG) + AC_MSG_RESULT(using long) + else + AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit}) + AC_MSG_RESULT(${tcl_cv_type_64bit}) + + # Now check for auxiliary declarations + AC_MSG_CHECKING([for struct dirent64]) + AC_CACHE_VAL(tcl_cv_struct_dirent64,[ + AC_TRY_COMPILE([#include +#include ],[struct dirent64 p;], + tcl_cv_struct_dirent64=yes,tcl_cv_struct_dirent64=no)]) + if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then + AC_DEFINE(HAVE_STRUCT_DIRENT64) + fi + AC_MSG_RESULT(${tcl_cv_struct_dirent64}) + + AC_MSG_CHECKING([for struct stat64]) + AC_CACHE_VAL(tcl_cv_struct_stat64,[ + AC_TRY_COMPILE([#include ],[struct stat64 p; +], + tcl_cv_struct_stat64=yes,tcl_cv_struct_stat64=no)]) + if test "x${tcl_cv_struct_stat64}" = "xyes" ; then + AC_DEFINE(HAVE_STRUCT_STAT64) + fi + AC_MSG_RESULT(${tcl_cv_struct_stat64}) + + AC_MSG_CHECKING([for off64_t]) + AC_CACHE_VAL(tcl_cv_type_off64_t,[ + AC_TRY_COMPILE([#include ],[off64_t offset; +], + tcl_cv_type_off64_t=yes,tcl_cv_type_off64_t=no)]) + AC_CHECK_FUNCS(open64 lseek64) + dnl Define HAVE_TYPE_OFF64_T only when the off64_t type and the + dnl functions lseek64 and open64 are defined. + if test "x${tcl_cv_type_off64_t}" = "xyes" && \ + test "x${ac_cv_func_lseek64}" = "xyes" && \ + test "x${ac_cv_func_open64}" = "xyes" ; then + AC_DEFINE(HAVE_TYPE_OFF64_T, 1, [Is off64_t in ?]) + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi + fi]) + diff --git a/configure b/configure index d6fb9ed..c28f29e 100755 --- a/configure +++ b/configure @@ -1,28 +1,325 @@ #! /bin/sh - # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.13 -# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# Generated by GNU Autoconf 2.59. # +# Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file -# Defaults: -ac_help= +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# ac_default_prefix=/usr/local -# Any additions from configure.in: -ac_help="$ac_help - --with-tcl directory containing tcl configuration (tclConfig.sh)" +ac_config_libobj_dir=. +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= + +ac_unique_file="src/ivycpy.i" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_STDINT_H +# include +# endif +#endif +#if HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS ECHO_E _N _C ECHO ESC INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PYTHON LINES COLUMNS PYTHON_VERSION PYTHON_INCLUDEDIR PYTHON_LIBDIR PYTHON_COMPILER pyexecdir pythondir pkgpyexecdir pkgpythondir TCL_VERSION TCL_BIN_DIR TCL_INC_DIR TCL_SRC_DIR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC DEFINES INCLUDES LIBRARIES SWIG DOXYGEN CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP PACKAGE VERSION DOCDIR LIBOBJS LTLIBOBJS' +ac_subst_files='' # Initialize some variables set by options. +ac_init_help= +ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. -build=NONE -cache_file=./config.cache +cache_file=/dev/null exec_prefix=NONE -host=NONE no_create= -nonopt=NONE no_recursion= prefix=NONE program_prefix=NONE @@ -31,10 +328,15 @@ program_transform_name=s,x,x, silent= site= srcdir= -target=NONE verbose= x_includes=NONE x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' @@ -48,17 +350,9 @@ oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' -# Initialize some other variables. -subdirs= -MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} -# Maximum number of lines to put in a shell here document. -ac_max_here_lines=12 - ac_prev= for ac_option do - # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" @@ -66,59 +360,59 @@ do continue fi - case "$ac_option" in - -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) ac_optarg= ;; - esac + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. - case "$ac_option" in + case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir="$ac_optarg" ;; + bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) - ac_prev=build ;; + ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build="$ac_optarg" ;; + build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file="$ac_optarg" ;; + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) - datadir="$ac_optarg" ;; + datadir=$ac_optarg ;; -disable-* | --disable-*) - ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - eval "enable_${ac_feature}=no" ;; + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) - ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac - eval "enable_${ac_feature}='$ac_optarg'" ;; + eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ @@ -127,95 +421,47 @@ do -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) - exec_prefix="$ac_optarg" ;; + exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; - -help | --help | --hel | --he) - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat << EOF -Usage: configure [options] [host] -Options: [defaults in brackets after descriptions] -Configuration: - --cache-file=FILE cache test results in FILE - --help print this message - --no-create do not create output files - --quiet, --silent do not print \`checking...' messages - --version print the version of autoconf that created configure -Directory and file names: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [same as prefix] - --bindir=DIR user executables in DIR [EPREFIX/bin] - --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] - --libexecdir=DIR program executables in DIR [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data in DIR - [PREFIX/share] - --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data in DIR - [PREFIX/com] - --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] - --libdir=DIR object code libraries in DIR [EPREFIX/lib] - --includedir=DIR C header files in DIR [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] - --infodir=DIR info documentation in DIR [PREFIX/info] - --mandir=DIR man documentation in DIR [PREFIX/man] - --srcdir=DIR find the sources in DIR [configure dir or ..] - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM - run sed PROGRAM on installed program names -EOF - cat << EOF -Host type: - --build=BUILD configure for building on BUILD [BUILD=HOST] - --host=HOST configure for HOST [guessed] - --target=TARGET configure for TARGET [TARGET=HOST] -Features and packages: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR -EOF - if test -n "$ac_help"; then - echo "--enable and --with options recognized:$ac_help" - fi - exit 0 ;; + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; -host | --host | --hos | --ho) - ac_prev=host ;; + ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) - host="$ac_optarg" ;; + host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir="$ac_optarg" ;; + includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir="$ac_optarg" ;; + infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir="$ac_optarg" ;; + libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) - libexecdir="$ac_optarg" ;; + libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ @@ -224,19 +470,19 @@ EOF -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir="$ac_optarg" ;; + localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir="$ac_optarg" ;; + mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) + | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ @@ -250,26 +496,26 @@ EOF -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir="$ac_optarg" ;; + oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix="$ac_optarg" ;; + prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix="$ac_optarg" ;; + program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix="$ac_optarg" ;; + program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ @@ -286,7 +532,7 @@ EOF | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name="$ac_optarg" ;; + program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) @@ -296,7 +542,7 @@ EOF ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) - sbindir="$ac_optarg" ;; + sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ @@ -307,58 +553,57 @@ EOF | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) - sharedstatedir="$ac_optarg" ;; + sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) - site="$ac_optarg" ;; + site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir="$ac_optarg" ;; + srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir="$ac_optarg" ;; + sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target ;; + ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target="$ac_optarg" ;; + target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; - -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.13" - exit 0 ;; + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; -with-* | --with-*) - ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac - eval "with_${ac_package}='$ac_optarg'" ;; + eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) - ac_package=`echo $ac_option|sed -e 's/-*without-//'` + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - eval "with_${ac_package}=no" ;; + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. @@ -369,99 +614,110 @@ EOF ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes="$ac_optarg" ;; + x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries="$ac_optarg" ;; + x_libraries=$ac_optarg ;; - -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + *) - if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then - echo "configure: warning: $ac_option: invalid host type" 1>&2 - fi - if test "x$nonopt" != xNONE; then - { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } - fi - nonopt="$ac_option" + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then - { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } -fi - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -# File descriptor usage: -# 0 standard input -# 1 file creation -# 2 errors and warnings -# 3 some systems may open it to /dev/tty -# 4 used on the Kubota Titan -# 6 checking for... messages and results -# 5 compiler messages saved in config.log -if test "$silent" = yes; then - exec 6>/dev/null -else - exec 6>&1 + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } fi -exec 5>./config.log -echo "\ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. -" 1>&5 +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done -# Strip out --no-create and --no-recursion so they do not pile up. -# Also quote any args containing shell metacharacters. -ac_configure_args= -for ac_arg +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir do - case "$ac_arg" in - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) ;; - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) - ac_configure_args="$ac_configure_args '$ac_arg'" ;; - *) ac_configure_args="$ac_configure_args $ac_arg" ;; + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; esac done -# NLS nuisances. -# Only set these to C if already set. These must not be set unconditionally -# because not all systems understand e.g. LANG=C (notably SCO). -# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! -# Non-C LC_CTYPE values break the ctype check. -if test "${LANG+set}" = set; then LANG=C; export LANG; fi -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi -if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo > confdefs.h +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null -# A filename unique to this package, relative to the directory that -# configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=ivycpy.i # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. - ac_prog=$0 - ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` - test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + ac_confdir=`(dirname "$0") 2>/dev/null || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. @@ -471,13 +727,459 @@ else fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then - { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } else - { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } fi fi -srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` +(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || + { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 + { (exit 1); exit 1; }; } +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures this package to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +_ACEOF + + cat <<_ACEOF +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +_ACEOF + + cat <<\_ACEOF +_ACEOF +fi + +if test -n "$ac_init_help"; then + + cat <<\_ACEOF + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-tcl directory containing tcl configuration (tclConfig.sh) + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d $ac_dir || continue + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_srcdir/configure.gnu; then + echo + $SHELL $ac_srcdir/configure.gnu --help=recursive + elif test -f $ac_srcdir/configure; then + echo + $SHELL $ac_srcdir/configure --help=recursive + elif test -f $ac_srcdir/configure.ac || + test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd "$ac_popdir" + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\_ACEOF + +Copyright (C) 2003 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by $as_me, which was +generated by GNU Autoconf 2.59. Invocation command line was + + $ $0 $@ + +_ACEOF +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_sep= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + # Get rid of the leading space. + ac_sep=" " + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------- ## +## Output files. ## +## ------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + sed "/^$/d" confdefs.h | sort + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core && + rm -rf conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then @@ -488,44 +1190,112 @@ if test -z "$CONFIG_SITE"; then fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then - echo "loading site script $ac_site_file" + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi else - echo "creating cache $cache_file" - > $cache_file + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file fi -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -ac_exeext= -ac_objext=o -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac fi -else - ac_n= ac_c='\c' ac_t= +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } fi -echo $ac_n "checking if «echo» support backslash-escaped characters""... $ac_c" 1>&6 -echo "configure:527: checking if «echo» support backslash-escaped characters" >&5 -if eval "test \"`echo '$''{'mv_cv_prog_ECHO_E'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + + + + + + + +PACKAGE=ivycpy +VERSION=2.0 + +echo "$as_me:$LINENO: checking if «echo» support backslash-escaped characters" >&5 +echo $ECHO_N "checking if «echo» support backslash-escaped characters... $ECHO_C" >&6 +if test "${mv_cv_prog_ECHO_E+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if >/dev/null 2>&1 echo && test -z "`echo '\a'|fgrep a`" && test -z "`echo '\b'|fgrep b`" && test -z "`echo '\c'|fgrep c`" && test -z "`echo '\f'|fgrep f`" && test -z "`echo '\n'|fgrep n`" && test -z "`echo '\r'|fgrep r`" && test -z "`echo '\t'|fgrep t`" && test -z "`echo '\v'|fgrep v`" && test -z "`echo '\033'|fgrep 33`"; then ECHO_E='echo' @@ -542,18 +1312,16 @@ mv_cv_prog_ECHO_E=$ECHO_E fi ECHO_E=$mv_cv_prog_ECHO_E if test -n "$ECHO_E"; then - echo "$ac_t""yes ($ECHO_E)" 1>&6 + echo "$as_me:$LINENO: result: yes ($ECHO_E)" >&5 +echo "${ECHO_T}yes ($ECHO_E)" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - -PACKAGE=ivycpy -VERSION=0.6 - -echo $ac_n "checking if «echo» can suppress trailing newline""... $ac_c" 1>&6 -echo "configure:555: checking if «echo» can suppress trailing newline" >&5 -if eval "test \"`echo '$''{'mv_cv_prog_ECHO_N'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking if «echo» can suppress trailing newline" >&5 +echo $ECHO_N "checking if «echo» can suppress trailing newline... $ECHO_C" >&6 +if test "${mv_cv_prog_ECHO_N+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ECHO_E" && >/dev/null 2>&1 $ECHO_E && test -z "`$ECHO_E -n ''|fgrep n`"; then ECHO_N=$ECHO_E; _N=-n; _C= @@ -574,14 +1342,16 @@ mv_cv_prog_ECHO_N=$ECHO_N; mv_cv_prog_ECHO_N_N=$_N; mv_cv_prog_ECHO_N_C=$_C fi ECHO_N=$mv_cv_prog_ECHO_N; _N=$mv_cv_prog_ECHO_N_N; _C=$mv_cv_prog_ECHO_N_C if test -n "$ECHO_N"; then - echo "$ac_t""yes (\$ECHO_N \$_N \"...\$_C\")" 1>&6 + echo "$as_me:$LINENO: result: yes (\$ECHO_N \$_N \\"...\$_C\\")" >&5 +echo "${ECHO_T}yes (\$ECHO_N \$_N \\"...\$_C\\")" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -echo $ac_n "checking the \"best\" «echo» command""... $ac_c" 1>&6 -echo "configure:583: checking the \"best\" «echo» command" >&5 -if eval "test \"`echo '$''{'mv_cv_prog_ECHO'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking the \"best\" «echo» command" >&5 +echo $ECHO_N "checking the \"best\" «echo» command... $ECHO_C" >&6 +if test "${mv_cv_prog_ECHO+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ECHO_N"; then ECHO=$ECHO_N @@ -594,17 +1364,43 @@ mv_cv_prog_ECHO=$ECHO fi ECHO=$mv_cv_prog_ECHO if test -n "$ECHO"; then - echo "$ac_t""$ECHO" 1>&6 + echo "$as_me:$LINENO: result: $ECHO" >&5 +echo "${ECHO_T}$ECHO" >&6 else - echo "$ac_t""no" 1>&6 - { echo "configure: error: NO ECHO COMMAND!!!" 1>&2; exit 1; } + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + { { echo "$as_me:$LINENO: error: NO ECHO COMMAND!!!" >&5 +echo "$as_me: error: NO ECHO COMMAND!!!" >&2;} + { (exit 1); exit 1; }; } fi -mv_LB=[ -mv_RB=] -mv_unset_colors() { - RESET= - # video attributes - BOLD= +echo "$as_me:$LINENO: checking if «$ECHO» support the escape character" >&5 +echo $ECHO_N "checking if «$ECHO» support the escape character... $ECHO_C" >&6 +if test "${mv_cv_prog_ECHO_ESC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if >/dev/null 2>&1 $ECHO '\e' && test -z "`$ECHO '\e'|fgrep e`"; then + ESC=\\e +elif >/dev/null 2>&1 $ECHO '\033' && test -z "`$ECHO '\033'|fgrep 33`"; then + ESC=\\033 +else + ESC= +fi +mv_cv_prog_ECHO_ESC=$ESC +fi +ESC=$mv_cv_prog_ECHO_ESC +if test -n "$ESC"; then + echo "$as_me:$LINENO: result: yes (\$ESC)" >&5 +echo "${ECHO_T}yes (\$ESC)" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +mv_LB=[ +mv_RB=] +mv_unset_colors() { + RESET= + # video attributes + BOLD= BOLD_OFF= UNDERLINE= UNDERLINE_OFF= @@ -638,26 +1434,6 @@ mv_unset_colors() { U= u= } -echo $ac_n "checking if «$ECHO» support the escape character""... $ac_c" 1>&6 -echo "configure:643: checking if «$ECHO» support the escape character" >&5 -if eval "test \"`echo '$''{'mv_cv_prog_ECHO_ESC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if >/dev/null 2>&1 $ECHO '\e' && test -z "`$ECHO '\e'|fgrep e`"; then - ESC=\\e -elif >/dev/null 2>&1 $ECHO '\033' && test -z "`$ECHO '\033'|fgrep 33`"; then - ESC=\\033 -else - ESC= -fi -mv_cv_prog_ECHO_ESC=$ESC -fi -ESC=$mv_cv_prog_ECHO_ESC -if test -n "$ESC"; then - echo "$ac_t""yes (\$ESC)" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi mv_set_colors() { if test -n "$ESC"; then RESET=${ESC}${mv_LB}0m @@ -724,14 +1500,20 @@ for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break fi done if test -z "$ac_aux_dir"; then - { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} + { (exit 1); exit 1; }; } fi -ac_config_guess=$ac_aux_dir/config.guess -ac_config_sub=$ac_aux_dir/config.sub -ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or @@ -740,66 +1522,81 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. -echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:749: checking for a BSD compatible install" >&5 +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" - for ac_dir in $PATH; do - # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - if test -f $ac_dir/$ac_prog; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : else - ac_cv_path_install="$ac_dir/$ac_prog -c" - break 2 + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 fi fi done - ;; - esac - done - IFS="$ac_save_IFS" + done + ;; +esac +done + fi if test "${ac_cv_path_install+set}" = set; then - INSTALL="$ac_cv_path_install" + INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. - INSTALL="$ac_install_sh" + INSTALL=$ac_install_sh fi fi -echo "$ac_t""$INSTALL" 1>&6 +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -echo $ac_n "checking terminal size""... $ac_c" 1>&6 -echo "configure:803: checking terminal size" >&5 +echo "$as_me:$LINENO: checking terminal size" >&5 +echo $ECHO_N "checking terminal size... $ECHO_C" >&6 case `uname` in Linux) mv_term_spec=`stty size` @@ -818,41 +1615,48 @@ SunOS) COLUMNS=0 ;; esac -echo "$ac_t""$COLUMNS x $LINES" 1>&6 +echo "$as_me:$LINENO: result: $COLUMNS x $LINES" >&5 +echo "${ECHO_T}$COLUMNS x $LINES" >&6 for ac_prog in python2.3 python2.2 python2.1 python do -# Extract the first word of "$ac_prog", so it can be a program name with args. + # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:830: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_PYTHON'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_PYTHON+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$PYTHON"; then ac_cv_prog_PYTHON="$PYTHON" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_PYTHON="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_PYTHON="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + fi fi -PYTHON="$ac_cv_prog_PYTHON" +PYTHON=$ac_cv_prog_PYTHON if test -n "$PYTHON"; then - echo "$ac_t""$PYTHON" 1>&6 + echo "$as_me:$LINENO: result: $PYTHON" >&5 +echo "${ECHO_T}$PYTHON" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -test -n "$PYTHON" && break + test -n "$PYTHON" && break done @@ -1094,25 +1898,27 @@ CPPFLAGS="$CPPFLAGS -I$PYTHON_INCLUDEDIR/python$PYTHON_VERSION" if test x"${no_tcl}" = x ; then # we reset no_tcl in case something fails here no_tcl=true - # Check whether --with-tcl or --without-tcl was given. + +# Check whether --with-tcl or --without-tcl was given. if test "${with_tcl+set}" = set; then withval="$with_tcl" with_tclconfig=${withval} -fi - - echo $ac_n "checking for Tcl configuration""... $ac_c" 1>&6 -echo "configure:1105: checking for Tcl configuration" >&5 - if eval "test \"`echo '$''{'ac_cv_c_tclconfig'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +fi; + echo "$as_me:$LINENO: checking for Tcl configuration" >&5 +echo $ECHO_N "checking for Tcl configuration... $ECHO_C" >&6 + if test "${ac_cv_c_tclconfig+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - - # First check to see if --with-tclconfig was specified. + + # First check to see if --with-tcl was specified. if test x"${with_tclconfig}" != x ; then if test -f "${with_tclconfig}/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)` else - { echo "configure: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" 1>&2; exit 1; } + { { echo "$as_me:$LINENO: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" >&5 +echo "$as_me: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" >&2;} + { (exit 1); exit 1; }; } fi fi @@ -1120,10 +1926,16 @@ else if test x"${ac_cv_c_tclconfig}" = x ; then for i in \ ../tcl \ + `ls -dr ../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \ + `ls -dr ../tcl[8-9].[0-9] 2>/dev/null` \ `ls -dr ../tcl[8-9].[0-9]* 2>/dev/null` \ ../../tcl \ + `ls -dr ../../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \ + `ls -dr ../../tcl[8-9].[0-9] 2>/dev/null` \ `ls -dr ../../tcl[8-9].[0-9]* 2>/dev/null` \ ../../../tcl \ + `ls -dr ../../../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \ + `ls -dr ../../../tcl[8-9].[0-9] 2>/dev/null` \ `ls -dr ../../../tcl[8-9].[0-9]* 2>/dev/null` ; do if test -f "$i/unix/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd $i/unix; pwd)` @@ -1134,8 +1946,11 @@ else # check in a few common install locations if test x"${ac_cv_c_tclconfig}" = x ; then - for i in `ls -d ${prefix}/lib 2>/dev/null` \ - `ls -d /usr/local/lib 2>/dev/null` ; do + for i in `ls -d ${libdir} 2>/dev/null` \ + `ls -d /usr/local/lib 2>/dev/null` \ + `ls -d /usr/contrib/lib 2>/dev/null` \ + `ls -d /usr/lib 2>/dev/null` \ + ; do if test -f "$i/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd $i; pwd)` break @@ -1144,9 +1959,11 @@ else fi # check in a few other private locations - if test x"${ac_cv_c_tcliconfig}" = x ; then + if test x"${ac_cv_c_tclconfig}" = x ; then for i in \ ${srcdir}/../tcl \ + `ls -dr ${srcdir}/../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \ + `ls -dr ${srcdir}/../tcl[8-9].[0-9] 2>/dev/null` \ `ls -dr ${srcdir}/../tcl[8-9].[0-9]* 2>/dev/null` ; do if test -f "$i/unix/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd $i/unix; pwd)` @@ -1154,44 +1971,75 @@ else fi done fi - + fi if test x"${ac_cv_c_tclconfig}" = x ; then TCL_BIN_DIR="# no Tcl configs found" - echo "configure: warning: Can't find Tcl configuration definitions" 1>&2 + { echo "$as_me:$LINENO: WARNING: Can't find Tcl configuration definitions" >&5 +echo "$as_me: WARNING: Can't find Tcl configuration definitions" >&2;} exit 0 else no_tcl= TCL_BIN_DIR=${ac_cv_c_tclconfig} - echo "$ac_t""found $TCL_BIN_DIR/tclConfig.sh" 1>&6 + echo "$as_me:$LINENO: result: found $TCL_BIN_DIR/tclConfig.sh" >&5 +echo "${ECHO_T}found $TCL_BIN_DIR/tclConfig.sh" >&6 fi fi - echo $ac_n "checking for existence of $TCL_BIN_DIR/tclConfig.sh""... $ac_c" 1>&6 -echo "configure:1175: checking for existence of $TCL_BIN_DIR/tclConfig.sh" >&5 + echo "$as_me:$LINENO: checking for existence of $TCL_BIN_DIR/tclConfig.sh" >&5 +echo $ECHO_N "checking for existence of $TCL_BIN_DIR/tclConfig.sh... $ECHO_C" >&6 if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then - echo "$ac_t""loading" 1>&6 + echo "$as_me:$LINENO: result: loading" >&5 +echo "${ECHO_T}loading" >&6 . $TCL_BIN_DIR/tclConfig.sh else - echo "$ac_t""file not found" 1>&6 + echo "$as_me:$LINENO: result: file not found" >&5 +echo "${ECHO_T}file not found" >&6 + fi + + # + # If the TCL_BIN_DIR is the build directory (not the install directory), + # then set the common variable name to the value of the build variables. + # For example, the variable TCL_LIB_SPEC will be set to the value + # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC + # instead of TCL_BUILD_LIB_SPEC since it will work with both an + # installed and uninstalled version of Tcl. + # + + if test -f $TCL_BIN_DIR/Makefile ; then + TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC} + TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC} + TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH} fi # - # The eval is required to do the TCL_DBGX substitution in the - # TCL_LIB_FILE variable + # eval is required to do the TCL_DBGX substitution # - eval TCL_LIB_FILE=${TCL_LIB_FILE} - eval TCL_LIB_FLAG=${TCL_LIB_FLAG} + eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\"" + eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\"" + eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\"" + + eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\"" + eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\"" + eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\"" + + + + + + + + + + + + - - - - if test "$silent" != yes; then @@ -1233,36 +2081,42 @@ CPPFLAGS="$CPPFLAGS $TCL_INCLUDES" for ac_prog in swig do -# Extract the first word of "$ac_prog", so it can be a program name with args. + # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1240: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_SWIG'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_SWIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$SWIG"; then ac_cv_prog_SWIG="$SWIG" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_SWIG="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_SWIG="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + fi fi -SWIG="$ac_cv_prog_SWIG" +SWIG=$ac_cv_prog_SWIG if test -n "$SWIG"; then - echo "$ac_t""$SWIG" 1>&6 + echo "$as_me:$LINENO: result: $SWIG" >&5 +echo "${ECHO_T}$SWIG" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -test -n "$SWIG" && break + test -n "$SWIG" && break done @@ -1324,400 +2178,1468 @@ fi $ECHO "$MAGENTA"""SWIGVERSION is "$SWIGVERSION ""${RESET}${FOREGROUND-$DEFAULT}${BACKGROUND-$BG_DEFAULT}" fi -# -# Checks for programs. -# AC_PROG_CXX -# Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1335: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +for ac_prog in doxygen +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_DOXYGEN+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. + if test -n "$DOXYGEN"; then + ac_cv_prog_DOXYGEN="$DOXYGEN" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="gcc" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DOXYGEN="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + fi fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 +DOXYGEN=$ac_cv_prog_DOXYGEN +if test -n "$DOXYGEN"; then + echo "$as_me:$LINENO: result: $DOXYGEN" >&5 +echo "${ECHO_T}$DOXYGEN" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1365: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. + test -n "$DOXYGEN" && break +done + + +if test -z "$DOXYGEN"; then + { { +mv_fd=2 +if test -n "$ESC" && test -t $mv_fd; then + mv_set_colors + mv_colors_on_fd_2=yes else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_prog_rejected=no - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - break - fi - done - IFS="$ac_save_ifs" -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# -gt 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - set dummy "$ac_dir/$ac_word" "$@" - shift - ac_cv_prog_CC="$@" - fi + mv_unset_colors + mv_colors_on_fd_2=no fi +mv_prefix=`basename ${0}` +mv_n=`expr length $mv_prefix` +mv_n=`expr $mv_n + 2` # ": " +mv_n=`expr $COLUMNS - $mv_n` + +mv_decor= +mv_i=$mv_n +while >/dev/null expr $mv_i; do + mv_i=`expr $mv_i - 1` + mv_decor="*$mv_decor" +done +unset mv_i +unset mv_n + +if test -n "Error"; then + mv_severity="${BOLD}Error${BOLD_OFF}: " +else + mv_severity= fi + +>&2 $ECHO "${RED}${mv_prefix}: ${mv_decor}" + +>&2 $ECHO "${RED}${mv_prefix}: *** ${mv_severity}${BOLD}No Doxygen program found${BOLD_OFF}" +>&2 $ECHO "${RED}${mv_prefix}: ${mv_decor}${FOREGROUND-$RESET}" +unset mv_prefix +unset mv_decor + +if test "$silent" = yes; then $ECHO $_N "$RESET$_C"; fi + +}; exit 1; } fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 + +DOXYGEN_VERSION=`$DOXYGEN --version` + +if test "$silent" != yes; then + mv_fd=1 +if test -n "$ESC" && test -t $mv_fd; then + mv_set_colors + mv_colors_on_fd_1=yes else - echo "$ac_t""no" 1>&6 + mv_unset_colors + mv_colors_on_fd_1=no +fi + $ECHO "$CYAN""You are using Doxygen version $DOXYGEN_VERSION""${RESET}${FOREGROUND-$DEFAULT}${BACKGROUND-$BG_DEFAULT}" fi - if test -z "$CC"; then - case "`uname -s`" in - *win32* | *WIN32*) - # Extract the first word of "cl", so it can be a program name with args. -set dummy cl; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1416: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. +if test "$DOXYGEN_VERSION" '<' "1.4.7"; then + { { +mv_fd=2 +if test -n "$ESC" && test -t $mv_fd; then + mv_set_colors + mv_colors_on_fd_2=yes else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="cl" - break - fi - done - IFS="$ac_save_ifs" -fi + mv_unset_colors + mv_colors_on_fd_2=no fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 +mv_prefix=`basename ${0}` +mv_n=`expr length $mv_prefix` +mv_n=`expr $mv_n + 2` # ": " +mv_n=`expr $COLUMNS - $mv_n` + +mv_decor= +mv_i=$mv_n +while >/dev/null expr $mv_i; do + mv_i=`expr $mv_i - 1` + mv_decor="*$mv_decor" +done +unset mv_i +unset mv_n + +if test -n "Error"; then + mv_severity="${BOLD}Error${BOLD_OFF}: " else - echo "$ac_t""no" 1>&6 + mv_severity= fi - ;; - esac - fi - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } + +>&2 $ECHO "${RED}${mv_prefix}: ${mv_decor}" + +>&2 $ECHO "${RED}${mv_prefix}: *** ${mv_severity}${BOLD}Doxygen version prior to 1.4.7 does not support python${BOLD_OFF}" +>&2 $ECHO "${RED}${mv_prefix}: ${mv_decor}${FOREGROUND-$RESET}" +unset mv_prefix +unset mv_decor + +if test "$silent" = yes; then $ECHO $_N "$RESET$_C"; fi + +}; exit 1; } fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1448: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +DOCDIR=\${exec_prefix}/doc/html + +# +# Checks for programs. +# AC_PROG_CXX ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -cat > conftest.$ac_ext << EOF - -#line 1459 "configure" -#include "confdefs.h" - -main(){return(0);} -EOF -if { (eval echo configure:1464: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - ac_cv_prog_cc_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cc_cross=no - else - ac_cv_prog_cc_cross=yes - fi +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cc_works=no -fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 -if test $ac_cv_prog_cc_works = no; then - { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1490: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 -cross_compiling=$ac_cv_prog_cc_cross - -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1495: checking whether we are using GNU C" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. else - ac_cv_prog_gcc=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + fi fi - -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 - -if test $ac_cv_prog_gcc = yes; then - GCC=yes +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 else - GCC= + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -ac_test_CFLAGS="${CFLAGS+set}" -ac_save_CFLAGS="$CFLAGS" -CFLAGS= -echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1523: checking whether ${CC-cc} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - echo 'void f(){}' > conftest.c -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then - ac_cv_prog_cc_g=yes + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 else - ac_cv_prog_cc_g=no + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -rm -f conftest* + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" fi -echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 -if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "$GCC" = yes; then + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +# b.out is created by i960 compilers. +for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) + ;; + conftest.$ac_ext ) + # This is the source file. + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; + * ) + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std1 is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std1. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + '' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +#include +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu # Checks for libraries. # FIXME: Replace `main' with a function in `-lc': -echo $ac_n "checking for main in -lc""... $ac_c" 1>&6 -echo "configure:1558: checking for main in -lc" >&5 -ac_lib_var=`echo c'_'main | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + + +echo "$as_me:$LINENO: checking for main in -lc" >&5 +echo $ECHO_N "checking for main in -lc... $ECHO_C" >&6 +if test "${ac_cv_lib_c_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-lc $LIBS" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + +int +main () +{ +main (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_c_main=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_lib_c_main=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo c | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <&5 +echo "${ECHO_T}$ac_cv_lib_c_main" >&6 +if test $ac_cv_lib_c_main = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBC 1 +_ACEOF LIBS="-lc $LIBS" -else - echo "$ac_t""no" 1>&6 fi # Checks for header files. -echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1603: checking how to run the C preprocessor" >&5 +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then -if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - # This must be in double quotes, not single quotes, because CPP may get - # substituted into the Makefile and "${CC-cc}" will confuse make. - CPP="${CC-cc} -E" + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1624: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -E -traditional-cpp" - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1641: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then : else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -nologo -E" - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1658: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then : else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP=/lib/cpp + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue fi -rm -f conftest* +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes fi -rm -f conftest* +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break fi -rm -f conftest* - ac_cv_prog_CPP="$CPP" +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } fi - CPP="$ac_cv_prog_CPP" + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6 +if test "${ac_cv_prog_egrep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_cv_prog_CPP="$CPP" + if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi fi -echo "$ac_t""$CPP" 1>&6 +echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + -echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1683: checking for ANSI C header files" >&5 -if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include #include #include -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1696: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_header_stdc=yes else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_stdc=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. -cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "memchr" >/dev/null 2>&1; then + $EGREP "memchr" >/dev/null 2>&1; then : else - rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* @@ -1726,16 +3648,19 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. -cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "free" >/dev/null 2>&1; then + $EGREP "free" >/dev/null 2>&1; then : else - rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* @@ -1744,175 +3669,419 @@ fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. -if test "$cross_compiling" = yes; then + if test "$cross_compiling" = yes; then : else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include -#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int main () { int i; for (i = 0; i < 256; i++) -if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); -exit (0); } +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif -EOF -if { (eval echo configure:1763: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then : else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_header_stdc=no + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no fi -rm -fr conftest* +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi - fi fi - -echo "$ac_t""$ac_cv_header_stdc" 1>&6 +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 -EOF +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + -for ac_hdr in stdlib.h string.h + +for ac_header in stdlib.h string.h do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1790: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1800: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 fi -rm -f conftest* +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - echo "$ac_t""no" 1>&6 + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + done - -# Checks for typedefs, structures, and compiler characteristics. -echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:1829: checking for working const" >&5 -if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <j = 5; -} -{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ - const int foo = 10; -} -; return 0; } -EOF -if { (eval echo configure:1883: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +# Checks for typedefs, structures, and compiler characteristics. +echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 +echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 +if test "${ac_cv_c_const+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +/* FIXME: Include the comments suggested by Paul. */ +#ifndef __cplusplus + /* Ultrix mips cc rejects this. */ + typedef int charset[2]; + const charset x; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *ccp; + char **p; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + ccp = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++ccp; + p = (char**) ccp; + ccp = (char const *const *) p; + { /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + } +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_c_const=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_c_const=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_c_const=no fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - -echo "$ac_t""$ac_cv_c_const" 1>&6 +echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 +echo "${ECHO_T}$ac_cv_c_const" >&6 if test $ac_cv_c_const = no; then - cat >> confdefs.h <<\EOF -#define const -EOF + +cat >>confdefs.h <<\_ACEOF +#define const +_ACEOF fi # specific checks -echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:1906: checking return type of signal handlers" >&5 -if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <&5 +echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 +if test "${ac_cv_type_signal+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include #ifdef signal -#undef signal +# undef signal #endif #ifdef __cplusplus extern "C" void (*signal (int, void (*)(int)))(int); @@ -1920,26 +4089,50 @@ extern "C" void (*signal (int, void (*)(int)))(int); void (*signal ()) (); #endif -int main() { +int +main () +{ int i; -; return 0; } -EOF -if { (eval echo configure:1928: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_type_signal=void else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_type_signal=int + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_signal=int fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi +echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 +echo "${ECHO_T}$ac_cv_type_signal" >&6 -echo "$ac_t""$ac_cv_type_signal" 1>&6 -cat >> confdefs.h <>confdefs.h <<_ACEOF #define RETSIGTYPE $ac_cv_type_signal -EOF +_ACEOF @@ -1947,53 +4140,101 @@ EOF # AC_MSG_CHECKING("checking for realloc ...") # AC_CHECK_FUNC(realloc,AC_MSG_RESULT(" present"),\ # AC_MSG_ERROR("unreachable")) -echo $ac_n "checking for realloc""... $ac_c" 1>&6 -echo "configure:1952: checking for realloc" >&5 -if eval "test \"`echo '$''{'ac_cv_func_realloc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <&5 +echo $ECHO_N "checking for realloc... $ECHO_C" >&6 +if test "${ac_cv_func_realloc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define realloc to an innocuous variant, in case declares realloc. + For example, HP-UX 11i declares gettimeofday. */ +#define realloc innocuous_realloc + /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char realloc(); below. */ -#include -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char realloc(); + which can conflict with char realloc (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ -int main() { +#ifdef __STDC__ +# include +#else +# include +#endif +#undef realloc + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char realloc (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_realloc) || defined (__stub___realloc) choke me #else -realloc(); +char (*f) () = realloc; +#endif +#ifdef __cplusplus +} #endif -; return 0; } -EOF -if { (eval echo configure:1980: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_realloc=yes" +int +main () +{ +return f != realloc; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_realloc=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_realloc=no" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_realloc=no fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi - -if eval "test \"`echo '$ac_cv_func_'realloc`\" = yes"; then - echo "$ac_t""yes" 1>&6 +echo "$as_me:$LINENO: result: $ac_cv_func_realloc" >&5 +echo "${ECHO_T}$ac_cv_func_realloc" >&6 +if test $ac_cv_func_realloc = yes; then : else - echo "$ac_t""no" 1>&6 -{ echo "configure: error: "realloc unreachable"" 1>&2; exit 1; } + { { echo "$as_me:$LINENO: error: \"realloc unreachable\"" >&5 +echo "$as_me: error: \"realloc unreachable\"" >&2;} + { (exit 1); exit 1; }; } fi @@ -2014,458 +4255,1461 @@ fi fi # python header -for ac_hdr in Python.h + +for ac_header in Python.h do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2022: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2032: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 fi -rm -f conftest* +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + else - echo "$ac_t""no" 1>&6 -{ echo "configure: error: "Python.h unreachable"" 1>&2; exit 1; } + { { echo "$as_me:$LINENO: error: \"Python.h unreachable\"" >&5 +echo "$as_me: error: \"Python.h unreachable\"" >&2;} + { (exit 1); exit 1; }; } fi + done # tcl header -for ac_hdr in tcl.h + +for ac_header in tcl.h do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2065: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2075: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 fi -rm -f conftest* +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + else - echo "$ac_t""no" 1>&6 -{ echo "configure: error: "tcl.h unreachable"" 1>&2; exit 1; } + { { echo "$as_me:$LINENO: error: \"tcl.h unreachable\"" >&5 +echo "$as_me: error: \"tcl.h unreachable\"" >&2;} + { (exit 1); exit 1; }; } fi + done # ivy header -for ac_hdr in ivy.h + +for ac_header in ivy.h do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2107: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2117: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 fi -rm -f conftest* +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + else - echo "$ac_t""no" 1>&6 -{ echo "configure: error: "ivy.h unreachable"" 1>&2; exit 1; } + { { echo "$as_me:$LINENO: error: \"ivy.h unreachable\"" >&5 +echo "$as_me: error: \"ivy.h unreachable\"" >&2;} + { (exit 1); exit 1; }; } fi + done -echo $ac_n "checking "TCL_THREADS"""... $ac_c" 1>&6 -echo "configure:2146: checking "TCL_THREADS"" >&5 -cat > conftest.$ac_ext <&5 +echo $ECHO_N "checking \"TCL_THREADS\"... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #define WITH_THREAD #include #ifdef TCL_THREADS yes #endif - -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "yes" >/dev/null 2>&1; then - rm -rf conftest* + $EGREP "yes" >/dev/null 2>&1; then tclthreads=yes else - rm -rf conftest* tclthreads=no fi rm -f conftest* if test "$tclthreads" = "yes" ; then - echo "$ac_t"""ok"" 1>&6 + echo "$as_me:$LINENO: result: \"ok\"" >&5 +echo "${ECHO_T}\"ok\"" >&6 else - echo "$ac_t"""no"" 1>&6 + echo "$as_me:$LINENO: result: \"no\"" >&5 +echo "${ECHO_T}\"no\"" >&6 fi - - # -trap '' 1 2 15 -cat > confcache <<\EOF + + + ac_config_files="$ac_config_files GNUmakefile" +cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure -# scripts and configure runs. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. # -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. # -EOF +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' -# Any assignment to VPATH causes Sun make to only execute -# the first set of double-colon rules, so remove it if not needed. -# If there is a colon in the path, we need to keep it. +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' fi -trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 - # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. -cat > conftest.defs <<\EOF -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g -s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g -s%\[%\\&%g -s%\]%\\&%g -s%\$%$$%g -EOF -DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` -rm -f conftest.defs - - -# Without the "./", some shells look in PATH for config.status. -: ${CONFIG_STATUS=./config.status} +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then we branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +cat >confdef2opt.sed <<\_ACEOF +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g +t quote +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g +t quote +d +: quote +s,[ `~#$^&*(){}\\|;'"<>?],\\&,g +s,\[,\\&,g +s,\],\\&,g +s,\$,$$,g +p +_ACEOF +# We use echo to avoid assuming a particular line-breaking character. +# The extra dot is to prevent the shell from consuming trailing +# line-breaks from the sub-command output. A line-break within +# single-quotes doesn't work because, if this script is created in a +# platform that uses two characters for line-breaks (e.g., DOS), tr +# would break. +ac_LF_and_DOT=`echo; echo .` +DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` +rm -f confdef2opt.sed + + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_i=`echo "$ac_i" | + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + # 2. Add them. + ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs -echo creating $CONFIG_STATUS -rm -f $CONFIG_STATUS -cat > $CONFIG_STATUS <&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. # Run this file to recreate the current configuration. -# This directory was configured as follows, -# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# -# $0 $ac_configure_args -# # Compiler output produced by configure, useful for debugging -# configure, is in ./config.log if it exists. +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh -ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" -for ac_option +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME do - case "\$ac_option" in - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" - exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; - -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.13" - exit 0 ;; - -help | --help | --hel | --he | --h) - echo "\$ac_cs_usage"; exit 0 ;; - *) echo "\$ac_cs_usage"; exit 1 ;; - esac + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi done -ac_given_srcdir=$srcdir -ac_given_INSTALL="$INSTALL" +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi -trap 'rm -fr `echo "GNUmakefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 -EOF -cat >> $CONFIG_STATUS </dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi -# Protect against being on the right side of a sed subst in config.status. -sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; - s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF -$ac_vpsub -$extrasub -s%@SHELL@%$SHELL%g -s%@CFLAGS@%$CFLAGS%g -s%@CPPFLAGS@%$CPPFLAGS%g -s%@CXXFLAGS@%$CXXFLAGS%g -s%@FFLAGS@%$FFLAGS%g -s%@DEFS@%$DEFS%g -s%@LDFLAGS@%$LDFLAGS%g -s%@LIBS@%$LIBS%g -s%@exec_prefix@%$exec_prefix%g -s%@prefix@%$prefix%g -s%@program_transform_name@%$program_transform_name%g -s%@bindir@%$bindir%g -s%@sbindir@%$sbindir%g -s%@libexecdir@%$libexecdir%g -s%@datadir@%$datadir%g -s%@sysconfdir@%$sysconfdir%g -s%@sharedstatedir@%$sharedstatedir%g -s%@localstatedir@%$localstatedir%g -s%@libdir@%$libdir%g -s%@includedir@%$includedir%g -s%@oldincludedir@%$oldincludedir%g -s%@infodir@%$infodir%g -s%@mandir@%$mandir%g -s%@ECHO_E@%$ECHO_E%g -s%@ECHO_N@%$ECHO_N%g -s%@_N@%$_N%g -s%@_C@%$_C%g -s%@ECHO@%$ECHO%g -s%@ESC@%$ESC%g -s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g -s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g -s%@INSTALL_DATA@%$INSTALL_DATA%g -s%@PYTHON@%$PYTHON%g -s%@LINES@%$LINES%g -s%@COLUMNS@%$COLUMNS%g -s%@PYTHON_VERSION@%$PYTHON_VERSION%g -s%@PYTHON_INCLUDEDIR@%$PYTHON_INCLUDEDIR%g -s%@PYTHON_LIBDIR@%$PYTHON_LIBDIR%g -s%@PYTHON_COMPILER@%$PYTHON_COMPILER%g -s%@pyexecdir@%$pyexecdir%g -s%@pythondir@%$pythondir%g -s%@pkgpyexecdir@%$pkgpyexecdir%g -s%@pkgpythondir@%$pkgpythondir%g -s%@TCL_BIN_DIR@%$TCL_BIN_DIR%g -s%@TCL_SRC_DIR@%$TCL_SRC_DIR%g -s%@TCL_INC_DIR@%$TCL_INC_DIR%g -s%@TCL_LIB_FILE@%$TCL_LIB_FILE%g -s%@DEFINES@%$DEFINES%g -s%@INCLUDES@%$INCLUDES%g -s%@LIBRARIES@%$LIBRARIES%g -s%@SWIG@%$SWIG%g -s%@CC@%$CC%g -s%@CPP@%$CPP%g -s%@PACKAGE@%$PACKAGE%g -s%@VERSION@%$VERSION%g -CEOF -EOF - -cat >> $CONFIG_STATUS <<\EOF - -# Split the substitutions into bite-sized pieces for seds with -# small command number limits, like on Digital OSF/1 and HP-UX. -ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. -ac_file=1 # Number of current file. -ac_beg=1 # First line for current file. -ac_end=$ac_max_sed_cmds # Line after last line for current file. -ac_more_lines=: -ac_sed_cmds="" -while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' else - sed "${ac_end}q" conftest.subs > conftest.s$ac_file + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } fi - if test ! -s conftest.s$ac_file; then - ac_more_lines=false - rm -f conftest.s$ac_file + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' else - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f conftest.s$ac_file" - else - ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" - fi - ac_file=`expr $ac_file + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_cmds` + as_ln_s='ln -s' fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by $as_me, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\_ACEOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Report bugs to ." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.59, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2003 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +INSTALL="$INSTALL" +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + ac_shift=: + ;; + -*) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_option=$1 + ac_need_defaults=false;; + esac + + case $ac_option in + # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift done -if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" fi -EOF -cat >> $CONFIG_STATUS <>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi -CONFIG_FILES=\${CONFIG_FILES-"GNUmakefile"} -EOF -cat >> $CONFIG_STATUS <<\EOF -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; +_ACEOF + + + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "GNUmakefile" ) CONFIG_FILES="$CONFIG_FILES GNUmakefile" ;; + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; esac +done - # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files +fi - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" - # A "../" for each directory in $ac_dir_suffix. - ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` - else - ac_dir_suffix= ac_dots= +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason to put it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./confstat$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@DEFS@,$DEFS,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@LIBS@,$LIBS,;t t +s,@ECHO_E@,$ECHO_E,;t t +s,@_N@,$_N,;t t +s,@_C@,$_C,;t t +s,@ECHO@,$ECHO,;t t +s,@ESC@,$ESC,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@PYTHON@,$PYTHON,;t t +s,@LINES@,$LINES,;t t +s,@COLUMNS@,$COLUMNS,;t t +s,@PYTHON_VERSION@,$PYTHON_VERSION,;t t +s,@PYTHON_INCLUDEDIR@,$PYTHON_INCLUDEDIR,;t t +s,@PYTHON_LIBDIR@,$PYTHON_LIBDIR,;t t +s,@PYTHON_COMPILER@,$PYTHON_COMPILER,;t t +s,@pyexecdir@,$pyexecdir,;t t +s,@pythondir@,$pythondir,;t t +s,@pkgpyexecdir@,$pkgpyexecdir,;t t +s,@pkgpythondir@,$pkgpythondir,;t t +s,@TCL_VERSION@,$TCL_VERSION,;t t +s,@TCL_BIN_DIR@,$TCL_BIN_DIR,;t t +s,@TCL_INC_DIR@,$TCL_INC_DIR,;t t +s,@TCL_SRC_DIR@,$TCL_SRC_DIR,;t t +s,@TCL_LIB_FILE@,$TCL_LIB_FILE,;t t +s,@TCL_LIB_FLAG@,$TCL_LIB_FLAG,;t t +s,@TCL_LIB_SPEC@,$TCL_LIB_SPEC,;t t +s,@TCL_STUB_LIB_FILE@,$TCL_STUB_LIB_FILE,;t t +s,@TCL_STUB_LIB_FLAG@,$TCL_STUB_LIB_FLAG,;t t +s,@TCL_STUB_LIB_SPEC@,$TCL_STUB_LIB_SPEC,;t t +s,@DEFINES@,$DEFINES,;t t +s,@INCLUDES@,$INCLUDES,;t t +s,@LIBRARIES@,$LIBRARIES,;t t +s,@SWIG@,$SWIG,;t t +s,@DOXYGEN@,$DOXYGEN,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@CPP@,$CPP,;t t +s,@EGREP@,$EGREP,;t t +s,@PACKAGE@,$PACKAGE,;t t +s,@VERSION@,$VERSION,;t t +s,@DOCDIR@,$DOCDIR,;t t +s,@LIBOBJS@,$LIBOBJS,;t t +s,@LTLIBOBJS@,$LTLIBOBJS,;t t +CEOF + +_ACEOF + + cat >>$CONFIG_STATUS <<\_ACEOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat fi +fi # test -n "$CONFIG_FILES" - case "$ac_given_srcdir" in - .) srcdir=. - if test -z "$ac_dots"; then top_srcdir=. - else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; - /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; - *) # Relative path. - srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" - top_srcdir="$ac_dots$ac_given_srcdir" ;; +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; esac - case "$ac_given_INSTALL" in - [/$]*) INSTALL="$ac_given_INSTALL" ;; - *) INSTALL="$ac_dots$ac_given_INSTALL" ;; - esac + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + - echo creating "$ac_file" - rm -f "$ac_file" - configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." - case "$ac_file" in - *Makefile*) ac_comsub="1i\\ -# $configure_input" ;; - *) ac_comsub= ;; + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - sed -e "$ac_comsub -s%@configure_input@%$configure_input%g -s%@srcdir@%$srcdir%g -s%@top_srcdir@%$top_srcdir%g -s%@INSTALL@%$INSTALL%g -" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file -fi; done -rm -f conftest.s* + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@abs_srcdir@,$ac_abs_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t +s,@builddir@,$ac_builddir,;t t +s,@abs_builddir@,$ac_abs_builddir,;t t +s,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi -EOF -cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +cat >>$CONFIG_STATUS <<\_ACEOF -exit 0 -EOF +{ (exit 0); exit 0; } +_ACEOF chmod +x $CONFIG_STATUS -rm -fr confdefs* $ac_clean_files -test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi if test "$silent" != yes; then diff --git a/configure.in b/configure.in index 3aee97b..935640f 100644 --- a/configure.in +++ b/configure.in @@ -3,9 +3,9 @@ dnl # autoconf2.13 script dnl # «» dnl # -AC_INIT(ivycpy.i) +AC_INIT(src/ivycpy.i) PACKAGE=ivycpy -VERSION=0.6 +VERSION=2.0 MV_COLOR_ON(BLACK, WHITE) dnl # @@ -44,6 +44,24 @@ SWIGVERSION=`swig -version 2>&1 | grep Version | awk '{print $3}'` MV_MSG(["SWIGVERSION is "$SWIGVERSION] , [$MAGENTA]) +dnl # checking doxygen availability and version + +AC_CHECK_PROGS(DOXYGEN, doxygen) + +if test -z "$DOXYGEN"; then + MV_ERROR(No Doxygen program found) +fi + +DOXYGEN_VERSION=`$DOXYGEN --version` + +MV_MSG(You are using Doxygen version $DOXYGEN_VERSION, $CYAN) + +if test "$DOXYGEN_VERSION" '<' "1.4.7"; then + MV_ERROR(Doxygen version prior to 1.4.7 does not support python) +fi + +DOCDIR=\${exec_prefix}/doc/html + # # Checks for programs. @@ -100,14 +118,14 @@ else AC_MSG_RESULT("no") fi - - # dnl # exporting (Makefile some variables) AC_SUBST(PACKAGE) AC_SUBST(VERSION) +AC_SUBST(DOXYGEN) +AC_SUBST(DOCDIR) AC_OUTPUT(GNUmakefile) diff --git a/debian/changelog b/debian/changelog index 3da1368..36b3c36 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +ivycpy (2.0-1) unstable; urgency=low + + * Mise à jour du wrapper suite au passage à la version 3.8.1.1 de ivy-c + * Utilisation de doxygen pour la génération de la documentation + + -- Olivier Saal Wed, 03 Jan 2007 10:50:30 +0100 + ivycpy (0.6-5) unstable; urgency=low * Génération de la documentation au format pdf et html diff --git a/debian/control b/debian/control index 1306c8f..f8a21b3 100644 --- a/debian/control +++ b/debian/control @@ -1,5 +1,5 @@ Source: ivycpy -Version: ivycpy213 +Version: ivycpy23 Section: devel Priority: optional Maintainer: Didier Pavet @@ -9,11 +9,10 @@ Build-Depends: debhelper, python, python-dev, python-epydoc Package: python-ivy Section: devel Architecture: i386 -Depends: libc6-dev, ivy-c (>= 3.7), ivy-c-dev (>= 3.7), python +Depends: libc6-dev, ivy-c (>= 3.8), ivy-c-dev (>= 3.8), python Conflicts: ivycpy213sa, ivycpy Description: Ivy stub for Python (wrapper above ivyc). - Ivycpy provides a Python access to the Ivy Bus. It is a wrapper above ivyc library ([3.3 .. 3.6]). - This version is the version for debian woody (ivycpy213 stands for ivycpy for - Python 213); it is dymically linked with libivy. - It requires to install python2.1-tk-o which is the Opened Tkinter version with the suited patch - on _tkinter.so sharable lib for ivycpy. + Ivycpy provides a Python access to the Ivy Bus. It is a wrapper above ivyc library ([3.8]). + This version is the version for debian sarge (ivycpy23 stands for ivycpy for + Python 23); it is dymically linked with libivy. + It requires to install python2.3 diff --git a/debian/copyright b/debian/copyright index 5998bd1..cd71e91 100644 --- a/debian/copyright +++ b/debian/copyright @@ -16,16 +16,17 @@ Copyright: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with this code; if not, write to the Free - Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. + You should have received a copy of the GNU General Public License with + your Debian GNU system, in /usr/share/common-licenses/GPL, or with the + Debian GNU hello source package as the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. Note : - Ivy (http://www.tls.cena.fr/products/ivy/) is proposed under LGPL license. -- Python and Tkinter 2.1 and older are now proposed under the BEOPEN PYTHON OPEN +- Python and Tkinter 2.3 and older are now proposed under the BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1 by the Python Software Foundation. See http://www.python.org/psf/ for more information about the PSF. diff --git a/debian/ivycpy.3 b/debian/ivycpy.3 index 47650e2..b182e25 100644 --- a/debian/ivycpy.3 +++ b/debian/ivycpy.3 @@ -2,7 +2,7 @@ .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) -.TH IVYCPY 3 "Sept, 2004" "ivycpy" "Python library for accessing Ivy Bus, v0.5" +.TH IVYCPY 3 "Jan, 2007" "ivycpy" "Python library for accessing Ivy Bus, v2.0" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -29,17 +29,13 @@ This manual page documents briefly the .B ivycpy library. This Python library (actually C wrapper around ivy-c library) allow -to use Ivy bus using Python. This library is a wrapper above ivyc library (>=3.3) +to use Ivy bus using Python. This library is a wrapper above ivyc library (>=3.8) and procures functions to plug a Python application onto the Ivy Bus. -This version is strictly compatible with ivy-c [3.2 .. 3.6] and can be +This version is strictly compatible with ivy-c [3.8] and can be dynamically linked to a new version of ivy-c, if ivy-c api is unchanged which is quite unlikely. -This current source version allows to link ivycpy with an dedicated version of -[Python/Tkinter] . ivycpy requires to share some internal data with _tkinter.c -and thus a dedicated version of tkinter is required to make ivycpy working. - .PP Ivycpy is developped using SWIG (Simplified Wrapper and Interface Generator), see http://www.swig.org for further inforation on SWIG. @@ -56,5 +52,6 @@ Documentation is available at : For further information about Ivy, visit the Ivy web site : http://www.tls.cena.fr/products/ivy/ .SH AUTHOR -This manual page was written by Didier Pavet , +This manual page was written by Didier Pavet +and was modified by Olivier Saal , for the Debian GNU/Linux system. diff --git a/docs/dev/how2build.html b/docs/dev/how2build.html index fd7bca8..6f027d4 100644 --- a/docs/dev/how2build.html +++ b/docs/dev/how2build.html @@ -9,9 +9,7 @@

Requirements: building from the source requires the following:

  • SWIG in version 1.3.x -
  • ivy-c-dev in version >= 3.3 -
  • Python Tkinter : a patched version is required ; delivered as - a debian package python2.1-tk-o - ask to the maintainer of this package. +
  • ivy-c-dev in version >= 3.8

@@ -47,6 +45,6 @@ exporting some MACRO def)
-Last modified: Thu Oct 7 12:34:09 CEST 2004 +Last modified: Wed Jan 3 10:59:09 CEST 2007 diff --git a/docs/examples/pyhello.py b/docs/examples/pyhello.py index e0db498..d355ba5 100755 --- a/docs/examples/pyhello.py +++ b/docs/examples/pyhello.py @@ -28,7 +28,7 @@ def oncxproc(connected): lprint( "An Ivy application was connected") lprint("currents Ivy application are [%s]", IvyGetApplicationList()) -def ondieproc(id): +def ondieproc(client, id): lprint( "received the order to die with id = %d", id) def onmsgproc(*larg): diff --git a/docs/examples/testIvy.py b/docs/examples/testIvy.py index 6f15517..bd2a753 100644 --- a/docs/examples/testIvy.py +++ b/docs/examples/testIvy.py @@ -1,20 +1,36 @@ #!/usr/bin/env python +# -*- coding: iso-8859-1 -*- +""" +Petit programme de test de la classe Ivy.Ivy +""" + +import logging +livy = logging.getLogger('Ivy') +console = logging.StreamHandler() +formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s') +console.setFormatter(formatter) +livy.addHandler(console) +livy.setLevel(logging.DEBUG) from ivy import Ivy, IvyApplicationAdapter, IvyMessageAdapter class MyApplicationAdapter (IvyApplicationAdapter): def connect(self, ivyclient): print "Connexion de %s"%ivyclient.getName() + def die(self, ivyclient, id): + print "Demande de fin de l'agent recu" class MyMessageAdapter(IvyMessageAdapter): def receive(self, client, *arg): print "Message --> %s"%arg[0] -appAdapter=MyApplicationAdapter() -bus=Ivy("tiny test","Hello World",appAdapter) +appAdapter = MyApplicationAdapter() +#Il ne faut pas mettre d'espace dans le nom de l'application +#sinon die ne fonctionne pas !! +bus = Ivy("tinytest","Hello World",appAdapter) print "Bus %s"%bus bus.start("") bus() -msgAdapter=MyMessageAdapter() -id=bus.bindMsg("([^ ]*) ([^ ]*) ([^ ]*) ([^ ]*)",msgAdapter) +msgAdapter = MyMessageAdapter() +id = bus.bindMsg("([^ ]*) ([^ ]*) ([^ ]*) ([^ ]*)",msgAdapter) bus.theThread.join(5) -id1=bus.bindMsg("(.*)",msgAdapter) +id1 = bus.bindMsg("(.*)",msgAdapter) bus.theThread.join(20) diff --git a/docs/html/index_tpl.html b/docs/html/index_tpl.html index e34148a..edc574e 100644 --- a/docs/html/index_tpl.html +++ b/docs/html/index_tpl.html @@ -20,7 +20,7 @@ installed version of [tcl/tk, adapted version of consequence, ivycpy is not presented as debian package any more. The source package allows to install the software as an OPTional package.

-

This version is strictly compatible with ivy-c [3.2 .. 3.6] and can be +

This version is strictly compatible with ivy-c [3.8] and can be dynamically linked to a new version of ivy-c, if ivy-c api is unchanged which is quite unlikely.

diff --git a/ivy.py b/ivy.py deleted file mode 100644 index 20b570f..0000000 --- a/ivy.py +++ /dev/null @@ -1,225 +0,0 @@ -import threading -# -*- coding: iso-8859-1 -*- - -import ivycpy -import sys -import traceback -class Ivy: - class IvyClient: - def __init__(self, ptr): - self.ptr=ptr - - def getPtr(self): - return self.ptr - - def getName(self): - return ivycpy.IvyGetApplicationName(self.ptr) - - def getHost(self): - return ivycpy.IvyGetApplicationHost(self.ptr) - - def getMessages(self): - return ivycpy.IvyGetApplicationMessages(self.ptr) - - def sendDie(self,message): - ivycpy.IvySendDieMsg(self.ptr) - - def sendDirectMsg(self, id, message): - ivycpy.IvySendDirectMsg(self.ptr,id,message) - - def sendError(self, id, error): - ivycpy.IvySendError(self.ptr,id,error) - - class Domain: - def __init__(self, domainaddr, port): - self.domainaddr=domainaddr - self.port=port - - def __str__(self): - return self.domainaddr+":"+self.port - - def getDomainaddr(self): - return self.domainaddr - - def getPort(self): - return self.port - - def __call__(self): - self.theThread=threading.Thread(target=self.mainloop) - self.theThread.setDaemon(1) - self.theThread.start() - - def __init__(self, name, message, aIvyApplicationListener): - self.lIvyApplicationlisteners=[] - self.dIvyClient={} - self.addApplicationListener(aIvyApplicationListener) - self.sReadyMessage=message - self.sAppName=name - self.dRegexp={} - self.lBindListeners=[] - ivycpy.IvyInit(name, - message, - 0, - self._appliCallback, - self._die) - - def start(self, sdomainbus): - #Todo Creation des objets Domaine - #a partir de la chaine de caracteres - self.sDomainBus=sdomainbus - ivycpy.IvySetBindCallback(self._bindCallback) - ivycpy.IvyStart(sdomainbus) - - def mainloop(self): - ivycpy.IvyMainLoop() - - def _bindCallback(self, client, id, regexp, event): - if (event == ivycpy.IvyAddBind ): - for bl in self.lBindListeners: - bl.bindPerformed(client, id, regexp) - elif (event == ivycpy.IvyRemoveBind ): - for bl in self.lBindListeners: - bl.unbindPerformed(client, id, regexp) - - def addBindListener(self, aBindListener): - self.lBindListeners.append(aBindListener) - - def removeBindListener(self, aBindListener): - self.lBindListeners.remove(aBindListener) - - def addApplicationListener(self, aApplicationListener): - self.lIvyApplicationlisteners.append(aApplicationListener) - - def removeApplicationListener(self, aApplicationListener): - try: - self.lIvyApplicationlisteners.remove(aApplicationListener) - except ValueError, x: - IvyException(str(x))() - - def _appliCallback(self, ivyclient, connected): - if not self.dIvyClient.has_key(ivyclient): - ivyClient=Ivy.IvyClient(ivyclient) - self.dIvyClient[ivyclient]=ivyClient - else: - ivyClient=self.dIvyClient[ivyclient] - - if connected == ivycpy.IvyApplicationConnected: - self._connect(ivyClient) - else: - self._disconnect(ivyClient) - - def _connect(self, *arg): - for listener in self.lIvyApplicationlisteners: - listener.connect(*arg) - - def _disconnect(self, *arg): - for listener in self.lIvyApplicationlisteners: - listener.disconnect(*arg) - - def _die(self,ivyclient): - try: - ivyClient=self.dIvyClient[ivyclient] - except KeyError: - ivyClient=Ivy.IvyClient(ivyclient) - self.dIvyClient[ivyclient]=ivyClient - - for listener in self.lIvyApplicationlisteners: - listener.die(ivyclient) - - def _directMessage(self, ivyclient, *arg): - try: - ivyClient=self.dIvyClient[ivyclient] - except KeyError: - ivyClient=Ivy.IvyClient(ivyclient) - self.dIvyClient[ivyclient]=ivyClient - for listener in self.lIvyApplicationlisteners: - listener.directMessage(ivyClient,*arg) - - def bindMsg(self, regexp, aIvyMessageListener): - id=ivycpy.IvyBindMsg(aIvyMessageListener.receive, - regexp) - self.dRegexp[regexp]=id - return id - - def unBindMsg(self, param): - if type(param) == type(1): - ivycpy.unBindMsg(self, id) - else: - if self.dRegexp.has_key(param): - id=self.dRegexp[param] - ivycpy.unBindMsg(self, id) - else: - IvyException("This expression not existed")() - - def sendMsg(self, message): - return ivycpy.IvySendMsg(message) - - def getSelfIvyClient(self): - return self.getIvyClientsByName(self.sAppName) - - def getIvyClients(self): - livyclient=ivycpy.IvyGetApplicationList().split() - lIvyClient=[] - for client in livyclient: - print "client %s"%client - ivyClient=self.getIvyClientsByName(client) - lIvyClient.append(ivyClient) - return lIvyClient - - def getIvyClientsByName(self, name): - ivyclient=ivycpy.IvyGetApplication(name) - try: - ivyClient=self.dIvyClient[ivyclient] - except KeyError: - ivyClient=IvyClient(ivyclient) - self.dIvyClient[ivyclient]=ivyClient - return ivyClient - -class IvyApplicationAdapter : - """IvyApplicationAdapter - Classe d'objets abstraite définissant l'interface des objets à  fournir à  l'objet de classe Ivy - lors de son initialisation et par les methodes addApplicationListener et removeApplicationListener - """ - - def connect(self,client): - pass - def disconnect(self,client): - pass - def die(self,id): - pass - def directMessage(self, client, id, msg): - pass - -class IvyBindAdapter : - """IvyBindAdapter - Classe d'objets abstraite définissant l'interface des objets - à  fournir à  l'objet de classe Ivy - via addBindListener et removeBindListener - """ - def bindPerformed(self,client, id, regexp): - """ - invoked when a Ivy Client performs a bind - """ - pass - - def unbindPerformed(self,client, id, regexp): - """ - invoked when a Ivy Client performs a unbind - """ - pass - -class IvyMessageAdapter: - def receive(self, client, *arg): - pass - -class IvyException : - def __call__(self): - raise self - - def __str__(self): - return self.message - - def __init__(self, message): - self.message=message - - diff --git a/ivycpy.i b/ivycpy.i deleted file mode 100644 index 4d34a90..0000000 --- a/ivycpy.i +++ /dev/null @@ -1,1149 +0,0 @@ -// SWIG Module for making a python wrapper to C ivy library -// -#- c-mode -#- -// -// warning avoid any phrase starting with "pyIvy -// or ending with MsgAsS" -// or ending with ErrorAsS" -// cause these patterns are patched afterwards in order to neat -// Ivycpy library naming -// - -%module ivycpy - -// part 1 on place ici entre %{%} les inclusions, pre-declarations importantes, -// fonctions locales qui vont etre associées au wrapper ce code sera conservé -// intact par SWIG - -%{ -#include -#include -#include -#include -#include -#include -#include -#include -#include "list.h" - -/* #define MYAPP "ivycpy" */ -/*#include <_tkinter.h> */ - - /* #include */ -%} -// part 1 on place ici les types de donnees faisant partie des elements -// à wrapper - -/* define */ -/* numero par default du bus */ -/* #define DEFAULT_BUS 2010 */ - -/* typedef : debut */ -typedef struct { - IvyClientPtr next; - Client client; - MsgSndPtr msg_send; - char *app_name; - unsigned short app_port; -} *IvyClientPtr; - - -typedef enum { IvyApplicationConnected, IvyApplicationDisconnected } - IvyApplicationEvent; - -typedef enum { IvyAddBind, IvyRemoveBind } IvyBindEvent; - -typedef struct _timer *TimerId; - -/* a voir si a laisser ici */ -/* extern void */ -/* IvyDefaultApplicationCallback( IvyClientPtr app, void *user_data, IvyApplicationEvent event ) ; */ - -/* pour ces callbacks le clientdata sert à ... */ -/* callback appele sur connexion deconnexion d'une appli */ -/* typedef void (*IvyApplicationCallback)( */ -/* IvyClientPtr app, void *user_data, IvyApplicationEvent event); */ - -/* callback appele sur reception de die */ -/* typedef void (*IvyDieCallback)( */ -/* IvyClientPtr app, void *user_data, int id) ; */ - -/* callback appele sur reception de messages normaux */ -/* typedef void (*MsgCallback)( */ -/* IvyClientPtr app, void *user_data, int argc, char **argv ) ; */ - -/* callback appele sur reception de messages directs */ -/* typedef void (*MsgDirectCallback)( IvyClientPtr app, void *user_data, int id, char *msg ) ; */ - -/* identifiant d'une expression reguliere ( Bind/Unbind ) */ -/* typedef struct _msg_rcv *MsgRcvPtr; */ - -/* typedef : fin */ - -/* les fonctions proprement dite : debut */ - -/* filtrage des regexps */ -/* void IvyClasses( int argc, const char **argv); */ - - -/* query sur les applications connectees */ -/* char *IvyGetApplicationName( IvyClientPtr app ); */ -/* char *IvyGetApplicationHost( IvyClientPtr app ); */ -/* IvyClientPtr IvyGetApplication( char *name ); */ -/* char *IvyGetApplicationList(); */ -/* char **IvyGetApplicationMessages( IvyClientPtr app); demande de reception d'un message */ - -/* void *mcb_as_data, cette donnee doit etre passee dans le user_data */ - -/* void IvyUnbindMsg( MsgRcvPtr id ); */ - -/* emission d'un message d'erreur */ -/* void IvySendError( IvyClientPtr app, int id, const char *message); */ - -/* emmission d'un message die pour terminer l'application */ -/* void IvySendDieMsg( IvyClientPtr app ); */ - -/* emission d'un message retourne le nb effectivement emis */ - -/* int IvySendMsg(const char *message); */ - -/* Message Direct Inter-application */ - -/* void IvyBindDirectMsg( MsgDirectCallback callback, void *user_data); */ -/* void IvySendDirectMsg( IvyClientPtr app, int id, char *msg ); */ - -/* qq donnees privees necessaires */ - -/* il faudra ici traiter les pbs de callback de facon propre -voir trash1 ou les exemples sur les callbacks en Python */ - - -// ---------------------------------------------------------------- -// Python helper functions for adding callbacks -// ---------------------------------------------------------------- - -%{ -/* typedef struct { */ -/* PyObject *func, */ -/* void *true_userdata */ -/* } _Userdata4cb , *_PUserdata4cb ; */ -struct _channel { - Channel next; - HANDLE fd; - void *data; - int tobedeleted; - ChannelHandleDelete handle_delete; - ChannelHandleRead handle_read; -}; - - -static Channel channels_list = NULL; - -static int channel_initialized = 0; - -static fd_set open_fds; -static int MainLoop = 1; - - typedef MsgRcvPtr *MsgRcvArray ; - typedef TimerId *TimerIdArray ; - typedef char *Message; - typedef Message *MessagesArray; -/* donnees et fonctions de gestion des infos MsgRcvPtr retournés par - IvyBindMsg */ -static MsgRcvArray msgrcvarray ; -static int bindingid_number = 0 ; - -/* donnees et fonctions de gestion des timer retournés par - TimerRepeatAfter */ -static TimerIdArray timerarray ; -static int timerid_number = 0 ; - -static int lloopmode ; /* 0 if Ivyloop else TkLoop */ - -static int -addRcvMsg(MsgRcvPtr rcvptr) -{ - int i, bindingid ; - for(i=0;i=0 && binding_id < bindingid_number) - return msgrcvarray[binding_id] ; - else - return NULL ; -} -static void -delRcvMsg(int binding_id) -{ - if (binding_id >=0 && binding_id < bindingid_number) - msgrcvarray[binding_id] = NULL ; -} -static void -printmsgrcvarray() -{ - int i; - for(i=0;i=0 && timerid < timerid_number) - return timerarray[timerid] ; - else - return NULL ; -} -static void -delIvyTimer(int timerid) -{ - if (timerid >=0 && timerid < timerid_number) - timerarray[timerid] = NULL ; -} -static void -printtimerarray() -{ - int i; - for(i=0;ifunc ; */ - /* la signature python doit etre proc(n) elle ne retourne rien */ - - descr = SWIG_TypeQuery("IvyClientPtr"); - resultobj = SWIG_NewPointerObj((void *) app, descr, 0); - eventobj = Py_BuildValue("i", (int) event); - arglist = PyTuple_New(2); - PyTuple_SetItem(arglist,0,resultobj); - PyTuple_SetItem(arglist,1,eventobj); - - result = PyEval_CallObject(func,arglist); - Py_DECREF(arglist); - -} -static void -pyIvyApplicationCallback(IvyClientPtr app, void *user_data, - IvyApplicationEvent event) -{ - PyObject *func, *arglist; - PyObject *result, *eventobj; - PyObject *resultobj; - static void *descr = 0; - -#ifdef __DEBUG__ - printf("-pyIvyApplicationCallback\n"); -#endif - func = (PyObject *) user_data; - /* cette verif est inutile ; elle a deja ete faite lors de - l'enregistrement du callback */ - if (!PyCallable_Check(func)) { - PyErr_SetString(PyExc_TypeError, "Need a callable object!"); - return ; - }; - /* user_data->func ; */ - /* la signature python doit etre proc(n) elle ne retourne rien */ - descr = SWIG_TypeQuery("IvyClientPtr"); - resultobj = SWIG_NewPointerObj((void *) app, descr, 0); - eventobj = Py_BuildValue("i", (int) event); - arglist = PyTuple_New(2); - PyTuple_SetItem(arglist,0,resultobj); - PyTuple_SetItem(arglist,1,eventobj); - - result = PyEval_CallObject(func,arglist); - Py_DECREF(arglist); -} - -static void -pyIvyBindCallback(IvyClientPtr app, void *user_data, - int id, char* regexp, IvyBindEvent event) -{ - PyObject *func, *arglist; - PyObject *result, *eventobj, *idobj, *regexpobj; - PyObject *resultobj; - static void *descr = 0; -#ifdef __DEBUG__ - printf("-pyIvyBindCallback\n"); -#endif - func = (PyObject *) user_data; - /* cette verif est inutile ; elle a deja ete faite lors de - l'enregistrement du callback */ - if (!PyCallable_Check(func)) { - PyErr_SetString(PyExc_TypeError, "Need a callable object!"); - return ; - }; - /* user_data->func ; */ - /* la signature python doit etre proc(n) elle ne retourne rien */ - descr = SWIG_TypeQuery("IvyClientPtr"); - resultobj = SWIG_NewPointerObj((void *) app, descr, 0); - - idobj = Py_BuildValue("i", (int) id); - regexpobj=PyString_FromString(regexp); - eventobj = Py_BuildValue("i", (int) event); - arglist = PyTuple_New(4); - - PyTuple_SetItem(arglist,0,resultobj); - PyTuple_SetItem(arglist,1,idobj); - PyTuple_SetItem(arglist,2,regexpobj); - PyTuple_SetItem(arglist,3,eventobj); - - result = PyEval_CallObject(func,arglist); - Py_DECREF(arglist); -} - -static void -pyIvySetBindCallback(PyObject *PyFunc) /* void *user_data, */ -{ - - IvySetBindCallback(pyIvyBindCallback, (void *) PyFunc); - Py_INCREF(PyFunc); -} - -static void -pyIvyDelBindCallback() /* void *user_data, */ -{ - - IvyDelBindCallback(); -} - -static void -pytkIvyDieCallback(IvyClientPtr app, void *user_data, int id) -{ - PyObject *func, *arglist; - PyObject *result, *idobj; - PyObject *resultobj; - static void *descr = 0; - -#ifdef __DEBUG__ - printf("-pytkIvyApplicationCallback\n"); -#endif - - - func = (PyObject *) user_data; - /* cette verif est inutile ; elle a deja ete faite lors de - l'enregistrement du callback */ - if (!PyCallable_Check(func)) { - PyErr_SetString(PyExc_TypeError, "Need a callable object!"); - return ; - }; - /* user_data->func ; */ - /* la signature python doit etre proc(n) elle ne retourne rien */ - - descr = SWIG_TypeQuery("IvyClientPtr"); - resultobj = SWIG_NewPointerObj((void *) app, descr, 0); - idobj = Py_BuildValue("i", (int) id); - - arglist = PyTuple_New(2); - PyTuple_SetItem(arglist,0,resultobj); - PyTuple_SetItem(arglist,1,idobj); - - result = PyEval_CallObject(func,arglist); - Py_DECREF(arglist); - -} -static void -pyIvyDieCallback(IvyClientPtr app, void *user_data, int id) -{ - PyObject *func, *arglist; - PyObject *result, *idobj; - PyObject *resultobj; - static void *descr = 0; - -#ifdef __DEBUG__ - printf("-pyIvyApplicationCallback\n"); -#endif - func = (PyObject *) user_data; - /* cette verif est inutile ; elle a deja ete faite lors de - l'enregistrement du callback */ - if (!PyCallable_Check(func)) { - PyErr_SetString(PyExc_TypeError, "Need a callable object!"); - return ; - }; - /* user_data->func ; */ - /* la signature python doit etre proc(n) elle ne retourne rien */ - - descr = SWIG_TypeQuery("IvyClientPtr"); - resultobj = SWIG_NewPointerObj((void *) app, descr, 0); - idobj = Py_BuildValue("i", (int) id); - - arglist = PyTuple_New(2); - PyTuple_SetItem(arglist,0,resultobj); - PyTuple_SetItem(arglist,1,idobj); - - result = PyEval_CallObject(func,arglist); - Py_DECREF(arglist); -} - - -static void -pytkMsgCallback( IvyClientPtr app, void *user_data, int argc, char **argv ) -{ - PyObject *pyargv ; - int i ; - PyObject *func; - PyObject *result; - PyObject *resultobj; - static void *descr = 0; - -#ifdef __DEBUG__ - printf("-pytkMsgCallback\n"); -#endif - - func = (PyObject *) user_data; - - /* cette verif est inutile ; elle a deja ete faite lors de - l'enregistrement du callback */ - if (!PyCallable_Check(func)) { - PyErr_SetString(PyExc_TypeError, "Need a callable object!"); - return ; - }; - /* user_data->func ; */ - /* la signature python doit etre proc(*arg)) - elle ne retourne rien */ - descr = SWIG_TypeQuery("IvyClientPtr"); - resultobj = SWIG_NewPointerObj((void *) app, descr, 0); - pyargv = PyTuple_New(argc+1); - PyTuple_SetItem(pyargv,0,resultobj); - for (i = 1; i < argc+1; i++) { - PyTuple_SetItem(pyargv,i,PyString_FromString(argv[i-1])); - } - /* this codes is useless; the tuple (pyargv) is directly passed - to the Python call back - arglist = Py_BuildValue("(iO)", argc, pyargv); - result = PyEval_CallObject(func,arglist); - Py_DECREF(arglist); */ - - result = PyEval_CallObject(func, pyargv) ; - Py_DECREF(pyargv); -} - -static void -pyMsgCallback( IvyClientPtr app, void *user_data, int argc, char **argv ) -{ - PyObject *pyargv ; - int i ; - PyObject *func; - PyObject *result; - PyObject *resultobj; - PyObject *chaine; - static void *descr = 0; -#ifdef __DEBUG__ - printf("-pytkMsgCallback\n"); -#endif - - func = (PyObject *) user_data; - - /* cette verif est inutile ; elle a deja ete faite lors de - l'enregistrement du callback */ - if (!PyCallable_Check(func)) { - PyErr_SetString(PyExc_TypeError, "Need a callable object!"); - return ; - }; - /* user_data->func ; */ - /* la signature python doit etre proc(*arg)) - elle ne retourne rien */ - descr = SWIG_TypeQuery("IvyClientPtr"); - resultobj = SWIG_NewPointerObj((void *) app, descr, 0); - pyargv = PyTuple_New(argc+1); - PyTuple_SetItem(pyargv,0,resultobj); - for (i = 1; i < argc+1; i++) { - if (argv[i-1]){ - chaine=PyString_FromString(argv[i-1]); - } - else{ - chaine=PyString_FromString(""); - } - if(PyString_Check(chaine)){ - PyTuple_SetItem(pyargv,i,chaine); - } - else{ - printf("-pytkMsgCallback Error %i\n",i); - } - } - /* this codes is useless; the tuple (pyargv) is directly passed - to the Python call back - */ - result = PyEval_CallObject(func, pyargv) ; - Py_DECREF(pyargv); - /*Py_DECREF(resultobj);*/ -} - -/* jeu de 2 callback fixes (mode tk ou sans (ce sera tjs le même) appellé par - pyIvyBindDirectMsg */ -static void -pytkMsgDirectCallback( IvyClientPtr app, void *user_data, int id, char *msg ) -{ - PyObject *func, *arglist; - PyObject *result; - PyObject *resultobj; - static void *descr = 0; - -#ifdef __DEBUG__ - printf("-pytkMsgDirectCallback\n"); -#endif - - func = (PyObject *) user_data; - - /* cette verif est inutile ; elle a deja ete faite lors de - l'enregistrement du callback */ - if (!PyCallable_Check(func)) { - PyErr_SetString(PyExc_TypeError, "Need a callable object!"); - return ; - }; - /* user_data->func ; */ - /* la signature python doit etre proc(arg)) - elle ne retourne rien */ - descr = SWIG_TypeQuery("IvyClientPtr"); - resultobj= SWIG_NewPointerObj((void *) app, descr, 0); - arglist = PyTuple_New(2); - PyTuple_SetItem(arglist,0,resultobj); - PyTuple_SetItem(arglist,1,PyString_FromString(msg)); - - result = PyEval_CallObject(func,arglist); - Py_DECREF(arglist); - Py_DECREF(resultobj); -} - -static void -pyMsgDirectCallback( IvyClientPtr app, void *user_data, int id, char *msg ) -{ - PyObject *func, *arglist; - PyObject *result; - PyObject *resultobj; - static void *descr = 0; - -#ifdef __DEBUG__ - printf("-pyMsgDirectCallback\n"); -#endif - func = (PyObject *) user_data; - - /* cette verif est inutile ; elle a deja ete faite lors de - l'enregistrement du callback */ - if (!PyCallable_Check(func)) { - PyErr_SetString(PyExc_TypeError, "Need a callable object!"); - return ; - }; - /* user_data->func ; */ - /* la signature python doit etre proc(arg)) - elle ne retourne rien */ - descr = SWIG_TypeQuery("IvyClientPtr"); - resultobj= SWIG_NewPointerObj((void *) app, descr, 0); - arglist = PyTuple_New(2); - PyTuple_SetItem(arglist,0,resultobj); - PyTuple_SetItem(arglist,1,PyString_FromString(msg)); - - result = PyEval_CallObject(func,arglist); - Py_DECREF(arglist); - Py_DECREF(resultobj); -} - -/* facade to IvyBindMsg avoiding vararg problem */ -static int -pyIvyBindMsg (PyObject *PyFunc, const char *msg) /* void *user_data, */ -{ - MsgRcvPtr result ; - int binding_id = -1 ; - - /* le user_data est le pointeur PyFunc */ - if (lloopmode) { - result = IvyBindMsg(pytkMsgCallback, (void *) PyFunc , msg); - } - else { - result = IvyBindMsg(pyMsgCallback, (void *) PyFunc , msg); - } - /* on conserve une trace de result sous la forme d'une table - indexé i -> (result) ; cet indice sera incrémenté et retourné - comme valeur de retour */ -#ifdef __DEBUG__ - printf("-IvyBindMsg retourne %x \n", (int) result); -#endif - binding_id = addRcvMsg(result) ; -#ifdef __DEBUG__ - printmsgrcvarray(); -#endif - Py_INCREF(PyFunc); - Py_INCREF(Py_None) ; - return binding_id ; -} -static void -pyIvyUnBindMsg (int binding_id) -{ /* on passe à pyIvyUnBindMsg l'indexe du MsgRcvPtr retourné par - pyIvyBindMsg */ - MsgRcvPtr rcvid ; - rcvid = getRcvMsg(binding_id) ; - if (rcvid != NULL) { - IvyUnbindMsg(rcvid); - delRcvMsg(binding_id); - }; -#ifdef __DEBUG__ - printmsgrcvarray() ; -#endif -} - -/* facade to IvyBindDirectMsg avoiding vararg problem */ -static void -pyIvyBindDirectMsg (PyObject *PyFunc) /* void *user_data, */ -{ - /* le user_data est le pointeur PyFunc */ - if (lloopmode) { - IvyBindDirectMsg(pytkMsgDirectCallback, (void *) PyFunc); - } - else { - IvyBindDirectMsg(pyMsgDirectCallback, (void *) PyFunc); - } - /* on conserve une trace de result sous la forme d'une table - indexé i -> (result) ; cet indice sera incrémenté et retourné - comme valeur de retour */ -#ifdef __DEBUG__ - printmsgrcvarray(); -#endif - Py_INCREF(PyFunc); - Py_INCREF(Py_None) ; -} - -/* facade to IvySendMsg avoiding vararg problem */ -int -pyIvySendMsg(const char *message) -{ - return(IvySendMsg(message)); -} -void -pyIvySendError( IvyClientPtr app, int id, const char *message) -{ - IvySendError(app,id,message); -} - -/* for ivy timer */ - -static void -pyTimerCallback(TimerId id , void *user_data, unsigned long delta ) -{ - PyObject *func ; - PyObject *result; - -#ifdef __DEBUG__ - printf("-pyTimerCallback\n"); -#endif - func = (PyObject *) user_data; - - /* cette verif est inutile ; elle a deja ete faite lors de - l'enregistrement du callback */ - if (!PyCallable_Check(func)) { - PyErr_SetString(PyExc_TypeError, "Need a callable object!"); - return ; - }; - /* la signature de la fonction python a appellé doit etre - proc() */ - result = PyEval_CallObject(func,NULL); -} -static void -pytkTimerCallback(TimerId id , void *user_data, unsigned long delta ) -{ - PyObject *func ; - PyObject *result; - -#ifdef __DEBUG__ - printf("-pytkTimerCallback\n"); -#endif - - func = (PyObject *) user_data; - - /* cette verif est inutile ; elle a deja ete faite lors de - l'enregistrement du callback */ - if (!PyCallable_Check(func)) { - PyErr_SetString(PyExc_TypeError, "Need a callable object!"); - return ; - }; - /* la signature de la fonction python a appellé doit etre - proc() */ - result = PyEval_CallObject(func,NULL); -} - -/* add an ivy timer */ -/* retourne l'indice du timer pour identification ultérieure */ -static int -pyIvyTimerRepeatAfter(int count, int time, PyObject *PyFunc) -{ - TimerId timer ; - int timerid ; -#ifdef __DEBUG__ - printf("-pyIvyTimerRepeatAfter\n"); -#endif - if (lloopmode) { - timer = TimerRepeatAfter(count, (long) time, pytkTimerCallback, - (void *) PyFunc); - } - else { - timer = TimerRepeatAfter(count, time, pyTimerCallback, - (void *) PyFunc); - } - timerid = addIvyTimer(timer); -#ifdef __DEBUG__ - printtimerarray(); -#endif - Py_INCREF(PyFunc); - Py_INCREF(Py_None) ; - return timerid ; -} -static void -pyIvyTimerModify( int timerid, int time ) -{ - TimerId timer ; - timer = getIvyTimer(timerid); - if (timer != NULL) { - TimerModify(timer, (long) time); - } -} -static void -pyIvyTimerRemove( int timerid) -{ - TimerId timer ; - timer = getIvyTimer(timerid); - if (timer != NULL) { - TimerRemove(timer); - delIvyTimer(timerid); - } -} - -static void -pyIvyStop (void) -{ - MainLoop = 0; -} - -static void -pyIvyChannelHandleRead (fd_set *current) -{ - Channel channel, next; - - IVY_LIST_EACH_SAFE (channels_list, channel, next) { - if (FD_ISSET (channel->fd, current)) { - (*channel->handle_read)(channel,channel->fd,channel->data); - } - } -} - -static void -pyIvyChannelHandleExcpt (fd_set *current) -{ - Channel channel,next; - IVY_LIST_EACH_SAFE (channels_list, channel, next) { - if (FD_ISSET (channel->fd, current)) { - if (channel->handle_delete) - (*channel->handle_delete)(channel->data); -/* IvyChannelClose (channel); */ - } - } -} - -static void -pyIvyChannelDelete (Channel channel) -{ - if (channel->handle_delete) - (*channel->handle_delete) (channel->data); - - FD_CLR (channel->fd, &open_fds); - IVY_LIST_REMOVE (channels_list, channel); -} -static void -pyChannelDefferedDelete () -{ - Channel channel, next; - IVY_LIST_EACH_SAFE (channels_list, channel,next) { - if (channel->tobedeleted ) { - pyIvyChannelDelete (channel); - } - } -} - -/* IvyMainLoop */ -static void -pyIvyMainLoop() -{ - fd_set rdset; - fd_set exset; - int ready; - - while (MainLoop) { - pyChannelDefferedDelete(); - rdset = open_fds; - exset = open_fds; - Py_BEGIN_ALLOW_THREADS - ready = select(64, &rdset, 0, &exset, TimerGetSmallestTimeout()); - Py_END_ALLOW_THREADS - if (ready < 0 && (errno != EINTR)) { - fprintf (stderr, "select error %d\n",errno); - perror("select"); - return; - } - TimerScan(); - if (ready > 0) { - pyIvyChannelHandleExcpt(&exset); - pyIvyChannelHandleRead(&rdset); - continue; - } - } - Py_INCREF(Py_None) ; -} - -/* code repris de ivytcl.h ecrit par FR. Colin et S. Chatty */ - -static void pyIvyChannelInit(void) -{ -#ifdef __DEBUG__ - printf("-pyIvyChannelInit\n"); -#endif -#ifdef WIN32 - int error; -#else - /* pour eviter les plantages quand les autres applis font core-dump */ - signal (SIGPIPE, SIG_IGN); -#endif - if (channel_initialized) return; - - if (!lloopmode){ - FD_ZERO (&open_fds); - } - -#ifdef WIN32 - error = WSAStartup (0x0101, &WsaData); - if (error == SOCKET_ERROR) { - printf ("WSAStartup failed.\n"); - } -#endif - channel_initialized = 1; -} - - -static void -IvyHandleFd(ClientData cd, - int mask) -{ - Channel channel = (Channel)cd; - - /*printf("-handle event %d\n", mask);*/ - if (mask == TCL_READABLE) { - (*channel->handle_read)(channel,channel->fd,channel->data); - } - else if (mask == TCL_EXCEPTION) { - (*channel->handle_delete)(channel->data); - } -} - -static Channel pyIvyChannelSetUp( - HANDLE fd, - void *data, - ChannelHandleDelete handle_delete, - ChannelHandleRead handle_read) -{ - Channel channel; - if (lloopmode) { - channel = (Channel)ckalloc( sizeof (struct _channel) ); /* ckalloc */ - if ( !channel ) { - fprintf(stderr,"NOK Memory Alloc Error\n"); - exit(0); - } - - channel->handle_delete = handle_delete; - channel->handle_read = handle_read; - channel->data = data; - channel->fd = fd; - - /*printf("-Create handle fd %d\n", fd);*/ - /* Py_BEGIN_ALLOW_THREADS*/ - /* ENTER_TCL */ - Tcl_CreateFileHandler(fd, TCL_READABLE|TCL_EXCEPTION, IvyHandleFd, - (ClientData) channel); - /* LEAVE_TCL */ - /* Py_END_ALLOW_THREADS */ - } - else{ - IVY_LIST_ADD (channels_list, channel); - if (!channel) { - fprintf(stderr,"NOK Memory Alloc Error\n"); - exit(0); - } - channel->fd = fd; - channel->tobedeleted = 0; - channel->handle_delete = handle_delete; - channel->handle_read = handle_read; - channel->data = data; - - FD_SET (channel->fd, &open_fds); - } - return channel; -} - -static void pyIvyChannelClose( Channel channel ) -{ -#ifdef __DEBUG__ - printf("-pyIvyChannelClose\n"); -#endif - if (lloopmode) { - if ( channel->handle_delete ) - (*channel->handle_delete)( channel->data ); - Tcl_DeleteFileHandler(channel->fd); - ckfree((char *) channel); - } - else{ - - channel->tobedeleted = 1; - } -} -ChannelInit channel_init = pyIvyChannelInit; -ChannelSetUp channel_setup = pyIvyChannelSetUp; -ChannelClose channel_close = pyIvyChannelClose; - -static void -pyIvyInit( - const char *AppName, /* nom de l'application */ - const char *ready, /* ready Message peut etre NULL */ - int loopmode, /* 1 = mode Tk , 0 = mode Ivyloop */ - PyObject *PyFuncOnCx, /* callback appele sur connection deconnection - d'une appli */ - /* void *data, user data passe au callback */ - PyObject *PyFuncOnDie) /* last change callback before die - void *die_data ) user data */ -{ -#ifdef __DEBUG__ - printf("-pyIvyInit\n"); -#endif - - lloopmode = loopmode ; - if (loopmode == 1) { -/* channel_init = pyIvyChannelInit ; */ -/* channel_setup = pyIvyChannelSetUp; */ -/* channel_close = pyIvyChannelClose; */ - IvyInit(AppName,ready, - pytkIvyApplicationCallback, (void *) PyFuncOnCx, - pytkIvyDieCallback, (void *) PyFuncOnDie); - } - else { - IvyInit(AppName,ready, - pyIvyApplicationCallback, (void *) PyFuncOnCx, - pyIvyDieCallback, (void *) PyFuncOnDie); - } - - Py_INCREF(PyFuncOnCx); - Py_INCREF(PyFuncOnDie); - -} - - -%} - -// part 2 -// on place ici les declarations complementaires : typemap, etc - -// ------------------------------------------------------------------- -// SWIG typemap allowing us to grab a Python callable object -// ------------------------------------------------------------------- - -/* %typemap(python,in) PyObject *PyFunc { */ -/* if (!PyCallable_Check($source)) { */ -/* PyErr_SetString(PyExc_TypeError, "Need a callable object!"); */ -/* return NULL; */ -/* } */ -/* $target = $source; */ -/* } */ - -/* %typemap(python,in) PyObject *PyFuncOnCx { */ -/* if (!PyCallable_Check($source)) { */ -/* PyErr_SetString(PyExc_TypeError, "Need a callable object!"); */ -/* return NULL; */ -/* } */ -/* $target = $source; */ -/* } */ - -/* %typemap(python,in) PyObject *PyFuncOnDie { */ -/* if (!PyCallable_Check($source)) { */ -/* PyErr_SetString(PyExc_TypeError, "Need a callable object!"); */ -/* return NULL; */ -/* } */ -/* $target = $source; */ -/* } */ - -// nouvelle syntaxe SWIG 1.3.x : $target -> $1 et $source -> $input -%typemap(python,in) PyObject *PyFunc { - if (!PyCallable_Check($input)) { - PyErr_SetString(PyExc_TypeError, "Need a callable object!"); - return NULL; - } - $1 = $input; -} - -%typemap(python,in) PyObject *PyFuncOnCx { - if (!PyCallable_Check($input)) { - PyErr_SetString(PyExc_TypeError, "Need a callable object!"); - return NULL; - } - $1 = $input; -} - -%typemap(python,in) PyObject *PyFuncOnDie { - if (!PyCallable_Check($input)) { - PyErr_SetString(PyExc_TypeError, "Need a callable object!"); - return NULL; - } - $1 = $input; -} - -%typemap(python,out) char** { - int size=0, i; - char **msgList; - msgList=$1; - while (*msgList ) - { - /*printf("Message to '%s'\n",*msgList++);*/ - *msgList++; - size++; - } - resultobj=PyTuple_New(size); - msgList=$1; - for (i = 0; i < size; i++) { - PyTuple_SetItem(resultobj,i,PyString_FromString(*msgList++)); - } - $result=resultobj; -} - -// part 3 -// on place ici les donnees, fonctions a wrapper - -void -pyIvyInit( - const char *AppName, /* nom de l'application */ - const char *ready, /* ready Message peut etre NULL */ - int loopmode, - PyObject *PyFuncOnCx, /* callback appele sur connection deconnection - d'une appli */ - /*void *data, user data passe au callback */ - PyObject *PyFuncOnDie); /* last change callback before die */ -/*void *die_data ); user data */ - -int -pyIvyBindMsg (PyObject *PyFunc, const char *msg); -void -pyIvyUnBindMsg (int binding_id); -void -IvyStart (const char*); -void -pyIvyStop (); -int -pyIvySendMsg(const char *message); -void -pyIvyMainLoop(); -char * -IvyGetApplicationList(); -IvyClientPtr -IvyGetApplication( char *name ); - -char * -IvyGetApplicationName( IvyClientPtr app ); -char *IvyGetApplicationHost( IvyClientPtr app ); -char **IvyGetApplicationMessages( IvyClientPtr app); -/* emission d'un message d'erreur */ -void -pyIvySendError( IvyClientPtr app, int id, const char *message); - -/* emission d'un message die pour terminer l'application */ -void -IvySendDieMsg( IvyClientPtr app ); - -/* send and bind direct */ -void -IvySendDirectMsg( IvyClientPtr app, int id, char *msg ); - -/* binddirect a venir */ -void -pyIvyBindDirectMsg (PyObject *PyFunc); - -/* fonction a wrapper concernant les timer */ -int -pyIvyTimerRepeatAfter(int count, int time, PyObject *PyFunc); -void -pyIvyTimerModify( int timerid, int time ); -void -pyIvyTimerRemove( int timerid); - -static void -pyIvySetBindCallback(PyObject *PyFunc); -static void -pyIvyDelBindCallback(); - -// for emacs -// Local Variables: -// mode: C -// indent-tabs-mode: t -// tab-width: 4 -// End: diff --git a/ivycpy_namer.sed b/ivycpy_namer.sed deleted file mode 100644 index 3cde8e7..0000000 --- a/ivycpy_namer.sed +++ /dev/null @@ -1,3 +0,0 @@ -s/^pyIvy/Ivy/g ; -# s/MsgAsS\"/Msg\"/g; -#s/ErrorAsS\"/Error\"/g; diff --git a/list.h b/list.h deleted file mode 100644 index 78eb07e..0000000 --- a/list.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Ivy, C interface - * - * Copyright (C) 1997-2000 - * Centre d'Études de la Navigation Aérienne - * - * Simple lists in C - * - * Authors: François-Régis Colin - * - * $Id$ - * - * Please refer to file version.h for the - * copyright notice regarding this software - */ -#if (__GNUC__ >= 3) -#define TYPEOF(p) typeof (p) -#else -#define TYPEOF(p) void * -#endif - -#define IVY_LIST_ITER( list, p, cond ) \ - p = list; \ - while ( p && (cond) ) p = p->next - - - -#define IVY_LIST_REMOVE( list, p ) \ - { \ - TYPEOF(p) toRemove; \ - if ( list == p ) \ - { \ - list = p->next; \ - free(p);\ - } \ - else \ - {\ - toRemove = p;\ - IVY_LIST_ITER( list, p, ( p->next != toRemove ));\ - if ( p )\ - {\ - /* somme tricky swapping to use a untyped variable */\ - TYPEOF(p) suiv; \ - TYPEOF(p) prec = p;\ - p = toRemove;\ - suiv = p->next;\ - p = prec;\ - p->next = suiv;\ - free(toRemove);\ - }\ - } \ - } - -#define IVY_LIST_ADD(list, p ) \ - if ( p = (TYPEOF(p)) (malloc( sizeof( *p ))))\ - { \ - memset( p, 0 , sizeof( *p ));\ - p->next = list; \ - list = p; \ - } - -#define IVY_LIST_EACH( list, p ) \ - for ( p = list ; p ; p = p -> next ) - -#define IVY_LIST_EACH_SAFE( list, p, next )\ -for ( p = list ; (next = p ? p->next: p ),p ; p = next ) - -#define IVY_LIST_EMPTY( list ) \ - { \ - TYPEOF(list) p; \ - while( list ) \ - { \ - p = list;\ - list = list->next; \ - free(p);\ - } \ - } diff --git a/src/IvyCTest.py b/src/IvyCTest.py new file mode 100644 index 0000000..3b42f4e --- /dev/null +++ b/src/IvyCTest.py @@ -0,0 +1,601 @@ +# -*- coding: iso-8859-1 -*- +############################################################################### +##### fichier contenant le client de BenchMark ############### +##### ce client lit, dans un fichier de configuration, les ############### +##### message et regexp à utiliser ############### +############################################################################### + + +import os +import string +import sys +import math +import threading +import traceback +import time +import Tkinter +import Utils +import random +import getopt +import XmlParser + +# import les modules ivy +import IvyCpy as ivy + +## +# classe MyApplicationAdapter +# classe dérivant de la classe abstraite IvyApplicationAdapter +# cette classe gère la réception des messages relatifs aux applications +# +class MyApplicationAdapter (ivy.IvyApplicationAdapter): + + ## + # méthode __init__ + # méthode initialisant la classe + # @param app_name : nom de l'application + # + def __init__ (self, app_name): + self.app_name = app_name + + ## + # methode connect + # methode appelee sur connection d'un nouveau client au bus ivy + # @param ivyclient : reference au IvyClient se connectant + # + def connect(self, ivyclient): + print "Connexion de %s" % ivyclient.getName() + + ## + # methode disconnect + # methode appelee sur deconnexion d'un client du bus ivy + # @param ivyclient : reference au client se deconnectant + # + def disconnect(self,ivyclient): + if ivyclient != None : + print "Deconnexion de %s" % ivyclient.getName() + + ## + # methode die + # methode appelee sur reception d'un message die + # @param ivyClient : reference au client tuant notre application + # @param id : identifaint sans signification + # + def die(self, ivyClient, id): + clientName = ivyClient.getName () + print 'mort de %s par %s' % (self.app_name, clientName) + if clientName == self.app_name: + sys.exit(0) + + ## + # methode directMessage + # methode appelee sur reception d'un message direct + # @param client : reference au IvyClient appelant + # @param id : identifiant sans signification + # @param msg : le message envoyé + # + def directMessage(self, client, id, msg): + clientName = client.getName () + print "direct message from %s with id %s : %s" %(clientName, id, msg) + + +## +# Clase derivee de Ivy pour surcharge de _die et attribut _client. +# ainsi on peut stopper les abonnements avant arrêt de l'application +# +class CIvyBus (ivy.Ivy): + + ## + # methode __init__ + # Initialisation des parametres de connexion + # @param application_name : nom de l'application + # @param ready : message emis lorsque sur le bus en fin d'initialisation + # @param appAdapter : reference à la 'objet en charge du traitement des messages relatifs aux applications + # @param client : reference à l'application cliente du bus Ivy + # + def __init__ (self, application_name,ready_message,appAdapter, client): + ivy.Ivy.__init__ (self, application_name,ready_message,appAdapter) + self._client = client + + ## + # methode _die + # Surcharge de la methode die de ivy, stop clear et kill des clients. + # cette methode permet l'arret de l'application proprement + # @param ivyclient : reference à l'IvyClient tuant l'application + # @param id : identifiant sans signification + # + def _die (self,ivyclient, id): + self._client.supStopMessage() + ivy.Ivy._die (self, ivyclient, id) + +## +# Cette classe encapsule l'objet bus, instance de CIvyBus, +# l'attribut bus est instancie lors de l'appel de la methode initialize par le client de supervision. +# +class CSuperIvy: + + ## + # methode initialize + # methode d'initialisation d'un bus ivy + # @param application_name : nom de l'application + # @param ready_message : message émis sur fin d'initialisation + # @param appAdapter : reference à l'objet en charge du traitement des messages relatifs aux applications + # @param client : refrence à l'application cliente du bus Ivy + # + def initialize (self, application_name, ready_message, appAdapter, client): + self.bus = CIvyBus (application_name,ready_message,appAdapter, client) + self.bus.setSendToSelf(False) + + ## + # methode start + # methode demarrant le bus Ivy + # @param ivybus : string representant l'adresse Ip et port utiliser pour le broadcast + # + def start (self, ivybus): + self.bus.start (ivybus) + + ## + # methode stop + # arret du bus Ivy + # + def stop (self): + self.bus.stop() + + ## + # methode __call__ + # methode demarrant le thread d'ecoute du bus + # + def __call__ (self): + self.bus () + + ## + # methode bindMsg + # methode d'abonnement à une expression régulière + # @param message : expression régulière pour l'abonnement + # @param adapter : reference à l'objet en charge de la reception des messages + # @return l'identifiant de l'abonnement + # + def bindMsg (self, message, adapter): + return self.bus.bindMsg (message, adapter) + + ## + # methode sendMsg + # methode envoyant un message sur le bus Ivy + # @param request : message envoyer + # @return entier informant de la reussite de p'operation + # + def sendMsg (self, request): + return self.bus.sendMsg (request) + + ## + # methode unBindMsg + # methode desabonnant l'application au message contenu dans param + # @param param : id ou regexp à desabonner + # + def unBindMsg (self, param): + self.bus.unBindMsg (param) + +# instanciation de superbus, l'objet sera ainsi importe lors de "import IvyBus" +superbus = CSuperIvy () + +## +# classe MyMessageTimerAdapter +# classe dérivant de IvyMessageAdapter +# cette classe permet de réagir aux message Timer +# +class MyMessageTimerAdapter (ivy.IvyMessageAdapter): + + ## + # methode __init__ + # methode initialisant la classe + # @param client : l'application cliente du bus ivy + # + def __init__ (self, client): + self._client = client + + ## + # methode receive + # methode traitant les messages arrivant + # @param client : reference au client envoyant le message + # @param arg : argument recu dans le message + # + def receive (self, client, *arg): + try: + self.__topOccured (arg) + except: + traceback.print_exc () + + ## + # methode __topOccured + # methode envoyant au client les informations Timer + # @param arg : infos recu dans le message + # + def __topOccured(self, *arg): + self._client.topOccured(arg) + + +## +# classe MyMessageBenchMarkAdapter +# classe dérivant de IvyMessageAdapter +# cette classe permet de réagir aux message BenchMark +# +class MyMessageBenchMarkAdapter (ivy.IvyMessageAdapter): + + ## + # methode __init__ + # methode initialisant la classe + # @param client : l'application cliente du bus ivy + # + def __init__ (self, client): + self._client = client + + ## + # methode receive + # methode traitant les messages arrivant + # @param client : reference au client envoyant le message + # @param arg : argument recu dans le message + # + def receive (self, client, *arg): + try: + self.__benchMark (arg) + except: + traceback.print_exc () + + ## + # methode __benchMark + # methode envoyant au client les infos recues + # @param arg : infos recues dans le message + # + def __benchMark(self, *arg): + self._client.benchMarkReceive(arg) + +## +# classe MyMessageOtherAdapter +# classe dérivant de IvyMessageAdapter +# cette classe permet de réagir aux messages autres que Timer et BenchMark +# ces messages ont definis dans le fichier de configuration +# +class MyMessageOtherAdapter (ivy.IvyMessageAdapter): + + ## + # methode __init__ + # methode initialisant la classe + # @param client : l'application cliente du bus ivy + # + def __init__ (self, client): + self._client = client + + ## + # methode receive + # methode traitant les messages arrivant + # @param client : reference au client envoyant le message + # @param arg : argument recu dans le message + # + def receive (self, client, *arg): + try: + self.__receiveMsg (arg) + except: + traceback.print_exc () + + ## + # methode __receiveMsg + # methode envoyant au client les infos recues + # @param arg : infos recues dans le message + # + def __receiveMsg(self, *arg): + self._client.receiveMsg(arg) + + + ############################################################################################################################# + + +## +# classe IvyTest +# cette classe est un client Ivy fonctionnant avec ivy-c ou ivy-python +# cette class epermet d'effectuer du benchmark sur les implementations des librairies ivy +# ce client s'abonne à plusieurs types de message dont deux sont importants: +# - Timer qui permet de déclencher un timer +# - BenchMark qui permet de vérifier l'intégriter des données, l'ordre des messages +# - les autres messages servent à tester les performances +# +class IvyTest: + + ## + # methode __init__ + # methode initialisant le client + # @param bus : adresse ip et port pour broadcast + # + def __init__ (self, bus): + # creation CRC calculateur + self.crcCalculator = Utils.CalcCRC() + + # temps de depart + self.startTime = None + + #valeur du timer + self.timer = 0 + + #initialisation de la liste des messages + self.messages = [] + self.dict = [] + + #parsing du fichier Xml + self.properties = XmlParser.property_server() + self.properties.setconfigfile ("Message.xml") + self.properties.readconfig (verbose=0) + + #initialisation du bus ivy + self.supervisionClientBuild("IvyTester" + str(int(time.time())), bus) + self.messageClientBuild() + self.startSup() + + # creation et initialisation de la partie interface graphique + self.tk = Tkinter.Tk () + self.createInterface(self.tk, width=500, height=500) + self.tk.mainloop() + + + + # + # Definition des methodes de supervision appelees par le client de supervision + # supervisionClientBuild: initialisation de la connexion au bus Ivy + # start: methode simulee de demarrage heritee de Daarwin + # __onCnxProc: methode privee appelee lors de l'initialisation + # __onDieProc: methode privee de destruction + + ## + # methode supervisionClientBuild + # construction du client de supervision ivy + # @param app_name : nom de l'application + #@param bus : information adresse de broadcast + # + def supervisionClientBuild(self,app_name, bus): + self.__appAdapter = MyApplicationAdapter(app_name) + self.__application_name = app_name + self.__ivybus = bus + self.__ready_message = "[%s] is ready" % self.__application_name + + superbus.initialize (self.__application_name, self.__ready_message, self.__appAdapter, self) + # Creation des objets domaines a partir du numero de port + superbus.start (self.__ivybus) + + ## + # methode startSup + # lancement du thread d'ecoute du bus ivy + # + def startSup(self): + superbus() + + ## + # methode sendMessage + # methode d'envoi de message + # @param message + # + def sendMessage(self, message): + superbus.sendMsg(message) + + + ## + # methode messageClientBuild + # methode de creation des abonnements + # + def messageClientBuild(self): + print "abonnement aux messages" + #lecture des messages dans le fichiers de config + self.properties.readMessages() + self.timer_adapter = MyMessageTimerAdapter (self) + self.benchMark_adapter = MyMessageBenchMarkAdapter (self) + self.message_other_adapter = MyMessageOtherAdapter (self) + # message de depart et d'arret du timer + self.top_message = superbus.bindMsg("(^Timer) action=([^ ]*)", self.timer_adapter) + # message de test de benchmarking, de stabilite et de robustesse + self.bench_message = superbus.bindMsg("(^BenchMark) Numero=([^ ]*) Message=([^ ]*) CRC=([^ ]*)", self.benchMark_adapter) + + #abonnement aux messages definis dans le fichier xml + for key in self.properties.getRegexp().keys(): + self.messages.append(superbus.bindMsg(str(self.properties.getRegexp()[key]), self.message_other_adapter)) + + + ## + # methode supStopMessage + # methode de destruction des abonnements + # + def supStopMessage(self): + superbus.unBindMsg (self.top_message) + superbus.unBindMsg (self.bench_message) + for id in self.messages : + superbus.unBindMsg (id) + superbus.stop() + print 'desabonnement du client IvyTest' + + ## + # methode topOccured + # methode appelee a reception d'un top de demarrage ou d'arret + # @param argn : infos message + # + def topOccured(self, *argn): + self.event2Applications("processTop",None) + + ## + # methode benchMarkReceive + # methode appelee lors de la reception d'un message de test + # @param arg : infos message + # + def benchMarkReceive(self, *arg): + data = arg[0][0] + self.event2Applications("processBench", data) + + ## + # methode receiveMsg + # methode appelee lors de la reception d'un message de test + # @param arg : infos messages + # + def receiveMsg(self, *arg): + data = arg[0][0] + self.event2Applications("processMessage", data) + + ## + # methode event2Applications + # methode postant les evenements ivy dans la boucle Tk + # @param function : fonction a appelee + # @param args : infos message + # + def event2Applications(self, function, args): + functocallstr = "self.%s" % function + functocall = eval (functocallstr) + try: + if args != None : + self.tk.after_idle (functocall, args) + else : + self.tk.after_idle (functocall) + except: + res = apply (traceback.format_exception, sys.exc_info ()) + print res + + ## + # methode processTop + # methode traitant les tops de depart et de fin + # + def processTop(self): + if self.startTime != None: + self.timer = time.time() - self.startTime + self.benchResult.set(self.timer) + self.startTime = None + print self.dict + self.dict = [] + else: + self.startTime = time.time() + self.timer = None + self.errorResult.set("") + self.currentNumber = 0 + + ## + # methode processBench + # methode traitant un message de benchmark + # @param data : infos benchmark + # + def processBench(self, data): + crc = str(self.crcCalculator.calcCCITTCRC16(data[2])) + if crc != data[3]: + value = self.errorResult.get() + "error crc on message %s" %data[1] + self.errorResult.set(value) + else: + if self.currentNumber != int(data[1]): + value = self.errorResult.get() + "error sequence on message %s" %data[1] + self.errorResult.set(value) + self.currentNumber += 1 + self.avancement.set(str((int(data[1])+1)*100/1000)+"%") + + ## + # methode processMessage + # methode traitant les messages autres que timer et benchmark + # @param data : infos messages + # + def processMessage(self, data): + self.currentNumber += 1 + self.dict.append(data[0]) + + ## + # methode generateMessage + # methode de generation d'un message de benchmark + # @param numero : numero du message + # + def generateMessage(self, numero): + randomNumber = str(random.random()) + crc = str(self.crcCalculator.calcCCITTCRC16(randomNumber)) + message ="BenchMark Numero=%s Message=%s CRC=%s" %(str(numero),randomNumber,crc) + return message + + + ################################################################################################ + + ## + # methode createInterface + # definition de l'interface graphique + # @param root : loopTk + # @param *args, **kw : liste arguments, keyword + # + def createInterface(self, root, *args, **kw): + self.frame = Tkinter.Frame(root, width=250, height=250) + self.frame.pack(expand=1, side='top', fill='both') + + # Menu + menubar = Tkinter.Menu (self.frame) + menubar.add_command (label="Quit", command=self.commandQuit) + root.config (menu=menubar) + + # bouton de lancement de test + buttonTestLaunch = Tkinter.Button (self.frame, text='Launch', command=self.commandLanchTest) + buttonTestLaunch.place (x=85, y=150, width=60, height=20) + + # affichage du resultat du bench Mark + labelBench = Tkinter.Label (self.frame, text="BenchMark") + labelBench.place (x=65, y=45, width=65, height=20) + self.benchResult = Tkinter.IntVar () + self.benchResult.set (0) + entryBenchResult = Tkinter.Entry (self.frame, textvariable=self.benchResult, justify='center') + entryBenchResult.place (x=65, y=60, width=100, height=20) + + # affichage du resultat du bench Mark + labelError = Tkinter.Label (self.frame, text="Error list") + labelError.place (x=60, y=80, width=65, height=20) + self.errorResult = Tkinter.StringVar () + self.errorResult.set ("") + entryErrorResult = Tkinter.Entry (self.frame, textvariable=self.errorResult, justify='center') + entryErrorResult.place (x=65, y=95, width=100, height=20) + + # affichage le pourcentage d'avancement du test + labelAvancement = Tkinter.Label (self.frame, text="Progression") + labelAvancement.place (x=65, y=115, width=70, height=20) + self.avancement = Tkinter.StringVar () + self.avancement.set ("0%") + entryAvancement = Tkinter.Entry (self.frame, textvariable=self.avancement, justify='center') + entryAvancement.place (x=65, y=130, width=100, height=20) + + ## + # methode commandQuit + # cette methode permet de terminer l'application + # + def commandQuit(self): + self.supStopMessage() + self.tk.quit() + sys.exit(0) + + ## + # methode commandLanchTest + # cette methode permet de lancer un test de performance et de coherence + # + def commandLanchTest(self): + self.sendMessage("Timer action=START") + for i in range(1000): + if i % 10 == 0 : + message = self.generateMessage(i) + else : + message = str(self.properties.getRandomMessage()) + self.sendMessage(message) + self.sendMessage("Timer action=STOP") + + +############################################################### +######## lancement du programme ############################### +############################################################### + +if __name__ == '__main__': + print "programme de test de connexion ivy" + bus = "127.255.255.255:2330" + try: + optlist, arg = getopt.getopt (sys.argv[1:], "b:",["bus"]) + except getopt.GetoptError: + print "PARSING ERROR #####################" + print sys.argv[1:] + try: + print arg + except: + print "arg is not defined" + for o, a in optlist: + # Activation des alarmes + if o in ("-b","--bus"): + bus = a + + + test = IvyTest(bus) + \ No newline at end of file diff --git a/src/IvyCpy.py b/src/IvyCpy.py new file mode 100644 index 0000000..f83d432 --- /dev/null +++ b/src/IvyCpy.py @@ -0,0 +1,646 @@ +# -*- coding: iso-8859-1 -*- +REVISION = "$Id: " + +# import +import threading +import ivycpy +import sys +import traceback +import re +import os + +## +# class Ivy +# this class is an Object oriented interface for the Ivy-c Library +# +class Ivy: + + ## + # __init__() + # initialisation method + # this method creates an Ivy Object and initializes an ivybus + # @param name: name of the application to connect + # @param message: the message displayed on connection + # @param aIvyApplicationListener: the reference to the object used to treat connection / disconnection event for applications + # + def __init__(self, name, message, aIvyApplicationListener): + self.lIvyApplicationlisteners=[] + self.dIvyClient={} + self.addApplicationListener(aIvyApplicationListener) + self.sReadyMessage=message + self.sAppName=name + self.dRegexp={} + self.lBindListeners=[] + self.sendToSelf = False + self.selfIvyClient = Ivy.SelfIvyClient(self) + self.dIvyClient[str(self.selfIvyClient)] = self.selfIvyClient + ivycpy.IvyInit(name, + message, + 0, + self._appliCallback, + self._die) + + ## + # method called on instruction Ivy() + # this method creates and starts a thread listening for ivy events + # + def __call__(self): + self.theThread=threading.Thread(target=self.mainloop) + self.theThread.setDaemon(1) + self.theThread.start() + + ## + # this method returns the IvyClient associated to an ivy-c client + # @param ivyclient: the reference of the ivy-c client in the local database + # @return the Ivy.IvyClient object corresponding to the ivyclient identifier + # + def getIvyClient(self, ivyclient): + ivyClient = None + if not self.dIvyClient.has_key(str(ivyclient)): + ivyClient = Ivy.IvyClient(ivyclient) + self.dIvyClient[str(ivyclient)] = ivyClient + else: + ivyClient = self.dIvyClient[str(ivyclient)] + return ivyClient + + ## + # getter of self Ivy client attribute + # @return this IvyClient object + # + def getSelfIvyClient(self): + return self.selfIvyClient + + ## + # getter of an Ivy client using his name + # @param name: name of the client + # @return the reference of the Ivy.IvyClient with the given name + # + def getIvyClientsByName(self, name): + ivyclient = ivycpy.IvyGetApplication(name) + return self.getIvyClient(ivyclient) + + ## + # method returning the ivy-c clients connected to the ivybus + # @return the list of Ivy.IvyClient connected to the ivybus + # + def getIvyClients(self): + lIvyClient = [ self.getIvyClientsByName(client) + for client in ivycpy.IvyGetApplicationList(",").split(",")] + # suppression du dernier element car element vide + lIvyClient.pop() + return lIvyClient + + ## + # methods starting the connection to ivybus + # @param sdomainbus: address used for braodcast + # + def start(self, sdomainbus): + #a partir de la chaine de caracteres + addr, port = sdomainbus.split(":") + self.sDomainBus= Ivy.Domain(addr, port) + ivycpy.IvySetBindCallback(self._bindCallback) + ivycpy.IvyBindDirectMsg(self._directMessage) + ivycpy.IvyStart(sdomainbus) + + ## + # methods stopping the connection to ivybus + # + def stop(self): + ivycpy.IvyStop() + + ## + # method launching the ivy mainloop in charge of listening events on the ivybus + # + def mainloop(self): + ivycpy.IvyMainLoop() + + ## + # method adding a ivy binding event listener to database + # @param aBindListener: listener for ivy event + # + def addBindListener(self, aBindListener): + self.lBindListeners.append(aBindListener) + + ## + # method removing an ivy binding event listener from database + # @param aBindListener: the listener to remove + # + def removeBindListener(self, aBindListener): + self.lBindListeners.remove(aBindListener) + + ## + # method adding application listener to database + # @param aApplicationListener: the listener to application connection + # + def addApplicationListener(self, aApplicationListener): + self.lIvyApplicationlisteners.append(aApplicationListener) + + ## + # method removing application listener from database + # @param aApplicationListener: the listener to remove + # + def removeApplicationListener(self, aApplicationListener): + try: + self.lIvyApplicationlisteners.remove(aApplicationListener) + except ValueError, x: + IvyException(str(x))() + + ## + # protected method called on bindings events + # @param client: reference to the ivy-c subscribing client + # @param id : unique id of the binding + # @param regexp: regular expression to match + # @param event: binding or removal of an existing binding + # + def _bindCallback(self, client, id, regexp, event): + if (event == ivycpy.IvyAddBind ): + for bl in self.lBindListeners: + bl.bindPerformed(client, id, regexp) + elif (event == ivycpy.IvyRemoveBind ): + for bl in self.lBindListeners: + bl.unbindPerformed(client, id, regexp) + + ## + # method called on applications connection + # @param ivyclient: reference to the client connected or disconnected + # @param connected: connection or disconnection + # + def _appliCallback(self, ivyclient, connected): + ivyClient = self.getIvyClient(ivyclient) + if connected == ivycpy.IvyApplicationConnected: + self._connect(ivyClient) + else: + self._disconnect(ivyClient) + + ## + # method calling the connect method of the applications listeners + # @param arg: anything + # + def _connect(self, *arg): + for listener in self.lIvyApplicationlisteners: + listener.connect(*arg) + + ## + # method calling the disconnect method of the applications listeners + # @param arg: anything + # + def _disconnect(self, *arg): + for listener in self.lIvyApplicationlisteners: + listener.disconnect(*arg) + + ## + # method called on die message + # @param ivyclient: reference to the client to kill + # @param id: id of the message + # + def _die(self, ivyclient, id): + ivyClient = self.getIvyClient(ivyclient) + for listener in self.lIvyApplicationlisteners: + listener.die(ivyClient, id) + + ## + # method called on direct message + # @param ivyclient: reference of the client + # @param id: id of the message + # @param msg: the message + # + def _directMessage(self, ivyclient, id, msg): + ivyClient = self.getIvyClient(ivyclient) + for listener in self.lIvyApplicationlisteners: + listener.directMessage(ivyClient, id, msg) + + ## + # method which binds message for application + # @param regexp: the regular expression to match + # @param aIvyMessageListener: the listener to call on reception + # @return the id of the subscription + # + def bindMsg(self, regexp, aIvyMessageListener): + id = ivycpy.IvyBindMsg(aIvyMessageListener.receive,regexp) + self.dRegexp[regexp] = id + self.selfIvyClient.bindMsg(regexp,aIvyMessageListener,id) + return id + + ## + # method which unbinds message for client + # @param param: regexp or id of the message to unbind + # + def unBindMsg(self, param): + if type(param) == type(1): + ivycpy.IvyUnBindMsg(param) + self.selfIvyClient.unbindMsg(param) + else: + if self.dRegexp.has_key(param): + self.selfIvyClient.unbindMsg(param) + id=self.dRegexp[param] + ivycpy.IvyUnBindMsg(id) + else: + IvyException("This expression did not exist")() + + ## + # method sending message on the ivybus + # @param message: the message to send + # @return the result of the operation 0 if error, 1 if ok + # + def sendMsg(self, message): + if self.getSendToSelf() is True: + self.selfIvyClient.sendMsg(message) + return ivycpy.IvySendMsg(message) + + ## + # method sending a die message to the ivy-c client + # @param ivyclient : ivy-c client to kill + # + def sendDie(self, ivyclient): + if type(ivyclient) == type(self.selfIvyClient): + self.selfIvyClient.sendDie() + else: + ivycpy.IvySendDieMsg(ivyclient) + + ## + # methods sending a message directly to a client + # @param ivyclient : the ivy-c client to contact + # @param id : id with no real meanings + # @param message : the message to send + # + def sendDirectMsg(self, ivyclient, id, message): + if type(ivyclient) == type(self.selfIvyClient): + self.selfIvyClient.sendDirectMsg(id, message) + else : + ivycpy.IvySendDirectMsg(ivyclient,id,message) + + ## + # methods sending an error message directly to a client + # @param ivyclient : the ivy-c client to contact + # @param id : id with no real meanings + # @param error : the message to send + # + def sendError(self, ivyclient, id, error): + if type(ivyclient) == type(self.selfIvyClient): + self.selfIvyClient.sendError(id, error) + else: + ivycpy.IvySendError(ivyclient,id,error) + + ## + # method launching a timer + # @param nbticks : number of ticks + # @param delay: delay before launching + # @param callback: method to call at the end + # @return the id of the timer + # + def timer_repeat(self, nbticks, delay, callback): + try: + timerid = ivycpy.IvyTimerRepeatAfter(nbticks, long(delay), callback) + except: + IvyException("An error occurred in IvyTimerRepeatAfter")() + timerid = None + + return (timerid) + + ## + # method modifying the timer + # @param timerid: id of the timer to modify + # @param newdelay: waiting delay + # + def timer_modify(self, timerid, newdelay): + ivycpy.IvyTimerModify(timerid, long(newdelay)) + + ## + # method removing timer + # @param timerid: id of the timer to remove + # + def timer_remove(self, timerid): + ivycpy.IvyTimerRemove(timerid) + + ## + # method setting the value of boolean sendToSelf + # @param value : boolean representing the falg sendToSelf + # + def setSendToSelf(self, value): + self.sendToSelf = value + + ## + # method returning the value of the flag sendToSelf + # @return boolean representing the value of the flag sendToSelf + # + def getSendToSelf(self): + return self.sendToSelf + + ## + # class IvyClient + # this class encapsulates an ivy-c client and gives methodes to access this client + # + class IvyClient: + + ## + # initialisation of the IvyClient + # @param ptr: (ivy-c client) pointer on the ivy-c client + # + def __init__(self, ptr): + self.ptr = ptr + + ## + # getter of the ivy-c client attribute + # @return a pointer on an ivy-c client + # + def getPtr(self): + return self.ptr + + ## + # getter of the ivy-c client name + # @return a string representing the name of the ivy-c client + # + def getName(self): + return ivycpy.IvyGetApplicationName(self.ptr) + + ## + # getter of the ivy-c client host + # @return a string representing the host of the ivy-c client + # + def getHost(self): + return ivycpy.IvyGetApplicationHost(self.ptr) + + ## + # getter of the ivy-c client messages bindings + # @return a table of strings representing the message for this ivy-c client + # + def getMessages(self): + return ivycpy.IvyGetApplicationMessages(self.ptr) + + ## + # method sending a die message to the ivy-c client + # @param ivyclient : ivy-c client to kill + # + def sendDie(self): + ivycpy.IvySendDieMsg(self.ptr) + + ## + # methods sending a message directly to a client + # @param ivyclient : the ivy-c client to contact + # @param id : id with no real meanings + # @param message : the message to send + # + def sendDirectMsg(self, id, message): + ivycpy.IvySendDirectMsg(self.ptr,id,message) + + ## + # methods sending an error message directly to a client + # @param ivyclient : the ivy-c client to contact + # @param id : id with no real meanings + # @param error : the message to send + # + def sendError(self, id, error): + ivycpy.IvySendError(self.ptr,id,error) + + ## + # class SelfIvyClient + # this class works like an IvyClient class but represents the application client + # + class SelfIvyClient(IvyClient): + + ## + # initialization of the SelfIvyClient + # @param ptr: pointer on the Ivy object + # + def __init__(self, ptr): + self.ptr = ptr + self.dBindings = {} + self.dId2Regexp = {} + self.dRegexp2Id = {} + + ## + # getter of the ptr attribute + # @return a pointer on an Ivy object + # + def getPtr(self): + return self.ptr + + ## + # getter of the self Client name + # @return a string representing the name of the selfclient + # + def getName(self): + return self.ptr.sAppName + + ## + # getter of the self Client host + # @return a string representing the host of the selfclient + # + def getHost(self): + return os.uname()[1] + + ## + # getter of the self Client messages bindings + # @return a tuple of strings representing the message for this selfIvyClient + # + def getMessages(self): + return tuple(self.ptr.dRegexp.keys()) + + ## + # method sending a die message to the self Client + # + def sendDie(self): + self.ptr._die(self,0) + + ## + # methods sending a message directly to self Client + # @param id : id with no real meanings + # @param message : the message to send + # + def sendDirectMsg(self, id, message): + self.ptr._directMessage(self,id,message) + + ## + # methods sending an error message directly to self Client + # @param id : id with no real meanings + # @param error : the message to send + # + def sendError(self, id, error): + self.ptr._directMessage(self,id,error) + + ## + # method sending a message to self + # @param message : string representing the message to send + # + def sendMsg(self,message): + for regexp in self.dBindings.keys(): + r = re.compile(regexp) + captures = r.match(message) + if captures: + captures=captures.groups() + if len(captures)==0: + captures='' + self.dBindings[regexp](message) + + ## + # method in charge of treating bindings + # @param regexp : String representing the regular expression to match + # @param aIvyMessageListener : the reference to object to call on reception + # @param id : id with no real meanings + # + def bindMsg(self, regexp, aIvyMessageListener, id): + self.dId2Regexp[id] = regexp + self.dRegexp2Id[regexp] = id + self.dBindings[regexp] = aIvyMessageListener.receive + + ## + # method sending a message to self + # @param message : id or regexp to delete + # + def unbindMsg(self, param): + if type(param) == type(1): + regexp = self.dId2Regexp.pop(param) + self.dRegexp2Id.pop(regexp) + self.dBindings.pop(regexp) + else: + if self.dRegexp.has_key(param): + id = self.dRegexp2Id.pop(param) + self.dRegexp2Id.pop(id) + self.dBindings.pop(param) + else: + IvyException("This expression did not exist")() + + ## + # class domain + # this class contains and allows access to ivybus properties + # + class Domain: + ## + # initialisation method + # @param domainaddr: Ip adress for broadcast + # @param port: port for braodcast + # + def __init__(self, domainaddr, port): + self.domainaddr=domainaddr + self.port=port + + ## + # method call on print + # display address and port used by ivybus + # @return the string to print + # + def __str__(self): + return self.domainaddr+":"+self.port + + ## + # getter of broadcast Ip adress + # @return the IP address + # + def getDomainaddr(self): + return self.domainaddr + + ## + # getter of broadcast port + # @return the IP port + # + def getPort(self): + return self.port + + +## +# IvyApplicationAdapter +# Classe d'objets abstraite definissant l'interface des objets a fournir a l'objet de classe Ivy +# lors de son initialisation et par les methodes addApplicationListener et removeApplicationListener +# +class IvyApplicationAdapter : + + ## + # abstract method called on application connection + # @param client: name of the client + # + def connect(self,client): + pass + + ## + # abstract method called on application disconnection + # @param client: name of the client + # + def disconnect(self,client): + pass + + ## + # abstract method called on die message + # @param client: name of the client + # @param id: id of the message + # + def die(self,client, id): + pass + + ## + # abstract method called on direct message + # @param client: name of the client + # @param id: id of the client + # @param msg: message sent + # + def directMessage(self, client, id, msg): + pass + +## +# IvyBindAdapter +# Classe d'objets abstraite definissant l'interface des objets +# a fournir a l'objet de classe Ivy +# via addBindListener et removeBindListener +# +class IvyBindAdapter : + + ## + # invoked when a Ivy Client performs a bind + # @param client: name of the client + # @param id: id of the client + # @param regexp: regular expression to match + # + def bindPerformed(self,client, id, regexp): + pass + + ## + # invoked when a Ivy Client performs a unbind + # @param client: name of the client + # @param id: id of the client + # @param regexp: regular expression to match + # + def unbindPerformed(self,client, id, regexp): + pass + + +## +# class IvyMessageAdapter +# classe abstraite definissant l'interface a fournir à la classe Ivy +# pour la reception de message +# +class IvyMessageAdapter: + + ## + # invoked when a message matching regexp is send on the bus + # @param client: name of the sender + # @param arg: message received + # + def receive(self, client, *arg): + pass + + +## +# classe gerant les exceptions Ivy +# +class IvyException : + + ## + # on error send an IvyException + # + def __call__(self): + raise self + + ## + # print the message of the exception + # @return the message to print + # + def __str__(self): + return self.message + + ## + # initialisation method + # @param message : the message to print + # + def __init__(self, message): + self.message=message + + diff --git a/src/Message.xml b/src/Message.xml new file mode 100644 index 0000000..4a57fb5 --- /dev/null +++ b/src/Message.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Utils.py b/src/Utils.py new file mode 100644 index 0000000..3618dfd --- /dev/null +++ b/src/Utils.py @@ -0,0 +1,105 @@ +# -*- coding: iso-8859-1 -*- + +############################################################################### +##### fichier contenant la classe en charge du ############### +##### calcul du CRC CCITT16 ############### +############################################################################### + +# imports des modules python a utiliser +import os + +# declaration des constantes à utiliser pour travail sur les bits +CRC_POLYNOMIAL = 0x00102100 +TAIL_CANCELLING_MASK = 0xFFFFFF00 +HEADER_TAIL_CANCELLING_MASK = 0x00FFFF00 +LSB_HEADER_TESTING_MASK = 0x01000000 +NULL_VALUE = 0x00000000 +REMAINDER_CANCELLING_MASK = 0xFF0000FF +INIT_VALUE = 0x00FFFF00 + +## +# classe CalcCRC +# cette classe permet de calculer une CRC CCITT sur 16 bits à partir d'une string +# +class CalcCRC: + + ## + # initialisation des polynomes de controles + # + def __init__(self): + self.CRC_POLYNOMIAL = 0x00102100 + self.cancellingMask = 0xFFFFFF00 + self.testingMask = 0x01000000 + self.value = 0x00000000 + + ## + # methode decalageGauche + # methode effectuant un decalage a gauche des bits de l'attribut value + # le bit de poids le plus fort de tail va dans le bit de poid faible de remainder et le bit de poids fort de remainder + # dans le bit de poids faible du header + # + def decalageGauche(self): + self.value = self.value << 1 + + ## + # methode insertNewValue + # methode permettant d'ajouter a la fin de value la valeur du nouvel octet + # @param byteValue : nouvel octet à mettre à la fin de l'attribut value + # + def insertNewValue(self, byteValue): + intermediaire = self.value & TAIL_CANCELLING_MASK + self.value = intermediaire | byteValue + + ## + # methode remainderDivision + # methode effectuant la division du reste par le polynome de controle + # + def remainderDivision(self): + intermediaire = self.value + intermediaire = intermediaire & HEADER_TAIL_CANCELLING_MASK + intermediaire = intermediaire ^ CRC_POLYNOMIAL + intermediaire = intermediaire & HEADER_TAIL_CANCELLING_MASK + nullRemainder = self.value & REMAINDER_CANCELLING_MASK + self.value = intermediaire | nullRemainder + + ## + # methode calcCCITTCRC16 + # methode calculant le CRC d'un message ASCII et le retournant + # @param message : message dont on veut calculer le CRC + # @return la valeur du CRC + # + def calcCCITTCRC16(self, message): + # initialisation de la variable de calcul + self.value = INIT_VALUE + # pour chaque octet du message effectue le calcul du CRC + for value in message : + self.calcCRC(ord(value)) + + self.calcCRC(0x00) + self.calcCRC(0x00) + + return (self.value & HEADER_TAIL_CANCELLING_MASK) >> 8 + + ## + # methode calcCRC + # methode calculant le reste de la division polynomial + # @param byteValue : nouvel octet + # + def calcCRC(self, byteValue): + # on range la nouvelle valeur dans le registre de calcul self.value + self.insertNewValue(byteValue) + + # on effectue la division + for test in range(8): + self.decalageGauche() + if (self.value & LSB_HEADER_TESTING_MASK) != NULL_VALUE : + self.remainderDivision() + else : + pass + + +if __name__ == '__main__': + message = 'A' + crcCalculator = CalcCRC() + crcCalculator.calcCCITTCRC16(message) + \ No newline at end of file diff --git a/src/XmlParser.py b/src/XmlParser.py new file mode 100644 index 0000000..1af755b --- /dev/null +++ b/src/XmlParser.py @@ -0,0 +1,449 @@ +# -*- coding: iso-8859-1 -*- + +######################################### +######## PARSER XML ##################### +######################################### + +# imports +import sys +import os +import math +import string +import random + +#test du module expat +try: + from xml.parsers import pyexpat +except ImportError: + # Possibly the pyexpat module hasn't been installed; we may be + # running an initial "make test" just after compiling the + # package. Try importing pyexpat directly. + import pyexpat + + +## +# classe entry +# cette classe est un representation d'un noeud en xml (entree) +# +class entry: + + ## + # methode __init__ + # methode initialisant les attributs de la classe + # + def __init__(self): + self.type = '' # Type de la données (déclarée dans DTD) + self.name = '' # Nom de la donnée : si Présence de l'attribut 'name' + self.cdata = '' # Données CDATA de l'élément (entre la balise ouvrante et la balise fermante + self.attribs = {} # Attributs : Clé nom de l'attribut + self.entries = [] # Liste des sous éléments + self.namedentries = {} # Dictionnaire des sous éléments nommés (recherche accélérée) + + ## + # methode setname + # mutateur de l'attribut name + # @param name : nom du noeud + # + def setname(self, name): + self.name = name + + ## + # methode getname + # accesseur à l'attribut name + # @return self.name + # + def getname(self): + return self.name + + ## + # methode setcdata + # mutateur de l'attribut cdata + # @param cdata : données entre balise ouvrantes et fermantes + # + def setcdata(self, cdata): + self.cdata = cdata + + ## + # methode getcdata + # accesseur à l'attribut cdata + # @return self.cdata + # + def getcdata(self): + return self.cdata + + ## + # methode setattribs + # mutateur de l'attribut attribs + # @param attribs : attribut du noeuds + # + def setattribs(self, attribs): + self.attribs = attribs + + ## + # methode getattribs + # accesseur à l'attribut attribs + # @return self.attribs + # + def getattribs(self): + return self.attribs + + ## + # methode hasattrib + # methode verifiant si un attribut de nom attribname est dans la liste des attributs + # @param attribname : nom de l'attribut + # @return true ou false + # + def hasattrib(self, attribname): + if self.attribs.has_key (attribname): + return 1 + else: + return 0 + + ## + # methode findattrib + # methode recherchant un attribut dans la liste et renvoyant sa valeur ou la valeur par default en cas d'abscense + # @param attribname : nom de 'attribut dont on charche la valeur + # @param defaultvalue :valeur a retourner en cas d'abscence de l'attribut + # @return valeur de l'attribut ou la valeur par default + # + def findattrib(self, attribname, defaultvalue): + if self.attribs.has_key (attribname): + return self.attribs[attribname] + else: + return defaultvalue + + ## + # methode findforceattrib + # methode cherchant la valeur d'un attribut et forçant une valeur non nulle comme valeur de retour + # @param attribname: nom de l'attribut + # @param defalutvalue : valeur par default + # @return une valeur non nulle + # + def findforceattrib(self, attribname, defaultvalue): + if self.attribs.has_key (attribname): + ret = self.attribs[attribname] + if ret == None or ret == "": + return defaultvalue + return ret + else: + return defaultvalue + + ## + # methode settype + # mutateur de l'attribut type + # @param type : le type du noeud + # + def settype(self, type): + self.type = type + + ## + # methode gettype + # accesseur à l'attribut type + # @return le type du noeud + # + def gettype(self): + return self.type + + ## + # methode addentry + # methode ajoutant une entry à la liste des sous noeuds + # @param entry : reference au noeud + # @param name : nom du noeuds + # + def addentry(self, entry, name): + self.entries.append (entry) + if name != "": + self.namedentries[name] = entry + + ## + # methode printlevel_recurs + # methode affichant recursivement les attributs se trouvant sous le noeud + # @param level : le niveau du noeud pour debuter l'affichage + # + def printlevel_recurs(self, level): + #affichage des attributs. + space = ' '*level + attstr = '' + for attkey in self.attribs.keys (): + attrib = self.attribs[attkey] + attstrloc = attkey + ' = ' + attrib + ', ' + attstr = attstr + attstrloc + toprint = space + 'Node type : ' + self.type + ', CData : ' + self.cdata + ', Attributes : ' + attstr + try: + print toprint + except: + print "##################################################" + print "Erreur de DUMP" + print self.__dict__ + print "##################################################" + + #affichage des fils. + for entry in self.entries: + entry.printlevel_recurs (level + 1) + + ## + # methode findentry + # methode recherchant un noeud dans la liste des sous noeuds en utilisant son type, un attribut et la valeur de celui-ci + # @param entrytype : type du noeuds recherche + # @param attribname : nom de l'attribut rechercher + # @param attribvalue : valeur de l'attribut + # @return l'attribut trouve ou None + # + def findentry(self, entrytype, attribname, attribvalue): + for entry in self.entries: + if entry.type == entrytype: + if entry.attribs.has_key (attribname): + attrib = entry.attribs[attribname] + if attrib == attribvalue: + return entry + return None + + ## + # methode findtype + # methode rechercahant un noeuds en fnction de son type + # @param entrytype : type du noeud + # @return le noeud ou None + # + def findtype(self, entrytype): + for entry in self.entries: + if entry.type == entrytype: + return entry + return None + + ## + # methode findnamedentry + # methode recherchant un noeud par son nom + # @param entryname : nom du noeud + # @return le noeud ou None + # + def findnamedentry(self, entryname): + if self.namedentries.has_key (entryname): + return self.namedentries[entryname] + else: + return None + + + +# +# Cette classe implemente un l'objet issue de la configuration +# + +## +# classe property_server +# cette classe est en charge de parser le fichier xml et de fournir les informations +# contenu dans le fichiers +# +class property_server: + + ## + # methode __init__ + # initialisation des attributs + # + def __init__(self): + self.configurationread = 0 + self.verbose = 0 + # Parametres de la ligne de commande + self.config_file = 'Message.xml' + self.messageDict = {} + self.regexpDict = {} + + ## + # methode setconfigfile + # mutateur de l'attribut config_file contenant le nom du fichier xml + # @param configfile : nouveau nom du fichier à parser + # + def setconfigfile (self, configfile): + self.config_file = configfile + + ## + # methode readconfig + # methode lisant et parsant le fichier xml + # @param verbose : falg d'affichage du resultat du parsing + # + def readconfig (self, verbose=0): + if self.configurationread != 0: + return + + self.verbose = verbose + self.configurationread = 1 + self.out = Outputter() + self.parser = pyexpat.ParserCreate() + self.parser.StartElementHandler = self.out.startelt + self.parser.EndElementHandler = self.out.endelt + self.parser.CharacterDataHandler = self.out.cdata + self.parser.ProcessingInstructionHandler = self.out.inst + if self.verbose == 1: + print ("Configuration file used : %s" % self.config_file) + self.data = open (self.config_file).read() + self.rv = self.parser.Parse (self.data, 1) + + if self.verbose == 1: + print ("Parser returned %s" % self.rv) + if self.rv == 0: + print ("** Error %s" % self.parser.ErrorCode) + print ("** Line %s" % self.parser.ErrorLineNumber) + print ("** Column %s" % self.parser.ErrorColumnNumber) + print ("** Byte %s" % self.parser.ErrorByteIndex) + print ('Summary of XML parser upcalls:') + print ("start elements: %s" % self.out.startcount) + print ("end elements: %s" % self.out.endcount) + print ("character data: %s" % self.out.cdatacount) + print ("processing instructions: %s" % self.out.instcount) + print ('browsing Tree') + + self.root = self.out.getroot () + + if self.verbose == 1: + self.root.printlevel_recurs (1) + + ## + # methode readMessages + # parsing des messages et regular expressions + # rangement des regexp et messages dans des dictionanires + # + def readMessages(self): + root = self.root.findtype("ivytester") + messages = root.findtype("messages") + i = 0 + for entry in messages.entries: + regexp = entry.findtype("regexp") + msg = entry.findtype("msg") + self.regexpDict[i] = regexp.findattrib("value","") + self.messageDict[i] = msg.findattrib("value","") + i = i+1 + + self.dictionnarySize = i + + ## + # methode getRandomMessage + # methode renvoyant aleatoirement un message du dictionnaire + # @return une string contenant le message à envoyer + # + def getRandomMessage(self): + value = random.randint(0, self.dictionnarySize-1) + return self.messageDict[value] + + ## + # methode getDictionnarySize + # methode renvoyant la taille des dictionnaires + # @return int repesentant le nombre d'element dans les dictionnaires regex et messages + # + def getDictionnarySize(self): + return self.dictionnarySize + + ## + # methode getMessages + # accesseur au dictionnaire de messages + # @return le dictionnaire de message + # + def getMessages(self): + return self.messageDict + + ## + # methode getRegexp + # accesseur au dictionnaire de regexp + # @return le dictionnaire de regexp + # + def getRegexp(self): + return self.regexpDict + + +## +# classe Outputter +# classe permettant la recuperation du parsing du fichier xml +# +class Outputter: + + ## + # methode __init__ + # initialisation des attributs + # + def __init__(self): + self.startcount = 0 + self.endcount = 0 + self.cdatacount = 0 + self.instcount = 0 + self.indlevel = 0 + self.currlevel = {} + new_entry = entry () + self.currlevel[self.indlevel] = new_entry + + ## + # methode startelt + # callaback de recuperation de l'element parse + # @param type : type du noeuds + # @param attrs : attribut du noeuds + # + def startelt(self, type, attrs): + father = self.currlevel[self.indlevel] + self.indlevel = self.indlevel + 1 + new_entry = entry () + self.currlevel[self.indlevel] = new_entry + attribs = {} + name = '' + self.startcount = self.startcount + 1 + if (sys.version[:3] == "1.5"): + for i in range(0, len(attrs), 2): + attribs[attrs[i]] = attrs[i+1] + if attrs[i] == 'name': + name = attrs[i+1] + else: + for attkey in attrs.keys (): + attrib = attrs[attkey] + attribs[attkey] = attrib + if attkey == 'name': + name = attrib + + new_entry.settype (type) + new_entry.setname (name) + new_entry.setattribs (attribs) + if name == '': + father.addentry (new_entry, type) + else: + father.addentry (new_entry, name) + + ## + # methode endelt + # callback appele sur parsing du dernier element + # @param name : nom de l'element (non utilise) + # + def endelt(self, name): + self.indlevel = self.indlevel - 1 + self.endcount = self.endcount + 1 + + ## + # methode cdata + # callback de recuperation des characteres data + # @param data : les characteres data parses + # + def cdata(self, data): + new_entry = self.currlevel[self.indlevel] + new_entry.setcdata (data) + self.cdatacount = self.cdatacount + 1 + + ## + # methode inst + # methode recuperant les instructions de parsing + # @param target : cible de l'instruction + # @param data : donnees recuperees + # + def inst(self, target, data): + self.instcount = self.instcount + 1 + + ## + # methode getroot + # methode recuperrant le noeud racine de l'arbre + # @return noeud racine + # + def getroot(self): + return self.currlevel[0] + + +Properties = property_server () + +if __name__ == '__main__': + print "programme main" + Properties.setconfigfile ("Message.xml") + Properties.readconfig (verbose=0) + Properties.readMessages() + print Properties.getRandomMessage() \ No newline at end of file diff --git a/src/ivycpy.docfile b/src/ivycpy.docfile new file mode 100644 index 0000000..eb56154 --- /dev/null +++ b/src/ivycpy.docfile @@ -0,0 +1,1594 @@ +/** + * SWIG Module for making a python wrapper to C ivy library + * -#- c-mode -#- + * + * warning avoid any phrase starting with "pyIvy + * or ending with MsgAsS" + * or ending with ErrorAsS" + * cause these patterns are patched afterwards in order to neat + * Ivycpy library naming + * this wrapper works only with ivy-c version 3.8.1.1 and higher version + */ + +%module ivycpy + +/* on place ici entre %{%} les inclusions, pre-declarations importantes, + fonctions locales qui vont etre associées au wrapper ce code sera conservé + intact par SWIG */ + +%{ +#include +#include +#include +#include +#include +#include +#include +#include +#include "list.h" + +%} + + +/********************************************************************** + ****************************** PART 1 ******************************** + ******************* définition des types de données ****************** + **********************************************************************/ + +/* part 1 on place ici les types de donnees faisant partie des elements + à wrapper */ + +/** + * définition de la structure pointeur sur IvyClient + * cette structure permet de chainer des clients et de parcourir cette chaine + * par acces au client suivant + */ +typedef struct +{ + /** + * next: pointeur vers le client suivant + */ + IvyClientPtr next; + + /** + * client: reference au client ivy-c + */ + Client client; + + /** + * msg_send: pointeur vers le message envoye + */ + MsgSndPtr msg_send; + + /** + * app_name: nom de l'application + */ + char *app_name; + + /** + * app_port: port tcp pour connexion a l'application + */ + unsigned short app_port; + +}*IvyClientPtr; + + + +/** + * définition des types d'évenement pouvant être envoyer par les applications + * IvyApplicationConnected : evenement de connexion d'une application + * IvyApplicationDisconnected : evenement de deconnexion d'une application + */ +typedef enum {IvyApplicationConnected, IvyApplicationDisconnected} IvyApplicationEvent; + + +/** + * définition des évenement lors des abonnments et désabonnement de message + * IvyAddBind : evenement d'ajout d'un binding par une application + * ivyRemoveBind : evenement de suppression d'un binding par une application + */ +typedef enum {IvyAddBind, IvyRemoveBind} IvyBindEvent; + + +/** + * définition de la structure pointeur sur timer + */ +typedef struct _timer *TimerId; + + /** + * structure définissant les canaux de communication + * cette structure permet de créer une liste chainee de canaux + */ + struct _channel + { + /** + * pointeur vers le canal suivant + */ + Channel next; + + /** + * int representant le numero de socket + */ + HANDLE fd; + + /** + * donnee recuperer sur la socket + */ + void *data; + + /** + * flag de suppression du canal + */ + int tobedeleted; + + /** + * callback declenche par la gestion de boucle sur evenement exception sur le canal + */ + ChannelHandleDelete handle_delete; + + /** + * callback declenche par la gestion de boucle sur donnees pretes sur le canal + */ + ChannelHandleRead handle_read; + }; + + + + /** + * channels_list: pointeur vers le premier element de la liste chaine des canaux + */ + static Channel channels_list = NULL; + + /** + * channel_initialized : flag d'initialisation d'un canal, vaut 1 si canal initialise, 0 sinon + */ + static int channel_initialized = 0; + + /** + * open_fds : file descriptor for socket + */ + static fd_set open_fds; + + /** + * MainLoop : flag pour la mainloop ivy, si MainLoop vaut 1, les evenements sont ecoutes + * sinon, il ne le sont pas + */ + static int MainLoop = 1; + + /** + * definition du type MsgRcvArray + * MsgRcvArray : tableau contenant les structures de donnees + * creer lors d'un abonnement a un message + */ + typedef MsgRcvPtr *MsgRcvArray ; + + /** + * definition du type TimerIdArray + * TimerIdArray : tableau contenant les identifiants des timers + */ + typedef TimerId *TimerIdArray ; + + /** + * definition du type Message + * Message : chaine de caracteres utilise pour les messages + */ + typedef char *Message; + + /** + * definition du type MessagesArray + * MessagesArray: tableau de Message + */ + typedef Message *MessagesArray ; + + + /** + * donnees et fonctions de gestion des infos MsgRcvPtr retournés par IvyBindMsg + * msgrcvarray : tableau utilise pour rangee les structures de donnees pour les abonnements + */ + static MsgRcvArray msgrcvarray ; + + /** + * bindingid_number : entier informant du nombre d'abonnement enregistre + */ + static int bindingid_number = 0 ; + + /** + * donnees et fonctions de gestion des timer retournés par TimerRepeatAfter + * timerarray : tableau contenant les identifiant des timers + */ + static TimerIdArray timerarray ; + + /** + * timerid_number : entier represenetant le nombre de timers + */ + static int timerid_number = 0 ; + + + /********************************************************** + **************** définition des fonctions **************** + **************** permettant la gestion des *************** + **************** bases de messages et timers ************* + **********************************************************/ + + /** + * fonction addRcvMsg() + * cette fonction permet d'ajouter un abonnement dans le tableau + * @param rcvptr, pointeur vers le message + * @return int représentant l'identifiant du message dans la base + **/ + static int addRcvMsg(MsgRcvPtr rcvptr) + { + int i, bindingid ; + /* loop on the msgarray to find free slots */ + for(i=0;i=0 && binding_id < bindingid_number) + return msgrcvarray[binding_id] ; + else + return NULL ; + } + + + /** + * fonction delRcvMsg() + * cette fonction permet de supprimer un abonnement de la base + * @param binding_id : identifiant de l'abonnement dans la base + */ + static void delRcvMsg(int binding_id) + { + if (binding_id >=0 && binding_id < bindingid_number) + msgrcvarray[binding_id] = NULL ; + } + + + /** + * fonction printmsgrcvarray() + * cette fonction affiche sur la sortie standard le contenu du tableau de message + */ + static void printmsgrcvarray() + { + int i; + for(i=0;i=0 && timerid < timerid_number) + return timerarray[timerid] ; + else + return NULL ; + } + + + /** + * fonction delIvyTimer() + * cette fonction permet de supprimer un timer de la base par son identifiant + * @param timerid : identifiant du timer + */ + static void delIvyTimer(int timerid) + { + if (timerid >=0 && timerid < timerid_number) + timerarray[timerid] = NULL ; + } + + + /** + * fonction printtimerarray() + * cette fonction permet d'afficher sur la sortie standard le contenu de la base de timers + */ + static void printtimerarray() + { + int i; + for(i=0;ifunc ; */ + /* la signature python doit etre proc(n) elle ne retourne rien */ + descr = SWIG_TypeQuery("IvyClientPtr"); + resultobj = SWIG_NewPointerObj((void *) app, descr, 0); + eventobj = Py_BuildValue("i", (int) event); + arglist = PyTuple_New(2); + PyTuple_SetItem(arglist,0,resultobj); + PyTuple_SetItem(arglist,1,eventobj); + + result = PyEval_CallObject(func,arglist); + if (!result) + { + PyErr_Print(); + }; + Py_DECREF(arglist); + } + + + /** + * fonction pyIvyBindCallback() + * cette fonction est le callback appele sur chaque abonnement ou desabonnement à un message + * @param app : pointeur sur le client s'abonnant ou se desabonnant + * @param user_data : pointeur vers la fonction appelee lors de cet abonnement/desabonnement + * @param id : identifiant de l'abonnement + * @param regexp : expression reguliere auquel le client s'abonne ou se desabonne + * @param event : evenement d'abonnement/desabonnement + */ + static void pyIvyBindCallback(IvyClientPtr app, + void *user_data, + int id, + char* regexp, + IvyBindEvent event) + { + PyObject *func, *arglist; + PyObject *result, *eventobj, *idobj, *regexpobj; + PyObject *resultobj; + static void *descr = 0; +#ifdef __DEBUG__ + printf("-pyIvyBindCallback\n"); +#endif + func = (PyObject *) user_data; + /* cette verif est inutile ; elle a deja ete faite lors de + l'enregistrement du callback */ + if (!PyCallable_Check(func)) + { + PyErr_SetString(PyExc_TypeError, "Need a callable object!"); + return ; + }; + /* user_data->func ; */ + /* la signature python doit etre proc(n) elle ne retourne rien */ + descr = SWIG_TypeQuery("IvyClientPtr"); + resultobj = SWIG_NewPointerObj((void *) app, descr, 0); + + idobj = Py_BuildValue("i", (int) id); + regexpobj=PyString_FromString(regexp); + eventobj = Py_BuildValue("i", (int) event); + arglist = PyTuple_New(4); + + PyTuple_SetItem(arglist,0,resultobj); + PyTuple_SetItem(arglist,1,idobj); + PyTuple_SetItem(arglist,2,regexpobj); + PyTuple_SetItem(arglist,3,eventobj); + + result = PyEval_CallObject(func,arglist); + if (!result) + { + PyErr_Print(); + }; + Py_DECREF(arglist); + } + + + /** + * fonction pyIvyDieCallback() + * cette fonction est le callback appele lors d'un message die + * @param app : le client envoyant le message + * @param user_data : fonction appelee lors d'une reception de message + * @param id : identifiant non utilise + */ + static void pyIvyDieCallback(IvyClientPtr app, + void *user_data, + int id) + { + PyObject *func, *arglist; + PyObject *result, *idobj; + PyObject *resultobj; + static void *descr = 0; +#ifdef __DEBUG__ + printf("-pyIvyDieCallback\n"); +#endif + func = (PyObject *) user_data; + /* cette verif est inutile ; elle a deja ete faite lors de + l'enregistrement du callback */ + if (!PyCallable_Check(func)) + { + PyErr_SetString(PyExc_TypeError, "Need a callable object!"); + return ; + }; + /* user_data->func ; */ + /* la signature python doit etre proc(n) elle ne retourne rien */ + /* + arglist = Py_BuildValue("(i)", id); + result = PyEval_CallObject(func,arglist); + Py_DECREF(arglist); + */ + descr = SWIG_TypeQuery("IvyClientPtr"); + resultobj = SWIG_NewPointerObj((void *) app, descr, 0); + idobj = Py_BuildValue("i", (int) id); + + arglist = PyTuple_New(2); + PyTuple_SetItem(arglist,0,resultobj); + PyTuple_SetItem(arglist,1,idobj); + + result = PyEval_CallObject(func,arglist); + if (!result) + { + PyErr_Print(); + }; + Py_DECREF(arglist); + } + + + /** + * fonction pyMsgCallback() + * cette fonction est le callback appele lors d'une reception de message + * @param app : le client appelant + * @param user_data : la fonction a appele lors de la reception de message + * @param argc : nombre de parametres envoyes dans le message + * @param argv : tableau de chaine de caractere contenant les elements du message + */ + static void pyMsgCallback( IvyClientPtr app, void *user_data, int argc, char **argv ) + { + PyObject *pyargv ; + int i ; + PyObject *func; + PyObject *result; + PyObject *resultobj; + PyObject *chaine; + static void *descr = 0; +#ifdef __DEBUG__ + printf("-pyMsgCallback\n"); +#endif + + func = (PyObject *) user_data; + + /* cette verif est inutile ; elle a deja ete faite lors de + l'enregistrement du callback */ + if (!PyCallable_Check(func)) + { + PyErr_SetString(PyExc_TypeError, "Need a callable object!"); + return ; + }; + /* user_data->func ; */ + /* la signature python doit etre proc(*arg)) + elle ne retourne rien */ + descr = SWIG_TypeQuery("IvyClientPtr"); + resultobj = SWIG_NewPointerObj((void *) app, descr, 0); + pyargv = PyTuple_New(argc+1); + PyTuple_SetItem(pyargv,0,resultobj); + for (i = 1; i < argc+1; i++) + { + if (argv[i-1]) + { + chaine=PyString_FromString(argv[i-1]); + } + else + { + chaine=PyString_FromString(""); + } + + if(PyString_Check(chaine)) + { + PyTuple_SetItem(pyargv,i,chaine); + } + else + { + printf("-pytkMsgCallback Error %i\n",i); + } + } + + /* this codes is useless; the tuple (pyargv) is directly passed + to the Python call back + */ + result = PyEval_CallObject(func, pyargv) ; + if (!result) + { + PyErr_Print(); + }; + Py_DECREF(pyargv); + /*Py_DECREF(resultobj);*/ + } + + + /** + * fonction pyMsgDirectCallback() + * cette fonction est le callback appele lors d'une reception d'un message direct + * @param app : le clieant appelant + * @param user_data : la fonction a appelee sur cette reception + * @param id : identifiant utilise pour message en plusieurs partie, sinon inutile + * @param msg : chaine de caractere representant le message + */ + static void pyMsgDirectCallback(IvyClientPtr app, + void *user_data, + int id, + char *msg ) + { + PyObject *func, *arglist; + PyObject *result, *idobj; + // modification olivier : ajout d'un parametre + //PyObject *result; + PyObject *resultobj; + static void *descr = 0; + +#ifdef __DEBUG__ + printf("-pyMsgDirectCallback\n"); +#endif + func = (PyObject *) user_data; + + /* cette verif est inutile ; elle a deja ete faite lors de + l'enregistrement du callback */ + if (!PyCallable_Check(func)) + { + PyErr_SetString(PyExc_TypeError, "Need a callable object!"); + return ; + }; + /* user_data->func ; */ + /* la signature python doit etre proc(arg)) + elle ne retourne rien */ + descr = SWIG_TypeQuery("IvyClientPtr"); + resultobj= SWIG_NewPointerObj((void *) app, descr, 0); + idobj = Py_BuildValue("i", (int) id); + // modification olivier : ajout d'un element au tuple + arglist = PyTuple_New(3); + //arglist = PyTuple_New(2); + PyTuple_SetItem(arglist,0,resultobj); + PyTuple_SetItem(arglist,1,idobj); + // modification olivier : ajout de l'identifiant dans le tuple + //PyTuple_SetItem(arglist,1,PyString_FromString(msg)); + PyTuple_SetItem(arglist,2,PyString_FromString(msg)); + + result = PyEval_CallObject(func,arglist); + if (!result) + { + PyErr_Print(); + }; + Py_DECREF(arglist); + Py_DECREF(resultobj); + } + + + + /** + * fonction pyTimerCallback() + * cette fonction est la callback appelee lors d'un repeat after sur un timer + * @param id : identifiant du timer sur lequel l'operation a eu lieu + * @param user_data : pointeur sur la fonction à appeler sur l'application + * @param delta : entier representant le resultat du timer + */ + static void pyTimerCallback(TimerId id, + void *user_data, + unsigned long delta) + { + PyObject *func ; + PyObject *result; + +#ifdef __DEBUG__ + printf("-pyTimerCallback\n"); +#endif + func = (PyObject *) user_data; + + /* cette verif est inutile ; elle a deja ete faite lors de + l'enregistrement du callback */ + if (!PyCallable_Check(func)) + { + PyErr_SetString(PyExc_TypeError, "Need a callable object!"); + return ; + }; + /* la signature de la fonction python a appellé doit etre + proc() */ + result = PyEval_CallObject(func,NULL); + } + + + /************************************************************ + ************* End functions matching C callbacks *********** + ************************************************************/ + + + /************************************************************* + **************** FUNCTIONS FOR IVY CHANNELS ***************** + *************************************************************/ + + /** + * fonction pyIvyChannelHandleRead() + * cette fonction est en charge de la gestion de la lecture sur la socket + * @param current : le file descriptor courant + */ + static void pyIvyChannelHandleRead (fd_set *current) + { + Channel channel, next; + + IVY_LIST_EACH_SAFE (channels_list, channel, next) + { + if (FD_ISSET (channel->fd, current)) + { + (*channel->handle_read)(channel,channel->fd,channel->data); + } + } + } + + /** + * fonction pyIvyChannelHandleExcpt() + * fonction gérant les exceptions lors de la lecture/ecriture sur la socket + * @param current : le file descriptor courant + */ + static void pyIvyChannelHandleExcpt (fd_set *current) + { + Channel channel,next; + IVY_LIST_EACH_SAFE (channels_list, channel, next) + { + if (FD_ISSET (channel->fd, current)) + { + if (channel->handle_delete) + (*channel->handle_delete)(channel->data); + } + } + } + + + /** + * fonction pyIvyChannelDelete() + * fonction permettant la suppression d'un canal de communication + * @param channel : le canal à supprimer + */ + static void pyIvyChannelDelete (Channel channel) + { + if (channel->handle_delete) + (*channel->handle_delete) (channel->data); + + FD_CLR (channel->fd, &open_fds); + IVY_LIST_REMOVE (channels_list, channel); + } + + + /** + * fonction pyChannelDefferedDelete() + * fonction permettant la suppression de l'ensemble des canaux + * marquer à supprimer + */ + static void pyChannelDefferedDelete () + { + Channel channel, next; + IVY_LIST_EACH_SAFE (channels_list, channel,next) + { + if (channel->tobedeleted ) + { + pyIvyChannelDelete (channel); + } + } + } + + + /** + * fonction IvyChannelInit() + * cette fonction est appele pour la création d'un canal de communication + * c'est la librairie ivy-c qui appelle cette fonction + * function called by the library ivy-c + * defined as extern in ivychannel.h + * initialisation d'un canal + */ + void IvyChannelInit(void) + { + +#ifdef __DEBUG__ + printf("-IvyChannelInit\n"); +#endif +#ifdef WIN32 + int error; +#else + /* pour eviter les plantages quand les autres applis font core-dump */ + signal (SIGPIPE, SIG_IGN); +#endif + if (channel_initialized) return; + + /* loopmode test removed */ + FD_ZERO (&open_fds); + +#ifdef WIN32 + error = WSAStartup (0x0101, &WsaData); + if (error == SOCKET_ERROR) + { + printf ("WSAStartup failed.\n"); + } +#endif + channel_initialized = 1; + } + + + + /** + * fonction IvyChannelStop() + * fonction appelee par la librairie ivy-c + * arret de la mainloop ivy + */ + void IvyChannelStop() + { + MainLoop = 0; + } + + + /** + * fonction IvyChannelAdd() + * fonction ajoutant un nouveau canal de communication à la liste + * @param fd : identifiant du file descriptor + * @param data : buffer de donnee à remplir + * @param handle_delete : fonction à appeler lors d'une suppression du canal + * @param handle_read : fonction à appeler lors de la lecture sur le canal + * @return une structure de donnee de type channel + */ + /* ajout d'un canal */ + Channel IvyChannelAdd(HANDLE fd, + void *data, + ChannelHandleDelete handle_delete, + ChannelHandleRead handle_read) + { + Channel channel; + /* loopmode test removed */ + IVY_LIST_ADD (channels_list, channel); + if (!channel) + { + fprintf(stderr,"NOK Memory Alloc Error\n"); + exit(0); + } + channel->fd = fd; + channel->tobedeleted = 0; + channel->handle_delete = handle_delete; + channel->handle_read = handle_read; + channel->data = data; + + FD_SET (channel->fd, &open_fds); + + return channel; + } + + + + /** + * fonction IvyChannelRemove() + * fonction appelee par la librairie ivy-c + * elle permet de supprimer un canal en plçant le flag tobedeleted à 1 + * @param channel : pointeur vers la structure de donnes du canal + */ + /* suppression d'un canal */ + void IvyChannelRemove(Channel channel) + { +#ifdef __DEBUG__ + printf("-IvyChannelRemove\n"); +#endif + /* loopmode test removed */ + channel->tobedeleted = 1; + } + + + + /************************************************************* + ******************** END IVY CHANNELS *********************** + *************************************************************/ + + + /**************************************************** + ************* FACADE FOR IVY METHODS *************** + ****************************************************/ + + /** + * fonction pyIvyInit() + + * cette fonction permet d'initialiser une connexion au bus Ivy + * cette fonction est une facade pour la fonction IvyInit() de la + * librairie ivy-c + * @param AppName : chaine de caractere representant + * le nom de l'application a connecter + * @param ready : chaine de caractere representant le message + * envoyer lors d'une connexion + * @param loopmode : entier permettant de fonctionner sur le thread + * de la boucle tk ou sur un thread à part ce parametre doit être + * mis à zero, car le mode fonctionnant avec le thread tk n'existe + * plus + * @param pyFuncOnCx : pointeur sur la fonction appelee lors d'une + * connexion d'une application au bus ivy + * @param PyFuncOnDie : pointeur sur la fonction a appele lors d'un + * DIE message + */ + + static void pyIvyInit(const char *AppName, /* nom de l'application */ + const char *ready, /* ready Message peut etre NULL */ + int loopmode, /* 1 = mode Tk (obsolete) , 0 = mode Ivyloop */ + PyObject *PyFuncOnCx, /* callback appele sur connection deconnection d'une appli */ + PyObject *PyFuncOnDie) /* last change callback before die */ + { + +#ifdef __DEBUG__ + printf("-pyIvyInit\n"); +#endif + IvyInit(AppName,ready, + pyIvyApplicationCallback, (void *) PyFuncOnCx, + pyIvyDieCallback, (void *) PyFuncOnDie); + + Py_INCREF(PyFuncOnCx); + Py_INCREF(PyFuncOnDie); + } + + + + /** + * fonction pyIvySetBindCallBack() + * cette fonction permet de donner la callback a appele lors d'un bind + * cette fonction est la facade de la fonction IvySetBindCallback() + * @param PyFunc: pointeur sur la callback appelee lors d'un bind + */ + static void pyIvySetBindCallback(PyObject *PyFunc) + { + IvySetBindCallback(pyIvyBindCallback, (void *) PyFunc); + Py_INCREF(PyFunc); + } + + + /** + * fonction pyIvyDelBindCallback() + * cette fonction permet de reseter la callback appelee lors d'un bind + * cette fonction est une facade de la fonction IvySetBindCallback() + * @TODO cette fonction ne marche peut être pas, il faudrait la tester et la corriger le cas échéant + */ + static void pyIvyDelBindCallback() + { + IvySetBindCallback(NULL, NULL); + } + + + /** + * fonction pyIvyStart() + * cette fonction permet de demarrer une application ivy + * cette fonction est une facade de la fonction IvyStart() + * @param appname : chaine de caractere representant le nom de l'application a demarrer + */ + static void pyIvyStart (const char* appname) + { + IvyStart(appname); + MainLoop = 1; + } + + /** + * fonction pyIvystop() + * cette fonction permet d'arreter une application + * cette fonction est une facade pour la fonction IvyStop() de la librairie ivt-c + */ + static void pyIvyStop (void) + { + IvyStop(); + } + + + /** + * fonction pyIvyGetApplicationName() + * cette fonction permet de recuperer le nom d'une application cliente + * cette fonction est uen facade de la fonction IvyGetApplicationName() de la librairie ivy-c + * @param app : pointeur vers le client dont on veur recuperer le nom + * @return une chane de caracteres representant le nom de l'application + */ + static char* pyIvyGetApplicationName(IvyClientPtr app) + { + return IvyGetApplicationName(app); + } + + + /** + * fonction pyIvyGetApplicationHost() + * cette fonction permet de recuperer la machine hote du client ivy passe en parametre + * cette fonction est une facade de la fonction IvyGetApplicationHost() de la librairie ivy-c + * @param app : pointeur vers le client ivy + * @return une chaine de caracteres representant le nom de la machine hote du client + */ + static char* pyIvyGetApplicationHost(IvyClientPtr app) + { + return IvyGetApplicationHost(app); + } + + + /** + * fonction pyIvyGetApplication() + * cette fonction permet de recuperer un une reference a un client ivy à partir de son nom + * cette fonction est uen facade de la fonction IvyGetApplication() de la librairie ivy-c + * @param name : chaine de caracteres represenatnt le nom de l'application + * @return une reference au client ivy + */ + static IvyClientPtr pyIvyGetApplication(char *name) + { + return IvyGetApplication(name); + } + + + /** + * fonction pyIvyGetApplicationList() + * cette fonction permet de recuperer la liste des clients connectes au bus ivy + * cette fonction est uen facade de la fonction IvygetApplicationList() de la librairie ivy-c + * @param sep : chaine de caractere representant le separateur a mettre entre les noms d'application + * @return chaine de caracteres representant la liste des clients connectes separes par le separateur + */ + static char* pyIvyGetApplicationList(const char* sep) + { + return IvyGetApplicationList(sep); + } + + + /** + * fonction pyIvyGetApplicationMessages() + * cette fonction permet de recuperer la liste des abonnements d'un client + * cette fonction est une facade de la fonction IvyGetApplicationMessages() de la libraire ivy-c + * @param app : refreence au client dnt on desire recuperer les abonnements + * @return un tableau de chaines de caracteres represenatnt les differents abonnements + */ + static char** pyIvyGetApplicationMessages(IvyClientPtr app) + { + return IvyGetApplicationMessages(app); + } + + + /** + * fonction pyIvyBindMsg() + * cette fonction permet de s'abonner à un type de message afin de declencher une action sur la reception + * cette fonction est une facade de IvyBindMsg() evitat le problème de vararg + * @param PyFunc : pointeur vers la callback à declencher sur recption d'un message + * @param msg : chaine de caracteres representant le message auquel on s'abonne (ce message est generalement une expression reguliere) + * @return une entier representant le numero de l'abonnement + */ + static int pyIvyBindMsg (PyObject *PyFunc, + const char *msg) + { + MsgRcvPtr result ; + int binding_id = -1 ; + + result = IvyBindMsg(pyMsgCallback, (void *) PyFunc , msg); + + /* on conserve une trace de result sous la forme d'une table + indexé i -> (result) ; cet indice sera incrémenté et retourné + comme valeur de retour */ +#ifdef __DEBUG__ + printf("-IvyBindMsg retourne %x \n", (int) result); +#endif + binding_id = addRcvMsg(result) ; +#ifdef __DEBUG__ + printmsgrcvarray(); +#endif + Py_INCREF(PyFunc); + Py_INCREF(Py_None) ; + return binding_id ; + } + + + /** + * fonction pyIvyUnbindMsg() + * cette fonction permet de se desabonner a un type de message + * cette fonction est une facade de IvyUnbindMsg() de la libraire ivy-c + * @param binding_id : entier representant le numero de l'abonnement que l'on veut arreter + */ + static void pyIvyUnBindMsg (int binding_id) + { + /* on passe à pyIvyUnBindMsg l'indexe du MsgRcvPtr retourné par + pyIvyBindMsg */ + MsgRcvPtr rcvid ; + rcvid = getRcvMsg(binding_id) ; + if (rcvid != NULL) + { + IvyUnbindMsg(rcvid); + delRcvMsg(binding_id); + }; +#ifdef __DEBUG__ + printmsgrcvarray() ; +#endif + } + + + /** + * fonction pyIvySendError() + * cette fonction permet d'envoyer un message d'erreur à un client donner + * cette fonction est une facade de IvySendError() de la librairie ivy-c + * @param app : refrence du client auquel on envoie le message + * @param id : identifiant lié au message + * @param message : chaine de caracteres representant le message d'erreur + */ + void pyIvySendError(IvyClientPtr app, + int id, + const char *message) + { + IvySendError(app,id,message); + } + + + /** + * fonction IvySendDieMsg() + * cette fonction permet de tuer un client via le bus ivy par un envoi d'un message DIE + * cette fonction est une facade de la fonction IvySendDieMsg() de la librairie ivy-c + * @param app : refrence au client à tuer + */ + static void pyIvySendDieMsg(IvyClientPtr app) + { + IvySendDieMsg(app); + } + + + /** + * fonction pyIvySendMsg() + * cette fonction permet d'envoyer un message sue le bus ivy + * cette fonction est une facade de IvySendMsg() évitant le problème de vararg + * @param message : chaine de cracteres representant le message à envoyer + * @return une entier indiquent si l'envoi c'est bien passer + */ + int pyIvySendMsg(const char *message) + { + return(IvySendMsg(message)); + } + + + /** + * fonction pyIvyBindDirectMsg() + * cette fonction permet de s'abonner au message directe entre application + * cette fonction est une facade de IvyBindDirectMsg() évitant le problème de vararg + * @param PyFunc : pointeur sur la callback à appeler lors d'un message direct + */ + static void pyIvyBindDirectMsg (PyObject *PyFunc) + { + /* le user_data est le pointeur PyFunc */ + IvyBindDirectMsg(pyMsgDirectCallback, (void *) PyFunc); + /* on conserve une trace de result sous la forme d'une table + indexé i -> (result) ; cet indice sera incrémenté et retourné + comme valeur de retour */ +#ifdef __DEBUG__ + printmsgrcvarray(); +#endif + Py_INCREF(PyFunc); + Py_INCREF(Py_None) ; + } + + + /** + * fonction pyIvySendDirectMsg() + * cette foction permet d'envoyer un message directement à une autre application connectée au bus ivy + * cette fontion est une facade de IvySendDirectMsg() de la librairie ivy-c + * @param app : refrence du client auquel on veut envoyer les message + * @param id : identifiant lié au message + * @param msg : chaine de caracteres representant le message à envoyer à l'application + */ + static void pyIvySendDirectMsg(IvyClientPtr app, int id, char *msg) + { + IvySendDirectMsg(app, id, msg); + } + + + /** + * il n'existe pas de fonction jouant le role de facade pour la fonction IvySetFilter() + */ + + + /***************************************************************** + ******************* END FACADE FOR IVY ************************** + *****************************************************************/ + + + /***************************************************************** + *********************** FACADE FOR IVY TIMER ******************** + *****************************************************************/ + + + /** + * fonction pyIvyTimerRepeatAfter() + * cette fonction permet de creer un timer et de le declencher + * cette fonction est une facade de TimerRepeatAfter() de la librairie ivy-c + * @param count : duree de comptage + * @param time : temps de depart + * @param PyFunc : ppointeur vers la callback à appeler à la fin du timer + * @return l'identifiant du timer creer pour l'operation + */ + static int pyIvyTimerRepeatAfter(int count, + int time, + PyObject *PyFunc) + { + TimerId timer ; + int timerid ; +#ifdef __DEBUG__ + printf("-pyIvyTimerRepeatAfter\n"); +#endif + timer = TimerRepeatAfter(count, time, + pyTimerCallback, + (void *) PyFunc); + timerid = addIvyTimer(timer); +#ifdef __DEBUG__ + printtimerarray(); +#endif + Py_INCREF(PyFunc); + Py_INCREF(Py_None) ; + return timerid ; + } + + + /** + * fonction pyIvyTimerModify() + * cette fonction permet de modifier les parametres d'un timer donne + * cette fonction est une facade de la fonction de TimerModify() de la librairie ivy-c + * @param timerid : entier representant l'identifiant du timer à modifier + * @param time : le nouveau temps à attribuer au timer + */ + static void pyIvyTimerModify(int timerid, + int time ) + { + TimerId timer ; + timer = getIvyTimer(timerid); + if (timer != NULL) + { + TimerModify(timer, (long) time); + } + } + + + /** + * fonction pyIvyTimerRemove() + * cette fonction permet de supprimer un timer + * cette fonction est une facade de Timerremove() de la lirairie ivy-c + * @param timerid : entier represenatnt l'identifiant du timer à supprimer + */ + static void pyIvyTimerRemove( int timerid) + { + TimerId timer ; + timer = getIvyTimer(timerid); + if (timer != NULL) + { + TimerRemove(timer); + delIvyTimer(timerid); + } + } + + + /************************************************************ + *******************END FACADE FOR IVY TIMER **************** + ************************************************************/ + + /***************************************************************** + ******************** MAINLOOP IVY ******************************* + *****************************************************************/ + + /** + * fonction pyIvyMainLoop() + * cette fonction est la fonctions ecoutant les différents canaux de communication + * et lisant sur les sockets + * c'est donc ce qu'on appelle la mainloop ivy + */ + static void pyIvyMainLoop() + { + fd_set rdset; + fd_set exset; + int ready; + + while (MainLoop) + { + pyChannelDefferedDelete(); + rdset = open_fds; + exset = open_fds; + Py_BEGIN_ALLOW_THREADS + ready = select(64, &rdset, 0, &exset, TimerGetSmallestTimeout()); + Py_END_ALLOW_THREADS + if (ready < 0 && (errno != EINTR)) + { + fprintf (stderr, "select error %d\n",errno); + perror("select"); + return; + } + TimerScan(); + if (ready > 0) + { + pyIvyChannelHandleExcpt(&exset); + pyIvyChannelHandleRead(&rdset); + continue; + } + } + Py_INCREF(Py_None) ; + } + + /**************************************************************** + ***************** FIN MAINLOOP IVY ***************************** + ****************************************************************/ + + + + +/************************************************************** + ************************* PART 2 ***************************** + *on place ici les declarations complementaires : typemap, etc* + *------------------------------------------------------------* + * SWIG typemap allowing us to grab a Python callable object ** + *-----------------------------------------------------------** + **************************************************************/ + +// nouvelle syntaxe SWIG 1.3.x : $target -> $1 et $source -> $input +%typemap(python,in) PyObject *PyFunc { + if (!PyCallable_Check($input)) { + PyErr_SetString(PyExc_TypeError, "Need a callable object!"); + return NULL; + } + $1 = $input; +} + +%typemap(python,in) PyObject *PyFuncOnCx { + if (!PyCallable_Check($input)) { + PyErr_SetString(PyExc_TypeError, "Need a callable object!"); + return NULL; + } + $1 = $input; +} + +%typemap(python,in) PyObject *PyFuncOnDie { + if (!PyCallable_Check($input)) { + PyErr_SetString(PyExc_TypeError, "Need a callable object!"); + return NULL; + } + $1 = $input; +} + +%typemap(python,out) char** { + int size=0, i; + char **msgList; + msgList=$1; + while (*msgList ) + { + /*printf("Message to '%s'\n",*msgList++);*/ + *msgList++; + size++; + } + resultobj=PyTuple_New(size); + msgList=$1; + for (i = 0; i < size; i++) { + PyTuple_SetItem(resultobj,i,PyString_FromString(*msgList++)); + } + $result=resultobj; +} + + + + +/****************************************************************** + *************************** PART 3 ******************************* + ******************** fonctions du wrapper ************************ + ******************************************************************/ + + +/** + * fonction pyIvyInit() + * cette fonction permet d'initialiser une connexion au bus Ivy + * cette fonction est une facade pour la fonction IvyInit() de la librairie ivy-c + * @param AppName : chaine de caractere representant le nom de l'application a connecter + * @param ready : chaine de caractere representant le message envoyer lors d'une connexion + * @param loopmode : entier permettant de fonctionner sur le thread de la boucle tk ou sur un thread à part + * ce parametre doit être mis à zero, car le mode fonctionnant avec le thread tk n'existe plus + * @param pyFuncOnCx : pointeur sur la fonction appelee lors d'une connexion d'une application au bus ivy + * @param PyFuncOnDie : pointeur sur la fonction a appele lors d'un DIE message + */ +void pyIvyInit(const char *AppName, /* nom de l'application */ + const char *ready, /* ready Message peut etre NULL */ + int loopmode, + PyObject *PyFuncOnCx,/* callback appele sur connection deconnection d'une appli */ + PyObject *PyFuncOnDie); /* last change callback before die */ + + + +/** + * fonction pyIvyStart() + * cette fonction permet de demarrer une application ivy + * cette fonction est une facade de la fonction IvyStart() + * @param appname : chaine de caractere representant le nom de l'application a demarrer + */ +/* fonction permettant l'initialisation d'une application */ +void pyIvyStart (const char*); + + +/** + * fonction pyIvyMainLoop() + * cette fonction est la fonctions ecoutant les différents canaux de communication + * et lisant sur les sockets + * c'est donc ce qu'on appelle la mainloop ivy + */ +/* lancement de la mainloop ivy */ +void pyIvyMainLoop(); + + +/** + * fonction pyIvystop() + * cette fonction permet d'arreter une application + * cette fonction est une facade pour la fonction IvyStop() de la librairie ivt-c + */ +/* fonction arretant un application ivy */ +void pyIvyStop (); + + +/** + * fonction pyIvyBindMsg() + * cette fonction permet de s'abonner à un type de message afin de declencher une action sur la reception + * cette fonction est une facade de IvyBindMsg() evitat le problème de vararg + * @param PyFunc : pointeur vers la callback à declencher sur recption d'un message + * @param msg : chaine de caracteres representant le message auquel on s'abonne (ce message est generalement une expression reguliere) + * @return une entier representant le numero de l'abonnement + */ +/* fonction permettant l'abonnement des messages */ +int pyIvyBindMsg (PyObject *PyFunc, const char *msg); + + +/** + * fonction pyIvyUnbindMsg() + * cette fonction permet de se desabonner a un type de message + * cette fonction est une facade de IvyUnbindMsg() de la libraire ivy-c + * @param binding_id : entier representant le numero de l'abonnement que l'on veut arreter + */ +/* fonction permettant le desabonnement des messages */ +void pyIvyUnBindMsg (int binding_id); + + +/** + * fonction pyIvySendMsg() + * cette fonction permet d'envoyer un message sue le bus ivy + * cette fonction est une facade de IvySendMsg() évitant le problème de vararg + * @param message : chaine de cracteres representant le message à envoyer + * @return une entier indiquent si l'envoi c'est bien passer + */ +/* fonction permettant l'envoi du message */ +int pyIvySendMsg(const char *message); + + +/** + * fonction pyIvySendDieMsg() + * cette fonction permet de tuer un client via le bus ivy par un envoi d'un message DIE + * cette fonction est une facade de la fonction IvySendDieMsg() de la librairie ivy-c + * @param app : refrence au client à tuer + */ +/* emission d'un message die pour terminer l'application */ +void pyIvySendDieMsg(IvyClientPtr app); + + +/** + * fonction pyIvySendDirectMsg() + * cette foction permet d'envoyer un message directement à une autre application connectée au bus ivy + * cette fontion est une facade de IvySendDirectMsg() de la librairie ivy-c + * @param app : refrence du client auquel on veut envoyer les message + * @param id : identifiant lié au message + * @param msg : chaine de caracteres representant le message à envoyer à l'application + */ +/* send direct message to an application */ +void pyIvySendDirectMsg(IvyClientPtr app, int id, char *msg); + + +/** + * fonction pyIvyBindDirectMsg() + * cette fonction permet de s'abonner au message directe entre application + * cette fonction est une facade de IvyBindDirectMsg() évitant le problème de vararg + * @param PyFunc : pointeur sur la callback à appeler lors d'un message direct + */ +/* bind direct a venir non implémente en ivy-python*/ +void pyIvyBindDirectMsg(PyObject *PyFunc); + + +/** + * fonction pyIvySendError() + * cette fonction permet d'envoyer un message d'erreur à un client donner + * cette fonction est une facade de IvySendError() de la librairie ivy-c + * @param app : refrence du client auquel on envoie le message + * @param id : identifiant lié au message + * @param message : chaine de caracteres representant le message d'erreur + */ +/* emission d'un message d'erreur non implemente en ivy-python*/ +void pyIvySendError(IvyClientPtr app, + int id, + const char *message); + +/* fonctions de bind et unbind callback non implemente en ivy-python*/ + +/** + * fonction pyIvySetBindCallBack() + * cette fonction permet de donner la callback a appele lors d'un bind + * cette fonction est la facade de la fonction IvySetBindCallback() + * @param PyFunc: pointeur sur la callback appelee lors d'un bind + */ +void pyIvySetBindCallback(PyObject *PyFunc); + + +/** + * fonction pyIvyDelBindCallback() + * cette fonction permet de reseter la callback appelee lors d'un bind + * cette fonction est une facade de la fonction IvySetBindCallback() + * @TODO cette fonction ne marche peut être pas, il faudrait la tester et la corriger le cas échéant + */ +void pyIvyDelBindCallback(); + + +/** + * fonction pyIvyGetApplicationList() + * cette fonction permet de recuperer la liste des clients connectes au bus ivy + * cette fonction est uen facade de la fonction IvygetApplicationList() de la librairie ivy-c + * @param sep : chaine de caractere representant le separateur a mettre entre les noms d'application + * @return chaine de caracteres representant la liste des clients connectes separes par le separateur + */ +/* fonction permettant de recuperer la liste des applications */ +char* pyIvyGetApplicationList(const char* sep); + + +/** + * fonction pyIvyGetApplication() + * cette fonction permet de recuperer un une reference a un client ivy à partir de son nom + * cette fonction est uen facade de la fonction IvyGetApplication() de la librairie ivy-c + * @param name : chaine de caracteres represenatnt le nom de l'application + * @return une reference au client ivy + */ +/* fonction permettant de recuperer un client */ +IvyClientPtr pyIvyGetApplication(char *name); + + +/** + * fonction pyIvyGetApplicationName() + * cette fonction permet de recuperer le nom d'une application cliente + * cette fonction est uen facade de la fonction IvyGetApplicationName() de la librairie ivy-c + * @param app : pointeur vers le client dont on veur recuperer le nom + * @return une chane de caracteres representant le nom de l'application + */ +/* fonction permettant la recuperation du nom d'un client */ +char* pyIvyGetApplicationName(IvyClientPtr app); + + +/** + * fonction pyIvyGetApplicationHost() + * cette fonction permet de recuperer la machine hote du client ivy passe en parametre + * cette fonction est une facade de la fonction IvyGetApplicationHost() de la librairie ivy-c + * @param app : pointeur vers le client ivy + * @return une chaine de caracteres representant le nom de la machine hote du client + */ +/* fonction peremettant la recuperation de l'hote du client */ +char* pyIvyGetApplicationHost(IvyClientPtr app); + + +/** + * fonction pyIvyGetApplicationMessages() + * cette fonction permet de recuperer la liste des abonnements d'un client + * cette fonction est une facade de la fonction IvyGetApplicationMessages() de la libraire ivy-c + * @param app : refreence au client dnt on desire recuperer les abonnements + * @return un tableau de chaines de caracteres represenatnt les differents abonnements + */ +/* methode permettant la recuperation de la liste des abonnement d'un client non implemente en ivy-python*/ +char** pyIvyGetApplicationMessages(IvyClientPtr app); + + +/** + * fonction pyIvyTimerRepeatAfter() + * cette fonction permet de creer un timer et de le declencher + * cette fonction est une facade de TimerRepeatAfter() de la librairie ivy-c + * @param count : duree de comptage + * @param time : temps de depart + * @param PyFunc : ppointeur vers la callback à appeler à la fin du timer + * @return l'identifiant du timer creer pour l'operation + */ +/* fonctions a wrapper concernant les timer */ +int pyIvyTimerRepeatAfter(int count, + int time, + PyObject *PyFunc); + + +/** + * fonction pyIvyTimerModify() + * cette fonction permet de modifier les parametres d'un timer donne + * cette fonction est une facade de la fonction de TimerModify() de la librairie ivy-c + * @param timerid : entier representant l'identifiant du timer à modifier + * @param time : le nouveau temps à attribuer au timer + */ +void pyIvyTimerModify(int timerid, + int time); + + +/** + * fonction pyIvyTimerRemove() + * cette fonction permet de supprimer un timer + * cette fonction est une facade de Timerremove() de la lirairie ivy-c + * @param timerid : entier represenatnt l'identifiant du timer à supprimer + */ +void pyIvyTimerRemove(int timerid); + + +// for emacs +// Local Variables: +// mode: C +// indent-tabs-mode: t +// tab-width: 4 +// End: diff --git a/src/ivycpy.i b/src/ivycpy.i new file mode 100644 index 0000000..dc525cc --- /dev/null +++ b/src/ivycpy.i @@ -0,0 +1,1595 @@ +/** + * SWIG Module for making a python wrapper to C ivy library + * -#- c-mode -#- + * + * warning avoid any phrase starting with "pyIvy + * or ending with MsgAsS" + * or ending with ErrorAsS" + * cause these patterns are patched afterwards in order to neat + * Ivycpy library naming + * this wrapper works only with ivy-c version 3.8.1.1 and higher version + */ + +%module ivycpy + +/* on place ici entre %{%} les inclusions, pre-declarations importantes, + fonctions locales qui vont etre associées au wrapper ce code sera conservé + intact par SWIG */ + +%{ +#include +#include +#include +#include +#include +#include +#include +#include +#include "list.h" + +%} + + +/********************************************************************** + ****************************** PART 1 ******************************** + ******************* définition des types de données ****************** + **********************************************************************/ + +/* part 1 on place ici les types de donnees faisant partie des elements + à wrapper */ + +/** + * définition de la structure pointeur sur IvyClient + * cette structure permet de chainer des clients et de parcourir cette chaine + * par acces au client suivant + */ +typedef struct +{ + /** + * next: pointeur vers le client suivant + */ + IvyClientPtr next; + + /** + * client: reference au client ivy-c + */ + Client client; + + /** + * msg_send: pointeur vers le message envoye + */ + MsgSndPtr msg_send; + + /** + * app_name: nom de l'application + */ + char *app_name; + + /** + * app_port: port tcp pour connexion a l'application + */ + unsigned short app_port; + +}*IvyClientPtr; + + + +/** + * définition des types d'évenement pouvant être envoyer par les applications + * IvyApplicationConnected : evenement de connexion d'une application + * IvyApplicationDisconnected : evenement de deconnexion d'une application + */ +typedef enum {IvyApplicationConnected, IvyApplicationDisconnected} IvyApplicationEvent; + + +/** + * définition des évenement lors des abonnments et désabonnement de message + * IvyAddBind : evenement d'ajout d'un binding par une application + * ivyRemoveBind : evenement de suppression d'un binding par une application + */ +typedef enum {IvyAddBind, IvyRemoveBind} IvyBindEvent; + + +/** + * définition de la structure pointeur sur timer + */ +typedef struct _timer *TimerId; + +%{ + /** + * structure définissant les canaux de communication + * cette structure permet de créer une liste chainee de canaux + */ + struct _channel + { + /** + * pointeur vers le canal suivant + */ + Channel next; + + /** + * int representant le numero de socket + */ + HANDLE fd; + + /** + * donnee recuperer sur la socket + */ + void *data; + + /** + * flag de suppression du canal + */ + int tobedeleted; + + /** + * callback declenche par la gestion de boucle sur evenement exception sur le canal + */ + ChannelHandleDelete handle_delete; + + /** + * callback declenche par la gestion de boucle sur donnees pretes sur le canal + */ + ChannelHandleRead handle_read; + }; + + + + /** + * channels_list: pointeur vers le premier element de la liste chaine des canaux + */ + static Channel channels_list = NULL; + + /** + * channel_initialized : flag d'initialisation d'un canal, vaut 1 si canal initialise, 0 sinon + */ + static int channel_initialized = 0; + + /** + * open_fds : file descriptor for socket + */ + static fd_set open_fds; + + /** + * MainLoop : flag pour la mainloop ivy, si MainLoop vaut 1, les evenements sont ecoutes + * sinon, il ne le sont pas + */ + static int MainLoop = 1; + + /** + * definition du type MsgRcvArray + * MsgRcvArray : tableau contenant les structures de donnees + * creer lors d'un abonnement a un message + */ + typedef MsgRcvPtr *MsgRcvArray ; + + /** + * definition du type TimerIdArray + * TimerIdArray : tableau contenant les identifiants des timers + */ + typedef TimerId *TimerIdArray ; + + /** + * definition du type Message + * Message : chaine de caracteres utilise pour les messages + */ + typedef char *Message; + + /** + * definition du type MessagesArray + * MessagesArray: tableau de Message + */ + typedef Message *MessagesArray ; + + + /** + * donnees et fonctions de gestion des infos MsgRcvPtr retournés par IvyBindMsg + * msgrcvarray : tableau utilise pour rangee les structures de donnees pour les abonnements + */ + static MsgRcvArray msgrcvarray ; + + /** + * bindingid_number : entier informant du nombre d'abonnement enregistre + */ + static int bindingid_number = 0 ; + + /** + * donnees et fonctions de gestion des timer retournés par TimerRepeatAfter + * timerarray : tableau contenant les identifiant des timers + */ + static TimerIdArray timerarray ; + + /** + * timerid_number : entier represenetant le nombre de timers + */ + static int timerid_number = 0 ; + + + /********************************************************** + **************** définition des fonctions **************** + **************** permettant la gestion des *************** + **************** bases de messages et timers ************* + **********************************************************/ + + /** + * fonction addRcvMsg() + * cette fonction permet d'ajouter un abonnement dans le tableau + * @param rcvptr, pointeur vers le message + * @return int représentant l'identifiant du message dans la base + **/ + static int addRcvMsg(MsgRcvPtr rcvptr) + { + int i, bindingid ; + /* loop on the msgarray to find free slots */ + for(i=0;i=0 && binding_id < bindingid_number) + return msgrcvarray[binding_id] ; + else + return NULL ; + } + + + /** + * fonction delRcvMsg() + * cette fonction permet de supprimer un abonnement de la base + * @param binding_id : identifiant de l'abonnement dans la base + */ + static void delRcvMsg(int binding_id) + { + if (binding_id >=0 && binding_id < bindingid_number) + msgrcvarray[binding_id] = NULL ; + } + + + /** + * fonction printmsgrcvarray() + * cette fonction affiche sur la sortie standard le contenu du tableau de message + */ + static void printmsgrcvarray() + { + int i; + for(i=0;i=0 && timerid < timerid_number) + return timerarray[timerid] ; + else + return NULL ; + } + + + /** + * fonction delIvyTimer() + * cette fonction permet de supprimer un timer de la base par son identifiant + * @param timerid : identifiant du timer + */ + static void delIvyTimer(int timerid) + { + if (timerid >=0 && timerid < timerid_number) + timerarray[timerid] = NULL ; + } + + + /** + * fonction printtimerarray() + * cette fonction permet d'afficher sur la sortie standard le contenu de la base de timers + */ + static void printtimerarray() + { + int i; + for(i=0;ifunc ; */ + /* la signature python doit etre proc(n) elle ne retourne rien */ + descr = SWIG_TypeQuery("IvyClientPtr"); + resultobj = SWIG_NewPointerObj((void *) app, descr, 0); + eventobj = Py_BuildValue("i", (int) event); + arglist = PyTuple_New(2); + PyTuple_SetItem(arglist,0,resultobj); + PyTuple_SetItem(arglist,1,eventobj); + + result = PyEval_CallObject(func,arglist); + if (!result) + { + PyErr_Print(); + }; + Py_DECREF(arglist); + } + + + /** + * fonction pyIvyBindCallback() + * cette fonction est le callback appele sur chaque abonnement ou desabonnement à un message + * @param app : pointeur sur le client s'abonnant ou se desabonnant + * @param user_data : pointeur vers la fonction appelee lors de cet abonnement/desabonnement + * @param id : identifiant de l'abonnement + * @param regexp : expression reguliere auquel le client s'abonne ou se desabonne + * @param event : evenement d'abonnement/desabonnement + */ + static void pyIvyBindCallback(IvyClientPtr app, + void *user_data, + int id, + char* regexp, + IvyBindEvent event) + { + PyObject *func, *arglist; + PyObject *result, *eventobj, *idobj, *regexpobj; + PyObject *resultobj; + static void *descr = 0; +#ifdef __DEBUG__ + printf("-pyIvyBindCallback\n"); +#endif + func = (PyObject *) user_data; + /* cette verif est inutile ; elle a deja ete faite lors de + l'enregistrement du callback */ + if (!PyCallable_Check(func)) + { + PyErr_SetString(PyExc_TypeError, "Need a callable object!"); + return ; + }; + /* user_data->func ; */ + /* la signature python doit etre proc(n) elle ne retourne rien */ + descr = SWIG_TypeQuery("IvyClientPtr"); + resultobj = SWIG_NewPointerObj((void *) app, descr, 0); + + idobj = Py_BuildValue("i", (int) id); + regexpobj=PyString_FromString(regexp); + eventobj = Py_BuildValue("i", (int) event); + arglist = PyTuple_New(4); + + PyTuple_SetItem(arglist,0,resultobj); + PyTuple_SetItem(arglist,1,idobj); + PyTuple_SetItem(arglist,2,regexpobj); + PyTuple_SetItem(arglist,3,eventobj); + + result = PyEval_CallObject(func,arglist); + if (!result) + { + PyErr_Print(); + }; + Py_DECREF(arglist); + } + + + /** + * fonction pyIvyDieCallback() + * cette fonction est le callback appele lors d'un message die + * @param app : le client envoyant le message + * @param user_data : fonction appelee lors d'une reception de message + * @param id : identifiant non utilise + */ + static void pyIvyDieCallback(IvyClientPtr app, + void *user_data, + int id) + { + PyObject *func, *arglist; + PyObject *result, *idobj; + PyObject *resultobj; + static void *descr = 0; +#ifdef __DEBUG__ + printf("-pyIvyDieCallback\n"); +#endif + func = (PyObject *) user_data; + /* cette verif est inutile ; elle a deja ete faite lors de + l'enregistrement du callback */ + if (!PyCallable_Check(func)) + { + PyErr_SetString(PyExc_TypeError, "Need a callable object!"); + return ; + }; + /* user_data->func ; */ + /* la signature python doit etre proc(n) elle ne retourne rien */ + /* + arglist = Py_BuildValue("(i)", id); + result = PyEval_CallObject(func,arglist); + Py_DECREF(arglist); + */ + descr = SWIG_TypeQuery("IvyClientPtr"); + resultobj = SWIG_NewPointerObj((void *) app, descr, 0); + idobj = Py_BuildValue("i", (int) id); + + arglist = PyTuple_New(2); + PyTuple_SetItem(arglist,0,resultobj); + PyTuple_SetItem(arglist,1,idobj); + + result = PyEval_CallObject(func,arglist); + if (!result) + { + PyErr_Print(); + }; + Py_DECREF(arglist); + } + + + /** + * fonction pyMsgCallback() + * cette fonction est le callback appele lors d'une reception de message + * @param app : le client appelant + * @param user_data : la fonction a appele lors de la reception de message + * @param argc : nombre de parametres envoyes dans le message + * @param argv : tableau de chaine de caractere contenant les elements du message + */ + static void pyMsgCallback( IvyClientPtr app, void *user_data, int argc, char **argv ) + { + PyObject *pyargv ; + int i ; + PyObject *func; + PyObject *result; + PyObject *resultobj; + PyObject *chaine; + static void *descr = 0; +#ifdef __DEBUG__ + printf("-pyMsgCallback\n"); +#endif + + func = (PyObject *) user_data; + + /* cette verif est inutile ; elle a deja ete faite lors de + l'enregistrement du callback */ + if (!PyCallable_Check(func)) + { + PyErr_SetString(PyExc_TypeError, "Need a callable object!"); + return ; + }; + /* user_data->func ; */ + /* la signature python doit etre proc(*arg)) + elle ne retourne rien */ + descr = SWIG_TypeQuery("IvyClientPtr"); + resultobj = SWIG_NewPointerObj((void *) app, descr, 0); + pyargv = PyTuple_New(argc+1); + PyTuple_SetItem(pyargv,0,resultobj); + for (i = 1; i < argc+1; i++) + { + if (argv[i-1]) + { + chaine=PyString_FromString(argv[i-1]); + } + else + { + chaine=PyString_FromString(""); + } + + if(PyString_Check(chaine)) + { + PyTuple_SetItem(pyargv,i,chaine); + } + else + { + printf("-pytkMsgCallback Error %i\n",i); + } + } + + /* this codes is useless; the tuple (pyargv) is directly passed + to the Python call back + */ + result = PyEval_CallObject(func, pyargv) ; + if (!result) + { + PyErr_Print(); + }; + Py_DECREF(pyargv); + /*Py_DECREF(resultobj);*/ + } + + + /** + * fonction pyMsgDirectCallback() + * cette fonction est le callback appele lors d'une reception d'un message direct + * @param app : le clieant appelant + * @param user_data : la fonction a appelee sur cette reception + * @param id : identifiant utilise pour message en plusieurs partie, sinon inutile + * @param msg : chaine de caractere representant le message + */ + static void pyMsgDirectCallback(IvyClientPtr app, + void *user_data, + int id, + char *msg ) + { + PyObject *func, *arglist; + PyObject *result, *idobj; + // modification olivier : ajout d'un parametre + //PyObject *result; + PyObject *resultobj; + static void *descr = 0; + +#ifdef __DEBUG__ + printf("-pyMsgDirectCallback\n"); +#endif + func = (PyObject *) user_data; + + /* cette verif est inutile ; elle a deja ete faite lors de + l'enregistrement du callback */ + if (!PyCallable_Check(func)) + { + PyErr_SetString(PyExc_TypeError, "Need a callable object!"); + return ; + }; + /* user_data->func ; */ + /* la signature python doit etre proc(arg)) + elle ne retourne rien */ + descr = SWIG_TypeQuery("IvyClientPtr"); + resultobj= SWIG_NewPointerObj((void *) app, descr, 0); + idobj = Py_BuildValue("i", (int) id); + // modification olivier : ajout d'un element au tuple + arglist = PyTuple_New(3); + //arglist = PyTuple_New(2); + PyTuple_SetItem(arglist,0,resultobj); + PyTuple_SetItem(arglist,1,idobj); + // modification olivier : ajout de l'identifiant dans le tuple + //PyTuple_SetItem(arglist,1,PyString_FromString(msg)); + PyTuple_SetItem(arglist,2,PyString_FromString(msg)); + + result = PyEval_CallObject(func,arglist); + if (!result) + { + PyErr_Print(); + }; + Py_DECREF(arglist); + Py_DECREF(resultobj); + } + + + + /** + * fonction pyTimerCallback() + * cette fonction est la callback appelee lors d'un repeat after sur un timer + * @param id : identifiant du timer sur lequel l'operation a eu lieu + * @param user_data : pointeur sur la fonction à appeler sur l'application + * @param delta : entier representant le resultat du timer + */ + static void pyTimerCallback(TimerId id, + void *user_data, + unsigned long delta) + { + PyObject *func ; + PyObject *result; + +#ifdef __DEBUG__ + printf("-pyTimerCallback\n"); +#endif + func = (PyObject *) user_data; + + /* cette verif est inutile ; elle a deja ete faite lors de + l'enregistrement du callback */ + if (!PyCallable_Check(func)) + { + PyErr_SetString(PyExc_TypeError, "Need a callable object!"); + return ; + }; + /* la signature de la fonction python a appellé doit etre + proc() */ + result = PyEval_CallObject(func,NULL); + } + + + /************************************************************ + ************* End functions matching C callbacks *********** + ************************************************************/ + + + /************************************************************* + **************** FUNCTIONS FOR IVY CHANNELS ***************** + *************************************************************/ + + /** + * fonction pyIvyChannelHandleRead() + * cette fonction est en charge de la gestion de la lecture sur la socket + * @param current : le file descriptor courant + */ + static void pyIvyChannelHandleRead (fd_set *current) + { + Channel channel, next; + + IVY_LIST_EACH_SAFE (channels_list, channel, next) + { + if (FD_ISSET (channel->fd, current)) + { + (*channel->handle_read)(channel,channel->fd,channel->data); + } + } + } + + /** + * fonction pyIvyChannelHandleExcpt() + * fonction gérant les exceptions lors de la lecture/ecriture sur la socket + * @param current : le file descriptor courant + */ + static void pyIvyChannelHandleExcpt (fd_set *current) + { + Channel channel,next; + IVY_LIST_EACH_SAFE (channels_list, channel, next) + { + if (FD_ISSET (channel->fd, current)) + { + if (channel->handle_delete) + (*channel->handle_delete)(channel->data); + } + } + } + + + /** + * fonction pyIvyChannelDelete() + * fonction permettant la suppression d'un canal de communication + * @param channel : le canal à supprimer + */ + static void pyIvyChannelDelete (Channel channel) + { + if (channel->handle_delete) + (*channel->handle_delete) (channel->data); + + FD_CLR (channel->fd, &open_fds); + IVY_LIST_REMOVE (channels_list, channel); + } + + + /** + * fonction pyChannelDefferedDelete() + * fonction permettant la suppression de l'ensemble des canaux + * marquer à supprimer + */ + static void pyChannelDefferedDelete () + { + Channel channel, next; + IVY_LIST_EACH_SAFE (channels_list, channel,next) + { + if (channel->tobedeleted ) + { + pyIvyChannelDelete (channel); + } + } + } + + + /** + * fonction IvyChannelInit() + * cette fonction est appele pour la création d'un canal de communication + * c'est la librairie ivy-c qui appelle cette fonction + * function called by the library ivy-c + * defined as extern in ivychannel.h + * initialisation d'un canal + */ + void IvyChannelInit(void) + { + +#ifdef __DEBUG__ + printf("-IvyChannelInit\n"); +#endif +#ifdef WIN32 + int error; +#else + /* pour eviter les plantages quand les autres applis font core-dump */ + signal (SIGPIPE, SIG_IGN); +#endif + if (channel_initialized) return; + + /* loopmode test removed */ + FD_ZERO (&open_fds); + +#ifdef WIN32 + error = WSAStartup (0x0101, &WsaData); + if (error == SOCKET_ERROR) + { + printf ("WSAStartup failed.\n"); + } +#endif + channel_initialized = 1; + } + + + + /** + * fonction IvyChannelStop() + * fonction appelee par la librairie ivy-c + * arret de la mainloop ivy + */ + void IvyChannelStop() + { + MainLoop = 0; + } + + + /** + * fonction IvyChannelAdd() + * fonction ajoutant un nouveau canal de communication à la liste + * @param fd : identifiant du file descriptor + * @param data : buffer de donnee à remplir + * @param handle_delete : fonction à appeler lors d'une suppression du canal + * @param handle_read : fonction à appeler lors de la lecture sur le canal + * @return une structure de donnee de type channel + */ + /* ajout d'un canal */ + Channel IvyChannelAdd(HANDLE fd, + void *data, + ChannelHandleDelete handle_delete, + ChannelHandleRead handle_read) + { + Channel channel; + /* loopmode test removed */ + IVY_LIST_ADD (channels_list, channel); + if (!channel) + { + fprintf(stderr,"NOK Memory Alloc Error\n"); + exit(0); + } + channel->fd = fd; + channel->tobedeleted = 0; + channel->handle_delete = handle_delete; + channel->handle_read = handle_read; + channel->data = data; + + FD_SET (channel->fd, &open_fds); + + return channel; + } + + + + /** + * fonction IvyChannelRemove() + * fonction appelee par la librairie ivy-c + * elle permet de supprimer un canal en plçant le flag tobedeleted à 1 + * @param channel : pointeur vers la structure de donnes du canal + */ + /* suppression d'un canal */ + void IvyChannelRemove(Channel channel) + { +#ifdef __DEBUG__ + printf("-IvyChannelRemove\n"); +#endif + /* loopmode test removed */ + channel->tobedeleted = 1; + } + + + + /************************************************************* + ******************** END IVY CHANNELS *********************** + *************************************************************/ + + + /**************************************************** + ************* FACADE FOR IVY METHODS *************** + ****************************************************/ + + /** + * fonction pyIvyInit() + + * cette fonction permet d'initialiser une connexion au bus Ivy + * cette fonction est une facade pour la fonction IvyInit() de la + * librairie ivy-c + * @param AppName : chaine de caractere representant + * le nom de l'application a connecter + * @param ready : chaine de caractere representant le message + * envoyer lors d'une connexion + * @param loopmode : entier permettant de fonctionner sur le thread + * de la boucle tk ou sur un thread à part ce parametre doit être + * mis à zero, car le mode fonctionnant avec le thread tk n'existe + * plus + * @param pyFuncOnCx : pointeur sur la fonction appelee lors d'une + * connexion d'une application au bus ivy + * @param PyFuncOnDie : pointeur sur la fonction a appele lors d'un + * DIE message + */ + + static void pyIvyInit(const char *AppName, /* nom de l'application */ + const char *ready, /* ready Message peut etre NULL */ + int loopmode, /* 1 = mode Tk (obsolete) , 0 = mode Ivyloop */ + PyObject *PyFuncOnCx, /* callback appele sur connection deconnection d'une appli */ + PyObject *PyFuncOnDie) /* last change callback before die */ + { + +#ifdef __DEBUG__ + printf("-pyIvyInit\n"); +#endif + IvyInit(AppName,ready, + pyIvyApplicationCallback, (void *) PyFuncOnCx, + pyIvyDieCallback, (void *) PyFuncOnDie); + + Py_INCREF(PyFuncOnCx); + Py_INCREF(PyFuncOnDie); + } + + + + /** + * fonction pyIvySetBindCallBack() + * cette fonction permet de donner la callback a appele lors d'un bind + * cette fonction est la facade de la fonction IvySetBindCallback() + * @param PyFunc: pointeur sur la callback appelee lors d'un bind + */ + static void pyIvySetBindCallback(PyObject *PyFunc) + { + IvySetBindCallback(pyIvyBindCallback, (void *) PyFunc); + Py_INCREF(PyFunc); + } + + + /** + * fonction pyIvyDelBindCallback() + * cette fonction permet de reseter la callback appelee lors d'un bind + * cette fonction est une facade de la fonction IvySetBindCallback() + * @TODO cette fonction ne marche peut être pas, il faudrait la tester et la corriger le cas échéant + */ + static void pyIvyDelBindCallback() + { + IvySetBindCallback(NULL, NULL); + } + + + /** + * fonction pyIvyStart() + * cette fonction permet de demarrer une application ivy + * cette fonction est une facade de la fonction IvyStart() + * @param appname : chaine de caractere representant le nom de l'application a demarrer + */ + static void pyIvyStart (const char* appname) + { + IvyStart(appname); + MainLoop = 1; + } + + /** + * fonction pyIvystop() + * cette fonction permet d'arreter une application + * cette fonction est une facade pour la fonction IvyStop() de la librairie ivt-c + */ + static void pyIvyStop (void) + { + IvyStop(); + } + + + /** + * fonction pyIvyGetApplicationName() + * cette fonction permet de recuperer le nom d'une application cliente + * cette fonction est uen facade de la fonction IvyGetApplicationName() de la librairie ivy-c + * @param app : pointeur vers le client dont on veur recuperer le nom + * @return une chane de caracteres representant le nom de l'application + */ + static char* pyIvyGetApplicationName(IvyClientPtr app) + { + return IvyGetApplicationName(app); + } + + + /** + * fonction pyIvyGetApplicationHost() + * cette fonction permet de recuperer la machine hote du client ivy passe en parametre + * cette fonction est une facade de la fonction IvyGetApplicationHost() de la librairie ivy-c + * @param app : pointeur vers le client ivy + * @return une chaine de caracteres representant le nom de la machine hote du client + */ + static char* pyIvyGetApplicationHost(IvyClientPtr app) + { + return IvyGetApplicationHost(app); + } + + + /** + * fonction pyIvyGetApplication() + * cette fonction permet de recuperer un une reference a un client ivy à partir de son nom + * cette fonction est uen facade de la fonction IvyGetApplication() de la librairie ivy-c + * @param name : chaine de caracteres represenatnt le nom de l'application + * @return une reference au client ivy + */ + static IvyClientPtr pyIvyGetApplication(char *name) + { + return IvyGetApplication(name); + } + + + /** + * fonction pyIvyGetApplicationList() + * cette fonction permet de recuperer la liste des clients connectes au bus ivy + * cette fonction est uen facade de la fonction IvygetApplicationList() de la librairie ivy-c + * @param sep : chaine de caractere representant le separateur a mettre entre les noms d'application + * @return chaine de caracteres representant la liste des clients connectes separes par le separateur + */ + static char* pyIvyGetApplicationList(const char* sep) + { + return IvyGetApplicationList(sep); + } + + + /** + * fonction pyIvyGetApplicationMessages() + * cette fonction permet de recuperer la liste des abonnements d'un client + * cette fonction est une facade de la fonction IvyGetApplicationMessages() de la libraire ivy-c + * @param app : refreence au client dnt on desire recuperer les abonnements + * @return un tableau de chaines de caracteres represenatnt les differents abonnements + */ + static char** pyIvyGetApplicationMessages(IvyClientPtr app) + { + return IvyGetApplicationMessages(app); + } + + + /** + * fonction pyIvyBindMsg() + * cette fonction permet de s'abonner à un type de message afin de declencher une action sur la reception + * cette fonction est une facade de IvyBindMsg() evitat le problème de vararg + * @param PyFunc : pointeur vers la callback à declencher sur recption d'un message + * @param msg : chaine de caracteres representant le message auquel on s'abonne (ce message est generalement une expression reguliere) + * @return une entier representant le numero de l'abonnement + */ + static int pyIvyBindMsg (PyObject *PyFunc, + const char *msg) + { + MsgRcvPtr result ; + int binding_id = -1 ; + + result = IvyBindMsg(pyMsgCallback, (void *) PyFunc , msg); + + /* on conserve une trace de result sous la forme d'une table + indexé i -> (result) ; cet indice sera incrémenté et retourné + comme valeur de retour */ +#ifdef __DEBUG__ + printf("-IvyBindMsg retourne %x \n", (int) result); +#endif + binding_id = addRcvMsg(result) ; +#ifdef __DEBUG__ + printmsgrcvarray(); +#endif + Py_INCREF(PyFunc); + Py_INCREF(Py_None) ; + return binding_id ; + } + + + /** + * fonction pyIvyUnbindMsg() + * cette fonction permet de se desabonner a un type de message + * cette fonction est une facade de IvyUnbindMsg() de la libraire ivy-c + * @param binding_id : entier representant le numero de l'abonnement que l'on veut arreter + */ + static void pyIvyUnBindMsg (int binding_id) + { + /* on passe à pyIvyUnBindMsg l'indexe du MsgRcvPtr retourné par + pyIvyBindMsg */ + MsgRcvPtr rcvid ; + rcvid = getRcvMsg(binding_id) ; + if (rcvid != NULL) + { + IvyUnbindMsg(rcvid); + delRcvMsg(binding_id); + }; +#ifdef __DEBUG__ + printmsgrcvarray() ; +#endif + } + + + /** + * fonction pyIvySendError() + * cette fonction permet d'envoyer un message d'erreur à un client donner + * cette fonction est une facade de IvySendError() de la librairie ivy-c + * @param app : refrence du client auquel on envoie le message + * @param id : identifiant lié au message + * @param message : chaine de caracteres representant le message d'erreur + */ + void pyIvySendError(IvyClientPtr app, + int id, + const char *message) + { + IvySendError(app,id,message); + } + + + /** + * fonction IvySendDieMsg() + * cette fonction permet de tuer un client via le bus ivy par un envoi d'un message DIE + * cette fonction est une facade de la fonction IvySendDieMsg() de la librairie ivy-c + * @param app : refrence au client à tuer + */ + static void pyIvySendDieMsg(IvyClientPtr app) + { + IvySendDieMsg(app); + } + + + /** + * fonction pyIvySendMsg() + * cette fonction permet d'envoyer un message sue le bus ivy + * cette fonction est une facade de IvySendMsg() évitant le problème de vararg + * @param message : chaine de cracteres representant le message à envoyer + * @return une entier indiquent si l'envoi c'est bien passer + */ + int pyIvySendMsg(const char *message) + { + return(IvySendMsg(message)); + } + + + /** + * fonction pyIvyBindDirectMsg() + * cette fonction permet de s'abonner au message directe entre application + * cette fonction est une facade de IvyBindDirectMsg() évitant le problème de vararg + * @param PyFunc : pointeur sur la callback à appeler lors d'un message direct + */ + static void pyIvyBindDirectMsg (PyObject *PyFunc) + { + /* le user_data est le pointeur PyFunc */ + IvyBindDirectMsg(pyMsgDirectCallback, (void *) PyFunc); + /* on conserve une trace de result sous la forme d'une table + indexé i -> (result) ; cet indice sera incrémenté et retourné + comme valeur de retour */ +#ifdef __DEBUG__ + printmsgrcvarray(); +#endif + Py_INCREF(PyFunc); + Py_INCREF(Py_None) ; + } + + + /** + * fonction pyIvySendDirectMsg() + * cette foction permet d'envoyer un message directement à une autre application connectée au bus ivy + * cette fontion est une facade de IvySendDirectMsg() de la librairie ivy-c + * @param app : refrence du client auquel on veut envoyer les message + * @param id : identifiant lié au message + * @param msg : chaine de caracteres representant le message à envoyer à l'application + */ + static void pyIvySendDirectMsg(IvyClientPtr app, int id, char *msg) + { + IvySendDirectMsg(app, id, msg); + } + + + /** + * il n'existe pas de fonction jouant le role de facade pour la fonction IvySetFilter() + */ + + + /***************************************************************** + ******************* END FACADE FOR IVY ************************** + *****************************************************************/ + + + /***************************************************************** + *********************** FACADE FOR IVY TIMER ******************** + *****************************************************************/ + + + /** + * fonction pyIvyTimerRepeatAfter() + * cette fonction permet de creer un timer et de le declencher + * cette fonction est une facade de TimerRepeatAfter() de la librairie ivy-c + * @param count : duree de comptage + * @param time : temps de depart + * @param PyFunc : ppointeur vers la callback à appeler à la fin du timer + * @return l'identifiant du timer creer pour l'operation + */ + static int pyIvyTimerRepeatAfter(int count, + int time, + PyObject *PyFunc) + { + TimerId timer ; + int timerid ; +#ifdef __DEBUG__ + printf("-pyIvyTimerRepeatAfter\n"); +#endif + timer = TimerRepeatAfter(count, time, + pyTimerCallback, + (void *) PyFunc); + timerid = addIvyTimer(timer); +#ifdef __DEBUG__ + printtimerarray(); +#endif + Py_INCREF(PyFunc); + Py_INCREF(Py_None) ; + return timerid ; + } + + + /** + * fonction pyIvyTimerModify() + * cette fonction permet de modifier les parametres d'un timer donne + * cette fonction est une facade de la fonction de TimerModify() de la librairie ivy-c + * @param timerid : entier representant l'identifiant du timer à modifier + * @param time : le nouveau temps à attribuer au timer + */ + static void pyIvyTimerModify(int timerid, + int time ) + { + TimerId timer ; + timer = getIvyTimer(timerid); + if (timer != NULL) + { + TimerModify(timer, (long) time); + } + } + + + /** + * fonction pyIvyTimerRemove() + * cette fonction permet de supprimer un timer + * cette fonction est une facade de Timerremove() de la lirairie ivy-c + * @param timerid : entier represenatnt l'identifiant du timer à supprimer + */ + static void pyIvyTimerRemove( int timerid) + { + TimerId timer ; + timer = getIvyTimer(timerid); + if (timer != NULL) + { + TimerRemove(timer); + delIvyTimer(timerid); + } + } + + + /************************************************************ + *******************END FACADE FOR IVY TIMER **************** + ************************************************************/ + + /***************************************************************** + ******************** MAINLOOP IVY ******************************* + *****************************************************************/ + + /** + * fonction pyIvyMainLoop() + * cette fonction est la fonctions ecoutant les différents canaux de communication + * et lisant sur les sockets + * c'est donc ce qu'on appelle la mainloop ivy + */ + static void pyIvyMainLoop() + { + fd_set rdset; + fd_set exset; + int ready; + + while (MainLoop) + { + pyChannelDefferedDelete(); + rdset = open_fds; + exset = open_fds; + Py_BEGIN_ALLOW_THREADS + ready = select(64, &rdset, 0, &exset, TimerGetSmallestTimeout()); + Py_END_ALLOW_THREADS + if (ready < 0 && (errno != EINTR)) + { + fprintf (stderr, "select error %d\n",errno); + perror("select"); + return; + } + TimerScan(); + if (ready > 0) + { + pyIvyChannelHandleExcpt(&exset); + pyIvyChannelHandleRead(&rdset); + continue; + } + } + Py_INCREF(Py_None) ; + } + + /**************************************************************** + ***************** FIN MAINLOOP IVY ***************************** + ****************************************************************/ + +%} + + +/************************************************************** + ************************* PART 2 ***************************** + *on place ici les declarations complementaires : typemap, etc* + *------------------------------------------------------------* + * SWIG typemap allowing us to grab a Python callable object ** + *-----------------------------------------------------------** + **************************************************************/ + +// nouvelle syntaxe SWIG 1.3.x : $target -> $1 et $source -> $input +%typemap(python,in) PyObject *PyFunc { + if (!PyCallable_Check($input)) { + PyErr_SetString(PyExc_TypeError, "Need a callable object!"); + return NULL; + } + $1 = $input; +} + +%typemap(python,in) PyObject *PyFuncOnCx { + if (!PyCallable_Check($input)) { + PyErr_SetString(PyExc_TypeError, "Need a callable object!"); + return NULL; + } + $1 = $input; +} + +%typemap(python,in) PyObject *PyFuncOnDie { + if (!PyCallable_Check($input)) { + PyErr_SetString(PyExc_TypeError, "Need a callable object!"); + return NULL; + } + $1 = $input; +} + +%typemap(python,out) char** { + int size=0, i; + char **msgList; + msgList=$1; + while (*msgList ) + { + /*printf("Message to '%s'\n",*msgList++);*/ + *msgList++; + size++; + } + resultobj=PyTuple_New(size); + msgList=$1; + for (i = 0; i < size; i++) { + PyTuple_SetItem(resultobj,i,PyString_FromString(*msgList++)); + } + $result=resultobj; +} + + + + +/****************************************************************** + *************************** PART 3 ******************************* + ******************** fonctions du wrapper ************************ + ******************************************************************/ + + +/** + * fonction pyIvyInit() + * cette fonction permet d'initialiser une connexion au bus Ivy + * cette fonction est une facade pour la fonction IvyInit() de la librairie ivy-c + * @param AppName : chaine de caractere representant le nom de l'application a connecter + * @param ready : chaine de caractere representant le message envoyer lors d'une connexion + * @param loopmode : entier permettant de fonctionner sur le thread de la boucle tk ou sur un thread à part + * ce parametre doit être mis à zero, car le mode fonctionnant avec le thread tk n'existe plus + * @param pyFuncOnCx : pointeur sur la fonction appelee lors d'une connexion d'une application au bus ivy + * @param PyFuncOnDie : pointeur sur la fonction a appele lors d'un DIE message + */ +void pyIvyInit(const char *AppName, /* nom de l'application */ + const char *ready, /* ready Message peut etre NULL */ + int loopmode, + PyObject *PyFuncOnCx,/* callback appele sur connection deconnection d'une appli */ + PyObject *PyFuncOnDie); /* last change callback before die */ + + + +/** + * fonction pyIvyStart() + * cette fonction permet de demarrer une application ivy + * cette fonction est une facade de la fonction IvyStart() + * @param appname : chaine de caractere representant le nom de l'application a demarrer + */ +/* fonction permettant l'initialisation d'une application */ +void pyIvyStart (const char*); + + +/** + * fonction pyIvyMainLoop() + * cette fonction est la fonctions ecoutant les différents canaux de communication + * et lisant sur les sockets + * c'est donc ce qu'on appelle la mainloop ivy + */ +/* lancement de la mainloop ivy */ +void pyIvyMainLoop(); + + +/** + * fonction pyIvystop() + * cette fonction permet d'arreter une application + * cette fonction est une facade pour la fonction IvyStop() de la librairie ivt-c + */ +/* fonction arretant un application ivy */ +void pyIvyStop (); + + +/** + * fonction pyIvyBindMsg() + * cette fonction permet de s'abonner à un type de message afin de declencher une action sur la reception + * cette fonction est une facade de IvyBindMsg() evitat le problème de vararg + * @param PyFunc : pointeur vers la callback à declencher sur recption d'un message + * @param msg : chaine de caracteres representant le message auquel on s'abonne (ce message est generalement une expression reguliere) + * @return une entier representant le numero de l'abonnement + */ +/* fonction permettant l'abonnement des messages */ +int pyIvyBindMsg (PyObject *PyFunc, const char *msg); + + +/** + * fonction pyIvyUnbindMsg() + * cette fonction permet de se desabonner a un type de message + * cette fonction est une facade de IvyUnbindMsg() de la libraire ivy-c + * @param binding_id : entier representant le numero de l'abonnement que l'on veut arreter + */ +/* fonction permettant le desabonnement des messages */ +void pyIvyUnBindMsg (int binding_id); + + +/** + * fonction pyIvySendMsg() + * cette fonction permet d'envoyer un message sue le bus ivy + * cette fonction est une facade de IvySendMsg() évitant le problème de vararg + * @param message : chaine de cracteres representant le message à envoyer + * @return une entier indiquent si l'envoi c'est bien passer + */ +/* fonction permettant l'envoi du message */ +int pyIvySendMsg(const char *message); + + +/** + * fonction pyIvySendDieMsg() + * cette fonction permet de tuer un client via le bus ivy par un envoi d'un message DIE + * cette fonction est une facade de la fonction IvySendDieMsg() de la librairie ivy-c + * @param app : refrence au client à tuer + */ +/* emission d'un message die pour terminer l'application */ +void pyIvySendDieMsg(IvyClientPtr app); + + +/** + * fonction pyIvySendDirectMsg() + * cette foction permet d'envoyer un message directement à une autre application connectée au bus ivy + * cette fontion est une facade de IvySendDirectMsg() de la librairie ivy-c + * @param app : refrence du client auquel on veut envoyer les message + * @param id : identifiant lié au message + * @param msg : chaine de caracteres representant le message à envoyer à l'application + */ +/* send direct message to an application */ +void pyIvySendDirectMsg(IvyClientPtr app, int id, char *msg); + + +/** + * fonction pyIvyBindDirectMsg() + * cette fonction permet de s'abonner au message directe entre application + * cette fonction est une facade de IvyBindDirectMsg() évitant le problème de vararg + * @param PyFunc : pointeur sur la callback à appeler lors d'un message direct + */ +/* bind direct a venir non implémente en ivy-python*/ +void pyIvyBindDirectMsg(PyObject *PyFunc); + + +/** + * fonction pyIvySendError() + * cette fonction permet d'envoyer un message d'erreur à un client donner + * cette fonction est une facade de IvySendError() de la librairie ivy-c + * @param app : refrence du client auquel on envoie le message + * @param id : identifiant lié au message + * @param message : chaine de caracteres representant le message d'erreur + */ +/* emission d'un message d'erreur non implemente en ivy-python*/ +void pyIvySendError(IvyClientPtr app, + int id, + const char *message); + +/* fonctions de bind et unbind callback non implemente en ivy-python*/ + +/** + * fonction pyIvySetBindCallBack() + * cette fonction permet de donner la callback a appele lors d'un bind + * cette fonction est la facade de la fonction IvySetBindCallback() + * @param PyFunc: pointeur sur la callback appelee lors d'un bind + */ +void pyIvySetBindCallback(PyObject *PyFunc); + + +/** + * fonction pyIvyDelBindCallback() + * cette fonction permet de reseter la callback appelee lors d'un bind + * cette fonction est une facade de la fonction IvySetBindCallback() + * @TODO cette fonction ne marche peut être pas, il faudrait la tester et la corriger le cas échéant + */ +void pyIvyDelBindCallback(); + + +/** + * fonction pyIvyGetApplicationList() + * cette fonction permet de recuperer la liste des clients connectes au bus ivy + * cette fonction est uen facade de la fonction IvygetApplicationList() de la librairie ivy-c + * @param sep : chaine de caractere representant le separateur a mettre entre les noms d'application + * @return chaine de caracteres representant la liste des clients connectes separes par le separateur + */ +/* fonction permettant de recuperer la liste des applications */ +char* pyIvyGetApplicationList(const char* sep); + + +/** + * fonction pyIvyGetApplication() + * cette fonction permet de recuperer un une reference a un client ivy à partir de son nom + * cette fonction est uen facade de la fonction IvyGetApplication() de la librairie ivy-c + * @param name : chaine de caracteres represenatnt le nom de l'application + * @return une reference au client ivy + */ +/* fonction permettant de recuperer un client */ +IvyClientPtr pyIvyGetApplication(char *name); + + +/** + * fonction pyIvyGetApplicationName() + * cette fonction permet de recuperer le nom d'une application cliente + * cette fonction est uen facade de la fonction IvyGetApplicationName() de la librairie ivy-c + * @param app : pointeur vers le client dont on veur recuperer le nom + * @return une chane de caracteres representant le nom de l'application + */ +/* fonction permettant la recuperation du nom d'un client */ +char* pyIvyGetApplicationName(IvyClientPtr app); + + +/** + * fonction pyIvyGetApplicationHost() + * cette fonction permet de recuperer la machine hote du client ivy passe en parametre + * cette fonction est une facade de la fonction IvyGetApplicationHost() de la librairie ivy-c + * @param app : pointeur vers le client ivy + * @return une chaine de caracteres representant le nom de la machine hote du client + */ +/* fonction peremettant la recuperation de l'hote du client */ +char* pyIvyGetApplicationHost(IvyClientPtr app); + + +/** + * fonction pyIvyGetApplicationMessages() + * cette fonction permet de recuperer la liste des abonnements d'un client + * cette fonction est une facade de la fonction IvyGetApplicationMessages() de la libraire ivy-c + * @param app : refreence au client dnt on desire recuperer les abonnements + * @return un tableau de chaines de caracteres represenatnt les differents abonnements + */ +/* methode permettant la recuperation de la liste des abonnement d'un client non implemente en ivy-python*/ +char** pyIvyGetApplicationMessages(IvyClientPtr app); + + +/** + * fonction pyIvyTimerRepeatAfter() + * cette fonction permet de creer un timer et de le declencher + * cette fonction est une facade de TimerRepeatAfter() de la librairie ivy-c + * @param count : duree de comptage + * @param time : temps de depart + * @param PyFunc : ppointeur vers la callback à appeler à la fin du timer + * @return l'identifiant du timer creer pour l'operation + */ +/* fonctions a wrapper concernant les timer */ +int pyIvyTimerRepeatAfter(int count, + int time, + PyObject *PyFunc); + + +/** + * fonction pyIvyTimerModify() + * cette fonction permet de modifier les parametres d'un timer donne + * cette fonction est une facade de la fonction de TimerModify() de la librairie ivy-c + * @param timerid : entier representant l'identifiant du timer à modifier + * @param time : le nouveau temps à attribuer au timer + */ +void pyIvyTimerModify(int timerid, + int time); + + +/** + * fonction pyIvyTimerRemove() + * cette fonction permet de supprimer un timer + * cette fonction est une facade de Timerremove() de la lirairie ivy-c + * @param timerid : entier represenatnt l'identifiant du timer à supprimer + */ +void pyIvyTimerRemove(int timerid); + + +// for emacs +// Local Variables: +// mode: C +// indent-tabs-mode: t +// tab-width: 4 +// End: diff --git a/src/ivycpy_namer.sed b/src/ivycpy_namer.sed new file mode 100644 index 0000000..3cde8e7 --- /dev/null +++ b/src/ivycpy_namer.sed @@ -0,0 +1,3 @@ +s/^pyIvy/Ivy/g ; +# s/MsgAsS\"/Msg\"/g; +#s/ErrorAsS\"/Error\"/g; diff --git a/src/list.h b/src/list.h new file mode 100644 index 0000000..c76c255 --- /dev/null +++ b/src/list.h @@ -0,0 +1,77 @@ +/* + * Ivy, C interface + * + * Copyright (C) 1997-2000 + * Centre d'Études de la Navigation Aérienne + * + * Simple lists in C + * + * Authors: François-Régis Colin + * + * $Id: list.h,v 1.2 2007/06/07 14:59:13 saal Exp $ + * + * Please refer to file version.h for the + * copyright notice regarding this software + */ +#if (__GNUC__ >= 3) +#define TYPEOF(p) typeof (p) +#else +#define TYPEOF(p) void * +#endif + +#define IVY_LIST_ITER( list, p, cond ) \ + p = list; \ + while ( p && (cond) ) p = p->next + + + +#define IVY_LIST_REMOVE( list, p ) \ + { \ + TYPEOF(p) toRemove; \ + if ( list == p ) \ + { \ + list = p->next; \ + free(p);\ + } \ + else \ + {\ + toRemove = p;\ + IVY_LIST_ITER( list, p, ( p->next != toRemove ));\ + if ( p )\ + {\ + /* somme tricky swapping to use a untyped variable */\ + TYPEOF(p) suiv; \ + TYPEOF(p) prec = p;\ + p = toRemove;\ + suiv = p->next;\ + p = prec;\ + p->next = suiv;\ + free(toRemove);\ + }\ + } \ + } + +#define IVY_LIST_ADD(list, p ) \ + if ( p = (TYPEOF(p)) (malloc( sizeof( *p ))))\ + { \ + memset( p, 0 , sizeof( *p ));\ + p->next = list; \ + list = p; \ + } + +#define IVY_LIST_EACH( list, p ) \ + for ( p = list ; p ; p = p -> next ) + +#define IVY_LIST_EACH_SAFE( list, p, next )\ +for ( p = list ; (next = p ? p->next: p ),p ; p = next ) + +#define IVY_LIST_EMPTY( list ) \ + { \ + TYPEOF(list) p; \ + while( list ) \ + { \ + p = list;\ + list = list->next; \ + free(p);\ + } \ + } -- cgit v1.1