-
Notifications
You must be signed in to change notification settings - Fork 47
/
configure.ac
261 lines (233 loc) · 7.12 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
dnl configure.in by David Necas (Yeti) <[email protected]>
dnl This file is in public domain.
dnl Process this file with autoconf to produce a configure script.
dnl Shake before use.
AC_INIT([Enca],[1.20-dev],[https://github.com/nijel/enca/issues])
AC_PREREQ([2.69])
AC_CONFIG_SRCDIR(src/enca.c)
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_FILES( \
Makefile \
enca.spec \
enca.pc \
devel-docs/Makefile \
data/Makefile \
lib/Makefile \
script/Makefile \
script/b-cstocs \
script/b-map \
script/b-piconv \
script/b-umap \
src/Makefile \
src/HELP \
test/Makefile \
tools/Makefile)
AC_CONFIG_HEADERS(config.h)
AM_INIT_AUTOMAKE([1.8 gnits check-news dist-xz])
AM_ACLOCAL_INCLUDE(m4)
AM_MAINTAINER_MODE
dnl RPM release (normally always 1, may be manually changed by package
dnl maintainer in spec later)
RELEASE=1
dnl Checks for programs.
AC_PROG_AWK
AC_PROG_CC
AX_PROG_CC_FOR_BUILD
AC_USE_SYSTEM_EXTENSIONS
AC_USE_SYSTEM_EXTENSIONS
AC_SEARCH_LIBS([strerror],[cposix])
LT_INIT
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PATH_PROG(MKTEMP_PROG, mktemp)
dnl With GCC, be paranoiac. It should compile really cleanly.
dnl Except -Wno-sign-compare, but older gcc's don't know it.
if test "$GCC" = yes; then
CFLAGS="-Wall -Wextra -W -pedantic $CFLAGS"
fi
dnl Check for various external converters.
AC_PATH_PROG(CSTOCS_PROG, cstocs)
AC_PATH_PROG(RECODE_PROG, recode)
AC_PATH_PROG(UMAP_PROG, umap)
AC_PATH_PROG(PICONV_PROG, piconv)
AC_PATH_PROG(MAP_PROG, map)
dnl External convetor. It may be disabled later, if fork() doesn't work.
AC_ARG_ENABLE(external,
[ --enable-external enable conversion using external programs @<:@yes@:>@],
[case "${enableval}" in
yes) WANT_EXTERNAL=yes ;;
no) WANT_EXTERNAL=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-external) ;;
esac],
[WANT_EXTERNAL=yes])
dnl gcov coverage
AM_GCOV
dnl Fool autoconf, it can't parse the for-cycle below
if false; then
AC_DEFINE_UNQUOTED(CSTOCS_PROG,"",[Define to path to the cstocs recoder.])
AC_DEFINE_UNQUOTED(MAP_PROG,"",[Define to path to the map recoder.])
AC_DEFINE_UNQUOTED(RECODE_PROG,"",[Define to path to the recode recoder.])
AC_DEFINE_UNQUOTED(PICONV_PROG,"",[Define to path to the piconv recoder.])
AC_DEFINE_UNQUOTED(UMAP_PROG,"",[Define to path to the umap recoder.])
fi
dnl Find default external converter
for w in cstocs recode piconv map umap; do
wPROG=`echo $w | tr $as_cr_letters $as_cr_LETTERS`_PROG
# Is this POSIX? But even ash supports it.
eval wPROGcv=$`echo ac_cv_path_$wPROG`
if test -n "$wPROGcv"; then
AC_DEFINE_UNQUOTED($wPROG,"$wPROGcv")
if test -z "$DEFAULT_EXTERNAL_CONVERTER"; then
DEFAULT_EXTERNAL_CONVERTER=$w
fi
fi
done
dnl And for gtk-doc
gtk_CHECK_GTK_DOC
dnl Checks for libraries.
ye_CHECK_LIBM
dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
AC_HEADER_STAT
AC_HEADER_STDBOOL
AC_CHECK_HEADERS( \
errno.h \
fcntl.h \
getopt.h \
langinfo.h \
limits.h \
locale.h \
memory.h \
string.h \
strings.h \
sys/stat.h \
sys/types.h \
sys/wait.h \
sys/time.h \
time.h \
unistd.h \
wordexp.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_UID_T
AC_CHECK_TYPE(ssize_t, int)
# FIXME: This is crude. It seems to work on Linux, though.
AC_CHECK_DECLS(LC_MESSAGES,,,[#include <locale.h>])
ye_CHECK_VAR_PROGRAM_INVOCATION_SHORT_NAME
dnl Checks for library functions.
AC_FUNC_FORK
AC_CHECK_FUNCS( \
ftruncate \
gettimeofday \
isatty \
nl_langinfo \
random \
realpath \
strstr \
stpcpy \
setlocale \
ttyname \
wordexp)
AC_REPLACE_FUNCS(getopt_long)
dnl Following two check for much more than just library functions, iconv test
dnl in fact has to build a simple iconv app to find out wheter it's usable.
CONVERTER_LIBS=
ye_CHECK_FUNC_ICONV_USABLE
ye_CHECK_LIB_RECODE
DEFAULT_CONVERTER_LIST="built-in"
if test "$librecode_ok" = "yes"; then
DEFAULT_CONVERTER_LIST="$DEFAULT_CONVERTER_LIST,librecode"
else
if test "$libiconv_ok" = "yes"; then
DEFAULT_CONVERTER_LIST="$DEFAULT_CONVERTER_LIST,iconv"
fi
fi
AC_DEFINE_UNQUOTED(DEFAULT_CONVERTER_LIST,"$DEFAULT_CONVERTER_LIST",[Define to default converter list.])
if test "$WANT_EXTERNAL" = "yes" -a "$ac_cv_func_fork_works" = "yes"; then
AC_DEFINE(ENABLE_EXTERNAL,1,[Define to enable external converter programs.])
if test -n "$DEFAULT_EXTERNAL_CONVERTER"; then
enable_external="yes ($DEFAULT_EXTERNAL_CONVERTER)"
else
enable_external="yes (but no suitable found)"
fi
else
enable_external=no
DEFAULT_EXTERNAL_CONVERTER=
fi
AC_DEFINE_UNQUOTED(DEFAULT_EXTERNAL_CONVERTER,"$DEFAULT_EXTERNAL_CONVERTER",[Define to default external converter program.])
dnl Try to find locale.alias. FIXME! FIXME! FIXME! This works on GNU/Linux and
dnl perhaps nowhere else. Any suggestions are welcome.
ye_PATH_LOCALE_ALIAS
dnl Random filename generation in scripts
if test -n "$MKTEMP_PROG"; then
SHELL_RANDOM_FILENAME='`'$MKTEMP_PROG' /tmp/enca-$$-XXXXXXXX`'
else
SHELL_RANDOM_FILENAME='/tmp/enca-$$-$RANDOM'
fi
AC_SUBST(RELEASE)
AC_SUBST(CONVERTER_LIBS)
AC_SUBST(DEFAULT_EXTERNAL_CONVERTER)
AC_SUBST(DEFAULT_CONVERTER_LIST)
AC_SUBST(SHELL_RANDOM_FILENAME)
AC_OUTPUT
dnl Inform user what optional features will be built.
if test "$yeti_recode_buggy" = yes; then
librecode_state="$librecode_ok (buggy, see above)"
else
librecode_state="$librecode_ok"
fi
if test -z "$yeti_cv_file_locale_alias"; then
locale_alias_state="built-in (naive)"
else
locale_alias_state="$yeti_cv_file_locale_alias"
fi
if test "$ac_cv_func_wordexp" = yes; then
ENCAOPT_state="$ac_cv_func_wordexp"
else
ENCAOPT_state="built-in parser (naive)"
fi
if test "$enable_static" = yes; then
if test "$enable_shared" = yes; then
libenca_state="static, shared"
else
libenca_state=static
fi
else
if test "$enable_shared" = yes; then
# Can this happen?
libenca_state=shared
else
libenca_state="not at all?"
fi
fi
echo "================================================================="
echo " Features:"
echo " libenca will be built as: $libenca_state"
echo " GNU recode library interface: $librecode_state"
echo " UNIX98 iconv interface: $libiconv_ok"
if test "$libiconv_ok" != "yes" && test "$librecode_ok" != "yes"; then
echo " (consider installing at least one of GNU libiconv and GNU librecode)"
fi
echo " External converters: $enable_external"
echo " Language preferences from locale: $ac_cv_func_setlocale"
if test "$ac_cv_func_setlocale" = yes; then
echo " Language aliases decryption: $locale_alias_state"
fi
echo " Target charset from locale: $ac_cv_func_nl_langinfo"
echo " ENCAOPT environment variable: $ENCAOPT_state"
echo "================================================================="
ye_WARN_FAIL($ac_cv_header_stdc,"ISO C headers")
ye_WARN_FAIL($ac_cv_header_unistd_h,"unistd.h")
ye_WARN_FAIL($ac_cv_header_sys_types_h,"sys/types.h")
ye_WARN_FAIL($ac_cv_header_sys_stat_h,"sys/stat.h")
echo
echo "Configure complete, now type \`make' to compile enca."
echo "If it compiles, don't forget to run \`make check'."