summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2018-02-13 14:04:22 (GMT)
committer Slávek Banko <slavek.banko@axis.cz>2018-02-13 14:04:22 (GMT)
commita14adb9ab9c50cbcd95a2d2e3f42c41fecf73fb0 (patch)
tree74fe96eab9e0a3bcefff551f24d5e7f46acff618
parent4d31e7d405ea7bf530b3d3dd136abff3da52b7ed (diff)
downloadtdelibs-a14adb9a.zip
tdelibs-a14adb9a.tar.gz
Add search for utempter helper
This resolves Bug 2841 Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
-rw-r--r--CMakeLists.txt21
-rw-r--r--config.h.cmake1
-rw-r--r--tdecore/kpty.cpp4
3 files changed, 23 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 80d66bc..c8047f8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -599,7 +599,26 @@ endif( HAVE_LIBMAGIC )
if( WITH_UTEMPTER )
check_include_file( utempter.h HAVE_UTEMPTER_H )
check_library_exists( utempter addToUtmp "" HAVE_ADDTOUTEMP )
- if( HAVE_UTEMPTER_H AND HAVE_ADDTOUTEMP )
+ if( NOT DEFINED UTEMPTER_HELPER )
+ message( STATUS "Looking for utempter helper" )
+ find_program( UTEMPTER_HELPER utempter
+ PATHS
+ /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/utempter
+ /usr/lib/utempter
+ /usr/libexec/utempter
+ /usr/libexec
+ /usr/local/lib/${CMAKE_LIBRARY_ARCHITECTURE}/utempter
+ /usr/local/lib/utempter
+ /usr/local/libexec/utempter
+ /usr/local/libexec
+ )
+ if( UTEMPTER_HELPER )
+ message( STATUS "Looking for utempter helper - found" )
+ else( )
+ message( STATUS "Looking for utempter helper - not found" )
+ endif( )
+ endif( )
+ if( HAVE_UTEMPTER_H AND HAVE_ADDTOUTEMP AND UTEMPTER_HELPER )
set( HAVE_UTEMPTER 1 )
set( UTEMPTER_LIBRARY utempter )
else( )
diff --git a/config.h.cmake b/config.h.cmake
index 7fb9bfc..b65b125 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -717,6 +717,7 @@
/* Define if you have the utempter helper for utmp managment */
#cmakedefine HAVE_UTEMPTER 1
+#cmakedefine UTEMPTER_HELPER "@UTEMPTER_HELPER@"
/* Define to 1 if you have the <util.h> header file. */
#cmakedefine HAVE_UTIL_H 1
diff --git a/tdecore/kpty.cpp b/tdecore/kpty.cpp
index 42abd1a..1e58061 100644
--- a/tdecore/kpty.cpp
+++ b/tdecore/kpty.cpp
@@ -453,7 +453,7 @@ void KPty::login(const char *user, const char *remotehost)
#ifdef HAVE_UTEMPTER
TDEProcess_Utmp utmp;
utmp.cmdFd = d->masterFd;
- utmp << "/usr/lib/utempter/utempter" << "add";
+ utmp << UTEMPTER_HELPER << "add";
if (remotehost)
utmp << remotehost;
utmp.start(TDEProcess::Block);
@@ -498,7 +498,7 @@ void KPty::logout()
#ifdef HAVE_UTEMPTER
TDEProcess_Utmp utmp;
utmp.cmdFd = d->masterFd;
- utmp << "/usr/lib/utempter/utempter" << "del";
+ utmp << UTEMPTER_HELPER << "del";
utmp.start(TDEProcess::Block);
#elif defined(USE_LOGIN)
const char *str_ptr = d->ttyName.data();