2 # $Id: configure.ac 4594 2017-11-05 15:21:35Z chrfranke $
4 dnl Process this file with autoconf to produce a configure script.
6 AC_INIT(smartmontools, 6.6, smartmontools-support@listi.jpberlin.de)
7 AM_INIT_AUTOMAKE([1.10 foreign])
9 smartmontools_cvs_tag=`echo '$Id: configure.ac 4594 2017-11-05 15:21:35Z chrfranke $'`
10 smartmontools_release_date=2017-11-05
11 smartmontools_release_time="15:20:58 UTC"
13 AC_DEFINE_UNQUOTED(SMARTMONTOOLS_CONFIGURE_ARGS, "$ac_configure_args", [smartmontools Configure Arguments])
14 AC_DEFINE_UNQUOTED(SMARTMONTOOLS_RELEASE_DATE, "$smartmontools_release_date", [smartmontools Release Date])
15 AC_DEFINE_UNQUOTED(SMARTMONTOOLS_RELEASE_TIME, "$smartmontools_release_time", [smartmontools Release Time])
16 AC_DEFINE_UNQUOTED(CONFIG_H_CVSID, "$smartmontools_cvs_tag", [smartmontools CVS Tag])
17 AC_DEFINE_UNQUOTED(PACKAGE_HOMEPAGE, "http://www.smartmontools.org/", [smartmontools Home Page])
19 AC_CONFIG_SRCDIR([smartctl.cpp])
20 AC_CONFIG_HEADER([config.h])
25 dnl Checks for programs.
30 m4_pattern_forbid([^PKG_PROG_])
31 if test "$cross_compiling" = "no"; then
32 m4_ifdef([PKG_PROG_PKG_CONFIG], [PKG_PROG_PKG_CONFIG],
33 [AC_MSG_WARN([m4/pkg.m4 missing, systemd detection disabled])])
36 AC_ARG_VAR(WINDMC, [Windows message compiler command])
37 AC_ARG_VAR(WINDRES, [Windows resource compiler command])
38 AC_ARG_VAR(MAKENSIS, [NSIS compiler command])
43 AC_CHECK_TOOL(WINDMC, [windmc])
44 AC_CHECK_TOOL(WINDRES, [windres])
46 AC_MSG_CHECKING([for makensis])
47 if test -z "$MAKENSIS"; then
48 if test -n "$PROGRAMFILES" && "$PROGRAMFILES/NSIS/makensis" -VERSION >/dev/null 2>&1; then
49 MAKENSIS="$PROGRAMFILES/NSIS/makensis"
50 elif makensis -VERSION >/dev/null 2>&1; then
54 AC_MSG_RESULT([${MAKENSIS:-no}])
59 AC_MSG_CHECKING([whether this is a build from SVN])
62 if test -f "$srcdir/.svn/wc.db"; then
63 # SVN 1.7, 1.8 working copy
64 svn_deps='${srcdir}/.svn/wc.db'
65 elif test -f "${srcdir}/.svn/entries"; then
66 # SVN <= 1.6 working copy (SVN 1.7 has empty entries file)
67 svn_deps='${srcdir}/.svn/entries'
69 if test -n "$svn_deps"; then
71 if (cd "$srcdir" && svn --version && svnversion && svn info) >/dev/null 2>&1; then
76 AM_CONDITIONAL(IS_SVN_BUILD, [test "$is_svn_build" = "yes"])
77 AC_MSG_RESULT([$is_svn_build])
79 # Note: On Linux, clock_gettime() requires -lrt which implies -lpthreads
80 # Check ommitted for now, gettimeofday() provides reasonable precision
81 # AC_SEARCH_LIBS(clock_gettime, rt)
83 dnl Checks for header files.
84 AC_CHECK_HEADERS([locale.h])
85 AC_CHECK_HEADERS([dev/ata/atavar.h])
86 dnl we need [u]int64_t and friends.
87 AC_CHECK_HEADERS([inttypes.h]) dnl C99, UNIX98, solaris 2.6+
88 AC_CHECK_HEADERS([stdint.h]) dnl C99
89 AC_CHECK_HEADERS([sys/inttypes.h]) dnl pre-UNIX98
90 AC_CHECK_HEADERS([sys/int_types.h]) dnl pre-UNIX98, solaris 2.6+
91 dnl Check for FreeBSD twe include files...currently missing on 5.2, but should be there
92 AC_CHECK_HEADERS([sys/tweio.h])
93 AC_CHECK_HEADERS([sys/twereg.h])
94 dnl Check for FreeBSD twa include files...
95 AC_CHECK_HEADERS([sys/tw_osl_ioctl.h])
96 dnl This header file is needed for cciss_ioctl.h at least on SuSE LINUX
97 AC_CHECK_HEADERS([linux/compiler.h])
98 dnl Check for the FreeBSD CCISS system header and use internal one if not found
99 AC_CHECK_HEADERS([dev/ciss/cissio.h],
100 [AC_DEFINE([CISS_LOCATION],[<dev/ciss/cissio.h>],[freebsd ciss header location])],
101 [AC_DEFINE([CISS_LOCATION],["cissio_freebsd.h"],[freebsd ciss header location])]
103 dnl Check for Linux CCISS include file
104 AC_CHECK_HEADERS([linux/cciss_ioctl.h], [], [], [AC_INCLUDES_DEFAULT
105 #ifdef HAVE_LINUX_COMPILER_H
106 # include <linux/compiler.h>
109 dnl Check for Windows DDK and WMI header files
110 AC_CHECK_HEADERS([ntdddisk.h ddk/ntdddisk.h], [], [], [AC_INCLUDES_DEFAULT
113 AC_CHECK_HEADERS([wbemcli.h])
115 dnl Checks for typedefs, structures, and compiler characteristics.
116 AC_CHECK_TYPES([int64_t, uint64_t])
118 dnl Checks for library functions.
119 AC_CHECK_FUNCS([getopt_long], [need_getopt_long=no], [need_getopt_long=yes])
120 AM_CONDITIONAL(NEED_GETOPT_LONG, [test "$need_getopt_long" = "yes"])
121 AC_CHECK_FUNCS([regcomp], [need_regex=no], [need_regex=yes])
122 AM_CONDITIONAL(NEED_REGEX, [test "$need_regex" = "yes"])
124 AC_CHECK_FUNCS([sigset])
125 AC_CHECK_FUNCS([strtoull])
126 AC_CHECK_FUNCS([uname])
127 AC_CHECK_FUNCS([clock_gettime ftime gettimeofday])
129 # Check byte ordering (defines WORDS_BIGENDIAN)
132 # check for __attribute__((packed))
133 # (sizeof() check is required to avoid false positives if other
134 # __attribute__((x)) are supported)
135 AC_MSG_CHECKING([whether $CXX supports __attribute__((packed))])
136 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [[
137 struct s { char a; short b; } __attribute__((packed));
138 typedef char t[sizeof(struct s) == 3 ? 1 : -1];]])],
139 [gcc_have_attr_packed=yes], [gcc_have_attr_packed=no])
140 AC_SUBST(gcc_have_attr_packed)
141 if test "$gcc_have_attr_packed" = "yes"; then
142 AC_DEFINE(HAVE_ATTR_PACKED, 1, [Define to 1 if C++ compiler supports __attribute__((packed))])
144 AC_MSG_RESULT([$gcc_have_attr_packed])
150 AC_ARG_WITH(systemdsystemunitdir,
151 [AS_HELP_STRING([--with-systemdsystemunitdir@<:@=DIR|auto|yes|no@:>@], [Location of systemd service files [auto]])],
152 [], [with_systemdsystemunitdir=auto])
154 systemdsystemunitdir=
155 case "$with_systemdsystemunitdir" in
157 if test -n "$PKG_CONFIG"; then
158 AC_MSG_CHECKING([for systemdsystemunitdir])
159 systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd 2>/dev/null`
160 AC_MSG_RESULT([${systemdsystemunitdir:-no}])
162 case "$with_systemdsystemunitdir:$sysconfdir:$systemdsystemunitdir" in
163 yes:*:) AC_MSG_ERROR([Location of systemd service files not found]) ;;
164 yes:*:*|auto:*:|auto:/etc:*) ;;
165 *) systemdsystemunitdir='${prefix}'$systemdsystemunitdir ;;
168 *) systemdsystemunitdir="$with_systemdsystemunitdir" ;;
170 AC_SUBST(systemdsystemunitdir)
171 AM_CONDITIONAL(INSTALL_SYSTEMDUNIT, [test -n "$systemdsystemunitdir"])
173 AC_ARG_WITH(systemdenvfile,
174 [AS_HELP_STRING([--with-systemdenvfile@<:@=FILE|auto|yes|no@:>@], [Path of systemd EnvironmentFile [auto]])],
175 [], [with_systemdenvfile=auto])
178 case "$with_systemdenvfile:$cross_compiling:$systemdsystemunitdir" in
180 AC_MSG_CHECKING([for path of systemd EnvironmentFile])
181 for dir in sysconfig default; do
182 if test -d /etc/$dir; then
183 systemdenvfile='${sysconfdir}'/$dir/smartmontools
187 AC_MSG_RESULT([${systemdenvfile:-no}])
188 case "$with_systemdenvfile:$systemdenvfile" in
189 yes:) AC_MSG_ERROR([Path of systemd EnvironmentFile not found]) ;;
192 *:*:) AC_MSG_ERROR([Location of systemd service files not found]) ;;
193 *) systemdenvfile="$with_systemdenvfile"
195 AC_SUBST(systemdenvfile)
197 AC_ARG_WITH(initscriptdir,
198 [AS_HELP_STRING([--with-initscriptdir@<:@=DIR|auto|yes|no@:>@], [Location of init scripts [auto]])],
199 [], [with_initscriptdir=auto])
202 case "$with_initscriptdir:$cross_compiling:$systemdsystemunitdir" in
204 AC_MSG_CHECKING([for init (rc) directory])
205 for dir in rc.d/init.d init.d rc.d; do
206 if test -d /etc/$dir; then
207 initddir='${sysconfdir}'/$dir
211 AC_MSG_RESULT([${initddir:-no}])
212 case "$with_initscriptdir:$initddir" in
213 yes:) AC_MSG_ERROR([Location of init scripts not found]) ;;
216 *) initddir="$with_initscriptdir" ;;
219 AM_CONDITIONAL(INSTALL_INITSCRIPT, [test -n "$initddir"])
221 # use different init script templates for different OS
224 initdfile="smartd.freebsd.initd"
227 initdfile="com.smartmontools.smartd.plist"
230 initdfile="smartd.initd"
235 AC_ARG_WITH(exampledir,
236 [AS_HELP_STRING([--with-exampledir=DIR], [Location of example scripts [DOCDIR/examplescripts]])],
237 [exampledir="$withval"], [exampledir='${docdir}/examplescripts'])
240 drivedbdir='${datadir}/${PACKAGE}'
241 AC_ARG_WITH(drivedbdir,
242 [AS_HELP_STRING([--with-drivedbdir@<:@=DIR|yes|no@:>@], [Location of drive database file [DATADIR/smartmontools]])],
243 [case "$withval" in yes) ;; no) drivedbdir= ;; *) drivedbdir="$withval" ;; esac])
245 AM_CONDITIONAL(ENABLE_DRIVEDB, [test -n "$drivedbdir"])
247 drivedb_version=$VERSION
248 AC_ARG_WITH(update-smart_drivedb,
249 [AS_HELP_STRING([--with-update-smart-drivedb@<:@=yes|no|X.Y@:>@],
250 [Install update-smart-drivedb script (and backport it to branches/RELEASE_X_Y_DRIVEDB) [yes]])],
253 5.4[[0-3]]|6.[[0-9]]) drivedb_version=$withval; with_update_smart_drivedb=yes ;;
254 *) AC_MSG_ERROR([Invalid drivedb branch version: $withval]) ;;
257 [with_update_smart_drivedb=yes])
258 test -n "$drivedbdir" || with_update_smart_drivedb=no
259 AC_SUBST(with_update_smart_drivedb)
260 AM_CONDITIONAL(ENABLE_UPDATE_SMART_DRIVEDB, [test "$with_update_smart_drivedb" = "yes"])
263 # Also check for '--with-gnupg[=yes]' because 'yes' is a valid command with infinite output
265 [AS_HELP_STRING([--with-gnupg@<:@=FILE|yes|no@:>@], [GnuPG used to verify drivedb.h [gpg]])],
266 [case "$withval" in yes) ;; no) gnupg= ;; *) gnupg="$withval" ;; esac], [])
269 case "$with_update_smart_drivedb:$gnupg" in
272 '--without-update-smart-drivedb' now requires '--without-gnupg'.
273 NEWS: update-smart-drivedb now verifies the downloaded drivedb.h file with GnuPG.])
277 AC_ARG_WITH(smartdscriptdir,
278 [AS_HELP_STRING([--with-smartdscriptdir=DIR], [Location of smartd_warning.sh script [SYSCONFDIR]])],
279 [smartdscriptdir="$withval"], [smartdscriptdir='${sysconfdir}'])
280 AC_SUBST(smartdscriptdir)
282 AC_ARG_WITH(smartdplugindir,
283 [AS_HELP_STRING([--with-smartdplugindir=@<:@DIR|no@:>@],
284 [Location of smartd_warning.sh plugin scripts [SMARTDSCRIPTDIR/smartd_warning.d]])],
285 [smartdplugindir=; test "$withval" != "no" && smartdplugindir="$withval"],
286 [smartdplugindir='${smartdscriptdir}/smartd_warning.d'])
287 AC_SUBST(smartdplugindir)
289 AC_ARG_WITH(scriptpath,
290 [AS_HELP_STRING([--with-scriptpath=@<:@PATH|no@:>@],
291 [PATH variable set within scripts [/usr/bin:/bin]])],
292 [scriptpath=; test "$withval" != "no" && scriptpath="$withval"],
293 [scriptpath="/usr/bin:/bin"])
295 AM_CONDITIONAL(ENABLE_SCRIPTPATH, [test -n "$scriptpath"])
298 AC_ARG_WITH(savestates,
299 [AS_HELP_STRING([--with-savestates@<:@=PREFIX|yes|no@:>@],
300 [Enable default smartd state files [no] (yes=LOCALSTATEDIR/lib/smartmontools/smartd.)])],
301 [case "$withval" in yes) savestates='${localstatedir}/lib/${PACKAGE}/smartd.' ;;
302 no) ;; *) savestates="$withval" ;; esac])
303 savestatesdir="${savestates%/*}"
305 AC_SUBST(savestatesdir)
306 AM_CONDITIONAL(ENABLE_SAVESTATES, [test -n "$savestates"])
309 AC_ARG_WITH(attributelog,
310 [AS_HELP_STRING([--with-attributelog@<:@=PREFIX|yes|no@:>@],
311 [Enable default smartd attribute log files [no] (yes=LOCALSTATEDIR/lib/smartmontools/attrlog.)])],
312 [case "$withval" in yes) attributelog='${localstatedir}/lib/${PACKAGE}/attrlog.' ;;
313 no) ;; *) attributelog="$withval" ;; esac])
314 attributelogdir="${attributelog%/*}"
315 AC_SUBST(attributelog)
316 AC_SUBST(attributelogdir)
317 AM_CONDITIONAL(ENABLE_ATTRIBUTELOG, [test -n "$attributelog"])
319 AC_ARG_ENABLE(sample,
320 [AS_HELP_STRING([--enable-sample], [Enables appending .sample to the installed smartd rc script and configuration file])],
321 [smartd_suffix=; test "$enableval" = "yes" && smartd_suffix=".sample"],
323 AC_SUBST(smartd_suffix)
326 [AS_HELP_STRING([--with-os-deps='os_module.o ...'], [Specify OS dependent module(s) [guessed]])],
327 [ for x in $with_os_deps; do
330 *) AC_MSG_ERROR([non-object file specified by --with-os-deps]) ;;
336 [AS_HELP_STRING([--with-selinux@<:@=yes|no@:>@], [Enables SELinux support [no]])],
337 [ if test "$withval" = "yes"; then
338 AC_CHECK_HEADERS([selinux/selinux.h], [], [AC_MSG_ERROR([Missing SELinux header files])])
339 AC_CHECK_LIB(selinux, matchpathcon, [], [AC_MSG_ERROR([Missing or incorrect SELinux library files])])
342 AC_SUBST(with_selinux)
343 if test "$with_selinux" = "yes"; then
344 AC_DEFINE(WITH_SELINUX, 1, [Define to 1 if SELinux support is enabled])
347 AC_ARG_WITH(libcap-ng,
348 [AS_HELP_STRING([--with-libcap-ng@<:@=auto|yes|no@:>@], [Add Libcap-ng support to smartd [auto]])],
349 [], [with_libcap_ng=auto])
352 if test "$with_libcap_ng" != "no"; then
353 AC_CHECK_LIB(cap-ng, capng_clear,
354 [AC_DEFINE(HAVE_LIBCAP_NG, 1, [Define to 1 if you have the `cap-ng' library (-lcap-ng).]) dnl `vim syntax
355 CAPNG_LDADD="-lcap-ng"; use_libcap_ng=yes])
357 if test "$use_libcap_ng" = "yes"; then
358 AC_CHECK_HEADER(cap-ng.h, [], [AC_MSG_ERROR([libcap-ng libraries found but headers are missing])])
359 elif test "$with_libcap_ng" = "yes"; then
360 AC_MSG_ERROR([libcap-ng support was requested but the library was not found])
364 AC_MSG_CHECKING([whether to use libcap-ng])
365 AC_SUBST(CAPNG_LDADD)
366 AC_MSG_RESULT([$use_libcap_ng])
368 # TODO: Remove when NVMe support is no longer EXPERIMENTAL
369 AC_ARG_WITH(nvme-devicescan,
370 [AS_HELP_STRING([--with-nvme-devicescan@<:@=yes|no@:>@],
371 [Include NVMe devices in smartd DEVICESCAN [no]])])
372 AC_SUBST(with_nvme_devicescan)
373 if test "$with_nvme_devicescan" = "yes"; then
374 AC_DEFINE(WITH_NVME_DEVICESCAN, 1, [Define to 1 to include NVMe devices in smartd DEVICESCAN.])
377 AC_ARG_WITH(solaris-sparc-ata,
378 [AS_HELP_STRING([--with-solaris-sparc-ata@<:@=yes|no@:>@],
379 [Enable legacy ATA support on Solaris SPARC (requires os_solaris_ata.s from SVN repository) [no]])])
381 case "$host:$with_solaris_sparc_ata" in
382 sparc-*-solaris*:yes)
383 if test ! -f "$srcdir/os_solaris_ata.s"; then
384 AC_MSG_ERROR([Missing source file: $srcdir/os_solaris_ata.s
385 This file is no longer included in the source tarball but still
386 available in the SVN repository.])
388 AC_DEFINE(WITH_SOLARIS_SPARC_ATA, 1, [Define to 1 to enable legacy ATA support on Solaris SPARC.])
392 # Assume broken snprintf only on Windows with MSVCRT (MinGW without ANSI stdio support)
393 libc_have_working_snprintf=yes
397 case " $CPPFLAGS $CXXFLAGS" in
398 *\ -[[DU]]__USE_MINGW_ANSI_STDIO*)
401 # Older MinGW do not properly define PRI?64 if __USE_MINGW_ANSI_STDIO is set
402 # Newer MinGW set __USE_MINGW_ANSI_STDIO in first C++ include which may be too late
403 AC_MSG_CHECKING([whether __USE_MINGW_ANSI_STDIO is defined by C++ includes])
404 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
405 #undef __USE_MINGW_ANSI_STDIO
407 #ifndef __USE_MINGW_ANSI_STDIO
410 [CXXFLAGS="-D__USE_MINGW_ANSI_STDIO $CXXFLAGS"],
411 [libc_have_working_snprintf=no])
412 AC_MSG_RESULT([$libc_have_working_snprintf])
417 AC_ARG_WITH(working-snprintf,
418 [AS_HELP_STRING([--with-working-snprintf@<:@=yes|no@:>@],
419 [Function snprintf() handles output truncation as specified by C99 [MinGW:guessed,others:yes]])],
420 [libc_have_working_snprintf=$withval])
422 if test "$libc_have_working_snprintf" = "yes"; then
423 AC_DEFINE(HAVE_WORKING_SNPRINTF, 1, [Define to 1 if the `snprintf' function is sane.]) dnl `vim syntax
426 AC_ARG_WITH(mingw-aslr,
427 [AS_HELP_STRING([--with-mingw-aslr@<:@=auto|yes|low|no@:>@], [Enable ASLR for MinGW executables [auto]])],
428 [], [with_mingw_aslr=auto])
430 case "$host:${LDFLAGS+set}" in
431 *-*-mingw*:) # MinGW defaults: link statically and indicate DEP and TS compatibility
432 LDFLAGS="-static -Wl,--nxcompat,--tsaware" ;;
435 case "$host:$with_mingw_aslr" in
436 x86_64-*-mingw*:auto)
437 AC_MSG_CHECKING([whether $CXX supports --high-entropy-va])
438 save_LDFLAGS=$LDFLAGS
439 LDFLAGS="$LDFLAGS -pie -Wl,--dynamicbase,-emainCRTStartup,--high-entropy-va,--image-base,0x140000000"
440 # Link libstdc++ to detect MinGW 6.3.0 problems with high --image-base
441 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
443 std::string s(42, '.');]])],
444 [with_mingw_aslr=yes], [with_mingw_aslr=no])
445 LDFLAGS=$save_LDFLAGS
446 AC_MSG_RESULT([$with_mingw_aslr])
447 test "$with_mingw_aslr" = "yes" || with_mingw_aslr=low
451 case "$host:$with_mingw_aslr" in
453 LDFLAGS="$LDFLAGS -pie -Wl,--dynamicbase,-emainCRTStartup,--high-entropy-va,--image-base,0x140000000" ;;
455 LDFLAGS="$LDFLAGS -pie -Wl,--dynamicbase,-emainCRTStartup" ;;
456 *-*-mingw*:auto|*-*-mingw*:yes|*-*-mingw*:low)
457 LDFLAGS="$LDFLAGS -pie -Wl,--dynamicbase,-e_mainCRTStartup" ;;
463 # Newer MinGW may add a default manifest
464 AC_MSG_CHECKING([whether $CXX adds an application manifest])
466 AC_LINK_IFELSE([AC_LANG_PROGRAM()], [
467 if "$WINDRES" -O rc conftest.exe 2>/dev/null | grep '^1.*RT_MANIFEST' >/dev/null 2>&1; then
468 cc_adds_manifest=incomplete
469 # Manifest must provide a Win 10 compatibility ID
470 if "$WINDRES" -O rc conftest.exe 2>/dev/null | grep '{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}' >/dev/null 2>&1; then
474 [AC_MSG_ERROR([test compile failed])])
475 AC_MSG_RESULT([$cc_adds_manifest])
476 test "$cc_adds_manifest" = "yes" || os_win32_manifest='os_win32/default.manifest'
480 AC_ARG_WITH(cxx11-option,
481 [AS_HELP_STRING([--with-cxx11-option@<:@=OPTION|auto|no@:>@],
482 [Compiler option to enable C++11 support for future versions of smartmontools, 'no' if unsupported [auto]])],
483 [], [with_cxx11_option=auto])
485 check_cxx11_support()
487 save_CXXFLAGS=$CXXFLAGS
489 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
490 #if __cplusplus < 201103L
493 // use some C++11 features (and return v * 42 :-)
494 auto cxx11(long v) noexcept -> decltype(v) {
495 typedef decltype(v) t; t r = v;
496 static const t a[] = { -7, -1, 1, 2, 3 };
497 static_assert(sizeof(r) == sizeof(a[0]), "fail");
498 auto f = [](t x, t y){ return x * y; };
499 for (const auto & e : a) r = f(r, e);
502 [CXXFLAGS=$save_CXXFLAGS; return 0], [CXXFLAGS=$save_CXXFLAGS; return 1])
505 case "$with_cxx11_option" in
508 AC_MSG_CHECKING([for $CXX option to accept C++11])
509 with_cxx11_option=unknown
510 for option in "" "-std=gnu++11" "-std=gnu++0x" "-std=c++11" "-std=c++0x"; do
511 if check_cxx11_support "$option"; then with_cxx11_option=$option; break; fi
513 AC_MSG_RESULT([${with_cxx11_option:-none needed}])
514 test "$with_cxx11_option" != "unknown" || AC_MSG_ERROR([
515 This version of smartmontools does not use C++11 features, but future
516 versions possibly will.
517 This script was unable to determine a compiler option to enable C++11.
518 Use option '--with-cxx11-option=OPTION' to specify the compiler option
519 (it will be checked, but not used in the actual build).
520 Use option '--without-cxx11-option' to suppress this error message if the
521 compiler lacks C++11 support.
522 In both cases, please send info about compiler and platform to
523 $PACKAGE_BUGREPORT - Thanks!])
526 AC_MSG_CHECKING([whether $CXX $with_cxx11_option accepts C++11])
527 res=no; check_cxx11_support "$with_cxx11_option" && res=yes
528 AC_MSG_RESULT([$res])
529 test "$res" = "yes" || AC_MSG_ERROR([$CXX $with_cxx11_option does not accept C++11])
534 AC_SUBST(releaseversion,['${PACKAGE}-${VERSION}'])
535 AC_SUBST(smartmontools_release_date)
536 AC_SUBST(smartmontools_release_time)
538 # Set platform-specific modules and symbols
540 os_dltools='curl wget lynx svn'
542 os_hostname="'hostname'"
544 os_nisdomainname="'domainname'"
553 os_deps='os_linux.o cciss.o dev_areca.o'
554 os_dnsdomainname="'dnsdomainname' 'hostname -d'"
555 os_nisdomainname="'nisdomainname' 'hostname -y' 'domainname'"
558 *-*-freebsd*|*-*-dragonfly*|*-*-kfreebsd*-gnu*)
559 os_deps='os_freebsd.o cciss.o dev_areca.o'
561 os_dltools='curl wget lynx fetch svn'
562 AC_CHECK_LIB(usb, libusb20_dev_get_device_desc)
563 os_man_filter=FreeBSD
566 os_deps='os_solaris.o'
567 test "$with_solaris_sparc_ata" = "yes" \
568 && os_deps="$os_deps os_solaris_ata.o"
571 os_man_filter=Solaris
574 os_deps='os_solaris.o'
577 os_man_filter=Solaris
580 os_deps='os_netbsd.o'
585 os_deps='os_openbsd.o'
587 os_dltools='curl wget lynx ftp svn'
588 os_man_filter=OpenBSD
591 os_deps='os_win32.o dev_areca.o'
593 os_hostname="'hostname' 'echo "'"${HOSTNAME?unset}"'"'"
594 os_dnsdomainname="'dnsdomainname' 'hostname -d' 'echo "'"${USERDNSDOMAIN?unset}"'"'"
600 os_deps='os_win32.o dev_areca.o'
604 os_man_filter=Windows
607 os_deps='os_win32.o dev_areca.o'
610 os_man_filter=Windows
613 os_deps='os_darwin.o'
614 os_libs='-framework CoreFoundation -framework IOKit'
619 os_deps='os_qnxnto.o'
625 os_deps='os_generic.o'
629 # Replace if '--with-os-deps' was specified
630 test -z "$with_os_deps" || os_deps="$with_os_deps"
632 # Check if we need adapter to old interface (dev_legacy.cpp)
633 os_src=`echo "${os_deps}"|sed -n 's,^\([[^ .]]*\)\.o.*$,\1.cpp,p'`
634 AC_MSG_CHECKING([whether ${os_src} uses new interface])
635 if grep "smart_interface" "${srcdir}/${os_src}" >/dev/null 2>&1; then
639 os_deps="${os_deps} dev_legacy.o"
640 AC_DEFINE(OLD_INTERFACE, 1, [Define to 1 if os_*.cpp still uses the old interface])
642 AC_MSG_RESULT([$os_new_interface])
646 AC_SUBST([os_dltools])
647 AC_SUBST([os_mailer])
648 AC_SUBST([os_hostname])
649 AC_SUBST([os_dnsdomainname])
650 AC_SUBST([os_nisdomainname])
651 AC_SUBST([os_man_filter])
652 AC_SUBST([os_win32_manifest])
654 # Create drivedb.h update branch name from version: 5.41[.X] -> RELEASE_5_41_DRIVEDB
655 DRIVEDB_BRANCH=`echo "$drivedb_version" | sed 's,^\([[0-9]]*\.[[0-9]]*\)\..*$,\1,' \
656 | sed -n 's,^\([[0-9]][[0-9]]*\)\.\([[0-9]][[0-9]]*\)$,RELEASE_\1_\2_DRIVEDB,p'`
657 if test -z "$DRIVEDB_BRANCH"; then
658 AC_MSG_ERROR([Unable to create DRIVEDB_BRANCH for version: $drivedb_version])
660 AC_SUBST([DRIVEDB_BRANCH])
662 # Enable platform-specific makefile sections
663 AM_CONDITIONAL(OS_DARWIN, [test "$os_darwin" = "yes"])
664 AM_CONDITIONAL(OS_SOLARIS, [test "$os_solaris" = "yes"])
665 AM_CONDITIONAL(OS_WIN32, [test "$os_win32" = "yes"])
666 AM_CONDITIONAL(OS_WIN32_MINGW, [test "$os_win32_mingw" = "yes"])
667 AM_CONDITIONAL(OS_WIN32_NSIS, [test -n "$MAKENSIS"])
668 AM_CONDITIONAL(OS_WIN64, [test "$os_win64" = "yes"])
670 if test "$GXX" = "yes"; then
671 # Add -Wall and -W[extra] if its not already specified
672 case " $CXXFLAGS " in
674 *) CXXFLAGS="$CXXFLAGS -Wall" ;;
676 case " $CXXFLAGS " in
677 *\ -W\ *|*\ -Wextra\ *) ;;
678 *) CXXFLAGS="$CXXFLAGS -W" ;;
680 # Add -Wformat=2 (GCC 3.0) -fstack-protector[-strong] (GCC 4.1[4.9]) if supported
681 # and CXXFLAGS was not set in configure cmdline (TODO: -Wformat-signedness)
682 case "${ac_test_CXXFLAGS+set}:$ac_test_CXXFLAGS" in
684 for option in "-Wformat=2" "-fstack-protector-strong" "-fstack-protector"; do
685 case " $CXXFLAGS:$option" in *\ -fstack-p*:-fstack-p*) continue ;; esac
686 AC_MSG_CHECKING([whether $CXX supports $option])
687 save_CXXFLAGS=$CXXFLAGS
688 CXXFLAGS="$CXXFLAGS $option"
689 AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [res=yes], [res=no; CXXFLAGS=$save_CXXFLAGS])
690 AC_MSG_RESULT([$res])
695 # We are NOT using gcc, so enable host-specific compiler flags
698 # Tell the Solaris/SPARC C++ compiler about packed ATA structures
701 *) CXXFLAGS="-xmemalign=1i $CXXFLAGS" ;;
706 # Turn on optimization if user has not explicitly set its value
709 *) CXXFLAGS="-xO2 $CXXFLAGS" ;;
711 # Suppress trivial warnings
714 *) CXXFLAGS="-erroff=%none,wbadinitl,wbadasgl,badargtypel2w,badargtype2w $CXXFLAGS" ;;
719 AC_DEFINE_UNQUOTED(SMARTMONTOOLS_BUILD_HOST, "${host}", [smartmontools Build Host])
723 AC_CONFIG_FILES(Makefile)
727 # Note: Use `...` here as some shells do not properly parse '$(... case $x in X) ...)'
729 echo "-----------------------------------------------------------------------------"
730 echo "${PACKAGE}-${VERSION} configuration:"
731 echo "host operating system: $host"
732 echo "C++ compiler: $CXX"
733 echo "C compiler: $CC"
734 echo "preprocessor flags: $CPPFLAGS"
735 echo "C++ compiler flags: $CXXFLAGS"
736 echo "C compiler flags: $CFLAGS"
737 echo "linker flags: $LDFLAGS"
738 echo "OS specific modules: $os_deps $os_libs $LIBS"
742 echo "application manifest: ${os_win32_manifest:-built-in}"
743 echo "resource compiler: $WINDRES"
744 echo "message compiler: $WINDMC"
745 echo "NSIS compiler: $MAKENSIS"
746 if test -n "$drivedbdir"; then
747 echo "drive database file: EXEDIR/drivedb.h"
748 if test -n "$MAKENSIS"; then
749 echo "database update tool: EXEDIR/update-smart-drivedb.exe"
752 echo "drive database file: [[disabled]]"
754 if test -n "$savestates"; then
755 echo "smartd save files: \`eval eval eval echo $savestates\`MODEL-SERIAL.TYPE.state"
757 if test -n "$attributelog"; then
758 echo "smartd attribute logs: \`eval eval eval echo $attributelog\`MODEL-SERIAL.TYPE.csv"
760 echo "NVMe DEVICESCAN: ${with_nvme_devicescan-no}"
764 echo "binary install path: \`eval eval eval echo $sbindir\`"
765 echo "man page install path: \`eval eval eval echo $mandir\`"
766 echo "doc file install path: \`eval eval eval echo $docdir\`"
767 echo "examples install path: \`eval eval eval echo $exampledir\`"
768 if test -n "$drivedbdir"; then
769 echo "drive database file: \`eval eval eval echo $drivedbdir\`/drivedb.h"
770 if test "$with_update_smart_drivedb" = "yes"; then
771 echo "database update script: \`eval eval eval echo $sbindir\`/update-smart-drivedb"
772 if test "$drivedb_version" != "$VERSION"; then
773 echo "... backported to: branches/$DRIVEDB_BRANCH"
775 echo "download tools: \`eval eval eval echo $os_dltools\`"
776 if test -n "$gnupg"; then
777 echo "GnuPG for verification: \`eval eval eval echo $gnupg\`"
779 echo "GnuPG for verification: [[disabled]]"
782 echo "database update script: [[disabled]]"
785 echo "drive database file: [[disabled]]"
787 echo "local drive database: \`eval eval eval echo $sysconfdir\`/smart_drivedb.h"
788 echo "smartd config file: \`eval eval eval echo $sysconfdir\`/smartd.conf${smartd_suffix}"
789 echo "smartd warning script: \`eval eval eval echo $smartdscriptdir\`/smartd_warning.sh"
790 if test -n "$smartdplugindir"; then
791 echo "smartd plugin path: \`eval eval eval echo $smartdplugindir\`"
793 echo "smartd plugin path: [[disabled]]"
795 if test -n "$scriptpath"; then
796 echo "PATH within scripts: \`eval eval eval echo $scriptpath\`"
798 echo "PATH within scripts: [[inherited]]"
800 if test -n "$initddir"; then
801 echo "smartd initd script: \`eval eval eval echo $initddir\`/${initdfile}"
802 elif test -z "$systemdsystemunitdir"; then
803 echo "smartd initd script: [[disabled]]"
805 if test -n "$systemdsystemunitdir"; then
806 echo "smartd systemd file: \`eval eval eval echo $systemdsystemunitdir\`/smartd.service"
807 if test -n "$systemdenvfile"; then
808 echo "smartd environ file: \`eval eval eval echo $systemdenvfile\`"
810 echo "smartd environ file: [[disabled]]"
813 if test -n "$savestates"; then
814 echo "smartd save files: \`eval eval eval echo $savestates\`MODEL-SERIAL.TYPE.state"
816 echo "smartd save files: [[disabled]]"
818 if test -n "$attributelog"; then
819 echo "smartd attribute logs: \`eval eval eval echo $attributelog\`MODEL-SERIAL.TYPE.csv"
821 echo "smartd attribute logs: [[disabled]]"
823 echo "libcap-ng support: $use_libcap_ng"
825 linux*) echo "SELinux support: ${with_selinux-no}" ;;
828 linux*|darwin*|netbsd*|cygwin*)
829 echo "NVMe DEVICESCAN: ${with_nvme_devicescan-no}" ;;
833 echo "-----------------------------------------------------------------------------"
840 # TODO: Remove when NVMe support is no longer EXPERIMENTAL
841 case "$host_os:${with_nvme_devicescan+set}" in
842 linux*:|darwin*:|netbsd*:|cygwin*:|mingw*:)
844 This version of smartmontools provides NVMe support which is still
845 EXPERIMENTAL. NVMe devices are not yet included in smartd.conf
846 'DEVICESCAN' and 'smartctl --scan' unless '-d nvme' is specified.
847 Use option '--with-nvme-devicescan' to include NVMe devices.
848 Use option '--without-nvme-devicescan' to suppress this warning.
853 # TODO: Remove after smartmontools 6.6
854 case "$host:${with_solaris_sparc_ata+set}" in
857 Legacy ATA support is no longer enabled by default on Solaris SPARC.
858 The required source file 'os_solaris_ata.s' is no longer included in
859 the source tarball but still available in the SVN repository.
860 Use option '--with-solaris-sparc-ata' to enable legacy ATA support.
861 Use option '--without-solaris-sparc-ata' to suppress this warning.