Does --specs=nosys.specs set a preprocessor macro?

Asked by Jeffrey Walton

I'm in a situation where the library I am compiling uses the following:

#if defined(USE_BERKELEY_STYLE_SOCKETS) && !defined(macintosh)
  #include <netinet/in.h>
  #include <netinet/tcp.h>
#endif

That's causing the compile to fail.

I believe the headers are standard on many Unix platforms, and they will likely be present when a platform is available. Until a platform is available, I'd like to guard their inclusion on a preprocessor macro.

I'm compiling and linking with --specs=nosys.specs.

Are then any preprocessor macros available for the guard? Does nosys.specs cause the compiler to define any macros to use?

Or are there other ways to avoid the compile problem (besides commenting out the defines)?

Question information

Language:
English Edit question
Status:
Answered
For:
GNU Arm Embedded Toolchain Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Thomas Preud'homme (thomas-preudhomme) said :
#1

I'm afraid --specs=nosys.specs does not change anything to the list of macro defined: it just specify what libraries to link and how. I'm not sure if such a solution would suit you but header inclusion is typically handled by autotools with a configure script that check whether the header is available on the target and do conditional inclusion accordingly.

Best regards.

Revision history for this message
TM (tm1234) said :
#2

> Does nosys.specs cause the compiler to define any macros to use?

You can see what a specific specs file does by looking at it.
E.g. .../arm-none-eabi-gcc/arm-none-eabi-gcc/lib/nosys.specs.
As mentioned above nosys.specs just deals with link time issues (libs etc.) and not preprocessor defines.

Hope this helps.

Can you help with this problem?

Provide an answer of your own, or ask Jeffrey Walton for more information if necessary.

To post a message you must log in.