]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
declare defeat trying to detect C89 compilers
authorDamien Miller <djm@mindrot.org>
Mon, 9 Sep 2024 07:30:38 +0000 (17:30 +1000)
committerDamien Miller <djm@mindrot.org>
Mon, 9 Sep 2024 07:30:38 +0000 (17:30 +1000)
I can't find a reliable way to detect the features the ML-KEM code
requires in configure. Give up for now and use VLA support (that we
can detect) as a proxy for "old compiler" and turn off ML-KEM if
it isn't supported.

configure.ac
defines.h

index 954de6cafac1766f5804d97e1d969315e4f76550..591d5a3880c59c23074fe58f2eb580ff4d71938c 100644 (file)
@@ -353,20 +353,6 @@ AC_COMPILE_IFELSE(
     [ AC_MSG_RESULT([no]) ]
 )
 
-AC_MSG_CHECKING([if compiler supports compound literals])
-AC_COMPILE_IFELSE(
-    [AC_LANG_PROGRAM([[#include <stdlib.h>]],
-    [[  struct foo { int bar; int baz; };
-        void *fooc = &(struct foo){.bar = 1, .baz = 2};
-        struct foo *foo2 = (struct foo *)fooc;
-        return (foo2->bar == 1 && foo2->baz == 2) ? 0 : 1;
-    ]])],
-    [ AC_MSG_RESULT([yes])
-      AC_DEFINE(COMPOUND_LITERALS, [1],
-        [compiler supports compound literals]) ],
-    [ AC_MSG_RESULT([no]) ]
-)
-
 AC_MSG_CHECKING([if compiler accepts variable declarations after code])
 AC_COMPILE_IFELSE(
     [AC_LANG_PROGRAM([[#include <stdlib.h>]],
index 3d03b033a3c869e55ba715422c8c87ae063c5a79..ed860e78bba0c9fc551d373e1051b4135cc35139 100644 (file)
--- a/defines.h
+++ b/defines.h
@@ -940,10 +940,8 @@ struct winsize {
  * so only enable if the compiler supports them.
  */
 #if defined(VARIABLE_LENGTH_ARRAYS) && defined(VARIABLE_DECLARATION_AFTER_CODE)
-# define USE_SNTRUP761X25519 1
-#endif
-/* The ML-KEM768 imlementation similarly uses C99 compound literals */
-#ifdef COMPOUND_LITERALS
+# define USE_SNTRUP761X25519   1
+/* The ML-KEM768 implementation also uses C89 features */
 # define USE_MLKEM768X25519    1
 #endif
 #endif /* _DEFINES_H */