2.0.0-pre1 - cannot build on FreeBSD

Nicolas Baradakis nbk at sitadelle.com
Mon May 28 13:05:52 CEST 2007


David Wood wrote:

> I've put in quite a bit of work today towards porting 2.0.0-pre1 to 
> FreeBSD, with the intention of submitting a FreeRADIUS 2 port as soon as 
> possible.
> 
> Unfortunately, there's a problem which I don't have the autoconf skills 
> to patch quickly. When checking (and later attempting to use) net/if.h, 
> you need to #include sys/socket.h on FreeBSD to get the definition of 
> struct sockaddr.

Thanks for the report. I hope the following changes in CVS head will
solve the problem. (you also need to run autoconf)

Index: configure.in
===================================================================
RCS file: /source/radiusd/configure.in,v
retrieving revision 1.240
retrieving revision 1.241
diff -u -r1.240 -r1.241
--- configure.in	28 May 2007 10:28:06 -0000	1.240
+++ configure.in	28 May 2007 10:46:54 -0000	1.241
@@ -559,7 +559,6 @@
 	sys/security.h \
 	fcntl.h \
 	sys/fcntl.h \
-	net/if.h \
 	prot.h \
 	pwd.h \
 	grp.h \
@@ -567,6 +566,13 @@
 	siad.h
 )
 
+dnl FreeBSD requires sys/socket.h before net/if.h
+AC_CHECK_HEADERS(net/if.h, [], [],
+[#if HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+# endif
+])
+
 REGEX=no
 AC_CHECK_HEADER(regex.h, AC_DEFINE(HAVE_REGEX_H, [], [define this if we have the <regex.h> header file]))
 if test "x$ac_cv_header_regex_h" = "xyes"; then
Index: src/include/missing.h
===================================================================
RCS file: /source/radiusd/src/include/missing.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- src/include/missing.h	25 May 2007 09:57:15 -0000	1.35
+++ src/include/missing.h	25 May 2007 09:58:26 -0000	1.36
@@ -50,6 +50,10 @@
 #include <sys/select.h>
 #endif
 
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif

-- 
Nicolas Baradakis



More information about the Freeradius-Users mailing list