diff --git a/configure.ac b/configure.ac index f41a9e62c..f1c9f9f31 100644 --- a/configure.ac +++ b/configure.ac @@ -121,6 +121,7 @@ AC_ARG_VAR(KARCH, [Kernel Architecture String]) AC_SUBST(KARCH) OVS_CHECK_LINUX OVS_CHECK_DPDK +OVS_CHECK_PRAGMA_MESSAGE AC_CONFIG_FILES(Makefile) AC_CONFIG_FILES(datapath/Makefile) diff --git a/lib/compiler.h b/lib/compiler.h index e8bf119f6..5942c3029 100644 --- a/lib/compiler.h +++ b/lib/compiler.h @@ -221,4 +221,14 @@ #define OVS_PREFETCH_WRITE(addr) #endif +/* Output a message (not an error) while compiling without failing the + * compilation process */ +#if HAVE_PRAGMA_MESSAGE +#define DO_PRAGMA(x) _Pragma(#x) +#define BUILD_MESSAGE(x) \ + DO_PRAGMA(message(x)) +#else +#define BUILD_MESSAGE(x) +#endif + #endif /* compiler.h */ diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4 index 4569bdc57..e918f2555 100644 --- a/m4/openvswitch.m4 +++ b/m4/openvswitch.m4 @@ -457,3 +457,12 @@ dnl OVS_CHECK_INCLUDE_NEXT AC_DEFUN([OVS_CHECK_INCLUDE_NEXT], [AC_REQUIRE([gl_CHECK_NEXT_HEADERS]) gl_CHECK_NEXT_HEADERS([$1])]) + +dnl OVS_CHECK_PRAGMA_MESSAGE +AC_DEFUN([OVS_CHECK_PRAGMA_MESSAGE], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM( + [[_Pragma("message(\"Checking for pragma message\")") + ]])], + [AC_DEFINE(HAVE_PRAGMA_MESSAGE,1,[Define if compiler supports #pragma + message directive])]) + ])