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