]>
Commit | Line | Data |
---|---|---|
832b75ed | 1 | # |
e165493d | 2 | # $Id: configure.in 3527 2012-03-25 16:42:24Z chrfranke $ |
832b75ed GG |
3 | # |
4 | dnl Process this file with autoconf to produce a configure script. | |
5 | AC_PREREQ(2.50) | |
d008864d | 6 | AC_INIT(smartmontools, 5.43, smartmontools-support@lists.sourceforge.net) |
4d59bff9 | 7 | AC_CONFIG_SRCDIR(smartctl.cpp) |
832b75ed | 8 | |
eb07ddf2 | 9 | smartmontools_configure_date=`date -u +'%Y-%m-%d %T %Z'` |
e165493d | 10 | smartmontools_cvs_tag=`echo '$Id: configure.in 3527 2012-03-25 16:42:24Z chrfranke $'` |
d008864d GI |
11 | smartmontools_release_date=2011-10-20 |
12 | smartmontools_release_time="19:19:34 UTC" | |
832b75ed GG |
13 | |
14 | AC_DEFINE_UNQUOTED(SMARTMONTOOLS_CONFIGURE_ARGS, "$ac_configure_args", [smartmontools Configure Arguments]) | |
15 | AC_DEFINE_UNQUOTED(SMARTMONTOOLS_CONFIGURE_DATE, "$smartmontools_configure_date", [smartmontools Configure Date]) | |
16 | AC_DEFINE_UNQUOTED(SMARTMONTOOLS_RELEASE_DATE, "$smartmontools_release_date", [smartmontools Release Date]) | |
17 | AC_DEFINE_UNQUOTED(SMARTMONTOOLS_RELEASE_TIME, "$smartmontools_release_time", [smartmontools Release Time]) | |
18 | AC_DEFINE_UNQUOTED(CONFIG_H_CVSID, "$smartmontools_cvs_tag", [smartmontools CVS Tag]) | |
19 | AC_DEFINE_UNQUOTED(PACKAGE_HOMEPAGE, "http://smartmontools.sourceforge.net/", [smartmontools Home Page]) | |
20 | ||
21 | AM_CONFIG_HEADER(config.h) | |
22 | ||
d008864d | 23 | AM_INIT_AUTOMAKE([foreign]) |
832b75ed GG |
24 | |
25 | AM_MAINTAINER_MODE | |
26 | ||
4d59bff9 | 27 | AC_LANG_CPLUSPLUS |
832b75ed | 28 | dnl Checks for programs. |
4d59bff9 | 29 | AC_PROG_CXX |
832b75ed GG |
30 | AM_PROG_AS |
31 | AC_PROG_INSTALL | |
d008864d GI |
32 | |
33 | m4_pattern_forbid([^PKG_PROG_]) | |
34 | if 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])]) | |
37 | fi | |
832b75ed | 38 | |
cfbba5b9 GI |
39 | AC_ARG_VAR(WINDMC, [Windows message compiler command]) |
40 | AC_ARG_VAR(WINDRES, [Windows resource compiler command]) | |
41 | AC_ARG_VAR(MAKENSIS, [NSIS compiler command]) | |
42 | ||
832b75ed | 43 | AC_CANONICAL_HOST |
832b75ed | 44 | case "${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 | |
51 | AC_CHECK_PROGS(WINDMC, [${host}-windmc windmc]) | |
52 | AC_CHECK_PROGS(WINDRES, [${host}-windres windres]) | |
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 |
64 | esac |
65 | ||
2127e193 GI |
66 | # Check for SVN. |
67 | AC_MSG_CHECKING([whether this is a build from SVN]) | |
68 | is_svn_build=no | |
e165493d | 69 | svn_deps= |
2127e193 GI |
70 | if 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 |
78 | fi | |
e165493d | 79 | AC_SUBST([svn_deps]) |
2127e193 GI |
80 | AM_CONDITIONAL(IS_SVN_BUILD, [test "$is_svn_build" = "yes"]) |
81 | AC_MSG_RESULT([$is_svn_build]) | |
82 | ||
83 | dnl Checks for libraries needed for name services (Solaris needs | |
832b75ed GG |
84 | dnl libnsl, might in the future also need libsocket) |
85 | # AC_SEARCH_LIBS (FUNCTION, SEARCH-LIBS, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [OTHER-LIBRARIES]) | |
2127e193 GI |
86 | AC_SEARCH_LIBS(socket, socket) |
87 | AC_SEARCH_LIBS(gethostbyname, nsl) | |
88 | AC_SEARCH_LIBS(getaddrinfo, nsl) | |
89 | AC_SEARCH_LIBS(getdomainname, nsl) | |
832b75ed | 90 | |
e165493d GI |
91 | # Note: On Linux, clock_gettime() requires -lrt which implies -lpthreads |
92 | # Check ommitted for now, gettimeofday() provides reasonable precision | |
93 | # AC_SEARCH_LIBS(clock_gettime, rt) | |
94 | ||
832b75ed GG |
95 | dnl Checks for header files. |
96 | AC_CHECK_HEADERS([locale.h]) | |
832b75ed GG |
97 | AC_CHECK_HEADERS([dev/ata/atavar.h]) |
98 | AC_CHECK_HEADERS([netdb.h]) | |
99 | dnl we need [u]int64_t and friends. | |
100 | AC_CHECK_HEADERS([inttypes.h]) dnl C99, UNIX98, solaris 2.6+ | |
101 | AC_CHECK_HEADERS([stdint.h]) dnl C99 | |
102 | AC_CHECK_HEADERS([sys/inttypes.h]) dnl pre-UNIX98 | |
103 | AC_CHECK_HEADERS([sys/int_types.h]) dnl pre-UNIX98, solaris 2.6+ | |
104 | dnl Check for FreeBSD twe include files...currently missing on 5.2, but should be there | |
105 | AC_CHECK_HEADERS([sys/tweio.h]) | |
106 | AC_CHECK_HEADERS([sys/twereg.h]) | |
107 | dnl Check for FreeBSD twa include files... | |
108 | AC_CHECK_HEADERS([sys/tw_osl_ioctl.h]) | |
1953ff6d | 109 | dnl This header file is needed for cciss_ioctl.h at least on SuSE LINUX |
ba59cff1 | 110 | AC_CHECK_HEADERS([linux/compiler.h]) |
d008864d GI |
111 | dnl Check for the FreeBSD CCISS system header and use internal one if not found |
112 | AC_CHECK_HEADERS([dev/ciss/cissio.h], | |
113 | [AC_DEFINE([CISS_LOCATION],[<dev/ciss/cissio.h>],[freebsd ciss header location])], | |
114 | [AC_DEFINE([CISS_LOCATION],["cissio_freebsd.h"],[freebsd ciss header location])] | |
115 | ) | |
1953ff6d GG |
116 | dnl Check for Linux CCISS include file |
117 | AC_CHECK_HEADERS([linux/cciss_ioctl.h], [], [], [AC_INCLUDES_DEFAULT | |
118 | #ifdef HAVE_LINUX_COMPILER_H | |
119 | # include <linux/compiler.h> | |
120 | #endif | |
121 | ]) | |
cfbba5b9 GI |
122 | dnl Check for Windows DDK and WMI header files |
123 | AC_CHECK_HEADERS([ntdddisk.h ddk/ntdddisk.h], [], [], [AC_INCLUDES_DEFAULT | |
124 | #include <windows.h> | |
125 | ]) | |
126 | AC_CHECK_HEADERS([wbemcli.h]) | |
832b75ed GG |
127 | |
128 | dnl Checks for typedefs, structures, and compiler characteristics. | |
129 | AC_CHECK_TYPES([int64_t, uint64_t]) | |
130 | ||
131 | dnl Checks for library functions. | |
e9583e0c GI |
132 | AC_CHECK_FUNCS([getopt_long], [need_getopt_long=no], [need_getopt_long=yes]) |
133 | AM_CONDITIONAL(NEED_GETOPT_LONG, [test "$need_getopt_long" = "yes"]) | |
134 | AC_CHECK_FUNCS([regcomp], [need_regex=no], [need_regex=yes]) | |
135 | AM_CONDITIONAL(NEED_REGEX, [test "$need_regex" = "yes"]) | |
2127e193 | 136 | |
832b75ed GG |
137 | AC_CHECK_FUNCS([getdomainname]) |
138 | AC_CHECK_FUNCS([gethostname]) | |
2127e193 | 139 | AC_CHECK_FUNCS([getaddrinfo]) |
832b75ed GG |
140 | AC_CHECK_FUNCS([gethostbyname]) |
141 | AC_CHECK_FUNCS([sigset]) | |
142 | AC_CHECK_FUNCS([strtoull]) | |
143 | AC_CHECK_FUNCS([uname]) | |
e165493d | 144 | AC_CHECK_FUNCS([clock_gettime ftime gettimeofday]) |
832b75ed | 145 | |
e9583e0c GI |
146 | # Check byte ordering (defines WORDS_BIGENDIAN) |
147 | AC_C_BIGENDIAN | |
148 | ||
832b75ed | 149 | # Check whether snprintf appends null char and returns expected length on overflow |
832b75ed GG |
150 | AC_MSG_CHECKING([for working snprintf]) |
151 | AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[ char buf[]="ABCDEFGHI"; | |
152 | int i=snprintf(buf,8,"12345678"); return !(!buf[7] && i==8); ]])], | |
4d59bff9 | 153 | [libc_have_working_snprintf=yes], |
cfbba5b9 GI |
154 | [libc_have_working_snprintf=no], |
155 | [libc_have_working_snprintf=unknown]) | |
832b75ed GG |
156 | AC_SUBST(libc_have_working_snprintf) |
157 | if test "$libc_have_working_snprintf" = "yes"; then | |
cfbba5b9 | 158 | AC_DEFINE(HAVE_WORKING_SNPRINTF, 1, [Define to 1 if the `snprintf' function is sane]) |
832b75ed GG |
159 | fi |
160 | AC_MSG_RESULT([$libc_have_working_snprintf]) | |
161 | ||
162 | # check for __attribute__((packed)) | |
d008864d GI |
163 | # (sizeof() check is required to avoid false positives if other |
164 | # __attribute__((x)) are supported) | |
7f0798ef | 165 | AC_MSG_CHECKING([whether $CXX supports __attribute__((packed))]) |
d008864d GI |
166 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [[ |
167 | struct s { char a; short b; } __attribute__((packed)); | |
168 | typedef char t[sizeof(struct s) == 3 ? 1 : -1];]])], | |
169 | [gcc_have_attr_packed=yes], [gcc_have_attr_packed=no]) | |
832b75ed GG |
170 | AC_SUBST(gcc_have_attr_packed) |
171 | if test "$gcc_have_attr_packed" = "yes"; then | |
cfbba5b9 | 172 | AC_DEFINE(HAVE_ATTR_PACKED, 1, [Define to 1 if C++ compiler supports __attribute__((packed))]) |
832b75ed GG |
173 | fi |
174 | AC_MSG_RESULT([$gcc_have_attr_packed]) | |
175 | ||
176 | AC_SUBST(CPPFLAGS) | |
177 | AC_SUBST(LDFLAGS) | |
178 | AC_SUBST(ASFLAGS) | |
179 | ||
a7e8ffec GI |
180 | AC_ARG_WITH(systemdsystemunitdir, |
181 | [AS_HELP_STRING([--with-systemdsystemunitdir@<:@=DIR|auto|yes|no@:>@], [Location of systemd service files [auto]])], | |
182 | [], [with_systemdsystemunitdir=auto]) | |
183 | ||
184 | systemdsystemunitdir= | |
185 | case "$with_systemdsystemunitdir" in | |
186 | auto|yes) | |
d008864d GI |
187 | if test -n "$PKG_CONFIG"; then |
188 | AC_MSG_CHECKING([for systemdsystemunitdir]) | |
189 | systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd` | |
190 | AC_MSG_RESULT([${systemdsystemunitdir:-no}]) | |
191 | fi | |
a7e8ffec GI |
192 | case "$with_systemdsystemunitdir:$sysconfdir:$systemdsystemunitdir" in |
193 | yes:*:) AC_MSG_ERROR([Location of systemd service files not found]) ;; | |
194 | yes:*:*|auto:*:|auto:/etc:*) ;; | |
195 | *) systemdsystemunitdir='${prefix}'$systemdsystemunitdir ;; | |
196 | esac ;; | |
197 | no) ;; | |
198 | *) systemdsystemunitdir="$with_systemdsystemunitdir" ;; | |
199 | esac | |
200 | AC_SUBST(systemdsystemunitdir) | |
201 | AM_CONDITIONAL(INSTALL_SYSTEMDUNIT, [test -n "$systemdsystemunitdir"]) | |
202 | ||
a23d5117 | 203 | AC_ARG_WITH(initscriptdir, |
a7e8ffec GI |
204 | [AC_HELP_STRING([--with-initscriptdir@<:@=DIR|auto|yes|no@:>@], [Location of init scripts [auto]])], |
205 | [], [with_initscriptdir=auto]) | |
206 | ||
d008864d GI |
207 | initddir= |
208 | case "$with_initscriptdir:$cross_compiling:$systemdsystemunitdir" in | |
209 | auto:no:|yes:*) | |
210 | AC_MSG_CHECKING([for init (rc) directory]) | |
211 | for dir in rc.d/init.d init.d rc.d; do | |
212 | if test -d /etc/$dir; then | |
213 | initddir='${sysconfdir}'/$dir | |
214 | break | |
215 | fi | |
216 | done | |
217 | AC_MSG_RESULT([${initddir:-no}]) | |
218 | case "$with_initscriptdir:$initddir" in | |
219 | yes:) AC_MSG_ERROR([Location of init scripts not found]) ;; | |
220 | esac ;; | |
221 | auto:*|no:*) ;; | |
a7e8ffec GI |
222 | *) initddir="$with_initscriptdir" ;; |
223 | esac | |
832b75ed | 224 | AC_SUBST(initddir) |
a7e8ffec GI |
225 | AM_CONDITIONAL(INSTALL_INITSCRIPT, [test -n "$initddir"]) |
226 | ||
227 | # use different init script templates for different OS | |
228 | case "${host}" in | |
229 | *-*-freebsd*) | |
230 | initdfile="smartd.freebsd.initd" | |
231 | ;; | |
232 | *) | |
233 | initdfile="smartd.initd" | |
234 | ;; | |
235 | esac | |
236 | AC_SUBST(initdfile) | |
832b75ed | 237 | |
a23d5117 GI |
238 | AC_ARG_WITH(docdir, |
239 | [AC_HELP_STRING([--with-docdir=DIR],[Location of documentation [DATADIR/doc/smartmontools]])], | |
240 | [docdir="$withval"], | |
241 | [ if test -z "$docdir"; then | |
242 | # autoconf 2.5x without '--docdir' support | |
243 | docdir='${datadir}/doc/${PACKAGE}' | |
a23d5117 GI |
244 | fi |
245 | ]) | |
832b75ed GG |
246 | AC_SUBST(docdir) |
247 | ||
cfbba5b9 GI |
248 | AC_ARG_WITH(exampledir, |
249 | [AC_HELP_STRING([--with-exampledir=DIR],[Location of example scripts [DOCDIR/examplescripts]])], | |
250 | [exampledir="$withval"], [exampledir='${docdir}/examplescripts']) | |
251 | AC_SUBST(exampledir) | |
252 | ||
253 | AC_ARG_ENABLE(drivedb, | |
254 | [AC_HELP_STRING([--disable-drivedb],[Disables drive database file])], | |
255 | [], [enable_drivedb=yes]) | |
2127e193 GI |
256 | |
257 | AC_ARG_WITH(drivedbdir, | |
258 | [AC_HELP_STRING([--with-drivedbdir=DIR],[Location of drive database file (implies --enable-drivedb) [DATADIR/smartmontools]])], | |
cfbba5b9 | 259 | [drivedbdir="$withval"; enable_drivedb=yes], |
2127e193 GI |
260 | [drivedbdir=; test "$enable_drivedb" = "yes" && drivedbdir='${datadir}/${PACKAGE}']) |
261 | AC_SUBST(drivedbdir) | |
262 | AM_CONDITIONAL(ENABLE_DRIVEDB, [test "$enable_drivedb" = "yes"]) | |
263 | ||
264 | AC_ARG_ENABLE(savestates, [AC_HELP_STRING([--enable-savestates],[Enables default smartd state files])]) | |
265 | ||
266 | AC_ARG_WITH(savestates, | |
267 | [AC_HELP_STRING([--with-savestates=PREFIX],[Prefix for default smartd state files (implies --enable-savestates) [LOCALSTATEDIR/lib/smartmontools/smartd.]])], | |
268 | [savestates="$withval"; enable_savestates="yes"], | |
269 | [savestates=; test "$enable_savestates" = "yes" && savestates='${localstatedir}/lib/${PACKAGE}/smartd.']) | |
270 | savestatesdir="${savestates%/*}" | |
271 | AC_SUBST(savestates) | |
272 | AC_SUBST(savestatesdir) | |
273 | AM_CONDITIONAL(ENABLE_SAVESTATES, [test "$enable_savestates" = "yes"]) | |
274 | ||
275 | AC_ARG_ENABLE(attributelog, [AC_HELP_STRING([--enable-attributelog],[Enables default smartd attribute log files])]) | |
276 | ||
277 | AC_ARG_WITH(attributelog, | |
278 | [AC_HELP_STRING([--with-attributelog=PREFIX],[Prefix for default smartd attribute log files (implies --enable-attributelog) [LOCALSTATEDIR/lib/smartmontools/attrlog.]])], | |
279 | [attributelog="$withval"; enable_attributelog="yes"], | |
280 | [attributelog=; test "$enable_attributelog" = "yes" && attributelog='${localstatedir}/lib/${PACKAGE}/attrlog.']) | |
281 | attributelogdir="${attributelog%/*}" | |
282 | AC_SUBST(attributelog) | |
283 | AC_SUBST(attributelogdir) | |
284 | AM_CONDITIONAL(ENABLE_ATTRIBUTELOG, [test "$enable_attributelog" = "yes"]) | |
285 | ||
cfbba5b9 GI |
286 | AC_ARG_ENABLE(sample, |
287 | [AC_HELP_STRING([--enable-sample],[Enables appending .sample to the installed smartd rc script and configuration file])], | |
288 | [smartd_suffix=; test "$enableval" = "yes" && smartd_suffix=".sample"], | |
289 | [smartd_suffix=;]) | |
832b75ed | 290 | AC_SUBST(smartd_suffix) |
832b75ed | 291 | |
2127e193 GI |
292 | AC_ARG_WITH(os-deps, |
293 | [AC_HELP_STRING([--with-os-deps='os_module.o ...'],[Specify OS dependent module(s) [guessed]])], | |
294 | [ for x in $with_os_deps; do | |
295 | case $x in | |
296 | *.o) ;; | |
297 | *) AC_MSG_ERROR([non-object file specified by --with-os-deps]) ;; | |
298 | esac | |
299 | done | |
300 | ],[]) | |
301 | ||
cfbba5b9 GI |
302 | AC_ARG_WITH(selinux, |
303 | [AC_HELP_STRING([--with-selinux@<:@=yes|no@:>@],[Enables SELinux support [no]])], | |
304 | [ if test "$withval" = "yes"; then | |
305 | AC_CHECK_HEADERS([selinux/selinux.h], [], [AC_MSG_ERROR([Missing SELinux header files])]) | |
306 | AC_CHECK_LIB(selinux, matchpathcon, [], [AC_MSG_ERROR([Missing or incorrect SELinux library files])]) | |
307 | fi | |
308 | ],[]) | |
2127e193 GI |
309 | AC_SUBST(with_selinux) |
310 | if test "$with_selinux" = "yes"; then | |
cfbba5b9 | 311 | AC_DEFINE(WITH_SELINUX, 1, [Define to 1 if SELinux support is enabled]) |
2127e193 GI |
312 | fi |
313 | ||
a23d5117 | 314 | AC_ARG_WITH(libcap-ng, |
cfbba5b9 | 315 | [AC_HELP_STRING([--with-libcap-ng@<:@=auto|yes|no@:>@],[Add Libcap-ng support to smartd [auto]])], |
a7e8ffec | 316 | [], [with_libcap_ng=auto]) |
a23d5117 GI |
317 | |
318 | use_libcap_ng=no | |
319 | if test "$with_libcap_ng" != "no"; then | |
320 | AC_CHECK_LIB(cap-ng, capng_clear, | |
321 | [AC_DEFINE(HAVE_LIBCAP_NG, 1, [Define to 1 if you have the `cap-ng' library (-lcap-ng).]) | |
322 | CAPNG_LDADD="-lcap-ng"; use_libcap_ng=yes]) | |
323 | ||
324 | if test "$use_libcap_ng" = "yes"; then | |
325 | AC_CHECK_HEADER(cap-ng.h, [], [AC_MSG_ERROR([libcap-ng libraries found but headers are missing])]) | |
326 | elif test "$with_libcap_ng" = "yes"; then | |
327 | AC_MSG_ERROR([libcap-ng support was requested but the library was not found]) | |
328 | fi | |
329 | fi | |
330 | ||
331 | AC_MSG_CHECKING([whether to use libcap-ng]) | |
332 | AC_SUBST(CAPNG_LDADD) | |
333 | AM_CONDITIONAL(ENABLE_CAPABILITIES, [test "$use_libcap_ng" = "yes"]) | |
334 | AC_MSG_RESULT([$use_libcap_ng]) | |
335 | ||
832b75ed GG |
336 | if test "$prefix" = "NONE"; then |
337 | dnl no prefix and no mandir, so use ${prefix}/share/man as default | |
338 | if test "$mandir" = '${prefix}/man'; then | |
339 | AC_SUBST([mandir], ['${prefix}/share/man']) | |
340 | fi | |
341 | fi | |
342 | ||
343 | AC_SUBST(releaseversion,['${PACKAGE}-${VERSION}']) | |
344 | AC_SUBST(smartmontools_release_date) | |
345 | AC_SUBST(smartmontools_release_time) | |
346 | ||
cfbba5b9 GI |
347 | # Set platform-specific modules and symbols |
348 | os_libs= | |
349 | os_dltools='curl wget lynx' | |
350 | os_mailer= | |
351 | os_darwin=no | |
352 | os_solaris=no | |
353 | os_win32=no | |
354 | os_win32_mingw=no | |
7f0798ef | 355 | os_win64=no |
d008864d | 356 | os_man_filter= |
832b75ed | 357 | case "${host}" in |
cfbba5b9 GI |
358 | *-*-linux*) |
359 | os_deps='os_linux.o cciss.o' | |
d008864d | 360 | os_man_filter=Linux |
cfbba5b9 GI |
361 | ;; |
362 | *-*-freebsd*|*-*-dragonfly*|*-*-kfreebsd*-gnu*) | |
363 | os_deps='os_freebsd.o cciss.o' | |
364 | os_libs='-lcam' | |
365 | os_dltools='curl wget lynx fetch' | |
366 | AC_CHECK_LIB(usb, libusb20_dev_get_device_desc) | |
d008864d | 367 | os_man_filter=FreeBSD |
cfbba5b9 GI |
368 | ;; |
369 | sparc-*-solaris*) | |
370 | os_deps='os_solaris.o os_solaris_ata.o' | |
371 | os_mailer='mailx' | |
372 | os_solaris=yes | |
d008864d | 373 | os_man_filter=Solaris |
cfbba5b9 GI |
374 | ;; |
375 | *-pc-solaris*) | |
376 | os_deps='os_solaris.o' | |
377 | os_mailer='mailx' | |
378 | os_solaris=yes | |
d008864d | 379 | os_man_filter=Solaris |
cfbba5b9 GI |
380 | ;; |
381 | *-*-netbsd*) | |
382 | os_deps='os_netbsd.o' | |
383 | os_libs='-lutil' | |
d008864d | 384 | os_man_filter=NetBSD |
cfbba5b9 GI |
385 | ;; |
386 | *-*-openbsd*) | |
387 | os_deps='os_openbsd.o' | |
388 | os_libs='-lutil' | |
389 | os_dltools='curl wget lynx ftp' | |
d008864d | 390 | os_man_filter=OpenBSD |
cfbba5b9 GI |
391 | ;; |
392 | *-*-cygwin*) | |
393 | os_deps='os_win32.o' | |
394 | os_win32=yes | |
d008864d | 395 | os_man_filter=Cygwin |
cfbba5b9 GI |
396 | ;; |
397 | x86_64-*-mingw*) | |
398 | os_deps='os_win32.o' | |
399 | os_win32=yes | |
400 | os_win32_mingw=yes | |
401 | os_win64=yes | |
d008864d | 402 | os_man_filter=Windows |
cfbba5b9 GI |
403 | ;; |
404 | *-*-mingw*) | |
405 | os_deps='os_win32.o' | |
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 |
422 | esac |
423 | ||
2127e193 GI |
424 | # Replace if '--with-os-deps' was specified |
425 | test -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) |
428 | os_src=`echo "${os_deps}"|sed -n 's,^\([[^ .]]*\)\.o.*$,\1.cpp,p'` | |
429 | AC_MSG_CHECKING([whether ${os_src} uses new interface]) | |
430 | if grep "smart_interface" "${srcdir}/${os_src}" >/dev/null 2>&1; then | |
431 | os_new_interface=yes | |
432 | else | |
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]) | |
436 | fi | |
437 | AC_MSG_RESULT([$os_new_interface]) | |
438 | ||
cfbba5b9 GI |
439 | AC_SUBST([os_deps]) |
440 | AC_SUBST([os_libs]) | |
441 | AC_SUBST([os_dltools]) | |
d008864d | 442 | AC_SUBST([os_man_filter]) |
cfbba5b9 GI |
443 | if test -n "$os_mailer"; then |
444 | AC_DEFINE_UNQUOTED(DEFAULT_MAILER, "$os_mailer", [Default mailer if "mail" is unavailable]) | |
445 | fi | |
446 | ||
447 | # Create drivedb.h update branch name from version: 5.41[.X] -> RELEASE_5_41_DRIVEDB | |
448 | DRIVEDB_BRANCH=`echo $VERSION | sed 's,^\([[0-9]]*\.[[0-9]]*\)\..*$,\1,' \ | |
449 | | sed -n 's,^\([[0-9]][[0-9]]*\)\.\([[0-9]][[0-9]]*\)$,RELEASE_\1_\2_DRIVEDB,p'` | |
450 | if test -z "$DRIVEDB_BRANCH"; then | |
451 | AC_MSG_ERROR([Unable to create DRIVEDB_BRANCH from VERSION=$VERSION]) | |
452 | fi | |
453 | AC_SUBST([DRIVEDB_BRANCH]) | |
454 | ||
455 | # Enable platform-specific makefile sections | |
456 | AM_CONDITIONAL(OS_DARWIN, [test "$os_darwin" = "yes"]) | |
457 | AM_CONDITIONAL(OS_SOLARIS, [test "$os_solaris" = "yes"]) | |
458 | AM_CONDITIONAL(OS_WIN32, [test "$os_win32" = "yes"]) | |
459 | AM_CONDITIONAL(OS_WIN32_MINGW, [test "$os_win32_mingw" = "yes"]) | |
460 | AM_CONDITIONAL(OS_WIN32_NSIS, [test -n "$MAKENSIS"]) | |
461 | AM_CONDITIONAL(OS_WIN32_WINDMC, [test -n "$WINDMC" && test "$WINDMC" != "no" && test -n "$WINDRES"]) | |
7f0798ef | 462 | AM_CONDITIONAL(OS_WIN64, [test "$os_win64" = "yes"]) |
832b75ed | 463 | |
bed94269 GI |
464 | dnl Add -Wall and -W if using g++ and its not already specified. |
465 | if 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 |
474 | else |
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 |
495 | fi | |
496 | ||
497 | AC_DEFINE_UNQUOTED(SMARTMONTOOLS_BUILD_HOST, "${host}", [smartmontools Build Host]) | |
498 | ||
4d59bff9 | 499 | AC_SUBST(CXXFLAGS) |
832b75ed | 500 | |
cfbba5b9 GI |
501 | AC_CONFIG_FILES(Makefile) |
502 | AC_OUTPUT | |
832b75ed | 503 | AC_PROG_MAKE_SET |
a23d5117 | 504 | |
e9583e0c GI |
505 | echo "-----------------------------------------------------------------------------" >&AS_MESSAGE_FD |
506 | echo "${PACKAGE}-${VERSION} configuration:" >&AS_MESSAGE_FD | |
507 | echo "host operating system: $host" >&AS_MESSAGE_FD | |
508 | echo "C++ compiler: $CXX" >&AS_MESSAGE_FD | |
cfbba5b9 | 509 | echo "C compiler: $CC" >&AS_MESSAGE_FD |
e9583e0c GI |
510 | echo "preprocessor flags: $CPPFLAGS" >&AS_MESSAGE_FD |
511 | echo "C++ compiler flags: $CXXFLAGS" >&AS_MESSAGE_FD | |
cfbba5b9 | 512 | echo "C compiler flags: $CFLAGS" >&AS_MESSAGE_FD |
e9583e0c | 513 | echo "linker flags: $LDFLAGS" >&AS_MESSAGE_FD |
cfbba5b9 | 514 | echo "OS specific modules: $os_deps $os_libs $LIBS" >&AS_MESSAGE_FD |
e9583e0c GI |
515 | |
516 | case "$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 | |
a7e8ffec GI |
551 | if test -n "$initddir"; then |
552 | echo "smartd initd script: `eval eval eval echo $initddir`/smartd${smartd_suffix}" >&AS_MESSAGE_FD | |
553 | elif test -z "$systemdsystemunitdir"; then | |
554 | echo "smartd initd script: [[disabled]]" >&AS_MESSAGE_FD | |
555 | fi | |
556 | if test -n "$systemdsystemunitdir"; then | |
557 | echo "smartd systemd file: `eval eval eval echo $systemdsystemunitdir`/smartd.service" >&AS_MESSAGE_FD | |
558 | fi | |
e9583e0c GI |
559 | if test -n "$savestates"; then |
560 | echo "smartd save files: `eval eval eval echo $savestates`MODEL-SERIAL.TYPE.state" >&AS_MESSAGE_FD | |
561 | else | |
562 | echo "smartd save files: [[disabled]]" >&AS_MESSAGE_FD | |
563 | fi | |
564 | if test -n "$attributelog"; then | |
565 | echo "smartd attribute logs: `eval eval eval echo $attributelog`MODEL-SERIAL.TYPE.csv" >&AS_MESSAGE_FD | |
566 | else | |
567 | echo "smartd attribute logs: [[disabled]]" >&AS_MESSAGE_FD | |
568 | fi | |
569 | echo "libcap-ng support: $use_libcap_ng" >&AS_MESSAGE_FD | |
570 | case "$host_os" in | |
571 | linux*) echo "SELinux support: ${with_selinux-no}" >&AS_MESSAGE_FD ;; | |
572 | esac | |
573 | ;; | |
574 | esac | |
575 | echo "-----------------------------------------------------------------------------" >&AS_MESSAGE_FD |