Parcourir la source

[master] Correct compile error in watch_socket_unittests.cc under Solaris

Solaris defines FIONREAD, used in unit test is dhcp_ddns/watch_socket_unittests.cc in sys/filio.h.  Added header check for this file to configure.ac and use
of HAVE_SYS_FILIO_H in the unit test source.
Thomas Markwalder il y a 11 ans
Parent
commit
10fa44e191
2 fichiers modifiés avec 9 ajouts et 1 suppressions
  1. 3 0
      configure.ac
  2. 6 1
      src/lib/dhcp_ddns/tests/watch_socket_unittests.cc

+ 3 - 0
configure.ac

@@ -910,6 +910,9 @@ if test "$MYSQL_CONFIG" != "" ; then
     AC_DEFINE([HAVE_MYSQL], [1], [MySQL is present])
 fi
 
+# Solaris puts FIONREAD in filio.h
+AC_CHECK_HEADERS(sys/filio.h,,,)
+
 # ... and at the shell level, so Makefile.am can take action depending on this.
 AM_CONDITIONAL(HAVE_MYSQL, test "$MYSQL_CONFIG" != "")
 

+ 6 - 1
src/lib/dhcp_ddns/tests/watch_socket_unittests.cc

@@ -11,7 +11,7 @@
 // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
 // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 // PERFORMANCE OF THIS SOFTWARE.
-
+#include <config.h>
 #include <dhcp_ddns/watch_socket.h>
 #include <test_utils.h>
 
@@ -20,6 +20,11 @@
 #include <sys/select.h>
 #include <sys/ioctl.h>
 
+#ifdef HAVE_SYS_FILIO_H
+// FIONREAD is here on Solaris
+#include <sys/filio.h>
+#endif
+
 using namespace std;
 using namespace isc;
 using namespace isc::dhcp_ddns;