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.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15727 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Andreas Köhler 2007-03-16 09:20:45 +00:00
parent 02d7e4276c
commit cc00692a51
3 changed files with 35 additions and 10 deletions

View File

@ -139,7 +139,18 @@ AM_CONDITIONAL(PLATFORM_WIN32, test "x$platform_win32" = "xyes")
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
##################################################

View File

@ -341,7 +341,7 @@ function inst_mingwutils() {
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 @@ function inst_inno() {
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 @@ function inst_hh() {
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 @@ function make_chm() {
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
}

View File

@ -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 @@ gnc_show_htmlhelp(const gchar *chmfile, const gchar *anchor)
g_free(wpath);
}
#else /* !HAVE_HTMLHELP_H */
#else /* !HAVE_HTMLHELPW */
void
gnc_show_htmlhelp(const gchar *chmfile, const gchar *anchor)
{
@ -148,4 +148,4 @@ gnc_show_htmlhelp(const gchar *chmfile, const gchar *anchor)
g_free(argv[1]);
}
#endif /* HAVE_HTMLHELP_H */
#endif /* HAVE_HTMLHELPW */