changeset 3830:e58f4b9ab1ad

[xemacs-hg @ 2007-02-15 16:11:52 by stephent] Adapt canna autodetection to current reality. <878xeze6qj.fsf@uwakimon.sk.tsukuba.ac.jp>
author stephent
date Thu, 15 Feb 2007 16:12:19 +0000
parents 5320274f018b
children 84e2628aeb1c
files ChangeLog configure configure.ac modules/ChangeLog modules/canna/canna_api.c src/ChangeLog src/config.h.in
diffstat 7 files changed, 106 insertions(+), 196 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Feb 14 22:51:17 2007 +0000
+++ b/ChangeLog	Thu Feb 15 16:12:19 2007 +0000
@@ -1,3 +1,12 @@
+2007-02-16  Stephen J. Turnbull  <stephen@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).
+
 2007-01-01  Malcolm Purvis  <malcolmp@xemacs.org>
 
 	* aclocal.m4 (XE_SHLIB_STUFF): Use $EGREP instead of egrep.
--- a/configure	Wed Feb 14 22:51:17 2007 +0000
+++ b/configure	Thu Feb 15 16:12:19 2007 +0000
@@ -28680,156 +28680,18 @@
     fi
   fi
 
-      canna_includes_found=no
+            have_canna=no
   if test "$with_canna" != "no"; then
-    if test "${ac_cv_header_canna_jrkanji_h+set}" = set; then
-  echo "$as_me:$LINENO: checking for canna/jrkanji.h" >&5
-echo $ECHO_N "checking for canna/jrkanji.h... $ECHO_C" >&6
-if test "${ac_cv_header_canna_jrkanji_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_canna_jrkanji_h" >&5
-echo "${ECHO_T}$ac_cv_header_canna_jrkanji_h" >&6
-else
-  # Is the header compilable?
-echo "$as_me:$LINENO: checking canna/jrkanji.h usability" >&5
-echo $ECHO_N "checking canna/jrkanji.h usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <canna/jrkanji.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking canna/jrkanji.h presence" >&5
-echo $ECHO_N "checking canna/jrkanji.h presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <canna/jrkanji.h>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: canna/jrkanji.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: canna/jrkanji.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: canna/jrkanji.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: canna/jrkanji.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: canna/jrkanji.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: canna/jrkanji.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: canna/jrkanji.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: canna/jrkanji.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: canna/jrkanji.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: canna/jrkanji.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: canna/jrkanji.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: canna/jrkanji.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: canna/jrkanji.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: canna/jrkanji.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: canna/jrkanji.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: canna/jrkanji.h: in the future, the compiler will take precedence" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------- ##
-## Report this to xemacs-beta@xemacs.org ##
-## ------------------------------------- ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-echo "$as_me:$LINENO: checking for canna/jrkanji.h" >&5
-echo $ECHO_N "checking for canna/jrkanji.h... $ECHO_C" >&6
-if test "${ac_cv_header_canna_jrkanji_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_cv_header_canna_jrkanji_h=$ac_header_preproc
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_canna_jrkanji_h" >&5
-echo "${ECHO_T}$ac_cv_header_canna_jrkanji_h" >&6
-
-fi
-if test $ac_cv_header_canna_jrkanji_h = yes; then
-  canna_includes_found=yes
-fi
-
-
-  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"
-    if test "${ac_cv_header_canna_jrkanji_h+set}" = set; 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 :-(
+        if test "${ac_cv_header_canna_jrkanji_h+set}" = set; then
   echo "$as_me:$LINENO: checking for canna/jrkanji.h" >&5
 echo $ECHO_N "checking for canna/jrkanji.h... $ECHO_C" >&6
 if test "${ac_cv_header_canna_jrkanji_h+set}" = set; then
@@ -28967,17 +28829,7 @@
 
 fi
 if test $ac_cv_header_canna_jrkanji_h = yes; then
-  canna_includes_found=yes
-fi
-
-
-    if test "$canna_includes_found" != "yes"; then
-      c_switch_site="$save_c_switch_site"
-      with_canna="no"
-    fi
-  fi
-
-  test -z "$with_canna" && { if test "${ac_cv_header_canna_RK_h+set}" = set; then
+  if test "${ac_cv_header_canna_RK_h+set}" = set; then
   echo "$as_me:$LINENO: checking for canna/RK.h" >&5
 echo $ECHO_N "checking for canna/RK.h... $ECHO_C" >&6
 if test "${ac_cv_header_canna_RK_h+set}" = set; then
@@ -29115,13 +28967,31 @@
 
 fi
 if test $ac_cv_header_canna_RK_h = yes; then
-  :
-else
-  with_canna=no
-fi
-
- }
-  test -z "$with_canna" && { echo "$as_me:$LINENO: checking for RkBgnBun in -lRKC" >&5
+  have_canna=$ac_header_compiler
+fi
+
+
+fi
+
+
+        test "$have_canna" = "yes" && break
+        { echo "$as_me:$LINENO: WARNING: 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." >&5
+echo "$as_me: WARNING: 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." >&2;}
+      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"
+    fi
+  fi
+
+  test "$have_canna" = "yes" && { echo "$as_me:$LINENO: checking for RkBgnBun in -lRKC" >&5
 echo $ECHO_N "checking for RkBgnBun in -lRKC... $ECHO_C" >&6
 if test "${ac_cv_lib_RKC_RkBgnBun+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -29188,10 +29058,10 @@
 if test $ac_cv_lib_RKC_RkBgnBun = yes; then
   :
 else
-  with_canna=no
+  have_canna=no
 fi
  }
-  test -z "$with_canna" && { echo "$as_me:$LINENO: checking for jrKanjiControl in -lcanna" >&5
+  test "$have_canna" = "yes" && { echo "$as_me:$LINENO: checking for jrKanjiControl in -lcanna" >&5
 echo $ECHO_N "checking for jrKanjiControl in -lcanna... $ECHO_C" >&6
 if test "${ac_cv_lib_canna_jrKanjiControl+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -29258,21 +29128,29 @@
 if test $ac_cv_lib_canna_jrKanjiControl = yes; then
   :
 else
-  with_canna=no
+  have_canna=no
 fi
  }
-  test -z "$with_canna" && with_canna=yes
-  if test "$with_canna" = "yes"; then
+  if test "$have_canna" = "yes"; then
     cat >>confdefs.h <<\_ACEOF
 #define HAVE_CANNA 1
 _ACEOF
 
+    test -n "$canna_wchar_aware" && cat >>confdefs.h <<\_ACEOF
+#define CANNA_NEW_WCHAR_AWARE 1
+_ACEOF
+
     MAKE_SUBDIR="$MAKE_SUBDIR modules/canna" &&  if test "$verbose" = "yes"; then echo "    Appending \"modules/canna\" to \$MAKE_SUBDIR"; fi
     need_modules_common=yes
     if test "$with_modules" = "yes"; then
       INSTALL_ARCH_DEP_SUBDIR="$INSTALL_ARCH_DEP_SUBDIR modules/canna" &&  if test "$verbose" = "yes"; then echo "    Appending \"modules/canna\" to \$INSTALL_ARCH_DEP_SUBDIR"; fi
     fi
     canna_libs="-lcanna -lRKC $canna_libs" &&  if test "$verbose" = "yes"; then echo "    Prepending \"-lcanna -lRKC\" to \$canna_libs"; fi
+  elif test "$with_canna" != "no"; then
+    { echo "$as_me:$LINENO: WARNING: Canna configuration failed.  If you expected success,
+maybe you need --with-site-prefixes=/usr/local/canna?" >&5
+echo "$as_me: WARNING: Canna configuration failed.  If you expected success,
+maybe you need --with-site-prefixes=/usr/local/canna?" >&2;}
   fi
 
 
@@ -39908,7 +39786,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."
--- a/configure.ac	Wed Feb 14 22:51:17 2007 +0000
+++ b/configure.ac	Thu Feb 15 16:12:19 2007 +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."
--- a/modules/ChangeLog	Wed Feb 14 22:51:17 2007 +0000
+++ b/modules/ChangeLog	Thu Feb 15 16:12:19 2007 +0000
@@ -1,3 +1,8 @@
+2007-02-16  Stephen J. Turnbull  <stephen@xemacs.org>
+
+	* canna/canna_api.c: Move CANNA_NEW_WCHAR_AWARE to config.h.
+	Clean up ancient cruft for IROHA (Canna v.1) support.
+
 2007-02-08  Adrian Aichner  <adrian@xemacs.org>
 
 	* postgresql/postgresql.c: Update Steve L. Baur's address on his
--- a/modules/canna/canna_api.c	Wed Feb 14 22:51:17 2007 +0000
+++ b/modules/canna/canna_api.c	Thu Feb 15 16:12:19 2007 +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 */
+
+/* #### These shouldn't be needed any more. */
 extern char *jrKanjiError;
-
 extern int (*jrBeepFunc) (void);
 
 /* #### is this global really necessary? */
--- a/src/ChangeLog	Wed Feb 14 22:51:17 2007 +0000
+++ b/src/ChangeLog	Thu Feb 15 16:12:19 2007 +0000
@@ -1,3 +1,8 @@
+2007-02-16  Stephen J. Turnbull  <stephen@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).
+
 2007-02-06  Aidan Kehoe  <kehoea@parhasard.net>
 
 	* specifier.c (setup_device_initial_specifier_tags):
--- a/src/config.h.in	Wed Feb 14 22:51:17 2007 +0000
+++ b/src/config.h.in	Thu Feb 15 16:12:19 2007 +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 */