| 1 |
# Copyright (C) 2016 and later: Unicode, Inc. and others. |
| 2 |
# License & terms of use: http://www.unicode.org/copyright.html |
| 3 |
# Copyright (c) 1999-2016, International Business Machines Corporation and |
| 4 |
# others. All Rights Reserved. |
| 5 |
# acinclude.m4 for ICU |
| 6 |
# Don't edit aclocal.m4, do edit acinclude.m4 |
| 7 |
# Stephen F. Booth |
| 8 |
|
| 9 |
# @TOP@ |
| 10 |
|
| 11 |
# ICU_CHECK_MH_FRAG |
| 12 |
AC_DEFUN([ICU_CHECK_MH_FRAG], [ |
| 13 |
AC_CACHE_CHECK( |
| 14 |
[which Makefile fragment to use for ${host}], |
| 15 |
[icu_cv_host_frag], |
| 16 |
[ |
| 17 |
case "${host}" in |
| 18 |
*-*-solaris*) |
| 19 |
if test "$GCC" = yes; then |
| 20 |
icu_cv_host_frag=mh-solaris-gcc |
| 21 |
else |
| 22 |
icu_cv_host_frag=mh-solaris |
| 23 |
fi ;; |
| 24 |
alpha*-*-linux-gnu) |
| 25 |
if test "$GCC" = yes; then |
| 26 |
icu_cv_host_frag=mh-alpha-linux-gcc |
| 27 |
else |
| 28 |
icu_cv_host_frag=mh-alpha-linux-cc |
| 29 |
fi ;; |
| 30 |
powerpc*-*-linux*) |
| 31 |
if test "$GCC" = yes; then |
| 32 |
icu_cv_host_frag=mh-linux |
| 33 |
else |
| 34 |
icu_cv_host_frag=mh-linux-va |
| 35 |
fi ;; |
| 36 |
*-*-linux*|*-*-gnu|*-*-k*bsd*-gnu|*-*-kopensolaris*-gnu) icu_cv_host_frag=mh-linux ;; |
| 37 |
i[[34567]]86-*-cygwin) |
| 38 |
if test "$GCC" = yes; then |
| 39 |
icu_cv_host_frag=mh-cygwin |
| 40 |
else |
| 41 |
icu_cv_host_frag=mh-cygwin-msvc |
| 42 |
fi ;; |
| 43 |
x86_64-*-cygwin) |
| 44 |
if test "$GCC" = yes; then |
| 45 |
icu_cv_host_frag=mh-cygwin64 |
| 46 |
else |
| 47 |
icu_cv_host_frag=mh-cygwin-msvc |
| 48 |
fi ;; |
| 49 |
*-*-mingw*) |
| 50 |
if test "$GCC" = yes; then |
| 51 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 52 |
#ifndef __MINGW64__ |
| 53 |
#error This is not MinGW64 |
| 54 |
#endif]])], [icu_cv_host_frag=mh-mingw64], |
| 55 |
[icu_cv_host_frag=mh-mingw]) |
| 56 |
else |
| 57 |
case "${host}" in |
| 58 |
*-*-mingw*) icu_cv_host_frag=mh-msys-msvc ;; |
| 59 |
*-*-cygwin) icu_cv_host_frag=mh-cygwin-msvc ;; |
| 60 |
esac |
| 61 |
fi ;; |
| 62 |
*-*-*bsd*|*-*-dragonfly*) icu_cv_host_frag=mh-bsd-gcc ;; |
| 63 |
*-*-aix*) |
| 64 |
if test "$GCC" = yes; then |
| 65 |
icu_cv_host_frag=mh-aix-gcc |
| 66 |
else |
| 67 |
icu_cv_host_frag=mh-aix-va |
| 68 |
fi ;; |
| 69 |
*-*-hpux*) |
| 70 |
if test "$GCC" = yes; then |
| 71 |
icu_cv_host_frag=mh-hpux-gcc |
| 72 |
else |
| 73 |
case "$CXX" in |
| 74 |
*aCC) icu_cv_host_frag=mh-hpux-acc ;; |
| 75 |
esac |
| 76 |
fi ;; |
| 77 |
*-*ibm-openedition*|*-*-os390*) icu_cv_host_frag=mh-os390 ;; |
| 78 |
*-*-os400*) icu_cv_host_frag=mh-os400 ;; |
| 79 |
*-apple-rhapsody*) icu_cv_host_frag=mh-darwin ;; |
| 80 |
powerpc*-apple-darwin*) icu_cv_host_frag=mh-darwin-ppc ;; |
| 81 |
*-apple-darwin*) icu_cv_host_frag=mh-darwin ;; |
| 82 |
*-*-beos) icu_cv_host_frag=mh-beos ;; |
| 83 |
*-*-haiku) icu_cv_host_frag=mh-haiku ;; |
| 84 |
*-*-irix*) icu_cv_host_frag=mh-irix ;; |
| 85 |
*-dec-osf*) icu_cv_host_frag=mh-alpha-osf ;; |
| 86 |
*-*-nto*) icu_cv_host_frag=mh-qnx ;; |
| 87 |
*-ncr-*) icu_cv_host_frag=mh-mpras ;; |
| 88 |
*) icu_cv_host_frag=mh-unknown ;; |
| 89 |
esac |
| 90 |
] |
| 91 |
) |
| 92 |
]) |
| 93 |
|
| 94 |
# ICU_PROG_LINK - Make sure that the linker is usable |
| 95 |
AC_DEFUN([ICU_PROG_LINK], |
| 96 |
[ |
| 97 |
case "${host}" in |
| 98 |
*-*-cygwin*|*-*-mingw*) |
| 99 |
if test "$GCC" != yes && test -n "`link --version 2>&1 | grep 'GNU coreutils'`"; then |
| 100 |
AC_MSG_ERROR([link.exe is not a valid linker. Your PATH is incorrect. |
| 101 |
Please follow the directions in ICU's readme.]) |
| 102 |
fi;; |
| 103 |
*);; |
| 104 |
esac]) |
| 105 |
|
| 106 |
# AC_SEARCH_LIBS_FIRST(FUNCTION, SEARCH-LIBS [, ACTION-IF-FOUND |
| 107 |
# [, ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]]) |
| 108 |
# Search for a library defining FUNC, then see if it's not already available. |
| 109 |
|
| 110 |
AC_DEFUN([AC_SEARCH_LIBS_FIRST], |
| 111 |
[AC_PREREQ([2.13]) |
| 112 |
AC_CACHE_CHECK([for library containing $1], [ac_cv_search_$1], |
| 113 |
[ac_func_search_save_LIBS="$LIBS" |
| 114 |
ac_cv_search_$1="no" |
| 115 |
for i in $2; do |
| 116 |
LIBS="-l$i $5 $ac_func_search_save_LIBS" |
| 117 |
AC_TRY_LINK_FUNC([$1], |
| 118 |
[ac_cv_search_$1="-l$i" |
| 119 |
break]) |
| 120 |
done |
| 121 |
if test "$ac_cv_search_$1" = "no"; then |
| 122 |
AC_TRY_LINK_FUNC([$1], [ac_cv_search_$1="none required"]) |
| 123 |
fi |
| 124 |
LIBS="$ac_func_search_save_LIBS"]) |
| 125 |
if test "$ac_cv_search_$1" != "no"; then |
| 126 |
test "$ac_cv_search_$1" = "none required" || LIBS="$ac_cv_search_$1 $LIBS" |
| 127 |
$3 |
| 128 |
else : |
| 129 |
$4 |
| 130 |
fi]) |
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
# Check if we can build and use 64-bit libraries |
| 135 |
AC_DEFUN([AC_CHECK_64BIT_LIBS], |
| 136 |
[ |
| 137 |
BITS_REQ=nochange |
| 138 |
ENABLE_64BIT_LIBS=unknown |
| 139 |
## revisit this for cross-compile. |
| 140 |
|
| 141 |
AC_ARG_ENABLE(64bit-libs, |
| 142 |
[ --enable-64bit-libs (deprecated, use --with-library-bits) build 64-bit libraries [default= platform default]], |
| 143 |
[echo "note, use --with-library-bits instead of --*-64bit-libs" |
| 144 |
case "${enableval}" in |
| 145 |
no|false|32) with_library_bits=32; ;; |
| 146 |
yes|true|64) with_library_bits=64else32 ;; |
| 147 |
nochange) with_library_bits=nochange; ;; |
| 148 |
*) AC_MSG_ERROR(bad value ${enableval} for '--*-64bit-libs') ;; |
| 149 |
esac] ) |
| 150 |
|
| 151 |
|
| 152 |
AC_ARG_WITH(library-bits, |
| 153 |
[ --with-library-bits=bits specify how many bits to use for the library (32, 64, 64else32, nochange) [default=nochange]], |
| 154 |
[case "${withval}" in |
| 155 |
""|nochange) BITS_REQ=$withval ;; |
| 156 |
32|64|64else32) BITS_REQ=$withval ;; |
| 157 |
*) AC_MSG_ERROR(bad value ${withval} for --with-library-bits) ;; |
| 158 |
esac]) |
| 159 |
|
| 160 |
# don't use these for cross compiling |
| 161 |
if test "$cross_compiling" = "yes" -a "${BITS_REQ}" != "nochange"; then |
| 162 |
AC_MSG_ERROR([Don't specify bitness when cross compiling. See readme.html for help with cross compilation., and set compiler options manually.]) |
| 163 |
fi |
| 164 |
AC_CHECK_SIZEOF([void *]) |
| 165 |
AC_MSG_CHECKING([whether runnable 64 bit binaries are built by default]) |
| 166 |
case $ac_cv_sizeof_void_p in |
| 167 |
8) DEFAULT_64BIT=yes ;; |
| 168 |
4) DEFAULT_64BIT=no ;; |
| 169 |
*) DEFAULT_64BIT=unknown |
| 170 |
esac |
| 171 |
BITS_GOT=unknown |
| 172 |
|
| 173 |
# 'OK' here means, we can exit any further checking, everything's copa |
| 174 |
BITS_OK=yes |
| 175 |
|
| 176 |
# do we need to check for buildable/runnable 32 or 64 bit? |
| 177 |
BITS_CHECK_32=no |
| 178 |
BITS_CHECK_64=no |
| 179 |
|
| 180 |
# later, can we run the 32/64 bit binaries so made? |
| 181 |
BITS_RUN_32=no |
| 182 |
BITS_RUN_64=no |
| 183 |
|
| 184 |
if test "$DEFAULT_64BIT" = "yes"; then |
| 185 |
# we get 64 bits by default. |
| 186 |
BITS_GOT=64 |
| 187 |
case "$BITS_REQ" in |
| 188 |
32) |
| 189 |
# need to look for 32 bit support. |
| 190 |
BITS_CHECK_32=yes |
| 191 |
# not copa. |
| 192 |
BITS_OK=no;; |
| 193 |
# everyone else is happy. |
| 194 |
nochange) ;; |
| 195 |
*) ;; |
| 196 |
esac |
| 197 |
elif test "$DEFAULT_64BIT" = "no"; then |
| 198 |
# not 64 bit by default. |
| 199 |
BITS_GOT=32 |
| 200 |
case "$BITS_REQ" in |
| 201 |
64|64else32) |
| 202 |
BITS_CHECK_64=yes |
| 203 |
#BITS_CHECK_32=yes |
| 204 |
BITS_OK=no;; |
| 205 |
nochange) ;; |
| 206 |
*) ;; |
| 207 |
esac |
| 208 |
elif test "$DEFAULT_64BIT" = "unknown"; then |
| 209 |
# cross compiling. |
| 210 |
BITS_GOT=unknown |
| 211 |
case "$BITS_REQ" in |
| 212 |
64|64else32) BITS_OK=no |
| 213 |
BITS_CHECK_32=yes |
| 214 |
BITS_CHECK_64=yes ;; |
| 215 |
32) BITS_OK=no;; |
| 216 |
nochange) ;; |
| 217 |
*) ;; |
| 218 |
esac |
| 219 |
fi |
| 220 |
|
| 221 |
AC_MSG_RESULT($DEFAULT_64BIT); |
| 222 |
|
| 223 |
if test "$BITS_OK" != "yes"; then |
| 224 |
# not copa. back these up. |
| 225 |
CFLAGS_OLD="${CFLAGS}" |
| 226 |
CXXFLAGS_OLD="${CXXFLAGS}" |
| 227 |
LDFLAGS_OLD="${LDFLAGS}" |
| 228 |
ARFLAGS_OLD="${ARFLAGS}" |
| 229 |
|
| 230 |
CFLAGS_32="${CFLAGS}" |
| 231 |
CXXFLAGS_32="${CXXFLAGS}" |
| 232 |
LDFLAGS_32="${LDFLAGS}" |
| 233 |
ARFLAGS_32="${ARFLAGS}" |
| 234 |
|
| 235 |
CFLAGS_64="${CFLAGS}" |
| 236 |
CXXFLAGS_64="${CXXFLAGS}" |
| 237 |
LDFLAGS_64="${LDFLAGS}" |
| 238 |
ARFLAGS_64="${ARFLAGS}" |
| 239 |
|
| 240 |
CAN_BUILD_64=unknown |
| 241 |
CAN_BUILD_32=unknown |
| 242 |
# These results can't be cached because is sets compiler flags. |
| 243 |
if test "$BITS_CHECK_64" = "yes"; then |
| 244 |
AC_MSG_CHECKING([how to build 64-bit executables]) |
| 245 |
CAN_BUILD_64=no |
| 246 |
#### |
| 247 |
# Find out if we think we can *build* for 64 bit. Doesn't check whether we can run it. |
| 248 |
# Note, we don't have to actually check if the options work- we'll try them before using them. |
| 249 |
# So, only try actually testing the options, if you are trying to decide between multiple options. |
| 250 |
# On exit from the following clauses: |
| 251 |
# if CAN_BUILD_64=yes: |
| 252 |
# *FLAGS are assumed to contain the right settings for 64bit |
| 253 |
# else if CAN_BUILD_64=no: (default) |
| 254 |
# *FLAGS are assumed to be trashed, and will be reset from *FLAGS_OLD |
| 255 |
|
| 256 |
if test "$GCC" = yes; then |
| 257 |
CFLAGS="${CFLAGS} -m64" |
| 258 |
CXXFLAGS="${CXXFLAGS} -m64" |
| 259 |
AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==64)?0:1;}])], |
| 260 |
CAN_BUILD_64=yes, CAN_BUILD_64=no) |
| 261 |
else |
| 262 |
case "${host}" in |
| 263 |
sparc*-*-solaris*) |
| 264 |
# 1. try -m64 |
| 265 |
CFLAGS="${CFLAGS} -m64" |
| 266 |
CXXFLAGS="${CXXFLAGS} -m64" |
| 267 |
AC_RUN_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==64)?0:1;}])], |
| 268 |
CAN_BUILD_64=yes, CAN_BUILD_64=no, CAN_BUILD_64=unknown) |
| 269 |
if test "$CAN_BUILD_64" != yes; then |
| 270 |
# Nope. back out changes. |
| 271 |
CFLAGS="${CFLAGS_OLD}" |
| 272 |
CXXFLAGS="${CXXFLAGS_OLD}" |
| 273 |
# 2. try xarch=v9 [deprecated] |
| 274 |
## TODO: cross compile: the following won't work. |
| 275 |
SPARCV9=`isainfo -n 2>&1 | grep sparcv9` |
| 276 |
SOL64=`$CXX -xarch=v9 2>&1 && $CC -xarch=v9 2>&1 | grep -v usage:` |
| 277 |
# "Warning: -xarch=v9 is deprecated, use -m64 to create 64-bit programs" |
| 278 |
if test -z "$SOL64" && test -n "$SPARCV9"; then |
| 279 |
CFLAGS="${CFLAGS} -xtarget=ultra -xarch=v9" |
| 280 |
CXXFLAGS="${CXXFLAGS} -xtarget=ultra -xarch=v9" |
| 281 |
LDFLAGS="${LDFLAGS} -xtarget=ultra -xarch=v9" |
| 282 |
CAN_BUILD_64=yes |
| 283 |
fi |
| 284 |
fi |
| 285 |
;; |
| 286 |
i386-*-solaris*) |
| 287 |
# 1. try -m64 |
| 288 |
CFLAGS="${CFLAGS} -m64" |
| 289 |
CXXFLAGS="${CXXFLAGS} -m64" |
| 290 |
AC_RUN_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==64)?0:1;}])], |
| 291 |
CAN_BUILD_64=yes, CAN_BUILD_64=no, CAN_BUILD_64=unknown) |
| 292 |
if test "$CAN_BUILD_64" != yes; then |
| 293 |
# Nope. back out changes. |
| 294 |
CFLAGS="${CFLAGS_OLD}" |
| 295 |
CXXFLAGS="${CXXFLAGS_OLD}" |
| 296 |
# 2. try the older compiler option |
| 297 |
## TODO: cross compile problem |
| 298 |
AMD64=`isainfo -n 2>&1 | grep amd64` |
| 299 |
SOL64=`$CXX -xtarget=generic64 2>&1 && $CC -xtarget=generic64 2>&1 | grep -v usage:` |
| 300 |
if test -z "$SOL64" && test -n "$AMD64"; then |
| 301 |
CFLAGS="${CFLAGS} -xtarget=generic64" |
| 302 |
CXXFLAGS="${CXXFLAGS} -xtarget=generic64" |
| 303 |
CAN_BUILD_64=yes |
| 304 |
fi |
| 305 |
fi |
| 306 |
;; |
| 307 |
ia64-*-linux*) |
| 308 |
# check for ecc/ecpc compiler support |
| 309 |
## TODO: cross compiler problem |
| 310 |
if test -n "`$CXX --help 2>&1 && $CC --help 2>&1 | grep -v Intel`"; then |
| 311 |
if test -n "`$CXX --help 2>&1 && $CC --help 2>&1 | grep -v Itanium`"; then |
| 312 |
CAN_BUILD_64=yes |
| 313 |
fi |
| 314 |
fi |
| 315 |
;; |
| 316 |
*-*-cygwin) |
| 317 |
# vcvarsamd64.bat should have been used to enable 64-bit builds. |
| 318 |
# We only do this check to display the correct answer. |
| 319 |
## TODO: cross compiler problem |
| 320 |
if test -n "`$CXX -help 2>&1 | grep 'for x64'`"; then |
| 321 |
CAN_BUILD_64=yes |
| 322 |
fi |
| 323 |
;; |
| 324 |
*-*-aix*|powerpc64-*-linux*) |
| 325 |
CFLAGS="${CFLAGS} -q64" |
| 326 |
CXXFLAGS="${CXXFLAGS} -q64" |
| 327 |
LDFLAGS="${LDFLAGS} -q64" |
| 328 |
AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==64)?0:1;}])], |
| 329 |
CAN_BUILD_64=yes, CAN_BUILD_64=no) |
| 330 |
if test "$CAN_BUILD_64" = yes; then |
| 331 |
# worked- set other options. |
| 332 |
case "${host}" in |
| 333 |
*-*-aix*) |
| 334 |
# tell AIX what executable mode to use. |
| 335 |
ARFLAGS="${ARFLAGS} -X64" |
| 336 |
esac |
| 337 |
fi |
| 338 |
;; |
| 339 |
*-*-hpux*) |
| 340 |
# First we try the newer +DD64, if that doesn't work, |
| 341 |
# try other options. |
| 342 |
|
| 343 |
CFLAGS="${CFLAGS} +DD64" |
| 344 |
CXXFLAGS="${CXXFLAGS} +DD64" |
| 345 |
AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==64)?0:1;}])], |
| 346 |
CAN_BUILD_64=yes, CAN_BUILD_64=no) |
| 347 |
if test "$CAN_BUILD_64" != yes; then |
| 348 |
# reset |
| 349 |
CFLAGS="${CFLAGS_OLD}" |
| 350 |
CXXFLAGS="${CXXFLAGS_OLD}" |
| 351 |
# append |
| 352 |
CFLAGS="${CFLAGS} +DA2.0W" |
| 353 |
CXXFLAGS="${CXXFLAGS} +DA2.0W" |
| 354 |
AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==64)?0:1;}])], |
| 355 |
CAN_BUILD_64=yes, CAN_BUILD_64=no) |
| 356 |
fi |
| 357 |
;; |
| 358 |
*-*ibm-openedition*|*-*-os390*) |
| 359 |
CFLAGS="${CFLAGS} -Wc,lp64" |
| 360 |
CXXFLAGS="${CXXFLAGS} -Wc,lp64" |
| 361 |
LDFLAGS="${LDFLAGS} -Wl,lp64" |
| 362 |
AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==64)?0:1;}])], |
| 363 |
CAN_BUILD_64=yes, CAN_BUILD_64=no) |
| 364 |
;; |
| 365 |
*) |
| 366 |
# unknown platform. |
| 367 |
;; |
| 368 |
esac |
| 369 |
fi |
| 370 |
AC_MSG_RESULT($CAN_BUILD_64) |
| 371 |
if test "$CAN_BUILD_64" = yes; then |
| 372 |
AC_MSG_CHECKING([whether runnable 64-bit binaries are being built ]) |
| 373 |
AC_RUN_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==64)?0:1;}])], |
| 374 |
BITS_RUN_64=yes, BITS_RUN_64=no, BITS_RUN_64=unknown) |
| 375 |
AC_MSG_RESULT($BITS_RUN_64); |
| 376 |
|
| 377 |
CFLAGS_64="${CFLAGS}" |
| 378 |
CXXFLAGS_64="${CXXFLAGS}" |
| 379 |
LDFLAGS_64="${LDFLAGS}" |
| 380 |
ARFLAGS_64="${ARFLAGS}" |
| 381 |
fi |
| 382 |
# put it back. |
| 383 |
CFLAGS="${CFLAGS_OLD}" |
| 384 |
CXXFLAGS="${CXXFLAGS_OLD}" |
| 385 |
LDFLAGS="${LDFLAGS_OLD}" |
| 386 |
ARFLAGS="${ARFLAGS_OLD}" |
| 387 |
fi |
| 388 |
if test "$BITS_CHECK_32" = "yes"; then |
| 389 |
# see comment under 'if BITS_CHECK_64', above. |
| 390 |
AC_MSG_CHECKING([how to build 32-bit executables]) |
| 391 |
if test "$GCC" = yes; then |
| 392 |
CFLAGS="${CFLAGS} -m32" |
| 393 |
CXXFLAGS="${CXXFLAGS} -m32" |
| 394 |
AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==32)?0:1;}])], |
| 395 |
CAN_BUILD_32=yes, CAN_BUILD_32=no) |
| 396 |
fi |
| 397 |
AC_MSG_RESULT($CAN_BUILD_32) |
| 398 |
if test "$CAN_BUILD_32" = yes; then |
| 399 |
AC_MSG_CHECKING([whether runnable 32-bit binaries are being built ]) |
| 400 |
AC_RUN_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==32)?0:1;}])], |
| 401 |
BITS_RUN_32=yes, BITS_RUN_32=no, BITS_RUN_32=unknown) |
| 402 |
AC_MSG_RESULT($BITS_RUN_32); |
| 403 |
CFLAGS_32="${CFLAGS}" |
| 404 |
CXXFLAGS_32="${CXXFLAGS}" |
| 405 |
LDFLAGS_32="${LDFLAGS}" |
| 406 |
ARFLAGS_32="${ARFLAGS}" |
| 407 |
fi |
| 408 |
# put it back. |
| 409 |
CFLAGS="${CFLAGS_OLD}" |
| 410 |
CXXFLAGS="${CXXFLAGS_OLD}" |
| 411 |
LDFLAGS="${LDFLAGS_OLD}" |
| 412 |
ARFLAGS="${ARFLAGS_OLD}" |
| 413 |
fi |
| 414 |
|
| 415 |
## |
| 416 |
# OK. Now, we've tested for 32 and 64 bitness. Let's see what we'll do. |
| 417 |
# |
| 418 |
|
| 419 |
# First, implement 64else32 |
| 420 |
if test "$BITS_REQ" = "64else32"; then |
| 421 |
if test "$BITS_RUN_64" = "yes"; then |
| 422 |
BITS_REQ=64 |
| 423 |
else |
| 424 |
# no changes. |
| 425 |
BITS_OK=yes |
| 426 |
fi |
| 427 |
fi |
| 428 |
|
| 429 |
# implement. |
| 430 |
if test "$BITS_REQ" = "32" -a "$BITS_RUN_32" = "yes"; then |
| 431 |
CFLAGS="${CFLAGS_32}" |
| 432 |
CXXFLAGS="${CXXFLAGS_32}" |
| 433 |
LDFLAGS="${LDFLAGS_32}" |
| 434 |
ARFLAGS="${ARFLAGS_32}" |
| 435 |
BITS_OK=yes |
| 436 |
elif test "$BITS_REQ" = "64" -a "$BITS_RUN_64" = "yes"; then |
| 437 |
CFLAGS="${CFLAGS_64}" |
| 438 |
CXXFLAGS="${CXXFLAGS_64}" |
| 439 |
LDFLAGS="${LDFLAGS_64}" |
| 440 |
ARFLAGS="${ARFLAGS_64}" |
| 441 |
BITS_OK=yes |
| 442 |
elif test "$BITS_OK" != "yes"; then |
| 443 |
AC_MSG_ERROR([Requested $BITS_REQ bit binaries but could not compile and execute them. See readme.html for help with cross compilation., and set compiler options manually.]) |
| 444 |
fi |
| 445 |
fi |
| 446 |
]) |
| 447 |
|
| 448 |
# Strict compilation options. |
| 449 |
AC_DEFUN([AC_CHECK_STRICT_COMPILE], |
| 450 |
[ |
| 451 |
AC_MSG_CHECKING([whether strict compiling is on]) |
| 452 |
AC_ARG_ENABLE(strict,[ --disable-strict do not compile with strict compiler options], [ |
| 453 |
if test "$enableval" = no |
| 454 |
then |
| 455 |
ac_use_strict_options=no |
| 456 |
else |
| 457 |
ac_use_strict_options=yes |
| 458 |
fi |
| 459 |
], [ac_use_strict_options=yes]) |
| 460 |
AC_MSG_RESULT($ac_use_strict_options) |
| 461 |
|
| 462 |
if test "$ac_use_strict_options" = yes |
| 463 |
then |
| 464 |
if test "$GCC" = yes |
| 465 |
then |
| 466 |
CFLAGS="$CFLAGS -Wall -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings" |
| 467 |
|
| 468 |
# Suppress clang C warnings: |
| 469 |
CFLAGS="$CFLAGS -Wno-sign-compare -Wno-unused" |
| 470 |
else |
| 471 |
case "${host}" in |
| 472 |
*-*-cygwin) |
| 473 |
if test "`$CC /help 2>&1 | head -c9`" = "Microsoft" |
| 474 |
then |
| 475 |
CFLAGS="$CFLAGS /W4" |
| 476 |
fi ;; |
| 477 |
*-*-mingw*) |
| 478 |
CFLAGS="$CFLAGS -W4" ;; |
| 479 |
esac |
| 480 |
fi |
| 481 |
if test "$GXX" = yes |
| 482 |
then |
| 483 |
CXXFLAGS="$CXXFLAGS -W -Wall -pedantic -Wpointer-arith -Wwrite-strings -Wno-long-long" |
| 484 |
|
| 485 |
# Suppress clang C++ warnings: |
| 486 |
CXXFLAGS="$CXXFLAGS -Wno-unused -Wno-unused-parameter" |
| 487 |
else |
| 488 |
case "${host}" in |
| 489 |
*-*-cygwin) |
| 490 |
if test "`$CXX /help 2>&1 | head -c9`" = "Microsoft" |
| 491 |
then |
| 492 |
CXXFLAGS="$CXXFLAGS /W4" |
| 493 |
fi ;; |
| 494 |
*-*-mingw*) |
| 495 |
CFLAGS="$CFLAGS -W4" ;; |
| 496 |
esac |
| 497 |
fi |
| 498 |
fi |
| 499 |
]) |
| 500 |
|
| 501 |
|