[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

socket.h and _XOPEN_SOURCE


today I was trying to help one of the Icecast2/Ices2/libshout developers
to compile those programs on OpenBSD 3.2 and 3.3beta, by offering some
humble feedback and a shell. Unfortunately, it didn't work out yet, and
the most pressing question in the end was "What is the correct way to
include <sys/socket.h> when _XOPEN_SOURCE is defined to 500?".
Errors like this one are the current showstoppers, and believed to be
connected to each other:

In file included from sock.c:40:
/usr/include/arpa/inet.h:89: syntax error before `inet_nsap_addr'
/usr/include/arpa/inet.h:89: syntax error before `u_char'
/usr/include/arpa/inet.h:89: warning: data definition has no type or
storage class
/usr/include/arpa/inet.h:90: syntax error before `*'
(from 3.3 beta)

Pointers to documentation or any hints that you could provide would be
highly appreciated.

Here's one more example:

#include <sys/types.h>
#include <sys/param.h> /* ... adding this include doesn't help */
#include <sys/socket.h>

int main()
    return 0;

It gives the following error when using -D_XOPEN_SOURCE=500 (same
without the =500 part):

$ gcc -D_XOPEN_SOURCE=500 -o sample sample.c
In file included from sample.c:3:
/usr/include/sys/socket.h:166: syntax error before `u_char'
/usr/include/sys/socket.h:168: syntax error before `u_char'
/usr/include/sys/socket.h:176: syntax error before `u_short'
/usr/include/sys/socket.h:320: syntax error before `u_int'
/usr/include/sys/socket.h:391: syntax error before `u_short'

Thanks a lot in advance,