1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
|
#
# $Id: configure.in,v 1.114 2006/04/12 17:39:32 ballen4705 Exp $
#
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.50)
AC_INIT(smartmontools, 5.36, smartmontools-support@lists.sourceforge.net)
AC_CONFIG_SRCDIR(smartctl.c)
smartmontools_configure_date=`date -u +"%Y/%m/%d %T %Z"`
smartmontools_cvs_tag=`echo '$Id: configure.in,v 1.114 2006/04/12 17:39:32 ballen4705 Exp $'`
smartmontools_release_date=2006/04/12
smartmontools_release_time="17:39:01 UTC"
AC_DEFINE_UNQUOTED(SMARTMONTOOLS_CONFIGURE_ARGS, "$ac_configure_args", [smartmontools Configure Arguments])
AC_DEFINE_UNQUOTED(SMARTMONTOOLS_CONFIGURE_DATE, "$smartmontools_configure_date", [smartmontools Configure Date])
AC_DEFINE_UNQUOTED(SMARTMONTOOLS_RELEASE_DATE, "$smartmontools_release_date", [smartmontools Release Date])
AC_DEFINE_UNQUOTED(SMARTMONTOOLS_RELEASE_TIME, "$smartmontools_release_time", [smartmontools Release Time])
AC_DEFINE_UNQUOTED(CONFIG_H_CVSID, "$smartmontools_cvs_tag", [smartmontools CVS Tag])
AC_DEFINE_UNQUOTED(PACKAGE_HOMEPAGE, "http://smartmontools.sourceforge.net/", [smartmontools Home Page])
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE
AM_MAINTAINER_MODE
AC_LANG_C
dnl Checks for programs.
AC_PROG_CC
AM_PROG_AS
AC_PROG_INSTALL
AC_CANONICAL_HOST
dnl Set flags which may affect AC_CHECK_*.
case "${host}" in
*-*-mingw*)
CPPFLAGS="$CPPFLAGS -mno-cygwin"
LDFLAGS="$LDFLAGS -mno-cygwin"
CPPFLAGS="$CPPFLAGS -idirafter ${srcdir}/posix -idirafter ${srcdir}/os_win32"
esac
dnl Checks for libraries.needed for gethostbyname (Solaris needs
dnl libnsl, might in the future also need libsocket)
# AC_SEARCH_LIBS (FUNCTION, SEARCH-LIBS, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [OTHER-LIBRARIES])
AC_SEARCH_LIBS(gethostbyname, nsl, , AC_SEARCH_LIBS(gethostbyname, nsl, , , -lsocket), , )
dnl Checks for header files.
AC_CHECK_HEADERS([locale.h])
AC_CHECK_HEADERS([getopt.h])
AC_CHECK_HEADERS([dev/ata/atavar.h])
AC_CHECK_HEADERS([netdb.h])
dnl we need [u]int64_t and friends.
AC_CHECK_HEADERS([inttypes.h]) dnl C99, UNIX98, solaris 2.6+
AC_CHECK_HEADERS([stdint.h]) dnl C99
AC_CHECK_HEADERS([sys/inttypes.h]) dnl pre-UNIX98
AC_CHECK_HEADERS([sys/int_types.h]) dnl pre-UNIX98, solaris 2.6+
dnl Check for FreeBSD twe include files...currently missing on 5.2, but should be there
AC_CHECK_HEADERS([sys/tweio.h])
AC_CHECK_HEADERS([sys/twereg.h])
dnl Check for FreeBSD twa include files...
AC_CHECK_HEADERS([sys/tw_osl_ioctl.h])
dnl Checks for typedefs, structures, and compiler characteristics.
AC_CHECK_TYPES([int64_t, uint64_t])
dnl Checks for library functions.
AC_CHECK_FUNCS([getopt])
AC_CHECK_FUNCS([getopt_long])
AC_CHECK_FUNCS([getdomainname])
AC_CHECK_FUNCS([gethostname])
AC_CHECK_FUNCS([gethostbyname])
AC_CHECK_FUNCS([sigset])
AC_CHECK_FUNCS([strtoull])
AC_CHECK_FUNCS([uname])
# Check whether snprintf appends null char and returns expected length on overflow
AH_TEMPLATE(HAVE_WORKING_SNPRINTF, [Define to 1 if the `snprintf' function is sane])
AC_MSG_CHECKING([for working snprintf])
AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[ char buf[]="ABCDEFGHI";
int i=snprintf(buf,8,"12345678"); return !(!buf[7] && i==8); ]])],
[libc_have_working_snprintf=yes], [libc_have_working_snprintf=no])
AC_SUBST(libc_have_working_snprintf)
if test "$libc_have_working_snprintf" = "yes"; then
AC_DEFINE(HAVE_WORKING_SNPRINTF)
fi
AC_MSG_RESULT([$libc_have_working_snprintf])
# check for __attribute__((packed))
AH_TEMPLATE(HAVE_ATTR_PACKED, [Define to 1 if C compiler supports __attribute__((packed))])
AC_MSG_CHECKING([whether C compiler supports __attribute__((packed))])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [[struct a { int b; } __attribute__((packed));]])],
[gcc_have_attr_packed=yes], [gcc_have_attr_packed=no])
AC_SUBST(gcc_have_attr_packed)
if test "$gcc_have_attr_packed" = "yes"; then
AC_DEFINE(HAVE_ATTR_PACKED)
fi
AC_MSG_RESULT([$gcc_have_attr_packed])
AC_SUBST(CPPFLAGS)
AC_SUBST(LDFLAGS)
AC_SUBST(ASFLAGS)
AC_SUBST([exampledir], ['${docdir}/examplescripts'])
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'])
AC_SUBST(initddir)
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}'])
AC_SUBST(docdir)
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=''])
AC_SUBST(smartd_suffix)
AM_CONDITIONAL(SMARTD_SUFFIX, test $smartd_suffix)
if test "$prefix" = "NONE"; then
dnl no prefix and no mandir, so use ${prefix}/share/man as default
if test "$mandir" = '${prefix}/man'; then
AC_SUBST([mandir], ['${prefix}/share/man'])
fi
fi
AC_SUBST(releaseversion,['${PACKAGE}-${VERSION}'])
AC_SUBST(smartmontools_release_date)
AC_SUBST(smartmontools_release_time)
dnl if OS not recognized, then use the os_generic modules
case "${host}" in
*-*-linux-gnu*)
AC_SUBST([os_deps], ['os_linux.o'])
AC_SUBST([os_libs], ['']) ;;
*-*-linux*)
AC_SUBST([os_deps], ['os_linux.o'])
AC_SUBST([os_libs], ['']) ;;
*-*-freebsd*)
AC_SUBST([os_deps], ['os_freebsd.o'])
AC_SUBST([os_libs], ['-lcam']);;
sparc-*-solaris*)
AC_DEFINE_UNQUOTED(DEFAULT_MAILER, "mailx", [use mailx as default mailer])
AC_DEFINE_UNQUOTED(NEED_SOLARIS_ATA_CODE, "os_solaris_ata.s", [need assembly code os_solaris_ata.s])
AC_SUBST([os_deps], ['os_solaris.o os_solaris_ata.o'])
AC_SUBST([os_libs], ['']) ;;
*-pc-solaris*)
AC_DEFINE_UNQUOTED(DEFAULT_MAILER, "mailx", [use mailx as default mailer])
AC_SUBST([os_deps], ['os_solaris.o'])
AC_SUBST([os_libs], ['']) ;;
*-*-netbsd*)
AC_SUBST([os_deps], ['os_netbsd.o'])
AC_SUBST([os_libs], ['-lutil']) ;;
*-*-openbsd*)
AC_SUBST([os_deps], ['os_openbsd.o'])
AC_SUBST([os_libs], ['-lutil']) ;;
*-*-cygwin*)
AC_SUBST([os_deps], ['os_win32.o'])
AC_SUBST([os_libs], ['']) ;;
*-*-mingw*)
AC_SUBST([os_deps], ['os_win32.o'])
AC_SUBST([os_libs], ['']) ;;
*-*-darwin*)
AC_SUBST([os_deps], ['os_darwin.o'])
AC_SUBST([os_libs], ['-framework CoreFoundation -framework IOKit']) ;;
*)
AC_SUBST([os_deps], ['os_generic.o'])
AC_SUBST([os_libs], ['']) ;;
esac
# Define symbols for optional functions in OS specific module
case "${os_deps}" in
os_win32*)
AC_DEFINE(HAVE_ATA_IDENTIFY_IS_CACHED, 1, [Define to 1 if you have the `ata_identify_is_cached' function in os_*.c.]) ;;
esac
case "${os_deps}" in
os_win32*)
AC_DEFINE(HAVE_GET_OS_VERSION_STR, 1, [Define to 1 if you have the `get_os_version_str' function in os_*.c.]) ;;
esac
dnl Define platform-specific symbol.
AM_CONDITIONAL(OS_DARWIN, [echo $host_os | grep '^darwin' > /dev/null])
AM_CONDITIONAL(OS_SOLARIS, [echo $host_os | grep '^solaris' > /dev/null])
AM_CONDITIONAL(OS_WIN32_MINGW, [echo $host_os | grep '^mingw' > /dev/null])
dnl Add -Wall and -W if using gcc and its not already specified.
if test "x$GCC" = "xyes"; then
if test -z "`echo "$CFLAGS" | grep "\-Wall" 2> /dev/null`" ; then
CFLAGS="$CFLAGS -Wall"
fi
# In the next line, do NOT delete the 2 spaces inside double quotes.
if test -z "`echo "$CFLAGS " | grep "\-W " 2> /dev/null`" ; then
CFLAGS="$CFLAGS -W"
fi
case "${host}" in
*-*-mingw*)
# MinGW uses MSVCRT.DLL which uses printf format "%I64d" and not "%lld" for int64_t
CFLAGS="$CFLAGS -Wno-format";;
esac
else
dnl We are NOT using gcc, so enable host-specific compiler flags
case "${host}" in
*-*-solaris*)
dnl set CFLAGS for Solaris C compiler
if test -z "`echo "$CFLAGS" | grep "\-xmemalign" 2> /dev/null`" ; then
dnl we have to tell the compilers about packed ATA structures
CFLAGS="-xmemalign=1i $CFLAGS"
fi
if test -z "`echo "$CFLAGS" | grep "\-xCC" 2> /dev/null`" ; then
dnl we have to tell the compiler to ignore C++ style comments
CFLAGS="-xCC $CFLAGS"
fi
if test -z "`echo "$CFLAGS" | grep "\-xO" 2> /dev/null`" ; then
dnl turn on optimization if user has not explicitly set its value
CFLAGS="-xO2 $CFLAGS"
fi
esac
fi
AC_DEFINE_UNQUOTED(SMARTMONTOOLS_BUILD_HOST, "${host}", [smartmontools Build Host])
AC_SUBST(CFLAGS)
AC_OUTPUT(Makefile examplescripts/Makefile)
AC_PROG_MAKE_SET
|