]> git.saurik.com Git - apple/icu.git/blob - icuSources/aclocal.m4
ICU-3.13.tar.gz
[apple/icu.git] / icuSources / aclocal.m4
1 dnl aclocal.m4 for ICU
2 dnl Copyright (c) 1999-2003, International Business Machines Corporation and
3 dnl others. All Rights Reserved.
4 dnl Stephen F. Booth
5
6 dnl @TOP@
7
8 dnl ICU_CHECK_MH_FRAG
9 AC_DEFUN(ICU_CHECK_MH_FRAG, [
10 AC_CACHE_CHECK(
11 [which Makefile fragment to use],
12 [icu_cv_host_frag],
13 [
14 case "${host}" in
15 *-*-solaris*)
16 if test "$ac_cv_prog_gcc" = yes; then
17 icu_cv_host_frag=mh-solaris-gcc
18 else
19 icu_cv_host_frag=mh-solaris
20 fi ;;
21 alpha*-*-linux-gnu)
22 if test "$ac_cv_prog_gcc" = yes; then
23 icu_cv_host_frag=mh-alpha-linux-gcc
24 else
25 icu_cv_host_frag=mh-alpha-linux-cc
26 fi ;;
27 *-*-linux*) icu_cv_host_frag=mh-linux ;;
28 *-*-cygwin)
29 if test "$ac_cv_prog_gcc" = yes; then
30 icu_cv_host_frag=mh-cygwin
31 else
32 icu_cv_host_frag=mh-cygwin-msvc
33 fi ;;
34 *-*-*bsd*) icu_cv_host_frag=mh-bsd-gcc ;;
35 *-*-aix*)
36 if test -n "`$CXX --help 2>&1 | grep 'IBM C and C++ Compilers$'`"; then
37 icu_cv_host_frag=mh-aix
38 else
39 icu_cv_host_frag=mh-aix-va
40 fi ;;
41 *-*-hpux*)
42 if test "$ac_cv_prog_gcc" = yes; then
43 icu_cv_host_frag=mh-hpux-gcc
44 else
45 case "$CXX" in
46 *aCC) icu_cv_host_frag=mh-hpux-acc ;;
47 *CC) icu_cv_host_frag=mh-hpux-cc ;;
48 esac
49 fi ;;
50 *-*ibm-openedition*|*-*-os390*) icu_cv_host_frag=mh-os390 ;;
51 *-*-os400*) icu_cv_host_frag=mh-os400 ;;
52 *-apple-rhapsody*) icu_cv_host_frag=mh-darwin ;;
53 *-apple-darwin*) icu_cv_host_frag=mh-darwin ;;
54 *-*-irix*) icu_cv_host_frag=mh-irix ;;
55 *-dec-osf*) icu_cv_host_frag=mh-alpha-osf ;;
56 *-*-nto*) icu_cv_host_frag=mh-qnx ;;
57 *-sequent-*) icu_cv_host_frag=mh-ptx ;;
58 *) icu_cv_host_frag=mh-unknown ;;
59 esac
60 ]
61 )
62 ])
63
64 dnl ICU_CONDITIONAL - Taken from Automake 1.4
65 AC_DEFUN(ICU_CONDITIONAL,
66 [AC_SUBST($1_TRUE)
67 AC_SUBST($1_FALSE)
68 if $2; then
69 $1_TRUE=
70 $1_FALSE='#'
71 else
72 $1_TRUE='#'
73 $1_FALSE=
74 fi])
75
76 dnl AC_SEARCH_LIBS_FIRST(FUNCTION, SEARCH-LIBS [, ACTION-IF-FOUND
77 dnl [, ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]])
78 dnl Search for a library defining FUNC, then see if it's not already available.
79
80 AC_DEFUN(AC_SEARCH_LIBS_FIRST,
81 [AC_PREREQ([2.13])
82 AC_CACHE_CHECK([for library containing $1], [ac_cv_search_$1],
83 [ac_func_search_save_LIBS="$LIBS"
84 ac_cv_search_$1="no"
85 for i in $2; do
86 LIBS="-l$i $5 $ac_func_search_save_LIBS"
87 AC_TRY_LINK_FUNC([$1],
88 [ac_cv_search_$1="-l$i"
89 break])
90 done
91 if test "$ac_cv_search_$1" = "no"; then
92 AC_TRY_LINK_FUNC([$1], [ac_cv_search_$1="none required"])
93 fi
94 LIBS="$ac_func_search_save_LIBS"])
95 if test "$ac_cv_search_$1" != "no"; then
96 test "$ac_cv_search_$1" = "none required" || LIBS="$ac_cv_search_$1 $LIBS"
97 $3
98 else :
99 $4
100 fi])
101
102 dnl Check if we can build and use 64-bit libraries
103 AC_DEFUN(AC_CHECK_64BIT_LIBS,
104 [
105 AC_ARG_ENABLE(64bit-libs,
106 [ --enable-64bit-libs build 64-bit libraries [default=yes]],
107 [ENABLE_64BIT_LIBS=${enableval}],
108 [ENABLE_64BIT_LIBS=yes]
109 )
110 dnl These results can't be cached because is sets compiler flags.
111 AC_MSG_CHECKING([for 64-bit executable support])
112 if test "$ENABLE_64BIT_LIBS" = no; then
113 case "${host}" in
114 *-*-hpux*)
115 case "${CXX}" in
116 *CC)
117 CFLAGS="${CFLAGS} +DAportable"
118 CXXFLAGS="${CXXFLAGS} +DAportable"
119 ;;
120 esac;;
121 esac
122 else
123 case "${host}" in
124 *-*-solaris*)
125 if test "$ac_cv_prog_gcc" = no; then
126 SOL64=`$CXX -xarch=v9 2>&1 && $CC -xarch=v9 2>&1 | grep -v usage:`
127 SPARCV9=`isainfo -n 2>&1 | grep sparcv9`
128 if test -z "$SOL64" && test -n "$SPARCV9"; then
129 CFLAGS="${CFLAGS} -xtarget=ultra -xarch=v9"
130 CXXFLAGS="${CXXFLAGS} -xtarget=ultra -xarch=v9"
131 LDFLAGS="${LDFLAGS} -xtarget=ultra -xarch=v9"
132 ENABLE_64BIT_LIBS=yes
133 else
134 ENABLE_64BIT_LIBS=no
135 fi
136 else
137 ENABLE_64BIT_LIBS=no
138 fi
139 ;;
140 *-*-aix*)
141 OLD_CFLAGS="${CFLAGS}"
142 OLD_CXXFLAGS="${CXXFLAGS}"
143 OLD_LDFLAGS="${LDFLAGS}"
144 CFLAGS="${CFLAGS} -q64"
145 CXXFLAGS="${CXXFLAGS} -q64"
146 LDFLAGS="${LDFLAGS} -q64"
147 AC_TRY_RUN(int main(void) {return 0;},
148 ENABLE_64BIT_LIBS=yes, ENABLE_64BIT_LIBS=no, ENABLE_64BIT_LIBS=no)
149 if test "$ENABLE_64BIT_LIBS" = no; then
150 CFLAGS="${OLD_CFLAGS}"
151 CXXFLAGS="${OLD_CXXFLAGS}"
152 LDFLAGS="${OLD_LDFLAGS}"
153 else
154 ARFLAGS="${ARFLAGS} -X64"
155 fi
156 ;;
157 *-*-hpux*)
158 OLD_CFLAGS="${CFLAGS}"
159 OLD_CXXFLAGS="${CXXFLAGS}"
160 CFLAGS="${CFLAGS} +DA2.0W"
161 CXXFLAGS="${CXXFLAGS} +DA2.0W"
162 AC_TRY_RUN(int main(void) {return 0;},
163 ENABLE_64BIT_LIBS=yes, ENABLE_64BIT_LIBS=no, ENABLE_64BIT_LIBS=no)
164 if test "$ENABLE_64BIT_LIBS" = no; then
165 CFLAGS="${OLD_CFLAGS}"
166 CXXFLAGS="${OLD_CXXFLAGS}"
167 fi
168 ;;
169 *)
170 ENABLE_64BIT_LIBS=no
171 ;;
172 esac
173 fi
174 dnl Individual tests that fail should reset their own flags.
175 AC_MSG_RESULT($ENABLE_64BIT_LIBS)
176 ])
177
178 dnl Strict compilation options.
179 AC_DEFUN(AC_CHECK_STRICT_COMPILE,
180 [
181 AC_MSG_CHECKING([whether strict compiling is on])
182 AC_ARG_ENABLE(strict,[ --enable-strict compile with strict compiler options [default=no]], [
183 if test "$enableval" = no
184 then
185 ac_use_strict_options=no
186 else
187 ac_use_strict_options=yes
188 fi
189 ], [ac_use_strict_options=no])
190 AC_MSG_RESULT($ac_use_strict_options)
191
192 if test "$ac_use_strict_options" = yes
193 then
194 if test "$GCC" = yes
195 then
196 CFLAGS="$CFLAGS -Wall -ansi -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -Winline"
197 case "${host}" in
198 *-*-solaris*)
199 CFLAGS="$CFLAGS -D__STDC__=0";;
200 esac
201 fi
202 if test "$GXX" = yes
203 then
204 CXXFLAGS="$CXXFLAGS -W -Wall -ansi -pedantic -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -Winline"
205 case "${host}" in
206 *-*-solaris*)
207 CXXFLAGS="$CXXFLAGS -D__STDC__=0";;
208 esac
209 fi
210 fi
211 ])
212
213 dnl Define a sizeof checking macro that is a bit better than autoconf's
214 dnl builtin (and heavily based on it, of course). The new macro is
215 dnl AC_DO_CHECK_SIZEOF(TYPE [, CROSS_SIZE [, INCLUDES])
216 AC_DEFUN(AC_DO_CHECK_SIZEOF,
217 [changequote(<<, >>)dnl
218 dnl The name to #define.
219 define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
220 dnl The cache variable name.
221 define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl
222 changequote([, ])dnl
223 AC_MSG_CHECKING(size of $1)
224 AC_CACHE_VAL(AC_CV_NAME,
225 [AC_TRY_RUN($3
226 [#include <stdio.h>
227 main()
228 {
229 FILE *f=fopen("conftestval", "w");
230 if (!f) exit(1);
231 fprintf(f, "%d\n", sizeof($1));
232 exit(0);
233 }], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$2], , , AC_CV_NAME=$2))])dnl
234 AC_MSG_RESULT($AC_CV_NAME)
235 AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME)
236 undefine([AC_TYPE_NAME])dnl
237 undefine([AC_CV_NAME])dnl
238 ])