#ifdef _COMMENT_
/* Extract compiler pre-defined macros as Make variables
 *
 * Expanded as $(INSTALL_CFG)/TOOLCHAIN.$(EPICS_HOST_ARCH).$(T_A)
 *
 * Must be careful not to #include any C definitions
 * into what is really a Makefile snippet
 *
 * cf. https://sourceforge.net/p/predef/wiki/Home/
 */
/* GCC preprocessor drops C comments from output.
 * MSVC preprocessor emits C comments in output
 */
#endif

#if defined(__GNUC__) && !defined(__clang__)
GCC_MAJOR = __GNUC__
GCC_MINOR = __GNUC_MINOR__
GCC_PATCH = __GNUC_PATCHLEVEL__

#elif defined(__clang__)
CLANG_MAJOR = __clang_major__
CLANG_MINOR = __clang_minor__
CLANG_PATCH = __clang_patchlevel__

#elif defined(_MSC_VER)
MSVC_VER = _MSC_VER
#endif

#ifdef __rtems__
#include <rtems/score/cpuopts.h>
#  if __RTEMS_MAJOR__>=5
OS_API = posix
#  else
OS_API = score
#  endif
#endif

#ifdef __has_include
#  if defined(__rtems__) && __RTEMS_MAJOR__<5 && __has_include(<libtecla.h>)
COMMANDLINE_LIBRARY ?= LIBTECLA
#  elif __has_include(<readline/readline.h>)
COMMANDLINE_LIBRARY ?= READLINE
#  else
COMMANDLINE_LIBRARY ?= EPICS
#  endif
#else
COMMANDLINE_LIBRARY ?= $(strip $(if $(wildcard $(if $(GNU_DIR),$(GNU_DIR)/include/readline/readline.h)), READLINE, EPICS))
#endif

#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE>2
OP_SYS_CPPFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
#endif

