]> git.proxmox.com Git - mirror_smartmontools-debian.git/blame - configure.ac
Stop passing arguments to dh_installinit
[mirror_smartmontools-debian.git] / configure.ac
CommitLineData
832b75ed 1#
6b80b4d2 2# $Id: configure.ac 4181 2015-12-07 20:58:40Z chrfranke $
832b75ed
GG
3#
4dnl Process this file with autoconf to produce a configure script.
6b80b4d2
JD
5AC_PREREQ([2.60])
6AC_INIT(smartmontools, 6.5, smartmontools-support@lists.sourceforge.net)
7AM_INIT_AUTOMAKE([1.10 foreign])
832b75ed 8
6b80b4d2 9smartmontools_cvs_tag=`echo '$Id: configure.ac 4181 2015-12-07 20:58:40Z chrfranke $'`
293b5ab8
JD
10smartmontools_release_date=2015-06-04
11smartmontools_release_time="16:29:41 UTC"
832b75ed
GG
12
13AC_DEFINE_UNQUOTED(SMARTMONTOOLS_CONFIGURE_ARGS, "$ac_configure_args", [smartmontools Configure Arguments])
832b75ed
GG
14AC_DEFINE_UNQUOTED(SMARTMONTOOLS_RELEASE_DATE, "$smartmontools_release_date", [smartmontools Release Date])
15AC_DEFINE_UNQUOTED(SMARTMONTOOLS_RELEASE_TIME, "$smartmontools_release_time", [smartmontools Release Time])
16AC_DEFINE_UNQUOTED(CONFIG_H_CVSID, "$smartmontools_cvs_tag", [smartmontools CVS Tag])
6b80b4d2 17AC_DEFINE_UNQUOTED(PACKAGE_HOMEPAGE, "http://www.smartmontools.org/", [smartmontools Home Page])
832b75ed 18
6b80b4d2 19AC_CONFIG_SRCDIR([smartctl.cpp])
d2e702cf 20AC_CONFIG_HEADER([config.h])
832b75ed 21
832b75ed
GG
22AM_MAINTAINER_MODE
23
d2e702cf 24AC_LANG([C++])
832b75ed 25dnl Checks for programs.
4d59bff9 26AC_PROG_CXX
832b75ed
GG
27AM_PROG_AS
28AC_PROG_INSTALL
d008864d
GI
29
30m4_pattern_forbid([^PKG_PROG_])
31if 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])])
34fi
832b75ed 35
cfbba5b9
GI
36AC_ARG_VAR(WINDMC, [Windows message compiler command])
37AC_ARG_VAR(WINDRES, [Windows resource compiler command])
38AC_ARG_VAR(MAKENSIS, [NSIS compiler command])
39
832b75ed 40AC_CANONICAL_HOST
832b75ed 41case "${host}" in
cfbba5b9 42 *-*-mingw*)
ee38a438
GI
43 AC_CHECK_TOOL(WINDMC, [windmc])
44 AC_CHECK_TOOL(WINDRES, [windres])
cfbba5b9 45
d2e702cf 46 AC_MSG_CHECKING([for makensis])
cfbba5b9
GI
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}])
cfbba5b9 55 ;;
832b75ed
GG
56esac
57
2127e193
GI
58# Check for SVN.
59AC_MSG_CHECKING([whether this is a build from SVN])
60is_svn_build=no
e165493d 61svn_deps=
3d17a85c
GI
62if test -f "$srcdir/.svn/wc.db"; then
63 # SVN 1.7, 1.8 working copy
64 svn_deps='${srcdir}/.svn/wc.db'
65elif 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'
68fi
69if test -n "$svn_deps"; then
2127e193
GI
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
74fi
e165493d 75AC_SUBST([svn_deps])
2127e193
GI
76AM_CONDITIONAL(IS_SVN_BUILD, [test "$is_svn_build" = "yes"])
77AC_MSG_RESULT([$is_svn_build])
78
e165493d
GI
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
832b75ed
GG
83dnl Checks for header files.
84AC_CHECK_HEADERS([locale.h])
832b75ed
GG
85AC_CHECK_HEADERS([dev/ata/atavar.h])
86AC_CHECK_HEADERS([netdb.h])
87dnl we need [u]int64_t and friends.
88AC_CHECK_HEADERS([inttypes.h]) dnl C99, UNIX98, solaris 2.6+
89AC_CHECK_HEADERS([stdint.h]) dnl C99
90AC_CHECK_HEADERS([sys/inttypes.h]) dnl pre-UNIX98
91AC_CHECK_HEADERS([sys/int_types.h]) dnl pre-UNIX98, solaris 2.6+
92dnl Check for FreeBSD twe include files...currently missing on 5.2, but should be there
93AC_CHECK_HEADERS([sys/tweio.h])
94AC_CHECK_HEADERS([sys/twereg.h])
95dnl Check for FreeBSD twa include files...
96AC_CHECK_HEADERS([sys/tw_osl_ioctl.h])
1953ff6d 97dnl This header file is needed for cciss_ioctl.h at least on SuSE LINUX
ba59cff1 98AC_CHECK_HEADERS([linux/compiler.h])
d008864d
GI
99dnl Check for the FreeBSD CCISS system header and use internal one if not found
100AC_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 )
1953ff6d
GG
104dnl Check for Linux CCISS include file
105AC_CHECK_HEADERS([linux/cciss_ioctl.h], [], [], [AC_INCLUDES_DEFAULT
106#ifdef HAVE_LINUX_COMPILER_H
107# include <linux/compiler.h>
108#endif
109])
cfbba5b9
GI
110dnl Check for Windows DDK and WMI header files
111AC_CHECK_HEADERS([ntdddisk.h ddk/ntdddisk.h], [], [], [AC_INCLUDES_DEFAULT
112#include <windows.h>
113])
114AC_CHECK_HEADERS([wbemcli.h])
832b75ed
GG
115
116dnl Checks for typedefs, structures, and compiler characteristics.
117AC_CHECK_TYPES([int64_t, uint64_t])
118
119dnl Checks for library functions.
e9583e0c
GI
120AC_CHECK_FUNCS([getopt_long], [need_getopt_long=no], [need_getopt_long=yes])
121AM_CONDITIONAL(NEED_GETOPT_LONG, [test "$need_getopt_long" = "yes"])
122AC_CHECK_FUNCS([regcomp], [need_regex=no], [need_regex=yes])
123AM_CONDITIONAL(NEED_REGEX, [test "$need_regex" = "yes"])
2127e193 124
832b75ed
GG
125AC_CHECK_FUNCS([sigset])
126AC_CHECK_FUNCS([strtoull])
127AC_CHECK_FUNCS([uname])
e165493d 128AC_CHECK_FUNCS([clock_gettime ftime gettimeofday])
832b75ed 129
e9583e0c
GI
130# Check byte ordering (defines WORDS_BIGENDIAN)
131AC_C_BIGENDIAN
132
832b75ed 133# check for __attribute__((packed))
d008864d
GI
134# (sizeof() check is required to avoid false positives if other
135# __attribute__((x)) are supported)
7f0798ef 136AC_MSG_CHECKING([whether $CXX supports __attribute__((packed))])
d008864d
GI
137AC_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])
832b75ed
GG
141AC_SUBST(gcc_have_attr_packed)
142if test "$gcc_have_attr_packed" = "yes"; then
cfbba5b9 143 AC_DEFINE(HAVE_ATTR_PACKED, 1, [Define to 1 if C++ compiler supports __attribute__((packed))])
832b75ed
GG
144fi
145AC_MSG_RESULT([$gcc_have_attr_packed])
146
147AC_SUBST(CPPFLAGS)
148AC_SUBST(LDFLAGS)
149AC_SUBST(ASFLAGS)
150
a7e8ffec
GI
151AC_ARG_WITH(systemdsystemunitdir,
152 [AS_HELP_STRING([--with-systemdsystemunitdir@<:@=DIR|auto|yes|no@:>@], [Location of systemd service files [auto]])],
293b5ab8 153 [], [with_systemdsystemunitdir=auto])
a7e8ffec
GI
154
155systemdsystemunitdir=
156case "$with_systemdsystemunitdir" in
157 auto|yes)
d008864d
GI
158 if test -n "$PKG_CONFIG"; then
159 AC_MSG_CHECKING([for systemdsystemunitdir])
d2e702cf 160 systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd 2>/dev/null`
d008864d
GI
161 AC_MSG_RESULT([${systemdsystemunitdir:-no}])
162 fi
a7e8ffec
GI
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" ;;
170esac
171AC_SUBST(systemdsystemunitdir)
172AM_CONDITIONAL(INSTALL_SYSTEMDUNIT, [test -n "$systemdsystemunitdir"])
173
293b5ab8
JD
174AC_ARG_WITH(systemdenvfile,
175 [AS_HELP_STRING([--with-systemdenvfile@<:@=FILE|auto|yes|no@:>@], [Path of systemd EnvironmentFile [auto]])],
176 [], [with_systemdenvfile=auto])
177
178systemdenvfile=
179case "$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"
195esac
196AC_SUBST(systemdenvfile)
197
a23d5117 198AC_ARG_WITH(initscriptdir,
d2e702cf 199 [AS_HELP_STRING([--with-initscriptdir@<:@=DIR|auto|yes|no@:>@], [Location of init scripts [auto]])],
a7e8ffec
GI
200 [], [with_initscriptdir=auto])
201
d008864d
GI
202initddir=
203case "$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:*) ;;
a7e8ffec
GI
217 *) initddir="$with_initscriptdir" ;;
218esac
832b75ed 219AC_SUBST(initddir)
a7e8ffec
GI
220AM_CONDITIONAL(INSTALL_INITSCRIPT, [test -n "$initddir"])
221
222# use different init script templates for different OS
223case "${host}" in
224 *-*-freebsd*)
225 initdfile="smartd.freebsd.initd"
226 ;;
227 *)
228 initdfile="smartd.initd"
229 ;;
230esac
231AC_SUBST(initdfile)
832b75ed 232
cfbba5b9 233AC_ARG_WITH(exampledir,
d2e702cf 234 [AS_HELP_STRING([--with-exampledir=DIR], [Location of example scripts [DOCDIR/examplescripts]])],
cfbba5b9
GI
235 [exampledir="$withval"], [exampledir='${docdir}/examplescripts'])
236AC_SUBST(exampledir)
237
6b80b4d2 238drivedbdir='${datadir}/${PACKAGE}'
2127e193 239AC_ARG_WITH(drivedbdir,
6b80b4d2
JD
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])
2127e193 242AC_SUBST(drivedbdir)
293b5ab8 243AM_CONDITIONAL(ENABLE_DRIVEDB, [test -n "$drivedbdir"])
2127e193 244
d2e702cf
GI
245AC_ARG_WITH(smartdscriptdir,
246 [AS_HELP_STRING([--with-smartdscriptdir=DIR], [Location of smartd_warning.sh script [SYSCONFDIR]])],
247 [smartdscriptdir="$withval"], [smartdscriptdir='${sysconfdir}'])
248AC_SUBST(smartdscriptdir)
249
250AC_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'])
255AC_SUBST(smartdplugindir)
256
6b80b4d2 257savestates=
2127e193 258AC_ARG_WITH(savestates,
293b5ab8
JD
259 [AS_HELP_STRING([--with-savestates@<:@=PREFIX|yes|no@:>@],
260 [Enable default smartd state files [no] (yes=LOCALSTATEDIR/lib/smartmontools/smartd.)])],
6b80b4d2
JD
261 [case "$withval" in yes) savestates='${localstatedir}/lib/${PACKAGE}/smartd.' ;;
262 no) ;; *) savestates="$withval" ;; esac])
2127e193
GI
263savestatesdir="${savestates%/*}"
264AC_SUBST(savestates)
265AC_SUBST(savestatesdir)
293b5ab8 266AM_CONDITIONAL(ENABLE_SAVESTATES, [test -n "$savestates"])
2127e193 267
6b80b4d2 268attributelog=
2127e193 269AC_ARG_WITH(attributelog,
293b5ab8
JD
270 [AS_HELP_STRING([--with-attributelog@<:@=PREFIX|yes|no@:>@],
271 [Enable default smartd attribute log files [no] (yes=LOCALSTATEDIR/lib/smartmontools/attrlog.)])],
6b80b4d2
JD
272 [case "$withval" in yes) attributelog='${localstatedir}/lib/${PACKAGE}/attrlog.' ;;
273 no) ;; *) attributelog="$withval" ;; esac])
2127e193
GI
274attributelogdir="${attributelog%/*}"
275AC_SUBST(attributelog)
276AC_SUBST(attributelogdir)
293b5ab8 277AM_CONDITIONAL(ENABLE_ATTRIBUTELOG, [test -n "$attributelog"])
2127e193 278
cfbba5b9 279AC_ARG_ENABLE(sample,
d2e702cf 280 [AS_HELP_STRING([--enable-sample], [Enables appending .sample to the installed smartd rc script and configuration file])],
cfbba5b9
GI
281 [smartd_suffix=; test "$enableval" = "yes" && smartd_suffix=".sample"],
282 [smartd_suffix=;])
832b75ed 283AC_SUBST(smartd_suffix)
832b75ed 284
2127e193 285AC_ARG_WITH(os-deps,
d2e702cf 286 [AS_HELP_STRING([--with-os-deps='os_module.o ...'], [Specify OS dependent module(s) [guessed]])],
2127e193
GI
287 [ for x in $with_os_deps; do
288 case $x in
289 *.o) ;;
290 *) AC_MSG_ERROR([non-object file specified by --with-os-deps]) ;;
291 esac
292 done
293 ],[])
294
cfbba5b9 295AC_ARG_WITH(selinux,
d2e702cf 296 [AS_HELP_STRING([--with-selinux@<:@=yes|no@:>@], [Enables SELinux support [no]])],
cfbba5b9
GI
297 [ if test "$withval" = "yes"; then
298 AC_CHECK_HEADERS([selinux/selinux.h], [], [AC_MSG_ERROR([Missing SELinux header files])])
299 AC_CHECK_LIB(selinux, matchpathcon, [], [AC_MSG_ERROR([Missing or incorrect SELinux library files])])
300 fi
301 ],[])
2127e193
GI
302AC_SUBST(with_selinux)
303if test "$with_selinux" = "yes"; then
cfbba5b9 304 AC_DEFINE(WITH_SELINUX, 1, [Define to 1 if SELinux support is enabled])
2127e193
GI
305fi
306
a23d5117 307AC_ARG_WITH(libcap-ng,
d2e702cf 308 [AS_HELP_STRING([--with-libcap-ng@<:@=auto|yes|no@:>@], [Add Libcap-ng support to smartd [auto]])],
a7e8ffec 309 [], [with_libcap_ng=auto])
a23d5117
GI
310
311use_libcap_ng=no
312if test "$with_libcap_ng" != "no"; then
313 AC_CHECK_LIB(cap-ng, capng_clear,
293b5ab8 314 [AC_DEFINE(HAVE_LIBCAP_NG, 1, [Define to 1 if you have the `cap-ng' library (-lcap-ng).]) dnl `vim syntax
a23d5117
GI
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
322fi
323
324AC_MSG_CHECKING([whether to use libcap-ng])
325AC_SUBST(CAPNG_LDADD)
a23d5117
GI
326AC_MSG_RESULT([$use_libcap_ng])
327
6b80b4d2
JD
328AC_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
332case "$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
336This file is no longer included in the source tarball but still
337available 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 ;;
341esac
342
d2e702cf
GI
343# Assume broken snprintf only on Windows with MSVCRT (MinGW without ANSI stdio support)
344libc_have_working_snprintf=yes
345
346case "$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 ;;
366esac
367
368AC_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
373if test "$libc_have_working_snprintf" = "yes"; then
293b5ab8 374 AC_DEFINE(HAVE_WORKING_SNPRINTF, 1, [Define to 1 if the `snprintf' function is sane.]) dnl `vim syntax
d2e702cf
GI
375fi
376
6b80b4d2
JD
377os_win32_manifest=
378case "$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 ;;
395esac
396
397# TODO: Remove after smartmontools 6.5
398AC_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])])
401AC_ARG_ENABLE(drivedb,
402 [AS_HELP_STRING([--disable-drivedb], [(removed, use --without-drivedbdir instead)])])
403AC_ARG_ENABLE(savestates,
404 [AS_HELP_STRING([--enable-savestates], [(removed, use --with-savestates@<:@=yes@:>@ instead)])])
405AC_ARG_ENABLE(attributelog,
406 [AS_HELP_STRING([--enable-attributelog], [(removed, use --with-attributelog@<:@=yes@:>@ instead)])])
407if 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.
409Use --without-drivedbdir, --with-savestates, --with-attributelog instead.])
832b75ed
GG
410fi
411
6b80b4d2 412
832b75ed
GG
413AC_SUBST(releaseversion,['${PACKAGE}-${VERSION}'])
414AC_SUBST(smartmontools_release_date)
415AC_SUBST(smartmontools_release_time)
416
cfbba5b9
GI
417# Set platform-specific modules and symbols
418os_libs=
6b80b4d2 419os_dltools='curl wget lynx svn'
ee38a438
GI
420os_mailer=mail
421os_hostname="'hostname'"
422os_dnsdomainname=
423os_nisdomainname="'domainname'"
cfbba5b9
GI
424os_darwin=no
425os_solaris=no
426os_win32=no
427os_win32_mingw=no
7f0798ef 428os_win64=no
d008864d 429os_man_filter=
832b75ed 430case "${host}" in
cfbba5b9 431 *-*-linux*)
ee38a438
GI
432 os_deps='os_linux.o cciss.o dev_areca.o'
433 os_dnsdomainname="'dnsdomainname' 'hostname -d'"
434 os_nisdomainname="'nisdomainname' 'hostname -y' 'domainname'"
d008864d 435 os_man_filter=Linux
cfbba5b9
GI
436 ;;
437 *-*-freebsd*|*-*-dragonfly*|*-*-kfreebsd*-gnu*)
ee38a438 438 os_deps='os_freebsd.o cciss.o dev_areca.o'
cfbba5b9 439 os_libs='-lcam'
6b80b4d2 440 os_dltools='curl wget lynx fetch svn'
cfbba5b9 441 AC_CHECK_LIB(usb, libusb20_dev_get_device_desc)
d008864d 442 os_man_filter=FreeBSD
cfbba5b9
GI
443 ;;
444 sparc-*-solaris*)
6b80b4d2
JD
445 os_deps='os_solaris.o'
446 test "$with_solaris_sparc_ata" = "yes" \
447 && os_deps="$os_deps os_solaris_ata.o"
cfbba5b9
GI
448 os_mailer='mailx'
449 os_solaris=yes
d008864d 450 os_man_filter=Solaris
cfbba5b9
GI
451 ;;
452 *-pc-solaris*)
453 os_deps='os_solaris.o'
454 os_mailer='mailx'
455 os_solaris=yes
d008864d 456 os_man_filter=Solaris
cfbba5b9
GI
457 ;;
458 *-*-netbsd*)
459 os_deps='os_netbsd.o'
460 os_libs='-lutil'
d008864d 461 os_man_filter=NetBSD
cfbba5b9
GI
462 ;;
463 *-*-openbsd*)
464 os_deps='os_openbsd.o'
465 os_libs='-lutil'
6b80b4d2 466 os_dltools='curl wget lynx ftp svn'
d008864d 467 os_man_filter=OpenBSD
cfbba5b9
GI
468 ;;
469 *-*-cygwin*)
ee38a438 470 os_deps='os_win32.o dev_areca.o'
d2e702cf 471 os_mailer='email'
ee38a438
GI
472 os_hostname="'hostname' 'echo "'"${HOSTNAME?unset}"'"'"
473 os_dnsdomainname="'dnsdomainname' 'hostname -d' 'echo "'"${USERDNSDOMAIN?unset}"'"'"
474 os_nisdomainname=
cfbba5b9 475 os_win32=yes
d008864d 476 os_man_filter=Cygwin
cfbba5b9
GI
477 ;;
478 x86_64-*-mingw*)
ee38a438 479 os_deps='os_win32.o dev_areca.o'
cfbba5b9
GI
480 os_win32=yes
481 os_win32_mingw=yes
482 os_win64=yes
d008864d 483 os_man_filter=Windows
cfbba5b9
GI
484 ;;
485 *-*-mingw*)
ee38a438 486 os_deps='os_win32.o dev_areca.o'
cfbba5b9
GI
487 os_win32=yes
488 os_win32_mingw=yes
d008864d 489 os_man_filter=Windows
cfbba5b9
GI
490 ;;
491 *-*-darwin*)
492 os_deps='os_darwin.o'
493 os_libs='-framework CoreFoundation -framework IOKit'
494 os_darwin=yes
d008864d 495 os_man_filter=Darwin
cfbba5b9
GI
496 ;;
497 *-*-nto-qnx*)
498 os_deps='os_qnxnto.o'
499 ;;
500 *)
501 os_deps='os_generic.o'
502 ;;
832b75ed
GG
503esac
504
2127e193
GI
505# Replace if '--with-os-deps' was specified
506test -z "$with_os_deps" || os_deps="$with_os_deps"
832b75ed 507
2127e193
GI
508# Check if we need adapter to old interface (dev_legacy.cpp)
509os_src=`echo "${os_deps}"|sed -n 's,^\([[^ .]]*\)\.o.*$,\1.cpp,p'`
510AC_MSG_CHECKING([whether ${os_src} uses new interface])
511if grep "smart_interface" "${srcdir}/${os_src}" >/dev/null 2>&1; then
512 os_new_interface=yes
513else
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])
517fi
518AC_MSG_RESULT([$os_new_interface])
519
cfbba5b9
GI
520AC_SUBST([os_deps])
521AC_SUBST([os_libs])
522AC_SUBST([os_dltools])
ee38a438
GI
523AC_SUBST([os_mailer])
524AC_SUBST([os_hostname])
525AC_SUBST([os_dnsdomainname])
526AC_SUBST([os_nisdomainname])
d008864d 527AC_SUBST([os_man_filter])
6b80b4d2 528AC_SUBST([os_win32_manifest])
cfbba5b9
GI
529
530# Create drivedb.h update branch name from version: 5.41[.X] -> RELEASE_5_41_DRIVEDB
531DRIVEDB_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'`
533if test -z "$DRIVEDB_BRANCH"; then
534 AC_MSG_ERROR([Unable to create DRIVEDB_BRANCH from VERSION=$VERSION])
535fi
536AC_SUBST([DRIVEDB_BRANCH])
537
538# Enable platform-specific makefile sections
539AM_CONDITIONAL(OS_DARWIN, [test "$os_darwin" = "yes"])
540AM_CONDITIONAL(OS_SOLARIS, [test "$os_solaris" = "yes"])
541AM_CONDITIONAL(OS_WIN32, [test "$os_win32" = "yes"])
542AM_CONDITIONAL(OS_WIN32_MINGW, [test "$os_win32_mingw" = "yes"])
543AM_CONDITIONAL(OS_WIN32_NSIS, [test -n "$MAKENSIS"])
7f0798ef 544AM_CONDITIONAL(OS_WIN64, [test "$os_win64" = "yes"])
832b75ed 545
bed94269
GI
546dnl Add -Wall and -W if using g++ and its not already specified.
547if test "$GXX" = "yes"; then
4d59bff9
GG
548 if test -z "`echo "$CXXFLAGS" | grep "\-Wall" 2> /dev/null`" ; then
549 CXXFLAGS="$CXXFLAGS -Wall"
832b75ed
GG
550 fi
551# In the next line, do NOT delete the 2 spaces inside double quotes.
4d59bff9
GG
552 if test -z "`echo "$CXXFLAGS " | grep "\-W " 2> /dev/null`" ; then
553 CXXFLAGS="$CXXFLAGS -W"
832b75ed 554 fi
bed94269 555
832b75ed
GG
556else
557 dnl We are NOT using gcc, so enable host-specific compiler flags
558 case "${host}" in
34ad0c5f
GG
559 sparc*-*-solaris*)
560 dnl set CXXFLAGS for Solaris/SPARC C++ compiler
4d59bff9 561 if test -z "`echo "$CXXFLAGS" | grep "\-xmemalign" 2> /dev/null`" ; then
832b75ed 562 dnl we have to tell the compilers about packed ATA structures
4d59bff9 563 CXXFLAGS="-xmemalign=1i $CXXFLAGS"
832b75ed 564 fi
34ad0c5f
GG
565 esac
566 case "${host}" in
567 *-*-solaris*)
4d59bff9 568 if test -z "`echo "$CXXFLAGS" | grep "\-xO" 2> /dev/null`" ; then
832b75ed 569 dnl turn on optimization if user has not explicitly set its value
4d59bff9 570 CXXFLAGS="-xO2 $CXXFLAGS"
832b75ed 571 fi
4d59bff9 572 if test -z "`echo "$CXXFLAGS" | grep "\-erroff" 2> /dev/null`" ; then
2127e193
GI
573 dnl suppress trivial warnings
574 CXXFLAGS="-erroff=%none,wbadinitl,wbadasgl,badargtypel2w,badargtype2w $CXXFLAGS"
4d59bff9 575 fi
832b75ed
GG
576 esac
577fi
578
579AC_DEFINE_UNQUOTED(SMARTMONTOOLS_BUILD_HOST, "${host}", [smartmontools Build Host])
580
4d59bff9 581AC_SUBST(CXXFLAGS)
832b75ed 582
cfbba5b9
GI
583AC_CONFIG_FILES(Makefile)
584AC_OUTPUT
832b75ed 585AC_PROG_MAKE_SET
a23d5117 586
e9583e0c
GI
587echo "-----------------------------------------------------------------------------" >&AS_MESSAGE_FD
588echo "${PACKAGE}-${VERSION} configuration:" >&AS_MESSAGE_FD
589echo "host operating system: $host" >&AS_MESSAGE_FD
590echo "C++ compiler: $CXX" >&AS_MESSAGE_FD
cfbba5b9 591echo "C compiler: $CC" >&AS_MESSAGE_FD
e9583e0c
GI
592echo "preprocessor flags: $CPPFLAGS" >&AS_MESSAGE_FD
593echo "C++ compiler flags: $CXXFLAGS" >&AS_MESSAGE_FD
cfbba5b9 594echo "C compiler flags: $CFLAGS" >&AS_MESSAGE_FD
e9583e0c 595echo "linker flags: $LDFLAGS" >&AS_MESSAGE_FD
cfbba5b9 596echo "OS specific modules: $os_deps $os_libs $LIBS" >&AS_MESSAGE_FD
e9583e0c
GI
597
598case "$host_os" in
599 mingw*)
6b80b4d2 600 echo "application manifest: ${os_win32_manifest:-built-in}" >&AS_MESSAGE_FD
cfbba5b9
GI
601 echo "resource compiler: $WINDRES" >&AS_MESSAGE_FD
602 echo "message compiler: $WINDMC" >&AS_MESSAGE_FD
603 echo "NSIS compiler: $MAKENSIS" >&AS_MESSAGE_FD
e9583e0c
GI
604 if test -n "$drivedbdir"; then
605 echo "drive database file: EXEDIR/drivedb.h" >&AS_MESSAGE_FD
cfbba5b9
GI
606 if test -n "$MAKENSIS"; then
607 echo "database update tool: EXEDIR/update-smart-drivedb.exe" >&AS_MESSAGE_FD
608 fi
e9583e0c
GI
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
cfbba5b9 624 echo "examples install path: `eval eval eval echo $exampledir`" >&AS_MESSAGE_FD
e9583e0c
GI
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
cfbba5b9 628 echo "download tools: `eval eval eval echo $os_dltools`" >&AS_MESSAGE_FD
e9583e0c
GI
629 else
630 echo "drive database file: [[disabled]]" >&AS_MESSAGE_FD
e9583e0c
GI
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
d2e702cf
GI
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
a7e8ffec
GI
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
d2e702cf
GI
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
a7e8ffec 652 fi
e9583e0c
GI
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 ;;
668esac
669echo "-----------------------------------------------------------------------------" >&AS_MESSAGE_FD
293b5ab8 670
6b80b4d2
JD
671# TODO: Remove after smartmontools 6.5
672case "$host:${with_solaris_sparc_ata+set}" in
673 sparc-*-solaris*:)
674 AC_MSG_WARN([
675Legacy ATA support is no longer enabled by default on Solaris SPARC.
676The required source file 'os_solaris_ata.s' is no longer included in
677the source tarball but still available in the SVN repository.
678Use option '--with-solaris-sparc-ata' to enable legacy ATA support.
679Use option '--without-solaris-sparc-ata' to suppress this warning.])
680 ;;
681esac