| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | ifdef([AC_PROG_CC_GNU],,[AC_DEFUN([AC_PROG_CC_GNU],)]) |
|---|
| 25 | AC_DEFUN([PAC_PROG_CC],[ |
|---|
| 26 | AC_PROVIDE([AC_PROG_CC]) |
|---|
| 27 | AC_CHECK_PROGS(CC, cc xlC xlc pgcc icc pathcc gcc ) |
|---|
| 28 | test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) |
|---|
| 29 | PAC_PROG_CC_WORKS |
|---|
| 30 | AC_PROG_CC_GNU |
|---|
| 31 | if test "$ac_cv_prog_gcc" = yes; then |
|---|
| 32 | GCC=yes |
|---|
| 33 | else |
|---|
| 34 | GCC= |
|---|
| 35 | fi |
|---|
| 36 | ]) |
|---|
| 37 | |
|---|
| 38 | |
|---|
| 39 | |
|---|
| 40 | |
|---|
| 41 | |
|---|
| 42 | |
|---|
| 43 | |
|---|
| 44 | |
|---|
| 45 | |
|---|
| 46 | |
|---|
| 47 | |
|---|
| 48 | |
|---|
| 49 | |
|---|
| 50 | |
|---|
| 51 | |
|---|
| 52 | |
|---|
| 53 | |
|---|
| 54 | |
|---|
| 55 | |
|---|
| 56 | |
|---|
| 57 | |
|---|
| 58 | |
|---|
| 59 | AC_DEFUN([PAC_C_CHECK_COMPILER_OPTION],[ |
|---|
| 60 | AC_MSG_CHECKING([whether C compiler accepts option $1]) |
|---|
| 61 | save_CFLAGS="$CFLAGS" |
|---|
| 62 | CFLAGS="$1 $CFLAGS" |
|---|
| 63 | rm -f conftest.out |
|---|
| 64 | echo 'int foo(void);int foo(void){return 0;}' > conftest2.c |
|---|
| 65 | echo 'int main(void);int main(void){return 0;}' > conftest.c |
|---|
| 66 | if ${CC-cc} $save_CFLAGS $CPPFLAGS -o conftest conftest.c $LDFLAGS >conftest.bas 2>&1 ; then |
|---|
| 67 | if ${CC-cc} $CFLAGS $CPPFLAGS -o conftest conftest.c $LDFLAGS >conftest.out 2>&1 ; then |
|---|
| 68 | if diff -b conftest.out conftest.bas >/dev/null 2>&1 ; then |
|---|
| 69 | AC_MSG_RESULT(yes) |
|---|
| 70 | AC_MSG_CHECKING([whether routines compiled with $1 can be linked with ones compiled without $1]) |
|---|
| 71 | rm -f conftest.out |
|---|
| 72 | rm -f conftest.bas |
|---|
| 73 | if ${CC-cc} -c $save_CFLAGS $CPPFLAGS conftest2.c >conftest2.out 2>&1 ; then |
|---|
| 74 | if ${CC-cc} $CFLAGS $CPPFLAGS -o conftest conftest2.o conftest.c $LDFLAGS >conftest.bas 2>&1 ; then |
|---|
| 75 | if ${CC-cc} $CFLAGS $CPPFLAGS -o conftest conftest2.o conftest.c $LDFLAGS >conftest.out 2>&1 ; then |
|---|
| 76 | if diff -b conftest.out conftest.bas >/dev/null 2>&1 ; then |
|---|
| 77 | AC_MSG_RESULT(yes) |
|---|
| 78 | CFLAGS="$save_CFLAGS" |
|---|
| 79 | ifelse($2,,COPTIONS="$COPTIONS $1",$2) |
|---|
| 80 | elif test -s conftest.out ; then |
|---|
| 81 | cat conftest.out >&AC_FD_CC |
|---|
| 82 | AC_MSG_RESULT(no) |
|---|
| 83 | CFLAGS="$save_CFLAGS" |
|---|
| 84 | $3 |
|---|
| 85 | else |
|---|
| 86 | AC_MSG_RESULT(no) |
|---|
| 87 | CFLAGS="$save_CFLAGS" |
|---|
| 88 | $3 |
|---|
| 89 | fi |
|---|
| 90 | else |
|---|
| 91 | if test -s conftest.out ; then |
|---|
| 92 | cat conftest.out >&AC_FD_CC |
|---|
| 93 | fi |
|---|
| 94 | AC_MSG_RESULT(no) |
|---|
| 95 | CFLAGS="$save_CFLAGS" |
|---|
| 96 | $3 |
|---|
| 97 | fi |
|---|
| 98 | else |
|---|
| 99 | |
|---|
| 100 | AC_MSG_RESULT(no) |
|---|
| 101 | fi |
|---|
| 102 | else |
|---|
| 103 | if test -s conftest2.out ; then |
|---|
| 104 | cat conftest2.out >&AC_FD_CC |
|---|
| 105 | fi |
|---|
| 106 | AC_MSG_RESULT(no) |
|---|
| 107 | CFLAGS="$save_CFLAGS" |
|---|
| 108 | $3 |
|---|
| 109 | fi |
|---|
| 110 | else |
|---|
| 111 | cat conftest.out >&AC_FD_CC |
|---|
| 112 | AC_MSG_RESULT(no) |
|---|
| 113 | $3 |
|---|
| 114 | CFLAGS="$save_CFLAGS" |
|---|
| 115 | fi |
|---|
| 116 | else |
|---|
| 117 | AC_MSG_RESULT(no) |
|---|
| 118 | $3 |
|---|
| 119 | if test -s conftest.out ; then cat conftest.out >&AC_FD_CC ; fi |
|---|
| 120 | CFLAGS="$save_CFLAGS" |
|---|
| 121 | fi |
|---|
| 122 | else |
|---|
| 123 | |
|---|
| 124 | AC_MSG_RESULT(no) |
|---|
| 125 | fi |
|---|
| 126 | |
|---|
| 127 | rm -rf conftest.dSYM |
|---|
| 128 | rm -f conftest* |
|---|
| 129 | ]) |
|---|
| 130 | |
|---|
| 131 | |
|---|
| 132 | |
|---|
| 133 | |
|---|
| 134 | |
|---|
| 135 | |
|---|
| 136 | |
|---|
| 137 | |
|---|
| 138 | |
|---|
| 139 | |
|---|
| 140 | |
|---|
| 141 | |
|---|
| 142 | |
|---|
| 143 | |
|---|
| 144 | |
|---|
| 145 | |
|---|
| 146 | |
|---|
| 147 | AC_DEFUN([PAC_C_OPTIMIZATION],[ |
|---|
| 148 | for copt in "-O4 -Ofast" "-Ofast" "-fast" "-O3" "-xO3" "-O" ; do |
|---|
| 149 | PAC_C_CHECK_COMPILER_OPTION($copt,found_opt=yes,found_opt=no) |
|---|
| 150 | if test "$found_opt" = "yes" ; then |
|---|
| 151 | ifelse($1,,COPTIONS="$COPTIONS $copt",$1) |
|---|
| 152 | break |
|---|
| 153 | fi |
|---|
| 154 | done |
|---|
| 155 | if test "$ac_cv_prog_gcc" = "yes" ; then |
|---|
| 156 | for copt in "-fomit-frame-pointer" "-finline-functions" \ |
|---|
| 157 | "-funroll-loops" ; do |
|---|
| 158 | PAC_C_CHECK_COMPILER_OPTION($copt,found_opt=yes,found_opt=no) |
|---|
| 159 | if test $found_opt = "yes" ; then |
|---|
| 160 | ifelse($1,,COPTIONS="$COPTIONS $copt",$1) |
|---|
| 161 | |
|---|
| 162 | fi |
|---|
| 163 | done |
|---|
| 164 | |
|---|
| 165 | fi |
|---|
| 166 | |
|---|
| 167 | ]) |
|---|
| 168 | |
|---|
| 169 | |
|---|
| 170 | |
|---|
| 171 | |
|---|
| 172 | |
|---|
| 173 | |
|---|
| 174 | |
|---|
| 175 | |
|---|
| 176 | |
|---|
| 177 | |
|---|
| 178 | |
|---|
| 179 | |
|---|
| 180 | |
|---|
| 181 | |
|---|
| 182 | |
|---|
| 183 | |
|---|
| 184 | |
|---|
| 185 | |
|---|
| 186 | |
|---|
| 187 | |
|---|
| 188 | |
|---|
| 189 | |
|---|
| 190 | |
|---|
| 191 | |
|---|
| 192 | |
|---|
| 193 | |
|---|
| 194 | |
|---|
| 195 | |
|---|
| 196 | |
|---|
| 197 | |
|---|
| 198 | |
|---|
| 199 | |
|---|
| 200 | |
|---|
| 201 | |
|---|
| 202 | |
|---|
| 203 | |
|---|
| 204 | |
|---|
| 205 | |
|---|
| 206 | |
|---|
| 207 | |
|---|
| 208 | |
|---|
| 209 | |
|---|
| 210 | |
|---|
| 211 | |
|---|
| 212 | |
|---|
| 213 | |
|---|
| 214 | |
|---|
| 215 | |
|---|
| 216 | |
|---|
| 217 | |
|---|
| 218 | |
|---|
| 219 | |
|---|
| 220 | |
|---|
| 221 | |
|---|
| 222 | |
|---|
| 223 | AC_DEFUN([PAC_C_DEPENDS],[ |
|---|
| 224 | AC_SUBST(C_DEPEND_OPT)AM_IGNORE(C_DEPEND_OPT) |
|---|
| 225 | AC_SUBST(C_DEPEND_OUT)AM_IGNORE(C_DEPEND_OUT) |
|---|
| 226 | AC_SUBST(C_DEPEND_MV)AM_IGNORE(C_DEPEND_MV) |
|---|
| 227 | AC_SUBST(C_DEPEND_PREFIX)AM_IGNORE(C_DEPEND_PREFIX) |
|---|
| 228 | AC_SUBST_FILE(C_DO_DEPENDS) |
|---|
| 229 | |
|---|
| 230 | |
|---|
| 231 | |
|---|
| 232 | if test -n "$ac_cv_c_depend_opt" ; then |
|---|
| 233 | AC_MSG_RESULT([Option $ac_cv_c_depend_opt creates dependencies (cached)]) |
|---|
| 234 | C_DEPEND_OUT="$ac_cv_c_depend_out" |
|---|
| 235 | C_DEPEND_MV="$ac_cv_c_depend_mv" |
|---|
| 236 | C_DEPEND_OPT="$ac_cv_c_depend_opt" |
|---|
| 237 | C_DEPEND_PREFIX="$ac_cv_c_depend_prefix" |
|---|
| 238 | C_DO_DEPENDS="$ac_cv_c_do_depends" |
|---|
| 239 | else |
|---|
| 240 | |
|---|
| 241 | |
|---|
| 242 | rm -rf conftest.dSYM |
|---|
| 243 | rm -f conftest* |
|---|
| 244 | |
|---|
| 245 | |
|---|
| 246 | |
|---|
| 247 | |
|---|
| 248 | cat >conftest.c <<EOF |
|---|
| 249 | |
|---|
| 250 | int f(void) { return 0; } |
|---|
| 251 | EOF |
|---|
| 252 | |
|---|
| 253 | |
|---|
| 254 | |
|---|
| 255 | |
|---|
| 256 | for copt in "-xM1" "-c -xM1" "-xM" "-c -xM" "-MM" "-M" "-c -M"; do |
|---|
| 257 | AC_MSG_CHECKING([whether $copt option generates dependencies]) |
|---|
| 258 | rm -f conftest.o conftest.u conftest.d conftest.err conftest.out |
|---|
| 259 | |
|---|
| 260 | if $CC $CFLAGS $copt conftest.c >conftest.out 2>conftest.err && \ |
|---|
| 261 | test ! -s conftest.err ; then |
|---|
| 262 | |
|---|
| 263 | if test -s conftest.u ; then |
|---|
| 264 | C_DEPEND_OUT="" |
|---|
| 265 | C_DEPEND_MV='mv $[*].u ${C_DEPEND_DIR}/$[*].dep' |
|---|
| 266 | pac_dep_file=conftest.u |
|---|
| 267 | elif test -s conftest.d ; then |
|---|
| 268 | C_DEPEND_OUT="" |
|---|
| 269 | C_DEPEND_MV='mv $[*].d ${C_DEPEND_DIR}/$[*].dep' |
|---|
| 270 | pac_dep_file=conftest.d |
|---|
| 271 | else |
|---|
| 272 | |
|---|
| 273 | |
|---|
| 274 | C_DEPEND_OUT='>$@' |
|---|
| 275 | C_DEPEND_MV=: |
|---|
| 276 | pac_dep_file=conftest.out |
|---|
| 277 | fi |
|---|
| 278 | if grep 'confdefs.h' $pac_dep_file >/dev/null 2>&1 ; then |
|---|
| 279 | AC_MSG_RESULT(yes) |
|---|
| 280 | C_DEPEND_OPT="$copt" |
|---|
| 281 | AC_MSG_CHECKING([whether .o file created with dependency file]) |
|---|
| 282 | if test -s conftest.o ; then |
|---|
| 283 | AC_MSG_RESULT(yes) |
|---|
| 284 | else |
|---|
| 285 | AC_MSG_RESULT(no) |
|---|
| 286 | echo "Output of $copt option was" >&AC_FD_CC |
|---|
| 287 | cat $pac_dep_file >&AC_FD_CC |
|---|
| 288 | fi |
|---|
| 289 | break |
|---|
| 290 | else |
|---|
| 291 | AC_MSG_RESULT(no) |
|---|
| 292 | fi |
|---|
| 293 | else |
|---|
| 294 | echo "Error in compiling program with flags $copt" >&AC_FD_CC |
|---|
| 295 | cat conftest.out >&AC_FD_CC |
|---|
| 296 | if test -s conftest.err ; then cat conftest.err >&AC_FD_CC ; fi |
|---|
| 297 | AC_MSG_RESULT(no) |
|---|
| 298 | fi |
|---|
| 299 | copt="" |
|---|
| 300 | done |
|---|
| 301 | if test -f $CONFIG_AUX_DIR/dependsrule -o \ |
|---|
| 302 | -f $CONFIG_AUX_DIR/dependsrule.in; then |
|---|
| 303 | C_DO_DEPENDS="$CONFIG_AUX_DIR/dependsrule" |
|---|
| 304 | else |
|---|
| 305 | C_DO_DEPENDS="/dev/null" |
|---|
| 306 | fi |
|---|
| 307 | if test "X$copt" = "X" ; then |
|---|
| 308 | C_DEPEND_PREFIX="true" |
|---|
| 309 | else |
|---|
| 310 | C_DEPEND_PREFIX="" |
|---|
| 311 | fi |
|---|
| 312 | ac_cv_c_depend_out="$C_DEPEND_OUT" |
|---|
| 313 | ac_cv_c_depend_mv="$C_DEPEND_MV" |
|---|
| 314 | ac_cv_c_depend_opt="$C_DEPEND_OPT" |
|---|
| 315 | ac_cv_c_depend_prefix="$C_DEPEND_PREFIX" |
|---|
| 316 | ac_cv_c_do_depends="$C_DO_DEPENDS" |
|---|
| 317 | fi |
|---|
| 318 | ]) |
|---|
| 319 | |
|---|
| 320 | |
|---|
| 321 | |
|---|
| 322 | |
|---|
| 323 | |
|---|
| 324 | |
|---|
| 325 | |
|---|
| 326 | |
|---|
| 327 | AC_DEFUN([PAC_C_PROTOTYPES],[ |
|---|
| 328 | AC_CACHE_CHECK([whether $CC supports function prototypes], |
|---|
| 329 | pac_cv_c_prototypes,[ |
|---|
| 330 | AC_TRY_COMPILE([int f(double a){return 0;}],[return 0];, |
|---|
| 331 | pac_cv_c_prototypes="yes",pac_cv_c_prototypes="no")]) |
|---|
| 332 | if test "$pac_cv_c_prototypes" = "yes" ; then |
|---|
| 333 | ifelse([$1],,:,[$1]) |
|---|
| 334 | else |
|---|
| 335 | ifelse([$2],,:,[$2]) |
|---|
| 336 | fi |
|---|
| 337 | ]) |
|---|
| 338 | |
|---|
| 339 | |
|---|
| 340 | |
|---|
| 341 | |
|---|
| 342 | |
|---|
| 343 | |
|---|
| 344 | |
|---|
| 345 | |
|---|
| 346 | |
|---|
| 347 | |
|---|
| 348 | |
|---|
| 349 | |
|---|
| 350 | |
|---|
| 351 | |
|---|
| 352 | AC_DEFUN([PAC_FUNC_SEMCTL],[ |
|---|
| 353 | AC_CHECK_FUNC(semctl) |
|---|
| 354 | if test "$ac_cv_func_semctl" = "yes" ; then |
|---|
| 355 | AC_CACHE_CHECK([for union semun], |
|---|
| 356 | pac_cv_type_union_semun,[ |
|---|
| 357 | AC_TRY_COMPILE([ |
|---|
| 358 | |
|---|
| 359 | |
|---|
| 360 | pac_cv_type_union_semun="yes",pac_cv_type_union_semun="no")]) |
|---|
| 361 | if test "$pac_cv_type_union_semun" = "yes" ; then |
|---|
| 362 | AC_DEFINE(HAVE_UNION_SEMUN,1,[Has union semun]) |
|---|
| 363 | |
|---|
| 364 | |
|---|
| 365 | AC_CACHE_CHECK([whether semctl needs union semun], |
|---|
| 366 | pac_cv_func_semctl_needs_semun,[ |
|---|
| 367 | AC_TRY_COMPILE([ |
|---|
| 368 | |
|---|
| 369 | |
|---|
| 370 | int arg = 0; semctl( 1, 1, SETVAL, arg );], |
|---|
| 371 | pac_cv_func_semctl_needs_semun="yes", |
|---|
| 372 | pac_cv_func_semctl_needs_semun="no") |
|---|
| 373 | ]) |
|---|
| 374 | if test "$pac_cv_func_semctl_needs_semun" = "yes" ; then |
|---|
| 375 | AC_DEFINE(SEMCTL_NEEDS_SEMUN,1,[Needs an explicit definition of semun]) |
|---|
| 376 | fi |
|---|
| 377 | fi |
|---|
| 378 | fi |
|---|
| 379 | ]) |
|---|
| 380 | |
|---|
| 381 | |
|---|
| 382 | |
|---|
| 383 | |
|---|
| 384 | |
|---|
| 385 | |
|---|
| 386 | |
|---|
| 387 | |
|---|
| 388 | |
|---|
| 389 | |
|---|
| 390 | |
|---|
| 391 | AC_DEFUN([PAC_C_VOLATILE],[ |
|---|
| 392 | AC_CACHE_CHECK([for volatile], |
|---|
| 393 | pac_cv_c_volatile,[ |
|---|
| 394 | AC_TRY_COMPILE(,[volatile int a;],pac_cv_c_volatile="yes", |
|---|
| 395 | pac_cv_c_volatile="no")]) |
|---|
| 396 | if test "$pac_cv_c_volatile" = "no" ; then |
|---|
| 397 | AC_DEFINE(volatile,,[if C does not support volatile]) |
|---|
| 398 | fi |
|---|
| 399 | ]) |
|---|
| 400 | |
|---|
| 401 | |
|---|
| 402 | |
|---|
| 403 | |
|---|
| 404 | |
|---|
| 405 | |
|---|
| 406 | |
|---|
| 407 | |
|---|
| 408 | |
|---|
| 409 | |
|---|
| 410 | |
|---|
| 411 | AC_DEFUN([PAC_C_INLINE],[ |
|---|
| 412 | AC_CACHE_CHECK([for inline], |
|---|
| 413 | pac_cv_c_inline,[ |
|---|
| 414 | AC_TRY_COMPILE([inline int a( int b ){return b+1;}],[int a;], |
|---|
| 415 | pac_cv_c_inline="yes",pac_cv_c_inline="no")]) |
|---|
| 416 | if test "$pac_cv_c_inline" = "no" ; then |
|---|
| 417 | AC_DEFINE(inline,,[if C does not support inline]) |
|---|
| 418 | fi |
|---|
| 419 | ]) |
|---|
| 420 | |
|---|
| 421 | |
|---|
| 422 | |
|---|
| 423 | |
|---|
| 424 | |
|---|
| 425 | |
|---|
| 426 | |
|---|
| 427 | |
|---|
| 428 | |
|---|
| 429 | |
|---|
| 430 | |
|---|
| 431 | |
|---|
| 432 | |
|---|
| 433 | |
|---|
| 434 | |
|---|
| 435 | |
|---|
| 436 | |
|---|
| 437 | |
|---|
| 438 | |
|---|
| 439 | |
|---|
| 440 | |
|---|
| 441 | |
|---|
| 442 | AC_DEFUN([PAC_C_CONST], |
|---|
| 443 | [AC_CACHE_CHECK([for an ANSI C-conforming const], pac_cv_c_const, |
|---|
| 444 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], |
|---|
| 445 | [[/* FIXME: Include the comments suggested by Paul. */ |
|---|
| 446 | |
|---|
| 447 | /* Ultrix mips cc rejects this. */ |
|---|
| 448 | typedef int charset[2]; |
|---|
| 449 | const charset cs = {0,0}; |
|---|
| 450 | /* SunOS 4.1.1 cc rejects this. */ |
|---|
| 451 | char const *const *pcpcc; |
|---|
| 452 | char **ppc; |
|---|
| 453 | /* NEC SVR4.0.2 mips cc rejects this. */ |
|---|
| 454 | struct point {int x, y;}; |
|---|
| 455 | static struct point const zero = {0,0}; |
|---|
| 456 | /* AIX XL C 1.02.0.0 rejects this. |
|---|
| 457 | It does not let you subtract one const X* pointer from another in |
|---|
| 458 | an arm of an if-expression whose if-part is not a constant |
|---|
| 459 | expression */ |
|---|
| 460 | const char *g = "string"; |
|---|
| 461 | pcpcc = &g + (g ? g-g : 0); |
|---|
| 462 | /* HPUX 7.0 cc rejects these. */ |
|---|
| 463 | ++pcpcc; |
|---|
| 464 | ppc = (char**) pcpcc; |
|---|
| 465 | pcpcc = (char const *const *) ppc; |
|---|
| 466 | { /* SCO 3.2v4 cc rejects this. */ |
|---|
| 467 | char const *s = 0 ? (char *) 0 : (char const *) 0; |
|---|
| 468 | if (s) return 0; |
|---|
| 469 | } |
|---|
| 470 | { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ |
|---|
| 471 | int x[] = {25, 17}; |
|---|
| 472 | const int *foo = &x[0]; |
|---|
| 473 | ++foo; |
|---|
| 474 | } |
|---|
| 475 | { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ |
|---|
| 476 | typedef const int *iptr; |
|---|
| 477 | iptr p = 0; |
|---|
| 478 | ++p; |
|---|
| 479 | } |
|---|
| 480 | { /* AIX XL C 1.02.0.0 rejects this saying |
|---|
| 481 | "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ |
|---|
| 482 | struct s { int j; const int *ap[3]; }; |
|---|
| 483 | struct s a; |
|---|
| 484 | struct s *b = &a; |
|---|
| 485 | b->j = 5; |
|---|
| 486 | } |
|---|
| 487 | { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ |
|---|
| 488 | const int foo = 10; |
|---|
| 489 | if (!foo) return 0; |
|---|
| 490 | } |
|---|
| 491 | return !cs[0] && !zero.x; |
|---|
| 492 | |
|---|
| 493 | ]])], |
|---|
| 494 | [pac_cv_c_const=yes], |
|---|
| 495 | [pac_cv_c_const=no])]) |
|---|
| 496 | if test $pac_cv_c_const = no; then |
|---|
| 497 | AC_DEFINE(const,, |
|---|
| 498 | [Define to empty if `const' does not conform to ANSI C.]) |
|---|
| 499 | fi |
|---|
| 500 | ]) |
|---|
| 501 | |
|---|
| 502 | |
|---|
| 503 | |
|---|
| 504 | |
|---|
| 505 | |
|---|
| 506 | |
|---|
| 507 | |
|---|
| 508 | |
|---|
| 509 | |
|---|
| 510 | |
|---|
| 511 | |
|---|
| 512 | |
|---|
| 513 | AC_DEFUN([PAC_C_CPP_CONCAT],[ |
|---|
| 514 | pac_pound=" |
|---|
| 515 | AC_CACHE_CHECK([whether the compiler $CC accepts $ac_pound$ac_pound for concatenation in cpp], |
|---|
| 516 | pac_cv_c_cpp_concat,[ |
|---|
| 517 | AC_TRY_COMPILE([ |
|---|
| 518 | |
|---|
| 519 | pac_cv_cpp_concat="yes",pac_cv_cpp_concat="no")]) |
|---|
| 520 | if test $pac_cv_c_cpp_concat = "yes" ; then |
|---|
| 521 | ifelse([$1],,:,[$1]) |
|---|
| 522 | else |
|---|
| 523 | ifelse([$2],,:,[$2]) |
|---|
| 524 | fi |
|---|
| 525 | ]) |
|---|
| 526 | |
|---|
| 527 | |
|---|
| 528 | |
|---|
| 529 | |
|---|
| 530 | |
|---|
| 531 | |
|---|
| 532 | |
|---|
| 533 | |
|---|
| 534 | |
|---|
| 535 | |
|---|
| 536 | |
|---|
| 537 | AC_DEFUN([PAC_FUNC_GETTIMEOFDAY],[ |
|---|
| 538 | AC_CACHE_CHECK([whether gettimeofday takes 2 arguments], |
|---|
| 539 | pac_cv_func_gettimeofday,[ |
|---|
| 540 | AC_TRY_COMPILE([ |
|---|
| 541 | gettimeofday(&tp,(void*)0);return 0;],pac_cv_func_gettimeofday="yes", |
|---|
| 542 | pac_cv_func_gettimeofday="no") |
|---|
| 543 | ]) |
|---|
| 544 | if test "$pac_cv_func_gettimeofday" = "yes" ; then |
|---|
| 545 | ifelse($1,,:,$1) |
|---|
| 546 | else |
|---|
| 547 | ifelse($2,,:,$2) |
|---|
| 548 | fi |
|---|
| 549 | ]) |
|---|
| 550 | |
|---|
| 551 | |
|---|
| 552 | |
|---|
| 553 | |
|---|
| 554 | |
|---|
| 555 | |
|---|
| 556 | |
|---|
| 557 | |
|---|
| 558 | |
|---|
| 559 | |
|---|
| 560 | |
|---|
| 561 | |
|---|
| 562 | |
|---|
| 563 | |
|---|
| 564 | |
|---|
| 565 | |
|---|
| 566 | |
|---|
| 567 | AC_DEFUN([PAC_C_RESTRICT],[ |
|---|
| 568 | AC_CACHE_CHECK([for restrict], |
|---|
| 569 | pac_cv_c_restrict,[ |
|---|
| 570 | AC_TRY_COMPILE(,[int * restrict a;],pac_cv_c_restrict="restrict", |
|---|
| 571 | pac_cv_c_restrict="no") |
|---|
| 572 | if test "$pac_cv_c_restrict" = "no" ; then |
|---|
| 573 | AC_TRY_COMPILE(,[int * _Restrict a;],pac_cv_c_restrict="_Restrict", |
|---|
| 574 | pac_cv_c_restrict="no") |
|---|
| 575 | fi |
|---|
| 576 | if test "$pac_cv_c_restrict" = "no" ; then |
|---|
| 577 | AC_TRY_COMPILE(,[int * __restrict a;],pac_cv_c_restrict="__restrict", |
|---|
| 578 | pac_cv_c_restrict="no") |
|---|
| 579 | fi |
|---|
| 580 | ]) |
|---|
| 581 | if test "$pac_cv_c_restrict" = "no" ; then |
|---|
| 582 | restrict_val="" |
|---|
| 583 | elif test "$pac_cv_c_restrict" != "restrict" ; then |
|---|
| 584 | restrict_val=$pac_cv_c_restrict |
|---|
| 585 | fi |
|---|
| 586 | if test "$restrict_val" != "restrict" ; then |
|---|
| 587 | AC_DEFINE_UNQUOTED(restrict,$restrict_val,[if C does not support restrict]) |
|---|
| 588 | fi |
|---|
| 589 | ]) |
|---|
| 590 | |
|---|
| 591 | |
|---|
| 592 | |
|---|
| 593 | |
|---|
| 594 | |
|---|
| 595 | |
|---|
| 596 | |
|---|
| 597 | |
|---|
| 598 | |
|---|
| 599 | |
|---|
| 600 | |
|---|
| 601 | |
|---|
| 602 | |
|---|
| 603 | |
|---|
| 604 | |
|---|
| 605 | |
|---|
| 606 | |
|---|
| 607 | |
|---|
| 608 | |
|---|
| 609 | |
|---|
| 610 | |
|---|
| 611 | |
|---|
| 612 | |
|---|
| 613 | |
|---|
| 614 | |
|---|
| 615 | AC_DEFUN([PAC_HEADER_STDARG],[ |
|---|
| 616 | AC_CHECK_HEADER(stdarg.h) |
|---|
| 617 | |
|---|
| 618 | if test "$ac_cv_header_stdarg_h" = "yes" ; then |
|---|
| 619 | |
|---|
| 620 | AC_CACHE_CHECK([whether stdarg is oldstyle], |
|---|
| 621 | pac_cv_header_stdarg_oldstyle,[ |
|---|
| 622 | PAC_C_TRY_COMPILE_CLEAN([ |
|---|
| 623 | |
|---|
| 624 | [int func( int a, ... ){ |
|---|
| 625 | int b; |
|---|
| 626 | va_list ap; |
|---|
| 627 | va_start( ap ); |
|---|
| 628 | b = va_arg(ap, int); |
|---|
| 629 | printf( "%d-%d\n", a, b ); |
|---|
| 630 | va_end(ap); |
|---|
| 631 | fflush(stdout); |
|---|
| 632 | return 0; |
|---|
| 633 | } |
|---|
| 634 | int main() { func( 1, 2 ); return 0;}],pac_check_compile) |
|---|
| 635 | case "$pac_check_compile" in |
|---|
| 636 | 0) pac_cv_header_stdarg_oldstyle="yes" |
|---|
| 637 | ;; |
|---|
| 638 | 1) pac_cv_header_stdarg_oldstyle="may be newstyle" |
|---|
| 639 | ;; |
|---|
| 640 | 2) pac_cv_header_stdarg_oldstyle="no" # compile failed |
|---|
| 641 | ;; |
|---|
| 642 | esac |
|---|
| 643 | ]) |
|---|
| 644 | if test "$pac_cv_header_stdarg_oldstyle" = "yes" ; then |
|---|
| 645 | ifelse($2,,:,[$2]) |
|---|
| 646 | else |
|---|
| 647 | AC_CACHE_CHECK([whether stdarg works], |
|---|
| 648 | pac_cv_header_stdarg_works,[ |
|---|
| 649 | PAC_C_TRY_COMPILE_CLEAN([ |
|---|
| 650 | #include <stdio.h> |
|---|
| 651 | #include <stdarg.h>],[ |
|---|
| 652 | int func( int a, ... ){ |
|---|
| 653 | int b; |
|---|
| 654 | va_list ap; |
|---|
| 655 | va_start( ap, a ); |
|---|
| 656 | b = va_arg(ap, int); |
|---|
| 657 | printf( "%d-%d\n", a, b ); |
|---|
| 658 | va_end(ap); |
|---|
| 659 | fflush(stdout); |
|---|
| 660 | return 0; |
|---|
| 661 | } |
|---|
| 662 | int main() { func( 1, 2 ); return 0;}],pac_check_compile) |
|---|
| 663 | case "$pac_check_compile" in |
|---|
| 664 | 0) pac_cv_header_stdarg_works="yes" |
|---|
| 665 | ;; |
|---|
| 666 | 1) pac_cv_header_stdarg_works="yes with warnings" |
|---|
| 667 | ;; |
|---|
| 668 | 2) pac_cv_header_stdarg_works="no" |
|---|
| 669 | ;; |
|---|
| 670 | esac |
|---|
| 671 | ]) |
|---|
| 672 | fi # test on oldstyle |
|---|
| 673 | if test "$pac_cv_header_stdarg_works" = "no" ; then |
|---|
| 674 | ifelse($3,,:,[$3]) |
|---|
| 675 | else |
|---|
| 676 | ifelse($1,,:,[$1]) |
|---|
| 677 | fi |
|---|
| 678 | else |
|---|
| 679 | ifelse($3,,:,[$3]) |
|---|
| 680 | fi # test on header |
|---|
| 681 | ]) |
|---|
| 682 | dnl/*D |
|---|
| 683 | dnl PAC_C_TRY_COMPILE_CLEAN - Try to compile a program, separating success |
|---|
| 684 | dnl with no warnings from success with warnings. |
|---|
| 685 | dnl |
|---|
| 686 | dnl Synopsis: |
|---|
| 687 | dnl PAC_C_TRY_COMPILE_CLEAN(header,program,flagvar) |
|---|
| 688 | dnl |
|---|
| 689 | dnl Output Effect: |
|---|
| 690 | dnl The 'flagvar' is set to 0 (clean), 1 (dirty but success ok), or 2 |
|---|
| 691 | |
|---|
| 692 | |
|---|
| 693 | |
|---|
| 694 | AC_DEFUN([PAC_C_TRY_COMPILE_CLEAN],[ |
|---|
| 695 | $3=2 |
|---|
| 696 | |
|---|
| 697 | if test -z "$pac_TRY_COMPLILE_CLEAN" ; then |
|---|
| 698 | |
|---|
| 699 | rm -rf conftest.dSYM |
|---|
| 700 | rm -f conftest* |
|---|
| 701 | echo 'int try(void);int try(void){return 0;}' > conftest.c |
|---|
| 702 | if ${CC-cc} $CFLAGS -c conftest.c >conftest.bas 2>&1 ; then |
|---|
| 703 | if test -s conftest.bas ; then |
|---|
| 704 | pac_TRY_COMPILE_CLEAN_OUT=`cat conftest.bas` |
|---|
| 705 | fi |
|---|
| 706 | pac_TRY_COMPILE_CLEAN=1 |
|---|
| 707 | else |
|---|
| 708 | AC_MSG_WARN([Could not compile simple test program!]) |
|---|
| 709 | if test -s conftest.bas ; then cat conftest.bas >> config.log ; fi |
|---|
| 710 | fi |
|---|
| 711 | fi |
|---|
| 712 | |
|---|
| 713 | |
|---|
| 714 | |
|---|
| 715 | rm -rf conftest.dSYM |
|---|
| 716 | rm -f conftest* |
|---|
| 717 | cat >conftest.c <<EOF |
|---|
| 718 | |
|---|
| 719 | [$1] |
|---|
| 720 | [$2] |
|---|
| 721 | EOF |
|---|
| 722 | |
|---|
| 723 | |
|---|
| 724 | if ${CC-cc} $CFLAGS -c conftest.c >conftest.bas 2>&1 ; then |
|---|
| 725 | |
|---|
| 726 | if test "$pac_TRY_COMPILE_CLEAN_OUT" = "`cat conftest.bas`" ; then |
|---|
| 727 | $3=0 |
|---|
| 728 | else |
|---|
| 729 | cat conftest.c >>config.log |
|---|
| 730 | if test -s conftest.bas ; then cat conftest.bas >> config.log ; fi |
|---|
| 731 | $3=1 |
|---|
| 732 | fi |
|---|
| 733 | else |
|---|
| 734 | |
|---|
| 735 | cat conftest.c >>config.log |
|---|
| 736 | if test -s conftest.bas ; then cat conftest.bas >> config.log ; fi |
|---|
| 737 | $3=2 |
|---|
| 738 | fi |
|---|
| 739 | |
|---|
| 740 | rm -rf conftest.dSYM |
|---|
| 741 | rm -f conftest* |
|---|
| 742 | ]) |
|---|
| 743 | |
|---|
| 744 | |
|---|
| 745 | |
|---|
| 746 | |
|---|
| 747 | |
|---|
| 748 | |
|---|
| 749 | |
|---|
| 750 | |
|---|
| 751 | |
|---|
| 752 | |
|---|
| 753 | |
|---|
| 754 | |
|---|
| 755 | AC_DEFUN([PAC_PROG_C_UNALIGNED_DOUBLES],[ |
|---|
| 756 | AC_CACHE_CHECK([whether C compiler allows unaligned doubles], |
|---|
| 757 | pac_cv_prog_c_unaligned_doubles,[ |
|---|
| 758 | AC_TRY_RUN([ |
|---|
| 759 | void fetch_double( v ) |
|---|
| 760 | double *v; |
|---|
| 761 | { |
|---|
| 762 | *v = 1.0; |
|---|
| 763 | } |
|---|
| 764 | int main( argc, argv ) |
|---|
| 765 | int argc; |
|---|
| 766 | char **argv; |
|---|
| 767 | { |
|---|
| 768 | int p[4]; |
|---|
| 769 | double *p_val; |
|---|
| 770 | fetch_double( (double *)&(p[0]) ); |
|---|
| 771 | p_val = (double *)&(p[0]); |
|---|
| 772 | if (*p_val != 1.0) return 1; |
|---|
| 773 | fetch_double( (double *)&(p[1]) ); |
|---|
| 774 | p_val = (double *)&(p[1]); |
|---|
| 775 | if (*p_val != 1.0) return 1; |
|---|
| 776 | return 0; |
|---|
| 777 | } |
|---|
| 778 | ],pac_cv_prog_c_unaligned_doubles="yes",pac_cv_prog_c_unaligned_doubles="no", |
|---|
| 779 | pac_cv_prog_c_unaligned_doubles="unknown")]) |
|---|
| 780 | ifelse($1,,,if test "X$pac_cv_prog_c_unaligned_doubles" = "yes" ; then |
|---|
| 781 | $1 |
|---|
| 782 | fi) |
|---|
| 783 | ifelse($2,,,if test "X$pac_cv_prog_c_unaligned_doubles" = "no" ; then |
|---|
| 784 | $2 |
|---|
| 785 | fi) |
|---|
| 786 | ifelse($3,,,if test "X$pac_cv_prog_c_unaligned_doubles" = "unknown" ; then |
|---|
| 787 | $3 |
|---|
| 788 | fi) |
|---|
| 789 | ]) |
|---|
| 790 | |
|---|
| 791 | |
|---|
| 792 | |
|---|
| 793 | |
|---|
| 794 | |
|---|
| 795 | |
|---|
| 796 | |
|---|
| 797 | |
|---|
| 798 | |
|---|
| 799 | |
|---|
| 800 | |
|---|
| 801 | |
|---|
| 802 | |
|---|
| 803 | |
|---|
| 804 | |
|---|
| 805 | |
|---|
| 806 | |
|---|
| 807 | |
|---|
| 808 | |
|---|
| 809 | |
|---|
| 810 | |
|---|
| 811 | |
|---|
| 812 | |
|---|
| 813 | |
|---|
| 814 | |
|---|
| 815 | AC_DEFUN([PAC_PROG_C_WEAK_SYMBOLS],[ |
|---|
| 816 | pragma_extra_message="" |
|---|
| 817 | AC_CACHE_CHECK([for type of weak symbol alias support], |
|---|
| 818 | pac_cv_prog_c_weak_symbols,[ |
|---|
| 819 | |
|---|
| 820 | |
|---|
| 821 | |
|---|
| 822 | AC_TRY_LINK([ |
|---|
| 823 | extern int PFoo(int); |
|---|
| 824 | |
|---|
| 825 | int Foo(int a) { return a; } |
|---|
| 826 | ],[return PFoo(1);],has_pragma_weak=yes) |
|---|
| 827 | |
|---|
| 828 | |
|---|
| 829 | |
|---|
| 830 | |
|---|
| 831 | |
|---|
| 832 | |
|---|
| 833 | if test "$has_pragma_weak" = yes ; then |
|---|
| 834 | |
|---|
| 835 | rm -rf conftest.dSYM |
|---|
| 836 | rm -f conftest* |
|---|
| 837 | cat >>conftest1.c <<EOF |
|---|
| 838 | extern int PFoo(int); |
|---|
| 839 | |
|---|
| 840 | int Foo(int); |
|---|
| 841 | int Foo(int a) { return a; } |
|---|
| 842 | EOF |
|---|
| 843 | cat >>conftest2.c <<EOF |
|---|
| 844 | extern int PFoo(int); |
|---|
| 845 | int main(int argc, char **argv) { |
|---|
| 846 | return PFoo(0);} |
|---|
| 847 | EOF |
|---|
| 848 | ac_link2='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest1.c conftest2.c $LIBS >conftest.out 2>&1' |
|---|
| 849 | if eval $ac_link2 ; then |
|---|
| 850 | |
|---|
| 851 | |
|---|
| 852 | |
|---|
| 853 | |
|---|
| 854 | |
|---|
| 855 | rm -rf conftest.dSYM |
|---|
| 856 | rm -f conftest* |
|---|
| 857 | cat >>conftest1.c <<EOF |
|---|
| 858 | extern int PFoo(int); |
|---|
| 859 | |
|---|
| 860 | int Foo(int); |
|---|
| 861 | int Foo(int a) { return a; } |
|---|
| 862 | EOF |
|---|
| 863 | cat >>conftest2.c <<EOF |
|---|
| 864 | extern int Foo(int); |
|---|
| 865 | int PFoo(int a) { return a+1;} |
|---|
| 866 | int main(int argc, char **argv) { |
|---|
| 867 | return Foo(0);} |
|---|
| 868 | EOF |
|---|
| 869 | if eval $ac_link2 ; then |
|---|
| 870 | pac_cv_prog_c_weak_symbols="pragma weak" |
|---|
| 871 | else |
|---|
| 872 | echo "$ac_link2" >> config.log |
|---|
| 873 | echo "Failed program was" >> config.log |
|---|
| 874 | cat conftest1.c >>config.log |
|---|
| 875 | cat conftest2.c >>config.log |
|---|
| 876 | if test -s conftest.out ; then cat conftest.out >> config.log ; fi |
|---|
| 877 | has_pragma_weak=0 |
|---|
| 878 | pragma_extra_message="pragma weak accepted but does not work (probably creates two non-weak entries)" |
|---|
| 879 | fi |
|---|
| 880 | else |
|---|
| 881 | echo "$ac_link2" >>config.log |
|---|
| 882 | echo "Failed program was" >>config.log |
|---|
| 883 | cat conftest1.c >>config.log |
|---|
| 884 | cat conftest2.c >>config.log |
|---|
| 885 | if test -s conftest.out ; then cat conftest.out >> config.log ; fi |
|---|
| 886 | has_pragma_weak=0 |
|---|
| 887 | pragma_extra_message="pragma weak does not work outside of a file" |
|---|
| 888 | fi |
|---|
| 889 | |
|---|
| 890 | rm -rf conftest.dSYM |
|---|
| 891 | rm -f conftest* |
|---|
| 892 | fi |
|---|
| 893 | |
|---|
| 894 | if test -z "$pac_cv_prog_c_weak_symbols" ; then |
|---|
| 895 | AC_TRY_LINK([ |
|---|
| 896 | extern int PFoo(int); |
|---|
| 897 | |
|---|
| 898 | int Foo(int a) { return a; } |
|---|
| 899 | ],[return PFoo(1);],pac_cv_prog_c_weak_symbols="pragma _HP_SECONDARY_DEF") |
|---|
| 900 | fi |
|---|
| 901 | |
|---|
| 902 | if test -z "$pac_cv_prog_c_weak_symbols" ; then |
|---|
| 903 | AC_TRY_LINK([ |
|---|
| 904 | extern int PFoo(int); |
|---|
| 905 | |
|---|
| 906 | int Foo(int a) { return a; } |
|---|
| 907 | ],[return PFoo(1);],pac_cv_prog_c_weak_symbols="pragma _CRI duplicate x as y") |
|---|
| 908 | fi |
|---|
| 909 | |
|---|
| 910 | if test -z "$pac_cv_prog_c_weak_symbols" ; then |
|---|
| 911 | pac_cv_prog_c_weak_symbols="no" |
|---|
| 912 | fi |
|---|
| 913 | |
|---|
| 914 | |
|---|
| 915 | |
|---|
| 916 | if test -n "$pragma_extra_message" ; then |
|---|
| 917 | echo $pragma_extra_message |
|---|
| 918 | fi |
|---|
| 919 | |
|---|
| 920 | ]) |
|---|
| 921 | if test "$pac_cv_prog_c_weak_symbols" = "no" ; then |
|---|
| 922 | ifelse([$2],,:,[$2]) |
|---|
| 923 | else |
|---|
| 924 | case "$pac_cv_prog_c_weak_symbols" in |
|---|
| 925 | "pragma weak") AC_DEFINE(HAVE_PRAGMA_WEAK,1,[Supports weak pragma]) |
|---|
| 926 | ;; |
|---|
| 927 | "pragma _HP") AC_DEFINE(HAVE_PRAGMA_HP_SEC_DEF,1,[HP style weak pragma]) |
|---|
| 928 | ;; |
|---|
| 929 | "pragma _CRI") AC_DEFINE(HAVE_PRAGMA_CRI_DUP,1,[Cray style weak pragma]) |
|---|
| 930 | ;; |
|---|
| 931 | esac |
|---|
| 932 | ifelse([$1],,:,[$1]) |
|---|
| 933 | fi |
|---|
| 934 | AC_CACHE_CHECK([whether __attribute__ ((weak)) allowed], |
|---|
| 935 | pac_cv_attr_weak,[ |
|---|
| 936 | AC_TRY_COMPILE([int foo(int) __attribute__ ((weak));],[int a;], |
|---|
| 937 | pac_cv_attr_weak=yes,pac_cv_attr_weak=no)]) |
|---|
| 938 | |
|---|
| 939 | |
|---|
| 940 | AC_CACHE_CHECK([whether __attribute ((weak_import)) allowed], |
|---|
| 941 | pac_cv_attr_weak_import,[ |
|---|
| 942 | AC_TRY_COMPILE([int foo(int) __attribute__ ((weak_import));],[int a;], |
|---|
| 943 | pac_cv_attr_weak_import=yes,pac_cv_attr_weak_import=no)]) |
|---|
| 944 | ]) |
|---|
| 945 | |
|---|
| 946 | |
|---|
| 947 | |
|---|
| 948 | |
|---|
| 949 | |
|---|
| 950 | |
|---|
| 951 | |
|---|
| 952 | |
|---|
| 953 | ifdef([AC_PROG_CC_WORKS],,[AC_DEFUN([AC_PROG_CC_WORKS],)]) |
|---|
| 954 | |
|---|
| 955 | AC_DEFUN([PAC_PROG_CC_WORKS], |
|---|
| 956 | [AC_PROG_CC_WORKS |
|---|
| 957 | AC_MSG_CHECKING([whether the C compiler sets its return status correctly]) |
|---|
| 958 | AC_LANG_SAVE |
|---|
| 959 | AC_LANG_C |
|---|
| 960 | AC_TRY_COMPILE(,[int a = bzzzt;],notbroken=no,notbroken=yes) |
|---|
| 961 | AC_MSG_RESULT($notbroken) |
|---|
| 962 | if test "$notbroken" = "no" ; then |
|---|
| 963 | AC_MSG_ERROR([installation or configuration problem: C compiler does not |
|---|
| 964 | correctly set error code when a fatal error occurs]) |
|---|
| 965 | fi |
|---|
| 966 | ]) |
|---|
| 967 | |
|---|
| 968 | |
|---|
| 969 | |
|---|
| 970 | |
|---|
| 971 | |
|---|
| 972 | |
|---|
| 973 | |
|---|
| 974 | |
|---|
| 975 | |
|---|
| 976 | |
|---|
| 977 | AC_DEFUN([PAC_PROG_C_MULTIPLE_WEAK_SYMBOLS],[ |
|---|
| 978 | AC_CACHE_CHECK([for multiple weak symbol support], |
|---|
| 979 | pac_cv_prog_c_multiple_weak_symbols,[ |
|---|
| 980 | |
|---|
| 981 | |
|---|
| 982 | |
|---|
| 983 | rm -rf conftest.dSYM |
|---|
| 984 | rm -f conftest* |
|---|
| 985 | cat >>conftest1.c <<EOF |
|---|
| 986 | extern int PFoo(int); |
|---|
| 987 | extern int PFoo_(int); |
|---|
| 988 | extern int pfoo_(int); |
|---|
| 989 | |
|---|
| 990 | |
|---|
| 991 | |
|---|
| 992 | int Foo(int); |
|---|
| 993 | int Foo(a) { return a; } |
|---|
| 994 | EOF |
|---|
| 995 | cat >>conftest2.c <<EOF |
|---|
| 996 | extern int PFoo(int), PFoo_(int), pfoo_(int); |
|---|
| 997 | int main() { |
|---|
| 998 | return PFoo(0) + PFoo_(1) + pfoo_(2);} |
|---|
| 999 | EOF |
|---|
| 1000 | ac_link2='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest1.c conftest2.c $LIBS >conftest.out 2>&1' |
|---|
| 1001 | if eval $ac_link2 ; then |
|---|
| 1002 | pac_cv_prog_c_multiple_weak_symbols="yes" |
|---|
| 1003 | else |
|---|
| 1004 | echo "$ac_link2" >>config.log |
|---|
| 1005 | echo "Failed program was" >>config.log |
|---|
| 1006 | cat conftest1.c >>config.log |
|---|
| 1007 | cat conftest2.c >>config.log |
|---|
| 1008 | if test -s conftest.out ; then cat conftest.out >> config.log ; fi |
|---|
| 1009 | fi |
|---|
| 1010 | |
|---|
| 1011 | rm -rf conftest.dSYM |
|---|
| 1012 | rm -f conftest* |
|---|
| 1013 | |
|---|
| 1014 | ]) |
|---|
| 1015 | if test "$pac_cv_prog_c_multiple_weak_symbols" = "yes" ; then |
|---|
| 1016 | ifelse([$1],,:,[$1]) |
|---|
| 1017 | else |
|---|
| 1018 | ifelse([$2],,:,[$2]) |
|---|
| 1019 | fi |
|---|
| 1020 | ]) |
|---|
| 1021 | |
|---|
| 1022 | |
|---|
| 1023 | |
|---|
| 1024 | |
|---|
| 1025 | |
|---|
| 1026 | |
|---|
| 1027 | |
|---|
| 1028 | |
|---|
| 1029 | |
|---|
| 1030 | |
|---|
| 1031 | |
|---|
| 1032 | |
|---|
| 1033 | |
|---|
| 1034 | |
|---|
| 1035 | |
|---|
| 1036 | AC_DEFUN([PAC_FUNC_CRYPT],[ |
|---|
| 1037 | AC_CACHE_CHECK([whether crypt defined in unistd.h], |
|---|
| 1038 | pac_cv_func_crypt_defined,[ |
|---|
| 1039 | AC_TRY_COMPILE([ |
|---|
| 1040 | |
|---|
| 1041 | double crypt(double a){return a;}],[return 0];, |
|---|
| 1042 | pac_cv_func_crypt_defined="no",pac_cv_func_crypt_defined="yes")]) |
|---|
| 1043 | if test "$pac_cv_func_crypt_defined" = "no" ; then |
|---|
| 1044 | |
|---|
| 1045 | AC_CACHE_CHECK([whether crypt defined in unistd with _XOPEN_SOURCE], |
|---|
| 1046 | pac_cv_func_crypt_xopen,[ |
|---|
| 1047 | AC_TRY_COMPILE([ |
|---|
| 1048 | |
|---|
| 1049 | |
|---|
| 1050 | double crypt(double a){return a;}],[return 0];, |
|---|
| 1051 | pac_cv_func_crypt_xopen="no",pac_cv_func_crypt_xopen="yes")]) |
|---|
| 1052 | fi |
|---|
| 1053 | if test "$pac_cv_func_crypt_xopen" = "yes" ; then |
|---|
| 1054 | AC_DEFINE(_XOPEN_SOURCE,1,[if xopen needed for crypt]) |
|---|
| 1055 | elif test "$pac_cv_func_crypt_defined" = "no" ; then |
|---|
| 1056 | AC_DEFINE(NEED_CRYPT_PROTOTYPE,1,[if a prototype for crypt is needed]) |
|---|
| 1057 | fi |
|---|
| 1058 | ]) |
|---|
| 1059 | |
|---|
| 1060 | |
|---|
| 1061 | |
|---|
| 1062 | |
|---|
| 1063 | |
|---|
| 1064 | |
|---|
| 1065 | |
|---|
| 1066 | |
|---|
| 1067 | |
|---|
| 1068 | |
|---|
| 1069 | |
|---|
| 1070 | AC_DEFUN([PAC_CC_STRICT],[ |
|---|
| 1071 | export enable_strict_done |
|---|
| 1072 | if test "$enable_strict_done" != "yes" ; then |
|---|
| 1073 | |
|---|
| 1074 | |
|---|
| 1075 | |
|---|
| 1076 | |
|---|
| 1077 | |
|---|
| 1078 | |
|---|
| 1079 | |
|---|
| 1080 | |
|---|
| 1081 | |
|---|
| 1082 | |
|---|
| 1083 | |
|---|
| 1084 | |
|---|
| 1085 | |
|---|
| 1086 | |
|---|
| 1087 | |
|---|
| 1088 | |
|---|
| 1089 | |
|---|
| 1090 | |
|---|
| 1091 | |
|---|
| 1092 | |
|---|
| 1093 | |
|---|
| 1094 | |
|---|
| 1095 | |
|---|
| 1096 | |
|---|
| 1097 | |
|---|
| 1098 | |
|---|
| 1099 | |
|---|
| 1100 | |
|---|
| 1101 | pac_common_strict_flags="-O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-type-limits -Wstrict-prototypes -Wmissing-prototypes -DGCC_WALL -Wno-unused-parameter -Wno-unused-label -Wshadow -Wmissing-declarations -Wno-long-long -Wfloat-equal -Wdeclaration-after-statement -Wundef -Wno-endif-labels -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Wno-sign-compare -Waggregate-return -Wold-style-definition -Wmissing-noreturn -Wno-multichar -Wno-deprecated-declarations -Wpacked -Wnested-externs -Winvalid-pch -Wno-pointer-sign -Wvariadic-macros -std=c89 -Wno-format-zero-length" |
|---|
| 1102 | pac_cc_strict_flags="" |
|---|
| 1103 | case "$1" in |
|---|
| 1104 | yes|all|posix) |
|---|
| 1105 | enable_strict_done="yes" |
|---|
| 1106 | pac_cc_strict_flags="$pac_common_strict_flags -D_POSIX_C_SOURCE=199506L" |
|---|
| 1107 | ;; |
|---|
| 1108 | |
|---|
| 1109 | noposix) |
|---|
| 1110 | enable_strict_done="yes" |
|---|
| 1111 | pac_cc_strict_flags="$pac_common_strict_flags" |
|---|
| 1112 | ;; |
|---|
| 1113 | |
|---|
| 1114 | no) |
|---|
| 1115 | |
|---|
| 1116 | : |
|---|
| 1117 | ;; |
|---|
| 1118 | |
|---|
| 1119 | *) |
|---|
| 1120 | if test -n "$1" ; then |
|---|
| 1121 | AC_MSG_WARN([Unrecognized value for enable-strict:$1]) |
|---|
| 1122 | fi |
|---|
| 1123 | ;; |
|---|
| 1124 | |
|---|
| 1125 | esac |
|---|
| 1126 | |
|---|
| 1127 | |
|---|
| 1128 | accepted_flags="" |
|---|
| 1129 | for flag in $pac_cc_strict_flags ; do |
|---|
| 1130 | old_CFLAGS=$CFLAGS |
|---|
| 1131 | CFLAGS="$CFLAGS $accepted_flags $flag" |
|---|
| 1132 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[int a;])],accepted_flags="$accepted_flags $flag",) |
|---|
| 1133 | CFLAGS="$old_CFLAGS" |
|---|
| 1134 | done |
|---|
| 1135 | pac_cc_strict_flags=$accepted_flags |
|---|
| 1136 | fi |
|---|
| 1137 | ]) |
|---|
| 1138 | |
|---|
| 1139 | |
|---|
| 1140 | |
|---|
| 1141 | |
|---|
| 1142 | |
|---|
| 1143 | |
|---|
| 1144 | |
|---|
| 1145 | |
|---|
| 1146 | |
|---|
| 1147 | |
|---|
| 1148 | |
|---|
| 1149 | AC_DEFUN([PAC_ARG_STRICT],[ |
|---|
| 1150 | AC_ARG_ENABLE(strict, |
|---|
| 1151 | [--enable-strict - Turn on strict compilation testing when using gcc]) |
|---|
| 1152 | PAC_CC_STRICT($enable_strict) |
|---|
| 1153 | CFLAGS="$CFLAGS $pac_cc_strict_flags" |
|---|
| 1154 | export CFLAGS |
|---|
| 1155 | ]) |
|---|
| 1156 | |
|---|
| 1157 | |
|---|
| 1158 | |
|---|
| 1159 | |
|---|
| 1160 | |
|---|
| 1161 | |
|---|
| 1162 | |
|---|
| 1163 | |
|---|
| 1164 | |
|---|
| 1165 | |
|---|
| 1166 | |
|---|
| 1167 | |
|---|
| 1168 | |
|---|
| 1169 | |
|---|
| 1170 | |
|---|
| 1171 | |
|---|
| 1172 | |
|---|
| 1173 | |
|---|
| 1174 | |
|---|
| 1175 | |
|---|
| 1176 | |
|---|
| 1177 | |
|---|
| 1178 | |
|---|
| 1179 | |
|---|
| 1180 | |
|---|
| 1181 | |
|---|
| 1182 | |
|---|
| 1183 | |
|---|
| 1184 | |
|---|
| 1185 | |
|---|
| 1186 | |
|---|
| 1187 | |
|---|
| 1188 | |
|---|
| 1189 | |
|---|
| 1190 | |
|---|
| 1191 | AC_DEFUN([PAC_ARG_CC_G],[ |
|---|
| 1192 | AC_ARG_ENABLE(g, |
|---|
| 1193 | [--enable-g - Turn on debugging of the package (typically adds -g to COPTIONS)]) |
|---|
| 1194 | export COPTIONS |
|---|
| 1195 | export enable_g_simple |
|---|
| 1196 | if test -n "$enable_g" -a "$enable_g" != "no" -a \ |
|---|
| 1197 | "$enable_g_simple" != "done" ; then |
|---|
| 1198 | enable_g_simple="done" |
|---|
| 1199 | if test "$enable_g" = "g" -o "$enable_g" = "yes" ; then |
|---|
| 1200 | COPTIONS="$COPTIONS -g" |
|---|
| 1201 | fi |
|---|
| 1202 | fi |
|---|
| 1203 | ]) |
|---|
| 1204 | |
|---|
| 1205 | |
|---|
| 1206 | |
|---|
| 1207 | AC_DEFUN([PAC_ARG_CC_COMMON],[ |
|---|
| 1208 | PAC_ARG_CC_G |
|---|
| 1209 | PAC_ARG_STRICT |
|---|
| 1210 | ]) |
|---|
| 1211 | |
|---|
| 1212 | |
|---|
| 1213 | |
|---|
| 1214 | |
|---|
| 1215 | |
|---|
| 1216 | |
|---|
| 1217 | |
|---|
| 1218 | |
|---|
| 1219 | |
|---|
| 1220 | |
|---|
| 1221 | |
|---|
| 1222 | |
|---|
| 1223 | |
|---|
| 1224 | |
|---|
| 1225 | |
|---|
| 1226 | |
|---|
| 1227 | |
|---|
| 1228 | |
|---|
| 1229 | |
|---|
| 1230 | |
|---|
| 1231 | |
|---|
| 1232 | |
|---|
| 1233 | |
|---|
| 1234 | |
|---|
| 1235 | |
|---|
| 1236 | |
|---|
| 1237 | |
|---|
| 1238 | |
|---|
| 1239 | |
|---|
| 1240 | |
|---|
| 1241 | |
|---|
| 1242 | |
|---|
| 1243 | |
|---|
| 1244 | |
|---|
| 1245 | |
|---|
| 1246 | AC_DEFUN([PAC_PROG_C_BROKEN_COMMON],[ |
|---|
| 1247 | AC_CACHE_CHECK([whether global variables handled properly], |
|---|
| 1248 | ac_cv_prog_cc_globals_work,[ |
|---|
| 1249 | AC_REQUIRE([AC_PROG_RANLIB]) |
|---|
| 1250 | ac_cv_prog_cc_globals_work=no |
|---|
| 1251 | rm -f libconftest.a |
|---|
| 1252 | echo 'extern int a; int a;' > conftest1.c |
|---|
| 1253 | echo 'extern int a; int main( ){ return a; }' > conftest2.c |
|---|
| 1254 | if ${CC-cc} $CFLAGS -c conftest1.c >conftest.out 2>&1 ; then |
|---|
| 1255 | if ${AR-ar} cr libconftest.a conftest1.o >/dev/null 2>&1 ; then |
|---|
| 1256 | if ${RANLIB-:} libconftest.a >/dev/null 2>&1 ; then |
|---|
| 1257 | if ${CC-cc} $CFLAGS -o conftest conftest2.c $LDFLAGS libconftest.a >>conftest.out 2>&1 ; then |
|---|
| 1258 | |
|---|
| 1259 | ac_cv_prog_cc_globals_work=yes |
|---|
| 1260 | else |
|---|
| 1261 | echo "Error linking program with uninitialized global" >&AC_FD_CC |
|---|
| 1262 | echo "Programs were:" >&AC_FD_CC |
|---|
| 1263 | echo "conftest1.c:" >&AC_FD_CC |
|---|
| 1264 | cat conftest1.c >&AC_FD_CC |
|---|
| 1265 | echo "conftest2.c:" >&AC_FD_CC |
|---|
| 1266 | cat conftest2.c >&AC_FD_CC |
|---|
| 1267 | echo "and link line was:" >&AC_FD_CC |
|---|
| 1268 | echo "${CC-cc} $CFLAGS -o conftest conftest2.c $LDFLAGS libconftest.a" >&AC_FD_CC |
|---|
| 1269 | echo "with output:" >&AC_FD_CC |
|---|
| 1270 | cat conftest.out >&AC_FD_CC |
|---|
| 1271 | |
|---|
| 1272 | # Failure! Do we need -fno-common? |
|---|
| 1273 | ${CC-cc} $CFLAGS -fno-common -c conftest1.c >> conftest.out 2>&1 |
|---|
| 1274 | rm -f libconftest.a |
|---|
| 1275 | ${AR-ar} cr libconftest.a conftest1.o |
|---|
| 1276 | ${RANLIB-:} libconftest.a |
|---|
| 1277 | if ${CC-cc} $CFLAGS -o conftest conftest2.c $LDFLAGS libconftest.a >> conftest.out 2>&1 ; then |
|---|
| 1278 | ac_cv_prog_cc_globals_work="needs -fno-common" |
|---|
| 1279 | CFLAGS="$CFLAGS -fno-common" |
|---|
| 1280 | elif test -n "$RANLIB" ; then |
|---|
| 1281 | # Try again, with ranlib changed to ranlib -c |
|---|
| 1282 | # (send output to /dev/null incase this ranlib |
|---|
| 1283 | # doesn't know -c) |
|---|
| 1284 | ${RANLIB} -c libconftest.a >/dev/null 2>&1 |
|---|
| 1285 | if ${CC-cc} $CFLAGS -o conftest conftest2.c $LDFLAGS libconftest.a >> conftest.out 2>&1 ; then |
|---|
| 1286 | RANLIB="$RANLIB -c" |
|---|
| 1287 | |
|---|
| 1288 | |
|---|
| 1289 | |
|---|
| 1290 | fi |
|---|
| 1291 | |
|---|
| 1292 | |
|---|
| 1293 | fi |
|---|
| 1294 | fi |
|---|
| 1295 | fi |
|---|
| 1296 | fi |
|---|
| 1297 | fi |
|---|
| 1298 | |
|---|
| 1299 | rm -rf conftest.dSYM |
|---|
| 1300 | rm -f conftest* libconftest*]) |
|---|
| 1301 | if test "$ac_cv_prog_cc_globals_work" = no ; then |
|---|
| 1302 | AC_MSG_WARN([Common symbols not supported on this system!]) |
|---|
| 1303 | fi |
|---|
| 1304 | ]) |
|---|
| 1305 | |
|---|
| 1306 | |
|---|
| 1307 | |
|---|
| 1308 | |
|---|
| 1309 | |
|---|
| 1310 | |
|---|
| 1311 | |
|---|
| 1312 | |
|---|
| 1313 | |
|---|
| 1314 | |
|---|
| 1315 | |
|---|
| 1316 | |
|---|
| 1317 | |
|---|
| 1318 | |
|---|
| 1319 | |
|---|
| 1320 | |
|---|
| 1321 | |
|---|
| 1322 | |
|---|
| 1323 | |
|---|
| 1324 | |
|---|
| 1325 | |
|---|
| 1326 | |
|---|
| 1327 | AC_DEFUN([PAC_C_STRUCT_ALIGNMENT],[ |
|---|
| 1328 | AC_CACHE_CHECK([for C struct alignment],pac_cv_c_struct_align,[ |
|---|
| 1329 | AC_TRY_RUN([ |
|---|
| 1330 | |
|---|
| 1331 | |
|---|
| 1332 | |
|---|
| 1333 | |
|---|
| 1334 | printf( "Setting %s to false because of %s\n", |
|---|
| 1335 | |
|---|
| 1336 | |
|---|
| 1337 | |
|---|
| 1338 | |
|---|
| 1339 | |
|---|
| 1340 | int main( int argc, char *argv[] ) |
|---|
| 1341 | { |
|---|
| 1342 | FILE *cf; |
|---|
| 1343 | int is_packed = 1; |
|---|
| 1344 | int is_two = 1; |
|---|
| 1345 | int is_four = 1; |
|---|
| 1346 | int is_eight = 1; |
|---|
| 1347 | int is_largest = 1; |
|---|
| 1348 | int is_largestorword = 1; |
|---|
| 1349 | int is_largestor4 = 1; |
|---|
| 1350 | int numCases; |
|---|
| 1351 | |
|---|
| 1352 | /* We've seen PowerPC systems where the alignment may |
|---|
| 1353 | be largest for some items but not for double + int */ |
|---|
| 1354 | struct { char a; int b; } char_int; |
|---|
| 1355 | struct { short a; int b; } short_int; |
|---|
| 1356 | struct { char a; short b; } char_short; |
|---|
| 1357 | struct { char a; long b; } char_long; |
|---|
| 1358 | struct { char a; float b; } char_float; |
|---|
| 1359 | struct { char a; double b; } char_double; |
|---|
| 1360 | struct { char a; int b; char c; } char_int_char; |
|---|
| 1361 | struct { char a; short b; char c; } char_short_char; |
|---|
| 1362 | |
|---|
| 1363 | struct { char a; long double b; } char_long_double; |
|---|
| 1364 | |
|---|
| 1365 | int size, extent; |
|---|
| 1366 | |
|---|
| 1367 | size = sizeof(char) + sizeof(int); |
|---|
| 1368 | extent = sizeof(char_int); |
|---|
| 1369 | if (size != extent) is_packed = 0; |
|---|
| 1370 | CHECK((extent % sizeof(int)) != 0, is_largest); |
|---|
| 1371 | CHECK((extent % sizeof(int)) != 0, is_largestor4); |
|---|
| 1372 | CHECK((extent % sizeof(int)) != 0, is_largestorword); |
|---|
| 1373 | if ( (extent % 2) != 0) is_two = 0; |
|---|
| 1374 | if ( (extent % 4) != 0) is_four = 0; |
|---|
| 1375 | if (sizeof(int) == 8 && (extent % 8) != 0) is_eight = 0; |
|---|
| 1376 | DBG("char_int",size,extent); |
|---|
| 1377 | |
|---|
| 1378 | size = sizeof(short) + sizeof(int); |
|---|
| 1379 | extent = sizeof(short_int); |
|---|
| 1380 | if (size != extent) is_packed = 0; |
|---|
| 1381 | CHECK((extent % sizeof(int)) != 0, is_largest); |
|---|
| 1382 | CHECK((extent % sizeof(int)) != 0, is_largestor4); |
|---|
| 1383 | CHECK((extent % sizeof(int)) != 0, is_largestorword); |
|---|
| 1384 | if ( (extent % 2) != 0) is_two = 0; |
|---|
| 1385 | if ( (size == 6) && (extent == 8) ) is_two = 0; |
|---|
| 1386 | if ( (extent % 4) != 0) is_four = 0; |
|---|
| 1387 | if (sizeof(int) == 8 && (extent % 8) != 0) is_eight = 0; |
|---|
| 1388 | DBG("short_int",size,extent); |
|---|
| 1389 | |
|---|
| 1390 | size = sizeof(char) + sizeof(short); |
|---|
| 1391 | extent = sizeof(char_short); |
|---|
| 1392 | if (size != extent) is_packed = 0; |
|---|
| 1393 | CHECK((extent % sizeof(short)) != 0,is_largest); |
|---|
| 1394 | CHECK((extent % sizeof(short)) != 0,is_largestor4); |
|---|
| 1395 | CHECK((extent % sizeof(short)) != 0,is_largestorword); |
|---|
| 1396 | if ( (extent % 2) != 0) is_two = 0; |
|---|
| 1397 | if (sizeof(short) == 4 && (extent % 4) != 0) is_four = 0; |
|---|
| 1398 | if (sizeof(short) == 8 && (extent % 8) != 0) is_eight = 0; |
|---|
| 1399 | DBG("char_short",size,extent); |
|---|
| 1400 | |
|---|
| 1401 | size = sizeof(char) + sizeof(long); |
|---|
| 1402 | extent = sizeof(char_long); |
|---|
| 1403 | if (size != extent) is_packed = 0; |
|---|
| 1404 | CHECK((extent % sizeof(long)) != 0,is_largest); |
|---|
| 1405 | CHECK((extent % 4) != 0,is_largestor4); |
|---|
| 1406 | CHECK((extent % sizeof(long)) != 0,is_largestorword); |
|---|
| 1407 | if ( (extent % 2) != 0) is_two = 0; |
|---|
| 1408 | if ( (extent % 4) != 0) is_four = 0; |
|---|
| 1409 | if (sizeof(long) == 8 && (extent % 8) != 0) is_eight = 0; |
|---|
| 1410 | DBG("char_long",size,extent); |
|---|
| 1411 | |
|---|
| 1412 | size = sizeof(char) + sizeof(float); |
|---|
| 1413 | extent = sizeof(char_float); |
|---|
| 1414 | if (size != extent) is_packed = 0; |
|---|
| 1415 | CHECK((extent % sizeof(float)) != 0,is_largest); |
|---|
| 1416 | CHECK((extent % sizeof(float)) != 0,is_largestor4); |
|---|
| 1417 | CHECK((extent % sizeof(float)) != 0,is_largestorword); |
|---|
| 1418 | if ( (extent % 2) != 0) is_two = 0; |
|---|
| 1419 | if ( (extent % 4) != 0) is_four = 0; |
|---|
| 1420 | if (sizeof(float) == 8 && (extent % 8) != 0) is_eight = 0; |
|---|
| 1421 | DBG("char_float",size,extent); |
|---|
| 1422 | |
|---|
| 1423 | size = sizeof(char) + sizeof(double); |
|---|
| 1424 | extent = sizeof(char_double); |
|---|
| 1425 | if (size != extent) is_packed = 0; |
|---|
| 1426 | CHECK((extent % sizeof(double)) != 0,is_largest); |
|---|
| 1427 | CHECK((extent % 4) != 0,is_largestor4); |
|---|
| 1428 | CHECK((extent % sizeof(int)) != 0,is_largestorword); |
|---|
| 1429 | if ( (extent % 2) != 0) is_two = 0; |
|---|
| 1430 | if ( (extent % 4) != 0) is_four = 0; |
|---|
| 1431 | if (sizeof(double) == 8 && (extent % 8) != 0) is_eight = 0; |
|---|
| 1432 | DBG("char_double",size,extent); |
|---|
| 1433 | |
|---|
| 1434 | |
|---|
| 1435 | size = sizeof(char) + sizeof(long double); |
|---|
| 1436 | extent = sizeof(char_long_double); |
|---|
| 1437 | if (size != extent) is_packed = 0; |
|---|
| 1438 | CHECK((extent % sizeof(long double)) != 0,is_largest); |
|---|
| 1439 | CHECK((extent % 4) != 0,is_largestor4); |
|---|
| 1440 | CHECK((extent % 16) == 0,is_largestor4); |
|---|
| 1441 | CHECK((extent % sizeof(long double)) != 0,is_largestorword); |
|---|
| 1442 | /* This case only applies to largestorword if long doubles are 16 bytes */ |
|---|
| 1443 | if (sizeof(long double) != 16) is_largestorword = 0; |
|---|
| 1444 | if ( (extent % 2) != 0) is_two = 0; |
|---|
| 1445 | if ( (extent % 4) != 0) is_four = 0; |
|---|
| 1446 | if (sizeof(long double) >= 8 && (extent % 8) != 0) is_eight = 0; |
|---|
| 1447 | DBG("char_long-double",size,extent); |
|---|
| 1448 | |
|---|
| 1449 | /* The special case of largestorword only applies if long double |
|---|
| 1450 | available */ |
|---|
| 1451 | is_largestorword=0; |
|---|
| 1452 | |
|---|
| 1453 | |
|---|
| 1454 | /* char int char helps separate largest from 4/8 aligned */ |
|---|
| 1455 | size = sizeof(char) + sizeof(int) + sizeof(char); |
|---|
| 1456 | extent = sizeof(char_int_char); |
|---|
| 1457 | if (size != extent) is_packed = 0; |
|---|
| 1458 | CHECK((extent % sizeof(int)) != 0,is_largest); |
|---|
| 1459 | CHECK((extent % sizeof(int)) != 0,is_largestor4); |
|---|
| 1460 | CHECK((extent % sizeof(int)) != 0,is_largestorword); |
|---|
| 1461 | if ( (extent % 2) != 0) is_two = 0; |
|---|
| 1462 | if ( (extent % 4) != 0) is_four = 0; |
|---|
| 1463 | if (sizeof(int) == 8 && (extent % 8) != 0) is_eight = 0; |
|---|
| 1464 | DBG("char_int_char",size,extent); |
|---|
| 1465 | |
|---|
| 1466 | /* char short char helps separate largest from 4/8 aligned */ |
|---|
| 1467 | size = sizeof(char) + sizeof(short) + sizeof(char); |
|---|
| 1468 | extent = sizeof(char_short_char); |
|---|
| 1469 | if (size != extent) is_packed = 0; |
|---|
| 1470 | CHECK((extent % sizeof(short)) != 0,is_largest); |
|---|
| 1471 | CHECK((extent % sizeof(short)) != 0,is_largestor4); |
|---|
| 1472 | CHECK((extent % sizeof(short)) != 0,is_largestorword); |
|---|
| 1473 | if ( (extent % 2) != 0) is_two = 0; |
|---|
| 1474 | if (sizeof(short) == 4 && (extent % 4) != 0) is_four = 0; |
|---|
| 1475 | CHECK((extent == 6) && (size == 4),is_four); |
|---|
| 1476 | if (sizeof(short) == 8 && (extent % 8) != 0) is_eight = 0; |
|---|
| 1477 | DBG("char_short_char",size,extent); |
|---|
| 1478 | |
|---|
| 1479 | /* If aligned mod 8, it will be aligned mod 4 */ |
|---|
| 1480 | if (is_eight) { is_four = 0; is_two = 0; } |
|---|
| 1481 | |
|---|
| 1482 | if (is_four) is_two = 0; |
|---|
| 1483 | |
|---|
| 1484 | /* largest superceeds eight */ |
|---|
| 1485 | if (is_largest) is_eight = 0; |
|---|
| 1486 | |
|---|
| 1487 | /* Tabulate the results */ |
|---|
| 1488 | cf = fopen( "ctest.out", "w" ); |
|---|
| 1489 | numCases = is_packed + is_largest + is_largestorword + is_largestor4 + |
|---|
| 1490 | is_two + is_four + is_eight; |
|---|
| 1491 | if (numCases == 0) { |
|---|
| 1492 | fprintf( cf, "Could not determine alignment\n" ); |
|---|
| 1493 | } |
|---|
| 1494 | else { |
|---|
| 1495 | if (numCases != 1) { |
|---|
| 1496 | fprintf( cf, "Multiple cases:\n" ); |
|---|
| 1497 | } |
|---|
| 1498 | if (is_packed) fprintf( cf, "packed\n" ); |
|---|
| 1499 | if (is_largest) fprintf( cf, "largest\n" ); |
|---|
| 1500 | if (is_largestorword) fprintf( cf, "largestorword\n" ); |
|---|
| 1501 | if (is_largestor4) fprintf( cf, "largestor4\n" ); |
|---|
| 1502 | if (is_two) fprintf( cf, "two\n" ); |
|---|
| 1503 | if (is_four) fprintf( cf, "four\n" ); |
|---|
| 1504 | if (is_eight) fprintf( cf, "eight\n" ); |
|---|
| 1505 | } |
|---|
| 1506 | fclose( cf ); |
|---|
| 1507 | return 0; |
|---|
| 1508 | }], |
|---|
| 1509 | pac_cv_c_struct_align=`cat ctest.out` |
|---|
| 1510 | ,pac_cv_c_struct_align="unknown",pac_cv_c_struct_align="$CROSS_ALIGN_STRUCT") |
|---|
| 1511 | rm -f ctest.out |
|---|
| 1512 | ]) |
|---|
| 1513 | if test -z "$pac_cv_c_struct_align" ; then |
|---|
| 1514 | pac_cv_c_struct_align="unknown" |
|---|
| 1515 | fi |
|---|
| 1516 | ]) |
|---|
| 1517 | |
|---|
| 1518 | |
|---|
| 1519 | |
|---|
| 1520 | |
|---|
| 1521 | |
|---|
| 1522 | |
|---|
| 1523 | |
|---|
| 1524 | |
|---|
| 1525 | |
|---|
| 1526 | |
|---|
| 1527 | |
|---|
| 1528 | AC_DEFUN([PAC_C_MAX_INTEGER_ALIGN],[ |
|---|
| 1529 | AC_CACHE_CHECK([for max C struct integer alignment], |
|---|
| 1530 | pac_cv_c_max_integer_align,[ |
|---|
| 1531 | AC_TRY_RUN([ |
|---|
| 1532 | |
|---|
| 1533 | |
|---|
| 1534 | int main( int argc, char *argv[] ) |
|---|
| 1535 | { |
|---|
| 1536 | FILE *cf; |
|---|
| 1537 | int is_packed = 1; |
|---|
| 1538 | int is_two = 1; |
|---|
| 1539 | int is_four = 1; |
|---|
| 1540 | int is_eight = 1; |
|---|
| 1541 | struct { char a; int b; } char_int; |
|---|
| 1542 | struct { char a; short b; } char_short; |
|---|
| 1543 | struct { char a; long b; } char_long; |
|---|
| 1544 | struct { char a; int b; char c; } char_int_char; |
|---|
| 1545 | struct { char a; short b; char c; } char_short_char; |
|---|
| 1546 | |
|---|
| 1547 | struct { long long int a; char b; } lli_c; |
|---|
| 1548 | struct { char a; long long int b; } c_lli; |
|---|
| 1549 | |
|---|
| 1550 | int size, extent, extent2; |
|---|
| 1551 | |
|---|
| 1552 | /* assume max integer alignment isn't 8 if we don't have |
|---|
| 1553 | * an eight-byte value :) |
|---|
| 1554 | */ |
|---|
| 1555 | |
|---|
| 1556 | if (sizeof(int) < 8 && sizeof(long) < 8 && sizeof(long long int) < 8) |
|---|
| 1557 | is_eight = 0; |
|---|
| 1558 | |
|---|
| 1559 | if (sizeof(int) < 8 && sizeof(long) < 8) is_eight = 0; |
|---|
| 1560 | |
|---|
| 1561 | |
|---|
| 1562 | size = sizeof(char) + sizeof(int); |
|---|
| 1563 | extent = sizeof(char_int); |
|---|
| 1564 | if (size != extent) is_packed = 0; |
|---|
| 1565 | if ( (extent % 2) != 0) is_two = 0; |
|---|
| 1566 | if ( (extent % 4) != 0) is_four = 0; |
|---|
| 1567 | if (sizeof(int) == 8 && (extent % 8) != 0) is_eight = 0; |
|---|
| 1568 | DBG("char_int",size,extent); |
|---|
| 1569 | |
|---|
| 1570 | size = sizeof(char) + sizeof(short); |
|---|
| 1571 | extent = sizeof(char_short); |
|---|
| 1572 | if (size != extent) is_packed = 0; |
|---|
| 1573 | if ( (extent % 2) != 0) is_two = 0; |
|---|
| 1574 | if (sizeof(short) == 4 && (extent % 4) != 0) is_four = 0; |
|---|
| 1575 | if (sizeof(short) == 8 && (extent % 8) != 0) is_eight = 0; |
|---|
| 1576 | DBG("char_short",size,extent); |
|---|
| 1577 | |
|---|
| 1578 | size = sizeof(char) + sizeof(long); |
|---|
| 1579 | extent = sizeof(char_long); |
|---|
| 1580 | if (size != extent) is_packed = 0; |
|---|
| 1581 | if ( (extent % 2) != 0) is_two = 0; |
|---|
| 1582 | if ( (extent % 4) != 0) is_four = 0; |
|---|
| 1583 | if (sizeof(long) == 8 && (extent % 8) != 0) is_eight = 0; |
|---|
| 1584 | DBG("char_long",size,extent); |
|---|
| 1585 | |
|---|
| 1586 | |
|---|
| 1587 | size = sizeof(char) + sizeof(long long int); |
|---|
| 1588 | extent = sizeof(lli_c); |
|---|
| 1589 | extent2 = sizeof(c_lli); |
|---|
| 1590 | if (size != extent) is_packed = 0; |
|---|
| 1591 | if ( (extent % 2) != 0 && (extent2 % 2) != 0) is_two = 0; |
|---|
| 1592 | if ( (extent % 4) != 0 && (extent2 % 4) != 0) is_four = 0; |
|---|
| 1593 | if (sizeof(long long int) >= 8 && (extent % 8) != 0 && (extent2 % 8) != 0) |
|---|
| 1594 | is_eight = 0; |
|---|
| 1595 | |
|---|
| 1596 | |
|---|
| 1597 | size = sizeof(char) + sizeof(int) + sizeof(char); |
|---|
| 1598 | extent = sizeof(char_int_char); |
|---|
| 1599 | if (size != extent) is_packed = 0; |
|---|
| 1600 | if ( (extent % 2) != 0) is_two = 0; |
|---|
| 1601 | if ( (extent % 4) != 0) is_four = 0; |
|---|
| 1602 | if (sizeof(int) == 8 && (extent % 8) != 0) is_eight = 0; |
|---|
| 1603 | DBG("char_int_char",size,extent); |
|---|
| 1604 | |
|---|
| 1605 | size = sizeof(char) + sizeof(short) + sizeof(char); |
|---|
| 1606 | extent = sizeof(char_short_char); |
|---|
| 1607 | if (size != extent) is_packed = 0; |
|---|
| 1608 | if ( (extent % 2) != 0) is_two = 0; |
|---|
| 1609 | if (sizeof(short) == 4 && (extent % 4) != 0) is_four = 0; |
|---|
| 1610 | if (sizeof(short) == 8 && (extent % 8) != 0) is_eight = 0; |
|---|
| 1611 | DBG("char_short_char",size,extent); |
|---|
| 1612 | |
|---|
| 1613 | /* If aligned mod 8, it will be aligned mod 4 */ |
|---|
| 1614 | if (is_eight) { is_four = 0; is_two = 0; } |
|---|
| 1615 | |
|---|
| 1616 | if (is_four) is_two = 0; |
|---|
| 1617 | |
|---|
| 1618 | /* Tabulate the results */ |
|---|
| 1619 | cf = fopen( "ctest.out", "w" ); |
|---|
| 1620 | if (is_packed + is_two + is_four + is_eight == 0) { |
|---|
| 1621 | fprintf( cf, "Could not determine alignment\n" ); |
|---|
| 1622 | } |
|---|
| 1623 | else { |
|---|
| 1624 | if (is_packed + is_two + is_four + is_eight != 1) { |
|---|
| 1625 | fprintf( cf, "error!\n" ); |
|---|
| 1626 | } |
|---|
| 1627 | else { |
|---|
| 1628 | if (is_packed) fprintf( cf, "packed\n" ); |
|---|
| 1629 | if (is_two) fprintf( cf, "two\n" ); |
|---|
| 1630 | if (is_four) fprintf( cf, "four\n" ); |
|---|
| 1631 | if (is_eight) fprintf( cf, "eight\n" ); |
|---|
| 1632 | } |
|---|
| 1633 | } |
|---|
| 1634 | fclose( cf ); |
|---|
| 1635 | return 0; |
|---|
| 1636 | }], |
|---|
| 1637 | pac_cv_c_max_integer_align=`cat ctest.out`, |
|---|
| 1638 | pac_cv_c_max_integer_align="unknown", |
|---|
| 1639 | pac_cv_c_max_integer_align="$CROSS_ALIGN_STRUCT_INT") |
|---|
| 1640 | rm -f ctest.out |
|---|
| 1641 | ]) |
|---|
| 1642 | if test -z "$pac_cv_c_max_integer_align" ; then |
|---|
| 1643 | pac_cv_c_max_integer_align="unknown" |
|---|
| 1644 | fi |
|---|
| 1645 | ]) |
|---|
| 1646 | |
|---|
| 1647 | |
|---|
| 1648 | |
|---|
| 1649 | |
|---|
| 1650 | |
|---|
| 1651 | |
|---|
| 1652 | |
|---|
| 1653 | |
|---|
| 1654 | |
|---|
| 1655 | |
|---|
| 1656 | |
|---|
| 1657 | |
|---|
| 1658 | |
|---|
| 1659 | |
|---|
| 1660 | AC_DEFUN([PAC_C_MAX_FP_ALIGN],[ |
|---|
| 1661 | AC_CACHE_CHECK([for max C struct floating point alignment], |
|---|
| 1662 | pac_cv_c_max_fp_align,[ |
|---|
| 1663 | AC_TRY_RUN([ |
|---|
| 1664 | |
|---|
| 1665 | |
|---|
| 1666 | int main( int argc, char *argv[] ) |
|---|
| 1667 | { |
|---|
| 1668 | FILE *cf; |
|---|
| 1669 | int is_packed = 1; |
|---|
| 1670 | int is_two = 1; |
|---|
| 1671 | int is_four = 1; |
|---|
| 1672 | int is_eight = 1; |
|---|
| 1673 | int is_sixteen = 1; |
|---|
| 1674 | struct { char a; float b; } char_float; |
|---|
| 1675 | struct { float b; char a; } float_char; |
|---|
| 1676 | struct { char a; double b; } char_double; |
|---|
| 1677 | struct { double b; char a; } double_char; |
|---|
| 1678 | |
|---|
| 1679 | struct { char a; long double b; } char_long_double; |
|---|
| 1680 | struct { long double b; char a; } long_double_char; |
|---|
| 1681 | struct { long double a; int b; char c; } long_double_int_char; |
|---|
| 1682 | |
|---|
| 1683 | int size, extent1, extent2; |
|---|
| 1684 | |
|---|
| 1685 | size = sizeof(char) + sizeof(float); |
|---|
| 1686 | extent1 = sizeof(char_float); |
|---|
| 1687 | extent2 = sizeof(float_char); |
|---|
| 1688 | if (size != extent1) is_packed = 0; |
|---|
| 1689 | if ( (extent1 % 2) != 0 && (extent2 % 2) != 0) is_two = 0; |
|---|
| 1690 | if ( (extent1 % 4) != 0 && (extent2 % 4) != 0) is_four = 0; |
|---|
| 1691 | if (sizeof(float) == 8 && (extent1 % 8) != 0 && (extent2 % 8) != 0) |
|---|
| 1692 | is_eight = 0; |
|---|
| 1693 | DBG("char_float",size,extent1); |
|---|
| 1694 | |
|---|
| 1695 | size = sizeof(char) + sizeof(double); |
|---|
| 1696 | extent1 = sizeof(char_double); |
|---|
| 1697 | extent2 = sizeof(double_char); |
|---|
| 1698 | if (size != extent1) is_packed = 0; |
|---|
| 1699 | if ( (extent1 % 2) != 0 && (extent2 % 2) != 0) is_two = 0; |
|---|
| 1700 | if ( (extent1 % 4) != 0 && (extent2 % 4) != 0) is_four = 0; |
|---|
| 1701 | if (sizeof(double) == 8 && (extent1 % 8) != 0 && (extent2 % 8) != 0) |
|---|
| 1702 | is_eight = 0; |
|---|
| 1703 | DBG("char_double",size,extent1); |
|---|
| 1704 | |
|---|
| 1705 | |
|---|
| 1706 | size = sizeof(char) + sizeof(long double); |
|---|
| 1707 | extent1 = sizeof(char_long_double); |
|---|
| 1708 | extent2 = sizeof(long_double_char); |
|---|
| 1709 | if (size != extent1) is_packed = 0; |
|---|
| 1710 | if ( (extent1 % 2) != 0 && (extent2 % 2) != 0) is_two = 0; |
|---|
| 1711 | if ( (extent1 % 4) != 0 && (extent2 % 4) != 0) is_four = 0; |
|---|
| 1712 | if (sizeof(long double) >= 8 && (extent1 % 8) != 0 && (extent2 % 8) != 0) |
|---|
| 1713 | is_eight = 0; |
|---|
| 1714 | if (sizeof(long double) > 8 && (extent1 % 16) != 0 |
|---|
| 1715 | && (extent2 % 16) != 0) is_sixteen = 0; |
|---|
| 1716 | DBG("char_long-double",size,extent1); |
|---|
| 1717 | |
|---|
| 1718 | extent1 = sizeof(long_double_int_char); |
|---|
| 1719 | if ( (extent1 % 2) != 0) is_two = 0; |
|---|
| 1720 | if ( (extent1 % 4) != 0) is_four = 0; |
|---|
| 1721 | if (sizeof(long double) >= 8 && (extent1 % 8) != 0) is_eight = 0; |
|---|
| 1722 | if (sizeof(long double) > 8 && (extent1 % 16) != 0) is_sixteen = 0; |
|---|
| 1723 | |
|---|
| 1724 | is_sixteen = 0; |
|---|
| 1725 | |
|---|
| 1726 | |
|---|
| 1727 | if (is_sixteen) { is_eight = 0; is_four = 0; is_two = 0; } |
|---|
| 1728 | |
|---|
| 1729 | if (is_eight) { is_four = 0; is_two = 0; } |
|---|
| 1730 | |
|---|
| 1731 | if (is_four) is_two = 0; |
|---|
| 1732 | |
|---|
| 1733 | /* Tabulate the results */ |
|---|
| 1734 | cf = fopen( "ctest.out", "w" ); |
|---|
| 1735 | if (is_packed + is_two + is_four + is_eight + is_sixteen == 0) { |
|---|
| 1736 | fprintf( cf, "Could not determine alignment\n" ); |
|---|
| 1737 | } |
|---|
| 1738 | else { |
|---|
| 1739 | if (is_packed + is_two + is_four + is_eight + is_sixteen != 1) { |
|---|
| 1740 | fprintf( cf, "error!\n" ); |
|---|
| 1741 | } |
|---|
| 1742 | else { |
|---|
| 1743 | if (is_packed) fprintf( cf, "packed\n" ); |
|---|
| 1744 | if (is_two) fprintf( cf, "two\n" ); |
|---|
| 1745 | if (is_four) fprintf( cf, "four\n" ); |
|---|
| 1746 | if (is_eight) fprintf( cf, "eight\n" ); |
|---|
| 1747 | if (is_sixteen) fprintf( cf, "sixteen\n" ); |
|---|
| 1748 | } |
|---|
| 1749 | } |
|---|
| 1750 | fclose( cf ); |
|---|
| 1751 | return 0; |
|---|
| 1752 | }], |
|---|
| 1753 | pac_cv_c_max_fp_align=`cat ctest.out`, |
|---|
| 1754 | pac_cv_c_max_fp_align="unknown", |
|---|
| 1755 | pac_cv_c_max_fp_align="$CROSS_ALIGN_STRUCT_FP") |
|---|
| 1756 | rm -f ctest.out |
|---|
| 1757 | ]) |
|---|
| 1758 | if test -z "$pac_cv_c_max_fp_align" ; then |
|---|
| 1759 | pac_cv_c_max_fp_align="unknown" |
|---|
| 1760 | fi |
|---|
| 1761 | ]) |
|---|
| 1762 | |
|---|
| 1763 | |
|---|
| 1764 | |
|---|
| 1765 | |
|---|
| 1766 | |
|---|
| 1767 | |
|---|
| 1768 | |
|---|
| 1769 | |
|---|
| 1770 | |
|---|
| 1771 | |
|---|
| 1772 | |
|---|
| 1773 | |
|---|
| 1774 | |
|---|
| 1775 | AC_DEFUN([PAC_C_MAX_DOUBLE_FP_ALIGN],[ |
|---|
| 1776 | AC_CACHE_CHECK([for max C struct alignment of structs with doubles], |
|---|
| 1777 | pac_cv_c_max_double_fp_align,[ |
|---|
| 1778 | AC_TRY_RUN([ |
|---|
| 1779 | |
|---|
| 1780 | |
|---|
| 1781 | int main( int argc, char *argv[] ) |
|---|
| 1782 | { |
|---|
| 1783 | FILE *cf; |
|---|
| 1784 | int is_packed = 1; |
|---|
| 1785 | int is_two = 1; |
|---|
| 1786 | int is_four = 1; |
|---|
| 1787 | int is_eight = 1; |
|---|
| 1788 | struct { char a; float b; } char_float; |
|---|
| 1789 | struct { float b; char a; } float_char; |
|---|
| 1790 | struct { char a; double b; } char_double; |
|---|
| 1791 | struct { double b; char a; } double_char; |
|---|
| 1792 | int size, extent1, extent2; |
|---|
| 1793 | |
|---|
| 1794 | size = sizeof(char) + sizeof(float); |
|---|
| 1795 | extent1 = sizeof(char_float); |
|---|
| 1796 | extent2 = sizeof(float_char); |
|---|
| 1797 | if (size != extent1) is_packed = 0; |
|---|
| 1798 | if ( (extent1 % 2) != 0 && (extent2 % 2) != 0) is_two = 0; |
|---|
| 1799 | if ( (extent1 % 4) != 0 && (extent2 % 4) != 0) is_four = 0; |
|---|
| 1800 | if (sizeof(float) == 8 && (extent1 % 8) != 0 && (extent2 % 8) != 0) |
|---|
| 1801 | is_eight = 0; |
|---|
| 1802 | DBG("char_float",size,extent1); |
|---|
| 1803 | |
|---|
| 1804 | size = sizeof(char) + sizeof(double); |
|---|
| 1805 | extent1 = sizeof(char_double); |
|---|
| 1806 | extent2 = sizeof(double_char); |
|---|
| 1807 | if (size != extent1) is_packed = 0; |
|---|
| 1808 | if ( (extent1 % 2) != 0 && (extent2 % 2) != 0) is_two = 0; |
|---|
| 1809 | if ( (extent1 % 4) != 0 && (extent2 % 4) != 0) is_four = 0; |
|---|
| 1810 | if (sizeof(double) == 8 && (extent1 % 8) != 0 && (extent2 % 8) != 0) |
|---|
| 1811 | is_eight = 0; |
|---|
| 1812 | DBG("char_double",size,extent1); |
|---|
| 1813 | |
|---|
| 1814 | if (is_eight) { is_four = 0; is_two = 0; } |
|---|
| 1815 | |
|---|
| 1816 | if (is_four) is_two = 0; |
|---|
| 1817 | |
|---|
| 1818 | /* Tabulate the results */ |
|---|
| 1819 | cf = fopen( "ctest.out", "w" ); |
|---|
| 1820 | if (is_packed + is_two + is_four + is_eight == 0) { |
|---|
| 1821 | fprintf( cf, "Could not determine alignment\n" ); |
|---|
| 1822 | } |
|---|
| 1823 | else { |
|---|
| 1824 | if (is_packed + is_two + is_four + is_eight != 1) { |
|---|
| 1825 | fprintf( cf, "error!\n" ); |
|---|
| 1826 | } |
|---|
| 1827 | else { |
|---|
| 1828 | if (is_packed) fprintf( cf, "packed\n" ); |
|---|
| 1829 | if (is_two) fprintf( cf, "two\n" ); |
|---|
| 1830 | if (is_four) fprintf( cf, "four\n" ); |
|---|
| 1831 | if (is_eight) fprintf( cf, "eight\n" ); |
|---|
| 1832 | } |
|---|
| 1833 | } |
|---|
| 1834 | fclose( cf ); |
|---|
| 1835 | return 0; |
|---|
| 1836 | }], |
|---|
| 1837 | pac_cv_c_max_double_fp_align=`cat ctest.out`, |
|---|
| 1838 | pac_cv_c_max_double_fp_align="unknown", |
|---|
| 1839 | pac_cv_c_max_double_fp_align="$CROSS_ALIGN_STRUCT_DOUBLE_FP") |
|---|
| 1840 | rm -f ctest.out |
|---|
| 1841 | ]) |
|---|
| 1842 | if test -z "$pac_cv_c_max_double_fp_align" ; then |
|---|
| 1843 | pac_cv_c_max_double_fp_align="unknown" |
|---|
| 1844 | fi |
|---|
| 1845 | ]) |
|---|
| 1846 | AC_DEFUN([PAC_C_MAX_LONGDOUBLE_FP_ALIGN],[ |
|---|
| 1847 | AC_CACHE_CHECK([for max C struct floating point alignment with long doubles], |
|---|
| 1848 | pac_cv_c_max_longdouble_fp_align,[ |
|---|
| 1849 | AC_TRY_RUN([ |
|---|
| 1850 | #include <stdio.h> |
|---|
| 1851 | #define DBG(a,b,c) |
|---|
| 1852 | int main( int argc, char *argv[] ) |
|---|
| 1853 | { |
|---|
| 1854 | FILE *cf; |
|---|
| 1855 | int is_packed = 1; |
|---|
| 1856 | int is_two = 1; |
|---|
| 1857 | int is_four = 1; |
|---|
| 1858 | int is_eight = 1; |
|---|
| 1859 | int is_sixteen = 1; |
|---|
| 1860 | struct { char a; long double b; } char_long_double; |
|---|
| 1861 | struct { long double b; char a; } long_double_char; |
|---|
| 1862 | struct { long double a; int b; char c; } long_double_int_char; |
|---|
| 1863 | int size, extent1, extent2; |
|---|
| 1864 | |
|---|
| 1865 | size = sizeof(char) + sizeof(long double); |
|---|
| 1866 | extent1 = sizeof(char_long_double); |
|---|
| 1867 | extent2 = sizeof(long_double_char); |
|---|
| 1868 | if (size != extent1) is_packed = 0; |
|---|
| 1869 | if ( (extent1 % 2) != 0 && (extent2 % 2) != 0) is_two = 0; |
|---|
| 1870 | if ( (extent1 % 4) != 0 && (extent2 % 4) != 0) is_four = 0; |
|---|
| 1871 | if (sizeof(long double) >= 8 && (extent1 % 8) != 0 && (extent2 % 8) != 0) |
|---|
| 1872 | is_eight = 0; |
|---|
| 1873 | if (sizeof(long double) > 8 && (extent1 % 16) != 0 |
|---|
| 1874 | && (extent2 % 16) != 0) is_sixteen = 0; |
|---|
| 1875 | DBG("char_long-double",size,extent1); |
|---|
| 1876 | |
|---|
| 1877 | extent1 = sizeof(long_double_int_char); |
|---|
| 1878 | if ( (extent1 % 2) != 0) is_two = 0; |
|---|
| 1879 | if ( (extent1 % 4) != 0) is_four = 0; |
|---|
| 1880 | if (sizeof(long double) >= 8 && (extent1 % 8) != 0) is_eight = 0; |
|---|
| 1881 | if (sizeof(long double) > 8 && (extent1 % 16) != 0) is_sixteen = 0; |
|---|
| 1882 | |
|---|
| 1883 | if (is_sixteen) { is_eight = 0; is_four = 0; is_two = 0; } |
|---|
| 1884 | |
|---|
| 1885 | if (is_eight) { is_four = 0; is_two = 0; } |
|---|
| 1886 | |
|---|
| 1887 | if (is_four) is_two = 0; |
|---|
| 1888 | |
|---|
| 1889 | /* Tabulate the results */ |
|---|
| 1890 | cf = fopen( "ctest.out", "w" ); |
|---|
| 1891 | if (is_packed + is_two + is_four + is_eight + is_sixteen == 0) { |
|---|
| 1892 | fprintf( cf, "Could not determine alignment\n" ); |
|---|
| 1893 | } |
|---|
| 1894 | else { |
|---|
| 1895 | if (is_packed + is_two + is_four + is_eight + is_sixteen != 1) { |
|---|
| 1896 | fprintf( cf, "error!\n" ); |
|---|
| 1897 | } |
|---|
| 1898 | else { |
|---|
| 1899 | if (is_packed) fprintf( cf, "packed\n" ); |
|---|
| 1900 | if (is_two) fprintf( cf, "two\n" ); |
|---|
| 1901 | if (is_four) fprintf( cf, "four\n" ); |
|---|
| 1902 | if (is_eight) fprintf( cf, "eight\n" ); |
|---|
| 1903 | if (is_sixteen) fprintf( cf, "sixteen\n" ); |
|---|
| 1904 | } |
|---|
| 1905 | } |
|---|
| 1906 | fclose( cf ); |
|---|
| 1907 | return 0; |
|---|
| 1908 | }], |
|---|
| 1909 | pac_cv_c_max_longdouble_fp_align=`cat ctest.out`, |
|---|
| 1910 | pac_cv_c_max_longdouble_fp_align="unknown", |
|---|
| 1911 | pac_cv_c_max_longdouble_fp_align="$CROSS_ALIGN_STRUCT_LONGDOUBLE_FP") |
|---|
| 1912 | rm -f ctest.out |
|---|
| 1913 | ]) |
|---|
| 1914 | if test -z "$pac_cv_c_max_longdouble_fp_align" ; then |
|---|
| 1915 | pac_cv_c_max_longdouble_fp_align="unknown" |
|---|
| 1916 | fi |
|---|
| 1917 | ]) |
|---|
| 1918 | dnl |
|---|
| 1919 | dnl Other tests assume that there is potentially a maximum alignment |
|---|
| 1920 | dnl and that if there is no maximum alignment, or a type is smaller than |
|---|
| 1921 | dnl that value, then we align on the size of the value, with the exception |
|---|
| 1922 | dnl of the "position-based alignment" rules we test for separately. |
|---|
| 1923 | dnl |
|---|
| 1924 | dnl It turns out that these assumptions have fallen short in at least one |
|---|
| 1925 | dnl case, on MacBook Pros, where doubles are aligned on 4-byte boundaries |
|---|
| 1926 | dnl even when long doubles are aligned on 16-byte boundaries. So this test |
|---|
| 1927 | dnl is here specifically to handle this case. |
|---|
| 1928 | dnl |
|---|
| 1929 | dnl Puts result in pac_cv_c_double_alignment_exception. |
|---|
| 1930 | dnl |
|---|
| 1931 | dnl Possible values currently include no and four. |
|---|
| 1932 | dnl |
|---|
| 1933 | AC_DEFUN([PAC_C_DOUBLE_ALIGNMENT_EXCEPTION],[ |
|---|
| 1934 | AC_CACHE_CHECK([if double alignment breaks rules, find actual alignment], |
|---|
| 1935 | pac_cv_c_double_alignment_exception,[ |
|---|
| 1936 | AC_TRY_RUN([ |
|---|
| 1937 | #include <stdio.h> |
|---|
| 1938 | #define DBG(a,b,c) |
|---|
| 1939 | int main( int argc, char *argv[] ) |
|---|
| 1940 | { |
|---|
| 1941 | FILE *cf; |
|---|
| 1942 | struct { char a; double b; } char_double; |
|---|
| 1943 | struct { double b; char a; } double_char; |
|---|
| 1944 | int extent1, extent2, align_4 = 0; |
|---|
| 1945 | |
|---|
| 1946 | extent1 = sizeof(char_double); |
|---|
| 1947 | extent2 = sizeof(double_char); |
|---|
| 1948 | |
|---|
| 1949 | /* we're interested in the largest value, will let separate test |
|---|
| 1950 | * deal with position-based issues. |
|---|
| 1951 | */ |
|---|
| 1952 | if (extent1 < extent2) extent1 = extent2; |
|---|
| 1953 | if ((sizeof(double) == 8) && (extent1 % 8) != 0) { |
|---|
| 1954 | if (extent1 % 4 == 0) { |
|---|
| 1955 | |
|---|
| 1956 | if (HAVE_MAX_FP_ALIGNMENT >= 8) align_4 = 1; |
|---|
| 1957 | |
|---|
| 1958 | align_4 = 1; |
|---|
| 1959 | |
|---|
| 1960 | } |
|---|
| 1961 | } |
|---|
| 1962 | |
|---|
| 1963 | cf = fopen( "ctest.out", "w" ); |
|---|
| 1964 | |
|---|
| 1965 | if (align_4) fprintf( cf, "four\n" ); |
|---|
| 1966 | else fprintf( cf, "no\n" ); |
|---|
| 1967 | |
|---|
| 1968 | fclose( cf ); |
|---|
| 1969 | return 0; |
|---|
| 1970 | }], |
|---|
| 1971 | pac_cv_c_double_alignment_exception=`cat ctest.out`, |
|---|
| 1972 | pac_cv_c_double_alignment_exception="unknown", |
|---|
| 1973 | pac_cv_c_double_alignment_exception="$CROSS_ALIGN_DOUBLE_EXCEPTION") |
|---|
| 1974 | rm -f ctest.out |
|---|
| 1975 | ]) |
|---|
| 1976 | if test -z "$pac_cv_c_double_alignment_exception" ; then |
|---|
| 1977 | pac_cv_c_double_alignment_exception="unknown" |
|---|
| 1978 | fi |
|---|
| 1979 | ]) |
|---|
| 1980 | |
|---|
| 1981 | |
|---|
| 1982 | |
|---|
| 1983 | |
|---|
| 1984 | |
|---|
| 1985 | |
|---|
| 1986 | |
|---|
| 1987 | |
|---|
| 1988 | |
|---|
| 1989 | |
|---|
| 1990 | AC_DEFUN([PAC_C_DOUBLE_POS_ALIGN],[ |
|---|
| 1991 | AC_CACHE_CHECK([if alignment of structs with doubles is based on position], |
|---|
| 1992 | pac_cv_c_double_pos_align,[ |
|---|
| 1993 | AC_TRY_RUN([ |
|---|
| 1994 | |
|---|
| 1995 | |
|---|
| 1996 | int main( int argc, char *argv[] ) |
|---|
| 1997 | { |
|---|
| 1998 | FILE *cf; |
|---|
| 1999 | int padding_varies_by_pos = 0; |
|---|
| 2000 | struct { char a; double b; } char_double; |
|---|
| 2001 | struct { double b; char a; } double_char; |
|---|
| 2002 | int extent1, extent2; |
|---|
| 2003 | |
|---|
| 2004 | extent1 = sizeof(char_double); |
|---|
| 2005 | extent2 = sizeof(double_char); |
|---|
| 2006 | if (extent1 != extent2) padding_varies_by_pos = 1; |
|---|
| 2007 | |
|---|
| 2008 | cf = fopen( "ctest.out", "w" ); |
|---|
| 2009 | if (padding_varies_by_pos) fprintf( cf, "yes\n" ); |
|---|
| 2010 | else fprintf( cf, "no\n" ); |
|---|
| 2011 | |
|---|
| 2012 | fclose( cf ); |
|---|
| 2013 | return 0; |
|---|
| 2014 | }], |
|---|
| 2015 | pac_cv_c_double_pos_align=`cat ctest.out`, |
|---|
| 2016 | pac_cv_c_double_pos_align="unknown", |
|---|
| 2017 | pac_cv_c_double_pos_align="$CROSS_ALIGN_DOUBLE_POS") |
|---|
| 2018 | rm -f ctest.out |
|---|
| 2019 | ]) |
|---|
| 2020 | if test -z "$pac_cv_c_double_pos_align" ; then |
|---|
| 2021 | pac_cv_c_double_pos_align="unknown" |
|---|
| 2022 | fi |
|---|
| 2023 | ]) |
|---|
| 2024 | |
|---|
| 2025 | |
|---|
| 2026 | |
|---|
| 2027 | |
|---|
| 2028 | |
|---|
| 2029 | |
|---|
| 2030 | |
|---|
| 2031 | |
|---|
| 2032 | |
|---|
| 2033 | |
|---|
| 2034 | AC_DEFUN([PAC_C_LLINT_POS_ALIGN],[ |
|---|
| 2035 | AC_CACHE_CHECK([if alignment of structs with long long ints is based on position], |
|---|
| 2036 | pac_cv_c_llint_pos_align,[ |
|---|
| 2037 | AC_TRY_RUN([ |
|---|
| 2038 | |
|---|
| 2039 | |
|---|
| 2040 | int main( int argc, char *argv[] ) |
|---|
| 2041 | { |
|---|
| 2042 | FILE *cf; |
|---|
| 2043 | int padding_varies_by_pos = 0; |
|---|
| 2044 | |
|---|
| 2045 | struct { char a; long long int b; } char_llint; |
|---|
| 2046 | struct { long long int b; char a; } llint_char; |
|---|
| 2047 | int extent1, extent2; |
|---|
| 2048 | |
|---|
| 2049 | extent1 = sizeof(char_llint); |
|---|
| 2050 | extent2 = sizeof(llint_char); |
|---|
| 2051 | if (extent1 != extent2) padding_varies_by_pos = 1; |
|---|
| 2052 | |
|---|
| 2053 | |
|---|
| 2054 | cf = fopen( "ctest.out", "w" ); |
|---|
| 2055 | if (padding_varies_by_pos) fprintf( cf, "yes\n" ); |
|---|
| 2056 | else fprintf( cf, "no\n" ); |
|---|
| 2057 | |
|---|
| 2058 | fclose( cf ); |
|---|
| 2059 | return 0; |
|---|
| 2060 | }], |
|---|
| 2061 | pac_cv_c_llint_pos_align=`cat ctest.out`, |
|---|
| 2062 | pac_cv_c_llint_pos_align="unknown", |
|---|
| 2063 | pac_cv_c_llint_pos_align="$CROSS_ALIGN_LLINT_POS") |
|---|
| 2064 | rm -f ctest.out |
|---|
| 2065 | ]) |
|---|
| 2066 | if test -z "$pac_cv_c_llint_pos_align" ; then |
|---|
| 2067 | pac_cv_c_llint_pos_align="unknown" |
|---|
| 2068 | fi |
|---|
| 2069 | ]) |
|---|
| 2070 | |
|---|
| 2071 | |
|---|
| 2072 | |
|---|
| 2073 | |
|---|
| 2074 | |
|---|
| 2075 | |
|---|
| 2076 | |
|---|
| 2077 | |
|---|
| 2078 | |
|---|
| 2079 | |
|---|
| 2080 | |
|---|
| 2081 | |
|---|
| 2082 | |
|---|
| 2083 | |
|---|
| 2084 | |
|---|
| 2085 | |
|---|
| 2086 | |
|---|
| 2087 | |
|---|
| 2088 | |
|---|
| 2089 | |
|---|
| 2090 | |
|---|
| 2091 | |
|---|
| 2092 | |
|---|
| 2093 | |
|---|
| 2094 | |
|---|
| 2095 | |
|---|
| 2096 | |
|---|
| 2097 | AC_DEFUN([PAC_FUNC_NEEDS_DECL],[ |
|---|
| 2098 | AC_CACHE_CHECK([whether $2 needs a declaration], |
|---|
| 2099 | pac_cv_func_decl_$2,[ |
|---|
| 2100 | AC_TRY_COMPILE([$1 |
|---|
| 2101 | int $2(double, int, double, const char *);],[int a=$2(1.0,27,1.0,"foo");], |
|---|
| 2102 | pac_cv_func_decl_$2=yes,pac_cv_func_decl_$2=no)]) |
|---|
| 2103 | if test "$pac_cv_func_decl_$2" = "yes" ; then |
|---|
| 2104 | changequote(<<,>>) |
|---|
| 2105 | define(<<PAC_FUNC_NAME>>, translit(NEEDS_$2_DECL, [a-z *], [A-Z__])) |
|---|
| 2106 | changequote([, ]) |
|---|
| 2107 | AC_DEFINE_UNQUOTED(PAC_FUNC_NAME,1,[Define if $2 needs a declaration]) |
|---|
| 2108 | undefine([PAC_FUNC_NAME]) |
|---|
| 2109 | fi |
|---|
| 2110 | ]) |
|---|
| 2111 | |
|---|
| 2112 | |
|---|
| 2113 | |
|---|
| 2114 | |
|---|
| 2115 | |
|---|
| 2116 | |
|---|
| 2117 | |
|---|
| 2118 | |
|---|
| 2119 | |
|---|
| 2120 | |
|---|
| 2121 | AC_DEFUN([PAC_CHECK_SIZEOF_DERIVED],[ |
|---|
| 2122 | changequote(<<,>>) |
|---|
| 2123 | define(<<AC_TYPE_NAME>>,translit(sizeof_$1,[a-z *], [A-Z_P])) |
|---|
| 2124 | define(<<AC_CV_NAME>>,translit(pac_cv_sizeof_$1,[ *], [_p])) |
|---|
| 2125 | changequote([,]) |
|---|
| 2126 | rm -f conftestval |
|---|
| 2127 | AC_MSG_CHECKING([for size of $1]) |
|---|
| 2128 | AC_CACHE_VAL(AC_CV_NAME, |
|---|
| 2129 | [AC_TRY_RUN([ |
|---|
| 2130 | main() |
|---|
| 2131 | { |
|---|
| 2132 | $2 a; |
|---|
| 2133 | FILE *f=fopen("conftestval", "w"); |
|---|
| 2134 | if (!f) exit(1); |
|---|
| 2135 | fprintf(f, "%d\n", sizeof(a)); |
|---|
| 2136 | exit(0); |
|---|
| 2137 | }],AC_CV_NAME=`cat conftestval`,AC_CV_NAME=0,ifelse([$3],,,AC_CV_NAME=$3))]) |
|---|
| 2138 | AC_MSG_RESULT($AC_CV_NAME) |
|---|
| 2139 | |
|---|
| 2140 | undefine([AC_TYPE_NAME])undefine([AC_CV_NAME]) |
|---|
| 2141 | ]) |
|---|
| 2142 | |
|---|
| 2143 | |
|---|
| 2144 | |
|---|
| 2145 | |
|---|
| 2146 | |
|---|
| 2147 | |
|---|
| 2148 | |
|---|
| 2149 | |
|---|
| 2150 | |
|---|
| 2151 | AC_DEFUN([PAC_CHECK_SIZEOF_2TYPES],[ |
|---|
| 2152 | changequote(<<,>>) |
|---|
| 2153 | define(<<AC_TYPE_NAME>>,translit(sizeof_$1,[a-z *], [A-Z_P])) |
|---|
| 2154 | define(<<AC_CV_NAME>>,translit(pac_cv_sizeof_$1,[ *], [_p])) |
|---|
| 2155 | changequote([,]) |
|---|
| 2156 | rm -f conftestval |
|---|
| 2157 | AC_MSG_CHECKING([for size of $1]) |
|---|
| 2158 | AC_CACHE_VAL(AC_CV_NAME, |
|---|
| 2159 | [AC_TRY_RUN([ |
|---|
| 2160 | main() |
|---|
| 2161 | { |
|---|
| 2162 | $2 a; |
|---|
| 2163 | $3 b; |
|---|
| 2164 | FILE *f=fopen("conftestval", "w"); |
|---|
| 2165 | if (!f) return 1; /* avoid exit */ |
|---|
| 2166 | fprintf(f, "%d\n", (int)(sizeof(a) + sizeof(b))); |
|---|
| 2167 | return 0; |
|---|
| 2168 | }],AC_CV_NAME=`cat conftestval`,AC_CV_NAME=0,ifelse([$4],,,AC_CV_NAME=$4))]) |
|---|
| 2169 | if test "X$AC_CV_NAME" = "X" ; then |
|---|
| 2170 | |
|---|
| 2171 | |
|---|
| 2172 | |
|---|
| 2173 | : |
|---|
| 2174 | fi |
|---|
| 2175 | rm -f conftestval |
|---|
| 2176 | AC_MSG_RESULT($AC_CV_NAME) |
|---|
| 2177 | |
|---|
| 2178 | undefine([AC_TYPE_NAME])undefine([AC_CV_NAME]) |
|---|
| 2179 | ]) |
|---|
| 2180 | |
|---|
| 2181 | |
|---|
| 2182 | |
|---|
| 2183 | |
|---|
| 2184 | |
|---|
| 2185 | |
|---|
| 2186 | |
|---|
| 2187 | |
|---|
| 2188 | |
|---|
| 2189 | |
|---|
| 2190 | |
|---|
| 2191 | |
|---|
| 2192 | |
|---|
| 2193 | |
|---|
| 2194 | |
|---|
| 2195 | AC_DEFUN([PAC_C_GNU_ATTRIBUTE],[ |
|---|
| 2196 | AC_REQUIRE([AC_PROG_CC_GNU]) |
|---|
| 2197 | if test "$ac_cv_prog_gcc" = "yes" ; then |
|---|
| 2198 | AC_CACHE_CHECK([whether __attribute__ allowed], |
|---|
| 2199 | pac_cv_gnu_attr_pure,[ |
|---|
| 2200 | AC_TRY_COMPILE([int foo(int) __attribute__ ((pure));],[int a;], |
|---|
| 2201 | pac_cv_gnu_attr_pure=yes,pac_cv_gnu_attr_pure=no)]) |
|---|
| 2202 | AC_CACHE_CHECK([whether __attribute__((format)) allowed], |
|---|
| 2203 | pac_cv_gnu_attr_format,[ |
|---|
| 2204 | AC_TRY_COMPILE([int foo(char *,...) __attribute__ ((format(printf,1,2)));],[int a;], |
|---|
| 2205 | pac_cv_gnu_attr_format=yes,pac_cv_gnu_attr_format=no)]) |
|---|
| 2206 | if test "$pac_cv_gnu_attr_pure" = "yes" -a "$pac_cv_gnu_attr_format" = "yes" ; then |
|---|
| 2207 | AC_DEFINE(HAVE_GCC_ATTRIBUTE,1,[Define if GNU __attribute__ is supported]) |
|---|
| 2208 | fi |
|---|
| 2209 | fi |
|---|
| 2210 | ]) |
|---|
| 2211 | |
|---|
| 2212 | |
|---|
| 2213 | |
|---|
| 2214 | |
|---|
| 2215 | |
|---|
| 2216 | AC_DEFUN([PAC_PROG_INSTALL_BREAKS_LIBS],[ |
|---|
| 2217 | AC_CACHE_CHECK([whether install breaks libraries], |
|---|
| 2218 | ac_cv_prog_install_breaks_libs,[ |
|---|
| 2219 | AC_REQUIRE([AC_PROG_RANLIB]) |
|---|
| 2220 | AC_REQUIRE([AC_PROG_INSTALL]) |
|---|
| 2221 | AC_REQUIRE([AC_PROG_CC]) |
|---|
| 2222 | ac_cv_prog_install_breaks_libs=yes |
|---|
| 2223 | |
|---|
| 2224 | rm -rf conftest.dSYM |
|---|
| 2225 | rm -f libconftest* conftest* |
|---|
| 2226 | echo 'int foo(int);int foo(int a){return a;}' > conftest1.c |
|---|
| 2227 | echo 'extern int foo(int); int main( int argc, char **argv){ return foo(0); }' > conftest2.c |
|---|
| 2228 | if ${CC-cc} $CFLAGS -c conftest1.c >conftest.out 2>&1 ; then |
|---|
| 2229 | if ${AR-ar} cr libconftest.a conftest1.o >/dev/null 2>&1 ; then |
|---|
| 2230 | if ${RANLIB-:} libconftest.a >/dev/null 2>&1 ; then |
|---|
| 2231 | |
|---|
| 2232 | |
|---|
| 2233 | sleep 10 |
|---|
| 2234 | libinstall="$INSTALL_DATA" |
|---|
| 2235 | eval "libinstall=\"$libinstall\"" |
|---|
| 2236 | if ${libinstall} libconftest.a libconftest1.a >/dev/null 2>&1 ; then |
|---|
| 2237 | if ${CC-cc} $CFLAGS -o conftest conftest2.c $LDFLAGS libconftest1.a >>conftest.out 2>&1 && test -x conftest ; then |
|---|
| 2238 | |
|---|
| 2239 | ac_cv_prog_install_breaks_libs=no |
|---|
| 2240 | else |
|---|
| 2241 | |
|---|
| 2242 | rm -f libconftest1.a |
|---|
| 2243 | if ${libinstall} -p libconftest.a libconftest1.a >/dev/null 2>&1 ; then |
|---|
| 2244 | if ${CC-cc} $CFLAGS -o conftest conftest2.c $LDFLAGS libconftest1.a >>conftest.out 2>&1 && test -x conftest ; then |
|---|
| 2245 | |
|---|
| 2246 | ac_cv_prog_install_breaks_libs="no, with -p" |
|---|
| 2247 | fi |
|---|
| 2248 | fi |
|---|
| 2249 | fi |
|---|
| 2250 | fi |
|---|
| 2251 | fi |
|---|
| 2252 | fi |
|---|
| 2253 | fi |
|---|
| 2254 | |
|---|
| 2255 | rm -rf conftest.dSYM |
|---|
| 2256 | rm -f conftest* libconftest*]) |
|---|
| 2257 | |
|---|
| 2258 | if test -z "$RANLIB_AFTER_INSTALL" ; then |
|---|
| 2259 | RANLIB_AFTER_INSTALL=no |
|---|
| 2260 | fi |
|---|
| 2261 | case "$ac_cv_prog_install_breaks_libs" in |
|---|
| 2262 | yes) |
|---|
| 2263 | RANLIB_AFTER_INSTALL=yes |
|---|
| 2264 | ;; |
|---|
| 2265 | "no, with -p") |
|---|
| 2266 | INSTALL_DATA="$INSTALL_DATA -p" |
|---|
| 2267 | ;; |
|---|
| 2268 | *) |
|---|
| 2269 | |
|---|
| 2270 | : |
|---|
| 2271 | ;; |
|---|
| 2272 | esac |
|---|
| 2273 | AC_SUBST(RANLIB_AFTER_INSTALL) |
|---|
| 2274 | ]) |
|---|
| 2275 | |
|---|
| 2276 | |
|---|
| 2277 | |
|---|
| 2278 | |
|---|
| 2279 | |
|---|
| 2280 | |
|---|
| 2281 | |
|---|
| 2282 | |
|---|
| 2283 | |
|---|
| 2284 | |
|---|
| 2285 | |
|---|
| 2286 | |
|---|
| 2287 | |
|---|
| 2288 | AC_DEFUN([PAC_CC_FUNCTION_NAME_SYMBOL],[ |
|---|
| 2289 | AC_CACHE_CHECK([whether the compiler defines __func__], |
|---|
| 2290 | pac_cv_have__func__,[ |
|---|
| 2291 | tmp_am_cross=no |
|---|
| 2292 | AC_RUN_IFELSE([ |
|---|
| 2293 | |
|---|
| 2294 | int foo(void); |
|---|
| 2295 | int foo(void) |
|---|
| 2296 | { |
|---|
| 2297 | return (strcmp(__func__, "foo") == 0); |
|---|
| 2298 | } |
|---|
| 2299 | int main(int argc, char ** argv) |
|---|
| 2300 | { |
|---|
| 2301 | return (foo() ? 0 : 1); |
|---|
| 2302 | } |
|---|
| 2303 | ], pac_cv_have__func__=yes, pac_cv_have__func__=no,tmp_am_cross=yes) |
|---|
| 2304 | if test "$tmp_am_cross" = yes ; then |
|---|
| 2305 | AC_LINK_IFELSE([ |
|---|
| 2306 | |
|---|
| 2307 | int foo(void); |
|---|
| 2308 | int foo(void) |
|---|
| 2309 | { |
|---|
| 2310 | return (strcmp(__func__, "foo") == 0); |
|---|
| 2311 | } |
|---|
| 2312 | int main(int argc, char ** argv) |
|---|
| 2313 | { |
|---|
| 2314 | return (foo() ? 0 : 1); |
|---|
| 2315 | } |
|---|
| 2316 | ], pac_cv_have__func__=yes, pac_cv_have__func__=no) |
|---|
| 2317 | fi |
|---|
| 2318 | ]) |
|---|
| 2319 | |
|---|
| 2320 | if test "$pac_cv_have__func__" = "yes" ; then |
|---|
| 2321 | AC_DEFINE(HAVE__FUNC__,,[define if the compiler defines __func__]) |
|---|
| 2322 | fi |
|---|
| 2323 | |
|---|
| 2324 | AC_CACHE_CHECK([whether the compiler defines __FUNC__], |
|---|
| 2325 | pac_cv_have_cap__func__,[ |
|---|
| 2326 | tmp_am_cross=no |
|---|
| 2327 | AC_RUN_IFELSE([ |
|---|
| 2328 | |
|---|
| 2329 | int foo(void); |
|---|
| 2330 | int foo(void) |
|---|
| 2331 | { |
|---|
| 2332 | return (strcmp(__FUNC__, "foo") == 0); |
|---|
| 2333 | } |
|---|
| 2334 | int main(int argc, char ** argv) |
|---|
| 2335 | { |
|---|
| 2336 | return (foo() ? 0 : 1); |
|---|
| 2337 | } |
|---|
| 2338 | ], pac_cv_have_cap__func__=yes, pac_cv_have_cap__func__=no,tmp_am_cross=yes) |
|---|
| 2339 | if test "$tmp_am_cross" = yes ; then |
|---|
| 2340 | AC_LINK_IFELSE([ |
|---|
| 2341 | |
|---|
| 2342 | int foo(void); |
|---|
| 2343 | int foo(void) |
|---|
| 2344 | { |
|---|
| 2345 | return (strcmp(__FUNC__, "foo") == 0); |
|---|
| 2346 | } |
|---|
| 2347 | int main(int argc, char ** argv) |
|---|
| 2348 | { |
|---|
| 2349 | return (foo() ? 0 : 1); |
|---|
| 2350 | } |
|---|
| 2351 | ], pac_cv_have__func__=yes, pac_cv_have__func__=no) |
|---|
| 2352 | fi |
|---|
| 2353 | ]) |
|---|
| 2354 | |
|---|
| 2355 | if test "$pac_cv_have_cap__func__" = "yes" ; then |
|---|
| 2356 | AC_DEFINE(HAVE_CAP__FUNC__,,[define if the compiler defines __FUNC__]) |
|---|
| 2357 | fi |
|---|
| 2358 | |
|---|
| 2359 | AC_CACHE_CHECK([whether the compiler sets __FUNCTION__], |
|---|
| 2360 | pac_cv_have__function__,[ |
|---|
| 2361 | tmp_am_cross=no |
|---|
| 2362 | AC_RUN_IFELSE([ |
|---|
| 2363 | |
|---|
| 2364 | int foo(void); |
|---|
| 2365 | int foo(void) |
|---|
| 2366 | { |
|---|
| 2367 | return (strcmp(__FUNCTION__, "foo") == 0); |
|---|
| 2368 | } |
|---|
| 2369 | int main(int argc, char ** argv) |
|---|
| 2370 | { |
|---|
| 2371 | return (foo() ? 0 : 1); |
|---|
| 2372 | } |
|---|
| 2373 | ], pac_cv_have__function__=yes, pac_cv_have__function__=no,tmp_am_cross=yes) |
|---|
| 2374 | if test "$tmp_am_cross" = yes ; then |
|---|
| 2375 | AC_LINK_IFELSE([ |
|---|
| 2376 | |
|---|
| 2377 | int foo(void); |
|---|
| 2378 | int foo(void) |
|---|
| 2379 | { |
|---|
| 2380 | return (strcmp(__FUNCTION__, "foo") == 0); |
|---|
| 2381 | } |
|---|
| 2382 | int main(int argc, char ** argv) |
|---|
| 2383 | { |
|---|
| 2384 | return (foo() ? 0 : 1); |
|---|
| 2385 | } |
|---|
| 2386 | ], pac_cv_have__func__=yes, pac_cv_have__func__=no) |
|---|
| 2387 | fi |
|---|
| 2388 | ]) |
|---|
| 2389 | |
|---|
| 2390 | if test "$pac_cv_have__function__" = "yes" ; then |
|---|
| 2391 | AC_DEFINE(HAVE__FUNCTION__,,[define if the compiler defines __FUNCTION__]) |
|---|
| 2392 | fi |
|---|
| 2393 | |
|---|
| 2394 | ]) |
|---|