From edd0a5a30ebd724b660718895fd6e857b805764d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Sun, 26 Aug 2018 03:10:29 +0200 Subject: cmake: Cleanup unused definitions from config.h Cleanup unnecessary tests from ConfigureChecks Add missing tests to ConfigureChecks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko --- CMakeLists.txt | 12 ++ ConfigureChecks.cmake | 79 +++++---- config.h.cmake | 449 +++----------------------------------------------- kuser/CMakeLists.txt | 3 +- 4 files changed, 85 insertions(+), 458 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 425070e..d9467cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,7 @@ set( VERSION R14.0.4 ) #### include essential cmake modules include( FindPkgConfig ) +include( CheckFunctionExists ) include( CheckIncludeFile ) include( CheckLibraryExists ) include( CheckCSourceCompiles ) @@ -57,6 +58,17 @@ option( BUILD_SECPOLICY "Build secpolicy" ${BUILD_ALL} ) option( BUILD_TDEFILE_PLUGINS "Build tdefile-plugins" ${BUILD_ALL} ) +##### user defined options ####### + +set( KU_FIRSTUID 500 CACHE STRING "KUser - first user ID" ) +set( KU_FIRSTGID 500 CACHE STRING "KUser - first group ID" ) +set( KU_USERPRIVATEGROUP false CACHE STRING "KUser - use private groups" ) +set( KU_HOMEDIR_PERM 0700 CACHE STRING "KUser - home directory permissions" ) +set( KU_HOMETEMPLATE "/home/%U" CACHE STRING "KUser - default template for homedir" ) +set( KU_MAILBOX_GID 0 CACHE STRING "KUser - mailbox gid" ) +set( KU_MAILBOX_PERM 0660 CACHE STRING "KUser - mailbox permissions" ) + + ##### configure checks include( ConfigureChecks.cmake ) diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index c6fcfb3..ca45811 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -29,39 +29,56 @@ endif( WITH_GCC_VISIBILITY ) #### check for headers + check_include_file( "unistd.h" HAVE_UNISTD_H ) check_include_file( "sys/stat.h" HAVE_SYS_STAT_H ) -check_include_file( "Carbon/Carbon.h" HAVE_CARBON_CARBON_H ) -check_include_file( "crt_externs.h" HAVE_CRT_EXTERNS_H ) check_include_file( "crypt.h" HAVE_CRYPT_H ) -check_include_file( "dirent.h" HAVE_DIRENT_H ) -check_include_file( "dlfcn.h" HAVE_DLFCN_H ) -check_include_file( "fcntl.h" HAVE_FCNTL_H ) -check_include_file( "inttypes.h" HAVE_INTTYPES_H ) -check_include_file( "linux/quota.h" HAVE_LINUX_QUOTA_H ) -check_include_file( "linux/unistd.h" HAVE_LINUX_UNISTD_H ) -check_include_file( "memory.h" HAVE_MEMORY_H ) -check_include_file( "mntent.h" HAVE_MNTENT_H ) -check_include_file( "ndir.h" HAVE_NDIR_H ) check_include_file( "paths.h" HAVE_PATHS_H ) -check_include_file( "signal.h" HAVE_SIGNAL_H ) -check_include_file( "stdint.h" HAVE_STDINT_H ) -check_include_file( "stdlib.h" HAVE_STDLIB_H ) -check_include_file( "strings.h" HAVE_STRINGS_H ) -check_include_file( "string.h" HAVE_STRING_H ) -check_include_file( "stropts.h" HAVE_STROPTS_H ) -check_include_file( "sys/bitypes.h" HAVE_SYS_BITYPES_H ) -check_include_file( "sys/dir.h" HAVE_SYS_DIR_H ) -check_include_file( "sys/fcntl.h" HAVE_SYS_FCNTL_H ) -check_include_file( "sys/fs/ufs_quota.h" HAVE_SYS_FS_UFS_QUOTA_H ) -check_include_file( "sys/mntent.h" HAVE_SYS_MNTENT_H ) -check_include_file( "sys/mnttab.h" HAVE_SYS_MNTTAB_H ) -check_include_file( "sys/mount.h" HAVE_SYS_MOUNT_H ) -check_include_file( "sys/ndir.h" HAVE_SYS_NDIR_H ) -check_include_file( "sys/params.h" HAVE_SYS_PARAMS_H ) -check_include_file( "sys/param.h" HAVE_SYS_PARAM_H ) -check_include_file( "sys/quota.h" HAVE_SYS_QUOTA_H ) -check_include_file( "sys/stropts.h" HAVE_SYS_STROPTS_H ) -check_include_file( "sys/time.h" HAVE_SYS_TIME_H ) -check_include_file( "sys/types.h" HAVE_SYS_TYPES_H ) + +#### check for functions + +check_function_exists( crypt HAVE_CRYPT ) +if( NOT HAVE_CRYPT ) + check_library_exists( crypt crypt "" HAVE_CRYPT_LIB ) + if( HAVE_CRYPT_LIB ) + set( HAVE_CRYPT 1 ) + set( CRYPT_LIBRARIES crypt ) + endif( HAVE_CRYPT_LIB ) +endif( NOT HAVE_CRYPT ) +if( NOT HAVE_CRYPT ) + check_library_exists( c crypt "" HAVE_CRYPT_LIBC ) + if( HAVE_CRYPT_LIBC ) + set( HAVE_CRYPT 1 ) + set( CRYPT_LIBRARIES c ) + endif( HAVE_CRYPT_LIBC ) +endif( NOT HAVE_CRYPT ) + +check_function_exists( getspent HAVE_GETSPENT ) +if( HAVE_GETSPENT ) + set( HAVE_SHADOW 1 ) +else( ) + check_library_exists( shadow getspent "" LIBSHADOW ) + if( LIBSHADOW ) + set( HAVE_SHADOW 1 ) + set( SHADOW_LIBRARIES shadow ) + else( ) + check_library_exists( gen getspent "" LIBGEN ) + if( LIBGEN ) + set( HAVE_SHADOW 1 ) + set( SHADOW_LIBRARIES gen ) + endif( ) + endif( ) +endif( ) + +tde_save_and_set( CMAKE_REQUIRED_INCLUDES "pwd.h" ) +check_function_exists( fgetpwent HAVE_FGETPWENT ) +tde_restore( CMAKE_REQUIRED_INCLUDES ) + +tde_save_and_set( CMAKE_REQUIRED_INCLUDES "grp.h" ) +check_function_exists( fgetgrent HAVE_FGETGRENT ) +tde_restore( CMAKE_REQUIRED_INCLUDES ) + +tde_save_and_set( CMAKE_REQUIRED_INCLUDES "shadow.h" ) +check_function_exists( fgetspent HAVE_FGETSPENT ) +tde_restore( CMAKE_REQUIRED_INCLUDES ) diff --git a/config.h.cmake b/config.h.cmake index a3a579f..879d3da 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -8,449 +8,46 @@ #cmakedefine WORDS_BIGENDIAN @WORDS_BIGENDIAN@ /* Define to 1 if you have the header file. */ -#cmakedefine HAVE_UNISTD_H @HAVE_UNISTD_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_LINUX_UNISTD_H @HAVE_LINUX_UNISTD_H@ +#cmakedefine HAVE_UNISTD_H 1 /* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_STAT_H @HAVE_SYS_STAT_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_CARBON_CARBON_H @HAVE_CARBON_CARBON_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_CRT_EXTERNS_H @HAVE_CRT_EXTERNS_H@ +#cmakedefine HAVE_SYS_STAT_H 1 /* Define to 1 if you have the header file. */ -#cmakedefine HAVE_CRYPT_H @HAVE_CRYPT_H@ - -/* Define to 1 if you have the header file, and it defines `DIR'. - */ -#cmakedefine HAVE_DIRENT_H @HAVE_DIRENT_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_DLFCN_H @HAVE_DLFCN_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_FCNTL_H @HAVE_FCNTL_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_INTTYPES_H @HAVE_INTTYPES_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_LINUX_QUOTA_H @HAVE_LINUX_QUOTA_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_MEMORY_H @HAVE_MEMORY_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_MNTENT_H @HAVE_MNTENT_H@ - -/* Define to 1 if you have the header file, and it defines `DIR'. */ -#cmakedefine HAVE_NDIR_H @HAVE_NDIR_H@ +#cmakedefine HAVE_CRYPT_H 1 /* Define to 1 if you have the header file. */ -#cmakedefine HAVE_PATHS_H @HAVE_PATHS_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SIGNAL_H @HAVE_SIGNAL_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SSTREAM @HAVE_SSTREAM@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_STDINT_H @HAVE_STDINT_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_STDLIB_H @HAVE_STDLIB_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_STRINGS_H @HAVE_STRINGS_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_STRING_H @HAVE_STRING_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_STROPTS_H @HAVE_STROPTS_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_BITYPES_H @HAVE_SYS_BITYPES_H@ - -/* Define to 1 if you have the header file, and it defines `DIR'. - */ -#cmakedefine HAVE_SYS_DIR_H @HAVE_SYS_DIR_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_FCNTL_H @HAVE_SYS_FCNTL_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_FS_UFS_QUOTA_H @HAVE_SYS_FS_UFS_QUOTA_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_MNTENT_H @HAVE_SYS_MNTENT_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_MNTTAB_H @HAVE_SYS_MNTTAB_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_MOUNT_H @HAVE_SYS_MOUNT_H@ - -/* Define to 1 if you have the header file, and it defines `DIR'. - */ -#cmakedefine HAVE_SYS_NDIR_H @HAVE_SYS_NDIR_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_PARAMS_H @HAVE_SYS_PARAMS_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_PARAM_H @HAVE_SYS_PARAM_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_QUOTA_H @HAVE_SYS_QUOTA_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_STROPTS_H @HAVE_SYS_STROPTS_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_TIME_H @HAVE_SYS_TIME_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_TYPES_H @HAVE_SYS_TYPES_H@ - - - - -/* config.h. Generated from config.h.in by configure. */ -/* config.h.in. Generated from configure.in by autoheader. */ - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "@VERSION@" - -/* Define if building universal (internal helper macro) */ -/* #undef AC_APPLE_UNIVERSAL_BUILD */ - -/* Define if you have the CoreAudio API */ -/* #undef HAVE_COREAUDIO */ - -/* Defines if your system has the crypt function */ -#define HAVE_CRYPT 1 - -/* Define if you have fgetgrent */ -#define HAVE_FGETGRENT 1 - -/* Define if you have the fgetgrent prototype */ -#define HAVE_FGETGRENT_PROTO 1 +#cmakedefine HAVE_PATHS_H 1 /* Define if you have fgetpwent */ -#define HAVE_FGETPWENT 1 +#cmakedefine HAVE_FGETPWENT 1 -/* Define if you have the fgetpwent prototype */ -#define HAVE_FGETPWENT_PROTO 1 +/* Define if you have fgetgrent */ +#cmakedefine HAVE_FGETGRENT 1 /* Define if you have fgetspent */ -#define HAVE_FGETSPENT 1 - -/* Define if you have the fgetspent prototype */ -#define HAVE_FGETSPENT_PROTO 1 - -/* Irix */ -/* #undef HAVE_IRIX */ - -/* Define if you have libjpeg */ -#define HAVE_LIBJPEG 1 - -/* Define if you have libpng */ -#define HAVE_LIBPNG 1 - -/* Define if you have a working libpthread (will enable threaded code) */ -#define HAVE_LIBPTHREAD 1 - -/* Define if you have libz */ -#define HAVE_LIBZ 1 - -/* Linux */ -#define HAVE_LINUX 1 - -/* Define if your system needs _NSGetEnviron to set up the environment */ -/* #undef HAVE_NSGETENVIRON */ - -/* Defines if you have PAM (Pluggable Authentication Modules) */ -/* #undef HAVE_PAM */ - -/* Define if your PAM headers are in pam/ instead of security/ */ -/* #undef HAVE_PAM_PAM_APPL_H */ - -/* Define if you have res_init */ -#define HAVE_RES_INIT 1 - -/* Define if you have the res_init prototype */ -#define HAVE_RES_INIT_PROTO 1 - -/* Define if you have setenv */ -#define HAVE_SETENV 1 - -/* Define if you have the setenv prototype */ -#define HAVE_SETENV_PROTO 1 - -/* Define if you have a STL implementation by SGI */ -#define HAVE_SGI_STL 1 +#cmakedefine HAVE_FGETSPENT 1 /* Define if you use shadow passwords */ -#define HAVE_SHADOW 1 - -/* Define to 1 if you have the `snprintf' function. */ -#define HAVE_SNPRINTF 1 - -/* Define if you have strlcat */ -/* #undef HAVE_STRLCAT */ - -/* Define if you have the strlcat prototype */ -/* #undef HAVE_STRLCAT_PROTO */ - -/* Define if you have strlcpy */ -/* #undef HAVE_STRLCPY */ - -/* Define if you have the strlcpy prototype */ -/* #undef HAVE_STRLCPY_PROTO */ - -/* Define if you have unsetenv */ -#define HAVE_UNSETENV 1 - -/* Define if you have the unsetenv prototype */ -#define HAVE_UNSETENV_PROTO 1 - -/* Define to 1 if you have the `vsnprintf' function. */ -#define HAVE_VSNPRINTF 1 - -/* Suffix for lib directories */ -#define KDELIBSUFF "64" - -/* first group ID */ -#define KU_FIRSTGID 500 - -/* first user ID */ -#define KU_FIRSTUID 500 - -/* home directory permissions */ -#define KU_HOMEDIR_PERM 0700 - -/* default template for homedir */ -#define KU_HOMETEMPLATE "/home/%U" - -/* mailbox gid */ -#define KU_MAILBOX_GID 0 - -/* mailbox permissions */ -#define KU_MAILBOX_PERM 0660 - -/* private groups */ -#define KU_USERPRIVATEGROUP false - -/* Define to the sub-directory where libtool stores uninstalled libraries. */ -#define LT_OBJDIR ".libs/" - -/* Name of package */ -#define PACKAGE "tdeadmin" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "" - -/* Define to the home page for this package. */ -#define PACKAGE_URL "" - -/* Define if your PAM support takes non-const arguments (Solaris) */ -/* #undef PAM_MESSAGE_NONCONST */ - -/* The size of `char *', as computed by sizeof. */ -#define SIZEOF_CHAR_P 8 - -/* The size of `int', as computed by sizeof. */ -#define SIZEOF_INT 4 - -/* The size of `long', as computed by sizeof. */ -#define SIZEOF_LONG 8 - -/* The size of `short', as computed by sizeof. */ -#define SIZEOF_SHORT 2 - -/* The size of `size_t', as computed by sizeof. */ -#define SIZEOF_SIZE_T 8 - -/* The size of `unsigned long', as computed by sizeof. */ -#define SIZEOF_UNSIGNED_LONG 8 - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define to 1 if you can safely include both and . */ -#define TIME_WITH_SYS_TIME 1 - -/* Defined if compiling without arts */ -/* #undef WITHOUT_ARTS */ - -/* - * jpeg.h needs HAVE_BOOLEAN, when the system uses boolean in system - * headers and I'm too lazy to write a configure test as long as only - * unixware is related - */ -#ifdef _UNIXWARE -#define HAVE_BOOLEAN -#endif - - - -/* - * AIX defines FD_SET in terms of bzero, but fails to include - * that defines bzero. - */ - -#if defined(_AIX) -#include -#endif - - - -#if defined(HAVE_NSGETENVIRON) && defined(HAVE_CRT_EXTERNS_H) -# include -# include -# define environ (*_NSGetEnviron()) -#endif - - - -#if !defined(HAVE_FGETGRENT_PROTO) -#ifdef __cplusplus -extern "C" { -#endif -; -#ifdef __cplusplus -} -#endif -#endif - - - -#if !defined(HAVE_FGETPWENT_PROTO) -#ifdef __cplusplus -extern "C" { -#endif -; -#ifdef __cplusplus -} -#endif -#endif - - - -#if !defined(HAVE_FGETSPENT_PROTO) -#ifdef __cplusplus -extern "C" { -#endif -; -#ifdef __cplusplus -} -#endif -#endif - - - -#if !defined(HAVE_RES_INIT_PROTO) -#ifdef __cplusplus -extern "C" { -#endif -int res_init(void); -#ifdef __cplusplus -} -#endif -#endif - - - -#if !defined(HAVE_SETENV_PROTO) -#ifdef __cplusplus -extern "C" { -#endif -int setenv (const char *, const char *, int); -#ifdef __cplusplus -} -#endif -#endif - - - -#if !defined(HAVE_STRLCAT_PROTO) -#ifdef __cplusplus -extern "C" { -#endif -unsigned long strlcat(char*, const char*, unsigned long); -#ifdef __cplusplus -} -#endif -#endif - - - -#if !defined(HAVE_STRLCPY_PROTO) -#ifdef __cplusplus -extern "C" { -#endif -unsigned long strlcpy(char*, const char*, unsigned long); -#ifdef __cplusplus -} -#endif -#endif - - - -#if !defined(HAVE_UNSETENV_PROTO) -#ifdef __cplusplus -extern "C" { -#endif -void unsetenv (const char *); -#ifdef __cplusplus -} -#endif -#endif - - +#cmakedefine HAVE_SHADOW 1 -/* - * On HP-UX, the declaration of vsnprintf() is needed every time ! - */ +/* KUser - first user ID */ +#define KU_FIRSTUID @KU_FIRSTUID@ -#if !defined(HAVE_VSNPRINTF) || defined(hpux) -#if __STDC__ -#include -#include -#else -#include -#endif -#ifdef __cplusplus -extern "C" -#endif -int vsnprintf(char *str, size_t n, char const *fmt, va_list ap); -#ifdef __cplusplus -extern "C" -#endif -int snprintf(char *str, size_t n, char const *fmt, ...); -#endif +/* KUser - first group ID */ +#define KU_FIRSTGID @KU_FIRSTGID@ +/* KUser - private groups */ +#define KU_USERPRIVATEGROUP @KU_USERPRIVATEGROUP@ -#if defined(__SVR4) && !defined(__svr4__) -#define __svr4__ 1 -#endif +/* KUser - home directory permissions */ +#define KU_HOMEDIR_PERM @KU_HOMEDIR_PERM@ +/* KUser - default template for homedir */ +#define KU_HOMETEMPLATE "@KU_HOMETEMPLATE@" -/* type to use in place of socklen_t if not defined */ -#define kde_socklen_t socklen_t +/* KUser - mailbox gid */ +#define KU_MAILBOX_GID @KU_MAILBOX_GID@ -/* type to use in place of socklen_t if not defined (deprecated, use - kde_socklen_t) */ -#define ksize_t socklen_t +/* KUser - mailbox permissions */ +#define KU_MAILBOX_PERM @KU_MAILBOX_PERM@ diff --git a/kuser/CMakeLists.txt b/kuser/CMakeLists.txt index a5cf2a9..f71abca 100644 --- a/kuser/CMakeLists.txt +++ b/kuser/CMakeLists.txt @@ -29,7 +29,8 @@ tde_add_executable( kuser AUTOMOC kgroupsystem.cpp selectconn.cpp sha1.cpp kuserprefs.kcfgc filessettings.ui generalsettings.ui ldapsettings.ui ldapsamba.ui passwordpolicy.ui LINK tdecore-shared tdeui-shared tdeio-shared tdeui-shared DCOP-shared tdefx - tdetexteditor crypt tdeabc_ldaptdeio tdeabc tdentlm + tdetexteditor tdeabc_ldaptdeio tdeabc tdentlm + ${CRYPT_LIBRARIES} ${SHADOW_LIBRARIES} DESTINATION ${BIN_INSTALL_DIR} ) -- cgit v1.2.3