File: configure.in

package info (click to toggle)
freewnn 1.1.1~a021%2Bcvs20130302-8
  • links: PTS
  • area: main
  • in suites: sid
  • size: 19,080 kB
  • sloc: ansic: 97,652; sh: 8,518; makefile: 6,487; cpp: 88
file content (923 lines) | stat: -rw-r--r-- 26,458 bytes parent folder | download
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
dnl
dnl   $Id: configure.in,v 1.55 2011/05/15 17:03:53 aonoto Exp $
dnl

dnl
dnl FreeWnn is a network-extensible Kana-to-Kanji conversion system.
dnl This file is part of FreeWnn.
dnl 
dnl Copyright Kyoto University Research Institute for Mathematical Sciences
dnl                 1987, 1988, 1989, 1990, 1991, 1992
dnl Copyright OMRON Corporation. 1987, 1988, 1989, 1990, 1991, 1992, 1999
dnl Copyright ASTEC, Inc. 1987, 1988, 1989, 1990, 1991, 1992
dnl Copyright FreeWnn Project
dnl                 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
dnl                 2010, 2011
dnl 
dnl Maintainer:  FreeWnn Project
dnl 
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2 of the License, or
dnl (at your option) any later version.
dnl 
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
dnl GNU General Public License for more details.
dnl 
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
dnl

dnl
dnl Process this file with autoconf to produce a configure script.
dnl
AC_INIT(FreeWnn, [1.1.1-cvs-a022], [freewnn-users-owner@lists.sourceforge.jp], FreeWnn)
AC_CONFIG_SRCDIR(Wnn/conv/cvt_head.h)
dnl old-style AC_INIT ...
dnl AC_INIT(Wnn/conv/cvt_head.h)
AC_CONFIG_HEADER(config.h)

dnl ====================================================================
dnl Check optional features
dnl ====================================================================

# Quick and Dirty workaround for Autoconf-2.53 and Libtools-1.5.* pair ...
# not to use additional tagged configuration. (default: CXX F77)
# NOTICE: Please remove next line if situation changes. (aono)
tagnames=

AC_CANONICAL_HOST

dnl
AC_ARG_PROGRAM

dnl build and install libraries, server or client

AC_ARG_ENABLE(debug,
[  --enable-debug          enable debug options [[default=no]]],
[case "${enableval}" in
   yes) debug=true ;;
   no)  debug=false ;;
   *)   AC_MSG_ERROR(bad value for --enable-debug)
esac], debug=false)

AC_ARG_ENABLE(libraries,
[  --enable-libraries      build and install libraries [[default=yes]]],
[case "${enableval}" in
   yes) libraries=true ;;
   no)  libraries=false ;;
   *)   AC_MSG_ERROR(bad value for --enable-libraries) ;;
esac], libraries=true)

AC_ARG_ENABLE(server,
[  --enable-server         build and install server [[default=yes]]],
[case "${enableval}" in
   yes) server=true ;;
   no)  server=false ;;
   *)   AC_MSG_ERROR(bad value for --enable-server) ;;
esac], server=true)

AC_ARG_ENABLE(client,
[  --enable-client         build and install clients [[default=no]]],
[case "${enableval}" in
   yes) client=true ;;
   no)  client=false ;;
   *)   AC_MSG_ERROR(bad value for --enable-client) ;;
esac], client=false)

AC_ARG_ENABLE(client-utmp,
[  --enable-client-utmp    write utmp with client [[default=yes if not modern BSD]]],
[case "${enableval}" in
   yes) client_utmp=true ;;
   no)  client_utmp=false ;;
   *)   AC_MSG_ERROR(bad value for --enable-client-utmp) ;;
esac],
client_utmp=auto
)

dnl If you set set-[ug]id user/group to (ex.) 'yes', 
dnl you can configure this with setting UUMOWNER / UUMGROUP .
AC_ARG_ENABLE(client-setuid,
[  --enable-client-setuid[[=user]] Install client with setuid and specified user [[default=guess if your system need this]]],
[case "${enableval}" in
    yes) client_setuid=true; UUMOWNER=${UUMOWNER:-root} ;;
    no)  client_setuid=false ;;
    *)   client_setuid=true; UUMOWNER=${enableval} ;;
esac],
[client_setuid=auto	# guess later ...
 UUMOWNER=root]
)

AC_ARG_ENABLE(client-setgid,
[  --enable-client-setgid=group Install client with setgid and specified group [[default=guess if your system need this]]],
[case "${enableval}" in
    yes)
	if test "x$UUMGROUP" = "x"; then 
	    AC_ERROR([You must set group name with --enable-client-setgid.])
	else
	    client_setgid=true;	# we already defined UUMGROUP ...
	fi
	;;
    no)  client_setgid=false ;;
    *)   client_setgid=true; UUMGROUP=${enableval} ;;
esac],
[client_setgid=auto	# guess later ...
UUMGROUP=]
)

if test $libraries = true; then
	SUBDIRS="\$(LIB_SUBDIRS)"
	WNNMANDIR="\$(LIB_WNNMANDIR)"
fi
if test $server = true; then
	SUBDIRS="$SUBDIRS \$(SERVER_SUBDIRS)"
	WNNMANDIR="$WNNMANDIR \$(SERVER_WNNMANDIR)"
fi
if test $client = true; then
	SUBDIRS="$SUBDIRS \$(CLIENT_SUBDIRS)"
dnl currently client is only uum and its man is in SERVER_WNNMANDIR
dnl	WNNMANDIR=$WNNMANDIR \$(CLIENT_WNNMANDIR)"
fi

AC_SUBST(SUBDIRS)
AC_SUBST(WNNMANDIR)

dnl For Severs

AC_ARG_ENABLE(Wnn,
[  --enable-Wnn            build and install Wnn [[default=yes]]],
[case "${enableval}" in
   yes) Wnn="Wnn";;
   no)  Wnn="" ;;
   *)   AC_MSG_ERROR(bad value for --enable-Wnn) ;;
esac], Wnn="Wnn")
AC_SUBST(Wnn)

if test "$server" = true -a "$Wnn" = Wnn; then
#	JSERVER_SUBDIRS1="\$(JSERVER_SUBDIRS1)"
	JSERVER_SUBDIRS2="\$(JSERVER_SUBDIRS2)"
else
#	JSERVER_SUBDIRS1=""
	JSERVER_SUBDIRS2=""
fi
dnl AC_SUBST(JSERVER_SUBDIRS1)
AC_SUBST(JSERVER_SUBDIRS2)

AC_ARG_ENABLE(cWnn,
[  --enable-cWnn           build and install cWnn [[default=yes]]],
[case "${enableval}" in
   yes) cWnn="cWnn" ;;
   no)  cWnn="" ;;
   *)   AC_MSG_ERROR(bad value for --enable-cWnn) ;;
esac], cWnn="cWnn")
AC_SUBST(cWnn)

AC_ARG_ENABLE(kWnn,
[  --enable-kWnn           build and install kWnn [[default=yes]]],
[case "${enableval}" in
   yes) kWnn="kWnn" ;;
   no)  kWnn="" ;;
   *)   AC_MSG_ERROR(bad value for --enable-kWnn) ;;
esac], kWnn="kWnn")
AC_SUBST(kWnn)

dnl For a library libwnn

AC_ARG_WITH(libwnn,
[  --with-libwnn             use installed Wnn library [[default=no]]],
[  with_libwnn="${withval}"], [with_libwnn=no])
AC_ARG_WITH(wnn-includes,
[  --with-wnn-includes=DIR   Installed Wnn include files are in DIR],
[wnnincludedir="-I${withval}"], [wnnincludedir=''])
AC_ARG_WITH(wnn-libraries,
[  --with-wnn-libraries=DIR  Search for Wnn libraries in DIR [[default=/usr/local/lib]]],
[wnnlibdir="${withval}"], [wnnlibdir='/usr/local/lib'])

if test X${with_libwnn} != Xno; then
	case X${with_libwnn} in
	Xyes | X-lwnn)
		WNNJLIB="-L${wnnlibdir} -lwnn" ;;
	X/*)
		WNNJLIB="${wnnlibdir}/libwnn.a" ;;
	*)
		# Honor specified value --with-libwnn
		# (maybe wrong in most cases)
		WNNJLIB="${with_libwnn}" ;;
	esac
	DEPWNNJLIB=""
	dnl NOTICE: HINSI_DATA depends on --prefix (and makerule.mk).
	HINSI_DATA="\$(JWNNWNNDIR)/hinsi.data"
	EXTWNNJINC=${wnnincludedir}
else
	WNNJLIB="\$(top_builddir)/Wnn/jlib/libwnn.la"
	DEPWNNJLIB="\$(WNNJLIB)"
	HINSI_DATA="\$(top_builddir)/Wnn/jd/hinsi.data"
	EXTWNNJINC=""
fi
AC_SUBST(WNNJLIB)
AC_SUBST(DEPWNNJLIB)
AC_SUBST(EXTWNNJINC)
AC_SUBST(HINSI_DATA)

AC_ARG_WITH(libcwnn,
[  --with-libcwnn            use installed cWnn library [[default=no]]],
[  with_libcwnn="${withval}"], [with_libcwnn=no])
AC_ARG_WITH(cwnn-includes,
[  --with-cwnn-includes=DIR  Installed cWnn include files are in DIR],
[cwnnincludedir="-I${withval}"], [cwnnincludedir=''])
AC_ARG_WITH(cwnn-libraries,
[  --with-cwnn-libraries=DIR Search for cWnn libraries in DIR [[default=/usr/local/lib]]],
[cwnnlibdir="${withval}"], [cwnnlibdir='/usr/local/lib'])

if test X${with_libcwnn} != Xno; then
   	case X${with_libcwnn} in
	Xyes | X-lcwnn)
		CWNNJLIB="-L${cwnnlibdir} -lcwnn" ;;
	X/*)
		CWNNJLIB="${cwnnlibdir}/libcwnn.a" ;;
	*)
		# Honor specified value --with-libcwnn
		# (maybe wrong in most cases)
		CWNNJLIB="${with_libcwnn}" ;;
	esac
	DEPCWNNJLIB=""
	dnl NOTICE: [CT]HINSI_DATA also depends on --prefix (and makerule.mk).
	CHINSI_DATA="\$(CWNNWNNDIR)/cixing.data"
	THINSI_DATA="\$(TWNNWNNDIR)/cixing.data"
	EXTCWNNJINC=${cwnnincludedir}
else
	CWNNJLIB="\$(top_builddir)/cWnn/jlib/libcwnn.la"
	DEPCWNNJLIB="\$(CWNNJLIB)"
	CHINSI_DATA="\$(CWNNCDSRC)/cixing.data"
	THINSI_DATA="\$(TWNNTDSRC)/cixing.data"
	EXTCWNNJINC=""
fi
AC_SUBST(CWNNJLIB)
AC_SUBST(DEPCWNNJLIB)
AC_SUBST(EXTCWNNJINC)
AC_SUBST(CHINSI_DATA)
AC_SUBST(THINSI_DATA)

AC_ARG_WITH(libkwnn,
[  --with-libkwnn            use installed kWnn library [[default=no]]],
[  with_libkwnn="${withval}"], [with_libkwnn=no])
AC_ARG_WITH(kwnn-includes,
[  --with-kwnn-includes=DIR  Installed kWnn include files are in DIR],
[kwnnincludedir="-I${withval}"], [kwnnincludedir=''])
AC_ARG_WITH(kwnn-libraries,
[  --with-kwnn-libraries=DIR Search for kWnn libraries in DIR [[default=/usr/local/lib]]],
[kwnnlibdir="${withval}"], [kwnnlibdir='/usr/local/lib'])

if test X${with_libkwnn} != Xno; then
   	case X${with_libkwnn} in
	Xyes | X-lkwnn)
		KWNNJLIB="-L${kwnnlibdir} -lkwnn" ;;
	X/*)
		KWNNJLIB="${kwnnlibdir}/libkwnn.a" ;;
	*)
		# Honor specified value --with-libkwnn
		# (maybe wrong in most cases)
		KWNNJLIB="${with_libkwnn}" ;;
	esac
	DEPKWNNJLIB=""
	dnl NOTICE: KHINSI_DATA also depends on --prefix (and makerule.mk).
	KHINSI_DATA="\$(KWNNWNNDIR)/hinsi.data"
	EXTKWNNJINC=${kwnnincludedir}
else
	KWNNJLIB="\$(top_builddir)/kWnn/jlib/libkwnn.la"
	DEPKWNNJLIB="\$(KWNNJLIB)"
	KHINSI_DATA="\$(KWNNKDSRC)/hinsi.data"
	EXTKWNNJINC=""
fi
AC_SUBST(KWNNJLIB)
AC_SUBST(DEPKWNNJLIB)
AC_SUBST(EXTKWNNJINC)
AC_SUBST(KHINSI_DATA)

dnl
dnl Build Options
dnl

AC_ARG_ENABLE(ipv6,
[  --enable-ipv6           build and install IPv6 [[default=no]]],
[case "${enableval}" in
   yes) ipv6="-DINET6";;
   no)  ipv6="" ;;
   *)   AC_MSG_ERROR(bad value for --enable-ipv6) ;;
esac], ipv6="")
AC_SUBST(ipv6)

AC_ARG_ENABLE(unsafe-path,
[  --enable-unsafe-path    allow creating files in an arbitrary path [[default=no]]],
[case "${enableval}" in
   yes) unsafe_path=true;;
   no)  unsafe_path=false;;
   *)   AC_MSG_ERROR(bad value for --enable-unsafe-path) ;;
esac], unsafe_path=false)
AC_SUBST(unsafe_path)

if test ${unsafe_path} = true; then
	AC_DEFINE(WNN_ALLOW_UNSAFE_PATH, 1,
		[Define to allow writing to other than JSERVERDIR.])
fi

dnl
dnl Install layout controlling
dnl
AC_ARG_ENABLE(traditional-layout,
[  --enable-traditional-layout Install files in traditional directories [[default=yes]]],
[case "${enableval}" in
   yes) trad_layout=true ;;
   no)  trad_layout=false ;;
   *)   AC_MSG_ERROR([bad value for --enable-traditional-layout]) ;;
esac], trad_layout=true)

if test $trad_layout = "true"; then
  WNNSBINDIR="\$(bindir)"
  # More path settings will come later ...
else
  WNNSBINDIR="\$(sbindir)"
  # Same as above.
fi
AC_SUBST(WNNSBINDIR)
dnl Same as above.

AC_ARG_ENABLE(sub-bindir,
[  --enable-sub-bindir         Install executables to (ex.) $(bindir)/Wnn4 [[default=yes if --enable-traditional-layout, no otherwise]]],
[case "${enableval}" in
   yes) sub_bindir=true ;;
   no)  sub_bindir=false ;;
   *)   AC_MSG_ERROR([bad value for --enable-sub-bindir]) ;;
esac], sub_bindir=guess)

if test $sub_bindir = "guess"; then
  if test $trad_layout = "true"; then
    sub_bindir=true
  else
    sub_bindir=false
  fi
fi
if test $sub_bindir = "true"; then
  if_enable_sub_bindir=' '
  if_disable_sub_bindir='#'
else
  if_enable_sub_bindir='#'
  if_disable_sub_bindir=' '
fi
AC_SUBST(if_enable_sub_bindir)
AC_SUBST(if_disable_sub_bindir)

# for debug
AC_MSG_CHECKING([if we use traditional layout])
if test $trad_layout = "true"; then
  AC_MSG_RESULT(yes)
else
  AC_MSG_RESULT(no)
fi

AC_MSG_CHECKING([if we install binaries on \$(bindir)/Wnn4 (etc.)])
if test $sub_bindir = "true"; then
  AC_MSG_RESULT(yes)
else
  AC_MSG_RESULT(no)
fi

dnl
dnl Checks for cc and cpp.
dnl
AC_PROG_CC

dnl System specific options
dnl Now that we are using autoconf, CCOPTIONS should be nuked...
dnl But please report if your system needs specific settings (CCOPTIONS etc.)
case $host in
*-*-linux*)
    CCOPTIONS="-Dlinux -D_GNU_SOURCE -D_POSIX_SOURCE -D_BSD_SOURCE"
    ;;
*-*-*-gnu)
    # Non-Linux kernel with GNU libc.
    CCOPTIONS="-D_GNU_SOURCE"
    ;;
*-*-sunos*)
      if test $GCC = yes; then
	CCOPTIONS="-Dsun -Dsparc"
      else
        CCOPTIONS=""
      fi
      ;;
*-*-solaris2.*)
    # Will 'solaris*' be OK?
      if test $GCC = yes; then
        CCOPTIONS="-Dsun -D`uname -p` -DSVR4 -DSYSV"
      else
        # TODO: need change for sparcv9 / x64 architecture ...
        CCOPTIONS="-Xc -xF -xcg92 -Dsun -D`uname -p` -DSVR4 -DSYSV"
      fi
    ;;
*-*-hpux*)
    if test $GCC = yes; then
        CCOPTIONS="-Dhpux -DSYSV"
    else
        CCOPTIONS="-Ae -Dhpux -DSYSV"
    fi
      ;;
i[[34567]]86-pc-beos*)
	CCOPTIONS="-DBEOS -D_POSIX_SOURCE -D_BSD_SOURCE"
	;;
powerpc-*-beos*)
	CCOPTIONS="-DBEOS -D_POSIX_SOURCE -D_BSD_SOURCE"
	;;
*-*-aix*)
    CCOPTIONS="-DSYSV"
    ;;
esac

dnl Checking if we use gcc or not
if test $debug = true; then
    if test $GCC = yes; then
      # FIXME: gcc -fstack-check doesn't work well on Linux/i386 ...
      CDEBUGFLAGS=${CDEBUGFLAGS:-"-g2 -O2 -Wall"}
    else
      CDEBUGFLAGS=${CDEBUGFLAGS:-""}
    fi
    INSTPGMFLAGS=
else
    CDEBUGFLAGS=${CDEBUGFLAGS:-""}
    INSTPGMFLAGS="-s"
fi
AC_SUBST(CCOPTIONS)
AC_SUBST(CDEBUGFLAGS)
AC_SUBST(INSTPGMFLAGS)

echo "Set CDEBUGFLAGS and CCOPTIONS to following:"
echo '  CDEBUGFLAGS="'"$CDEBUGFLAGS"'"'
echo '    CCOPTIONS="'"$CCOPTIONS"'"'

dnl ưǧǷꤵ줿ʤconfigure˴ĶѿCPPꤻ衣
dnl ΰ֤ʤФޤƥͭʬCPP򥪡Х饤ɤǤ뤬
dnl CPP=${CPP:-"/usr/ccs/lib/cpp"}פΤȤ桼ΰջ֤ºŤ
dnl 褤Ȼפ롣
AC_PROG_CPP

dnl Define cpp for text processing.
AC_MSG_CHECKING([cpp for text processing])
if test "$GCC" = "yes" -a "$CPP" = "$CC -E"; then
  # Need checking your gcc accepts '-traditional-cpp' option?
  FZK_PP=${FZK_PP:-"$CPP -traditional-cpp"}
else
  FZK_PP=${FZK_PP:-"$CPP"}
fi
AC_MSG_RESULT($FZK_PP)
AC_SUBST(FZK_PP)

dnl
dnl Checks for programs.
dnl
dnl ### AC_PROG_YACC
dnl ### AC_PROG_LEX
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL
AC_SUBST(LIBTOOL_DEPS)

# Libtool-2.4 needs more powerful shell (other than /bin/sh),
# so we explicitly use this SHELL directly.
LIBTOOL_MOD=`echo $LIBTOOL | sed 's,\$(SHELL),'${SHELL}','`
AC_SUBST(LIBTOOL_MOD)

dnl Checks for libraries.
dnl ### dnl Replace `main' with a function in -lX11:
dnl ### AC_CHECK_LIB(X11, main)

AC_SEARCH_LIBS(crypt, crypt)
AC_CHECK_LIB(socket, connect)
AC_CHECK_LIB(bind, getservbyname)
AC_SEARCH_LIBS(gethostbyname, nsl)
dnl libutil only needed by uum w/openpty...
dnl FIXME: deals with Linux that have both ptsname & openpty
AC_CHECK_LIB(util, openpty)

dnl
dnl Checks for header files.
dnl
dnl disabled for now ...: dnl AC_PATH_X
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
AC_CHECK_HEADERS(fcntl.h syslog.h unistd.h utmp.h utmpx.h \
	sys/file.h sys/ioctl.h sys/time.h sys/types.h sys/param.h \
	malloc.h strings.h memory.h \
	curses.h ncurses.h sgtty.h term.h termio.h termios.h \
	termcap.h sys/termio.h libutil.h\
)

dnl
dnl Terminal library selection.
dnl ported from vim6.1 via canuum (Canna 3.6p3) for uum.
dnl FIXME: cross compilation
dnl
olibs="$LIBS"
CNVFILE_SUBDIR=bsd
AC_MSG_CHECKING(--with-term-libs argument)
AC_ARG_WITH(tlib,
[  --with-term-libs=-lLIB  terminal library to be used ],)
if test -n "$with_term_libs"; then
  AC_MSG_RESULT($with_term_libs)
dnl  LIBS="$LIBS $with_term_libs"
  TERMLIB=$with_term_libs
else
  AC_MSG_RESULT([automatic terminal library selection])
  dnl  On HP-UX 10.10 termcap or termlib should be used instead of
  dnl  curses, because curses is much slower.
  dnl  Newer versions of ncurses are preferred over anything.
  dnl  Older versions of ncurses have bugs, get a new one!
  dnl  Digital Unix (OSF1) should use curses (Ronald Schild).
  case "`uname -s 2>/dev/null`" in
	OSF1)	tlibs="ncurses curses termlib termcap";;
	*)	tlibs="ncurses termlib termcap curses";;
  esac
 for libname in $tlibs; do
    AC_CHECK_LIB(${libname}, tgetent, [
      dnl It's possible that a library is found but it doesn't work
      dnl e.g., shared library that cannot be found.
      dnl compile and run a test program to be sure
      LIBS="${LIBS} -l${libname}"
      AC_TRY_RUN([
#ifdef HAVE_TERMCAP_H
# include <termcap.h>
#endif
#include <stdlib.h>
main() {char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(0); }],
	res="OK", res="FAIL", res="FAIL")
      if test "$res" = "OK"; then
	TERMLIB="${TERMLIB} -l${libname}"
	dnl lname=`echo ${libname} | sed 'y/termcaplibnus/TERMCAPLIBNUS/'`
	dnl AC_DEFINE_UNQUOTED(HAVE_${lname}, 1, [use ${libname} for terminal control])
	dnl We need to define AH_TEMPLATE (if we really need this)
	dnl ex. AH_TEMPLATE(HAVE_NCURSES, [use ncurses for terminal control])
	break
      fi
      AC_MSG_RESULT($libname library is not usable)
      ],)
    LIBS=${olibs}
  done
fi
if test "x$TERMLIB" != "x"; then
  LIBS="${LIBS} ${TERMLIB}"
  AC_MSG_CHECKING(whether we talk terminfo)
  AC_TRY_RUN([
#ifdef HAVE_TERMCAP_H
# include <termcap.h>
#endif
#include <stdlib.h>
#include <string.h>
main()
{char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(!strcmp(s==0 ? "" : s, "1")); }],
	[ AC_MSG_RESULT([no -- we are in termcap land])
	  CNVFILE_SUBDIR=bsd ],
	[ AC_DEFINE(HAVE_TERMINFO, 1, [terminfo spoken here])
	  AC_MSG_RESULT([yes -- terminfo spoken here])
	  CNVFILE_SUBDIR=sysV ],
	AC_MSG_ERROR(failed to compile test program.))
else
  AC_MSG_RESULT(none found)
fi
LIBS=${olibs}
AC_SUBST(TERMLIB)
AC_SUBST(CNVFILE_SUBDIR)

dnl
dnl Checks for typedefs, structures, and compiler characteristics.
dnl
AC_TYPE_MODE_T
AC_HEADER_TIME

dnl AC_CHECK_TYPES(time_t,,
dnl	AC_DEFINE(time_t, long, [Define missing time_t.]),
dnl		[INCLUDES = time.h])
AC_CHECK_TYPES(socklen_t,,
		AC_DEFINE(socklen_t, int, [Define missing socklen_t.]), [
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <sys/socket.h>])

AC_CHECK_MEMBERS([struct utmp.ut_user, struct utmp.ut_name, struct utmp.ut_id],,,[
#include <sys/types.h>
#if HAVE_UTMPX_H
#  include <utmpx.h>
#endif
#if HAVE_UTMP_H
#  include <utmp.h>
#endif])

dnl
dnl Checks for symbol
dnl

dnl
dnl Checks for library functions.
dnl
AC_PROG_GCC_TRADITIONAL

dnl idea borrowed from EB Library http://www.sra.co.jp/people/m-kasahr/eb/
AC_TYPE_SIGNAL
if test "$ac_cv_type_signal" = void; then
  AC_DEFINE(RETSIGTYPE_VOID, 1, [Define if the signal function returns void.])
fi

AC_FUNC_MEMCMP
AC_CHECK_FUNCS(getpgid getpgrp setpgrp wait3)
AC_FUNC_GETPGRP
AC_FUNC_SETPGRP
dnl FreeWnn do not use the 3rd parameter of wait3().
dnl AC_FUNC_WAIT3

dnl NOTE: FD_SET is defined as macro on many systems. But this check
dnl	  will be done in Wnn/include/wnn_os.h , so don't care...
AC_CHECK_FUNCS(random drand48 fchmod getopt killpg \
	FD_SET \
	gethostname select socket closesocket setsockopt send recv \
	getdtablesize getrlimit syslog vsyslog setenv snprintf \
	ptsname posix_openpt openpty pututxline pututline setsid)
dnl for bcopy/index -> memcpy/strchr conversion (preparation):
AC_CHECK_FUNCS(bcopy bzero bcmp index rindex \
	memcpy memmove memset strchr strrchr)

dnl Check fallback functions for jserver (should use AC_REPLACE_FUNCS?)
JS_SUPPORTOBJS=
AC_CHECK_FUNCS(mkdir vasprintf, ,
[JS_SUPPORTOBJS="${JS_SUPPORTOBJS} ${ac_func}.o"])
AC_SUBST(JS_SUPPORTOBJS)

dnl delayed check for --enable-client-utmp
if test $client = true; then
  if test $client_utmp = auto; then
    AC_EGREP_CPP(yes, [
#if HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
#if defined(BSD) && (BSD >= 199306) && !defined(HAVE_PUTUTXLINE) && !defined(HAVE_PUTUTLINE)
   yes
#endif
    ], client_utmp=false, client_utmp=true)
  fi

  dnl for Debug
  AC_MSG_CHECKING([whether we're using utmp with uum])
  if test $client_utmp = true; then
    dnl We need to look again if we introduce libspt check 
    AC_DEFINE(USE_UTMP, 1, [Define to 1 if uum writes utmp entry])
    AC_MSG_RESULT(yes)
  else
    AC_MSG_RESULT(no)
  fi
fi

dnl delayed check for --enable-client-set[ug]id
if test $client = true; then
  guess_setuid=
  guess_setgid=false
  dnl Note: (HAVE_OPENPTY && defined(TIOCPTMGET)): for recent OpenBSD 
  if test $client_utmp = true; then
    AC_EGREP_CPP(yes, [
#if HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
#endif
#if HAVE_PTSNAME || (HAVE_OPENPTY && defined(TIOCPTMGET))
# if HAVE_PUTUTLINE || HAVE_PUTUTXLINE
  yes
# endif
#endif
    ], [
    case $host_os in
    linux*)
      # On recent Linux, it has both ptsname() and putut*line().
      # But putut*line() will take effect only if prog is installed
      # with set-gid to group utmp.
      guess_setgid=true
      UUMGROUP=${UUMGROUP:-utmp}
      ;;
    esac
    guess_setuid=false
    ], guess_setuid=true)
  else
    # $client_utmp != true
    AC_EGREP_CPP(yes, [
#if HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
#endif
#if HAVE_PTSNAME || (HAVE_OPENPTY && defined(TIOCPTMGET))
  yes
#endif
    ], guess_setuid=false, guess_setuid=true)
  fi
  # $client_utmp != true

  if test $client_setuid = auto; then
    client_setuid=$guess_setuid
    # UUMOWNER is already set ...
  fi
  if test $client_setgid = auto; then
    client_setgid=$guess_setgid
    # UUMGROUP is already set (if it needs)
  fi

  dnl set install flag (at last)
  if test $client_setuid = true; then
    INSTUUMFLAGS="-o \$(UUMOWNER)"
    if test $client_setgid = true; then
      INSTUUMFLAGS="-m 6711 $INSTUUMFLAGS -g \$(UUMGROUP)"
    else
    # client_setuid && !client_setgid
      INSTUUMFLAGS="-m 4711 $INSTUUMFLAGS"
    fi
  else
    if test $client_setgid = true; then
    # !client_setuid && client_setgid
      INSTUUMFLAGS="-m 2711 -g \$(UUMGROUP)"
    else
    # !client_setuid && !client_setgid
      INSTUUMFLAGS="-m 0711"
    fi
  fi

  dnl for Debug
  AC_MSG_CHECKING([whether we need to install uum as setuid program])
  if test $client_setuid = true; then
    AC_MSG_RESULT([yes, $UUMOWNER])
  else
    AC_MSG_RESULT(no)
  fi
  AC_MSG_CHECKING([whether we need to install uum as setgid program])
  if test $client_setgid = true; then
    AC_MSG_RESULT([yes, $UUMGROUP])
  else
    AC_MSG_RESULT(no)
  fi
else
# $client != true
  INSTUUMFLAGS="-m 4711 -o \$(UUMOWNER)"
fi
# $client = true

AC_SUBST(INSTUUMFLAGS)
AC_SUBST(UUMOWNER)
AC_SUBST(UUMGROUP)

dnl
dnl File Existence
dnl Checking file at compile time may bring false result when cross-
dnl compiling. So, one have to check generated config.h and edit it
dnl if necessary after running configure.
dnl
dnl AC_CHECK_FILE(/dev/ptmx, AC_DEFINE(HAVE_DEV_PTMX, 1, [/dev/ptmx found]),)
AC_CHECK_FILES(/dev/ptmx,,)


dnl
dnl FIXME: libspt support
dnl for example:
dnl
dnl --with-libspt[=/path/to/libspt-config]
dnl
dnl LIBSPT_CFLAGS=`/path/to/libspt-config --cflags`
dnl LIBSPT_LIBS=`/path/to/libspt-config --libs`
dnl AC_SUBST(LIBSPT_CFLAGS)
dnl AC_SUBST(LIBSPT_LIBS)
dnl AC_DEFINE(HAVE_LIBSPT, 1, [Define if you have libspt support.])

dnl
dnl TCP Wrapper.
dnl
WRAPLIB=
AC_MSG_CHECKING(whether to use libwrap)
AC_ARG_WITH(libwrap,
	[  --with-libwrap[[=DIR]]    Compile in libwrap (tcp_wrappers) support [[default=try to find libwrap]]],
	[ case "$withval" in
	  no)
	    AC_MSG_RESULT(no)
	    WRAP_TRY=no
	    ;;
	  yes)
	    AC_MSG_RESULT(yes)
	    WRAP_TRY=yes
	    ;;
	  *)
	    AC_MSG_RESULT(yes)
	    WRAP_TRY=yes
	    if test -d "$withval"; then
	      WRAPINCLUDES="-I$withval"
	      if test -d $withval/include; then
		WRAPINCLUDES="-I$withval/include $WRAPINCLUDES"
	      fi
	      WRAPLIB="-L$withval -lwrap"
	      if test -d $withval/lib; then
		WRAPLIB="-L$withval/lib $WRAPLIB"
	      fi
	    else
	      WRAPINCLUDES="$withval"
	    fi
	    ;;
	esac],
	[AC_MSG_RESULT([try to find])
	 WRAP_TRY=auto]
)
# Link test for libwrap
if test "$WRAP_TRY" = yes -o "$WRAP_TRY" = auto; then
    OLDCFLAGS="$CFLAGS"
    CFLAGS="$WRAPINCLUDES $CFLAGS"
    OLDLIBS="$LIBS"
    WRAPLIB=${WRAPLIB:-"-lwrap"}
    LIBS="$WRAPLIB $OLDLIBS"
    AC_MSG_CHECKING([libwrap is working])
    AC_TRY_LINK([#include <tcpd.h>
		 int allow_severity;
		 int deny_severity; ],
		[ hosts_access(); ],
		[ AC_MSG_RESULT(yes)
		  AC_DEFINE(HAVE_LIBWRAP, 1,
		           [Define if you have libwrap (TCP wrapper) support.])
		  AC_SUBST(WRAPLIB)],
		[ AC_MSG_RESULT(no)
		  if test "$WRAP_TRY" = yes; then
		    AC_MSG_ERROR([Could not find libwrap. Please check config.log.])
		  else
		    # recover old flag / clear needless WRAPLIB and continue
		    CFLAGS=$OLDCFLAGS
		    WRAPLIB=
		  fi] )
    # only jserver needs libwrap, recover LIBS also
    LIBS=$OLDLIBS
fi


dnl
dnl Creating Makefiles.
dnl
# mkdir -p Contrib/dic/gerodic in case builddir != srcdir
dir=Contrib/dic/gerodic
if test ! -d $dir; then
  echo "creating $dir ..."
  $ac_install_sh -d $dir
fi

dnl
dnl Generate Makefiles
dnl

dnl Generic

makefiles_generic="makerule.mk Makefile"

dnl Japanese

if test "x${Wnn}" = "xWnn"; then
  makefiles_wnn="Wnn/Makefile Wnn/conv/Makefile Wnn/include/Makefile \
	Wnn/jd/Makefile Wnn/jd/rk/Makefile Wnn/jd/rk.vi/Makefile \
	Wnn/jlib/Makefile Wnn/jlib.V3/Makefile Wnn/jserver/Makefile \
	Wnn/jutil/Makefile Wnn/ld/Makefile Wnn/ld/rk/Makefile \
	Wnn/romkan/Makefile Wnn/uum/Makefile \
	Wnn/man/Makefile Wnn/man/2.env/Makefile Wnn/man/3.libwnn/Makefile \
	Wnn/man/4.cmd/Makefile Wnn/man/6.jutil/Makefile \
	Wnn/man/2.env/dic/Makefile Wnn/man/2.env/wnn/Makefile \
	Wnn/man/3.libwnn/jl_lib/Makefile Wnn/man/3.libwnn/js_lib/Makefile \
	Wnn/man/3.libwnn/misc_lib/Makefile Wnn/man/3.libwnn/rk_lib/Makefile"
  makefiles_wnn_dic="Contrib/dic/gerodic/Makefile Wnn/pubdicplus/Makefile \
	Wnn/wnncons/Makefile Wnn/wnncons/dic/Makefile"
fi

dnl Chinese and Taiwanese

if test "x$cWnn" = "xcWnn"; then
  makefiles_cwnn="cWnn/Makefile cWnn/conv/Makefile cWnn/etc/Makefile \
	cWnn/cd/Makefile cWnn/cd/rk/Makefile \
	cWnn/cd/rk_p/Makefile cWnn/cd/rk_z/Makefile \
	cWnn/td/Makefile cWnn/td/rk/Makefile \
	cWnn/td/rk_z/Makefile cWnn/td/rk_p/Makefile \
	cWnn/include/Makefile cWnn/jlib/Makefile \
	cWnn/jserver/Makefile cWnn/jutil/Makefile \
	cWnn/man/Makefile cWnn/man/1.intro/Makefile cWnn/man/2.env/Makefile \
	cWnn/man/4.cmd/Makefile cWnn/man/6.jutil/Makefile \
	cWnn/romkan/Makefile cWnn/uum/Makefile"
  makefiles_cwnn_dic="cWnn/cdic/Makefile cWnn/tdic/Makefile"
fi

dnl Korean

if test "x$kWnn" = "xkWnn"; then
  makefiles_kwnn="kWnn/Makefile kWnn/conv/Makefile kWnn/etc/Makefile \
	kWnn/include/Makefile kWnn/jlib/Makefile kWnn/jutil/Makefile \
	kWnn/jserver/Makefile kWnn/kd/Makefile kWnn/kd/rk/Makefile \
	kWnn/romkan/Makefile kWnn/uum/Makefile"
  makefiles_kwnn_dic="kWnn/kdic/Makefile"
fi

AC_OUTPUT(${makefiles_generic} \
	${makefiles_wnn} ${makefiles_wnn_dic} \
	${makefiles_cwnn} ${makefiles_cwnn_dic} \
	${makefiles_kwnn} ${makefiles_kwnn_dic})