build-sys: use the same flags checking as PulseAudio.
[platform/upstream/libatasmart.git] / configure.ac
1 # -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 # This file is part of libatasmart.
5 #
6 # Copyright 2008 Lennart Poettering
7 #
8 # libatasmart is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU Lesser General Public License as
10 # published by the Free Software Foundation, either version 2.1 of the
11 # License, or (at your option) any later version.
12 #
13 # libatasmart is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # Lesser General Public License for more details.
17 #
18 # You should have received a copy of the GNU Lesser General Public
19 # License along with libatasmart. If not, If not, see
20 # <http://www.gnu.org/licenses/>.
21
22 AC_PREREQ(2.63)
23
24 AC_INIT([libatasmart], 0.17, [mzyvongnfzneg (at) 0pointer (dot) net])
25 AC_CONFIG_SRCDIR([atasmart.c])
26 AC_CONFIG_HEADERS([config.h])
27 AC_CONFIG_MACRO_DIR(m4)
28
29 AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules tar-pax])
30
31 AC_SUBST(PACKAGE_URL, [http://git.0pointer.de/?p=libatasmart.git])
32
33 AC_SUBST(LIBATASMART_VERSION_INFO, [4:3:0])
34
35 AC_CANONICAL_HOST
36
37 AM_SILENT_RULES([yes])
38
39 if type -p stow > /dev/null && test -d /usr/local/stow ; then
40    AC_MSG_NOTICE([*** Found /usr/local/stow: default install prefix set to /usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION} ***])
41    ac_default_prefix="/usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION}"
42 fi
43
44 #### Checks for programs. ####
45
46 # CC
47
48 AC_PROG_CC
49 AC_PROG_CC_C99
50 AM_PROG_CC_C_O
51 AC_PROG_GCC_TRADITIONAL
52 AX_CC_FOR_BUILD
53 AC_USE_SYSTEM_EXTENSIONS
54
55 # C++
56
57 AC_PROG_CXX
58
59 dnl Check compiler flags
60 CC_CHECK_CFLAGS_APPEND([-Wall -W -Wextra -pedantic -pipe -Wformat -Wold-style-definition -Wdeclaration-after-statement -Wfloat-equal -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wshadow -Wendif-labels -Wpointer-arith -Wcast-align -Wwrite-strings -Winline -Wno-unused-parameter -ffast-math])
61
62 #### libtool stuff ####
63
64 AC_PROG_LIBTOOL
65
66 #### Checks for header files. ####
67
68 # ISO
69 AC_HEADER_STDC
70
71 # XPG4-UNIX
72 AC_CHECK_HEADERS([sys/poll.h])
73
74 # Other
75 AC_CHECK_HEADERS([sys/ioctl.h])
76 AC_CHECK_HEADERS([byteswap.h])
77
78 #### Typdefs, structures, etc. ####
79
80 AC_C_CONST
81 AC_C_BIGENDIAN
82 AC_TYPE_PID_T
83 AC_TYPE_SIZE_T
84 AC_CHECK_TYPES(ssize_t, , [AC_DEFINE([ssize_t], [signed long],
85     [Define ssize_t if it is not done by the standard libs.])])
86 AC_TYPE_OFF_T
87 AC_TYPE_SIGNAL
88 AC_TYPE_UID_T
89
90 #### Large File-Support (LFS) ####
91
92 AC_SYS_LARGEFILE
93
94 PKG_CHECK_MODULES([LIBUDEV], [libudev >= 143])
95
96 ###################################
97 #            Output               #
98 ###################################
99
100 AC_CONFIG_FILES([
101 Makefile
102 strpool/Makefile
103 libatasmart.pc
104 ])
105 AC_OUTPUT
106
107 echo "
108  ---{ $PACKAGE_NAME $VERSION }---
109
110     prefix:                 ${prefix}
111     sysconfdir:             ${sysconfdir}
112     localstatedir:          ${localstatedir}
113     Compiler:               ${CC}
114     CFLAGS:                 ${CFLAGS}
115 "