forked from pantoniou/libfyaml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
275 lines (225 loc) · 7.61 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
275
AC_PREREQ(2.61)
AC_INIT([libfyaml],
m4_esyscmd([build-aux/git-version-gen .tarball-version]),
AC_CONFIG_SRCDIR([src/lib/fy-parse.c])
AC_CONFIG_HEADER([config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([foreign 1.8.5 -Wall subdir-objects ])
m4_pattern_allow([^(AM_EXTRA_RECURSIVE_TARGETS|AM_PROG_AR)$])dnl
# supoort older versions of automake
# only define the recursive targets when it's defined
# note that the top level makefile rules will not
# include them
m4_ifdef([AM_EXTRA_RECURSIVE_TARGETS],
[AM_EXTRA_RECURSIVE_TARGETS([doc-help doc-html doc-latexpdf doc-man doc-clean doc-markdown])],
[AC_MSG_WARN([Old automake version without AM_EXTRA_RECURSIVE_TARGETS, doc-* rules won't be available at top level])])
m4_define(fyaml_major, `echo $VERSION | cut -d. -f1 | cut -d- -f1`)
m4_define(fyaml_minor, `echo $VERSION | cut -d. -f2 | cut -d- -f1`)
m4_define(fyaml_patch, `echo $VERSION | cut -d. -f3- | cut -d- -f1`)
m4_define(fyaml_extra, `echo $VERSION | cut -d- -f2-`)
AC_SUBST(MAJOR, fyaml_major)
AC_SUBST(MINOR, fyaml_minor)
AC_SUBST(PATCH, fyaml_patch)
AC_SUBST(EXTRA, fyaml_extra)
m4_define(fyaml_date, `git show -s --format=%ci`)
AC_SUBST(DATE, fyaml_date)
AC_SUBST(DEBVERSION, "$MAJOR.$MINOR")
dnl AX_* requires 2.64
m4_version_prereq(2.64, [AX_CHECK_ENABLE_DEBUG()], [true])
AC_PROG_MKDIR_P
AC_PROG_CC
AC_PROG_CC_C99
AM_PROG_CC_C_O
AC_PROG_GCC_TRADITIONAL
AC_USE_SYSTEM_EXTENSIONS
m4_ifdef([AM_PROG_AR], [AM_PROG_AR],
[AC_MSG_WARN([Old automake version without AM_PROG_AR, library versioning will not be available])])
AC_PROG_CXX
AC_PROG_AWK
AC_PROG_LN_S
AX_PTHREAD
AC_PATH_PROG([M4], [m4 gm4], [no])
if test "x$M4" = xno ; then
AC_MSG_ERROR([m4 missing])
fi
AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
# pkg-config
PKG_PROG_PKG_CONFIG
AC_LTDL_ENABLE_INSTALL
AC_LIBLTDL_INSTALLABLE
AC_LIBTOOL_DLOPEN
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
AC_SUBST(LTDLINCL)
AC_SUBST(LIBLTDL)
AC_CONFIG_SUBDIRS(libltdl)
AC_HEADER_STDC
AC_C_CONST
AC_C_BIGENDIAN
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_CHECK_TYPES(ssize_t, , [AC_DEFINE([ssize_t], [signed long],
[Define ssize_t if it is not done by the standard libs.])])
AC_TYPE_OFF_T
AC_TYPE_SIGNAL
AC_TYPE_UID_T
AC_CHECK_DECLS(environ)
dnl for old autoconf version AX_APPEND_COMPILE_FLAGS does not work
m4_version_prereq(2.64,
[AX_APPEND_COMPILE_FLAGS([-Wall -Wsign-compare],
[CFLAGS], [-pedantic -Werror])],
[CFLAGS="$CFLAGS -Wall -Wsign-compare"])
dnl -O2 is universal no need for AX_APPEND_COMPILE_FLAGS
if test "x$ax_enable_debug" != "xyes" ; then
CFLAGS="$CFLAGS -O2"
fi
# include -lm in the link
AC_SEARCH_LIBS([llrintf], [m], [], [AC_MSG_ERROR([unable to find the llrintf() function])])
# check if there's a qsort_r available (musl does not have it)
AC_CHECK_FUNC([qsort_r],
HAVE_QSORT_R=1,
HAVE_QSORT_R=0)
AC_SUBST(HAVE_QSORT_R)
AC_DEFINE_UNQUOTED([HAVE_QSORT_R], [$HAVE_QSORT_R], [Define to 1 if you have qsort_r available])
AM_CONDITIONAL([HAVE_QSORT_R], [ test x$HAVE_QSORT_R = x1 ])
PKG_CHECK_MODULES(LIBYAML, [ yaml-0.1 ], HAVE_LIBYAML=1, HAVE_LIBYAML=0)
# update with pkg-config's flags
if test "x$HAVE_LIBYAML" != "x1" ; then
AC_MSG_WARN([failed to find libyaml; compatibility disabled])
fi
AC_SUBST(HAVE_LIBYAML)
AC_SUBST(LIBYAML_CFLAGS)
AC_SUBST(LIBYAML_LIBS)
AC_DEFINE_UNQUOTED([HAVE_LIBYAML], [$HAVE_LIBYAML], [Define to 1 if you have libyaml available])
AM_CONDITIONAL([HAVE_LIBYAML], [ test x$HAVE_LIBYAML = x1 ])
PKG_CHECK_MODULES(CHECK, [ check ], HAVE_CHECK=1, HAVE_CHECK=0)
AC_SUBST(HAVE_CHECK)
AC_SUBST(CHECK_CFLAGS)
AC_SUBST(CHECK_LDFLAGS)
AC_SUBST(CHECK_LIBS)
AC_DEFINE_UNQUOTED([HAVE_CHECK], [$HAVE_CHECK], [Define to 1 if you have check available])
AM_CONDITIONAL([HAVE_CHECK], [ test x$HAVE_CHECK = x1 ])
HAVE_COMPATIBLE_CHECK=0
if test "x$HAVE_CHECK" == "x1" ; then
save_LIBS="$LIBS"
save_CFLAGS="$CFLAGS"
LIBS="$LIBS $CHECK_LIBS"
CFLAGS="$CFLAGS $CHECK_CFLAGS"
# check if libcheck has srunner_set_tap (jessie has outdated libcheck)
AC_CHECK_FUNC([srunner_set_tap],
HAVE_COMPATIBLE_CHECK=1,
HAVE_COMPATIBLE_CHECK=0)
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
fi
AC_SUBST(HAVE_COMPATIBLE_CHECK)
AC_DEFINE_UNQUOTED([HAVE_COMPATIBLE_CHECK], [$HAVE_COMPATIBLE_CHECK], [Define to 1 if you have a compatible version of check available])
AM_CONDITIONAL([HAVE_COMPATIBLE_CHECK], [ test x$HAVE_COMPATIBLE_CHECK = x1 ])
dnl enable internet available when checking
AC_ARG_ENABLE([network],
AS_HELP_STRING([--disable-network],
[Disable tests requiring network access]))
if test "x$enable_network" != "xno" ; then
HAVE_NETWORK=1
else
HAVE_NETWORK=0
fi
AC_SUBST(HAVE_NETWORK)
AM_CONDITIONAL([HAVE_NETWORK],
[ test x$HAVE_NETWORK = x1 ])
# check for sphinx
AC_PATH_PROG([SPHINX], [sphinx-build])
if test "x$SPHINX" != "x" ; then
HAVE_SPHINX=1
else
HAVE_SPHINX=0
fi
AC_DEFINE_UNQUOTED([HAVE_SPHINX], [$HAVE_SPHINX], [Define to 1 if you have sphinx available])
AM_CONDITIONAL([HAVE_SPHINX], [ test x$HAVE_SPHINX = x1 ])
# check for git
AC_PATH_PROG([GIT], [git])
if test "x$GIT" != "x" ; then
HAVE_GIT=1
else
HAVE_GIT=0
fi
AC_DEFINE_UNQUOTED([HAVE_GIT], [$HAVE_GIT], [Define to 1 if you have git available])
AM_CONDITIONAL([HAVE_GIT], [ test x$HAVE_GIT = x1 ])
AC_ARG_VAR(TESTSUITEURL, [Testsuite git repo URL (default: https://github.com/yaml/yaml-test-suite)])
if test "x$TESTSUITEURL" == "x" ; then
TESTSUITEURL="https://github.com/yaml/yaml-test-suite"
fi
AC_ARG_VAR(JSONTESTSUITEURL, [JSON Testsuite git repo URL (default: https://github.com/nst/JSONTestSuite)])
if test "x$JSONTESTSUITEURL" == "x" ; then
JSONTESTSUITEURL="https://github.com/nst/JSONTestSuite"
fi
# check for docker
AC_PATH_PROG([DOCKER], [docker])
if test "x$DOCKER" != "x" ; then
HAVE_DOCKER=1
else
HAVE_DOCKER=0
fi
AM_CONDITIONAL([HAVE_DOCKER], [ test x$HAVE_DOCKER = x1 ])
# note that debian does not support cross compilation
# so do not use it to build cross packages
# check for dpkg
AC_PATH_PROG([DPKG], [dpkg])
if test "x$DPKG" != "x" ; then
HAVE_DPKG=1
else
HAVE_DPKG=0
fi
AC_DEFINE_UNQUOTED([HAVE_DPKG], [$HAVE_DPKG], [Define to 1 if you have dpkg available])
AM_CONDITIONAL([HAVE_DPKG], [ test x$HAVE_DPKG = x1 ])
if test "x$HAVE_DPKG" = "x1" ; then
DPKG_ARCH=`$DPKG --print-architecture`
else
DPKG_ARCH="unknown"
fi
AC_SUBST(DPKG_ARCH, "$DPKG_ARCH")
# Shave by default on supported autoconf versions
dnl m4_version_prereq(2.64, SHAVE_INIT([build-aux], [enable]), [true])
m4_ifdef([SHAVE_INIT], [SHAVE_INIT([build-aux], [enable])])
AC_CONFIG_FILES([
build-aux/shave
build-aux/shave-libtool
Makefile
src/Makefile
test/Makefile
doc/Makefile
libfyaml.pc
debian/changelog
debian/control
debian/copyright
debian/$PACKAGE_NAME-$DEBVERSION.install:debian/$PACKAGE_NAME.install.in
debian/$PACKAGE_NAME-dev.install
debian/$PACKAGE_NAME-utils.install
])
AC_REQUIRE_AUX_FILE([tap-driver.sh])
AC_OUTPUT
echo "
---{ $PACKAGE_NAME $VERSION }---
VERSION: ${VERSION}
MAJOR.MINOR: ${MAJOR}.${MINOR}
PATCH: ${PATCH}
EXTRA: ${EXTRA}
prefix: ${prefix}
C compiler: ${CC}
CFLAGS: ${CFLAGS}
Linker: ${LD}
LDFLAGS: ${LDFLAGS}
LIBS: ${LIBS}
HAVE_CHECK: ${HAVE_CHECK}
HAVE_COMPATIBLE_CHECK: ${HAVE_COMPATIBLE_CHECK}
HAVE_NETWORK: ${HAVE_NETWORK}
SPHINX: $SPHINX
GIT: $GIT
DOCKER: $DOCKER
HAVE_DPKG: $HAVE_DPKG
DPKG_ARCH: $DPKG_ARCH
TESTSUITEURL: $TESTSUITEURL
JSONTESTSUITEURL: $JSONTESTSUITEURL
"