forked from kfish/libshveu
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfigure.ac
274 lines (214 loc) · 7.66 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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
################################################################################
# libshveu: A library for controlling SH-Mobile VEU hardware #
################################################################################
# Process this file with autoconf to produce a configure script.
AC_INIT
AC_CONFIG_SRCDIR([src/libshveu/veu.c])
AC_PREREQ(2.53)
AM_INIT_AUTOMAKE(libshveu, 1.7.2)
AM_CONFIG_HEADER(config.h)
################################################################################
# Set the shared versioning info, according to section 6.3 of the libtool info #
# pages. CURRENT:REVISION:AGE must be updated immediately before each release: #
# #
# * If the library source code has changed at all since the last #
# update, then increment REVISION (`C:R:A' becomes `C:r+1:A'). #
# #
# * If any interfaces have been added, removed, or changed since the #
# last update, increment CURRENT, and set REVISION to 0. #
# #
# * If any interfaces have been added since the last public release, #
# then increment AGE. #
# #
# * If any interfaces have been removed since the last public release, #
# then set AGE to 0. #
# #
################################################################################
SHARED_VERSION_INFO="7:2:2"
SHLIB_VERSION_ARG=""
# Checks for programs.
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL
AC_C_CONST
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h inttypes.h stdlib.h string.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
# Checks for library functions.
AC_FUNC_REALLOC
AC_CHECK_FUNCS([])
# Check for pkg-config
AC_CHECK_PROG(HAVE_PKG_CONFIG, pkg-config, yes)
# Check for doxygen
AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, true, false)
AM_CONDITIONAL(HAVE_DOXYGEN,$HAVE_DOXYGEN)
if test $HAVE_DOXYGEN = "false"; then
AC_MSG_WARN([*** doxygen not found, docs will not be built])
fi
# Check for valgrind
VALGRIND_ENVIRONMENT=""
ac_enable_valgrind=no
AC_ARG_ENABLE(valgrind-testing,
[ --enable-valgrind-testing enable running of tests inside Valgrind ],
[ ac_enable_valgrind=yes ], [ ac_enable_valgrind=no] )
if test "x${ac_enable_valgrind}" = xyes ; then
if test "x${enable_shared}" = xyes ; then
VALGRIND_ENVIRONMENT="libtool --mode=execute "
fi
AC_CHECK_PROG(HAVE_VALGRIND, valgrind, yes, no)
if test "x$HAVE_VALGRIND" = xyes ; then
VALGRIND_ENVIRONMENT="$VALGRIND_ENVIRONMENT valgrind -q --leak-check=yes --show-reachable=yes --num-callers=100"
AC_SUBST(VALGRIND_ENVIRONMENT)
TESTS_INFO="Test suite will be run under:
${VALGRIND_ENVIRONMENT}"
else
TESTS_INFO="(Valgrind not found)"
fi
else
TESTS_INFO="(Valgrind testing not enabled)"
fi
dnl Checks for libraries.
LIBS=""
dnl
dnl Check for libuiomux
dnl
PKG_CHECK_MODULES(UIOMUX, uiomux >= 1.6.0)
# check for getopt in a separate library
HAVE_GETOPT=no
AC_CHECK_LIB(getopt, getopt, HAVE_GETOPT="yes")
if test "x$HAVE_GETOPT" = xyes ; then
GETOPT_LIBS="-lgetopt"
AC_SUBST(GETOPT_LIBS)
fi
# check for getopt_long in standard library
HAVE_GETOPT_LONG=no
AC_CHECK_FUNC(getopt_long, HAVE_GETOPT_LONG="yes")
if test "x$HAVE_GETOPT_LONG" = xyes ; then
AC_DEFINE(HAVE_GETOPT_LONG, [], [Define to 1 if you have the 'getopt_long' function])
fi
HAVE_NCURSES=no
AC_CHECK_LIB(ncurses, initscr, HAVE_NCURSES="maybe", HAVE_NCURSES=no)
if test "x$HAVE_NCURSES" = "xmaybe" ; then
AC_CHECK_HEADER([ncurses.h], HAVE_NCURSES="yes")
if test "x$HAVE_NCURSES" = "xmaybe" ; then
AC_CHECK_HEADER([ncurses/ncurses.h], HAVE_NCURSES="yes")
if test "x$HAVE_NCURSES" = "xyes" ; then
AC_DEFINE(HAVE_NCURSES_SUBDIR, [], [Define to 1 if ncurses.h is inside an <ncurses/> subdir])
fi
fi
fi
if test "x$HAVE_NCURSES" = "xyes" ; then
AC_DEFINE(HAVE_NCURSES, [], [Define to 1 if ncurses is available])
fi
AM_CONDITIONAL(HAVE_NCURSES, [test "x$HAVE_NCURSES" = "xyes"])
dnl Overall configuration success flag
shveu_config_ok=yes
shveu_read_programs=""
shveu_rw_programs=""
dnl
dnl Configuration option for building of experimental code.
dnl
ac_enable_experimental=no
AC_ARG_ENABLE(experimental,
[ --enable-experimental enable building of experimental code ],
[ ac_enable_experimental=yes ])
if test "x${ac_enable_experimental}" = xyes ; then
AC_DEFINE(SHCODECS_CONFIG_EXPERIMENTAL, [], [Define to build experimental code])
fi
# Checks for header files.
# Checks for typedefs, structures, and compiler characteristics.
dnl Add some useful warnings if we have gcc.
dnl changequote(,)dnl
if test "x$ac_cv_prog_gcc" = xyes ; then
CFLAGS="$CFLAGS -Wall -Wextra -g -std=gnu99 -Wdeclaration-after-statement -Wno-unused"
fi
dnl changequote([,])dnl
dnl
dnl Configuration option to add -Werror to all Makefiles
dnl
AC_ARG_ENABLE(gcc-werror,
AC_HELP_STRING([--enable-gcc-werror], [enable -Werror in all Makefiles]),
[ ac_enable_gcc_werror=yes ], [ ac_enable_gcc_werror=no] )
if test "x${ac_enable_gcc_werror}" = xyes ; then
CFLAGS="-Werror $CFLAGS"
fi
dnl
dnl Shared library symbol versioning and hiding
dnl
case "$target_os" in
linux* | solaris*)
SHLIB_VERSION_ARG="-Wl,--version-script=Version_script"
;;
*)
;;
esac
# Checks for library functions.
dnl
dnl Configuration tests complete -- provide summary of results.
dnl
if test $shveu_config_ok = no ; then
AC_MSG_RESULT([
**************************************************************
*** $PACKAGE $VERSION: Automatic configuration FAILED.
*** The file config.log has full details.
*** The following required libraries are missing or
*** misconfigured on your system:
])
dnl ...
AC_MSG_RESULT(
[*** If you install the required libraries from source, you
*** need to inform the dynamic linker of their location. If
*** you install them in a system-wide directory such as
*** /usr/local (the default), you must ensure that
*** /usr/local/lib is listed in /etc/ld.so.conf, then run
*** ldconfig to update the dynamic linking system.
*** Alternatively, you can set your LD_LIBRARY_PATH environment
*** variable to include the library installation directory.
])
AC_MSG_RESULT(
[**************************************************************
])
AC_MSG_ERROR([
***
*** After fixing the above problems, you must run ./configure again.
***
])
else
AC_SUBST(SHLIB_VERSION_ARG)
AC_SUBST(SHARED_VERSION_INFO)
AC_OUTPUT([
Makefile
doc/Makefile
doc/Doxyfile
include/Makefile
include/shveu/Makefile
src/Makefile
src/libshveu/Version_script
src/libshveu/Makefile
src/tools/Makefile
shveu.pc
shveu-uninstalled.pc
])
AC_MSG_RESULT([
------------------------------------------------------------------------
$PACKAGE $VERSION: Automatic configuration OK.
General configuration:
Experimental code: ........... ${ac_enable_experimental}
Tools:
shveu-convert ${ncurses_programs}
Building:
Type 'make' to compile $PACKAGE.
Type 'make install' to install $PACKAGE.
Type 'make check' to test $PACKAGE using the unit and functional tests
contained in the src/tests directory.
${TESTS_INFO}
Example programs will be built but not installed.
------------------------------------------------------------------------
])
fi