]> git.proxmox.com Git - mirror_smartmontools-debian.git/blob - configure.ac
import smartmontools 7.0
[mirror_smartmontools-debian.git] / configure.ac
1 #
2 # $Id: configure.ac 4319 2016-05-07 12:14:20Z chrfranke $
3 #
4 dnl Process this file with autoconf to produce a configure script.
5 AC_PREREQ([2.60])
6 AC_INIT(smartmontools, 6.6, smartmontools-support@lists.sourceforge.net)
7 AM_INIT_AUTOMAKE([1.10 foreign])
8
9 smartmontools_cvs_tag=`echo '$Id: configure.ac 4319 2016-05-07 12:14:20Z chrfranke $'`
10 smartmontools_release_date=2016-05-07
11 smartmontools_release_time="11:17:46 UTC"
12
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])
18
19 AC_CONFIG_SRCDIR([smartctl.cpp])
20 AC_CONFIG_HEADER([config.h])
21
22 AM_MAINTAINER_MODE
23
24 AC_LANG([C++])
25 dnl Checks for programs.
26 AC_PROG_CXX
27 AM_PROG_AS
28 AC_PROG_INSTALL
29
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])])
34 fi
35
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])
39
40 AC_CANONICAL_HOST
41 case "${host}" in
42 *-*-mingw*)
43 AC_CHECK_TOOL(WINDMC, [windmc])
44 AC_CHECK_TOOL(WINDRES, [windres])
45
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
51 MAKENSIS=makensis
52 fi
53 fi
54 AC_MSG_RESULT([${MAKENSIS:-no}])
55 ;;
56 esac
57
58 # Check for SVN.
59 AC_MSG_CHECKING([whether this is a build from SVN])
60 is_svn_build=no
61 svn_deps=
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'
68 fi
69 if test -n "$svn_deps"; then
70 is_svn_build=unknown
71 if (cd "$srcdir" && svn --version && svnversion && svn info) >/dev/null 2>&1; then
72 is_svn_build=yes
73 fi
74 fi
75 AC_SUBST([svn_deps])
76 AM_CONDITIONAL(IS_SVN_BUILD, [test "$is_svn_build" = "yes"])
77 AC_MSG_RESULT([$is_svn_build])
78
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)
82
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])]
102 )
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>
107 #endif
108 ])
109 dnl Check for Windows DDK and WMI header files
110 AC_CHECK_HEADERS([ntdddisk.h ddk/ntdddisk.h], [], [], [AC_INCLUDES_DEFAULT
111 #include <windows.h>
112 ])
113 AC_CHECK_HEADERS([wbemcli.h])
114
115 dnl Checks for typedefs, structures, and compiler characteristics.
116 AC_CHECK_TYPES([int64_t, uint64_t])
117
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"])
123
124 AC_CHECK_FUNCS([sigset])
125 AC_CHECK_FUNCS([strtoull])
126 AC_CHECK_FUNCS([uname])
127 AC_CHECK_FUNCS([clock_gettime ftime gettimeofday])
128
129 # Check byte ordering (defines WORDS_BIGENDIAN)
130 AC_C_BIGENDIAN
131
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))])
143 fi
144 AC_MSG_RESULT([$gcc_have_attr_packed])
145
146 AC_SUBST(CPPFLAGS)
147 AC_SUBST(LDFLAGS)
148 AC_SUBST(ASFLAGS)
149
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])
153
154 systemdsystemunitdir=
155 case "$with_systemdsystemunitdir" in
156 auto|yes)
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}])
161 fi
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 ;;
166 esac ;;
167 no) ;;
168 *) systemdsystemunitdir="$with_systemdsystemunitdir" ;;
169 esac
170 AC_SUBST(systemdsystemunitdir)
171 AM_CONDITIONAL(INSTALL_SYSTEMDUNIT, [test -n "$systemdsystemunitdir"])
172
173 AC_ARG_WITH(systemdenvfile,
174 [AS_HELP_STRING([--with-systemdenvfile@<:@=FILE|auto|yes|no@:>@], [Path of systemd EnvironmentFile [auto]])],
175 [], [with_systemdenvfile=auto])
176
177 systemdenvfile=
178 case "$with_systemdenvfile:$cross_compiling:$systemdsystemunitdir" in
179 auto:no:?*|yes:*:?*)
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
184 break
185 fi
186 done
187 AC_MSG_RESULT([${systemdenvfile:-no}])
188 case "$with_systemdenvfile:$systemdenvfile" in
189 yes:) AC_MSG_ERROR([Path of systemd EnvironmentFile not found]) ;;
190 esac ;;
191 auto:*|no:*) ;;
192 *:*:) AC_MSG_ERROR([Location of systemd service files not found]) ;;
193 *) systemdenvfile="$with_systemdenvfile"
194 esac
195 AC_SUBST(systemdenvfile)
196
197 AC_ARG_WITH(initscriptdir,
198 [AS_HELP_STRING([--with-initscriptdir@<:@=DIR|auto|yes|no@:>@], [Location of init scripts [auto]])],
199 [], [with_initscriptdir=auto])
200
201 initddir=
202 case "$with_initscriptdir:$cross_compiling:$systemdsystemunitdir" in
203 auto:no:|yes:*)
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
208 break
209 fi
210 done
211 AC_MSG_RESULT([${initddir:-no}])
212 case "$with_initscriptdir:$initddir" in
213 yes:) AC_MSG_ERROR([Location of init scripts not found]) ;;
214 esac ;;
215 auto:*|no:*) ;;
216 *) initddir="$with_initscriptdir" ;;
217 esac
218 AC_SUBST(initddir)
219 AM_CONDITIONAL(INSTALL_INITSCRIPT, [test -n "$initddir"])
220
221 # use different init script templates for different OS
222 case "${host}" in
223 *-*-freebsd*)
224 initdfile="smartd.freebsd.initd"
225 ;;
226 *-apple-darwin*)
227 initdfile="com.smartmontools.smartd.plist"
228 ;;
229 *)
230 initdfile="smartd.initd"
231 ;;
232 esac
233 AC_SUBST(initdfile)
234
235 AC_ARG_WITH(exampledir,
236 [AS_HELP_STRING([--with-exampledir=DIR], [Location of example scripts [DOCDIR/examplescripts]])],
237 [exampledir="$withval"], [exampledir='${docdir}/examplescripts'])
238 AC_SUBST(exampledir)
239
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])
244 AC_SUBST(drivedbdir)
245 AM_CONDITIONAL(ENABLE_DRIVEDB, [test -n "$drivedbdir"])
246
247 AC_ARG_WITH(update-smart_drivedb,
248 [AS_HELP_STRING([--with-update-smart-drivedb@<:@=yes|no@:>@], [Install update-smart-drivedb script [yes]])],
249 [], [with_update_smart_drivedb=yes])
250 test -n "$drivedbdir" || with_update_smart_drivedb=no
251 AC_SUBST(with_update_smart_drivedb)
252 AM_CONDITIONAL(ENABLE_UPDATE_SMART_DRIVEDB, [test "$with_update_smart_drivedb" = "yes"])
253
254 AC_ARG_WITH(smartdscriptdir,
255 [AS_HELP_STRING([--with-smartdscriptdir=DIR], [Location of smartd_warning.sh script [SYSCONFDIR]])],
256 [smartdscriptdir="$withval"], [smartdscriptdir='${sysconfdir}'])
257 AC_SUBST(smartdscriptdir)
258
259 AC_ARG_WITH(smartdplugindir,
260 [AS_HELP_STRING([--with-smartdplugindir=@<:@DIR|no@:>@],
261 [Location of smartd_warning.sh plugin scripts [SMARTDSCRIPTDIR/smartd_warning.d]])],
262 [smartdplugindir=; test "$withval" != "no" && smartdplugindir="$withval"],
263 [smartdplugindir='${smartdscriptdir}/smartd_warning.d'])
264 AC_SUBST(smartdplugindir)
265
266 savestates=
267 AC_ARG_WITH(savestates,
268 [AS_HELP_STRING([--with-savestates@<:@=PREFIX|yes|no@:>@],
269 [Enable default smartd state files [no] (yes=LOCALSTATEDIR/lib/smartmontools/smartd.)])],
270 [case "$withval" in yes) savestates='${localstatedir}/lib/${PACKAGE}/smartd.' ;;
271 no) ;; *) savestates="$withval" ;; esac])
272 savestatesdir="${savestates%/*}"
273 AC_SUBST(savestates)
274 AC_SUBST(savestatesdir)
275 AM_CONDITIONAL(ENABLE_SAVESTATES, [test -n "$savestates"])
276
277 attributelog=
278 AC_ARG_WITH(attributelog,
279 [AS_HELP_STRING([--with-attributelog@<:@=PREFIX|yes|no@:>@],
280 [Enable default smartd attribute log files [no] (yes=LOCALSTATEDIR/lib/smartmontools/attrlog.)])],
281 [case "$withval" in yes) attributelog='${localstatedir}/lib/${PACKAGE}/attrlog.' ;;
282 no) ;; *) attributelog="$withval" ;; esac])
283 attributelogdir="${attributelog%/*}"
284 AC_SUBST(attributelog)
285 AC_SUBST(attributelogdir)
286 AM_CONDITIONAL(ENABLE_ATTRIBUTELOG, [test -n "$attributelog"])
287
288 AC_ARG_ENABLE(sample,
289 [AS_HELP_STRING([--enable-sample], [Enables appending .sample to the installed smartd rc script and configuration file])],
290 [smartd_suffix=; test "$enableval" = "yes" && smartd_suffix=".sample"],
291 [smartd_suffix=;])
292 AC_SUBST(smartd_suffix)
293
294 AC_ARG_WITH(os-deps,
295 [AS_HELP_STRING([--with-os-deps='os_module.o ...'], [Specify OS dependent module(s) [guessed]])],
296 [ for x in $with_os_deps; do
297 case $x in
298 *.o) ;;
299 *) AC_MSG_ERROR([non-object file specified by --with-os-deps]) ;;
300 esac
301 done
302 ],[])
303
304 AC_ARG_WITH(selinux,
305 [AS_HELP_STRING([--with-selinux@<:@=yes|no@:>@], [Enables SELinux support [no]])],
306 [ if test "$withval" = "yes"; then
307 AC_CHECK_HEADERS([selinux/selinux.h], [], [AC_MSG_ERROR([Missing SELinux header files])])
308 AC_CHECK_LIB(selinux, matchpathcon, [], [AC_MSG_ERROR([Missing or incorrect SELinux library files])])
309 fi
310 ],[])
311 AC_SUBST(with_selinux)
312 if test "$with_selinux" = "yes"; then
313 AC_DEFINE(WITH_SELINUX, 1, [Define to 1 if SELinux support is enabled])
314 fi
315
316 AC_ARG_WITH(libcap-ng,
317 [AS_HELP_STRING([--with-libcap-ng@<:@=auto|yes|no@:>@], [Add Libcap-ng support to smartd [auto]])],
318 [], [with_libcap_ng=auto])
319
320 use_libcap_ng=no
321 if test "$with_libcap_ng" != "no"; then
322 AC_CHECK_LIB(cap-ng, capng_clear,
323 [AC_DEFINE(HAVE_LIBCAP_NG, 1, [Define to 1 if you have the `cap-ng' library (-lcap-ng).]) dnl `vim syntax
324 CAPNG_LDADD="-lcap-ng"; use_libcap_ng=yes])
325
326 if test "$use_libcap_ng" = "yes"; then
327 AC_CHECK_HEADER(cap-ng.h, [], [AC_MSG_ERROR([libcap-ng libraries found but headers are missing])])
328 elif test "$with_libcap_ng" = "yes"; then
329 AC_MSG_ERROR([libcap-ng support was requested but the library was not found])
330 fi
331 fi
332
333 AC_MSG_CHECKING([whether to use libcap-ng])
334 AC_SUBST(CAPNG_LDADD)
335 AC_MSG_RESULT([$use_libcap_ng])
336
337 # TODO: Remove when NVMe support is no longer EXPERIMENTAL
338 AC_ARG_WITH(nvme-devicescan,
339 [AS_HELP_STRING([--with-nvme-devicescan@<:@=yes|no@:>@],
340 [Include NVMe devices in smartd DEVICESCAN [no]])])
341 AC_SUBST(with_nvme_devicescan)
342 if test "$with_nvme_devicescan" = "yes"; then
343 AC_DEFINE(WITH_NVME_DEVICESCAN, 1, [Define to 1 to include NVMe devices in smartd DEVICESCAN.])
344 fi
345
346 AC_ARG_WITH(solaris-sparc-ata,
347 [AS_HELP_STRING([--with-solaris-sparc-ata@<:@=yes|no@:>@],
348 [Enable legacy ATA support on Solaris SPARC (requires os_solaris_ata.s from SVN repository) [no]])])
349
350 case "$host:$with_solaris_sparc_ata" in
351 sparc-*-solaris*:yes)
352 if test ! -f "$srcdir/os_solaris_ata.s"; then
353 AC_MSG_ERROR([Missing source file: $srcdir/os_solaris_ata.s
354 This file is no longer included in the source tarball but still
355 available in the SVN repository.])
356 fi
357 AC_DEFINE(WITH_SOLARIS_SPARC_ATA, 1, [Define to 1 to enable legacy ATA support on Solaris SPARC.])
358 ;;
359 esac
360
361 # Assume broken snprintf only on Windows with MSVCRT (MinGW without ANSI stdio support)
362 libc_have_working_snprintf=yes
363
364 case "$host" in
365 *-*-mingw*)
366 case " $CPPFLAGS $CXXFLAGS" in
367 *\ -[[DU]]__USE_MINGW_ANSI_STDIO*)
368 ;;
369 *)
370 # Older MinGW do not properly define PRI?64 if __USE_MINGW_ANSI_STDIO is set
371 # Newer MinGW set __USE_MINGW_ANSI_STDIO in first C++ include which may be too late
372 AC_MSG_CHECKING([whether __USE_MINGW_ANSI_STDIO is defined by C++ includes])
373 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
374 #undef __USE_MINGW_ANSI_STDIO
375 #include <iostream>
376 #ifndef __USE_MINGW_ANSI_STDIO
377 #error false
378 #endif]])],
379 [CXXFLAGS="-D__USE_MINGW_ANSI_STDIO $CXXFLAGS"],
380 [libc_have_working_snprintf=no])
381 AC_MSG_RESULT([$libc_have_working_snprintf])
382 ;;
383 esac ;;
384 esac
385
386 AC_ARG_WITH(working-snprintf,
387 [AS_HELP_STRING([--with-working-snprintf@<:@=yes|no@:>@],
388 [Function snprintf() handles output truncation as specified by C99 [MinGW:guessed,others:yes]])],
389 [libc_have_working_snprintf=$withval])
390
391 if test "$libc_have_working_snprintf" = "yes"; then
392 AC_DEFINE(HAVE_WORKING_SNPRINTF, 1, [Define to 1 if the `snprintf' function is sane.]) dnl `vim syntax
393 fi
394
395 os_win32_manifest=
396 case "$host" in
397 *-*-mingw*)
398 # Newer MinGW may add a default manifest
399 AC_MSG_CHECKING([whether $CC adds an application manifest])
400 cc_adds_manifest=no
401 AC_LINK_IFELSE([AC_LANG_PROGRAM()], [
402 if "$WINDRES" -O rc conftest.exe 2>/dev/null | grep '^1.*RT_MANIFEST' >/dev/null 2>&1; then
403 cc_adds_manifest=incomplete
404 # Manifest must provide a Win 10 compatibility ID
405 if "$WINDRES" -O rc conftest.exe 2>/dev/null | grep '{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}' >/dev/null 2>&1; then
406 cc_adds_manifest=yes
407 fi
408 fi],
409 [AC_MSG_ERROR([test compile failed])])
410 AC_MSG_RESULT([$cc_adds_manifest])
411 test "$cc_adds_manifest" = "yes" || os_win32_manifest='default.manifest.o'
412 ;;
413 esac
414
415 # TODO: Remove after smartmontools 6.5
416 AC_ARG_WITH(docdir,
417 [AS_HELP_STRING([--with-docdir=DIR], [(removed, use --docdir=DIR instead)])],
418 [AC_MSG_ERROR([--with-docdir is no longer supported, use --docdir instead])])
419 AC_ARG_ENABLE(drivedb,
420 [AS_HELP_STRING([--disable-drivedb], [(removed, use --without-drivedbdir instead)])])
421 AC_ARG_ENABLE(savestates,
422 [AS_HELP_STRING([--enable-savestates], [(removed, use --with-savestates@<:@=yes@:>@ instead)])])
423 AC_ARG_ENABLE(attributelog,
424 [AS_HELP_STRING([--enable-attributelog], [(removed, use --with-attributelog@<:@=yes@:>@ instead)])])
425 if test -n "${enable_drivedb+set}${enable_savestates+set}${enable_attributelog+set}"; then
426 AC_MSG_ERROR([Options --disable-drivedb, --enable-savestates, --enable-attributelog are no longer supported.
427 Use --without-drivedbdir, --with-savestates, --with-attributelog instead.])
428 fi
429
430
431 AC_SUBST(releaseversion,['${PACKAGE}-${VERSION}'])
432 AC_SUBST(smartmontools_release_date)
433 AC_SUBST(smartmontools_release_time)
434
435 # Set platform-specific modules and symbols
436 os_libs=
437 os_dltools='curl wget lynx svn'
438 os_mailer=mail
439 os_hostname="'hostname'"
440 os_dnsdomainname=
441 os_nisdomainname="'domainname'"
442 os_darwin=no
443 os_solaris=no
444 os_win32=no
445 os_win32_mingw=no
446 os_win64=no
447 os_man_filter=
448 case "${host}" in
449 *-*-linux*)
450 os_deps='os_linux.o cciss.o dev_areca.o'
451 os_dnsdomainname="'dnsdomainname' 'hostname -d'"
452 os_nisdomainname="'nisdomainname' 'hostname -y' 'domainname'"
453 os_man_filter=Linux
454 ;;
455 *-*-freebsd*|*-*-dragonfly*|*-*-kfreebsd*-gnu*)
456 os_deps='os_freebsd.o cciss.o dev_areca.o'
457 os_libs='-lcam'
458 os_dltools='curl wget lynx fetch svn'
459 AC_CHECK_LIB(usb, libusb20_dev_get_device_desc)
460 os_man_filter=FreeBSD
461 ;;
462 sparc-*-solaris*)
463 os_deps='os_solaris.o'
464 test "$with_solaris_sparc_ata" = "yes" \
465 && os_deps="$os_deps os_solaris_ata.o"
466 os_mailer='mailx'
467 os_solaris=yes
468 os_man_filter=Solaris
469 ;;
470 *-pc-solaris*)
471 os_deps='os_solaris.o'
472 os_mailer='mailx'
473 os_solaris=yes
474 os_man_filter=Solaris
475 ;;
476 *-*-netbsd*)
477 os_deps='os_netbsd.o'
478 os_libs='-lutil'
479 os_man_filter=NetBSD
480 ;;
481 *-*-openbsd*)
482 os_deps='os_openbsd.o'
483 os_libs='-lutil'
484 os_dltools='curl wget lynx ftp svn'
485 os_man_filter=OpenBSD
486 ;;
487 *-*-cygwin*)
488 os_deps='os_win32.o dev_areca.o'
489 os_mailer='email'
490 os_hostname="'hostname' 'echo "'"${HOSTNAME?unset}"'"'"
491 os_dnsdomainname="'dnsdomainname' 'hostname -d' 'echo "'"${USERDNSDOMAIN?unset}"'"'"
492 os_nisdomainname=
493 os_win32=yes
494 os_man_filter=Cygwin
495 ;;
496 x86_64-*-mingw*)
497 os_deps='os_win32.o dev_areca.o'
498 os_win32=yes
499 os_win32_mingw=yes
500 os_win64=yes
501 os_man_filter=Windows
502 ;;
503 *-*-mingw*)
504 os_deps='os_win32.o dev_areca.o'
505 os_win32=yes
506 os_win32_mingw=yes
507 os_man_filter=Windows
508 ;;
509 *-*-darwin*)
510 os_deps='os_darwin.o'
511 os_libs='-framework CoreFoundation -framework IOKit'
512 os_darwin=yes
513 os_man_filter=Darwin
514 ;;
515 *-*-nto-qnx*)
516 os_deps='os_qnxnto.o'
517 ;;
518 *)
519 os_deps='os_generic.o'
520 ;;
521 esac
522
523 # Replace if '--with-os-deps' was specified
524 test -z "$with_os_deps" || os_deps="$with_os_deps"
525
526 # Check if we need adapter to old interface (dev_legacy.cpp)
527 os_src=`echo "${os_deps}"|sed -n 's,^\([[^ .]]*\)\.o.*$,\1.cpp,p'`
528 AC_MSG_CHECKING([whether ${os_src} uses new interface])
529 if grep "smart_interface" "${srcdir}/${os_src}" >/dev/null 2>&1; then
530 os_new_interface=yes
531 else
532 os_new_interface=no
533 os_deps="${os_deps} dev_legacy.o"
534 AC_DEFINE(OLD_INTERFACE, 1, [Define to 1 if os_*.cpp still uses the old interface])
535 fi
536 AC_MSG_RESULT([$os_new_interface])
537
538 AC_SUBST([os_deps])
539 AC_SUBST([os_libs])
540 AC_SUBST([os_dltools])
541 AC_SUBST([os_mailer])
542 AC_SUBST([os_hostname])
543 AC_SUBST([os_dnsdomainname])
544 AC_SUBST([os_nisdomainname])
545 AC_SUBST([os_man_filter])
546 AC_SUBST([os_win32_manifest])
547
548 # Create drivedb.h update branch name from version: 5.41[.X] -> RELEASE_5_41_DRIVEDB
549 DRIVEDB_BRANCH=`echo $VERSION | sed 's,^\([[0-9]]*\.[[0-9]]*\)\..*$,\1,' \
550 | sed -n 's,^\([[0-9]][[0-9]]*\)\.\([[0-9]][[0-9]]*\)$,RELEASE_\1_\2_DRIVEDB,p'`
551 if test -z "$DRIVEDB_BRANCH"; then
552 AC_MSG_ERROR([Unable to create DRIVEDB_BRANCH from VERSION=$VERSION])
553 fi
554 AC_SUBST([DRIVEDB_BRANCH])
555
556 # Enable platform-specific makefile sections
557 AM_CONDITIONAL(OS_DARWIN, [test "$os_darwin" = "yes"])
558 AM_CONDITIONAL(OS_SOLARIS, [test "$os_solaris" = "yes"])
559 AM_CONDITIONAL(OS_WIN32, [test "$os_win32" = "yes"])
560 AM_CONDITIONAL(OS_WIN32_MINGW, [test "$os_win32_mingw" = "yes"])
561 AM_CONDITIONAL(OS_WIN32_NSIS, [test -n "$MAKENSIS"])
562 AM_CONDITIONAL(OS_WIN64, [test "$os_win64" = "yes"])
563
564 dnl Add -Wall and -W if using g++ and its not already specified.
565 if test "$GXX" = "yes"; then
566 if test -z "`echo "$CXXFLAGS" | grep "\-Wall" 2> /dev/null`" ; then
567 CXXFLAGS="$CXXFLAGS -Wall"
568 fi
569 # In the next line, do NOT delete the 2 spaces inside double quotes.
570 if test -z "`echo "$CXXFLAGS " | grep "\-W " 2> /dev/null`" ; then
571 CXXFLAGS="$CXXFLAGS -W"
572 fi
573
574 else
575 dnl We are NOT using gcc, so enable host-specific compiler flags
576 case "${host}" in
577 sparc*-*-solaris*)
578 dnl set CXXFLAGS for Solaris/SPARC C++ compiler
579 if test -z "`echo "$CXXFLAGS" | grep "\-xmemalign" 2> /dev/null`" ; then
580 dnl we have to tell the compilers about packed ATA structures
581 CXXFLAGS="-xmemalign=1i $CXXFLAGS"
582 fi
583 esac
584 case "${host}" in
585 *-*-solaris*)
586 if test -z "`echo "$CXXFLAGS" | grep "\-xO" 2> /dev/null`" ; then
587 dnl turn on optimization if user has not explicitly set its value
588 CXXFLAGS="-xO2 $CXXFLAGS"
589 fi
590 if test -z "`echo "$CXXFLAGS" | grep "\-erroff" 2> /dev/null`" ; then
591 dnl suppress trivial warnings
592 CXXFLAGS="-erroff=%none,wbadinitl,wbadasgl,badargtypel2w,badargtype2w $CXXFLAGS"
593 fi
594 esac
595 fi
596
597 AC_DEFINE_UNQUOTED(SMARTMONTOOLS_BUILD_HOST, "${host}", [smartmontools Build Host])
598
599 AC_SUBST(CXXFLAGS)
600
601 AC_CONFIG_FILES(Makefile)
602 AC_OUTPUT
603 AC_PROG_MAKE_SET
604
605 # Note: Use `...` here as some shells do not properly parse '$(... case $x in X) ...)'
606 info=`
607 echo "-----------------------------------------------------------------------------"
608 echo "${PACKAGE}-${VERSION} configuration:"
609 echo "host operating system: $host"
610 echo "C++ compiler: $CXX"
611 echo "C compiler: $CC"
612 echo "preprocessor flags: $CPPFLAGS"
613 echo "C++ compiler flags: $CXXFLAGS"
614 echo "C compiler flags: $CFLAGS"
615 echo "linker flags: $LDFLAGS"
616 echo "OS specific modules: $os_deps $os_libs $LIBS"
617
618 case "$host_os" in
619 mingw*)
620 echo "application manifest: ${os_win32_manifest:-built-in}"
621 echo "resource compiler: $WINDRES"
622 echo "message compiler: $WINDMC"
623 echo "NSIS compiler: $MAKENSIS"
624 if test -n "$drivedbdir"; then
625 echo "drive database file: EXEDIR/drivedb.h"
626 if test -n "$MAKENSIS"; then
627 echo "database update tool: EXEDIR/update-smart-drivedb.exe"
628 fi
629 else
630 echo "drive database file: [[disabled]]"
631 fi
632 if test -n "$savestates"; then
633 echo "smartd save files: \`eval eval eval echo $savestates\`MODEL-SERIAL.TYPE.state"
634 fi
635 if test -n "$attributelog"; then
636 echo "smartd attribute logs: \`eval eval eval echo $attributelog\`MODEL-SERIAL.TYPE.csv"
637 fi
638 echo "NVMe DEVICESCAN: ${with_nvme_devicescan-no}"
639 ;;
640
641 *)
642 echo "binary install path: \`eval eval eval echo $sbindir\`"
643 echo "man page install path: \`eval eval eval echo $mandir\`"
644 echo "doc file install path: \`eval eval eval echo $docdir\`"
645 echo "examples install path: \`eval eval eval echo $exampledir\`"
646 if test -n "$drivedbdir"; then
647 echo "drive database file: \`eval eval eval echo $drivedbdir\`/drivedb.h"
648 if test "$with_update_smart_drivedb" = "yes"; then
649 echo "database update script: \`eval eval eval echo $sbindir\`/update-smart-drivedb"
650 echo "download tools: \`eval eval eval echo $os_dltools\`"
651 else
652 echo "database update script: [[disabled]]"
653 fi
654 else
655 echo "drive database file: [[disabled]]"
656 fi
657 echo "local drive database: \`eval eval eval echo $sysconfdir\`/smart_drivedb.h"
658 echo "smartd config file: \`eval eval eval echo $sysconfdir\`/smartd.conf${smartd_suffix}"
659 echo "smartd warning script: \`eval eval eval echo $smartdscriptdir\`/smartd_warning.sh"
660 if test -n "$smartdplugindir"; then
661 echo "smartd plugin path: \`eval eval eval echo $smartdplugindir\`"
662 else
663 echo "smartd plugin path: [[disabled]]"
664 fi
665 if test -n "$initddir"; then
666 echo "smartd initd script: \`eval eval eval echo $initddir\`/${initdfile}"
667 elif test -z "$systemdsystemunitdir"; then
668 echo "smartd initd script: [[disabled]]"
669 fi
670 if test -n "$systemdsystemunitdir"; then
671 echo "smartd systemd file: \`eval eval eval echo $systemdsystemunitdir\`/smartd.service"
672 if test -n "$systemdenvfile"; then
673 echo "smartd environ file: \`eval eval eval echo $systemdenvfile\`"
674 else
675 echo "smartd environ file: [[disabled]]"
676 fi
677 fi
678 if test -n "$savestates"; then
679 echo "smartd save files: \`eval eval eval echo $savestates\`MODEL-SERIAL.TYPE.state"
680 else
681 echo "smartd save files: [[disabled]]"
682 fi
683 if test -n "$attributelog"; then
684 echo "smartd attribute logs: \`eval eval eval echo $attributelog\`MODEL-SERIAL.TYPE.csv"
685 else
686 echo "smartd attribute logs: [[disabled]]"
687 fi
688 echo "libcap-ng support: $use_libcap_ng"
689 case "$host_os" in
690 linux*) echo "SELinux support: ${with_selinux-no}" ;;
691 esac
692 case "$host_os" in
693 linux*|cygwin*) echo "NVMe DEVICESCAN: ${with_nvme_devicescan-no}" ;;
694 esac
695 ;;
696 esac
697 echo "-----------------------------------------------------------------------------"
698 `
699
700 AC_MSG_NOTICE([
701 $info
702 ])
703
704 # TODO: Remove when NVMe support is no longer EXPERIMENTAL
705 case "$host_os:${with_nvme_devicescan+set}" in
706 linux*:|cygwin*:|mingw*:)
707 AC_MSG_WARN([
708 This version of smartmontools provides NVMe support which is still
709 EXPERIMENTAL. NVMe devices are not yet included in smartd.conf
710 'DEVICESCAN' and 'smartctl --scan' unless '-d nvme' is specified.
711 Use option '--with-nvme-devicescan' to include NVMe devices.
712 Use option '--without-nvme-devicescan' to suppress this warning.])
713 ;;
714 esac
715
716 # TODO: Remove after smartmontools 6.5
717 case "$host:${with_solaris_sparc_ata+set}" in
718 sparc-*-solaris*:)
719 AC_MSG_WARN([
720 Legacy ATA support is no longer enabled by default on Solaris SPARC.
721 The required source file 'os_solaris_ata.s' is no longer included in
722 the source tarball but still available in the SVN repository.
723 Use option '--with-solaris-sparc-ata' to enable legacy ATA support.
724 Use option '--without-solaris-sparc-ata' to suppress this warning.])
725 ;;
726 esac