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.2.0)
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:
63 AC_CHECK_HEADERS(ctype.h)
64 AC_CHECK_HEADERS(errno.h)
65 AC_CHECK_HEADERS(libintl.h, HAVE_LIBINTL_H=1)
66 AC_CHECK_HEADERS(locale.h, HAVE_LOCALE_H=1)
67 AC_CHECK_HEADERS(net/if.h)
68 AC_CHECK_HEADERS(regex.h)
69 AC_CHECK_HEADERS(signal.h)
70 AC_CHECK_HEADERS(stdio.h)
71 AC_CHECK_HEADERS(sys/file.h)
72 AC_CHECK_HEADERS(sys/ioctl.h)
73 AC_CHECK_HEADERS(sys/stat.h)
74 AC_CHECK_HEADERS(sys/sysmacros.h, HAVE_SYS_SYSMACROS_H=1)
77 echo Check typedefs, structures and compiler characteristics:
84 echo Check library functions:
86 AC_CHECK_FUNCS(strchr)
87 AC_CHECK_FUNCS(strcspn)
88 AC_CHECK_FUNCS(strspn)
89 AC_CHECK_FUNCS(strstr)
91 # Should we check for lm_sensors?
92 AC_MSG_CHECKING(for sensors support)
93 AC_ARG_ENABLE(sensors,
94 AC_HELP_STRING([--disable-sensors],
95 [disable sensors support]),
96 SENSORS=$enableval,SENSORS=yes)
97 if test $SENSORS != "yes"; then
102 AC_MSG_RESULT($SENSORS)
104 # Check for lm_sensors
108 AC_CHECK_LIB(sensors, sensors_get_detected_chips, LFSENSORS="-lsensors", HAVE_SENSORS="n")
109 AC_MSG_CHECKING(for sensors lib)
110 AC_TRY_COMPILE(#include <sensors/sensors.h>
111 #include <sensors/error.h>
112 , sensors_cleanup();,SENSORS=yes; DFSENSORS="-DHAVE_SENSORS", HAVE_SENSORS="n"; SENSORS=no)
113 AC_MSG_RESULT($SENSORS)
114 AC_SUBST(HAVE_SENSORS)
119 echo Check system services:
124 echo Check configuration:
126 # Check arguments used
129 # --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
130 # --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
131 # --disable-largefile omit support for large files
132 # --disable-nls disable National Language Support
133 # --disable-file-attr don't set attributes on files being installed
134 # --enable-install-cron tell sysstat to install cron scripts
135 # --collect-all tell sadc to collect all possible data
136 # --enable-clean-sa-dir clean system activity directory
137 # --enable-compress-manpg compress manual pages
138 # --enable-install-isag install isag script
139 # --enable-debuginfo enable debug output (--debuginfo option)
140 # --disable-documentation do not install documentation (man pages...)
141 # --disable-sensors do not link against libsensors even if available
142 # --disable-stripping do not strip object files
143 # --enablle-copy-only only copy files when installing sysstat
145 # Some influential environment variables:
146 # rcdir directory where startup scripts are installed
147 # sa_lib_dir sadc, sa1 and sa2 directory
148 # sa_dir system activity daily datafiles directory
149 # conf_dir sysstat configuration directory (default is /etc/sysconfig)
150 # history number of daily datafiles to keep (default value is 7)
151 # compressafter number of days after which datafiles are compressed
152 # man_group group for man pages
153 # cron_owner crontab owner
154 # cron_interval crontab sampling interval
155 # sadc_options options to be passed to sadc
157 # Fine tuning the installation directories:
158 # --mandir=DIR man documentation directory [PREFIX/man]
159 # --docdir=DIR other documentation directory [PREFIX/share/doc]
161 # Installation directories:
162 # --prefix=PREFIX install architecture-independent files in PREFIX
164 # --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
168 if test -d /etc/init.d && test ! -L /etc/init.d; then
169 if test -d /etc/init.d/rc2.d; then
177 elif test -d /sbin/init.d; then
179 INIT_DIR=/sbin/init.d
183 INIT_DIR=/etc/rc.d/init.d
187 AC_MSG_CHECKING(run-commands directory)
188 AC_ARG_VAR([rcdir],[run-commands directory])
189 if test x$rcdir != x""; then
190 # Override previous rc directories values
192 INIT_DIR=$rcdir/init.d
195 AC_MSG_RESULT($RC_DIR)
196 if test ! -d $RC_DIR; then
197 echo "INFO: Directory ${RC_DIR} doesn't exist."
198 echo "INFO: Startup scripts won't be installed."
205 if test $HAVE_SYS_SYSMACROS_H; then
213 if test $prefix != "NONE"; then
219 SADC_DIR=$AuxPrefix/lib
220 if test -d $AuxPrefix/lib64; then
221 # Verify that this OS is really 64 bit
222 BITS=$(getconf LONG_BIT 2>/dev/null)
224 if test $BITS = 64; then
225 SADC_DIR=$AuxPrefix/lib64
228 # Fallback: look for lm (long mode) flag to know if CPU is 64 bit
229 grep " lm " /proc/cpuinfo >/dev/null 2>&1
231 SADC_DIR=$AuxPrefix/lib64
236 AC_MSG_CHECKING(sadc directory)
237 AC_ARG_VAR([sa_lib_dir],[sadc directory])
238 if test x$sa_lib_dir != x""; then
239 SA_LIB_DIR=$sa_lib_dir
241 SA_LIB_DIR=$SADC_DIR/sa
243 AC_MSG_RESULT($SA_LIB_DIR)
244 if test ! -d $SA_LIB_DIR; then
245 echo "INFO: Directory ${SA_LIB_DIR} will be created during installation stage."
249 # Set system activity directory
250 AC_MSG_CHECKING(system activity directory)
251 AC_ARG_VAR([sa_dir],[system activity directory])
252 if test x$sa_dir != x""; then
257 AC_MSG_RESULT($SA_DIR)
258 if test ! -d $SA_DIR; then
259 echo "INFO: Directory ${SA_DIR} will be created during installation stage."
263 # Set configuration directory
264 AC_MSG_CHECKING(sysstat configuration directory)
265 AC_ARG_VAR([conf_dir],[sysstat configuration directory])
266 if test x$conf_dir != x""; then
267 SYSCONFIG_DIR=$conf_dir
269 SYSCONFIG_DIR=/etc/sysconfig
271 AC_MSG_RESULT($SYSCONFIG_DIR)
272 if test ! -d $SYSCONFIG_DIR; then
273 echo "INFO: Directory ${SYSCONFIG_DIR} will be created during installation stage."
275 AC_SUBST(SYSCONFIG_DIR)
277 # National Language Support
278 AC_MSG_CHECKING(National Language Support)
280 AC_HELP_STRING([--disable-nls],
281 [disable National Language Support]),
282 AUX_NLS=$enableval,AUX_NLS=yes)
283 if test $AUX_NLS != "no" && test $HAVE_LIBINTL_H && test $HAVE_LOCALE_H; then
290 AC_MSG_RESULT($AUX_NLS)
292 if test $AUX_NLS = "yes" && test x$MSGFMT != x"msgfmt"; then
293 echo "WARNING: msgfmt command not found!"
295 if test $AUX_NLS = "yes" && test x$XGETTEXT != x"xgettext"; then
296 echo "WARNING: xgettext command not found!"
298 if test $AUX_NLS = "yes" && test x$MSGMERGE != x"msgmerge"; then
299 echo "WARNING: msgmerge command not found!"
302 # Data history to keep by sa2
303 AC_MSG_CHECKING(number of daily data files to keep)
304 AC_ARG_VAR([history],[number of daily data files to keep (default value is 7)])
305 if test x$history = x""; then
310 AC_MSG_RESULT($HISTORY)
313 # Number of days after which datafiles are compressed
314 AC_MSG_CHECKING(number of days after which data files are compressed)
315 AC_ARG_VAR([compressafter],[number of days after which data files are compressed (default value is 10)])
316 if test x$compressafter = x""; then
319 COMPRESSAFTER=$compressafter
321 AC_MSG_RESULT($COMPRESSAFTER)
322 AC_SUBST(COMPRESSAFTER)
324 # Preallocation factor
325 AC_MSG_CHECKING(preallocation factor value)
326 AC_ARG_VAR([prealloc],[preallocation factor that will determine data files size (default value is 1)])
327 if test x$prealloc = x""; then
330 PREALLOC_FACTOR=$prealloc
332 AC_MSG_RESULT($PREALLOC_FACTOR)
333 AC_SUBST(PREALLOC_FACTOR)
336 grep ^man: /etc/group >/dev/null 2>&1
343 AC_MSG_CHECKING(group for manual pages)
344 AC_ARG_VAR([man_group],[group for manual pages])
345 if test x$man_group = x""; then
347 AC_MSG_RESULT($MAN_GROUP)
349 grep ^$man_group: /etc/group >/dev/null 2>&1
352 AC_MSG_RESULT($MAN_GROUP)
353 echo "WARNING: Group ${man_group} not found: Using ${GRP} instead"
356 AC_MSG_RESULT($MAN_GROUP)
361 # Don't set attributes on files being installed?
362 AC_MSG_CHECKING(whether attributes should not be set on files being installed)
363 AC_ARG_ENABLE(file-attr,
364 AC_HELP_STRING([--disable-file-attr],
365 [do not set attributes on files being installed]),
366 AUX_IMG=$enableval,AUX_IMG=yes)
367 if test $AUX_IMG != "no"; then
368 IGNORE_FILE_ATTRIBUTES=n
371 IGNORE_FILE_ATTRIBUTES=y
374 AC_MSG_RESULT($AUX_IMG)
375 AC_SUBST(IGNORE_FILE_ATTRIBUTES)
377 # Compress manual pages?
378 AC_MSG_CHECKING(whether manual pages should be compressed)
379 AC_ARG_ENABLE(compress-manpg,
380 AC_HELP_STRING([--enable-compress-manpg],
381 [compress sysstat manual pages]),
382 AUX_MPG=$enableval,AUX_MPG=no)
383 if test $AUX_MPG != "yes"; then
389 AC_MSG_RESULT($AUX_MPG)
390 AC_SUBST(COMPRESS_MANPG)
392 # Check whether isag should be installed
393 AC_MSG_CHECKING(whether isag script should be installed)
394 AC_ARG_ENABLE(install-isag,
395 AC_HELP_STRING([--enable-install-isag],
396 [install isag script]),
397 AUX_IIS=$enableval,AUX_IIS=no)
398 if test $AUX_IIS != "yes"; then
404 AC_MSG_RESULT($AUX_IIS)
405 AC_SUBST(INSTALL_ISAG)
407 # Check whether sa directory should be cleaned
408 AC_MSG_CHECKING(whether system activity directory should be cleaned)
409 AC_ARG_ENABLE(clean-sa-dir,
410 AC_HELP_STRING([--enable-clean-sa-dir],
411 [clean system activity directory]),
412 AUX_CSD=$enableval,AUX_CSD=no)
413 if test $AUX_CSD != "yes"; then
419 AC_MSG_RESULT($AUX_CSD)
420 AC_SUBST(CLEAN_SA_DIR)
423 AC_MSG_CHECKING(whether cron should start sar automatically)
424 AC_ARG_ENABLE(install-cron,
425 AC_HELP_STRING([--enable-install-cron],
426 [install a crontab to start sar]),
427 INSTALL_CRON=$enableval,INSTALL_CRON=n)
428 if test $INSTALL_CRON != "yes"; then
435 AC_MSG_RESULT($AUX_CRON)
436 AC_SUBST(INSTALL_CRON)
440 if test $INSTALL_CRON = "y"; then
441 AC_MSG_CHECKING(crontab owner)
442 AC_ARG_VAR([cron_owner],[crontab owner])
443 if test x$cron_owner = x""; then
445 AC_MSG_RESULT($CRON_OWNER)
447 grep ^$cron_owner: /etc/passwd >/dev/null 2>&1
450 AC_MSG_RESULT($CRON_OWNER)
451 echo "WARNING: User ${cron_owner} not found: Using ${CUSR} instead."
453 CRON_OWNER=$cron_owner
454 AC_MSG_RESULT($CRON_OWNER)
457 echo "INFO: Crontab for ${CRON_OWNER} will be saved in current directory if necessary"
458 if test $CRON_OWNER = "root"; then
461 REM_CHOWN="# REM_CHOWN"
463 SU_C_OWNER="su $CRON_OWNER -c "
465 # " (ignore this line)
470 AC_MSG_CHECKING(crontab interval)
471 AC_ARG_VAR([cron_interval],[crontab interval])
472 if test x$cron_interval = x""; then
475 CRON_INTERVAL=$cron_interval
477 AC_MSG_RESULT($CRON_INTERVAL)
478 CRON_INTERVAL_SEC=`expr ${CRON_INTERVAL} \* 60`
479 CRON_COUNT=`expr 60 / ${CRON_INTERVAL}`
481 # Check whether sadc should collect all possible activities
482 AC_MSG_CHECKING(whether sadc should collect all possible activities)
483 AC_ARG_ENABLE(collect-all,
484 AC_HELP_STRING([--enable-collect-all],
485 [collect all possible activities]),
486 COLLECT_ALL=$enableval,COLLECT_ALL=n)
487 if test $COLLECT_ALL != "yes"; then
491 COLLECT_ALL="-S XALL"
494 AC_MSG_RESULT($AUX_COLL)
496 AC_MSG_CHECKING(options to be passed to sadc)
497 AC_ARG_VAR([sadc_options],[options to be passed to sadc])
498 if test x"$sadc_options" != x""; then
499 SADC_OPT="$sadc_options"
503 AC_MSG_RESULT($SADC_OPT)
506 # Check whether files should only be copied
507 AC_MSG_CHECKING(whether files should only be copied)
508 AC_ARG_ENABLE(copy-only,
509 AC_HELP_STRING([--enable-copy-only],
510 [only copy files when installing]),
511 OCOPY=$enableval,OCOPY=no)
512 if test $OCOPY != "yes"; then
518 AC_MSG_RESULT($OCOPY)
525 REM_CHOWN="# REM_CHOWN"
527 CRON_INTERVAL_SEC=600
533 AC_SUBST(CRON_INTERVAL)
534 AC_SUBST(CRON_INTERVAL_SEC)
538 AC_SUBST(COLLECT_ALL)
540 # Check whether documentation should be installed
541 AC_MSG_CHECKING(whether documentation should be installed)
542 AC_ARG_ENABLE(documentation,
543 AC_HELP_STRING([--disable-documentation],
544 [do not install documentation]),
545 AUX_DOC=$enableval,AUX_DOC=yes)
546 if test $AUX_DOC != "no"; then
553 AC_MSG_RESULT($AUX_DOC)
554 AC_SUBST(INSTALL_DOC)
556 # Set directory for installing manual pages (see comment in Makefile)
559 # Check whether --debuginfo options should be allowed
560 AC_ARG_ENABLE(debuginfo,
561 AC_HELP_STRING([--enable-debuginfo],
562 [enable debug output (--debuginfo option)]),
563 WITH_DEBUG=yes ; DFLAGS="$DFLAGS -DDEBUG" , WITH_DEBUG=no)
567 # Check whether object files should be stripped
568 AC_MSG_CHECKING(whether object files should be stripped)
569 AC_ARG_ENABLE(stripping,
570 AC_HELP_STRING([--disable-stripping],
571 [do not strip object files]),
572 AUX_STRIP=$enableval,AUX_STRIP=yes)
573 if test $AUX_STRIP != "no"; then
580 AC_MSG_RESULT($AUX_STRIP)
585 echo Now create files:
587 AC_CONFIG_FILES([sa1], [chmod +x sa1]) # Permissions must be changed
588 AC_CONFIG_FILES([sa2], [chmod +x sa2]) # Permissions must be changed
589 AC_CONFIG_FILES([cron/crontab:cron/crontab.sample]) # File must be renamed
590 AC_CONFIG_FILES([sysstat.sysconfig])
591 AC_CONFIG_FILES([version.h:version.in]) # File must be renamed
592 AC_CONFIG_FILES([sysconfig.h:sysconfig.in]) # File must be renamed
593 AC_CONFIG_FILES([prealloc.h:prealloc.in]) # File must be renamed
594 AC_CONFIG_FILES([cron/sysstat.cron.daily])
595 AC_CONFIG_FILES([cron/sysstat.cron.hourly])
596 AC_CONFIG_FILES([cron/sysstat.crond])
597 AC_CONFIG_FILES([cron/sysstat.crond.sample.in:cron/sysstat.crond.in], [sed s/^/#/ cron/sysstat.crond.sample.in > cron/sysstat.crond.sample])
598 AC_CONFIG_FILES([sysstat], [chmod +x sysstat]) # Permissions must be changed
599 AC_CONFIG_FILES([sysstat.service])
600 AC_CONFIG_FILES([cron/sysstat-collect.service])
601 AC_CONFIG_FILES([cron/sysstat-collect.timer])
602 AC_CONFIG_FILES([cron/sysstat-summary.service])
603 AC_CONFIG_FILES([cron/sysstat-summary.timer])
604 AC_CONFIG_FILES([man/sa1.8:man/sa1.in]) # File must be renamed
605 AC_CONFIG_FILES([man/sa2.8:man/sa2.in]) # File must be renamed
606 AC_CONFIG_FILES([man/sadc.8:man/sadc.in]) # File must be renamed
607 AC_CONFIG_FILES([man/sadf.1:man/sadf.in]) # File must be renamed
608 AC_CONFIG_FILES([man/sar.1:man/sar.in]) # File must be renamed
609 AC_CONFIG_FILES([man/sysstat.5:man/sysstat.in]) # File must be renamed
610 AC_CONFIG_FILES([man/iostat.1:man/iostat.in]) # File must be renamed
611 AC_CONFIG_FILES([man/cifsiostat.1:man/cifsiostat.in]) # File must be renamed
612 AC_CONFIG_FILES([contrib/isag/isag], [chmod +x contrib/isag/isag]) # Permissions must be changed
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