Files
epics-base/configure/toolchain.c
Chris Johns 2b8a944a7d rtems: Add legacy network support and fix LDFLAGS
RTEMS 6 has moved the legacy network support out of the main repo
to a 3rd party library. This change adds support for using the
legacy networking stack with EPICS in a backwards compatible way.

A BSP can be built with libbsd or the legacy stack and by default
EPICS 7 assumes libbsd.

This patch also fixes the LDFLAGS adding the RTEMS LDFLAGS imported
from Makefile.inc.
2024-10-31 16:21:49 -05:00

71 lines
1.9 KiB
C

#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
# if defined(RTEMS_NETWORKING)
/* legacy stack circa RTEMS <= 5 and networking internal to RTEMS */
RTEMS_LEGACY_NETWORKING_INTERNAL = yes
# else
# if !defined(__has_include)
/* assume old GCC implies RTEMS < 5 with mis-configured BSP */
# error rebuild BSP with --enable-network
# elif __has_include(<machine/rtems-net-legacy.h>)
/* legacy stack circa RTEMS > 5 */
RTEMS_LEGACY_NETWORKING = yes
# elif __has_include(<machine/rtems-bsd-version.h>)
/* libbsd stack */
RTEMS_BSD_NETWORKING = yes
# else
# error Cannot determine RTEMS network configuration
# endif
# 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