build-sys: modernize build system
[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.68)
23
24 AC_INIT([libatasmart],
25         [0.19],
26         [mzyvongnfzneg (at) 0pointer (dot) net],
27         [libatasmart],
28         [http://git.0pointer.de/?p=libatasmart.git])
29
30 AC_CONFIG_SRCDIR([atasmart.c])
31 AC_CONFIG_HEADERS([config.h])
32 AC_CONFIG_MACRO_DIR(m4)
33 AC_CONFIG_AUX_DIR([build-aux])
34
35 AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules tar-pax no-dist-gzip dist-xz])
36 AM_SILENT_RULES([yes])
37
38 AC_SUBST(LIBATASMART_VERSION_INFO, [4:4:0])
39
40 if type -p stow > /dev/null && test -d /usr/local/stow ; then
41         AC_MSG_NOTICE([*** Found /usr/local/stow: default install prefix set to /usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION} ***])
42         ac_default_prefix="/usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION}"
43 fi
44
45 AC_PROG_CC
46 AC_PROG_CC_C99
47 AM_PROG_CC_C_O
48 AC_PROG_GCC_TRADITIONAL
49 AX_CC_FOR_BUILD
50
51 AC_USE_SYSTEM_EXTENSIONS
52 AC_SYS_LARGEFILE
53
54 CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
55         -pipe \
56         -Wall \
57         -W \
58         -Wextra \
59         -Winline \
60         -Wvla \
61         -Wundef \
62         -Wformat=2 \
63         -Wlogical-op \
64         -Wsign-compare \
65         -Wformat-security \
66         -Wmissing-include-dirs \
67         -Wformat-nonliteral \
68         -Wold-style-definition \
69         -Wpointer-arith \
70         -Winit-self \
71         -Wdeclaration-after-statement \
72         -Wfloat-equal \
73         -Wmissing-prototypes \
74         -Wstrict-prototypes \
75         -Wredundant-decls \
76         -Wmissing-declarations \
77         -Wmissing-noreturn \
78         -Wshadow \
79         -Wendif-labels \
80         -Wcast-align \
81         -Wstrict-aliasing=2 \
82         -Wwrite-strings \
83         -Wno-long-long \
84         -Wno-overlength-strings \
85         -Wno-unused-parameter \
86         -Wno-missing-field-initializers \
87         -Wno-unused-result \
88         -Wunsafe-loop-optimizations \
89         -Wpacked \
90         -Werror=overflow \
91         -Wp,-D_FORTIFY_SOURCE=2 \
92         -ffast-math \
93         -fno-common \
94         -fdiagnostics-show-option \
95         -fno-strict-aliasing \
96         -ffunction-sections \
97         -fdata-sections])
98 AC_SUBST([WARNINGFLAGS], $with_cflags)
99
100 CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\
101         -Wl,--as-needed \
102         -Wl,--gc-sections])
103 AC_SUBST([GCLDFLAGS], $with_ldflags)
104
105 PKG_PROG_PKG_CONFIG
106 PKG_CHECK_MODULES([LIBUDEV], [libudev >= 143])
107
108 LT_PREREQ(2.2)
109 LT_INIT([disable-static])
110
111 dnl###################################
112 dnl#            Output               #
113 dnl###################################
114
115 AC_CONFIG_FILES([
116 Makefile
117 strpool/Makefile
118 libatasmart.pc
119 ])
120 AC_OUTPUT
121
122 echo "
123  ---{ $PACKAGE_NAME $VERSION }---
124
125     prefix:                 ${prefix}
126     sysconfdir:             ${sysconfdir}
127     localstatedir:          ${localstatedir}
128     Compiler:               ${CC}
129     CFLAGS:                 ${CFLAGS}
130 "