forked from GNUAspell/aspell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
605 lines (504 loc) · 17.1 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
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
AC_INIT(GNU Aspell, 0.60.9-git)
AC_CONFIG_SRCDIR(prog/aspell.cpp)
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER(gen/settings.h)
if test -e "$srcdir"/autogen -a "$enable_maintainer_mode" != "no"
then
enable_maintainer_mode=yes
fi
AM_MAINTAINER_MODE
AC_ARG_ENABLE(docdir,
AS_HELP_STRING([--enable-docdir=DIR],[documentation files in DIR @<:@PREFIX/share/doc/aspell@:>@]),
pkgdocdir=$enable_docdir, pkgdocdir=\${prefix}/share/doc/aspell)
AC_SUBST(pkgdocdir)
dnl pkgdatadir
pkgdatadir=undef
AC_ARG_ENABLE(pkgdatadir,
AS_HELP_STRING([--enable-pkgdatadir=DIR],[device dependent data files @<:@LIBDIR/aspell-0.60@:>@]),
pkgdatadir=$enable_pkgdatadir)
AC_ARG_ENABLE(pkgdata-dir,
AS_HELP_STRING([--enable-data-dir=DIR],[alias for pkgdatadir]),
pkgdatadir=$enable_dict_dir)
if test "$pkgdatadir" = "undef"
then
pkgdatadir=\${libdir}/aspell-0.60
fi
AC_SUBST(pkgdatadir)
dnl pkglibdir
pkglibdir=undef
AC_ARG_ENABLE(pkglibdir,
AS_HELP_STRING([--enable-pkglibdir=DIR],[device dependent data files @<:@LIBDIR/aspell-0.60@:>@]),
pkglibdir=$enable_pkglibdir)
AC_ARG_ENABLE(dict-dir,
AS_HELP_STRING([--enable-dict-dir=DIR],[alias for pkglibdir]),
pkglibdir=$enable_dict_dir)
if test "$pkglibdir" = "undef"
then
pkglibdir=\${libdir}/aspell-0.60
fi
AC_SUBST(pkglibdir)
dnl optional features
AC_ARG_ENABLE(win32-relocatable,
[ --enable-win32-relocatable])
AC_ARG_ENABLE(curses,
AS_HELP_STRING([--enable-curses=LIBFILE],[cursor control library]))
AC_ARG_ENABLE(curses-include,
[ --enable-curses-include=DIR])
AC_ARG_ENABLE(wide-curses,
AS_HELP_STRING([--disable-wide-curses],[disable wide char utf8 cursor control]))
AC_ARG_ENABLE(regex,
[ --disable-regex])
AC_ARG_ENABLE(compile-in-filters,
[ --enable-compile-in-filters])
AC_ARG_ENABLE(filter-version-control,
[ --disable-filter-version-control])
AC_ARG_ENABLE(32-bit-hash-fun,
AS_HELP_STRING([--enable-32-bit-hash-fun],[use 32-bit hash function for compiled dictionaries]))
AC_ARG_ENABLE(sloppy-null-term-strings,
AS_HELP_STRING([--enable-sloppy-null-term-strings],[allows allow null terminated UCS-2 and UCS-4 strings]))
AC_ARG_ENABLE(pspell-compatibility,
AS_HELP_STRING([--disable-pspell-compatibility],[don't install pspell compatibility libraries]))
AC_ARG_ENABLE(incremented-soname,
AS_HELP_STRING([--enable-incremented-soname],[break aspell 0.50 binary compatibility]))
dnl AC_ARG_ENABLE(aspell5-compatibility,
dnl [ --enable-aspell5-compatibility install aspell 0.50 compatibility libraries])
dnl
AC_PROG_CXX
if test "$GXX" = "yes" && expr x"$CXXFLAGS" : '.*-O' > /dev/null
then
CXXFLAGS="$CXXFLAGS -fno-exceptions"
fi
AC_LANG([C++])
AM_PROG_CC_C_O
AC_DISABLE_STATIC
AC_LIBTOOL_DLOPEN
AC_PROG_LIBTOOL
dnl DL stuff
AC_CHECK_HEADERS(dlfcn.h,,[enable_compile_in_filters=yes])
AC_CHECK_FUNC(dlopen,,
AC_CHECK_LIB(dl, dlopen,,[enable_compile_in_filters=yes]))
dnl
AC_CHECK_PROG(SED,sed,sed)
AC_PATH_PROG(PERLPROG,perl)
dnl
if test "$enable_static" = "yes"
then
enable_compile_in_filters=yes
fi
if test "$enable_compile_in_filters" = "yes"
then
AC_DEFINE(COMPILE_IN_FILTER, 1, [Defined if filters should be compiled in])
fi
find_git=`expr "$PACKAGE_VERSION" : '.*git'`
if test "$find_git" -gt 0
then
enable_filter_version_control=no
fi
if test "$enable_filter_version_control" != "no"
then
AC_DEFINE(FILTER_VERSION_CONTROL, 1,
[Defined if filter version control should be used])
fi
AM_CONDITIONAL(COMPILE_IN_FILTERS,
[test "$enable_compile_in_filters" = "yes"])
if test "$enable_32_bit_hash_fun" = "yes"
then
AC_DEFINE(USE_32_BIT_HASH_FUN, 1, [Defined if 32-bit hash function should be used for compiled dictionaries.])
fi
if test "$enable_sloppy_null_term_strings" = "yes"
then
AC_DEFINE(SLOPPY_NULL_TERM_STRINGS, 1, [Defined if null-terminated UCS-2 and UCS-4 strings should always be allowed.])
fi
AM_CONDITIONAL(PSPELL_COMPATIBILITY,
[test "$enable_pspell_compatibility" != "no"])
AM_CONDITIONAL(INCREMENTED_SONAME,
[test "$enable_incremented_soname" = "yes"])
dnl AM_CONDITIONAL(ASPELL5_COMPATIBILITY,
dnl [test "$enable_incremented_soname" != "no" -a \
dnl "$enable_aspell5_compatibility" = "yes"])
dnl GETTEXT
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.19.3])
AH_TOP([#ifndef ASPELL_SETTINGS__H
#define ASPELL_SETTINGS__H])
AH_BOTTOM([#define C_EXPORT extern "C"])
AH_BOTTOM([#endif /* ASPELL_SETTINGS__H */])
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# Platform Specific Tests #
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
if test "$enable_win32_relocatable" = "yes"
then
AC_DEFINE(ENABLE_WIN32_RELOCATABLE, 1, [Defined if win32 relocation should be used])
fi
# DL stuff
AC_CHECK_HEADERS(dlfcn.h)
AC_CHECK_LIB(dl, dlopen)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# Posix tests #
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
AC_MSG_CHECKING(if file locking and truncating is supported)
AC_TRY_LINK(
[#include <fcntl.h>
#include <unistd.h>],
[int fd;
struct flock fl;
fcntl(fd, F_SETLKW, &fl);
ftruncate(fd,0);],
[AC_MSG_RESULT(yes)
AC_DEFINE(USE_FILE_LOCKS, 1,
[Defined if file locking and truncating is supported])
],
[AC_MSG_RESULT(no)] )
AC_MSG_CHECKING(if mmap and friends is supported)
AC_TRY_LINK(
[#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>],
[char * p = (char *)mmap(NULL, 10, PROT_READ, MAP_SHARED, -1, 2);
munmap(p,10);],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_MMAP, 1, [Defined if mmap and friends is supported])],
[AC_MSG_RESULT(no)] )
AC_MSG_CHECKING(if file ino is supported)
touch conftest-f1
touch conftest-f2
AC_TRY_RUN(
[#include <stdlib.h>
#include <sys/stat.h>
int main() {
struct stat s1,s2;
if (stat("conftest-f1",&s1) != 0) exit(2);
if (stat("conftest-f2",&s2) != 0) exit(2);
exit (s1.st_ino != s2.st_ino ? 0 : 1);
}
],
[AC_MSG_RESULT(yes)
AC_DEFINE(USE_FILE_INO, 1, [Defined if file ino is supported])
],
[AC_MSG_RESULT(no)],
[if test "$MINGW32" = "yes"
then
AC_MSG_RESULT(cant run test!, assuming no)
else
AC_MSG_RESULT(cant run test!, assuming yes)
AC_DEFINE(USE_FILE_INO, 1, [Defined if file ino is supported])
fi
] )
AC_MSG_CHECKING(if posix locals are supported)
AC_TRY_COMPILE(
[#include <locale.h>],
[setlocale (LC_ALL, NULL);
setlocale (LC_MESSAGES, NULL);],
[AC_MSG_RESULT(yes)
AC_DEFINE(USE_LOCALE, 1, [Defined if Posix locales are supported])],
[AC_MSG_RESULT(no)] )
if test "$enable_regex" != "no"
then
AC_MSG_CHECKING(if posix regex are supported)
AC_TRY_LINK(
[#include <sys/types.h>
#include <regex.h>],
[regex_t r;
regcomp(&r, "", REG_EXTENDED);
regexec(&r, "", 0, 0, 0);],
[AC_MSG_RESULT(yes)
AC_DEFINE(USE_POSIX_REGEX, 1, [Defined if Posix regex are supported])],
[AC_MSG_RESULT(no)])
fi
AM_LANGINFO_CODESET
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# Posix lock function tests #
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
AC_SUBST(PTHREAD_LIB)
AC_MSG_CHECKING(if posix mutexes are supported)
ORIG_LIBS="$LIBS"
for l in '' '-lpthread'
do
if test -z "$use_posix_mutex"
then
LIBS="$l $ORIG_LIBS"
AC_TRY_LINK(
[#include <pthread.h>],
[pthread_mutex_t lck;
pthread_mutex_init(&lck, 0);
pthread_mutex_lock(&lck);
pthread_mutex_unlock(&lck);
pthread_mutex_destroy(&lck);],
[PTHREAD_LIB=$l
use_posix_mutex=1])
fi
done
LIBS="$ORIG_LIBS"
if test "$use_posix_mutex"
then
if test -z "$PTHREAD_LIB"
then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT([yes (in $PTHREAD_LIB)])
fi
AC_DEFINE(USE_POSIX_MUTEX, 1, [Defined if Posix mutexes are supported])
else
AC_MSG_RESULT(no)
AC_MSG_WARN([Unable to find locking mechanism, Aspell will not be thread safe.])
fi
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# Terminal function tests #
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
AC_MSG_CHECKING(if mblen is supported)
AC_TRY_LINK(
[#include <wchar.h>
#include <stddef.h>
#include <stdlib.h>],
[size_t s = mblen("bla", MB_CUR_MAX);],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_MBLEN, 1, [Defined if mblen is supported])
have_mblen=1],
[AC_MSG_RESULT(no)]
)
AC_SUBST(CURSES_LIB)
AC_SUBST(CURSES_INCLUDE)
if test "$enable_curses" != "no"
then
use_curses=t
case "$enable_curses" in
yes | "" ) ;;
/* | *lib* | *.a | -l* | -L* ) CURSES_LIB="$enable_curses" ;;
* ) CURSES_LIB=-l$enable_curses ;;
esac
case "$enable_curses_include" in
yes | no | "") ;;
-I* ) CURSES_INCLUDE="$enable_curses_include" ;;
* ) CURSES_INCLUDE=-I$enable_curses_include ;;
esac
fi
if test "$use_curses"
then
ORIG_LIBS="$LIBS"
ORIG_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CURSES_INCLUDE $ORIG_CPPFLAGS"
if test -z "$CURSES_LIB"
then
AC_MSG_CHECKING(for working curses library)
if test "$enable_wide_curses" != "no" -a -n "$have_mblen"
then
LIBS="-lncursesw $ORIG_LIBS"
AC_TRY_LINK(
[#include <ncursesw/curses.h>], [initscr()],
[CURSES_LIB=-lncursesw
AC_DEFINE(CURSES_HEADER, <ncursesw/curses.h>, [Defined to curses header file])
AC_DEFINE(TERM_HEADER, <ncursesw/term.h>, [Defined to term header file])])
fi
if test -z "$CURSES_LIB"
then
LIBS="-lncurses $ORIG_LIBS"
AC_TRY_LINK(
[#include <ncurses/curses.h>], [initscr()],
[CURSES_LIB=-lncurses
AC_DEFINE(CURSES_HEADER, <ncurses/curses.h>, [Defined to curses header file])
AC_DEFINE(TERM_HEADER, <ncurses/term.h>, [Defined to term header file])],
[
LIBS="-lncurses $ORIG_LIBS"
AC_TRY_LINK(
[#include <ncurses.h>], [initscr()],
[CURSES_LIB=-lncurses
AC_DEFINE(CURSES_HEADER, <ncurses.h>, [Defined to curses header file])
AC_DEFINE(TERM_HEADER, <term.h>, [Defined to term header file])],
[
LIBS="-lcurses $ORIG_LIBS"
AC_TRY_LINK(
[#include <curses.h>], [initscr()],
[CURSES_LIB=-lcurses
AC_DEFINE(CURSES_HEADER, <curses.h>, [Defined to curses header file])
AC_DEFINE(TERM_HEADER, <term.h>, [Defined to term header file])],
[
LIBS="-lncurses $ORIG_LIBS"
AC_TRY_LINK(
[#include <curses.h>], [initscr()],
[CURSES_LIB=-lncurses
AC_DEFINE(CURSES_HEADER, <curses.h>, [Defined to curses header file])
AC_DEFINE(TERM_HEADER, <term.h>, [Defined to term header file])],
) ]) ]) ])
fi
if test -n "$CURSES_LIB"
then
AC_MSG_RESULT([found in $CURSES_LIB])
else
AC_MSG_RESULT([not found])
fi
else
AC_DEFINE(CURSES_HEADER, <curses.h>, [Defined to curses header file])
AC_DEFINE(TERM_HEADER, <term.h>, [Defined to term header file])
fi
if test -n "$CURSES_LIB"
then
LIBS="$CURSES_LIB $ORIG_LIBS"
if test "$enable_wide_curses" != "no"
then
AC_MSG_CHECKING(for wide character support in curses libraray)
if test -n "$have_mblen"
then
AC_TRY_LINK(
[#include <wchar.h>
#include CURSES_HEADER
],
[wchar_t wch = 0;
addnwstr(&wch, 1);],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_WIDE_CURSES, 1, [Defined if curses libraray includes wide character support])],
[
AC_TRY_LINK(
[#define _XOPEN_SOURCE_EXTENDED 1
#include <wchar.h>
#include CURSES_HEADER
],
[wchar_t wch = 0;
addnwstr(&wch, 1);],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_WIDE_CURSES, 1)
AC_DEFINE(DEFINE_XOPEN_SOURCE_EXTENDED, 1,
[Defined if _XOPEN_SOURCE_EXTENDED needs to be defined.
(Can't define globally as that will cause problems with some systems)])
],
[AC_MSG_RESULT(no)
AC_MSG_WARN([Aspell will not be able to Display UTF-8 characters correctly.])])])
else
AC_MSG_RESULT([no, because "mblen" is not supported])
AC_MSG_WARN([Aspell will not be able to Display UTF-8 characters correctly.])
fi
fi
AC_MSG_CHECKING(if standard curses include sequence will work)
AC_TRY_LINK(
[#ifdef DEFINE_XOPEN_SOURCE_EXTENDED
# define _XOPEN_SOURCE_EXTENDED 1
#endif
#include <termios.h>
#include <unistd.h>
#include CURSES_HEADER
#include TERM_HEADER
],
[tigetstr(const_cast<char *>("cup"));],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_LIBCURSES, 1,
[Defined if the curses library is available])
posix_termios=t
AC_DEFINE(CURSES_INCLUDE_STANDARD, 1,
[Defined if no special Workarounds are needed for Curses headers])],
[AC_MSG_RESULT(no)
dnl else if
AC_MSG_CHECKING(if curses workaround I will work)
AC_TRY_LINK(
[#ifdef DEFINE_XOPEN_SOURCE_EXTENDED
# define _XOPEN_SOURCE_EXTENDED 1
#endif
#include <termios.h>
#include <unistd.h>
#include CURSES_HEADER
extern "C" {char * tigetstr(char * capname);}],
[tigetstr(const_cast<char *>("cup"));],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_LIBCURSES, 1, [])
posix_termios=t
AC_DEFINE(CURSES_INCLUDE_WORKAROUND_1, 1,
[Defined if special Wordaround I is need for Curses headers])],
[AC_MSG_RESULT(no)
dnl else if
AC_MSG_CHECKING(if curses without Unix stuff will work)
AC_TRY_LINK(
[#include CURSES_HEADER
],
[initscr();],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_LIBCURSES, 1, [])
AC_DEFINE(CURSES_ONLY, 1,
[Defined if curses like POSIX Functions should be used])
curses_only=t],
[AC_MSG_RESULT(no)
dnl else
use_curses=false
CURSES_LIBS=""
CURSES_INCLUDE=""
]) ]) ])
fi
CPPFLAGS="$ORIG_CPPFLAGS"
LIBS="$ORIG_LIBS"
fi
if test -z "$posix_termios" -a -z "$curses_only"
then
AC_MSG_CHECKING(if posix termios is supported)
AC_TRY_LINK(
[#include <termios.h>
#include <unistd.h>
#include <stdlib.h>],
[isatty (STDIN_FILENO);
atexit(0);
termios attrib;
tcgetattr (STDIN_FILENO, &attrib);
tcsetattr (STDIN_FILENO, TCSAFLUSH, &attrib);],
[AC_MSG_RESULT(yes)
posix_termios=t],
[AC_MSG_RESULT(no)]
)
fi
if test -z "$posix_termios" -a -z "$use_curses"
then
dnl else if
AC_MSG_CHECKING(if getch is supported)
AC_TRY_LINK(
[extern "C" {int getch();}],
[char c = getch();],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GETCH, 1, [Defined if msdos getch is supported])
],
[AC_MSG_RESULT(no)]
)
fi
if test "$posix_termios"
then
AC_DEFINE(POSIX_TERMIOS, 1, [Defined if Posix Termios is Supported])
fi
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# Compiler Quirks Tests #
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
AC_MSG_CHECKING(for STL rel_ops pollution)
AC_TRY_COMPILE(
[#include <utility>
template <typename T>
class C {};
template <typename T>
bool operator== (C<T>, C<T>) {return true;}
template <typename T>
bool operator!= (C<T>, C<T>) {return false;}],
[C<int> c1, c2;
bool v = c1 != c2;],
[AC_MSG_RESULT(no)],
[AC_MSG_RESULT(yes)
AC_DEFINE(REL_OPS_POLLUTION, 1,
[Defined if STL rel_ops pollute the global namespace])
]
)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# Output #
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
AC_CONFIG_FILES([Makefile gen/Makefile common/Makefile lib/Makefile data/Makefile
auto/Makefile modules/Makefile modules/tokenizer/Makefile
modules/speller/Makefile modules/speller/default/Makefile
interfaces/Makefile interfaces/cc/Makefile
scripts/Makefile examples/Makefile
prog/Makefile manual/Makefile po/Makefile.in m4/Makefile
modules/filter/Makefile myspell/Makefile lib5/Makefile
])
AC_OUTPUT