From: Ken Raeburn Date: Thu, 14 Aug 2008 22:59:54 +0000 (+0000) Subject: Only add -Os for size optimizations if CFLAGS wasn't specified already. If X-Git-Tag: krb5-1.7-alpha1~489 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7b2fd388c28d4c8a3a7a2a4bf2b70a251bf037e8;p=krb5.git Only add -Os for size optimizations if CFLAGS wasn't specified already. If the configure-generated CFLAGS string is one of the usual ones with -O2, replace -O2 rather than appending, since -Os will override previously specified optimization levels anyways. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20660 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/aclocal.m4 b/src/aclocal.m4 index 859529e5b..51d034d2b 100644 --- a/src/aclocal.m4 +++ b/src/aclocal.m4 @@ -624,9 +624,13 @@ extra_gcc_warn_opts="-Wall -Wcast-qual -Wcast-align -Wconversion -Wshadow" # -Wmissing-prototypes if test "$GCC" = yes ; then # Putting this here means we get -Os after -O2, which works. - if test "$with_size_optimizations" = yes; then + if test "$with_size_optimizations" = yes && test "x$krb5_ac_cflags_set" != xset; then AC_MSG_NOTICE(adding -Os optimization option) - CFLAGS="$CFLAGS -Os" + case "$CFLAGS" in + "-g -O2") CFLAGS="-g -Os" ;; + "-O2") CFLAGS="-Os" ;; + *) CFLAGS="$CFLAGS -Os" ;; + esac fi if test "x$krb5_ac_cflags_set" = xset ; then AC_MSG_NOTICE(not adding extra gcc warning flags because CFLAGS was set)