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