| @@ -1,434 +0,0 @@ |
| 1 | dnl @synopsis AC_C_FIND_ENDIAN | | |
| 2 | dnl | | |
| 3 | dnl Determine endian-ness of target processor. | | |
| 4 | dnl @version 1.1 Mar 03 2002 | | |
| 5 | dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com> | | |
| 6 | dnl | | |
| 7 | dnl Majority written from scratch to replace the standard autoconf macro | | |
| 8 | dnl AC_C_BIGENDIAN. Only part remaining from the original it the invocation | | |
| 9 | dnl of the AC_TRY_RUN macro. | | |
| 10 | dnl | | |
| 11 | dnl Permission to use, copy, modify, distribute, and sell this file for any | | |
| 12 | dnl purpose is hereby granted without fee, provided that the above copyright | | |
| 13 | dnl and this permission notice appear in all copies. No representations are | | |
| 14 | dnl made about the suitability of this software for any purpose. It is | | |
| 15 | dnl provided "as is" without express or implied warranty. | | |
| 16 | | | |
| 17 | dnl Find endian-ness in the following way: | | |
| 18 | dnl 1) Look in <endian.h>. | | |
| 19 | dnl 2) If 1) fails, look in <sys/types.h> and <sys/param.h>. | | |
| 20 | dnl 3) If 1) and 2) fails and not cross compiling run a test program. | | |
| 21 | dnl 4) If 1) and 2) fails and cross compiling then guess based on target. | | |
| 22 | | | |
| 23 | AC_DEFUN([AC_C_FIND_ENDIAN], | | |
| 24 | [AC_CACHE_CHECK(processor byte ordering, | | |
| 25 | ac_cv_c_byte_order, | | |
| 26 | | | |
| 27 | # Initialize to unknown | | |
| 28 | ac_cv_c_byte_order=unknown | | |
| 29 | | | |
| 30 | if test x$ac_cv_header_endian_h = xyes ; then | | |
| 31 | | | |
| 32 | # First try <endian.h> which should set BYTE_ORDER. | | |
| 33 | | | |
| 34 | [AC_TRY_LINK([ | | |
| 35 | #include <endian.h> | | |
| 36 | #if BYTE_ORDER != LITTLE_ENDIAN | | |
| 37 | not big endian | | |
| 38 | #endif | | |
| 39 | ], return 0 ;, | | |
| 40 | ac_cv_c_byte_order=little | | |
| 41 | )] | | |
| 42 | | | |
| 43 | [AC_TRY_LINK([ | | |
| 44 | #include <endian.h> | | |
| 45 | #if BYTE_ORDER != BIG_ENDIAN | | |
| 46 | not big endian | | |
| 47 | #endif | | |
| 48 | ], return 0 ;, | | |
| 49 | ac_cv_c_byte_order=big | | |
| 50 | )] | | |
| 51 | | | |
| 52 | fi | | |
| 53 | | | |
| 54 | if test $ac_cv_c_byte_order = unknown ; then | | |
| 55 | | | |
| 56 | [AC_TRY_LINK([ | | |
| 57 | #include <sys/types.h> | | |
| 58 | #include <sys/param.h> | | |
| 59 | #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN | | |
| 60 | bogus endian macros | | |
| 61 | #endif | | |
| 62 | ], return 0 ;, | | |
| 63 | | | |
| 64 | [AC_TRY_LINK([ | | |
| 65 | #include <sys/types.h> | | |
| 66 | #include <sys/param.h> | | |
| 67 | #if BYTE_ORDER != LITTLE_ENDIAN | | |
| 68 | not big endian | | |
| 69 | #endif | | |
| 70 | ], return 0 ;, | | |
| 71 | ac_cv_c_byte_order=little | | |
| 72 | )] | | |
| 73 | | | |
| 74 | [AC_TRY_LINK([ | | |
| 75 | #include <sys/types.h> | | |
| 76 | #include <sys/param.h> | | |
| 77 | #if BYTE_ORDER != LITTLE_ENDIAN | | |
| 78 | not big endian | | |
| 79 | #endif | | |
| 80 | ], return 0 ;, | | |
| 81 | ac_cv_c_byte_order=little | | |
| 82 | )] | | |
| 83 | | | |
| 84 | )] | | |
| 85 | | | |
| 86 | fi | | |
| 87 | | | |
| 88 | if test $ac_cv_c_byte_order = unknown ; then | | |
| 89 | if test $cross_compiling = yes ; then | | |
| 90 | # This is the last resort. Try to guess the target processor endian-ness | | |
| 91 | # by looking at the target CPU type. | | |
| 92 | [ | | |
| 93 | case "$target_cpu" in | | |
| 94 | alpha* | i?86* | mipsel* | ia64*) | | |
| 95 | ac_cv_c_big_endian=0 | | |
| 96 | ac_cv_c_little_endian=1 | | |
| 97 | ;; | | |
| 98 | | | |
| 99 | m68* | mips* | powerpc* | hppa* | sparc*) | | |
| 100 | ac_cv_c_big_endian=1 | | |
| 101 | ac_cv_c_little_endian=0 | | |
| 102 | ;; | | |
| 103 | | | |
| 104 | esac | | |
| 105 | ] | | |
| 106 | else | | |
| 107 | AC_TRY_RUN( | | |
| 108 | [[ | | |
| 109 | int main (void) | | |
| 110 | { /* Are we little or big endian? From Harbison&Steele. */ | | |
| 111 | union | | |
| 112 | { long l ; | | |
| 113 | char c [sizeof (long)] ; | | |
| 114 | } u ; | | |
| 115 | u.l = 1 ; | | |
| 116 | return (u.c [sizeof (long) - 1] == 1); | | |
| 117 | } | | |
| 118 | ]], , ac_cv_c_byte_order=big, | | |
| 119 | ac_cv_c_byte_order=unknown | | |
| 120 | ) | | |
| 121 | | | |
| 122 | AC_TRY_RUN( | | |
| 123 | [[int main (void) | | |
| 124 | { /* Are we little or big endian? From Harbison&Steele. */ | | |
| 125 | union | | |
| 126 | { long l ; | | |
| 127 | char c [sizeof (long)] ; | | |
| 128 | } u ; | | |
| 129 | u.l = 1 ; | | |
| 130 | return (u.c [0] == 1); | | |
| 131 | }]], , ac_cv_c_byte_order=little, | | |
| 132 | ac_cv_c_byte_order=unknown | | |
| 133 | ) | | |
| 134 | fi | | |
| 135 | fi | | |
| 136 | | | |
| 137 | ) | | |
| 138 | ] | | |
| 139 | | | |
| 140 | if test $ac_cv_c_byte_order = big ; then | | |
| 141 | ac_cv_c_big_endian=1 | | |
| 142 | ac_cv_c_little_endian=0 | | |
| 143 | elif test $ac_cv_c_byte_order = little ; then | | |
| 144 | ac_cv_c_big_endian=0 | | |
| 145 | ac_cv_c_little_endian=1 | | |
| 146 | else | | |
| 147 | ac_cv_c_big_endian=0 | | |
| 148 | ac_cv_c_little_endian=0 | | |
| 149 | | | |
| 150 | AC_MSG_WARN([[*****************************************************************]]) | | |
| 151 | AC_MSG_WARN([[*** Not able to determine endian-ness of target processor. ]]) | | |
| 152 | AC_MSG_WARN([[*** The constants CPU_IS_BIG_ENDIAN and CPU_IS_LITTLE_ENDIAN in ]]) | | |
| 153 | AC_MSG_WARN([[*** src/config.h may need to be hand editied. ]]) | | |
| 154 | AC_MSG_WARN([[*****************************************************************]]) | | |
| 155 | fi | | |
| 156 | | | |
| 157 | )# AC_C_FIND_ENDIAN | | |
| 158 | | | |
| 159 | | | |
| 160 | | | |
| 161 | | | |
| 162 | | | |
| 163 | dnl @synopsis AC_C99_FUNC_LRINT | | |
| 164 | dnl | | |
| 165 | dnl Check whether C99's lrint function is available. | | |
| 166 | dnl @version 1.3 Feb 12 2002 | | |
| 167 | dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com> | | |
| 168 | dnl | | |
| 169 | dnl Permission to use, copy, modify, distribute, and sell this file for any | | |
| 170 | dnl purpose is hereby granted without fee, provided that the above copyright | | |
| 171 | dnl and this permission notice appear in all copies. No representations are | | |
| 172 | dnl made about the suitability of this software for any purpose. It is | | |
| 173 | dnl provided "as is" without express or implied warranty. | | |
| 174 | dnl | | |
| 175 | AC_DEFUN([AC_C99_FUNC_LRINT], | | |
| 176 | [AC_CACHE_CHECK(for lrint, | | |
| 177 | ac_cv_c99_lrint, | | |
| 178 | [ | | |
| 179 | lrint_save_CFLAGS=$CFLAGS | | |
| 180 | CFLAGS="-O2 -lm" | | |
| 181 | AC_TRY_LINK([ | | |
| 182 | #define _ISOC9X_SOURCE 1 | | |
| 183 | #define _ISOC99_SOURCE 1 | | |
| 184 | #define __USE_ISOC99 1 | | |
| 185 | #define __USE_ISOC9X 1 | | |
| 186 | | | |
| 187 | #include <math.h> | | |
| 188 | ], if (!lrint(3.14159)) lrint(2.7183);, ac_cv_c99_lrint=yes, ac_cv_c99_lrint=no) | | |
| 189 | | | |
| 190 | CFLAGS=$lrint_save_CFLAGS | | |
| 191 | | | |
| 192 | ]) | | |
| 193 | | | |
| 194 | if test "$ac_cv_c99_lrint" = yes; then | | |
| 195 | AC_DEFINE(HAVE_LRINT, 1, | | |
| 196 | [Define if you have C99's lrint function.]) | | |
| 197 | fi | | |
| 198 | ])# AC_C99_FUNC_LRINT | | |
| 199 | | | |
| 200 | | | |
| 201 | | | |
| 202 | | | |
| 203 | | | |
| 204 | dnl @synopsis AC_C99_FUNC_LRINTF | | |
| 205 | dnl | | |
| 206 | dnl Check whether C99's lrintf function is available. | | |
| 207 | dnl @version 1.3 Feb 12 2002 | | |
| 208 | dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com> | | |
| 209 | dnl | | |
| 210 | dnl Permission to use, copy, modify, distribute, and sell this file for any | | |
| 211 | dnl purpose is hereby granted without fee, provided that the above copyright | | |
| 212 | dnl and this permission notice appear in all copies. No representations are | | |
| 213 | dnl made about the suitability of this software for any purpose. It is | | |
| 214 | dnl provided "as is" without express or implied warranty. | | |
| 215 | dnl | | |
| 216 | | | |
| 217 | AC_DEFUN([AC_C99_FUNC_LRINTF], | | |
| 218 | [AC_CACHE_CHECK(for lrintf, | | |
| 219 | ac_cv_c99_lrintf, | | |
| 220 | [ | | |
| 221 | lrintf_save_CFLAGS=$CFLAGS | | |
| 222 | CFLAGS="-O2 -lm" | | |
| 223 | AC_TRY_LINK([ | | |
| 224 | #define _ISOC9X_SOURCE 1 | | |
| 225 | #define _ISOC99_SOURCE 1 | | |
| 226 | #define __USE_ISOC99 1 | | |
| 227 | #define __USE_ISOC9X 1 | | |
| 228 | | | |
| 229 | #include <math.h> | | |
| 230 | ], if (!lrintf(3.14159)) lrintf(2.7183);, ac_cv_c99_lrintf=yes, ac_cv_c99_lrintf=no) | | |
| 231 | | | |
| 232 | CFLAGS=$lrintf_save_CFLAGS | | |
| 233 | | | |
| 234 | ]) | | |
| 235 | | | |
| 236 | if test "$ac_cv_c99_lrintf" = yes; then | | |
| 237 | AC_DEFINE(HAVE_LRINTF, 1, | | |
| 238 | [Define if you have C99's lrintf function.]) | | |
| 239 | fi | | |
| 240 | ])# AC_C99_FUNC_LRINTF | | |
| 241 | | | |
| 242 | | | |
| 243 | | | |
| 244 | | | |
| 245 | | | |
| 246 | dnl @synopsis AC_C99_FUNC_LLRINT | | |
| 247 | dnl | | |
| 248 | dnl Check whether C99's llrint function is available. | | |
| 249 | dnl @version 1.1 Sep 30 2002 | | |
| 250 | dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com> | | |
| 251 | dnl | | |
| 252 | dnl Permission to use, copy, modify, distribute, and sell this file for any | | |
| 253 | dnl purpose is hereby granted without fee, provided that the above copyright | | |
| 254 | dnl and this permission notice appear in all copies. No representations are | | |
| 255 | dnl made about the suitability of this software for any purpose. It is | | |
| 256 | dnl provided "as is" without express or implied warranty. | | |
| 257 | dnl | | |
| 258 | AC_DEFUN([AC_C99_FUNC_LLRINT], | | |
| 259 | [AC_CACHE_CHECK(for llrint, | | |
| 260 | ac_cv_c99_llrint, | | |
| 261 | [ | | |
| 262 | llrint_save_CFLAGS=$CFLAGS | | |
| 263 | CFLAGS="-O2 -lm" | | |
| 264 | AC_TRY_LINK([ | | |
| 265 | #define _ISOC9X_SOURCE 1 | | |
| 266 | #define _ISOC99_SOURCE 1 | | |
| 267 | #define __USE_ISOC99 1 | | |
| 268 | #define __USE_ISOC9X 1 | | |
| 269 | | | |
| 270 | #include <math.h> | | |
| 271 | #include <stdint.h> | | |
| 272 | ], int64_t x ; x = llrint(3.14159) ;, ac_cv_c99_llrint=yes, ac_cv_c99_llrint=no) | | |
| 273 | | | |
| 274 | CFLAGS=$llrint_save_CFLAGS | | |
| 275 | | | |
| 276 | ]) | | |
| 277 | | | |
| 278 | if test "$ac_cv_c99_llrint" = yes; then | | |
| 279 | AC_DEFINE(HAVE_LLRINT, 1, | | |
| 280 | [Define if you have C99's llrint function.]) | | |
| 281 | fi | | |
| 282 | ])# AC_C99_FUNC_LLRINT | | |
| 283 | | | |
| 284 | | | |
| 285 | | | |
| 286 | | | |
| 287 | | | |
| 288 | dnl @synopsis AC_C_CLIP_MODE | | |
| 289 | dnl | | |
| 290 | dnl Determine the clipping mode when converting float to int. | | |
| 291 | dnl @version 1.0 May 17 2003 | | |
| 292 | dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com> | | |
| 293 | dnl | | |
| 294 | dnl Permission to use, copy, modify, distribute, and sell this file for any | | |
| 295 | dnl purpose is hereby granted without fee, provided that the above copyright | | |
| 296 | dnl and this permission notice appear in all copies. No representations are | | |
| 297 | dnl made about the suitability of this software for any purpose. It is | | |
| 298 | dnl provided "as is" without express or implied warranty. | | |
| 299 | | | |
| 300 | dnl Find the clipping mode in the following way: | | |
| 301 | dnl 1) If we are not cross compiling test it. | | |
| 302 | dnl 2) IF we are cross compiling, assume that clipping isn't done correctly. | | |
| 303 | | | |
| 304 | AC_DEFUN([AC_C_CLIP_MODE], | | |
| 305 | [AC_CACHE_CHECK(processor clipping capabilities, | | |
| 306 | ac_cv_c_clip_type, | | |
| 307 | | | |
| 308 | # Initialize to unknown | | |
| 309 | ac_cv_c_clip_positive=unknown | | |
| 310 | ac_cv_c_clip_negative=unknown | | |
| 311 | | | |
| 312 | if test $ac_cv_c_clip_positive = unknown ; then | | |
| 313 | AC_TRY_RUN( | | |
| 314 | [[ | | |
| 315 | #define _ISOC9X_SOURCE 1 | | |
| 316 | #define _ISOC99_SOURCE 1 | | |
| 317 | #define __USE_ISOC99 1 | | |
| 318 | #define __USE_ISOC9X 1 | | |
| 319 | #include <math.h> | | |
| 320 | int main (void) | | |
| 321 | { double fval ; | | |
| 322 | int k, ival ; | | |
| 323 | | | |
| 324 | fval = 1.0 * 0x7FFFFFFF ; | | |
| 325 | for (k = 0 ; k < 100 ; k++) | | |
| 326 | { ival = (lrint (fval)) >> 24 ; | | |
| 327 | if (ival != 127) | | |
| 328 | return 1 ; | | |
| 329 | | | |
| 330 | fval *= 1.2499999 ; | | |
| 331 | } ; | | |
| 332 | | | |
| 333 | return 0 ; | | |
| 334 | } | | |
| 335 | ]], | | |
| 336 | ac_cv_c_clip_positive=yes, | | |
| 337 | ac_cv_c_clip_positive=no, | | |
| 338 | ac_cv_c_clip_positive=unknown | | |
| 339 | ) | | |
| 340 | | | |
| 341 | AC_TRY_RUN( | | |
| 342 | [[ | | |
| 343 | #define _ISOC9X_SOURCE 1 | | |
| 344 | #define _ISOC99_SOURCE 1 | | |
| 345 | #define __USE_ISOC99 1 | | |
| 346 | #define __USE_ISOC9X 1 | | |
| 347 | #include <math.h> | | |
| 348 | int main (void) | | |
| 349 | { double fval ; | | |
| 350 | int k, ival ; | | |
| 351 | | | |
| 352 | fval = -8.0 * 0x10000000 ; | | |
| 353 | for (k = 0 ; k < 100 ; k++) | | |
| 354 | { ival = (lrint (fval)) >> 24 ; | | |
| 355 | if (ival != -128) | | |
| 356 | return 1 ; | | |
| 357 | | | |
| 358 | fval *= 1.2499999 ; | | |
| 359 | } ; | | |
| 360 | | | |
| 361 | return 0 ; | | |
| 362 | } | | |
| 363 | ]], | | |
| 364 | ac_cv_c_clip_negative=yes, | | |
| 365 | ac_cv_c_clip_negative=no, | | |
| 366 | ac_cv_c_clip_negative=unknown | | |
| 367 | ) | | |
| 368 | | | |
| 369 | fi | | |
| 370 | | | |
| 371 | if test $ac_cv_c_clip_positive = yes ; then | | |
| 372 | ac_cv_c_clip_positive=1 | | |
| 373 | else | | |
| 374 | ac_cv_c_clip_positive=0 | | |
| 375 | fi | | |
| 376 | | | |
| 377 | if test $ac_cv_c_clip_negative = yes ; then | | |
| 378 | ac_cv_c_clip_negative=1 | | |
| 379 | else | | |
| 380 | ac_cv_c_clip_negative=0 | | |
| 381 | fi | | |
| 382 | | | |
| 383 | [[ | | |
| 384 | case "$ac_cv_c_clip_positive$ac_cv_c_clip_negative" in | | |
| 385 | "00") | | |
| 386 | ac_cv_c_clip_type="none" | | |
| 387 | ;; | | |
| 388 | "10") | | |
| 389 | ac_cv_c_clip_type="positive" | | |
| 390 | ;; | | |
| 391 | "01") | | |
| 392 | ac_cv_c_clip_type="negative" | | |
| 393 | ;; | | |
| 394 | "11") | | |
| 395 | ac_cv_c_clip_type="both" | | |
| 396 | ;; | | |
| 397 | esac | | |
| 398 | ]] | | |
| 399 | | | |
| 400 | ) | | |
| 401 | ] | | |
| 402 | | | |
| 403 | )# AC_C_CLIP_MODE | | |
| 404 | | | |
| 405 | | | |
| 406 | | | |
| 407 | | | |
| 408 | | | |
| 409 | dnl @synopsis AC_CHECK_SIGNAL(SIGNAME) | | |
| 410 | dnl | | |
| 411 | dnl | | |
| 412 | dnl @category C | | |
| 413 | dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com> | | |
| 414 | dnl @version 1.0 Jul 07 2007 | | |
| 415 | | | |
| 416 | AC_DEFUN([AC_CHECK_SIGNAL], | | |
| 417 | [AC_CACHE_CHECK(for $1, | | |
| 418 | ac_cv_signal_$1, | | |
| 419 | [ | | |
| 420 | AC_TRY_LINK([ | | |
| 421 | #include <signal.h> | | |
| 422 | | | |
| 423 | ], signal($1, SIG_DFL) ;, ac_cv_signal_$1=yes, ac_cv_signal_$1=no) | | |
| 424 | | | |
| 425 | ]) | | |
| 426 | | | |
| 427 | if test "$ac_cv_signal_$1" = yes; then | | |
| 428 | AC_DEFINE(HAVE_$1, 1, | | |
| 429 | [Define if you have signal $1.]) | | |
| 430 | fi | | |
| 431 | ])# AC_CHECK_SIGNAL | | |
| 432 | | | |
| 433 | | | |
| 434 | ## AC_CHECK_SIGNALS | | |