Fix openpty detection with util.h and libutil.h

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit 4e9aeea224)
pull/182/head
Slávek Banko 10 years ago
parent f3f4cad271
commit 3977c5503e

@ -40,6 +40,6 @@ set( target tdeio_fish )
tde_add_kpart( ${target} AUTOMOC
SOURCES fish.cpp
LINK tdeio-shared util
LINK tdeio-shared ${LIB_UTIL}
DESTINATION ${PLUGIN_INSTALL_DIR}
)

@ -18,15 +18,27 @@ check_include_file( pty.h HAVE_PTY_H )
tde_save( CMAKE_REQUIRED_LIBRARIES )
set( CMAKE_REQUIRED_LIBRARIES util )
check_c_source_runs("
#include <pty.h>
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
)
if( HAVE_PTY_H )
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 <${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);
return 0;
}"
HAVE_OPENPTY
)
endif( )
if( HAVE_OPENPTY )
set( LIB_UTIL util )
endif( )
tde_restore( CMAKE_REQUIRED_LIBRARIES )

Loading…
Cancel
Save