source: Xerces/m4/xerces_msgloader_selection.m4 @ 835

Last change on this file since 835 was 721, checked in by lindanl, 9 years ago

Add the original Xerces code (version 3.1.1)

File size: 4.1 KB
Line 
1dnl @synopsis XERCES_MSGLOADER_SELECTION
2dnl
3dnl Determine which msgloader to use.
4dnl
5dnl @category C
6dnl @author James Berry
7dnl @version 2005-05-23
8dnl @license AllPermissive
9dnl
10dnl $Id: xerces_msgloader_selection.m4 835245 2009-11-12 05:57:31Z borisk $
11
12AC_DEFUN([XERCES_MSGLOADER_SELECTION],
13        [
14
15        ######################################################
16        # Test for availability of each msgloader on this host.
17        # For each msgloader that's available, and hasn't been disabled, add it to our list.
18        # If the msgloader has been explicitly "enable"d, then vote for it strongly,
19        # in upper case.
20        ######################################################
21
22        ml_list=
23
24        # Check for inmemory msgloader
25        AC_MSG_CHECKING([whether we support the InMemory MsgLoader])
26        list_add=
27        AS_IF([true], [
28                AC_ARG_ENABLE([msgloader-inmemory],
29                        AS_HELP_STRING([--enable-msgloader-inmemory],
30                                [Enable InMemory MsgLoader support]),
31                        [AS_IF([test x"$enableval" = xyes],
32                                [list_add=INMEMORY])],
33                        [list_add=inmemory])
34        ])
35        AS_IF([test x"$list_add" != x],
36                [ml_list="$ml_list -$list_add-"; AC_MSG_RESULT(yes)],
37                [AC_MSG_RESULT(no)]
38        )
39
40        # Check for ICU
41        AC_REQUIRE([XERCES_ICU_PREFIX])
42        AC_MSG_CHECKING([whether we support the ICU MsgLoader])
43        list_add=
44        AS_IF([test x"$xerces_cv_icu_present" != x"no"], [
45                AC_ARG_ENABLE([msgloader-icu],
46                        AS_HELP_STRING([--enable-msgloader-icu],
47                                [Enable ICU-based MsgLoader support]),
48                        [AS_IF([test x"$enableval" = xyes],
49                                [list_add=ICU])],
50                        [list_add=icu])
51        ])
52        AS_IF([test x"$list_add" != x],
53                [ml_list="$ml_list -$list_add-"; AC_MSG_RESULT(yes)],
54                [AC_MSG_RESULT(no)]
55        )
56
57        # Check for iconv support
58        no_iconv=false
59        AC_CHECK_HEADERS([nl_types.h], [], [no_iconv=true])
60        AC_CHECK_FUNCS([catopen catclose catgets], [], [no_iconv=true])
61        AC_MSG_CHECKING([whether we can support the iconv MsgLoader])
62        list_add=
63        AS_IF([! $no_iconv], [
64                AC_ARG_ENABLE([msgloader-iconv],
65                        AS_HELP_STRING([--enable-msgloader-iconv],
66                                [Enable Iconv-based MsgLoader support]),
67                        [AS_IF([test x"$enableval" = xyes],
68                                [list_add=ICONV])],
69                        [list_add=iconv])
70        ])
71        AS_IF([test x"$list_add" != x],
72                [ml_list="$ml_list -$list_add-"; AC_MSG_RESULT(yes)],
73                [AC_MSG_RESULT(no)]
74        )
75
76        # TODO: Add test for additional msgloaders
77
78
79        ######################################################
80        # Determine which msgloader to use.
81        #
82        # We do this in two passes. MsgLoaders that have been enabled with "yes",
83        # and which start out in upper case, get the top priority on the first pass.
84        # On the second pass, we consider those which are simply available, but
85        # which were not "disable"d (these won't even be in our list).
86        ######################################################
87        msgloader=
88        az_lower=abcdefghijklmnopqrstuvwxyz
89        az_upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
90        AC_MSG_CHECKING([for which MsgLoader to use (choices:$ml_list)])
91        for i in 1 2; do
92                # Swap upper/lower case in the ml_list. Cannot use tr ranges
93                # because of the portability issues.
94                #
95                ml_list=`echo $ml_list | tr "$az_lower$az_upper" "$az_upper$az_lower"`
96
97                # Check for each msgloader, in implicit rank order
98                case $ml_list in
99                *-inmemory-*)
100                        AC_DEFINE([XERCES_USE_MSGLOADER_INMEMORY], 1, [Define to use the InMemory MsgLoader])
101                        msgloader=inmemory
102                        break
103                        ;;
104
105                *-icu-*)
106                        AC_DEFINE([XERCES_USE_MSGLOADER_ICU], 1, [Define to use the ICU-based MsgLoader])
107                        msgloader=icu
108                        LIBS="${LIBS} ${xerces_cv_icu_libs}"
109                        break
110                        ;;
111
112                *-iconv-*)
113                        AC_DEFINE([XERCES_USE_MSGLOADER_ICONV], 1, [Define to use the iconv-based MsgLoader])
114                        msgloader=iconv
115                        break
116                        ;;
117
118                *)
119                        AS_IF([test $i -eq 2], [
120                                AC_MSG_RESULT([none])
121                                AC_MSG_ERROR([Xerces cannot function without a MsgLoader])
122                                ]
123                        )
124                        ;;
125                esac
126        done
127        if test x"$msgloader" != x; then
128                AC_MSG_RESULT($msgloader)
129        fi
130
131        # Define the auto-make conditionals which determine what actually gets compiled
132        # Note that these macros can't be executed conditionally, which is why they're here, not above.
133        AM_CONDITIONAL([XERCES_USE_MSGLOADER_ICU],      [test x"$msgloader" = xicu])
134        AM_CONDITIONAL([XERCES_USE_MSGLOADER_ICONV],    [test x"$msgloader" = xiconv])
135        AM_CONDITIONAL([XERCES_USE_MSGLOADER_INMEMORY], [test x"$msgloader" = xinmemory])
136
137        ]
138)
Note: See TracBrowser for help on using the repository browser.