1 | # |
---|
2 | # $Id: configure.in 3079 2010-04-01 18:45:45Z chrfranke $ |
---|
3 | # |
---|
4 | dnl Process this file with autoconf to produce a configure script. |
---|
5 | AC_PREREQ(2.50) |
---|
6 | AC_INIT(smartmontools, 5.40, smartmontools-support@lists.sourceforge.net) |
---|
7 | AC_CONFIG_SRCDIR(smartctl.cpp) |
---|
8 | |
---|
9 | smartmontools_configure_date=`date -u +'%Y-%m-%d %T %Z'` |
---|
10 | smartmontools_cvs_tag=`echo '$Id: configure.in 3079 2010-04-01 18:45:45Z chrfranke $'` |
---|
11 | smartmontools_release_date=2009-12-09 |
---|
12 | smartmontools_release_time="21:00:32 UTC" |
---|
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 | |
---|
27 | AC_LANG_CPLUSPLUS |
---|
28 | dnl Checks for programs. |
---|
29 | AC_PROG_CXX |
---|
30 | AM_PROG_AS |
---|
31 | AC_PROG_INSTALL |
---|
32 | |
---|
33 | AC_CANONICAL_HOST |
---|
34 | dnl Set flags which may affect AC_CHECK_*. |
---|
35 | case "${host}" in |
---|
36 | *-*-mingw*) |
---|
37 | # If building on Cygwin and not cross-compiling add '-mno-cygwin' |
---|
38 | # to select MinGW gcc. This does no longer work for gcc 4.x. |
---|
39 | if test "${build}" = "${host}" && test -x /usr/bin/uname && \ |
---|
40 | /usr/bin/uname | grep -i '^CYGWIN' >/dev/null; then |
---|
41 | AC_MSG_CHECKING([whether $CC and $CXX support -mno-cygwin]) |
---|
42 | gcc_support_m_no_cygwin=no |
---|
43 | if $CC -v -mno-cygwin >/dev/null 2>&1 && \ |
---|
44 | $CXX -v -mno-cygwin >/dev/null 2>&1; then |
---|
45 | gcc_support_m_no_cygwin=yes |
---|
46 | fi |
---|
47 | AC_MSG_RESULT([$gcc_support_m_no_cygwin]) |
---|
48 | if test "$gcc_support_m_no_cygwin" != "yes"; then |
---|
49 | AC_MSG_ERROR([$CC and $CXX do not support -mno-cygwin, see INSTALL file for details.]) |
---|
50 | fi |
---|
51 | CPPFLAGS="$CPPFLAGS -mno-cygwin" |
---|
52 | LDFLAGS="$LDFLAGS -mno-cygwin" |
---|
53 | fi |
---|
54 | CPPFLAGS="$CPPFLAGS -idirafter ${srcdir}/posix -idirafter ${srcdir}/os_win32" |
---|
55 | ;; |
---|
56 | *-*-freebsd*) |
---|
57 | CPPFLAGS="$CPPFLAGS -I/usr/src/sys" |
---|
58 | ;; |
---|
59 | esac |
---|
60 | |
---|
61 | # Check for SVN. |
---|
62 | AC_MSG_CHECKING([whether this is a build from SVN]) |
---|
63 | is_svn_build=no |
---|
64 | if test -f "$srcdir/.svn/entries"; then |
---|
65 | is_svn_build=unknown |
---|
66 | if (cd "$srcdir" && svn --version && svnversion && svn info) >/dev/null 2>&1; then |
---|
67 | is_svn_build=yes |
---|
68 | fi |
---|
69 | fi |
---|
70 | AM_CONDITIONAL(IS_SVN_BUILD, [test "$is_svn_build" = "yes"]) |
---|
71 | AC_MSG_RESULT([$is_svn_build]) |
---|
72 | |
---|
73 | dnl Checks for libraries needed for name services (Solaris needs |
---|
74 | dnl libnsl, might in the future also need libsocket) |
---|
75 | # AC_SEARCH_LIBS (FUNCTION, SEARCH-LIBS, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [OTHER-LIBRARIES]) |
---|
76 | AC_SEARCH_LIBS(socket, socket) |
---|
77 | AC_SEARCH_LIBS(gethostbyname, nsl) |
---|
78 | AC_SEARCH_LIBS(getaddrinfo, nsl) |
---|
79 | AC_SEARCH_LIBS(getdomainname, nsl) |
---|
80 | |
---|
81 | dnl Checks for header files. |
---|
82 | AC_CHECK_HEADERS([locale.h]) |
---|
83 | AC_CHECK_HEADERS([dev/ata/atavar.h]) |
---|
84 | AC_CHECK_HEADERS([netdb.h]) |
---|
85 | dnl we need [u]int64_t and friends. |
---|
86 | AC_CHECK_HEADERS([inttypes.h]) dnl C99, UNIX98, solaris 2.6+ |
---|
87 | AC_CHECK_HEADERS([stdint.h]) dnl C99 |
---|
88 | AC_CHECK_HEADERS([sys/inttypes.h]) dnl pre-UNIX98 |
---|
89 | AC_CHECK_HEADERS([sys/int_types.h]) dnl pre-UNIX98, solaris 2.6+ |
---|
90 | dnl Check for FreeBSD twe include files...currently missing on 5.2, but should be there |
---|
91 | AC_CHECK_HEADERS([sys/tweio.h]) |
---|
92 | AC_CHECK_HEADERS([sys/twereg.h]) |
---|
93 | dnl Check for FreeBSD twa include files... |
---|
94 | AC_CHECK_HEADERS([sys/tw_osl_ioctl.h]) |
---|
95 | dnl Check for FreeBSD ciss include files... |
---|
96 | AC_CHECK_HEADERS([dev/ciss/cissio.h]) |
---|
97 | dnl This header file is needed for cciss_ioctl.h at least on SuSE LINUX |
---|
98 | AC_CHECK_HEADERS([linux/compiler.h]) |
---|
99 | dnl Check for Linux CCISS include file |
---|
100 | AC_CHECK_HEADERS([linux/cciss_ioctl.h], [], [], [AC_INCLUDES_DEFAULT |
---|
101 | #ifdef HAVE_LINUX_COMPILER_H |
---|
102 | # include <linux/compiler.h> |
---|
103 | #endif |
---|
104 | ]) |
---|
105 | |
---|
106 | dnl Checks for typedefs, structures, and compiler characteristics. |
---|
107 | AC_CHECK_TYPES([int64_t, uint64_t]) |
---|
108 | |
---|
109 | dnl Checks for library functions. |
---|
110 | AC_CHECK_FUNCS([getopt_long], , [ |
---|
111 | AC_MSG_NOTICE([smartmontools does no longer support platforms without getopt_long().]) |
---|
112 | AC_MSG_NOTICE([Please inform ${PACKAGE_BUGREPORT},]) |
---|
113 | AC_MSG_NOTICE([including details about your build environment.]) |
---|
114 | # AC_MSG_ERROR([function getopt_long() not found]) |
---|
115 | ]) |
---|
116 | |
---|
117 | AC_CHECK_FUNCS([getdomainname]) |
---|
118 | AC_CHECK_FUNCS([gethostname]) |
---|
119 | AC_CHECK_FUNCS([getaddrinfo]) |
---|
120 | AC_CHECK_FUNCS([gethostbyname]) |
---|
121 | AC_CHECK_FUNCS([sigset]) |
---|
122 | AC_CHECK_FUNCS([strtoull]) |
---|
123 | AC_CHECK_FUNCS([uname]) |
---|
124 | |
---|
125 | # Check whether snprintf appends null char and returns expected length on overflow |
---|
126 | AH_TEMPLATE(HAVE_WORKING_SNPRINTF, [Define to 1 if the `snprintf' function is sane]) |
---|
127 | AC_MSG_CHECKING([for working snprintf]) |
---|
128 | AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[ char buf[]="ABCDEFGHI"; |
---|
129 | int i=snprintf(buf,8,"12345678"); return !(!buf[7] && i==8); ]])], |
---|
130 | [libc_have_working_snprintf=yes], |
---|
131 | [libc_have_working_snprintf=no], |
---|
132 | [libc_have_working_snprintf=no]) |
---|
133 | AC_SUBST(libc_have_working_snprintf) |
---|
134 | if test "$libc_have_working_snprintf" = "yes"; then |
---|
135 | AC_DEFINE(HAVE_WORKING_SNPRINTF) |
---|
136 | fi |
---|
137 | AC_MSG_RESULT([$libc_have_working_snprintf]) |
---|
138 | |
---|
139 | # check for __attribute__((packed)) |
---|
140 | AH_TEMPLATE(HAVE_ATTR_PACKED, [Define to 1 if C++ compiler supports __attribute__((packed))]) |
---|
141 | AC_MSG_CHECKING([whether $CXX supports __attribute__((packed))]) |
---|
142 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [[struct a { int b; } __attribute__((packed));]])], |
---|
143 | [gcc_have_attr_packed=yes], [gcc_have_attr_packed=no]) |
---|
144 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [[#if defined(__SUNPRO_C) || defined(__SUNPRO_CC) |
---|
145 | #error "Sun's compiler cannot handle __attribute__((packed))!" |
---|
146 | #endif]])], |
---|
147 | [true], [gcc_have_attr_packed=no]) |
---|
148 | AC_SUBST(gcc_have_attr_packed) |
---|
149 | if test "$gcc_have_attr_packed" = "yes"; then |
---|
150 | AC_DEFINE(HAVE_ATTR_PACKED) |
---|
151 | fi |
---|
152 | AC_MSG_RESULT([$gcc_have_attr_packed]) |
---|
153 | |
---|
154 | AC_SUBST(CPPFLAGS) |
---|
155 | AC_SUBST(LDFLAGS) |
---|
156 | AC_SUBST(ASFLAGS) |
---|
157 | |
---|
158 | AC_SUBST([exampledir], ['${docdir}/examplescripts']) |
---|
159 | |
---|
160 | AC_ARG_WITH(initscriptdir, |
---|
161 | [AC_HELP_STRING([--with-initscriptdir=DIR],[Location of init scripts [SYSCONFDIR/rc.d/init.d]])], |
---|
162 | [initddir="$withval"],[initddir='${sysconfdir}/rc.d/init.d']) |
---|
163 | AC_SUBST(initddir) |
---|
164 | AM_CONDITIONAL(INSTALL_INITSCRIPT, [test "$with_initscriptdir" != "no"]) |
---|
165 | |
---|
166 | docdir_is_default=no |
---|
167 | AC_ARG_WITH(docdir, |
---|
168 | [AC_HELP_STRING([--with-docdir=DIR],[Location of documentation [DATADIR/doc/smartmontools]])], |
---|
169 | [docdir="$withval"], |
---|
170 | [ if test -z "$docdir"; then |
---|
171 | # autoconf 2.5x without '--docdir' support |
---|
172 | docdir='${datadir}/doc/${PACKAGE}' |
---|
173 | docdir_is_default=yes |
---|
174 | elif test "$docdir" = '${datarootdir}/doc/${PACKAGE_TARNAME}'; then |
---|
175 | # autoconf 2.6x '--docdir' default |
---|
176 | docdir_is_default=yes |
---|
177 | fi |
---|
178 | ]) |
---|
179 | AC_SUBST(docdir) |
---|
180 | |
---|
181 | AC_ARG_ENABLE(drivedb, [AC_HELP_STRING([--enable-drivedb],[Enables drive database file])]) |
---|
182 | |
---|
183 | AC_ARG_WITH(drivedbdir, |
---|
184 | [AC_HELP_STRING([--with-drivedbdir=DIR],[Location of drive database file (implies --enable-drivedb) [DATADIR/smartmontools]])], |
---|
185 | [drivedbdir="$withval"; enable_drivedb="yes"], |
---|
186 | [drivedbdir=; test "$enable_drivedb" = "yes" && drivedbdir='${datadir}/${PACKAGE}']) |
---|
187 | AC_SUBST(drivedbdir) |
---|
188 | AM_CONDITIONAL(ENABLE_DRIVEDB, [test "$enable_drivedb" = "yes"]) |
---|
189 | |
---|
190 | AC_ARG_ENABLE(savestates, [AC_HELP_STRING([--enable-savestates],[Enables default smartd state files])]) |
---|
191 | |
---|
192 | AC_ARG_WITH(savestates, |
---|
193 | [AC_HELP_STRING([--with-savestates=PREFIX],[Prefix for default smartd state files (implies --enable-savestates) [LOCALSTATEDIR/lib/smartmontools/smartd.]])], |
---|
194 | [savestates="$withval"; enable_savestates="yes"], |
---|
195 | [savestates=; test "$enable_savestates" = "yes" && savestates='${localstatedir}/lib/${PACKAGE}/smartd.']) |
---|
196 | savestatesdir="${savestates%/*}" |
---|
197 | AC_SUBST(savestates) |
---|
198 | AC_SUBST(savestatesdir) |
---|
199 | AM_CONDITIONAL(ENABLE_SAVESTATES, [test "$enable_savestates" = "yes"]) |
---|
200 | |
---|
201 | AC_ARG_ENABLE(attributelog, [AC_HELP_STRING([--enable-attributelog],[Enables default smartd attribute log files])]) |
---|
202 | |
---|
203 | AC_ARG_WITH(attributelog, |
---|
204 | [AC_HELP_STRING([--with-attributelog=PREFIX],[Prefix for default smartd attribute log files (implies --enable-attributelog) [LOCALSTATEDIR/lib/smartmontools/attrlog.]])], |
---|
205 | [attributelog="$withval"; enable_attributelog="yes"], |
---|
206 | [attributelog=; test "$enable_attributelog" = "yes" && attributelog='${localstatedir}/lib/${PACKAGE}/attrlog.']) |
---|
207 | attributelogdir="${attributelog%/*}" |
---|
208 | AC_SUBST(attributelog) |
---|
209 | AC_SUBST(attributelogdir) |
---|
210 | AM_CONDITIONAL(ENABLE_ATTRIBUTELOG, [test "$enable_attributelog" = "yes"]) |
---|
211 | |
---|
212 | AC_ARG_ENABLE(sample,[AC_HELP_STRING([--enable-sample],[Enables appending .sample to the installed smartd rc script and configuration file])],[smartd_suffix='.sample'],[smartd_suffix='']) |
---|
213 | AC_SUBST(smartd_suffix) |
---|
214 | AM_CONDITIONAL(SMARTD_SUFFIX, test $smartd_suffix) |
---|
215 | |
---|
216 | AC_ARG_WITH(os-deps, |
---|
217 | [AC_HELP_STRING([--with-os-deps='os_module.o ...'],[Specify OS dependent module(s) [guessed]])], |
---|
218 | [ for x in $with_os_deps; do |
---|
219 | case $x in |
---|
220 | *.o) ;; |
---|
221 | *) AC_MSG_ERROR([non-object file specified by --with-os-deps]) ;; |
---|
222 | esac |
---|
223 | done |
---|
224 | ],[]) |
---|
225 | |
---|
226 | AC_ARG_WITH(selinux,[AC_HELP_STRING([--with-selinux],[Enables SELinux support])], |
---|
227 | [ |
---|
228 | AC_CHECK_HEADERS([selinux/selinux.h], [], [echo "*** Error: Missing SELinux header files";exit 1]) |
---|
229 | AC_CHECK_LIB(selinux, matchpathcon, [with_selinux=yes], [echo "*** Error: Missing or incorrect SELinux library files"; exit 1],) |
---|
230 | ],[]) |
---|
231 | AC_SUBST(with_selinux) |
---|
232 | if test "$with_selinux" = "yes"; then |
---|
233 | AC_DEFINE(WITH_SELINUX, [1], [Define to 1 if SELinux support is enabled]) |
---|
234 | fi |
---|
235 | |
---|
236 | AC_ARG_WITH(libcap-ng, |
---|
237 | [AC_HELP_STRING([--with-libcap-ng=[auto|yes|no]], [Add Libcap-ng support to smartd [auto]])], |
---|
238 | [with_libcap_ng="$withval"], |
---|
239 | [with_libcap_ng=auto]) |
---|
240 | |
---|
241 | use_libcap_ng=no |
---|
242 | if test "$with_libcap_ng" != "no"; then |
---|
243 | AC_CHECK_LIB(cap-ng, capng_clear, |
---|
244 | [AC_DEFINE(HAVE_LIBCAP_NG, 1, [Define to 1 if you have the `cap-ng' library (-lcap-ng).]) |
---|
245 | CAPNG_LDADD="-lcap-ng"; use_libcap_ng=yes]) |
---|
246 | |
---|
247 | if test "$use_libcap_ng" = "yes"; then |
---|
248 | AC_CHECK_HEADER(cap-ng.h, [], [AC_MSG_ERROR([libcap-ng libraries found but headers are missing])]) |
---|
249 | elif test "$with_libcap_ng" = "yes"; then |
---|
250 | AC_MSG_ERROR([libcap-ng support was requested but the library was not found]) |
---|
251 | fi |
---|
252 | fi |
---|
253 | |
---|
254 | AC_MSG_CHECKING([whether to use libcap-ng]) |
---|
255 | AC_SUBST(CAPNG_LDADD) |
---|
256 | AM_CONDITIONAL(ENABLE_CAPABILITIES, [test "$use_libcap_ng" = "yes"]) |
---|
257 | AC_MSG_RESULT([$use_libcap_ng]) |
---|
258 | |
---|
259 | if test "$prefix" = "NONE"; then |
---|
260 | dnl no prefix and no mandir, so use ${prefix}/share/man as default |
---|
261 | if test "$mandir" = '${prefix}/man'; then |
---|
262 | AC_SUBST([mandir], ['${prefix}/share/man']) |
---|
263 | fi |
---|
264 | fi |
---|
265 | |
---|
266 | AC_SUBST(releaseversion,['${PACKAGE}-${VERSION}']) |
---|
267 | AC_SUBST(smartmontools_release_date) |
---|
268 | AC_SUBST(smartmontools_release_time) |
---|
269 | |
---|
270 | AC_MSG_CHECKING([for OS dependent modules and libraries]) |
---|
271 | dnl if OS not recognized, then use the os_generic modules |
---|
272 | os_win64=no |
---|
273 | case "${host}" in |
---|
274 | *-*-linux*) |
---|
275 | AC_SUBST([os_deps], ['os_linux.o cciss.o']) |
---|
276 | if test "$with_selinux" = "yes"; then |
---|
277 | AC_SUBST([os_libs], ['-lselinux']) |
---|
278 | else |
---|
279 | AC_SUBST([os_libs], ['']) |
---|
280 | fi;; |
---|
281 | *-*-freebsd*|*-*-dragonfly*|*-*-kfreebsd*-gnu*) |
---|
282 | AC_SUBST([os_deps], ['os_freebsd.o cciss.o']) |
---|
283 | AC_SUBST([os_libs], ['-lcam']) |
---|
284 | AC_CHECK_LIB(usb, libusb20_dev_get_device_desc) |
---|
285 | ;; |
---|
286 | sparc-*-solaris*) |
---|
287 | AC_DEFINE_UNQUOTED(DEFAULT_MAILER, "mailx", [use mailx as default mailer]) |
---|
288 | AC_DEFINE_UNQUOTED(NEED_SOLARIS_ATA_CODE, "os_solaris_ata.s", [need assembly code os_solaris_ata.s]) |
---|
289 | AC_SUBST([os_deps], ['os_solaris.o os_solaris_ata.o']) |
---|
290 | AC_SUBST([os_libs], ['']) ;; |
---|
291 | *-pc-solaris*) |
---|
292 | AC_DEFINE_UNQUOTED(DEFAULT_MAILER, "mailx", [use mailx as default mailer]) |
---|
293 | AC_SUBST([os_deps], ['os_solaris.o']) |
---|
294 | AC_SUBST([os_libs], ['']) ;; |
---|
295 | *-*-netbsd*) |
---|
296 | AC_SUBST([os_deps], ['os_netbsd.o']) |
---|
297 | AC_SUBST([os_libs], ['-lutil']) ;; |
---|
298 | *-*-openbsd*) |
---|
299 | AC_SUBST([os_deps], ['os_openbsd.o']) |
---|
300 | AC_SUBST([os_libs], ['-lutil']) ;; |
---|
301 | *-*-cygwin*) |
---|
302 | AC_SUBST([os_deps], ['os_win32.o']) |
---|
303 | AC_SUBST([os_libs], ['']) ;; |
---|
304 | *-*-mingw*) |
---|
305 | AC_SUBST([os_deps], ['os_win32.o']) |
---|
306 | AC_SUBST([os_libs], ['']) |
---|
307 | test "$host_cpu" = "x86_64" && os_win64=yes ;; |
---|
308 | *-*-darwin*) |
---|
309 | AC_SUBST([os_deps], ['os_darwin.o']) |
---|
310 | AC_SUBST([os_libs], ['-framework CoreFoundation -framework IOKit']) ;; |
---|
311 | *-*-nto-qnx*) |
---|
312 | AC_SUBST([os_deps], ['os_qnxnto.o getopt/getopt.o getopt/getopt1.o']) |
---|
313 | CXXFLAGS="$CXXFLAGS -Igetopt -D__GNU_LIBRARY__" |
---|
314 | AC_SUBST([os_libs], ['']) ;; |
---|
315 | |
---|
316 | *) |
---|
317 | AC_SUBST([os_deps], ['os_generic.o']) |
---|
318 | AC_SUBST([os_libs], ['']) ;; |
---|
319 | esac |
---|
320 | |
---|
321 | # Replace if '--with-os-deps' was specified |
---|
322 | test -z "$with_os_deps" || os_deps="$with_os_deps" |
---|
323 | AC_MSG_RESULT([$os_deps $os_libs]) |
---|
324 | |
---|
325 | # Define symbols for optional functions in OS specific module |
---|
326 | case "${os_deps}" in |
---|
327 | os_win32*) |
---|
328 | AC_DEFINE(HAVE_ATA_IDENTIFY_IS_CACHED, 1, [Define to 1 if you have the `ata_identify_is_cached' function in os_*.c.]) ;; |
---|
329 | esac |
---|
330 | case "${os_deps}" in |
---|
331 | os_win32*) |
---|
332 | AC_DEFINE(HAVE_GET_OS_VERSION_STR, 1, [Define to 1 if you have the `get_os_version_str' function in os_*.c.]) ;; |
---|
333 | esac |
---|
334 | |
---|
335 | # Check if we need adapter to old interface (dev_legacy.cpp) |
---|
336 | os_src=`echo "${os_deps}"|sed -n 's,^\([[^ .]]*\)\.o.*$,\1.cpp,p'` |
---|
337 | AC_MSG_CHECKING([whether ${os_src} uses new interface]) |
---|
338 | if grep "smart_interface" "${srcdir}/${os_src}" >/dev/null 2>&1; then |
---|
339 | os_new_interface=yes |
---|
340 | else |
---|
341 | os_new_interface=no |
---|
342 | os_deps="${os_deps} dev_legacy.o" |
---|
343 | AC_DEFINE(OLD_INTERFACE, 1, [Define to 1 if os_*.cpp still uses the old interface]) |
---|
344 | fi |
---|
345 | AC_MSG_RESULT([$os_new_interface]) |
---|
346 | |
---|
347 | dnl Define platform-specific symbol. |
---|
348 | AM_CONDITIONAL(OS_DARWIN, [echo $host_os | grep '^darwin' > /dev/null]) |
---|
349 | AM_CONDITIONAL(OS_SOLARIS, [echo $host_os | grep '^solaris' > /dev/null]) |
---|
350 | AM_CONDITIONAL(OS_WIN32_MINGW, [echo $host_os | grep '^mingw' > /dev/null]) |
---|
351 | AM_CONDITIONAL(OS_WIN64, [test "$os_win64" = "yes"]) |
---|
352 | AM_CONDITIONAL(OS_FREEBSD, [echo $host_os | grep '^freebsd' > /dev/null]) |
---|
353 | |
---|
354 | dnl Add -Wall and -W if using g++ and its not already specified. |
---|
355 | if test "$GXX" = "yes"; then |
---|
356 | if test -z "`echo "$CXXFLAGS" | grep "\-Wall" 2> /dev/null`" ; then |
---|
357 | CXXFLAGS="$CXXFLAGS -Wall" |
---|
358 | fi |
---|
359 | # In the next line, do NOT delete the 2 spaces inside double quotes. |
---|
360 | if test -z "`echo "$CXXFLAGS " | grep "\-W " 2> /dev/null`" ; then |
---|
361 | CXXFLAGS="$CXXFLAGS -W" |
---|
362 | fi |
---|
363 | case "${host}" in |
---|
364 | *-*-mingw*) |
---|
365 | # MinGW uses MSVCRT.DLL which uses printf format "%I64d" and not "%lld" for int64_t |
---|
366 | CXXFLAGS="$CXXFLAGS -Wno-format";; |
---|
367 | esac |
---|
368 | |
---|
369 | # Disable strict aliasing rules by default (see ticket #23). |
---|
370 | if test -z "`echo "$CXXFLAGS" | grep "\-f[[no-]]*strict-aliasing" 2> /dev/null`" ; then |
---|
371 | AC_MSG_CHECKING([whether $CXX supports -fno-strict-aliasing]) |
---|
372 | ac_save_CXXFLAGS="$CXXFLAGS" |
---|
373 | CXXFLAGS="-fno-strict-aliasing" |
---|
374 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], |
---|
375 | [gcc_have_fno_strict_aliasing=yes], [gcc_have_fno_strict_aliasing=no]) |
---|
376 | CXXFLAGS="$ac_save_CXXFLAGS" |
---|
377 | if test "$gcc_have_fno_strict_aliasing" = "yes"; then |
---|
378 | CXXFLAGS="$CXXFLAGS -fno-strict-aliasing" |
---|
379 | fi |
---|
380 | AC_MSG_RESULT([$gcc_have_fno_strict_aliasing]) |
---|
381 | fi |
---|
382 | |
---|
383 | else |
---|
384 | dnl We are NOT using gcc, so enable host-specific compiler flags |
---|
385 | case "${host}" in |
---|
386 | sparc*-*-solaris*) |
---|
387 | dnl set CXXFLAGS for Solaris/SPARC C++ compiler |
---|
388 | if test -z "`echo "$CXXFLAGS" | grep "\-xmemalign" 2> /dev/null`" ; then |
---|
389 | dnl we have to tell the compilers about packed ATA structures |
---|
390 | CXXFLAGS="-xmemalign=1i $CXXFLAGS" |
---|
391 | fi |
---|
392 | esac |
---|
393 | case "${host}" in |
---|
394 | *-*-solaris*) |
---|
395 | if test -z "`echo "$CXXFLAGS" | grep "\-xO" 2> /dev/null`" ; then |
---|
396 | dnl turn on optimization if user has not explicitly set its value |
---|
397 | CXXFLAGS="-xO2 $CXXFLAGS" |
---|
398 | fi |
---|
399 | if test -z "`echo "$CXXFLAGS" | grep "\-erroff" 2> /dev/null`" ; then |
---|
400 | dnl suppress trivial warnings |
---|
401 | CXXFLAGS="-erroff=%none,wbadinitl,wbadasgl,badargtypel2w,badargtype2w $CXXFLAGS" |
---|
402 | fi |
---|
403 | esac |
---|
404 | fi |
---|
405 | |
---|
406 | AC_DEFINE_UNQUOTED(SMARTMONTOOLS_BUILD_HOST, "${host}", [smartmontools Build Host]) |
---|
407 | |
---|
408 | AC_SUBST(CXXFLAGS) |
---|
409 | |
---|
410 | AC_OUTPUT(Makefile examplescripts/Makefile) |
---|
411 | AC_PROG_MAKE_SET |
---|
412 | |
---|
413 | echo "-----------------------------------------------------------------------------" >&AS_MESSAGE_FD |
---|
414 | echo "${PACKAGE}-${VERSION} configuration:" >&AS_MESSAGE_FD |
---|
415 | echo "host operating system: $host" >&AS_MESSAGE_FD |
---|
416 | echo "C++ compiler: $CXX" >&AS_MESSAGE_FD |
---|
417 | echo "preprocessor flags: $CPPFLAGS" >&AS_MESSAGE_FD |
---|
418 | echo "C++ compiler flags: $CXXFLAGS" >&AS_MESSAGE_FD |
---|
419 | echo "linker flags: $LDFLAGS" >&AS_MESSAGE_FD |
---|
420 | |
---|
421 | case "$host_os" in |
---|
422 | mingw*) |
---|
423 | if test -n "$drivedbdir"; then |
---|
424 | echo "drive database file: `eval eval eval echo $drivedbdir`/drivedb.h" >&AS_MESSAGE_FD |
---|
425 | fi |
---|
426 | if test -n "$savestates"; then |
---|
427 | echo "smartd save files: `eval eval eval echo $savestates`MODEL-SERIAL.TYPE.state" >&AS_MESSAGE_FD |
---|
428 | fi |
---|
429 | if test -n "$attributelog"; then |
---|
430 | echo "smartd attribute logs: `eval eval eval echo $attributelog`MODEL-SERIAL.TYPE.csv" >&AS_MESSAGE_FD |
---|
431 | fi |
---|
432 | ;; |
---|
433 | |
---|
434 | *) |
---|
435 | echo "binary install path: `eval eval eval echo $sbindir`" >&AS_MESSAGE_FD |
---|
436 | echo "man page install path: `eval eval eval echo $mandir`" >&AS_MESSAGE_FD |
---|
437 | echo "doc file install path: `eval eval eval echo $docdir`" >&AS_MESSAGE_FD |
---|
438 | if test "$docdir_is_default" = "yes"; then |
---|
439 | echo "(NOTE: old default was: `eval eval eval echo ${prefix}/share/doc/${PACKAGE}-${VERSION}`)" >&AS_MESSAGE_FD |
---|
440 | fi |
---|
441 | if test -n "$drivedbdir"; then |
---|
442 | echo "drive database file: `eval eval eval echo $drivedbdir`/drivedb.h" >&AS_MESSAGE_FD |
---|
443 | echo "database update script: `eval eval eval echo $sbindir`/update-smart-drivedb" >&AS_MESSAGE_FD |
---|
444 | else |
---|
445 | echo "drive database file: [[disabled]]" >&AS_MESSAGE_FD |
---|
446 | echo "database update script: [[disabled]]" >&AS_MESSAGE_FD |
---|
447 | fi |
---|
448 | echo "local drive database: `eval eval eval echo $sysconfdir`/smart_drivedb.h" >&AS_MESSAGE_FD |
---|
449 | echo "smartd config file: `eval eval eval echo $sysconfdir`/smartd.conf${smartd_suffix}" >&AS_MESSAGE_FD |
---|
450 | echo "smartd initd script: `eval eval eval echo $initddir`/smartd${smartd_suffix}" >&AS_MESSAGE_FD |
---|
451 | if test -n "$savestates"; then |
---|
452 | echo "smartd save files: `eval eval eval echo $savestates`MODEL-SERIAL.TYPE.state" >&AS_MESSAGE_FD |
---|
453 | else |
---|
454 | echo "smartd save files: [[disabled]]" >&AS_MESSAGE_FD |
---|
455 | fi |
---|
456 | if test -n "$attributelog"; then |
---|
457 | echo "smartd attribute logs: `eval eval eval echo $attributelog`MODEL-SERIAL.TYPE.csv" >&AS_MESSAGE_FD |
---|
458 | else |
---|
459 | echo "smartd attribute logs: [[disabled]]" >&AS_MESSAGE_FD |
---|
460 | fi |
---|
461 | echo "libcap-ng support: $use_libcap_ng" >&AS_MESSAGE_FD |
---|
462 | case "$host_os" in |
---|
463 | linux*) echo "SELinux support: ${with_selinux-no}" >&AS_MESSAGE_FD ;; |
---|
464 | esac |
---|
465 | ;; |
---|
466 | esac |
---|
467 | echo "-----------------------------------------------------------------------------" >&AS_MESSAGE_FD |
---|