]> git.proxmox.com Git - mirror_smartmontools-debian.git/blob - configure.ac
Stop passing arguments to dh_installinit
[mirror_smartmontools-debian.git] / configure.ac
1 #
2 # $Id: configure.ac 4181 2015-12-07 20:58:40Z chrfranke $
3 #
4 dnl Process this file with autoconf to produce a configure script.
5 AC_PREREQ([2.60])
6 AC_INIT(smartmontools, 6.5, smartmontools-support@lists.sourceforge.net)
7 AM_INIT_AUTOMAKE([1.10 foreign])
8
9 smartmontools_cvs_tag=`echo '$Id: configure.ac 4181 2015-12-07 20:58:40Z 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://www.smartmontools.org/", [smartmontools Home Page])
18
19 AC_CONFIG_SRCDIR([smartctl.cpp])
20 AC_CONFIG_HEADER([config.h])
21
22 AM_MAINTAINER_MODE
23
24 AC_LANG([C++])
25 dnl Checks for programs.
26 AC_PROG_CXX
27 AM_PROG_AS
28 AC_PROG_INSTALL
29
30 m4_pattern_forbid([^PKG_PROG_])
31 if test "$cross_compiling" = "no"; then
32 m4_ifdef([PKG_PROG_PKG_CONFIG], [PKG_PROG_PKG_CONFIG],
33 [AC_MSG_WARN([m4/pkg.m4 missing, systemd detection disabled])])
34 fi
35
36 AC_ARG_VAR(WINDMC, [Windows message compiler command])
37 AC_ARG_VAR(WINDRES, [Windows resource compiler command])
38 AC_ARG_VAR(MAKENSIS, [NSIS compiler command])
39
40 AC_CANONICAL_HOST
41 case "${host}" in
42 *-*-mingw*)
43 AC_CHECK_TOOL(WINDMC, [windmc])
44 AC_CHECK_TOOL(WINDRES, [windres])
45
46 AC_MSG_CHECKING([for makensis])
47 if test -z "$MAKENSIS"; then
48 if test -n "$PROGRAMFILES" && "$PROGRAMFILES/NSIS/makensis" -VERSION >/dev/null 2>&1; then
49 MAKENSIS="$PROGRAMFILES/NSIS/makensis"
50 elif makensis -VERSION >/dev/null 2>&1; then
51 MAKENSIS=makensis
52 fi
53 fi
54 AC_MSG_RESULT([${MAKENSIS:-no}])
55 ;;
56 esac
57
58 # Check for SVN.
59 AC_MSG_CHECKING([whether this is a build from SVN])
60 is_svn_build=no
61 svn_deps=
62 if test -f "$srcdir/.svn/wc.db"; then
63 # SVN 1.7, 1.8 working copy
64 svn_deps='${srcdir}/.svn/wc.db'
65 elif test -f "${srcdir}/.svn/entries"; then
66 # SVN <= 1.6 working copy (SVN 1.7 has empty entries file)
67 svn_deps='${srcdir}/.svn/entries'
68 fi
69 if test -n "$svn_deps"; then
70 is_svn_build=unknown
71 if (cd "$srcdir" && svn --version && svnversion && svn info) >/dev/null 2>&1; then
72 is_svn_build=yes
73 fi
74 fi
75 AC_SUBST([svn_deps])
76 AM_CONDITIONAL(IS_SVN_BUILD, [test "$is_svn_build" = "yes"])
77 AC_MSG_RESULT([$is_svn_build])
78
79 # Note: On Linux, clock_gettime() requires -lrt which implies -lpthreads
80 # Check ommitted for now, gettimeofday() provides reasonable precision
81 # AC_SEARCH_LIBS(clock_gettime, rt)
82
83 dnl Checks for header files.
84 AC_CHECK_HEADERS([locale.h])
85 AC_CHECK_HEADERS([dev/ata/atavar.h])
86 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])
97 dnl This header file is needed for cciss_ioctl.h at least on SuSE LINUX
98 AC_CHECK_HEADERS([linux/compiler.h])
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 )
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 ])
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])
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.
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"])
124
125 AC_CHECK_FUNCS([sigset])
126 AC_CHECK_FUNCS([strtoull])
127 AC_CHECK_FUNCS([uname])
128 AC_CHECK_FUNCS([clock_gettime ftime gettimeofday])
129
130 # Check byte ordering (defines WORDS_BIGENDIAN)
131 AC_C_BIGENDIAN
132
133 # check for __attribute__((packed))
134 # (sizeof() check is required to avoid false positives if other
135 # __attribute__((x)) are supported)
136 AC_MSG_CHECKING([whether $CXX supports __attribute__((packed))])
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])
141 AC_SUBST(gcc_have_attr_packed)
142 if test "$gcc_have_attr_packed" = "yes"; then
143 AC_DEFINE(HAVE_ATTR_PACKED, 1, [Define to 1 if C++ compiler supports __attribute__((packed))])
144 fi
145 AC_MSG_RESULT([$gcc_have_attr_packed])
146
147 AC_SUBST(CPPFLAGS)
148 AC_SUBST(LDFLAGS)
149 AC_SUBST(ASFLAGS)
150
151 AC_ARG_WITH(systemdsystemunitdir,
152 [AS_HELP_STRING([--with-systemdsystemunitdir@<:@=DIR|auto|yes|no@:>@], [Location of systemd service files [auto]])],
153 [], [with_systemdsystemunitdir=auto])
154
155 systemdsystemunitdir=
156 case "$with_systemdsystemunitdir" in
157 auto|yes)
158 if test -n "$PKG_CONFIG"; then
159 AC_MSG_CHECKING([for systemdsystemunitdir])
160 systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd 2>/dev/null`
161 AC_MSG_RESULT([${systemdsystemunitdir:-no}])
162 fi
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
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
198 AC_ARG_WITH(initscriptdir,
199 [AS_HELP_STRING([--with-initscriptdir@<:@=DIR|auto|yes|no@:>@], [Location of init scripts [auto]])],
200 [], [with_initscriptdir=auto])
201
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:*) ;;
217 *) initddir="$with_initscriptdir" ;;
218 esac
219 AC_SUBST(initddir)
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)
232
233 AC_ARG_WITH(exampledir,
234 [AS_HELP_STRING([--with-exampledir=DIR], [Location of example scripts [DOCDIR/examplescripts]])],
235 [exampledir="$withval"], [exampledir='${docdir}/examplescripts'])
236 AC_SUBST(exampledir)
237
238 drivedbdir='${datadir}/${PACKAGE}'
239 AC_ARG_WITH(drivedbdir,
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])
242 AC_SUBST(drivedbdir)
243 AM_CONDITIONAL(ENABLE_DRIVEDB, [test -n "$drivedbdir"])
244
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
257 savestates=
258 AC_ARG_WITH(savestates,
259 [AS_HELP_STRING([--with-savestates@<:@=PREFIX|yes|no@:>@],
260 [Enable default smartd state files [no] (yes=LOCALSTATEDIR/lib/smartmontools/smartd.)])],
261 [case "$withval" in yes) savestates='${localstatedir}/lib/${PACKAGE}/smartd.' ;;
262 no) ;; *) savestates="$withval" ;; esac])
263 savestatesdir="${savestates%/*}"
264 AC_SUBST(savestates)
265 AC_SUBST(savestatesdir)
266 AM_CONDITIONAL(ENABLE_SAVESTATES, [test -n "$savestates"])
267
268 attributelog=
269 AC_ARG_WITH(attributelog,
270 [AS_HELP_STRING([--with-attributelog@<:@=PREFIX|yes|no@:>@],
271 [Enable default smartd attribute log files [no] (yes=LOCALSTATEDIR/lib/smartmontools/attrlog.)])],
272 [case "$withval" in yes) attributelog='${localstatedir}/lib/${PACKAGE}/attrlog.' ;;
273 no) ;; *) attributelog="$withval" ;; esac])
274 attributelogdir="${attributelog%/*}"
275 AC_SUBST(attributelog)
276 AC_SUBST(attributelogdir)
277 AM_CONDITIONAL(ENABLE_ATTRIBUTELOG, [test -n "$attributelog"])
278
279 AC_ARG_ENABLE(sample,
280 [AS_HELP_STRING([--enable-sample], [Enables appending .sample to the installed smartd rc script and configuration file])],
281 [smartd_suffix=; test "$enableval" = "yes" && smartd_suffix=".sample"],
282 [smartd_suffix=;])
283 AC_SUBST(smartd_suffix)
284
285 AC_ARG_WITH(os-deps,
286 [AS_HELP_STRING([--with-os-deps='os_module.o ...'], [Specify OS dependent module(s) [guessed]])],
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
295 AC_ARG_WITH(selinux,
296 [AS_HELP_STRING([--with-selinux@<:@=yes|no@:>@], [Enables SELinux support [no]])],
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 ],[])
302 AC_SUBST(with_selinux)
303 if test "$with_selinux" = "yes"; then
304 AC_DEFINE(WITH_SELINUX, 1, [Define to 1 if SELinux support is enabled])
305 fi
306
307 AC_ARG_WITH(libcap-ng,
308 [AS_HELP_STRING([--with-libcap-ng@<:@=auto|yes|no@:>@], [Add Libcap-ng support to smartd [auto]])],
309 [], [with_libcap_ng=auto])
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).]) dnl `vim syntax
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 AC_MSG_RESULT([$use_libcap_ng])
327
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
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
374 AC_DEFINE(HAVE_WORKING_SNPRINTF, 1, [Define to 1 if the `snprintf' function is sane.]) dnl `vim syntax
375 fi
376
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.])
410 fi
411
412
413 AC_SUBST(releaseversion,['${PACKAGE}-${VERSION}'])
414 AC_SUBST(smartmontools_release_date)
415 AC_SUBST(smartmontools_release_time)
416
417 # Set platform-specific modules and symbols
418 os_libs=
419 os_dltools='curl wget lynx svn'
420 os_mailer=mail
421 os_hostname="'hostname'"
422 os_dnsdomainname=
423 os_nisdomainname="'domainname'"
424 os_darwin=no
425 os_solaris=no
426 os_win32=no
427 os_win32_mingw=no
428 os_win64=no
429 os_man_filter=
430 case "${host}" in
431 *-*-linux*)
432 os_deps='os_linux.o cciss.o dev_areca.o'
433 os_dnsdomainname="'dnsdomainname' 'hostname -d'"
434 os_nisdomainname="'nisdomainname' 'hostname -y' 'domainname'"
435 os_man_filter=Linux
436 ;;
437 *-*-freebsd*|*-*-dragonfly*|*-*-kfreebsd*-gnu*)
438 os_deps='os_freebsd.o cciss.o dev_areca.o'
439 os_libs='-lcam'
440 os_dltools='curl wget lynx fetch svn'
441 AC_CHECK_LIB(usb, libusb20_dev_get_device_desc)
442 os_man_filter=FreeBSD
443 ;;
444 sparc-*-solaris*)
445 os_deps='os_solaris.o'
446 test "$with_solaris_sparc_ata" = "yes" \
447 && os_deps="$os_deps os_solaris_ata.o"
448 os_mailer='mailx'
449 os_solaris=yes
450 os_man_filter=Solaris
451 ;;
452 *-pc-solaris*)
453 os_deps='os_solaris.o'
454 os_mailer='mailx'
455 os_solaris=yes
456 os_man_filter=Solaris
457 ;;
458 *-*-netbsd*)
459 os_deps='os_netbsd.o'
460 os_libs='-lutil'
461 os_man_filter=NetBSD
462 ;;
463 *-*-openbsd*)
464 os_deps='os_openbsd.o'
465 os_libs='-lutil'
466 os_dltools='curl wget lynx ftp svn'
467 os_man_filter=OpenBSD
468 ;;
469 *-*-cygwin*)
470 os_deps='os_win32.o dev_areca.o'
471 os_mailer='email'
472 os_hostname="'hostname' 'echo "'"${HOSTNAME?unset}"'"'"
473 os_dnsdomainname="'dnsdomainname' 'hostname -d' 'echo "'"${USERDNSDOMAIN?unset}"'"'"
474 os_nisdomainname=
475 os_win32=yes
476 os_man_filter=Cygwin
477 ;;
478 x86_64-*-mingw*)
479 os_deps='os_win32.o dev_areca.o'
480 os_win32=yes
481 os_win32_mingw=yes
482 os_win64=yes
483 os_man_filter=Windows
484 ;;
485 *-*-mingw*)
486 os_deps='os_win32.o dev_areca.o'
487 os_win32=yes
488 os_win32_mingw=yes
489 os_man_filter=Windows
490 ;;
491 *-*-darwin*)
492 os_deps='os_darwin.o'
493 os_libs='-framework CoreFoundation -framework IOKit'
494 os_darwin=yes
495 os_man_filter=Darwin
496 ;;
497 *-*-nto-qnx*)
498 os_deps='os_qnxnto.o'
499 ;;
500 *)
501 os_deps='os_generic.o'
502 ;;
503 esac
504
505 # Replace if '--with-os-deps' was specified
506 test -z "$with_os_deps" || os_deps="$with_os_deps"
507
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
520 AC_SUBST([os_deps])
521 AC_SUBST([os_libs])
522 AC_SUBST([os_dltools])
523 AC_SUBST([os_mailer])
524 AC_SUBST([os_hostname])
525 AC_SUBST([os_dnsdomainname])
526 AC_SUBST([os_nisdomainname])
527 AC_SUBST([os_man_filter])
528 AC_SUBST([os_win32_manifest])
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"])
544 AM_CONDITIONAL(OS_WIN64, [test "$os_win64" = "yes"])
545
546 dnl Add -Wall and -W if using g++ and its not already specified.
547 if test "$GXX" = "yes"; then
548 if test -z "`echo "$CXXFLAGS" | grep "\-Wall" 2> /dev/null`" ; then
549 CXXFLAGS="$CXXFLAGS -Wall"
550 fi
551 # In the next line, do NOT delete the 2 spaces inside double quotes.
552 if test -z "`echo "$CXXFLAGS " | grep "\-W " 2> /dev/null`" ; then
553 CXXFLAGS="$CXXFLAGS -W"
554 fi
555
556 else
557 dnl We are NOT using gcc, so enable host-specific compiler flags
558 case "${host}" in
559 sparc*-*-solaris*)
560 dnl set CXXFLAGS for Solaris/SPARC C++ compiler
561 if test -z "`echo "$CXXFLAGS" | grep "\-xmemalign" 2> /dev/null`" ; then
562 dnl we have to tell the compilers about packed ATA structures
563 CXXFLAGS="-xmemalign=1i $CXXFLAGS"
564 fi
565 esac
566 case "${host}" in
567 *-*-solaris*)
568 if test -z "`echo "$CXXFLAGS" | grep "\-xO" 2> /dev/null`" ; then
569 dnl turn on optimization if user has not explicitly set its value
570 CXXFLAGS="-xO2 $CXXFLAGS"
571 fi
572 if test -z "`echo "$CXXFLAGS" | grep "\-erroff" 2> /dev/null`" ; then
573 dnl suppress trivial warnings
574 CXXFLAGS="-erroff=%none,wbadinitl,wbadasgl,badargtypel2w,badargtype2w $CXXFLAGS"
575 fi
576 esac
577 fi
578
579 AC_DEFINE_UNQUOTED(SMARTMONTOOLS_BUILD_HOST, "${host}", [smartmontools Build Host])
580
581 AC_SUBST(CXXFLAGS)
582
583 AC_CONFIG_FILES(Makefile)
584 AC_OUTPUT
585 AC_PROG_MAKE_SET
586
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
591 echo "C compiler: $CC" >&AS_MESSAGE_FD
592 echo "preprocessor flags: $CPPFLAGS" >&AS_MESSAGE_FD
593 echo "C++ compiler flags: $CXXFLAGS" >&AS_MESSAGE_FD
594 echo "C compiler flags: $CFLAGS" >&AS_MESSAGE_FD
595 echo "linker flags: $LDFLAGS" >&AS_MESSAGE_FD
596 echo "OS specific modules: $os_deps $os_libs $LIBS" >&AS_MESSAGE_FD
597
598 case "$host_os" in
599 mingw*)
600 echo "application manifest: ${os_win32_manifest:-built-in}" >&AS_MESSAGE_FD
601 echo "resource compiler: $WINDRES" >&AS_MESSAGE_FD
602 echo "message compiler: $WINDMC" >&AS_MESSAGE_FD
603 echo "NSIS compiler: $MAKENSIS" >&AS_MESSAGE_FD
604 if test -n "$drivedbdir"; then
605 echo "drive database file: EXEDIR/drivedb.h" >&AS_MESSAGE_FD
606 if test -n "$MAKENSIS"; then
607 echo "database update tool: EXEDIR/update-smart-drivedb.exe" >&AS_MESSAGE_FD
608 fi
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
624 echo "examples install path: `eval eval eval echo $exampledir`" >&AS_MESSAGE_FD
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
628 echo "download tools: `eval eval eval echo $os_dltools`" >&AS_MESSAGE_FD
629 else
630 echo "drive database file: [[disabled]]" >&AS_MESSAGE_FD
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
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
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
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
652 fi
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
670
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