APPROVE COMMIT 21.5
Not relevant to 21.4.
Recent versions of Canna (a input method for Japanese) have changed
the way that they handle wide characters, and require that
CANNA_NEW_WCHAR_AWARE be #define'd to indicate that the application
has been fixed to deal with the API change. Jerry (IIRC) added the
needed #define to modules/canna/canna_api.c, but this isn't available
to the configure test for RK.h. Now that autoconf in its infinite
wisdom is moving toward enforcing a compile test for header files, we
may as well get this right.
This patch refactors the Canna detection, uses have_canna instead of
with_canna to track progress of detection, and also removes some
really ancient cruft (the CANNA2 flag; Canna 1 was obsoleted a decade
ago, and I doubt the code still works).
Tested on Mac OS X 10.4.8 and 10.3.9 and on Gentoo Linux. Patch for
the generated configure script omitted.
Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/ChangeLog,v
retrieving revision 1.521
diff -u -U0 -r1.521 ChangeLog
--- ChangeLog 14 Feb 2007 07:35:07 -0000 1.521
+++ ChangeLog 15 Feb 2007 15:50:47 -0000
@@ -0,0 +1,9 @@
+2007-02-16 Stephen J. Turnbull <stephen(a)xemacs.org>
+
+ * configure.ac (canna):
+ Move #define of CANNA_NEW_WCHAR_AWARE to config.h.
+ Use -DCANNA_NEW_WCHAR_AWARE since check for RK.h fails otherwise.
+ Refactor into loops over orthogonal tweaks (prefix and define).
+ Use have_canna to track detection success, not with_canna.
+ Add AC_MSG_WARNs documenting autoconf's bogosity (ours, too).
+
Index: modules/ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/modules/ChangeLog,v
retrieving revision 1.60
diff -u -U0 -r1.60 ChangeLog
--- modules/ChangeLog 8 Feb 2007 21:26:03 -0000 1.60
+++ modules/ChangeLog 15 Feb 2007 15:50:47 -0000
@@ -0,0 +1,5 @@
+2007-02-16 Stephen J. Turnbull <stephen(a)xemacs.org>
+
+ * canna/canna_api.c: Move CANNA_NEW_WCHAR_AWARE to config.h.
+ Clean up ancient cruft for IROHA (Canna v.1) support.
+
Index: src/ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/ChangeLog,v
retrieving revision 1.1043
diff -u -U0 -r1.1043 ChangeLog
--- src/ChangeLog 6 Feb 2007 20:01:40 -0000 1.1043
+++ src/ChangeLog 15 Feb 2007 15:50:53 -0000
@@ -0,0 +1,5 @@
+2007-02-16 Stephen J. Turnbull <stephen(a)xemacs.org>
+
+ * config.h.in: Move CANNA_NEW_WCHAR_AWARE here from canna_api.c.
+ Remove crufty CANNA2 define, we can't support CANNA1 (IROHA).
+
Index: configure.ac
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/configure.ac,v
retrieving revision 1.54
diff -u -r1.54 configure.ac
--- configure.ac 28 Dec 2006 12:56:04 -0000 1.54
+++ configure.ac 15 Feb 2007 15:49:35 -0000
@@ -4594,35 +4594,51 @@
fi
fi
- dnl Autodetect canna
+ dnl Configure canna
dnl canna_libs variable is initialized at toplevel
- canna_includes_found=no
+ dnl #### the hard-coding of /usr/local/canna/include is bogus and
+ dnl my Mac OS X 10.4 system needs /usr/local/canna/lib, too
+ dnl #### this whole mess should be in modules/canna, no? maybe not
+ have_canna=no
if test "$with_canna" != "no"; then
- AC_CHECK_HEADER(canna/jrkanji.h,canna_includes_found=yes)
- fi
- if test "$canna_includes_found" = "no" -a "$with_canna"
!= "no" -a \
- -d "/usr/local/canna/include"; then
save_c_switch_site="$c_switch_site"
- c_switch_site="$c_switch_site -I/usr/local/canna/include"
- AC_CHECK_HEADER(canna/jrkanji.h,canna_includes_found=yes)
- if test "$canna_includes_found" != "yes"; then
+ for canna_include_path in "" " -I/usr/local/canna/include"; do
+ for canna_wchar_aware in "" " -DCANNA_NEW_WCHAR_AWARE=1"; do
+
c_switch_site="$save_c_switch_site$canna_include_path$canna_wchar_aware"
+ # defeat autoconf's cache mechanism
+ $as_unset ac_cv_header_canna_jrkanji_h
+ $as_unset ac_cv_header_canna_RK_h
+ # using $ac_header_compiler is a hack, but autoconf doesn't let us
+ # get at this information otherwise :-(
+
AC_CHECK_HEADER(canna/jrkanji.h,[AC_CHECK_HEADER(canna/RK.h,have_canna=$ac_header_compiler)])
+ test "$have_canna" = "yes" && break
+ AC_MSG_WARN([You may ignore any *Present but not compiled* message
+ from autoconf. We detect that condition and recheck, but there
+ is no way to suppress autoconf's message.])
+ done
+ test "$have_canna" = "yes" && break
+ done
+ if test "$have_canna" = "yes"; then
+ c_switch_site="$save_c_switch_site$canna_include_path"
+ else
c_switch_site="$save_c_switch_site"
- with_canna="no"
fi
fi
- test -z "$with_canna" && { AC_CHECK_HEADER(canna/RK.h, ,
with_canna=no) }
- test -z "$with_canna" && { AC_CHECK_LIB(RKC, RkBgnBun,
[:],with_canna=no) }
- test -z "$with_canna" && {
AC_CHECK_LIB(canna,jrKanjiControl,[:],with_canna=no) }
- test -z "$with_canna" && with_canna=yes
- if test "$with_canna" = "yes"; then
+ test "$have_canna" = "yes" && { AC_CHECK_LIB(RKC, RkBgnBun,
[:],have_canna=no) }
+ test "$have_canna" = "yes" && {
AC_CHECK_LIB(canna,jrKanjiControl,[:],have_canna=no) }
+ if test "$have_canna" = "yes"; then
AC_DEFINE(HAVE_CANNA)
+ test -n "$canna_wchar_aware" && AC_DEFINE(CANNA_NEW_WCHAR_AWARE)
XE_APPEND(modules/canna, MAKE_SUBDIR)
need_modules_common=yes
if test "$with_modules" = "yes"; then
XE_APPEND(modules/canna, INSTALL_ARCH_DEP_SUBDIR)
fi
XE_PREPEND(-lcanna -lRKC, canna_libs)
+ elif test "$with_canna" != "no"; then
+ AC_MSG_WARN([Canna configuration failed. If you expected success,
+maybe you need --with-site-prefixes=/usr/local/canna?])
fi
AC_SUBST(canna_libs)
@@ -6098,7 +6114,7 @@
test "$with_xim" = motif && echo " - Using Motif to provide XIM
support."
test "$with_xim" = xlib && echo " - Using raw Xlib to provide
XIM support."
test "$with_xfs" = yes && echo " - Using XFontSet to provide
bilingual menubar."
-test "$with_canna" = yes && echo " Compiling in support for Canna
on Mule."
+test "$have_canna" = yes && echo " Compiling in support for Canna
on Mule."
if test "$with_wnn" = yes; then
echo " Compiling in support for the WNN input method on Mule."
test "$with_wnn6" = yes && echo " - Using WNN version
6."
Index: modules/canna/canna_api.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/modules/canna/canna_api.c,v
retrieving revision 1.3
diff -u -r1.3 canna_api.c
--- modules/canna/canna_api.c 16 Nov 2005 07:14:16 -0000 1.3
+++ modules/canna/canna_api.c 15 Feb 2007 15:49:36 -0000
@@ -161,17 +161,14 @@
#include "buffer.h"
#include "file-coding.h"
-#ifdef CANNA2
+/* iroha (Canna v1) support removed as of canna_api.c r1.4.
+ #### Is the IROHA_BC #define needed? */
#define IROHA_BC
-#define CANNA_NEW_WCHAR_AWARE
#include "canna/jrkanji.h"
#include "canna/RK.h"
-#else /* !CANNA2 */
-#include "iroha/jrkanji.h"
-#include "iroha/RK.h"
-#endif /* !CANNA2 */
-extern char *jrKanjiError;
+/* #### These shouldn't be needed any more. */
+extern char *jrKanjiError;
extern int (*jrBeepFunc) (void);
/* #### is this global really necessary? */
Index: src/config.h.in
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/config.h.in,v
retrieving revision 1.110
diff -u -r1.110 config.h.in
--- src/config.h.in 11 Dec 2006 19:44:56 -0000 1.110
+++ src/config.h.in 15 Feb 2007 15:49:42 -0000
@@ -677,6 +677,7 @@
/* Non-XIM input methods for use with Mule. */
#undef HAVE_CANNA
+#undef CANNA_NEW_WCHAR_AWARE
#undef HAVE_WNN
#undef WNN6
@@ -1046,7 +1047,6 @@
#endif
#ifdef HAVE_CANNA
-# define CANNA2
# define CANNA_MULE
# define CANNA_PURESIZE 0
#else /* not CANNA */
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches