bump version and soname
[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.57)
23
24 AC_INIT([libatasmart], 0.8, [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.9 -Wall])
30
31 AC_SUBST(PACKAGE_URL, [https://http://git.0pointer.de/?p=libatasmart.git])
32
33 AC_SUBST(LIBATASMART_VERSION_INFO, [2:4:2])
34
35 AC_CANONICAL_HOST
36
37 if type -p stow > /dev/null && test -d /usr/local/stow ; then
38    AC_MSG_NOTICE([*** Found /usr/local/stow: default install prefix set to /usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION} ***])
39    ac_default_prefix="/usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION}"
40 fi
41
42 #### Checks for programs. ####
43
44 # CC
45
46 AC_PROG_CC
47 AM_PROG_CC_C_O
48 AC_PROG_GCC_TRADITIONAL
49 AC_GNU_SOURCE
50
51 # C++
52
53 AC_PROG_CXX
54
55 # GCC flags
56
57 test_gcc_flag() {
58     AC_LANG_CONFTEST([int main(int argc, char*argv[]) {}])
59     $CC -c conftest.c $CFLAGS "$1" -o conftest.o > /dev/null 2> /dev/null
60     ret=$?
61     rm -f conftest.o
62     return $ret
63 }
64
65 # If using GCC specify some additional parameters
66 if test "x$GCC" = "xyes" ; then
67
68     # We use gnu99 instead of c99 because many have interpreted the standard
69     # in a way that int64_t isn't defined on non-64 bit platforms.
70     DESIRED_FLAGS="-std=gnu99 -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"
71
72     for flag in $DESIRED_FLAGS ; do
73         AC_MSG_CHECKING([whether $CC accepts $flag])
74         if test_gcc_flag $flag ; then
75            CFLAGS="$CFLAGS $flag"
76            CXXFLAGS="$CXXFLAGS $flag"
77            AC_MSG_RESULT([yes])
78         else
79            AC_MSG_RESULT([no])
80         fi
81     done
82 fi
83
84 #### libtool stuff ####
85
86 AC_PROG_LIBTOOL
87
88 #### Checks for header files. ####
89
90 # ISO
91 AC_HEADER_STDC
92
93 # XPG4-UNIX
94 AC_CHECK_HEADERS([sys/poll.h])
95
96 # Other
97 AC_CHECK_HEADERS([sys/ioctl.h])
98 AC_CHECK_HEADERS([byteswap.h])
99
100 #### Typdefs, structures, etc. ####
101
102 AC_C_CONST
103 AC_C_BIGENDIAN
104 AC_TYPE_PID_T
105 AC_TYPE_SIZE_T
106 AC_CHECK_TYPES(ssize_t, , [AC_DEFINE([ssize_t], [signed long],
107     [Define ssize_t if it is not done by the standard libs.])])
108 AC_TYPE_OFF_T
109 AC_TYPE_SIGNAL
110 AC_TYPE_UID_T
111
112 #### Large File-Support (LFS) ####
113
114 AC_SYS_LARGEFILE
115
116 PKG_CHECK_MODULES([LIBUDEV], [libudev])
117 AC_DEFINE([LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE], 1, [I know the API is subject to change.])
118
119 ###################################
120 #            Output               #
121 ###################################
122
123 AC_CONFIG_FILES([
124 Makefile
125 libatasmart.pc
126 ])
127 AC_OUTPUT
128
129 echo "
130  ---{ $PACKAGE_NAME $VERSION }---
131
132     prefix:                 ${prefix}
133     sysconfdir:             ${sysconfdir}
134     localstatedir:          ${localstatedir}
135     Compiler:               ${CC}
136     CFLAGS:                 ${CFLAGS}
137 "