r15727 - gnucash/trunk - Harden tests for HtmlHelpW on Windows.

Andreas Köhler andi5 at cvs.gnucash.org
Fri Mar 16 05:20:47 EDT 2007


Author: andi5
Date: 2007-03-16 05:20:45 -0400 (Fri, 16 Mar 2007)
New Revision: 15727
Trac: http://svn.gnucash.org/trac/changeset/15727

Modified:
   gnucash/trunk/configure.in
   gnucash/trunk/packaging/win32/install.sh
   gnucash/trunk/src/app-utils/gnc-help-utils.c
Log:
Harden tests for HtmlHelpW on Windows.

Check both, in install.sh and configure.in, whether we can link a test
source for HtmlHelpW against the html help import library, instead of
just testing for htmlhelp.h or some htmlhelp library thing.


Modified: gnucash/trunk/configure.in
===================================================================
--- gnucash/trunk/configure.in	2007-03-15 21:33:03 UTC (rev 15726)
+++ gnucash/trunk/configure.in	2007-03-16 09:20:45 UTC (rev 15727)
@@ -139,7 +139,18 @@
 
 if test "x$native_win32" = "xyes" ; then
   HTMLHELP_LIBS=
-  AC_CHECK_HEADERS(htmlhelp.h,[HTMLHELP_LIBS=-lhtmlhelp],,[#include <windows.h>])
+  AC_MSG_CHECKING(for HtmlHelpW)
+  saved_LIBS="${LIBS}"
+  LIBS="${LIBS} -lhtmlhelp"
+  AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <windows.h>
+  #include <htmlhelp.h>]], [HtmlHelpW(0, (wchar_t*)"", HH_HELP_CONTEXT, 0);])], [
+    AC_MSG_RESULT(yes)
+    HTMLHELP_LIBS=-lhtmlhelp
+    AC_DEFINE(HAVE_HTMLHELPW,1,[System has HtmlHelpW])
+  ], [
+    AC_MSG_RESULT(no)
+  ])
+  LIBS="${saved_LIBS}"
   AC_SUBST(HTMLHELP_LIBS)
 fi
 ##################################################

Modified: gnucash/trunk/packaging/win32/install.sh
===================================================================
--- gnucash/trunk/packaging/win32/install.sh	2007-03-15 21:33:03 UTC (rev 15726)
+++ gnucash/trunk/packaging/win32/install.sh	2007-03-16 09:20:45 UTC (rev 15727)
@@ -341,7 +341,7 @@
     else
         wget_unpacked $MINGW_UTILS_URL $DOWNLOAD_DIR $MINGW_UTILS_DIR
     fi
-    (quiet which pexports && quiet which reimp) || die "pexports unavailable"
+    (quiet which pexports && quiet which reimp) || die "mingw-utils not installed correctly"
 }
 
 function inst_exetype() {
@@ -636,13 +636,27 @@
     quiet which iscc || die "iscc (Inno Setup Compiler) not installed correctly"
 }
 
+function test_for_hh() {
+    qpushd $TMP_UDIR
+        cat > ofile.c <<EOF
+#include <windows.h>
+#include <htmlhelp.h>
+int main(int argc, char **argv) {
+  HtmlHelpW(0, (wchar_t*)"", HH_HELP_CONTEXT, 0);
+  return 0;
+}
+EOF
+        gcc -o ofile.exe ofile.c $HH_CPPFLAGS $HH_LDFLAGS -lhtmlhelp || return 1
+    qpopd
+}
+
 function inst_hh() {
     setup HTML Help Workshop
     _HH_UDIR=`unix_path $HH_DIR`
     add_to_env -I$_HH_UDIR/include HH_CPPFLAGS
     add_to_env -L$_HH_UDIR/lib HH_LDFLAGS
     add_to_env $_HH_UDIR PATH
-    if quiet ${LD} $HH_LDFLAGS -lhtmlhelp -o $TMP_UDIR/ofile
+    if quiet test_for_hh
     then
         echo "html help workshop already installed.  skipping."
     else
@@ -657,7 +671,7 @@
            mv htmlhelp.lib htmlhelp.lib.bak
         qpopd
     fi
-    quiet ${LD} $HH_LDFLAGS -lhtmlhelp -o $TMP_UDIR/ofile || die "html help workshop not installed correctly"
+    quiet test_for_hh || die "html help workshop not installed correctly"
 }
 
 function inst_opensp() {
@@ -983,8 +997,8 @@
         cat mymaps >> htmlhelp.hhp
         rm mymaps
         hhc htmlhelp.hhp || true
-        mv -fv htmlhelp.chm $_DOCS_INST_UDIR/$_CHM_LANG/gnucash-$_CHM_TYPE.chm
-        mv -fv htmlhelp.hhmap $_DOCS_INST_UDIR/$_CHM_LANG/gnucash-$_CHM_TYPE.hhmap
+        cp -fv htmlhelp.chm $_DOCS_INST_UDIR/$_CHM_LANG/gnucash-$_CHM_TYPE.chm
+        cp -fv htmlhelp.hhmap $_DOCS_INST_UDIR/$_CHM_LANG/gnucash-$_CHM_TYPE.hhmap
     qpopd
 }
 

Modified: gnucash/trunk/src/app-utils/gnc-help-utils.c
===================================================================
--- gnucash/trunk/src/app-utils/gnc-help-utils.c	2007-03-15 21:33:03 UTC (rev 15726)
+++ gnucash/trunk/src/app-utils/gnc-help-utils.c	2007-03-16 09:20:45 UTC (rev 15727)
@@ -23,14 +23,14 @@
 #include "config.h"
 #include <glib.h>
 
-#ifdef HAVE_HTMLHELP_H
+#ifdef HAVE_HTMLHELPW
 #    include <windows.h>
 #    include <htmlhelp.h>
 #endif
 
 #include "gnc-help-utils.h"
 
-#ifdef HAVE_HTMLHELP_H
+#ifdef HAVE_HTMLHELPW
 
 static GHashTable *
 parse_hhmap_file(const gchar *chmfile)
@@ -129,7 +129,7 @@
     g_free(wpath);
 }
 
-#else /* !HAVE_HTMLHELP_H */
+#else /* !HAVE_HTMLHELPW */
 void
 gnc_show_htmlhelp(const gchar *chmfile, const gchar *anchor)
 {
@@ -148,4 +148,4 @@
 
     g_free(argv[1]);
 }
-#endif /* HAVE_HTMLHELP_H */
+#endif /* HAVE_HTMLHELPW */



More information about the gnucash-changes mailing list