Currently when trying to build the examples under FreeBSD you get this error:
OS=uname; test "$OS" = Linux && LIBS="-ldl" ; cc -W -Wall -I.. -pthread -g hello.c ../mongoose.c $LIBS -o hello;
../mongoose.c: In function 'mg_connect':
../mongoose.c:3988: error: 'PF_INET' undeclared (first use in this function)
../mongoose.c:3988: error: (Each undeclared identifier is reported only once
../mongoose.c:3988: error: for each function it appears in.)
The attached patch fixes this error for FreeBSD systems.
sys/socket.h is already included. does it fail because of the #defines at the beginning of the file, e.g. _XOPEN_SOURCE, etc?
Is there a free shell, or live CD for qemu ? What version of FreeBSD you're using ?
Yes, apperantely it fails because of _XOPEN_SOURCE - if I comment it then it builds fine, with _XOPEN_SOURCE defined it fails to build.
I'm running FreeBSD 9.0-RELEASE.
Ok, according to flockfile(3) under Linux you need only this:
-#define _XOPEN_SOURCE 600 // For flockfile() on Linux
+#define _XOPEN_SOURCE // For flockfile() on Linux
Just checked it on my FreeBSD system and it builds fine.
I'll re-work the patch and provide you with a new one. OK for you as well?
Yes, sounds good, thanks!
Please check pull request #17 for the new patch.