]> git.proxmox.com Git - mirror_smartmontools-debian.git/blob - configure.ac
Merge branch 'upstream' of git.debian.org:/git/collab-maint/smartmontools into upstream
[mirror_smartmontools-debian.git] / configure.ac
1 #
2 <<<<<<< HEAD
3 # $Id: configure.ac 4319 2016-05-07 12:14:20Z chrfranke $
4 =======
5 # $Id: configure.ac 4109 2015-06-04 16:30:15Z chrfranke $
6 >>>>>>> 3d8ad6fa4529eb02ae1391a1e937bf57aad3fb74
7 #
8 dnl Process this file with autoconf to produce a configure script.
9 AC_PREREQ([2.60])
10 AC_INIT(smartmontools, 6.6, smartmontools-support@lists.sourceforge.net)
11 AM_INIT_AUTOMAKE([1.10 foreign])
12
13 <<<<<<< HEAD
14 smartmontools_cvs_tag=`echo '$Id: configure.ac 4319 2016-05-07 12:14:20Z chrfranke $'`
15 smartmontools_release_date=2016-05-07
16 smartmontools_release_time="11:17:46 UTC"
17 =======
18 smartmontools_cvs_tag=`echo '$Id: configure.ac 4109 2015-06-04 16:30:15Z chrfranke $'`
19 smartmontools_release_date=2015-06-04
20 smartmontools_release_time="16:29:41 UTC"
21 >>>>>>> 3d8ad6fa4529eb02ae1391a1e937bf57aad3fb74
22
23 AC_DEFINE_UNQUOTED(SMARTMONTOOLS_CONFIGURE_ARGS, "$ac_configure_args", [smartmontools Configure Arguments])
24 AC_DEFINE_UNQUOTED(SMARTMONTOOLS_RELEASE_DATE, "$smartmontools_release_date", [smartmontools Release Date])
25 AC_DEFINE_UNQUOTED(SMARTMONTOOLS_RELEASE_TIME, "$smartmontools_release_time", [smartmontools Release Time])
26 AC_DEFINE_UNQUOTED(CONFIG_H_CVSID, "$smartmontools_cvs_tag", [smartmontools CVS Tag])
27 AC_DEFINE_UNQUOTED(PACKAGE_HOMEPAGE, "http://www.smartmontools.org/", [smartmontools Home Page])
28
29 AC_CONFIG_SRCDIR([smartctl.cpp])
30 AC_CONFIG_HEADER([config.h])
31
32 AM_MAINTAINER_MODE
33
34 AC_LANG([C++])
35 dnl Checks for programs.
36 AC_PROG_CXX
37 AM_PROG_AS
38 AC_PROG_INSTALL
39
40 m4_pattern_forbid([^PKG_PROG_])
41 if test "$cross_compiling" = "no"; then
42 m4_ifdef([PKG_PROG_PKG_CONFIG], [PKG_PROG_PKG_CONFIG],
43 [AC_MSG_WARN([m4/pkg.m4 missing, systemd detection disabled])])
44 fi
45
46 AC_ARG_VAR(WINDMC, [Windows message compiler command])
47 AC_ARG_VAR(WINDRES, [Windows resource compiler command])
48 AC_ARG_VAR(MAKENSIS, [NSIS compiler command])
49
50 AC_CANONICAL_HOST
51 case "${host}" in
52 *-*-mingw*)
53 AC_CHECK_TOOL(WINDMC, [windmc])
54 AC_CHECK_TOOL(WINDRES, [windres])
55
56 AC_MSG_CHECKING([for makensis])
57 if test -z "$MAKENSIS"; then
58 if test -n "$PROGRAMFILES" && "$PROGRAMFILES/NSIS/makensis" -VERSION >/dev/null 2>&1; then
59 MAKENSIS="$PROGRAMFILES/NSIS/makensis"
60 elif makensis -VERSION >/dev/null 2>&1; then
61 MAKENSIS=makensis
62 fi
63 fi
64 AC_MSG_RESULT([${MAKENSIS:-no}])
65 ;;
66 esac
67
68 # Check for SVN.
69 AC_MSG_CHECKING([whether this is a build from SVN])
70 is_svn_build=no
71 svn_deps=
72 if test -f "$srcdir/.svn/wc.db"; then
73 # SVN 1.7, 1.8 working copy
74 svn_deps='${srcdir}/.svn/wc.db'
75 elif test -f "${srcdir}/.svn/entries"; then
76 # SVN <= 1.6 working copy (SVN 1.7 has empty entries file)
77 svn_deps='${srcdir}/.svn/entries'
78 fi
79 if test -n "$svn_deps"; then
80 is_svn_build=unknown
81 if (cd "$srcdir" && svn --version && svnversion && svn info) >/dev/null 2>&1; then
82 is_svn_build=yes
83 fi
84 fi
85 AC_SUBST([svn_deps])
86 AM_CONDITIONAL(IS_SVN_BUILD, [test "$is_svn_build" = "yes"])
87 AC_MSG_RESULT([$is_svn_build])
88
89 # Note: On Linux, clock_gettime() requires -lrt which implies -lpthreads
90 # Check ommitted for now, gettimeofday() provides reasonable precision
91 # AC_SEARCH_LIBS(clock_gettime, rt)
92
93 dnl Checks for header files.
94 AC_CHECK_HEADERS([locale.h])
95 AC_CHECK_HEADERS([dev/ata/atavar.h])
96 dnl we need [u]int64_t and friends.
97 AC_CHECK_HEADERS([inttypes.h]) dnl C99, UNIX98, solaris 2.6+
98 AC_CHECK_HEADERS([stdint.h]) dnl C99
99 AC_CHECK_HEADERS([sys/inttypes.h]) dnl pre-UNIX98
100 AC_CHECK_HEADERS([sys/int_types.h]) dnl pre-UNIX98, solaris 2.6+
101 dnl Check for FreeBSD twe include files...currently missing on 5.2, but should be there
102 AC_CHECK_HEADERS([sys/tweio.h])
103 AC_CHECK_HEADERS([sys/twereg.h])
104 dnl Check for FreeBSD twa include files...
105 AC_CHECK_HEADERS([sys/tw_osl_ioctl.h])
106 dnl This header file is needed for cciss_ioctl.h at least on SuSE LINUX
107 AC_CHECK_HEADERS([linux/compiler.h])
108 dnl Check for the FreeBSD CCISS system header and use internal one if not found
109 AC_CHECK_HEADERS([dev/ciss/cissio.h],
110 [AC_DEFINE([CISS_LOCATION],[<dev/ciss/cissio.h>],[freebsd ciss header location])],
111 [AC_DEFINE([CISS_LOCATION],["cissio_freebsd.h"],[freebsd ciss header location])]
112 )
113 dnl Check for Linux CCISS include file
114 AC_CHECK_HEADERS([linux/cciss_ioctl.h], [], [], [AC_INCLUDES_DEFAULT
115 #ifdef HAVE_LINUX_COMPILER_H
116 # include <linux/compiler.h>
117 #endif
118 ])
119 dnl Check for Windows DDK and WMI header files
120 AC_CHECK_HEADERS([ntdddisk.h ddk/ntdddisk.h], [], [], [AC_INCLUDES_DEFAULT
121 #include <windows.h>
122 ])
123 AC_CHECK_HEADERS([wbemcli.h])
124
125 dnl Checks for typedefs, structures, and compiler characteristics.
126 AC_CHECK_TYPES([int64_t, uint64_t])
127
128 dnl Checks for library functions.
129 AC_CHECK_FUNCS([getopt_long], [need_getopt_long=no], [need_getopt_long=yes])
130 AM_CONDITIONAL(NEED_GETOPT_LONG, [test "$need_getopt_long" = "yes"])
131 AC_CHECK_FUNCS([regcomp], [need_regex=no], [need_regex=yes])
132 AM_CONDITIONAL(NEED_REGEX, [test "$need_regex" = "yes"])
133
134 AC_CHECK_FUNCS([sigset])
135 AC_CHECK_FUNCS([strtoull])
136 AC_CHECK_FUNCS([uname])
137 AC_CHECK_FUNCS([clock_gettime ftime gettimeofday])
138
139 # Check byte ordering (defines WORDS_BIGENDIAN)
140 AC_C_BIGENDIAN
141
142 # check for __attribute__((packed))
143 # (sizeof() check is required to avoid false positives if other
144 # __attribute__((x)) are supported)
145 AC_MSG_CHECKING([whether $CXX supports __attribute__((packed))])
146 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [[
147 struct s { char a; short b; } __attribute__((packed));
148 typedef char t[sizeof(struct s) == 3 ? 1 : -1];]])],
149 [gcc_have_attr_packed=yes], [gcc_have_attr_packed=no])
150 AC_SUBST(gcc_have_attr_packed)
151 if test "$gcc_have_attr_packed" = "yes"; then
152 AC_DEFINE(HAVE_ATTR_PACKED, 1, [Define to 1 if C++ compiler supports __attribute__((packed))])
153 fi
154 AC_MSG_RESULT([$gcc_have_attr_packed])
155
156 AC_SUBST(CPPFLAGS)
157 AC_SUBST(LDFLAGS)
158 AC_SUBST(ASFLAGS)
159
160 AC_ARG_WITH(systemdsystemunitdir,
161 [AS_HELP_STRING([--with-systemdsystemunitdir@<:@=DIR|auto|yes|no@:>@], [Location of systemd service files [auto]])],
162 [], [with_systemdsystemunitdir=auto])
163
164 systemdsystemunitdir=
165 case "$with_systemdsystemunitdir" in
166 auto|yes)
167 if test -n "$PKG_CONFIG"; then
168 AC_MSG_CHECKING([for systemdsystemunitdir])
169 systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd 2>/dev/null`
170 AC_MSG_RESULT([${systemdsystemunitdir:-no}])
171 fi
172 case "$with_systemdsystemunitdir:$sysconfdir:$systemdsystemunitdir" in
173 yes:*:) AC_MSG_ERROR([Location of systemd service files not found]) ;;
174 yes:*:*|auto:*:|auto:/etc:*) ;;
175 *) systemdsystemunitdir='${prefix}'$systemdsystemunitdir ;;
176 esac ;;
177 no) ;;
178 *) systemdsystemunitdir="$with_systemdsystemunitdir" ;;
179 esac
180 AC_SUBST(systemdsystemunitdir)
181 AM_CONDITIONAL(INSTALL_SYSTEMDUNIT, [test -n "$systemdsystemunitdir"])
182
183 AC_ARG_WITH(systemdenvfile,
184 [AS_HELP_STRING([--with-systemdenvfile@<:@=FILE|auto|yes|no@:>@], [Path of systemd EnvironmentFile [auto]])],
185 [], [with_systemdenvfile=auto])
186
187 systemdenvfile=
188 case "$with_systemdenvfile:$cross_compiling:$systemdsystemunitdir" in
189 auto:no:?*|yes:*:?*)
190 AC_MSG_CHECKING([for path of systemd EnvironmentFile])
191 for dir in sysconfig default; do
192 if test -d /etc/$dir; then
193 systemdenvfile='${sysconfdir}'/$dir/smartmontools
194 break
195 fi
196 done
197 AC_MSG_RESULT([${systemdenvfile:-no}])
198 case "$with_systemdenvfile:$systemdenvfile" in
199 yes:) AC_MSG_ERROR([Path of systemd EnvironmentFile not found]) ;;
200 esac ;;
201 auto:*|no:*) ;;
202 *:*:) AC_MSG_ERROR([Location of systemd service files not found]) ;;
203 *) systemdenvfile="$with_systemdenvfile"
204 esac
205 AC_SUBST(systemdenvfile)
206
207 AC_ARG_WITH(initscriptdir,
208 [AS_HELP_STRING([--with-initscriptdir@<:@=DIR|auto|yes|no@:>@], [Location of init scripts [auto]])],
209 [], [with_initscriptdir=auto])
210
211 initddir=
212 case "$with_initscriptdir:$cross_compiling:$systemdsystemunitdir" in
213 auto:no:|yes:*)
214 AC_MSG_CHECKING([for init (rc) directory])
215 for dir in rc.d/init.d init.d rc.d; do
216 if test -d /etc/$dir; then
217 initddir='${sysconfdir}'/$dir
218 break
219 fi
220 done
221 AC_MSG_RESULT([${initddir:-no}])
222 case "$with_initscriptdir:$initddir" in
223 yes:) AC_MSG_ERROR([Location of init scripts not found]) ;;
224 esac ;;
225 auto:*|no:*) ;;
226 *) initddir="$with_initscriptdir" ;;
227 esac
228 AC_SUBST(initddir)
229 AM_CONDITIONAL(INSTALL_INITSCRIPT, [test -n "$initddir"])
230
231 # use different init script templates for different OS
232 case "${host}" in
233 *-*-freebsd*)
234 initdfile="smartd.freebsd.initd"
235 ;;
236 *-apple-darwin*)
237 initdfile="com.smartmontools.smartd.plist"
238 ;;
239 *)
240 initdfile="smartd.initd"
241 ;;
242 esac
243 AC_SUBST(initdfile)
244
245 <<<<<<< HEAD
246 =======
247 autoconf_25x=${docdir:-yes}
248 AC_ARG_WITH(docdir,
249 [AS_HELP_STRING([--with-docdir=DIR], [Deprecated (use --docdir=DIR instead)])],
250 [docdir="$withval"],
251 [ if test -z "$docdir"; then
252 # autoconf 2.5x without '--docdir' support
253 docdir='${datadir}/doc/${PACKAGE}'
254 fi
255 ])
256 AC_SUBST(docdir)
257
258 >>>>>>> 3d8ad6fa4529eb02ae1391a1e937bf57aad3fb74
259 AC_ARG_WITH(exampledir,
260 [AS_HELP_STRING([--with-exampledir=DIR], [Location of example scripts [DOCDIR/examplescripts]])],
261 [exampledir="$withval"], [exampledir='${docdir}/examplescripts'])
262 AC_SUBST(exampledir)
263
264 <<<<<<< HEAD
265 drivedbdir='${datadir}/${PACKAGE}'
266 AC_ARG_WITH(drivedbdir,
267 [AS_HELP_STRING([--with-drivedbdir@<:@=DIR|yes|no@:>@], [Location of drive database file [DATADIR/smartmontools]])],
268 [case "$withval" in yes) ;; no) drivedbdir= ;; *) drivedbdir="$withval" ;; esac])
269 AC_SUBST(drivedbdir)
270 AM_CONDITIONAL(ENABLE_DRIVEDB, [test -n "$drivedbdir"])
271
272 AC_ARG_WITH(update-smart_drivedb,
273 [AS_HELP_STRING([--with-update-smart-drivedb@<:@=yes|no@:>@], [Install update-smart-drivedb script [yes]])],
274 [], [with_update_smart_drivedb=yes])
275 test -n "$drivedbdir" || with_update_smart_drivedb=no
276 AC_SUBST(with_update_smart_drivedb)
277 AM_CONDITIONAL(ENABLE_UPDATE_SMART_DRIVEDB, [test "$with_update_smart_drivedb" = "yes"])
278 =======
279 used_deprecated_option=no
280 AC_ARG_ENABLE(drivedb,
281 [AS_HELP_STRING([--disable-drivedb], [Deprecated (use --without-drivedbdir instead)])],
282 [used_deprecated_option=yes], [enable_drivedb=yes])
283
284 drivedbdir=
285 AC_ARG_WITH(drivedbdir,
286 [AS_HELP_STRING([--with-drivedbdir=@<:@DIR|no@:>@], [Location of drive database file [DATADIR/smartmontools]])],
287 [test "$withval" != "no" && drivedbdir="$withval"],
288 [test "$enable_drivedb" != "no" && drivedbdir='${datadir}/${PACKAGE}'])
289 AC_SUBST(drivedbdir)
290 AM_CONDITIONAL(ENABLE_DRIVEDB, [test -n "$drivedbdir"])
291 >>>>>>> 3d8ad6fa4529eb02ae1391a1e937bf57aad3fb74
292
293 AC_ARG_WITH(smartdscriptdir,
294 [AS_HELP_STRING([--with-smartdscriptdir=DIR], [Location of smartd_warning.sh script [SYSCONFDIR]])],
295 [smartdscriptdir="$withval"], [smartdscriptdir='${sysconfdir}'])
296 AC_SUBST(smartdscriptdir)
297
298 AC_ARG_WITH(smartdplugindir,
299 [AS_HELP_STRING([--with-smartdplugindir=@<:@DIR|no@:>@],
300 [Location of smartd_warning.sh plugin scripts [SMARTDSCRIPTDIR/smartd_warning.d]])],
301 [smartdplugindir=; test "$withval" != "no" && smartdplugindir="$withval"],
302 [smartdplugindir='${smartdscriptdir}/smartd_warning.d'])
303 AC_SUBST(smartdplugindir)
304
305 <<<<<<< HEAD
306 savestates=
307 AC_ARG_WITH(savestates,
308 [AS_HELP_STRING([--with-savestates@<:@=PREFIX|yes|no@:>@],
309 [Enable default smartd state files [no] (yes=LOCALSTATEDIR/lib/smartmontools/smartd.)])],
310 [case "$withval" in yes) savestates='${localstatedir}/lib/${PACKAGE}/smartd.' ;;
311 no) ;; *) savestates="$withval" ;; esac])
312 =======
313 AC_ARG_ENABLE(savestates,
314 [AS_HELP_STRING([--enable-savestates], [Deprecated (use --with-savestates@<:@=yes@:>@ instead)])],
315 [used_deprecated_option=yes], [enable_savestates=no])
316
317 savestates='${localstatedir}/lib/${PACKAGE}/smartd.'
318 AC_ARG_WITH(savestates,
319 [AS_HELP_STRING([--with-savestates@<:@=PREFIX|yes|no@:>@],
320 [Enable default smartd state files [no] (yes=LOCALSTATEDIR/lib/smartmontools/smartd.)])],
321 [case "$withval" in yes) ;; no) savestates= ;; *) savestates="$withval" ;; esac],
322 [test "$enable_savestates" != "yes" && savestates=])
323 >>>>>>> 3d8ad6fa4529eb02ae1391a1e937bf57aad3fb74
324 savestatesdir="${savestates%/*}"
325 AC_SUBST(savestates)
326 AC_SUBST(savestatesdir)
327 AM_CONDITIONAL(ENABLE_SAVESTATES, [test -n "$savestates"])
328 <<<<<<< HEAD
329
330 attributelog=
331 AC_ARG_WITH(attributelog,
332 [AS_HELP_STRING([--with-attributelog@<:@=PREFIX|yes|no@:>@],
333 [Enable default smartd attribute log files [no] (yes=LOCALSTATEDIR/lib/smartmontools/attrlog.)])],
334 [case "$withval" in yes) attributelog='${localstatedir}/lib/${PACKAGE}/attrlog.' ;;
335 no) ;; *) attributelog="$withval" ;; esac])
336 =======
337
338 AC_ARG_ENABLE(attributelog,
339 [AS_HELP_STRING([--enable-attributelog], [Deprecated (use --with-attributelog@<:@=yes@:>@ instead)])],
340 [used_deprecated_option=yes], [enable_attributelog=no])
341
342 attributelog='${localstatedir}/lib/${PACKAGE}/attrlog.'
343 AC_ARG_WITH(attributelog,
344 [AS_HELP_STRING([--with-attributelog@<:@=PREFIX|yes|no@:>@],
345 [Enable default smartd attribute log files [no] (yes=LOCALSTATEDIR/lib/smartmontools/attrlog.)])],
346 [case "$withval" in yes) ;; no) attributelog= ;; *) attributelog="$withval" ;; esac],
347 [test "$enable_attributelog" != "yes" && attributelog=])
348 >>>>>>> 3d8ad6fa4529eb02ae1391a1e937bf57aad3fb74
349 attributelogdir="${attributelog%/*}"
350 AC_SUBST(attributelog)
351 AC_SUBST(attributelogdir)
352 AM_CONDITIONAL(ENABLE_ATTRIBUTELOG, [test -n "$attributelog"])
353
354 AC_ARG_ENABLE(sample,
355 [AS_HELP_STRING([--enable-sample], [Enables appending .sample to the installed smartd rc script and configuration file])],
356 [smartd_suffix=; test "$enableval" = "yes" && smartd_suffix=".sample"],
357 [smartd_suffix=;])
358 AC_SUBST(smartd_suffix)
359
360 AC_ARG_WITH(os-deps,
361 [AS_HELP_STRING([--with-os-deps='os_module.o ...'], [Specify OS dependent module(s) [guessed]])],
362 [ for x in $with_os_deps; do
363 case $x in
364 *.o) ;;
365 *) AC_MSG_ERROR([non-object file specified by --with-os-deps]) ;;
366 esac
367 done
368 ],[])
369
370 AC_ARG_WITH(selinux,
371 [AS_HELP_STRING([--with-selinux@<:@=yes|no@:>@], [Enables SELinux support [no]])],
372 [ if test "$withval" = "yes"; then
373 AC_CHECK_HEADERS([selinux/selinux.h], [], [AC_MSG_ERROR([Missing SELinux header files])])
374 AC_CHECK_LIB(selinux, matchpathcon, [], [AC_MSG_ERROR([Missing or incorrect SELinux library files])])
375 fi
376 ],[])
377 AC_SUBST(with_selinux)
378 if test "$with_selinux" = "yes"; then
379 AC_DEFINE(WITH_SELINUX, 1, [Define to 1 if SELinux support is enabled])
380 fi
381
382 AC_ARG_WITH(libcap-ng,
383 [AS_HELP_STRING([--with-libcap-ng@<:@=auto|yes|no@:>@], [Add Libcap-ng support to smartd [auto]])],
384 [], [with_libcap_ng=auto])
385
386 use_libcap_ng=no
387 if test "$with_libcap_ng" != "no"; then
388 AC_CHECK_LIB(cap-ng, capng_clear,
389 [AC_DEFINE(HAVE_LIBCAP_NG, 1, [Define to 1 if you have the `cap-ng' library (-lcap-ng).]) dnl `vim syntax
390 CAPNG_LDADD="-lcap-ng"; use_libcap_ng=yes])
391
392 if test "$use_libcap_ng" = "yes"; then
393 AC_CHECK_HEADER(cap-ng.h, [], [AC_MSG_ERROR([libcap-ng libraries found but headers are missing])])
394 elif test "$with_libcap_ng" = "yes"; then
395 AC_MSG_ERROR([libcap-ng support was requested but the library was not found])
396 fi
397 fi
398
399 AC_MSG_CHECKING([whether to use libcap-ng])
400 AC_SUBST(CAPNG_LDADD)
401 AC_MSG_RESULT([$use_libcap_ng])
402
403 # TODO: Remove when NVMe support is no longer EXPERIMENTAL
404 AC_ARG_WITH(nvme-devicescan,
405 [AS_HELP_STRING([--with-nvme-devicescan@<:@=yes|no@:>@],
406 [Include NVMe devices in smartd DEVICESCAN [no]])])
407 AC_SUBST(with_nvme_devicescan)
408 if test "$with_nvme_devicescan" = "yes"; then
409 AC_DEFINE(WITH_NVME_DEVICESCAN, 1, [Define to 1 to include NVMe devices in smartd DEVICESCAN.])
410 fi
411
412 AC_ARG_WITH(solaris-sparc-ata,
413 [AS_HELP_STRING([--with-solaris-sparc-ata@<:@=yes|no@:>@],
414 [Enable legacy ATA support on Solaris SPARC (requires os_solaris_ata.s from SVN repository) [no]])])
415
416 case "$host:$with_solaris_sparc_ata" in
417 sparc-*-solaris*:yes)
418 if test ! -f "$srcdir/os_solaris_ata.s"; then
419 AC_MSG_ERROR([Missing source file: $srcdir/os_solaris_ata.s
420 This file is no longer included in the source tarball but still
421 available in the SVN repository.])
422 fi
423 AC_DEFINE(WITH_SOLARIS_SPARC_ATA, 1, [Define to 1 to enable legacy ATA support on Solaris SPARC.])
424 ;;
425 esac
426
427 # Assume broken snprintf only on Windows with MSVCRT (MinGW without ANSI stdio support)
428 libc_have_working_snprintf=yes
429
430 case "$host" in
431 *-*-mingw*)
432 case " $CPPFLAGS $CXXFLAGS" in
433 *\ -[[DU]]__USE_MINGW_ANSI_STDIO*)
434 ;;
435 *)
436 # Older MinGW do not properly define PRI?64 if __USE_MINGW_ANSI_STDIO is set
437 # Newer MinGW set __USE_MINGW_ANSI_STDIO in first C++ include which may be too late
438 AC_MSG_CHECKING([whether __USE_MINGW_ANSI_STDIO is defined by C++ includes])
439 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
440 #undef __USE_MINGW_ANSI_STDIO
441 #include <iostream>
442 #ifndef __USE_MINGW_ANSI_STDIO
443 #error false
444 #endif]])],
445 [CXXFLAGS="-D__USE_MINGW_ANSI_STDIO $CXXFLAGS"],
446 [libc_have_working_snprintf=no])
447 AC_MSG_RESULT([$libc_have_working_snprintf])
448 ;;
449 esac ;;
450 esac
451
452 AC_ARG_WITH(working-snprintf,
453 [AS_HELP_STRING([--with-working-snprintf@<:@=yes|no@:>@],
454 [Function snprintf() handles output truncation as specified by C99 [MinGW:guessed,others:yes]])],
455 [libc_have_working_snprintf=$withval])
456
457 if test "$libc_have_working_snprintf" = "yes"; then
458 AC_DEFINE(HAVE_WORKING_SNPRINTF, 1, [Define to 1 if the `snprintf' function is sane.]) dnl `vim syntax
459 fi
460
461 <<<<<<< HEAD
462 os_win32_manifest=
463 case "$host" in
464 *-*-mingw*)
465 # Newer MinGW may add a default manifest
466 AC_MSG_CHECKING([whether $CC adds an application manifest])
467 cc_adds_manifest=no
468 AC_LINK_IFELSE([AC_LANG_PROGRAM()], [
469 if "$WINDRES" -O rc conftest.exe 2>/dev/null | grep '^1.*RT_MANIFEST' >/dev/null 2>&1; then
470 cc_adds_manifest=incomplete
471 # Manifest must provide a Win 10 compatibility ID
472 if "$WINDRES" -O rc conftest.exe 2>/dev/null | grep '{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}' >/dev/null 2>&1; then
473 cc_adds_manifest=yes
474 fi
475 fi],
476 [AC_MSG_ERROR([test compile failed])])
477 AC_MSG_RESULT([$cc_adds_manifest])
478 test "$cc_adds_manifest" = "yes" || os_win32_manifest='default.manifest.o'
479 ;;
480 esac
481
482 # TODO: Remove after smartmontools 6.5
483 AC_ARG_WITH(docdir,
484 [AS_HELP_STRING([--with-docdir=DIR], [(removed, use --docdir=DIR instead)])],
485 [AC_MSG_ERROR([--with-docdir is no longer supported, use --docdir instead])])
486 AC_ARG_ENABLE(drivedb,
487 [AS_HELP_STRING([--disable-drivedb], [(removed, use --without-drivedbdir instead)])])
488 AC_ARG_ENABLE(savestates,
489 [AS_HELP_STRING([--enable-savestates], [(removed, use --with-savestates@<:@=yes@:>@ instead)])])
490 AC_ARG_ENABLE(attributelog,
491 [AS_HELP_STRING([--enable-attributelog], [(removed, use --with-attributelog@<:@=yes@:>@ instead)])])
492 if test -n "${enable_drivedb+set}${enable_savestates+set}${enable_attributelog+set}"; then
493 AC_MSG_ERROR([Options --disable-drivedb, --enable-savestates, --enable-attributelog are no longer supported.
494 Use --without-drivedbdir, --with-savestates, --with-attributelog instead.])
495 =======
496 if test "$prefix" = "NONE"; then
497 # Fix mandir default set by autoconf 2.5x
498 if test "$mandir" = '${prefix}/man'; then
499 AC_SUBST([mandir], ['${prefix}/share/man'])
500 fi
501 >>>>>>> 3d8ad6fa4529eb02ae1391a1e937bf57aad3fb74
502 fi
503
504
505 AC_SUBST(releaseversion,['${PACKAGE}-${VERSION}'])
506 AC_SUBST(smartmontools_release_date)
507 AC_SUBST(smartmontools_release_time)
508
509 # Set platform-specific modules and symbols
510 os_libs=
511 os_dltools='curl wget lynx svn'
512 os_mailer=mail
513 os_hostname="'hostname'"
514 os_dnsdomainname=
515 os_nisdomainname="'domainname'"
516 os_darwin=no
517 os_solaris=no
518 os_win32=no
519 os_win32_mingw=no
520 os_win64=no
521 os_man_filter=
522 case "${host}" in
523 *-*-linux*)
524 os_deps='os_linux.o cciss.o dev_areca.o'
525 os_dnsdomainname="'dnsdomainname' 'hostname -d'"
526 os_nisdomainname="'nisdomainname' 'hostname -y' 'domainname'"
527 os_man_filter=Linux
528 ;;
529 *-*-freebsd*|*-*-dragonfly*|*-*-kfreebsd*-gnu*)
530 os_deps='os_freebsd.o cciss.o dev_areca.o'
531 os_libs='-lcam'
532 os_dltools='curl wget lynx fetch svn'
533 AC_CHECK_LIB(usb, libusb20_dev_get_device_desc)
534 os_man_filter=FreeBSD
535 ;;
536 sparc-*-solaris*)
537 os_deps='os_solaris.o'
538 test "$with_solaris_sparc_ata" = "yes" \
539 && os_deps="$os_deps os_solaris_ata.o"
540 os_mailer='mailx'
541 os_solaris=yes
542 os_man_filter=Solaris
543 ;;
544 *-pc-solaris*)
545 os_deps='os_solaris.o'
546 os_mailer='mailx'
547 os_solaris=yes
548 os_man_filter=Solaris
549 ;;
550 *-*-netbsd*)
551 os_deps='os_netbsd.o'
552 os_libs='-lutil'
553 os_man_filter=NetBSD
554 ;;
555 *-*-openbsd*)
556 os_deps='os_openbsd.o'
557 os_libs='-lutil'
558 os_dltools='curl wget lynx ftp svn'
559 os_man_filter=OpenBSD
560 ;;
561 *-*-cygwin*)
562 os_deps='os_win32.o dev_areca.o'
563 os_mailer='email'
564 os_hostname="'hostname' 'echo "'"${HOSTNAME?unset}"'"'"
565 os_dnsdomainname="'dnsdomainname' 'hostname -d' 'echo "'"${USERDNSDOMAIN?unset}"'"'"
566 os_nisdomainname=
567 os_win32=yes
568 os_man_filter=Cygwin
569 ;;
570 x86_64-*-mingw*)
571 os_deps='os_win32.o dev_areca.o'
572 os_win32=yes
573 os_win32_mingw=yes
574 os_win64=yes
575 os_man_filter=Windows
576 ;;
577 *-*-mingw*)
578 os_deps='os_win32.o dev_areca.o'
579 os_win32=yes
580 os_win32_mingw=yes
581 os_man_filter=Windows
582 ;;
583 *-*-darwin*)
584 os_deps='os_darwin.o'
585 os_libs='-framework CoreFoundation -framework IOKit'
586 os_darwin=yes
587 os_man_filter=Darwin
588 ;;
589 *-*-nto-qnx*)
590 os_deps='os_qnxnto.o'
591 ;;
592 *)
593 os_deps='os_generic.o'
594 ;;
595 esac
596
597 # Replace if '--with-os-deps' was specified
598 test -z "$with_os_deps" || os_deps="$with_os_deps"
599
600 # Check if we need adapter to old interface (dev_legacy.cpp)
601 os_src=`echo "${os_deps}"|sed -n 's,^\([[^ .]]*\)\.o.*$,\1.cpp,p'`
602 AC_MSG_CHECKING([whether ${os_src} uses new interface])
603 if grep "smart_interface" "${srcdir}/${os_src}" >/dev/null 2>&1; then
604 os_new_interface=yes
605 else
606 os_new_interface=no
607 os_deps="${os_deps} dev_legacy.o"
608 AC_DEFINE(OLD_INTERFACE, 1, [Define to 1 if os_*.cpp still uses the old interface])
609 fi
610 AC_MSG_RESULT([$os_new_interface])
611
612 AC_SUBST([os_deps])
613 AC_SUBST([os_libs])
614 AC_SUBST([os_dltools])
615 AC_SUBST([os_mailer])
616 AC_SUBST([os_hostname])
617 AC_SUBST([os_dnsdomainname])
618 AC_SUBST([os_nisdomainname])
619 AC_SUBST([os_man_filter])
620 AC_SUBST([os_win32_manifest])
621
622 # Create drivedb.h update branch name from version: 5.41[.X] -> RELEASE_5_41_DRIVEDB
623 DRIVEDB_BRANCH=`echo $VERSION | sed 's,^\([[0-9]]*\.[[0-9]]*\)\..*$,\1,' \
624 | sed -n 's,^\([[0-9]][[0-9]]*\)\.\([[0-9]][[0-9]]*\)$,RELEASE_\1_\2_DRIVEDB,p'`
625 if test -z "$DRIVEDB_BRANCH"; then
626 AC_MSG_ERROR([Unable to create DRIVEDB_BRANCH from VERSION=$VERSION])
627 fi
628 AC_SUBST([DRIVEDB_BRANCH])
629
630 # Enable platform-specific makefile sections
631 AM_CONDITIONAL(OS_DARWIN, [test "$os_darwin" = "yes"])
632 AM_CONDITIONAL(OS_SOLARIS, [test "$os_solaris" = "yes"])
633 AM_CONDITIONAL(OS_WIN32, [test "$os_win32" = "yes"])
634 AM_CONDITIONAL(OS_WIN32_MINGW, [test "$os_win32_mingw" = "yes"])
635 AM_CONDITIONAL(OS_WIN32_NSIS, [test -n "$MAKENSIS"])
636 AM_CONDITIONAL(OS_WIN64, [test "$os_win64" = "yes"])
637
638 dnl Add -Wall and -W if using g++ and its not already specified.
639 if test "$GXX" = "yes"; then
640 if test -z "`echo "$CXXFLAGS" | grep "\-Wall" 2> /dev/null`" ; then
641 CXXFLAGS="$CXXFLAGS -Wall"
642 fi
643 # In the next line, do NOT delete the 2 spaces inside double quotes.
644 if test -z "`echo "$CXXFLAGS " | grep "\-W " 2> /dev/null`" ; then
645 CXXFLAGS="$CXXFLAGS -W"
646 fi
647
648 else
649 dnl We are NOT using gcc, so enable host-specific compiler flags
650 case "${host}" in
651 sparc*-*-solaris*)
652 dnl set CXXFLAGS for Solaris/SPARC C++ compiler
653 if test -z "`echo "$CXXFLAGS" | grep "\-xmemalign" 2> /dev/null`" ; then
654 dnl we have to tell the compilers about packed ATA structures
655 CXXFLAGS="-xmemalign=1i $CXXFLAGS"
656 fi
657 esac
658 case "${host}" in
659 *-*-solaris*)
660 if test -z "`echo "$CXXFLAGS" | grep "\-xO" 2> /dev/null`" ; then
661 dnl turn on optimization if user has not explicitly set its value
662 CXXFLAGS="-xO2 $CXXFLAGS"
663 fi
664 if test -z "`echo "$CXXFLAGS" | grep "\-erroff" 2> /dev/null`" ; then
665 dnl suppress trivial warnings
666 CXXFLAGS="-erroff=%none,wbadinitl,wbadasgl,badargtypel2w,badargtype2w $CXXFLAGS"
667 fi
668 esac
669 fi
670
671 AC_DEFINE_UNQUOTED(SMARTMONTOOLS_BUILD_HOST, "${host}", [smartmontools Build Host])
672
673 AC_SUBST(CXXFLAGS)
674
675 AC_CONFIG_FILES(Makefile)
676 AC_OUTPUT
677 AC_PROG_MAKE_SET
678
679 # Note: Use `...` here as some shells do not properly parse '$(... case $x in X) ...)'
680 info=`
681 echo "-----------------------------------------------------------------------------"
682 echo "${PACKAGE}-${VERSION} configuration:"
683 echo "host operating system: $host"
684 echo "C++ compiler: $CXX"
685 echo "C compiler: $CC"
686 echo "preprocessor flags: $CPPFLAGS"
687 echo "C++ compiler flags: $CXXFLAGS"
688 echo "C compiler flags: $CFLAGS"
689 echo "linker flags: $LDFLAGS"
690 echo "OS specific modules: $os_deps $os_libs $LIBS"
691
692 case "$host_os" in
693 mingw*)
694 echo "application manifest: ${os_win32_manifest:-built-in}"
695 echo "resource compiler: $WINDRES"
696 echo "message compiler: $WINDMC"
697 echo "NSIS compiler: $MAKENSIS"
698 if test -n "$drivedbdir"; then
699 echo "drive database file: EXEDIR/drivedb.h"
700 if test -n "$MAKENSIS"; then
701 echo "database update tool: EXEDIR/update-smart-drivedb.exe"
702 fi
703 else
704 echo "drive database file: [[disabled]]"
705 fi
706 if test -n "$savestates"; then
707 echo "smartd save files: \`eval eval eval echo $savestates\`MODEL-SERIAL.TYPE.state"
708 fi
709 if test -n "$attributelog"; then
710 echo "smartd attribute logs: \`eval eval eval echo $attributelog\`MODEL-SERIAL.TYPE.csv"
711 fi
712 echo "NVMe DEVICESCAN: ${with_nvme_devicescan-no}"
713 ;;
714
715 *)
716 echo "binary install path: \`eval eval eval echo $sbindir\`"
717 echo "man page install path: \`eval eval eval echo $mandir\`"
718 echo "doc file install path: \`eval eval eval echo $docdir\`"
719 echo "examples install path: \`eval eval eval echo $exampledir\`"
720 if test -n "$drivedbdir"; then
721 echo "drive database file: \`eval eval eval echo $drivedbdir\`/drivedb.h"
722 if test "$with_update_smart_drivedb" = "yes"; then
723 echo "database update script: \`eval eval eval echo $sbindir\`/update-smart-drivedb"
724 echo "download tools: \`eval eval eval echo $os_dltools\`"
725 else
726 echo "database update script: [[disabled]]"
727 fi
728 else
729 echo "drive database file: [[disabled]]"
730 fi
731 echo "local drive database: \`eval eval eval echo $sysconfdir\`/smart_drivedb.h"
732 echo "smartd config file: \`eval eval eval echo $sysconfdir\`/smartd.conf${smartd_suffix}"
733 echo "smartd warning script: \`eval eval eval echo $smartdscriptdir\`/smartd_warning.sh"
734 if test -n "$smartdplugindir"; then
735 echo "smartd plugin path: \`eval eval eval echo $smartdplugindir\`"
736 else
737 echo "smartd plugin path: [[disabled]]"
738 fi
739 if test -n "$initddir"; then
740 echo "smartd initd script: \`eval eval eval echo $initddir\`/${initdfile}"
741 elif test -z "$systemdsystemunitdir"; then
742 echo "smartd initd script: [[disabled]]"
743 fi
744 if test -n "$systemdsystemunitdir"; then
745 echo "smartd systemd file: \`eval eval eval echo $systemdsystemunitdir\`/smartd.service"
746 if test -n "$systemdenvfile"; then
747 echo "smartd environ file: \`eval eval eval echo $systemdenvfile\`"
748 else
749 echo "smartd environ file: [[disabled]]"
750 fi
751 fi
752 if test -n "$savestates"; then
753 echo "smartd save files: \`eval eval eval echo $savestates\`MODEL-SERIAL.TYPE.state"
754 else
755 echo "smartd save files: [[disabled]]"
756 fi
757 if test -n "$attributelog"; then
758 echo "smartd attribute logs: \`eval eval eval echo $attributelog\`MODEL-SERIAL.TYPE.csv"
759 else
760 echo "smartd attribute logs: [[disabled]]"
761 fi
762 echo "libcap-ng support: $use_libcap_ng"
763 case "$host_os" in
764 linux*) echo "SELinux support: ${with_selinux-no}" ;;
765 esac
766 case "$host_os" in
767 linux*|cygwin*) echo "NVMe DEVICESCAN: ${with_nvme_devicescan-no}" ;;
768 esac
769 ;;
770 esac
771 echo "-----------------------------------------------------------------------------"
772 `
773
774 AC_MSG_NOTICE([
775 $info
776 ])
777
778 # TODO: Remove when NVMe support is no longer EXPERIMENTAL
779 case "$host_os:${with_nvme_devicescan+set}" in
780 linux*:|cygwin*:|mingw*:)
781 AC_MSG_WARN([
782 This version of smartmontools provides NVMe support which is still
783 EXPERIMENTAL. NVMe devices are not yet included in smartd.conf
784 'DEVICESCAN' and 'smartctl --scan' unless '-d nvme' is specified.
785 Use option '--with-nvme-devicescan' to include NVMe devices.
786 Use option '--without-nvme-devicescan' to suppress this warning.])
787 ;;
788 esac
789
790 # TODO: Remove after smartmontools 6.5
791 case "$host:${with_solaris_sparc_ata+set}" in
792 sparc-*-solaris*:)
793 AC_MSG_WARN([
794 Legacy ATA support is no longer enabled by default on Solaris SPARC.
795 The required source file 'os_solaris_ata.s' is no longer included in
796 the source tarball but still available in the SVN repository.
797 Use option '--with-solaris-sparc-ata' to enable legacy ATA support.
798 Use option '--without-solaris-sparc-ata' to suppress this warning.])
799 ;;
800 esac
801 <<<<<<< HEAD
802 =======
803 echo "-----------------------------------------------------------------------------" >&AS_MESSAGE_FD
804
805 if test "$autoconf_25x" = "yes"; then
806 echo "WARNING:" >&AS_MESSAGE_FD
807 echo "Support for old autoconf 2.5x versions will be removed in a future" >&AS_MESSAGE_FD
808 echo "release of smartmontools." >&AS_MESSAGE_FD
809 elif test "${with_docdir+set}" = "set"; then
810 echo "WARNING:" >&AS_MESSAGE_FD
811 echo "Option --with-docdir is deprecated and will be removed in a future" >&AS_MESSAGE_FD
812 echo "release of smartmontools. Use --docdir instead." >&AS_MESSAGE_FD
813 fi
814
815 if test "$used_deprecated_option" = "yes"; then
816 echo "WARNING:" >&AS_MESSAGE_FD
817 echo "Options --disable-drivedb, --enable-savestates, --enable-attributelog are" >&AS_MESSAGE_FD
818 echo "deprecated and will be removed in a future release of smartmontools." >&AS_MESSAGE_FD
819 echo "Use --without-drivedb, --with-savestates, --with-attributelog instead." >&AS_MESSAGE_FD
820 fi
821 >>>>>>> 3d8ad6fa4529eb02ae1391a1e937bf57aad3fb74