1 dnl +------------------------------------------------------------------+
2 dnl | Network UPS Tools: configure.in |
3 dnl +------------------------------------------------------------------+
5 dnl NUT version number is defined here, with a Git suffix in include/nut_version.h
6 AC_INIT(nut, 2.7.1-pre2)
7 AC_CONFIG_SRCDIR(server/upsd.c)
8 AC_CONFIG_MACRO_DIR([m4])
9 echo "Network UPS Tools version ${PACKAGE_VERSION}"
12 AC_CONFIG_HEADER(include/config.h)
13 AC_PREFIX_DEFAULT(/usr/local/ups)
16 dnl we need Autoconf 2.60 or better to enable features of Posix that are extensions to C
17 AC_MSG_CHECKING(for autoconf macro to enable system extensions)
18 m4_version_prereq(2.60, [
20 AC_USE_SYSTEM_EXTENSIONS
25 dnl Use "./configure --enable-maintainer-mode" to keep Makefile.in and Makefile
26 dnl in sync after SVN updates.
29 dnl PKG_PROG_PKG_CONFIG
31 dnl Various version related processing
32 dnl ----------------------------------
34 dnl # the following is commented out, because the UPS_VERSION macro now
35 dnl # resides in include/nut_version.h, which is generated by Makefile.am,
36 dnl # rather than in include/config.h, which is generated by configure. The
37 dnl # reason is that the SVN revision should be computed at compile time,
38 dnl # not configure time.
39 dnl AC_DEFINE_UNQUOTED(UPS_VERSION, "${PACKAGE_VERSION}", [NUT version])
41 dnl However, automatically define the tree version (mostly for AC_SUBST)
42 TREE_VERSION="`echo ${PACKAGE_VERSION} | awk '{ print substr($0,1,3) }'`"
43 AC_DEFINE_UNQUOTED(TREE_VERSION, "${TREE_VERSION}", [NUT tree version])
46 AC_DEFINE_UNQUOTED(NUT_NETVERSION, "${NUT_NETVERSION}", [NUT network protocol version])
49 dnl Fix this early so we can expand with eval later
50 test "${prefix}" = "NONE" && prefix="${ac_default_prefix}"
51 test "${exec_prefix}" = "NONE" && exec_prefix='${prefix}'
55 dnl NOTE: for definition of NUT_* autoconf macros, see m4/ directory
56 dnl and docs/macros.txt
58 dnl +------------------------------------------------------------------+
59 dnl | default values for things later on (can be overridden) |
61 STATEPATH="/var/state/ups"
63 cgiexecdir='${exec_prefix}/cgi-bin'
64 driverexecdir='${exec_prefix}/bin'
65 htmldir='${prefix}/html'
66 pkgconfigdir='${libdir}/pkgconfig'
67 hotplugdir='/etc/hotplug'
68 if test ! -d "${hotplugdir}"; then
72 if test ! -d "${udevdir}"; then
74 if test ! -d "${udevdir}"; then
83 dnl Define directory where LIBOBJS replacement functions are
84 AC_CONFIG_LIBOBJ_DIR([common])
86 dnl +-------------------------------------------------------------------
89 dnl Needed for per-target flags
96 AC_CHECK_TOOL(RANLIB, ranlib, :)
97 dnl Postpone call to AC_PROG_LIBTOOL to allow disabling static lib
100 AC_C_FLEXIBLE_ARRAY_MEMBER
102 AC_CHECK_FUNCS(flock lockf fcvt fcvtl)
103 AC_CHECK_FUNCS(cfsetispeed tcsendbreak)
104 AC_CHECK_FUNCS(seteuid setsid getpassphrase)
105 AC_CHECK_FUNCS(on_exit strptime setlogmask)
106 AC_CHECK_DECLS(LOG_UPTO, [], [], [#include <syslog.h>])
108 dnl the following may add stuff to LIBOBJS (is this still needed?)
109 AC_CHECK_FUNCS(vsnprintf snprintf, [], [
112 AC_TYPE_LONG_LONG_INT
115 AC_REPLACE_FUNCS(setenv strerror atexit)
119 dnl Tests for CppUnit availability and usability
120 dnl Using CppUnit implies C++ support!
121 dnl Theoretically, libcppunit-dev will pull up to g++, through libstdc++...
122 dnl AM_PATH_CPPUNIT(1.9.6)
124 PKG_CHECK_MODULES(CPPUNIT, cppunit, have_cppunit=yes, have_cppunit=no)
125 if test "${have_cppunit}" != "yes" ; then
126 AC_MSG_WARN([libcppunit not found.])
128 AM_CONDITIONAL(HAVE_CPPUNIT, test "${have_cppunit}" = "yes")
131 dnl Only use these when compiling with gcc
133 if ( test "${GCC}" = "yes" )
135 CFLAGS="${CFLAGS} -Wall -Wsign-compare"
140 dnl On Solaris, this allows errno to use thread local storage
141 CFLAGS="${CFLAGS} -D_REENTRANT"
144 dnl On AIX, this allows errno to use thread local storage
145 CFLAGS="${CFLAGS} -D_REENTRANT"
148 dnl It seems like the thread safe string functions will not be included
149 dnl on 64 bit HP-UX unless we define _REENTRANT
150 CFLAGS="${CFLAGS} -D_REENTRANT"
155 dnl need to check if unistd.h is enough, else try getopt.h, else need decls
156 AC_CHECK_DECLS(optind, [], [
157 AC_CHECK_HEADERS(getopt.h, [
158 AC_DEFINE(NEED_GETOPT_H, 1, [Define if getopt.h is needed])
160 AC_DEFINE(NEED_GETOPT_DECLS, 1, [Define to use explicit getopt declarations])
161 ], [AC_INCLUDES_DEFAULT])
162 ], [AC_INCLUDES_DEFAULT])
164 dnl do a 2nd check to ensure inclusion of getopt.h, in case optind is known
165 AC_CHECK_HEADERS(getopt.h, [
166 AC_DEFINE(NEED_GETOPT_H, 1, [Define if getopt.h is needed])
168 AC_DEFINE(NEED_GETOPT_DECLS, 1, [Define to use explicit getopt declarations])
169 ], [AC_INCLUDES_DEFAULT])
171 dnl also check for getopt_long
172 AC_CHECK_FUNCS(getopt_long)
174 dnl FreeBSD serial locking compatibility - look for uu_lock in libutil.h
175 AC_CHECK_DECLS(uu_lock, [
176 AC_DEFINE(HAVE_UU_LOCK, 1, [Use uu_lock for locking (FreeBSD)])
178 dnl put in some better defaults for FreeBSD
183 #include <sys/types.h>
187 AC_CHECK_DECLS(__func__, [], [
188 AC_CHECK_DECLS(__FUNCTION__, [
189 AC_DEFINE(__func__, __FUNCTION__, [Replace missing __func__ declaration])
191 AC_DEFINE(__func__, __LINE__, [Replace missing __func__ declaration])
192 ], [AC_INCLUDES_DEFAULT])
193 ], [AC_INCLUDES_DEFAULT])
195 dnl Solaris compatibility - check for -lnsl and -lsocket
196 AC_SEARCH_LIBS(gethostbyname, nsl)
197 AC_SEARCH_LIBS(connect, socket)
200 AC_CHECK_HEADERS(sys/modem.h stdarg.h varargs.h sys/termios.h sys/time.h, [], [], [AC_INCLUDES_DEFAULT])
202 # pthread related checks
203 AC_SEARCH_LIBS([pthread_create], [pthread],
204 [AC_DEFINE(HAVE_PTHREAD, 1, [Define to enable pthread support code])],
207 dnl ----------------------------------------------------------------------
208 dnl Check for types and define possible replacements
211 dnl ----------------------------------------------------------------------
212 dnl check for --with-all (or --without-all, or --with-all=auto) flag
214 AC_MSG_CHECKING(for --with-all)
216 AS_HELP_STRING([--with-all], [enable serial, usb, snmp, neon, ipmi, powerman, cgi, dev, avahi]),
218 if test -n "${withval}"; then
219 dnl Note: we allow "no" as a positive value, because
220 dnl this is what the user expects from --without-all
221 if test -z "${with_serial}"; then with_serial="${withval}"; fi
222 if test -z "${with_usb}"; then with_usb="${withval}"; fi
223 if test -z "${with_snmp}"; then with_snmp="${withval}"; fi
224 if test -z "${with_neon}"; then with_neon="${withval}"; fi
225 if test -z "${with_powerman}"; then with_powerman="${withval}"; fi
226 if test -z "${with_cgi}"; then with_cgi="${withval}"; fi
227 if test -z "${with_dev}"; then with_dev="${withval}"; fi
228 if test -z "${with_avahi}"; then with_avahi="${withval}"; fi
229 if test -z "${with_ipmi}"; then with_ipmi="${withval}"; fi
230 AC_MSG_RESULT("${withval}")
232 AC_MSG_RESULT(not given)
235 AC_MSG_RESULT(not given)
238 dnl ----------------------------------------------------------------------
239 dnl declare a number of --with-FEATURE options. Do this early, so that
240 dnl they are listed near the top by "./configure --help"
242 NUT_ARG_WITH([dev], [build and install the development files], [no])
243 NUT_ARG_WITH([serial], [build and install serial drivers], [yes])
244 NUT_ARG_WITH([usb], [build and install USB drivers], [auto])
245 NUT_ARG_WITH([doc], [build and install documentation], [no])
246 NUT_ARG_WITH([avahi], [build and install Avahi support], [auto])
248 dnl ----------------------------------------------------------------------
249 dnl Check for presence and compiler flags of various libraries
251 dnl These checks are performed unconditionally, even if the corresponding
252 dnl --with-* options are not given. This is because we cannot predict
253 dnl what will be in the --with-drivers argument.
257 NUT_ARG_WITH([hal], [build and install HAL support], [no])
260 NUT_ARG_WITH([snmp], [build and install SNMP drivers], [auto])
262 NUT_ARG_WITH([neon], [build and install neon based XML/HTTP driver], [auto])
264 NUT_ARG_WITH([powerman], [build and install Powerman PDU client driver], [auto])
265 NUT_CHECK_LIBPOWERMAN
268 dnl ----------------------------------------------------------------------
269 dnl additional USB-related checks
271 dnl Solaris 10/11 USB handling (need librt and libusb runtime path)
272 dnl HPUX, since v11, needs an explicit activation of pthreads
275 echo Checking for Solaris 10 / 11 specific configuration for usb drivers
276 AC_SEARCH_LIBS(nanosleep, rt)
277 LIBUSB_LIBS="-R/usr/sfw/lib ${LIBUSB_LIBS}"
278 dnl FIXME: Sun's libusb doesn't support timeout (so blocks notification)
279 dnl and need to call libusb close upon reconnection
280 AC_DEFINE(SUN_LIBUSB, 1, [Define to 1 for Sun version of the libusb.])
284 CFLAGS="${CFLAGS} -lpthread"
288 dnl ----------------------------------------------------------------------
289 dnl checks related to --with-serial
291 dnl ${nut_with_serial}: any value except "yes" or "no" is treated as "auto".
292 if test "${nut_with_serial}" != "no"; then
293 nut_with_serial="yes"
296 NUT_REPORT_FEATURE([build serial drivers], [${nut_with_serial}], [],
297 [WITH_SERIAL], [Define to enable serial support])
299 dnl ----------------------------------------------------------------------
300 dnl checks related to --with-usb
302 dnl ${nut_with_usb}: any value except "yes" or "no" is treated as "auto".
303 if test "${nut_with_usb}" = "yes" -a "${nut_have_libusb}" != "yes"; then
304 AC_MSG_ERROR(["USB drivers requested, but libusb not found."])
307 if test "${nut_with_usb}" != "no"; then
308 nut_with_usb="${nut_have_libusb}"
311 NUT_REPORT_FEATURE([build USB drivers], [${nut_with_usb}], [],
312 [WITH_USB], [Define to enable USB support])
314 dnl ----------------------------------------------------------------------
315 dnl checks related to --with-snmp
317 dnl ${nut_with_snmp}: any value except "yes" or "no" is treated as "auto".
318 if test "${nut_with_snmp}" = "yes" -a "${nut_have_libnetsnmp}" != "yes"; then
319 AC_MSG_ERROR(["Net-SNMP libraries not found, required for SNMP drivers"])
322 if test "${nut_with_snmp}" != "no"; then
323 nut_with_snmp="${nut_have_libnetsnmp}"
326 NUT_REPORT_FEATURE([build SNMP drivers], [${nut_with_snmp}], [],
327 [WITH_SNMP], [Define to enable SNMP support])
329 dnl ----------------------------------------------------------------------
330 dnl checks related to --with-neon
332 dnl ${nut_with_neon}: any value except "yes" or "no" is treated as "auto".
333 if test "${nut_with_neon}" = "yes" -a "${nut_have_neon}" != "yes"; then
334 AC_MSG_ERROR(["neon libraries not found, required for neon based XML/HTTP driver"])
337 if test "${nut_with_neon}" != "no"; then
338 nut_with_neon="${nut_have_neon}"
341 NUT_REPORT_FEATURE([build neon based XML driver], [${nut_with_neon}], [],
342 [WITH_NEON], [Define to enable Neon HTTP support])
344 dnl ----------------------------------------------------------------------
345 dnl checks related to --with-avahi
347 dnl ${nut_with_avahi}: any value except "yes" or "no" is treated as "auto".
348 if test "${nut_with_avahi}" = "yes" -a "${nut_have_avahi}" != "yes"; then
349 AC_MSG_ERROR(["avahi libraries not found"])
352 if test "${nut_with_avahi}" != "no"; then
353 nut_with_avahi="${nut_have_avahi}"
356 NUT_REPORT_FEATURE([enable Avahi support], [${nut_with_avahi}], [],
357 [WITH_AVAHI], [Define to enable Avahi support])
359 dnl ----------------------------------------------------------------------
361 dnl checks related to --with-powerman
363 dnl ${nut_with_powerman}: any value except "yes" or "no" is treated as "auto".
364 if test "${nut_with_powerman}" = "yes" -a "${nut_have_libpowerman}" != "yes"; then
365 AC_MSG_ERROR(["Powerman client libraries not found, required for Powerman PDU client driver"])
368 if test "${nut_with_powerman}" != "no"; then
369 nut_with_powerman="${nut_have_libpowerman}"
372 NUT_REPORT_FEATURE([build Powerman PDU client driver], [${nut_with_powerman}], [],
373 [WITH_LIBPOWERMAN], [Define to enable Powerman PDU support])
375 dnl ----------------------------------------------------------------------
376 dnl Check for with-ipmi, and --with-freeipmi (or --with-openipmi)
377 dnl Only one can be enabled at a time, with a preference for FreeIPMI
378 dnl if both are available (since it is the only one supported ATM!!)
382 NUT_ARG_WITH([ipmi], [build and install IPMI PSU driver], [auto])
383 NUT_ARG_WITH([freeipmi], [enable IPMI support using FreeIPMI], [auto])
384 dnl NUT_ARG_WITH([openipmi], [enable IPMI support using OpenIPMI], [auto])
386 dnl ${nut_with_ipmi}: any value except "yes" or "no" is treated as "auto".
387 if test "${nut_with_ipmi}" != "no"; then
388 dnl check if FreeIPMI (and maybe later OpenIPMI) was explicitly requested
389 if test "${nut_with_freeipmi}" = "yes"; then
390 NUT_CHECK_LIBFREEIPMI
391 if test "${nut_have_freeipmi}" != "yes"; then
392 AC_MSG_ERROR(["GNU FreeIPMI not found, required for IPMI support"])
394 dnl Implies --with-ipmi
396 dnl elif test "${nut_with_openipmi}" = "yes"; then
397 dnl AC_MSG_ERROR(["OpenIPMI is not yet supported"])
398 dnl NUT_CHECK_LIBOPENIPMI
399 dnl if test "${nut_have_openipmi}" != "yes"; then
400 dnl AC_MSG_ERROR(["OpenIPMI not found, required for IPMI support"])
402 dnl Implies --with-ipmi
403 dnl nut_with_ipmi="yes"
404 dnl AC_DEFINE(WITH_OPENIPMI, 1, [Define to enable IPMI support using OpenIPMI])
406 dnl Prefer FreeIPMI over OpenIPMI otherwise
407 NUT_CHECK_LIBFREEIPMI
408 if test "${nut_have_freeipmi}" != "yes"; then
409 if test "${nut_with_ipmi}" = "yes"; then
410 AC_MSG_ERROR(["FreeIPMI not found, required for IPMI support"])
413 dnl NUT_CHECK_OPENIPMI
414 dnl if test "${nut_have_openipmi}" != "yes"; then
415 dnl if test "${nut_with_ipmi}" = "yes"; then
416 dnl AC_MSG_ERROR(["GNU FreeIPMI and OpenIPMI neither found, required for IPMI support"])
418 dnl nut_with_ipmi="no"
420 dnl Implies --with-ipmi
421 dnl nut_with_ipmi="yes"
422 dnl nut_with_openipmi="yes"
425 dnl Implies --with-ipmi
427 nut_with_freeipmi="yes"
428 AC_DEFINE(WITH_FREEIPMI, 1, [Define to enable IPMI support using FreeIPMI])
434 NUT_REPORT_FEATURE([build IPMI driver], [${nut_with_ipmi}], [${nut_ipmi_lib}],
435 [WITH_IPMI], [Define to enable IPMI support])
437 dnl Note: we still have to manually enable complementary AC_DEFINEs (see above)
438 dnl and AM_CONDITIONALs (see below)...
439 AM_CONDITIONAL(WITH_FREEIPMI, test "${nut_with_freeipmi}" = "yes")
440 dnl AM_CONDITIONAL(WITH_OPENIPMI, test "${nut_with_openipmi}" = "yes")
443 dnl ----------------------------------------------------------------------
444 dnl The Mac OS X meta-driver looks at IOKit Power Sources keys managed by
445 dnl the internal USB UPS driver.
447 dnl FIXME: be slightly more clever here:
449 NUT_ARG_WITH([macosx_ups], [build and install Mac OS X Power Sources meta-driver], [auto])
450 if test "${nut_with_macosx_ups}" != no; then
451 if test -d /System/Library/Frameworks/IOKit.framework/ ; then
452 nut_with_macosx_ups="yes"
454 nut_with_macosx_ups="no"
458 NUT_REPORT_FEATURE([build Mac OS X meta-driver],
459 [${nut_with_macosx_ups}], [${nut_macosx_ups_lib}],
460 [WITH_MACOSX], [Define to enable Mac OS X meta-driver])
462 dnl ----------------------------------------------------------------------
463 dnl Check for with-ssl, and --with-nss or --with-openssl
464 dnl Only one can be enabled at a time, with a preference for OpenSSL
465 dnl if both are available
469 NUT_ARG_WITH([ssl], [enable SSL support (either NSS or OpenSSL)], [auto])
470 NUT_ARG_WITH([nss], [enable SSL support using Mozilla NSS], [auto])
471 NUT_ARG_WITH([openssl], [enable SSL support using OpenSSL], [auto])
473 dnl ${nut_with_ssl}: any value except "yes" or "no" is treated as "auto".
474 if test "${nut_with_ssl}" != "no"; then
475 dnl check if either NSS or OpenSSL was explicitly requested
476 if test "${nut_with_nss}" = "yes"; then
478 if test "${nut_have_libnss}" != "yes"; then
479 AC_MSG_ERROR(["Mozilla NSS not found, required for SSL support"])
481 elif test "${nut_with_openssl}" = "yes"; then
483 if test "${nut_have_openssl}" != "yes"; then
484 AC_MSG_ERROR(["OpenSSL not found, required for SSL support"])
487 dnl Prefer OpenSSL over NSS otherwise
489 if test "${nut_have_openssl}" != "yes"; then
491 if test "${nut_have_libnss}" != "yes"; then
492 dnl Only abort if SSL has been explicitly requested by the user
493 if test "${nut_with_ssl}" = "yes"; then
494 AC_MSG_ERROR(["Mozilla NSS and OpenSSL neither found, but are needed for the requested SSL support"])
496 AC_MSG_WARN(["Mozilla NSS and OpenSSL neither found, required for SSL support"])
500 nut_with_nss="${nut_have_libnss}"
503 nut_with_openssl="${nut_have_openssl}"
508 AM_CONDITIONAL(WITH_NSS, test "${nut_with_nss}" = "yes")
509 AM_CONDITIONAL(WITH_OPENSSL, test "${nut_with_openssl}" = "yes")
511 NUT_REPORT_FEATURE([enable SSL support], [${nut_with_ssl}], [${nut_ssl_lib}],
512 [WITH_SSL], [Define to enable SSL])
514 dnl ----------------------------------------------------------------------
515 dnl Check for --with-wrap
517 NUT_ARG_WITH([wrap], [enable libwrap (tcp-wrappers) support], [auto])
519 dnl ${nut_with_wrap}: any value except "yes" or "no" is treated as "auto".
520 if test "${nut_with_wrap}" != "no"; then
521 dnl check for libwrap compiler flags
525 if test "${nut_with_wrap}" = "yes" -a "${nut_have_libwrap}" != "yes"; then
526 AC_MSG_ERROR(["libwrap not found"])
529 if test "${nut_with_wrap}" != "no"; then
530 nut_with_wrap="${nut_have_libwrap}"
533 NUT_REPORT_FEATURE([enable libwrap (tcp-wrappers) support], [${nut_with_wrap}], [],
534 [WITH_WRAP], [Define to enable libwrap (tcp-wrappers) support])
537 dnl ----------------------------------------------------------------------
538 dnl Check for --with-libltdl
540 NUT_ARG_WITH([libltdl], [enable libltdl (Libtool dlopen abstraction) support], [auto])
542 dnl ${nut_with_libltdl}: any value except "yes" or "no" is treated as "auto".
543 if test "${nut_with_libltdl}" != "no"; then
544 dnl check for libltdl compiler flags
548 if test "${nut_with_libltdl}" = "yes" -a "${nut_have_libltdl}" != "yes"; then
549 AC_MSG_ERROR(["libltdl not found"])
552 if test "${nut_with_libltdl}" != "no"; then
553 nut_with_libltdl="${nut_have_libltdl}"
556 NUT_REPORT_FEATURE([enable libltdl (Libtool dlopen abstraction) support], [${nut_with_libltdl}], [],
557 [WITH_LIBLTDL], [Define to enable libltdl (Libtool dlopen abstraction) support])
559 dnl Explicitely report if we are building nut-scanner or not
560 dnl since it requires libltdl
561 NUT_REPORT([build nut-scanner], [${nut_with_libltdl}])
563 dnl ----------------------------------------------------------------------
564 dnl checks related to --with-cgi
566 NUT_ARG_WITH([cgi], [build and install the CGI programs], [no])
568 dnl ${nut_with_cgi}: any value except "yes" or "no" is treated as "auto".
569 if test "${nut_with_cgi}" != "no"; then
570 dnl check for libgd compiler flags
574 if test "${nut_with_cgi}" = "yes" -a "${nut_have_libgd}" != "yes"; then
575 AC_MSG_ERROR([libgd not found, required for CGI build])
578 if test "${nut_with_cgi}" != "no"; then
579 nut_with_cgi="${nut_have_libgd}"
582 NUT_REPORT_FEATURE([build CGI programs], [${nut_with_cgi}], [],
583 [WITH_CGI], [Define to enable CGI (HTTP) support])
585 dnl ----------------------------------------------------------------------
586 dnl checks related to --with-hal
588 dnl ${nut_with_hal}: any value except "yes" or "no" is treated as "auto".
589 if test "${nut_with_hal}" = "yes" -a "${nut_have_libhal}" != "yes"; then
590 AC_MSG_ERROR(["libhal not found, required for HAL support"])
593 if test "${nut_with_hal}" = "yes" -a "${nut_have_libusb}" != "yes"; then
594 AC_MSG_ERROR(["libusb not found, required for HAL support"])
597 if test "${nut_with_hal}" != "no"; then
598 if test "${nut_have_libhal}" = "yes" -a "${nut_have_libusb}" = "yes"; then
605 AM_CONDITIONAL(WITH_HAL, test "${nut_with_hal}" = "yes")
606 NUT_REPORT_FEATURE([enable HAL support], [${nut_with_hal}], [],
607 [WITH_HAL], [Define to enable HAL support])
609 dnl ----------------------------------------------------------------------
611 dnl checks related to --with-doc
613 dnl Always check for AsciiDoc prerequisites, since even if --with-doc
614 dnl is set to 'no', we may still want to build the website, or some
615 dnl doc targets manually
618 case "${nut_with_doc}" in
620 nut_doc_build_list="html-single html-chunked pdf"
623 nut_doc_build_list=""
626 nut_doc_build_list="`echo ${nut_with_doc} | sed 's/,/ /g'`"
630 for nut_doc_build_target in ${nut_doc_build_list}; do
631 case "${nut_doc_build_target}" in
633 AC_MSG_CHECKING([if asciidoc version can build ${nut_doc_build_target}])
634 AX_COMPARE_VERSION([${ASCIIDOC_VERSION}], [ge], [8.6.3], [
636 DOC_BUILD_LIST="${DOC_BUILD_LIST} ${nut_doc_build_target}"
639 DOC_NOBUILD_LIST="${DOC_NOBUILD_LIST} ${nut_doc_build_target}"
644 AC_MSG_CHECKING([if a2x version can build ${nut_doc_build_target}])
645 AX_COMPARE_VERSION([${A2X_VERSION}], [ge], [8.6.3], [
647 DOC_BUILD_LIST="${DOC_BUILD_LIST} ${nut_doc_build_target}"
650 DOC_NOBUILD_LIST="${DOC_NOBUILD_LIST} ${nut_doc_build_target}"
655 AC_MSG_CHECKING([if dblatex version can build ${nut_doc_build_target}])
656 AX_COMPARE_VERSION([${DBLATEX_VERSION}], [ge], [0.2.5], [
658 DOC_BUILD_LIST="${DOC_BUILD_LIST} ${nut_doc_build_target}"
661 DOC_NOBUILD_LIST="${DOC_NOBUILD_LIST} ${nut_doc_build_target}"
667 case "${nut_with_doc}" in
669 if test -n "${DOC_BUILD_LIST}"; then
678 if test -z "${DOC_NOBUILD_LIST}"; then
681 AC_MSG_ERROR(["Unable to build ${DOC_NOBUILD_LIST} documentation"])
686 AC_MSG_CHECKING([if asciidoc version can build website (minimum required 8.6.3)])
687 AX_COMPARE_VERSION([${ASCIIDOC_VERSION}], [ge], [8.6.3], [
689 nut_have_asciidoc="yes"
692 nut_have_asciidoc="no"
695 AC_MSG_CHECKING([if a2x version can build website (minimum required 8.6.3)])
696 AX_COMPARE_VERSION([${A2X_VERSION}], [ge], [8.6.3], [
700 nut_have_asciidoc="no"
703 NUT_REPORT_FEATURE([build and install documentation], [${nut_with_doc}], [],
704 [WITH_ASCIIDOC], [Define to enable Asciidoc support])
706 dnl Notes: we also keep HAVE_ASCIIDOC for implicit targets, such as manpage
708 AM_CONDITIONAL([HAVE_ASCIIDOC], [test "${nut_have_asciidoc}" = "yes"])
710 if test "${nut_with_doc}" = "yes"; then
711 NUT_REPORT([only build specific documentation format], [${DOC_BUILD_LIST}])
714 dnl ----------------------------------------------------------------------
715 dnl checks related to --with-dev
717 dnl We only init libtool there to allow AC_DISABLE_STATIC
720 dnl ${nut_with_dev}: any value except "yes" or "no" is treated as "auto".
721 if test "${nut_with_dev}" != "no"; then
726 AM_CONDITIONAL(WITH_DEV, test "${nut_with_dev}" = "yes")
727 NUT_REPORT_FEATURE([build and install the development files], [${nut_with_dev}], [],
728 [WITH_DEV], [Define to enable development files support])
730 dnl ----------------------------------------------------------------------
733 AC_MSG_CHECKING(state path)
734 AC_ARG_WITH(statepath,
735 AS_HELP_STRING([--with-statepath=PATH], [path for ups state files (/var/state/ups)]),
739 AC_MSG_ERROR(invalid option --with(out)-statepath - see docs/configure.txt)
742 STATEPATH="${withval}"
746 AC_DEFINE_UNQUOTED(STATEPATH, "${STATEPATH}", [Path for UPS driver state files])
747 AC_MSG_RESULT(${STATEPATH})
749 dnl ---------------------------------------------------------------------
750 dnl The 'alt pid path' is used by the drivers (via main.c) and upsd, since
751 dnl ideally they do not run as root and will not be able to write to the usual
752 dnl /var/run path. This defaults to the STATEPATH since they should be
753 dnl able to write there.
756 AC_MSG_CHECKING(alt pid path)
757 AC_ARG_WITH(altpidpath,
758 AS_HELP_STRING([--with-altpidpath=PATH], [path for driver/upsd .pid files (<statepath>)]),
762 AC_MSG_ERROR(invalid option --with(out)-altpidpath - see docs/configure.txt)
765 ALTPIDPATH="${withval}"
769 ALTPIDPATH="${STATEPATH}"
771 AC_DEFINE_UNQUOTED(ALTPIDPATH, "${ALTPIDPATH}", [Path for pid files of drivers and upsd (usually STATEPATH)])
772 AC_MSG_RESULT(${ALTPIDPATH})
774 AC_MSG_CHECKING(driver path)
776 AS_HELP_STRING([--with-drvpath=PATH], [where to install UPS drivers (EPREFIX/bin)]),
780 AC_MSG_ERROR(invalid option --with(out)-drvpath - see docs/configure.txt)
783 driverexecdir="${withval}"
787 conftemp="${driverexecdir}"
788 eval conftemp=\"${conftemp}\"
789 eval conftemp=\"${conftemp}\"
790 AC_DEFINE_UNQUOTED(DRVPATH, "${conftemp}", [Default path for UPS drivers])
791 AC_MSG_RESULT(${driverexecdir})
793 AC_MSG_CHECKING(cgi path)
795 AS_HELP_STRING([--with-cgipath=PATH], [where to install CGI programs (EPREFIX/cgi-bin)]),
799 AC_MSG_ERROR(invalid option --with(out)-cgipath - see docs/configure.txt)
802 cgiexecdir="${withval}"
806 conftemp="${cgiexecdir}"
807 eval conftemp=\"${conftemp}\"
808 eval conftemp=\"${conftemp}\"
809 AC_DEFINE_UNQUOTED(CGIPATH, "${conftemp}", [Default path for CGI programs])
810 AC_MSG_RESULT(${cgiexecdir})
812 AC_MSG_CHECKING(html path)
813 AC_ARG_WITH(htmlpath,
814 AS_HELP_STRING([--with-htmlpath=PATH], [where to install HTML files (PREFIX/html)]),
818 AC_MSG_ERROR(invalid option --with(out)-htmlpath - see docs/configure.txt)
825 conftemp="${htmldir}"
826 eval conftemp=\"${conftemp}\"
827 eval conftemp=\"${conftemp}\"
828 AC_DEFINE_UNQUOTED(HTMLPATH, "${conftemp}", [Default path for HTML files])
829 AC_MSG_RESULT(${htmldir})
831 AC_MSG_CHECKING(pidpath)
833 AS_HELP_STRING([--with-pidpath=PATH], [path for .pid files (/var/run)]),
837 AC_MSG_ERROR(invalid option --with(out)-pidpath - see docs/configure.txt)
844 AC_DEFINE_UNQUOTED(PIDPATH, "${PIDPATH}", [Path where the pid files should go])
845 AC_MSG_RESULT(${PIDPATH})
847 AC_MSG_CHECKING(network port number)
849 AS_HELP_STRING([--with-port=PORT], [port for network communications (3493)]),
853 AC_MSG_ERROR(invalid option --with(out)-port - see docs/configure.txt)
862 AC_DEFINE_UNQUOTED(PORT, ${PORT}, [Port for network communications])
863 AC_MSG_RESULT(${PORT})
865 AC_MSG_CHECKING(user to run as)
867 AS_HELP_STRING([--with-user=username], [user for programs started as root (nobody)]),
871 AC_MSG_ERROR(invalid option --with(out)-user - see docs/configure.txt)
874 RUN_AS_USER="${withval}"
881 AC_DEFINE_UNQUOTED(RUN_AS_USER, "${RUN_AS_USER}", [User to switch to if started as root])
882 AC_MSG_RESULT(${RUN_AS_USER})
884 AC_MSG_CHECKING(group membership of user to run as)
886 AS_HELP_STRING([--with-group=groupname], [group membership of user for programs started as root (nogroup)]),
890 AC_MSG_ERROR(invalid option --with(out)-group - see docs/configure.txt)
893 RUN_AS_GROUP="${withval}"
900 AC_DEFINE_UNQUOTED(RUN_AS_GROUP, "${RUN_AS_GROUP}", [Group membership of user to switch to if started as root])
901 AC_MSG_RESULT(${RUN_AS_GROUP})
903 dnl check that --with-user is given if --with-group is given.
904 if test "${nut_user_given}" = "yes" -a "${nut_group_given}" = "no"; then
905 AC_MSG_ERROR(["If you specify --with-user, you also must specify --with-group"])
906 elif test "${nut_user_given}" = "no" -a "${nut_group_given}" = "yes"; then
907 AC_MSG_ERROR(["If you specify --with-group, you also must specify --with-user"])
910 AC_MSG_CHECKING(facility for syslog)
911 AC_ARG_WITH(logfacility,
912 AS_HELP_STRING([--with-logfacility=FACILITY], [facility for log messages (LOG_DAEMON)]),
916 AC_MSG_ERROR(invalid option --with(out)-logfacility - see docs/configure.txt)
919 LOGFACILITY="${withval}"
923 LOGFACILITY="LOG_DAEMON"
925 AC_DEFINE_UNQUOTED(LOG_FACILITY, ${LOGFACILITY}, [Desired syslog facility - see syslog(3)])
926 AC_MSG_RESULT(${LOGFACILITY})
928 dnl Autoconf versions before 2.62 do not allow consecutive quadrigraphs,
929 dnl so the help string depends on the version used
930 AC_MSG_CHECKING(which drivers to build)
932 AS_HELP_STRING([m4_version_prereq(2.62,
933 [@<:@--with-drivers=driver@<:@,driver@:>@@:>@],
934 [[[[--with-drivers=driver@<:@,driver@:>@]]]])],
935 [Only build specific drivers (all)]),
939 AC_MSG_ERROR(invalid option --with(out)-drivers - see docs/configure.txt)
942 DRIVER_BUILD_LIST=`echo ${withval} | sed "s/,/ /g"`
943 AC_MSG_RESULT(${DRIVER_BUILD_LIST})
947 DRIVER_BUILD_LIST="all"
948 AC_MSG_RESULT(all available)
950 AM_CONDITIONAL(SOME_DRIVERS, test "${DRIVER_BUILD_LIST}" != "all")
952 if test "${DRIVER_BUILD_LIST}" != "all"; then
953 NUT_REPORT([only build specific drivers], [${DRIVER_BUILD_LIST}])
956 AC_MSG_CHECKING(which driver man pages to install)
957 if test "${DRIVER_BUILD_LIST}" = "all"; then
959 AC_MSG_RESULT(all available)
962 for i in ${DRIVER_BUILD_LIST}; do
963 if test -f ${srcdir}/docs/man/$i.8; then
964 DRIVER_MAN_LIST="${DRIVER_MAN_LIST} $i.8"
967 AC_MSG_RESULT(${DRIVER_MAN_LIST})
970 AC_MSG_CHECKING(whether to strip debug symbols)
972 AS_HELP_STRING([--enable-strip], [Strip debugging symbols from binaries (no)]),
980 CFLAGS="${CFLAGS} -s"
987 AC_MSG_CHECKING(whether to install pkg-config *.pc files)
988 AC_ARG_WITH(pkgconfig-dir,
989 AS_HELP_STRING([--with-pkgconfig-dir=PATH], [where to install pkg-config *.pc files (EPREFIX/lib/pkgconfig)]),
998 pkgconfigdir="${withval}"
1002 if test -n "${pkgconfigdir}"; then
1003 AC_MSG_RESULT(using ${pkgconfigdir})
1007 AM_CONDITIONAL(WITH_PKG_CONFIG, test -n "${pkgconfigdir}")
1010 systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd`
1011 AC_MSG_CHECKING(whether to install systemd files)
1012 AC_ARG_WITH([systemdsystemunitdir],
1013 AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files (auto)]),
1015 case "${withval}" in
1019 systemdsystemunitdir=""
1022 systemdsystemunitdir="${withval}"
1026 dnl Override installation directory, with the local installation
1027 dnl prefix. This is needed for 'distcheck*' targets, otherwise
1028 dnl files will try to get intalled to the actual system directories
1029 if test -n "${systemdsystemunitdir}"; then
1030 systemdsystemshutdowndir="${libdir}/systemd/system-shutdown"
1031 AC_MSG_RESULT(using ${systemdsystemunitdir})
1032 systemdsystemunitdir="`echo ${systemdsystemunitdir} | sed 's/\/lib/\${libdir}/'`"
1036 AM_CONDITIONAL(HAVE_SYSTEMD, test "$systemdsystemunitdir" != "")
1038 AC_MSG_CHECKING(whether to install hotplug rules)
1039 AC_ARG_WITH(hotplug-dir,
1040 AS_HELP_STRING([--with-hotplug-dir=PATH], [where to install hotplug rules (/etc/hotplug)]),
1042 case "${withval}" in
1044 if test -z "${hotplugdir}"; then
1046 AC_MSG_ERROR(["hotplug directory requested but not found"])
1055 hotplugdir="${withval}"
1059 if test -n "${hotplugdir}"; then
1060 AC_MSG_RESULT(using ${hotplugdir})
1064 AM_CONDITIONAL(WITH_HOTPLUG, test -n "${hotplugdir}")
1066 AC_MSG_CHECKING(whether to install udev rules)
1067 AC_ARG_WITH(udev-dir,
1068 AS_HELP_STRING([--with-udev-dir=PATH], [where to install udev rules (/lib/udev or /etc/udev)]),
1070 case "${withval}" in
1072 if test -z "${udevdir}"; then
1074 AC_MSG_ERROR(["udev directory requested but not found"])
1083 udevdir="${withval}"
1087 if test -n "${udevdir}"; then
1088 AC_MSG_RESULT(using ${udevdir})
1092 AM_CONDITIONAL(WITH_UDEV, test -n "${udevdir}")
1094 AC_PATH_PROGS([ASCIIDOC], [asciidoc], [none])
1095 AM_CONDITIONAL([MANUALUPDATE], [test "x$ASCIIDOC" != "xnone"])
1096 AC_PATH_PROGS([A2X], [a2x], [none])
1098 dnl check for spell checking deps
1099 AC_PATH_PROGS([ASPELL], [aspell], [none])
1100 AM_CONDITIONAL([HAVE_ASPELL], [test "x$ASPELL" != "xnone"])
1102 dnl expand ${sysconfdir} and write it out
1103 conftemp="${sysconfdir}"
1104 eval conftemp=\"${conftemp}\"
1105 eval conftemp=\"${conftemp}\"
1106 CONFPATH=${conftemp}
1107 AC_DEFINE_UNQUOTED(CONFPATH, "${conftemp}", [Default path for configuration files])
1109 dnl same for datadir
1110 conftemp="${datadir}"
1111 eval conftemp=\"${conftemp}\"
1112 eval conftemp=\"${conftemp}\"
1114 AC_DEFINE_UNQUOTED(DATADIR, "${conftemp}", [Default path for data files])
1117 conftemp="${bindir}"
1118 eval conftemp=\"${conftemp}\"
1119 eval conftemp=\"${conftemp}\"
1121 AC_DEFINE_UNQUOTED(BINDIR, "${conftemp}", [Default path for user executables])
1123 dnl same for sbindir
1124 conftemp="${sbindir}"
1125 eval conftemp=\"${conftemp}\"
1126 eval conftemp=\"${conftemp}\"
1128 AC_DEFINE_UNQUOTED(SBINDIR, "${conftemp}", [Default path for system executables])
1131 AC_SUBST(TREE_VERSION)
1132 AC_SUBST(NUT_NETVERSION)
1133 AC_SUBST(LIBSSL_CFLAGS)
1134 AC_SUBST(LIBSSL_LIBS)
1135 AC_SUBST(LIBGD_CFLAGS)
1136 AC_SUBST(LIBGD_LDFLAGS)
1137 AC_SUBST(LIBNETSNMP_CFLAGS)
1138 AC_SUBST(LIBNETSNMP_LIBS)
1139 AC_SUBST(LIBUSB_CFLAGS)
1140 AC_SUBST(LIBUSB_LIBS)
1141 AC_SUBST(LIBNEON_CFLAGS)
1142 AC_SUBST(LIBNEON_LIBS)
1143 AC_SUBST(LIBAVAHI_CFLAGS)
1144 AC_SUBST(LIBAVAHI_LIBS)
1145 AC_SUBST(LIBPOWERMAN_CFLAGS)
1146 AC_SUBST(LIBPOWERMAN_LIBS)
1147 AC_SUBST(LIBIPMI_CFLAGS)
1148 AC_SUBST(LIBIPMI_LIBS)
1149 AC_SUBST(DOC_BUILD_LIST)
1150 AC_SUBST(LIBWRAP_CFLAGS)
1151 AC_SUBST(LIBWRAP_LIBS)
1152 AC_SUBST(LIBLTDL_CFLAGS)
1153 AC_SUBST(LIBLTDL_LIBS)
1155 AC_SUBST(HAL_DEVICE_MATCH_KEY)
1156 AC_SUBST(HAL_FDI_PATH)
1157 AC_SUBST(HAL_CALLOUTS_PATH)
1158 AC_SUBST(LIBHAL_CFLAGS)
1159 AC_SUBST(LIBHAL_LIBS)
1160 AC_SUBST(DRIVER_BUILD_LIST)
1161 AC_SUBST(DRIVER_MAN_LIST)
1162 AC_SUBST(DRIVER_INSTALL_TARGET)
1172 AC_SUBST(RUN_AS_USER)
1173 AC_SUBST(RUN_AS_GROUP)
1174 AC_SUBST(SUN_LIBUSB)
1175 AC_SUBST(WORDS_BIGENDIAN)
1176 AC_SUBST(cgiexecdir)
1177 AC_SUBST(driverexecdir)
1179 AC_SUBST(pkgconfigdir)
1180 AC_SUBST(systemdsystemunitdir)
1181 AC_SUBST(systemdsystemshutdowndir)
1182 AC_SUBST(hotplugdir)
1189 conf/upsmon.conf.sample
1190 conf/upssched.conf.sample
1191 data/html/header.html
1197 docs/website/Makefile
1200 lib/libupsclient-config
1205 scripts/augeas/Makefile
1206 scripts/augeas/nutnutconf.aug
1207 scripts/augeas/nutupsconf.aug
1208 scripts/augeas/nutupsdconf.aug
1209 scripts/augeas/nutupsdusers.aug
1210 scripts/augeas/nutupsmonconf.aug
1211 scripts/augeas/nutupsschedconf.aug
1212 scripts/augeas/nuthostsconf.aug
1213 scripts/augeas/nutupssetconf.aug
1214 scripts/avahi/nut.service
1215 scripts/hal/Makefile
1216 scripts/hal/ups-nut-device.fdi
1217 scripts/hotplug/Makefile
1218 scripts/hotplug/libhidups
1219 scripts/HP-UX/nut.psf
1220 scripts/HP-UX/postinstall
1221 scripts/python/Makefile
1222 scripts/systemd/Makefile
1223 scripts/systemd/nut-driver.service
1224 scripts/systemd/nut-monitor.service
1225 scripts/systemd/nut-server.service
1226 scripts/systemd/nutshutdown
1227 scripts/Solaris/Makefile
1228 scripts/Solaris/pkginfo
1229 scripts/Solaris/postinstall
1230 scripts/Solaris/preremove
1232 scripts/udev/Makefile
1233 scripts/udev/nut-ipmipsu.rules
1234 scripts/udev/nut-usbups.rules
1235 scripts/ufw/nut.ufw.profile
1239 tools/nut-scanner/Makefile
1244 NUT_PRINT_FEATURE_REPORT