]> granicus.if.org Git - sysstat/blobdiff - configure.in
Merge branch 'scop-grep-E'
[sysstat] / configure.in
index 35afb5ad62d76ed210f9f546fcc7d62da8ef57d4..7a42cf9d8950c8592b32a865d999764efe66a605 100644 (file)
@@ -4,7 +4,7 @@
 # Modified by Sebastien Godard (sysstat <at> orange.fr)
 
 # Initialization of $PACKAGE_VERSION and $PACKAGE_NAME variables
-AC_INIT(sysstat, 12.3.1)
+AC_INIT(sysstat, 12.5.5)
 
 # Ensure that a recent enough version of Autoconf is being used
 AC_PREREQ(2.53)
@@ -53,6 +53,12 @@ AC_ARG_WITH([systemdsystemunitdir],
 if test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ; then
     AC_SUBST([SYSTEMD_UNIT_DIR], [$with_systemdsystemunitdir])
 fi
+AC_ARG_WITH([systemdsleepdir],
+    AS_HELP_STRING([--with-systemdsleepdir=DIR],[Directory for systemd suspend/resume scripts]),
+    [], [with_systemdsleepdir=$($PKG_CONFIG --variable=systemdsleepdir systemd)])
+if test -n "$with_systemdsleepdir" -a "x$with_systemdsleepdir" != xno ; then
+    AC_SUBST([SYSTEMD_SLEEP_DIR], [$with_systemdsleepdir])
+fi
 
 # Check libraries
 
@@ -64,8 +70,6 @@ HAVE_LIBINTL_H=
 HAVE_LOCALE_H=
 HAVE_SYS_SYSMACROS_H=
 HAVE_SYS_PARAM_H=
-AC_HEADER_STDC
-AC_HEADER_DIRENT
 AC_CHECK_HEADERS(ctype.h)
 AC_CHECK_HEADERS(errno.h)
 AC_CHECK_HEADERS(libintl.h, HAVE_LIBINTL_H=1)
@@ -109,35 +113,6 @@ AC_CHECK_FUNCS(strcspn)
 AC_CHECK_FUNCS(strspn)
 AC_CHECK_FUNCS(strstr)
 
-# Should we check for lm_sensors?
-AC_MSG_CHECKING(for sensors support)
-AC_ARG_ENABLE(sensors,
-             AC_HELP_STRING([--disable-sensors],
-                            [disable sensors support]),
-                            SENSORS=$enableval,SENSORS=yes)
-if test $SENSORS != "yes"; then
-       HAVE_SENSORS="n"
-else
-       HAVE_SENSORS="y"
-fi
-AC_MSG_RESULT($SENSORS)
-
-# Check for lm_sensors
-LFSENSORS=""
-DFSENSORS=""
-if test $HAVE_SENSORS = "y"; then
-       SENSORS=no
-       AC_CHECK_LIB(sensors, sensors_get_detected_chips, LFSENSORS="-lsensors", HAVE_SENSORS="n")
-       AC_MSG_CHECKING(for sensors lib)
-       AC_TRY_COMPILE(#include <sensors/sensors.h>
-                      #include <sensors/error.h>
-                      , sensors_cleanup();,SENSORS=yes; DFSENSORS="-DHAVE_SENSORS", HAVE_SENSORS="n"; SENSORS=no)
-       AC_MSG_RESULT($SENSORS)
-fi
-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,
@@ -149,11 +124,12 @@ if test $PCP != "yes"; then
 else
        HAVE_PCP="y"
 fi
-AC_MSG_RESULT($PCP)
 
 if test ! $HAVE_PCP_PMAPI_H; then
        HAVE_PCP="n"
+       PCP=no
 fi
+AC_MSG_RESULT($PCP)
 
 # Check for PCP libraries
 LFPCP=""
@@ -162,9 +138,9 @@ 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 <pcp/pmapi.h>
-                      #include <pcp/import.h>
-                      , pmiEnd();,PCP=yes; DFPCP="-DHAVE_PCP", HAVE_PCP="n"; PCP=no)
+       AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <pcp/pmapi.h>
+                                            #include <pcp/import.h>]],
+                                          [[pmiEnd();]])],PCP=yes; DFPCP="-DHAVE_PCP", HAVE_PCP="n"; PCP=no)
        AC_MSG_RESULT($PCP)
 fi
 AC_SUBST(HAVE_PCP)
@@ -178,6 +154,69 @@ else
 fi
 AC_SUBST(PCP_IMPL)
 
+# Should we check for lm_sensors?
+AC_MSG_CHECKING(for sensors support)
+AC_ARG_ENABLE(sensors,
+             AC_HELP_STRING([--disable-sensors],
+                            [disable sensors support]),
+                            SENSORS=$enableval,SENSORS=yes)
+if test $SENSORS != "yes"; then
+       SENSORS_SUPPORT="n"
+else
+       SENSORS_SUPPORT="y"
+fi
+AC_MSG_RESULT($SENSORS)
+
+# Check for lm_sensors library
+LFSENSORS=""
+DFSENSORS=""
+HAVE_SENSORS="n"
+if test $SENSORS_SUPPORT = "y"; then
+       SENSORS=no
+       AC_CHECK_LIB(sensors, sensors_get_detected_chips, LFSENSORS="-lsensors", HAVE_SENSORS="n")
+       AC_MSG_CHECKING(for sensors library)
+       AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sensors/sensors.h>
+                                            #include <sensors/error.h>]],
+                                          [[sensors_cleanup();]])], SENSORS=yes; HAVE_SENSORS="y"; DFSENSORS="-DHAVE_SENSORS", HAVE_SENSORS="n"; SENSORS=no)
+       AC_MSG_RESULT($SENSORS)
+fi
+AC_SUBST(HAVE_SENSORS)
+AC_SUBST(LFSENSORS)
+AC_SUBST(DFSENSORS)
+
+# Check for 32-bit version of lm_sensors library
+LFSENSORS32=""
+DFSENSORS32=""
+HAVE_SENSORS32="n"
+if test $SENSORS_SUPPORT = "y"; then
+       CFLAGS_SAVE=$CFLAGS
+       CFLAGS+=" -m32"
+       LDFLAGS=" -lsensors"
+       SENSORS=no
+#      Check for another function to avoid using cached result
+       AC_CHECK_LIB(sensors, sensors_cleanup, LFSENSORS32="-lsensors", HAVE_SENSORS32="n")
+       AC_MSG_CHECKING(for sensors 32-bit library)
+       AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sensors/sensors.h>
+                                         #include <sensors/error.h>]],
+                                       [[sensors_cleanup();]])], SENSORS=yes; HAVE_SENSORS32="y"; DFSENSORS32="-DHAVE_SENSORS32", HAVE_SENSORS32="n"; SENSORS=no)
+       AC_MSG_RESULT($SENSORS)
+       CFLAGS=$CFLAGS_SAVE
+fi
+AC_SUBST(HAVE_SENSORS32)
+AC_SUBST(LFSENSORS32)
+AC_SUBST(DFSENSORS32)
+
+# Check for 32-bit system libraries
+TGLIB32=no
+CFLAGS_SAVE=$CFLAGS
+CFLAGS+=" -m32"
+AC_MSG_CHECKING(for 32-bit system libraries)
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]],
+                                  [[printf("%d\n", sizeof(long));]])],TGLIB32=yes, TGLIB32=no)
+AC_MSG_RESULT($TGLIB32)
+CFLAGS=$CFLAGS_SAVE
+AC_SUBST(TGLIB32)
+
 echo .
 echo Check system services:
 echo .
@@ -189,21 +228,23 @@ echo .
 # Check arguments used
 #
 # Optional Features:
-#  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
-#  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
-#  --disable-largefile     omit support for large files
-#  --disable-nls           disable National Language Support
-#  --disable-file-attr     don't set attributes on files being installed
-#  --enable-install-cron   tell sysstat to install cron scripts
-#  --collect-all           tell sadc to collect all possible data    
-#  --enable-clean-sa-dir   clean system activity directory
-#  --enable-compress-manpg compress manual pages
-#  --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
+#  --disable-FEATURE        do not include FEATURE (same as --enable-FEATURE=no)
+#  --enable-FEATURE[=ARG]   include FEATURE [ARG=yes]
+#  --disable-largefile      omit support for large files
+#  --disable-nls            disable National Language Support
+#  --disable-file-attr      don't set attributes on files being installed
+#  --enable-install-cron    tell sysstat to install cron scripts
+#  --collect-all            tell sadc to collect all possible data
+#  --enable-clean-sa-dir    clean system activity directory
+#  --disable-compress-manpg do not compress manual pages when installed
+#  --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
+#  --enable-use-crond       use standard cron daemon
+#  --enable-lto                    compile with Link Time Optimizations
 #
 # Some influential environment variables:
 #  rcdir         directory where startup scripts are installed
@@ -213,6 +254,7 @@ echo .
 #  conf_dir      sysstat configuration directory (default is /etc/sysconfig)
 #  conf_file     sysstat configuration file (default is sysstat)
 #  history       number of daily datafiles to keep (default value is 7)
+#  delay_range   maximum delay (in seconds) to wait before sa2 script generates its reports
 #  compressafter number of days after which datafiles are compressed
 #  man_group     group for man pages
 #  cron_owner    crontab owner
@@ -389,6 +431,8 @@ else
    NLS="n"
 fi
 AC_MSG_RESULT($AUX_NLS)
+AC_CHECK_LIB(intl, gettext, LFINTL="-lintl")
+AC_SUBST(LFINTL)
 LACKING_GETTEXT="n"
 if test $AUX_NLS = "yes" &&  test x$MSGFMT != x"msgfmt"; then 
    echo "WARNING: msgfmt command not found!"
@@ -408,6 +452,25 @@ if test $NLS = "y" && test $LACKING_GETTEXT = "y"; then
 fi
 AC_SUBST(NLS)
 
+# Link Time Optimization
+AC_MSG_CHECKING(Link Time Optimization support)
+AC_ARG_ENABLE(lto,
+             AC_HELP_STRING([--enable-lto],
+                            [enable Link Time Optimization]),
+                            AUX_LTO=$enableval,AUX_LTO=no)
+AC_MSG_RESULT($AUX_LTO)
+LTO="n"
+if test $AUX_LTO = "yes"; then
+       AC_CHECK_PROG(GCC_AR, gcc-ar, gcc-ar)
+       if test x$GCC_AR != x"gcc-ar"; then
+               echo "WARNING: gcc-ar command not found! Disabling LTO support"
+               AUX_LTO="no"
+       else
+               LTO="y"
+       fi
+fi
+AC_SUBST(LTO)
+
 # Data history to keep by sa2
 AC_MSG_CHECKING(number of daily data files to keep)
 AC_ARG_VAR([history],[number of daily data files to keep (default value is 7)]) 
@@ -430,6 +493,17 @@ fi
 AC_MSG_RESULT($COMPRESSAFTER)
 AC_SUBST(COMPRESSAFTER)
 
+# Random delay to wait before sa2 script runs
+AC_MSG_CHECKING(random delay to wait before sa2 script runs)
+AC_ARG_VAR([delay_range],[maximum delay (in seconds) to wait before sa2 script generates its reports])
+if test x$delay_range = x""; then
+   DELAY_RANGE=0
+else
+   DELAY_RANGE=$delay_range
+fi
+AC_MSG_RESULT($DELAY_RANGE)
+AC_SUBST(DELAY_RANGE)
+
 # Manual page group
 grep ^man: /etc/group >/dev/null 2>&1
 if test $? = 0; then
@@ -475,12 +549,11 @@ AC_SUBST(IGNORE_FILE_ATTRIBUTES)
 # Compress manual pages?
 AC_MSG_CHECKING(whether manual pages should be compressed)
 AC_ARG_ENABLE(compress-manpg,
-             AC_HELP_STRING([--enable-compress-manpg],
-                            [compress sysstat manual pages]),
-                            AUX_MPG=$enableval,AUX_MPG=no)
+             AC_HELP_STRING([--disable-compress-manpg],
+                            [do not compress sysstat manual pages]),
+                            AUX_MPG=$enableval,AUX_MPG=yes)
 if test $AUX_MPG != "yes"; then
    COMPRESS_MANPG=n
-   AUX_MPG=no
 else
    COMPRESS_MANPG=y
 fi
@@ -549,6 +622,21 @@ if test $INSTALL_CRON = "y"; then
       REM_CHOWN=$CHOWN
    fi
 
+#  Check whether we should use the standard cron daemon
+   AC_MSG_CHECKING(whether we should use the standard cron daemon)
+   AC_ARG_ENABLE(use-crond,
+                AC_HELP_STRING([--enable-use-crond],
+                               [use standard cron daemon]),
+                               UCROND=$enableval,UCROND=no)
+   if test $UCROND != "yes"; then
+      USE_CROND=n
+      UCROND=no
+   else
+      USE_CROND=y
+   fi
+   AC_MSG_RESULT($UCROND)
+   AC_SUBST(USE_CROND)
+
 #  Crontab interval
    AC_MSG_CHECKING(crontab interval)
    AC_ARG_VAR([cron_interval],[crontab interval])
@@ -626,7 +714,7 @@ AC_ARG_ENABLE(documentation,
              AC_HELP_STRING([--disable-documentation],
                             [do not install documentation]),
                             AUX_DOC=$enableval,AUX_DOC=yes)
-if  test  $AUX_DOC !=  "no"; then
+if test $AUX_DOC != "no"; then
    AUX_DOC="yes"
    INSTALL_DOC="y"
 else
@@ -639,13 +727,15 @@ AC_SUBST(INSTALL_DOC)
 # Set directory for installing manual pages (see comment in Makefile)
 AC_SUBST(mandir)
 
-# Check whether --debuginfo options should be allowed
+# Check whether debug mode should be activated
+AC_MSG_CHECKING(whether debug mode should be activated)
 AC_ARG_ENABLE(debuginfo, 
              AC_HELP_STRING([--enable-debuginfo],
                             [enable debug output (--debuginfo option)]),
                             WITH_DEBUG=yes ; DFLAGS="$DFLAGS -DDEBUG" , WITH_DEBUG=no)
-AC_SUBST(WITH_DEBUG)
+AC_MSG_RESULT($WITH_DEBUG)
 AC_SUBST(DFLAGS)
+AC_SUBST(WITH_DEBUG)
 
 # Check whether object files should be stripped
 AC_MSG_CHECKING(whether object files should be stripped)
@@ -683,6 +773,7 @@ AC_CONFIG_FILES([cron/sysstat-collect.service])
 AC_CONFIG_FILES([cron/sysstat-collect.timer])
 AC_CONFIG_FILES([cron/sysstat-summary.service])
 AC_CONFIG_FILES([cron/sysstat-summary.timer])
+AC_CONFIG_FILES([cron/sysstat.sleep], [chmod +x cron/sysstat.sleep])   # Permissions must be changed
 AC_CONFIG_FILES([man/sa1.8:man/sa1.in])                # File must be renamed
 AC_CONFIG_FILES([man/sa2.8:man/sa2.in])                # File must be renamed
 AC_CONFIG_FILES([man/sadc.8:man/sadc.in])      # File must be renamed
@@ -699,11 +790,15 @@ echo "
    Sysstat version:            $PACKAGE_VERSION
    Installation prefix:                $prefix
    rc directory:               ${RC_DIR}
-   Init directory:             ${INIT_DIR}
-   Systemd unit dir:           ${with_systemdsystemunitdir}
-   Configuration file:         ${SYSCONFIG_DIR}/${SYSCONFIG_FILE}
+   Init directory:             ${INIT_DIR}"
+if test "$UCROND" != "yes"; then
+   echo "   Systemd unit dir:          ${with_systemdsystemunitdir}"
+   echo "   Systemd sleep dir:         ${with_systemdsleepdir}"
+else
+   echo "   Use standard cron daemon"
+fi
+echo "   Configuration file:           ${SYSCONFIG_DIR}/${SYSCONFIG_FILE}
    Man pages directory:                $mandir
    Compiler:                   $CC
    Compiler flags:             $CFLAGS
 "
-