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