Changeset 4845

Show
Ignore:
Timestamp:
06/29/09 01:08:44 (5 months ago)
Author:
balaji
Message:

This patch is really a hack to get around some of the issues with the
top-level configure.in. We currently do not store any of the detected
compiler flags in CFLAGS, but rather add them to
MPICH2_EXTRA_CFLAGS. So, the autoconf and confdb macros which use
these flags make incorrect decisions on what should be defined and
what not. This patch temporarily sets the CFLAGS to the detected flags
for each test and resets them once the test is done. The correct fix
for this is to save the user-defined CFLAGS in some place and append
flags as they are detected into the CFLAGS variable itself.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • mpich2/trunk/configure.in

    r4819 r4845  
    31593159PAC_C_VOLATILE 
    31603160PAC_C_RESTRICT 
     3161 
     3162saveCFLAGS=$CFLAGS 
     3163CFLAGS="$CFLAGS $MPICH2_EXTRA_CFLAGS" 
    31613164AC_C_INLINE 
     3165CFLAGS=$saveCFLAGS 
     3166 
    31623167PAC_C_GNU_ATTRIBUTE 
    31633168# We need to check for the endianess in order to implement the 
     
    50855090if test "$ac_cv_func_vsnprintf" = "yes" ; then 
    50865091    # vsnprintf may be declared in stdio.h and may need stdarg.h  
     5092    saveCFLAGS=$CFLAGS 
     5093    CFLAGS="$CFLAGS $MPICH2_EXTRA_CFLAGS" 
    50875094    PAC_FUNC_NEEDS_DECL([#include <stdio.h> 
    50885095#include <stdarg.h>],vsnprintf) 
     5096    CFLAGS=$saveCFLAGS 
    50895097fi 
    50905098# We would like to use strerror in the file namepublisher; it is also used 
     
    50955103AC_CHECK_FUNCS(snprintf) 
    50965104if test "$ac_cv_func_snprintf" = "yes" ; then 
     5105    saveCFLAGS=$CFLAGS 
     5106    CFLAGS="$CFLAGS $MPICH2_EXTRA_CFLAGS" 
    50975107    PAC_FUNC_NEEDS_DECL([#include <stdio.h>],snprintf) 
     5108    CFLAGS=$saveCFLAGS 
    50985109fi 
    50995110# if we are using stdarg, we may need va_copy .  Test to see if we have it 
     
    51045115# test in confdb/aclocal_cc.m4). 
    51055116AC_CACHE_CHECK([for va_copy],pac_cv_func_va_copy,[ 
     5117saveCFLAGS=$CFLAGS 
     5118CFLAGS="$CFLAGS $MPICH2_EXTRA_CFLAGS" 
    51065119AC_TRY_LINK([ 
    51075120#include <stdarg.h> 
     
    51145127} 
    51155128],[foo1("a test %d", 3);],pac_cv_func_va_copy=yes,pac_cv_func_va_copy=no)]) 
     5129CFLAGS=$saveCFLAGS 
     5130 
    51165131if test "$pac_cv_func_va_copy" = "yes" ; then 
    51175132    AC_DEFINE(HAVE_VA_COPY,1,[Define if we have va_copy]) 
    5118 fi 
    5119 # We might have __va_copy... 
    5120 if test "$pac_cv_func_va_copy" != "yes" ; then  
     5133else 
    51215134    AC_CACHE_CHECK([for __va_copy],pac_cv_func___va_copy,[ 
     5135    saveCFLAGS=$CFLAGS 
     5136    CFLAGS="$CFLAGS $MPICH2_EXTRA_CFLAGS" 
    51225137    AC_TRY_LINK([ 
    51235138#include <stdarg.h> 
     
    51305145} 
    51315146],[foo1("a test %d", 3);],pac_cv_func___va_copy=yes,pac_cv_func___va_copy=no)]) 
     5147    CFLAGS=$saveCFLAGS 
    51325148    if test "$pac_cv_func___va_copy" = "yes" ; then 
    5133     AC_DEFINE(HAVE___VA_COPY,1,[Define if we have __va_copy]) 
     5149        AC_DEFINE(HAVE___VA_COPY,1,[Define if we have __va_copy]) 
    51345150    fi 
    51355151fi 
     
    51655181    if test "$ac_cv_func_strdup" = "yes" ; then 
    51665182        # Do we need to declare strdup? 
     5183        saveCFLAGS=$CFLAGS 
     5184        CFLAGS="$CFLAGS $MPICH2_EXTRA_CFLAGS" 
    51675185        PAC_FUNC_NEEDS_DECL([#include <string.h>],strdup) 
     5186        CFLAGS=$saveCFLAGS 
    51685187    fi 
    51695188else 
     
    51965215AC_HAVE_FUNCS(mkstemp) 
    51975216if test "$ac_cv_func_mkstemp" = "yes" ; then 
     5217    saveCFLAGS=$CFLAGS 
     5218    CFLAGS="$CFLAGS $MPICH2_EXTRA_CFLAGS" 
    51985219    PAC_FUNC_NEEDS_DECL([#include <stdlib.h>],mkstemp) 
     5220    CFLAGS=$saveCFLAGS 
    51995221fi 
    52005222# fdopen() converts from an fd to a FILE* 
    52015223AC_HAVE_FUNCS(fdopen) 
    52025224if test "$ac_cv_func_fdopen" = "yes" ; then 
     5225    saveCFLAGS=$CFLAGS 
     5226    CFLAGS="$CFLAGS $MPICH2_EXTRA_CFLAGS" 
    52035227    PAC_FUNC_NEEDS_DECL([#include <stdlib.h>],fdopen) 
     5228    CFLAGS=$saveCFLAGS 
    52045229fi 
    52055230# putenv() sets environment variable 
    52065231AC_HAVE_FUNCS(putenv) 
    52075232if test "$ac_cv_func_putenv" = "yes" ; then 
     5233    saveCFLAGS=$CFLAGS 
     5234    CFLAGS="$CFLAGS $MPICH2_EXTRA_CFLAGS" 
    52085235    PAC_FUNC_NEEDS_DECL([#include <stdlib.h>],putenv) 
     5236    CFLAGS=$saveCFLAGS 
    52095237fi 
    52105238