-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfigure.ac
189 lines (164 loc) · 5.46 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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.68])
AC_INIT([Mongoose],
[m4_esyscmd([build-aux/git-version-gen .tarball-version])],
[colfordk@gmail.com],
[],
[https://github.com/kcolford/mongoose])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_SRCDIR([src/compiler.h])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
# Set the default prefix to the same one as ldd(1). We do this
# because that is the same prefix where glibc is installed on most
# systems and thus the compiler needs to be installed there too.
AC_PREFIX_PROGRAM([ldd])
# Determine the build, host, and target system.
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
# Restrict ourselves to only building on systems we know.
AS_IF([test "$target_cpu" != "x86_64"], [
AC_MSG_ERROR([Invalid target CPU.])
])
AS_IF([test "$target_os" != "linux-gnu"], [
AC_MSG_ERROR([Invalid target OS.])
])
# Begin AutoMake intialization.
AC_USE_SYSTEM_EXTENSIONS
AM_INIT_AUTOMAKE([color-tests foreign parallel-tests])
AM_SILENT_RULES([yes])
LT_INIT
# Checks for programs.
AC_PROG_CC
gl_EARLY
gl_INIT
AC_PROG_CXX
AC_PROG_YACC
AM_PROG_LEX
AC_PROG_RANLIB
# Locate env and timeout for the testsuites.
AC_CHECK_PROGS([ENV], [env])
AC_CHECK_PROG([TIMEOUT], [timeout],
[[timeout 15s]])
# Locate the AutoGen program for maintainer's use.
AC_ARG_VAR([AUTOGEN], [*Maintainers Only*: The AutoGen program to use,
must be version 5 or later.])
AC_CHECK_PROGS([AUTOGEN], [autogen], [false])
# Locate Doxygen on the host system.
AC_ARG_VAR([DOXYGEN], [The instance of Doxygen to use when generating
documentation from source files. Note: must be version 1.8 or higher])
AC_CHECK_PROGS([DOXYGEN], [doxygen], [false])
AC_MSG_CHECKING([whether doxygen is version 1.8 or higher])
AX_COMPARE_VERSION([1.8], [le], [$($DOXYGEN -v)], [
AC_MSG_RESULT([yes])
], [
DOXYGEN=false
AC_MSG_RESULT([no])
AC_MSG_WARN([Without the proper version of Doxygen, you will be unable to
generate the documentation.])
])
AM_CONDITIONAL([HAVE_DOXYGEN], [test "$DOXYGEN" != "false"])
# Locate LaTeX for converting Doxygen output to PDFs.
AC_ARG_VAR([LATEX], [The instance of LaTeX to use when compiling .tex files.])
AC_CHECK_PROGS([LATEX], [latex])
AC_SUBST([GENERATE_LATEX], [NO])
AC_SUBST([USE_PDFLATEX], [NO])
AS_IF([test "$LATEX"], [
AC_SUBST([GENERATE_LATEX], [YES])
AC_CHECK_PROGS([PDFLATEX], [pdflatex])
AS_IF([test "$PDFLATEX"], [
AC_SUBST([USE_PDFLATEX], [YES])
])
AC_CHECK_PROGS([MAKEINDEX], [makeindex])
])
AM_CONDITIONAL([GENERATE_LATEX], [test "$GENERATE_LATEX" = "YES"])
# Locate Dot for Doxygen's graph generation.
AC_PATH_PROGS([DOT], [dot])
AC_SUBST([HAVE_DOT], [NO])
AS_IF([test "$DOT"], [
AC_SUBST([HAVE_DOT], [YES])
])
# Check if we can use Help2Man to create a man page for the user.
AS_IF([test $cross_compiling = no], [
AM_MISSING_PROG([HELP2MAN], [help2man])
])
# Locate the Dynamic Linker by searching through the shell script
# ldd(1) that's distributed with glibc.
AC_PATH_PROG([LDD], [ldd])
RTLDLIST=''
AS_IF([test "$LDD"], [
AC_PROG_GREP
eval `$GREP '^RTLDLIST=".*"$' $LDD`
])
dynamiclinker=''
for d in $RTLDLIST
do
AS_IF([test -r "$d"], [
dynamiclinker="$d"
])
done
# Define the path for the dynamic linker that we will use.
AC_DEFINE_UNQUOTED([DYNAMIC_LINKER], ["$dynamiclinker"],
[Define to the path of the dynamic linker to use.])
# Determine the directory for glibc files. This will be defined for
# use in the makefile.
AC_SUBST([archdir], ["${prefix}/lib/${target_cpu}-${target_os}"])
# Determine if we can in fact use glibc files on our own. If not,
# we fall back on the existing compiler's ability to do this.
AC_CHECK_FILES([$archdir/crti.o $archdir/crt1.o $archdir/crtn.o], [
AC_DEFINE([RUN_INDEPENDANTLY], [1],
[Define to 1 if we are linking on our own.])
])
# Check for programs that we can boostrap off of.
BOOTSTRAP_PROG([CC], [$CC], [The C compiler to bootstrap off of.])
BOOTSTRAP_PROG([CPP], [cpp], [The C preprocessor to boostrap off of.])
BOOTSTRAP_PROG([AS], [as gas], [The assembler to bootstrap off of.])
BOOTSTRAP_PROG([LD], [ld gold], [The linker to bootstrap off of.])
# Set up warnings for the compilation routines.
gl_MANYWARN_ALL_GCC([warnings])
warnings="$warnings -Wno-missing-field-initializers"
nw=
nw="$nw -Wsystem-headers" # Ridiculous warning.
nw="$nw -Wvla" # Breaks gnulib gettext.h.
nw="$nw -Wswitch-default" # Breaks generated files.
nw="$nw -Wunused-macros" # Likewise.
gl_MANYWARN_COMPLEMENT([warnings], [$warnings], [$nw])
for w in $warnings; do
gl_WARN_ADD([$w])
done
# Checks for libraries.
# We don't need any external libraries.
# Checks for header files.
AC_CHECK_HEADERS([fcntl.h libintl.h locale.h stddef.h])
AC_HEADER_STDBOOL
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_INT8_T
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_UINT8_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
# Make gl_list_t signal-safe for use in cleanup routines.
AC_DEFINE([SIGNAL_SAFE_LIST], [1],
[Define to 1 if lists must be signal-safe.])
# Checks for library functions.
AC_CHECK_FUNCS([atexit memset setlocale strtol])
AC_FUNC_ALLOCA
AC_FUNC_ERROR_AT_LINE
AC_FUNC_FORK
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AM_GNU_GETTEXT_VERSION([0.18.1])
AM_GNU_GETTEXT([external])
AC_CONFIG_FILES([Makefile
doc/doc.cfg
doc/Makefile
lib/Makefile
man/Makefile
po/Makefile.in
src/Makefile
tests/Makefile
tests/working-programs/Makefile])
AC_OUTPUT