diff -pruN ocaml-tmk-upstream/config.ml.in ocaml-tmk-autoconf/config.ml.in --- ocaml-tmk-upstream/config.ml.in 1969-12-31 18:00:00.000000000 -0600 +++ ocaml-tmk-autoconf/config.ml.in 2008-04-10 00:17:24.000000000 -0500 @@ -0,0 +1,22 @@ +(*************************************************************************** + * OCaml Curses -- configuration information + * Copyright (C) 2008 Paul Pelzl + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ***************************************************************************) + +(* Did we compile with ncurses wide char support? *) +let wide_ncurses = @BOOL_WIDE_CURSES@ + diff -pruN ocaml-tmk-upstream/configure.ac ocaml-tmk-autoconf/configure.ac --- ocaml-tmk-upstream/configure.ac 1969-12-31 18:00:00.000000000 -0600 +++ ocaml-tmk-autoconf/configure.ac 2008-04-10 00:17:24.000000000 -0500 @@ -0,0 +1,154 @@ +############################################################################ +# configure.ac +# +# Build configuration script for OCaml curses bindings. +# +# History: +# +# 2008-04-08 pjp Derived from Wyrd 1.4.4 build system. +############################################################################ + +# Check for a particular file from the source tree + +AC_INIT(config.ml.in) + +# optional arguments + +AC_ARG_ENABLE(widec, +[ --enable-widec link against a wide-character-enabled ncurses)], +[try_widec=$enable_widec], [try_widec=no]) + + +# Find a C compiler + +AC_PROG_CC() + +ORIG_LIBS="$LIBS" +ORIG_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CURSES_INCLUDE $ORIG_CPPFLAGS" + + +# Check for ncurses, and test a number of different locations for the header + +AC_MSG_CHECKING(for working ncurses library) + +if test "$try_widec" != "no" +then +LIBS="-lncursesw $ORIG_LIBS" +AC_TRY_LINK( + [#include ], [initscr(); use_default_colors()], + [CURSES_LIB=-lncursesw + AC_DEFINE(CURSES_HEADER, , [Defined to ncurses header file])]) +fi + +if test -z "$CURSES_LIB" +then +LIBS="-lncurses $ORIG_LIBS" +AC_TRY_LINK( + [#include ], [initscr(); use_default_colors()], + [CURSES_LIB=-lncurses + AC_DEFINE(CURSES_HEADER, , [Defined to ncurses header file])], + [ +LIBS="-lncurses $ORIG_LIBS" +AC_TRY_LINK( + [#include ], [initscr(); use_default_colors()], + [CURSES_LIB=-lncurses + AC_DEFINE(CURSES_HEADER, , [Defined to ncurses header file])], + [ +LIBS="-lcurses $ORIG_LIBS" +AC_TRY_LINK( + [#include ], [initscr(); use_default_colors()], + [CURSES_LIB=-lcurses + AC_DEFINE(CURSES_HEADER, , [Defined to ncurses header file])], + [ +LIBS="-lncurses $ORIG_LIBS" +AC_TRY_LINK( + [#include ], [initscr(); use_default_colors()], + [CURSES_LIB=-lcurses + AC_DEFINE(CURSES_HEADER, , [Defined to ncurses header file])], +) ]) ]) ]) +fi + +if test -n "$CURSES_LIB" +then +AC_MSG_RESULT([found in $CURSES_LIB]) +else +AC_MSG_ERROR([not found]) +fi + +# Try to locate term.h, which has a sadly nonstandardized location + +AC_MSG_CHECKING(for ncurses term.h) +AC_TRY_COMPILE( + [#include ], [TERMTYPE __dummy], + [TERM_H_STRING="" + AC_DEFINE(CURSES_TERM_H, , [Defined to ncurses term.h file])], + [ +AC_TRY_COMPILE( + [#include ], [TERMTYPE __dummy], + [TERM_H_STRING="" + AC_DEFINE(CURSES_TERM_H, , [Defined to ncurses term.h file])], + [ +AC_TRY_COMPILE( + [#include ], [TERMTYPE __dummy], + [TERM_H_STRING="" + AC_DEFINE(CURSES_TERM_H, , [Defined to ncurses term.h file])], +) ]) ]) + +if test -n "$TERM_H_STRING" +then + AC_MSG_RESULT([found in $TERM_H_STRING]) +else + AC_MSG_ERROR([not found]) +fi + + +# Determine whether the detected curses has wide character support + +BOOL_WIDE_CURSES="false" +if test -n "$CURSES_LIB" +then + LIBS="$CURSES_LIB $ORIG_LIBS" + + if test "$try_widec" != "no" + then + AC_MSG_CHECKING(for wide character support in ncurses library) + AC_TRY_LINK( + [#include + #include CURSES_HEADER + ], + [wchar_t wch = 0; + addnwstr(&wch, 1);], + [AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_WIDE_CURSES, 1, [Defined if ncurses library includes wide character support]) + BOOL_WIDE_CURSES="true"], + [AC_MSG_RESULT(no)]) + fi +fi + +CURSES_LIB_BASE=`expr "$CURSES_LIB" : '-l\(.*\)'` +CPPFLAGS="$ORIG_CPPFLAGS" +LIBS="$ORIG_LIBS" + + +# Perform substitutions + +AC_SUBST(CURSES_HEADER) +AC_SUBST(CURSES_TERM_H) +AC_SUBST(CURSES_LIB) +AC_SUBST(CURSES_LIB_BASE) +AC_SUBST(BOOL_WIDE_CURSES) +AC_SUBST(DEFS) +AC_SUBST(CC) +AC_SUBST(CFLAGS) +AC_SUBST(CPPFLAGS) +AC_SUBST(LDFLAGS) + + +# Generate the Makefile and config module + +AC_OUTPUT(Makefile config.ml) +chmod a-w Makefile + + + diff -pruN ocaml-tmk-upstream/curses.ml ocaml-tmk-autoconf/curses.ml --- ocaml-tmk-upstream/curses.ml 2008-04-10 00:17:31.000000000 -0500 +++ ocaml-tmk-autoconf/curses.ml 2008-04-10 00:17:24.000000000 -0500 @@ -179,3 +179,8 @@ module Key = struct #include "keys.ml" let f n = f0 + n end + +module Config = struct +#include "config.ml" +end + diff -pruN ocaml-tmk-upstream/curses.mli ocaml-tmk-autoconf/curses.mli --- ocaml-tmk-upstream/curses.mli 2008-04-10 00:17:31.000000000 -0500 +++ ocaml-tmk-autoconf/curses.mli 2008-04-10 00:17:24.000000000 -0500 @@ -766,3 +766,14 @@ val curs_set : int -> err val napms : int -> unit val ripoffline : bool -> unit val get_ripoff : unit -> window * int + + +(** {2 Configuration} *) + +module Config : +sig + (** If [Curses] has been linked against a curses library with wide + * character support, then [wide_ncurses] is [true]. *) + val wide_ncurses : bool +end + diff -pruN ocaml-tmk-upstream/Makefile ocaml-tmk-autoconf/Makefile --- ocaml-tmk-upstream/Makefile 2008-04-10 00:17:31.000000000 -0500 +++ ocaml-tmk-autoconf/Makefile 1969-12-31 18:00:00.000000000 -0600 @@ -1,78 +0,0 @@ -# $Id: Makefile,v 1.13 2007/11/19 12:00:21 smimram Exp $ - -PACKAGE = ocaml-curses -VERSION = 1.0.3 -CURSES = ncurses -CLIBS = curses - -RESULT = curses -SOURCES = ml_curses.c keys.ml curses.mli curses.ml - -CFLAGS = -g -Wall -LIBINSTALL_FILES = $(wildcard *.mli *.cmi *.cma *.cmxa *.a *.so) -OCAMLDOCFLAGS = -stars - -all: byte - -opt: ncl META - -byte: bcl META - -install: byte libinstall - -uninstall: libuninstall - -test: test.ml byte - $(OCAMLC) -I . -o $@ curses.cma $< - -test.opt: test.ml opt - $(OCAMLOPT) -I . -o $@ curses.cmxa $< - -META: META.in - sed \ - -e 's/@PACKAGE@/curses/' \ - -e 's/@VERSION@/$(VERSION)/' \ - -e 's/@CURSES@/$(CURSES)/' \ - < $< > $@ - -doc: htdoc - -distclean: clean - rm -rf doc/curses - -# Distribution. - -dist: - $(MAKE) check-manifest - rm -rf $(PACKAGE)-$(VERSION) - mkdir $(PACKAGE)-$(VERSION) - tar -cf - -T MANIFEST | tar -C $(PACKAGE)-$(VERSION) -xf - - tar zcf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION) - rm -rf $(PACKAGE)-$(VERSION) - ls -l $(PACKAGE)-$(VERSION).tar.gz - -check-manifest: - @for d in `find -type d -name CVS | grep -v '^\./debian/'`; \ - do \ - b=`dirname $$d`/; \ - awk -F/ '$$1 != "D" {print $$2}' $$d/Entries | \ - sed -e "s|^|$$b|" -e "s|^\./||"; \ - done | grep -v \.cvsignore | sort > .check-manifest; \ - sort MANIFEST > .orig-manifest; \ - diff -u .orig-manifest .check-manifest; rv=$$?; \ - rm -f .orig-manifest .check-manifest; \ - exit $$r - -# Upload to Savannah. - -USER = $(shell whoami) - -upload: - rm -f $(PACKAGE)-$(VERSION).tar.gz.sig - gpg -b $(PACKAGE)-$(VERSION).tar.gz - scp $(PACKAGE)-$(VERSION).tar.gz{,.sig} \ - $(USER)@dl.sv.nongnu.org:/releases/ocaml-tmk - -include OCamlMakefile - -.PHONY: doc diff -pruN ocaml-tmk-upstream/Makefile.in ocaml-tmk-autoconf/Makefile.in --- ocaml-tmk-upstream/Makefile.in 1969-12-31 18:00:00.000000000 -0600 +++ ocaml-tmk-autoconf/Makefile.in 2008-04-10 00:17:24.000000000 -0500 @@ -0,0 +1,81 @@ +# $Id: Makefile,v 1.13 2007/11/19 12:00:21 smimram Exp $ + +PACKAGE = ocaml-curses +VERSION = 1.0.3 +CURSES = ncurses +CLIBS = @CURSES_LIB_BASE@ +DEFS = @DEFS@ + +RESULT = curses +SOURCES = ml_curses.c keys.ml curses.mli curses.ml + +CFLAGS = -g -Wall $(DEFS) +LIBINSTALL_FILES = $(wildcard *.mli *.cmi *.cma *.cmxa *.a *.so) +OCAMLDOCFLAGS = -stars + +all: byte + +opt: ncl META + +byte: bcl META + +install: byte libinstall + +uninstall: libuninstall + +test: test.ml byte + $(OCAMLC) -I . -o $@ curses.cma $< + +test.opt: test.ml opt + $(OCAMLOPT) -I . -o $@ curses.cmxa $< + +META: META.in + sed \ + -e 's/@PACKAGE@/curses/' \ + -e 's/@VERSION@/$(VERSION)/' \ + -e 's/@CURSES@/$(CURSES)/' \ + < $< > $@ + +doc: htdoc + +distclean: clean + rm -rf doc/curses + rm -rf autom4te.cache + rm -f config.log config.status Makefile config.ml + +# Distribution. + +dist: + $(MAKE) check-manifest + rm -rf $(PACKAGE)-$(VERSION) + mkdir $(PACKAGE)-$(VERSION) + tar -cf - -T MANIFEST | tar -C $(PACKAGE)-$(VERSION) -xf - + tar zcf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION) + rm -rf $(PACKAGE)-$(VERSION) + ls -l $(PACKAGE)-$(VERSION).tar.gz + +check-manifest: + @for d in `find -type d -name CVS | grep -v '^\./debian/'`; \ + do \ + b=`dirname $$d`/; \ + awk -F/ '$$1 != "D" {print $$2}' $$d/Entries | \ + sed -e "s|^|$$b|" -e "s|^\./||"; \ + done | grep -v \.cvsignore | sort > .check-manifest; \ + sort MANIFEST > .orig-manifest; \ + diff -u .orig-manifest .check-manifest; rv=$$?; \ + rm -f .orig-manifest .check-manifest; \ + exit $$r + +# Upload to Savannah. + +USER = $(shell whoami) + +upload: + rm -f $(PACKAGE)-$(VERSION).tar.gz.sig + gpg -b $(PACKAGE)-$(VERSION).tar.gz + scp $(PACKAGE)-$(VERSION).tar.gz{,.sig} \ + $(USER)@dl.sv.nongnu.org:/releases/ocaml-tmk + +include OCamlMakefile + +.PHONY: doc diff -pruN ocaml-tmk-upstream/ml_curses.c ocaml-tmk-autoconf/ml_curses.c --- ocaml-tmk-upstream/ml_curses.c 2008-04-10 00:17:31.000000000 -0500 +++ ocaml-tmk-autoconf/ml_curses.c 2008-04-10 00:17:24.000000000 -0500 @@ -5,8 +5,19 @@ #include #include #include + +#ifdef CURSES_HEADER +#include CURSES_HEADER +#else #include +#endif + +#ifdef CURSES_TERM_H +#include CURSES_TERM_H +#else #include +#endif + /* Du travail pour les esclaves de M$ */ #include #include