intl/icu/source/acinclude.m4

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial