diff options
39 files changed, 10955 insertions, 0 deletions
diff --git a/.cvsignore b/.cvsignore new file mode 100644 index 0000000..f54272c --- /dev/null +++ b/.cvsignore @@ -0,0 +1,6 @@ +config.log +config.cache +config.status +GNUmakefile +env.sh +autom4te.cache
\ No newline at end of file diff --git a/GNUmakefile.in b/GNUmakefile.in new file mode 100644 index 0000000..1f38136 --- /dev/null +++ b/GNUmakefile.in @@ -0,0 +1,155 @@ +## -*- makefile -*- + +ifneq (,) +This makefile requires GNU Make. +endif + +VPATH := @srcdir@ + +PACKAGE := @PACKAGE@ +VERSION := @VERSION@ + +STATIC_EXAMPLES := pyhello.py testtk.py +EXAMPLES := $(addprefix docs/examples/, env.sh) +DOCS := $(addprefix docs/html/, index.html ivycpy_wrap.html) + +DEFINES := @DEFINES@ +INCLUDES := @INCLUDES@ +LIBRARIES := @LIBRARIES@ + +prefix := @prefix@ +exec_prefix := @exec_prefix@ +datadir := @datadir@ +includedir := @includedir@ +libdir := @libdir@ +bindir := @bindir@ +mandir := @mandir@ +infodir := @infodir@ +pyexecdir := @pyexecdir@ +pythondir := @pythondir@ + +PKGEXAMPLESDIR := $(datadir)/$(PACKAGE)-$(VERSION)/examples +PKGDOCDIR := $(datadir)/$(PACKAGE)-$(VERSION)/docs + +MKDIR := mkdir -p +RMDIR := rmdir -p + +LN_S := @LN_S@ -f + +ARFLAGS := r + +RANLIB := @RANLIB@ + +INSTALL := @INSTALL@ +INSTALL_PROGRAM := @INSTALL_PROGRAM@ +INSTALL_SCRIPT := @INSTALL_SCRIPT@ +INSTALL_DATA := @INSTALL_DATA@ + +UMASK ?= 022 + +INSTALL_DIR := $(SHELL) $(top_srcdir)/mkinstalldirs +INSTALL_DIR := $(INSTALL) -d +INSTALL_DIR := umask $(UMASK) && mkdirhier +INSTALL_DIR := umask $(UMASK) && $(MKDIR) + +SWIG := @SWIG@ + +CC := gcc + +CC_WARNING_OPTIONS := -Wall +CC_PIC_OPTIONS := -fPIC +CC_SHARED_OPTIONS := -shared + +CC_OPTIONS := $(CC_WARNING_OPTIONS) + +ifdef DEBUG +CC_OPTIONS += -g +DEFINES += -D__DEBUG__ +else +DEFINES += -DNDEBUG +endif + +CPPFLAGS = $(DEFINES) $(INCLUDES) @DEFS@ @CPPFLAGS@ +CFLAGS = @CFLAGS@ $(CC_OPTIONS) +LDFLAGS = @LDFLAGS@ $(LD_OPTIONS) +LDLIBS = $(LIBRARIES) @LIBS@ + +default: ivycpy.so $(DOCS) $(EXAMPLES) + +ivycpy.so: ivycpy_wrap_neat.o @PYTHON_LIBDIR@/python@PYTHON_VERSION@/lib-dynload/_tkinter.so + $(LINK.o) $(CC_SHARED_OPTIONS) $^ -o $@ -livy $(LDLIBS) -lc + +ivycpy_wrap_neat.o: CFLAGS += $(CC_PIC_OPTIONS) +ivycpy_wrap_neat.o: ivycpy_wrap_neat.c + +# true or neat wrapper with proper name for function +ivycpy_wrap_neat.c: ivycpy_wrap.c + >$@ sed -f ivycpy_namer.sed $< + +# wrapper code generated by swig +ivycpy_wrap.c: ivycpy.i + $(SWIG) -python -dhtml $< + +# testing include and defines + +ivycpy_test.e: ivycpy_test.c + >|$@ $(CC) -E $(CPPFLAGS) $< + +# documentation + +docs/html/ivycpy_wrap.html: ivycpy_wrap.html + >|$@ sed -e "s/<B>pyIvy/<B>Ivy/g" $< + +docs/html/index.html: docs/html/index_tpl.html + >|$@ sed -e "s/_VERSION_/$(VERSION)/g" $< + +VERSION: + printf '# generated dynamically do not edit; change VERSION in configure.in instead\n' >|$@ + printf '$$Id$$\n' $(VERSION) >|$@ + +# misc +docs/examples/env.sh: env_tpl.sh + >|$@ sed -e "s|_IVYCPYPATH_|$(pythondir)|g" $< + +install:: ivycpy.so + $(INSTALL_DIR) $(pythondir) + $(INSTALL_DATA) $< $(pythondir) + +install:: $(DOCS) + $(INSTALL_DIR) $(PKGDOCDIR) + cp -rp docs/* $(PKGDOCDIR) + +.PHONY: default install VERSION + +clean: + $(RM) core a.out *.o + $(RM) ivycpy.so + +realclean: clean + $(RM) ivycpy_wrap*.c + $(RM) $(EXAMPLES) + +distclean: realclean + $(RM) ivycpy_wrap*.* + $(RM) GNUmakefile config.log config.status config.cache + +.PHONY: clean realclean distclean + +GNUmakefile:: GNUmakefile.in + CONFIG_FILES=GNUmakefile ./config.status + +GNUmakefile:: ./config.status + ./config.status + +config.status: @top_srcdir@/configure + ./config.status --recheck + +@top_srcdir@/configure: @top_srcdir@/configure.in + cd @top_srcdir@ && autoconf + +recheck: + ./config.status --recheck && ./config.status + +.PHONY: recheck + +## [END OF FILE] @@ -0,0 +1 @@ +$Id$ diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..261d5a4 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,3786 @@ +dnl aclocal.m4 generated automatically by aclocal 1.4-p4 + +dnl Copyright (C) 1994, 1995-8, 1999 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 This program is distributed in the hope that it will be useful, +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. + +dnl # -*- shell-script -*- +dnl ########################################################################### +dnl # +dnl # LAYER-SYSTEM -- tool for configuring, building, and installing software +dnl # Copyright (C) 1996-2001, Martin Vicente +dnl # Copyright (C) 2002-2004, Centre d'Etudes de la Navigation Aérienne +dnl # +dnl # This software is free software; you can redistribute it and/or modify +dnl # it under the terms of the GNU General Public License as published by +dnl # the Free Software Foundation; either version 2 of the License, or +dnl # (at your option) any later version. +dnl # +dnl # This software is distributed in the hope that it will be useful, +dnl # but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +dnl # See the GNU General Public License for more details. +dnl # +dnl # You should have received a copy of the GNU General Public License +dnl # along with this software (see the file COPYING). +dnl # If not, write to the Free Software Foundation, Inc., +dnl # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. +dnl # +dnl ########################################################################### +dnl # +dnl # LAYER-SYSTEM -- TOOL FOR CONFIGURING, BUILDING, AND INSTALLING SOFTWARE +dnl # © Martin Vicente, 1996-2001 +dnl # © Centre d'Etudes de la Navigation Aérienne, 2002-2004 +dnl # +dnl # MY LOCAL ADDITIONS TO AUTOCONF MACROS +dnl # +dnl # Project: LAYER-SYSTEM +dnl # Purpose: Tool for configuring, building, and installing software +dnl # Version: 1.0 (first official release) +dnl # ------------------------------------------------------------------------ +dnl # File : martin.m4 +dnl # Purpose: My local additions to Autoconf macros +dnl # Version: 1.0.5 +dnl # Dialect: Autoconf (m4 and Bourne shell) +dnl # Creator: Martin Vicente +dnl # Created: 20 juin 2002 +dnl # Remarks: From XCLIB - "Les outils de Martin" +dnl # Contact: vicente@cena.fr +dnl # +dnl # Last Modified On: 24 janvier 2004 +dnl # Last Modified By: Martin Vicente +dnl # +dnl # DESCRIPTION: +dnl # LAYER-SYSTEM est une évolution du système de fabrication de XCLIB. +dnl # XCLIB est une bibliothèque de fonctions à usage général. +dnl # La bibliothèque "mini XCLIB" en est une mouture allégée destinée en +dnl # particulier à une application locale au CENA (Centre d'Etudes de la +dnl # Navigation Aérienne). +dnl # +dnl # Ce fichier apporte quelques macros supplémentaires pour Autoconf. +dnl # Certaines offrent des fonctionnalités génériques, et ont pour ambition +dnl # d'intégrer un jour la distribution Autoconf; et d'autres sont ici +dnl # essentiellement pour alléger l'écriture du fichier «configure.in». +dnl # Afin de les distinguer sans ambiguïté des macros standards Autoconf, +dnl # elles sont préfixées par «MV_». +dnl # +dnl # REMARKS: +dnl # +dnl # ENVIRONMENT/PARAMETERS/OPTIONS: +dnl # +dnl # PROBLEMS: +dnl # +dnl # TODO: +dnl # +dnl # REVISION HISTORY: +dnl # ## 21 novembre 2003 - Martin Vicente +dnl # - Renommage de ce fichier en «martin.m4» pour tenir compte d'autres +dnl # jeux de macros et éviter un conflit possible. +dnl # ## 20 juin 2002 - Martin Vicente +dnl # - Création du fichier «aclocal.m4» à partir de celui de XCLIB. +dnl # +dnl # MAINTAINERS: +dnl # Martin Vicente <vicente@cena.fr> +dnl ########################################################################### + +dnl #++ +dnl # LISTE DES MACROS: +dnl # ================= +dnl # +dnl # MV_AUTOCONF_ERROR(TEXT) +dnl # MV_LOWER +dnl # MV_UPPER +dnl # MV_DEL_ACCENT +dnl # MV_CONCAT(VAR, N, STR) +dnl # MV_SET_BRACKETS +dnl # MV_PROG_ECHO_E +dnl # MV_PROG_ECHO_N +dnl # MV_PROG_ECHO +dnl # MV_PROG_ECHO_ESCAPE +dnl # MV_DEF_SET_COLORS +dnl # MV_DEF_UNSET_COLORS +dnl # MV_SET_COLORS +dnl # MV_UNSET_COLORS +dnl # MV_CONFIG_FD_IS_CHAR_DEVICE +dnl # MV_SETUP_COLORS(FD) +dnl # MV_COLOR_ON(FOREGROUND, BACKGROUND) +dnl # MV_COLOR_OFF +dnl # MV_TERM_SIZE +dnl # MV_MSG(TEXT [, COLOR-ATTRIBUTS ]) +dnl # MV_MSG_N(TEXT [, COLOR-ATTRIBUTS ]) +dnl # MV_ERR_MSG(PREFIX, TEXT [, COLOR ]) +dnl # MV_WARNING(TEXT [, COLOR ]) +dnl # MV_ERROR(TEXT [, COLOR ]) +dnl # MV_MSG_RESULT +dnl # MV_ARG_ENABLE +dnl # MV_FILL_COLUMNS(VAR, CH) +dnl # MV_FILL_BACKGROUND(VAR, CH) +dnl # MV_PROG_AUTOCONF +dnl # MV_PROG_ACLOCAL +dnl # MV_PROG_CTRACE +dnl # MV_TOPDIR +dnl # MV_STANDARD +dnl # MV_TRANSFORM_MODULES(SRC-DIRS, LNK-DIR, &MODULES) +dnl # MV_CONFIG_RULES(CONFIG-FILES, PRE-COMMAND, FILENAME) +dnl # MV_OUTPUT(CONFIG-FILES, EXTRA-CMDS, INIT-CMDS) +dnl # MV_MKLOG +dnl # MV_MK_STANDARD +dnl # MV_MK_OUTPUT(MAKEFILE-NAME, SUBDIRS, CONFIG-FILES, EXTRA-CMDS, INIT-CMDS) +dnl # MV_SET_GCC_OPTIONS +dnl # MV_SET_GXX_OPTIONS +dnl # MV_PROG_GCC(-pipe -ansi -pedantic ...) +dnl # MV_PROG_GXX(-pipe -ansi -pedantic ...) +dnl # MV_PROG_CC +dnl # MV_PROG_CXX +dnl # +dnl # -- A REVOIR -- +dnl # +dnl # MV_PREFIX_PROGRAM +dnl # MV_PROG_MKDIRHIER +dnl # MV_PROG_RMDIRHIER +dnl # MV_PROG_LD +dnl # MV_PROG_PERL(MIN-VERSION) +dnl # MV_AUTOCONF_DIRS +dnl # MV_DO_MICO +dnl # MV_DO_OMNIORB +dnl # MV_DO_OMNIORB2 +dnl # MV_CHECK_XCLIB +dnl # MV_CHECK_DPKG_VERSION +dnl # MV_CHECK_CONFIG_FILES +dnl #-- + +dnl ########################################################################### +dnl # forloop(I, MIN, MAX, CMD) +dnl # +dnl # Extension M4. +dnl # +define([forloop], [pushdef([$1], [$2])_forloop([$1], [$2], [$3], [$4])popdef([$1])]) +define([_forloop], [$4[]ifelse($1, [$3], , [define([$1], incr($1))_forloop([$1], [$2], [$3], [$4])])]) + +dnl ########################################################################### +dnl # MV_AUTOCONF_ERROR(TEXT) +dnl # +dnl # Fonction d'erreur interne souvent utilisée pour, par exemple, tester +dnl # l'invocation correcte d'une macro Autoconf. +dnl # +define(MV_AUTOCONF_ERROR, [dnl +errprint([autoconf: *** Error: $1 - File "]__file__[" at line ]__line__[ +])dnl +m4exit(1)]) + +dnl ########################################################################### +dnl # MV_TOLOWER +dnl # +dnl # Transposition des caractères en minuscules. +dnl # +AC_DEFUN(MV_TOLOWER, [dnl +TOLOWER="tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'" +AC_SUBST(TOLOWER)]) + +dnl ########################################################################### +dnl # MV_TOUPPER +dnl # +dnl # Transposition des caractères en majuscules. +dnl # +AC_DEFUN(MV_TOUPPER, [dnl +TOUPPER="tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" +AC_SUBST(TOUPPER)]) + +dnl ########################################################################### +dnl # MV_DEL_ACCENT +dnl # +dnl # Elimination des accents. +dnl # +define(MV_DEL_ACCENT, [dnl +tr 'àçéèêëîïôöùüÂÇÉÈÊËÎÏÔÖÙÜ' 'aceeeeiioouuACEEEEIIOOUU']) + +dnl ########################################################################### +dnl # MV_CONCAT(VAR, N, STR) +dnl # +dnl # Concatène «N» fois la chaîne «STR». L'ajoute à «VAR». +dnl # +define(MV_CONCAT, [dnl +ifelse($#,3,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +{ +mv_v="$[]$1" +mv_i=$2 +while >/dev/null expr $mv_i; do + mv_v="${mv_v}$3" + mv_i=`expr $mv_i - 1` +done +$1=$mv_v +}]) + +dnl ########################################################################### +dnl # MV_SET_BRACKETS +dnl # +dnl # Pour utiliser le caractère «[», en évitant de jongler avec les +dnl # «changequote». +dnl # +AC_DEFUN(MV_SET_BRACKETS, [dnl +ifelse($#,0,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +dnl +changequote(«,»)dnl +mv_LB=[ +mv_RB=]«»dnl +changequote([,])]) + +dnl ########################################################################### +dnl # MV_PROG_ECHO_E +dnl # +dnl # Recherche une commande «echo» qui supporte la représentation +dnl # "backslash-escaped" («\n», «\a», etc); et donc aussi la notation octale +dnl # (ex: «\033»). +dnl # Si une telle command est trouvée, la variable «ECHO_E» sera renseignée +dnl # en conséquence, sinon elle sera vide. +dnl # +dnl # Le test canonique: +define(mv_prog_echo_e__try, [dnl +dnl # - la commande doit d'abord fonctionner sans retourner de statut d'erreur, +>/dev/null 2>&1 $1 dnl +dnl # - la notation "backslash-escaped" doit être interprétée, +&& test -z "`$1 '\a'|fgrep a`" dnl # alert character +&& test -z "`$1 '\b'|fgrep b`" dnl # backspace +&& test -z "`$1 '\c'|fgrep c`" dnl # print line without new-line +&& test -z "`$1 '\f'|fgrep f`" dnl # form-feed +&& test -z "`$1 '\n'|fgrep n`" dnl # new-line +&& test -z "`$1 '\r'|fgrep r`" dnl # carriage return +&& test -z "`$1 '\t'|fgrep t`" dnl # tab +&& test -z "`$1 '\v'|fgrep v`" dnl # vertical tab +dnl # - et aussi la représentation octale. +&& test -z "`$1 '\033'|fgrep 33`"]) +dnl # +dnl # +AC_DEFUN(MV_PROG_ECHO_E, [dnl +ifelse($#,0,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +AC_MSG_CHECKING([if «echo» support backslash-escaped characters]) +AC_CACHE_VAL(mv_cv_prog_ECHO_E, [dnl +if mv_prog_echo_e__try(echo); then + ECHO_E='echo' +elif mv_prog_echo_e__try(echo -e); then + ECHO_E='echo -e' +elif mv_prog_echo_e__try(/bin/echo); then + ECHO_E='/bin/echo' +elif mv_prog_echo_e__try(/bin/echo -e); then + ECHO_E='/bin/echo -e' +else + ECHO_E= +fi +mv_cv_prog_ECHO_E=$ECHO_E])dnl +ECHO_E=$mv_cv_prog_ECHO_E +if test -n "$ECHO_E"; then + AC_MSG_RESULT([yes ($ECHO_E)]) +else + AC_MSG_RESULT([no]) +fi[]dnl +AC_SUBST(ECHO_E)]) + +dnl ########################################################################### +dnl # MV_PROG_ECHO_N +dnl # +dnl # Si je trouve une commande «echo» qui permet de supprimer le passage à +dnl # la ligne suivante, j'affecte les variables «ECHO_N», «_N», et «_C» en +dnl # conséquence; et sinon, ces variable seront vides. +dnl # Et si cette commande peut supporter également les séquences +dnl # "backslash-escaped" (et la notation octale), c'est pas plus mal. +dnl # +dnl # Exemple d'utilisation: @ECHO_N@ @_N@ "Hello World!@_C@" +dnl # +dnl # Comme pour «MV_PROG_ECHO_E», le test se déroule en 2 phases: +dnl # - vérifier que la commande ne renvoie pas un statut d'erreur; +dnl # - vérifier que l'option «-n» ou la séquence «\c» est interprété. +dnl # +dnl # Test avec «-n»: +define(mv_prog_echo_n__try_n, [dnl +>/dev/null 2>&1 $1 && test -z "`$1 -n ''|fgrep n`"]) +dnl # +dnl # Test avec «\c»: +define(mv_prog_echo_n__try_c, [dnl +>/dev/null 2>&1 $1 && test -z "`$1 '\c'|fgrep c`"]) +dnl # +dnl # +AC_DEFUN(MV_PROG_ECHO_N, [dnl +ifelse($#,0,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +AC_REQUIRE([MV_PROG_ECHO_E])dnl +AC_MSG_CHECKING([if «echo» can suppress trailing newline]) +AC_CACHE_VAL(mv_cv_prog_ECHO_N, [dnl +if test -n "$ECHO_E" && mv_prog_echo_n__try_n([$ECHO_E]); then + ECHO_N=$ECHO_E; _N=-n; _C= +elif test -n "$ECHO_E" && mv_prog_echo_n__try_c([$ECHO_E]); then + ECHO_N=$ECHO_E; _N=; _C=\\c +elif mv_prog_echo_n__try_n([echo]); then + ECHO_N=echo; _N=-n; _C= +elif mv_prog_echo_n__try_c([echo]); then + ECHO_N=echo; _N=; _C=\\c +elif mv_prog_echo_n__try_n([/bin/echo]); then + ECHO_N=/bin/echo; _N=-n; _C= +elif mv_prog_echo_n__try_c([/bin/echo]); then + ECHO_N=/bin/echo; _N=; _C=\\c +else + ECHO_N=; _N=; _C= +fi +mv_cv_prog_ECHO_N=$ECHO_N; mv_cv_prog_ECHO_N_N=$_N; mv_cv_prog_ECHO_N_C=$_C])dnl +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 + AC_MSG_RESULT([yes (\$ECHO_N \$_N \"...\$_C\")]) +else + AC_MSG_RESULT([no]) +fi[]dnl +AC_SUBST(ECHO_N)AC_SUBST(_N)AC_SUBST(_C)]) + +dnl ########################################################################### +dnl # MV_PROG_ECHO +dnl # +dnl # Recherche la "meilleur" commande pour la fonction «echo». +dnl # La variable «ECHO» est renseignée en conséquence, ainsi que: +dnl # «ECHO_E», «ECHO_N», «_N» et «_C». +dnl # +AC_DEFUN(MV_PROG_ECHO, [dnl +ifelse($#,0,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +AC_REQUIRE([MV_PROG_ECHO_N])dnl +AC_REQUIRE([MV_PROG_ECHO_E])dnl +AC_MSG_CHECKING([the \"best\" «echo» command]) +AC_CACHE_VAL(mv_cv_prog_ECHO, [dnl +if test -n "$ECHO_N"; then + ECHO=$ECHO_N +elif test -n "$ECHO_E"; then + ECHO=$ECHO_E +else + ECHO=echo +fi +mv_cv_prog_ECHO=$ECHO])dnl +ECHO=$mv_cv_prog_ECHO +if test -n "$ECHO"; then + AC_MSG_RESULT([$ECHO]) +else + AC_MSG_RESULT([no]) + AC_MSG_ERROR([NO ECHO COMMAND!!!]) +fi[]dnl +AC_SUBST(ECHO)]) + +dnl ########################################################################### +dnl # MV_PROG_ECHO_ESCAPE +dnl # +dnl # Si «echo» supporte les séquences d'échappement, j'affecte la variable +dnl # «ESC» avec la notation à utiliser; et sinon, cette dernière sera vide. +dnl # Dans la foulée, on recherche aussi la meilleur commande «echo». +dnl # Les variables remplacées sont: +dnl # +dnl # «ECHO», «ECHO_E», «ECHO_N», «_N», «_C» et «ESC». +dnl # +AC_DEFUN(MV_PROG_ECHO_ESCAPE, [dnl +ifelse($#,0,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +AC_REQUIRE([MV_PROG_ECHO])dnl +AC_MSG_CHECKING([if «$ECHO» support the escape character]) +AC_CACHE_VAL(mv_cv_prog_ECHO_ESC, [dnl +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])dnl +ESC=$mv_cv_prog_ECHO_ESC +if test -n "$ESC"; then + AC_MSG_RESULT([yes (\$ESC)]) +else + AC_MSG_RESULT([no]) +fi[]dnl +AC_SUBST(ESC)]) + +dnl ########################################################################### +dnl # MV_DEF_SET_COLORS +dnl # +dnl # Définit la fonction «mv_set_colors» qui (ré-)active l'utilisation de la +dnl # couleur et des attributs graphiques. +dnl # +AC_DEFUN(MV_DEF_SET_COLORS, [dnl +ifelse($#,0,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +AC_REQUIRE([MV_SET_BRACKETS])dnl +AC_REQUIRE([MV_PROG_ECHO_ESCAPE])dnl +AC_REQUIRE([MV_DEF_UNSET_COLORS])dnl +mv_set_colors() { + if test -n "$ESC"; then + RESET=${ESC}${mv_LB}0m + # video attributes + BOLD=${ESC}${mv_LB}1m + BOLD_OFF=${ESC}${mv_LB}22m + UNDERLINE=${ESC}${mv_LB}4m + UNDERLINE_OFF=${ESC}${mv_LB}24m + BLINK=${ESC}${mv_LB}5m + BLINK_OFF=${ESC}${mv_LB}25m + REVERSE=${ESC}${mv_LB}7m + REVERSE_OFF=${ESC}${mv_LB}27m + # foreground colors + BLACK=${ESC}${mv_LB}30m + RED=${ESC}${mv_LB}31m + GREEN=${ESC}${mv_LB}32m + YELLOW=${ESC}${mv_LB}33m + BLUE=${ESC}${mv_LB}34m + MAGENTA=${ESC}${mv_LB}35m + CYAN=${ESC}${mv_LB}36m + WHITE=${ESC}${mv_LB}37m + DEFAULT=${ESC}${mv_LB}39m + # background colors + BG_BLACK=${ESC}${mv_LB}40m + BG_RED=${ESC}${mv_LB}41m + BG_GREEN=${ESC}${mv_LB}42m + BG_YELLOW=${ESC}${mv_LB}43m + BG_BLUE=${ESC}${mv_LB}44m + BG_MAGENTA=${ESC}${mv_LB}45m + BG_CYAN=${ESC}${mv_LB}46m + BG_WHITE=${ESC}${mv_LB}47m + BG_DEFAULT=${ESC}${mv_LB}49m + # abreviations + B=$BOLD + b=$BOLD_OFF + U=$UNDERLINE + u=$UNDERLINE_OFF + else + mv_unset_colors + fi +}]) + +dnl ########################################################################### +dnl # MV_DEF_UNSET_COLORS +dnl # +dnl # Définit la fonction «mv_unset_colors» qui supprime l'utilisation de la +dnl # couleur et des attributs graphiques. +dnl # +AC_DEFUN(MV_DEF_UNSET_COLORS, [dnl +ifelse($#,0,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +mv_unset_colors() { + RESET= + # video attributes + BOLD= + BOLD_OFF= + UNDERLINE= + UNDERLINE_OFF= + BLINK= + BLINK_OFF= + REVERSE= + REVERSE_OFF= + # foreground colors + BLACK= + RED= + GREEN= + YELLOW= + BLUE= + MAGENTA= + CYAN= + WHITE= + DEFAULT= + # background colors + BG_BLACK= + BG_RED= + BG_GREEN= + BG_YELLOW= + BG_BLUE= + BG_MAGENTA= + BG_CYAN= + BG_WHITE= + BG_DEFAULT= + # abreviations + B= + b= + U= + u= +}]) + +dnl ########################################################################### +dnl # MV_SET_COLORS +dnl # +dnl # (Ré-)active l'utilisation de la couleur, et du rendu en général. +dnl # La réactivation sera effective, seulement si elle est possible. +dnl # +AC_DEFUN(MV_SET_COLORS, [dnl +ifelse($#,0,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +AC_REQUIRE([MV_DEF_SET_COLORS])dnl +mv_set_colors]) + +dnl ########################################################################### +dnl # MV_UNSET_COLORS +dnl # +dnl # Supprime l'utilisation de la couleur, et du rendu en général. +dnl # +AC_DEFUN(MV_UNSET_COLORS, [dnl +ifelse($#,0,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +AC_REQUIRE([MV_DEF_UNSET_COLORS])dnl +mv_unset_colors]) + +dnl ########################################################################### +dnl # MV_CONFIG_FD_IS_CHAR_DEVICE +dnl # +dnl # *** A REVOIR POUR DES ENVIRONNEMENTS NON GNU *** +dnl # Les séquences d'échappement propre au rendu des terminaux, ne seront +dnl # interprétées que si le périphérique est effectivement un terminal. +dnl # Evident, mais encore fallait-il l'écrire :-) +dnl # Cette macro permet donc de lever un peu le doute sur la nature du +dnl # périphérique. «MV_CONFIG_FD_IS_CHAR_DEVICE» va générer le programme +dnl # «config.fd_is_char_device». Il suffira de lui fournir en paramètre le +dnl # descripteur de fichier utilisé pour accéder au périphérique en +dnl # question. +dnl # +AC_DEFUN(MV_CONFIG_FD_IS_CHAR_DEVICE, [dnl +ifelse($#,0,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +{ +if test -z "$CC"; then + >&2 echo "__file__:__line__: *** FATAL ERROR: NO C COMPILER DEFINED" + exit 1 +fi + +pgm=config.fd_is_char_device + +if test ! -f $pgm; then + + changequote(«,»)dnl + cat >$pgm.c <<EOT +#include <sys/types.h> +#include <sys/stat.h> + +#include <unistd.h> + +#include <stdlib.h> + +int main(int argc, char *argv[]) +{ + int fd; + struct stat stat; + + if (argc != 2) return -1; + + fd = atoi(argv[1]); + + if (fstat(fd, &stat) == -1) return -1; + + return S_ISCHR(stat.st_mode) == 0; +} +EOT + changequote([,])dnl + + $CC -o $pgm $pgm.c + rm $pgm.c + +elif test ! -x $pgm; then + + chmod +x $pgm + +fi + +CONFIGURE_FILES="$pgm $CONFIGURE_FILES" + +unset pgm +}]) + +dnl ########################################################################### +dnl # MV_SETUP_COLORS(FD) +dnl # +AC_DEFUN(MV_SETUP_COLORS, [dnl +ifelse($#,0,mv_fd=1,ifelse($#,1,mv_fd=$1,[[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])]])) +AC_REQUIRE([MV_PROG_ECHO_ESCAPE])dnl +AC_REQUIRE([MV_DEF_SET_COLORS])dnl +AC_REQUIRE([MV_DEF_UNSET_COLORS])dnl +if test -n "$ESC" && test -t $mv_fd; then + MV_SET_COLORS + mv_colors_on_fd_$1=yes +else + MV_UNSET_COLORS + mv_colors_on_fd_$1=no +fi]) + +dnl ########################################################################### +dnl # MV_COLOR_ON(FOREGROUND, BACKGROUND) +dnl # +AC_DEFUN(MV_COLOR_ON, [dnl +ifelse($#,2,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +if test "$silent" != yes; then + MV_SETUP_COLORS(1) + if test "$mv_colors_on_fd_1" = yes; then + FOREGROUND=$[$1] + BACKGROUND=$BG_[$2] + $ECHO "COLOR ON${FOREGROUND}${BACKGROUND}" + fi +fi]) + +dnl ########################################################################### +dnl # MV_COLOR_OFF +dnl # +AC_DEFUN(MV_COLOR_OFF, [dnl +ifelse($#,0,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +if test "$silent" != yes; then + MV_SETUP_COLORS(1) + if test "$mv_colors_on_fd_1" = yes; then + $ECHO "COLOR OFF${RESET}" + fi +fi]) + +dnl ########################################################################### +dnl # MV_TERM_SIZE +dnl # +dnl # Récupère les dimensions du terminal. +dnl # Substitue «LINES» et «COLUMNS». +dnl # +dnl # o Pas portable entre U*ix: améliorer la portabilité. +dnl # o Je préfère ne pas "cacher" ces valeurs afin de permettre une +dnl # reconfiguration rapide par l'utilisateur. +dnl # +AC_DEFUN(MV_TERM_SIZE, [dnl +ifelse($#,0,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +dnl +AC_MSG_CHECKING(terminal size) +case `uname` in +Linux) + mv_term_spec=`stty size` + LINES=`echo $mv_term_spec|awk '{ print $[]1 }'` + COLUMNS=`echo $mv_term_spec|awk '{ print $[]2 }'` + unset mv_term_spec + ;; +SunOS) + mv_term_spec=`stty` +changequote(,)dnl + LINES=`echo $mv_term_spec|fgrep 'rows ='|sed 's/.*rows = \([0-9]*\).*/\1/'` + COLUMNS=`echo $mv_term_spec|fgrep 'rows ='|sed 's/.*columns = \([0-9]*\).*/\1/'` +changequote([, ])dnl + unset mv_term_spec + ;; +*) + LINES=0 + COLUMNS=0 + ;; +esac +AC_MSG_RESULT($COLUMNS x $LINES) +AC_SUBST(LINES)dnl +AC_SUBST(COLUMNS)]) + +dnl ########################################################################### +dnl # MV_MSG(TEXT [, COLOR-ATTRIBUTS ]) +dnl # +dnl # Affiche un message. +dnl # +AC_DEFUN(MV_MSG, [dnl +ifelse($#,1,,[ifelse($#,2,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])])dnl +dnl +if test "$silent" != yes; then + MV_SETUP_COLORS(1) + $ECHO "ifelse($#,2,[$2],${FOREGROUND})""$1""${RESET}${FOREGROUND-$DEFAULT}${BACKGROUND-$BG_DEFAULT}" +fi]) + +dnl ########################################################################### +dnl # MV_MSG_N(TEXT [, COLOR-ATTRIBUTS ]) +dnl # +dnl # Affiche un message sans passage à la ligne suivante. +dnl # +AC_DEFUN(MV_MSG_N, [dnl +ifelse($#,1,,[ifelse($#,2,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])])dnl +dnl +if test "$silent" != yes; then + MV_SETUP_COLORS(1) + $ECHO_N $_N "ifelse($#,2,[$2],${FOREGROUND})""$1$_C""${RESET}${FOREGROUND-$DEFAULT}${BACKGROUND-$BG_DEFAULT}" +fi]) + +dnl ########################################################################### +dnl # MV_ERR_MSG(PREFIX, TEXT [, COLOR ]) +dnl # +dnl # Affiche un message d'erreur bien visible. +dnl # +AC_DEFUN(MV_ERR_MSG, [dnl +ifelse($#,2,,[ifelse($#,3,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])])dnl +AC_REQUIRE([MV_TERM_SIZE])dnl +dnl +{ +MV_SETUP_COLORS(2) +dnl +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 "$1"; then + mv_severity="${BOLD}$1${BOLD_OFF}: " +else + mv_severity= +fi + +>&2 $ECHO "ifelse($#,3,${$3},${RED})${mv_prefix}: ${mv_decor}" + +>&2 $ECHO "ifelse($#,3,${$3},${RED})${mv_prefix}: *** ${mv_severity}patsubst([$2], [ +], [" +>&2 $ECHO "ifelse($#,3,${$3},${RED})${mv_prefix}: *** ${mv_severity}])" +>&2 $ECHO "ifelse($#,3,${$3},${RED})${mv_prefix}: ${mv_decor}${FOREGROUND-$RESET}" +unset mv_prefix +unset mv_decor + +if test "$silent" = yes; then $ECHO $_N "$RESET$_C"; fi + +}]) + +dnl ########################################################################### +dnl # MV_WARNING(TEXT [, COLOR ]) +dnl # +dnl # Le texte du message sera affiché avec l'attribut "bold". +dnl # Exemple d'utilisation: +dnl # +dnl # MV_WARNING([dnl +dnl # Ligne 1 +dnl # Ligne 2]) +dnl # +AC_DEFUN(MV_WARNING, [dnl +ifelse($#,1,,[ifelse($#,2,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])])dnl +dnl +MV_ERR_MSG(Warning,${BOLD}patsubst([$1], [ +], [${BOLD_OFF} +${BOLD}])${BOLD_OFF})]) + +dnl ########################################################################### +dnl # MV_ERROR(TEXT [, COLOR ]) +dnl # +dnl # Le texte du message sera affiché avec l'attribut "bold". +dnl # Exemple d'utilisation: +dnl # +dnl # MV_ERROR([dnl +dnl # Ligne 1 +dnl # Ligne 2]) +dnl # +AC_DEFUN(MV_ERROR, [dnl +ifelse($#,1,,[ifelse($#,2,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])])dnl +dnl +{ MV_ERR_MSG(Error,${BOLD}patsubst([$1], [ +], [${BOLD_OFF} +${BOLD}])${BOLD_OFF}); exit 1; }]) + +dnl ########################################################################### +dnl # MV_MSG_RESULT +dnl # +define(MV_MSG_RESULT, [dnl +AC_REQUIRE([MV_PROG_ECHO])dnl +$ECHO $_N "${CYAN}${_C}" +AC_MSG_RESULT([$1]) +$ECHO $_N "${FOREGROUND-$DEFAULT}$_C"]) + +dnl ########################################################################### +dnl # MV_ARG_ENABLE +dnl # +AC_DEFUN(MV_ARG_ENABLE, [dnl +{ +AC_ARG_ENABLE([$1],, [dnl + +enable_$1=`echo "$enableval"|MV_LOWER` +if test "$enable_$1" != yes; then enable_$1=no; fi], [enable_$1=yes]) +MV_MSG_RESULT([$3: $enable_$1]) + +dnl # Présentation de l'aide: +AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl +mv_len=`expr length "$2"` +n=`expr 24 - $mv_len` +v="$2" +i=$n +while >/dev/null expr $i; do + v="$v " + i=`expr $i - 1` +done +ac_help="$ac_help ${v}$3 (default=yes)" +AC_DIVERT_POP() + +if test "$enable_$1" = yes; then + : + $4 +else + : + $5 +fi +}dnl +AC_SUBST(enable_$1)]) + +dnl ########################################################################### +dnl # MV_FILL_COLUMNS(VAR, CH) +dnl # +dnl # Remplit la chaîne «VAR» avec (le caractère) «CH», autant de fois que la +dnl # largeur du teminal. +dnl # +AC_DEFUN(MV_FILL_COLUMNS, [dnl +ifelse($#,2,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +AC_REQUIRE([MV_TERM_SIZE])dnl +MV_CONCAT($1, $COLUMNS, $2)]) + +dnl ########################################################################### +dnl # MV_FILL_BACKGROUND(VAR, CH) +dnl # +dnl # Remplit la chaîne «VAR» avec (le caractère) «CH», autant de fois que la +dnl # largeur du teminal, et ajoute le caractère «\r». +dnl # +AC_DEFUN(MV_FILL_BACKGROUND, [dnl +ifelse($#,2,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +MV_FILL_COLUMNS($1, $2); $1="$[]$1\r"]) + +dnl ########################################################################### +dnl # MV_PROG_AUTOCONF +dnl # +AC_DEFUN(MV_PROG_AUTOCONF, [AC_CHECK_PROGS(AUTOCONF, autoconf, :)]) + +dnl ########################################################################### +dnl # MV_PROG_ACLOCAL +dnl # +AC_DEFUN(MV_PROG_ACLOCAL, [AC_CHECK_PROGS(ACLOCAL, aclocal, :)]) + +dnl ########################################################################### +dnl # MV_PROG_CTRACE +dnl # +AC_DEFUN(MV_PROG_CTRACE, [AC_CHECK_PROGS(CTRACE, ctrace, cat)]) + +AC_DEFUN(MV_PROG_CTRACE2, [dnl +ifelse($#,0,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +dnl +{ +if test "$CTRACE" = yes; then + PATH_saved=$PATH + if test "$with_xc_libraries" = yes; then + PATH=.:$PATH + AC_PATH_PROG(CTRACE, ctrace) + elif test -n "$with_xc_libraries" -a "$with_xc_libraries" != no; then + CTRACE="LD_LIBRARY_PATH=$with_xc_libraries:$LD_LIBRARY_PATH `cd $with_xc_libraries && pwd`/ctrace" + AC_MSG_RESULT(ctrace path set to $with_xc_libraries/ctrace) + else + PATH=.:$PATH + LD_LIBRARY_PATH_saved=$LD_LIBRARY_PATH + LD_LIBRARY_PATH=$with_xc_libraries:$LD_LIBRARY_PATH + AC_PATH_PROG(CTRACE, ctrace) + LD_LIBRARY_PATH=$LD_LIBRARY_PATH_saved + fi + PATH=$PATH_saved +else + CTRACE=cat +fi + +AC_SUBST(CTRACE) + +}]) + +dnl ########################################################################### +dnl # MV_TOPDIR +dnl # +AC_DEFUN(MV_TOPDIR, [dnl + +topdir=`/bin/pwd` + +AC_SUBST(topdir)]) + +dnl ########################################################################### +dnl # MV_STANDARD +dnl # +AC_DEFUN(MV_STANDARD, [dnl +ifelse($#,0,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +AC_REQUIRE([MV_PROG_ECHO_ESCAPE])dnl +AC_REQUIRE([MV_DEF_SET_COLORS])dnl +AC_REQUIRE([AC_PROG_LN_S])dnl +AC_REQUIRE([MV_PROG_AUTOCONF])dnl +AC_REQUIRE([MV_PROG_ACLOCAL])dnl +AC_REQUIRE([MV_PROG_CTRACE])dnl +AC_REQUIRE([AC_PROG_RANLIB])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +AC_REQUIRE([MV_TOPDIR])dnl +]) + +dnl ########################################################################### +dnl # MV_TRANSFORM_MODULES(SRC-DIRS, LNK-DIR, &MODULES) +dnl # +AC_DEFUN(MV_TRANSFORM_MODULES, [dnl +ifelse($#,3,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +AC_REQUIRE([AC_PROG_LN_S])dnl +{ +AC_MSG_RESULT(transforming module's names) + +mv_SRC_DIRS=$1 +mv_LNK_DIR=$2 +mv_MODULES=$$3 + +for mv_dir in $mv_SRC_DIRS; do + if test ! -d $mv_dir; then + MV_WARNING([dnl +No «`basename $mv_dir`» directory +in `dirname $mv_dir`]) + fi +done + +if test ! -d $mv_LNK_DIR; then mkdir -p $mv_LNK_DIR; fi + +TRANSFORM_MODULES= + +for m in $mv_MODULES; do + m=`echo $m|sed 's/\.o$//'` + ok=no + for d in $mv_SRC_DIRS; do + fs=$d/$m.cc + if test -f $fs; then + ok=yes + fl=$mv_LNK_DIR/`echo $m.cc|sed 's/\//__/g'` + TRANSFORM_MODULES="$TRANSFORM_MODULES $fl" + if test ! -L $fl; then + MV_MSG_RESULT([ ]- `basename $fl`) + ( cd `dirname $fl` && $LN_S $fs `basename $fl` ) + fi + else + fs=$d/$m.c + if test -f $fs; then + ok=yes + fl=$mv_LNK_DIR/`echo $m.c|sed 's/\//__/g'` + TRANSFORM_MODULES="$TRANSFORM_MODULES $fl" + if test ! -L $fl; then + MV_MSG_RESULT([ ]- `basename $fl`) + ( cd `dirname $fl` && $LN_S $fs `basename $fl` ) + fi + fi + fi + if test $ok = no; then MV_ERROR(Le fichier «$fs» n'existe pas); fi + done +done + +mv_modules= +for mv_mod in $mv_MODULES; do + mv_modules="$mv_modules `echo $mv_mod|sed 's/\//__/g'`" +done + +$3=$mv_modules + +AC_SUBST(TRANSFORM_MODULES)dnl + +}]) + +dnl ########################################################################### +dnl # MV_CONFIG_RULES(CONFIG-FILES, PRE-COMMAND, FILENAME) +dnl # +dnl # Génère le fichier, dont le nom sera par défaut «config.rules», +dnl # contenant les règles destinées à la mise-à-jour des fichiers FILES. +dnl # +define(MV_CONFIG_RULES, [dnl +AC_REQUIRE([MV_TOPDIR])dnl + +mv_config_files="$1" + +ifelse($#,3,[CONFIG_RULES=$3],[CONFIG_RULES=config.rules]) + +if test ! -f $CONFIG_RULES; then + echo "creating $CONFIG_RULES" + touch $CONFIG_RULES + >>$CONFIG_RULES echo '## -*- makefile -*-' + >>$CONFIG_RULES echo '## Generated automatically by configure.' + >>$CONFIG_RULES echo '' + >>$CONFIG_RULES echo '##--------------------------------------------------' + >>$CONFIG_RULES echo '## Inclure ce fichier dans un makefile pour gérer la' + >>$CONFIG_RULES echo '## mise-à-jour des fichiers configurés.' + >>$CONFIG_RULES echo '##--------------------------------------------------' + >>$CONFIG_RULES echo '' +else + echo "updating $CONFIG_RULES" +fi + +for mv_cf in $mv_config_files; do + case $mv_cf in + *:*) + mv_of=`echo $mv_cf|sed 's%:.*$%%'` + mv_cf=`echo $mv_cf|sed 's%^.*:%%'` + ;; + *) + mv_of=$mv_cf + mv_cf=$mv_cf.in + ;; + esac + mv_string1='$(topdir)/'$mv_of': $(top_srcdir)/'$mv_cf + mv_string2=' cd $(topdir) && CONFIG_FILES='$mv_of':'$mv_cf' ./config.status' + if >/dev/null grep -Fx "$mv_string1" $CONFIG_RULES; then + continue + fi + >>$CONFIG_RULES echo "$mv_string1" +ifelse($#,2,[dnl + >>$CONFIG_RULES echo ' ]$2[' +], ifelse($#,3,[dnl + >>$CONFIG_RULES echo ' ]$2[' +])) + >>$CONFIG_RULES echo "$mv_string2" + >>$CONFIG_RULES echo '' +done + +dnl # Il faudra que je trouve la technique M4 (et non shell) pour que le +dnl # traitement final effectif de MV_CONFIG_RULES, se fasse lors du dernier +dnl # appel de la macro (voir AC_DIVERSION...). +>>$CONFIG_RULES echo '## [END OF FILE]' + +CONFIGURE_FILES="`echo $CONFIG_RULES $CONFIGURE_FILES`" + +AC_SUBST(CONFIG_RULES)]) + +dnl ########################################################################### +dnl # MV_OUTPUT(CONFIG-FILES, EXTRA-CMDS, INIT-CMDS) +dnl # +dnl # Idem que «AC_OUTPUT», et substitue «OUTPUT_FILES» et «CONFIGURE_FILES». +dnl # Ces deux variables sont utiles pour nettoyer la distribution. Exemple: +dnl # +dnl # distclean:: ; $(RM) @OUTPUT_FILES@ @CONFIGURE_FILES@ +dnl # +AC_DEFUN(MV_OUTPUT, [dnl + +mv_config_files="$1" + +OUTPUT_FILES= +for mv_cf in $mv_config_files; do + case $mv_cf in + *:*) OUTPUT_FILES="$OUTPUT_FILES `echo $mv_cf|sed 's%:.*$%%'`";; + *) OUTPUT_FILES="$OUTPUT_FILES $mv_cf";; + esac +done + +OUTPUT_FILES=`echo $OUTPUT_FILES` + +CONFIGURE_FILES="`echo $CONFIGURE_FILES config.log config.status config.cache`" + +AC_SUBST(OUTPUT_FILES)dnl +AC_SUBST(CONFIGURE_FILES)dnl + +AC_OUTPUT($mv_config_files, $2, $3)]) + +dnl ########################################################################### +dnl # MV_MKLOG +dnl # +dnl # Macro très spécialisée destinée à l'affichage dans LAYER-SYSTEM. +dnl # Substitue «MK_MKLOG» et «MK_BG_SPACES». +dnl # Remis à jour à chaque appel de configure. +dnl # +AC_DEFUN(MV_MKLOG, [dnl +ifelse($#,0,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +MV_FILL_BACKGROUND(MK_MKLOG, [.]) +MV_CONCAT(MK_MKLOG,`expr $COLUMNS / 8`,\\t) +MV_FILL_BACKGROUND(MK_BG_SPACES, [[[ ]]]) +AC_SUBST(MK_MKLOG)dnl +AC_SUBST(MK_BG_SPACES)]) + +dnl ########################################################################### +dnl # MV_MK_STANDARD +dnl # +AC_DEFUN(MV_MK_STANDARD, [dnl +ifelse($#,0,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl + +AC_CONFIG_AUX_DIR(mk) +MV_STANDARD +MV_TOLOWER +MV_TOUPPER +MV_MKLOG + +PACKAGE=${PACKAGE-PACKAGE} +VERSION=${VERSION-0.0.0} +SOMAJOR=${SOMAJOR-`echo $VERSION|sed 's/\..*//'`} + +pkgdatadir=$datadir/$PACKAGE +pkgsysconfdir=$sysconfdir/$PACKAGE +pkglocalstatedir=$localstatedir/$PACKAGE +pkgsharedstatedir=$sharedstatedir/$PACKAGE +package_data=$pkgdatadir/data + +dnl # Obligatoires: +AC_SUBST(PACKAGE)dnl +AC_SUBST(VERSION)dnl +dnl # Ici car très communément utilisés: +AC_SUBST(PROGRAMS)dnl +AC_SUBST(INCNAME)dnl +AC_SUBST(LIBNAME)dnl +AC_SUBST(ARCHIVE)dnl +AC_SUBST(LIBRARY)dnl +AC_SUBST(SOMAJOR)dnl +AC_SUBST(LIBSONAME)dnl +AC_SUBST(MODULES)dnl +AC_SUBST(PLUGINS)dnl +AC_SUBST(HEADERS)dnl +AC_SUBST(MANUALS)dnl +AC_SUBST(SUBDIRS)dnl +dnl # Diverses variables employées par LAYER-SYSTEM: +AC_SUBST(LAYERS)dnl +AC_SUBST(DEPINCS)dnl +AC_SUBST(DEPLIBS)dnl +AC_SUBST(DEFINES)dnl +AC_SUBST(INCLUDES)dnl +AC_SUBST(LIBRARIES)dnl +AC_SUBST(RPATH)dnl +AC_SUBST(LOCAL_LNK_DIR)dnl +AC_SUBST(LOCAL_SRC_DIRS)dnl +AC_SUBST(LOCAL_INC_DIRS)dnl +AC_SUBST(LOCAL_MAN_DIRS)dnl + +AC_SUBST(pkgdatadir)dnl +AC_SUBST(pkgsysconfdir)dnl +AC_SUBST(pkglocalstatedir)dnl +AC_SUBST(pkgsharedstatedir)dnl +AC_SUBST(package_data)dnl + +dnl ## +dnl # PERL PART +AC_SUBST(PERL)dnl +dnl ## +dnl # PYTHON PART +AC_SUBST(PYTHON)dnl +AC_SUBST(PYTHON_VERSION)dnl +AC_SUBST(PYTHON_LIBDIR)dnl +dnl ## +dnl # C PART +AC_SUBST(CC)dnl +AC_SUBST(CPP)dnl +dnl ## +dnl # C++ PART +AC_SUBST(CXX)dnl +AC_SUBST(CXXCPP)dnl +]) + +dnl ########################################################################### +dnl # MV_MK_OUTPUT(MAKEFILE-NAME, SUBDIRS, CONFIG-FILES, EXTRA-CMDS, INIT-CMDS) +dnl # +dnl # Idem que «MV_OUTPUT», mais gère en plus les fichiers pour LAYER-SYSTEM +dnl # grâce au fichier «system.rules» qui sera généré. +dnl # Prend 2 paramètres supplémentaires afin d'indiquer les makefile à créer +dnl # à l'aide de la liste des répertoires fournis. +dnl # Substitue les variables «topdir» et «makefile». +dnl # Appel également MV_TRANSFORM_MODULES. +dnl # +AC_DEFUN(MV_MK_OUTPUT, [dnl + +MV_MK_STANDARD + +dnl # Cette partie est certainement à isoler dans une macro à part... + +abssrcdir=`cd $srcdir && /bin/pwd` + +LOCAL_INC_DIRS=`for d in $LOCAL_INC_DIRS; do echo -n " $abssrcdir/$d"; done` +LOCAL_SRC_DIRS=`for d in $LOCAL_SRC_DIRS; do echo -n " $abssrcdir/$d"; done` +LOCAL_MAN_DIRS=`for d in $LOCAL_MAN_DIRS; do echo -n " $abssrcdir/$d"; done` + +if test -n "$LOCAL_LNK_DIR"; then + LOCAL_LNK_DIR=$topdir/$LOCAL_LNK_DIR + MV_TRANSFORM_MODULES($LOCAL_SRC_DIRS, $LOCAL_LNK_DIR, MODULES) +fi + +dnl # + +makefile=$1 +mv_subdirs="$2" + +if test ! -d $srcdir/mk; then + MV_ERROR([dnl +No «mk» (LAYER-SYSTEM) directory +in «$srcdir»]) +fi + +if test ! -f $srcdir/mk/private.mk.in; then + MV_ERROR([dnl +No «mk/private.mk.in» (LAYER-SYSTEM) file +in «$srcdir»]) +fi + +# Prise en compte automatique des fichiers de LAYER-SYSTEM +mv_system_files=`cd $srcdir && 2>/dev/null ls mk/*.in|fgrep -xv mk/private.mk.in|sed 's/\.in$//g'` + +if test -z "$mv_system_files"; then + MV_WARNING([dnl +No LAYER-SYSTEM files +in «$srcdir/mk/»]) +fi + +MV_CONFIG_RULES($mv_system_files, [@ $(~autoconf)], system.rules) + +mv_config_files=$mv_system_files + +if test -n "$makefile" -a -n "$mv_subdirs"; then + for mv_subdir in $mv_subdirs; do + if test ! -d $srcdir/$mv_subdir; then + MV_ERROR([No «$mv_subdir» directory!]) + fi + if test ! -f $srcdir/$mv_subdir/$makefile.in; then + MV_ERROR([No $makefile in «$mv_subdir» source directory!]) + fi + mv_config_files="$mv_config_files $mv_subdir/.private.mk:mk/private.mk.in" + mv_config_files="$mv_config_files $mv_subdir/$makefile" + done +fi + +AC_SUBST(makefile)dnl + +MV_OUTPUT($mv_config_files $3, $4, $5)]) + +dnl ########################################################################### +dnl # MV_SET_GCC_OPTIONS +dnl # +AC_DEFUN(MV_SET_GCC_OPTIONS, [dnl +dnl +GCC_OVERALL_OPTIONS=" -pipe" +GCC_WARNING_OPTIONS=" -Wall -W -Wmissing-prototypes -Wshadow -Wwrite-strings\ + -Wcast-qual -Winline" +GCC_DEBUG_OPTIONS=" -fno-builtin -g" +# OPTIMIZE: Attention «-fshort-enums» est très délicat à utiliser. Il impose +# que tous les composants d'une application aient été générés de cette manière. +GCC_OPTIMIZE_OPTIONS=" -O2 -ffast-math -fomit-frame-pointer" +GCC_PIC_OPTIONS=" -fPIC" +GNU_LINKER_OPTIONS=" -warn-once -warn-common" + +if test -n "`echo $GNU_LINKER_OPTIONS`"; then + GCC_LINKER_OPTIONS="\ + $GCC_LINKER_OPTIONS -Wl,`echo $GNU_LINKER_OPTIONS|sed 's/ /,/g'`" +fi + +GCC_SHARED_OPTIONS=" -shared" +dnl +AC_SUBST(GCC_WARNING_OPTIONS)dnl +AC_SUBST(GCC_DEBUG_OPTIONS)dnl +AC_SUBST(GCC_OPTIMIZE_OPTIONS)dnl +AC_SUBST(GCC_PIC_OPTIONS)dnl +AC_SUBST(GCC_LINKER_OPTIONS)dnl +AC_SUBST(GCC_SHARED_OPTIONS)]) + +dnl ########################################################################### +dnl # MV_SET_GXX_OPTIONS +dnl # +AC_DEFUN(MV_SET_GXX_OPTIONS, [dnl +dnl +GXX_OVERALL_OPTIONS=" -pipe" +GXX_WARNING_OPTIONS=" -Wall -W -Wmissing-prototypes -Wshadow -Wwrite-strings\ + -Wcast-qual -Winline" +GXX_DEBUG_OPTIONS=" -fno-builtin -g" +# OPTIMIZE: Attention «-fshort-enums» est très délicat à utiliser. Il impose +# que tous les composants d'une application aient été générés de cette manière. +GXX_OPTIMIZE_OPTIONS=" -O2 -ffast-math -fomit-frame-pointer" +GXX_PIC_OPTIONS=" -fPIC" +GNU_LINKER_OPTIONS=" -warn-once -warn-common" + +if test -n "`echo $GNU_LINKER_OPTIONS`"; then + GXX_LINKER_OPTIONS="\ + $GXX_LINKER_OPTIONS -Wl,`echo $GNU_LINKER_OPTIONS|sed 's/ /,/g'`" +fi + +GXX_SHARED_OPTIONS=" -shared" +dnl +AC_SUBST(GXX_WARNING_OPTIONS)dnl +AC_SUBST(GXX_DEBUG_OPTIONS)dnl +AC_SUBST(GXX_OPTIMIZE_OPTIONS)dnl +AC_SUBST(GXX_PIC_OPTIONS)dnl +AC_SUBST(GXX_LINKER_OPTIONS)dnl +AC_SUBST(GXX_SHARED_OPTIONS)]) + +dnl ########################################################################### +dnl # MV_PROG_GCC(-pipe -ansi -pedantic ...) +dnl # +dnl # Vite fait, bien fait ;-) +dnl # Impose gcc comme compilateur C. +dnl # Définit CC et CPP, ainsi que d'autres variables à utiliser dans un +dnl # makefile. +dnl # +AC_DEFUN(MV_PROG_GCC, [dnl +AC_BEFORE([$0], MV_CONFIG_FD_IS_CHAR_DEVICE)dnl +AC_REQUIRE([MV_SET_GCC_OPTIONS])dnl +MV_MSG_RESULT([GNU C compiler set]) +AC_CACHE_VAL(ac_cv_prog_CC, [ac_cv_prog_CC=`echo gcc $1`]) +CC=$ac_cv_prog_CC +AC_PROG_CC_WORKS +AC_PROG_CC_GNU +AC_PROG_CC_G +if test $ac_cv_prog_gcc = yes; then GCC=yes; else GCC=; fi +AC_CACHE_VAL(ac_cv_prog_CPP, [ac_cv_prog_CPP="$CC -E"]) +CPP=$ac_cv_prog_CPP +CC_WARNING_OPTIONS='$(GCC_WARNING_OPTIONS)' +CC_DEBUG_OPTIONS='$(GCC_DEBUG_OPTIONS)' +CC_OPTIMIZE_OPTIONS='$(GCC_OPTIMIZE_OPTIONS)' +CC_PIC_OPTIONS='$(GCC_PIC_OPTIONS)' +CC_LINKER_OPTIONS='$(GCC_LINKER_OPTIONS)' +CC_SHARED_OPTIONS='$(GCC_SHARED_OPTIONS)' +AC_SUBST(GCC)dnl +AC_SUBST(CC)dnl +AC_SUBST(CPP)dnl +AC_SUBST(CC_WARNING_OPTIONS)dnl +AC_SUBST(CC_DEBUG_OPTIONS)dnl +AC_SUBST(CC_OPTIMIZE_OPTIONS)dnl +AC_SUBST(CC_PIC_OPTIONS)dnl +AC_SUBST(CC_LINKER_OPTIONS)dnl +AC_SUBST(CC_SHARED_OPTIONS)]) + +dnl ########################################################################### +dnl # MV_PROG_GXX(-pipe -ansi -pedantic ...) +dnl # +dnl # Vite fait, bien fait ;-) +dnl # Impose g++ comme compilateur C++. +dnl # Définit CXX et CXXCPP, ainsi que d'autres variables à utiliser dans un +dnl # makefile. +dnl # +AC_DEFUN(MV_PROG_GXX, [dnl +AC_BEFORE([$0], MV_CONFIG_FD_IS_CHAR_DEVICE)dnl +AC_REQUIRE([MV_SET_GXX_OPTIONS])dnl +MV_MSG_RESULT([GNU C++ compiler set]) +AC_CACHE_VAL(ac_cv_prog_CXX, [ac_cv_prog_CXX=`echo g++ $1`]) +CXX=$ac_cv_prog_CXX +AC_PROG_CXX_WORKS +AC_PROG_CXX_GNU +AC_PROG_CXX_G +if test $ac_cv_prog_gxx = yes; then GXX=yes; else GXX=; fi +AC_CACHE_VAL(ac_cv_prog_CXXCPP, [ac_cv_prog_CXXCPP="$CXX -E"]) +CXXCPP=$ac_cv_prog_CXXCPP +CXX_WARNING_OPTIONS='$(GXX_WARNING_OPTIONS)' +CXX_DEBUG_OPTIONS='$(GXX_DEBUG_OPTIONS)' +CXX_OPTIMIZE_OPTIONS='$(GXX_OPTIMIZE_OPTIONS)' +CXX_PIC_OPTIONS='$(GXX_PIC_OPTIONS)' +CXX_LINKER_OPTIONS='$(GXX_LINKER_OPTIONS)' +CXX_SHARED_OPTIONS='$(GXX_SHARED_OPTIONS)' +AC_SUBST(GXX)dnl +AC_SUBST(CXX)dnl +AC_SUBST(CXXCPP)dnl +AC_SUBST(CXX_WARNING_OPTIONS)dnl +AC_SUBST(CXX_DEBUG_OPTIONS)dnl +AC_SUBST(CXX_OPTIMIZE_OPTIONS)dnl +AC_SUBST(CXX_PIC_OPTIONS)dnl +AC_SUBST(CXX_LINKER_OPTIONS)dnl +AC_SUBST(CXX_SHARED_OPTIONS)]) + +dnl ########################################################################### +dnl # MV_PROG_CC +dnl # +dnl # Comme AC_PROG_CC, avec AC_PROG_CPP, et quelques trucs en plus. +dnl # Définit également des options qui seront choisies en appelant make. +dnl # +AC_DEFUN(MV_PROG_CC, [dnl +AC_BEFORE([$0], MV_CONFIG_FD_IS_CHAR_DEVICE)dnl +AC_REQUIRE([MV_SET_GCC_OPTIONS])dnl +{ +dnl # If the user did not set CFLAGS, set it now to keep +dnl # the AC_PROG_CC macro from adding "-g -O2". +if test "${CFLAGS+set}" != set; then CFLAGS=; fi +AC_PROG_CC +if test "$GCC" = yes; then + MV_MSG_RESULT([Congratulations: You are using GNU CC ($CC). The best!]) + CC_OVERALL_OPTIONS=$GCC_OVERALL_OPTIONS + CC_WARNING_OPTIONS='$(GCC_WARNING_OPTIONS)' + CC_DEBUG_OPTIONS='$(GCC_DEBUG_OPTIONS)' + CC_OPTIMIZE_OPTIONS='$(GCC_OPTIMIZE_OPTIONS)' + CC_PIC_OPTIONS='$(GCC_PIC_OPTIONS)' + CC_SHARED_OPTIONS='$(GCC_SHARED_OPTIONS)' + CC_LINKER_OPTIONS='$(GCC_LINKER_OPTIONS)' +else + AC_MSG_RESULT([Why don't use GNU CC?]) +fi +CC=`echo $CC $CC_OVERALL_OPTIONS` +AC_PROG_CPP +} +AC_SUBST(GCC)dnl +AC_SUBST(CC_WARNING_OPTIONS)dnl +AC_SUBST(CC_DEBUG_OPTIONS)dnl +AC_SUBST(CC_OPTIMIZE_OPTIONS)dnl +AC_SUBST(CC_PIC_OPTIONS)dnl +AC_SUBST(CC_LINKER_OPTIONS)dnl +AC_SUBST(CC_SHARED_OPTIONS)dnl +]) + +dnl ########################################################################### +dnl # MV_PROG_CXX +dnl # +dnl # Comme AC_PROG_CXX, avec AC_PROG_CXXCPP, et quelques trucs en plus. +dnl # Définit également des options qui seront choisies en appelant make. +dnl # +AC_DEFUN(MV_PROG_CXX, [dnl +AC_BEFORE([$0], MV_CONFIG_FD_IS_CHAR_DEVICE)dnl +AC_REQUIRE([MV_SET_GXX_OPTIONS])dnl +{ +dnl # If the user did not set CFLAGS, set it now to keep +dnl # the AC_PROG_CXX macro from adding "-g -O2". +if test "${CFLAGS+set}" != set; then CFLAGS=; fi +AC_PROG_CXX +if test "$GXX" = yes; then + MV_MSG_RESULT([Congratulations: You are using GNU CXX ($CXX). The best!]) + CXX_OVERALL_OPTIONS=$GXX_OVERALL_OPTIONS + CXX_WARNING_OPTIONS='$(GXX_WARNING_OPTIONS)' + CXX_DEBUG_OPTIONS='$(GXX_DEBUG_OPTIONS)' + CXX_OPTIMIZE_OPTIONS='$(GXX_OPTIMIZE_OPTIONS)' + CXX_PIC_OPTIONS='$(GXX_PIC_OPTIONS)' + CXX_SHARED_OPTIONS='$(GXX_SHARED_OPTIONS)' + CXX_LINKER_OPTIONS='$(GXX_LINKER_OPTIONS)' +else + AC_MSG_RESULT([Why don't use GNU C++?]) +fi +CXX=`echo $CXX $CXX_OVERALL_OPTIONS` +AC_PROG_CXXCPP +} +AC_SUBST(GXX)dnl +AC_SUBST(CXX_WARNING_OPTIONS)dnl +AC_SUBST(CXX_DEBUG_OPTIONS)dnl +AC_SUBST(CXX_OPTIMIZE_OPTIONS)dnl +AC_SUBST(CXX_PIC_OPTIONS)dnl +AC_SUBST(CXX_LINKER_OPTIONS)dnl +AC_SUBST(CXX_SHARED_OPTIONS)dnl +]) + +dnl ########################################################################### +dnl # A REVOIR/A RELIRE +dnl ########################################################################### + +dnl ########################################################################### +dnl # MV_PREFIX_PROGRAM +dnl # +dnl # Une simple ré-écriture de «AC_PREFIX_PROGRAM» juste pour autoriser le +dnl # caractère «-» dans le nom du programme. +dnl # +AC_DEFUN(MV_PREFIX_PROGRAM, [dnl +if test "x$prefix" = xNONE; then +changequote(«, »)dnl +define(«AC_VAR_NAME», translit($1, -[a-z], _[A-Z]))dnl +changequote([,])dnl +dnl We reimplement AC_MSG_CHECKING (mostly) to avoid the ... in the middle. +echo $ac_n "checking for prefix by $ac_c" 1>&AC_FD_MSG +AC_PATH_PROG(AC_VAR_NAME, $1) +changequote(«,»)dnl + if test -n "$ac_cv_path_«»AC_VAR_NAME"; then + prefix=`echo $ac_cv_path_«»AC_VAR_NAME|sed 's%/[^/][^/]*//*[^/][^/]*$%%'` +changequote([,])dnl + fi +fi +undefine([AC_VAR_NAME])]) + +dnl ########################################################################### +dnl # MV_PROG_MKDIRHIER +dnl # +AC_DEFUN(MV_PROG_MKDIRHIER, [dnl +if test `uname` = Linux; then + AC_PATH_PROGS(MKDIRHIER, mkinstalldirs mkdirhier, install -d, $PATH:$srcdir) +else + AC_PATH_PROGS(MKDIRHIER, mkinstalldirs mkdirhier, mkdir -p, $PATH:$srcdir) +fi]) + +dnl ########################################################################### +dnl # MV_PROG_RMDIRHIER +dnl # +AC_DEFUN(MV_PROG_RMDIRHIER, [dnl +if test `uname` = Linux; then + AC_PATH_PROG(RMDIRHIER, rmdirhier, rmdir -p, $PATH:$srcdir) +else + RMDIRHIER="rmdir -p" +fi]) + +dnl ########################################################################### +dnl # MV_PROG_LD +dnl # +AC_DEFUN(MV_PROG_LD, [dnl +AC_MSG_CHECKING(for the \"front-end\" linker to use) +ifelse(AC_LANG, C, [ + LD=$CC + AC_MSG_RESULT($LD)], + ifelse(AC_LANG, CPLUSPLUS, [ + LD=$CXX + AC_MSG_RESULT($LD)], + LD=${CC:-cc} + AC_MSG_RESULT($LD))) +AC_SUBST(LD)]) + +dnl ########################################################################### +dnl # MV_PROG_PERL(MIN-VERSION) +dnl # +AC_DEFUN(MV_PROG_PERL, [{dnl + +mv_requested_version=$1 + +changequote(,) +mv_requested_major_version=`echo $mv_requested_version|sed -n 's/^\([^.]*\).*$/\1/p'` +mv_requested_version=`echo $mv_requested_version|sed -n "s/^$mv_requested_major_version\.\(.*$\)/\1/p"` +mv_requested_minor_version=`echo $mv_requested_version|sed -n 's/^\([^.]*\).*$/\1/p'` +mv_requested_version=`echo $mv_requested_version|sed -n "s/^$mv_requested_minor_version\.\(.*$\)/\1/p"` +mv_requested_micro_version=`echo $mv_requested_version|sed -n 's/^\([^.]*\).*$/\1/p'` +mv_requested_version=`echo $mv_requested_version|sed -n "s/^$mv_requested_micro_version\.\(.*$\)/\1/p"` +changequote([,]) + +if test -z "$mv_requested_major_version"\ + -o -z "$mv_requested_minor_version"\ + -o -z "$mv_requested_micro_version"\ + -o -n "$mv_requested_version"; then + test "$silent" != yes && MV_WARNING(Un problème d'analyse de la version demandée de Perl) +fi + +mv_requested_major_version=`echo $mv_requested_major_version|sed 's/^0*//'` +mv_requested_minor_version=`echo $mv_requested_minor_version|sed 's/^0*//'` +mv_requested_micro_version=`echo $mv_requested_micro_version|sed 's/^0*//'` + +mv_requested_version=$mv_requested_major_version.$mv_requested_minor_version.$mv_requested_micro_version + +MV_MSG(You want Perl version \"$mv_requested_version\":, $CYAN) + +AC_CHECK_PROGS(PERL, perl) + +if test -z "$PERL"; then MV_ERROR(No PERL interpreter found!!!); fi + +AC_REQUIRE([MV_SET_BRACKETS])dnl +mv_string='print $'"${mv_RB};" +PERL_VERSION=`$PERL -e "$mv_string;"` +MV_MSG_N(Perl version found is \"$PERL_VERSION\"..., $CYAN) + +changequote(,) +PERL_MAJOR_VERSION=`echo $PERL_VERSION|sed -n 's/^\([^.]*\).*$/\1/p'` +PERL_VERSION=`echo $PERL_VERSION|sed -n "s/^$PERL_MAJOR_VERSION\.\(.*$\)/\1/p"` +PERL_MINOR_VERSION=`echo $PERL_VERSION|sed -n 's/^\(...\).*$/\1/p'` +PERL_VERSION=`echo $PERL_VERSION|sed -n "s/^$PERL_MINOR_VERSION\(.*$\)/\1/p"` +dnl # Un doute ici: 03 doit-il correspondre à 3 ou 30? +PERL_MICRO_VERSION=$PERL_VERSION +changequote([,]) + +if test -z "$PERL_MAJOR_VERSION"\ + -o -z "$PERL_MINOR_VERSION"\ + -o -z "$PERL_MICRO_VERSION"; then + test "$silent" != yes && MV_MSG(); MV_WARNING(Un problème d'analyse de la version trouvée de Perl) +fi + +PERL_MAJOR_VERSION=`echo $PERL_MAJOR_VERSION|sed 's/^0*//'` +PERL_MINOR_VERSION=`echo $PERL_MINOR_VERSION|sed 's/^0*//'` +PERL_MICRO_VERSION=`echo $PERL_MICRO_VERSION|sed 's/^0*//'` + +AC_SUBST(PERL_MAJOR_VERSION)dnl +AC_SUBST(PERL_MINOR_VERSION)dnl +AC_SUBST(PERL_MICRO_VERSION)dnl + +PERL_VERSION=$PERL_MAJOR_VERSION.$PERL_MINOR_VERSION.$PERL_MICRO_VERSION + +AC_SUBST(PERL_VERSION)dnl + +MV_MSG([ ]and standardized version is \"$PERL_VERSION\", $CYAN) + +if test $PERL_MAJOR_VERSION -lt $mv_requested_major_version\ + -o $PERL_MINOR_VERSION -lt $mv_requested_minor_version\ + -o $PERL_MICRO_VERSION -lt $mv_requested_micro_version; then + test "$silent" != yes && MV_WARNING(La version demandée de Perl n'a pas été trouvée) +else + MV_MSG(Fine: Version of Perl requested is found, $CYAN) +fi + +}]) + +dnl ########################################################################### +dnl # MV_AUTOCONF_DIRS +dnl # +AC_DEFUN(MV_AUTOCONF_DIRS, [dnl +dnl # +test "$prefix" = NONE && prefix=$ac_default_prefix +test "$exec_prefix" = NONE && exec_prefix=$prefix +dnl # +test "$libdir" = '${exec_prefix}/lib' && libdir=${exec_prefix}/lib +test "$libexecdir" = '${exec_prefix}/libexec' && libexecdir=${exec_prefix}/libexec +test "$sbindir" = '${exec_prefix}/sbin' && sbindir=${exec_prefix}/sbin +test "$bindir" = '${exec_prefix}/bin' && bindir=${exec_prefix}/bin +test "$datadir" = '${prefix}/share' && datadir=${prefix}/share +test "$sysconfdir" = '${prefix}/etc' && sysconfdir=${prefix}/etc +test "$localstatedir" = '${prefix}/var' && localstatedir=${prefix}/var +test "$sharedstatedir" = '${prefix}/com' && sharedstatedir=${prefix}/com +test "$mandir" = '${prefix}/man' && mandir=${prefix}/man +test "$infodir" = '${prefix}/info' && infodir=${prefix}/info +test "$includedir" = '${prefix}/include' && includedir=${prefix}/include]) + +dnl ########################################################################### +dnl # MV_CHECK_CONFIG_FILES +dnl # +AC_DEFUN(MV_CHECK_CONFIG_FILES, [dnl +for i in $CONFIG_FILES; do + case $i in + *:*) + t=`echo $i | sed 's/^.*://'` + ;; + *) + t=$i.in + ;; + esac + if test ! -f $srcdir/$t; then + dir=`dirname $srcdir/$t` + if test ! -d $dir; then + MV_ERROR([Le répertoire «$dir» n'existe pas]) + fi + MV_ERROR([Le fichier «$srcdir/$t» n'existe pas]) + fi +done]) + +dnl ########################################################################### +dnl # MV_DO_MICO +dnl # +AC_DEFUN(MV_DO_MICO, [dnl +AC_CHECK_PROGS(IDL, idl) +if test -n "$IDL"; then + version_string=`$IDL --version` + if test "`echo $version_string | awk '{ print [$]1 }'`" = MICO; then + AC_DEFINE(__MICO__) + MICO_VERSION=`echo $version_string | awk '{ print [$]3 }'` + echo "MICO Version $MICO_VERSION found" + IDL='idl --c++-suffix=$(strip $''1) --hh-suffix=$(strip $''2)' + AC_SUBST(IDL) + IDL_BOA="$IDL --boa --no-poa" + IDL_POA="$IDL --poa --no-boa" + IDL_BOA_POA="$IDL --boa --poa" + IDL_POA_BOA="$IDL --poa --boa" + AC_SUBST(IDL_BOA) + AC_SUBST(IDL_POA) + AC_SUBST(IDL_BOA_POA) + AC_SUBST(IDL_POA_BOA) + AC_CHECK_LIB(mico$MICO_VERSION, main) + fi +fi]) + +dnl ########################################################################### +dnl # MV_DO_OMNIORB +dnl # +AC_DEFUN(MV_DO_OMNIORB, [dnl +AC_CHECK_PROGS(IDL, omniidl) +if test -n "$IDL"; then + version_string=`2>&1 omniidl -V | head -1` + if test "`echo $version_string | awk '{ print [$]1 }'`" = Omniidl; then + AC_DEFINE(__OMNIORB__) + OMNIORB_VERSION=`echo $version_string | awk '{ print [$]2 }'` + echo "omniORB Version $OMNIORB_VERSION found" + IDL='idl -s $(strip $''1) -h $(strip $''2)' + AC_SUBST(IDL) + IDL_BOA="$IDL" + IDL_POA="$IDL" + IDL_BOA_POA="$IDL" + IDL_POA_BOA="$IDL" + AC_SUBST(IDL_BOA) + AC_SUBST(IDL_POA) + AC_SUBST(IDL_BOA_POA) + AC_SUBST(IDL_POA_BOA) + AC_CHECK_LIB(omniGK_alone, main) + AC_CHECK_LIB(omniORB, main) + fi +fi]) + +dnl ########################################################################### +dnl # MV_DO_OMNIORB2 +dnl # +AC_DEFUN(MV_DO_OMNIORB2, [dnl +AC_CHECK_PROGS(IDL, omniidl2) +if test -n "$IDL"; then + version_string=`2>&1 omniidl2 -V | head -1` + if test "`echo $version_string | awk '{ print [$]1 }'`" = Omniidl; then + AC_DEFINE(__OMNIORB__) + OMNIORB_VERSION=`echo $version_string | awk '{ print [$]2 }'` + echo "omniORB Version $OMNIORB_VERSION found" + IDL='idl -s $(strip $''1) -h $(strip $''2)' + AC_SUBST(IDL) + IDL_BOA="$IDL" + IDL_POA="$IDL" + IDL_BOA_POA="$IDL" + IDL_POA_BOA="$IDL" + AC_SUBST(IDL_BOA) + AC_SUBST(IDL_POA) + AC_SUBST(IDL_BOA_POA) + AC_SUBST(IDL_POA_BOA) + AC_CHECK_LIB(omniGK_alone, main) + AC_CHECK_LIB(omniORB2, main) + fi +fi]) + +dnl ########################################################################### +dnl # MV_CHECK_OMLIB +dnl # +AC_DEFUN(MV_CHECK_OMLIB, [dnl +ifelse($#,0,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])]) + +{ + +AC_ARG_WITH(om_includes, +[] --with-om-includes=DIR OMLIB include files are in DIR) +AC_ARG_WITH(om_libraries, +[] --with-om-libraries=DIR OMLIB library files are in DIR) + +if test -z "$with_om_includes" -o "$with_om_includes" = yes; then + found=false + if test -n "$subdirs"; then + for dir in $subdirs; do + if test -f "$dir/OverlapMan2.h"; then + found=true + AC_MSG_RESULT(omlib: include file \"OverlapMan2.h\" found in $dir/include) + depinc="`cd $dir && /bin/pwd`/OverlapMan2.h" + DEPINCS="$depinc $DEPINCS" + AC_MSG_RESULT(omlib: $depinc add to DEPINCS) + break + fi + done + fi + if ! $found; then + AC_CHECK_HEADER(OverlapMan2.h,, AC_ERROR(Overlap Manger Library required)) + fi +elif test "$with_om_includes" != no; then + if test -f "$srcdir/$with_om_includes/OverlapMan2.h"; then + AC_MSG_RESULT(omlib: include file \"OverlapMan2.h\" found in $srcdir/$with_om_includes) + DEPINCS="`cd $srcdir/$with_om_includes && /bin/pwd`/OverlapMan2.h $DEPINCS" + else + AC_ERROR(OverlapMan2.h not found in $srcdir/$with_om_includes) + fi +fi + +if test -z "$with_om_libraries" -o "$with_om_libraries" = yes; then + found=false + if test -n "$subdirs"; then + for dir in $subdirs; do + if test -f "$dir/OverlapMan2.h"; then + found=true + dir="`cd $dir && /bin/pwd`" + RPATH="$dir $RPATH" + deplib=$dir/libom.so + DEPLIBS="$deplib $DEPLIBS" + AC_MSG_RESULT(omlib: $deplib add to DEPLIBS) + break + fi + done + fi + if ! $found; then + if test "$with_om_libraries" = yes; then + AC_CHECK_LIB(om, puterrmsg,, AC_ERROR(Overlap Manger required)) + else + AC_CHECK_LIB(om, puterrmsg) + fi + fi +elif test "$with_om_libraries" != no; then + if test -f "$srcdir/$with_om_libraries/configure"; then + AC_CONFIG_SUBDIRS($with_om_libraries) + AC_MSG_RESULT(omlib: $with_om_libraries added to directories to configure) + LDFLAGS="-L`cd $with_om_libraries && /bin/pwd` $LDFLAGS" + LIBS="-lom $LIBS" + elif test -f "$srcdir/$with_om_libraries/libom.so"; then + AC_MSG_RESULT(omlib: library file \"libom.so\" found in $srcdir/$with_om_libraries) + DEPLIBS="`cd $srcdir/$with_om_libraries && /bin/pwd`/libom.so $DEPLIBS" + elif test -f "$srcdir/$with_om_libraries/libom.a"; then + AC_MSG_RESULT(omlib: library file \"libom.a\" found in $srcdir/$with_om_libraries) + DEPLIBS="`cd $srcdir/$with_om_libraries && /bin/pwd`/libom.a $DEPLIBS" + else + AC_ERROR(no Overlap Manger library found and don't know how to built it) + fi +fi + +AC_SUBST(RPATH) + +}]) + +dnl ########################################################################### +dnl # MV_CHECK_XCLIB +dnl # +AC_DEFUN(MV_CHECK_XCLIB, [dnl +ifelse($#,0,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])]) + +{ + +AC_ARG_WITH(xc_includes, +[] --with-xc-includes=DIR XCLIB include files are in DIR) +AC_ARG_WITH(xc_libraries, +[] --with-xc-libraries=DIR XCLIB library files are in DIR) + +if test -z "$with_xc_includes" -o "$with_xc_includes" = yes; then + found=false + if test -n "$subdirs"; then + for dir in $subdirs; do + if test -f "$dir/include/xclib.h"; then + found=true + AC_MSG_RESULT(xclib: include file \"xclib.h\" found in $dir/include) + depinc="`cd $dir/include && /bin/pwd`/xclib.h" + DEPINCS="$depinc $DEPINCS" + AC_MSG_RESULT(xclib: $depinc add to DEPINCS) + break + fi + done + fi + if ! $found; then + AC_CHECK_HEADER(xclib.h,, AC_ERROR(eXtended C Library required)) + fi +elif test "$with_xc_includes" != no; then + if test -f "$srcdir/$with_xc_includes/xclib.h"; then + AC_MSG_RESULT(xclib: include file \"xclib.h\" found in $srcdir/$with_xc_includes) + DEPINCS="`cd $srcdir/$with_xc_includes && /bin/pwd`/xclib.h $DEPINCS" + else + AC_ERROR(xclib.h not found in $srcdir/$with_xc_includes) + fi +fi + +if test -z "$with_xc_libraries" -o "$with_xc_libraries" = yes; then + found=false + if test -n "$subdirs"; then + for dir in $subdirs; do + if test -f "$dir/include/xclib.h"; then + found=true + dir="`cd $dir && /bin/pwd`" + RPATH="$dir $RPATH" + deplib=$dir/libxc.so + DEPLIBS="$deplib $DEPLIBS" + AC_MSG_RESULT(xclib: $deplib add to DEPLIBS) + break + fi + done + fi + if ! $found; then + if test "$with_xc_libraries" = yes; then + AC_CHECK_LIB(xc, puterrmsg,, AC_ERROR(eXtended C Library required)) + else + AC_CHECK_LIB(xc, puterrmsg) + fi + fi +elif test "$with_xc_libraries" != no; then + if test -f "$srcdir/$with_xc_libraries/configure"; then + AC_CONFIG_SUBDIRS($with_xc_libraries) + AC_MSG_RESULT(xclib: $with_xc_libraries added to directories to configure) + LDFLAGS="-L`cd $with_xc_libraries && /bin/pwd` $LDFLAGS" + LIBS="-lxc $LIBS" + elif test -f "$srcdir/$with_xc_libraries/libxc.so"; then + AC_MSG_RESULT(xclib: library file \"libxc.so\" found in $srcdir/$with_xc_libraries) + DEPLIBS="`cd $srcdir/$with_xc_libraries && /bin/pwd`/libxc.so $DEPLIBS" + elif test -f "$srcdir/$with_xc_libraries/libxc.a"; then + AC_MSG_RESULT(xclib: library file \"libxc.a\" found in $srcdir/$with_xc_libraries) + DEPLIBS="`cd $srcdir/$with_xc_libraries && /bin/pwd`/libxc.a $DEPLIBS" + else + AC_ERROR(no \"eXtended C\" library found and don't know how to built it) + fi +fi + +AC_SUBST(RPATH) + +}]) + +dnl ########################################################################### +dnl # MV_CHECK_DPKG_VERSION +dnl # +AC_DEFUN(MV_CHECK_DPKG_VERSION, [dnl +ifelse($#,1,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +dnl +mv_version="$1" +dnl +AC_CHECK_PROG(PARSECHANGELOG, dpkg-parsechangelog, dpkg-parsechangelog)dnl +dnl +if test -n "$PARSECHANGELOG"; then +changequote(«,»)dnl + DPKG_VERSION=`$PARSECHANGELOG -l$srcdir/debian/changelog|sed -n 's/^Version: \([^-]*\).*$/\1/p'` +changequote([,])dnl + if test "$DPKG_VERSION" != "$mv_version"; then + AC_ERROR(Version in debian/changelog is different +------------------------------------------------------------------------------ +`$PARSECHANGELOG` +------------------------------------------------------------------------------) + fi +fi]) + +dnl ########################################################################### +dnl # [END OF FILE] +dnl ########################################################################### + +dnl # -*- autoconf -*- + +dnl #++ +dnl # LISTE DES MACROS: +dnl # ================= +dnl # +dnl # MV_PROG_PYTHON +dnl # MV_LOAD_TCL_CONFIG +dnl # MV_LOAD_TK_CONFIG +dnl # MV_SET_TCL_CONFIG +dnl # MV_SET_TCL_STUB_CONFIG +dnl # MV_SET_TK_STUB_CONFIG +dnl #-- + +dnl ########################################################################### +dnl # MV_PROG_PYTHON +dnl # +AC_DEFUN(MV_PROG_PYTHON, [dnl + +AC_CHECK_PROGS(PYTHON, python2.3 python2.2 python2.1 python) + +if test -z "$PYTHON"; then + MV_ERROR(No Python interpreter found) +fi + +changequote(,) +PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[:3]"` +changequote([, ]) + +MV_MSG(You are using Python version $PYTHON_VERSION, $CYAN) + +AC_SUBST(PYTHON_VERSION)dnl + +mv_tmp=`type -p $PYTHON` # filespec +mv_tmp=`dirname $mv_tmp` # bindir +mv_tmp=`dirname $mv_tmp` # topdir + +if test ! -d $mv_tmp/include; then + MV_ERROR(No «$mv_tmp/include» found) +fi +if test ! -d $mv_tmp/include/python$PYTHON_VERSION; then + MV_ERROR(No «$mv_tmp/include/python$PYTHON_VERSION» found) +fi +if test ! -f $mv_tmp/include/python$PYTHON_VERSION/Python.h; then + MV_ERROR(No «$mv_tmp/include/python$PYTHON_VERSION/Python.h» found) +fi + +PYTHON_INCLUDEDIR=$mv_tmp/include +PYTHON_LIBDIR=$mv_tmp/lib + +AC_SUBST(PYTHON_INCLUDEDIR) +AC_SUBST(PYTHON_LIBDIR) + +dnl # A FAIRE: +dnl # S'assurer de bien utiliser cette version de la bibliotheque python! + +pyexecdir=\${exec_prefix}/lib/python$PYTHON_VERSION/site-packages +pythondir=\${exec_prefix}/lib/python$PYTHON_VERSION/site-packages + +AC_SUBST(pyexecdir) +AC_SUBST(pythondir) + +pkgpyexecdir=\${pyexecdir}/$PACKAGE +pkgpythondir=\${pythondir}/$PACKAGE + +AC_SUBST(pkgpyexecdir) +AC_SUBST(pkgpythondir) + +]) + +dnl ########################################################################### +dnl # MV_LOAD_TCL_CONFIG +dnl # +dnl # Find and load the tclConfig.sh file +dnl # +AC_DEFUN(MV_LOAD_TCL_CONFIG, [dnl + +SC_PATH_TCLCONFIG +SC_LOAD_TCLCONFIG + +MV_MSG([You are using Tcl $TCL_VERSION], $CYAN)]) + +dnl ########################################################################### +dnl # MV_LOAD_TK_CONFIG +dnl # +dnl # Find and load the tkConfig.sh file +dnl # +AC_DEFUN(MV_LOAD_TK_CONFIG, [dnl + +SC_PATH_TKCONFIG +SC_LOAD_TKCONFIG + +MV_MSG([You are using Tk $TK_VERSION], $CYAN) + +if test "$TCL_VERSION" != "$TK_VERSION"; then + MV_ERROR([dnl +$TCL_BIN_DIR/tclConfig.sh is for Tcl $TCL_VERSION. +Tk $TK_VERSION$TK_PATCH_LEVEL needs Tcl $TK_VERSION. +Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl $TK_VERSION.]) + else + MV_MSG([Good: Tcl and Tk have the same version], $CYAN) + fi +]) + +dnl ########################################################################### +dnl # MV_SET_TCL_CONFIG +dnl # +dnl # Find and load the tcl configuration +dnl # +AC_DEFUN(MV_SET_TCL_CONFIG, [dnl + +AC_REQUIRE([MV_LOAD_TCL_CONFIG])dnl + +TCL_INCLUDES= +TCL_INCLUDES="$TCL_INCLUDES ${TCL_INCLUDE_SPEC-"-I$TCL_SRC_DIR"}/unix" +TCL_INCLUDES="$TCL_INCLUDES ${TCL_INCLUDE_SPEC-"-I$TCL_SRC_DIR"}/generic" +TCL_INCLUDES="$TCL_INCLUDES ${TCL_INCLUDE_SPEC-"-I$TCL_SRC_DIR"}" + +DEFINES=" $DEFINES $TCL_DEFS" +INCLUDES=" $TCL_INCLUDES $INCLUDES" +LIBRARIES=" $TCL_LIB_SPEC $LIBRARIES" + +AC_SUBST(DEFINES)dnl +AC_SUBST(INCLUDES)dnl +AC_SUBST(LIBRARIES)]) + +dnl ########################################################################### +dnl # MV_SET_TCL_STUB_CONFIG +dnl # +dnl # Find and load the tcl configuration for stub operation +dnl # +AC_DEFUN(MV_SET_TCL_STUB_CONFIG, [dnl + +DEFINES="$DEFINES -DUSE_TCL_STUBS=1" + +AC_REQUIRE([MV_LOAD_TCL_CONFIG])dnl + +TCL_INCLUDES= +TCL_INCLUDES="$TCL_INCLUDES ${TCL_INCLUDE_SPEC-"-I$TCL_SRC_DIR"}/unix" +TCL_INCLUDES="$TCL_INCLUDES ${TCL_INCLUDE_SPEC-"-I$TCL_SRC_DIR"}/generic" +TCL_INCLUDES="$TCL_INCLUDES ${TCL_INCLUDE_SPEC-"-I$TCL_SRC_DIR"}" + +DEFINES=" $DEFINES $TCL_DEFS" +INCLUDES=" $TCL_INCLUDES $INCLUDES" +LIBRARIES=" $TCL_STUB_LIB_SPEC $LIBRARIES" + +AC_SUBST(DEFINES)dnl +AC_SUBST(INCLUDES)dnl +AC_SUBST(LIBRARIES)]) + +dnl ########################################################################### +dnl # MV_SET_TK_STUB_CONFIG +dnl # +dnl # Find and load the tk configuration for stub operation +dnl # +AC_DEFUN(MV_SET_TK_STUB_CONFIG, [dnl + +DEFINES="$DEFINES -DUSE_TK_STUBS=1" + +AC_REQUIRE([MV_LOAD_TK_CONFIG])dnl + +INCLUDES=" $TK_XINCLUDES $INCLUDES" +LIBRARIES="$TK_XLIBSW $LIBRARIES" + +TK_INCLUDES= +TK_INCLUDES="$TK_INCLUDES -I$TK_PREFIX/include/tk$TK_VERSION/unix" +TK_INCLUDES="$TK_INCLUDES -I$TK_PREFIX/include/tk$TK_VERSION/generic" +TK_INCLUDES="$TK_INCLUDES -I$TK_PREFIX/include/tk$TK_VERSION" + +dnl # La galère sur la woody... +TK_INCLUDES="$TK_INCLUDES -I$TK_PREFIX/include/tcl$TK_VERSION/tk-private/unix" +TK_INCLUDES="$TK_INCLUDES -I$TK_PREFIX/include/tcl$TK_VERSION/tk-private/generic" +TK_INCLUDES="$TK_INCLUDES -I$TK_PREFIX/include/tcl$TK_VERSION/tk-private" + +TK_INCLUDES="$TK_INCLUDES -I$TK_PREFIX/include/unix" +TK_INCLUDES="$TK_INCLUDES -I$TK_PREFIX/include/generic" +TK_INCLUDES="$TK_INCLUDES -I$TK_PREFIX/include" + +DEFINES=" $DEFINES $TK_DEFS" +INCLUDES=" $TK_INCLUDES $INCLUDES" +LIBRARIES=" $TK_STUB_LIB_SPEC $LIBRARIES" + +AC_SUBST(DEFINES)dnl +AC_SUBST(INCLUDES)dnl +AC_SUBST(LIBRARIES)]) + +dnl ########################################################################### +dnl # [END OF FILE] +dnl ########################################################################### + +#------------------------------------------------------------------------ +# SC_PATH_TCLCONFIG -- +# +# Locate the tclConfig.sh file and perform a sanity check on +# the Tcl compile flags +# +# Arguments: +# none +# +# Results: +# +# Adds the following arguments to configure: +# --with-tcl=... +# +# Defines the following vars: +# TCL_BIN_DIR Full path to the directory containing +# the tclConfig.sh file +#------------------------------------------------------------------------ + +AC_DEFUN(SC_PATH_TCLCONFIG, [ + # + # Ok, lets find the tcl configuration + # First, look for one uninstalled. + # the alternative search directory is invoked by --with-tcl + # + + if test x"${no_tcl}" = x ; then + # we reset no_tcl in case something fails here + no_tcl=true + AC_ARG_WITH(tcl, [ --with-tcl directory containing tcl configuration (tclConfig.sh)], with_tclconfig=${withval}) + AC_MSG_CHECKING([for Tcl configuration]) + AC_CACHE_VAL(ac_cv_c_tclconfig,[ + + # First check to see if --with-tclconfig 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 + AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh]) + fi + fi + + # then check for a private Tcl installation + if test x"${ac_cv_c_tclconfig}" = x ; then + for i in \ + ../tcl \ + `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \ + ../../tcl \ + `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \ + ../../../tcl \ + `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)` + break + fi + done + fi + + # 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 + if test -f "$i/tclConfig.sh" ; then + ac_cv_c_tclconfig=`(cd $i; pwd)` + break + fi + done + fi + + # check in a few other private locations + if test x"${ac_cv_c_tcliconfig}" = x ; then + for i in \ + ${srcdir}/../tcl \ + `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)` + break + fi + done + fi + ]) + + if test x"${ac_cv_c_tclconfig}" = x ; then + TCL_BIN_DIR="# no Tcl configs found" + AC_MSG_WARN(Can't find Tcl configuration definitions) + exit 0 + else + no_tcl= + TCL_BIN_DIR=${ac_cv_c_tclconfig} + AC_MSG_RESULT(found $TCL_BIN_DIR/tclConfig.sh) + fi + fi +]) + +#------------------------------------------------------------------------ +# SC_PATH_TKCONFIG -- +# +# Locate the tkConfig.sh file +# +# Arguments: +# none +# +# Results: +# +# Adds the following arguments to configure: +# --with-tk=... +# +# Defines the following vars: +# TK_BIN_DIR Full path to the directory containing +# the tkConfig.sh file +#------------------------------------------------------------------------ + +AC_DEFUN(SC_PATH_TKCONFIG, [ + # + # Ok, lets find the tk configuration + # First, look for one uninstalled. + # the alternative search directory is invoked by --with-tk + # + + if test x"${no_tk}" = x ; then + # we reset no_tk in case something fails here + no_tk=true + AC_ARG_WITH(tk, [ --with-tk directory containing tk configuration (tkConfig.sh)], with_tkconfig=${withval}) + AC_MSG_CHECKING([for Tk configuration]) + AC_CACHE_VAL(ac_cv_c_tkconfig,[ + + # First check to see if --with-tkconfig was specified. + if test x"${with_tkconfig}" != x ; then + if test -f "${with_tkconfig}/tkConfig.sh" ; then + ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)` + else + AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh]) + fi + fi + + # then check for a private Tk library + if test x"${ac_cv_c_tkconfig}" = x ; then + for i in \ + ../tk \ + `ls -dr ../tk[[8-9]].[[0-9]]* 2>/dev/null` \ + ../../tk \ + `ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \ + ../../../tk \ + `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)` + break + fi + done + 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 + if test -f "$i/tkConfig.sh" ; then + ac_cv_c_tkconfig=`(cd $i; pwd)` + break + fi + done + fi + # check in a few other private locations + if test x"${ac_cv_c_tkconfig}" = x ; then + for i in \ + ${srcdir}/../tk \ + `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)` + break + fi + done + fi + ]) + if test x"${ac_cv_c_tkconfig}" = x ; then + TK_BIN_DIR="# no Tk configs found" + AC_MSG_WARN(Can't find Tk configuration definitions) + exit 0 + else + no_tk= + TK_BIN_DIR=${ac_cv_c_tkconfig} + AC_MSG_RESULT(found $TK_BIN_DIR/tkConfig.sh) + fi + fi + +]) + +#------------------------------------------------------------------------ +# SC_LOAD_TCLCONFIG -- +# +# Load the tclConfig.sh file +# +# Arguments: +# +# Requires the following vars to be set: +# TCL_BIN_DIR +# +# Results: +# +# Subst the following vars: +# TCL_BIN_DIR +# TCL_SRC_DIR +# TCL_LIB_FILE +# +#------------------------------------------------------------------------ + +AC_DEFUN(SC_LOAD_TCLCONFIG, [ + AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh]) + + if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then + AC_MSG_RESULT([loading]) + . $TCL_BIN_DIR/tclConfig.sh + else + AC_MSG_RESULT([file not found]) + fi + + # + # The eval is required to do the TCL_DBGX substitution in the + # TCL_LIB_FILE variable + # + + eval TCL_LIB_FILE=${TCL_LIB_FILE} + eval TCL_LIB_FLAG=${TCL_LIB_FLAG} + + AC_SUBST(TCL_BIN_DIR) + AC_SUBST(TCL_SRC_DIR) + AC_SUBST(TCL_LIB_FILE) +]) + +#------------------------------------------------------------------------ +# SC_LOAD_TKCONFIG -- +# +# Load the tkConfig.sh file +# +# Arguments: +# +# Requires the following vars to be set: +# TK_BIN_DIR +# +# Results: +# +# Sets the following vars that should be in tkConfig.sh: +# TK_BIN_DIR +#------------------------------------------------------------------------ + +AC_DEFUN(SC_LOAD_TKCONFIG, [ + AC_MSG_CHECKING([for existence of $TCLCONFIG]) + + if test -f "$TK_BIN_DIR/tkConfig.sh" ; then + AC_MSG_CHECKING([loading $TK_BIN_DIR/tkConfig.sh]) + . $TK_BIN_DIR/tkConfig.sh + else + AC_MSG_RESULT([could not find $TK_BIN_DIR/tkConfig.sh]) + fi + + AC_SUBST(TK_BIN_DIR) + AC_SUBST(TK_SRC_DIR) + AC_SUBST(TK_LIB_FILE) +]) + +#------------------------------------------------------------------------ +# 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 +# +# Arguments: +# none +# +# Results: +# +# Adds the following arguments to configure: +# --enable-shared=yes|no +# +# Defines the following vars: +# STATIC_BUILD Used for building import/export libraries +# on Windows. +# +# Sets the following vars: +# SHARED_BUILD Value of 1 or 0 +#------------------------------------------------------------------------ + +AC_DEFUN(SC_ENABLE_SHARED, [ + AC_MSG_CHECKING([how to build libraries]) + AC_ARG_ENABLE(shared, + [ --disable-shared build and link without shared libraries [--disable-shared]], + [tcl_ok=$enableval], [tcl_ok=yes]) + + if test "${enable_shared+set}" = set; then + enableval="$enable_shared" + tcl_ok=$enableval + else + tcl_ok=yes + fi + + if test "$tcl_ok" = "yes" ; then + AC_MSG_RESULT([shared]) + SHARED_BUILD=1 + else + AC_MSG_RESULT([static]) + SHARED_BUILD=0 + AC_DEFINE(STATIC_BUILD) + fi +]) + +#------------------------------------------------------------------------ +# SC_ENABLE_THREADS -- +# +# Specify if thread support should be enabled +# +# Arguments: +# none +# +# Results: +# +# Adds the following arguments to configure: +# --enable-threads +# +# Sets the following vars: +# THREADS_LIBS Thread library(s) +# +# Defines the following vars: +# TCL_THREADS +# _REENTRANT +# +#------------------------------------------------------------------------ + +AC_DEFUN(SC_ENABLE_THREADS, [ + AC_MSG_CHECKING(for building with 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) + TCL_THREADS=1 + AC_DEFINE(TCL_THREADS) + AC_DEFINE(_REENTRANT) + + AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no) + if test "$tcl_ok" = "yes"; then + # The space is needed + THREADS_LIBS=" -lpthread" + 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 + else + TCL_THREADS=0 + AC_MSG_RESULT(no (default)) + fi + +]) + +#------------------------------------------------------------------------ +# SC_ENABLE_SYMBOLS -- +# +# Specify if debugging symbols should be used +# +# Arguments: +# none +# +# Requires the following vars to be set: +# CFLAGS_DEBUG +# CFLAGS_OPTIMIZE +# LDFLAGS_DEBUG +# LDFLAGS_OPTIMIZE +# +# Results: +# +# Adds the following arguments to configure: +# --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 +# DBGX Debug library extension +# +#------------------------------------------------------------------------ + +AC_DEFUN(SC_ENABLE_SYMBOLS, [ + AC_MSG_CHECKING([for build with symbols]) + AC_ARG_ENABLE(symbols, [ --enable-symbols build with debugging symbols [--enable-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}' + DBGX="" + AC_MSG_RESULT([no]) + fi +]) + +#-------------------------------------------------------------------- +# SC_CONFIG_CFLAGS +# +# Try to determine the proper flags to pass to the compiler +# for building shared libraries and other such nonsense. +# +# Arguments: +# none +# +# Results: +# +# Defines the following vars: +# +# DL_OBJS - Name of the object file that implements dynamic +# loading for Tcl on this system. +# DL_LIBS - Library file(s) to include in tclsh and other base +# applications in order for the "load" command to work. +# LDFLAGS - Flags to pass to the compiler when linking object +# files into an executable application binary such +# as tclsh. +# 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. +# MAKE_LIB - Command to execute to build the Tcl library; +# differs depending on whether or not Tcl is being +# compiled as a shared 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_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 +# shared libraries. The value of the symbol is +# "${LIBS}" if all of the dependent libraries should +# be specified when creating a shared library. If +# dependent libraries should not be specified (as on +# SunOS 4.x, where they cause the link to fail, or in +# general if Tcl and Tk aren't themselves shared +# libraries), then this symbol has an empty string +# as its value. +# 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 +# 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 +# a .a extension whereas shared objects for loadable +# extensions have a .so extension. Defaults to +# ${VERSION}${SHLIB_SUFFIX}. +# TCL_NEEDS_EXP_FILE - +# 1 means that an export file is needed to link to a +# shared library. +# TCL_EXP_FILE - The name of the installed export / import file which +# should be used to link to the Tcl shared library. +# Empty if Tcl is unshared. +# TCL_BUILD_EXP_FILE - +# The name of the built export / import file which +# should be used to link to the Tcl shared library. +# Empty if Tcl is unshared. +# CFLAGS_DEBUG - +# Flags used when running the compiler in debug mode +# CFLAGS_OPTIMIZE - +# Flags used when running the compiler in optimize mode +# +# EXTRA_CFLAGS +# +# Subst's the following vars: +# DL_LIBS +# CFLAGS_DEBUG +# CFLAGS_OPTIMIZE +#-------------------------------------------------------------------- + +AC_DEFUN(SC_CONFIG_CFLAGS, [ + + # Step 0: Enable 64 bit support? + + AC_MSG_CHECKING([if 64bit support is enabled]) + AC_ARG_ENABLE(64bit,[ --enable-64bit enable 64bit support],,enableval="no") + + if test "$enableval" = "yes"; then + AC_MSG_RESULT(Will compile with 64bit support) + do64bit=yes + else + do64bit=no + fi + AC_MSG_RESULT($do64bit) + + # Step 1: set the variable "system" to hold the name and version number + # for the system. This can usually be done via the "uname" command, but + # there are a few systems, like Next, where this doesn't work. + + AC_MSG_CHECKING([system version (for dynamic loading)]) + if test -f /usr/lib/NextStep/software_version; then + system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version` + else + system=`uname -s`-`uname -r` + if test "$?" -ne 0 ; then + AC_MSG_RESULT([unknown (can't find uname command)]) + system=unknown + else + # Special check for weird MP-RAS system (uname returns weird + # results, and the version is kept in special file). + + if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then + system=MP-RAS-`awk '{print $3}' /etc/.relid'` + fi + if test "`uname -s`" = "AIX" ; then + system=AIX-`uname -v`.`uname -r` + fi + AC_MSG_RESULT($system) + fi + fi + + # 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) + + # Step 3: set configuration options based on system name and version. + + do64bit_ok=no + fullSrcDir=`cd $srcdir; pwd` + EXTRA_CFLAGS="" + TCL_EXPORT_FILE_SUFFIX="" + UNSHARED_LIB_SUFFIX="" + TCL_TRIM_DOTS='`echo ${VERSION} | tr -d .`' + ECHO_VERSION='`echo ${VERSION}`' + TCL_LIB_VERSIONS_OK=ok + CFLAGS_DEBUG=-g + CFLAGS_OPTIMIZE=-O2 + TCL_NEEDS_EXP_FILE=0 + TCL_BUILD_EXP_FILE="" + TCL_EXP_FILE="" + STLIB_LD="ar cr" + case $system in + AIX-4.[[2-9]]) + 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="" + DL_LIBS="-ldl" + LDFLAGS="" + LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + TCL_NEEDS_EXP_FILE=1 + TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.exp' + ;; + AIX-*) + 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="" + LIBOBJS="$LIBOBJS tclLoadAix.o" + DL_LIBS="-lld" + LDFLAGS="" + LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + TCL_NEEDS_EXP_FILE=1 + TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.exp' + ;; + BSD/OS-2.1*|BSD/OS-3*) + SHLIB_CFLAGS="" + SHLIB_LD="shlicc -r" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="" + DL_LIBS="-ldl" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + BSD/OS-4.*) + SHLIB_CFLAGS="-export-dynamic -fPIC" + SHLIB_LD="cc -shared" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="" + DL_LIBS="-ldl" + LDFLAGS="-export-dynamic" + LD_SEARCH_FLAGS="" + ;; + dgux*) + SHLIB_CFLAGS="-K PIC" + SHLIB_LD="cc -G" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="" + DL_LIBS="-ldl" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*|HP-UX-*.11.*) + 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="" + DL_OBJS="tclLoadShl.o" + DL_LIBS="-ldld" + LDFLAGS="-Wl,-E" + LD_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.' + fi + ;; + IRIX-4.*) + SHLIB_CFLAGS="-G 0" + SHLIB_SUFFIX=".a" + SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0" + SHLIB_LD_LIBS='${LIBS}' + DL_OBJS="tclLoadAout.o" + DL_LIBS="" + LDFLAGS="-Wl,-D,08000000" + LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a' + ;; + IRIX-5.*|IRIX-6.*|IRIX64-6.5*) + SHLIB_CFLAGS="" + SHLIB_LD="ld -n32 -shared -rdata_shared" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="" + DL_LIBS="" + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then + EXTRA_CFLAGS="-mabi=n32" + 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" + ;; + *) + EXTRA_CFLAGS="-n32" + ;; + esac + LDFLAGS="-n32" + fi + ;; + IRIX64-6.*) + SHLIB_CFLAGS="" + SHLIB_LD="ld -32 -shared -rdata_shared" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + ;; + Linux*) + SHLIB_CFLAGS="-fPIC" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + + # 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" + + if test "$have_dl" = yes; then + SHLIB_LD="${CC} -shared" + DL_OBJS="" + DL_LIBS="-ldl" + LDFLAGS="-rdynamic" + #LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + else + AC_CHECK_HEADER(dld.h, [ + SHLIB_LD="ld -shared" + DL_OBJS="tclLoadDld.o" + DL_LIBS="-ldld" + LDFLAGS="" + LD_SEARCH_FLAGS=""]) + fi + if test "`uname -m`" = "alpha" ; then + EXTRA_CFLAGS="-mieee" + fi + ;; + GNU*) + SHLIB_CFLAGS="-fPIC" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + + if test "$have_dl" = yes; then + SHLIB_LD="${CC} -shared" + DL_OBJS="" + DL_LIBS="-ldl" + LDFLAGS="-rdynamic" + LD_SEARCH_FLAGS="" + else + AC_CHECK_HEADER(dld.h, [ + SHLIB_LD="ld -shared" + DL_OBJS="" + DL_LIBS="-ldld" + LDFLAGS="" + LD_SEARCH_FLAGS=""]) + fi + if test "`uname -m`" = "alpha" ; then + EXTRA_CFLAGS="-mieee" + fi + ;; + MP-RAS-02*) + SHLIB_CFLAGS="-K PIC" + SHLIB_LD="cc -G" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="" + DL_LIBS="-ldl" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + MP-RAS-*) + SHLIB_CFLAGS="-K PIC" + SHLIB_LD="cc -G" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="" + DL_LIBS="-ldl" + LDFLAGS="-Wl,-Bexport" + LD_SEARCH_FLAGS="" + ;; + NetBSD-*|FreeBSD-[[1-2]].*|OpenBSD-*) + # Not available on all versions: check for include file. + AC_CHECK_HEADER(dlfcn.h, [ + SHLIB_CFLAGS="-fpic" + SHLIB_LD="ld -Bshareable -x" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS="" + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0' + ], [ + SHLIB_CFLAGS="" + SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".a" + DL_OBJS="tclLoadAout.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + 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 + ;; + FreeBSD-*) + # FreeBSD 3.* and greater have ELF. + SHLIB_CFLAGS="-fpic" + SHLIB_LD="ld -Bshareable -x" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + NEXTSTEP-*) + SHLIB_CFLAGS="" + SHLIB_LD="cc -nostdlib -r" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadNext.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + OS/390-*) + CFLAGS_OPTIMIZE="" # Optimizer is buggy + AC_DEFINE(_OE_SOCKETS) # needed in sys/socket.h + ;; + OSF1-1.0|OSF1-1.1|OSF1-1.2) + # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1 + SHLIB_CFLAGS="" + # Hack: make package name same as library name + SHLIB_LD='ld -R -export $@:' + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadOSF.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + OSF1-1.*) + # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2 + SHLIB_CFLAGS="-fpic" + SHLIB_LD="ld -shared" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + OSF1-V*) + # Digital OSF/1 + SHLIB_CFLAGS="" + SHLIB_LD='ld -shared -expect_unresolved "*"' + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + ;; + RISCos-*) + SHLIB_CFLAGS="-G 0" + SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".a" + DL_OBJS="tclLoadAout.o" + DL_LIBS="" + LDFLAGS="-Wl,-D,08000000" + LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + ;; + 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. + SHLIB_CFLAGS="-Kpic -belf" + SHLIB_LD="ld -G" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="" + DL_LIBS="" + LDFLAGS="-belf -Wl,-Bexport" + LD_SEARCH_FLAGS="" + ;; + SINIX*5.4*) + SHLIB_CFLAGS="-K PIC" + SHLIB_LD="cc -G" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="" + DL_LIBS="-ldl" + LDFLAGS="" + LD_SEARCH_FLAGS="" + ;; + SunOS-4*) + SHLIB_CFLAGS="-PIC" + SHLIB_LD="ld" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="" + DL_LIBS="-ldl" + LDFLAGS="" + LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + + # SunOS can't handle version numbers with dots in them in library + # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it + # requires an extra version number at the end of .so file names. + # So, the library has to have a name like libtcl75.so.1.0 + + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0' + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + TCL_LIB_VERSIONS_OK=nodots + ;; + SunOS-5.[[0-6]]*) + 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. + + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="" + DL_LIBS="-ldl" + LDFLAGS="" + LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' + ;; + SunOS-5*) + SHLIB_CFLAGS="-KPIC" + SHLIB_LD="/usr/ccs/bin/ld -G -z text" + LDFLAGS="" + + do64bit_ok=no + if test "$do64bit" = "yes" ; then + arch=`isainfo` + if test "$arch" = "sparcv9 sparc" ; then + if test "$CC" != "gcc" -a `$CC -v 2>&1 | grep -c gcc` = "0" ; then + do64bit_ok=yes + EXTRA_CFLAGS="-xarch=v9" + LDFLAGS="-xarch=v9" + else + AC_MSG_WARN("64bit mode not supported using GCC on $system") + fi + else + AC_MSG_WARN("64bit mode only supported sparcv9 system") + fi + fi + + # 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="" + DL_LIBS="-ldl" + if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then + LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' + else + LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' + fi + ;; + ULTRIX-4.*) + SHLIB_CFLAGS="-G 0" + SHLIB_SUFFIX=".a" + SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0" + SHLIB_LD_LIBS='${LIBS}' + DL_OBJS="tclLoadAout.o" + DL_LIBS="" + LDFLAGS="-Wl,-D,08000000" + LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + ;; + UNIX_SV* | UnixWare-5*) + SHLIB_CFLAGS="-KPIC" + SHLIB_LD="cc -G" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="" + DL_LIBS="-ldl" + # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers + # 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 + AC_MSG_RESULT($found) + if test $found = yes; then + LDFLAGS="-Wl,-Bexport" + else + LDFLAGS="" + fi + LD_SEARCH_FLAGS="" + ;; + esac + + if test "$do64bit" = "yes" -a "$do64bit_ok" = "no" ; then + AC_MSG_WARN("64bit support being disabled -- not supported on this platform") + fi + + # Step 4: If pseudo-static linking is in use (see K. B. Kenny, "Dynamic + # Loading for Tcl -- What Became of It?". Proc. 2nd Tcl/Tk Workshop, + # New Orleans, LA, Computerized Processes Unlimited, 1994), then we need + # to determine which of several header files defines the a.out file + # format (a.out.h, sys/exec.h, or sys/exec_aout.h). At present, we + # support only a file format that is more or less version-7-compatible. + # In particular, + # - a.out files must begin with `struct exec'. + # - the N_TXTOFF on the `struct exec' must compute the seek address + # of the text segment + # - The `struct exec' must contain a_magic, a_text, a_data, a_bss + # and a_entry fields. + # The following compilation should succeed if and only if either sys/exec.h + # or a.out.h is usable for the purpose. + # + # Note that the modified COFF format used on MIPS Ultrix 4.x is usable; the + # `struct exec' includes a second header that contains information that + # duplicates the v7 fields that are needed. + + if test "x$DL_OBJS" = "xtclLoadAout.o" ; then + AC_MSG_CHECKING(sys/exec.h) + AC_TRY_COMPILE([#include <sys/exec.h>],[ + struct exec foo; + unsigned long seek; + int flag; +#if defined(__mips) || defined(mips) + seek = N_TXTOFF (foo.ex_f, foo.ex_o); +#else + seek = N_TXTOFF (foo); +#endif + flag = (foo.a_magic == OMAGIC); + return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry; + ], tcl_ok=usable, tcl_ok=unusable) + AC_MSG_RESULT($tcl_ok) + if test $tcl_ok = usable; then + AC_DEFINE(USE_SYS_EXEC_H) + else + AC_MSG_CHECKING(a.out.h) + AC_TRY_COMPILE([#include <a.out.h>],[ + struct exec foo; + unsigned long seek; + int flag; +#if defined(__mips) || defined(mips) + seek = N_TXTOFF (foo.ex_f, foo.ex_o); +#else + seek = N_TXTOFF (foo); +#endif + flag = (foo.a_magic == OMAGIC); + return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry; + ], tcl_ok=usable, tcl_ok=unusable) + AC_MSG_RESULT($tcl_ok) + if test $tcl_ok = usable; then + AC_DEFINE(USE_A_OUT_H) + else + AC_MSG_CHECKING(sys/exec_aout.h) + AC_TRY_COMPILE([#include <sys/exec_aout.h>],[ + struct exec foo; + unsigned long seek; + int flag; +#if defined(__mips) || defined(mips) + seek = N_TXTOFF (foo.ex_f, foo.ex_o); +#else + seek = N_TXTOFF (foo); +#endif + flag = (foo.a_midmag == OMAGIC); + return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry; + ], tcl_ok=usable, tcl_ok=unusable) + AC_MSG_RESULT($tcl_ok) + if test $tcl_ok = usable; then + AC_DEFINE(USE_SYS_EXEC_AOUT_H) + else + DL_OBJS="" + fi + fi + fi + fi + + # Step 5: disable dynamic loading if requested via a command-line switch. + + AC_ARG_ENABLE(load, [ --disable-load disallow dynamic loading and "load" command], + [tcl_ok=$enableval], [tcl_ok=yes]) + if test "$tcl_ok" = "no"; then + DL_OBJS="" + fi + + if test "x$SHLIB_LD" != "x" ; then + BUILD_DLTEST="\$(DLTEST_TARGETS)" + else + echo "Can't figure out how to do dynamic loading or shared libraries" + echo "on this system." + SHLIB_CFLAGS="" + SHLIB_LD="" + SHLIB_SUFFIX="" + DL_OBJS="tclLoadNone.o" + DL_LIBS="" + LDFLAGS="" + LD_SEARCH_FLAGS="" + BUILD_DLTEST="" + fi + + # If we're running gcc, then change the C flags for compiling shared + # libraries to the right flags for gcc, instead of those for the + # standard manufacturer compiler. + + if test "$DL_OBJS" != "tclLoadNone.o" ; then + if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then + case $system in + AIX-*) + ;; + BSD/OS*) + ;; + IRIX*) + ;; + NetBSD-*|FreeBSD-*|OpenBSD-*) + ;; + RISCos-*) + ;; + ULTRIX-4.*) + ;; + *) + SHLIB_CFLAGS="-fPIC" + ;; + esac + fi + fi + + if test "$SHARED_LIB_SUFFIX" = "" ; then + SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}${SHLIB_SUFFIX}.1' + fi + if test "$UNSHARED_LIB_SUFFIX" = "" ; then + UNSHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a' + fi + + AC_SUBST(DL_LIBS) + AC_SUBST(CFLAGS_DEBUG) + AC_SUBST(CFLAGS_OPTIMIZE) +]) + +#-------------------------------------------------------------------- +# SC_SERIAL_PORT +# +# 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. +# +# Arguments: +# none +# +# Results: +# +# Defines only one of the following vars: +# USE_TERMIOS +# USE_TERMIO +# USE_SGTTY +# +#-------------------------------------------------------------------- + +AC_DEFUN(SC_SERIAL_PORT, [ + AC_MSG_CHECKING([termios vs. termio vs. sgtty]) + + AC_TRY_RUN([ +#include <termios.h> + +main() +{ + struct termios t; + if (tcgetattr(0, &t) == 0) { + cfsetospeed(&t, 0); + t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB; + return 0; + } + return 1; +}], tk_ok=termios, tk_ok=no, tk_ok=no) + + if test $tk_ok = termios; then + AC_DEFINE(USE_TERMIOS) + else + AC_TRY_RUN([ +#include <termio.h> + +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 + AC_TRY_RUN([ +#include <sgtty.h> + +main() +{ + struct sgttyb t; + if (ioctl(0, TIOCGETP, &t) == 0) { + t.sg_ospeed = 0; + t.sg_flags |= ODDP | EVENP | RAW; + 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 + AC_MSG_RESULT($tk_ok) +]) + +#-------------------------------------------------------------------- +# SC_MISSING_POSIX_HEADERS +# +# Supply substitutes for missing POSIX header files. Special +# notes: +# - stdlib.h doesn't define strtol, strtoul, or +# strtod insome versions of SunOS +# - some versions of string.h don't declare procedures such +# as strstr +# +# Arguments: +# none +# +# Results: +# +# Defines some of the following vars: +# NO_DIRENT_H +# NO_ERRNO_H +# NO_VALUES_H +# NO_LIMITS_H +# NO_STDLIB_H +# NO_STRING_H +# NO_SYS_WAIT_H +# NO_DLFCN_H +# HAVE_UNISTD_H +# HAVE_SYS_PARAM_H +# +# HAVE_STRING_H ? +# +#-------------------------------------------------------------------- + +AC_DEFUN(SC_MISSING_POSIX_HEADERS, [ + + AC_MSG_CHECKING(dirent.h) + AC_TRY_LINK([#include <sys/types.h> +#include <dirent.h>], [ +#ifndef _POSIX_SOURCE +# ifdef __Lynx__ + /* + * Generate compilation error to make the test fail: Lynx headers + * are only valid if really in the POSIX environment. + */ + + missing_procedure(); +# endif +#endif +DIR *d; +struct dirent *entryPtr; +char *p; +d = opendir("foobar"); +entryPtr = readdir(d); +p = entryPtr->d_name; +closedir(d); +], tcl_ok=yes, tcl_ok=no) + + if test $tcl_ok = no; then + AC_DEFINE(NO_DIRENT_H) + fi + + AC_MSG_RESULT($tcl_ok) + 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(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) + AC_EGREP_HEADER(strtod, stdlib.h, , tcl_ok=0) + if test $tcl_ok = 0; then + AC_DEFINE(NO_STDLIB_H) + fi + AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0) + AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0) + AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0) + + # See also memmove check below for a place where NO_STRING_H can be + # set and why. + + if test $tcl_ok = 0; then + AC_DEFINE(NO_STRING_H) + fi + + AC_CHECK_HEADER(sys/wait.h, , AC_DEFINE(NO_SYS_WAIT_H)) + AC_CHECK_HEADER(dlfcn.h, , AC_DEFINE(NO_DLFCN_H)) + + # OS/390 lacks sys/param.h (and doesn't need it, by chance). + + AC_HAVE_HEADERS(unistd.h sys/param.h) + +]) + +#-------------------------------------------------------------------- +# SC_PATH_X +# +# Locate the X11 header files and the X11 library archive. Try +# the ac_path_x macro first, but if it doesn't find the X stuff +# (e.g. because there's no xmkmf program) then check through +# a list of possible directories. Under some conditions the +# autoconf macro will return an include directory that contains +# no include files, so double-check its result just to be safe. +# +# Arguments: +# none +# +# Results: +# +# Sets the the following vars: +# XINCLUDES +# XLIBSW +# +#-------------------------------------------------------------------- + +AC_DEFUN(SC_PATH_X, [ + AC_PATH_X + not_really_there="" + if test "$no_x" = ""; then + if test "$x_includes" = ""; then + AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes") + else + if test ! -r $x_includes/X11/Intrinsic.h; then + not_really_there="yes" + fi + fi + 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 <X11/Intrinsic.h>], , XINCLUDES="nope") + if test "$XINCLUDES" = nope; 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" + break + fi + done + fi + else + if test "$x_includes" != ""; then + XINCLUDES=-I$x_includes + else + XINCLUDES="# no special path needed" + fi + fi + if test "$XINCLUDES" = nope; then + AC_MSG_RESULT(couldn't find any!) + XINCLUDES="# no include files found" + fi + + if test "$no_x" = yes; then + AC_MSG_CHECKING(for X11 libraries) + XLIBSW=nope + dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/X11R6/lib /usr/X11R5/lib /usr/lib/X11R5 /usr/lib/X11R4 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib" + for i in $dirs ; do + if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then + AC_MSG_RESULT($i) + XLIBSW="-L$i -lX11" + x_libraries="$i" + break + fi + done + else + if test "$x_libraries" = ""; then + XLIBSW=-lX11 + else + XLIBSW="-L$x_libraries -lX11" + fi + fi + if test "$XLIBSW" = nope ; then + AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow) + fi + if test "$XLIBSW" = nope ; then + AC_MSG_RESULT(couldn't find any! Using -lX11.) + XLIBSW=-lX11 + fi +]) +#-------------------------------------------------------------------- +# SC_BLOCKING_STYLE +# +# The statements below check for systems where POSIX-style +# non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented. +# On these systems (mostly older ones), use the old BSD-style +# FIONBIO approach instead. +# +# Arguments: +# none +# +# Results: +# +# Defines some of the following vars: +# HAVE_SYS_IOCTL_H +# HAVE_SYS_FILIO_H +# USE_FIONBIO +# O_NONBLOCK +# +#-------------------------------------------------------------------- + +AC_DEFUN(SC_BLOCKING_STYLE, [ + AC_CHECK_HEADERS(sys/ioctl.h) + AC_CHECK_HEADERS(sys/filio.h) + AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O]) + if test -f /usr/lib/NextStep/software_version; then + system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version` + else + system=`uname -s`-`uname -r` + if test "$?" -ne 0 ; then + system=unknown + else + # Special check for weird MP-RAS system (uname returns weird + # results, and the version is kept in special file). + + if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then + system=MP-RAS-`awk '{print $3}' /etc/.relid'` + fi + if test "`uname -s`" = "AIX" ; then + system=AIX-`uname -v`.`uname -r` + fi + fi + fi + case $system in + # There used to be code here to use FIONBIO under AIX. However, it + # was reported that FIONBIO doesn't work under AIX 3.2.5. Since + # using O_NONBLOCK seems fine under AIX 4.*, I removed the FIONBIO + # code (JO, 5/31/97). + + OSF*) + AC_DEFINE(USE_FIONBIO) + AC_MSG_RESULT(FIONBIO) + ;; + SunOS-4*) + AC_DEFINE(USE_FIONBIO) + AC_MSG_RESULT(FIONBIO) + ;; + ULTRIX-4.*) + AC_DEFINE(USE_FIONBIO) + AC_MSG_RESULT(FIONBIO) + ;; + *) + AC_MSG_RESULT(O_NONBLOCK) + ;; + esac +]) + +#-------------------------------------------------------------------- +# SC_HAVE_VFORK +# +# Check to see whether the system provides a vfork kernel call. +# If not, then use fork instead. Also, check for a problem with +# vforks and signals that can cause core dumps if a vforked child +# resets a signal handler. If the problem exists, then use fork +# instead of vfork. +# +# Arguments: +# none +# +# Results: +# +# Defines some of the following vars: +# vfork (=fork) +# +#-------------------------------------------------------------------- + +AC_DEFUN(SC_HAVE_VFORK, [ + AC_TYPE_SIGNAL() + AC_CHECK_FUNC(vfork, tcl_ok=1, tcl_ok=0) + if test "$tcl_ok" = 1; then + AC_MSG_CHECKING([vfork/signal bug]); + AC_TRY_RUN([ +#include <stdio.h> +#include <signal.h> +#include <sys/wait.h> +int gotSignal = 0; +sigProc(sig) + int sig; +{ + gotSignal = 1; +} +main() +{ + int pid, sts; + (void) signal(SIGCHLD, sigProc); + pid = vfork(); + if (pid < 0) { + exit(1); + } else if (pid == 0) { + (void) signal(SIGCHLD, SIG_DFL); + _exit(0); + } else { + (void) wait(&sts); + } + exit((gotSignal) ? 0 : 1); +}], tcl_ok=1, tcl_ok=0, tcl_ok=0) + + if test "$tcl_ok" = 1; then + AC_MSG_RESULT(ok) + else + AC_MSG_RESULT([buggy, using fork instead]) + fi + fi + rm -f core + if test "$tcl_ok" = 0; then + AC_DEFINE(vfork, fork) + fi +]) + +#-------------------------------------------------------------------- +# SC_TIME_HANLDER +# +# Checks how the system deals with time.h, what time structures +# are used on the system, and what fields the structures have. +# +# Arguments: +# none +# +# Results: +# +# Defines some of the following vars: +# USE_DELTA_FOR_TZ +# HAVE_TM_GMTOFF +# HAVE_TM_TZADJ +# HAVE_TIMEZONE_VAR +# +#-------------------------------------------------------------------- + +AC_DEFUN(SC_TIME_HANDLER, [ + AC_CHECK_HEADERS(sys/time.h) + AC_HEADER_TIME + AC_STRUCT_TIMEZONE + + AC_MSG_CHECKING([tm_tzadj in struct tm]) + AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_tzadj;], + [AC_DEFINE(HAVE_TM_TZADJ) + AC_MSG_RESULT(yes)], + AC_MSG_RESULT(no)) + + AC_MSG_CHECKING([tm_gmtoff in struct tm]) + AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_gmtoff;], + [AC_DEFINE(HAVE_TM_GMTOFF) + AC_MSG_RESULT(yes)], + AC_MSG_RESULT(no)) + + # + # 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 <time.h>], + [extern long timezone; + timezone += 1; + exit (0);], + [have_timezone=yes + 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 <time.h>], + [extern time_t timezone; + timezone += 1; + exit (0);], + [AC_DEFINE(HAVE_TIMEZONE_VAR) + AC_MSG_RESULT(yes)], + AC_MSG_RESULT(no)) + fi + + # + # AIX does not have a timezone field in struct tm. When the AIX bsd + # library is used, the timezone global and the gettimeofday methods are + # to be avoided for timezone deduction instead, we deduce the timezone + # by comparing the localtime result on a known GMT value. + # + + if test "`uname -s`" = "AIX" ; then + AC_CHECK_LIB(bsd, gettimeofday, libbsd=yes) + if test $libbsd = yes; then + AC_DEFINE(USE_DELTA_FOR_TZ) + fi + fi +]) + +#-------------------------------------------------------------------- +# SC_BUGGY_STRTOD +# +# Under Solaris 2.4, strtod returns the wrong value for the +# terminating character under some conditions. Check for this +# and if the problem exists use a substitute procedure +# "fixstrtod" (provided by Tcl) that corrects the error. +# +# Arguments: +# none +# +# Results: +# +# Might defines some of the following vars: +# strtod (=fixstrtod) +# +#-------------------------------------------------------------------- + +AC_DEFUN(SC_BUGGY_STRTOD, [ + AC_CHECK_FUNC(strtod, tk_strtod=1, tk_strtod=0) + if test "$tk_strtod" = 1; then + AC_MSG_CHECKING([for Solaris 2.4 strtod bug]) + AC_TRY_RUN([ + extern double strtod(); + int main() + { + char *string = "NaN"; + char *term; + strtod(string, &term); + if ((term != string) && (term[-1] == 0)) { + exit(1); + } + exit(0); + }], tk_ok=1, tk_ok=0, tk_ok=0) + if test "$tk_ok" = 1; then + AC_MSG_RESULT(ok) + else + AC_MSG_RESULT(buggy) + AC_DEFINE(strtod, fixstrtod) + fi + fi +]) + +#-------------------------------------------------------------------- +# SC_TCL_LINK_LIBS +# +# Search for the libraries needed to link the Tcl shell. +# Things like the math library (-lm) and socket stuff (-lsocket vs. +# -lnsl) are dealt with here. +# +# Arguments: +# Requires the following vars to be set in the Makefile: +# DL_LIBS +# LIBS +# MATH_LIBS +# +# Results: +# +# Subst's the following var: +# TCL_LIBS +# MATH_LIBS +# +# Might append to the following vars: +# LIBS +# +# Might define the following vars: +# HAVE_NET_ERRNO_H +# +#-------------------------------------------------------------------- + +AC_DEFUN(SC_TCL_LINK_LIBS, [ + #-------------------------------------------------------------------- + # On a few very rare systems, all of the libm.a stuff is + # already in libc.a. Set compiler flags accordingly. + # Also, Linux requires the "ieee" library for math to work + # right (and it must appear before "-lm"). + #-------------------------------------------------------------------- + + AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm") + AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"]) + + #-------------------------------------------------------------------- + # On AIX 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 + # insure proper sequencing, is to add it to the tail of MATH_LIBS. + # This library also supplies gettimeofday. + #-------------------------------------------------------------------- + + libbsd=no + if test "`uname -s`" = "AIX" ; then + AC_CHECK_LIB(bsd, gettimeofday, libbsd=yes) + if test $libbsd = yes; then + MATH_LIBS="$MATH_LIBS -lbsd" + fi + fi + + + #-------------------------------------------------------------------- + # Interactive UNIX requires -linet instead of -lsocket, plus it + # needs net/errno.h to define the socket-related error codes. + #-------------------------------------------------------------------- + + AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"]) + AC_CHECK_HEADER(net/errno.h, AC_DEFINE(HAVE_NET_ERRNO_H)) + + #-------------------------------------------------------------------- + # Check for the existence of the -lsocket and -lnsl libraries. + # The order here is important, so that they end up in the right + # order in the command line generated by make. Here are some + # special considerations: + # 1. Use "connect" and "accept" to check for -lsocket, and + # "gethostbyname" to check for -lnsl. + # 2. Use each function name only once: can't redo a check because + # autoconf caches the results of the last check and won't redo it. + # 3. Use -lnsl and -lsocket only if they supply procedures that + # aren't already present in the normal libraries. This is because + # IRIX 5.2 has libraries, but they aren't needed and they're + # bogus: they goof up name resolution if used. + # 4. On some SVR4 systems, can't use -lsocket without -lnsl too. + # To get around this problem, check for both libraries together + # if -lsocket doesn't work by itself. + #-------------------------------------------------------------------- + + tcl_checkBoth=0 + AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1) + if test "$tcl_checkSocket" = 1; then + AC_CHECK_LIB(socket, main, LIBS="$LIBS -lsocket", tcl_checkBoth=1) + fi + if test "$tcl_checkBoth" = 1; then + tk_oldLibs=$LIBS + LIBS="$LIBS -lsocket -lnsl" + AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs]) + fi + AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, + [LIBS="$LIBS -lnsl"])) + + # Don't perform the eval of the libraries here because DL_LIBS + # won't be set until we call SC_CONFIG_CFLAGS + + TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}' + AC_SUBST(TCL_LIBS) + AC_SUBST(MATH_LIBS) +]) + diff --git a/configure b/configure new file mode 100755 index 0000000..a85167a --- /dev/null +++ b/configure @@ -0,0 +1,2480 @@ +#! /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. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_help="$ac_help + --with-tcl directory containing tcl configuration (tclConfig.sh)" + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +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" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$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" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*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" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # 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 + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + 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 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$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" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + 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" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + 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_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + 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-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-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + 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" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$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 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # 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'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*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" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + 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-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" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + 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" + ;; + + 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 +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 + +# 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 +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" ;; + 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 + +# 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 + +# 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=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +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; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $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= + fi +else + ac_n= ac_c='\c' ac_t= +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 +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' +elif >/dev/null 2>&1 echo -e && test -z "`echo -e '\a'|fgrep a`" && test -z "`echo -e '\b'|fgrep b`" && test -z "`echo -e '\c'|fgrep c`" && test -z "`echo -e '\f'|fgrep f`" && test -z "`echo -e '\n'|fgrep n`" && test -z "`echo -e '\r'|fgrep r`" && test -z "`echo -e '\t'|fgrep t`" && test -z "`echo -e '\v'|fgrep v`" && test -z "`echo -e '\033'|fgrep 33`"; then + ECHO_E='echo -e' +elif >/dev/null 2>&1 /bin/echo && test -z "`/bin/echo '\a'|fgrep a`" && test -z "`/bin/echo '\b'|fgrep b`" && test -z "`/bin/echo '\c'|fgrep c`" && test -z "`/bin/echo '\f'|fgrep f`" && test -z "`/bin/echo '\n'|fgrep n`" && test -z "`/bin/echo '\r'|fgrep r`" && test -z "`/bin/echo '\t'|fgrep t`" && test -z "`/bin/echo '\v'|fgrep v`" && test -z "`/bin/echo '\033'|fgrep 33`"; then + ECHO_E='/bin/echo' +elif >/dev/null 2>&1 /bin/echo -e && test -z "`/bin/echo -e '\a'|fgrep a`" && test -z "`/bin/echo -e '\b'|fgrep b`" && test -z "`/bin/echo -e '\c'|fgrep c`" && test -z "`/bin/echo -e '\f'|fgrep f`" && test -z "`/bin/echo -e '\n'|fgrep n`" && test -z "`/bin/echo -e '\r'|fgrep r`" && test -z "`/bin/echo -e '\t'|fgrep t`" && test -z "`/bin/echo -e '\v'|fgrep v`" && test -z "`/bin/echo -e '\033'|fgrep 33`"; then + ECHO_E='/bin/echo -e' +else + ECHO_E= +fi +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 +else + echo "$ac_t""no" 1>&6 +fi + +PACKAGE=ivycpy +VERSION=0.4 + +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 +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= +elif test -n "$ECHO_E" && >/dev/null 2>&1 $ECHO_E && test -z "`$ECHO_E '\c'|fgrep c`"; then + ECHO_N=$ECHO_E; _N=; _C=\\c +elif >/dev/null 2>&1 echo && test -z "`echo -n ''|fgrep n`"; then + ECHO_N=echo; _N=-n; _C= +elif >/dev/null 2>&1 echo && test -z "`echo '\c'|fgrep c`"; then + ECHO_N=echo; _N=; _C=\\c +elif >/dev/null 2>&1 /bin/echo && test -z "`/bin/echo -n ''|fgrep n`"; then + ECHO_N=/bin/echo; _N=-n; _C= +elif >/dev/null 2>&1 /bin/echo && test -z "`/bin/echo '\c'|fgrep c`"; then + ECHO_N=/bin/echo; _N=; _C=\\c +else + ECHO_N=; _N=; _C= +fi +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 +else + echo "$ac_t""no" 1>&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 +else + if test -n "$ECHO_N"; then + ECHO=$ECHO_N +elif test -n "$ECHO_E"; then + ECHO=$ECHO_E +else + ECHO=echo +fi +mv_cv_prog_ECHO=$ECHO +fi +ECHO=$mv_cv_prog_ECHO +if test -n "$ECHO"; then + echo "$ac_t""$ECHO" 1>&6 +else + echo "$ac_t""no" 1>&6 + { echo "configure: error: NO ECHO COMMAND!!!" 1>&2; exit 1; } +fi +mv_LB=[ +mv_RB=] +mv_unset_colors() { + RESET= + # video attributes + BOLD= + BOLD_OFF= + UNDERLINE= + UNDERLINE_OFF= + BLINK= + BLINK_OFF= + REVERSE= + REVERSE_OFF= + # foreground colors + BLACK= + RED= + GREEN= + YELLOW= + BLUE= + MAGENTA= + CYAN= + WHITE= + DEFAULT= + # background colors + BG_BLACK= + BG_RED= + BG_GREEN= + BG_YELLOW= + BG_BLUE= + BG_MAGENTA= + BG_CYAN= + BG_WHITE= + BG_DEFAULT= + # abreviations + B= + b= + 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 + # video attributes + BOLD=${ESC}${mv_LB}1m + BOLD_OFF=${ESC}${mv_LB}22m + UNDERLINE=${ESC}${mv_LB}4m + UNDERLINE_OFF=${ESC}${mv_LB}24m + BLINK=${ESC}${mv_LB}5m + BLINK_OFF=${ESC}${mv_LB}25m + REVERSE=${ESC}${mv_LB}7m + REVERSE_OFF=${ESC}${mv_LB}27m + # foreground colors + BLACK=${ESC}${mv_LB}30m + RED=${ESC}${mv_LB}31m + GREEN=${ESC}${mv_LB}32m + YELLOW=${ESC}${mv_LB}33m + BLUE=${ESC}${mv_LB}34m + MAGENTA=${ESC}${mv_LB}35m + CYAN=${ESC}${mv_LB}36m + WHITE=${ESC}${mv_LB}37m + DEFAULT=${ESC}${mv_LB}39m + # background colors + BG_BLACK=${ESC}${mv_LB}40m + BG_RED=${ESC}${mv_LB}41m + BG_GREEN=${ESC}${mv_LB}42m + BG_YELLOW=${ESC}${mv_LB}43m + BG_BLUE=${ESC}${mv_LB}44m + BG_MAGENTA=${ESC}${mv_LB}45m + BG_CYAN=${ESC}${mv_LB}46m + BG_WHITE=${ESC}${mv_LB}47m + BG_DEFAULT=${ESC}${mv_LB}49m + # abreviations + B=$BOLD + b=$BOLD_OFF + U=$UNDERLINE + u=$UNDERLINE_OFF + else + mv_unset_colors + fi +} +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 + mv_unset_colors + mv_colors_on_fd_1=no +fi + if test "$mv_colors_on_fd_1" = yes; then + FOREGROUND=$BLACK + BACKGROUND=$BG_WHITE + $ECHO "COLOR ON${FOREGROUND}${BACKGROUND}" + fi +fi +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -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; } +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. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# 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" +# ./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 +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_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + 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" + fi +fi +echo "$ac_t""$INSTALL" 1>&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_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +echo $ac_n "checking terminal size""... $ac_c" 1>&6 +echo "configure:803: checking terminal size" >&5 +case `uname` in +Linux) + mv_term_spec=`stty size` + LINES=`echo $mv_term_spec|awk '{ print $1 }'` + COLUMNS=`echo $mv_term_spec|awk '{ print $2 }'` + unset mv_term_spec + ;; +SunOS) + mv_term_spec=`stty` + LINES=`echo $mv_term_spec|fgrep 'rows ='|sed 's/.*rows = \([0-9]*\).*/\1/'` + COLUMNS=`echo $mv_term_spec|fgrep 'rows ='|sed 's/.*columns = \([0-9]*\).*/\1/'` + unset mv_term_spec + ;; +*) + LINES=0 + COLUMNS=0 + ;; +esac +echo "$ac_t""$COLUMNS x $LINES" 1>&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. +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 +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" +fi +fi +PYTHON="$ac_cv_prog_PYTHON" +if test -n "$PYTHON"; then + echo "$ac_t""$PYTHON" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$PYTHON" && break +done + + +if test -z "$PYTHON"; then + { { +mv_fd=2 +if test -n "$ESC" && test -t $mv_fd; then + mv_set_colors + mv_colors_on_fd_2=yes +else + 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 Python interpreter 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 + + +PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[:3]"` + + +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 + mv_unset_colors + mv_colors_on_fd_1=no +fi + $ECHO "$CYAN""You are using Python version $PYTHON_VERSION""${RESET}${FOREGROUND-$DEFAULT}${BACKGROUND-$BG_DEFAULT}" +fi + + +mv_tmp=`type -p $PYTHON` # filespec +mv_tmp=`dirname $mv_tmp` # bindir +mv_tmp=`dirname $mv_tmp` # topdir + +if test ! -d $mv_tmp/include; then + { { +mv_fd=2 +if test -n "$ESC" && test -t $mv_fd; then + mv_set_colors + mv_colors_on_fd_2=yes +else + 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 «$mv_tmp/include» 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 +if test ! -d $mv_tmp/include/python$PYTHON_VERSION; then + { { +mv_fd=2 +if test -n "$ESC" && test -t $mv_fd; then + mv_set_colors + mv_colors_on_fd_2=yes +else + 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 «$mv_tmp/include/python$PYTHON_VERSION» 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 +if test ! -f $mv_tmp/include/python$PYTHON_VERSION/Python.h; then + { { +mv_fd=2 +if test -n "$ESC" && test -t $mv_fd; then + mv_set_colors + mv_colors_on_fd_2=yes +else + 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 «$mv_tmp/include/python$PYTHON_VERSION/Python.h» 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 + +PYTHON_INCLUDEDIR=$mv_tmp/include +PYTHON_LIBDIR=$mv_tmp/lib + + + + + +pyexecdir=\${exec_prefix}/lib/python$PYTHON_VERSION/site-packages +pythondir=\${exec_prefix}/lib/python$PYTHON_VERSION/site-packages + + + + +pkgpyexecdir=\${pyexecdir}/$PACKAGE +pkgpythondir=\${pythondir}/$PACKAGE + + + + + + +CPPFLAGS="$CPPFLAGS -I$PYTHON_INCLUDEDIR/python$PYTHON_VERSION" + + + + # + # Ok, lets find the tcl configuration + # First, look for one uninstalled. + # the alternative search directory is invoked by --with-tcl + # + + 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. +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:1088: checking for Tcl configuration" >&5 + if eval "test \"`echo '$''{'ac_cv_c_tclconfig'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + + # First check to see if --with-tclconfig 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; } + fi + fi + + # then check for a private Tcl installation + if test x"${ac_cv_c_tclconfig}" = x ; then + for i in \ + ../tcl \ + `ls -dr ../tcl[8-9].[0-9]* 2>/dev/null` \ + ../../tcl \ + `ls -dr ../../tcl[8-9].[0-9]* 2>/dev/null` \ + ../../../tcl \ + `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)` + break + fi + done + fi + + # 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 + if test -f "$i/tclConfig.sh" ; then + ac_cv_c_tclconfig=`(cd $i; pwd)` + break + fi + done + fi + + # check in a few other private locations + if test x"${ac_cv_c_tcliconfig}" = x ; then + for i in \ + ${srcdir}/../tcl \ + `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)` + break + 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 + exit 0 + else + no_tcl= + TCL_BIN_DIR=${ac_cv_c_tclconfig} + echo "$ac_t""found $TCL_BIN_DIR/tclConfig.sh" 1>&6 + fi + fi + + + echo $ac_n "checking for existence of $TCL_BIN_DIR/tclConfig.sh""... $ac_c" 1>&6 +echo "configure:1158: checking for existence of $TCL_BIN_DIR/tclConfig.sh" >&5 + + if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then + echo "$ac_t""loading" 1>&6 + . $TCL_BIN_DIR/tclConfig.sh + else + echo "$ac_t""file not found" 1>&6 + fi + + # + # The eval is required to do the TCL_DBGX substitution in the + # TCL_LIB_FILE variable + # + + eval TCL_LIB_FILE=${TCL_LIB_FILE} + eval TCL_LIB_FLAG=${TCL_LIB_FLAG} + + + + + + +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 + mv_unset_colors + mv_colors_on_fd_1=no +fi + $ECHO "$CYAN""You are using Tcl $TCL_VERSION""${RESET}${FOREGROUND-$DEFAULT}${BACKGROUND-$BG_DEFAULT}" +fi + + +TCL_INCLUDES= +TCL_INCLUDES="$TCL_INCLUDES ${TCL_INCLUDE_SPEC-"-I$TCL_SRC_DIR"}/unix" +TCL_INCLUDES="$TCL_INCLUDES ${TCL_INCLUDE_SPEC-"-I$TCL_SRC_DIR"}/generic" +TCL_INCLUDES="$TCL_INCLUDES ${TCL_INCLUDE_SPEC-"-I$TCL_SRC_DIR"}" + +DEFINES=" $DEFINES $TCL_DEFS" +INCLUDES=" $TCL_INCLUDES $INCLUDES" +LIBRARIES=" $TCL_LIB_SPEC $LIBRARIES" + + +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 + mv_unset_colors + mv_colors_on_fd_1=no +fi + $ECHO "$MAGENTA"""TCL_INCLUDES is "$TCL_INCLUDES ""${RESET}${FOREGROUND-$DEFAULT}${BACKGROUND-$BG_DEFAULT}" +fi +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. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1221: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_SWIG'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&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" +fi +fi +SWIG="$ac_cv_prog_SWIG" +if test -n "$SWIG"; then + echo "$ac_t""$SWIG" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$SWIG" && break +done + + +if test -z "$SWIG"; then + { { +mv_fd=2 +if test -n "$ESC" && test -t $mv_fd; then + mv_set_colors + mv_colors_on_fd_2=yes +else + 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}SWIG (Simplified Wrapper and Interface Generator) not${BOLD_OFF}" +>&2 $ECHO "${RED}${mv_prefix}: *** ${mv_severity}${BOLD}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 + +# <check for standard thing> + +# 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:1301: 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. +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" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&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:1331: 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. +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 +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +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:1382: 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. +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 +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + ;; + esac + fi + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:1414: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +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 1425 "configure" +#include "confdefs.h" + +main(){return(0);} +EOF +if { (eval echo configure:1430: \"$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 +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:1456: 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:1461: 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 <<EOF +#ifdef __GNUC__ + yes; +#endif +EOF +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1470: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +else + GCC= +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:1489: 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 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +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 +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi + + +# 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:1524: 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 +else + ac_save_LIBS="$LIBS" +LIBS="-lc $LIBS" +cat > conftest.$ac_ext <<EOF +#line 1532 "configure" +#include "confdefs.h" + +int main() { +main() +; return 0; } +EOF +if { (eval echo configure:1539: \"$ac_link\") 1>&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" + +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 <<EOF +#define $ac_tr_lib 1 +EOF + + 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:1569: checking how to run the C preprocessor" >&5 +# 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 +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" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. + cat > conftest.$ac_ext <<EOF +#line 1584 "configure" +#include "confdefs.h" +#include <assert.h> +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1590: \"$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 + : +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 <<EOF +#line 1601 "configure" +#include "confdefs.h" +#include <assert.h> +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1607: \"$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 + : +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 <<EOF +#line 1618 "configure" +#include "confdefs.h" +#include <assert.h> +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 + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP=/lib/cpp +fi +rm -f conftest* +fi +rm -f conftest* +fi +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" +fi +echo "$ac_t""$CPP" 1>&6 + +echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 +echo "configure:1649: 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 +else + cat > conftest.$ac_ext <<EOF +#line 1654 "configure" +#include "confdefs.h" +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.h> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1662: \"$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* + 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 +fi +rm -f conftest* + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. +cat > conftest.$ac_ext <<EOF +#line 1679 "configure" +#include "confdefs.h" +#include <string.h> +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +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 <<EOF +#line 1697 "configure" +#include "confdefs.h" +#include <stdlib.h> +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +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 + : +else + cat > conftest.$ac_ext <<EOF +#line 1718 "configure" +#include "confdefs.h" +#include <ctype.h> +#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); } + +EOF +if { (eval echo configure:1729: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_header_stdc=no +fi +rm -fr conftest* +fi + +fi +fi + +echo "$ac_t""$ac_cv_header_stdc" 1>&6 +if test $ac_cv_header_stdc = yes; then + cat >> confdefs.h <<\EOF +#define STDC_HEADERS 1 +EOF + +fi + +for ac_hdr 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:1756: 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 +#line 1761 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1766: \"$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" +fi +rm -f conftest* +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 <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + +# Checks for typedefs, structures, and compiler characteristics. +echo $ac_n "checking for working const""... $ac_c" 1>&6 +echo "configure:1795: 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 <<EOF +#line 1800 "configure" +#include "confdefs.h" + +int main() { + +/* 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; +} + +; return 0; } +EOF +if { (eval echo configure:1849: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + 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 +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_c_const" 1>&6 +if test $ac_cv_c_const = no; then + cat >> confdefs.h <<\EOF +#define const +EOF + +fi + + +# specific checks +echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 +echo "configure:1872: 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 <<EOF +#line 1877 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <signal.h> +#ifdef signal +#undef signal +#endif +#ifdef __cplusplus +extern "C" void (*signal (int, void (*)(int)))(int); +#else +void (*signal ()) (); +#endif + +int main() { +int i; +; return 0; } +EOF +if { (eval echo configure:1894: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + 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 +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_type_signal" 1>&6 +cat >> confdefs.h <<EOF +#define RETSIGTYPE $ac_cv_type_signal +EOF + + + +# Checks for library functions. +# 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:1918: 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 <<EOF +#line 1923 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char realloc(); below. */ +#include <assert.h> +/* 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(); + +int main() { + +/* 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(); +#endif + +; return 0; } +EOF +if { (eval echo configure:1946: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "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" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'realloc`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +{ echo "configure: error: "realloc unreachable"" 1>&2; exit 1; } +fi + + +# </check for standard thing> + +# <checking really presence of some ivycpy required header file, library> + +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 + mv_unset_colors + mv_colors_on_fd_1=no +fi + $ECHO "$MAGENTA"""CPPFLAGS is "$CPPFLAGS ""${RESET}${FOREGROUND-$DEFAULT}${BACKGROUND-$BG_DEFAULT}" +fi + +# python header +for ac_hdr in Python.h _tkinter.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1988: 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 +#line 1993 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1998: \"$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" +fi +rm -f conftest* +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 <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +{ echo "configure: error: "Python.h _tkinter.h unreachable"" 1>&2; exit 1; } +fi +done + + +# tcl header +for ac_hdr 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:2031: 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 +#line 2036 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2041: \"$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" +fi +rm -f conftest* +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 <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +{ echo "configure: error: "tcl.h unreachable"" 1>&2; exit 1; } +fi +done + +# ivy header +for ac_hdr 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:2073: 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 +#line 2078 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2083: \"$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" +fi +rm -f conftest* +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 <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +{ echo "configure: error: "ivy.h unreachable"" 1>&2; exit 1; } +fi +done + + +# python adaptation : shared macro with ivycpy (ENTER_PYTHON, LEAVE_PYTHON) +# if you dont have them, it means you do not point on the suited python/tkinter +# patched version +# #include <_tkinter.h> + +echo $ac_n "checking "suited patched Python version"""... $ac_c" 1>&6 +echo "configure:2117: checking "suited patched Python version"" >&5 +cat > conftest.$ac_ext <<EOF +#line 2119 "configure" +#include "confdefs.h" +#include <_tkinter.h> + #ifdef ENTER_PYTHON && LEAVE_PYTHON + yes + #endif + +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "yes" >/dev/null 2>&1; then + rm -rf conftest* + pythonpatched=yes +else + rm -rf conftest* + pythonpatched=no +fi +rm -f conftest* + +if test "$pythonpatched" = "yes" ; then + echo "$ac_t"""ok"" 1>&6 +else + { echo "configure: error: "no"" 1>&2; exit 1; } +fi + +echo $ac_n "checking "TCL_THREADS"""... $ac_c" 1>&6 +echo "configure:2144: checking "TCL_THREADS"" >&5 +cat > conftest.$ac_ext <<EOF +#line 2146 "configure" +#include "confdefs.h" + +#define WITH_THREAD +#include <_tkinter.h> +#ifdef TCL_THREADS +yes +#endif + +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "yes" >/dev/null 2>&1; then + rm -rf conftest* + tclthreads=yes +else + rm -rf conftest* + tclthreads=no +fi +rm -f conftest* + +if test "$tclthreads" = "yes" ; then + echo "$ac_t"""ok"" 1>&6 +else + echo "$ac_t"""no"" 1>&6 +fi + + + + +# </checking really presence of some ivycpy required header file, library> + + + + +trap '' 1 2 15 +cat > confcache <<\EOF +# 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. +# +# 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. +# +EOF +# 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 + if test -w $cache_file; then + 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. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +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} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS <<EOF +#! /bin/sh +# Generated automatically by configure. +# 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. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +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 +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "GNUmakefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS <<EOF + +# 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%@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_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 + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + 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` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <<EOF + +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" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # 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= + fi + + 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" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + 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= ;; + 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* + +EOF +cat >> $CONFIG_STATUS <<EOF + +EOF +cat >> $CONFIG_STATUS <<\EOF + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + + +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 + mv_unset_colors + mv_colors_on_fd_1=no +fi + if test "$mv_colors_on_fd_1" = yes; then + $ECHO "COLOR OFF${RESET}" + fi +fi + diff --git a/configure.in b/configure.in new file mode 100644 index 0000000..e425f7f --- /dev/null +++ b/configure.in @@ -0,0 +1,120 @@ +dnl # -*-shell-script-*- +dnl # autoconf2.13 script +dnl # «» +dnl # FAIRE L INSTALL DE LA DOC + +AC_INIT(ivycpy.i) +PACKAGE=ivycpy +VERSION=0.5 + +MV_COLOR_ON(BLACK, WHITE) +dnl # +AC_PROG_INSTALL + +dnl # for python specific settings +MV_PROG_PYTHON + +CPPFLAGS="$CPPFLAGS -I$PYTHON_INCLUDEDIR/python$PYTHON_VERSION" + +dnl # for tcl specific settings +MV_SET_TCL_CONFIG +MV_MSG(["TCL_INCLUDES is "$TCL_INCLUDES] , [$MAGENTA]) +CPPFLAGS="$CPPFLAGS $TCL_INCLUDES" + +dnl # testing some tools are working properly : swig +AC_CHECK_PROGS(SWIG, swig) + +if test -z "$SWIG"; then + MV_ERROR( +SWIG (Simplified Wrapper and Interface Generator) not +found) +fi + +# <check for standard thing> + +# Checks for programs. +# AC_PROG_CXX +AC_PROG_CC + +# Checks for libraries. +# FIXME: Replace `main' with a function in `-lc': +AC_CHECK_LIB([c], [main]) + +# Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS([stdlib.h string.h]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST + +# specific checks +AC_TYPE_SIGNAL + +# Checks for library functions. +# AC_MSG_CHECKING("checking for realloc ...") +# AC_CHECK_FUNC(realloc,AC_MSG_RESULT(" present"),\ +# AC_MSG_ERROR("unreachable")) +AC_CHECK_FUNC(realloc,,AC_MSG_ERROR("realloc unreachable")) + +# </check for standard thing> + +# <checking really presence of some ivycpy required header file, library> + +MV_MSG(["CPPFLAGS is "$CPPFLAGS] , [$MAGENTA]) + +# python header +AC_CHECK_HEADERS([Python.h _tkinter.h], , +AC_MSG_ERROR("Python.h _tkinter.h unreachable")) + +# tcl header +AC_CHECK_HEADERS([tcl.h],,AC_MSG_ERROR("tcl.h unreachable")) +# ivy header +AC_CHECK_HEADERS([ivy.h],,AC_MSG_ERROR("ivy.h unreachable")) + +# python adaptation : shared macro with ivycpy (ENTER_PYTHON, LEAVE_PYTHON) +# if you dont have them, it means you do not point on the suited python/tkinter +# patched version +# #include <_tkinter.h> + +AC_MSG_CHECKING("suited patched Python version") +AC_EGREP_CPP(yes, + [#include <_tkinter.h> + #ifdef ENTER_PYTHON && LEAVE_PYTHON + yes + #endif + ], pythonpatched=yes, pythonpatched=no) +if test "$pythonpatched" = "yes" ; then + AC_MSG_RESULT("ok") +else + AC_MSG_ERROR("no") +fi + +AC_MSG_CHECKING("TCL_THREADS") +AC_EGREP_CPP(yes, + [ +#define WITH_THREAD +#include <_tkinter.h> +#ifdef TCL_THREADS +yes +#endif + ], tclthreads=yes, tclthreads=no) +if test "$tclthreads" = "yes" ; then + AC_MSG_RESULT("ok") +else + AC_MSG_RESULT("no") +fi + + + + +# </checking really presence of some ivycpy required header file, library> + +dnl # exporting (Makefile some variables) +AC_SUBST(PACKAGE) +AC_SUBST(VERSION) + +AC_OUTPUT(GNUmakefile) + +MV_COLOR_OFF + +dnl # [END OF FILE] diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..ff28c71 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,47 @@ +ivycpy (0.5-1) stable; urgency=low + + * first version stored in ivy/cvs repository + + -- Didier Pavet <pavet@cena.fr> Thu, 9 Sep 2004 00:00:00 +0100 + +** ivycpy (0.3 - 0.4) unstable; urgency=low +** temporary version +** Didier Pavet <pavet@cena.fr> + +ivycpy (0.2-2-213sa) unstable; urgency=low + + * copyright, docs, + * demos respects Ivy standard -b otpions but remain "unclear" + + -- Didier Pavet <pavet@cena.fr> Mon, 3 Mar 2003 13:00:00 +0100 + +ivycpy (0.2-1-213sa) unstable; urgency=low + + * First version for Debian 3.0 (Python 213) + + -- Didier Pavet <pavet@cena.fr> Sun, 9 Feb 2003 01:00:00 +0100 + +ivycpy (0.1-3) unstable; urgency=low + + * correction on env variable when building the packahe to be "neat" + + -- Didier Pavet <pavet@cena.fr> Wed, 11 Dec 2002 15:45:14 +0100 + +ivycpy (0.1-2) unstable; urgency=low + + * correction on doc-base file + * attempt to clean the package and solve the problem of configuration + + -- Didier Pavet <pavet@cena.fr> Tue, 16 Jul 2002 17:07:39 +0200 + +ivycpy (0.1-1) unstable; urgency=low + + * Initial Release. + * First delivery of the ivycpy library; this version is made to test + * compatability with tkinter, thread, corba and so on + + -- Didier Pavet <pavet@cena.fr> Wed, 10 Jul 2002 17:32:59 +0200 + +Local variables: +mode: debian-changelog +End: diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..9d1502c --- /dev/null +++ b/debian/control @@ -0,0 +1,19 @@ +Source: ivycpy +Version: ivycpy213sa +Section: devel +Priority: optional +Maintainer: Didier Pavet <pavet@cena.fr> +Standards-Version: 3.0.1 +Build-Depends: debhelper + +Package: ivycpy +Section: devel +Architecture: i386 +Depends: ${shlibs:Depends}, libc6-dev, python-tk (=2.1.3-3.2) +Description: Ivy stub for Python (wrapper above ivyc). + Ivycpy is a wrapper above ivyc library (3.4) and procures functions + to plug a Python application onto the Ivy Bus; + This version is a very early release (ivycpy213sa stands for ivycpy for + Python 213 Stand Alone) which embodies ivy object modules, + and procures its own tkinter shared library . Further release should + just rely on dynamic linking with both libivy.so and native _tkinter.so diff --git a/debian/dirs b/debian/dirs new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/debian/dirs @@ -0,0 +1 @@ + diff --git a/debian/files b/debian/files new file mode 100644 index 0000000..abe1668 --- /dev/null +++ b/debian/files @@ -0,0 +1 @@ +ivycpy_0.2-2-213sa_i386.deb devel optional diff --git a/debian/ivycpy.3 b/debian/ivycpy.3 new file mode 100644 index 0000000..059d4d7 --- /dev/null +++ b/debian/ivycpy.3 @@ -0,0 +1,52 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" 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 "Feb, 2003" "ivycpy" "Python library for accessing Ivy Bus" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp <n> insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +ivycpy \- a Python library for accessing Ivy Bus +.SH SYNOPSIS +.B # importing ivycpy + +.B from ivycpy import * + +.SH DESCRIPTION +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.4) +and procures functions to plug a Python application onto the Ivy Bus. +This version is a very early release (ivycpy213sa stands for ivycpy for +Python 213 - Stand Alone) which embodies ivy object modules, +and procures its own tkinter shared library . Further release should +just rely on dynamic linking with both libivy.so and native _tkinter.so, but +some details stuff required to hack both ivy-c and tkinter themselves, so. +.PP +Ivycpy is developped using SWIG (Simplified Wrapper and Interface Generator), +see http://www.swig.org for further inforation on SWIG. + +.\" TeX users may be more comfortable with the \fB<whatever>\fP and +.\" \fI<whatever>\fP escape sequences to invode bold face and italics, +.\" respectively. +.SH EXAMPLES +Some examples of Python scripts are provided in +/usr/share/doc/ivycpy directory . +.SH SEE ALSO +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 <pavet@cena.fr>, +for the Debian GNU/Linux system. diff --git a/debian/ivycpy.doc-base b/debian/ivycpy.doc-base new file mode 100644 index 0000000..20204f1 --- /dev/null +++ b/debian/ivycpy.doc-base @@ -0,0 +1,10 @@ +Document: ivycpy +Title: Debian ivycpy Manual +Author: Didier Pavet +Abstract: This manual describes what ivycpy is. +Section: Devel + +Format: HTML +Index: /usr/share/doc/ivycpy/html/index.html +Files: /usr/share/doc/ivycpy/html/*.html + diff --git a/debian/ivycpy.docs b/debian/ivycpy.docs new file mode 100644 index 0000000..0a6cc9a --- /dev/null +++ b/debian/ivycpy.docs @@ -0,0 +1,2 @@ +docs/examples +docs/html diff --git a/debian/postinst b/debian/postinst new file mode 100644 index 0000000..bcbd460 --- /dev/null +++ b/debian/postinst @@ -0,0 +1,59 @@ +#! /bin/sh +# postinst script for ivycpy +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * <postinst> `configure' <most-recently-configured-version> +# * <old-postinst> `abort-upgrade' <new version> +# * <conflictor's-postinst> `abort-remove' `in-favour' <package> +# <new-version> +# * <deconfigured's-postinst> `abort-deconfigure' `in-favour' +# <failed-install-package> <version> `removing' +# <conflicting-package> <version> +# for details, see /usr/doc/packaging-manual/ +# +# quoting from the policy: +# Any necessary prompting should almost always be confined to the +# post-installation script, and should be protected with a conditional +# so that unnecessary prompting doesn't happen if a package's +# installation fails and the `postinst' is called with `abort-upgrade', +# `abort-remove' or `abort-deconfigure'. + +TKINTERDIR="/usr/lib/python2.1/lib-dynload" +EXAMPLEDIR="/usr/share/doc/ivycpy/examples" + +case "$1" in + configure) + #touch $TKINTERDIR/ivycpy.touch + if [ -f $TKINTERDIR/_tkinter.so ] + then + mv $TKINTERDIR/_tkinter.so $TKINTERDIR/_tkinter.so.orig + ln -s $TKINTERDIR/_tkinter.so.ivycpy $TKINTERDIR/_tkinter.so + fi + for i in $EXAMPLEDIR ; do + python -O /usr/lib/python2.1/compileall.py -q $i + python /usr/lib/python2.1/compileall.py -q $i + done + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 0 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + diff --git a/debian/postinst.debhelper b/debian/postinst.debhelper new file mode 100644 index 0000000..43c3446 --- /dev/null +++ b/debian/postinst.debhelper @@ -0,0 +1,12 @@ +# Automatically added by dh_installdocs +if [ "$1" = "configure" ]; then + if [ -d /usr/doc -a ! -e /usr/doc/ivycpy -a -d /usr/share/doc/ivycpy ]; then + ln -sf ../share/doc/ivycpy /usr/doc/ivycpy + fi +fi +# End automatically added section +# Automatically added by dh_installdocs +if [ "$1" = configure ] && command -v install-docs >/dev/null 2>&1; then + install-docs -i /usr/share/doc-base/ivycpy +fi +# End automatically added section diff --git a/debian/postrm b/debian/postrm new file mode 100644 index 0000000..f5979ce --- /dev/null +++ b/debian/postrm @@ -0,0 +1,40 @@ +#! /bin/sh +# postrm script for ivycpy +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * <postrm> `remove' +# * <postrm> `purge' +# * <old-postrm> `upgrade' <new-version> +# * <new-postrm> `failed-upgrade' <old-version> +# * <new-postrm> `abort-install' +# * <new-postrm> `abort-install' <old-version> +# * <new-postrm> `abort-upgrade' <old-version> +# * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version> +# for details, see /usr/doc/packaging-manual/ + +TKINTERDIR="/usr/lib/python2.1/lib-dynload" + +case "$1" in + purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + if [ -f $TKINTERDIR/_tkinter.so.orig ] + then + mv -f $TKINTERDIR/_tkinter.so.orig $TKINTERDIR/_tkinter.so + fi + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 0 + +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + + diff --git a/debian/prerm b/debian/prerm new file mode 100644 index 0000000..6c5dae3 --- /dev/null +++ b/debian/prerm @@ -0,0 +1,39 @@ +#! /bin/sh +# see: dh_installdeb(1) + +set -e +# +EXAMPLEDIR="/usr/share/doc/ivycpy/examples" + +# summary of how this script can be called: +# * <prerm> `remove' +# * <old-prerm> `upgrade' <new-version> +# * <new-prerm> `failed-upgrade' <old-version> +# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version> +# * <deconfigured's-prerm> `deconfigure' `in-favour' +# <package-being-installed> <version> `removing' +# <conflicting-package> <version> +# for details, see /usr/doc/packaging-manual/ + +case "$1" in + remove|upgrade|deconfigure) +# install-info --quiet --remove /usr/info/ivycpy.info.gz +# removing example file + rm $EXAMPLEDIR/*.* + ;; + failed-upgrade) + ;; + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 0 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + diff --git a/debian/prerm.debhelper b/debian/prerm.debhelper new file mode 100644 index 0000000..3c636ee --- /dev/null +++ b/debian/prerm.debhelper @@ -0,0 +1,11 @@ +# Automatically added by dh_installdocs +if [ \( "$1" = "upgrade" -o "$1" = "remove" \) -a -L /usr/doc/ivycpy ]; then + rm -f /usr/doc/ivycpy +fi +# End automatically added section +# Automatically added by dh_installdocs +if [ "$1" = remove -o "$1" = upgrade ] && \ + command -v install-docs >/dev/null 2>&1; then + install-docs -r ivycpy +fi +# End automatically added section diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..b443946 --- /dev/null +++ b/debian/rules @@ -0,0 +1,78 @@ +#!/usr/bin/make -f +# Sample debian/rules that uses debhelper. +# GNU copyright 1997 to 1999 by Joey Hess. + +# Uncomment this to turn on verbose mode. +export DH_VERBOSE=1 + +# This is the debhelper compatability version to use. +export DH_COMPAT=1 + +build: build-stamp +build-stamp: + dh_testdir + + ./configure --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info + # Add here commands to compile the package. + #$(MAKE) + + touch build-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-stamp + + # Add here commands to clean up after the build process. + -$(MAKE) distclean + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/tmp. + $(MAKE) install prefix=`pwd`/debian/tmp + + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install +# dh_testversion + dh_testdir + dh_testroot +# dh_installdebconf + dh_installdocs +# dh_installexamples examples/* _dp + dh_installmenu +# dh_installemacsen +# dh_installpam +# dh_installinit + dh_installcron + dh_installmanpages + dh_installinfo +# dh_undocumented + dh_installchangelogs + dh_link + dh_strip +# compression sauf des .py (exemples python) + dh_compress -X.py + dh_fixperms + # You may want to make some executables suid here. + dh_suidregister +# dh_makeshlibs + dh_installdeb +# dh_perl + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install diff --git a/debian/substvars b/debian/substvars new file mode 100644 index 0000000..56f0f5f --- /dev/null +++ b/debian/substvars @@ -0,0 +1 @@ +shlibs:Depends=libc6 (>= 2.2.4-4), tcl8.3 (>= 8.3.0), tk8.3 (>= 8.3.0), xlibs (>> 4.1.0) diff --git a/docs/copyright b/docs/copyright new file mode 100644 index 0000000..5998bd1 --- /dev/null +++ b/docs/copyright @@ -0,0 +1,31 @@ +This package is maintained by Didier Pavet <pavet@cena.fr> . + +It was probably downloaded from Cvs data base : Cena/Pii: /projet/ivy/cvsroot + +Copyright: + + Copyright (c) 2003,2004 CENA, Didier Pavet -- + + This code is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This code is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + 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. + +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 +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/docs/dev/BUGS b/docs/dev/BUGS new file mode 100644 index 0000000..181ec3d --- /dev/null +++ b/docs/dev/BUGS @@ -0,0 +1,2 @@ +None reported up-to-now ; + diff --git a/docs/dev/TODO b/docs/dev/TODO new file mode 100644 index 0000000..0ef6a7f --- /dev/null +++ b/docs/dev/TODO @@ -0,0 +1,32 @@ +evolutions du mode de fabrication de la librairie ivycpy.so : +clarifier avec Martin les besoins en macro m4 ; + + +préparer une version 0.4 ayant ces caractéristiques : +------------------------------------------------------------ +o0 : ajouter les dépendances d'outils de fabrication +install +swig +ivy test include +python test include + +les dépendances de header (include) + +o1 : faciliter le cablage adhoc avec les librairies "dépendances" +(dont ivycpy dépend): +- libivy.so , libtclivy.so +- _tkinter.so (et donc python) +- libtcl + +o2 : faciliter la realisation à la fois : +- installation adhoc (a partir des sources) avec une target +- paquet debian + +o3 : nettoyer le paquet des anciens modes de travail + +o4 : ajouter bindirect dans l'interface et ds les exemples; + +o5 : faire une version 0.4 source et debian ; + +préparer une version beta 0.5 indépendante de python +------------------------------------------------------------
\ No newline at end of file diff --git a/docs/dev/TODO_SITEIVY b/docs/dev/TODO_SITEIVY new file mode 100644 index 0000000..6622824 --- /dev/null +++ b/docs/dev/TODO_SITEIVY @@ -0,0 +1,80 @@ +From: Marcellin Buisson <buisson@cena.fr>, +To: François-Régis Colin <fcolin@cena.fr>, + Yannick Jestin <jestin@cena.fr>, + Christophe Mertz <mertz@intuilab.com>, + Didier PAVET <didier.pavet@ath.cena.fr>, + pascal.brisset@recherche.enac.fr, + Stéphane Chatty <chatty@intuilab.com>, + Sébastien Maury <smaury@apple.com>, + alexandre bustico <alexandre.bustico@cena.fr>, + Philippe Truillet <truillet@irit.fr>, + Alexandre Lemort <lemort@intuilab.com>, Eric Blond <blond@cena.fr>, +Cc: Marcellin Buisson <buisson@cena.fr>, + Gwenael BOTHOREL <bothorel@cena.fr>, +Subject: Ivy, web, sources, binaires et compagnie...., +Date: Mon, 14 Jun 2004 18:17:28 +0200, +Mcnf-Status: ok +Mcnf-Date: Mon Jun 14 18:19:40 2004 +Mcnf-Att: "/pcnfs/usagers/pavet/.amcnf/msg-1622-1.txt" + + Bonjour à tous, + + C'est en tant qu'auteurs ou empaqueteurs usuels des différentes +portages ivy que je sollicite votre aide et vous offre la lecture qui +suit :o) + + Comme vous avez pu le constater par vous même (ou comme vous le voyez +en vous rendant sur +http://www.tls.cena.fr/products/ivy/download/index.html), les sources +et les binaires des différents portages d'ivy qui sont distribuées sur +le site web datent un peu..ou sont incomplets.. bref c'est un peu le +bazar... + + En tant que mainteneur du site web ivy (et donc responsable de +l'obsolescence du code mis en ligne) , je me trouve confronté à +plusieurs problèmes : + + - quand mettre à jour les sources d'un portage ? + (notion de version d'ivy par exemple, pour environ 10 langages +supportés différents, à des états d'avancement différents ) + + - comment gérer les différents empaquetages ? + (pour 5 ou 6 architectures, et quelques unes exotiques) + + - comment respecter la LGPL dans notre distribution ? + (actuellement par exemple le texte de la LGPL, ou une reference à +celle-ci n'est pas présent dans tous les sources disponibles : +http://www.gnu.org/copyleft/lesser.txt) + + En l'absence pour le moment d'un espace de collaboration en ligne type +wiki, d'un accès anonyme la la base CVS ivy du CENA, ainsi que de +méthodes éprouvées pour *livrer* une version d'ivy, je vous propose la +chose suivante (si vous voyez une autre façon de faire, n'hésitez pas à +la proposer ! ) : + + Pour le source non disponible actuellement sur la base cvs du CENA +(c'est-à-dire tout sauf ivy-ada, ivy-c, ivy-c++, ivy-java, ivy-perl), +les auteurs des différents ports pourraient-ils m'envoyer une version +actualisée et respectant la LGPL du source (tar.gz par exemple) +estampillée "ivy-port-juin-2004" et que vous m'autoriseriez à mettre +dans la base cvs du CENA ? (je pense notamment à ivy-csharp, +ivy-python, ivy-metacard, ivy-caml, ivy-flash, ivy-com) + + Pour le source déjà disponible dans la base cvs, pourriez-vous m'aider +à inclure les fichiers de licences corrects et à vérifier qu'il est en +état (c'est à dire compile par exemple, avec des makefile corrects) + + Ce sera une première étape. + + La seconde étape, c'est de livrer un certain nombre de paquets +correspondants à cette livraison de sources. J'aurais alors besoin de +votre aide pour empaqueter sous windows, Mandrake 10.0, debian woody et +sarge, ipaq, macos X etc etc). Ce qui devrait me permettre ensuite de +mettre à jour les pages web ivy et donc de contribuer à son +rayonnement, son expansion..sa prolifération et ainsi de suite... + + J'attends vos idées, réactions, et surtout votre aide !! + +Viva ivy et bonne soirée, + +Marcellin. diff --git a/docs/dev/how2build.html b/docs/dev/how2build.html new file mode 100644 index 0000000..738bf8e --- /dev/null +++ b/docs/dev/how2build.html @@ -0,0 +1,29 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> +<html> <head> +<title>Ivycpy - buiding instructions</title> +</head> + +<body> +<H2><A NAME=PURPOSE>Ivycpy - buiding instructions</A></H2> +<p>First of all ivycpy is building process is managed by autoconf.</p> +<p>You should have to do the following actions: +<ul> + <li>say to configure where is ivy-c lib and include files (LD_LIBRARY_PATH , CPPFAGS) + <li>say to configure where is your version of Python (LD_LIBRARY_PATH , +CPPFAGS) (Note: a specific version is required exporting some MACRO def) + <li>launching configure with the suited location of tcl/tk configuration file tclConfig.sh and your target + destination:<br> + <em>./configure --prefix=/opt/ivycpy-dp --with-tcl=/opt/tcltk-8.4.5/lib/</em><br> + verify that every test is ok; normally if all is ok, you should be capable to compile and install + without any problems. + <li><em>make</em> + <li><em>make install </em> +</ul> +</p> + + +<hr> +<!-- hhmts start --> +Last modified: Mon May 24 16:43:51 CEST 2004 +<!-- hhmts end --> +</body> </html> diff --git a/docs/dev/maintainer_notes.txt b/docs/dev/maintainer_notes.txt new file mode 100644 index 0000000..54a6147 --- /dev/null +++ b/docs/dev/maintainer_notes.txt @@ -0,0 +1,104 @@ +Echanges avec Martin Loewis concerant les évolutions de Python et Tkinter +liés au wrapper python <-> ivy + + + +Date: Sun, 13 Jul 2003 18:49:35 +0200 +From: =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?= <martin@v.loewis.de> +User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de-AT; rv:1.4) Gecko/20030624 +X-Accept-Language: de, en-us, en +To: Didier PAVET <pavet@ath.cena.fr> +Subject: Re: a request / tkinter (ENTER_TCL ENTER_PYTHON macro) +In-Reply-To: <200307100715.JAA18790@basilic.dev.ath.cena.fr> +Content-Type: text/plain; charset=us-ascii; format=flowed +X-Seen: false +X-ID: rfGYOMZcgeZyNlhDQlB5laNXLu1X06U3wOOZDJ0mi2oMCVtqUb+aQc@t-dialin.net + +Didier PAVET wrote: + +> Have you allready heard some request in that sens ? + +Dear Didier, + +Yes, this is a SourceForge feature request, see + +http://python.org/sf/539907 + +> Does it stand sensible that this patch could be integrated in Python/Tkinter +> distribution and are you the right man to do that ? + +In some form, yes, certainly. Merely copying the macros into a header +file is not sufficient though: the code has been become much more +complex since 2.1, as we now also need to support multi-threaded Tcl +installations. + +Also, in general, you cannot access C variables across different +Python extension modules. Instead, you need to expose a CObject of some +kind. Instead of having that C object refer to the Tcl lock, I'd rather +provide access to some higher-level function pointers which can take +into account the various Tcl installations. + +I'd encourage you to work on this for Python 2.4. Please make either +Python 2.3 or the Python CVS your starting point, and please submit +unified diffs to sf.net/projects/python when you are done. + +If you have any questions about this approach, don#t hesitate to ask. + +Regards, +Martin + + +Date: 10 Jul 2003 09:07:08 +0200 +From: Didier PAVET <pavet@ath.cena.fr> +To: martin@v.loewis.de +Subject: a request / tkinter (ENTER_TCL ENTER_PYTHON macro) + +Martin, + +First of all, thank you for the job to maintain and upgrade python's stuff. +My organisation (french R&D center for air navigation) currently benefits from +python , tkinter material to build prototype, mock-up and so all. + +I have a request concerning _tkinter.h and _tkinter.c . In fact, in order to +build a python wrapper to an in-house middleware library built in C, I have +faced a problem with macro which aim at protecting interaction between tcl/tk +mainloop, thread and so on . I mean these macro ; +ENTER_TCL +LEAVE_TCL +ENTER_PYTHON +LEAVE_PYTHON + +For the moment, these macros are private to _tkinter module and so defined in +_tkinter.c. My need is to be capable from an external python module (in fact +my wrapper) to use (and so to share the data) these macros. + +I have allready carried out a solution patching Python 2.1.3 distribution and +packing my library to verify that it works . The solution is to externalize +and put the macros definition in the header _tkinter.h and allow external +access to lock as tcl_lock, tcl_state . + +2 requests : + +Have you allready heard some request in that sens ? +Does it stand sensible that this patch could be integrated in Python/Tkinter +distribution and are you the right man to do that ? + +Many thanks in advance for your help; it is clear for me that a positive +answer would avoid me to deliver my wrapper with a patched version of +Tkinter (solution which is pretty not handy). + +I just attached as a tar file my version of _tkinter.h and _tkinter.c derived +from Python 2.1.3 (debian woody stable version). + +Didier +-- +Didier PAVET Centre d'Etudes de La Navigation Aerienne / (Chef division ICS) +Office location Phone: (33 1) 69 57 68 89 - Fax: (33 1) 69 57 68 52 +B1608 b025 ou 01 69 57 68 89 ou 01 69 57 68 52 +E-mail: pavet@ath.cena.fr WWW: http://www.ath.cena.fr/~pavet + +Note : the middleware, target of my wrapper is Ivy; +have a look at +http://www.tls.cena.fr/products/ivy/ or +http://freshmeat.net/projects/ivy/ + diff --git a/docs/examples/.cvsignore b/docs/examples/.cvsignore new file mode 100644 index 0000000..93baa45 --- /dev/null +++ b/docs/examples/.cvsignore @@ -0,0 +1 @@ +env.sh
\ No newline at end of file diff --git a/docs/examples/pyhello.py b/docs/examples/pyhello.py new file mode 100755 index 0000000..e0db498 --- /dev/null +++ b/docs/examples/pyhello.py @@ -0,0 +1,94 @@ +#!/usr/bin/env python +""" pyhello.py : very simple hello world python program using ivycpy +with a local main loop +""" +import traceback, time, string, os, sys, getopt +# importing ivycpy +from ivycpy import * + +IVYAPPNAME = "pyhello" + +def lprint(fmt,*arg): + print IVYAPPNAME + ": " + fmt % arg + +def usage(scmd): + lpathitem = string.split(scmd,'/') + fmt = '''Usage: %s [-h] [-b IVYBUS | --ivybus=IVYBUS] +where +\t-h provides the usage message; +\t-b IVYBUS | --ivybus=IVYBUS allow to provide the IVYBUS string in the form +\t adresse:port eg. 127.255.255.255:2010 +''' + print fmt % lpathitem[-1] + +def oncxproc(connected): + if connected == IvyApplicationDisconnected : + lprint( "An Ivy application was disconnected ") + else: + lprint( "An Ivy application was connected") + lprint("currents Ivy application are [%s]", IvyGetApplicationList()) + +def ondieproc(id): + lprint( "received the order to die with id = %d", id) + +def onmsgproc(*larg): + lprint( "%s received [%s] ", IVYAPPNAME , larg[0]) + +def onhello(*larg): + sreply = "goodday %s to=%s from=%s " % (larg[0], larg[1],IVYAPPNAME) + lprint( "on hello , %s reply [%s]", IVYAPPNAME, sreply) + IvySendMsg(sreply) + +def ontick(): + lprint( "%s send a tick", IVYAPPNAME) + IvySendMsg("%s_tick" % IVYAPPNAME) + +if __name__ == '__main__': + # initializing ivybus and isreadymsg + sivybus = "" + sisreadymsg = "%s is ready" % IVYAPPNAME + # getting option + try: + optlist, left_args = getopt.getopt(sys.argv[1:],'hb:', ['ivybus=']) + except getopt.GetoptError: + # print help information and exit: + usage(sys.argv[0]) + sys.exit(2) + for o, a in optlist: + if o in ("-h", "--help"): + usage(sys.argv[0]) + sys.exit() + elif o in ("-b", "--ivybus"): + sivybus= a + if sivybus != "" : + sechoivybus = sivybus + elif os.environ.has_key("IVYBUS"): + sechoivybus = os.environ["IVYBUS"] + else: + sechoivybus = "ivydefault" + lprint( "Ivy will broadcast on %s ", sechoivybus) + + # initialising the bus + IvyInit(IVYAPPNAME, # application name for Ivy + sisreadymsg , # ready message + 0, # main loop is local (ie. using IvyMainloop) + oncxproc, # handler called on connection/deconnection + ondieproc # handler called when a diemessage is received + ) + # starting the bus + # Note: env variable IVYBUS will be used if no parameter or empty string + # is given ; this is performed by IvyStart (C) + IvyStart(sivybus) + # binding to every message + IvyBindMsg(onmsgproc, "(.*)") + # binding on dedicated message : starting with "hello ..." + IvyBindMsg(onhello, "^hello=([^ ]*) from=([^ ]*)") + # creating a infinite timer + timerid = IvyTimerRepeatAfter(0, # number of time to be called + 1000, # delay in ms between calls + ontick # handler to call + ) + lprint( "IvyTimerRepeatAfter id is %d", timerid) + + lprint( "%s doing IvyMainLoop", IVYAPPNAME) + IvyMainLoop() diff --git a/docs/examples/testtk.py b/docs/examples/testtk.py new file mode 100755 index 0000000..13bb1f9 --- /dev/null +++ b/docs/examples/testtk.py @@ -0,0 +1,192 @@ +#!/usr/bin/env python +""" programme de test de ivycpy en mode boucle tk """ + +import traceback, time, os, sys, string, getopt +from Tkinter import * +from ivycpy import * + +IVYAPPNAME = "pytesttk" + +def lprint(fmt,*arg): + print IVYAPPNAME + ": " + fmt % arg + +def usage(scmd): + lpathitem = string.split(scmd,'/') + fmt = '''Usage: %s [-h] [-b IVYBUS | --ivybus=IVYBUS] +where +\t-h provides the usage message; +\t-b IVYBUS | --ivybus=IVYBUS allow to provide the IVYBUS string in the form +\t adresse:port eg. 127.255.255.255:2010 +''' + print fmt % lpathitem[-1] + +global hellobindingid +hellobindingid = -1 + +class TopLevel(Tk) : + __single = 0 + def __init__(self,appname = "TopLevel"): + if TopLevel.__single != 0 : + lprint("TopLevel is singleton") + sys.exit(1) + __single = 1 + # the object is tk_root + Tk.__init__(self) + self.appname = appname + self.title(self.appname) + # Frame contenant heure et bouton quit + self.tkFheadpanel = Frame(self) + # Label hour + self.tkLhour = Label(self.tkFheadpanel,text="hh:mm:ss") + self.tkLhour.pack(padx=4 , pady=4 , side = LEFT) + # dummy button +## self.tkBdummy = Button(self.tkFheadpanel, +## text="dummy", bg='pink') +## self.tkBdummy.pack(padx=4 , pady=4, side = RIGHT) + + # button quit + self.tkBquit = Button(self.tkFheadpanel, + text="QUIT", bg='pink', command=self.quit) + self.tkBquit.pack(padx=4 , pady=4, side = RIGHT) + self.tkFheadpanel.pack(side=TOP) + + # Frame contenant un Text et un Scroller + self.tkFreceive_msg = Frame(self) + # Text + self.tkTreceive_msg = Text(self.tkFreceive_msg, height=26, width=50) + # Scrollbar + self.tkSBreceive_scroller = Scrollbar( + self.tkFreceive_msg, + command = self.tkTreceive_msg.yview) + self.tkTreceive_msg.configure( + yscrollcommand = self.tkSBreceive_scroller.set) + + self.tkTreceive_msg.pack(padx=4 , pady=4, + side=LEFT, fill = BOTH, expand = YES) + self.tkSBreceive_scroller.pack(side=RIGHT, fill = Y) + self.tkFreceive_msg.pack(side=BOTTOM, fill = BOTH, expand = YES) + + def add_one_msg(self, smsg) : + self.tkTreceive_msg.insert(END, "%s\n" % smsg ) + + def quit(self): + # cleanup action before detroying tk_root + lprint("doing IvyStop") + IvyStop() + lprint("doing destroy" ) + self.destroy() + lprint("after destroy") + lprint("done.") + + def ontick(self): + lprint("on tick method") + IvySendMsg("testtk_tick") + self.after(1000,self.ontick) + +def oncxproc(connected): + if connected == IvyApplicationDisconnected : + lprint("an IvyApplication was Disconnected") + else: + lprint("an IvyApplication was Connected") + +def ondieproc(id): + lprint("On die proc id=%d", id ) + +def onhelloproc(*larg): + sargs = string.join(larg,":") + sresult = "On <hello %s>, i reply <goodday %s>" % (larg[0], larg[0]) + mytoplevel.add_one_msg(sresult) + # lprint("[%s]" % sresult + IvySendMsg("goodday %s" % (larg[0])) + +def onmsgproc(*larg): + sresult = "On msg proc : arg number = %d , arglist = %s" % \ + (len(larg), string.join(larg,":")) + mytoplevel.add_one_msg(sresult) + + # abonnement selectif + +def oncmd(*larg): + global hellobindingid + lprint("hb =%d", hellobindingid) + lprint("cmd [%s] larg0=%s", string.join(larg,":"), larg[0]) + if larg[0] == 'bindhello' : + if hellobindingid == -1 : + hellobindingid = IvyBindMsg(onhelloproc,"^hello (.*)") + lprint("binding hello id = %d ", hellobindingid) + elif larg[0] == 'unbindhello' : + if hellobindingid != -1 : + lprint("unbinding hello id = %d ", hellobindingid) + IvyUnBindMsg(hellobindingid) + hellobindingid = -1 + elif larg[0] == 'getlist' : + sapplist = IvyGetApplicationList() + lprint("app list return %s" , sapplist) + for sapp in string.split(sapplist): + lprint("app name [%s] host [%s] ", + sapp, IvyGetApplicationHost(IvyGetApplication(sapp))) + lprint(IvyGetApplication(sapp)) + elif larg[0] == 'senddie' : + sapplist = IvyGetApplicationList() + lprint("app list return %s", sapplist) + for sapp in string.split(sapplist): + lprint("sending die to %s ", sapp) + IvySendDieMsg(IvyGetApplication(sapp)) + elif larg[0] == 'senderror' : + sapplist = IvyGetApplicationList() + lprint("app list return %s" , sapplist) + for sapp in string.split(sapplist): + lprint("sending error to %s " , sapp) + IvySendError(IvyGetApplication(sapp),0, + "error msg to %s from %s" % (sapp,IVYAPPNAME)) + # print "[%s]" % sresult + # IvySendMsg("a recu et renvoi [%s]" % sargs) + +def ontick(): + lprint("ontick") + IvySendMsg("testtk_tick") + +if __name__ == '__main__': + # initializing ivybus and isreadymsg + sivybus = "" + sisreadymsg = "[%s is ready]" % IVYAPPNAME + # getting option + try: + optlist, left_args = getopt.getopt(sys.argv[1:],'hb:', ['ivybus=']) + except getopt.GetoptError: + # print help information and exit: + usage(sys.argv[0]) + sys.exit(2) + for o, a in optlist: + if o in ("-h", "--help"): + usage(sys.argv[0]) + sys.exit() + elif o in ("-b", "--ivybus"): + sivybus= a + if sivybus != "" : + sechoivybus = sivybus + elif os.environ.has_key("IVYBUS"): + sechoivybus = os.environ["IVYBUS"] + else: + sechoivybus = "ivydefault" + lprint("Ivy will broadcast on %s " , sechoivybus) + + mytoplevel = TopLevel("%s top window" % IVYAPPNAME) + # myinterface = SocketInt(mytoplevel, delay = 2.0, iter = 5) + sisreadymsg = "%s is ready" % IVYAPPNAME + lprint("IvyApplicationConnected is %s " , IvyApplicationConnected) + lprint("IvyApplicationDisconnected is %s " , IvyApplicationDisconnected) + IvyInit(IVYAPPNAME, sisreadymsg, 1 , oncxproc, ondieproc ) + IvyStart(sivybus) + bindingid = IvyBindMsg(onmsgproc, "([^ ]*) ([^ ]*) ([^ ]*) ([^ ]*) (.*)") # "(.*)") + # lprint("IvyBindMsg retourne %d" , bindingid ) + bindingid = IvyBindMsg(oncmd, "^\.(.*)") # "(.*)") + # lprint("IvyBindMsg retourne %d", bindingid) + + # timerid = IvyTimerRepeatAfter(10,1000,ontick) + # print("IvyTimerRepeatAfter retourne %d" % timerid + mytoplevel.after(1000,mytoplevel.ontick) + + lprint("tk mainloop") + mytoplevel.mainloop() + diff --git a/docs/examples/vl_isa.py b/docs/examples/vl_isa.py new file mode 100755 index 0000000..89c70fa --- /dev/null +++ b/docs/examples/vl_isa.py @@ -0,0 +1,140 @@ +#!/usr/bin/env python +""" very light isa hmi mockup +prog de test infrastructure ivy + mini ihm type isa """ + +import traceback, time, os, sys, string, getopt +from Tkinter import * +from ivycpy import * + +APPNAME = "vl_isa" + +def lprint(fmt,*arg): + print APPNAME + ": " + fmt % arg + +def usage(scmd): + lpathitem = string.split(scmd,'/') + fmt = '''Usage: %s [-h] [-b IVYBUS | --ivybus=IVYBUS] [-n APPNAME | --name=APPNAME] +where +\t-h provides the usage message; +\t-n APPNAME | --name=APPNAME +\t-b IVYBUS | --ivybus=IVYBUS allow to provide the IVYBUS string in the form +\t adresse:port eg. 127.255.255.255:2010 +''' + print fmt % lpathitem[-1] + +def oncxproc(connected): + if connected == IvyApplicationDisconnected : + lprint("an IvyApplication was Disconnected") + else: + lprint("an IvyApplication was Connected") + +def ondieproc(id): + lprint("we ask me to die with id [%d]", id ) + +class TopLevel(Tk) : + __single = 0 + def __init__(self,appname = "TopLevel"): + if TopLevel.__single != 0 : + lprint("TopLevel is singleton") + sys.exit(1) + __single = 1 + # the object is tk_root + Tk.__init__(self) + self.appname = appname + self.title(self.appname) + # Frame contenant heure et bouton quit + self.tkFheadpanel = Frame(self) + # Label hour + self.tkLhour = Label(self.tkFheadpanel,text="hh:mm:ss") + self.tkLhour.pack(padx=4 , pady=4 , side = LEFT) + # dummy button +## self.tkBdummy = Button(self.tkFheadpanel, +## text="dummy", bg='pink') +## self.tkBdummy.pack(padx=4 , pady=4, side = RIGHT) + + # button quit + self.tkBquit = Button(self.tkFheadpanel, + text="QUIT", bg='pink', command=self.quit) + self.tkBquit.pack(padx=4 , pady=4, side = RIGHT) + self.tkFheadpanel.pack(side=TOP) + + # Frame contenant un Label, un Text et un Scroller + self.tkFreceive_msg = Frame(self) + # label + self.tkLreceive_msg = Label(self.tkFreceive_msg, text="flyingonthebus") + self.tkLreceive_msg.pack(padx=4 , pady=4, + side=TOP, fill = BOTH, expand = YES) + # Text + self.tkTreceive_msg = Text(self.tkFreceive_msg, height=26, width=50) + # Scrollbar + self.tkSBreceive_scroller = Scrollbar( + self.tkFreceive_msg, + command = self.tkTreceive_msg.yview) + self.tkTreceive_msg.configure( + yscrollcommand = self.tkSBreceive_scroller.set) + + self.tkTreceive_msg.pack(padx=4 , pady=4, + side=LEFT, fill = BOTH, expand = YES) + self.tkSBreceive_scroller.pack(side=RIGHT, fill = Y) + self.tkFreceive_msg.pack(side=BOTTOM, fill = BOTH, expand = YES) + + def add_one_msg(self, smsg) : + self.tkTreceive_msg.insert(END, "%s\n" % smsg ) + + def onmsgproc(self,*arg) : + self.add_one_msg(string.join(arg,"")) + + def quit(self): + # cleanup action before detroying tk_root + lprint("doing IvyStop") + IvyStop() + lprint("doing destroy" ) + self.destroy() + lprint("after destroy") + lprint("done.") + +## def ontick(self): +## lprint("on tick method") +## IvySendMsg("testtk_tick") +## self.after(1000,self.ontick) + +# main prog +if __name__ == '__main__': + # setting some main variable + sivybus = "" + + # getting option + try: + optlist, left_args = getopt.getopt(sys.argv[1:],'hb:n:', ['ivybus=','name']) + except getopt.GetoptError: + # print help information and exit: + usage(sys.argv[0]) + sys.exit(2) + for o, a in optlist: + if o in ("-h", "--help"): + usage(sys.argv[0]) + sys.exit() + elif o in ("-b", "--ivybus"): + sivybus = a + elif o in ("-n","--name"): + APPNAME = a + if sivybus != "" : + sechoivybus = sivybus + elif os.environ.has_key("IVYBUS"): + sechoivybus = os.environ["IVYBUS"] + else: + sechoivybus = "ivydefault" + lprint("Ivy will broadcast on %s " , sechoivybus) + + # initializing ivy : isreadymsg + sisreadymsg = "[%s is ready]" % APPNAME + IvyInit(APPNAME, sisreadymsg, 1 , oncxproc, ondieproc ) + IvyStart(sivybus) + + # initializing top hmi part + mytoplevel = TopLevel("%s top window" % APPNAME) + + # doing suited binding + IvyBindMsg(mytoplevel.onmsgproc , "(.*)") + + mytoplevel.mainloop() diff --git a/docs/html/.cvsignore b/docs/html/.cvsignore new file mode 100644 index 0000000..64233a9 --- /dev/null +++ b/docs/html/.cvsignore @@ -0,0 +1 @@ +index.html
\ No newline at end of file diff --git a/docs/html/index_tpl.html b/docs/html/index_tpl.html new file mode 100644 index 0000000..1c96948 --- /dev/null +++ b/docs/html/index_tpl.html @@ -0,0 +1,65 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> +<html> <head> +<title>Ivycpy - a wrapper around ivy-c to get a Python stub to Ivy</title> +</head> + +<body> +<h2><A NAME=NAME>NAME</A></h2> +ivycpy - a wrapper around ivy-c to get a Python stub to Ivy +<H2><A NAME=VERSION>VERSION</A></H2> +<p>Current version is _VERSION_. </p> +<H2><A NAME=SYNOPSIS>SYNOPSIS</A></H2> +<p>ivycpy library procures a way to connect Python/Python-Tkinter application +on an Ivy bus. +<H2><A NAME=WARNING>WARNING</A></H2> + +<p>This current source version allows to link ivycpy with locally +installed version of [tcl/tk, adapted version of +[Python/Tkinter]]. ivycpy requires still some patches on _tkinter.c +(see <a href="../dev/">dev docs</a> for further information). As a +consequence, <em>ivycpy is not presented as debian package any more</em>. The +source package allows to install the software as an OPTional package.</p> + +<p>This version is strictly compatible with ivy-c [3.2 .. 3.6] and can be +dynamically linked to a new version of ivy-c, if ivy-c api is unchanged which is +quite unlikely.</p> + +<p>So provided that, you installed compatible version of tcl/tk and +Python/Tkinter (adapted by yourself), ivy-c and ivy-c-dev, it should be easy to +rebuilt a new version of ivycpy adapted to the needs. <em>See for <a +href="../dev/how2build.html"">building instructions</a></em></p> + +<p><i>A former version ivycpy213sa has been delivered as a debian package +tightly linked with woody 3.0 set of package , ie.: +<ul> + <li>ivyc library (3.4) + <li>tcl/tk 8.3 + <li>Python 2.1.3 +</ul> +but it was clearly immatured and awkward ! +</i></p> +<H2><A NAME=DESCRIPTION>DESCRIPTION</A></H2> + +<p>ivycpy is not a native python language binding to Ivy but, a wrapper around C +level functions. ivycpy was made with <a href="http://www.swig.org">swig</a> +(Scripting Wrapper Interface Generator). For a high level view of the python +api, have a look to <a href="ivycpy_wrap.html">ivycpy_wrap.html</a>. For a hands on experience, see, next section.</p> + +<H2><A NAME=EXAMPLES>EXAMPLES</A></H2> +<p>To have a clear view of how to use this library, please, have a look at the +examples normally accessible at <a href="../examples/">examples</a>.</p> + +<H2><A NAME=SEEALSO>SEE ALSO</A></H2> +See Ivy home page at <a href="http://www.tls.cena.fr/products/ivy"> +www.tls.cena.fr/products/ivy</a> to obtain detailed information about ivy. + +<H2><A NAME=AUTHORS>AUTHORS</A></H2> +Didier Pavet <pavet@cena.fr> +<H2><A NAME=COPYRIGHT>COPYRIGHT</A></H2> +<p>This software is free software under Library GNU Public License; see <a href="copyright">./copyright</a> for detail and references.</p> +<hr> + +<!-- hhmts start --> +Last modified: Thu Sep 9 16:14:00 CEST 2004 +<!-- hhmts end --> +</body> </html> diff --git a/docs/html/ivycpy_wrap.html b/docs/html/ivycpy_wrap.html new file mode 100644 index 0000000..82052ea --- /dev/null +++ b/docs/html/ivycpy_wrap.html @@ -0,0 +1,93 @@ +<HTML> +<HEAD> +<TITLE> +ivycpy_wrap.c</TITLE> +<BODY BGCOLOR="#ffffff"> +<H1>ivycpy_wrap.c</H1> +[ Python Module : ivycpy ]<BR> + +<P><TT><B>IvyApplicationConnected = IvyApplicationConnected</B></TT> +<BLOCKQUOTE>[ Constant: int ] +<BR></BLOCKQUOTE> + +<P><TT><B>IvyApplicationDisconnected = IvyApplicationDisconnected</B></TT> +<BLOCKQUOTE>[ Constant: int ] +<BR></BLOCKQUOTE> + +<P><TT><B>IvyInit(AppName,ready,loopmode,PyFuncOnCx,PyFuncOnDie)</B></TT> +<BLOCKQUOTE>[ returns void ] +<BR> void *die_data ); user data +</BLOCKQUOTE> + +<P><TT><B>IvyBindMsg(PyFunc,msg)</B></TT> +<BLOCKQUOTE>[ returns int ] +<BR></BLOCKQUOTE> + +<P><TT><B>IvyUnBindMsg(binding_id)</B></TT> +<BLOCKQUOTE>[ returns void ] +<BR></BLOCKQUOTE> + +<P><TT><B>IvyStart(char *)</B></TT> +<BLOCKQUOTE>[ returns void ] +<BR></BLOCKQUOTE> + +<P><TT><B>IvyStop()</B></TT> +<BLOCKQUOTE>[ returns void ] +<BR></BLOCKQUOTE> + +<P><TT><B>IvySendMsg(message)</B></TT> +<BLOCKQUOTE>[ returns int ] +<BR></BLOCKQUOTE> + +<P><TT><B>IvyMainLoop()</B></TT> +<BLOCKQUOTE>[ returns void ] +<BR></BLOCKQUOTE> + +<P><TT><B>IvyGetApplicationList()</B></TT> +<BLOCKQUOTE>[ returns char * ] +<BR></BLOCKQUOTE> + +<P><TT><B>IvyGetApplication(name)</B></TT> +<BLOCKQUOTE>[ returns IvyClientPtr ] +<BR></BLOCKQUOTE> + +<P><TT><B>IvyGetApplicationName(app)</B></TT> +<BLOCKQUOTE>[ returns char * ] +<BR></BLOCKQUOTE> + +<P><TT><B>IvyGetApplicationHost(app)</B></TT> +<BLOCKQUOTE>[ returns char * ] +<BR> emission d'un message d'erreur +</BLOCKQUOTE> + +<P><TT><B>IvySendError(app,id,message)</B></TT> +<BLOCKQUOTE>[ returns void ] +<BR></BLOCKQUOTE> + +<P><TT><B>IvySendDieMsg(app)</B></TT> +<BLOCKQUOTE>[ returns void ] +<BR></BLOCKQUOTE> + +<P><TT><B>IvySendDirectMsg(app,id,msg)</B></TT> +<BLOCKQUOTE>[ returns void ] +<BR></BLOCKQUOTE> + +<P><TT><B>IvyBindDirectMsg(PyFunc)</B></TT> +<BLOCKQUOTE>[ returns void ] +<BR></BLOCKQUOTE> + +<P><TT><B>IvyTimerRepeatAfter(count,time,PyFunc)</B></TT> +<BLOCKQUOTE>[ returns int ] +<BR></BLOCKQUOTE> + +<P><TT><B>IvyTimerModify(timerid,time)</B></TT> +<BLOCKQUOTE>[ returns void ] +<BR></BLOCKQUOTE> + +<P><TT><B>IvyTimerRemove(timerid)</B></TT> +<BLOCKQUOTE>[ returns void ] +<BR></BLOCKQUOTE> + + +</BODY> +</HTML> diff --git a/env_tpl.sh b/env_tpl.sh new file mode 100644 index 0000000..24dfcc5 --- /dev/null +++ b/env_tpl.sh @@ -0,0 +1 @@ +export PYTHONPATH=_IVYCPYPATH_:$PYTHONPATH diff --git a/install-sh b/install-sh new file mode 100755 index 0000000..ebc6691 --- /dev/null +++ b/install-sh @@ -0,0 +1,250 @@ +#! /bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/ivycpy.i b/ivycpy.i new file mode 100644 index 0000000..3dcc449 --- /dev/null +++ b/ivycpy.i @@ -0,0 +1,865 @@ +// 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 <stdio.h> +#include <string.h> +#include <ivy.h> +#include <timer.h> +#include <ivyloop.h> +#include <ivychannel.h> +#include <signal.h> +#include <tcl.h> +/* #define MYAPP "ivycpy" */ +#include <_tkinter.h> + + /* #include <ivytcl.h> */ +%} +// 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 _clnt_lst *IvyClientPtr; +typedef enum { IvyApplicationConnected, IvyApplicationDisconnected } + IvyApplicationEvent; + +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 ; */ + +typedef MsgRcvPtr *MsgRcvArray ; +typedef TimerId *TimerIdArray ; + +/* 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<bindingid_number;++i) { + if (msgrcvarray[i] == NULL) { /* a slot is free */ + msgrcvarray[i] = rcvptr ; + return(i); + } + } + /* no free slot was found */ + bindingid = bindingid_number ; + bindingid_number ++ ; + + msgrcvarray = (MsgRcvPtr *) realloc( + (void *) msgrcvarray , + sizeof(MsgRcvArray) * (bindingid_number) ); + /* testing realloc */ + if (!msgrcvarray) { + fprintf(stderr,"realloc msgrcvarray return NULL\n"); + exit(1); + }; + msgrcvarray[bindingid] = rcvptr ; + /* memcpy((char *) &msgrcvarray[bindingid] , + (char *) rcvptr, sizeof(MsgRcvPtr) ); */ + return bindingid ; +} +static MsgRcvPtr +getRcvMsg(int binding_id) +{ + if (binding_id >=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<bindingid_number;++i) { + printf("rcvarray %i : %x \n", i, (int) msgrcvarray[i]); + } +} +static int +addIvyTimer(TimerId timer) +{ + int i, timerid ; + for(i=0;i<timerid_number;++i) { + if (timerarray[i] == NULL) { /* a slot is free */ + timerarray[i] = timer ; + return(i); + } + } + /* no free slot was found */ + timerid = timerid_number ; + timerid_number ++ ; + + timerarray = (TimerId *) realloc( + (void *) timerarray, + sizeof(TimerIdArray) * (timerid_number) ); + /* testing realloc */ + if (!timerarray) { + fprintf(stderr,"realloc timerarray return NULL\n"); + exit(1); + }; + timerarray[timerid] = timer ; + return timerid ; +} +static TimerId +getIvyTimer(int timerid) +{ + if (timerid >=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;i<timerid_number;++i) { + printf("timerarray %i : %x \n", i, (int) timerarray[i]); + } +} + + +/* This function matches the prototype of a normal C callback + function for our widget. However, the clientdata pointer + actually refers to a Python callable object. */ +static void +pytkIvyApplicationCallback(IvyClientPtr app, void *user_data, + IvyApplicationEvent event) +{ + PyObject *func, *arglist; + PyObject *result; + +#ifdef __DEBUG__ + printf("-pytkIvyApplicationCallback\n"); +#endif + + ENTER_PYTHON + 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)", (int) event); + result = PyEval_CallObject(func,arglist); + Py_DECREF(arglist); + LEAVE_PYTHON +} +static void +pyIvyApplicationCallback(IvyClientPtr app, void *user_data, + IvyApplicationEvent event) +{ + PyObject *func, *arglist; + PyObject *result; + +#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 */ + + arglist = Py_BuildValue("(i)", (int) event); + result = PyEval_CallObject(func,arglist); + Py_DECREF(arglist); +} +static void +pytkIvyDieCallback(IvyClientPtr app, void *user_data, int id) +{ + PyObject *func, *arglist; + PyObject *result; + +#ifdef __DEBUG__ + printf("-pytkIvyApplicationCallback\n"); +#endif + + + ENTER_PYTHON + 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); + LEAVE_PYTHON +} +static void +pyIvyDieCallback(IvyClientPtr app, void *user_data, int id) +{ + PyObject *func, *arglist; + PyObject *result; + +#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 */ + + arglist = Py_BuildValue("(i)", id ); + result = PyEval_CallObject(func,arglist); + Py_DECREF(arglist); +} + +/* callback fixe (ce sera tjs le même) appellé par pyIvyBindMsg */ +static void +pytkMsgCallback( IvyClientPtr app, void *user_data, int argc, char **argv ) +{ + PyObject *func, *arglist; + PyObject *result; + PyObject *pyargv ; + int i ; + +#ifdef __DEBUG__ + printf("-pytkMsgCallback\n"); +#endif + + ENTER_PYTHON + 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 */ + + pyargv = PyTuple_New(argc); + for (i = 0; i < argc; i++) { + PyTuple_SetItem(pyargv,i,PyString_FromString(argv[i])); + } + /* 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) ; + LEAVE_PYTHON + +} + +static void +pyMsgCallback( IvyClientPtr app, void *user_data, int argc, char **argv ) +{ + PyObject *func, *arglist; + PyObject *result; + PyObject *pyargv ; + int i ; + +#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 */ + + pyargv = PyTuple_New(argc); + for (i = 0; i < argc; i++) { + PyTuple_SetItem(pyargv,i,PyString_FromString(argv[i])); + } + /* 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) ; +} + +/* 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; + PyObject *result; + +#ifdef __DEBUG__ + printf("-pytkMsgDirectCallback\n"); +#endif + + ENTER_PYTHON + 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 */ + + result = PyEval_CallObject(func, PyString_FromString(msg)) ; + + LEAVE_PYTHON +} + +static void +pyMsgDirectCallback( IvyClientPtr app, void *user_data, int id, char *msg ) +{ + PyObject *func; + PyObject *result; + +#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 */ + result = PyEval_CallObject(func, PyString_FromString(msg)) ; + +} + +/* 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) { + printf("-IvyUnbindMsg %x \n" , (int) rcvid) ; + 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 + + ENTER_PYTHON + 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); + LEAVE_PYTHON +} + +/* 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) { + printf("-modifying timer %x \n", (int) timer); + TimerModify(timer, (long) time); + } +} +static void +pyIvyTimerRemove( int timerid) +{ + TimerId timer ; + timer = getIvyTimer(timerid); + if (timer != NULL) { + printf("-removing timer %x \n", (int) timer); + TimerRemove(timer); + delIvyTimer(timerid); + } +} + +/* IvyMainLoop */ +static void +pyIvyMainLoop() +{ + IvyMainLoop(0); /* pyHookCallback, (void *) PyFunc ); */ + Py_INCREF(Py_None) ; +} + +/* code repris de ivytcl.h ecrit par FR. Colin et S. Chatty */ +struct _channel { + HANDLE fd; + void *data; + ChannelHandleDelete handle_delete; + ChannelHandleRead handle_read; + }; +static int channel_initialized = 0; + +static void pyIvyChannelInit(void) +{ +#ifdef __DEBUG__ + printf("-pyIvyChannelInit\n"); +#endif + if ( channel_initialized ) return; + /* pour eviter les plantages quand les autres applis font core-dump */ +#ifndef WIN32 + signal( SIGPIPE, SIG_IGN); +#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; + +#ifdef __DEBUG__ + printf("-pyIvyChannelSetUp\n"); +#endif + 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 */ + + return channel; + +} + +static void pyIvyChannelClose( Channel channel ) +{ +#ifdef __DEBUG__ + printf("-pyIvyChannelClose\n"); +#endif + + if ( channel->handle_delete ) + (*channel->handle_delete)( channel->data ); + Tcl_DeleteFileHandler(channel->fd); + + ckfree((char *) channel); + +} + +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; +} + + +// 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 +IvyStop (); +int +pyIvySendMsg(const char *message); +void +pyIvyMainLoop(); +char * +IvyGetApplicationList(); +IvyClientPtr +IvyGetApplication( char *name ); + +char * +IvyGetApplicationName( IvyClientPtr app ); +char *IvyGetApplicationHost( 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); + +// for emacs +// Local Variables: +// mode: C +// indent-tabs-mode: t +// tab-width: 4 +// End: diff --git a/ivycpy_namer.sed b/ivycpy_namer.sed new file mode 100644 index 0000000..859d11f --- /dev/null +++ b/ivycpy_namer.sed @@ -0,0 +1,3 @@ +s/\"pyIvy/\"Ivy/g ; +# s/MsgAsS\"/Msg\"/g; +s/ErrorAsS\"/Error\"/g; diff --git a/martin.m4 b/martin.m4 new file mode 100644 index 0000000..470fc6b --- /dev/null +++ b/martin.m4 @@ -0,0 +1,1863 @@ +dnl # -*- shell-script -*- +dnl ########################################################################### +dnl # +dnl # LAYER-SYSTEM -- tool for configuring, building, and installing software +dnl # Copyright (C) 1996-2001, Martin Vicente +dnl # Copyright (C) 2002-2004, Centre d'Etudes de la Navigation Aérienne +dnl # +dnl # This software is free software; you can redistribute it and/or modify +dnl # it under the terms of the GNU General Public License as published by +dnl # the Free Software Foundation; either version 2 of the License, or +dnl # (at your option) any later version. +dnl # +dnl # This software is distributed in the hope that it will be useful, +dnl # but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +dnl # See the GNU General Public License for more details. +dnl # +dnl # You should have received a copy of the GNU General Public License +dnl # along with this software (see the file COPYING). +dnl # If not, write to the Free Software Foundation, Inc., +dnl # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. +dnl # +dnl ########################################################################### +dnl # +dnl # LAYER-SYSTEM -- TOOL FOR CONFIGURING, BUILDING, AND INSTALLING SOFTWARE +dnl # © Martin Vicente, 1996-2001 +dnl # © Centre d'Etudes de la Navigation Aérienne, 2002-2004 +dnl # +dnl # MY LOCAL ADDITIONS TO AUTOCONF MACROS +dnl # +dnl # Project: LAYER-SYSTEM +dnl # Purpose: Tool for configuring, building, and installing software +dnl # Version: 1.0 (first official release) +dnl # ------------------------------------------------------------------------ +dnl # File : martin.m4 +dnl # Purpose: My local additions to Autoconf macros +dnl # Version: 1.0.5 +dnl # Dialect: Autoconf (m4 and Bourne shell) +dnl # Creator: Martin Vicente +dnl # Created: 20 juin 2002 +dnl # Remarks: From XCLIB - "Les outils de Martin" +dnl # Contact: vicente@cena.fr +dnl # +dnl # Last Modified On: 24 janvier 2004 +dnl # Last Modified By: Martin Vicente +dnl # +dnl # DESCRIPTION: +dnl # LAYER-SYSTEM est une évolution du système de fabrication de XCLIB. +dnl # XCLIB est une bibliothèque de fonctions à usage général. +dnl # La bibliothèque "mini XCLIB" en est une mouture allégée destinée en +dnl # particulier à une application locale au CENA (Centre d'Etudes de la +dnl # Navigation Aérienne). +dnl # +dnl # Ce fichier apporte quelques macros supplémentaires pour Autoconf. +dnl # Certaines offrent des fonctionnalités génériques, et ont pour ambition +dnl # d'intégrer un jour la distribution Autoconf; et d'autres sont ici +dnl # essentiellement pour alléger l'écriture du fichier «configure.in». +dnl # Afin de les distinguer sans ambiguïté des macros standards Autoconf, +dnl # elles sont préfixées par «MV_». +dnl # +dnl # REMARKS: +dnl # +dnl # ENVIRONMENT/PARAMETERS/OPTIONS: +dnl # +dnl # PROBLEMS: +dnl # +dnl # TODO: +dnl # +dnl # REVISION HISTORY: +dnl # ## 21 novembre 2003 - Martin Vicente +dnl # - Renommage de ce fichier en «martin.m4» pour tenir compte d'autres +dnl # jeux de macros et éviter un conflit possible. +dnl # ## 20 juin 2002 - Martin Vicente +dnl # - Création du fichier «aclocal.m4» à partir de celui de XCLIB. +dnl # +dnl # MAINTAINERS: +dnl # Martin Vicente <vicente@cena.fr> +dnl ########################################################################### + +dnl #++ +dnl # LISTE DES MACROS: +dnl # ================= +dnl # +dnl # MV_AUTOCONF_ERROR(TEXT) +dnl # MV_LOWER +dnl # MV_UPPER +dnl # MV_DEL_ACCENT +dnl # MV_CONCAT(VAR, N, STR) +dnl # MV_SET_BRACKETS +dnl # MV_PROG_ECHO_E +dnl # MV_PROG_ECHO_N +dnl # MV_PROG_ECHO +dnl # MV_PROG_ECHO_ESCAPE +dnl # MV_DEF_SET_COLORS +dnl # MV_DEF_UNSET_COLORS +dnl # MV_SET_COLORS +dnl # MV_UNSET_COLORS +dnl # MV_CONFIG_FD_IS_CHAR_DEVICE +dnl # MV_SETUP_COLORS(FD) +dnl # MV_COLOR_ON(FOREGROUND, BACKGROUND) +dnl # MV_COLOR_OFF +dnl # MV_TERM_SIZE +dnl # MV_MSG(TEXT [, COLOR-ATTRIBUTS ]) +dnl # MV_MSG_N(TEXT [, COLOR-ATTRIBUTS ]) +dnl # MV_ERR_MSG(PREFIX, TEXT [, COLOR ]) +dnl # MV_WARNING(TEXT [, COLOR ]) +dnl # MV_ERROR(TEXT [, COLOR ]) +dnl # MV_MSG_RESULT +dnl # MV_ARG_ENABLE +dnl # MV_FILL_COLUMNS(VAR, CH) +dnl # MV_FILL_BACKGROUND(VAR, CH) +dnl # MV_PROG_AUTOCONF +dnl # MV_PROG_ACLOCAL +dnl # MV_PROG_CTRACE +dnl # MV_TOPDIR +dnl # MV_STANDARD +dnl # MV_TRANSFORM_MODULES(SRC-DIRS, LNK-DIR, &MODULES) +dnl # MV_CONFIG_RULES(CONFIG-FILES, PRE-COMMAND, FILENAME) +dnl # MV_OUTPUT(CONFIG-FILES, EXTRA-CMDS, INIT-CMDS) +dnl # MV_MKLOG +dnl # MV_MK_STANDARD +dnl # MV_MK_OUTPUT(MAKEFILE-NAME, SUBDIRS, CONFIG-FILES, EXTRA-CMDS, INIT-CMDS) +dnl # MV_SET_GCC_OPTIONS +dnl # MV_SET_GXX_OPTIONS +dnl # MV_PROG_GCC(-pipe -ansi -pedantic ...) +dnl # MV_PROG_GXX(-pipe -ansi -pedantic ...) +dnl # MV_PROG_CC +dnl # MV_PROG_CXX +dnl # +dnl # -- A REVOIR -- +dnl # +dnl # MV_PREFIX_PROGRAM +dnl # MV_PROG_MKDIRHIER +dnl # MV_PROG_RMDIRHIER +dnl # MV_PROG_LD +dnl # MV_PROG_PERL(MIN-VERSION) +dnl # MV_AUTOCONF_DIRS +dnl # MV_DO_MICO +dnl # MV_DO_OMNIORB +dnl # MV_DO_OMNIORB2 +dnl # MV_CHECK_XCLIB +dnl # MV_CHECK_DPKG_VERSION +dnl # MV_CHECK_CONFIG_FILES +dnl #-- + +dnl ########################################################################### +dnl # forloop(I, MIN, MAX, CMD) +dnl # +dnl # Extension M4. +dnl # +define([forloop], [pushdef([$1], [$2])_forloop([$1], [$2], [$3], [$4])popdef([$1])]) +define([_forloop], [$4[]ifelse($1, [$3], , [define([$1], incr($1))_forloop([$1], [$2], [$3], [$4])])]) + +dnl ########################################################################### +dnl # MV_AUTOCONF_ERROR(TEXT) +dnl # +dnl # Fonction d'erreur interne souvent utilisée pour, par exemple, tester +dnl # l'invocation correcte d'une macro Autoconf. +dnl # +define(MV_AUTOCONF_ERROR, [dnl +errprint([autoconf: *** Error: $1 - File "]__file__[" at line ]__line__[ +])dnl +m4exit(1)]) + +dnl ########################################################################### +dnl # MV_TOLOWER +dnl # +dnl # Transposition des caractères en minuscules. +dnl # +AC_DEFUN(MV_TOLOWER, [dnl +TOLOWER="tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'" +AC_SUBST(TOLOWER)]) + +dnl ########################################################################### +dnl # MV_TOUPPER +dnl # +dnl # Transposition des caractères en majuscules. +dnl # +AC_DEFUN(MV_TOUPPER, [dnl +TOUPPER="tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" +AC_SUBST(TOUPPER)]) + +dnl ########################################################################### +dnl # MV_DEL_ACCENT +dnl # +dnl # Elimination des accents. +dnl # +define(MV_DEL_ACCENT, [dnl +tr 'àçéèêëîïôöùüÂÇÉÈÊËÎÏÔÖÙÜ' 'aceeeeiioouuACEEEEIIOOUU']) + +dnl ########################################################################### +dnl # MV_CONCAT(VAR, N, STR) +dnl # +dnl # Concatène «N» fois la chaîne «STR». L'ajoute à «VAR». +dnl # +define(MV_CONCAT, [dnl +ifelse($#,3,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +{ +mv_v="$[]$1" +mv_i=$2 +while >/dev/null expr $mv_i; do + mv_v="${mv_v}$3" + mv_i=`expr $mv_i - 1` +done +$1=$mv_v +}]) + +dnl ########################################################################### +dnl # MV_SET_BRACKETS +dnl # +dnl # Pour utiliser le caractère «[», en évitant de jongler avec les +dnl # «changequote». +dnl # +AC_DEFUN(MV_SET_BRACKETS, [dnl +ifelse($#,0,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +dnl +changequote(«,»)dnl +mv_LB=[ +mv_RB=]«»dnl +changequote([,])]) + +dnl ########################################################################### +dnl # MV_PROG_ECHO_E +dnl # +dnl # Recherche une commande «echo» qui supporte la représentation +dnl # "backslash-escaped" («\n», «\a», etc); et donc aussi la notation octale +dnl # (ex: «\033»). +dnl # Si une telle command est trouvée, la variable «ECHO_E» sera renseignée +dnl # en conséquence, sinon elle sera vide. +dnl # +dnl # Le test canonique: +define(mv_prog_echo_e__try, [dnl +dnl # - la commande doit d'abord fonctionner sans retourner de statut d'erreur, +>/dev/null 2>&1 $1 dnl +dnl # - la notation "backslash-escaped" doit être interprétée, +&& test -z "`$1 '\a'|fgrep a`" dnl # alert character +&& test -z "`$1 '\b'|fgrep b`" dnl # backspace +&& test -z "`$1 '\c'|fgrep c`" dnl # print line without new-line +&& test -z "`$1 '\f'|fgrep f`" dnl # form-feed +&& test -z "`$1 '\n'|fgrep n`" dnl # new-line +&& test -z "`$1 '\r'|fgrep r`" dnl # carriage return +&& test -z "`$1 '\t'|fgrep t`" dnl # tab +&& test -z "`$1 '\v'|fgrep v`" dnl # vertical tab +dnl # - et aussi la représentation octale. +&& test -z "`$1 '\033'|fgrep 33`"]) +dnl # +dnl # +AC_DEFUN(MV_PROG_ECHO_E, [dnl +ifelse($#,0,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +AC_MSG_CHECKING([if «echo» support backslash-escaped characters]) +AC_CACHE_VAL(mv_cv_prog_ECHO_E, [dnl +if mv_prog_echo_e__try(echo); then + ECHO_E='echo' +elif mv_prog_echo_e__try(echo -e); then + ECHO_E='echo -e' +elif mv_prog_echo_e__try(/bin/echo); then + ECHO_E='/bin/echo' +elif mv_prog_echo_e__try(/bin/echo -e); then + ECHO_E='/bin/echo -e' +else + ECHO_E= +fi +mv_cv_prog_ECHO_E=$ECHO_E])dnl +ECHO_E=$mv_cv_prog_ECHO_E +if test -n "$ECHO_E"; then + AC_MSG_RESULT([yes ($ECHO_E)]) +else + AC_MSG_RESULT([no]) +fi[]dnl +AC_SUBST(ECHO_E)]) + +dnl ########################################################################### +dnl # MV_PROG_ECHO_N +dnl # +dnl # Si je trouve une commande «echo» qui permet de supprimer le passage à +dnl # la ligne suivante, j'affecte les variables «ECHO_N», «_N», et «_C» en +dnl # conséquence; et sinon, ces variable seront vides. +dnl # Et si cette commande peut supporter également les séquences +dnl # "backslash-escaped" (et la notation octale), c'est pas plus mal. +dnl # +dnl # Exemple d'utilisation: @ECHO_N@ @_N@ "Hello World!@_C@" +dnl # +dnl # Comme pour «MV_PROG_ECHO_E», le test se déroule en 2 phases: +dnl # - vérifier que la commande ne renvoie pas un statut d'erreur; +dnl # - vérifier que l'option «-n» ou la séquence «\c» est interprété. +dnl # +dnl # Test avec «-n»: +define(mv_prog_echo_n__try_n, [dnl +>/dev/null 2>&1 $1 && test -z "`$1 -n ''|fgrep n`"]) +dnl # +dnl # Test avec «\c»: +define(mv_prog_echo_n__try_c, [dnl +>/dev/null 2>&1 $1 && test -z "`$1 '\c'|fgrep c`"]) +dnl # +dnl # +AC_DEFUN(MV_PROG_ECHO_N, [dnl +ifelse($#,0,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +AC_REQUIRE([MV_PROG_ECHO_E])dnl +AC_MSG_CHECKING([if «echo» can suppress trailing newline]) +AC_CACHE_VAL(mv_cv_prog_ECHO_N, [dnl +if test -n "$ECHO_E" && mv_prog_echo_n__try_n([$ECHO_E]); then + ECHO_N=$ECHO_E; _N=-n; _C= +elif test -n "$ECHO_E" && mv_prog_echo_n__try_c([$ECHO_E]); then + ECHO_N=$ECHO_E; _N=; _C=\\c +elif mv_prog_echo_n__try_n([echo]); then + ECHO_N=echo; _N=-n; _C= +elif mv_prog_echo_n__try_c([echo]); then + ECHO_N=echo; _N=; _C=\\c +elif mv_prog_echo_n__try_n([/bin/echo]); then + ECHO_N=/bin/echo; _N=-n; _C= +elif mv_prog_echo_n__try_c([/bin/echo]); then + ECHO_N=/bin/echo; _N=; _C=\\c +else + ECHO_N=; _N=; _C= +fi +mv_cv_prog_ECHO_N=$ECHO_N; mv_cv_prog_ECHO_N_N=$_N; mv_cv_prog_ECHO_N_C=$_C])dnl +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 + AC_MSG_RESULT([yes (\$ECHO_N \$_N \"...\$_C\")]) +else + AC_MSG_RESULT([no]) +fi[]dnl +AC_SUBST(ECHO_N)AC_SUBST(_N)AC_SUBST(_C)]) + +dnl ########################################################################### +dnl # MV_PROG_ECHO +dnl # +dnl # Recherche la "meilleur" commande pour la fonction «echo». +dnl # La variable «ECHO» est renseignée en conséquence, ainsi que: +dnl # «ECHO_E», «ECHO_N», «_N» et «_C». +dnl # +AC_DEFUN(MV_PROG_ECHO, [dnl +ifelse($#,0,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +AC_REQUIRE([MV_PROG_ECHO_N])dnl +AC_REQUIRE([MV_PROG_ECHO_E])dnl +AC_MSG_CHECKING([the \"best\" «echo» command]) +AC_CACHE_VAL(mv_cv_prog_ECHO, [dnl +if test -n "$ECHO_N"; then + ECHO=$ECHO_N +elif test -n "$ECHO_E"; then + ECHO=$ECHO_E +else + ECHO=echo +fi +mv_cv_prog_ECHO=$ECHO])dnl +ECHO=$mv_cv_prog_ECHO +if test -n "$ECHO"; then + AC_MSG_RESULT([$ECHO]) +else + AC_MSG_RESULT([no]) + AC_MSG_ERROR([NO ECHO COMMAND!!!]) +fi[]dnl +AC_SUBST(ECHO)]) + +dnl ########################################################################### +dnl # MV_PROG_ECHO_ESCAPE +dnl # +dnl # Si «echo» supporte les séquences d'échappement, j'affecte la variable +dnl # «ESC» avec la notation à utiliser; et sinon, cette dernière sera vide. +dnl # Dans la foulée, on recherche aussi la meilleur commande «echo». +dnl # Les variables remplacées sont: +dnl # +dnl # «ECHO», «ECHO_E», «ECHO_N», «_N», «_C» et «ESC». +dnl # +AC_DEFUN(MV_PROG_ECHO_ESCAPE, [dnl +ifelse($#,0,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +AC_REQUIRE([MV_PROG_ECHO])dnl +AC_MSG_CHECKING([if «$ECHO» support the escape character]) +AC_CACHE_VAL(mv_cv_prog_ECHO_ESC, [dnl +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])dnl +ESC=$mv_cv_prog_ECHO_ESC +if test -n "$ESC"; then + AC_MSG_RESULT([yes (\$ESC)]) +else + AC_MSG_RESULT([no]) +fi[]dnl +AC_SUBST(ESC)]) + +dnl ########################################################################### +dnl # MV_DEF_SET_COLORS +dnl # +dnl # Définit la fonction «mv_set_colors» qui (ré-)active l'utilisation de la +dnl # couleur et des attributs graphiques. +dnl # +AC_DEFUN(MV_DEF_SET_COLORS, [dnl +ifelse($#,0,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +AC_REQUIRE([MV_SET_BRACKETS])dnl +AC_REQUIRE([MV_PROG_ECHO_ESCAPE])dnl +AC_REQUIRE([MV_DEF_UNSET_COLORS])dnl +mv_set_colors() { + if test -n "$ESC"; then + RESET=${ESC}${mv_LB}0m + # video attributes + BOLD=${ESC}${mv_LB}1m + BOLD_OFF=${ESC}${mv_LB}22m + UNDERLINE=${ESC}${mv_LB}4m + UNDERLINE_OFF=${ESC}${mv_LB}24m + BLINK=${ESC}${mv_LB}5m + BLINK_OFF=${ESC}${mv_LB}25m + REVERSE=${ESC}${mv_LB}7m + REVERSE_OFF=${ESC}${mv_LB}27m + # foreground colors + BLACK=${ESC}${mv_LB}30m + RED=${ESC}${mv_LB}31m + GREEN=${ESC}${mv_LB}32m + YELLOW=${ESC}${mv_LB}33m + BLUE=${ESC}${mv_LB}34m + MAGENTA=${ESC}${mv_LB}35m + CYAN=${ESC}${mv_LB}36m + WHITE=${ESC}${mv_LB}37m + DEFAULT=${ESC}${mv_LB}39m + # background colors + BG_BLACK=${ESC}${mv_LB}40m + BG_RED=${ESC}${mv_LB}41m + BG_GREEN=${ESC}${mv_LB}42m + BG_YELLOW=${ESC}${mv_LB}43m + BG_BLUE=${ESC}${mv_LB}44m + BG_MAGENTA=${ESC}${mv_LB}45m + BG_CYAN=${ESC}${mv_LB}46m + BG_WHITE=${ESC}${mv_LB}47m + BG_DEFAULT=${ESC}${mv_LB}49m + # abreviations + B=$BOLD + b=$BOLD_OFF + U=$UNDERLINE + u=$UNDERLINE_OFF + else + mv_unset_colors + fi +}]) + +dnl ########################################################################### +dnl # MV_DEF_UNSET_COLORS +dnl # +dnl # Définit la fonction «mv_unset_colors» qui supprime l'utilisation de la +dnl # couleur et des attributs graphiques. +dnl # +AC_DEFUN(MV_DEF_UNSET_COLORS, [dnl +ifelse($#,0,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +mv_unset_colors() { + RESET= + # video attributes + BOLD= + BOLD_OFF= + UNDERLINE= + UNDERLINE_OFF= + BLINK= + BLINK_OFF= + REVERSE= + REVERSE_OFF= + # foreground colors + BLACK= + RED= + GREEN= + YELLOW= + BLUE= + MAGENTA= + CYAN= + WHITE= + DEFAULT= + # background colors + BG_BLACK= + BG_RED= + BG_GREEN= + BG_YELLOW= + BG_BLUE= + BG_MAGENTA= + BG_CYAN= + BG_WHITE= + BG_DEFAULT= + # abreviations + B= + b= + U= + u= +}]) + +dnl ########################################################################### +dnl # MV_SET_COLORS +dnl # +dnl # (Ré-)active l'utilisation de la couleur, et du rendu en général. +dnl # La réactivation sera effective, seulement si elle est possible. +dnl # +AC_DEFUN(MV_SET_COLORS, [dnl +ifelse($#,0,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +AC_REQUIRE([MV_DEF_SET_COLORS])dnl +mv_set_colors]) + +dnl ########################################################################### +dnl # MV_UNSET_COLORS +dnl # +dnl # Supprime l'utilisation de la couleur, et du rendu en général. +dnl # +AC_DEFUN(MV_UNSET_COLORS, [dnl +ifelse($#,0,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +AC_REQUIRE([MV_DEF_UNSET_COLORS])dnl +mv_unset_colors]) + +dnl ########################################################################### +dnl # MV_CONFIG_FD_IS_CHAR_DEVICE +dnl # +dnl # *** A REVOIR POUR DES ENVIRONNEMENTS NON GNU *** +dnl # Les séquences d'échappement propre au rendu des terminaux, ne seront +dnl # interprétées que si le périphérique est effectivement un terminal. +dnl # Evident, mais encore fallait-il l'écrire :-) +dnl # Cette macro permet donc de lever un peu le doute sur la nature du +dnl # périphérique. «MV_CONFIG_FD_IS_CHAR_DEVICE» va générer le programme +dnl # «config.fd_is_char_device». Il suffira de lui fournir en paramètre le +dnl # descripteur de fichier utilisé pour accéder au périphérique en +dnl # question. +dnl # +AC_DEFUN(MV_CONFIG_FD_IS_CHAR_DEVICE, [dnl +ifelse($#,0,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +{ +if test -z "$CC"; then + >&2 echo "__file__:__line__: *** FATAL ERROR: NO C COMPILER DEFINED" + exit 1 +fi + +pgm=config.fd_is_char_device + +if test ! -f $pgm; then + + changequote(«,»)dnl + cat >$pgm.c <<EOT +#include <sys/types.h> +#include <sys/stat.h> + +#include <unistd.h> + +#include <stdlib.h> + +int main(int argc, char *argv[]) +{ + int fd; + struct stat stat; + + if (argc != 2) return -1; + + fd = atoi(argv[1]); + + if (fstat(fd, &stat) == -1) return -1; + + return S_ISCHR(stat.st_mode) == 0; +} +EOT + changequote([,])dnl + + $CC -o $pgm $pgm.c + rm $pgm.c + +elif test ! -x $pgm; then + + chmod +x $pgm + +fi + +CONFIGURE_FILES="$pgm $CONFIGURE_FILES" + +unset pgm +}]) + +dnl ########################################################################### +dnl # MV_SETUP_COLORS(FD) +dnl # +AC_DEFUN(MV_SETUP_COLORS, [dnl +ifelse($#,0,mv_fd=1,ifelse($#,1,mv_fd=$1,[[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])]])) +AC_REQUIRE([MV_PROG_ECHO_ESCAPE])dnl +AC_REQUIRE([MV_DEF_SET_COLORS])dnl +AC_REQUIRE([MV_DEF_UNSET_COLORS])dnl +if test -n "$ESC" && test -t $mv_fd; then + MV_SET_COLORS + mv_colors_on_fd_$1=yes +else + MV_UNSET_COLORS + mv_colors_on_fd_$1=no +fi]) + +dnl ########################################################################### +dnl # MV_COLOR_ON(FOREGROUND, BACKGROUND) +dnl # +AC_DEFUN(MV_COLOR_ON, [dnl +ifelse($#,2,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +if test "$silent" != yes; then + MV_SETUP_COLORS(1) + if test "$mv_colors_on_fd_1" = yes; then + FOREGROUND=$[$1] + BACKGROUND=$BG_[$2] + $ECHO "COLOR ON${FOREGROUND}${BACKGROUND}" + fi +fi]) + +dnl ########################################################################### +dnl # MV_COLOR_OFF +dnl # +AC_DEFUN(MV_COLOR_OFF, [dnl +ifelse($#,0,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +if test "$silent" != yes; then + MV_SETUP_COLORS(1) + if test "$mv_colors_on_fd_1" = yes; then + $ECHO "COLOR OFF${RESET}" + fi +fi]) + +dnl ########################################################################### +dnl # MV_TERM_SIZE +dnl # +dnl # Récupère les dimensions du terminal. +dnl # Substitue «LINES» et «COLUMNS». +dnl # +dnl # o Pas portable entre U*ix: améliorer la portabilité. +dnl # o Je préfère ne pas "cacher" ces valeurs afin de permettre une +dnl # reconfiguration rapide par l'utilisateur. +dnl # +AC_DEFUN(MV_TERM_SIZE, [dnl +ifelse($#,0,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +dnl +AC_MSG_CHECKING(terminal size) +case `uname` in +Linux) + mv_term_spec=`stty size` + LINES=`echo $mv_term_spec|awk '{ print $[]1 }'` + COLUMNS=`echo $mv_term_spec|awk '{ print $[]2 }'` + unset mv_term_spec + ;; +SunOS) + mv_term_spec=`stty` +changequote(,)dnl + LINES=`echo $mv_term_spec|fgrep 'rows ='|sed 's/.*rows = \([0-9]*\).*/\1/'` + COLUMNS=`echo $mv_term_spec|fgrep 'rows ='|sed 's/.*columns = \([0-9]*\).*/\1/'` +changequote([, ])dnl + unset mv_term_spec + ;; +*) + LINES=0 + COLUMNS=0 + ;; +esac +AC_MSG_RESULT($COLUMNS x $LINES) +AC_SUBST(LINES)dnl +AC_SUBST(COLUMNS)]) + +dnl ########################################################################### +dnl # MV_MSG(TEXT [, COLOR-ATTRIBUTS ]) +dnl # +dnl # Affiche un message. +dnl # +AC_DEFUN(MV_MSG, [dnl +ifelse($#,1,,[ifelse($#,2,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])])dnl +dnl +if test "$silent" != yes; then + MV_SETUP_COLORS(1) + $ECHO "ifelse($#,2,[$2],${FOREGROUND})""$1""${RESET}${FOREGROUND-$DEFAULT}${BACKGROUND-$BG_DEFAULT}" +fi]) + +dnl ########################################################################### +dnl # MV_MSG_N(TEXT [, COLOR-ATTRIBUTS ]) +dnl # +dnl # Affiche un message sans passage à la ligne suivante. +dnl # +AC_DEFUN(MV_MSG_N, [dnl +ifelse($#,1,,[ifelse($#,2,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])])dnl +dnl +if test "$silent" != yes; then + MV_SETUP_COLORS(1) + $ECHO_N $_N "ifelse($#,2,[$2],${FOREGROUND})""$1$_C""${RESET}${FOREGROUND-$DEFAULT}${BACKGROUND-$BG_DEFAULT}" +fi]) + +dnl ########################################################################### +dnl # MV_ERR_MSG(PREFIX, TEXT [, COLOR ]) +dnl # +dnl # Affiche un message d'erreur bien visible. +dnl # +AC_DEFUN(MV_ERR_MSG, [dnl +ifelse($#,2,,[ifelse($#,3,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])])dnl +AC_REQUIRE([MV_TERM_SIZE])dnl +dnl +{ +MV_SETUP_COLORS(2) +dnl +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 "$1"; then + mv_severity="${BOLD}$1${BOLD_OFF}: " +else + mv_severity= +fi + +>&2 $ECHO "ifelse($#,3,${$3},${RED})${mv_prefix}: ${mv_decor}" + +>&2 $ECHO "ifelse($#,3,${$3},${RED})${mv_prefix}: *** ${mv_severity}patsubst([$2], [ +], [" +>&2 $ECHO "ifelse($#,3,${$3},${RED})${mv_prefix}: *** ${mv_severity}])" +>&2 $ECHO "ifelse($#,3,${$3},${RED})${mv_prefix}: ${mv_decor}${FOREGROUND-$RESET}" +unset mv_prefix +unset mv_decor + +if test "$silent" = yes; then $ECHO $_N "$RESET$_C"; fi + +}]) + +dnl ########################################################################### +dnl # MV_WARNING(TEXT [, COLOR ]) +dnl # +dnl # Le texte du message sera affiché avec l'attribut "bold". +dnl # Exemple d'utilisation: +dnl # +dnl # MV_WARNING([dnl +dnl # Ligne 1 +dnl # Ligne 2]) +dnl # +AC_DEFUN(MV_WARNING, [dnl +ifelse($#,1,,[ifelse($#,2,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])])dnl +dnl +MV_ERR_MSG(Warning,${BOLD}patsubst([$1], [ +], [${BOLD_OFF} +${BOLD}])${BOLD_OFF})]) + +dnl ########################################################################### +dnl # MV_ERROR(TEXT [, COLOR ]) +dnl # +dnl # Le texte du message sera affiché avec l'attribut "bold". +dnl # Exemple d'utilisation: +dnl # +dnl # MV_ERROR([dnl +dnl # Ligne 1 +dnl # Ligne 2]) +dnl # +AC_DEFUN(MV_ERROR, [dnl +ifelse($#,1,,[ifelse($#,2,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])])dnl +dnl +{ MV_ERR_MSG(Error,${BOLD}patsubst([$1], [ +], [${BOLD_OFF} +${BOLD}])${BOLD_OFF}); exit 1; }]) + +dnl ########################################################################### +dnl # MV_MSG_RESULT +dnl # +define(MV_MSG_RESULT, [dnl +AC_REQUIRE([MV_PROG_ECHO])dnl +$ECHO $_N "${CYAN}${_C}" +AC_MSG_RESULT([$1]) +$ECHO $_N "${FOREGROUND-$DEFAULT}$_C"]) + +dnl ########################################################################### +dnl # MV_ARG_ENABLE +dnl # +AC_DEFUN(MV_ARG_ENABLE, [dnl +{ +AC_ARG_ENABLE([$1],, [dnl + +enable_$1=`echo "$enableval"|MV_LOWER` +if test "$enable_$1" != yes; then enable_$1=no; fi], [enable_$1=yes]) +MV_MSG_RESULT([$3: $enable_$1]) + +dnl # Présentation de l'aide: +AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl +mv_len=`expr length "$2"` +n=`expr 24 - $mv_len` +v="$2" +i=$n +while >/dev/null expr $i; do + v="$v " + i=`expr $i - 1` +done +ac_help="$ac_help ${v}$3 (default=yes)" +AC_DIVERT_POP() + +if test "$enable_$1" = yes; then + : + $4 +else + : + $5 +fi +}dnl +AC_SUBST(enable_$1)]) + +dnl ########################################################################### +dnl # MV_FILL_COLUMNS(VAR, CH) +dnl # +dnl # Remplit la chaîne «VAR» avec (le caractère) «CH», autant de fois que la +dnl # largeur du teminal. +dnl # +AC_DEFUN(MV_FILL_COLUMNS, [dnl +ifelse($#,2,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +AC_REQUIRE([MV_TERM_SIZE])dnl +MV_CONCAT($1, $COLUMNS, $2)]) + +dnl ########################################################################### +dnl # MV_FILL_BACKGROUND(VAR, CH) +dnl # +dnl # Remplit la chaîne «VAR» avec (le caractère) «CH», autant de fois que la +dnl # largeur du teminal, et ajoute le caractère «\r». +dnl # +AC_DEFUN(MV_FILL_BACKGROUND, [dnl +ifelse($#,2,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +MV_FILL_COLUMNS($1, $2); $1="$[]$1\r"]) + +dnl ########################################################################### +dnl # MV_PROG_AUTOCONF +dnl # +AC_DEFUN(MV_PROG_AUTOCONF, [AC_CHECK_PROGS(AUTOCONF, autoconf, :)]) + +dnl ########################################################################### +dnl # MV_PROG_ACLOCAL +dnl # +AC_DEFUN(MV_PROG_ACLOCAL, [AC_CHECK_PROGS(ACLOCAL, aclocal, :)]) + +dnl ########################################################################### +dnl # MV_PROG_CTRACE +dnl # +AC_DEFUN(MV_PROG_CTRACE, [AC_CHECK_PROGS(CTRACE, ctrace, cat)]) + +AC_DEFUN(MV_PROG_CTRACE2, [dnl +ifelse($#,0,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +dnl +{ +if test "$CTRACE" = yes; then + PATH_saved=$PATH + if test "$with_xc_libraries" = yes; then + PATH=.:$PATH + AC_PATH_PROG(CTRACE, ctrace) + elif test -n "$with_xc_libraries" -a "$with_xc_libraries" != no; then + CTRACE="LD_LIBRARY_PATH=$with_xc_libraries:$LD_LIBRARY_PATH `cd $with_xc_libraries && pwd`/ctrace" + AC_MSG_RESULT(ctrace path set to $with_xc_libraries/ctrace) + else + PATH=.:$PATH + LD_LIBRARY_PATH_saved=$LD_LIBRARY_PATH + LD_LIBRARY_PATH=$with_xc_libraries:$LD_LIBRARY_PATH + AC_PATH_PROG(CTRACE, ctrace) + LD_LIBRARY_PATH=$LD_LIBRARY_PATH_saved + fi + PATH=$PATH_saved +else + CTRACE=cat +fi + +AC_SUBST(CTRACE) + +}]) + +dnl ########################################################################### +dnl # MV_TOPDIR +dnl # +AC_DEFUN(MV_TOPDIR, [dnl + +topdir=`/bin/pwd` + +AC_SUBST(topdir)]) + +dnl ########################################################################### +dnl # MV_STANDARD +dnl # +AC_DEFUN(MV_STANDARD, [dnl +ifelse($#,0,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +AC_REQUIRE([MV_PROG_ECHO_ESCAPE])dnl +AC_REQUIRE([MV_DEF_SET_COLORS])dnl +AC_REQUIRE([AC_PROG_LN_S])dnl +AC_REQUIRE([MV_PROG_AUTOCONF])dnl +AC_REQUIRE([MV_PROG_ACLOCAL])dnl +AC_REQUIRE([MV_PROG_CTRACE])dnl +AC_REQUIRE([AC_PROG_RANLIB])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +AC_REQUIRE([MV_TOPDIR])dnl +]) + +dnl ########################################################################### +dnl # MV_TRANSFORM_MODULES(SRC-DIRS, LNK-DIR, &MODULES) +dnl # +AC_DEFUN(MV_TRANSFORM_MODULES, [dnl +ifelse($#,3,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +AC_REQUIRE([AC_PROG_LN_S])dnl +{ +AC_MSG_RESULT(transforming module's names) + +mv_SRC_DIRS=$1 +mv_LNK_DIR=$2 +mv_MODULES=$$3 + +for mv_dir in $mv_SRC_DIRS; do + if test ! -d $mv_dir; then + MV_WARNING([dnl +No «`basename $mv_dir`» directory +in `dirname $mv_dir`]) + fi +done + +if test ! -d $mv_LNK_DIR; then mkdir -p $mv_LNK_DIR; fi + +TRANSFORM_MODULES= + +for m in $mv_MODULES; do + m=`echo $m|sed 's/\.o$//'` + ok=no + for d in $mv_SRC_DIRS; do + fs=$d/$m.cc + if test -f $fs; then + ok=yes + fl=$mv_LNK_DIR/`echo $m.cc|sed 's/\//__/g'` + TRANSFORM_MODULES="$TRANSFORM_MODULES $fl" + if test ! -L $fl; then + MV_MSG_RESULT([ ]- `basename $fl`) + ( cd `dirname $fl` && $LN_S $fs `basename $fl` ) + fi + else + fs=$d/$m.c + if test -f $fs; then + ok=yes + fl=$mv_LNK_DIR/`echo $m.c|sed 's/\//__/g'` + TRANSFORM_MODULES="$TRANSFORM_MODULES $fl" + if test ! -L $fl; then + MV_MSG_RESULT([ ]- `basename $fl`) + ( cd `dirname $fl` && $LN_S $fs `basename $fl` ) + fi + fi + fi + if test $ok = no; then MV_ERROR(Le fichier «$fs» n'existe pas); fi + done +done + +mv_modules= +for mv_mod in $mv_MODULES; do + mv_modules="$mv_modules `echo $mv_mod|sed 's/\//__/g'`" +done + +$3=$mv_modules + +AC_SUBST(TRANSFORM_MODULES)dnl + +}]) + +dnl ########################################################################### +dnl # MV_CONFIG_RULES(CONFIG-FILES, PRE-COMMAND, FILENAME) +dnl # +dnl # Génère le fichier, dont le nom sera par défaut «config.rules», +dnl # contenant les règles destinées à la mise-à-jour des fichiers FILES. +dnl # +define(MV_CONFIG_RULES, [dnl +AC_REQUIRE([MV_TOPDIR])dnl + +mv_config_files="$1" + +ifelse($#,3,[CONFIG_RULES=$3],[CONFIG_RULES=config.rules]) + +if test ! -f $CONFIG_RULES; then + echo "creating $CONFIG_RULES" + touch $CONFIG_RULES + >>$CONFIG_RULES echo '## -*- makefile -*-' + >>$CONFIG_RULES echo '## Generated automatically by configure.' + >>$CONFIG_RULES echo '' + >>$CONFIG_RULES echo '##--------------------------------------------------' + >>$CONFIG_RULES echo '## Inclure ce fichier dans un makefile pour gérer la' + >>$CONFIG_RULES echo '## mise-à-jour des fichiers configurés.' + >>$CONFIG_RULES echo '##--------------------------------------------------' + >>$CONFIG_RULES echo '' +else + echo "updating $CONFIG_RULES" +fi + +for mv_cf in $mv_config_files; do + case $mv_cf in + *:*) + mv_of=`echo $mv_cf|sed 's%:.*$%%'` + mv_cf=`echo $mv_cf|sed 's%^.*:%%'` + ;; + *) + mv_of=$mv_cf + mv_cf=$mv_cf.in + ;; + esac + mv_string1='$(topdir)/'$mv_of': $(top_srcdir)/'$mv_cf + mv_string2=' cd $(topdir) && CONFIG_FILES='$mv_of':'$mv_cf' ./config.status' + if >/dev/null grep -Fx "$mv_string1" $CONFIG_RULES; then + continue + fi + >>$CONFIG_RULES echo "$mv_string1" +ifelse($#,2,[dnl + >>$CONFIG_RULES echo ' ]$2[' +], ifelse($#,3,[dnl + >>$CONFIG_RULES echo ' ]$2[' +])) + >>$CONFIG_RULES echo "$mv_string2" + >>$CONFIG_RULES echo '' +done + +dnl # Il faudra que je trouve la technique M4 (et non shell) pour que le +dnl # traitement final effectif de MV_CONFIG_RULES, se fasse lors du dernier +dnl # appel de la macro (voir AC_DIVERSION...). +>>$CONFIG_RULES echo '## [END OF FILE]' + +CONFIGURE_FILES="`echo $CONFIG_RULES $CONFIGURE_FILES`" + +AC_SUBST(CONFIG_RULES)]) + +dnl ########################################################################### +dnl # MV_OUTPUT(CONFIG-FILES, EXTRA-CMDS, INIT-CMDS) +dnl # +dnl # Idem que «AC_OUTPUT», et substitue «OUTPUT_FILES» et «CONFIGURE_FILES». +dnl # Ces deux variables sont utiles pour nettoyer la distribution. Exemple: +dnl # +dnl # distclean:: ; $(RM) @OUTPUT_FILES@ @CONFIGURE_FILES@ +dnl # +AC_DEFUN(MV_OUTPUT, [dnl + +mv_config_files="$1" + +OUTPUT_FILES= +for mv_cf in $mv_config_files; do + case $mv_cf in + *:*) OUTPUT_FILES="$OUTPUT_FILES `echo $mv_cf|sed 's%:.*$%%'`";; + *) OUTPUT_FILES="$OUTPUT_FILES $mv_cf";; + esac +done + +OUTPUT_FILES=`echo $OUTPUT_FILES` + +CONFIGURE_FILES="`echo $CONFIGURE_FILES config.log config.status config.cache`" + +AC_SUBST(OUTPUT_FILES)dnl +AC_SUBST(CONFIGURE_FILES)dnl + +AC_OUTPUT($mv_config_files, $2, $3)]) + +dnl ########################################################################### +dnl # MV_MKLOG +dnl # +dnl # Macro très spécialisée destinée à l'affichage dans LAYER-SYSTEM. +dnl # Substitue «MK_MKLOG» et «MK_BG_SPACES». +dnl # Remis à jour à chaque appel de configure. +dnl # +AC_DEFUN(MV_MKLOG, [dnl +ifelse($#,0,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +MV_FILL_BACKGROUND(MK_MKLOG, [.]) +MV_CONCAT(MK_MKLOG,`expr $COLUMNS / 8`,\\t) +MV_FILL_BACKGROUND(MK_BG_SPACES, [[[ ]]]) +AC_SUBST(MK_MKLOG)dnl +AC_SUBST(MK_BG_SPACES)]) + +dnl ########################################################################### +dnl # MV_MK_STANDARD +dnl # +AC_DEFUN(MV_MK_STANDARD, [dnl +ifelse($#,0,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl + +AC_CONFIG_AUX_DIR(mk) +MV_STANDARD +MV_TOLOWER +MV_TOUPPER +MV_MKLOG + +PACKAGE=${PACKAGE-PACKAGE} +VERSION=${VERSION-0.0.0} +SOMAJOR=${SOMAJOR-`echo $VERSION|sed 's/\..*//'`} + +pkgdatadir=$datadir/$PACKAGE +pkgsysconfdir=$sysconfdir/$PACKAGE +pkglocalstatedir=$localstatedir/$PACKAGE +pkgsharedstatedir=$sharedstatedir/$PACKAGE +package_data=$pkgdatadir/data + +dnl # Obligatoires: +AC_SUBST(PACKAGE)dnl +AC_SUBST(VERSION)dnl +dnl # Ici car très communément utilisés: +AC_SUBST(PROGRAMS)dnl +AC_SUBST(INCNAME)dnl +AC_SUBST(LIBNAME)dnl +AC_SUBST(ARCHIVE)dnl +AC_SUBST(LIBRARY)dnl +AC_SUBST(SOMAJOR)dnl +AC_SUBST(LIBSONAME)dnl +AC_SUBST(MODULES)dnl +AC_SUBST(PLUGINS)dnl +AC_SUBST(HEADERS)dnl +AC_SUBST(MANUALS)dnl +AC_SUBST(SUBDIRS)dnl +dnl # Diverses variables employées par LAYER-SYSTEM: +AC_SUBST(LAYERS)dnl +AC_SUBST(DEPINCS)dnl +AC_SUBST(DEPLIBS)dnl +AC_SUBST(DEFINES)dnl +AC_SUBST(INCLUDES)dnl +AC_SUBST(LIBRARIES)dnl +AC_SUBST(RPATH)dnl +AC_SUBST(LOCAL_LNK_DIR)dnl +AC_SUBST(LOCAL_SRC_DIRS)dnl +AC_SUBST(LOCAL_INC_DIRS)dnl +AC_SUBST(LOCAL_MAN_DIRS)dnl + +AC_SUBST(pkgdatadir)dnl +AC_SUBST(pkgsysconfdir)dnl +AC_SUBST(pkglocalstatedir)dnl +AC_SUBST(pkgsharedstatedir)dnl +AC_SUBST(package_data)dnl + +dnl ## +dnl # PERL PART +AC_SUBST(PERL)dnl +dnl ## +dnl # PYTHON PART +AC_SUBST(PYTHON)dnl +AC_SUBST(PYTHON_VERSION)dnl +AC_SUBST(PYTHON_LIBDIR)dnl +dnl ## +dnl # C PART +AC_SUBST(CC)dnl +AC_SUBST(CPP)dnl +dnl ## +dnl # C++ PART +AC_SUBST(CXX)dnl +AC_SUBST(CXXCPP)dnl +]) + +dnl ########################################################################### +dnl # MV_MK_OUTPUT(MAKEFILE-NAME, SUBDIRS, CONFIG-FILES, EXTRA-CMDS, INIT-CMDS) +dnl # +dnl # Idem que «MV_OUTPUT», mais gère en plus les fichiers pour LAYER-SYSTEM +dnl # grâce au fichier «system.rules» qui sera généré. +dnl # Prend 2 paramètres supplémentaires afin d'indiquer les makefile à créer +dnl # à l'aide de la liste des répertoires fournis. +dnl # Substitue les variables «topdir» et «makefile». +dnl # Appel également MV_TRANSFORM_MODULES. +dnl # +AC_DEFUN(MV_MK_OUTPUT, [dnl + +MV_MK_STANDARD + +dnl # Cette partie est certainement à isoler dans une macro à part... + +abssrcdir=`cd $srcdir && /bin/pwd` + +LOCAL_INC_DIRS=`for d in $LOCAL_INC_DIRS; do echo -n " $abssrcdir/$d"; done` +LOCAL_SRC_DIRS=`for d in $LOCAL_SRC_DIRS; do echo -n " $abssrcdir/$d"; done` +LOCAL_MAN_DIRS=`for d in $LOCAL_MAN_DIRS; do echo -n " $abssrcdir/$d"; done` + +if test -n "$LOCAL_LNK_DIR"; then + LOCAL_LNK_DIR=$topdir/$LOCAL_LNK_DIR + MV_TRANSFORM_MODULES($LOCAL_SRC_DIRS, $LOCAL_LNK_DIR, MODULES) +fi + +dnl # + +makefile=$1 +mv_subdirs="$2" + +if test ! -d $srcdir/mk; then + MV_ERROR([dnl +No «mk» (LAYER-SYSTEM) directory +in «$srcdir»]) +fi + +if test ! -f $srcdir/mk/private.mk.in; then + MV_ERROR([dnl +No «mk/private.mk.in» (LAYER-SYSTEM) file +in «$srcdir»]) +fi + +# Prise en compte automatique des fichiers de LAYER-SYSTEM +mv_system_files=`cd $srcdir && 2>/dev/null ls mk/*.in|fgrep -xv mk/private.mk.in|sed 's/\.in$//g'` + +if test -z "$mv_system_files"; then + MV_WARNING([dnl +No LAYER-SYSTEM files +in «$srcdir/mk/»]) +fi + +MV_CONFIG_RULES($mv_system_files, [@ $(~autoconf)], system.rules) + +mv_config_files=$mv_system_files + +if test -n "$makefile" -a -n "$mv_subdirs"; then + for mv_subdir in $mv_subdirs; do + if test ! -d $srcdir/$mv_subdir; then + MV_ERROR([No «$mv_subdir» directory!]) + fi + if test ! -f $srcdir/$mv_subdir/$makefile.in; then + MV_ERROR([No $makefile in «$mv_subdir» source directory!]) + fi + mv_config_files="$mv_config_files $mv_subdir/.private.mk:mk/private.mk.in" + mv_config_files="$mv_config_files $mv_subdir/$makefile" + done +fi + +AC_SUBST(makefile)dnl + +MV_OUTPUT($mv_config_files $3, $4, $5)]) + +dnl ########################################################################### +dnl # MV_SET_GCC_OPTIONS +dnl # +AC_DEFUN(MV_SET_GCC_OPTIONS, [dnl +dnl +GCC_OVERALL_OPTIONS=" -pipe" +GCC_WARNING_OPTIONS=" -Wall -W -Wmissing-prototypes -Wshadow -Wwrite-strings\ + -Wcast-qual -Winline" +GCC_DEBUG_OPTIONS=" -fno-builtin -g" +## +# OPTIMIZE: Attention «-fshort-enums» est très délicat à utiliser. Il impose +# que tous les composants d'une application aient été générés de cette manière. +GCC_OPTIMIZE_OPTIONS=" -O2 -ffast-math -fomit-frame-pointer" +GCC_PIC_OPTIONS=" -fPIC" +GNU_LINKER_OPTIONS=" -warn-once -warn-common" + +if test -n "`echo $GNU_LINKER_OPTIONS`"; then + GCC_LINKER_OPTIONS="\ + $GCC_LINKER_OPTIONS -Wl,`echo $GNU_LINKER_OPTIONS|sed 's/ /,/g'`" +fi + +GCC_SHARED_OPTIONS=" -shared" +dnl +AC_SUBST(GCC_WARNING_OPTIONS)dnl +AC_SUBST(GCC_DEBUG_OPTIONS)dnl +AC_SUBST(GCC_OPTIMIZE_OPTIONS)dnl +AC_SUBST(GCC_PIC_OPTIONS)dnl +AC_SUBST(GCC_LINKER_OPTIONS)dnl +AC_SUBST(GCC_SHARED_OPTIONS)]) + +dnl ########################################################################### +dnl # MV_SET_GXX_OPTIONS +dnl # +AC_DEFUN(MV_SET_GXX_OPTIONS, [dnl +dnl +GXX_OVERALL_OPTIONS=" -pipe" +GXX_WARNING_OPTIONS=" -Wall -W -Wmissing-prototypes -Wshadow -Wwrite-strings\ + -Wcast-qual -Winline" +GXX_DEBUG_OPTIONS=" -fno-builtin -g" +## +# OPTIMIZE: Attention «-fshort-enums» est très délicat à utiliser. Il impose +# que tous les composants d'une application aient été générés de cette manière. +GXX_OPTIMIZE_OPTIONS=" -O2 -ffast-math -fomit-frame-pointer" +GXX_PIC_OPTIONS=" -fPIC" +GNU_LINKER_OPTIONS=" -warn-once -warn-common" + +if test -n "`echo $GNU_LINKER_OPTIONS`"; then + GXX_LINKER_OPTIONS="\ + $GXX_LINKER_OPTIONS -Wl,`echo $GNU_LINKER_OPTIONS|sed 's/ /,/g'`" +fi + +GXX_SHARED_OPTIONS=" -shared" +dnl +AC_SUBST(GXX_WARNING_OPTIONS)dnl +AC_SUBST(GXX_DEBUG_OPTIONS)dnl +AC_SUBST(GXX_OPTIMIZE_OPTIONS)dnl +AC_SUBST(GXX_PIC_OPTIONS)dnl +AC_SUBST(GXX_LINKER_OPTIONS)dnl +AC_SUBST(GXX_SHARED_OPTIONS)]) + +dnl ########################################################################### +dnl # MV_PROG_GCC(-pipe -ansi -pedantic ...) +dnl # +dnl # Vite fait, bien fait ;-) +dnl # Impose gcc comme compilateur C. +dnl # Définit CC et CPP, ainsi que d'autres variables à utiliser dans un +dnl # makefile. +dnl # +AC_DEFUN(MV_PROG_GCC, [dnl +AC_BEFORE([$0], MV_CONFIG_FD_IS_CHAR_DEVICE)dnl +AC_REQUIRE([MV_SET_GCC_OPTIONS])dnl +MV_MSG_RESULT([GNU C compiler set]) +AC_CACHE_VAL(ac_cv_prog_CC, [ac_cv_prog_CC=`echo gcc $1`]) +CC=$ac_cv_prog_CC +AC_PROG_CC_WORKS +AC_PROG_CC_GNU +AC_PROG_CC_G +if test $ac_cv_prog_gcc = yes; then GCC=yes; else GCC=; fi +AC_CACHE_VAL(ac_cv_prog_CPP, [ac_cv_prog_CPP="$CC -E"]) +CPP=$ac_cv_prog_CPP +CC_WARNING_OPTIONS='$(GCC_WARNING_OPTIONS)' +CC_DEBUG_OPTIONS='$(GCC_DEBUG_OPTIONS)' +CC_OPTIMIZE_OPTIONS='$(GCC_OPTIMIZE_OPTIONS)' +CC_PIC_OPTIONS='$(GCC_PIC_OPTIONS)' +CC_LINKER_OPTIONS='$(GCC_LINKER_OPTIONS)' +CC_SHARED_OPTIONS='$(GCC_SHARED_OPTIONS)' +AC_SUBST(GCC)dnl +AC_SUBST(CC)dnl +AC_SUBST(CPP)dnl +AC_SUBST(CC_WARNING_OPTIONS)dnl +AC_SUBST(CC_DEBUG_OPTIONS)dnl +AC_SUBST(CC_OPTIMIZE_OPTIONS)dnl +AC_SUBST(CC_PIC_OPTIONS)dnl +AC_SUBST(CC_LINKER_OPTIONS)dnl +AC_SUBST(CC_SHARED_OPTIONS)]) + +dnl ########################################################################### +dnl # MV_PROG_GXX(-pipe -ansi -pedantic ...) +dnl # +dnl # Vite fait, bien fait ;-) +dnl # Impose g++ comme compilateur C++. +dnl # Définit CXX et CXXCPP, ainsi que d'autres variables à utiliser dans un +dnl # makefile. +dnl # +AC_DEFUN(MV_PROG_GXX, [dnl +AC_BEFORE([$0], MV_CONFIG_FD_IS_CHAR_DEVICE)dnl +AC_REQUIRE([MV_SET_GXX_OPTIONS])dnl +MV_MSG_RESULT([GNU C++ compiler set]) +AC_CACHE_VAL(ac_cv_prog_CXX, [ac_cv_prog_CXX=`echo g++ $1`]) +CXX=$ac_cv_prog_CXX +AC_PROG_CXX_WORKS +AC_PROG_CXX_GNU +AC_PROG_CXX_G +if test $ac_cv_prog_gxx = yes; then GXX=yes; else GXX=; fi +AC_CACHE_VAL(ac_cv_prog_CXXCPP, [ac_cv_prog_CXXCPP="$CXX -E"]) +CXXCPP=$ac_cv_prog_CXXCPP +CXX_WARNING_OPTIONS='$(GXX_WARNING_OPTIONS)' +CXX_DEBUG_OPTIONS='$(GXX_DEBUG_OPTIONS)' +CXX_OPTIMIZE_OPTIONS='$(GXX_OPTIMIZE_OPTIONS)' +CXX_PIC_OPTIONS='$(GXX_PIC_OPTIONS)' +CXX_LINKER_OPTIONS='$(GXX_LINKER_OPTIONS)' +CXX_SHARED_OPTIONS='$(GXX_SHARED_OPTIONS)' +AC_SUBST(GXX)dnl +AC_SUBST(CXX)dnl +AC_SUBST(CXXCPP)dnl +AC_SUBST(CXX_WARNING_OPTIONS)dnl +AC_SUBST(CXX_DEBUG_OPTIONS)dnl +AC_SUBST(CXX_OPTIMIZE_OPTIONS)dnl +AC_SUBST(CXX_PIC_OPTIONS)dnl +AC_SUBST(CXX_LINKER_OPTIONS)dnl +AC_SUBST(CXX_SHARED_OPTIONS)]) + +dnl ########################################################################### +dnl # MV_PROG_CC +dnl # +dnl # Comme AC_PROG_CC, avec AC_PROG_CPP, et quelques trucs en plus. +dnl # Définit également des options qui seront choisies en appelant make. +dnl # +AC_DEFUN(MV_PROG_CC, [dnl +AC_BEFORE([$0], MV_CONFIG_FD_IS_CHAR_DEVICE)dnl +AC_REQUIRE([MV_SET_GCC_OPTIONS])dnl +{ +dnl # If the user did not set CFLAGS, set it now to keep +dnl # the AC_PROG_CC macro from adding "-g -O2". +if test "${CFLAGS+set}" != set; then CFLAGS=; fi +AC_PROG_CC +if test "$GCC" = yes; then + MV_MSG_RESULT([Congratulations: You are using GNU CC ($CC). The best!]) + CC_OVERALL_OPTIONS=$GCC_OVERALL_OPTIONS + CC_WARNING_OPTIONS='$(GCC_WARNING_OPTIONS)' + CC_DEBUG_OPTIONS='$(GCC_DEBUG_OPTIONS)' + CC_OPTIMIZE_OPTIONS='$(GCC_OPTIMIZE_OPTIONS)' + CC_PIC_OPTIONS='$(GCC_PIC_OPTIONS)' + CC_SHARED_OPTIONS='$(GCC_SHARED_OPTIONS)' + CC_LINKER_OPTIONS='$(GCC_LINKER_OPTIONS)' +else + AC_MSG_RESULT([Why don't use GNU CC?]) +fi +CC=`echo $CC $CC_OVERALL_OPTIONS` +AC_PROG_CPP +} +AC_SUBST(GCC)dnl +AC_SUBST(CC_WARNING_OPTIONS)dnl +AC_SUBST(CC_DEBUG_OPTIONS)dnl +AC_SUBST(CC_OPTIMIZE_OPTIONS)dnl +AC_SUBST(CC_PIC_OPTIONS)dnl +AC_SUBST(CC_LINKER_OPTIONS)dnl +AC_SUBST(CC_SHARED_OPTIONS)dnl +]) + +dnl ########################################################################### +dnl # MV_PROG_CXX +dnl # +dnl # Comme AC_PROG_CXX, avec AC_PROG_CXXCPP, et quelques trucs en plus. +dnl # Définit également des options qui seront choisies en appelant make. +dnl # +AC_DEFUN(MV_PROG_CXX, [dnl +AC_BEFORE([$0], MV_CONFIG_FD_IS_CHAR_DEVICE)dnl +AC_REQUIRE([MV_SET_GXX_OPTIONS])dnl +{ +dnl # If the user did not set CFLAGS, set it now to keep +dnl # the AC_PROG_CXX macro from adding "-g -O2". +if test "${CFLAGS+set}" != set; then CFLAGS=; fi +AC_PROG_CXX +if test "$GXX" = yes; then + MV_MSG_RESULT([Congratulations: You are using GNU CXX ($CXX). The best!]) + CXX_OVERALL_OPTIONS=$GXX_OVERALL_OPTIONS + CXX_WARNING_OPTIONS='$(GXX_WARNING_OPTIONS)' + CXX_DEBUG_OPTIONS='$(GXX_DEBUG_OPTIONS)' + CXX_OPTIMIZE_OPTIONS='$(GXX_OPTIMIZE_OPTIONS)' + CXX_PIC_OPTIONS='$(GXX_PIC_OPTIONS)' + CXX_SHARED_OPTIONS='$(GXX_SHARED_OPTIONS)' + CXX_LINKER_OPTIONS='$(GXX_LINKER_OPTIONS)' +else + AC_MSG_RESULT([Why don't use GNU C++?]) +fi +CXX=`echo $CXX $CXX_OVERALL_OPTIONS` +AC_PROG_CXXCPP +} +AC_SUBST(GXX)dnl +AC_SUBST(CXX_WARNING_OPTIONS)dnl +AC_SUBST(CXX_DEBUG_OPTIONS)dnl +AC_SUBST(CXX_OPTIMIZE_OPTIONS)dnl +AC_SUBST(CXX_PIC_OPTIONS)dnl +AC_SUBST(CXX_LINKER_OPTIONS)dnl +AC_SUBST(CXX_SHARED_OPTIONS)dnl +]) + +dnl ########################################################################### +dnl # A REVOIR/A RELIRE +dnl ########################################################################### + +dnl ########################################################################### +dnl # MV_PREFIX_PROGRAM +dnl # +dnl # Une simple ré-écriture de «AC_PREFIX_PROGRAM» juste pour autoriser le +dnl # caractère «-» dans le nom du programme. +dnl # +AC_DEFUN(MV_PREFIX_PROGRAM, [dnl +if test "x$prefix" = xNONE; then +changequote(«, »)dnl +define(«AC_VAR_NAME», translit($1, -[a-z], _[A-Z]))dnl +changequote([,])dnl +dnl We reimplement AC_MSG_CHECKING (mostly) to avoid the ... in the middle. +echo $ac_n "checking for prefix by $ac_c" 1>&AC_FD_MSG +AC_PATH_PROG(AC_VAR_NAME, $1) +changequote(«,»)dnl + if test -n "$ac_cv_path_«»AC_VAR_NAME"; then + prefix=`echo $ac_cv_path_«»AC_VAR_NAME|sed 's%/[^/][^/]*//*[^/][^/]*$%%'` +changequote([,])dnl + fi +fi +undefine([AC_VAR_NAME])]) + +dnl ########################################################################### +dnl # MV_PROG_MKDIRHIER +dnl # +AC_DEFUN(MV_PROG_MKDIRHIER, [dnl +if test `uname` = Linux; then + AC_PATH_PROGS(MKDIRHIER, mkinstalldirs mkdirhier, install -d, $PATH:$srcdir) +else + AC_PATH_PROGS(MKDIRHIER, mkinstalldirs mkdirhier, mkdir -p, $PATH:$srcdir) +fi]) + +dnl ########################################################################### +dnl # MV_PROG_RMDIRHIER +dnl # +AC_DEFUN(MV_PROG_RMDIRHIER, [dnl +if test `uname` = Linux; then + AC_PATH_PROG(RMDIRHIER, rmdirhier, rmdir -p, $PATH:$srcdir) +else + RMDIRHIER="rmdir -p" +fi]) + +dnl ########################################################################### +dnl # MV_PROG_LD +dnl # +AC_DEFUN(MV_PROG_LD, [dnl +AC_MSG_CHECKING(for the \"front-end\" linker to use) +ifelse(AC_LANG, C, [ + LD=$CC + AC_MSG_RESULT($LD)], + ifelse(AC_LANG, CPLUSPLUS, [ + LD=$CXX + AC_MSG_RESULT($LD)], + LD=${CC:-cc} + AC_MSG_RESULT($LD))) +AC_SUBST(LD)]) + +dnl ########################################################################### +dnl # MV_PROG_PERL(MIN-VERSION) +dnl # +AC_DEFUN(MV_PROG_PERL, [{dnl + +mv_requested_version=$1 + +changequote(,) +mv_requested_major_version=`echo $mv_requested_version|sed -n 's/^\([^.]*\).*$/\1/p'` +mv_requested_version=`echo $mv_requested_version|sed -n "s/^$mv_requested_major_version\.\(.*$\)/\1/p"` +mv_requested_minor_version=`echo $mv_requested_version|sed -n 's/^\([^.]*\).*$/\1/p'` +mv_requested_version=`echo $mv_requested_version|sed -n "s/^$mv_requested_minor_version\.\(.*$\)/\1/p"` +mv_requested_micro_version=`echo $mv_requested_version|sed -n 's/^\([^.]*\).*$/\1/p'` +mv_requested_version=`echo $mv_requested_version|sed -n "s/^$mv_requested_micro_version\.\(.*$\)/\1/p"` +changequote([,]) + +if test -z "$mv_requested_major_version"\ + -o -z "$mv_requested_minor_version"\ + -o -z "$mv_requested_micro_version"\ + -o -n "$mv_requested_version"; then + test "$silent" != yes && MV_WARNING(Un problème d'analyse de la version demandée de Perl) +fi + +mv_requested_major_version=`echo $mv_requested_major_version|sed 's/^0*//'` +mv_requested_minor_version=`echo $mv_requested_minor_version|sed 's/^0*//'` +mv_requested_micro_version=`echo $mv_requested_micro_version|sed 's/^0*//'` + +mv_requested_version=$mv_requested_major_version.$mv_requested_minor_version.$mv_requested_micro_version + +MV_MSG(You want Perl version \"$mv_requested_version\":, $CYAN) + +AC_CHECK_PROGS(PERL, perl) + +if test -z "$PERL"; then MV_ERROR(No PERL interpreter found!!!); fi + +AC_REQUIRE([MV_SET_BRACKETS])dnl +mv_string='print $'"${mv_RB};" +PERL_VERSION=`$PERL -e "$mv_string;"` +MV_MSG_N(Perl version found is \"$PERL_VERSION\"..., $CYAN) + +changequote(,) +PERL_MAJOR_VERSION=`echo $PERL_VERSION|sed -n 's/^\([^.]*\).*$/\1/p'` +PERL_VERSION=`echo $PERL_VERSION|sed -n "s/^$PERL_MAJOR_VERSION\.\(.*$\)/\1/p"` +PERL_MINOR_VERSION=`echo $PERL_VERSION|sed -n 's/^\(...\).*$/\1/p'` +PERL_VERSION=`echo $PERL_VERSION|sed -n "s/^$PERL_MINOR_VERSION\(.*$\)/\1/p"` +dnl # Un doute ici: 03 doit-il correspondre à 3 ou 30? +PERL_MICRO_VERSION=$PERL_VERSION +changequote([,]) + +if test -z "$PERL_MAJOR_VERSION"\ + -o -z "$PERL_MINOR_VERSION"\ + -o -z "$PERL_MICRO_VERSION"; then + test "$silent" != yes && MV_MSG(); MV_WARNING(Un problème d'analyse de la version trouvée de Perl) +fi + +PERL_MAJOR_VERSION=`echo $PERL_MAJOR_VERSION|sed 's/^0*//'` +PERL_MINOR_VERSION=`echo $PERL_MINOR_VERSION|sed 's/^0*//'` +PERL_MICRO_VERSION=`echo $PERL_MICRO_VERSION|sed 's/^0*//'` + +AC_SUBST(PERL_MAJOR_VERSION)dnl +AC_SUBST(PERL_MINOR_VERSION)dnl +AC_SUBST(PERL_MICRO_VERSION)dnl + +PERL_VERSION=$PERL_MAJOR_VERSION.$PERL_MINOR_VERSION.$PERL_MICRO_VERSION + +AC_SUBST(PERL_VERSION)dnl + +MV_MSG([ ]and standardized version is \"$PERL_VERSION\", $CYAN) + +if test $PERL_MAJOR_VERSION -lt $mv_requested_major_version\ + -o $PERL_MINOR_VERSION -lt $mv_requested_minor_version\ + -o $PERL_MICRO_VERSION -lt $mv_requested_micro_version; then + test "$silent" != yes && MV_WARNING(La version demandée de Perl n'a pas été trouvée) +else + MV_MSG(Fine: Version of Perl requested is found, $CYAN) +fi + +}]) + +dnl ########################################################################### +dnl # MV_AUTOCONF_DIRS +dnl # +AC_DEFUN(MV_AUTOCONF_DIRS, [dnl +dnl # +test "$prefix" = NONE && prefix=$ac_default_prefix +test "$exec_prefix" = NONE && exec_prefix=$prefix +dnl # +test "$libdir" = '${exec_prefix}/lib' && libdir=${exec_prefix}/lib +test "$libexecdir" = '${exec_prefix}/libexec' && libexecdir=${exec_prefix}/libexec +test "$sbindir" = '${exec_prefix}/sbin' && sbindir=${exec_prefix}/sbin +test "$bindir" = '${exec_prefix}/bin' && bindir=${exec_prefix}/bin +test "$datadir" = '${prefix}/share' && datadir=${prefix}/share +test "$sysconfdir" = '${prefix}/etc' && sysconfdir=${prefix}/etc +test "$localstatedir" = '${prefix}/var' && localstatedir=${prefix}/var +test "$sharedstatedir" = '${prefix}/com' && sharedstatedir=${prefix}/com +test "$mandir" = '${prefix}/man' && mandir=${prefix}/man +test "$infodir" = '${prefix}/info' && infodir=${prefix}/info +test "$includedir" = '${prefix}/include' && includedir=${prefix}/include]) + +dnl ########################################################################### +dnl # MV_CHECK_CONFIG_FILES +dnl # +AC_DEFUN(MV_CHECK_CONFIG_FILES, [dnl +for i in $CONFIG_FILES; do + case $i in + *:*) + t=`echo $i | sed 's/^.*://'` + ;; + *) + t=$i.in + ;; + esac + if test ! -f $srcdir/$t; then + dir=`dirname $srcdir/$t` + if test ! -d $dir; then + MV_ERROR([Le répertoire «$dir» n'existe pas]) + fi + MV_ERROR([Le fichier «$srcdir/$t» n'existe pas]) + fi +done]) + +dnl ########################################################################### +dnl # MV_DO_MICO +dnl # +AC_DEFUN(MV_DO_MICO, [dnl +AC_CHECK_PROGS(IDL, idl) +if test -n "$IDL"; then + version_string=`$IDL --version` + if test "`echo $version_string | awk '{ print [$]1 }'`" = MICO; then + AC_DEFINE(__MICO__) + MICO_VERSION=`echo $version_string | awk '{ print [$]3 }'` + echo "MICO Version $MICO_VERSION found" + IDL='idl --c++-suffix=$(strip $''1) --hh-suffix=$(strip $''2)' + AC_SUBST(IDL) + IDL_BOA="$IDL --boa --no-poa" + IDL_POA="$IDL --poa --no-boa" + IDL_BOA_POA="$IDL --boa --poa" + IDL_POA_BOA="$IDL --poa --boa" + AC_SUBST(IDL_BOA) + AC_SUBST(IDL_POA) + AC_SUBST(IDL_BOA_POA) + AC_SUBST(IDL_POA_BOA) + AC_CHECK_LIB(mico$MICO_VERSION, main) + fi +fi]) + +dnl ########################################################################### +dnl # MV_DO_OMNIORB +dnl # +AC_DEFUN(MV_DO_OMNIORB, [dnl +AC_CHECK_PROGS(IDL, omniidl) +if test -n "$IDL"; then + version_string=`2>&1 omniidl -V | head -1` + if test "`echo $version_string | awk '{ print [$]1 }'`" = Omniidl; then + AC_DEFINE(__OMNIORB__) + OMNIORB_VERSION=`echo $version_string | awk '{ print [$]2 }'` + echo "omniORB Version $OMNIORB_VERSION found" + IDL='idl -s $(strip $''1) -h $(strip $''2)' + AC_SUBST(IDL) + IDL_BOA="$IDL" + IDL_POA="$IDL" + IDL_BOA_POA="$IDL" + IDL_POA_BOA="$IDL" + AC_SUBST(IDL_BOA) + AC_SUBST(IDL_POA) + AC_SUBST(IDL_BOA_POA) + AC_SUBST(IDL_POA_BOA) + AC_CHECK_LIB(omniGK_alone, main) + AC_CHECK_LIB(omniORB, main) + fi +fi]) + +dnl ########################################################################### +dnl # MV_DO_OMNIORB2 +dnl # +AC_DEFUN(MV_DO_OMNIORB2, [dnl +AC_CHECK_PROGS(IDL, omniidl2) +if test -n "$IDL"; then + version_string=`2>&1 omniidl2 -V | head -1` + if test "`echo $version_string | awk '{ print [$]1 }'`" = Omniidl; then + AC_DEFINE(__OMNIORB__) + OMNIORB_VERSION=`echo $version_string | awk '{ print [$]2 }'` + echo "omniORB Version $OMNIORB_VERSION found" + IDL='idl -s $(strip $''1) -h $(strip $''2)' + AC_SUBST(IDL) + IDL_BOA="$IDL" + IDL_POA="$IDL" + IDL_BOA_POA="$IDL" + IDL_POA_BOA="$IDL" + AC_SUBST(IDL_BOA) + AC_SUBST(IDL_POA) + AC_SUBST(IDL_BOA_POA) + AC_SUBST(IDL_POA_BOA) + AC_CHECK_LIB(omniGK_alone, main) + AC_CHECK_LIB(omniORB2, main) + fi +fi]) + +dnl ########################################################################### +dnl # MV_CHECK_OMLIB +dnl # +AC_DEFUN(MV_CHECK_OMLIB, [dnl +ifelse($#,0,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])]) + +{ + +AC_ARG_WITH(om_includes, +[] --with-om-includes=DIR OMLIB include files are in DIR) +AC_ARG_WITH(om_libraries, +[] --with-om-libraries=DIR OMLIB library files are in DIR) + +if test -z "$with_om_includes" -o "$with_om_includes" = yes; then + found=false + if test -n "$subdirs"; then + for dir in $subdirs; do + if test -f "$dir/OverlapMan2.h"; then + found=true + AC_MSG_RESULT(omlib: include file \"OverlapMan2.h\" found in $dir/include) + depinc="`cd $dir && /bin/pwd`/OverlapMan2.h" + DEPINCS="$depinc $DEPINCS" + AC_MSG_RESULT(omlib: $depinc add to DEPINCS) + break + fi + done + fi + if ! $found; then + AC_CHECK_HEADER(OverlapMan2.h,, AC_ERROR(Overlap Manger Library required)) + fi +elif test "$with_om_includes" != no; then + if test -f "$srcdir/$with_om_includes/OverlapMan2.h"; then + AC_MSG_RESULT(omlib: include file \"OverlapMan2.h\" found in $srcdir/$with_om_includes) + DEPINCS="`cd $srcdir/$with_om_includes && /bin/pwd`/OverlapMan2.h $DEPINCS" + else + AC_ERROR(OverlapMan2.h not found in $srcdir/$with_om_includes) + fi +fi + +if test -z "$with_om_libraries" -o "$with_om_libraries" = yes; then + found=false + if test -n "$subdirs"; then + for dir in $subdirs; do + if test -f "$dir/OverlapMan2.h"; then + found=true + dir="`cd $dir && /bin/pwd`" + RPATH="$dir $RPATH" + deplib=$dir/libom.so + DEPLIBS="$deplib $DEPLIBS" + AC_MSG_RESULT(omlib: $deplib add to DEPLIBS) + break + fi + done + fi + if ! $found; then + if test "$with_om_libraries" = yes; then + AC_CHECK_LIB(om, puterrmsg,, AC_ERROR(Overlap Manger required)) + else + AC_CHECK_LIB(om, puterrmsg) + fi + fi +elif test "$with_om_libraries" != no; then + if test -f "$srcdir/$with_om_libraries/configure"; then + AC_CONFIG_SUBDIRS($with_om_libraries) + AC_MSG_RESULT(omlib: $with_om_libraries added to directories to configure) + LDFLAGS="-L`cd $with_om_libraries && /bin/pwd` $LDFLAGS" + LIBS="-lom $LIBS" + elif test -f "$srcdir/$with_om_libraries/libom.so"; then + AC_MSG_RESULT(omlib: library file \"libom.so\" found in $srcdir/$with_om_libraries) + DEPLIBS="`cd $srcdir/$with_om_libraries && /bin/pwd`/libom.so $DEPLIBS" + elif test -f "$srcdir/$with_om_libraries/libom.a"; then + AC_MSG_RESULT(omlib: library file \"libom.a\" found in $srcdir/$with_om_libraries) + DEPLIBS="`cd $srcdir/$with_om_libraries && /bin/pwd`/libom.a $DEPLIBS" + else + AC_ERROR(no Overlap Manger library found and don't know how to built it) + fi +fi + +AC_SUBST(RPATH) + +}]) + +dnl ########################################################################### +dnl # MV_CHECK_XCLIB +dnl # +AC_DEFUN(MV_CHECK_XCLIB, [dnl +ifelse($#,0,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])]) + +{ + +AC_ARG_WITH(xc_includes, +[] --with-xc-includes=DIR XCLIB include files are in DIR) +AC_ARG_WITH(xc_libraries, +[] --with-xc-libraries=DIR XCLIB library files are in DIR) + +if test -z "$with_xc_includes" -o "$with_xc_includes" = yes; then + found=false + if test -n "$subdirs"; then + for dir in $subdirs; do + if test -f "$dir/include/xclib.h"; then + found=true + AC_MSG_RESULT(xclib: include file \"xclib.h\" found in $dir/include) + depinc="`cd $dir/include && /bin/pwd`/xclib.h" + DEPINCS="$depinc $DEPINCS" + AC_MSG_RESULT(xclib: $depinc add to DEPINCS) + break + fi + done + fi + if ! $found; then + AC_CHECK_HEADER(xclib.h,, AC_ERROR(eXtended C Library required)) + fi +elif test "$with_xc_includes" != no; then + if test -f "$srcdir/$with_xc_includes/xclib.h"; then + AC_MSG_RESULT(xclib: include file \"xclib.h\" found in $srcdir/$with_xc_includes) + DEPINCS="`cd $srcdir/$with_xc_includes && /bin/pwd`/xclib.h $DEPINCS" + else + AC_ERROR(xclib.h not found in $srcdir/$with_xc_includes) + fi +fi + +if test -z "$with_xc_libraries" -o "$with_xc_libraries" = yes; then + found=false + if test -n "$subdirs"; then + for dir in $subdirs; do + if test -f "$dir/include/xclib.h"; then + found=true + dir="`cd $dir && /bin/pwd`" + RPATH="$dir $RPATH" + deplib=$dir/libxc.so + DEPLIBS="$deplib $DEPLIBS" + AC_MSG_RESULT(xclib: $deplib add to DEPLIBS) + break + fi + done + fi + if ! $found; then + if test "$with_xc_libraries" = yes; then + AC_CHECK_LIB(xc, puterrmsg,, AC_ERROR(eXtended C Library required)) + else + AC_CHECK_LIB(xc, puterrmsg) + fi + fi +elif test "$with_xc_libraries" != no; then + if test -f "$srcdir/$with_xc_libraries/configure"; then + AC_CONFIG_SUBDIRS($with_xc_libraries) + AC_MSG_RESULT(xclib: $with_xc_libraries added to directories to configure) + LDFLAGS="-L`cd $with_xc_libraries && /bin/pwd` $LDFLAGS" + LIBS="-lxc $LIBS" + elif test -f "$srcdir/$with_xc_libraries/libxc.so"; then + AC_MSG_RESULT(xclib: library file \"libxc.so\" found in $srcdir/$with_xc_libraries) + DEPLIBS="`cd $srcdir/$with_xc_libraries && /bin/pwd`/libxc.so $DEPLIBS" + elif test -f "$srcdir/$with_xc_libraries/libxc.a"; then + AC_MSG_RESULT(xclib: library file \"libxc.a\" found in $srcdir/$with_xc_libraries) + DEPLIBS="`cd $srcdir/$with_xc_libraries && /bin/pwd`/libxc.a $DEPLIBS" + else + AC_ERROR(no \"eXtended C\" library found and don't know how to built it) + fi +fi + +AC_SUBST(RPATH) + +}]) + +dnl ########################################################################### +dnl # MV_CHECK_DPKG_VERSION +dnl # +AC_DEFUN(MV_CHECK_DPKG_VERSION, [dnl +ifelse($#,1,,[MV_AUTOCONF_ERROR([Invalid invocation of «$0»])])dnl +dnl +mv_version="$1" +dnl +AC_CHECK_PROG(PARSECHANGELOG, dpkg-parsechangelog, dpkg-parsechangelog)dnl +dnl +if test -n "$PARSECHANGELOG"; then +changequote(«,»)dnl + DPKG_VERSION=`$PARSECHANGELOG -l$srcdir/debian/changelog|sed -n 's/^Version: \([^-]*\).*$/\1/p'` +changequote([,])dnl + if test "$DPKG_VERSION" != "$mv_version"; then + AC_ERROR(Version in debian/changelog is different +------------------------------------------------------------------------------ +`$PARSECHANGELOG` +------------------------------------------------------------------------------) + fi +fi]) + +dnl ########################################################################### +dnl # [END OF FILE] +dnl ########################################################################### diff --git a/private.m4 b/private.m4 new file mode 100644 index 0000000..733b865 --- /dev/null +++ b/private.m4 @@ -0,0 +1,189 @@ +dnl # -*- autoconf -*- + +dnl #++ +dnl # LISTE DES MACROS: +dnl # ================= +dnl # +dnl # MV_PROG_PYTHON +dnl # MV_LOAD_TCL_CONFIG +dnl # MV_LOAD_TK_CONFIG +dnl # MV_SET_TCL_CONFIG +dnl # MV_SET_TCL_STUB_CONFIG +dnl # MV_SET_TK_STUB_CONFIG +dnl #-- + +dnl ########################################################################### +dnl # MV_PROG_PYTHON +dnl # +AC_DEFUN(MV_PROG_PYTHON, [dnl + +AC_CHECK_PROGS(PYTHON, python2.3 python2.2 python2.1 python) + +if test -z "$PYTHON"; then + MV_ERROR(No Python interpreter found) +fi + +changequote(,) +PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[:3]"` +changequote([, ]) + +MV_MSG(You are using Python version $PYTHON_VERSION, $CYAN) + +AC_SUBST(PYTHON_VERSION)dnl + +mv_tmp=`type -p $PYTHON` # filespec +mv_tmp=`dirname $mv_tmp` # bindir +mv_tmp=`dirname $mv_tmp` # topdir + +if test ! -d $mv_tmp/include; then + MV_ERROR(No «$mv_tmp/include» found) +fi +if test ! -d $mv_tmp/include/python$PYTHON_VERSION; then + MV_ERROR(No «$mv_tmp/include/python$PYTHON_VERSION» found) +fi +if test ! -f $mv_tmp/include/python$PYTHON_VERSION/Python.h; then + MV_ERROR(No «$mv_tmp/include/python$PYTHON_VERSION/Python.h» found) +fi + +PYTHON_INCLUDEDIR=$mv_tmp/include +PYTHON_LIBDIR=$mv_tmp/lib + +AC_SUBST(PYTHON_INCLUDEDIR) +AC_SUBST(PYTHON_LIBDIR) + +dnl # A FAIRE: +dnl # S'assurer de bien utiliser cette version de la bibliotheque python! + +pyexecdir=\${exec_prefix}/lib/python$PYTHON_VERSION/site-packages +pythondir=\${exec_prefix}/lib/python$PYTHON_VERSION/site-packages + +AC_SUBST(pyexecdir) +AC_SUBST(pythondir) + +pkgpyexecdir=\${pyexecdir}/$PACKAGE +pkgpythondir=\${pythondir}/$PACKAGE + +AC_SUBST(pkgpyexecdir) +AC_SUBST(pkgpythondir) + +]) + +dnl ########################################################################### +dnl # MV_LOAD_TCL_CONFIG +dnl # +dnl # Find and load the tclConfig.sh file +dnl # +AC_DEFUN(MV_LOAD_TCL_CONFIG, [dnl + +SC_PATH_TCLCONFIG +SC_LOAD_TCLCONFIG + +MV_MSG([You are using Tcl $TCL_VERSION], $CYAN)]) + +dnl ########################################################################### +dnl # MV_LOAD_TK_CONFIG +dnl # +dnl # Find and load the tkConfig.sh file +dnl # +AC_DEFUN(MV_LOAD_TK_CONFIG, [dnl + +SC_PATH_TKCONFIG +SC_LOAD_TKCONFIG + +MV_MSG([You are using Tk $TK_VERSION], $CYAN) + +if test "$TCL_VERSION" != "$TK_VERSION"; then + MV_ERROR([dnl +$TCL_BIN_DIR/tclConfig.sh is for Tcl $TCL_VERSION. +Tk $TK_VERSION$TK_PATCH_LEVEL needs Tcl $TK_VERSION. +Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl $TK_VERSION.]) + else + MV_MSG([Good: Tcl and Tk have the same version], $CYAN) + fi +]) + +dnl ########################################################################### +dnl # MV_SET_TCL_CONFIG +dnl # +dnl # Find and load the tcl configuration +dnl # +AC_DEFUN(MV_SET_TCL_CONFIG, [dnl + +AC_REQUIRE([MV_LOAD_TCL_CONFIG])dnl + +TCL_INCLUDES= +TCL_INCLUDES="$TCL_INCLUDES ${TCL_INCLUDE_SPEC-"-I$TCL_SRC_DIR"}/unix" +TCL_INCLUDES="$TCL_INCLUDES ${TCL_INCLUDE_SPEC-"-I$TCL_SRC_DIR"}/generic" +TCL_INCLUDES="$TCL_INCLUDES ${TCL_INCLUDE_SPEC-"-I$TCL_SRC_DIR"}" + +DEFINES=" $DEFINES $TCL_DEFS" +INCLUDES=" $TCL_INCLUDES $INCLUDES" +LIBRARIES=" $TCL_LIB_SPEC $LIBRARIES" + +AC_SUBST(DEFINES)dnl +AC_SUBST(INCLUDES)dnl +AC_SUBST(LIBRARIES)]) + +dnl ########################################################################### +dnl # MV_SET_TCL_STUB_CONFIG +dnl # +dnl # Find and load the tcl configuration for stub operation +dnl # +AC_DEFUN(MV_SET_TCL_STUB_CONFIG, [dnl + +DEFINES="$DEFINES -DUSE_TCL_STUBS=1" + +AC_REQUIRE([MV_LOAD_TCL_CONFIG])dnl + +TCL_INCLUDES= +TCL_INCLUDES="$TCL_INCLUDES ${TCL_INCLUDE_SPEC-"-I$TCL_SRC_DIR"}/unix" +TCL_INCLUDES="$TCL_INCLUDES ${TCL_INCLUDE_SPEC-"-I$TCL_SRC_DIR"}/generic" +TCL_INCLUDES="$TCL_INCLUDES ${TCL_INCLUDE_SPEC-"-I$TCL_SRC_DIR"}" + +DEFINES=" $DEFINES $TCL_DEFS" +INCLUDES=" $TCL_INCLUDES $INCLUDES" +LIBRARIES=" $TCL_STUB_LIB_SPEC $LIBRARIES" + +AC_SUBST(DEFINES)dnl +AC_SUBST(INCLUDES)dnl +AC_SUBST(LIBRARIES)]) + +dnl ########################################################################### +dnl # MV_SET_TK_STUB_CONFIG +dnl # +dnl # Find and load the tk configuration for stub operation +dnl # +AC_DEFUN(MV_SET_TK_STUB_CONFIG, [dnl + +DEFINES="$DEFINES -DUSE_TK_STUBS=1" + +AC_REQUIRE([MV_LOAD_TK_CONFIG])dnl + +INCLUDES=" $TK_XINCLUDES $INCLUDES" +LIBRARIES="$TK_XLIBSW $LIBRARIES" + +TK_INCLUDES= +TK_INCLUDES="$TK_INCLUDES -I$TK_PREFIX/include/tk$TK_VERSION/unix" +TK_INCLUDES="$TK_INCLUDES -I$TK_PREFIX/include/tk$TK_VERSION/generic" +TK_INCLUDES="$TK_INCLUDES -I$TK_PREFIX/include/tk$TK_VERSION" + +dnl # La galère sur la woody... +TK_INCLUDES="$TK_INCLUDES -I$TK_PREFIX/include/tcl$TK_VERSION/tk-private/unix" +TK_INCLUDES="$TK_INCLUDES -I$TK_PREFIX/include/tcl$TK_VERSION/tk-private/generic" +TK_INCLUDES="$TK_INCLUDES -I$TK_PREFIX/include/tcl$TK_VERSION/tk-private" + +TK_INCLUDES="$TK_INCLUDES -I$TK_PREFIX/include/unix" +TK_INCLUDES="$TK_INCLUDES -I$TK_PREFIX/include/generic" +TK_INCLUDES="$TK_INCLUDES -I$TK_PREFIX/include" + +DEFINES=" $DEFINES $TK_DEFS" +INCLUDES=" $TK_INCLUDES $INCLUDES" +LIBRARIES=" $TK_STUB_LIB_SPEC $LIBRARIES" + +AC_SUBST(DEFINES)dnl +AC_SUBST(INCLUDES)dnl +AC_SUBST(LIBRARIES)]) + +dnl ########################################################################### +dnl # [END OF FILE] +dnl ########################################################################### |