intl/icu/source/acinclude.m4

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/intl/icu/source/acinclude.m4	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,502 @@
     1.4 +# Copyright (c) 1999-2013, International Business Machines Corporation and
     1.5 +# others. All Rights Reserved.
     1.6 +# acinclude.m4 for ICU
     1.7 +# Don't edit aclocal.m4, do edit acinclude.m4
     1.8 +# Stephen F. Booth
     1.9 +
    1.10 +# @TOP@
    1.11 +
    1.12 +# ICU_CHECK_MH_FRAG
    1.13 +AC_DEFUN([ICU_CHECK_MH_FRAG], [
    1.14 +	AC_CACHE_CHECK(
    1.15 +		[which Makefile fragment to use for ${host}],
    1.16 +		[icu_cv_host_frag],
    1.17 +		[
    1.18 +case "${host}" in
    1.19 +*-*-solaris*)
    1.20 +	if test "$GCC" = yes; then	
    1.21 +		icu_cv_host_frag=mh-solaris-gcc
    1.22 +	else
    1.23 +		icu_cv_host_frag=mh-solaris
    1.24 +	fi ;;
    1.25 +alpha*-*-linux-gnu)
    1.26 +	if test "$GCC" = yes; then
    1.27 +		icu_cv_host_frag=mh-alpha-linux-gcc
    1.28 +	else
    1.29 +		icu_cv_host_frag=mh-alpha-linux-cc
    1.30 +	fi ;;
    1.31 +powerpc*-*-linux*)
    1.32 +	if test "$GCC" = yes; then
    1.33 +		icu_cv_host_frag=mh-linux
    1.34 +	else
    1.35 +		icu_cv_host_frag=mh-linux-va
    1.36 +	fi ;;
    1.37 +*-*-linux*|*-*-gnu|*-*-k*bsd*-gnu|*-*-kopensolaris*-gnu) icu_cv_host_frag=mh-linux ;;
    1.38 +*-*-cygwin|*-*-mingw32|*-*-mingw64)
    1.39 +	if test "$GCC" = yes; then
    1.40 +		AC_TRY_COMPILE([
    1.41 +#ifndef __MINGW32__
    1.42 +#error This is not MinGW
    1.43 +#endif], [], AC_TRY_COMPILE([
    1.44 +#ifndef __MINGW64__
    1.45 +#error This is not MinGW64
    1.46 +#endif], [], icu_cv_host_frag=mh-mingw64, icu_cv_host_frag=mh-mingw), icu_cv_host_frag=mh-cygwin)
    1.47 +	else
    1.48 +		case "${host}" in
    1.49 +		*-*-cygwin) icu_cv_host_frag=mh-cygwin-msvc ;;
    1.50 +		*-*-mingw32|*-*-mingw64) icu_cv_host_frag=mh-msys-msvc ;;
    1.51 +		esac
    1.52 +	fi ;;
    1.53 +*-*-*bsd*|*-*-dragonfly*) 	icu_cv_host_frag=mh-bsd-gcc ;;
    1.54 +*-*-aix*)
    1.55 +	if test "$GCC" = yes; then
    1.56 +		icu_cv_host_frag=mh-aix-gcc
    1.57 +	else
    1.58 +		icu_cv_host_frag=mh-aix-va
    1.59 +	fi ;;
    1.60 +*-*-hpux*)
    1.61 +	if test "$GCC" = yes; then
    1.62 +		icu_cv_host_frag=mh-hpux-gcc
    1.63 +	else
    1.64 +		case "$CXX" in
    1.65 +		*aCC)    icu_cv_host_frag=mh-hpux-acc ;;
    1.66 +		esac
    1.67 +	fi ;;
    1.68 +*-*ibm-openedition*|*-*-os390*)	icu_cv_host_frag=mh-os390 ;;
    1.69 +*-*-os400*)	icu_cv_host_frag=mh-os400 ;;
    1.70 +*-apple-rhapsody*)	icu_cv_host_frag=mh-darwin ;;
    1.71 +*-apple-darwin*)	icu_cv_host_frag=mh-darwin ;;
    1.72 +*-*-beos)       icu_cv_host_frag=mh-beos ;; 
    1.73 +*-*-haiku)      icu_cv_host_frag=mh-haiku ;; 
    1.74 +*-*-irix*)	icu_cv_host_frag=mh-irix ;;
    1.75 +*-dec-osf*) icu_cv_host_frag=mh-alpha-osf ;;
    1.76 +*-*-nto*)	icu_cv_host_frag=mh-qnx ;;
    1.77 +*-ncr-*)	icu_cv_host_frag=mh-mpras ;;
    1.78 +*) 		icu_cv_host_frag=mh-unknown ;;
    1.79 +esac
    1.80 +		]
    1.81 +	)
    1.82 +])
    1.83 +
    1.84 +# ICU_CONDITIONAL - similar example taken from Automake 1.4
    1.85 +AC_DEFUN([ICU_CONDITIONAL],
    1.86 +[AC_SUBST($1_TRUE)
    1.87 +if $2; then
    1.88 +  $1_TRUE=
    1.89 +else
    1.90 +  $1_TRUE='#'
    1.91 +fi])
    1.92 +
    1.93 +# ICU_PROG_LINK - Make sure that the linker is usable
    1.94 +AC_DEFUN([ICU_PROG_LINK],
    1.95 +[
    1.96 +case "${host}" in
    1.97 +    *-*-cygwin*|*-*-mingw*)
    1.98 +        if test "$GCC" != yes && test -n "`link --version 2>&1 | grep 'GNU coreutils'`"; then
    1.99 +            AC_MSG_ERROR([link.exe is not a valid linker. Your PATH is incorrect.
   1.100 +                  Please follow the directions in ICU's readme.])
   1.101 +        fi;;
   1.102 +    *);;
   1.103 +esac])
   1.104 +
   1.105 +# AC_SEARCH_LIBS_FIRST(FUNCTION, SEARCH-LIBS [, ACTION-IF-FOUND
   1.106 +#            [, ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]])
   1.107 +# Search for a library defining FUNC, then see if it's not already available.
   1.108 +
   1.109 +AC_DEFUN([AC_SEARCH_LIBS_FIRST],
   1.110 +[AC_PREREQ([2.13])
   1.111 +AC_CACHE_CHECK([for library containing $1], [ac_cv_search_$1],
   1.112 +[ac_func_search_save_LIBS="$LIBS"
   1.113 +ac_cv_search_$1="no"
   1.114 +for i in $2; do
   1.115 +LIBS="-l$i $5 $ac_func_search_save_LIBS"
   1.116 +AC_TRY_LINK_FUNC([$1],
   1.117 +[ac_cv_search_$1="-l$i"
   1.118 +break])
   1.119 +done
   1.120 +if test "$ac_cv_search_$1" = "no"; then
   1.121 +AC_TRY_LINK_FUNC([$1], [ac_cv_search_$1="none required"])
   1.122 +fi
   1.123 +LIBS="$ac_func_search_save_LIBS"])
   1.124 +if test "$ac_cv_search_$1" != "no"; then
   1.125 +  test "$ac_cv_search_$1" = "none required" || LIBS="$ac_cv_search_$1 $LIBS"
   1.126 +  $3
   1.127 +else :
   1.128 +  $4
   1.129 +fi])
   1.130 +
   1.131 +
   1.132 +
   1.133 +# Check if we can build and use 64-bit libraries
   1.134 +AC_DEFUN([AC_CHECK_64BIT_LIBS],
   1.135 +[
   1.136 +    BITS_REQ=nochange
   1.137 +    ENABLE_64BIT_LIBS=unknown
   1.138 +    ## revisit this for cross-compile.
   1.139 +    
   1.140 +    AC_ARG_ENABLE(64bit-libs,
   1.141 +        [  --enable-64bit-libs     (deprecated, use --with-library-bits) build 64-bit libraries [default= platform default]],
   1.142 +        [echo "note, use --with-library-bits instead of --*-64bit-libs"
   1.143 +         case "${enableval}" in
   1.144 +            no|false|32) with_library_bits=32;  ;;
   1.145 +            yes|true|64) with_library_bits=64else32 ;;
   1.146 +            nochange) with_library_bits=nochange; ;;
   1.147 +            *) AC_MSG_ERROR(bad value ${enableval} for '--*-64bit-libs') ;;
   1.148 +            esac]    )
   1.149 +    
   1.150 +
   1.151 +    AC_ARG_WITH(library-bits,
   1.152 +        [  --with-library-bits=bits specify how many bits to use for the library (32, 64, 64else32, nochange) [default=nochange]],
   1.153 +        [case "${withval}" in
   1.154 +            ""|nochange) BITS_REQ=$withval ;;
   1.155 +            32|64|64else32) BITS_REQ=$withval ;;
   1.156 +            *) AC_MSG_ERROR(bad value ${withval} for --with-library-bits) ;;
   1.157 +            esac])
   1.158 +        
   1.159 +    # don't use these for cross compiling
   1.160 +    if test "$cross_compiling" = "yes" -a "${BITS_REQ}" != "nochange"; then
   1.161 +        AC_MSG_ERROR([Don't specify bitness when cross compiling. See readme.html for help with cross compilation., and set compiler options manually.])
   1.162 +    fi
   1.163 +    AC_CHECK_SIZEOF([void *])
   1.164 +    AC_MSG_CHECKING([whether runnable 64 bit binaries are built by default])
   1.165 +    case $ac_cv_sizeof_void_p in
   1.166 +        8) DEFAULT_64BIT=yes ;;
   1.167 +        4) DEFAULT_64BIT=no ;;
   1.168 +        *) DEFAULT_64BIT=unknown
   1.169 +    esac
   1.170 +    BITS_GOT=unknown
   1.171 +    
   1.172 +    # 'OK' here means, we can exit any further checking, everything's copa
   1.173 +    BITS_OK=yes
   1.174 +
   1.175 +    # do we need to check for buildable/runnable 32 or 64 bit?
   1.176 +    BITS_CHECK_32=no
   1.177 +    BITS_CHECK_64=no
   1.178 +    
   1.179 +    # later, can we run the 32/64 bit binaries so made?
   1.180 +    BITS_RUN_32=no
   1.181 +    BITS_RUN_64=no
   1.182 +    
   1.183 +    if test "$DEFAULT_64BIT" = "yes"; then
   1.184 +        # we get 64 bits by default.
   1.185 +        BITS_GOT=64
   1.186 +        case "$BITS_REQ" in
   1.187 +            32) 
   1.188 +                # need to look for 32 bit support. 
   1.189 +                BITS_CHECK_32=yes
   1.190 +                # not copa.
   1.191 +                BITS_OK=no;;
   1.192 +            # everyone else is happy.
   1.193 +            nochange) ;;
   1.194 +            *) ;;
   1.195 +        esac
   1.196 +    elif test "$DEFAULT_64BIT" = "no"; then
   1.197 +        # not 64 bit by default.
   1.198 +        BITS_GOT=32
   1.199 +        case "$BITS_REQ" in
   1.200 +            64|64else32)
   1.201 +                BITS_CHECK_64=yes
   1.202 +                #BITS_CHECK_32=yes
   1.203 +                BITS_OK=no;;
   1.204 +            nochange) ;;
   1.205 +            *) ;;
   1.206 +        esac
   1.207 +    elif test "$DEFAULT_64BIT" = "unknown"; then
   1.208 +        # cross compiling.
   1.209 +        BITS_GOT=unknown
   1.210 +        case "$BITS_REQ" in
   1.211 +            64|64else32) BITS_OK=no
   1.212 +            BITS_CHECK_32=yes
   1.213 +            BITS_CHECK_64=yes ;;
   1.214 +            32) BITS_OK=no;;
   1.215 +            nochange) ;;
   1.216 +            *) ;;
   1.217 +        esac
   1.218 +    fi
   1.219 +            
   1.220 +    AC_MSG_RESULT($DEFAULT_64BIT);
   1.221 +
   1.222 +    if test "$BITS_OK" != "yes"; then
   1.223 +        # not copa. back these up.
   1.224 +        CFLAGS_OLD="${CFLAGS}"
   1.225 +        CXXFLAGS_OLD="${CXXFLAGS}"
   1.226 +        LDFLAGS_OLD="${LDFLAGS}"
   1.227 +        ARFLAGS_OLD="${ARFLAGS}"        
   1.228 +        
   1.229 +        CFLAGS_32="${CFLAGS}"
   1.230 +        CXXFLAGS_32="${CXXFLAGS}"
   1.231 +        LDFLAGS_32="${LDFLAGS}"
   1.232 +        ARFLAGS_32="${ARFLAGS}"        
   1.233 +        
   1.234 +        CFLAGS_64="${CFLAGS}"
   1.235 +        CXXFLAGS_64="${CXXFLAGS}"
   1.236 +        LDFLAGS_64="${LDFLAGS}"
   1.237 +        ARFLAGS_64="${ARFLAGS}"        
   1.238 +        
   1.239 +        CAN_BUILD_64=unknown
   1.240 +        CAN_BUILD_32=unknown
   1.241 +        # These results can't be cached because is sets compiler flags.
   1.242 +        if test "$BITS_CHECK_64" = "yes"; then
   1.243 +            AC_MSG_CHECKING([how to build 64-bit executables])
   1.244 +            CAN_BUILD_64=no
   1.245 +            ####
   1.246 +            # Find out if we think we can *build* for 64 bit. Doesn't check whether we can run it.
   1.247 +            #  Note, we don't have to actually check if the options work- we'll try them before using them.
   1.248 +            #  So, only try actually testing the options, if you are trying to decide between multiple options.
   1.249 +            # On exit from the following clauses:
   1.250 +            # if CAN_BUILD_64=yes:
   1.251 +            #    *FLAGS are assumed to contain the right settings for 64bit
   1.252 +            # else if CAN_BUILD_64=no: (default)
   1.253 +            #    *FLAGS are assumed to be trashed, and will be reset from *FLAGS_OLD
   1.254 +            
   1.255 +            if test "$GCC" = yes; then
   1.256 +                CFLAGS="${CFLAGS} -m64"
   1.257 +                CXXFLAGS="${CXXFLAGS} -m64"
   1.258 +                AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==64)?0:1;}])],
   1.259 +                   CAN_BUILD_64=yes, CAN_BUILD_64=no)
   1.260 +            else
   1.261 +                case "${host}" in
   1.262 +                sparc*-*-solaris*)
   1.263 +                    # 1. try -m64
   1.264 +                    CFLAGS="${CFLAGS} -m64"
   1.265 +                    CXXFLAGS="${CXXFLAGS} -m64"
   1.266 +                    AC_RUN_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==64)?0:1;}])],
   1.267 +                       CAN_BUILD_64=yes, CAN_BUILD_64=no, CAN_BUILD_64=unknown)
   1.268 +                    if test "$CAN_BUILD_64" != yes; then
   1.269 +                        # Nope. back out changes.
   1.270 +                        CFLAGS="${CFLAGS_OLD}"
   1.271 +                        CXXFLAGS="${CFLAGS_OLD}"
   1.272 +                        # 2. try xarch=v9 [deprecated]
   1.273 +                        ## TODO: cross compile: the following won't work.
   1.274 +                        SPARCV9=`isainfo -n 2>&1 | grep sparcv9`
   1.275 +                        SOL64=`$CXX -xarch=v9 2>&1 && $CC -xarch=v9 2>&1 | grep -v usage:`
   1.276 +                        # "Warning: -xarch=v9 is deprecated, use -m64 to create 64-bit programs"
   1.277 +                        if test -z "$SOL64" && test -n "$SPARCV9"; then
   1.278 +                            CFLAGS="${CFLAGS} -xtarget=ultra -xarch=v9"
   1.279 +                            CXXFLAGS="${CXXFLAGS} -xtarget=ultra -xarch=v9"
   1.280 +                            LDFLAGS="${LDFLAGS} -xtarget=ultra -xarch=v9"
   1.281 +                            CAN_BUILD_64=yes
   1.282 +                        fi
   1.283 +                    fi
   1.284 +                    ;;
   1.285 +                i386-*-solaris*)
   1.286 +                    # 1. try -m64
   1.287 +                    CFLAGS="${CFLAGS} -m64"
   1.288 +                    CXXFLAGS="${CXXFLAGS} -m64"
   1.289 +                    AC_RUN_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==64)?0:1;}])],
   1.290 +                       CAN_BUILD_64=yes, CAN_BUILD_64=no, CAN_BUILD_64=unknown)
   1.291 +                    if test "$CAN_BUILD_64" != yes; then
   1.292 +                        # Nope. back out changes.
   1.293 +                        CFLAGS="${CFLAGS_OLD}"
   1.294 +                        CXXFLAGS="${CXXFLAGS_OLD}"
   1.295 +                        # 2. try the older compiler option
   1.296 +                        ## TODO: cross compile problem
   1.297 +                        AMD64=`isainfo -n 2>&1 | grep amd64`
   1.298 +                        SOL64=`$CXX -xtarget=generic64 2>&1 && $CC -xtarget=generic64 2>&1 | grep -v usage:`
   1.299 +                        if test -z "$SOL64" && test -n "$AMD64"; then
   1.300 +                            CFLAGS="${CFLAGS} -xtarget=generic64"
   1.301 +                            CXXFLAGS="${CXXFLAGS} -xtarget=generic64"
   1.302 +                            CAN_BUILD_64=yes
   1.303 +                        fi
   1.304 +                    fi
   1.305 +                    ;;
   1.306 +                ia64-*-linux*)
   1.307 +                    # check for ecc/ecpc compiler support
   1.308 +                    ## TODO: cross compiler problem
   1.309 +                    if test -n "`$CXX --help 2>&1 && $CC --help 2>&1 | grep -v Intel`"; then
   1.310 +                        if test -n "`$CXX --help 2>&1 && $CC --help 2>&1 | grep -v Itanium`"; then
   1.311 +                            CAN_BUILD_64=yes
   1.312 +                        fi
   1.313 +                    fi
   1.314 +                    ;;
   1.315 +                *-*-cygwin)
   1.316 +                    # vcvarsamd64.bat should have been used to enable 64-bit builds.
   1.317 +                    # We only do this check to display the correct answer.
   1.318 +                    ## TODO: cross compiler problem
   1.319 +                    if test -n "`$CXX -help 2>&1 | grep 'for x64'`"; then
   1.320 +                        CAN_BUILD_64=yes
   1.321 +                    fi
   1.322 +                    ;;
   1.323 +                *-*-aix*|powerpc64-*-linux*)
   1.324 +                    CFLAGS="${CFLAGS} -q64"
   1.325 +                    CXXFLAGS="${CXXFLAGS} -q64"
   1.326 +                    LDFLAGS="${LDFLAGS} -q64"
   1.327 +                    AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==64)?0:1;}])],
   1.328 +                       CAN_BUILD_64=yes, CAN_BUILD_64=no)
   1.329 +                    if test "$CAN_BUILD_64" = yes; then
   1.330 +                        # worked- set other options.
   1.331 +                        case "${host}" in
   1.332 +                        *-*-aix*)
   1.333 +                            # tell AIX what executable mode to use.
   1.334 +                            ARFLAGS="${ARFLAGS} -X64"
   1.335 +                        esac
   1.336 +                    fi
   1.337 +                    ;;
   1.338 +                *-*-hpux*)
   1.339 +                    # First we try the newer +DD64, if that doesn't work,
   1.340 +                    # try other options.
   1.341 +
   1.342 +                    CFLAGS="${CFLAGS} +DD64"
   1.343 +                    CXXFLAGS="${CXXFLAGS} +DD64"
   1.344 +                    AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==64)?0:1;}])],
   1.345 +                        CAN_BUILD_64=yes, CAN_BUILD_64=no)
   1.346 +                    if test "$CAN_BUILD_64" != yes; then
   1.347 +                        # reset
   1.348 +                        CFLAGS="${CFLAGS_OLD}"
   1.349 +                        CXXFLAGS="${CXXFLAGS_OLD}"
   1.350 +                        # append
   1.351 +                        CFLAGS="${CFLAGS} +DA2.0W"
   1.352 +                        CXXFLAGS="${CXXFLAGS} +DA2.0W"
   1.353 +                        AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==64)?0:1;}])],
   1.354 +                            CAN_BUILD_64=yes, CAN_BUILD_64=no)
   1.355 +                    fi
   1.356 +                    ;;
   1.357 +                *-*ibm-openedition*|*-*-os390*)
   1.358 +                    CFLAGS="${CFLAGS} -Wc,lp64"
   1.359 +                    CXXFLAGS="${CXXFLAGS} -Wc,lp64"
   1.360 +                    LDFLAGS="${LDFLAGS} -Wl,lp64"
   1.361 +                    AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==64)?0:1;}])],
   1.362 +                       CAN_BUILD_64=yes, CAN_BUILD_64=no)
   1.363 +                    ;;
   1.364 +                *)
   1.365 +                    # unknown platform.
   1.366 +                    ;;
   1.367 +                esac
   1.368 +            fi
   1.369 +            AC_MSG_RESULT($CAN_BUILD_64)
   1.370 +            if test "$CAN_BUILD_64" = yes; then
   1.371 +                AC_MSG_CHECKING([whether runnable 64-bit binaries are being built ])
   1.372 +                AC_RUN_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==64)?0:1;}])],
   1.373 +                   BITS_RUN_64=yes, BITS_RUN_64=no, BITS_RUN_64=unknown)
   1.374 +                AC_MSG_RESULT($BITS_RUN_64);
   1.375 +
   1.376 +                CFLAGS_64="${CFLAGS}"
   1.377 +                CXXFLAGS_64="${CXXFLAGS}"
   1.378 +                LDFLAGS_64="${LDFLAGS}"
   1.379 +                ARFLAGS_64="${ARFLAGS}"        
   1.380 +            fi
   1.381 +            # put it back.
   1.382 +            CFLAGS="${CFLAGS_OLD}"
   1.383 +            CXXFLAGS="${CXXFLAGS_OLD}"
   1.384 +            LDFLAGS="${LDFLAGS_OLD}"
   1.385 +            ARFLAGS="${ARFLAGS_OLD}"     
   1.386 +        fi
   1.387 +        if test "$BITS_CHECK_32" = "yes"; then
   1.388 +            # see comment under 'if BITS_CHECK_64', above.
   1.389 +            AC_MSG_CHECKING([how to build 32-bit executables])
   1.390 +            if test "$GCC" = yes; then
   1.391 +                CFLAGS="${CFLAGS} -m32"
   1.392 +                CXXFLAGS="${CXXFLAGS} -m32"
   1.393 +                AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==32)?0:1;}])],
   1.394 +                   CAN_BUILD_32=yes, CAN_BUILD_32=no)
   1.395 +            fi
   1.396 +            AC_MSG_RESULT($CAN_BUILD_32)
   1.397 +            if test "$CAN_BUILD_32" = yes; then
   1.398 +                AC_MSG_CHECKING([whether runnable 32-bit binaries are being built ])
   1.399 +                AC_RUN_IFELSE([AC_LANG_SOURCE([int main(void) {return (sizeof(void*)*8==32)?0:1;}])],
   1.400 +                   BITS_RUN_32=yes, BITS_RUN_32=no, BITS_RUN_32=unknown)
   1.401 +                AC_MSG_RESULT($BITS_RUN_32);
   1.402 +                CFLAGS_32="${CFLAGS}"
   1.403 +                CXXFLAGS_32="${CXXFLAGS}"
   1.404 +                LDFLAGS_32="${LDFLAGS}"
   1.405 +                ARFLAGS_32="${ARFLAGS}"        
   1.406 +            fi
   1.407 +            # put it back.
   1.408 +            CFLAGS="${CFLAGS_OLD}"
   1.409 +            CXXFLAGS="${CXXFLAGS_OLD}"
   1.410 +            LDFLAGS="${LDFLAGS_OLD}"
   1.411 +            ARFLAGS="${ARFLAGS_OLD}"     
   1.412 +        fi
   1.413 +        
   1.414 +        ##
   1.415 +        # OK. Now, we've tested for 32 and 64 bitness. Let's see what we'll do.
   1.416 +        #
   1.417 +        
   1.418 +        # First, implement 64else32
   1.419 +        if test "$BITS_REQ" = "64else32"; then
   1.420 +            if test "$BITS_RUN_64" = "yes"; then
   1.421 +                BITS_REQ=64
   1.422 +            else
   1.423 +                # no changes.
   1.424 +                BITS_OK=yes 
   1.425 +            fi
   1.426 +        fi
   1.427 +        
   1.428 +        # implement.
   1.429 +        if test "$BITS_REQ" = "32" -a "$BITS_RUN_32" = "yes"; then
   1.430 +            CFLAGS="${CFLAGS_32}"
   1.431 +            CXXFLAGS="${CXXFLAGS_32}"
   1.432 +            LDFLAGS="${LDFLAGS_32}"
   1.433 +            ARFLAGS="${ARFLAGS_32}"     
   1.434 +            BITS_OK=yes
   1.435 +        elif test "$BITS_REQ" = "64" -a "$BITS_RUN_64" = "yes"; then
   1.436 +            CFLAGS="${CFLAGS_64}"
   1.437 +            CXXFLAGS="${CXXFLAGS_64}"
   1.438 +            LDFLAGS="${LDFLAGS_64}"
   1.439 +            ARFLAGS="${ARFLAGS_64}"     
   1.440 +            BITS_OK=yes
   1.441 +        elif test "$BITS_OK" != "yes"; then
   1.442 +            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.])
   1.443 +        fi
   1.444 +     fi
   1.445 +])
   1.446 +
   1.447 +# Strict compilation options.
   1.448 +AC_DEFUN([AC_CHECK_STRICT_COMPILE],
   1.449 +[
   1.450 +    AC_MSG_CHECKING([whether strict compiling is on])
   1.451 +    AC_ARG_ENABLE(strict,[  --enable-strict         compile with strict compiler options [default=yes]], [
   1.452 +        if test "$enableval" = no
   1.453 +        then
   1.454 +            ac_use_strict_options=no
   1.455 +        else
   1.456 +            ac_use_strict_options=yes
   1.457 +        fi
   1.458 +      ], [ac_use_strict_options=yes])
   1.459 +    AC_MSG_RESULT($ac_use_strict_options)
   1.460 +
   1.461 +    if test "$ac_use_strict_options" = yes
   1.462 +    then
   1.463 +        if test "$GCC" = yes
   1.464 +        then
   1.465 +            case "${host}" in
   1.466 +            *-*-solaris*)
   1.467 +                # Don't use -std=c99 option on Solaris/GCC
   1.468 +                ;;
   1.469 +            *)
   1.470 +                # Do not use -ansi. It limits us to C90, and it breaks some platforms.
   1.471 +                # We use -std=c99 to disable the gnu99 defaults and its associated warnings
   1.472 +                CFLAGS="$CFLAGS -std=c99"
   1.473 +                ;;
   1.474 +            esac
   1.475 +            
   1.476 +            CFLAGS="$CFLAGS -Wall -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings"
   1.477 +        else
   1.478 +            case "${host}" in
   1.479 +            *-*-cygwin)
   1.480 +                if test "`$CC /help 2>&1 | head -c9`" = "Microsoft"
   1.481 +                then
   1.482 +                    CFLAGS="$CFLAGS /W4"
   1.483 +                fi ;;
   1.484 +            *-*-mingw32|*-*-mingw64)
   1.485 +                CFLAGS="$CFLAGS -W4" ;;
   1.486 +            esac
   1.487 +        fi
   1.488 +        if test "$GXX" = yes
   1.489 +        then
   1.490 +            CXXFLAGS="$CXXFLAGS -W -Wall -pedantic -Wpointer-arith -Wwrite-strings -Wno-long-long"
   1.491 +        else
   1.492 +            case "${host}" in
   1.493 +            *-*-cygwin)
   1.494 +                if test "`$CXX /help 2>&1 | head -c9`" = "Microsoft"
   1.495 +                then
   1.496 +                    CXXFLAGS="$CXXFLAGS /W4"
   1.497 +                fi ;;
   1.498 +            *-*-mingw32|*-*-mingw64)
   1.499 +                CFLAGS="$CFLAGS -W4" ;;
   1.500 +            esac
   1.501 +        fi
   1.502 +    fi
   1.503 +])
   1.504 +
   1.505 +

mercurial