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