-
Notifications
You must be signed in to change notification settings - Fork 6
/
configure.ac
214 lines (177 loc) · 5.75 KB
/
configure.ac
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
dnl libgovernor - Open-BLDC configuration and debug protocol library
dnl Copyright (C) 2010 by Piotr Esden-Tempski <[email protected]>
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 3 of the License, or
dnl (at your option) any later version.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
AC_PREREQ(2.50)
AC_INIT([libgovernor], [0.2], [[email protected]])
#===============================
# cross compilation
#===============================
case "$host" in
arm-*)
CFLAGS="$CFLAGS -mcpu=cortex-m3 -mthumb -mfix-cortex-m3-ldrd -ffunction-sections -fdata-sections -msoft-float -g"
LDFLAGS="$LDFLAGS -T${srcdir}/src/stm32.ld -nostartfiles -mthumb -mcpu=cortex-m3 -mfix-cortex-m3-ldrd -msoft-float"
;;
esac
# =============================
# init libtool
# =============================
LT_INIT
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([src/ring.c])
AM_INIT_AUTOMAKE
AC_COPYRIGHT([Copyright (C) 2010-2011 Piotr Esden-Tempski])
AC_DEFINE([COPYRIGHT],["Copyright (C) 2010-2011 Piotr Esden-Tempski <[email protected]>"],[Software package copyright])
AC_DEFINE([LICENSE],["License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>"],[Software package license])
AC_CANONICAL_HOST
AC_DEFINE_UNQUOTED([HOST],["$host"],[The canonical host])
# If the user didn't supplied a CFLAGS value,
# set it to the default of -O2 -g -Wall.
#test -z "$CFLAGS" && CFLAGS="-O2 -g -Wall"
AC_SUBST(EXTRACFLAGS, "-Wall -Wextra -Wshadow -I${srcdir}/include")
AC_SUBST(CHECK_EXTRACFLAGS, "-Wall -Wextra -Wshadow")
AC_SUBST(EXTRALDFLAGS, "")
AC_SUBST(CHECK_EXTRALDFLAGS, "")
# ===================
# Check for programs.
# ===================
dnl AC_PROG_CC
dnl AC_ISC_POSIX
dnl AC_PROG_CC_STDC
dnl AC_PROG_RANLIB
dnl AC_PROG_LN_S
AC_PROG_LIBTOOL
AC_CACHE_SAVE
# ========================
# Checks for header files.
# ========================
AC_HEADER_STDC
AC_HEADER_DIRENT
dnl AC_CHECK_HEADERS(
dnl [stdbool.h] dnl
dnl [stdout.h] dnl
dnl [string.h] dnl
dnl [stdlib.h] dnl
dnl [unistd.h] dnl
dnl )
AC_HEADER_TIME
AC_HEADER_STAT
# ==============================================================
# Checks for typedefs, structures, and compiler characteristics.
# ==============================================================
AC_C_CONST
AC_TYPE_UID_T dnl This checks for gid_t too.
dnl AC_CHECK_TYPES([ssize_t])
# =============================
# Checks for library functions.
# =============================
AC_CHECK_DECLS([malloc, free, memrchr, strnlen])
AC_CHECK_FUNCS([sleep usleep])
AC_FUNC_VPRINTF
AC_REPLACE_FUNCS([memrchr stpcpy strndup strcasecmp])
# for error.c
AC_CHECK_FUNCS([strerror])
AC_CHECK_DECLS([strerror])
AC_FUNC_STRERROR_R
#===============================
# Werror
#===============================
AC_ARG_ENABLE([werror],
[AC_HELP_STRING([--disable-werror], [disable -Werror @<:@default=enabled@:>@])],
[
if test "x${enableval}" = "xyes" ; then
werror="yes"
else
werror="no"
fi
],
[werror="yes"])
if test "x$werror" == "xyes";
then
EXTRACFLAGS="$EXTRACFLAGS -Werror"
CHECK_EXTRACFLAGS="$CHECK_EXTRACFLAGS -Werror"
fi
#==============================
# code coverage stuff
#==============================
AC_ARG_ENABLE(gcov, AC_HELP_STRING([--enable-gcov],[turn on code coverage analysis tools]))
AC_CHECK_PROGS(LCOV, lcov, false)
AC_CHECK_PROGS(GENHTML, genhtml, false)
dnl Check for --enable-gcov and add appropriate flags for gcc
dnl Note that these extra switches are NOT applied to the loader
AC_SUBST(GCOV_ENABLED, "")
if test "x$enable_gcov" = "xyes";
then
GCOV_ENABLED="yes"
EXTRACFLAGS="$EXTRACFLAGS -fprofile-arcs -ftest-coverage"
dnl Turn off optimization so code coverage tool
dnl can get accurate line numbers
CFLAGS=`echo "$CFLAGS" | sed -e 's/-O[0-9]//g'`
EXTRALDFLAGS="$EXTRALDFLAGS -lgcov"
fi
#===============================
# Doxygen support
#===============================
#DX_HTML_FEATURE(ON)
#DX_CHM_FEATURE(OFF)
#DX_CHI_FEATURE(OFF)
#DX_MAN_FEATURE(OFF)
#DX_RTF_FEATURE(OFF)
#DX_XML_FEATURE(OFF)
#DX_PDF_FEATURE(ON)
#DX_PS_FEATURE(OFF)
#
#DX_INIT_DOXYGEN(LG, doxygen.cfg, doc/doxygen)
# ===============================
# Test for check unittest library
# ===============================
AM_PROG_CC_C_O
AC_ARG_ENABLE(check, AC_HELP_STRING([--enable-check],[turn on check unittest library]))
if test "x$enable_check" = "xyes";
then
PKG_CHECK_MODULES([CHECK], [check >= 0.9.4])
fi
# ============
# Output files
# ============
# Put config.h in the base directory because libintl expects it here,
# but keep src/config.h.in in the src/ directory to keep the base directory
# as clean as possible.
AC_CONFIG_HEADERS([include/config.h:include/config.h.in])
AC_CONFIG_FILES([
Makefile
src/Makefile
include/Makefile
tests/Makefile
doc/Makefile
])
AC_OUTPUT
eval bindir="$bindir"
eval bindir="$bindir"
eval datadir="$datadir"
eval mandir="$mandir"
echo "
libgovernor configuration
--------------------
libgovernor version : $VERSION
host : $host
binary install path : $bindir
data install path : ${datadir}/libgovernor
manual page install path : $mandir
compiler : $CC
general options
CFLAGS : $CFLAGS $EXTRACFLAGS
LIBS : $LDFLAGS $LIBS $EXTRALDFLAGS
CHECK_CFLAGS : $CFLAGS $CHECK_EXTRACFLAGS
CHECK_LIBS : $LDFLAGS $LIBS $CHECK_EXTRALDFLAGS"