-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
184 lines (164 loc) · 5.51 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
# Specify the project and version + the minimum automake version required.
AC_PREREQ(2.66)
AC_INIT([judo], [1.0.0-rc2])
# Instruct automake to place all intermediary files into a seperate directory.
# If this isn't specified, then it will pollute the main directory.
AC_CONFIG_AUX_DIR([config])
# Sanity check to verify this is indeed the source directory.
AC_CONFIG_SRCDIR(src/judo_scan.c)
# Initialize automake and use "foreign" so it doesn't attmpet to look for or
# create a GNU project structure: COPYING, NEWS, etc...
AM_INIT_AUTOMAKE([foreign])
# Check for the --enable-json-parser option.
AC_ARG_ENABLE([json-parser],
[AS_HELP_STRING([--enable-json-parser], [for building an in-memory JSON tree (enabled by default)])],
[enable_parser=$enableval],
[enable_parser=yes]) # Default to enabling the parser.
# Check for the --enable-json-standard option.
AC_ARG_ENABLE([json-standard],
[AS_HELP_STRING([--enable-json-standard=json5|rfc8259|rfc4627], [set the JSON standard (defaults to JSON5)])],
[json_standard=$enableval],
[json_standard=json5]) # Default to "json5" if no value is provided
# Check for the --enable-json-comments option.
AC_ARG_ENABLE([json-comments],
[AS_HELP_STRING([--enable-json-comments], [enable JavaScript style comments (implictly enabled with JSON5)])],
[AC_SUBST([WITH_COMMENTS], [1])],
[AC_SUBST([WITH_COMMENTS], [0])])
# Check for the --enable-json-trailing-commas option.
AC_ARG_ENABLE([json-trailing-commas],
[AS_HELP_STRING([--enable-json-trailing-commas], [enable trailing commas after the last JSON value in an object or array (implictly enabled in JSON5)])],
[AC_SUBST([WITH_TRAILING_COMMAS], [1])],
[AC_SUBST([WITH_TRAILING_COMMAS], [0])])
# Check for the --enable-json-float-storage option.
AC_ARG_ENABLE([json-float-storage],
[AS_HELP_STRING([--enable-json-float-storage=float|double|longdouble|disabled], [set the floating point storage type (auto-detected by default)])],
[float_storage=$enableval],
[float_storage=auto]) # Default to infering whether floats are available.
# Check for the --enable-json-maximum-depth option.
AC_ARG_ENABLE([json-maximum-depth],
[AS_HELP_STRING([--enable-json-maximum-depth=depth], [set the maximum nesting depth a JSON structure can be (defaults to 16)])],
[maximum_nesting=$enableval],
[maximum_nesting=16]) # Default to a maximum nesting depth of 16.
# Checks for programs.
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
LT_INIT([win32-dll])
# Perform all tests in C.
AC_LANG([C])
# Enable the parser interface.
AS_IF([test "$enable_parser" = "yes"], [
AC_SUBST([ENABLE_PARSER], [1])
])
AM_CONDITIONAL([HAVE_PARSER], [test "$enable_parser" = "yes"])
# If this option is specified without a value, then autotools defaults
# to "yes" -- in which case fallback on the default value.
AS_IF([test "$maximum_nesting" = "yes"], [
maximum_nesting=16
])
AC_SUBST([MAXIMUM_NESTING_DEPTH], [$maximum_nesting])
# Check which JSON standard the user specified.
AS_IF([test "$json_standard" = "json5"], [
AC_SUBST([ENABLE_JSON5], [1])
AC_SUBST([ENABLE_RFC8259], [0])
AC_SUBST([ENABLE_RFC4627], [0])
], [
AS_IF([test "$json_standard" = "rfc8259"], [
AC_SUBST([ENABLE_JSON5], [0])
AC_SUBST([ENABLE_RFC8259], [1])
AC_SUBST([ENABLE_RFC4627], [0])
], [
AS_IF([test "$json_standard" = "rfc4627"], [
AC_SUBST([ENABLE_JSON5], [0])
AC_SUBST([ENABLE_RFC8259], [0])
AC_SUBST([ENABLE_RFC4627], [1])
], [
AC_MSG_ERROR([please specify a valid JSON5 standard])
])
])
])
have_floats="no"
# Check for long double.
AS_IF([test "$float_storage" = "auto"], [
AC_MSG_CHECKING(for long double storage)
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
#include <math.h>
]],[[
long double x;
]]
)], [have_floats="yes"])
AC_MSG_RESULT($have_floats)
AS_IF([test "$have_floats" = "yes"], [
float_storage=longdouble
])
])
# Check for double.
AS_IF([test "$float_storage" = "auto"], [
AC_MSG_CHECKING(for double storage)
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
#include <math.h>
]],[[
double x;
]]
)], [have_floats="yes"])
AC_MSG_RESULT($float_storage)
AS_IF([test "$have_floats" = "yes"], [
float_storage=double
])
])
# Check for float.
AS_IF([test "$float_storage" = "auto"], [
AC_MSG_CHECKING(for float storage)
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
#include <math.h>
]],[[
float x;
]]
)], [have_floats="yes"])
AC_MSG_RESULT($float_storage)
AS_IF([test "$have_floats" = "yes"], [
float_storage=float
])
])
# Substitute variables depending on which float type was found.
AS_IF([test "$float_storage" = "float"], [
AC_SUBST([HAVE_FLOAT], [1])
AC_SUBST([HAVE_DOUBLE], [0])
AC_SUBST([HAVE_LONGDOUBLE], [0])
], [
AS_IF([test "$float_storage" = "double"], [
AC_SUBST([HAVE_FLOAT], [0])
AC_SUBST([HAVE_DOUBLE], [1])
AC_SUBST([HAVE_LONGDOUBLE], [0])
], [
AS_IF([test "$float_storage" = "longdouble"], [
AC_SUBST([HAVE_FLOAT], [0])
AC_SUBST([HAVE_DOUBLE], [0])
AC_SUBST([HAVE_LONGDOUBLE], [1])
], [
AS_IF([test "$float_storage" = "disabled"], [
AC_SUBST([HAVE_FLOAT], [0])
AC_SUBST([HAVE_DOUBLE], [0])
AC_SUBST([HAVE_LONGDOUBLE], [0])
], [
AC_MSG_ERROR([please specify a valid floating point storage type])
])
])
])
])
AC_CONFIG_FILES([
Makefile
man/Makefile
include/Makefile
src/Makefile
examples/Makefile
judo_config.h
judo.pc
])
AC_OUTPUT