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