annotate src/fftw-3.3.8/m4/ax_gcc_aligns_stack.m4 @ 82:d0c2a83c1364

Add FFTW 3.3.8 source, and a Linux build
author Chris Cannam
date Tue, 19 Nov 2019 14:52:55 +0000
parents
children
rev   line source
Chris@82 1 dnl @synopsis AX_GCC_ALIGNS_STACK([ACTION-IF-YES], [ACTION-IF-NO])
Chris@82 2 dnl @summary check whether gcc can align stack to 8-byte boundary
Chris@82 3 dnl @category Misc
Chris@82 4 dnl
Chris@82 5 dnl Check to see if we are using a version of gcc that aligns the stack
Chris@82 6 dnl (true in gcc-2.95+, which have the -mpreferred-stack-boundary flag).
Chris@82 7 dnl Also, however, checks whether main() is correctly aligned by the
Chris@82 8 dnl OS/libc/..., as well as for a bug in the stack alignment of gcc-2.95.x
Chris@82 9 dnl (see http://gcc.gnu.org/ml/gcc-bugs/1999-11/msg00259.html).
Chris@82 10 dnl
Chris@82 11 dnl ACTION-IF-YES/ACTION-IF-NO are shell commands to execute if we are
Chris@82 12 dnl using gcc and the stack is/isn't aligned, respectively.
Chris@82 13 dnl
Chris@82 14 dnl Requires macro: AX_CHECK_COMPILER_FLAGS, AX_GCC_VERSION
Chris@82 15 dnl
Chris@82 16 dnl @version 2005-05-30
Chris@82 17 dnl @license GPLWithACException
Chris@82 18 dnl @author Steven G. Johnson <stevenj@alum.mit.edu>
Chris@82 19 AC_DEFUN([AX_GCC_ALIGNS_STACK],
Chris@82 20 [
Chris@82 21 AC_REQUIRE([AC_PROG_CC])
Chris@82 22 ax_gcc_aligns_stack=no
Chris@82 23 if test "$GCC" = "yes"; then
Chris@82 24 AX_CHECK_COMPILER_FLAGS(-mpreferred-stack-boundary=4, [
Chris@82 25 AC_MSG_CHECKING([whether the stack is at least 8-byte aligned by gcc])
Chris@82 26 save_CFLAGS="$CFLAGS"
Chris@82 27 CFLAGS="-O"
Chris@82 28 AX_CHECK_COMPILER_FLAGS(-malign-double, CFLAGS="$CFLAGS -malign-double")
Chris@82 29 AC_TRY_RUN([#include <stdlib.h>
Chris@82 30 # include <stdio.h>
Chris@82 31 struct yuck { int blechh; };
Chris@82 32 int one(void) { return 1; }
Chris@82 33 struct yuck ick(void) { struct yuck y; y.blechh = 3; return y; }
Chris@82 34 # define CHK_ALIGN(x) if ((((long) &(x)) & 0x7)) { fprintf(stderr, "bad alignment of " #x "\n"); exit(1); }
Chris@82 35 void blah(int foo) { double foobar; CHK_ALIGN(foobar); }
Chris@82 36 int main2(void) {double ok1; struct yuck y; double ok2; CHK_ALIGN(ok1);
Chris@82 37 CHK_ALIGN(ok2); y = ick(); blah(one()); return 0;}
Chris@82 38 int main(void) { if ((((long) (__builtin_alloca(0))) & 0x7)) __builtin_alloca(4); return main2(); }
Chris@82 39 ], [ax_gcc_aligns_stack=yes; ax_gcc_stack_align_bug=no],
Chris@82 40 ax_gcc_stack_align_bug=yes, [AX_GCC_VERSION(3,0,0, ax_gcc_stack_align_bug=no, ax_gcc_stack_align_bug=yes)])
Chris@82 41 CFLAGS="$save_CFLAGS"
Chris@82 42 AC_MSG_RESULT($ax_gcc_aligns_stack)
Chris@82 43 ])
Chris@82 44 fi
Chris@82 45 if test "$ax_gcc_aligns_stack" = yes; then
Chris@82 46 m4_default([$1], :)
Chris@82 47 else
Chris@82 48 m4_default([$2], :)
Chris@82 49 fi
Chris@82 50 ])