]>
Commit | Line | Data |
---|---|---|
832b75ed | 1 | # |
d2e702cf | 2 | # $Id: configure.ac 3977 2014-07-26 11:03:24Z chrfranke $ |
832b75ed GG |
3 | # |
4 | dnl Process this file with autoconf to produce a configure script. | |
5 | AC_PREREQ(2.50) | |
d2e702cf | 6 | AC_INIT(smartmontools, 6.4, smartmontools-support@lists.sourceforge.net) |
4d59bff9 | 7 | AC_CONFIG_SRCDIR(smartctl.cpp) |
832b75ed | 8 | |
d2e702cf GI |
9 | smartmontools_cvs_tag=`echo '$Id: configure.ac 3977 2014-07-26 11:03:24Z chrfranke $'` |
10 | smartmontools_release_date=2014-07-26 | |
11 | smartmontools_release_time="09:49:11 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]) | |
17 | AC_DEFINE_UNQUOTED(PACKAGE_HOMEPAGE, "http://smartmontools.sourceforge.net/", [smartmontools Home Page]) | |
18 | ||
d2e702cf | 19 | AC_CONFIG_HEADER([config.h]) |
832b75ed | 20 | |
d008864d | 21 | AM_INIT_AUTOMAKE([foreign]) |
832b75ed GG |
22 | |
23 | AM_MAINTAINER_MODE | |
24 | ||
d2e702cf | 25 | AC_LANG([C++]) |
832b75ed | 26 | dnl Checks for programs. |
4d59bff9 | 27 | AC_PROG_CXX |
832b75ed GG |
28 | AM_PROG_AS |
29 | AC_PROG_INSTALL | |
d008864d GI |
30 | |
31 | m4_pattern_forbid([^PKG_PROG_]) | |
32 | if test "$cross_compiling" = "no"; then | |
33 | m4_ifdef([PKG_PROG_PKG_CONFIG], [PKG_PROG_PKG_CONFIG], | |
34 | [AC_MSG_WARN([m4/pkg.m4 missing, systemd detection disabled])]) | |
35 | fi | |
832b75ed | 36 | |
cfbba5b9 GI |
37 | AC_ARG_VAR(WINDMC, [Windows message compiler command]) |
38 | AC_ARG_VAR(WINDRES, [Windows resource compiler command]) | |
39 | AC_ARG_VAR(MAKENSIS, [NSIS compiler command]) | |
40 | ||
832b75ed | 41 | AC_CANONICAL_HOST |
832b75ed | 42 | case "${host}" in |
cfbba5b9 | 43 | *-*-mingw*) |
ee38a438 GI |
44 | AC_CHECK_TOOL(WINDMC, [windmc]) |
45 | AC_CHECK_TOOL(WINDRES, [windres]) | |
cfbba5b9 | 46 | |
d2e702cf | 47 | AC_MSG_CHECKING([for makensis]) |
cfbba5b9 GI |
48 | if test -z "$MAKENSIS"; then |
49 | if test -n "$PROGRAMFILES" && "$PROGRAMFILES/NSIS/makensis" -VERSION >/dev/null 2>&1; then | |
50 | MAKENSIS="$PROGRAMFILES/NSIS/makensis" | |
51 | elif makensis -VERSION >/dev/null 2>&1; then | |
52 | MAKENSIS=makensis | |
53 | fi | |
54 | fi | |
55 | AC_MSG_RESULT([${MAKENSIS:-no}]) | |
cfbba5b9 | 56 | ;; |
832b75ed GG |
57 | esac |
58 | ||
2127e193 GI |
59 | # Check for SVN. |
60 | AC_MSG_CHECKING([whether this is a build from SVN]) | |
61 | is_svn_build=no | |
e165493d | 62 | svn_deps= |
3d17a85c GI |
63 | if test -f "$srcdir/.svn/wc.db"; then |
64 | # SVN 1.7, 1.8 working copy | |
65 | svn_deps='${srcdir}/.svn/wc.db' | |
66 | elif test -f "${srcdir}/.svn/entries"; then | |
67 | # SVN <= 1.6 working copy (SVN 1.7 has empty entries file) | |
68 | svn_deps='${srcdir}/.svn/entries' | |
69 | fi | |
70 | if test -n "$svn_deps"; then | |
2127e193 GI |
71 | is_svn_build=unknown |
72 | if (cd "$srcdir" && svn --version && svnversion && svn info) >/dev/null 2>&1; then | |
73 | is_svn_build=yes | |
74 | fi | |
75 | fi | |
e165493d | 76 | AC_SUBST([svn_deps]) |
2127e193 GI |
77 | AM_CONDITIONAL(IS_SVN_BUILD, [test "$is_svn_build" = "yes"]) |
78 | AC_MSG_RESULT([$is_svn_build]) | |
79 | ||
e165493d GI |
80 | # Note: On Linux, clock_gettime() requires -lrt which implies -lpthreads |
81 | # Check ommitted for now, gettimeofday() provides reasonable precision | |
82 | # AC_SEARCH_LIBS(clock_gettime, rt) | |
83 | ||
832b75ed GG |
84 | dnl Checks for header files. |
85 | AC_CHECK_HEADERS([locale.h]) | |
832b75ed GG |
86 | AC_CHECK_HEADERS([dev/ata/atavar.h]) |
87 | AC_CHECK_HEADERS([netdb.h]) | |
88 | dnl we need [u]int64_t and friends. | |
89 | AC_CHECK_HEADERS([inttypes.h]) dnl C99, UNIX98, solaris 2.6+ | |
90 | AC_CHECK_HEADERS([stdint.h]) dnl C99 | |
91 | AC_CHECK_HEADERS([sys/inttypes.h]) dnl pre-UNIX98 | |
92 | AC_CHECK_HEADERS([sys/int_types.h]) dnl pre-UNIX98, solaris 2.6+ | |
93 | dnl Check for FreeBSD twe include files...currently missing on 5.2, but should be there | |
94 | AC_CHECK_HEADERS([sys/tweio.h]) | |
95 | AC_CHECK_HEADERS([sys/twereg.h]) | |
96 | dnl Check for FreeBSD twa include files... | |
97 | AC_CHECK_HEADERS([sys/tw_osl_ioctl.h]) | |
1953ff6d | 98 | dnl This header file is needed for cciss_ioctl.h at least on SuSE LINUX |
ba59cff1 | 99 | AC_CHECK_HEADERS([linux/compiler.h]) |
d008864d GI |
100 | dnl Check for the FreeBSD CCISS system header and use internal one if not found |
101 | AC_CHECK_HEADERS([dev/ciss/cissio.h], | |
102 | [AC_DEFINE([CISS_LOCATION],[<dev/ciss/cissio.h>],[freebsd ciss header location])], | |
103 | [AC_DEFINE([CISS_LOCATION],["cissio_freebsd.h"],[freebsd ciss header location])] | |
104 | ) | |
1953ff6d GG |
105 | dnl Check for Linux CCISS include file |
106 | AC_CHECK_HEADERS([linux/cciss_ioctl.h], [], [], [AC_INCLUDES_DEFAULT | |
107 | #ifdef HAVE_LINUX_COMPILER_H | |
108 | # include <linux/compiler.h> | |
109 | #endif | |
110 | ]) | |
cfbba5b9 GI |
111 | dnl Check for Windows DDK and WMI header files |
112 | AC_CHECK_HEADERS([ntdddisk.h ddk/ntdddisk.h], [], [], [AC_INCLUDES_DEFAULT | |
113 | #include <windows.h> | |
114 | ]) | |
115 | AC_CHECK_HEADERS([wbemcli.h]) | |
832b75ed GG |
116 | |
117 | dnl Checks for typedefs, structures, and compiler characteristics. | |
118 | AC_CHECK_TYPES([int64_t, uint64_t]) | |
119 | ||
120 | dnl Checks for library functions. | |
e9583e0c GI |
121 | AC_CHECK_FUNCS([getopt_long], [need_getopt_long=no], [need_getopt_long=yes]) |
122 | AM_CONDITIONAL(NEED_GETOPT_LONG, [test "$need_getopt_long" = "yes"]) | |
123 | AC_CHECK_FUNCS([regcomp], [need_regex=no], [need_regex=yes]) | |
124 | AM_CONDITIONAL(NEED_REGEX, [test "$need_regex" = "yes"]) | |
2127e193 | 125 | |
832b75ed GG |
126 | AC_CHECK_FUNCS([sigset]) |
127 | AC_CHECK_FUNCS([strtoull]) | |
128 | AC_CHECK_FUNCS([uname]) | |
e165493d | 129 | AC_CHECK_FUNCS([clock_gettime ftime gettimeofday]) |
832b75ed | 130 | |
e9583e0c GI |
131 | # Check byte ordering (defines WORDS_BIGENDIAN) |
132 | AC_C_BIGENDIAN | |
133 | ||
832b75ed | 134 | # check for __attribute__((packed)) |
d008864d GI |
135 | # (sizeof() check is required to avoid false positives if other |
136 | # __attribute__((x)) are supported) | |
7f0798ef | 137 | AC_MSG_CHECKING([whether $CXX supports __attribute__((packed))]) |
d008864d GI |
138 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [[ |
139 | struct s { char a; short b; } __attribute__((packed)); | |
140 | typedef char t[sizeof(struct s) == 3 ? 1 : -1];]])], | |
141 | [gcc_have_attr_packed=yes], [gcc_have_attr_packed=no]) | |
832b75ed GG |
142 | AC_SUBST(gcc_have_attr_packed) |
143 | if test "$gcc_have_attr_packed" = "yes"; then | |
cfbba5b9 | 144 | AC_DEFINE(HAVE_ATTR_PACKED, 1, [Define to 1 if C++ compiler supports __attribute__((packed))]) |
832b75ed GG |
145 | fi |
146 | AC_MSG_RESULT([$gcc_have_attr_packed]) | |
147 | ||
148 | AC_SUBST(CPPFLAGS) | |
149 | AC_SUBST(LDFLAGS) | |
150 | AC_SUBST(ASFLAGS) | |
151 | ||
d2e702cf GI |
152 | AC_ARG_WITH(systemdenvfile, |
153 | [AS_HELP_STRING([--with-systemdenvfile=@<:@FILE|no@:>@], | |
154 | [Path of systemd EnvironmentFile (implies --with-systemdsystemunitdir=yes) [SYSCONFDIR/sysconfig/smartmontools]])], | |
155 | [systemdenvfile=; test "$withval" != "no" && systemdenvfile="$withval"; systemd_default=yes], | |
156 | [systemdenvfile='${sysconfdir}/sysconfig/smartmontools'; systemd_default=auto]) | |
157 | AC_SUBST(systemdenvfile) | |
158 | ||
a7e8ffec GI |
159 | AC_ARG_WITH(systemdsystemunitdir, |
160 | [AS_HELP_STRING([--with-systemdsystemunitdir@<:@=DIR|auto|yes|no@:>@], [Location of systemd service files [auto]])], | |
d2e702cf | 161 | [], [with_systemdsystemunitdir=$systemd_default]) |
a7e8ffec GI |
162 | |
163 | systemdsystemunitdir= | |
164 | case "$with_systemdsystemunitdir" in | |
165 | auto|yes) | |
d008864d GI |
166 | if test -n "$PKG_CONFIG"; then |
167 | AC_MSG_CHECKING([for systemdsystemunitdir]) | |
d2e702cf | 168 | systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd 2>/dev/null` |
d008864d GI |
169 | AC_MSG_RESULT([${systemdsystemunitdir:-no}]) |
170 | fi | |
a7e8ffec GI |
171 | case "$with_systemdsystemunitdir:$sysconfdir:$systemdsystemunitdir" in |
172 | yes:*:) AC_MSG_ERROR([Location of systemd service files not found]) ;; | |
173 | yes:*:*|auto:*:|auto:/etc:*) ;; | |
174 | *) systemdsystemunitdir='${prefix}'$systemdsystemunitdir ;; | |
175 | esac ;; | |
176 | no) ;; | |
177 | *) systemdsystemunitdir="$with_systemdsystemunitdir" ;; | |
178 | esac | |
179 | AC_SUBST(systemdsystemunitdir) | |
180 | AM_CONDITIONAL(INSTALL_SYSTEMDUNIT, [test -n "$systemdsystemunitdir"]) | |
181 | ||
a23d5117 | 182 | AC_ARG_WITH(initscriptdir, |
d2e702cf | 183 | [AS_HELP_STRING([--with-initscriptdir@<:@=DIR|auto|yes|no@:>@], [Location of init scripts [auto]])], |
a7e8ffec GI |
184 | [], [with_initscriptdir=auto]) |
185 | ||
d008864d GI |
186 | initddir= |
187 | case "$with_initscriptdir:$cross_compiling:$systemdsystemunitdir" in | |
188 | auto:no:|yes:*) | |
189 | AC_MSG_CHECKING([for init (rc) directory]) | |
190 | for dir in rc.d/init.d init.d rc.d; do | |
191 | if test -d /etc/$dir; then | |
192 | initddir='${sysconfdir}'/$dir | |
193 | break | |
194 | fi | |
195 | done | |
196 | AC_MSG_RESULT([${initddir:-no}]) | |
197 | case "$with_initscriptdir:$initddir" in | |
198 | yes:) AC_MSG_ERROR([Location of init scripts not found]) ;; | |
199 | esac ;; | |
200 | auto:*|no:*) ;; | |
a7e8ffec GI |
201 | *) initddir="$with_initscriptdir" ;; |
202 | esac | |
832b75ed | 203 | AC_SUBST(initddir) |
a7e8ffec GI |
204 | AM_CONDITIONAL(INSTALL_INITSCRIPT, [test -n "$initddir"]) |
205 | ||
206 | # use different init script templates for different OS | |
207 | case "${host}" in | |
208 | *-*-freebsd*) | |
209 | initdfile="smartd.freebsd.initd" | |
210 | ;; | |
211 | *) | |
212 | initdfile="smartd.initd" | |
213 | ;; | |
214 | esac | |
215 | AC_SUBST(initdfile) | |
832b75ed | 216 | |
a23d5117 | 217 | AC_ARG_WITH(docdir, |
d2e702cf | 218 | [AS_HELP_STRING([--with-docdir=DIR], [Location of documentation [DATADIR/doc/smartmontools]])], |
a23d5117 GI |
219 | [docdir="$withval"], |
220 | [ if test -z "$docdir"; then | |
221 | # autoconf 2.5x without '--docdir' support | |
222 | docdir='${datadir}/doc/${PACKAGE}' | |
a23d5117 GI |
223 | fi |
224 | ]) | |
832b75ed GG |
225 | AC_SUBST(docdir) |
226 | ||
cfbba5b9 | 227 | AC_ARG_WITH(exampledir, |
d2e702cf | 228 | [AS_HELP_STRING([--with-exampledir=DIR], [Location of example scripts [DOCDIR/examplescripts]])], |
cfbba5b9 GI |
229 | [exampledir="$withval"], [exampledir='${docdir}/examplescripts']) |
230 | AC_SUBST(exampledir) | |
231 | ||
232 | AC_ARG_ENABLE(drivedb, | |
d2e702cf | 233 | [AS_HELP_STRING([--disable-drivedb], [Disables drive database file])], |
cfbba5b9 | 234 | [], [enable_drivedb=yes]) |
2127e193 GI |
235 | |
236 | AC_ARG_WITH(drivedbdir, | |
d2e702cf | 237 | [AS_HELP_STRING([--with-drivedbdir=DIR], [Location of drive database file [DATADIR/smartmontools]])], |
cfbba5b9 | 238 | [drivedbdir="$withval"; enable_drivedb=yes], |
2127e193 GI |
239 | [drivedbdir=; test "$enable_drivedb" = "yes" && drivedbdir='${datadir}/${PACKAGE}']) |
240 | AC_SUBST(drivedbdir) | |
241 | AM_CONDITIONAL(ENABLE_DRIVEDB, [test "$enable_drivedb" = "yes"]) | |
242 | ||
d2e702cf GI |
243 | AC_ARG_WITH(smartdscriptdir, |
244 | [AS_HELP_STRING([--with-smartdscriptdir=DIR], [Location of smartd_warning.sh script [SYSCONFDIR]])], | |
245 | [smartdscriptdir="$withval"], [smartdscriptdir='${sysconfdir}']) | |
246 | AC_SUBST(smartdscriptdir) | |
247 | ||
248 | AC_ARG_WITH(smartdplugindir, | |
249 | [AS_HELP_STRING([--with-smartdplugindir=@<:@DIR|no@:>@], | |
250 | [Location of smartd_warning.sh plugin scripts [SMARTDSCRIPTDIR/smartd_warning.d]])], | |
251 | [smartdplugindir=; test "$withval" != "no" && smartdplugindir="$withval"], | |
252 | [smartdplugindir='${smartdscriptdir}/smartd_warning.d']) | |
253 | AC_SUBST(smartdplugindir) | |
254 | ||
255 | AC_ARG_ENABLE(savestates, [AS_HELP_STRING([--enable-savestates], [Enables default smartd state files])]) | |
2127e193 GI |
256 | |
257 | AC_ARG_WITH(savestates, | |
d2e702cf GI |
258 | [AS_HELP_STRING([--with-savestates=PREFIX], |
259 | [Prefix for default smartd state files (implies --enable-savestates) [LOCALSTATEDIR/lib/smartmontools/smartd.]])], | |
2127e193 GI |
260 | [savestates="$withval"; enable_savestates="yes"], |
261 | [savestates=; test "$enable_savestates" = "yes" && savestates='${localstatedir}/lib/${PACKAGE}/smartd.']) | |
262 | savestatesdir="${savestates%/*}" | |
263 | AC_SUBST(savestates) | |
264 | AC_SUBST(savestatesdir) | |
265 | AM_CONDITIONAL(ENABLE_SAVESTATES, [test "$enable_savestates" = "yes"]) | |
266 | ||
d2e702cf | 267 | AC_ARG_ENABLE(attributelog, [AS_HELP_STRING([--enable-attributelog], [Enables default smartd attribute log files])]) |
2127e193 GI |
268 | |
269 | AC_ARG_WITH(attributelog, | |
d2e702cf GI |
270 | [AS_HELP_STRING([--with-attributelog=PREFIX], |
271 | [Prefix for default smartd attribute log files (implies --enable-attributelog) [LOCALSTATEDIR/lib/smartmontools/attrlog.]])], | |
2127e193 GI |
272 | [attributelog="$withval"; enable_attributelog="yes"], |
273 | [attributelog=; test "$enable_attributelog" = "yes" && attributelog='${localstatedir}/lib/${PACKAGE}/attrlog.']) | |
274 | attributelogdir="${attributelog%/*}" | |
275 | AC_SUBST(attributelog) | |
276 | AC_SUBST(attributelogdir) | |
277 | AM_CONDITIONAL(ENABLE_ATTRIBUTELOG, [test "$enable_attributelog" = "yes"]) | |
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, | |
314 | [AC_DEFINE(HAVE_LIBCAP_NG, 1, [Define to 1 if you have the `cap-ng' library (-lcap-ng).]) | |
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) | |
326 | AM_CONDITIONAL(ENABLE_CAPABILITIES, [test "$use_libcap_ng" = "yes"]) | |
327 | AC_MSG_RESULT([$use_libcap_ng]) | |
328 | ||
d2e702cf GI |
329 | # Assume broken snprintf only on Windows with MSVCRT (MinGW without ANSI stdio support) |
330 | libc_have_working_snprintf=yes | |
331 | ||
332 | case "$host" in | |
333 | *-*-mingw*) | |
334 | case " $CPPFLAGS $CXXFLAGS" in | |
335 | *\ -[[DU]]__USE_MINGW_ANSI_STDIO*) | |
336 | ;; | |
337 | *) | |
338 | # Older MinGW do not properly define PRI?64 if __USE_MINGW_ANSI_STDIO is set | |
339 | # Newer MinGW set __USE_MINGW_ANSI_STDIO in first C++ include which may be too late | |
340 | AC_MSG_CHECKING([whether __USE_MINGW_ANSI_STDIO is defined by C++ includes]) | |
341 | AC_PREPROC_IFELSE([AC_LANG_SOURCE([[ | |
342 | #undef __USE_MINGW_ANSI_STDIO | |
343 | #include <iostream> | |
344 | #ifndef __USE_MINGW_ANSI_STDIO | |
345 | #error false | |
346 | #endif]])], | |
347 | [CXXFLAGS="-D__USE_MINGW_ANSI_STDIO $CXXFLAGS"], | |
348 | [libc_have_working_snprintf=no]) | |
349 | AC_MSG_RESULT([$libc_have_working_snprintf]) | |
350 | ;; | |
351 | esac ;; | |
352 | esac | |
353 | ||
354 | AC_ARG_WITH(working-snprintf, | |
355 | [AS_HELP_STRING([--with-working-snprintf@<:@=yes|no@:>@], | |
356 | [Function snprintf() handles output truncation as specified by C99 [MinGW:guessed,others:yes]])], | |
357 | [libc_have_working_snprintf=$withval]) | |
358 | ||
359 | if test "$libc_have_working_snprintf" = "yes"; then | |
360 | AC_DEFINE(HAVE_WORKING_SNPRINTF, 1, [Define to 1 if the `snprintf' function is sane]) | |
361 | fi | |
362 | ||
832b75ed GG |
363 | if test "$prefix" = "NONE"; then |
364 | dnl no prefix and no mandir, so use ${prefix}/share/man as default | |
365 | if test "$mandir" = '${prefix}/man'; then | |
366 | AC_SUBST([mandir], ['${prefix}/share/man']) | |
367 | fi | |
368 | fi | |
369 | ||
370 | AC_SUBST(releaseversion,['${PACKAGE}-${VERSION}']) | |
371 | AC_SUBST(smartmontools_release_date) | |
372 | AC_SUBST(smartmontools_release_time) | |
373 | ||
cfbba5b9 GI |
374 | # Set platform-specific modules and symbols |
375 | os_libs= | |
376 | os_dltools='curl wget lynx' | |
ee38a438 GI |
377 | os_mailer=mail |
378 | os_hostname="'hostname'" | |
379 | os_dnsdomainname= | |
380 | os_nisdomainname="'domainname'" | |
cfbba5b9 GI |
381 | os_darwin=no |
382 | os_solaris=no | |
383 | os_win32=no | |
384 | os_win32_mingw=no | |
7f0798ef | 385 | os_win64=no |
d008864d | 386 | os_man_filter= |
832b75ed | 387 | case "${host}" in |
cfbba5b9 | 388 | *-*-linux*) |
ee38a438 GI |
389 | os_deps='os_linux.o cciss.o dev_areca.o' |
390 | os_dnsdomainname="'dnsdomainname' 'hostname -d'" | |
391 | os_nisdomainname="'nisdomainname' 'hostname -y' 'domainname'" | |
d008864d | 392 | os_man_filter=Linux |
cfbba5b9 GI |
393 | ;; |
394 | *-*-freebsd*|*-*-dragonfly*|*-*-kfreebsd*-gnu*) | |
ee38a438 | 395 | os_deps='os_freebsd.o cciss.o dev_areca.o' |
cfbba5b9 GI |
396 | os_libs='-lcam' |
397 | os_dltools='curl wget lynx fetch' | |
398 | AC_CHECK_LIB(usb, libusb20_dev_get_device_desc) | |
d008864d | 399 | os_man_filter=FreeBSD |
cfbba5b9 GI |
400 | ;; |
401 | sparc-*-solaris*) | |
402 | os_deps='os_solaris.o os_solaris_ata.o' | |
403 | os_mailer='mailx' | |
404 | os_solaris=yes | |
d008864d | 405 | os_man_filter=Solaris |
cfbba5b9 GI |
406 | ;; |
407 | *-pc-solaris*) | |
408 | os_deps='os_solaris.o' | |
409 | os_mailer='mailx' | |
410 | os_solaris=yes | |
d008864d | 411 | os_man_filter=Solaris |
cfbba5b9 GI |
412 | ;; |
413 | *-*-netbsd*) | |
414 | os_deps='os_netbsd.o' | |
415 | os_libs='-lutil' | |
d008864d | 416 | os_man_filter=NetBSD |
cfbba5b9 GI |
417 | ;; |
418 | *-*-openbsd*) | |
419 | os_deps='os_openbsd.o' | |
420 | os_libs='-lutil' | |
421 | os_dltools='curl wget lynx ftp' | |
d008864d | 422 | os_man_filter=OpenBSD |
cfbba5b9 GI |
423 | ;; |
424 | *-*-cygwin*) | |
ee38a438 | 425 | os_deps='os_win32.o dev_areca.o' |
d2e702cf | 426 | os_mailer='email' |
ee38a438 GI |
427 | os_hostname="'hostname' 'echo "'"${HOSTNAME?unset}"'"'" |
428 | os_dnsdomainname="'dnsdomainname' 'hostname -d' 'echo "'"${USERDNSDOMAIN?unset}"'"'" | |
429 | os_nisdomainname= | |
cfbba5b9 | 430 | os_win32=yes |
d008864d | 431 | os_man_filter=Cygwin |
cfbba5b9 GI |
432 | ;; |
433 | x86_64-*-mingw*) | |
ee38a438 | 434 | os_deps='os_win32.o dev_areca.o' |
cfbba5b9 GI |
435 | os_win32=yes |
436 | os_win32_mingw=yes | |
437 | os_win64=yes | |
d008864d | 438 | os_man_filter=Windows |
cfbba5b9 GI |
439 | ;; |
440 | *-*-mingw*) | |
ee38a438 | 441 | os_deps='os_win32.o dev_areca.o' |
cfbba5b9 GI |
442 | os_win32=yes |
443 | os_win32_mingw=yes | |
d008864d | 444 | os_man_filter=Windows |
cfbba5b9 GI |
445 | ;; |
446 | *-*-darwin*) | |
447 | os_deps='os_darwin.o' | |
448 | os_libs='-framework CoreFoundation -framework IOKit' | |
449 | os_darwin=yes | |
d008864d | 450 | os_man_filter=Darwin |
cfbba5b9 GI |
451 | ;; |
452 | *-*-nto-qnx*) | |
453 | os_deps='os_qnxnto.o' | |
454 | ;; | |
455 | *) | |
456 | os_deps='os_generic.o' | |
457 | ;; | |
832b75ed GG |
458 | esac |
459 | ||
2127e193 GI |
460 | # Replace if '--with-os-deps' was specified |
461 | test -z "$with_os_deps" || os_deps="$with_os_deps" | |
832b75ed | 462 | |
2127e193 GI |
463 | # Check if we need adapter to old interface (dev_legacy.cpp) |
464 | os_src=`echo "${os_deps}"|sed -n 's,^\([[^ .]]*\)\.o.*$,\1.cpp,p'` | |
465 | AC_MSG_CHECKING([whether ${os_src} uses new interface]) | |
466 | if grep "smart_interface" "${srcdir}/${os_src}" >/dev/null 2>&1; then | |
467 | os_new_interface=yes | |
468 | else | |
469 | os_new_interface=no | |
470 | os_deps="${os_deps} dev_legacy.o" | |
471 | AC_DEFINE(OLD_INTERFACE, 1, [Define to 1 if os_*.cpp still uses the old interface]) | |
472 | fi | |
473 | AC_MSG_RESULT([$os_new_interface]) | |
474 | ||
cfbba5b9 GI |
475 | AC_SUBST([os_deps]) |
476 | AC_SUBST([os_libs]) | |
477 | AC_SUBST([os_dltools]) | |
ee38a438 GI |
478 | AC_SUBST([os_mailer]) |
479 | AC_SUBST([os_hostname]) | |
480 | AC_SUBST([os_dnsdomainname]) | |
481 | AC_SUBST([os_nisdomainname]) | |
d008864d | 482 | AC_SUBST([os_man_filter]) |
cfbba5b9 GI |
483 | |
484 | # Create drivedb.h update branch name from version: 5.41[.X] -> RELEASE_5_41_DRIVEDB | |
485 | DRIVEDB_BRANCH=`echo $VERSION | sed 's,^\([[0-9]]*\.[[0-9]]*\)\..*$,\1,' \ | |
486 | | sed -n 's,^\([[0-9]][[0-9]]*\)\.\([[0-9]][[0-9]]*\)$,RELEASE_\1_\2_DRIVEDB,p'` | |
487 | if test -z "$DRIVEDB_BRANCH"; then | |
488 | AC_MSG_ERROR([Unable to create DRIVEDB_BRANCH from VERSION=$VERSION]) | |
489 | fi | |
490 | AC_SUBST([DRIVEDB_BRANCH]) | |
491 | ||
492 | # Enable platform-specific makefile sections | |
493 | AM_CONDITIONAL(OS_DARWIN, [test "$os_darwin" = "yes"]) | |
494 | AM_CONDITIONAL(OS_SOLARIS, [test "$os_solaris" = "yes"]) | |
495 | AM_CONDITIONAL(OS_WIN32, [test "$os_win32" = "yes"]) | |
496 | AM_CONDITIONAL(OS_WIN32_MINGW, [test "$os_win32_mingw" = "yes"]) | |
497 | AM_CONDITIONAL(OS_WIN32_NSIS, [test -n "$MAKENSIS"]) | |
7f0798ef | 498 | AM_CONDITIONAL(OS_WIN64, [test "$os_win64" = "yes"]) |
832b75ed | 499 | |
bed94269 GI |
500 | dnl Add -Wall and -W if using g++ and its not already specified. |
501 | if test "$GXX" = "yes"; then | |
4d59bff9 GG |
502 | if test -z "`echo "$CXXFLAGS" | grep "\-Wall" 2> /dev/null`" ; then |
503 | CXXFLAGS="$CXXFLAGS -Wall" | |
832b75ed GG |
504 | fi |
505 | # In the next line, do NOT delete the 2 spaces inside double quotes. | |
4d59bff9 GG |
506 | if test -z "`echo "$CXXFLAGS " | grep "\-W " 2> /dev/null`" ; then |
507 | CXXFLAGS="$CXXFLAGS -W" | |
832b75ed | 508 | fi |
bed94269 | 509 | |
832b75ed GG |
510 | else |
511 | dnl We are NOT using gcc, so enable host-specific compiler flags | |
512 | case "${host}" in | |
34ad0c5f GG |
513 | sparc*-*-solaris*) |
514 | dnl set CXXFLAGS for Solaris/SPARC C++ compiler | |
4d59bff9 | 515 | if test -z "`echo "$CXXFLAGS" | grep "\-xmemalign" 2> /dev/null`" ; then |
832b75ed | 516 | dnl we have to tell the compilers about packed ATA structures |
4d59bff9 | 517 | CXXFLAGS="-xmemalign=1i $CXXFLAGS" |
832b75ed | 518 | fi |
34ad0c5f GG |
519 | esac |
520 | case "${host}" in | |
521 | *-*-solaris*) | |
4d59bff9 | 522 | if test -z "`echo "$CXXFLAGS" | grep "\-xO" 2> /dev/null`" ; then |
832b75ed | 523 | dnl turn on optimization if user has not explicitly set its value |
4d59bff9 | 524 | CXXFLAGS="-xO2 $CXXFLAGS" |
832b75ed | 525 | fi |
4d59bff9 | 526 | if test -z "`echo "$CXXFLAGS" | grep "\-erroff" 2> /dev/null`" ; then |
2127e193 GI |
527 | dnl suppress trivial warnings |
528 | CXXFLAGS="-erroff=%none,wbadinitl,wbadasgl,badargtypel2w,badargtype2w $CXXFLAGS" | |
4d59bff9 | 529 | fi |
832b75ed GG |
530 | esac |
531 | fi | |
532 | ||
533 | AC_DEFINE_UNQUOTED(SMARTMONTOOLS_BUILD_HOST, "${host}", [smartmontools Build Host]) | |
534 | ||
4d59bff9 | 535 | AC_SUBST(CXXFLAGS) |
832b75ed | 536 | |
cfbba5b9 GI |
537 | AC_CONFIG_FILES(Makefile) |
538 | AC_OUTPUT | |
832b75ed | 539 | AC_PROG_MAKE_SET |
a23d5117 | 540 | |
e9583e0c GI |
541 | echo "-----------------------------------------------------------------------------" >&AS_MESSAGE_FD |
542 | echo "${PACKAGE}-${VERSION} configuration:" >&AS_MESSAGE_FD | |
543 | echo "host operating system: $host" >&AS_MESSAGE_FD | |
544 | echo "C++ compiler: $CXX" >&AS_MESSAGE_FD | |
cfbba5b9 | 545 | echo "C compiler: $CC" >&AS_MESSAGE_FD |
e9583e0c GI |
546 | echo "preprocessor flags: $CPPFLAGS" >&AS_MESSAGE_FD |
547 | echo "C++ compiler flags: $CXXFLAGS" >&AS_MESSAGE_FD | |
cfbba5b9 | 548 | echo "C compiler flags: $CFLAGS" >&AS_MESSAGE_FD |
e9583e0c | 549 | echo "linker flags: $LDFLAGS" >&AS_MESSAGE_FD |
cfbba5b9 | 550 | echo "OS specific modules: $os_deps $os_libs $LIBS" >&AS_MESSAGE_FD |
e9583e0c GI |
551 | |
552 | case "$host_os" in | |
553 | mingw*) | |
cfbba5b9 GI |
554 | echo "resource compiler: $WINDRES" >&AS_MESSAGE_FD |
555 | echo "message compiler: $WINDMC" >&AS_MESSAGE_FD | |
556 | echo "NSIS compiler: $MAKENSIS" >&AS_MESSAGE_FD | |
e9583e0c GI |
557 | if test -n "$drivedbdir"; then |
558 | echo "drive database file: EXEDIR/drivedb.h" >&AS_MESSAGE_FD | |
cfbba5b9 GI |
559 | if test -n "$MAKENSIS"; then |
560 | echo "database update tool: EXEDIR/update-smart-drivedb.exe" >&AS_MESSAGE_FD | |
561 | fi | |
e9583e0c GI |
562 | else |
563 | echo "drive database file: [[disabled]]" >&AS_MESSAGE_FD | |
564 | fi | |
565 | if test -n "$savestates"; then | |
566 | echo "smartd save files: `eval eval eval echo $savestates`MODEL-SERIAL.TYPE.state" >&AS_MESSAGE_FD | |
567 | fi | |
568 | if test -n "$attributelog"; then | |
569 | echo "smartd attribute logs: `eval eval eval echo $attributelog`MODEL-SERIAL.TYPE.csv" >&AS_MESSAGE_FD | |
570 | fi | |
571 | ;; | |
572 | ||
573 | *) | |
574 | echo "binary install path: `eval eval eval echo $sbindir`" >&AS_MESSAGE_FD | |
575 | echo "man page install path: `eval eval eval echo $mandir`" >&AS_MESSAGE_FD | |
576 | echo "doc file install path: `eval eval eval echo $docdir`" >&AS_MESSAGE_FD | |
cfbba5b9 | 577 | echo "examples install path: `eval eval eval echo $exampledir`" >&AS_MESSAGE_FD |
e9583e0c GI |
578 | if test -n "$drivedbdir"; then |
579 | echo "drive database file: `eval eval eval echo $drivedbdir`/drivedb.h" >&AS_MESSAGE_FD | |
580 | echo "database update script: `eval eval eval echo $sbindir`/update-smart-drivedb" >&AS_MESSAGE_FD | |
cfbba5b9 | 581 | echo "download tools: `eval eval eval echo $os_dltools`" >&AS_MESSAGE_FD |
e9583e0c GI |
582 | else |
583 | echo "drive database file: [[disabled]]" >&AS_MESSAGE_FD | |
e9583e0c GI |
584 | fi |
585 | echo "local drive database: `eval eval eval echo $sysconfdir`/smart_drivedb.h" >&AS_MESSAGE_FD | |
586 | echo "smartd config file: `eval eval eval echo $sysconfdir`/smartd.conf${smartd_suffix}" >&AS_MESSAGE_FD | |
d2e702cf GI |
587 | echo "smartd warning script: `eval eval eval echo $smartdscriptdir`/smartd_warning.sh" >&AS_MESSAGE_FD |
588 | if test -n "$smartdplugindir"; then | |
589 | echo "smartd plugin path: `eval eval eval echo $smartdplugindir`" >&AS_MESSAGE_FD | |
590 | else | |
591 | echo "smartd plugin path: [[disabled]]" >&AS_MESSAGE_FD | |
592 | fi | |
a7e8ffec GI |
593 | if test -n "$initddir"; then |
594 | echo "smartd initd script: `eval eval eval echo $initddir`/smartd${smartd_suffix}" >&AS_MESSAGE_FD | |
595 | elif test -z "$systemdsystemunitdir"; then | |
596 | echo "smartd initd script: [[disabled]]" >&AS_MESSAGE_FD | |
597 | fi | |
598 | if test -n "$systemdsystemunitdir"; then | |
599 | echo "smartd systemd file: `eval eval eval echo $systemdsystemunitdir`/smartd.service" >&AS_MESSAGE_FD | |
d2e702cf GI |
600 | if test -n "$systemdenvfile"; then |
601 | echo "smartd environ file: `eval eval eval echo $systemdenvfile`" >&AS_MESSAGE_FD | |
602 | else | |
603 | echo "smartd environ file: [[disabled]]" >&AS_MESSAGE_FD | |
604 | fi | |
a7e8ffec | 605 | fi |
e9583e0c GI |
606 | if test -n "$savestates"; then |
607 | echo "smartd save files: `eval eval eval echo $savestates`MODEL-SERIAL.TYPE.state" >&AS_MESSAGE_FD | |
608 | else | |
609 | echo "smartd save files: [[disabled]]" >&AS_MESSAGE_FD | |
610 | fi | |
611 | if test -n "$attributelog"; then | |
612 | echo "smartd attribute logs: `eval eval eval echo $attributelog`MODEL-SERIAL.TYPE.csv" >&AS_MESSAGE_FD | |
613 | else | |
614 | echo "smartd attribute logs: [[disabled]]" >&AS_MESSAGE_FD | |
615 | fi | |
616 | echo "libcap-ng support: $use_libcap_ng" >&AS_MESSAGE_FD | |
617 | case "$host_os" in | |
618 | linux*) echo "SELinux support: ${with_selinux-no}" >&AS_MESSAGE_FD ;; | |
619 | esac | |
620 | ;; | |
621 | esac | |
622 | echo "-----------------------------------------------------------------------------" >&AS_MESSAGE_FD |