CMake + OS X + current head == tcpd.h problems

Compilation and installation of DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
chaircrusher
Posts: 32
Joined: Tue, 2011-12-20, 23:24
Location: iowa city,ia

CMake + OS X + current head == tcpd.h problems

#1 Post by chaircrusher »

OS X Version 10.7.5
XCode Version 4.4.1
cmake version 2.8.9
clang version 3.2 (trunk 167618)

This was apparently not an issue in an earlier version we were using (ab844899a92f46e2d880c38c85ce098933533aef)
But in today's head revision (628eb9865179bbdbdcd88c1f7aa238d6dd037530), the CMake build runs into problems on OS X because of the non-ansi version of tcpd.h.

The reason the earlier snapshot (ab844899) worked is that WITH_TCPWRAPPER was only defined in the configure script -- it wasn't dealt with at all in the CMake build files.

Currently there is an addition of a FindWrap.cmake that is used to find tcpd.h and libwrap, but it doesn't try to compile a program including tcpd.h to determine if it has C++-compatible headers.

So the compilation fails in dcmnet/libsrc/dul.cc

The following code fixes FindWrap.cmake.

Code: Select all

diff --git a/CMake/FindWrap.cmake b/CMake/FindWrap.cmake
index 5737e41..1eac629 100644
--- a/CMake/FindWrap.cmake
+++ b/CMake/FindWrap.cmake
@@ -19,6 +19,23 @@ MARK_AS_ADVANCED(WRAP_LIBRARY)
 
 FIND_PACKAGE_HANDLE_STANDARD_ARGS(WRAP REQUIRED_VARS WRAP_LIBRARY WRAP_INCLUDE_DIR)
 
+#
+# ftpd.h doesn't by default include ansi prototypes for the wrap library
+DCMTK_TRY_COMPILE(_WRAP_FOUND "Can include tcpd.h in a C++ source file"
+"// minimal test for ftpd.h
+#include <tcpd.h>
+#include <syslog.h>
+int main(int,char *[])
+{
+  struct request_info request;
+  (void)hosts_access(&request);
+  return 0;
+}
+")
+if(NOT _WRAP_FOUND)
+set(WRAP_FOUND 0)
+endif()
+
 # Copy the result to output variables
 IF(WRAP_FOUND)
   SET(WRAP_LIBRARIES ${WRAP_LIBRARY})

Uli Schlachter
DCMTK Developer
Posts: 120
Joined: Thu, 2009-11-26, 08:15

Re: CMake + OS X + current head == tcpd.h problems

#2 Post by Uli Schlachter »

Thanks for the bug report. The problem should be fixed now:

http://git.dcmtk.org/web?p=dcmtk.git;a= ... f76e775a8b

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest