2 dnl Copyright (c) 1999-2003, 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 "$ac_cv_prog_gcc" = yes; then
17 icu_cv_host_frag=mh-solaris-gcc
19 icu_cv_host_frag=mh-solaris
22 if test "$ac_cv_prog_gcc" = yes; then
23 icu_cv_host_frag=mh-alpha-linux-gcc
25 icu_cv_host_frag=mh-alpha-linux-cc
27 *-*-linux*) icu_cv_host_frag=mh-linux ;;
29 if test "$ac_cv_prog_gcc" = yes; then
30 icu_cv_host_frag=mh-cygwin
32 icu_cv_host_frag=mh-cygwin-msvc
34 *-*-*bsd*) icu_cv_host_frag=mh-bsd-gcc ;;
36 if test -n "`$CXX --help 2>&1 | grep 'IBM C and C++ Compilers$'`"; then
37 icu_cv_host_frag=mh-aix
39 icu_cv_host_frag=mh-aix-va
42 if test "$ac_cv_prog_gcc" = yes; then
43 icu_cv_host_frag=mh-hpux-gcc
46 *aCC) icu_cv_host_frag=mh-hpux-acc ;;
47 *CC) icu_cv_host_frag=mh-hpux-cc ;;
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 ;;
64 dnl ICU_CONDITIONAL - Taken from Automake 1.4
65 AC_DEFUN(ICU_CONDITIONAL,
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.
80 AC_DEFUN(AC_SEARCH_LIBS_FIRST,
82 AC_CACHE_CHECK([for library containing $1], [ac_cv_search_$1],
83 [ac_func_search_save_LIBS="$LIBS"
86 LIBS="-l$i $5 $ac_func_search_save_LIBS"
87 AC_TRY_LINK_FUNC([$1],
88 [ac_cv_search_$1="-l$i"
91 if test "$ac_cv_search_$1" = "no"; then
92 AC_TRY_LINK_FUNC([$1], [ac_cv_search_$1="none required"])
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"
102 dnl Check if we can build and use 64-bit libraries
103 AC_DEFUN(AC_CHECK_64BIT_LIBS,
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]
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
117 CFLAGS="${CFLAGS} +DAportable"
118 CXXFLAGS="${CXXFLAGS} +DAportable"
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
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}"
154 ARFLAGS="${ARFLAGS} -X64"
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}"
174 dnl Individual tests that fail should reset their own flags.
175 AC_MSG_RESULT($ENABLE_64BIT_LIBS)
178 dnl Strict compilation options.
179 AC_DEFUN(AC_CHECK_STRICT_COMPILE,
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
185 ac_use_strict_options=no
187 ac_use_strict_options=yes
189 ], [ac_use_strict_options=no])
190 AC_MSG_RESULT($ac_use_strict_options)
192 if test "$ac_use_strict_options" = yes
196 CFLAGS="$CFLAGS -Wall -ansi -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -Winline"
199 CFLAGS="$CFLAGS -D__STDC__=0";;
204 CXXFLAGS="$CXXFLAGS -W -Wall -ansi -pedantic -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -Winline"
207 CXXFLAGS="$CXXFLAGS -D__STDC__=0";;
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
223 AC_MSG_CHECKING(size of $1)
224 AC_CACHE_VAL(AC_CV_NAME,
229 FILE *f=fopen("conftestval", "w");
231 fprintf(f, "%d\n", sizeof($1));
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