ps: making the libselinux support configurable

Previously the libselinux support was present
in the sources, but disabled with a preprocessor
condition (#if 0).
From now the libselinux support can be enabled with
the --enable-libselinux switch available
in the configuration script. That way is more
flexible than local patches modifying the condition
value from 0 to 1.
This commit is contained in:
Jaromir Capik 2013-08-07 17:52:38 +02:00
parent 26ae657950
commit 5f663aee47
2 changed files with 13 additions and 1 deletions

View File

@ -111,6 +111,14 @@ if test "$enable_watch8bit" = "yes"; then
AC_DEFINE([WITH_WATCH8BIT], [1], [Enable 8 bit clean watch]) AC_DEFINE([WITH_WATCH8BIT], [1], [Enable 8 bit clean watch])
fi fi
AC_ARG_ENABLE([libselinux],
AS_HELP_STRING([--enable-libselinux], [enable libselinux]),
[enable_libselinux=$enableval],
[enable_libselinux="no"])
if test "$enable_libselinux" = "yes"; then
AC_DEFINE([ENABLE_LIBSELINUX], [1], [Enable libselinux])
fi
# Optional packages - AC_ARG_WITH # Optional packages - AC_ARG_WITH
AC_ARG_WITH([ncurses], AC_ARG_WITH([ncurses],
AS_HELP_STRING([--without-ncurses], [build only applications not needing ncurses]), AS_HELP_STRING([--without-ncurses], [build only applications not needing ncurses]),

View File

@ -1282,6 +1282,8 @@ fail:
/****************** FLASK & seLinux security stuff **********************/ /****************** FLASK & seLinux security stuff **********************/
// move the bulk of this to libproc sometime // move the bulk of this to libproc sometime
#if !ENABLE_LIBSELINUX
static int pr_context(char *restrict const outbuf, const proc_t *restrict const pp){ static int pr_context(char *restrict const outbuf, const proc_t *restrict const pp){
char filename[48]; char filename[48];
size_t len; size_t len;
@ -1310,7 +1312,8 @@ fail:
return 1; return 1;
} }
#if 0 #else
// This needs more study, considering: // This needs more study, considering:
// 1. the static linking option (maybe disable this in that case) // 1. the static linking option (maybe disable this in that case)
// 2. the -z and -Z option issue // 2. the -z and -Z option issue
@ -1345,6 +1348,7 @@ static int pr_context(char *restrict const outbuf, const proc_t *restrict const
} }
return len; return len;
} }
#endif #endif