Skip to content

Commit

Permalink
configure: never overwrite users CFLAGS
Browse files Browse the repository at this point in the history
  • Loading branch information
junghans committed Apr 20, 2011
1 parent dc47442 commit daca0d7
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -101,26 +101,30 @@ AC_SUBST(ESPRESSO_MPIEXEC)
##################################
#### COMPILER CHARACTERISTICS ####
##################################
# test for -O5
AC_MSG_CHECKING([whether the compiler accepts -O5])
saved_CFLAGS=$CFLAGS
CFLAGS="-O5 $CFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],[
AC_MSG_RESULT(yes);try_add_flag_res=yes
],[
AC_MSG_RESULT(no); CFLAGS=$saved_CFLAGS; try_add_flag_res=no
])

##################################
# test for -Wall
AC_MSG_CHECKING([whether the compiler accepts -Wall])
saved_CFLAGS=$CFLAGS
CFLAGS="-Wall $CFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],[
AC_MSG_RESULT(yes);try_add_flag_res=yes
],[
AC_MSG_RESULT(no); CFLAGS=$saved_CFLAGS; try_add_flag_res=no
])
#never overwrite users CFLAGS
if test ${CFLAGS+set} != set; then
# test for -O5
AC_MSG_CHECKING([whether the compiler accepts -O5])
saved_CFLAGS=$CFLAGS
CFLAGS="-O5 $CFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],[
AC_MSG_RESULT(yes);try_add_flag_res=yes
],[
AC_MSG_RESULT(no); CFLAGS=$saved_CFLAGS; try_add_flag_res=no
])

##################################
# test for -Wall
AC_MSG_CHECKING([whether the compiler accepts -Wall])
saved_CFLAGS=$CFLAGS
CFLAGS="-Wall $CFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],[
AC_MSG_RESULT(yes);try_add_flag_res=yes
],[
AC_MSG_RESULT(no); CFLAGS=$saved_CFLAGS; try_add_flag_res=no
])
fi

##################################
# test inlining
Expand Down

0 comments on commit daca0d7

Please sign in to comment.