File: xerces_msgloader_selection.m4

package info (click to toggle)
xerces-c 3.2.4%2Bdebian-1.3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 19,948 kB
  • sloc: cpp: 167,201; xml: 23,619; sh: 4,789; ansic: 3,988; makefile: 1,438; perl: 355; javascript: 18
file content (138 lines) | stat: -rw-r--r-- 4,160 bytes parent folder | download | duplicates (4)
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
dnl @synopsis XERCES_MSGLOADER_SELECTION
dnl
dnl Determine which msgloader to use.
dnl
dnl @category C
dnl @author James Berry
dnl @version 2005-05-23
dnl @license AllPermissive
dnl
dnl $Id$

AC_DEFUN([XERCES_MSGLOADER_SELECTION],
	[

	######################################################
	# Test for availability of each msgloader on this host.
	# For each msgloader that's available, and hasn't been disabled, add it to our list.
	# If the msgloader has been explicitly "enable"d, then vote for it strongly,
	# in upper case.
	######################################################

	ml_list=

	# Check for inmemory msgloader
	AC_MSG_CHECKING([whether we support the InMemory MsgLoader])
	list_add=
	AS_IF([true], [
		AC_ARG_ENABLE([msgloader-inmemory],
			AS_HELP_STRING([--enable-msgloader-inmemory],
				[Enable InMemory MsgLoader support]),
			[AS_IF([test x"$enableval" = xyes],
				[list_add=INMEMORY])],
			[list_add=inmemory])
	])
	AS_IF([test x"$list_add" != x],
		[ml_list="$ml_list -$list_add-"; AC_MSG_RESULT(yes)],
		[AC_MSG_RESULT(no)]
	)

	# Check for ICU
	AC_REQUIRE([XERCES_ICU_PREFIX])
	AC_MSG_CHECKING([whether we support the ICU MsgLoader])
	list_add=
	AS_IF([test x"$xerces_cv_icu_present" != x"no"], [
		AC_ARG_ENABLE([msgloader-icu],
			AS_HELP_STRING([--enable-msgloader-icu],
				[Enable ICU-based MsgLoader support]),
			[AS_IF([test x"$enableval" = xyes],
				[list_add=ICU])],
			[list_add=icu])
	])
	AS_IF([test x"$list_add" != x],
		[ml_list="$ml_list -$list_add-"; AC_MSG_RESULT(yes)],
		[AC_MSG_RESULT(no)]
	)

	# Check for iconv support
	no_iconv=false
	AC_CHECK_HEADERS([nl_types.h], [], [no_iconv=true])
	AC_CHECK_FUNCS([catopen catclose catgets], [], [no_iconv=true])
	AC_MSG_CHECKING([whether we can support the iconv MsgLoader])
	list_add=
	AS_IF([! $no_iconv], [
		AC_ARG_ENABLE([msgloader-iconv],
			AS_HELP_STRING([--enable-msgloader-iconv],
				[Enable Iconv-based MsgLoader support]),
			[AS_IF([test x"$enableval" = xyes],
				[list_add=ICONV])],
			[list_add=iconv])
	])
	AS_IF([test x"$list_add" != x],
		[ml_list="$ml_list -$list_add-"; AC_MSG_RESULT(yes)],
		[AC_MSG_RESULT(no)]
	)

	# TODO: Add test for additional msgloaders


	######################################################
	# Determine which msgloader to use.
	#
	# We do this in two passes. MsgLoaders that have been enabled with "yes",
	# and which start out in upper case, get the top priority on the first pass.
	# On the second pass, we consider those which are simply available, but
	# which were not "disable"d (these won't even be in our list).
	######################################################
	msgloader=
	az_lower=abcdefghijklmnopqrstuvwxyz
	az_upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
	AC_MSG_CHECKING([for which MsgLoader to use (choices:$ml_list)])
	for i in 1 2; do
		# Swap upper/lower case in the ml_list. Cannot use tr ranges
                # because of the portability issues.
                #
		ml_list=`echo $ml_list | tr "$az_lower$az_upper" "$az_upper$az_lower"`

		# Check for each msgloader, in implicit rank order
		case $ml_list in
		*-inmemory-*)
			AC_DEFINE([XERCES_USE_MSGLOADER_INMEMORY], 1, [Define to use the InMemory MsgLoader])
			msgloader=inmemory
			break
			;;

		*-icu-*)
			AC_DEFINE([XERCES_USE_MSGLOADER_ICU], 1, [Define to use the ICU-based MsgLoader])
			msgloader=icu
			LIBS="${LIBS} ${xerces_cv_icu_libs}"
			break
			;;

		*-iconv-*)
			AC_DEFINE([XERCES_USE_MSGLOADER_ICONV], 1, [Define to use the iconv-based MsgLoader])
			msgloader=iconv
			break
			;;

		*)
			AS_IF([test $i -eq 2], [
				AC_MSG_RESULT([none])
				AC_MSG_ERROR([Xerces cannot function without a MsgLoader])
				]
			)
			;;
		esac
	done
	if test x"$msgloader" != x; then
		AC_MSG_RESULT($msgloader)
	fi

	# Define the auto-make conditionals which determine what actually gets compiled
	# Note that these macros can't be executed conditionally, which is why they're here, not above.
	AM_CONDITIONAL([XERCES_USE_MSGLOADER_ICU], 	[test x"$msgloader" = xicu])
	AM_CONDITIONAL([XERCES_USE_MSGLOADER_ICONV], 	[test x"$msgloader" = xiconv])
	AM_CONDITIONAL([XERCES_USE_MSGLOADER_INMEMORY],	[test x"$msgloader" = xinmemory])

	]
)