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, 10.2.1)
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, bzip2 gzip, gzip, /bin /etc /sbin /usr/bin /usr/etc /usr/sbin /usr/ucb /usr/local/bin /usr/local/etc /usr/local/sbin)
34 INSTALL_DATA="\${INSTALL} -m 644"
35 AC_SUBST(INSTALL_DATA)
36 INSTALL_BIN="\${INSTALL} -m 755"
39 AC_PATH_PROGS(PATH_CP, cp, cp, /bin /etc /sbin /usr/bin /usr/etc /usr/sbin /usr/ucb /usr/local/bin /usr/local/etc /usr/local/sbin)
40 AC_PATH_PROGS(PATH_CHKCONFIG, chkconfig, chkconfig, /bin /etc /sbin /usr/bin /usr/etc /usr/sbin /usr/ucb /usr/local/bin /usr/local/etc /usr/local/sbin)
43 AC_CHECK_PROG(PKG_CONFIG, pkg-config, pkg-config)
44 AC_PATH_PROGS(SYSTEMCTL, systemctl, systemctl, /bin /etc /sbin /usr/bin /usr/etc /usr/sbin /usr/ucb /usr/local/bin /usr/local/etc /usr/local/sbin)
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:
62 AC_CHECK_HEADERS(ctype.h)
63 AC_CHECK_HEADERS(errno.h)
64 AC_CHECK_HEADERS(libintl.h, HAVE_LIBINTL_H=1)
65 AC_CHECK_HEADERS(locale.h, HAVE_LOCALE_H=1)
66 AC_CHECK_HEADERS(net/if.h)
67 AC_CHECK_HEADERS(regex.h)
68 AC_CHECK_HEADERS(signal.h)
69 AC_CHECK_HEADERS(stdio.h)
70 AC_CHECK_HEADERS(sys/file.h)
71 AC_CHECK_HEADERS(sys/ioctl.h)
72 AC_CHECK_HEADERS(sys/stat.h)
75 echo Check typedefs, structures and compiler characteristics:
82 echo Check library functions:
84 AC_CHECK_FUNCS(strchr)
85 AC_CHECK_FUNCS(strcspn)
86 AC_CHECK_FUNCS(strspn)
87 AC_CHECK_FUNCS(strstr)
89 # Should we check for lm_sensors?
90 AC_MSG_CHECKING(for sensors support)
91 AC_ARG_ENABLE(sensors,
92 AC_HELP_STRING([--disable-sensors],
93 [disable sensors support]),
94 SENSORS=$enableval,SENSORS=yes)
95 if test $SENSORS != "yes"; then
100 AC_MSG_RESULT($SENSORS)
102 # Check for lm_sensors
106 AC_CHECK_LIB(sensors, sensors_get_detected_chips, LFSENSORS="-lsensors", HAVE_SENSORS="n")
107 AC_MSG_CHECKING(for sensors lib)
108 AC_TRY_COMPILE(#include <sensors/sensors.h>
109 #include <sensors/error.h>
110 , sensors_cleanup();,SENSORS=yes; DFSENSORS="-DHAVE_SENSORS", HAVE_SENSORS="n"; SENSORS=no)
111 AC_MSG_RESULT($SENSORS)
112 AC_SUBST(HAVE_SENSORS)
117 echo Check system services:
122 echo Check configuration:
124 # Check arguments used
127 # --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
128 # --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
129 # --disable-largefile omit support for large files
130 # --disable-nls disable National Language Support
131 # --enable-yesterday tell sa2 to use "yesterday" data files
132 # --disable-man-group ignore man_group variable value
133 # --enable-install-cron tell sysstat to install cron scripts
134 # --collect-all tell sadc to collect all possible data
135 # --enable-clean-sa-dir clean system activity directory
136 # --enable-compress-manpg compress manual pages
137 # --enable-install-isag install isag script
138 # --enable-debuginfo enable debug output (--debuginfo option)
139 # --disable-documentation do not install documentation (man pages...)
140 # --disable-sensors do not link against libsensors even if available
141 # --disable-stripping do not strip object files
142 # --enablle-copy-only only copy files when installing sysstat
144 # Some influential environment variables:
145 # rcdir directory where startup scripts are installed
146 # sa_lib_dir sadc, sa1 and sa2 directory
147 # sa_dir system activity daily datafiles directory
148 # conf_dir sysstat configuration directory (default is /etc/sysconfig)
149 # history number of daily datafiles to keep (default value is 7)
150 # compressafter number of days after which datafiles are compressed
151 # man_group group for man pages
152 # cron_owner crontab owner
153 # cron_interval crontab sampling interval
155 # Fine tuning the installation directories:
156 # --mandir=DIR man documentation directory [PREFIX/man]
157 # --docdir=DIR other documentation directory [PREFIX/share/doc]
159 # Installation directories:
160 # --prefix=PREFIX install architecture-independent files in PREFIX
162 # --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
166 if test -d /etc/init.d && test ! -L /etc/init.d; then
167 if test -d /etc/init.d/rc2.d; then
175 elif test -d /sbin/init.d; then
177 INIT_DIR=/sbin/init.d
181 INIT_DIR=/etc/rc.d/init.d
185 AC_MSG_CHECKING(run-commands directory)
186 AC_ARG_VAR([rcdir],[run-commands directory])
187 if test x$rcdir != x""; then
188 # Override previous rc directories values
190 INIT_DIR=$rcdir/init.d
193 AC_MSG_RESULT($RC_DIR)
194 if test ! -d $RC_DIR; then
195 echo "INFO: Directory ${RC_DIR} doesn't exist."
196 echo "INFO: Startup scripts won't be installed."
204 if test $prefix != "NONE"; then
210 SADC_DIR=$AuxPrefix/lib
211 if test -d $AuxPrefix/lib64; then
212 # Look for lm (long mode) flag to know if CPU is 64 bit
213 grep " lm " /proc/cpuinfo >/dev/null 2>&1
215 SADC_DIR=$AuxPrefix/lib64
219 AC_MSG_CHECKING(sadc directory)
220 AC_ARG_VAR([sa_lib_dir],[sadc directory])
221 if test x$sa_lib_dir != x""; then
222 SA_LIB_DIR=$sa_lib_dir
224 SA_LIB_DIR=$SADC_DIR/sa
226 AC_MSG_RESULT($SA_LIB_DIR)
227 if test ! -d $SA_LIB_DIR; then
228 echo "INFO: Directory ${SA_LIB_DIR} will be created during installation stage."
232 # Set system activity directory
233 AC_MSG_CHECKING(system activity directory)
234 AC_ARG_VAR([sa_dir],[system activity directory])
235 if test x$sa_dir != x""; then
240 AC_MSG_RESULT($SA_DIR)
241 if test ! -d $SA_DIR; then
242 echo "INFO: Directory ${SA_DIR} will be created during installation stage."
246 # Set configuration directory
247 AC_MSG_CHECKING(sysstat configuration directory)
248 AC_ARG_VAR([conf_dir],[sysstat configuration directory])
249 if test x$conf_dir != x""; then
250 SYSCONFIG_DIR=$conf_dir
252 SYSCONFIG_DIR=/etc/sysconfig
254 AC_MSG_RESULT($SYSCONFIG_DIR)
255 if test ! -d $SYSCONFIG_DIR; then
256 echo "INFO: Directory ${SYSCONFIG_DIR} will be created during installation stage."
258 AC_SUBST(SYSCONFIG_DIR)
260 # National Language Support
261 AC_MSG_CHECKING(National Language Support)
263 AC_HELP_STRING([--disable-nls],
264 [disable National Language Support]),
265 AUX_NLS=$enableval,AUX_NLS=yes)
266 if test $AUX_NLS != "no" && test $HAVE_LIBINTL_H && test $HAVE_LOCALE_H; then
273 AC_MSG_RESULT($AUX_NLS)
275 if test $AUX_NLS = "yes" && test x$MSGFMT != x"msgfmt"; then
276 echo "WARNING: msgfmt command not found!"
278 if test $AUX_NLS = "yes" && test x$XGETTEXT != x"xgettext"; then
279 echo "WARNING: xgettext command not found!"
281 if test $AUX_NLS = "yes" && test x$MSGMERGE != x"msgmerge"; then
282 echo "WARNING: msgmerge command not found!"
285 # Check whether sa2 should process data file of the day before
286 AC_MSG_CHECKING(whether sa2 should process data file of the day before)
287 AC_ARG_ENABLE(yesterday,
288 AC_HELP_STRING([--enable-yesterday],
289 [tell sa2 to use data file of the day before]),
290 AUX_YESTERDAY=$enableval,AUX_YESTERDAY=no)
291 if test $AUX_YESTERDAY = "yes"; then
292 YESTERDAY="--date=yesterday"
300 # Data history to keep by sa2
301 AC_MSG_CHECKING(number of daily data files to keep)
302 AC_ARG_VAR([history],[number of daily data files to keep (default value is 7)])
303 if test x$history = x""; then
308 AC_MSG_RESULT($HISTORY)
311 # Number of days after which datafiles are compressed
312 AC_MSG_CHECKING(number of days after which data files are compressed)
313 AC_ARG_VAR([compressafter],[number of days after which data files are compressed (default value is 10)])
314 if test x$compressafter = x""; then
317 COMPRESSAFTER=$compressafter
319 AC_MSG_RESULT($COMPRESSAFTER)
320 AC_SUBST(COMPRESSAFTER)
322 # Preallocation factor
323 AC_MSG_CHECKING(preallocation factor value)
324 AC_ARG_VAR([prealloc],[preallocation factor that will determine data files size (default value is 1)])
325 if test x$prealloc = x""; then
328 PREALLOC_FACTOR=$prealloc
330 AC_MSG_RESULT($PREALLOC_FACTOR)
331 AC_SUBST(PREALLOC_FACTOR)
334 grep ^man: /etc/group >/dev/null 2>&1
341 AC_MSG_CHECKING(group for manual pages)
342 AC_ARG_VAR([man_group],[group for manual pages])
343 if test x$man_group = x""; then
345 AC_MSG_RESULT($MAN_GROUP)
347 grep ^$man_group: /etc/group >/dev/null 2>&1
350 AC_MSG_RESULT($MAN_GROUP)
351 echo "WARNING: Group ${man_group} not found: Using ${GRP} instead"
354 AC_MSG_RESULT($MAN_GROUP)
359 # Ignore manual pages group?
360 AC_MSG_CHECKING(whether man_group variable should be ignored)
361 AC_ARG_ENABLE(man-group,
362 AC_HELP_STRING([--disable-man-group],
363 [ignore man_group variable value]),
364 AUX_IMG=$enableval,AUX_IMG=yes)
365 if test $AUX_IMG != "no"; then
372 AC_MSG_RESULT($AUX_IMG)
373 AC_SUBST(IGNORE_MAN_GROUP)
375 # Compress manual pages?
376 AC_MSG_CHECKING(whether manual pages should be compressed)
377 AC_ARG_ENABLE(compress-manpg,
378 AC_HELP_STRING([--enable-compress-manpg],
379 [compress sysstat manual pages]),
380 AUX_MPG=$enableval,AUX_MPG=no)
381 if test $AUX_MPG != "yes"; then
387 AC_MSG_RESULT($AUX_MPG)
388 AC_SUBST(COMPRESS_MANPG)
390 # Check whether isag should be installed
391 AC_MSG_CHECKING(whether isag script should be installed)
392 AC_ARG_ENABLE(install-isag,
393 AC_HELP_STRING([--enable-install-isag],
394 [install isag script]),
395 AUX_IIS=$enableval,AUX_IIS=no)
396 if test $AUX_IIS != "yes"; then
402 AC_MSG_RESULT($AUX_IIS)
403 AC_SUBST(INSTALL_ISAG)
405 # Check whether sa directory should be cleaned
406 AC_MSG_CHECKING(whether system activity directory should be cleaned)
407 AC_ARG_ENABLE(clean-sa-dir,
408 AC_HELP_STRING([--enable-clean-sa-dir],
409 [clean system activity directory]),
410 AUX_CSD=$enableval,AUX_CSD=no)
411 if test $AUX_CSD != "yes"; then
417 AC_MSG_RESULT($AUX_CSD)
418 AC_SUBST(CLEAN_SA_DIR)
421 AC_MSG_CHECKING(whether cron should start sar automatically)
422 AC_ARG_ENABLE(install-cron,
423 AC_HELP_STRING([--enable-install-cron],
424 [install a crontab to start sar]),
425 INSTALL_CRON=$enableval,INSTALL_CRON=n)
426 if test $INSTALL_CRON != "yes"; then
433 AC_MSG_RESULT($AUX_CRON)
434 AC_SUBST(INSTALL_CRON)
438 if test $INSTALL_CRON = "y"; then
439 AC_MSG_CHECKING(crontab owner)
440 AC_ARG_VAR([cron_owner],[crontab owner])
441 if test x$cron_owner = x""; then
443 AC_MSG_RESULT($CRON_OWNER)
445 grep ^$cron_owner: /etc/passwd >/dev/null 2>&1
448 AC_MSG_RESULT($CRON_OWNER)
449 echo "WARNING: User ${cron_owner} not found: Using ${CUSR} instead."
451 CRON_OWNER=$cron_owner
452 AC_MSG_RESULT($CRON_OWNER)
455 echo "INFO: Crontab for ${CRON_OWNER} will be saved in current directory if necessary"
456 if test $CRON_OWNER = "root"; then
459 REM_CHOWN="# REM_CHOWN"
461 SU_C_OWNER="su $CRON_OWNER -c "
463 # " (ignore this line)
468 AC_MSG_CHECKING(crontab interval)
469 AC_ARG_VAR([cron_interval],[crontab interval])
470 if test x$cron_interval = x""; then
473 CRON_INTERVAL=$cron_interval
475 AC_MSG_RESULT($CRON_INTERVAL)
476 CRON_INTERVAL_SEC=`expr ${CRON_INTERVAL} \* 60`
477 CRON_COUNT=`expr 60 / ${CRON_INTERVAL}`
479 # Check whether sadc should collect all possible activities
480 AC_MSG_CHECKING(whether sadc should collect all possible activities)
481 AC_ARG_ENABLE(collect-all,
482 AC_HELP_STRING([--enable-collect-all],
483 [collect all possible activities]),
484 COLLECT_ALL=$enableval,COLLECT_ALL=n=n)
485 if test $COLLECT_ALL != "yes"; then
489 COLLECT_ALL="-S XALL"
492 AC_MSG_RESULT($AUX_COLL)
494 # Check whether files should only be copied
495 AC_MSG_CHECKING(whether files should only be copied)
496 AC_ARG_ENABLE(copy-only,
497 AC_HELP_STRING([--enable-copy-only],
498 [only copy files when installing]),
499 OCOPY=$enableval,OCOPY=no)
500 if test $OCOPY != "yes"; then
506 AC_MSG_RESULT($OCOPY)
513 REM_CHOWN="# REM_CHOWN"
515 CRON_INTERVAL_SEC=600
521 AC_SUBST(CRON_INTERVAL)
522 AC_SUBST(CRON_INTERVAL_SEC)
526 AC_SUBST(COLLECT_ALL)
528 # Check whether documentation should be installed
529 AC_MSG_CHECKING(whether documentation should be installed)
530 AC_ARG_ENABLE(documentation,
531 AC_HELP_STRING([--disable-documentation],
532 [do not install documentation]),
533 AUX_DOC=$enableval,AUX_DOC=yes)
534 if test $AUX_DOC != "no"; then
541 AC_MSG_RESULT($AUX_DOC)
542 AC_SUBST(INSTALL_DOC)
544 # Set directory for installing manual pages (see comment in Makefile)
547 # Check whether --debuginfo options should be allowed
548 AC_ARG_ENABLE(debuginfo,
549 AC_HELP_STRING([--enable-debuginfo],
550 [enable debug output (--debuginfo option)]),
551 WITH_DEBUG=yes ; DFLAGS="$DFLAGS -DDEBUG" , WITH_DEBUG=no)
555 # Check whether object files should be stripped
556 AC_MSG_CHECKING(whether object files should be stripped)
557 AC_ARG_ENABLE(stripping,
558 AC_HELP_STRING([--disable-stripping],
559 [do not strip object files]),
560 AUX_STRIP=$enableval,AUX_STRIP=yes)
561 if test $AUX_STRIP != "no"; then
568 AC_MSG_RESULT($AUX_STRIP)
570 # National Language Support
571 #AC_MSG_CHECKING(National Language Support)
573 # AC_HELP_STRING([--disable-nls],
574 # [disable National Language Support]),
575 # AUX_NLS=$enableval,AUX_NLS=yes)
576 #if test $AUX_NLS != "no" && test $HAVE_LIBINTL_H && test $HAVE_LOCALE_H; then
583 #AC_MSG_RESULT($AUX_NLS)
588 echo Now create files:
590 AC_CONFIG_FILES([sa1], [chmod +x sa1]) # Permissions must be changed
591 AC_CONFIG_FILES([sa2], [chmod +x sa2]) # Permissions must be changed
592 AC_CONFIG_FILES([cron/crontab:cron/crontab.sample]) # File must be renamed
593 AC_CONFIG_FILES([sysstat.sysconfig])
594 AC_CONFIG_FILES([version.h:version.in]) # File must be renamed
595 AC_CONFIG_FILES([sysconfig.h:sysconfig.in]) # File must be renamed
596 AC_CONFIG_FILES([prealloc.h:prealloc.in]) # File must be renamed
597 AC_CONFIG_FILES([cron/sysstat.cron.daily])
598 AC_CONFIG_FILES([cron/sysstat.cron.hourly])
599 AC_CONFIG_FILES([cron/sysstat.crond])
600 AC_CONFIG_FILES([cron/sysstat.crond.sample.in:cron/sysstat.crond.in], [sed s/^/#/ cron/sysstat.crond.sample.in > cron/sysstat.crond.sample])
601 AC_CONFIG_FILES([sysstat], [chmod +x sysstat]) # Permissions must be changed
602 AC_CONFIG_FILES([sysstat.service])
603 AC_CONFIG_FILES([man/sa1.8:man/sa1.in]) # File must be renamed
604 AC_CONFIG_FILES([man/sa2.8:man/sa2.in]) # File must be renamed
605 AC_CONFIG_FILES([man/sadc.8:man/sadc.in]) # File must be renamed
606 AC_CONFIG_FILES([man/sadf.1:man/sadf.in]) # File must be renamed
607 AC_CONFIG_FILES([man/sar.1:man/sar.in]) # File must be renamed
608 AC_CONFIG_FILES([man/sysstat.5:man/sysstat.in]) # File must be renamed
609 AC_CONFIG_FILES([man/iostat.1:man/iostat.in]) # File must be renamed
610 AC_CONFIG_FILES([man/cifsiostat.1:man/cifsiostat.in]) # File must be renamed
611 AC_CONFIG_FILES([man/nfsiostat.1:man/nfsiostat.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