2 dnl Copyright (c) 1999-2004, International Business Machines Corporation and
3 dnl others. All Rights Reserved.
9 AC_DEFUN(ICU_CHECK_MH_FRAG, [
11 [which Makefile fragment to use],
16 if test "$GCC" = yes; then
17 icu_cv_host_frag=mh-solaris-gcc
19 icu_cv_host_frag=mh-solaris
22 if test "$GCC" = yes; then
23 icu_cv_host_frag=mh-alpha-linux-gcc
25 icu_cv_host_frag=mh-alpha-linux-cc
28 if test "$GCC" = yes; then
29 icu_cv_host_frag=mh-linux
31 icu_cv_host_frag=mh-linux-va
33 *-*-linux*) icu_cv_host_frag=mh-linux ;;
35 if test "$GCC" = yes; then
36 icu_cv_host_frag=mh-cygwin
38 icu_cv_host_frag=mh-cygwin-msvc
41 if test "$GCC" = yes; then
42 icu_cv_host_frag=mh-mingw
44 icu_cv_host_frag=mh-cygwin-msvc
46 *-*-*bsd*) icu_cv_host_frag=mh-bsd-gcc ;;
48 if test "$GCC" = yes; then
49 icu_cv_host_frag=mh-aix-gcc
51 if test -n "`$CXX --help 2>&1 | grep 'IBM C and C++ Compilers$'`"; then
52 icu_cv_host_frag=mh-aix
54 icu_cv_host_frag=mh-aix-va
58 if test "$GCC" = yes; then
59 icu_cv_host_frag=mh-hpux-gcc
62 *aCC) icu_cv_host_frag=mh-hpux-acc ;;
63 *CC) icu_cv_host_frag=mh-hpux-cc ;;
66 *-*ibm-openedition*|*-*-os390*) icu_cv_host_frag=mh-os390 ;;
67 *-*-os400*) icu_cv_host_frag=mh-os400 ;;
68 *-apple-rhapsody*) icu_cv_host_frag=mh-darwin ;;
69 *-apple-darwin*) icu_cv_host_frag=mh-darwin ;;
70 *-*-beos) icu_cv_host_frag=mh-beos ;;
71 *-*-irix*) icu_cv_host_frag=mh-irix ;;
72 *-dec-osf*) icu_cv_host_frag=mh-alpha-osf ;;
73 *-*-nto*) icu_cv_host_frag=mh-qnx ;;
74 *-ncr-*) icu_cv_host_frag=mh-mpras ;;
75 *-sequent-*) icu_cv_host_frag=mh-ptx ;;
76 *) icu_cv_host_frag=mh-unknown ;;
82 dnl ICU_CONDITIONAL - similar example taken from Automake 1.4
83 AC_DEFUN(ICU_CONDITIONAL,
91 dnl AC_SEARCH_LIBS_FIRST(FUNCTION, SEARCH-LIBS [, ACTION-IF-FOUND
92 dnl [, ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]])
93 dnl Search for a library defining FUNC, then see if it's not already available.
95 AC_DEFUN(AC_SEARCH_LIBS_FIRST,
97 AC_CACHE_CHECK([for library containing $1], [ac_cv_search_$1],
98 [ac_func_search_save_LIBS="$LIBS"
101 LIBS="-l$i $5 $ac_func_search_save_LIBS"
102 AC_TRY_LINK_FUNC([$1],
103 [ac_cv_search_$1="-l$i"
106 if test "$ac_cv_search_$1" = "no"; then
107 AC_TRY_LINK_FUNC([$1], [ac_cv_search_$1="none required"])
109 LIBS="$ac_func_search_save_LIBS"])
110 if test "$ac_cv_search_$1" != "no"; then
111 test "$ac_cv_search_$1" = "none required" || LIBS="$ac_cv_search_$1 $LIBS"
117 dnl Check if we can build and use 64-bit libraries
118 AC_DEFUN(AC_CHECK_64BIT_LIBS,
120 AC_ARG_ENABLE(64bit-libs,
121 [ --enable-64bit-libs build 64-bit libraries [default=yes]],
122 [ENABLE_64BIT_LIBS=${enableval}],
123 [ENABLE_64BIT_LIBS=yes]
125 dnl These results can't be cached because is sets compiler flags.
126 AC_MSG_CHECKING([for 64-bit executable support])
127 if test "$ENABLE_64BIT_LIBS" != no; then
130 SPARCV9=`isainfo -n 2>&1 | grep sparcv9`
131 if test "$GCC" = yes; then
132 # We could add a check for -m64 depending on the gcc version.
135 SOL64=`$CXX -xarch=v9 2>&1 && $CC -xarch=v9 2>&1 | grep -v usage:`
136 if test -z "$SOL64" && test -n "$SPARCV9"; then
137 CFLAGS="${CFLAGS} -xtarget=ultra -xarch=v9"
138 CXXFLAGS="${CXXFLAGS} -xtarget=ultra -xarch=v9"
139 LDFLAGS="${LDFLAGS} -xtarget=ultra -xarch=v9"
140 ENABLE_64BIT_LIBS=yes
147 if test "$GCC" = yes; then
148 # gcc compiler support
149 if test -n "`$CXX -dumpspecs 2>&1 && $CC -dumpspecs 2>&1 | grep -v __LP64__`"; then
150 ENABLE_64BIT_LIBS=yes
155 # check for ecc/ecpc compiler support
156 if test -n "`$CXX --help 2>&1 && $CC --help 2>&1 | grep -v Intel`"; then
157 if test -n "`$CXX --help 2>&1 && $CC --help 2>&1 | grep -v Itanium`"; then
158 ENABLE_64BIT_LIBS=yes
169 if test "$GCC" = yes; then
170 if test -n "`$CXX -dumpspecs 2>&1 && $CC -dumpspecs 2>&1 | grep -v __LP64__`"; then
171 ENABLE_64BIT_LIBS=yes
180 *-*-aix*|powerpc64-*-linux*)
181 if test "$ac_cv_prog_gcc" = no; then
182 # Note: Have not tested 64-bitness with gcc.
183 # Maybe the flag "-maix64" could be used with gcc?
184 OLD_CFLAGS="${CFLAGS}"
185 OLD_CXXFLAGS="${CXXFLAGS}"
186 OLD_LDFLAGS="${LDFLAGS}"
187 CFLAGS="${CFLAGS} -q64"
188 CXXFLAGS="${CXXFLAGS} -q64"
189 LDFLAGS="${LDFLAGS} -q64"
190 AC_TRY_RUN(int main(void) {return 0;},
191 ENABLE_64BIT_LIBS=yes, ENABLE_64BIT_LIBS=no, ENABLE_64BIT_LIBS=no)
192 if test "$ENABLE_64BIT_LIBS" = no; then
193 CFLAGS="${OLD_CFLAGS}"
194 CXXFLAGS="${OLD_CXXFLAGS}"
195 LDFLAGS="${OLD_LDFLAGS}"
199 ARFLAGS="${ARFLAGS} -X64"
205 dnl First we try the newer +DD64, if that doesn't work,
206 dnl try other options.
208 OLD_CFLAGS="${CFLAGS}"
209 OLD_CXXFLAGS="${CXXFLAGS}"
210 CFLAGS="${CFLAGS} +DD64"
211 CXXFLAGS="${CXXFLAGS} +DD64"
212 AC_TRY_RUN(int main(void) {return 0;},
213 ENABLE_64BIT_LIBS=yes, ENABLE_64BIT_LIBS=no, ENABLE_64BIT_LIBS=no)
214 if test "$ENABLE_64BIT_LIBS" = no; then
215 CFLAGS="${OLD_CFLAGS}"
216 CXXFLAGS="${OLD_CXXFLAGS}"
217 CFLAGS="${CFLAGS} +DA2.0W"
218 CXXFLAGS="${CXXFLAGS} +DA2.0W"
219 AC_TRY_RUN(int main(void) {return 0;},
220 ENABLE_64BIT_LIBS=yes, ENABLE_64BIT_LIBS=no, ENABLE_64BIT_LIBS=no)
221 if test "$ENABLE_64BIT_LIBS" = no; then
222 CFLAGS="${OLD_CFLAGS}"
223 CXXFLAGS="${OLD_CXXFLAGS}"
232 dnl Individual tests that fail should reset their own flags.
233 AC_MSG_RESULT($ENABLE_64BIT_LIBS)
236 dnl Strict compilation options.
237 AC_DEFUN(AC_CHECK_STRICT_COMPILE,
239 AC_MSG_CHECKING([whether strict compiling is on])
240 AC_ARG_ENABLE(strict,[ --enable-strict compile with strict compiler options [default=no]], [
241 if test "$enableval" = no
243 ac_use_strict_options=no
245 ac_use_strict_options=yes
247 ], [ac_use_strict_options=no])
248 AC_MSG_RESULT($ac_use_strict_options)
250 if test "$ac_use_strict_options" = yes
254 CFLAGS="$CFLAGS -Wall -ansi -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -Winline -Wno-long-long"
257 CFLAGS="$CFLAGS -D__STDC__=0";;
262 if test "`$CC /help 2>&1 | head -c9`" = "Microsoft"
270 CXXFLAGS="$CXXFLAGS -W -Wall -ansi -pedantic -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -Winline -Wno-long-long"
273 CXXFLAGS="$CXXFLAGS -D__STDC__=0";;
278 if test "`$CXX /help 2>&1 | head -c9`" = "Microsoft"
280 CXXFLAGS="$CXXFLAGS /W4"
287 dnl Define a sizeof checking macro that is a bit better than autoconf's
288 dnl builtin (and heavily based on it, of course). The new macro is
289 dnl AC_DO_CHECK_SIZEOF(TYPE [, CROSS_SIZE [, INCLUDES])
290 AC_DEFUN(AC_DO_CHECK_SIZEOF,
291 [changequote(<<, >>)dnl
292 dnl The name to #define.
293 define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
294 dnl The cache variable name.
295 define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl
297 AC_MSG_CHECKING(size of $1)
298 AC_CACHE_VAL(AC_CV_NAME,
303 FILE *f=fopen("conftestval", "w");
305 fprintf(f, "%d\n", sizeof($1));
307 }], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$2], , , AC_CV_NAME=$2))])dnl
308 AC_MSG_RESULT($AC_CV_NAME)
309 AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME)
310 undefine([AC_TYPE_NAME])dnl
311 undefine([AC_CV_NAME])dnl