From 67f533465451e150a68b987e63af3923c678ba57 Mon Sep 17 00:00:00 2001 From: Sebastien GODARD Date: Sat, 23 Feb 2019 10:15:55 +0100 Subject: [PATCH] PCP: Add option --disable-pcp to configuration scripts PCP (Performance CoPilot) will be suported by default by sysstat if PCP development libraries are available. Add a new option (--disable-pcp) to 'configure' script to allow user to disable PCP support even if PCP libraries are installed. Signed-off-by: Sebastien GODARD --- configure | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++++ configure.in | 30 ++++++++++++++++ iconfig | 13 +++++-- 3 files changed, 140 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 74a0635..85de021 100755 --- a/configure +++ b/configure @@ -661,6 +661,9 @@ INITD_DIR INIT_DIR RC_DIR rcdir +DFPCP +LFPCP +HAVE_PCP DFSENSORS LFSENSORS HAVE_SENSORS @@ -735,6 +738,7 @@ ac_user_opts=' enable_option_checking with_systemdsystemunitdir enable_sensors +enable_pcp enable_largefile enable_nls enable_file_attr @@ -1376,6 +1380,7 @@ Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-sensors disable sensors support + --disable-pcp disable PCP support --disable-largefile omit support for large files --disable-nls disable National Language Support --disable-file-attr do not set attributes on files being installed @@ -4725,6 +4730,99 @@ fi +# Should we check for PCP support? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PCP support" >&5 +$as_echo_n "checking for PCP support... " >&6; } +# Check whether --enable-pcp was given. +if test "${enable_pcp+set}" = set; then : + enableval=$enable_pcp; PCP=$enableval +else + PCP=yes +fi + +if test $PCP != "yes"; then + HAVE_PCP="n" +else + HAVE_PCP="y" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PCP" >&5 +$as_echo "$PCP" >&6; } + +# Check for PCP libraries +LFPCP="" +DFPCP="" +if test $HAVE_PCP = "y"; then + PCP=no + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pmGetVersion in -lpcp" >&5 +$as_echo_n "checking for pmGetVersion in -lpcp... " >&6; } +if ${ac_cv_lib_pcp_pmGetVersion+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpcp $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pmGetVersion (); +int +main () +{ +return pmGetVersion (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_pcp_pmGetVersion=yes +else + ac_cv_lib_pcp_pmGetVersion=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pcp_pmGetVersion" >&5 +$as_echo "$ac_cv_lib_pcp_pmGetVersion" >&6; } +if test "x$ac_cv_lib_pcp_pmGetVersion" = xyes; then : + LFPCP="-lpcp -lpcp_import" +else + HAVE_PCP="n" +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PCP libraries" >&5 +$as_echo_n "checking for PCP libraries... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + +int +main () +{ +pmiEnd(); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + PCP=yes; DFPCP="-DHAVE_PCP" +else + HAVE_PCP="n"; PCP=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PCP" >&5 +$as_echo "$PCP" >&6; } +fi + + + + echo . echo Check system services: echo . @@ -4947,6 +5045,7 @@ echo . # --enable-debuginfo enable debug output (--debuginfo option) # --disable-documentation do not install documentation (man pages...) # --disable-sensors do not link against libsensors even if available +# --disable-pcp do not link against PCP libraries even if available # --disable-stripping do not strip object files # --enable-copy-only only copy files when installing sysstat # diff --git a/configure.in b/configure.in index dafd057..c53abba 100644 --- a/configure.in +++ b/configure.in @@ -124,6 +124,35 @@ AC_SUBST(HAVE_SENSORS) AC_SUBST(LFSENSORS) AC_SUBST(DFSENSORS) +# Should we check for PCP support? +AC_MSG_CHECKING(for PCP support) +AC_ARG_ENABLE(pcp, + AC_HELP_STRING([--disable-pcp], + [disable PCP support]), + PCP=$enableval,PCP=yes) +if test $PCP != "yes"; then + HAVE_PCP="n" +else + HAVE_PCP="y" +fi +AC_MSG_RESULT($PCP) + +# Check for PCP libraries +LFPCP="" +DFPCP="" +if test $HAVE_PCP = "y"; then + PCP=no + AC_CHECK_LIB(pcp, pmGetVersion, LFPCP="-lpcp -lpcp_import", HAVE_PCP="n") + AC_MSG_CHECKING(for PCP libraries) + AC_TRY_COMPILE(#include + #include + , pmiEnd();,PCP=yes; DFPCP="-DHAVE_PCP", HAVE_PCP="n"; PCP=no) + AC_MSG_RESULT($PCP) +fi +AC_SUBST(HAVE_PCP) +AC_SUBST(LFPCP) +AC_SUBST(DFPCP) + echo . echo Check system services: echo . @@ -147,6 +176,7 @@ echo . # --enable-debuginfo enable debug output (--debuginfo option) # --disable-documentation do not install documentation (man pages...) # --disable-sensors do not link against libsensors even if available +# --disable-pcp do not link against PCP libraries even if available # --disable-stripping do not strip object files # --enable-copy-only only copy files when installing sysstat # diff --git a/iconfig b/iconfig index 137b219..0e7d402 100755 --- a/iconfig +++ b/iconfig @@ -67,6 +67,15 @@ else echo "Parameter --disable-sensors is NOT set" fi +# PCP support +PCP=`${ASK} 'Disable PCP support? (y/n)' "--disable-pcp" "pcp"` +if [ "${PCP}" = "y" ]; then + PCP="--disable-pcp " +else + PCP="" + echo "Parameter --disable-pcp is NOT set" +fi + # Data history to keep by sa2 HISTORY=`${ASK} 'Number of daily data files to keep:' "history" "history"` if [ "${HISTORY}" != "" ]; then @@ -201,11 +210,11 @@ if [ "${SADC_OPT}" != "" ]; then echo -n "sadc_options=\"${SADC_OPT}\"" fi -echo "${COMPRESSMANPG}${INSTALL_DOC}${DEBUGINFO}${SENSORS}${STRIP}${COPY_ONLY}" +echo "${COMPRESSMANPG}${INSTALL_DOC}${DEBUGINFO}${SENSORS}${PCP}${STRIP}${COPY_ONLY}" echo ./configure ${PREFIX}${SA_LIB_DIR}${SA_DIR}${SYSCONFIG_DIR}${CLEAN_SA_DIR}${NLS} \ ${HISTORY}${COMPRESSAFTER}${MAN}${IGNORE_FILE_ATTR}${CRON}${RCDIR} \ sadc_options="${SADC_OPT}" ${COMPRESSMANPG}${INSTALL_DOC}${DEBUGINFO}${SENSORS} \ -${STRIP}${COPY_ONLY} +${PCP}${STRIP}${COPY_ONLY} -- 2.40.0