tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

c11 support in mk?



(Obviously for post freeze.)

pkgsrc does not seem to have c11 support in USE_LANGUAGES.  At least
mongodb needs c11, according to its SConstruct file.   So it seems we
should be adding the obvious addition to what's there for c99.

(What's not obvious is:

  Why is gnu99 added when a package declares c99, when we have gnu
  flavors of the C++ standards explicitly?

  Why is the c99 flag test only in gcc?  I am guessing that how to
  sepcify c99 is not the same, while --std=c++11 more or less is these
  days.  But it seems clang should get a --std=c99 flag, even if that
  might be default.  Or if we really should be using gnu99, --std=gnu99.

Index: compiler.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/compiler.mk,v
retrieving revision 1.91
diff -u -p -r1.91 compiler.mk
--- compiler.mk	22 Feb 2019 00:06:46 -0000	1.91
+++ compiler.mk	28 Jun 2019 16:08:03 -0000
@@ -44,9 +44,9 @@
 #	This is used to determine the correct compilers to make
 #	visible to the build environment, installing them if
 #	necessary.  Flags such as --std=c++99 are also added.
-#	Valid values are: c, c99, c++, c++03, gnu++03, c++0x, gnu++0x,
-#	c++11, gnu++11, c++14, gnu++14, fortran, fortran77, java, objc,
-#	obj-c++, and ada.  The default is "c".
+#	Valid values are: c, c99, c11, c++, c++03, gnu++03, c++0x,
+#	gnu++0x, c++11, gnu++11, c++14, gnu++14, fortran, fortran77,
+#	java, objc, obj-c++, and ada.  The default is "c".
 #
 #       The above is partly aspirational.  As an example c++11 does
 #       not force a new enough version of gcc.
@@ -79,7 +79,7 @@ _SYS_VARS.compiler=	CC_VERSION
 USE_LANGUAGES?=	c
 
 # Add c support if c99 is set
-.if !empty(USE_LANGUAGES:Mc99)
+.if !empty(USE_LANGUAGES:Mc99) || !empty(USE_LANGUAGES:Mc11)
 USE_LANGUAGES+=	c
 .endif
 
Index: compiler/gcc.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/compiler/gcc.mk,v
retrieving revision 1.198
diff -u -p -r1.198 gcc.mk
--- compiler/gcc.mk	12 Nov 2018 14:22:58 -0000	1.198
+++ compiler/gcc.mk	28 Jun 2019 16:08:03 -0000
@@ -342,6 +342,11 @@ _WRAP_EXTRA_ARGS.CC+=	-std=gnu99
 CWRAPPERS_APPEND.cc+=	-std=gnu99
 .endif
 
+.if !empty(USE_LANGUAGES:Mc11)
+_WRAP_EXTRA_ARGS.CC+=	-std=c11
+CWRAPPERS_APPEND.cc+=	-std=c11
+.endif
+
 .if ${OPSYS} == "NetBSD"
 _MKPIE_CFLAGS.gcc=	-fPIC
 # XXX for executables it should be:

I'll commit this post freeze, absent objections and with edits from
comments.


Home | Main Index | Thread Index | Old Index