]>
Commit | Line | Data |
---|---|---|
832b75ed | 1 | # |
ff28b140 | 2 | # $Id: configure.ac 4883 2018-12-30 14:48:54Z chrfranke $ |
832b75ed GG |
3 | # |
4 | dnl Process this file with autoconf to produce a configure script. | |
a86ec89e | 5 | AC_PREREQ([2.60]) |
ff28b140 | 6 | AC_INIT([smartmontools], [7.0], [smartmontools-support@listi.jpberlin.de]) |
a86ec89e | 7 | AM_INIT_AUTOMAKE([1.10 foreign]) |
832b75ed | 8 | |
ff28b140 TL |
9 | # Version of drive database branch |
10 | smartmontools_drivedb_version=7.0 | |
832b75ed | 11 | |
ff28b140 TL |
12 | smartmontools_cvs_tag=`echo '$Id: configure.ac 4883 2018-12-30 14:48:54Z chrfranke $'` |
13 | smartmontools_release_date=2018-12-30 | |
14 | smartmontools_release_time="14:47:55 UTC" | |
15 | ||
16 | AC_DEFINE_UNQUOTED(SMARTMONTOOLS_CONFIGURE_ARGS, "$ac_configure_args", [smartmontools Configure Arguments]) | |
17 | AC_DEFINE_UNQUOTED(SMARTMONTOOLS_RELEASE_DATE, "$smartmontools_release_date", [smartmontools Release Date]) | |
18 | AC_DEFINE_UNQUOTED(SMARTMONTOOLS_RELEASE_TIME, "$smartmontools_release_time", [smartmontools Release Time]) | |
19 | AC_DEFINE_UNQUOTED(CONFIG_H_CVSID, "$smartmontools_cvs_tag", [smartmontools CVS Tag]) | |
20 | AC_DEFINE_UNQUOTED(PACKAGE_HOMEPAGE, "https://www.smartmontools.org/", [smartmontools Home Page]) | |
832b75ed | 21 | |
a86ec89e | 22 | AC_CONFIG_SRCDIR([smartctl.cpp]) |
d2e702cf | 23 | AC_CONFIG_HEADER([config.h]) |
832b75ed | 24 | |
832b75ed GG |
25 | AM_MAINTAINER_MODE |
26 | ||
d2e702cf | 27 | AC_LANG([C++]) |
832b75ed | 28 | dnl Checks for programs. |
4d59bff9 | 29 | AC_PROG_CXX |
832b75ed GG |
30 | AM_PROG_AS |
31 | AC_PROG_INSTALL | |
d008864d GI |
32 | |
33 | m4_pattern_forbid([^PKG_PROG_]) | |
34 | if test "$cross_compiling" = "no"; then | |
35 | m4_ifdef([PKG_PROG_PKG_CONFIG], [PKG_PROG_PKG_CONFIG], | |
36 | [AC_MSG_WARN([m4/pkg.m4 missing, systemd detection disabled])]) | |
37 | fi | |
832b75ed | 38 | |
cfbba5b9 GI |
39 | AC_ARG_VAR(WINDMC, [Windows message compiler command]) |
40 | AC_ARG_VAR(WINDRES, [Windows resource compiler command]) | |
41 | AC_ARG_VAR(MAKENSIS, [NSIS compiler command]) | |
42 | ||
832b75ed | 43 | AC_CANONICAL_HOST |
832b75ed | 44 | case "${host}" in |
cfbba5b9 | 45 | *-*-mingw*) |
ee38a438 GI |
46 | AC_CHECK_TOOL(WINDMC, [windmc]) |
47 | AC_CHECK_TOOL(WINDRES, [windres]) | |
cfbba5b9 | 48 | |
d2e702cf | 49 | AC_MSG_CHECKING([for makensis]) |
cfbba5b9 GI |
50 | if test -z "$MAKENSIS"; then |
51 | if test -n "$PROGRAMFILES" && "$PROGRAMFILES/NSIS/makensis" -VERSION >/dev/null 2>&1; then | |
52 | MAKENSIS="$PROGRAMFILES/NSIS/makensis" | |
53 | elif makensis -VERSION >/dev/null 2>&1; then | |
54 | MAKENSIS=makensis | |
55 | fi | |
56 | fi | |
57 | AC_MSG_RESULT([${MAKENSIS:-no}]) | |
cfbba5b9 | 58 | ;; |
832b75ed GG |
59 | esac |
60 | ||
2127e193 GI |
61 | # Check for SVN. |
62 | AC_MSG_CHECKING([whether this is a build from SVN]) | |
63 | is_svn_build=no | |
e165493d | 64 | svn_deps= |
3d17a85c GI |
65 | if test -f "$srcdir/.svn/wc.db"; then |
66 | # SVN 1.7, 1.8 working copy | |
67 | svn_deps='${srcdir}/.svn/wc.db' | |
68 | elif test -f "${srcdir}/.svn/entries"; then | |
69 | # SVN <= 1.6 working copy (SVN 1.7 has empty entries file) | |
70 | svn_deps='${srcdir}/.svn/entries' | |
71 | fi | |
72 | if test -n "$svn_deps"; then | |
2127e193 GI |
73 | is_svn_build=unknown |
74 | if (cd "$srcdir" && svn --version && svnversion && svn info) >/dev/null 2>&1; then | |
75 | is_svn_build=yes | |
76 | fi | |
77 | fi | |
e165493d | 78 | AC_SUBST([svn_deps]) |
2127e193 GI |
79 | AM_CONDITIONAL(IS_SVN_BUILD, [test "$is_svn_build" = "yes"]) |
80 | AC_MSG_RESULT([$is_svn_build]) | |
81 | ||
e165493d | 82 | # Note: On Linux, clock_gettime() requires -lrt which implies -lpthreads |
ff28b140 | 83 | # Check omitted for now, gettimeofday() provides reasonable precision |
e165493d GI |
84 | # AC_SEARCH_LIBS(clock_gettime, rt) |
85 | ||
ff28b140 | 86 | # Checks for header files. |
832b75ed | 87 | AC_CHECK_HEADERS([locale.h]) |
ff28b140 TL |
88 | AC_CHECK_HEADERS([byteswap.h], [], [], []) |
89 | ||
90 | case "$host" in | |
91 | *-*-freebsd*|*-*-dragonfly*|*-*-kfreebsd*-gnu*) | |
92 | # Check for FreeBSD twe and twa include files | |
93 | AC_CHECK_HEADERS([sys/tweio.h sys/twereg.h sys/tw_osl_ioctl.h]) | |
94 | # Check for the FreeBSD CCISS system header and use internal one if not found | |
95 | AC_CHECK_HEADERS([dev/ciss/cissio.h], | |
96 | [AC_DEFINE([CISS_LOCATION],[<dev/ciss/cissio.h>],[freebsd ciss header location])], | |
97 | [AC_DEFINE([CISS_LOCATION],["cissio_freebsd.h"],[freebsd ciss header location])]) | |
98 | ;; | |
99 | *-*-linux*) | |
100 | # <linux/compiler.h> is needed for cciss_ioctl.h at least on SuSE LINUX | |
101 | AC_CHECK_HEADERS([sys/sysmacros.h linux/compiler.h]) | |
102 | # Check for Linux CCISS include file | |
103 | AC_CHECK_HEADERS([linux/cciss_ioctl.h], [], [], [AC_INCLUDES_DEFAULT | |
1953ff6d GG |
104 | #ifdef HAVE_LINUX_COMPILER_H |
105 | # include <linux/compiler.h> | |
106 | #endif | |
107 | ]) | |
ff28b140 TL |
108 | ;; |
109 | *-*-netbsd*|*-*-openbsd*) | |
110 | AC_CHECK_HEADERS([dev/ata/atavar.h]) | |
111 | ;; | |
112 | *-*-cygwin*|*-*-mingw*) | |
113 | # Check for Windows DDK header files | |
114 | AC_CHECK_HEADERS([ntdddisk.h ddk/ntdddisk.h], [], [], [AC_INCLUDES_DEFAULT | |
cfbba5b9 GI |
115 | #include <windows.h> |
116 | ]) | |
ff28b140 TL |
117 | ;; |
118 | esac | |
832b75ed | 119 | |
ff28b140 TL |
120 | # Checks for typedefs, and compiler characteristics. |
121 | AC_CHECK_TYPES([__int128]) | |
122 | AC_TYPE_LONG_DOUBLE_WIDER | |
832b75ed | 123 | |
ff28b140 | 124 | # Checks for library functions. |
e9583e0c GI |
125 | AC_CHECK_FUNCS([getopt_long], [need_getopt_long=no], [need_getopt_long=yes]) |
126 | AM_CONDITIONAL(NEED_GETOPT_LONG, [test "$need_getopt_long" = "yes"]) | |
2127e193 | 127 | |
e165493d | 128 | AC_CHECK_FUNCS([clock_gettime ftime gettimeofday]) |
832b75ed | 129 | |
e9583e0c GI |
130 | # Check byte ordering (defines WORDS_BIGENDIAN) |
131 | AC_C_BIGENDIAN | |
132 | ||
832b75ed | 133 | # check for __attribute__((packed)) |
d008864d GI |
134 | # (sizeof() check is required to avoid false positives if other |
135 | # __attribute__((x)) are supported) | |
7f0798ef | 136 | AC_MSG_CHECKING([whether $CXX supports __attribute__((packed))]) |
d008864d GI |
137 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [[ |
138 | struct s { char a; short b; } __attribute__((packed)); | |
139 | typedef char t[sizeof(struct s) == 3 ? 1 : -1];]])], | |
140 | [gcc_have_attr_packed=yes], [gcc_have_attr_packed=no]) | |
832b75ed GG |
141 | AC_SUBST(gcc_have_attr_packed) |
142 | if test "$gcc_have_attr_packed" = "yes"; then | |
cfbba5b9 | 143 | AC_DEFINE(HAVE_ATTR_PACKED, 1, [Define to 1 if C++ compiler supports __attribute__((packed))]) |
832b75ed GG |
144 | fi |
145 | AC_MSG_RESULT([$gcc_have_attr_packed]) | |
146 | ||
147 | AC_SUBST(CPPFLAGS) | |
148 | AC_SUBST(LDFLAGS) | |
149 | AC_SUBST(ASFLAGS) | |
150 | ||
d008864d | 151 | initddir= |
ff28b140 TL |
152 | AC_ARG_WITH(initscriptdir, |
153 | [AS_HELP_STRING([--with-initscriptdir=@<:@DIR|no@:>@], [Location of init scripts [no]])], | |
154 | [ case "$withval" in | |
155 | auto|yes) AC_MSG_ERROR(['--with-initscriptdir=$withval' is no longer supported]) ;; | |
156 | no) ;; | |
157 | *) initddir="$withval" ;; | |
158 | esac | |
159 | ]) | |
832b75ed | 160 | AC_SUBST(initddir) |
a7e8ffec GI |
161 | AM_CONDITIONAL(INSTALL_INITSCRIPT, [test -n "$initddir"]) |
162 | ||
163 | # use different init script templates for different OS | |
164 | case "${host}" in | |
165 | *-*-freebsd*) | |
166 | initdfile="smartd.freebsd.initd" | |
167 | ;; | |
a86ec89e GI |
168 | *-apple-darwin*) |
169 | initdfile="com.smartmontools.smartd.plist" | |
170 | ;; | |
ff28b140 TL |
171 | *-*-cygwin*) |
172 | initdfile="smartd.cygwin.initd" | |
173 | ;; | |
a7e8ffec GI |
174 | *) |
175 | initdfile="smartd.initd" | |
176 | ;; | |
177 | esac | |
178 | AC_SUBST(initdfile) | |
832b75ed | 179 | |
cfbba5b9 | 180 | AC_ARG_WITH(exampledir, |
d2e702cf | 181 | [AS_HELP_STRING([--with-exampledir=DIR], [Location of example scripts [DOCDIR/examplescripts]])], |
cfbba5b9 GI |
182 | [exampledir="$withval"], [exampledir='${docdir}/examplescripts']) |
183 | AC_SUBST(exampledir) | |
184 | ||
a86ec89e | 185 | drivedbdir='${datadir}/${PACKAGE}' |
2127e193 | 186 | AC_ARG_WITH(drivedbdir, |
a86ec89e GI |
187 | [AS_HELP_STRING([--with-drivedbdir@<:@=DIR|yes|no@:>@], [Location of drive database file [DATADIR/smartmontools]])], |
188 | [case "$withval" in yes) ;; no) drivedbdir= ;; *) drivedbdir="$withval" ;; esac]) | |
2127e193 | 189 | AC_SUBST(drivedbdir) |
a86ec89e GI |
190 | AM_CONDITIONAL(ENABLE_DRIVEDB, [test -n "$drivedbdir"]) |
191 | ||
ff28b140 | 192 | drivedb_version=$smartmontools_drivedb_version |
a86ec89e | 193 | AC_ARG_WITH(update-smart_drivedb, |
f9e10201 JD |
194 | [AS_HELP_STRING([--with-update-smart-drivedb@<:@=yes|no|X.Y@:>@], |
195 | [Install update-smart-drivedb script (and backport it to branches/RELEASE_X_Y_DRIVEDB) [yes]])], | |
196 | [ case "$withval" in | |
197 | yes|no) ;; | |
198 | 5.4[[0-3]]|6.[[0-9]]) drivedb_version=$withval; with_update_smart_drivedb=yes ;; | |
199 | *) AC_MSG_ERROR([Invalid drivedb branch version: $withval]) ;; | |
200 | esac | |
201 | ], | |
202 | [with_update_smart_drivedb=yes]) | |
a86ec89e GI |
203 | test -n "$drivedbdir" || with_update_smart_drivedb=no |
204 | AC_SUBST(with_update_smart_drivedb) | |
205 | AM_CONDITIONAL(ENABLE_UPDATE_SMART_DRIVEDB, [test "$with_update_smart_drivedb" = "yes"]) | |
2127e193 | 206 | |
f9e10201 JD |
207 | gnupg="gpg" |
208 | # Also check for '--with-gnupg[=yes]' because 'yes' is a valid command with infinite output | |
209 | AC_ARG_WITH(gnupg, | |
210 | [AS_HELP_STRING([--with-gnupg@<:@=FILE|yes|no@:>@], [GnuPG used to verify drivedb.h [gpg]])], | |
211 | [case "$withval" in yes) ;; no) gnupg= ;; *) gnupg="$withval" ;; esac], []) | |
212 | AC_SUBST(gnupg) | |
213 | ||
214 | case "$with_update_smart_drivedb:$gnupg" in | |
215 | no:?*) | |
216 | AC_MSG_ERROR([ | |
217 | '--without-update-smart-drivedb' now requires '--without-gnupg'. | |
218 | NEWS: update-smart-drivedb now verifies the downloaded drivedb.h file with GnuPG.]) | |
219 | ;; | |
220 | esac | |
221 | ||
d2e702cf GI |
222 | AC_ARG_WITH(smartdscriptdir, |
223 | [AS_HELP_STRING([--with-smartdscriptdir=DIR], [Location of smartd_warning.sh script [SYSCONFDIR]])], | |
224 | [smartdscriptdir="$withval"], [smartdscriptdir='${sysconfdir}']) | |
225 | AC_SUBST(smartdscriptdir) | |
226 | ||
227 | AC_ARG_WITH(smartdplugindir, | |
228 | [AS_HELP_STRING([--with-smartdplugindir=@<:@DIR|no@:>@], | |
229 | [Location of smartd_warning.sh plugin scripts [SMARTDSCRIPTDIR/smartd_warning.d]])], | |
230 | [smartdplugindir=; test "$withval" != "no" && smartdplugindir="$withval"], | |
231 | [smartdplugindir='${smartdscriptdir}/smartd_warning.d']) | |
232 | AC_SUBST(smartdplugindir) | |
233 | ||
f9e10201 JD |
234 | AC_ARG_WITH(scriptpath, |
235 | [AS_HELP_STRING([--with-scriptpath=@<:@PATH|no@:>@], | |
ff28b140 | 236 | [PATH variable set within scripts [/usr/local/bin:/usr/bin:/bin]])], |
f9e10201 | 237 | [scriptpath=; test "$withval" != "no" && scriptpath="$withval"], |
ff28b140 | 238 | [scriptpath="/usr/local/bin:/usr/bin:/bin"]) |
f9e10201 JD |
239 | AC_SUBST(scriptpath) |
240 | AM_CONDITIONAL(ENABLE_SCRIPTPATH, [test -n "$scriptpath"]) | |
241 | ||
a86ec89e | 242 | savestates= |
2127e193 | 243 | AC_ARG_WITH(savestates, |
a86ec89e GI |
244 | [AS_HELP_STRING([--with-savestates@<:@=PREFIX|yes|no@:>@], |
245 | [Enable default smartd state files [no] (yes=LOCALSTATEDIR/lib/smartmontools/smartd.)])], | |
246 | [case "$withval" in yes) savestates='${localstatedir}/lib/${PACKAGE}/smartd.' ;; | |
247 | no) ;; *) savestates="$withval" ;; esac]) | |
2127e193 GI |
248 | savestatesdir="${savestates%/*}" |
249 | AC_SUBST(savestates) | |
250 | AC_SUBST(savestatesdir) | |
a86ec89e | 251 | AM_CONDITIONAL(ENABLE_SAVESTATES, [test -n "$savestates"]) |
2127e193 | 252 | |
a86ec89e | 253 | attributelog= |
2127e193 | 254 | AC_ARG_WITH(attributelog, |
a86ec89e GI |
255 | [AS_HELP_STRING([--with-attributelog@<:@=PREFIX|yes|no@:>@], |
256 | [Enable default smartd attribute log files [no] (yes=LOCALSTATEDIR/lib/smartmontools/attrlog.)])], | |
257 | [case "$withval" in yes) attributelog='${localstatedir}/lib/${PACKAGE}/attrlog.' ;; | |
258 | no) ;; *) attributelog="$withval" ;; esac]) | |
2127e193 GI |
259 | attributelogdir="${attributelog%/*}" |
260 | AC_SUBST(attributelog) | |
261 | AC_SUBST(attributelogdir) | |
a86ec89e | 262 | AM_CONDITIONAL(ENABLE_ATTRIBUTELOG, [test -n "$attributelog"]) |
2127e193 | 263 | |
cfbba5b9 | 264 | AC_ARG_ENABLE(sample, |
d2e702cf | 265 | [AS_HELP_STRING([--enable-sample], [Enables appending .sample to the installed smartd rc script and configuration file])], |
cfbba5b9 GI |
266 | [smartd_suffix=; test "$enableval" = "yes" && smartd_suffix=".sample"], |
267 | [smartd_suffix=;]) | |
832b75ed | 268 | AC_SUBST(smartd_suffix) |
832b75ed | 269 | |
ff28b140 TL |
270 | AC_ARG_ENABLE([scsi-cdb-check], |
271 | [AS_HELP_STRING([--enable-scsi-cdb-check], [do sanity check on each SCSI cdb])], | |
272 | [ if test "$enableval" = "yes"; then | |
273 | AC_DEFINE(SCSI_CDB_CHECK, 1, [Define to 1 to enable check on each SCSI cdb]) | |
274 | fi | |
275 | ],[]) | |
276 | ||
277 | AC_ARG_ENABLE([fast-lebe], | |
278 | [AS_HELP_STRING([--disable-fast-lebe], [use generic little-endian/big-endian code instead])], | |
279 | [ if test "$enableval" = "no"; then | |
280 | AC_DEFINE(IGNORE_FAST_LEBE, 1, [Define to 1 to use generic LE/BE code instead]) | |
281 | fi | |
282 | ],[]) | |
283 | ||
2127e193 | 284 | AC_ARG_WITH(os-deps, |
d2e702cf | 285 | [AS_HELP_STRING([--with-os-deps='os_module.o ...'], [Specify OS dependent module(s) [guessed]])], |
2127e193 GI |
286 | [ for x in $with_os_deps; do |
287 | case $x in | |
288 | *.o) ;; | |
289 | *) AC_MSG_ERROR([non-object file specified by --with-os-deps]) ;; | |
290 | esac | |
291 | done | |
292 | ],[]) | |
293 | ||
cfbba5b9 | 294 | AC_ARG_WITH(selinux, |
d2e702cf | 295 | [AS_HELP_STRING([--with-selinux@<:@=yes|no@:>@], [Enables SELinux support [no]])], |
cfbba5b9 GI |
296 | [ if test "$withval" = "yes"; then |
297 | AC_CHECK_HEADERS([selinux/selinux.h], [], [AC_MSG_ERROR([Missing SELinux header files])]) | |
298 | AC_CHECK_LIB(selinux, matchpathcon, [], [AC_MSG_ERROR([Missing or incorrect SELinux library files])]) | |
299 | fi | |
300 | ],[]) | |
2127e193 | 301 | |
a23d5117 | 302 | AC_ARG_WITH(libcap-ng, |
d2e702cf | 303 | [AS_HELP_STRING([--with-libcap-ng@<:@=auto|yes|no@:>@], [Add Libcap-ng support to smartd [auto]])], |
a7e8ffec | 304 | [], [with_libcap_ng=auto]) |
a23d5117 GI |
305 | |
306 | use_libcap_ng=no | |
ff28b140 TL |
307 | case "$with_libcap_ng:$host_os" in |
308 | auto:linux*|yes:*) | |
309 | AC_CHECK_HEADERS([cap-ng.h], [AC_CHECK_LIB([cap-ng], [capng_clear], | |
310 | [AC_DEFINE(HAVE_LIBCAP_NG, 1, | |
311 | [Define to 1 if you have the `cap-ng' library (-lcap-ng).]) dnl `vim syntax | |
312 | CAPNG_LDADD="-lcap-ng"; use_libcap_ng=yes], | |
313 | [AC_MSG_ERROR([libcap-ng headers found but library is missing])])], | |
314 | [test "$with_libcap_ng" != "yes" || AC_MSG_ERROR([Missing libcap-ng header files])]) | |
315 | ;; | |
316 | esac | |
a23d5117 | 317 | AC_SUBST(CAPNG_LDADD) |
ff28b140 TL |
318 | |
319 | AC_ARG_WITH(libsystemd, | |
320 | [AS_HELP_STRING([--with-libsystemd@<:@=auto|yes|no@:>@], | |
321 | [Add systemd 'Type=notify' support to smartd [auto]])], | |
322 | [], [with_libsystemd=auto]) | |
323 | ||
324 | use_libsystemd=no | |
325 | case "$with_libsystemd:$host_os" in | |
326 | auto:linux*|yes:*) | |
327 | AC_CHECK_HEADERS([systemd/sd-daemon.h], [AC_CHECK_LIB([systemd], [sd_notify], | |
328 | [AC_DEFINE(HAVE_LIBSYSTEMD, 1, | |
329 | [Define to 1 if you have the `systemd' library (-lsystemd).]) dnl `vim syntax | |
330 | SYSTEMD_LDADD="-lsystemd"; use_libsystemd=yes], | |
331 | [AC_MSG_ERROR([libsystemd headers found but library is missing])])], | |
332 | [test "$with_libsystemd" != "yes" || AC_MSG_ERROR([Missing libsystemd header files])]) | |
333 | ;; | |
334 | esac | |
335 | AC_SUBST(SYSTEMD_LDADD) | |
336 | ||
337 | AC_ARG_WITH(systemdsystemunitdir, | |
338 | [AS_HELP_STRING([--with-systemdsystemunitdir@<:@=DIR|auto|yes|no@:>@], [Location of systemd service files [auto]])], | |
339 | [], [with_systemdsystemunitdir=auto]) | |
340 | ||
341 | systemdsystemunitdir= | |
342 | case "$with_systemdsystemunitdir:$use_libsystemd" in | |
343 | auto:yes|yes:yes) | |
344 | if test -n "$PKG_CONFIG"; then | |
345 | AC_MSG_CHECKING([for systemdsystemunitdir]) | |
346 | systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd 2>/dev/null` | |
347 | AC_MSG_RESULT([${systemdsystemunitdir:-no}]) | |
348 | fi | |
349 | case "$with_systemdsystemunitdir:$sysconfdir:$systemdsystemunitdir" in | |
350 | yes:*:) AC_MSG_ERROR([Location of systemd service files not found]) ;; | |
351 | yes:*:*|auto:*:|auto:/etc:*) ;; | |
352 | *) systemdsystemunitdir='${prefix}'$systemdsystemunitdir ;; | |
353 | esac ;; | |
354 | auto:*|no:*) ;; | |
355 | *:yes) systemdsystemunitdir="$with_systemdsystemunitdir" ;; | |
356 | *) AC_MSG_ERROR(['--with-systemdsystemunitdir=$with_systemdsystemunitdir' now requires '--with-libsystemd']) ;; | |
357 | esac | |
358 | AC_SUBST(systemdsystemunitdir) | |
359 | AM_CONDITIONAL(INSTALL_SYSTEMDUNIT, [test -n "$systemdsystemunitdir"]) | |
360 | ||
361 | AC_ARG_WITH(systemdenvfile, | |
362 | [AS_HELP_STRING([--with-systemdenvfile@<:@=FILE|auto|yes|no@:>@], [Path of systemd EnvironmentFile [auto]])], | |
363 | [], [with_systemdenvfile=auto]) | |
364 | ||
365 | systemdenvfile= | |
366 | case "$with_systemdenvfile:$cross_compiling:$systemdsystemunitdir" in | |
367 | auto:no:?*|yes:*:?*) | |
368 | AC_MSG_CHECKING([for path of systemd EnvironmentFile]) | |
369 | for dir in sysconfig default; do | |
370 | if test -d /etc/$dir; then | |
371 | systemdenvfile='${sysconfdir}'/$dir/smartmontools | |
372 | break | |
373 | fi | |
374 | done | |
375 | AC_MSG_RESULT([${systemdenvfile:-no}]) | |
376 | case "$with_systemdenvfile:$systemdenvfile" in | |
377 | yes:) AC_MSG_ERROR([Path of systemd EnvironmentFile not found]) ;; | |
378 | esac ;; | |
379 | auto:*|no:*) ;; | |
380 | *:*:) AC_MSG_ERROR([Location of systemd service files not found]) ;; | |
381 | *) systemdenvfile="$with_systemdenvfile" | |
382 | esac | |
383 | AC_SUBST(systemdenvfile) | |
a23d5117 | 384 | |
a86ec89e GI |
385 | # TODO: Remove when NVMe support is no longer EXPERIMENTAL |
386 | AC_ARG_WITH(nvme-devicescan, | |
387 | [AS_HELP_STRING([--with-nvme-devicescan@<:@=yes|no@:>@], | |
ff28b140 | 388 | [Include NVMe devices in smartd DEVICESCAN [Linux,Windows:yes;Others:no]])]) |
a86ec89e GI |
389 | |
390 | AC_ARG_WITH(solaris-sparc-ata, | |
391 | [AS_HELP_STRING([--with-solaris-sparc-ata@<:@=yes|no@:>@], | |
392 | [Enable legacy ATA support on Solaris SPARC (requires os_solaris_ata.s from SVN repository) [no]])]) | |
393 | ||
394 | case "$host:$with_solaris_sparc_ata" in | |
395 | sparc-*-solaris*:yes) | |
396 | if test ! -f "$srcdir/os_solaris_ata.s"; then | |
397 | AC_MSG_ERROR([Missing source file: $srcdir/os_solaris_ata.s | |
398 | This file is no longer included in the source tarball but still | |
399 | available in the SVN repository.]) | |
400 | fi | |
401 | AC_DEFINE(WITH_SOLARIS_SPARC_ATA, 1, [Define to 1 to enable legacy ATA support on Solaris SPARC.]) | |
402 | ;; | |
403 | esac | |
404 | ||
ff28b140 TL |
405 | AC_ARG_WITH(signal-func, |
406 | [AS_HELP_STRING([--with-signal-func=@<:@sigaction|sigset|signal@:>@], | |
407 | [Function to set signal(2) action [sigaction]])], | |
408 | [], [with_signal_func=sigaction]) | |
409 | ||
410 | case "$host:$with_signal_func" in | |
411 | *-*-mingw*:*) ;; | |
412 | *:sigaction) | |
413 | AC_CHECK_FUNCS([sigaction], [], AC_MSG_ERROR([Missing function 'sigaction()'. | |
414 | Try '--with-signal-func=sigset' or '--with-signal-func=signal'. | |
415 | Please send info about your system to $PACKAGE_BUGREPORT.])) ;; | |
416 | *:sigset) | |
417 | AC_CHECK_FUNCS([sigset], [], AC_MSG_ERROR([Missing function 'sigset()'])) ;; | |
418 | *:signal) ;; | |
419 | *) AC_MSG_ERROR([Invalid option '--with-signal-func=$with_signal_func']) ;; | |
d2e702cf GI |
420 | esac |
421 | ||
ff28b140 | 422 | # TODO: Remove after smartmontools 6.7 |
d2e702cf GI |
423 | AC_ARG_WITH(working-snprintf, |
424 | [AS_HELP_STRING([--with-working-snprintf@<:@=yes|no@:>@], | |
ff28b140 TL |
425 | [Function snprintf() handles output truncation as specified by C99 [yes]])], |
426 | [], [with_working_snprintf=yes]) | |
d2e702cf | 427 | |
ff28b140 | 428 | if test "$with_working_snprintf" = "yes"; then |
a86ec89e | 429 | AC_DEFINE(HAVE_WORKING_SNPRINTF, 1, [Define to 1 if the `snprintf' function is sane.]) dnl `vim syntax |
d2e702cf GI |
430 | fi |
431 | ||
ff28b140 TL |
432 | case "$with_working_snprintf:$host_os: $CPPFLAGS $CXXFLAGS" in |
433 | yes:mingw*:*\ -[[DU]]__USE_MINGW_ANSI_STDIO*) | |
434 | ;; | |
435 | yes:mingw*:*) | |
436 | # Older MinGW (4.6.3) do not properly define PRI?64 if __USE_MINGW_ANSI_STDIO is set. | |
437 | # Newer MinGW (4.9.1) set __USE_MINGW_ANSI_STDIO in first C++ include which may be too late. | |
438 | # Set __USE_MINGW_ANSI_STDIO always and fail if not fully supported. | |
439 | AC_MSG_CHECKING([whether $CXX supports __USE_MINGW_ANSI_STDIO]) | |
440 | save_CXXFLAGS=$CXXFLAGS | |
441 | CXXFLAGS="-Wformat -Werror -D__USE_MINGW_ANSI_STDIO" | |
442 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ | |
443 | #define __STDC_FORMAT_MACROS 1 | |
444 | #include <inttypes.h> | |
445 | #include <stdio.h> | |
446 | void f(char * buf1, char * buf2, size_t size) { | |
447 | snprintf(buf1, size, "%lld", 42LL); | |
448 | snprintf(buf2, size, "%" PRId64, (int64_t)42); | |
449 | }]])], | |
450 | [result=yes], [result=no]) | |
451 | AC_MSG_RESULT([$result]) | |
452 | if test "$result" != "yes"; then | |
453 | AC_MSG_ERROR([ | |
454 | This version of $CXX does not support __USE_MINGW_ANSI_STDIO. | |
455 | Use option '--without-working-snprintf' to skip this check. | |
456 | Please send info about your system to $PACKAGE_BUGREPORT. | |
457 | ]) | |
458 | fi | |
459 | CXXFLAGS="-D__USE_MINGW_ANSI_STDIO $save_CXXFLAGS" | |
460 | ;; | |
461 | esac | |
462 | ||
f9e10201 JD |
463 | AC_ARG_WITH(mingw-aslr, |
464 | [AS_HELP_STRING([--with-mingw-aslr@<:@=auto|yes|low|no@:>@], [Enable ASLR for MinGW executables [auto]])], | |
465 | [], [with_mingw_aslr=auto]) | |
466 | ||
467 | case "$host:${LDFLAGS+set}" in | |
468 | *-*-mingw*:) # MinGW defaults: link statically and indicate DEP and TS compatibility | |
469 | LDFLAGS="-static -Wl,--nxcompat,--tsaware" ;; | |
470 | esac | |
471 | ||
472 | case "$host:$with_mingw_aslr" in | |
473 | x86_64-*-mingw*:auto) | |
474 | AC_MSG_CHECKING([whether $CXX supports --high-entropy-va]) | |
475 | save_LDFLAGS=$LDFLAGS | |
476 | LDFLAGS="$LDFLAGS -pie -Wl,--dynamicbase,-emainCRTStartup,--high-entropy-va,--image-base,0x140000000" | |
477 | # Link libstdc++ to detect MinGW 6.3.0 problems with high --image-base | |
478 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ | |
479 | #include <string> | |
480 | std::string s(42, '.');]])], | |
481 | [with_mingw_aslr=yes], [with_mingw_aslr=no]) | |
482 | LDFLAGS=$save_LDFLAGS | |
483 | AC_MSG_RESULT([$with_mingw_aslr]) | |
484 | test "$with_mingw_aslr" = "yes" || with_mingw_aslr=low | |
485 | ;; | |
486 | esac | |
487 | ||
488 | case "$host:$with_mingw_aslr" in | |
489 | x86_64-*-mingw*:yes) | |
490 | LDFLAGS="$LDFLAGS -pie -Wl,--dynamicbase,-emainCRTStartup,--high-entropy-va,--image-base,0x140000000" ;; | |
491 | x86_64-*-mingw*:low) | |
492 | LDFLAGS="$LDFLAGS -pie -Wl,--dynamicbase,-emainCRTStartup" ;; | |
493 | *-*-mingw*:auto|*-*-mingw*:yes|*-*-mingw*:low) | |
494 | LDFLAGS="$LDFLAGS -pie -Wl,--dynamicbase,-e_mainCRTStartup" ;; | |
495 | esac | |
496 | ||
a86ec89e GI |
497 | os_win32_manifest= |
498 | case "$host" in | |
499 | *-*-mingw*) | |
500 | # Newer MinGW may add a default manifest | |
f9e10201 | 501 | AC_MSG_CHECKING([whether $CXX adds an application manifest]) |
a86ec89e GI |
502 | cc_adds_manifest=no |
503 | AC_LINK_IFELSE([AC_LANG_PROGRAM()], [ | |
504 | if "$WINDRES" -O rc conftest.exe 2>/dev/null | grep '^1.*RT_MANIFEST' >/dev/null 2>&1; then | |
505 | cc_adds_manifest=incomplete | |
506 | # Manifest must provide a Win 10 compatibility ID | |
507 | if "$WINDRES" -O rc conftest.exe 2>/dev/null | grep '{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}' >/dev/null 2>&1; then | |
508 | cc_adds_manifest=yes | |
509 | fi | |
510 | fi], | |
511 | [AC_MSG_ERROR([test compile failed])]) | |
512 | AC_MSG_RESULT([$cc_adds_manifest]) | |
f9e10201 | 513 | test "$cc_adds_manifest" = "yes" || os_win32_manifest='os_win32/default.manifest' |
a86ec89e GI |
514 | ;; |
515 | esac | |
516 | ||
f9e10201 | 517 | AC_ARG_WITH(cxx11-option, |
ff28b140 | 518 | [AS_HELP_STRING([--with-cxx11-option=@<:@OPTION|auto|no@:>@], |
f9e10201 JD |
519 | [Compiler option to enable C++11 support for future versions of smartmontools, 'no' if unsupported [auto]])], |
520 | [], [with_cxx11_option=auto]) | |
521 | ||
522 | check_cxx11_support() | |
523 | { | |
524 | save_CXXFLAGS=$CXXFLAGS | |
525 | CXXFLAGS=$1 | |
526 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
527 | #if __cplusplus < 201103L | |
528 | #error false | |
529 | #endif | |
530 | // use some C++11 features (and return v * 42 :-) | |
531 | auto cxx11(long v) noexcept -> decltype(v) { | |
532 | typedef decltype(v) t; t r = v; | |
533 | static const t a[] = { -7, -1, 1, 2, 3 }; | |
534 | static_assert(sizeof(r) == sizeof(a[0]), "fail"); | |
535 | auto f = [](t x, t y){ return x * y; }; | |
536 | for (const auto & e : a) r = f(r, e); | |
537 | return r; | |
538 | }]])], | |
539 | [CXXFLAGS=$save_CXXFLAGS; return 0], [CXXFLAGS=$save_CXXFLAGS; return 1]) | |
540 | } | |
541 | ||
542 | case "$with_cxx11_option" in | |
543 | no) ;; | |
544 | auto) | |
545 | AC_MSG_CHECKING([for $CXX option to accept C++11]) | |
546 | with_cxx11_option=unknown | |
547 | for option in "" "-std=gnu++11" "-std=gnu++0x" "-std=c++11" "-std=c++0x"; do | |
548 | if check_cxx11_support "$option"; then with_cxx11_option=$option; break; fi | |
549 | done | |
550 | AC_MSG_RESULT([${with_cxx11_option:-none needed}]) | |
551 | test "$with_cxx11_option" != "unknown" || AC_MSG_ERROR([ | |
552 | This version of smartmontools does not use C++11 features, but future | |
553 | versions possibly will. | |
554 | This script was unable to determine a compiler option to enable C++11. | |
555 | Use option '--with-cxx11-option=OPTION' to specify the compiler option | |
ff28b140 | 556 | (it will be used in the actual build only if '--with-cxx11-regex' is set). |
f9e10201 JD |
557 | Use option '--without-cxx11-option' to suppress this error message if the |
558 | compiler lacks C++11 support. | |
559 | In both cases, please send info about compiler and platform to | |
560 | $PACKAGE_BUGREPORT - Thanks!]) | |
561 | ;; | |
562 | *) | |
563 | AC_MSG_CHECKING([whether $CXX $with_cxx11_option accepts C++11]) | |
564 | res=no; check_cxx11_support "$with_cxx11_option" && res=yes | |
565 | AC_MSG_RESULT([$res]) | |
566 | test "$res" = "yes" || AC_MSG_ERROR([$CXX $with_cxx11_option does not accept C++11]) | |
567 | ;; | |
568 | esac | |
832b75ed | 569 | |
ff28b140 TL |
570 | AC_ARG_WITH(cxx11-regex, |
571 | [AS_HELP_STRING([--with-cxx11-regex@<:@=yes|no@:>@], | |
572 | [Use C++11 std::regex instead of POSIX regex(3) [no]])]) | |
573 | ||
574 | need_regex=no | |
575 | if test "$with_cxx11_regex" = "yes"; then | |
576 | AC_DEFINE(WITH_CXX11_REGEX, 1, [Define to 1 to use C++11 std::regex instead of POSIX regex(3)]) | |
577 | case "$with_cxx11_option: $CXXFLAGS " in | |
578 | no:*) AC_MSG_ERROR(['--with-cxx11-regex' requires C++11 support]) ;; | |
579 | ?*:*\ $with_cxx11_option\ *) ;; | |
580 | ?*:*) CXXFLAGS="$CXXFLAGS $with_cxx11_option" ;; | |
581 | esac | |
582 | else | |
583 | AC_CHECK_FUNCS([regcomp], [], [need_regex=yes]) | |
584 | fi | |
585 | AM_CONDITIONAL(NEED_REGEX, [test "$need_regex" = "yes"]) | |
a86ec89e | 586 | |
832b75ed GG |
587 | AC_SUBST(releaseversion,['${PACKAGE}-${VERSION}']) |
588 | AC_SUBST(smartmontools_release_date) | |
589 | AC_SUBST(smartmontools_release_time) | |
590 | ||
cfbba5b9 GI |
591 | # Set platform-specific modules and symbols |
592 | os_libs= | |
a86ec89e | 593 | os_dltools='curl wget lynx svn' |
ee38a438 GI |
594 | os_mailer=mail |
595 | os_hostname="'hostname'" | |
596 | os_dnsdomainname= | |
597 | os_nisdomainname="'domainname'" | |
cfbba5b9 GI |
598 | os_darwin=no |
599 | os_solaris=no | |
600 | os_win32=no | |
601 | os_win32_mingw=no | |
7f0798ef | 602 | os_win64=no |
d008864d | 603 | os_man_filter= |
ff28b140 | 604 | os_nvme_devicescan= |
832b75ed | 605 | case "${host}" in |
cfbba5b9 | 606 | *-*-linux*) |
ee38a438 GI |
607 | os_deps='os_linux.o cciss.o dev_areca.o' |
608 | os_dnsdomainname="'dnsdomainname' 'hostname -d'" | |
609 | os_nisdomainname="'nisdomainname' 'hostname -y' 'domainname'" | |
d008864d | 610 | os_man_filter=Linux |
ff28b140 | 611 | os_nvme_devicescan=yes |
cfbba5b9 GI |
612 | ;; |
613 | *-*-freebsd*|*-*-dragonfly*|*-*-kfreebsd*-gnu*) | |
ee38a438 | 614 | os_deps='os_freebsd.o cciss.o dev_areca.o' |
ff28b140 | 615 | os_libs='-lcam -lsbuf' |
a86ec89e | 616 | os_dltools='curl wget lynx fetch svn' |
cfbba5b9 | 617 | AC_CHECK_LIB(usb, libusb20_dev_get_device_desc) |
d008864d | 618 | os_man_filter=FreeBSD |
ff28b140 | 619 | os_nvme_devicescan=no |
cfbba5b9 GI |
620 | ;; |
621 | sparc-*-solaris*) | |
a86ec89e GI |
622 | os_deps='os_solaris.o' |
623 | test "$with_solaris_sparc_ata" = "yes" \ | |
624 | && os_deps="$os_deps os_solaris_ata.o" | |
cfbba5b9 GI |
625 | os_mailer='mailx' |
626 | os_solaris=yes | |
d008864d | 627 | os_man_filter=Solaris |
cfbba5b9 GI |
628 | ;; |
629 | *-pc-solaris*) | |
630 | os_deps='os_solaris.o' | |
631 | os_mailer='mailx' | |
632 | os_solaris=yes | |
d008864d | 633 | os_man_filter=Solaris |
cfbba5b9 GI |
634 | ;; |
635 | *-*-netbsd*) | |
636 | os_deps='os_netbsd.o' | |
637 | os_libs='-lutil' | |
d008864d | 638 | os_man_filter=NetBSD |
ff28b140 | 639 | os_nvme_devicescan=no |
cfbba5b9 GI |
640 | ;; |
641 | *-*-openbsd*) | |
642 | os_deps='os_openbsd.o' | |
643 | os_libs='-lutil' | |
a86ec89e | 644 | os_dltools='curl wget lynx ftp svn' |
d008864d | 645 | os_man_filter=OpenBSD |
cfbba5b9 GI |
646 | ;; |
647 | *-*-cygwin*) | |
ee38a438 | 648 | os_deps='os_win32.o dev_areca.o' |
d2e702cf | 649 | os_mailer='email' |
ee38a438 GI |
650 | os_hostname="'hostname' 'echo "'"${HOSTNAME?unset}"'"'" |
651 | os_dnsdomainname="'dnsdomainname' 'hostname -d' 'echo "'"${USERDNSDOMAIN?unset}"'"'" | |
652 | os_nisdomainname= | |
cfbba5b9 | 653 | os_win32=yes |
d008864d | 654 | os_man_filter=Cygwin |
ff28b140 | 655 | os_nvme_devicescan=yes |
cfbba5b9 GI |
656 | ;; |
657 | x86_64-*-mingw*) | |
ee38a438 | 658 | os_deps='os_win32.o dev_areca.o' |
cfbba5b9 GI |
659 | os_win32=yes |
660 | os_win32_mingw=yes | |
661 | os_win64=yes | |
d008864d | 662 | os_man_filter=Windows |
ff28b140 | 663 | os_nvme_devicescan=yes |
cfbba5b9 GI |
664 | ;; |
665 | *-*-mingw*) | |
ee38a438 | 666 | os_deps='os_win32.o dev_areca.o' |
cfbba5b9 GI |
667 | os_win32=yes |
668 | os_win32_mingw=yes | |
d008864d | 669 | os_man_filter=Windows |
ff28b140 | 670 | os_nvme_devicescan=yes |
cfbba5b9 GI |
671 | ;; |
672 | *-*-darwin*) | |
673 | os_deps='os_darwin.o' | |
674 | os_libs='-framework CoreFoundation -framework IOKit' | |
675 | os_darwin=yes | |
d008864d | 676 | os_man_filter=Darwin |
ff28b140 | 677 | os_nvme_devicescan=no |
cfbba5b9 GI |
678 | ;; |
679 | *-*-nto-qnx*) | |
680 | os_deps='os_qnxnto.o' | |
681 | ;; | |
f9e10201 JD |
682 | *-*-os2-*) |
683 | os_deps='os_os2.o' | |
684 | ;; | |
cfbba5b9 GI |
685 | *) |
686 | os_deps='os_generic.o' | |
687 | ;; | |
832b75ed GG |
688 | esac |
689 | ||
2127e193 GI |
690 | # Replace if '--with-os-deps' was specified |
691 | test -z "$with_os_deps" || os_deps="$with_os_deps" | |
832b75ed | 692 | |
2127e193 GI |
693 | # Check if we need adapter to old interface (dev_legacy.cpp) |
694 | os_src=`echo "${os_deps}"|sed -n 's,^\([[^ .]]*\)\.o.*$,\1.cpp,p'` | |
695 | AC_MSG_CHECKING([whether ${os_src} uses new interface]) | |
696 | if grep "smart_interface" "${srcdir}/${os_src}" >/dev/null 2>&1; then | |
697 | os_new_interface=yes | |
698 | else | |
699 | os_new_interface=no | |
700 | os_deps="${os_deps} dev_legacy.o" | |
701 | AC_DEFINE(OLD_INTERFACE, 1, [Define to 1 if os_*.cpp still uses the old interface]) | |
702 | fi | |
703 | AC_MSG_RESULT([$os_new_interface]) | |
704 | ||
ff28b140 TL |
705 | # TODO: Remove when NVMe support is no longer EXPERIMENTAL |
706 | case "$os_nvme_devicescan:${with_nvme_devicescan+set}" in | |
707 | no:|yes:) | |
708 | AC_MSG_CHECKING([whether NVMe device scanning could be safely enabled]) | |
709 | with_nvme_devicescan=$os_nvme_devicescan | |
710 | AC_MSG_RESULT([$os_nvme_devicescan]) | |
711 | os_nvme_devicescan=used ;; | |
712 | esac | |
713 | AC_SUBST(with_nvme_devicescan) | |
714 | if test "$with_nvme_devicescan" = "yes"; then | |
715 | AC_DEFINE(WITH_NVME_DEVICESCAN, 1, [Define to 1 to include NVMe devices in smartd DEVICESCAN.]) | |
716 | fi | |
717 | ||
cfbba5b9 GI |
718 | AC_SUBST([os_deps]) |
719 | AC_SUBST([os_libs]) | |
720 | AC_SUBST([os_dltools]) | |
ee38a438 GI |
721 | AC_SUBST([os_mailer]) |
722 | AC_SUBST([os_hostname]) | |
723 | AC_SUBST([os_dnsdomainname]) | |
724 | AC_SUBST([os_nisdomainname]) | |
d008864d | 725 | AC_SUBST([os_man_filter]) |
a86ec89e | 726 | AC_SUBST([os_win32_manifest]) |
cfbba5b9 GI |
727 | |
728 | # Create drivedb.h update branch name from version: 5.41[.X] -> RELEASE_5_41_DRIVEDB | |
f9e10201 | 729 | DRIVEDB_BRANCH=`echo "$drivedb_version" | sed 's,^\([[0-9]]*\.[[0-9]]*\)\..*$,\1,' \ |
cfbba5b9 GI |
730 | | sed -n 's,^\([[0-9]][[0-9]]*\)\.\([[0-9]][[0-9]]*\)$,RELEASE_\1_\2_DRIVEDB,p'` |
731 | if test -z "$DRIVEDB_BRANCH"; then | |
f9e10201 | 732 | AC_MSG_ERROR([Unable to create DRIVEDB_BRANCH for version: $drivedb_version]) |
cfbba5b9 GI |
733 | fi |
734 | AC_SUBST([DRIVEDB_BRANCH]) | |
735 | ||
736 | # Enable platform-specific makefile sections | |
737 | AM_CONDITIONAL(OS_DARWIN, [test "$os_darwin" = "yes"]) | |
738 | AM_CONDITIONAL(OS_SOLARIS, [test "$os_solaris" = "yes"]) | |
739 | AM_CONDITIONAL(OS_WIN32, [test "$os_win32" = "yes"]) | |
740 | AM_CONDITIONAL(OS_WIN32_MINGW, [test "$os_win32_mingw" = "yes"]) | |
741 | AM_CONDITIONAL(OS_WIN32_NSIS, [test -n "$MAKENSIS"]) | |
7f0798ef | 742 | AM_CONDITIONAL(OS_WIN64, [test "$os_win64" = "yes"]) |
832b75ed | 743 | |
bed94269 | 744 | if test "$GXX" = "yes"; then |
ff28b140 | 745 | orig_CXXFLAGS=$CXXFLAGS |
f9e10201 JD |
746 | # Add -Wall and -W[extra] if its not already specified |
747 | case " $CXXFLAGS " in | |
748 | *\ -Wall\ *) ;; | |
749 | *) CXXFLAGS="$CXXFLAGS -Wall" ;; | |
750 | esac | |
751 | case " $CXXFLAGS " in | |
752 | *\ -W\ *|*\ -Wextra\ *) ;; | |
753 | *) CXXFLAGS="$CXXFLAGS -W" ;; | |
754 | esac | |
755 | # Add -Wformat=2 (GCC 3.0) -fstack-protector[-strong] (GCC 4.1[4.9]) if supported | |
ff28b140 TL |
756 | # and no -W or -f option was set in configure cmdline (TODO: -Wformat-signedness) |
757 | for option in "-Wformat=2" "-fstack-protector-strong" "-fstack-protector"; do | |
758 | case " $orig_CXXFLAGS:$option" in *\ -W*:-W*|*\ -f*:-f*) continue ;; esac | |
759 | case " $CXXFLAGS:$option" in *\ -fstack-p*:-fstack-p*) continue ;; esac | |
760 | AC_MSG_CHECKING([whether $CXX supports $option]) | |
761 | save_CXXFLAGS=$CXXFLAGS | |
762 | CXXFLAGS="$CXXFLAGS $option" | |
763 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [res=yes], [res=no; CXXFLAGS=$save_CXXFLAGS]) | |
764 | AC_MSG_RESULT([$res]) | |
765 | done | |
832b75ed | 766 | else |
f9e10201 JD |
767 | # We are NOT using gcc, so enable host-specific compiler flags |
768 | case "${host}" in | |
769 | sparc*-*-solaris*) | |
770 | # Tell the Solaris/SPARC C++ compiler about packed ATA structures | |
771 | case " $CXXFLAGS" in | |
772 | *\ -xmemalign*) ;; | |
773 | *) CXXFLAGS="-xmemalign=1i $CXXFLAGS" ;; | |
774 | esac ;; | |
775 | esac | |
776 | case "${host}" in | |
777 | *-*-solaris*) | |
778 | # Turn on optimization if user has not explicitly set its value | |
779 | case " $CXXFLAGS" in | |
780 | *\ -xO*) ;; | |
781 | *) CXXFLAGS="-xO2 $CXXFLAGS" ;; | |
782 | esac | |
783 | # Suppress trivial warnings | |
784 | case " $CXXFLAGS" in | |
785 | *\ -erroff*) ;; | |
786 | *) CXXFLAGS="-erroff=%none,wbadinitl,wbadasgl,badargtypel2w,badargtype2w $CXXFLAGS" ;; | |
787 | esac ;; | |
788 | esac | |
832b75ed GG |
789 | fi |
790 | ||
791 | AC_DEFINE_UNQUOTED(SMARTMONTOOLS_BUILD_HOST, "${host}", [smartmontools Build Host]) | |
792 | ||
4d59bff9 | 793 | AC_SUBST(CXXFLAGS) |
832b75ed | 794 | |
cfbba5b9 GI |
795 | AC_CONFIG_FILES(Makefile) |
796 | AC_OUTPUT | |
832b75ed | 797 | AC_PROG_MAKE_SET |
a23d5117 | 798 | |
a86ec89e GI |
799 | # Note: Use `...` here as some shells do not properly parse '$(... case $x in X) ...)' |
800 | info=` | |
801 | echo "-----------------------------------------------------------------------------" | |
802 | echo "${PACKAGE}-${VERSION} configuration:" | |
803 | echo "host operating system: $host" | |
804 | echo "C++ compiler: $CXX" | |
805 | echo "C compiler: $CC" | |
806 | echo "preprocessor flags: $CPPFLAGS" | |
807 | echo "C++ compiler flags: $CXXFLAGS" | |
808 | echo "C compiler flags: $CFLAGS" | |
809 | echo "linker flags: $LDFLAGS" | |
810 | echo "OS specific modules: $os_deps $os_libs $LIBS" | |
811 | ||
812 | case "$host_os" in | |
813 | mingw*) | |
814 | echo "application manifest: ${os_win32_manifest:-built-in}" | |
815 | echo "resource compiler: $WINDRES" | |
816 | echo "message compiler: $WINDMC" | |
817 | echo "NSIS compiler: $MAKENSIS" | |
818 | if test -n "$drivedbdir"; then | |
819 | echo "drive database file: EXEDIR/drivedb.h" | |
820 | if test -n "$MAKENSIS"; then | |
821 | echo "database update tool: EXEDIR/update-smart-drivedb.exe" | |
822 | fi | |
823 | else | |
824 | echo "drive database file: [[disabled]]" | |
cfbba5b9 | 825 | fi |
a86ec89e GI |
826 | if test -n "$savestates"; then |
827 | echo "smartd save files: \`eval eval eval echo $savestates\`MODEL-SERIAL.TYPE.state" | |
828 | fi | |
829 | if test -n "$attributelog"; then | |
830 | echo "smartd attribute logs: \`eval eval eval echo $attributelog\`MODEL-SERIAL.TYPE.csv" | |
831 | fi | |
832 | echo "NVMe DEVICESCAN: ${with_nvme_devicescan-no}" | |
833 | ;; | |
834 | ||
835 | *) | |
836 | echo "binary install path: \`eval eval eval echo $sbindir\`" | |
837 | echo "man page install path: \`eval eval eval echo $mandir\`" | |
838 | echo "doc file install path: \`eval eval eval echo $docdir\`" | |
839 | echo "examples install path: \`eval eval eval echo $exampledir\`" | |
840 | if test -n "$drivedbdir"; then | |
841 | echo "drive database file: \`eval eval eval echo $drivedbdir\`/drivedb.h" | |
842 | if test "$with_update_smart_drivedb" = "yes"; then | |
843 | echo "database update script: \`eval eval eval echo $sbindir\`/update-smart-drivedb" | |
ff28b140 TL |
844 | if test "$drivedb_version" = "$smartmontools_drivedb_version"; then |
845 | echo "database update branch: branches/$DRIVEDB_BRANCH" | |
846 | else | |
f9e10201 JD |
847 | echo "... backported to: branches/$DRIVEDB_BRANCH" |
848 | fi | |
a86ec89e | 849 | echo "download tools: \`eval eval eval echo $os_dltools\`" |
f9e10201 JD |
850 | if test -n "$gnupg"; then |
851 | echo "GnuPG for verification: \`eval eval eval echo $gnupg\`" | |
852 | else | |
853 | echo "GnuPG for verification: [[disabled]]" | |
854 | fi | |
a86ec89e GI |
855 | else |
856 | echo "database update script: [[disabled]]" | |
857 | fi | |
d2e702cf | 858 | else |
a86ec89e | 859 | echo "drive database file: [[disabled]]" |
d2e702cf | 860 | fi |
a86ec89e GI |
861 | echo "local drive database: \`eval eval eval echo $sysconfdir\`/smart_drivedb.h" |
862 | echo "smartd config file: \`eval eval eval echo $sysconfdir\`/smartd.conf${smartd_suffix}" | |
863 | echo "smartd warning script: \`eval eval eval echo $smartdscriptdir\`/smartd_warning.sh" | |
864 | if test -n "$smartdplugindir"; then | |
865 | echo "smartd plugin path: \`eval eval eval echo $smartdplugindir\`" | |
866 | else | |
867 | echo "smartd plugin path: [[disabled]]" | |
868 | fi | |
f9e10201 JD |
869 | if test -n "$scriptpath"; then |
870 | echo "PATH within scripts: \`eval eval eval echo $scriptpath\`" | |
871 | else | |
872 | echo "PATH within scripts: [[inherited]]" | |
873 | fi | |
a86ec89e | 874 | if test -n "$initddir"; then |
ff28b140 | 875 | echo "smartd initd script: \`eval eval eval echo $initddir\`/smartd" |
a86ec89e GI |
876 | elif test -z "$systemdsystemunitdir"; then |
877 | echo "smartd initd script: [[disabled]]" | |
878 | fi | |
879 | if test -n "$systemdsystemunitdir"; then | |
ff28b140 | 880 | echo "smartd service file: \`eval eval eval echo $systemdsystemunitdir\`/smartd.service" |
a86ec89e GI |
881 | if test -n "$systemdenvfile"; then |
882 | echo "smartd environ file: \`eval eval eval echo $systemdenvfile\`" | |
883 | else | |
884 | echo "smartd environ file: [[disabled]]" | |
885 | fi | |
886 | fi | |
887 | if test -n "$savestates"; then | |
888 | echo "smartd save files: \`eval eval eval echo $savestates\`MODEL-SERIAL.TYPE.state" | |
889 | else | |
890 | echo "smartd save files: [[disabled]]" | |
891 | fi | |
892 | if test -n "$attributelog"; then | |
893 | echo "smartd attribute logs: \`eval eval eval echo $attributelog\`MODEL-SERIAL.TYPE.csv" | |
894 | else | |
895 | echo "smartd attribute logs: [[disabled]]" | |
896 | fi | |
a86ec89e | 897 | case "$host_os" in |
ff28b140 TL |
898 | linux*) |
899 | echo "SELinux support: ${with_selinux-no}" | |
900 | echo "libcap-ng support: $use_libcap_ng" | |
901 | echo "systemd notify support: $use_libsystemd" ;; | |
a86ec89e | 902 | esac |
ff28b140 | 903 | echo "NVMe DEVICESCAN: ${with_nvme_devicescan-[[not implemented]]}" |
a86ec89e GI |
904 | ;; |
905 | esac | |
906 | echo "-----------------------------------------------------------------------------" | |
907 | ` | |
908 | ||
909 | AC_MSG_NOTICE([ | |
910 | $info | |
911 | ]) | |
912 | ||
913 | # TODO: Remove when NVMe support is no longer EXPERIMENTAL | |
ff28b140 TL |
914 | case "$os_nvme_devicescan:$with_nvme_devicescan" in |
915 | used:yes) AC_MSG_WARN([ | |
916 | The default for the inclusion of NVME devices in smartd.conf | |
917 | 'DEVICESCAN' and 'smartctl --scan' has been changed to 'yes' on | |
918 | this platform. If '--without-nvme-devicescan' is still needed, | |
919 | please inform $PACKAGE_BUGREPORT. | |
920 | Use option '--with-nvme-devicescan' to suppress this warning. | |
921 | ]) ;; | |
922 | used:no) AC_MSG_WARN([ | |
a86ec89e GI |
923 | This version of smartmontools provides NVMe support which is still |
924 | EXPERIMENTAL. NVMe devices are not yet included in smartd.conf | |
925 | 'DEVICESCAN' and 'smartctl --scan' unless '-d nvme' is specified. | |
926 | Use option '--with-nvme-devicescan' to include NVMe devices. | |
f9e10201 | 927 | Use option '--without-nvme-devicescan' to suppress this warning. |
ff28b140 | 928 | ]) ;; |
a86ec89e GI |
929 | esac |
930 | ||
ff28b140 TL |
931 | # TODO: Remove after smartmontools 6.7 |
932 | if test "$with_working_snprintf" != "yes"; then | |
933 | AC_MSG_WARN([ | |
934 | The option '--without-working-snprintf' is deprecated and will be removed | |
935 | in a future version of smartmontools. If you still need support for | |
936 | pre-C99 snprintf(), please inform $PACKAGE_BUGREPORT. | |
f9e10201 | 937 | ]) |
ff28b140 TL |
938 | fi |
939 | ||
940 | case "$host_os:$with_libsystemd:$use_libsystemd:$PKG_CONFIG" in | |
941 | linux*:auto:no:?*) | |
942 | if $PKG_CONFIG systemd >/dev/null 2>&1; then | |
943 | AC_MSG_WARN([ | |
944 | systemd(1) is used on this system but smartd systemd notify support will | |
945 | not be available because libsystemd-dev[[el]] package is not installed. | |
946 | Use option '--without-libsystemd' to suppress this warning. | |
947 | ]) | |
948 | fi ;; | |
e9583e0c | 949 | esac |