summaryrefslogtreecommitdiff
path: root/libgphoto2_port/gphoto-m4/gp-manual-w3m.m4
blob: fc77352b7c8f600bcf5a467668f6eb91e930a105 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# gp-manual-w3m.m4 - look for w3m tool for html>txt conversion -*- Autoconf -*-
# serial 13
dnl | Increment the above serial number every time you edit this file.
dnl | When it finds multiple m4 files with the same name,
dnl | aclocal will use the one with the highest serial.
dnl
dnl ---------------------------------------------------------------------------
dnl w3m: This program is needed for converting HTML to text.
dnl ---------------------------------------------------------------------------
AC_DEFUN([GP_CHECK_W3M],
[

try_w3m=true
have_w3m=false
AC_ARG_WITH(w3m, [  --without-w3m         Don't use w3m],[
	if test "x$withval" = "xno"; then
		try_w3m=false
	fi])
if $try_w3m; then
	AC_PATH_PROG(W3M,w3m)
	if test -n "${W3M}"; then
		have_w3m=true
	fi
fi
if $have_w3m; then
	AC_MSG_CHECKING([whether ${W3M} works])
        cat > html2text-test.xxxhtml 2> /dev/null <<EOF
<html>
<title>
<h1>HTML2TEXT Test</h1>
</title>
<body>
<p>This is a test.</p>
</body>
</html>
EOF
	${W3M} -T text/html -cols 78 -dump html2text-test.xxxhtml > html2text-test.txt
        if test $? != 0 || test ! -f html2text-test.txt || test ! -s html2text-test.txt
        then
                have_w3m=false
		AC_MSG_RESULT([no (see http://www.w3m.org/ or http://w3m.sourceforge.net/ ...)])
		W3M=false
		AC_SUBST(W3M)
	else
		AC_MSG_RESULT([yes])
		AC_SUBST(W3M)
        fi
fi
AM_CONDITIONAL([HAVE_W3M], [$have_w3m])

])
dnl
dnl
dnl ####################################################################
dnl
dnl Local Variables:
dnl mode: autoconf
dnl End: