-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
1949 lines (1711 loc) · 54.9 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
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
m4_define([UIM_MAJOR_VERSION], [1])
m4_define([UIM_MINOR_VERSION], [9])
m4_define([UIM_PATCHLEVEL_VERSION], [0])
m4_define([UIM_VERSION],
UIM_MAJOR_VERSION.UIM_MINOR_VERSION.UIM_PATCHLEVEL_VERSION)
AC_PREREQ(2.60b)
AC_INIT([uim], [UIM_VERSION], [uim-en@googlegroups.com])
AC_CONFIG_SRCDIR([uim/uim.c])
AC_CONFIG_HEADERS([uim/config.h])
AM_INIT_AUTOMAKE([1.10 dist-bzip2])
AC_SUBST(UIM_VERSION_MAJOR, UIM_MAJOR_VERSION)
AC_SUBST(UIM_VERSION_MINOR, UIM_MINOR_VERSION)
AC_SUBST(UIM_VERSION_PATCHLEVEL, UIM_PATCHLEVEL_VERSION)
# Enable GNU extensions such as asprintf(3), BSD-originated functions,
# POSIX features and more on glibc (and some other
# implementations). See features.h. This macro should be placed here.
AC_GNU_SOURCE
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_CPP
AC_PROG_OBJC
AC_PROG_LN_S
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
AC_PATH_PROG(SH, sh)
AC_PATH_PROG(RSVG, rsvg-convert)
AC_PATH_PROG(CSI, csi)
AC_PATH_PROGS(MD5, md5 md5sum)
AC_PATH_PROGS(SHA1, sha1 sha1sum)
AC_PATH_PROGS(SED, sed gsed)
AX_PATH_QMAKE4
AX_PATH_QMAKE5
AM_MAINTAINER_MODE
# Checks for libraries
AC_CHECK_LIB(dl,dlopen)
AC_CHECK_LIB(socket,socket)
AX_LIB_GLIBC
dnl ***********************
dnl *** Tests for iconv ***
dnl ***********************
dnl
dnl We do this before the gettext checks, to avoid distortion
AM_ICONV
if test "$am_cv_func_iconv" != yes; then
AC_MSG_ERROR([Could not find iconv(3) in libc or libiconv (required for uim)])
fi
AC_SUBST(LIBICONV)
dnl *************************
dnl *** Tests for m17nlib ***
dnl *************************
AC_ARG_WITH(m17nlib,
AS_HELP_STRING([--without-m17nlib],
[do not build against m17nlib]),
[],
[with_m17nlib=yes])
if test "x$with_m17nlib" != xno; then
PKG_CHECK_MODULES(M17NLIB, m17n-shell >= 1.3.1,
with_m17nlib=yes, with_m17nlib=no)
AC_CHECK_PROG(M17NDB, m17n-db, m17n-db)
if test -n "$M17NDB"; then
m17n_db_dir=`$M17NDB`
fi
fi
AC_SUBST(M17NLIB_LIBS)
AC_SUBST(m17n_db_dir)
AM_CONDITIONAL(M17NLIB, test "x$with_m17nlib" = xyes)
# ***********************
# *** Tests for Anthy ***
# ***********************
AC_ARG_WITH(anthy,
AC_HELP_STRING([--without-anthy],
[do not build with libanthy]),
[],
[with_anthy=yes])
if test "x$with_anthy" != xno; then
AC_CHECK_HEADERS([anthy/anthy.h],
[
saved_LIBS=$LIBS
LIBS="$LIBS -lanthy -lanthydic"
AC_CHECK_LIB([anthy], [anthy_init], [with_anthy=yes], [with_anthy=no])
LIBS=$saved_LIBS
],
[with_anthy=no])
fi
if test "x$with_anthy" = xyes; then
ANTHY_LIBS="-lanthy -lanthydic"
ANTHY_CFLAGS=""
PKG_CHECK_EXISTS(anthy >= 8622,
[AC_DEFINE(LIBANTHY_UTF8_CAPABLE, 1,
"libanthy can handle UTF-8")])
fi
AC_SUBST(ANTHY_LIBS)
AC_SUBST(ANTHY_CFLAGS)
AM_CONDITIONAL(ANTHY, test "x$with_anthy" = xyes)
# *******************************
# *** Tests for Anthy (UTF-8) ***
# *******************************
AC_ARG_WITH(anthy-utf8,
AC_HELP_STRING([--with-anthy-utf8],
[build with libanthy (UTF-8)]),
[],
[with_anthy_utf8=no])
if test "x$with_anthy_utf8" != xno; then
PKG_CHECK_MODULES(ANTHY_UTF8, anthy >= 8622,
[with_anthy_utf8=yes
AC_DEFINE(LIBANTHY_UTF8_CAPABLE, 1,
[libanthy can handle UTF-8])],
with_anthy_utf8=no)
fi
AM_CONDITIONAL(ANTHY_UTF8, test "x$with_anthy_utf8" = xyes)
dnl for uim-dict.xml.in
if test "x$with_anthy" = xyes || test "x$with_anthy_utf8" = xyes; then
UI_XML_ANTHY_START=""
UI_XML_ANTHY_END=""
else
UI_XML_ANTHY_START="<!--"
UI_XML_ANTHY_END="-->"
fi
AC_SUBST(UI_XML_ANTHY_START)
AC_SUBST(UI_XML_ANTHY_END)
# ***********************
# *** Tests for Canna ***
# ***********************
AC_ARG_WITH(canna,
AS_HELP_STRING([--with-canna],
[use Canna]),
[],
[with_canna=no])
AM_CONDITIONAL(CANNA, test "x$with_canna" = xyes)
# *********************
# *** Tests for Wnn ***
# *********************
AC_ARG_WITH(wnn,
AS_HELP_STRING([--with-wnn],
[build with libwnn]),
[],
[with_wnn=no])
if test "x$with_wnn" != xno; then
AM_PATH_WNN(with_wnn=yes, with_wnn=no)
fi
AM_CONDITIONAL(WNN, test "x$with_wnn" = xyes)
# ***********************
# *** Tests for Mana ***
# ***********************
AC_ARG_WITH(mana,
AS_HELP_STRING([--without-mana],
[do not build a plugin for Mana]),
[],
[with_mana=yes])
if test "x$with_mana" != xno; then
AC_CHECK_PROG(MANA, mana, mana)
if test -z "$MANA"; then
with_mana=no
fi
fi
AM_CONDITIONAL(MANA, test "x$with_mana" = xyes)
# ***********************
# *** Tests for PRIME ***
# ***********************
AC_ARG_WITH(prime,
AS_HELP_STRING([--without-prime],
[do not build a plugin for PRIME]),
[],
[with_prime=yes])
if test "x$with_prime" != xno; then
PKG_CHECK_MODULES(PRIME, prime >= 0.8.5.2, with_prime=yes, with_prime=no)
fi
AM_CONDITIONAL(PRIME, test "x$with_prime" = xyes)
# *********************
# *** Tests for SJ3 ***
# *********************
AC_ARG_WITH(sj3,
AS_HELP_STRING([--with-sj3],
[use SJ3]),
[],
[with_sj3=no])
AM_CONDITIONAL(SJ3, test "x$with_sj3" = xyes)
# *********************
# *** Tests for SKK ***
# *********************
AC_ARG_WITH(skk,
AS_HELP_STRING([--without-skk],
[do not build a plugin for SKK]),
[],
[with_skk=yes])
AM_CONDITIONAL(SKK, test "x$with_skk" = xyes)
# **********************
# *** Tests for cURL ***
# **********************
AC_ARG_WITH(curl,
AS_HELP_STRING([--with-curl],
[build with libcurl]),
[],
[with_curl=no])
if test "x$with_curl" != xno; then
PKG_CHECK_MODULES(CURL, libcurl >= 7.16.4, with_curl=yes, with_curl=no)
fi
AM_CONDITIONAL(CURL, test "x$with_curl" = xyes)
# ***********************
# *** Tests for expat ***
# ***********************
expat_found=no
AM_WITH_EXPAT
AM_CONDITIONAL(EXPAT, test "x$expat_found" = xyes)
# *************************
# *** Tests for OpenSSL ***
# *************************
AC_ARG_ENABLE(openssl,
AC_HELP_STRING([--enable-openssl],
[enable OpenSSL]),
[],
[enable_openssl=no])
if test "x$enable_openssl" != xno; then
AM_WITH_OPENSSL
fi
AM_CONDITIONAL(OPENSSL, test "x$enable_openssl" = xyes)
# *************************
# *** Tests for SQLite3 ***
# *************************
AC_ARG_WITH(sqlite3,
AS_HELP_STRING([--with-sqlite3],
[build with SQLite3]),
[],
[with_sqlite3=yes])
if test "x$with_sqlite3" = xyes; then
PKG_CHECK_MODULES(SQLITE3, sqlite3 >= 3.0.0,
with_sqlite3=yes, with_sqlite3=no)
fi
AM_CONDITIONAL(SQLITE3, test "x$with_sqlite3" = xyes)
# ************************
# *** Tests for libffi ***
# ************************
AC_ARG_WITH(ffi,
AS_HELP_STRING([--with-ffi],
[build with libffi]),
[],
[with_ffi=no])
if test "x$with_ffi" = xyes; then
PKG_CHECK_MODULES(FFI, libffi >= 3.0.0, with_ffi=yes, with_ffi=no)
fi
AM_CONDITIONAL(FFI, test "x$with_ffi" = xyes)
PKG_CHECK_MODULES(X11, x11, x11_use_new_dir=yes, x11_use_new_dir=no)
AC_PATH_XTRA
use_xim=no
if test x"$have_x" != xdisabled && test x"$have_x" != xno; then
PKG_CHECK_MODULES(XIM, xext, use_xim=yes, use_xim=no)
if test "x$use_xim" = xyes; then
AC_CXX_NAMESPACES
AC_CXX_HAVE_STL
if test $ac_cv_cxx_have_stl = no; then
use_xim=no
fi
fi
AC_MSG_CHECKING([whether to have Xft support])
AM_PATH_XFT(yes, XFT=true, XFT=false)
if test x"$XFT" = xtrue; then
saved_CFLAGS=$CFLAGS
saved_LIBS=$LIBS
CFLAGS="$CFLAGS $XFT_CFLAGS"
LIBS="$LIBS $XFT_LIBS"
AC_TRY_LINK([
#include <X11/Xft/Xft.h>], [ XftFontClose(0, 0); return 1; ],
[
AC_DEFINE(WITH_XFT, 1, [font antialiasing support])
AC_MSG_CHECKING([Xft UTF-8 support])
AC_TRY_LINK([
#include <X11/Xft/Xft.h>
], [
XftDrawStringUtf8(0, 0, 0, 0, 0, 0, 0); return 0;
],
AC_DEFINE(HAVE_XFT_UTF8_STRING, 1, "Xft UTF8 support")
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
],
[
AC_MSG_RESULT([***Could not link with Xft. Install Xft if you want support for it***])
XFT=false
XFT_CFLAGS=
XFT_LIBS=
])
CFLAGS=$saved_CFLAGS
LIBS=$saved_LIBS
fi
fi
AM_CONDITIONAL(XIM, test x"$use_xim" = xyes)
AM_CONDITIONAL(WITH_XFT, test x"$XFT" = xtrue)
# Checks for header files
AC_HEADER_STDC
AC_HEADER_STDBOOL
AC_CHECK_HEADERS([stdint.h inttypes.h sys/inttypes.h sys/types.h])
AC_CHECK_HEADERS([fcntl.h locale.h stdlib.h unistd.h errno.h])
AC_CHECK_HEADERS([string.h sys/ioctl.h sys/socket.h termios.h sys/termios.h wchar.h])
AC_CHECK_HEADERS([sys/time.h sys/stat.h sys/un.h getopt.h assert.h signal.h term.h ncurses/term.h ctype.h pwd.h stdarg.h])
AC_CHECK_HEADERS([pty.h utmp.h util.h libutil.h])
AC_CHECK_HEADERS([curses.h stropts.h])
AC_CHECK_HEADERS([sys/param.h strings.h netdb.h sysexits.h])
AC_CHECK_HEADERS([poll.h sys/poll.h])
# Check for types
AC_TYPE_INT8_T
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_INTMAX_T
AC_TYPE_INTPTR_T
AC_TYPE_UINT8_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINTMAX_T
AC_TYPE_UINTPTR_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIGNAL
AC_CHECK_TYPES(sig_atomic_t, , ,
[ #include <signal.h> ])
AC_CHECK_TYPES(sig_t, , ,
[ #include <signal.h> ])
# Checks for structures
# Checks for compiler characteristics
AC_C_CONST
# FIXME: depending on the internal variable name
AC_DEFUN([AX_LANG_WNOERROR], [ac_[]_AC_LANG_ABBREV[]_werror_flag=])
AC_LANG_WERROR # Turn warning-only unknown options into error.
AX_CFLAGS_GCC_OPTION([-pedantic])
AX_CFLAGS_GCC_OPTION([-pipe])
AX_CFLAGS_GCC_OPTION([-Wall])
AX_CFLAGS_GCC_OPTION([-Wchar-subscripts])
AX_CFLAGS_GCC_OPTION([-Wmissing-declarations])
AX_CFLAGS_GCC_OPTION([-Wredundant-decls])
AX_CFLAGS_GCC_OPTION([-Wmissing-prototypes])
AX_CFLAGS_GCC_OPTION([-Wnested-externs])
AX_CFLAGS_GCC_OPTION([-Wpointer-arith])
AX_CFLAGS_GCC_OPTION([-Wcast-align])
AX_CFLAGS_GCC_OPTION([-Wsign-compare])
AX_CFLAGS_GCC_OPTION([-Wno-long-long])
# Suppress warnings about strings longer than ISO C 89 maximum length (509).
AX_CFLAGS_GCC_OPTION([-Wno-overlength-strings])
# Disable the problematic preprocessing on Mac OS X
AX_CFLAGS_GCC_OPTION([-no-cpp-precomp])
# Deprecated autoconf macro used in AX_CXXFLAGS_GCC_OPTION.
AC_DEFUN([AC_LANG_CXX], [AC_LANG([C++])])
AX_CXXFLAGS_GCC_OPTION([-pipe])
AX_CXXFLAGS_GCC_OPTION([-W])
AX_CXXFLAGS_GCC_OPTION([-Wall])
AX_CXXFLAGS_GCC_OPTION([-Wchar-subscripts])
AX_CXXFLAGS_GCC_OPTION([-Wnon-virtual-dtor])
AX_CXXFLAGS_GCC_OPTION([-Wno-long-long])
AX_CXXFLAGS_GCC_OPTION([-Wcast-align])
AX_CXXFLAGS_GCC_OPTION([-Wconversion])
AX_CXXFLAGS_GCC_OPTION([-Wchar-subscripts])
AX_CXXFLAGS_GCC_OPTION([-Wpointer-arith])
AX_CXXFLAGS_GCC_OPTION([-Wwrite-strings])
AX_CXXFLAGS_GCC_OPTION([-Wformat-security])
AX_LANG_WNOERROR # end AC_LANG_WERROR
AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
# compute LLONG_MIN and LLONG_MAX if we don't know them.
if test -z "$have_llong_max"; then
AC_MSG_CHECKING([for max value of long long])
AC_RUN_IFELSE(
[AC_LANG_SOURCE([[
#include <stdio.h>
/* Why is this so damn hard? */
#ifdef __GNUC__
# undef __GNUC__
#endif
#define __USE_ISOC99
#include <limits.h>
#define DATA "conftest.llminmax"
#define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
/*
* printf in libc on some platforms (eg old Tru64) does not understand %lld so
* we do this the hard way.
*/
static int
fprint_ll(FILE *f, long long n)
{
unsigned int i;
int l[sizeof(long long) * 8];
if (n < 0)
if (fprintf(f, "-") < 0)
return -1;
for (i = 0; n != 0; i++) {
l[i] = my_abs(n % 10);
n /= 10;
}
do {
if (fprintf(f, "%d", l[--i]) < 0)
return -1;
} while (i != 0);
if (fprintf(f, " ") < 0)
return -1;
return 0;
}
int main(void) {
FILE *f;
long long i, llmin, llmax = 0, llmin1, llmax1;
if((f = fopen(DATA,"w")) == NULL)
exit(1);
#if defined(LLONG_MIN) && defined(LLONG_MAX)
fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
llmin = LLONG_MIN;
llmax = LLONG_MAX;
#else
fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
/* This will work on one's complement and two's complement */
for (i = 1; i > llmax; i <<= 1, i++)
llmax = i;
llmin = llmax + 1LL; /* wrap */
#endif
/* Sanity check */
llmin1 = llmin - 1;
llmax1 = llmax + 1;
if (llmin + 1 < llmin || llmin1 < llmin || llmax1 > llmax
|| llmax - 1 > llmax || llmin == llmax || llmin == 0
|| llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
fprintf(f, "unknown unknown\n");
exit(2);
}
if (fprint_ll(f, llmin) < 0)
exit(3);
if (fprint_ll(f, llmax) < 0)
exit(4);
if (fclose(f) < 0)
exit(5);
exit(0);
}
]])],
[
llong_min=`$AWK '{print $1}' conftest.llminmax`
llong_max=`$AWK '{print $2}' conftest.llminmax`
AC_MSG_RESULT($llong_max)
AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
[max value of long long calculated by configure])
AC_MSG_CHECKING([for min value of long long])
AC_MSG_RESULT($llong_min)
AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
[min value of long long calculated by configure])
],
[
AC_MSG_RESULT(not found)
],
[
AC_MSG_WARN([cross compiling: not checking])
]
)
fi
# Checks for library functions
AC_FUNC_REALLOC
AC_FUNC_ALLOCA
AC_FUNC_MEMCMP
AC_FUNC_MMAP
AX_FUNC_SIGSETJMP
AC_FUNC_FORK
AC_FUNC_LSTAT
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
AC_FUNC_SELECT_ARGTYPES
AC_CHECK_FUNCS([cfmakeraw])
AC_CHECK_FUNCS([wcswidth])
# BSD functions
AC_CHECK_FUNCS([strdup])
# GNU functions
AC_CHECK_FUNCS([asprintf vasprintf])
# C99 functions
AC_CHECK_FUNCS([snprintf vsnprintf])
# FIXME: replace non-standard perror(3)
AC_REPLACE_FUNCS([getpeereid strsep setenv unsetenv strlcpy strlcat strtonum strtoll])
AC_CHECK_FUNCS([getpid stat mkdir chmod])
AC_CHECK_FUNCS([execv execvp])
AC_CHECK_FUNCS([isascii])
AC_CHECK_FUNCS([getaddrinfo freeaddrinfo getnameinfo])
AC_CHECK_FUNCS([issetugid])
AC_CHECK_FUNCS([poll])
AC_CHECK_FUNCS([waitpid])
AC_CHECK_FUNCS([daemon])
# IRIX has a const char return value for gai_strerror()
AC_CHECK_FUNCS(gai_strerror,[
AC_DEFINE(HAVE_GAI_STRERROR)
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
const char *gai_strerror(int);],[
char *str;
str = gai_strerror(0);],[
AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
[Define if gai_strerror() returns const char *])])])
# Check for broken snprintf
if test "x$ac_cv_func_snprintf" = xyes; then
AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
AC_RUN_IFELSE(
[AC_LANG_SOURCE([[
#include <stdio.h>
int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
]])],
[AC_MSG_RESULT(yes)],
[
AC_MSG_RESULT(no)
AC_DEFINE(BROKEN_SNPRINTF, 1,
[Define if your snprintf is busted])
AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
],
[ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
)
fi
# If we don't have a working asprintf, then we strongly depend on vsnprintf
# returning the right thing on overflow: the number of characters it tried to
# create (as per SUSv3)
if test "x$ac_cv_func_asprintf" != xyes && \
test "x$ac_cv_func_vsnprintf" = xyes; then
AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
AC_RUN_IFELSE(
[AC_LANG_SOURCE([[
#include <sys/types.h>
#include <stdio.h>
#include <stdarg.h>
int x_snprintf(char *str,size_t count,const char *fmt,...)
{
size_t ret; va_list ap;
va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
return ret;
}
int main(void)
{
char x[1];
exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
} ]])],
[AC_MSG_RESULT(yes)],
[
AC_MSG_RESULT(no)
AC_DEFINE(BROKEN_SNPRINTF, 1,
[Define if your snprintf is busted])
AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
],
[ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
)
fi
# On systems where [v]snprintf is broken, but is declared in stdio,
# check that the fmt argument is const char * or just char *.
# This is only useful for when BROKEN_SNPRINTF
AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
int main(void) { snprintf(0, 0, 0); }
]])],
[AC_MSG_RESULT(yes)
AC_DEFINE(SNPRINTF_CONST, [const],
[Define as const if snprintf() can declare const char *fmt])],
[AC_MSG_RESULT(no)
AC_DEFINE(SNPRINTF_CONST, [/* not const */])])
AC_SEARCH_LIBS(dlfunc,dl,
[
AC_DEFINE(HAVE_DLFUNC, 1,
[Define to 1 if you have the dlfunc function.])
])
# for uim-fep
AM_LANGINFO_CODESET
dnl Solaris 9 needs -lresolv for inet_aton
NETLIBS=""
AC_CHECK_FUNC(inet_aton, ,
[AC_CHECK_LIB(resolv, inet_aton, [NETLIBS="-lresolv"])])
AC_SUBST(NETLIBS)
dnl socket related
AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
AC_TRY_COMPILE(
[
#include <sys/types.h>
#include <sys/socket.h>
],
[ struct sockaddr_storage s; ],
[ ac_cv_have_struct_sockaddr_storage=yes ],
[ ac_cv_have_struct_sockaddr_storage=no ]
)
])
if test "x$ac_cv_have_struct_sockaddr_storage" = xyes; then
AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
[define if you have struct sockaddr_storage data type])
fi
dnl cred related
AC_CACHE_CHECK([for struct cmsgcred], ac_cv_have_struct_cmsgcred, [
AC_TRY_COMPILE(
[
#include <sys/types.h>
#include <sys/socket.h>
],
[ struct cmsgcred s; ],
[ ac_cv_have_struct_cmsgcred=yes ],
[ ac_cv_have_struct_cmsgcred=no ]
)
])
if test "x$ac_cv_have_struct_cmsgcred" = xyes; then
AC_DEFINE(HAVE_STRUCT_CMSGCRED, 1,
[define if you have struct cmsgcred data type])
fi
AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
AC_TRY_COMPILE(
[
#include <sys/types.h>
#include <netinet/in.h>
],
[ struct sockaddr_in6 s; s.sin6_family = 0; ],
[ ac_cv_have_struct_sockaddr_in6=yes ],
[ ac_cv_have_struct_sockaddr_in6=no ]
)
])
if test "x$ac_cv_have_struct_sockaddr_in6" = xyes; then
AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
[define if you have struct sockaddr_in6 data type])
fi
AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
AC_TRY_COMPILE(
[
#include <sys/types.h>
#include <netinet/in.h>
],
[ struct in6_addr s; s.s6_addr[0] = 0; ],
[ ac_cv_have_struct_in6_addr=yes ],
[ ac_cv_have_struct_in6_addr=no ]
)
])
if test "x$ac_cv_have_struct_in6_addr" = xyes; then
AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
[define if you have struct in6_addr data type])
fi
AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
AC_TRY_COMPILE(
[
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
],
[ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
[ ac_cv_have_struct_addrinfo=yes ],
[ ac_cv_have_struct_addrinfo=no ]
)
])
if test "x$ac_cv_have_struct_addrinfo" = xyes; then
AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
[define if you have struct addrinfo data type])
fi
GETTEXT_PACKAGE=uim
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[gettext package name])
AM_GNU_GETTEXT([external], [need-ngettext])
AM_GNU_GETTEXT_VERSION([0.17])
# FIXME: Probably voilent way -- YamaKen 2005-01-07
if test "x$prefix" = xNONE; then
prefix=$ac_default_prefix
fi
if test "x$exec_prefix" = xNONE; then
exec_prefix=$prefix
fi
# FIXME: complicated directory handlings -- YamaKen 2006-07-08
# FIXME: double eval workaround for datarootdir
LIBDIR=`eval eval echo ${libdir}`
AC_DEFINE_UNQUOTED(LIBDIR, "$LIBDIR", [libraries dir])
DATADIR=`eval eval echo ${datadir}`
AC_DEFINE_UNQUOTED(DATADIR, "$DATADIR", [read-only architecture-independent data dir])
UIM_LIBEXECDIR=`eval echo "${libexecdir}"`
AC_DEFINE_UNQUOTED(UIM_LIBEXECDIR, "$UIM_LIBEXECDIR", [libexec dir])
AC_SUBST(UIM_LIBEXECDIR)
# we should use more safe macro such as AC_EXPAND_DIR
LOCALEDIR=`eval eval echo ${datadir}/locale`
# backward compatibility
localedir=$LOCALEDIR
AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR", [locale dir])
AC_DEFINE_UNQUOTED(GNOMELOCALEDIR, "$LOCALEDIR", [locale dir for GNOME])
AC_DEFINE_UNQUOTED(GNOME3LOCALEDIR, "$LOCALEDIR", [locale dir for GNOME3])
# define XLIB directory for Compose file
if test "x$x11_use_new_dir" = xyes; then
AC_DEFINE_UNQUOTED(XLIB_DIR, "`$PKG_CONFIG x11 --variable=prefix`/share", [X11 Library Directory])
else
AC_DEFINE_UNQUOTED(XLIB_DIR, "$x_libraries", [X11 Library Directory])
fi
uim_pixmapsdir=`eval eval echo ${datadir}/${PACKAGE_TARNAME}/pixmaps`
AC_DEFINE_UNQUOTED(UIM_PIXMAPSDIR, "${uim_pixmapsdir}", [pixmaps directory])
AC_SUBST(uim_pixmapsdir)
dnl ******************************
dnl *** Check for GTK+ Library ***
dnl ******************************
AC_ARG_WITH(gtk2,
AC_HELP_STRING([--without-gtk2],
[do not build against GTK+2]),
[],
[with_gtk2=yes])
if test "x$with_gtk2" != xno; then
PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= 2.2.0 gdk-x11-2.0,
with_gtk2=yes, with_gtk2=no)
PKG_CHECK_MODULES(GTK2_4, gtk+-2.0 >= 2.4.0 gdk-x11-2.0,
with_gtk2_4=yes, with_gtk2_4=no)
fi
AM_CONDITIONAL(GTK2, test "x$with_gtk2" = xyes)
AM_CONDITIONAL(GTK2_4, test "x$with_gtk2_4" = xyes)
if test "x$with_gtk2" = xyes; then
GTK_BINARY_VERSION=`$PKG_CONFIG gtk+-2.0 --variable=gtk_binary_version`
GTK_LIBDIR=`$PKG_CONFIG gtk+-2.0 --variable=libdir`
AC_SUBST(GTK_BINARY_VERSION)
AC_SUBST(GTK_LIBDIR)
AC_DEFINE(USE_GTK2, 1, [use GTK+2])
fi
AC_ARG_ENABLE(gnome-applet,
AC_HELP_STRING([--disable-gnome-applet],
[disable uim applet for GNOME2 panel]),
[],
[enable_gnome_applet=yes])
if test "x$enable_gnome_applet" != xno; then
PKG_CHECK_MODULES(GNOME_APPLET, libpanelapplet-2.0,
enable_gnome_applet=yes, enable_gnome_applet=no)
PKG_CHECK_MODULES(APPLET_2_14, libpanelapplet-2.0 >= 2.14.0,
panelapplet_have_set_background_api=yes,
panelapplet_have_set_background_api=no)
fi
if test x"$panelapplet_have_set_background_api" = xyes; then
AC_DEFINE(LIBPANEL_APPLET_HAVE_SET_BACKGROUND_WIDGET, 1 , [libpanel-applet have set_background api])
fi
AM_CONDITIONAL(GNOME_APPLET, test "x$enable_gnome_applet" = xyes)
dnl *******************************
dnl *** Check for GTK+3 Library ***
dnl *******************************
AC_ARG_WITH(gtk3,
AC_HELP_STRING([--without-gtk3],
[do not build GTK+3 immodule and helper applications]),
[],
[with_gtk3=yes])
if test "x$with_gtk3" != xno; then
PKG_CHECK_MODULES(GTK3, gtk+-3.0, with_gtk3=yes, with_gtk3=no)
fi
AM_CONDITIONAL(GTK3, test "x$with_gtk3" = xyes)
if test "x$with_gtk3" = xyes; then
AC_DEFINE(USE_GTK3, 1, [use GTK+3])
GTK3_BINARY_VERSION=`$PKG_CONFIG gtk+-3.0 --variable=gtk_binary_version`
GTK3_LIBDIR=`$PKG_CONFIG gtk+-3.0 --variable=libdir`
AC_SUBST(GTK3_BINARY_VERSION)
AC_SUBST(GTK3_LIBDIR)
fi
AC_ARG_ENABLE(gnome3-applet,
AC_HELP_STRING([--disable-gnome3-applet],
[disable uim applet for GNOME3 panel]),
[],
[enable_gnome3_applet=yes])
if test "x$enable_gnome3_applet" != xno; then
PKG_CHECK_MODULES(GNOME3_APPLET, libpanelapplet-4.0,
enable_gnome3_applet=yes, enable_gnome3_applet=no)
fi
AM_CONDITIONAL(GNOME3_APPLET, test "x$enable_gnome3_applet" = xyes)
dnl ****************************
dnl *** Check for Qt Library ***
dnl ****************************
AC_ARG_WITH(qt,
AC_HELP_STRING([--with-qt],
[build Qt3 helper applications]),
[],
[with_qt=no])
if test "x$with_qt" = xyes; then
# minimum version
QT_VERSION=3.2.0
QT_VERSION_NUM=0x030200
# GUESS $QTDIR
if test ! -d "$QTDIR"; then
QTDIR="/usr/lib/qt3"
fi
if test ! -d "$QTDIR"; then
QTDIR="/usr/lib/qt"
fi
if test ! -d "$QTDIR"; then
QTDIR="/usr"
fi
AC_MSG_CHECKING(for Qt3 library dir)
if test ! -d "$QTDIR"; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT($QTDIR)
fi
# GUESS $QTINCDIR from $QTDIR
QTINCDIR="$QTDIR/include/qt"
if test ! -d "$QTINCDIR"; then
QTINCDIR="$QTDIR/include/X11/qt"
fi
if test ! -d "$QTINCDIR"; then
QTINCDIR="$QTDIR/include/qt3"
fi
if test ! -d "$QTINCDIR"; then
QTINCDIR="$QTDIR/include"
fi
# GUESS $QTINCDIR independently
if test ! -d "$QTINCDIR"; then
QTINCDIR="/usr/include/X11/qt"
fi
if test ! -d "$QTINCDIR"; then
QTINCDIR="/usr/include/qt3"
fi
if test ! -d "$QTINCDIR"; then
QTINCDIR="/usr/include/qt"
fi
if test ! -d "$QTINCDIR"; then
QTINCDIR="/usr/include"
fi
# GUESS $QTLIBDIR
QTLIBDIR="$QTDIR/lib64"
if test ! -d "$QTLIBDIR"; then
QTLIBDIR="$QTDIR/lib"
fi
if test ! -d "$QTLIBDIR"; then
QTLIBDIR="/usr/lib/qt3"
fi
if test ! -d "$QTLIBDIR"; then
QTLIBDIR="/usr/lib/qt"
fi
if test ! -d "$QTLIBDIR"; then
QTLIBDIR="/usr/lib"
fi
# Check For MOC
if test -x "$QTDIR/bin/moc"; then
HOST_MOC="$QTDIR/bin/moc"
else
AC_CHECK_PROGS(HOST_MOC, moc-qt3 moc, "")
fi
if test -z "$HOST_MOC"; then
AC_MSG_ERROR([no acceptable moc( meta object compiler ) found])
fi
MOC=$HOST_MOC
# Check For UIC
if test -x "$QTDIR/bin/uic"; then
HOST_UIC="$QTDIR/bin/uic"
else
AC_CHECK_PROGS(HOST_UIC, uic-qt3 uic, "")
fi
if test -z "$HOST_UIC"; then
AC_MSG_ERROR([no acceptable uic( user interface compiler ) found])
fi
UIC=$HOST_UIC
# GUESS plugins dir for immodule installation
AC_MSG_CHECKING(for qt-immodule plugins dir)
if test ! -d "$QTDIR/plugins"; then
AC_MSG_RESULT(no)
else
QT_PLUGINSDIR=$QTDIR/plugins
AC_MSG_RESULT($QT_PLUGINSDIR)
AC_SUBST(QT_PLUGINSDIR)
fi
# Process for compiler & linker flags
QT_CXXFLAGS="-I${QTINCDIR} -DQT_GENUINE_STR -DQT_NO_STL"
if test -z "$enable_debug"; then
QT_CXXFLAGS="$QT_CXXFLAGS -DQT_NO_DEBUG -DNO_DEBUG"
fi
_SAVE_LDFLAGS=$LDFLAGS
QT_LDFLAGS=-L${QTLIBDIR}
LDFLAGS="$LDFLAGS $QT_LDFLAGS"
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_CHECK_LIB(qt, main, QT_LIB=-lqt,
AC_CHECK_LIB(qt-mt, main, QT_LIB=-lqt-mt,
AC_MSG_ERROR([Cannot find QT libraries.])))
if test "$QT_LIB" = "-lqt-mt"; then
QT_CXXFLAGS="$QT_CXXFLAGS -DQT_THREAD_SUPPORT"
fi
LDFLAGS=$_SAVE_LDFLAGS
QT_LIBS="$X_LIBS $QT_LDFLAGS $QT_LIB -lXext -lX11"
_SAVE_CXXFLAGS=$CXXFLAGS
_SAVE_LIBS=$LIBS
CXXFLAGS="$CXXFLAGS $QT_CXXFLAGS"
LIBS="$LIBS $QT_LIBS"
AC_MSG_CHECKING(Qt - version >= $QT_VERSION)
AC_TRY_COMPILE([#include <qglobal.h>],
[
#if (QT_VERSION < $QT_VERSION_NUM)
#error "QT_VERSION too old"
#endif
],result=yes,result=no)
AC_MSG_RESULT("$result")