Add option --disable-O-flag-munging.
authorWerner Koch <wk@gnupg.org>
Thu, 10 Dec 2009 17:27:55 +0000 (17:27 +0000)
committerWerner Koch <wk@gnupg.org>
Thu, 10 Dec 2009 17:27:55 +0000 (17:27 +0000)
ChangeLog
README
cipher/ChangeLog
cipher/Makefile.am
configure.ac

index 869abaa..80717c5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-12-10  Werner Koch  <wk@g10code.com>
+
+       * configure.ac: Add option --disable-O-flag-munging.
+
 2009-12-08  Marcus Brinkmann  <marcus@g10code.de>
 
        Update to libtool 2.2.6a.
diff --git a/README b/README
index 3bab599..fc534b0 100644 (file)
--- a/README
+++ b/README
                      available.  Try this if you get problems with
                      assembler code.
 
+     --disable-O-flag-munging
+                     Some code is too complex for some compilers while
+                     in higher optimization modes, thus the compiler
+                     invocation is modified to use a lower
+                     optimization level.  Usually this works very well
+                     but on some platforms these rules break the
+                     invocation.  This option may be used to disable
+                     the feature under the assumption that either good
+                     CFLAGS are given or the compiler can grok the code.
+
+                      
+
 
     Build Problems
     --------------
index 26b9e7b..cd29838 100644 (file)
@@ -1,5 +1,8 @@
 2009-12-10  Werner Koch  <wk@g10code.com>
 
+       * Makefile.am (o_flag_munging): New.
+       (tiger.o, tiger.lo): Use it. 
+
        * cipher.c (do_ctr_encrypt): Add arg OUTBUFLEN.  Check for
        suitable value.  Add check for valid inputlen.  Wipe temporary
        memory.
index f49c6a7..9474848 100644 (file)
@@ -67,10 +67,16 @@ twofish.c \
 rfc2268.c \
 camellia.c camellia.h camellia-glue.c
 
+if ENABLE_O_FLAG_MUNGING
+o_flag_munging = sed -e 's/-O[2-9s]*/-O1/g'
+else
+o_flag_munging = cat
+endif
+
 
 # We need to lower the optimization for this module.
 tiger.o: $(srcdir)/tiger.c
-       `echo $(COMPILE) -c $(srcdir)/tiger.c | sed -e 's/-O[2-9s]*/-O1/g' `
+       `echo $(COMPILE) -c $(srcdir)/tiger.c | $(o_flag_munging) `
 
 tiger.lo: $(srcdir)/tiger.c
-       `echo $(LTCOMPILE) -c $(srcdir)/tiger.c | sed -e 's/-O[2-9s]*/-O1/g' `
+       `echo $(LTCOMPILE) -c $(srcdir)/tiger.c | $(o_flag_munging) `
index 93f4c03..be2fd32 100644 (file)
@@ -477,6 +477,16 @@ if test x"$padlocksupport" = xyes ; then
             [Enable support for the PadLock engine.])
 fi
 
+# Implementation of the --disable-O-flag-munging switch.
+AC_MSG_CHECKING([whether a -O flag munging is requested])
+AC_ARG_ENABLE([O-flag-munging],
+              AC_HELP_STRING([--disable-O-flag-munging],
+                 [Disable modification of the cc -O flag]),
+              [enable_o_flag_munging=$enableval],
+              [enable_o_flag_munging=yes])
+AC_MSG_RESULT($enable_o_flag_munging)
+AM_CONDITIONAL(ENABLE_O_FLAG_MUNGING, test "$enable_o_flag_munging" = "yes")
+
 
 
 AC_DEFINE_UNQUOTED(PRINTABLE_OS_NAME, "$PRINTABLE_OS_NAME",
@@ -506,6 +516,7 @@ AC_DEFINE_UNQUOTED(NAME_OF_DEV_RANDOM, "$NAME_OF_DEV_RANDOM",
 AC_DEFINE_UNQUOTED(NAME_OF_DEV_URANDOM, "$NAME_OF_DEV_URANDOM",
                    [defined to the name of the weaker random device])
 
+
 ###############################
 #### Checks for libraries. ####
 ###############################