1#
2# configure for Namazu
3#
4# Created  by Satoru Takabayashi <satoru@isoternet.org> [1998/10/09]
5# Modified by SATOH Fumiyasu <fumiya@cij.co.jp> [1998/12/05]
6# Modified by Satoru Takabayashi <satoru@isoternet.org> [1998/12/06]
7#
8
9dnl Process this file with autoconf to produce a configure script.
10AC_INIT(cgi.c)
11
12# Do you wish?
13#PATH=/bin:/usr/bin:/usr/sbin:/usr/local/bin:$PATH
14
15# This option requires config.guess, config.sub and install-sh
16#AC_CANONICAL_SYSTEM
17
18dnl Checks for programs.
19AC_PROG_CC
20
21if test -n "$GCC"; then
22    CFLAGS="$CFLAGS -Wall"
23fi
24
25dnl Checks for libraries.
26dnl Replace `main' with a function in -lm:
27AC_CHECK_LIB(m, main)
28
29dnl Checks for header files.
30AC_HEADER_STDC
31AC_CHECK_HEADERS(fcntl.h unistd.h)
32
33dnl Checks for typedefs, structures, and compiler characteristics.
34AC_C_CONST
35AC_TYPE_PID_T
36AC_TYPE_SIZE_T
37
38dnl Checks for library functions.
39AC_FUNC_ALLOCA
40AC_FUNC_MEMCMP
41AC_CHECK_FUNCS(re_comp memmove)
42
43dnl CGI directory
44CGIDIR=/cgi-bin
45AC_SUBST(CGIDIR)
46AC_ARG_WITH(
47        cgi_dir,
48	[  --with-cgi-dir=DIR      set CGI directory [/usr/local/etc/httpd/cgi-bin]],
49	CGIDIR=$with_cgi_dir,
50)
51
52ADMIN=webmaster@foobar.jp
53AC_ARG_WITH(
54	admin,
55	[  --with-admin=EMAIL      set webmaster's email address [webmaster@foobar.jp]],
56	echo "webmaster's email address is set to $with_admin"
57	ADMIN=$with_admin,
58)
59AC_SUBST(ADMIN)
60
61dnl Checks for external commands
62
63AC_ARG_WITH(
64	perl5,
65	[  --with-perl5=PATH       set perl ver.5 interpreter location [search path]],
66	echo using $with_perl5 for perl5
67	PERL=$with_perl5,
68	[AC_PATH_PROGS(PERL, perl5 perl, not_found)]
69)
70if test "$PERL" = "not_found" || $PERL -e 'exit ($] >= 5)'; then
71    AC_MSG_ERROR(perl(ver.5) interpreter required)
72fi
73
74AC_ARG_WITH(
75	japanese,
76	[  --without-japanese      don't treat Japanese code],
77	USE_JAPANESE=$withval,
78	USE_JAPANESE=yes
79)
80
81# --without-japanese
82if test "$USE_JAPANESE" = "no"; then
83    LANGUAGE=en
84    AC_SUBST(LANGUAGE)
85    WAKATI_DEFAULT=NONE
86    AC_SUBST(WAKATI_DEFAULT)
87else
88    LANGUAGE=ja
89    AC_SUBST(LANGUAGE)
90    AC_ARG_WITH(
91	    lang,
92	    [  --with-lang=language    set default LANGUAGE code (ja or en) [ja]],
93	    LANGUAGE=$with_lang,
94    )
95
96    AC_ARG_WITH(
97	    nkf,
98	    [  --with-nkf=PATH         set nkf command location [search path]],
99	    echo using $with_nkf for nkf
100	    NKF=$with_nkf,
101	    [AC_PATH_PROG(NKF,nkf, not_found)]
102    )
103    if test "$NKF" = "not_found"; then
104	AC_MSG_ERROR(NKF (network kanji filter) not found to treat Japanese code)
105    fi
106
107    AC_ARG_WITH(
108	    kakasi,
109	    [  --with-kakasi=PATH      set kakasi command location [search path]],
110	    echo using $with_kakasi for kakasi
111	    KAKASI=$with_kakasi,
112	    [AC_PATH_PROG(KAKASI,kakasi, not_found)]
113    )
114    AC_ARG_WITH(
115	    chasen,
116	    [  --with-chasen=PATH      set chasen command location [search path]],
117	    echo using $with_chasen for chasen
118	    CHASEN=$with_chasen,
119	    [AC_PATH_PROG(CHASEN,chasen, not_found)]
120    )
121    if test "$KAKASI" = "not_found" -a "$CHASEN" = "not_found"; then
122	AC_MSG_ERROR(KAKASI or ChaSen required to treat Japanese code)
123    fi
124
125    WAKATI_DEFAULT=
126    if test "$KAKASI" != "not_found"; then
127	WAKATI_DEFAULT=KAKASI
128    fi
129    if test "$CHASEN" != "not_found"; then
130	WAKATI_DEFAULT=CHASEN
131    fi
132    AC_SUBST(WAKATI_DEFAULT)
133fi
134
135AC_PATH_PROG(ZCAT, zcat, not_found)
136if test "$ZCAT" = "not_found"; then
137    AC_MSG_WARN(zcat not found)
138fi
139AC_PATH_PROGS(GROFF, jgroff groff nroff, not_found)
140if test "$GROFF" = "not_found"; then
141    AC_MSG_WARN(jgroff(, groff and nroff) not found)
142else
143    # nroff
144    GROFF_OPT=
145    # groff
146    if $GROFF -man -Tascii </dev/null 2>/dev/null; then
147	GROFF_OPT=-Tascii
148    fi
149    # jgroff
150    if $GROFF -man -Tnippon </dev/null 2>/dev/null; then
151	GROFF_OPT=-Tnippon
152    fi
153    AC_SUBST(GROFF_OPT)
154fi
155
156AC_OUTPUT(Makefile)
157
158