[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
modification of CFLAGS
From: |
Jason Curl |
Subject: |
modification of CFLAGS |
Date: |
Thu, 20 May 2010 20:40:39 +0200 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4 |
Hello,
I'd like to write a macro, called LX_DEBUG. This checks if the user
gives "--enable-debug" and then depending on the compiler, modify CFLAGS.
However, I see that the autoconf macros already modify CFLAGS. Is there
a way that I can obtain what the user originally entered *within* my
macro after AC_PROG_CC? If the user provided CFLAGS, I wish to use that
and make no modifications. Otherwise, if GNU CC is used, I wish to set
it to "-O0 -g".
Currently, autotools sets it to "-O2 -g". I can't seem to figure out
where the original settings are given.
If the user doesn't provide --enable-debug, I don't want to change anything.
My macro currently looks like:
AC_DEFUN([LX_DEBUG],
[AC_ARG_ENABLE(debug)
AM_CONDITIONAL([HAVE_DEBUG], [test x$enable_debug = xyes])
if test x$enable_debug = xyes; then
AC_DEFINE([DEBUG], [1], [Enable Debugging])
AC_MSG_CHECKING([supported compiler debug options])
if test x$ac_cv_c_compiler_gnu = xyes; then
AC_MSG_RESULT([GCC])
AC_MSG_CHECKING([gcc cflags])
# Unfortunately here, CFLAGS is always set, even if the user
didn't set them
if test "x$CFLAGS" = "x"; then
CFLAGS="-O0 -g"
fi
AC_MSG_RESULT([$CFLAGS])
else
AC_MSG_RESULT([Unknown])
fi
fi
])
- modification of CFLAGS,
Jason Curl <=