The net library is configurable on vxworks7. Pick the library to include in link closures in accordance with the availability of a revealing header file, using the recently introduced if-exist-then-else spec builtin function.
Tested on a mix of gcc-9 and gcc-10 based builds for Vxworks7r2, and sanity checked that a powerpc-vxworks build passes for languages=c,c++ with mainline sources. Committing to mainline. Olivier 2021-10-23 Douglas Rupp <r...@adacore.com> gcc/ * config/vxworks.h (VXWORKS_NET_LIBS_RTP): Use -lrtnet if rtnetStackLib.h is available, fallback to -lnet otherwise.
--- a/gcc/config/vxworks.h +++ b/gcc/config/vxworks.h @@ -90,7 +90,7 @@ along with GCC; see the file COPYING3. If not see #define VXWORKS_SYSCALL_LIBS_RTP #if TARGET_VXWORKS7 -#define VXWORKS_NET_LIBS_RTP "-lnet" +#define VXWORKS_NET_LIBS_RTP "-l%:if-exists-then-else(%:getenv(VSB_DIR /usr/h/public/rtnetStackLib.h) rtnet net)" #else #define VXWORKS_NET_LIBS_RTP "-lnet -ldsi" #endif -- 2.17.1