]> git.proxmox.com Git - mirror_smartmontools-debian.git/blob - configure.in
bump standards version
[mirror_smartmontools-debian.git] / configure.in
1 #
2 # $Id: configure.in,v 1.130 2008/02/24 20:16:31 ballen4705 Exp $
3 #
4 dnl Process this file with autoconf to produce a configure script.
5 AC_PREREQ(2.50)
6 AC_INIT(smartmontools, 5.38, 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,v 1.130 2008/02/24 20:16:31 ballen4705 Exp $'`
11 smartmontools_release_date=2008/02/24
12 smartmontools_release_time="20:16:09 GMT"
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 CPPFLAGS="$CPPFLAGS -mno-cygwin"
38 LDFLAGS="$LDFLAGS -mno-cygwin"
39 CPPFLAGS="$CPPFLAGS -idirafter ${srcdir}/posix -idirafter ${srcdir}/os_win32"
40 ;;
41 *-*-freebsd*)
42 CPPFLAGS="$CPPFLAGS -I/usr/src/sys"
43 ;;
44 esac
45
46 dnl Checks for libraries.needed for gethostbyname (Solaris needs
47 dnl libnsl, might in the future also need libsocket)
48 # AC_SEARCH_LIBS (FUNCTION, SEARCH-LIBS, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [OTHER-LIBRARIES])
49 AC_SEARCH_LIBS(gethostbyname, nsl, , AC_SEARCH_LIBS(gethostbyname, nsl, , , -lsocket), , )
50
51 dnl Checks for header files.
52 AC_CHECK_HEADERS([locale.h])
53 AC_CHECK_HEADERS([getopt.h])
54 AC_CHECK_HEADERS([dev/ata/atavar.h])
55 AC_CHECK_HEADERS([netdb.h])
56 dnl we need [u]int64_t and friends.
57 AC_CHECK_HEADERS([inttypes.h]) dnl C99, UNIX98, solaris 2.6+
58 AC_CHECK_HEADERS([stdint.h]) dnl C99
59 AC_CHECK_HEADERS([sys/inttypes.h]) dnl pre-UNIX98
60 AC_CHECK_HEADERS([sys/int_types.h]) dnl pre-UNIX98, solaris 2.6+
61 dnl Check for FreeBSD twe include files...currently missing on 5.2, but should be there
62 AC_CHECK_HEADERS([sys/tweio.h])
63 AC_CHECK_HEADERS([sys/twereg.h])
64 dnl Check for FreeBSD twa include files...
65 AC_CHECK_HEADERS([sys/tw_osl_ioctl.h])
66 dnl Check for FreeBSD ciss include files...
67 AC_CHECK_HEADERS([dev/ciss/cissio.h])
68 dnl This header file is needed for cciss_ioctl.h at least on SuSE LINUX
69 AC_CHECK_HEADERS([linux/compiler.h])
70 dnl Check for Linux CCISS include file
71 AC_CHECK_HEADERS([linux/cciss_ioctl.h], [], [], [AC_INCLUDES_DEFAULT
72 #ifdef HAVE_LINUX_COMPILER_H
73 # include <linux/compiler.h>
74 #endif
75 ])
76
77 dnl Checks for typedefs, structures, and compiler characteristics.
78 AC_CHECK_TYPES([int64_t, uint64_t])
79
80 dnl Checks for library functions.
81 AC_CHECK_FUNCS([getopt])
82 AC_CHECK_FUNCS([getopt_long])
83 AC_CHECK_FUNCS([getdomainname])
84 AC_CHECK_FUNCS([gethostname])
85 AC_CHECK_FUNCS([gethostbyname])
86 AC_CHECK_FUNCS([sigset])
87 AC_CHECK_FUNCS([strtoull])
88 AC_CHECK_FUNCS([uname])
89
90 # Check whether snprintf appends null char and returns expected length on overflow
91 AH_TEMPLATE(HAVE_WORKING_SNPRINTF, [Define to 1 if the `snprintf' function is sane])
92 AC_MSG_CHECKING([for working snprintf])
93 AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[ char buf[]="ABCDEFGHI";
94 int i=snprintf(buf,8,"12345678"); return !(!buf[7] && i==8); ]])],
95 [libc_have_working_snprintf=yes],
96 [libc_have_working_snprintf=no],
97 [libc_have_working_snprintf=no])
98 AC_SUBST(libc_have_working_snprintf)
99 if test "$libc_have_working_snprintf" = "yes"; then
100 AC_DEFINE(HAVE_WORKING_SNPRINTF)
101 fi
102 AC_MSG_RESULT([$libc_have_working_snprintf])
103
104 # check for __attribute__((packed))
105 AH_TEMPLATE(HAVE_ATTR_PACKED, [Define to 1 if C++ compiler supports __attribute__((packed))])
106 AC_MSG_CHECKING([whether C++ compiler supports __attribute__((packed))])
107 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [[struct a { int b; } __attribute__((packed));]])],
108 [gcc_have_attr_packed=yes], [gcc_have_attr_packed=no])
109 AC_SUBST(gcc_have_attr_packed)
110 if test "$gcc_have_attr_packed" = "yes"; then
111 AC_DEFINE(HAVE_ATTR_PACKED)
112 fi
113 AC_MSG_RESULT([$gcc_have_attr_packed])
114
115 AC_SUBST(CPPFLAGS)
116 AC_SUBST(LDFLAGS)
117 AC_SUBST(ASFLAGS)
118
119 AC_SUBST([exampledir], ['${docdir}/examplescripts'])
120
121 AC_ARG_WITH(initscriptdir,[AC_HELP_STRING([--with-initscriptdir=dir],[Location of init scripts (default is ${sysconfdir}/rc.d/init.d)])],[initddir="$withval"],[initddir='${sysconfdir}/rc.d/init.d'])
122 AC_SUBST(initddir)
123
124 AC_ARG_WITH(docdir,[AC_HELP_STRING([--with-docdir=dir],[Location of documentation (default is ${prefix}/share/doc/smartmontools-5.X)])],[docdir="$withval"],[docdir='${prefix}/share/doc/${PACKAGE}-${VERSION}'])
125 AC_SUBST(docdir)
126
127 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=''])
128 AC_SUBST(smartd_suffix)
129 AM_CONDITIONAL(SMARTD_SUFFIX, test $smartd_suffix)
130
131 if test "$prefix" = "NONE"; then
132 dnl no prefix and no mandir, so use ${prefix}/share/man as default
133 if test "$mandir" = '${prefix}/man'; then
134 AC_SUBST([mandir], ['${prefix}/share/man'])
135 fi
136 fi
137
138 AC_SUBST(releaseversion,['${PACKAGE}-${VERSION}'])
139 AC_SUBST(smartmontools_release_date)
140 AC_SUBST(smartmontools_release_time)
141
142 dnl if OS not recognized, then use the os_generic modules
143 case "${host}" in
144 *-*-linux*)
145 AC_SUBST([os_deps], ['os_linux.o cciss.o'])
146 AC_SUBST([os_libs], ['']) ;;
147 *-*-freebsd*|*-*-dragonfly*)
148 AC_SUBST([os_deps], ['os_freebsd.o cciss.o'])
149 AC_SUBST([os_libs], ['-lcam']);;
150 sparc-*-solaris*)
151 AC_DEFINE_UNQUOTED(DEFAULT_MAILER, "mailx", [use mailx as default mailer])
152 AC_DEFINE_UNQUOTED(NEED_SOLARIS_ATA_CODE, "os_solaris_ata.s", [need assembly code os_solaris_ata.s])
153 AC_SUBST([os_deps], ['os_solaris.o os_solaris_ata.o'])
154 AC_SUBST([os_libs], ['']) ;;
155 *-pc-solaris*)
156 AC_DEFINE_UNQUOTED(DEFAULT_MAILER, "mailx", [use mailx as default mailer])
157 AC_SUBST([os_deps], ['os_solaris.o'])
158 AC_SUBST([os_libs], ['']) ;;
159 *-*-netbsd*)
160 AC_SUBST([os_deps], ['os_netbsd.o'])
161 AC_SUBST([os_libs], ['-lutil']) ;;
162 *-*-openbsd*)
163 AC_SUBST([os_deps], ['os_openbsd.o'])
164 AC_SUBST([os_libs], ['-lutil']) ;;
165 *-*-cygwin*)
166 AC_SUBST([os_deps], ['os_win32.o'])
167 AC_SUBST([os_libs], ['']) ;;
168 *-*-mingw*)
169 AC_SUBST([os_deps], ['os_win32.o'])
170 AC_SUBST([os_libs], ['']) ;;
171 *-*-darwin*)
172 AC_SUBST([os_deps], ['os_darwin.o'])
173 AC_SUBST([os_libs], ['-framework CoreFoundation -framework IOKit']) ;;
174 *-*-nto-qnx*)
175 AC_SUBST([os_deps], ['os_qnxnto.o'])
176 AC_SUBST([os_libs], ['']) ;;
177
178 *)
179 AC_SUBST([os_deps], ['os_generic.o'])
180 AC_SUBST([os_libs], ['']) ;;
181 esac
182
183 # Define symbols for optional functions in OS specific module
184 case "${os_deps}" in
185 os_win32*)
186 AC_DEFINE(HAVE_ATA_IDENTIFY_IS_CACHED, 1, [Define to 1 if you have the `ata_identify_is_cached' function in os_*.c.]) ;;
187 esac
188 case "${os_deps}" in
189 os_win32*)
190 AC_DEFINE(HAVE_GET_OS_VERSION_STR, 1, [Define to 1 if you have the `get_os_version_str' function in os_*.c.]) ;;
191 esac
192
193 dnl Define platform-specific symbol.
194 AM_CONDITIONAL(OS_DARWIN, [echo $host_os | grep '^darwin' > /dev/null])
195 AM_CONDITIONAL(OS_SOLARIS, [echo $host_os | grep '^solaris' > /dev/null])
196 AM_CONDITIONAL(OS_WIN32_MINGW, [echo $host_os | grep '^mingw' > /dev/null])
197
198 dnl Add -Wall and -W if using gcc and its not already specified.
199 if test "x$GCC" = "xyes"; then
200 if test -z "`echo "$CXXFLAGS" | grep "\-Wall" 2> /dev/null`" ; then
201 CXXFLAGS="$CXXFLAGS -Wall"
202 fi
203 # In the next line, do NOT delete the 2 spaces inside double quotes.
204 if test -z "`echo "$CXXFLAGS " | grep "\-W " 2> /dev/null`" ; then
205 CXXFLAGS="$CXXFLAGS -W"
206 fi
207 case "${host}" in
208 *-*-mingw*)
209 # MinGW uses MSVCRT.DLL which uses printf format "%I64d" and not "%lld" for int64_t
210 CXXFLAGS="$CXXFLAGS -Wno-format";;
211 esac
212 else
213 dnl We are NOT using gcc, so enable host-specific compiler flags
214 case "${host}" in
215 *-*-solaris*)
216 dnl set CXXFLAGS for Solaris C++ compiler
217 if test -z "`echo "$CXXFLAGS" | grep "\-xmemalign" 2> /dev/null`" ; then
218 dnl we have to tell the compilers about packed ATA structures
219 CXXFLAGS="-xmemalign=1i $CXXFLAGS"
220 fi
221 if test -z "`echo "$CXXFLAGS" | grep "\-xO" 2> /dev/null`" ; then
222 dnl turn on optimization if user has not explicitly set its value
223 CXXFLAGS="-xO2 $CXXFLAGS"
224 fi
225 if test -z "`echo "$CXXFLAGS" | grep "\-erroff" 2> /dev/null`" ; then
226 dnl suppress warnings on use of string literal (const char[]) as
227 dnl char*. TODO: Sun Studio 10 (Sun C++ 5.7) or above only?
228 CXXFLAGS="-erroff=%none,wbadinitl,wbadasgl,badargtypel2w $CXXFLAGS"
229 fi
230 esac
231 fi
232
233 AC_DEFINE_UNQUOTED(SMARTMONTOOLS_BUILD_HOST, "${host}", [smartmontools Build Host])
234
235 AC_SUBST(CXXFLAGS)
236
237 AC_OUTPUT(Makefile examplescripts/Makefile)
238 AC_PROG_MAKE_SET