summaryrefslogtreecommitdiff
blob: a3b2b9d1835aadafc22d07fc6d69694b6b8770e4 (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
From 8506e3b61dca2861b594c3cea2dc4e0470aad4fc Mon Sep 17 00:00:00 2001
From: Gilles Dartiguelongue <eva@gentoo.org>
Date: Sun, 26 Sep 2010 18:48:04 +0200
Subject: [PATCH 01/13] Allow selection of a specific syntax highlighter, bug #628611.

---
 configure.ac |   53 +++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 43 insertions(+), 10 deletions(-)

diff --git a/configure.ac b/configure.ac
index 3d7c8e1..9dada11 100644
--- a/configure.ac
+++ b/configure.ac
@@ -100,26 +100,59 @@ JH_CHECK_XML_CATALOG([http://docbook.sourceforge.net/release/xsl/current/html/ch
 dnl
 dnl Check for syntax highlighters
 dnl
+AC_ARG_WITH([highlight],
+	AS_HELP_STRING([--with-highlight], [Select source code syntax highlighter (no|source-highlight|highlight|vim|auto)]),
+	, [with_highlight=auto])
+
+case $with_highlight in
+	no|source-highlight|highlight|vim|auto) ;;
+	*) AC_MSG_ERROR([Invalid value for syntax highlighting option.]) ;;
+esac
+
 HIGHLIGHT_OPTIONS=""
-AC_PATH_PROG([HIGHLIGHT], [source-highlight])
-if test -n "$HIGHLIGHT"; then
-	HIGHLIGHT_OPTIONS="-t4 -sc -cstyle.css --no-doc -i"
-else
-	AC_PATH_PROG([HIGHLIGHT], [highlight])
+if test "$with_highlight" = "auto"; then
+	AC_PATH_PROG([HIGHLIGHT], [source-highlight])
 	if test -n "$HIGHLIGHT"; then
-		HIGHLIGHT_OPTIONS="-X -f --class-name=gtkdoc "
+		HIGHLIGHT_OPTIONS="-t4 -sc -cstyle.css --no-doc -i"
 	else
-		AC_PATH_PROG([HIGHLIGHT], [vim])
+		AC_PATH_PROG([HIGHLIGHT], [highlight])
 		if test -n "$HIGHLIGHT"; then
-			dnl vim is useless if it does not support syntax highlighting
+			HIGHLIGHT_OPTIONS="-X -f --class-name=gtkdoc "
+		else
+			AC_PATH_PROG([HIGHLIGHT], [vim])
+			if test -n "$HIGHLIGHT"; then
+				dnl vim is useless if it does not support syntax highlighting
+				AC_MSG_CHECKING([whether vim has +syntax feature])
+				if $HIGHLIGHT --version | grep '+syntax' >/dev/null; then
+					AC_MSG_RESULT([yes])
+				else
+					AC_MSG_RESULT([no])
+					HIGHLIGHT=
+				fi
+			fi
+		fi
+	fi
+else
+	if test "$with_highlight" != "no"; then
+		AC_PATH_PROG([HIGHLIGHT], [$with_highlight], [no])
+	fi
+
+	case $with_highlight in
+		source-highlight) HIGHLIGHT_OPTIONS="-t4 -sc -cstyle.css --no-doc -i";;
+		highlight) HIGHLIGHT_OPTIONS="-X -f --class-name=gtkdoc ";;
+		vim)
 			AC_MSG_CHECKING([whether vim has +syntax feature])
 			if $HIGHLIGHT --version | grep '+syntax' >/dev/null; then
 				AC_MSG_RESULT([yes])
 			else
 				AC_MSG_RESULT([no])
-				HIGHLIGHT=
+				HIGHLIGHT=no
 			fi
-		fi
+		;;
+	esac
+
+	if test "$HIGHLIGHT" = "no" && test "$with_highlight" != "no"; then
+		AC_MSG_ERROR([Could not find requested syntax highlighter])
 	fi
 fi
 AC_SUBST([HIGHLIGHT_OPTIONS])
-- 
1.7.3.1