summaryrefslogtreecommitdiff
path: root/m4/ace_func.m4
blob: 52ff1a0b2c18cc18c0f7ac0207cd649e6ad12d57 (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
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
139
140
141
142
143
144
145
146
147
148
# ACE_FUNC_STRCASECMP
# + Defines ACE_LACKS_STRCASECMP to 1 if platform lacks strcasecmp()
# + Defines ACE_STRCASECMP_EQUIVALENT to identifier name if platform
#   has a equivalent function that differs in name only.
# + Defines ACE_LACKS_STRCASECMP_PROTOTYPE to 1 if platform lacks
#   declaration for strcasecmp().
#---------------------------------------------------------------------------
AC_DEFUN([ACE_FUNC_STRCASECMP],
[ACE_CHECK_LACKS_FUNCS(strcasecmp)
if test "$ac_cv_func_strcasecmp" = yes; then
    AC_CHECK_DECL([strcasecmp],
		  [],
		  [AC_DEFINE([ACE_LACKS_STRCASECMP_PROTOTYPE], 1,
			     [Define to 1 if platform lacks a declaration for strcasecmp()])],
		  [
#if !defined(ACE_LACKS_STRINGS_H)
#include <strings.h>
#endif
#if !defined(ACE_LACKS_STRING_H)
#include <string.h>
#endif
		  ])
else
    AC_CHECK_FUNC(stricmp)
    if test "$ac_cv_func_stricmp" = yes; then
        AC_DEFINE(ACE_STRCASECMP_EQUIVALENT, [::stricmp],
		  [Define to function that is equivalent to strcasecmp()])
    else
	AC_CHECK_FUNC(_stricmp)
	if test "$ac_cv_func__stricmp" = yes; then
	    AC_DEFINE(ACE_STRCASECMP_EQUIVALENT, [::_stricmp])
	fi
    fi
fi
])

# ACE_FUNC_STRNCASECMP
# + Defines ACE_LACKS_STRCASECMP to 1 if platform lacks strcasecmp()
# + Defines ACE_STRCASECMP_EQUIVALENT to identifier name if platform
#   has a equivalent function that differs in name only.
# + Defines ACE_LACKS_STRNCASECMP_PROTOTYPE to 1 if platform lacks
#   declaration for strncasecmp().
#---------------------------------------------------------------------------
AC_DEFUN([ACE_FUNC_STRNCASECMP],
[ACE_CHECK_LACKS_FUNCS(strncasecmp)
if test "$ac_cv_func_strncasecmp" = yes; then
    AC_CHECK_DECL([strncasecmp],
		  [],
		  [AC_DEFINE([ACE_LACKS_STRNCASECMP_PROTOTYPE], 1,
			     [Define to 1 if platform lacks a declaration for strncasecmp()])],
		  [
#if !defined(ACE_LACKS_STRINGS_H)
#include <strings.h>
#endif
#if !defined(ACE_LACKS_STRING_H)
#include <string.h>
#endif
		  ])
else
    AC_CHECK_FUNC(strnicmp)
    if test "$ac_cv_func_strnicmp" = yes; then
        AC_DEFINE(ACE_STRNCASECMP_EQUIVALENT, [::strnicmp],
		  [Define to function that is equivalent to strncasecmp()])
    else
	AC_CHECK_FUNC(_strnicmp)
	if test "$ac_cv_func__strnicmp" = yes; then
	    AC_DEFINE(ACE_STRNCASECMP_EQUIVALENT, [::_strnicmp])
	fi
    fi
fi
])

# ACE_FUNC_STRDUP
# + Defines ACE_LACKS_STRDUP to 1 if platform lacks strdup()
# + Defines ACE_STRDUP_EQUIVALENT to identifier name if platform
#   has a equivalent function that differs in name only.
# + Defines ACE_HAS_NONCONST_STRDUP if argument is char*. (TODO)
#---------------------------------------------------------------------------
AC_DEFUN([ACE_FUNC_STRDUP],
[ACE_CHECK_LACKS_FUNCS(strdup)
if test "$ac_cv_func_strdup" = no; then
    AC_CHECK_FUNC(_strdup)
    if test "$ac_cv_func__strdup" = yes; then
        AC_DEFINE(ACE_STRDUP_EQUIVALENT, [::_strdup],
		  [Define to function that is equivalent to strdup()])
    fi
fi
])


# ACE_FUNC_WCSCASECMP
# + Defines ACE_LACKS_WCSCASECMP to 1 if platform lacks strcasecmp()
# + Defines ACE_WCSCASECMP_EQUIVALENT to identifier name if platform
#   has a equivalent function that differs in name only.
#---------------------------------------------------------------------------
AC_DEFUN([ACE_FUNC_WCSCASECMP],
[ACE_CHECK_LACKS_FUNCS(wcscasecmp)
if test "$ac_cv_func_wcscasecmp" = no; then
    AC_CHECK_FUNC(wcsicmp)
    if test "$ac_cv_func_wcsicmp" = yes; then
        AC_DEFINE(ACE_WCSCASECMP_EQUIVALENT, [::wcsicmp],
		  [Define to function that is equivalent to wcscasecmp()])
    else
	AC_CHECK_FUNC(_wcsicmp)
	if test "$ac_cv_func__wcsicmp" = yes; then
	    AC_DEFINE(ACE_WCSCASECMP_EQUIVALENT, [::_wcsicmp])
	fi
    fi
fi
])

# ACE_FUNC_WCSNCASECMP
# + Defines ACE_LACKS_WCSNCASECMP to 1 if platform lacks strcasecmp()
# + Defines ACE_WCSNCASECMP_EQUIVALENT to identifier name if platform
#   has a equivalent function that differs in name only.
#---------------------------------------------------------------------------
AC_DEFUN([ACE_FUNC_WCSNCASECMP],
[ACE_CHECK_LACKS_FUNCS(wcsncasecmp)
if test "$ac_cv_func_wcsncasecmp" = no; then
    AC_CHECK_FUNC(wcsnicmp)
    if test "$ac_cv_func_wcsnicmp" = yes; then
        AC_DEFINE(ACE_WCSNCASECMP_EQUIVALENT, [::wcsnicmp],
		  [Define to function that is equivalent to wcsncasecmp()])
    else
	AC_CHECK_FUNC(_wcsnicmp)
	if test "$ac_cv_func__wcsnicmp" = yes; then
	    AC_DEFINE(ACE_WCSNCASECMP_EQUIVALENT, [::_wcsnicmp])
	fi
    fi
fi
])

# ACE_FUNC_WCSDUP
# + Defines ACE_LACKS_WCSDUP to 1 if platform lacks wcsdup()
# + Defines ACE_WCSDUP_EQUIVALENT to identifier name if platform
#   has a equivalent function that differs in name only.
# + Defines ACE_HAS_NONCONST_WCSDUP if argument is char*. (TODO)
#---------------------------------------------------------------------------
AC_DEFUN([ACE_FUNC_WCSDUP],
[ACE_CHECK_LACKS_FUNCS(wcsdup)
if test "$ac_cv_func_wcsdup" = no; then
    AC_CHECK_FUNC(_wcsdup)
    if test "$ac_cv_func__wcsdup" = yes; then
        AC_DEFINE(ACE_WCSDUP_EQUIVALENT, [::_wcsdup],
		  [Define to function that is equivalent to wcsdup()])
    fi
fi
])