3 # (C) 2007 - Ivana Varekova <varekova@redhat.com>
4 # Modified by Sebastien Godard (sysstat <at> orange.fr)
6 # Initialization of $PACKAGE_VERSION and $PACKAGE_NAME variables
7 AC_INIT(sysstat, 11.5.6)
9 # Ensure that a recent enough version of Autoconf is being used
12 # Check whether the configure script is in the right dir
13 AC_CONFIG_SRCDIR(ioconf.h)
26 AC_CHECK_PROG(CHMOD, chmod, chmod)
27 AC_CHECK_PROG(CHOWN, chown, chown)
28 AC_CHECK_PROG(AR, ar, ar)
29 AC_CHECK_PROG(INSTALL, install, install)
30 AC_CHECK_PROG(MSGFMT, msgfmt, msgfmt)
31 AC_CHECK_PROG(XGETTEXT, xgettext, xgettext)
32 AC_CHECK_PROG(MSGMERGE, msgmerge, msgmerge)
33 AC_CHECK_PROGS(ZIP, xz bzip2 gzip, gzip)
34 INSTALL_DATA="\${INSTALL} -m 644"
35 AC_SUBST(INSTALL_DATA)
36 INSTALL_BIN="\${INSTALL} -m 755"
39 AC_PATH_PROG(PATH_CP, cp)
40 AC_PATH_PROG(PATH_CHKCONFIG, chkconfig)
43 AC_CHECK_PROG(PKG_CONFIG, pkg-config, pkg-config)
44 AC_PATH_PROG(SYSTEMCTL, systemctl)
45 AC_ARG_WITH([systemdsystemunitdir],
46 AS_HELP_STRING([--with-systemdsystemunitdir=DIR],[Directory for systemd service files]),
47 [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
48 if test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ; then
49 AC_SUBST([SYSTEMD_UNIT_DIR], [$with_systemdsystemunitdir])
56 echo Check header files:
64 AC_CHECK_HEADERS(ctype.h)
65 AC_CHECK_HEADERS(errno.h)
66 AC_CHECK_HEADERS(libintl.h, HAVE_LIBINTL_H=1)
67 AC_CHECK_HEADERS(locale.h, HAVE_LOCALE_H=1)
68 AC_CHECK_HEADERS(net/if.h)
69 AC_CHECK_HEADERS(regex.h)
70 AC_CHECK_HEADERS(signal.h)
71 AC_CHECK_HEADERS(stdio.h)
72 AC_CHECK_HEADERS(sys/file.h)
73 AC_CHECK_HEADERS(sys/ioctl.h)
74 AC_CHECK_HEADERS(sys/param.h, HAVE_SYS_PARAM_H=1)
75 AC_CHECK_HEADERS(sys/stat.h)
76 AC_CHECK_HEADERS(sys/sysmacros.h, HAVE_SYS_SYSMACROS_H=1)
79 echo Check typedefs, structures and compiler characteristics:
86 echo Check library functions:
88 AC_CHECK_FUNCS(strchr)
89 AC_CHECK_FUNCS(strcspn)
90 AC_CHECK_FUNCS(strspn)
91 AC_CHECK_FUNCS(strstr)
93 # Should we check for lm_sensors?
94 AC_MSG_CHECKING(for sensors support)
95 AC_ARG_ENABLE(sensors,
96 AC_HELP_STRING([--disable-sensors],
97 [disable sensors support]),
98 SENSORS=$enableval,SENSORS=yes)
99 if test $SENSORS != "yes"; then
104 AC_MSG_RESULT($SENSORS)
106 # Check for lm_sensors
110 AC_CHECK_LIB(sensors, sensors_get_detected_chips, LFSENSORS="-lsensors", HAVE_SENSORS="n")
111 AC_MSG_CHECKING(for sensors lib)
112 AC_TRY_COMPILE(#include <sensors/sensors.h>
113 #include <sensors/error.h>
114 , sensors_cleanup();,SENSORS=yes; DFSENSORS="-DHAVE_SENSORS", HAVE_SENSORS="n"; SENSORS=no)
115 AC_MSG_RESULT($SENSORS)
116 AC_SUBST(HAVE_SENSORS)
121 echo Check system services:
126 echo Check configuration:
128 # Check arguments used
131 # --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
132 # --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
133 # --disable-largefile omit support for large files
134 # --disable-nls disable National Language Support
135 # --disable-file-attr don't set attributes on files being installed
136 # --enable-install-cron tell sysstat to install cron scripts
137 # --collect-all tell sadc to collect all possible data
138 # --enable-clean-sa-dir clean system activity directory
139 # --enable-compress-manpg compress manual pages
140 # --enable-debuginfo enable debug output (--debuginfo option)
141 # --disable-documentation do not install documentation (man pages...)
142 # --disable-sensors do not link against libsensors even if available
143 # --disable-stripping do not strip object files
144 # --enablle-copy-only only copy files when installing sysstat
146 # Some influential environment variables:
147 # rcdir directory where startup scripts are installed
148 # sa_lib_dir sadc, sa1 and sa2 directory
149 # sa_dir system activity daily datafiles directory
150 # conf_dir sysstat configuration directory (default is /etc/sysconfig)
151 # history number of daily datafiles to keep (default value is 7)
152 # compressafter number of days after which datafiles are compressed
153 # man_group group for man pages
154 # cron_owner crontab owner
155 # cron_interval crontab sampling interval
156 # sadc_options options to be passed to sadc
158 # Fine tuning the installation directories:
159 # --mandir=DIR man documentation directory [PREFIX/man]
160 # --docdir=DIR other documentation directory [PREFIX/share/doc]
162 # Installation directories:
163 # --prefix=PREFIX install architecture-independent files in PREFIX
165 # --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
169 if test -d /etc/init.d && test ! -L /etc/init.d; then
170 if test -d /etc/init.d/rc2.d; then
178 elif test -d /sbin/init.d; then
180 INIT_DIR=/sbin/init.d
184 INIT_DIR=/etc/rc.d/init.d
188 AC_MSG_CHECKING(run-commands directory)
189 AC_ARG_VAR([rcdir],[run-commands directory])
190 if test x$rcdir != x""; then
191 # Override previous rc directories values
193 INIT_DIR=$rcdir/init.d
196 AC_MSG_RESULT($RC_DIR)
197 if test ! -d $RC_DIR; then
198 echo "INFO: Directory ${RC_DIR} doesn't exist."
199 echo "INFO: Startup scripts won't be installed."
206 if test $HAVE_SYS_SYSMACROS_H; then
213 if test $HAVE_SYS_PARAM_H; then
221 if test $prefix != "NONE"; then
227 SADC_DIR=$AuxPrefix/lib
228 if test -d $AuxPrefix/lib64; then
229 # Verify that this OS is really 64 bit
230 BITS=$(getconf LONG_BIT 2>/dev/null)
232 if test $BITS = 64; then
233 SADC_DIR=$AuxPrefix/lib64
236 # Fallback: look for lm (long mode) flag to know if CPU is 64 bit
237 grep " lm " /proc/cpuinfo >/dev/null 2>&1
239 SADC_DIR=$AuxPrefix/lib64
244 AC_MSG_CHECKING(sadc directory)
245 AC_ARG_VAR([sa_lib_dir],[sadc directory])
246 if test x$sa_lib_dir != x""; then
247 SA_LIB_DIR=$sa_lib_dir
249 SA_LIB_DIR=$SADC_DIR/sa
251 AC_MSG_RESULT($SA_LIB_DIR)
252 if test ! -d $SA_LIB_DIR; then
253 echo "INFO: Directory ${SA_LIB_DIR} will be created during installation stage."
257 # Set system activity directory
258 AC_MSG_CHECKING(system activity directory)
259 AC_ARG_VAR([sa_dir],[system activity directory])
260 if test x$sa_dir != x""; then
265 AC_MSG_RESULT($SA_DIR)
266 if test ! -d $SA_DIR; then
267 echo "INFO: Directory ${SA_DIR} will be created during installation stage."
271 # Set configuration directory
272 AC_MSG_CHECKING(sysstat configuration directory)
273 AC_ARG_VAR([conf_dir],[sysstat configuration directory])
274 if test x$conf_dir != x""; then
275 SYSCONFIG_DIR=$conf_dir
277 SYSCONFIG_DIR=/etc/sysconfig
279 AC_MSG_RESULT($SYSCONFIG_DIR)
280 if test ! -d $SYSCONFIG_DIR; then
281 echo "INFO: Directory ${SYSCONFIG_DIR} will be created during installation stage."
283 AC_SUBST(SYSCONFIG_DIR)
285 # National Language Support
286 AC_MSG_CHECKING(National Language Support)
288 AC_HELP_STRING([--disable-nls],
289 [disable National Language Support]),
290 AUX_NLS=$enableval,AUX_NLS=yes)
291 if test $AUX_NLS != "no" && test $HAVE_LIBINTL_H && test $HAVE_LOCALE_H; then
298 AC_MSG_RESULT($AUX_NLS)
300 if test $AUX_NLS = "yes" && test x$MSGFMT != x"msgfmt"; then
301 echo "WARNING: msgfmt command not found!"
304 if test $AUX_NLS = "yes" && test x$XGETTEXT != x"xgettext"; then
305 echo "WARNING: xgettext command not found!"
308 if test $AUX_NLS = "yes" && test x$MSGMERGE != x"msgmerge"; then
309 echo "WARNING: msgmerge command not found!"
312 if test $NLS = "y" && test $LACKING_GETTEXT = "y"; then
313 echo "WARNING: Disabling NLS"
318 # Data history to keep by sa2
319 AC_MSG_CHECKING(number of daily data files to keep)
320 AC_ARG_VAR([history],[number of daily data files to keep (default value is 7)])
321 if test x$history = x""; then
326 AC_MSG_RESULT($HISTORY)
329 # Number of days after which datafiles are compressed
330 AC_MSG_CHECKING(number of days after which data files are compressed)
331 AC_ARG_VAR([compressafter],[number of days after which data files are compressed (default value is 10)])
332 if test x$compressafter = x""; then
335 COMPRESSAFTER=$compressafter
337 AC_MSG_RESULT($COMPRESSAFTER)
338 AC_SUBST(COMPRESSAFTER)
340 # Preallocation factor
341 AC_MSG_CHECKING(preallocation factor value)
342 AC_ARG_VAR([prealloc],[preallocation factor that will determine data files size (default value is 1)])
343 if test x$prealloc = x""; then
346 PREALLOC_FACTOR=$prealloc
348 AC_MSG_RESULT($PREALLOC_FACTOR)
349 AC_SUBST(PREALLOC_FACTOR)
352 grep ^man: /etc/group >/dev/null 2>&1
359 AC_MSG_CHECKING(group for manual pages)
360 AC_ARG_VAR([man_group],[group for manual pages])
361 if test x$man_group = x""; then
363 AC_MSG_RESULT($MAN_GROUP)
365 grep ^$man_group: /etc/group >/dev/null 2>&1
368 AC_MSG_RESULT($MAN_GROUP)
369 echo "WARNING: Group ${man_group} not found: Using ${GRP} instead"
372 AC_MSG_RESULT($MAN_GROUP)
377 # Don't set attributes on files being installed?
378 AC_MSG_CHECKING(whether attributes should not be set on files being installed)
379 AC_ARG_ENABLE(file-attr,
380 AC_HELP_STRING([--disable-file-attr],
381 [do not set attributes on files being installed]),
382 AUX_IMG=$enableval,AUX_IMG=yes)
383 if test $AUX_IMG != "no"; then
384 IGNORE_FILE_ATTRIBUTES=n
387 IGNORE_FILE_ATTRIBUTES=y
390 AC_MSG_RESULT($AUX_IMG)
391 AC_SUBST(IGNORE_FILE_ATTRIBUTES)
393 # Compress manual pages?
394 AC_MSG_CHECKING(whether manual pages should be compressed)
395 AC_ARG_ENABLE(compress-manpg,
396 AC_HELP_STRING([--enable-compress-manpg],
397 [compress sysstat manual pages]),
398 AUX_MPG=$enableval,AUX_MPG=no)
399 if test $AUX_MPG != "yes"; then
405 AC_MSG_RESULT($AUX_MPG)
406 AC_SUBST(COMPRESS_MANPG)
408 # Check whether sa directory should be cleaned
409 AC_MSG_CHECKING(whether system activity directory should be cleaned)
410 AC_ARG_ENABLE(clean-sa-dir,
411 AC_HELP_STRING([--enable-clean-sa-dir],
412 [clean system activity directory]),
413 AUX_CSD=$enableval,AUX_CSD=no)
414 if test $AUX_CSD != "yes"; then
420 AC_MSG_RESULT($AUX_CSD)
421 AC_SUBST(CLEAN_SA_DIR)
424 AC_MSG_CHECKING(whether cron should start sar automatically)
425 AC_ARG_ENABLE(install-cron,
426 AC_HELP_STRING([--enable-install-cron],
427 [install a crontab to start sar]),
428 INSTALL_CRON=$enableval,INSTALL_CRON=n)
429 if test $INSTALL_CRON != "yes"; then
436 AC_MSG_RESULT($AUX_CRON)
437 AC_SUBST(INSTALL_CRON)
441 if test $INSTALL_CRON = "y"; then
442 AC_MSG_CHECKING(crontab owner)
443 AC_ARG_VAR([cron_owner],[crontab owner])
444 if test x$cron_owner = x""; then
446 AC_MSG_RESULT($CRON_OWNER)
448 grep ^$cron_owner: /etc/passwd >/dev/null 2>&1
451 AC_MSG_RESULT($CRON_OWNER)
452 echo "WARNING: User ${cron_owner} not found: Using ${CUSR} instead."
454 CRON_OWNER=$cron_owner
455 AC_MSG_RESULT($CRON_OWNER)
458 echo "INFO: Crontab for ${CRON_OWNER} will be saved in current directory if necessary"
459 if test $CRON_OWNER = "root"; then
462 REM_CHOWN="# REM_CHOWN"
464 SU_C_OWNER="su $CRON_OWNER -c "
466 # " (ignore this line)
471 AC_MSG_CHECKING(crontab interval)
472 AC_ARG_VAR([cron_interval],[crontab interval])
473 if test x$cron_interval = x""; then
476 CRON_INTERVAL=$cron_interval
478 AC_MSG_RESULT($CRON_INTERVAL)
479 CRON_INTERVAL_SEC=`expr ${CRON_INTERVAL} \* 60`
480 CRON_COUNT=`expr 60 / ${CRON_INTERVAL}`
482 # Check whether sadc should collect all possible activities
483 AC_MSG_CHECKING(whether sadc should collect all possible activities)
484 AC_ARG_ENABLE(collect-all,
485 AC_HELP_STRING([--enable-collect-all],
486 [collect all possible activities]),
487 COLLECT_ALL=$enableval,COLLECT_ALL=n)
488 if test $COLLECT_ALL != "yes"; then
492 COLLECT_ALL="-S XALL"
495 AC_MSG_RESULT($AUX_COLL)
497 AC_MSG_CHECKING(options to be passed to sadc)
498 AC_ARG_VAR([sadc_options],[options to be passed to sadc])
499 if test x"$sadc_options" != x""; then
500 SADC_OPT="$sadc_options"
504 AC_MSG_RESULT($SADC_OPT)
507 # Check whether files should only be copied
508 AC_MSG_CHECKING(whether files should only be copied)
509 AC_ARG_ENABLE(copy-only,
510 AC_HELP_STRING([--enable-copy-only],
511 [only copy files when installing]),
512 OCOPY=$enableval,OCOPY=no)
513 if test $OCOPY != "yes"; then
519 AC_MSG_RESULT($OCOPY)
526 REM_CHOWN="# REM_CHOWN"
528 CRON_INTERVAL_SEC=600
534 AC_SUBST(CRON_INTERVAL)
535 AC_SUBST(CRON_INTERVAL_SEC)
539 AC_SUBST(COLLECT_ALL)
541 # Check whether documentation should be installed
542 AC_MSG_CHECKING(whether documentation should be installed)
543 AC_ARG_ENABLE(documentation,
544 AC_HELP_STRING([--disable-documentation],
545 [do not install documentation]),
546 AUX_DOC=$enableval,AUX_DOC=yes)
547 if test $AUX_DOC != "no"; then
554 AC_MSG_RESULT($AUX_DOC)
555 AC_SUBST(INSTALL_DOC)
557 # Set directory for installing manual pages (see comment in Makefile)
560 # Check whether --debuginfo options should be allowed
561 AC_ARG_ENABLE(debuginfo,
562 AC_HELP_STRING([--enable-debuginfo],
563 [enable debug output (--debuginfo option)]),
564 WITH_DEBUG=yes ; DFLAGS="$DFLAGS -DDEBUG" , WITH_DEBUG=no)
568 # Check whether object files should be stripped
569 AC_MSG_CHECKING(whether object files should be stripped)
570 AC_ARG_ENABLE(stripping,
571 AC_HELP_STRING([--disable-stripping],
572 [do not strip object files]),
573 AUX_STRIP=$enableval,AUX_STRIP=yes)
574 if test $AUX_STRIP != "no"; then
581 AC_MSG_RESULT($AUX_STRIP)
586 echo Now create files:
588 AC_CONFIG_FILES([sa1], [chmod +x sa1]) # Permissions must be changed
589 AC_CONFIG_FILES([sa2], [chmod +x sa2]) # Permissions must be changed
590 AC_CONFIG_FILES([cron/crontab:cron/crontab.sample]) # File must be renamed
591 AC_CONFIG_FILES([sysstat.sysconfig])
592 AC_CONFIG_FILES([version.h:version.in]) # File must be renamed
593 AC_CONFIG_FILES([sysconfig.h:sysconfig.in]) # File must be renamed
594 AC_CONFIG_FILES([prealloc.h:prealloc.in]) # File must be renamed
595 AC_CONFIG_FILES([cron/sysstat.cron.daily])
596 AC_CONFIG_FILES([cron/sysstat.cron.hourly])
597 AC_CONFIG_FILES([cron/sysstat.crond])
598 AC_CONFIG_FILES([cron/sysstat.crond.sample.in:cron/sysstat.crond.in], [sed s/^/#/ cron/sysstat.crond.sample.in > cron/sysstat.crond.sample])
599 AC_CONFIG_FILES([sysstat], [chmod +x sysstat]) # Permissions must be changed
600 AC_CONFIG_FILES([sysstat.service])
601 AC_CONFIG_FILES([cron/sysstat-collect.service])
602 AC_CONFIG_FILES([cron/sysstat-collect.timer])
603 AC_CONFIG_FILES([cron/sysstat-summary.service])
604 AC_CONFIG_FILES([cron/sysstat-summary.timer])
605 AC_CONFIG_FILES([man/sa1.8:man/sa1.in]) # File must be renamed
606 AC_CONFIG_FILES([man/sa2.8:man/sa2.in]) # File must be renamed
607 AC_CONFIG_FILES([man/sadc.8:man/sadc.in]) # File must be renamed
608 AC_CONFIG_FILES([man/sadf.1:man/sadf.in]) # File must be renamed
609 AC_CONFIG_FILES([man/sar.1:man/sar.in]) # File must be renamed
610 AC_CONFIG_FILES([man/sysstat.5:man/sysstat.in]) # File must be renamed
611 AC_CONFIG_FILES([man/iostat.1:man/iostat.in]) # File must be renamed
612 AC_CONFIG_FILES([man/cifsiostat.1:man/cifsiostat.in]) # File must be renamed
617 Sysstat version: $PACKAGE_VERSION
618 Installation prefix: $prefix
619 rc directory: ${RC_DIR}
620 Init directory: ${INIT_DIR}
621 Systemd unit dir: ${with_systemdsystemunitdir}
622 Configuration directory: ${SYSCONFIG_DIR}
623 Man pages directory: $mandir
625 Compiler flags: $CFLAGS