From b71166c66ac55345899a6998d57cc13ab3d93720 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Sun, 14 Jun 2015 20:27:02 +0200 Subject: [PATCH] Fix openpty detection with libutil.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko (cherry picked from commit e75569be1b7bf138685d0e4941daf111e6f51ba3) --- CMakeLists.txt | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ca577fe63..55f61c87f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -472,20 +472,16 @@ endif( HAVE_RES_INIT) set( CMAKE_REQUIRED_LIBRARIES util ) if( HAVE_PTY_H ) - check_c_source_runs(" - #include - int main(int argc, char* argv) { - int master_fd, slave_fd; - int result; - result = openpty(&master_fd, &slave_fd, 0, 0, 0); - return 0; - }" - HAVE_OPENPTY - ) + set( USE_OPENPTY_H pty.h ) elseif( HAVE_UTIL_H ) + set( USE_OPENPTY_H util.h ) +elseif( HAVE_LIBUTIL_H ) + set( USE_OPENPTY_H libutil.h ) +endif( ) +if( USE_OPENPTY_H ) check_c_source_runs(" - #include - int main(int argc, char* argv) { + #include <${USE_OPENPTY_H}> + int main(int argc, char* argv[]) { int master_fd, slave_fd; int result; result = openpty(&master_fd, &slave_fd, 0, 0, 0);