Only add -Os for size optimizations if CFLAGS wasn't specified already. If
authorKen Raeburn <raeburn@mit.edu>
Thu, 14 Aug 2008 22:59:54 +0000 (22:59 +0000)
committerKen Raeburn <raeburn@mit.edu>
Thu, 14 Aug 2008 22:59:54 +0000 (22:59 +0000)
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

src/aclocal.m4

index 859529e5bea419cff7d82afb658cc2c598c04e9b..51d034d2b87556fa20be52c3d37f6ea18a4b4ea5 100644 (file)
@@ -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)