diff options
author | Thomas White <taw@physics.org> | 2018-06-14 15:23:13 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2018-06-14 17:15:01 +0200 |
commit | 746cc0c5ff9c60a14933bb62eb761bea4d223343 (patch) | |
tree | 61ba1a40362c4d8132e5f19803fbcdbd48a8812a | |
parent | ed31303341ad073c4ed3468fb97f236d8b0d01ab (diff) |
Add CMake check to find forkpty()
-rw-r--r-- | libcrystfel/CMakeLists.txt | 9 | ||||
-rw-r--r-- | libcrystfel/config.h.cmake.in | 3 | ||||
-rw-r--r-- | libcrystfel/src/dirax.c | 8 | ||||
-rw-r--r-- | libcrystfel/src/felix.c | 7 | ||||
-rw-r--r-- | libcrystfel/src/mosflm.c | 8 | ||||
-rw-r--r-- | libcrystfel/src/xds.c | 8 |
6 files changed, 39 insertions, 4 deletions
diff --git a/libcrystfel/CMakeLists.txt b/libcrystfel/CMakeLists.txt index 311cb790..82c29446 100644 --- a/libcrystfel/CMakeLists.txt +++ b/libcrystfel/CMakeLists.txt @@ -22,6 +22,15 @@ unset(CMAKE_REQUIRED_DEFINITIONS) # Check for nice clock function check_symbol_exists(clock_gettime "time.h" HAVE_CLOCK_GETTIME) +# Find out where forkpty() is declared +set(CMAKE_REQUIRED_LIBRARIES "-lutil") +check_symbol_exists(forkpty "pty.h" HAVE_FORKPTY_PTY_H) +check_symbol_exists(forkpty "util.h" HAVE_FORKPTY_UTIL_H) +unset(CMAKE_REQUIRED_LIBRARIES) +if ( NOT(HAVE_FORKPTY_PTY_H OR HAVE_FORKPTY_UTIL_H) ) + message(FATAL_ERROR "Couldn't find forkpty()") +endif() + configure_file(config.h.cmake.in config.h) set(LIBCRYSTFEL_SOURCES diff --git a/libcrystfel/config.h.cmake.in b/libcrystfel/config.h.cmake.in index ba332bec..d1e27a9a 100644 --- a/libcrystfel/config.h.cmake.in +++ b/libcrystfel/config.h.cmake.in @@ -16,4 +16,7 @@ #cmakedefine HAVE_CBF_CBF_H #cmakedefine HAVE_CBFLIB_CBF_H +#cmakedefine HAVE_FORKPTY_PTY_H +#cmakedefine HAVE_FORKPTY_UTIL_H + #define CRYSTFEL_VERSIONSTRING "${CRYSTFEL_VERSION}" diff --git a/libcrystfel/src/dirax.c b/libcrystfel/src/dirax.c index 885afb97..0f5b5741 100644 --- a/libcrystfel/src/dirax.c +++ b/libcrystfel/src/dirax.c @@ -34,7 +34,6 @@ #include <stdlib.h> #include <stdio.h> #include <math.h> -#include <pty.h> #include <string.h> #include <unistd.h> #include <sys/wait.h> @@ -43,6 +42,13 @@ #include <sys/ioctl.h> #include <errno.h> +#ifdef HAVE_FORKPTY_PTY_H +#include <pty.h> +#endif +#ifdef HAVE_FORKPTY_UTIL_H +#include <util.h> +#endif + #include "image.h" #include "dirax.h" #include "utils.h" diff --git a/libcrystfel/src/felix.c b/libcrystfel/src/felix.c index db473d73..c7ff2d01 100644 --- a/libcrystfel/src/felix.c +++ b/libcrystfel/src/felix.c @@ -35,7 +35,6 @@ #include <stdlib.h> #include <stdio.h> #include <math.h> -#include <pty.h> #include <string.h> #include <sys/types.h> #include <sys/wait.h> @@ -50,6 +49,12 @@ #include <sys/time.h> #endif +#ifdef HAVE_FORKPTY_PTY_H +#include <pty.h> +#endif +#ifdef HAVE_FORKPTY_UTIL_H +#include <util.h> +#endif #include "image.h" #include "utils.h" diff --git a/libcrystfel/src/mosflm.c b/libcrystfel/src/mosflm.c index d1b7ffed..7b0159ab 100644 --- a/libcrystfel/src/mosflm.c +++ b/libcrystfel/src/mosflm.c @@ -62,7 +62,6 @@ #include <stdlib.h> #include <stdio.h> #include <math.h> -#include <pty.h> #include <string.h> #include <sys/types.h> #include <sys/wait.h> @@ -71,6 +70,13 @@ #include <fcntl.h> #include <errno.h> +#ifdef HAVE_FORKPTY_PTY_H +#include <pty.h> +#endif +#ifdef HAVE_FORKPTY_UTIL_H +#include <util.h> +#endif + #ifdef HAVE_CLOCK_GETTIME #include <time.h> #else diff --git a/libcrystfel/src/xds.c b/libcrystfel/src/xds.c index b28dc93a..01c12dca 100644 --- a/libcrystfel/src/xds.c +++ b/libcrystfel/src/xds.c @@ -36,7 +36,6 @@ #include <stdlib.h> #include <stdio.h> #include <math.h> -#include <pty.h> #include <string.h> #include <unistd.h> #include <sys/wait.h> @@ -45,6 +44,13 @@ #include <sys/ioctl.h> #include <errno.h> +#ifdef HAVE_FORKPTY_PTY_H +#include <pty.h> +#endif +#ifdef HAVE_FORKPTY_UTIL_H +#include <util.h> +#endif + #include "xds.h" #include "cell.h" #include "image.h" |