changeset 1678:9305c0d5216b

added memalign detection, maps to malloc if fails.
author atmos4
date Fri, 24 Aug 2001 14:49:05 +0000
parents 1bf2c3dbc36e
children 73c8f54305b1
files configure
diffstat 1 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/configure	Fri Aug 24 10:46:31 2001 +0000
+++ b/configure	Fri Aug 24 14:49:05 2001 +0000
@@ -908,8 +908,22 @@
 int main( void ) { return 0; }
 EOF
 
+_memalign_def=
 _malloc_h=no
-$_cc -o $TMPO $TMPC 2> /dev/null && _malloc_h=yes
+if $_cc -o $TMPO $TMPC 2> /dev/null ; then
+_malloc_h=yes
+# check for memalign - atmos
+# should this be restricted to x86, or customized for cpu types (opt for cacheline sizes)?
+cat > $TMPC << EOF
+#include <malloc.h>
+int main ( void ) {
+char *string = NULL;
+string = memalign(64, sizeof(char));
+return 0;
+}
+EOF
+$_cc -o $TMPO $TMPC 2> /dev/null || _memalign_def='#define memalign(a,b) malloc(b)'
+fi
 
 
 cat > $TMPC << EOF
@@ -1994,6 +2008,9 @@
 /* Define this if your system has the "malloc.h" header file */
 $_have_malloc_h
 
+/* memalign is mapped to malloc here, if unsupported */
+$_memalign_def
+
 /* Define this if your system has the "alloca.h" header file */
 $_have_alloca_h