blob: 1ebf82c187ca08493c08ebd40e616dc6b00483a6 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001dnl configure.in: autoconf script for Vim
2
3dnl Process this file with autoconf 2.12 or 2.13 to produce "configure".
4dnl Should also work with autoconf 2.54 and later.
5
6AC_INIT(vim.h)
7AC_CONFIG_HEADER(auto/config.h:config.h.in)
8
9dnl Being able to run configure means the system is Unix (compatible).
10AC_DEFINE(UNIX)
11AC_PROG_MAKE_SET
12
13dnl Checks for programs.
14AC_PROG_CC dnl required by almost everything
15AC_PROG_CPP dnl required by header file checks
16AC_PROGRAM_EGREP dnl required by AC_EGREP_CPP
17AC_ISC_POSIX dnl required by AC_C_CROSS
18AC_PROG_AWK dnl required for "make html" in ../doc
19
20dnl Don't strip if we don't have it
21AC_CHECK_PROG(STRIP, strip, strip, :)
22
23dnl Check for extention of executables
24AC_EXEEXT
25
26dnl Set default value for CFLAGS if none is defined or it's empty
27if test -z "$CFLAGS"; then
28 CFLAGS="-O"
29 test "$GCC" = yes && CFLAGS="-O2 -fno-strength-reduce -Wall"
30fi
31if test "$GCC" = yes; then
32 gccversion=`"$CC" --version | sed -e '2,$d;s/^[[^0-9]]*\([[0-9]]\.[[0-9.]]*\).*$/\1/g'`
33 if test "$gccversion" = "3.0.1" -o "$gccversion" = "3.0.2"; then
34 echo 'GCC 3.0.x has a bug in the optimizer, disabling "-O#"'
35 CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-O/'`
36 else
37 if test "$gccversion" = "3.1" -o "$gccversion" = "3.2" -o "$gccversion" = "3.2.1" && `echo "$CFLAGS" | grep -v fno-strength-reduce >/dev/null`; then
38 echo 'GCC 3.1 and 3.2 have a bug in the optimizer, adding "-fno-strength-reduce"'
39 CFLAGS="$CFLAGS -fno-strength-reduce"
40 fi
41 fi
42fi
43
44dnl If configure thinks we are cross compiling, there is probably something
45dnl wrong with the CC or CFLAGS settings, give an understandable error message
46if test "$cross_compiling" = yes; then
47 AC_MSG_ERROR([cannot compile a simple program, check CC and CFLAGS
48 (cross compiling doesn't work)])
49fi
50
51dnl gcc-cpp has the wonderful -MM option to produce nicer dependencies
52test "$GCC" = yes && CPP_MM=M; AC_SUBST(CPP_MM)
53
54if test -f ./toolcheck; then
55 AC_CHECKING(for buggy tools)
56 sh ./toolcheck 1>&AC_FD_MSG
57fi
58
59OS_EXTRA_SRC=""; OS_EXTRA_OBJ=""
60
61dnl Check for BeOS, which needs an extra source file
62AC_MSG_CHECKING(for BeOS)
63case `uname` in
64 BeOS) OS_EXTRA_SRC=os_beos.c; OS_EXTRA_OBJ=objects/os_beos.o
65 BEOS=yes; AC_MSG_RESULT(yes);;
66 *) BEOS=no; AC_MSG_RESULT(no);;
67esac
68
69dnl If QNX is found, assume we don't want to use Xphoton
70dnl unless it was specifically asked for (--with-x)
71AC_MSG_CHECKING(for QNX)
72case `uname` in
73 QNX) OS_EXTRA_SRC=os_qnx.c; OS_EXTRA_OBJ=objects/os_qnx.o
74 test -z "$with_x" && with_x=no
75 QNX=yes; AC_MSG_RESULT(yes);;
76 *) QNX=no; AC_MSG_RESULT(no);;
77esac
78
79dnl Check for Darwin and MacOS X
80dnl We do a check for MacOS X in the very beginning because there
81dnl are a lot of other things we need to change besides GUI stuff
82DEFAULT_VIMNAME=vim
83AC_MSG_CHECKING([for Darwin (Mac OS X)])
84if test "`(uname) 2>/dev/null`" = Darwin; then
85 AC_MSG_RESULT(yes)
86
87 AC_MSG_CHECKING(--disable-darwin argument)
88 AC_ARG_ENABLE(darwin,
89 [ --disable-darwin Disable Darwin (Mac OS X) support.],
90 , [enable_darwin="yes"])
91 if test "$enable_darwin" = "yes"; then
92 AC_MSG_RESULT(no)
93 AC_MSG_CHECKING(if Darwin files are there)
94 if test -f os_macosx.c; then
95 AC_MSG_RESULT(yes)
96 else
97 AC_MSG_RESULT([no, Darwin support disabled])
98 enable_darwin=no
99 fi
100 else
101 AC_MSG_RESULT([yes, Darwin support excluded])
102 fi
103
104 if test "$enable_darwin" = "yes"; then
105 MACOSX=yes
106 OS_EXTRA_SCR="os_macosx.c";
107 OS_EXTRA_OBJ="objects/os_macosx.o"
108 CPPFLAGS="$CPPFLAGS -DMACOS_X_UNIX -I/Developer/Headers/FlatCarbon -no-cpp-precomp"
109
110 dnl If Carbon is found, assume we don't want X11
111 dnl unless it was specifically asked for (--with-x)
112 AC_CHECK_HEADER(Carbon/Carbon.h, CARBON=yes)
113 if test "x$CARBON" = "xyes"; then
114 if test -z "$with_x"; then
115 with_x=no
116 DEFAULT_VIMNAME=Vim
117 fi
118 fi
119 fi
120else
121 AC_MSG_RESULT(no)
122fi
123
124AC_SUBST(OS_EXTRA_SRC)
125AC_SUBST(OS_EXTRA_OBJ)
126
127dnl Add /usr/local/lib to $LDFLAGS and /usr/local/include to CFLAGS.
128dnl Only when the directory exists and it wasn't there yet.
129dnl For gcc don't do this when it is already in the default search path.
130have_local_include=''
131have_local_lib=''
132if test "$GCC" = yes; then
133 echo 'void f(){}' > conftest.c
134 dnl -no-cpp-precomp is needed for OS X 10.2 (Ben Fowler)
135 have_local_include=`${CC-cc} -no-cpp-precomp -c -v conftest.c 2>&1 | grep '/usr/local/include'`
136 have_local_lib=`${CC-cc} -c -v conftest.c 2>&1 | grep '/usr/local/lib'`
137 rm -f conftest.c conftest.o
138fi
139if test -z "$have_local_lib" -a -d /usr/local/lib; then
140 tt=`echo "$LDFLAGS" | sed -e 's+-L/usr/local/lib ++g' -e 's+-L/usr/local/lib$++g'`
141 if test "$tt" = "$LDFLAGS"; then
142 LDFLAGS="$LDFLAGS -L/usr/local/lib"
143 fi
144fi
145if test -z "$have_local_include" -a -d /usr/local/include; then
146 tt=`echo "$CPPFLAGS" | sed -e 's+-I/usr/local/include ++g' -e 's+-I/usr/local/include$++g'`
147 if test "$tt" = "$CPPFLAGS"; then
148 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
149 fi
150fi
151
152AC_MSG_CHECKING(--with-vim-name argument)
153AC_ARG_WITH(vim-name, [ --with-vim-name=NAME what to call the Vim executable],
154 VIMNAME="$withval"; AC_MSG_RESULT($VIMNAME),
155 VIMNAME="$DEFAULT_VIMNAME"; AC_MSG_RESULT(Defaulting to $VIMNAME))
156AC_SUBST(VIMNAME)
157AC_MSG_CHECKING(--with-ex-name argument)
158AC_ARG_WITH(ex-name, [ --with-ex-name=NAME what to call the Ex executable],
159 EXNAME="$withval"; AC_MSG_RESULT($EXNAME),
160 EXNAME="ex"; AC_MSG_RESULT(Defaulting to ex))
161AC_SUBST(EXNAME)
162AC_MSG_CHECKING(--with-view-name argument)
163AC_ARG_WITH(view-name, [ --with-view-name=NAME what to call the View executable],
164 VIEWNAME="$withval"; AC_MSG_RESULT($VIEWNAME),
165 VIEWNAME="view"; AC_MSG_RESULT(Defaulting to view))
166AC_SUBST(VIEWNAME)
167
168AC_MSG_CHECKING(--with-global-runtime argument)
169AC_ARG_WITH(global-runtime, [ --with-global-runtime=DIR global runtime directory in 'runtimepath'],
170 AC_MSG_RESULT($withval); AC_DEFINE_UNQUOTED(RUNTIME_GLOBAL, "$withval"),
171 AC_MSG_RESULT(no))
172
173AC_MSG_CHECKING(--with-modified-by argument)
174AC_ARG_WITH(modified-by, [ --with-modified-by=NAME name of who modified a release version],
175 AC_MSG_RESULT($withval); AC_DEFINE_UNQUOTED(MODIFIED_BY, "$withval"),
176 AC_MSG_RESULT(no))
177
178dnl Check for EBCDIC stolen from the LYNX port to OS390 Unix
179AC_MSG_CHECKING(if character set is EBCDIC)
180AC_TRY_COMPILE([ ],
181[ /* TryCompile function for CharSet.
182 Treat any failure as ASCII for compatibility with existing art.
183 Use compile-time rather than run-time tests for cross-compiler
184 tolerance. */
185#if '0'!=240
186make an error "Character set is not EBCDIC"
187#endif ],
188[ # TryCompile action if true
189cf_cv_ebcdic=yes ],
190[ # TryCompile action if false
191cf_cv_ebcdic=no])
192# end of TryCompile ])
193# end of CacheVal CvEbcdic
194AC_MSG_RESULT($cf_cv_ebcdic)
195case "$cf_cv_ebcdic" in #(vi
196 yes) AC_DEFINE(EBCDIC)
197 line_break='"\\n"'
198 ;;
199 *) line_break='"\\012"';;
200esac
201AC_SUBST(line_break)
202
203if test "$cf_cv_ebcdic" = "yes"; then
204dnl If we have EBCDIC we most likley have OS390 Unix, let's test it!
205AC_MSG_CHECKING(for OS/390 Unix)
206case `uname` in
207 OS/390) OS390Unix="yes";
208 dnl If using cc the environment variable _CC_CCMODE must be
209 dnl set to "1", so that some compiler extensions are enabled.
210 dnl If using c89 the environment variable is named _CC_C89MODE.
211 dnl Note: compile with c89 never tested.
212 if test "$CC" = "cc"; then
213 ccm="$_CC_CCMODE"
214 ccn="CC"
215 else
216 if test "$CC" = "c89"; then
217 ccm="$_CC_C89MODE"
218 ccn="C89"
219 else
220 ccm=1
221 fi
222 fi
223 if test "$ccm" != "1"; then
224 echo ""
225 echo "------------------------------------------"
226 echo " On OS/390 Unix, the environment variable"
227 echo " __CC_${ccn}MODE must be set to \"1\"!"
228 echo " Do:"
229 echo " export _CC_${ccn}MODE=1"
230 echo " and then call configure again."
231 echo "------------------------------------------"
232 exit 1
233 fi
234 CFLAGS="$CFLAGS -D_ALL_SOURCE"; LDFLAGS="$LDFLAGS -Wl,EDIT=NO"
235 AC_MSG_RESULT(yes)
236 ;;
237 *) OS390Unix="no";
238 AC_MSG_RESULT(no)
239 ;;
240esac
241fi
242
243
244dnl Check user requested features.
245
246AC_MSG_CHECKING(--with-features argument)
247AC_ARG_WITH(features, [ --with-features=TYPE tiny, small, normal, big or huge (default: normal)],
248 features="$withval"; AC_MSG_RESULT($features),
249 features="normal"; AC_MSG_RESULT(Defaulting to normal))
250
251dovimdiff=""
252dogvimdiff=""
253case "$features" in
254 tiny) AC_DEFINE(FEAT_TINY) ;;
255 small) AC_DEFINE(FEAT_SMALL) ;;
256 normal) AC_DEFINE(FEAT_NORMAL) dovimdiff="installvimdiff";
257 dogvimdiff="installgvimdiff" ;;
258 big) AC_DEFINE(FEAT_BIG) dovimdiff="installvimdiff";
259 dogvimdiff="installgvimdiff" ;;
260 huge) AC_DEFINE(FEAT_HUGE) dovimdiff="installvimdiff";
261 dogvimdiff="installgvimdiff" ;;
262 *) AC_MSG_RESULT([Sorry, $features is not supported]) ;;
263esac
264
265AC_SUBST(dovimdiff)
266AC_SUBST(dogvimdiff)
267
268AC_MSG_CHECKING(--with-compiledby argument)
269AC_ARG_WITH(compiledby, [ --with-compiledby=NAME name to show in :version message],
270 compiledby="$withval"; AC_MSG_RESULT($withval),
271 compiledby=""; AC_MSG_RESULT(no))
272AC_SUBST(compiledby)
273
274AC_MSG_CHECKING(--disable-xsmp argument)
275AC_ARG_ENABLE(xsmp,
276 [ --disable-xsmp Disable XSMP session management],
277 , enable_xsmp="yes")
278
279if test "$enable_xsmp" = "yes"; then
280 AC_MSG_RESULT(no)
281 AC_MSG_CHECKING(--disable-xsmp-interact argument)
282 AC_ARG_ENABLE(xsmp-interact,
283 [ --disable-xsmp-interact Disable XSMP interaction],
284 , enable_xsmp_interact="yes")
285 if test "$enable_xsmp_interact" = "yes"; then
286 AC_MSG_RESULT(no)
287 AC_DEFINE(USE_XSMP_INTERACT)
288 else
289 AC_MSG_RESULT(yes)
290 fi
291else
292 AC_MSG_RESULT(yes)
293fi
294
295AC_MSG_CHECKING(--enable-perlinterp argument)
296AC_ARG_ENABLE(perlinterp,
297 [ --enable-perlinterp Include Perl interpreter.], ,
298 [enable_perlinterp="no"])
299AC_MSG_RESULT($enable_perlinterp)
300if test "$enable_perlinterp" = "yes"; then
301 AC_SUBST(vi_cv_path_perl)
302 AC_PATH_PROG(vi_cv_path_perl, perl)
303 if test "X$vi_cv_path_perl" != "X"; then
304 AC_MSG_CHECKING(Perl version)
305 if $vi_cv_path_perl -e 'require 5.003_01' >/dev/null 2>/dev/null; then
306 eval `$vi_cv_path_perl -V:usethreads`
307 if test "X$usethreads" = "XUNKNOWN" -o "X$usethreads" = "Xundef"; then
308 badthreads=no
309 else
310 if $vi_cv_path_perl -e 'require 5.6.0' >/dev/null 2>/dev/null; then
311 eval `$vi_cv_path_perl -V:use5005threads`
312 if test "X$use5005threads" = "XUNKNOWN" -o "X$use5005threads" = "Xundef"; then
313 badthreads=no
314 else
315 badthreads=yes
316 AC_MSG_RESULT(>>> Perl > 5.6 with 5.5 threads cannot be used <<<)
317 fi
318 else
319 badthreads=yes
320 AC_MSG_RESULT(>>> Perl 5.5 with threads cannot be used <<<)
321 fi
322 fi
323 if test $badthreads = no; then
324 AC_MSG_RESULT(OK)
325 eval `$vi_cv_path_perl -V:shrpenv`
326 if test "X$shrpenv" = "XUNKNOWN"; then # pre 5.003_04
327 shrpenv=""
328 fi
329 vi_cv_perllib=`$vi_cv_path_perl -MConfig -e 'print $Config{privlibexp}'`
330 AC_SUBST(vi_cv_perllib)
331 dnl Remove "-fno-something", it breaks using cproto.
332 perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \
333 -e 'ccflags;perl_inc;print"\n"' | sed -e 's/-fno[[^ ]]*//'`
334 dnl Remove "-lc", it breaks on FreeBSD when using "-pthread".
335 perllibs=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed -e 'ldopts' | \
336 sed -e '/Warning/d' -e '/Note (probably harmless)/d' \
337 -e 's/-bE:perl.exp//' -e 's/-lc //'`
338 dnl Don't add perl lib to $LIBS: if it's not in LD_LIBRARY_PATH
339 dnl a test in configure may fail because of that.
340 perlldflags=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed \
341 -e 'ccdlflags' | sed -e 's/-bE:perl.exp//'`
342
343 dnl check that compiling a simple program still works with the flags
344 dnl added for Perl.
345 AC_MSG_CHECKING([if compile and link flags for Perl are sane])
346 cflags_save=$CFLAGS
347 libs_save=$LIBS
348 ldflags_save=$LDFLAGS
349 CFLAGS="$CFLAGS $perlcppflags"
350 LIBS="$LIBS $perllibs"
351 LDFLAGS="$perlldflags $LDFLAGS"
352 AC_TRY_LINK(,[ ],
353 AC_MSG_RESULT(yes); perl_ok=yes,
354 AC_MSG_RESULT(no: PERL DISABLED); perl_ok=no)
355 CFLAGS=$cflags_save
356 LIBS=$libs_save
357 LDFLAGS=$ldflags_save
358 if test $perl_ok = yes; then
359 if test "X$perlcppflags" != "X"; then
360 PERL_CFLAGS="$perlcppflags"
361 fi
362 if test "X$perlldflags" != "X"; then
363 LDFLAGS="$perlldflags $LDFLAGS"
364 fi
365 PERL_LIBS=$perllibs
366 PERL_SRC="auto/if_perl.c if_perlsfio.c"
367 PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o"
368 PERL_PRO="if_perl.pro if_perlsfio.pro"
369 AC_DEFINE(FEAT_PERL)
370 fi
371 fi
372 else
373 AC_MSG_RESULT(>>> too old; need Perl version 5.003_01 or later <<<)
374 fi
375 fi
376
377 if test "x$MACOSX" = "xyes"; then
378 dnl Mac OS X 10.2 or 10.3
379 dir=/System/Library/Perl
380 darwindir=$dir/darwin
381 if test -d $darwindir; then
382 PERL=/usr/bin/perl
383 else
384 dnl Mac OS X 10.3
385 dir=/System/Library/Perl/5.8.1
386 darwindir=$dir/darwin-thread-multi-2level
387 if test -d $darwindir; then
388 PERL=/usr/bin/perl
389 fi
390 fi
391 if test -n "$PERL"; then
392 PERL_DIR="$dir"
393 PERL_CFLAGS="-DFEAT_PERL -I$darwindir/CORE"
394 PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o $darwindir/auto/DynaLoader/DynaLoader.a"
395 PERL_LIBS="-L$darwindir/CORE -lperl"
396 fi
397 fi
398fi
399AC_SUBST(shrpenv)
400AC_SUBST(PERL_SRC)
401AC_SUBST(PERL_OBJ)
402AC_SUBST(PERL_PRO)
403AC_SUBST(PERL_CFLAGS)
404AC_SUBST(PERL_LIBS)
405
406AC_MSG_CHECKING(--enable-pythoninterp argument)
407AC_ARG_ENABLE(pythoninterp,
408 [ --enable-pythoninterp Include Python interpreter.], ,
409 [enable_pythoninterp="no"])
410AC_MSG_RESULT($enable_pythoninterp)
411if test "$enable_pythoninterp" = "yes"; then
412 dnl -- find the python executable
413 AC_PATH_PROG(vi_cv_path_python, python)
414 if test "X$vi_cv_path_python" != "X"; then
415
416 dnl -- get its version number
417 AC_CACHE_CHECK(Python version,vi_cv_var_python_version,
418 [[vi_cv_var_python_version=`
419 ${vi_cv_path_python} -c 'import sys; print sys.version[:3]'`
420 ]])
421
422 dnl -- it must be at least version 1.4
423 AC_MSG_CHECKING(Python is 1.4 or better)
424 if ${vi_cv_path_python} -c \
425 "import sys; sys.exit(${vi_cv_var_python_version} < 1.4)"
426 then
427 AC_MSG_RESULT(yep)
428
429 dnl -- find where python thinks it was installed
430 AC_CACHE_CHECK(Python's install prefix,vi_cv_path_python_pfx,
431 [ vi_cv_path_python_pfx=`
432 ${vi_cv_path_python} -c \
433 "import sys; print sys.prefix"` ])
434
435 dnl -- and where it thinks it runs
436 AC_CACHE_CHECK(Python's execution prefix,vi_cv_path_python_epfx,
437 [ vi_cv_path_python_epfx=`
438 ${vi_cv_path_python} -c \
439 "import sys; print sys.exec_prefix"` ])
440
441 dnl -- python's internal library path
442
443 AC_CACHE_VAL(vi_cv_path_pythonpath,
444 [ vi_cv_path_pythonpath=`
445 unset PYTHONPATH;
446 ${vi_cv_path_python} -c \
447 "import sys, string; print string.join(sys.path,':')"` ])
448
449 dnl -- where the Python implementation library archives are
450
451 AC_ARG_WITH(python-config-dir,
452 [ --with-python-config-dir=PATH Python's config directory],
453 [ vi_cv_path_python_conf="${withval}" ] )
454
455 AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python_conf,
456 [
457 vi_cv_path_python_conf=
458 for path in "${vi_cv_path_python_pfx}" "${vi_cv_path_python_epfx}"; do
459 for subdir in lib share; do
460 d="${path}/${subdir}/python${vi_cv_var_python_version}/config"
461 if test -d "$d" && test -f "$d/config.c"; then
462 vi_cv_path_python_conf="$d"
463 fi
464 done
465 done
466 ])
467
468 PYTHON_CONFDIR="${vi_cv_path_python_conf}"
469
470 if test "X$PYTHON_CONFDIR" = "X"; then
471 AC_MSG_RESULT([can't find it!])
472 else
473
474 dnl -- we need to examine Python's config/Makefile too
475 dnl see what the interpreter is built from
476 AC_CACHE_VAL(vi_cv_path_python_plibs,
477 [
478 tmp_mkf="/tmp/Makefile-conf$$"
479 cat ${PYTHON_CONFDIR}/Makefile - <<'eof' >${tmp_mkf}
480__:
481 @echo "python_MODLIBS='$(MODLIBS)'"
482 @echo "python_LIBS='$(LIBS)'"
483 @echo "python_SYSLIBS='$(SYSLIBS)'"
484 @echo "python_LINKFORSHARED='$(LINKFORSHARED)'"
485eof
486 dnl -- delete the lines from make about Entering/Leaving directory
487 eval "`cd ${PYTHON_CONFDIR} && make -f ${tmp_mkf} __ | sed '/ directory /d'`"
488 rm -f ${tmp_mkf}
489 if test "x$MACOSX" = "xyes" && ${vi_cv_path_python} -c \
490 "import sys; sys.exit(${vi_cv_var_python_version} < 2.3)"; then
491 vi_cv_path_python_plibs="-framework Python"
492 else
493 if test "${vi_cv_var_python_version}" = "1.4"; then
494 vi_cv_path_python_plibs="${PYTHON_CONFDIR}/libModules.a ${PYTHON_CONFDIR}/libPython.a ${PYTHON_CONFDIR}/libObjects.a ${PYTHON_CONFDIR}/libParser.a"
495 else
496 vi_cv_path_python_plibs="-L${PYTHON_CONFDIR} -lpython${vi_cv_var_python_version}"
497 fi
498 vi_cv_path_python_plibs="${vi_cv_path_python_plibs} ${python_MODLIBS} ${python_LIBS} ${python_SYSLIBS} ${python_LINKFORSHARED}"
499 dnl remove -ltermcap, it can conflict with an earlier -lncurses
500 vi_cv_path_python_plibs=`echo $vi_cv_path_python_plibs | sed s/-ltermcap//`
501 fi
502 ])
503
504 PYTHON_LIBS="${vi_cv_path_python_plibs}"
505 if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then
506 PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version}"
507 else
508 PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -I${vi_cv_path_python_epfx}/include/python${vi_cv_var_python_version}"
509 fi
510 PYTHON_SRC="if_python.c"
511 dnl For Mac OSX 10.2 config.o is included in the Python library.
512 if test "x$MACOSX" = "xyes"; then
513 PYTHON_OBJ="objects/if_python.o"
514 else
515 PYTHON_OBJ="objects/if_python.o objects/py_config.o"
516 fi
517 if test "${vi_cv_var_python_version}" = "1.4"; then
518 PYTHON_OBJ="$PYTHON_OBJ objects/py_getpath.o"
519 fi
520 PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'"
521
522 dnl On FreeBSD linking with "-pthread" is required to use threads.
523 dnl _THREAD_SAFE must be used for compiling then.
524 dnl The "-pthread" is added to $LIBS, so that the following check for
525 dnl sigaltstack() will look in libc_r (it's there in libc!).
526 dnl Otherwise, when using GCC, try adding -pthread to $CFLAGS. GCC
527 dnl will then define target-specific defines, e.g., -D_REENTRANT.
528 dnl Don't do this for Mac OSX, -pthread will generate a warning.
529 AC_MSG_CHECKING([if -pthread should be used])
530 threadsafe_flag=
531 thread_lib=
532 if test "x$MACOSX" != "xyes"; then
533 test "$GCC" = yes && threadsafe_flag="-pthread"
534 if test "`(uname) 2>/dev/null`" = FreeBSD; then
535 threadsafe_flag="-D_THREAD_SAFE"
536 thread_lib="-pthread"
537 fi
538 fi
539 libs_save_old=$LIBS
540 if test -n "$threadsafe_flag"; then
541 cflags_save=$CFLAGS
542 CFLAGS="$CFLAGS $threadsafe_flag"
543 LIBS="$LIBS $thread_lib"
544 AC_TRY_LINK(,[ ],
545 AC_MSG_RESULT(yes); PYTHON_CFLAGS="$PYTHON_CFLAGS $threadsafe_flag",
546 AC_MSG_RESULT(no); LIBS=$libs_save_old
547 )
548 CFLAGS=$cflags_save
549 else
550 AC_MSG_RESULT(no)
551 fi
552
553 dnl check that compiling a simple program still works with the flags
554 dnl added for Python.
555 AC_MSG_CHECKING([if compile and link flags for Python are sane])
556 cflags_save=$CFLAGS
557 libs_save=$LIBS
558 CFLAGS="$CFLAGS $PYTHON_CFLAGS"
559 LIBS="$LIBS $PYTHON_LIBS"
560 AC_TRY_LINK(,[ ],
561 AC_MSG_RESULT(yes); python_ok=yes,
562 AC_MSG_RESULT(no: PYTHON DISABLED); python_ok=no)
563 CFLAGS=$cflags_save
564 LIBS=$libs_save
565 if test $python_ok = yes; then
566 AC_DEFINE(FEAT_PYTHON)
567 else
568 LIBS=$libs_save_old
569 PYTHON_SRC=
570 PYTHON_OBJ=
571 PYTHON_LIBS=
572 PYTHON_CFLAGS=
573 fi
574
575 fi
576 else
577 AC_MSG_RESULT(too old)
578 fi
579 fi
580fi
581AC_SUBST(PYTHON_CONFDIR)
582AC_SUBST(PYTHON_LIBS)
583AC_SUBST(PYTHON_GETPATH_CFLAGS)
584AC_SUBST(PYTHON_CFLAGS)
585AC_SUBST(PYTHON_SRC)
586AC_SUBST(PYTHON_OBJ)
587
588AC_MSG_CHECKING(--enable-tclinterp argument)
589AC_ARG_ENABLE(tclinterp,
590 [ --enable-tclinterp Include Tcl interpreter.], ,
591 [enable_tclinterp="no"])
592AC_MSG_RESULT($enable_tclinterp)
593
594if test "$enable_tclinterp" = "yes"; then
595
596 dnl on FreeBSD tclsh is a silly script, look for tclsh8.0 or tclsh8.2
597 AC_MSG_CHECKING(--with-tclsh argument)
598 AC_ARG_WITH(tclsh, [ --with-tclsh=PATH which tclsh to use (default: tclsh8.0)],
599 tclsh_name="$withval"; AC_MSG_RESULT($tclsh_name),
600 tclsh_name="tclsh8.0"; AC_MSG_RESULT(no))
601 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
602 AC_SUBST(vi_cv_path_tcl)
603
604 dnl when no specific version specified, also try 8.2
605 if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.0"; then
606 tclsh_name="tclsh8.2"
607 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
608 fi
609 dnl still didn't find it, try without version number
610 if test "X$vi_cv_path_tcl" = "X"; then
611 tclsh_name="tclsh"
612 AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
613 fi
614 if test "X$vi_cv_path_tcl" != "X"; then
615 AC_MSG_CHECKING(Tcl version)
616 if echo 'exit [[expr [info tclversion] < 8.0]]' | $vi_cv_path_tcl - ; then
617 tclver=`echo 'puts [[info tclversion]]' | $vi_cv_path_tcl -`
618 AC_MSG_RESULT($tclver - OK);
619 tclloc=`echo 'set l [[info library]];set i [[string last lib $l]];incr i -2;puts [[string range $l 0 $i]]' | $vi_cv_path_tcl -`
620
621 AC_MSG_CHECKING(for location of Tcl include)
622 if test "x$MACOSX" != "xyes"; then
623 tclinc="$tclloc/include $tclloc/include/tcl $tclloc/include/tcl$tclver /usr/local/include"
624 else
625 dnl For Mac OS X 10.3, use the OS-provided framework location
626 tclinc="/System/Library/Frameworks/Tcl.framework/Headers"
627 fi
628 for try in $tclinc; do
629 if test -f "$try/tcl.h"; then
630 AC_MSG_RESULT($try/tcl.h)
631 TCL_INC=$try
632 break
633 fi
634 done
635 if test -z "$TCL_INC"; then
636 AC_MSG_RESULT(<not found>)
637 SKIP_TCL=YES
638 fi
639 if test -z "$SKIP_TCL"; then
640 AC_MSG_CHECKING(for location of tclConfig.sh script)
641 if test "x$MACOSX" != "xyes"; then
642 tclcnf=`echo $tclinc | sed s/include/lib/g`
643 else
644 dnl For Mac OS X 10.3, use the OS-provided framework location
645 tclcnf="/System/Library/Frameworks/Tcl.framework"
646 fi
647 for try in $tclcnf; do
648 if test -f $try/tclConfig.sh; then
649 AC_MSG_RESULT($try/tclConfig.sh)
650 . $try/tclConfig.sh
651 dnl use eval, because tcl 8.2 includes ${TCL_DBGX}
652 TCL_LIBS=`eval echo "$TCL_LIB_SPEC $TCL_LIBS"`
653 dnl Use $TCL_DEFS for -D_THREAD_SAFE et al. But only use the
654 dnl "-D_ABC" items.
655 TCL_DEFS=`echo $TCL_DEFS | tr ' ' '\012' | sed -e '/^-[[^D]]/d' -e '/-D[[^_]]/d' -e 's/-D_/ -D_/' | tr -d '\012'`
656 break
657 fi
658 done
659 if test -z "$TCL_LIBS"; then
660 AC_MSG_RESULT(<not found>)
661 AC_MSG_CHECKING(for Tcl library by myself)
662 tcllib=`echo $tclinc | sed s/include/lib/g`
663 for ext in .so .a ; do
664 for ver in "" $tclver ; do
665 for try in $tcllib ; do
666 trylib=tcl$ver$ext
667 if test -f $try/lib$trylib ; then
668 AC_MSG_RESULT($try/lib$trylib)
669 TCL_LIBS="-L$try -ltcl$ver -ldl -lm"
670 if test "`(uname) 2>/dev/null`" = SunOS &&
671 uname -r | grep '^5' >/dev/null; then
672 TCL_LIBS="$TCL_LIBS -R $try"
673 fi
674 break 3
675 fi
676 done
677 done
678 done
679 if test -z "$TCL_LIBS"; then
680 AC_MSG_RESULT(<not found>)
681 SKIP_TCL=YES
682 fi
683 fi
684 if test -z "$SKIP_TCL"; then
685 AC_DEFINE(FEAT_TCL)
686 TCL_SRC=if_tcl.c
687 TCL_OBJ=objects/if_tcl.o
688 TCL_PRO=if_tcl.pro
689 TCL_CFLAGS="-I$TCL_INC $TCL_DEFS"
690 fi
691 fi
692 else
693 AC_MSG_RESULT(too old; need Tcl version 8.0 or later)
694 fi
695 fi
696fi
697AC_SUBST(TCL_SRC)
698AC_SUBST(TCL_OBJ)
699AC_SUBST(TCL_PRO)
700AC_SUBST(TCL_CFLAGS)
701AC_SUBST(TCL_LIBS)
702
703AC_MSG_CHECKING(--enable-rubyinterp argument)
704AC_ARG_ENABLE(rubyinterp,
705 [ --enable-rubyinterp Include Ruby interpreter.], ,
706 [enable_rubyinterp="no"])
707AC_MSG_RESULT($enable_rubyinterp)
708if test "$enable_rubyinterp" = "yes"; then
709 AC_SUBST(vi_cv_path_ruby)
710 AC_PATH_PROG(vi_cv_path_ruby, ruby)
711 if test "X$vi_cv_path_ruby" != "X"; then
712 AC_MSG_CHECKING(Ruby version)
713 if $vi_cv_path_ruby -e 'VERSION >= "1.6.0" or exit 1' >/dev/null 2>/dev/null; then
714 AC_MSG_RESULT(OK)
715 AC_MSG_CHECKING(Ruby header files)
716 rubyhdrdir=`$vi_cv_path_ruby -r mkmf -e 'print Config::CONFIG[["archdir"]] || $hdrdir' 2>/dev/null`
717 if test "X$rubyhdrdir" != "X"; then
718 AC_MSG_RESULT($rubyhdrdir)
719 RUBY_CFLAGS="-I$rubyhdrdir"
720 rubylibs=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["LIBS"]]'`
721 if test "X$rubylibs" != "X"; then
722 RUBY_LIBS="$rubylibs"
723 fi
724 librubyarg=`$vi_cv_path_ruby -r rbconfig -e 'print Config.expand(Config::CONFIG[["LIBRUBYARG"]])'`
725 if test -f "$rubyhdrdir/$librubyarg"; then
726 librubyarg="$rubyhdrdir/$librubyarg"
727 else
728 rubylibdir=`$vi_cv_path_ruby -r rbconfig -e 'print Config.expand(Config::CONFIG[["libdir"]])'`
729 if test -f "$rubylibdir/$librubyarg"; then
730 librubyarg="$rubylibdir/$librubyarg"
731 elif test "$librubyarg" = "libruby.a"; then
732 dnl required on Mac OS 10.3 where libruby.a doesn't exist
733 librubyarg="-lruby"
734 else
735 librubyarg=`$vi_cv_path_ruby -r rbconfig -e "print '$librubyarg'.gsub(/-L\./, %'-L#{Config.expand(Config::CONFIG[\"libdir\"])}')"`
736 fi
737 fi
738
739 if test "X$librubyarg" != "X"; then
740 RUBY_LIBS="$librubyarg $RUBY_LIBS"
741 fi
742 rubyldflags=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["LDFLAGS"]]'`
743 if test "X$rubyldflags" != "X"; then
744 LDFLAGS="$rubyldflags $LDFLAGS"
745 fi
746 RUBY_SRC="if_ruby.c"
747 RUBY_OBJ="objects/if_ruby.o"
748 RUBY_PRO="if_ruby.pro"
749 AC_DEFINE(FEAT_RUBY)
750 else
751 AC_MSG_RESULT(not found, disabling Ruby)
752 fi
753 else
754 AC_MSG_RESULT(too old; need Ruby version 1.6.0 or later)
755 fi
756 fi
757fi
758AC_SUBST(RUBY_SRC)
759AC_SUBST(RUBY_OBJ)
760AC_SUBST(RUBY_PRO)
761AC_SUBST(RUBY_CFLAGS)
762AC_SUBST(RUBY_LIBS)
763
764AC_MSG_CHECKING(--enable-cscope argument)
765AC_ARG_ENABLE(cscope,
766 [ --enable-cscope Include cscope interface.], ,
767 [enable_cscope="no"])
768AC_MSG_RESULT($enable_cscope)
769if test "$enable_cscope" = "yes"; then
770 AC_DEFINE(FEAT_CSCOPE)
771fi
772
773AC_MSG_CHECKING(--enable-workshop argument)
774AC_ARG_ENABLE(workshop,
775 [ --enable-workshop Include Sun Visual Workshop support.], ,
776 [enable_workshop="no"])
777AC_MSG_RESULT($enable_workshop)
778if test "$enable_workshop" = "yes"; then
779 AC_DEFINE(FEAT_SUN_WORKSHOP)
780 WORKSHOP_SRC="workshop.c integration.c"
781 AC_SUBST(WORKSHOP_SRC)
782 WORKSHOP_OBJ="objects/workshop.o objects/integration.o"
783 AC_SUBST(WORKSHOP_OBJ)
784 if test "${enable_gui-xxx}" = xxx; then
785 enable_gui=motif
786 fi
787fi
788
789AC_MSG_CHECKING(--disable-netbeans argument)
790AC_ARG_ENABLE(netbeans,
791 [ --disable-netbeans Disable NetBeans integration support.],
792 , [enable_netbeans="yes"])
793if test "$enable_netbeans" = "yes"; then
794 AC_MSG_RESULT(no)
795 dnl On Solaris we need the socket and nsl library.
796 AC_CHECK_LIB(socket, socket)
797 AC_CHECK_LIB(nsl, gethostbyname)
798 AC_MSG_CHECKING(whether compiling netbeans integration is possible)
799 AC_TRY_LINK([
800#include <stdio.h>
801#include <stdlib.h>
802#include <stdarg.h>
803#include <fcntl.h>
804#include <netdb.h>
805#include <netinet/in.h>
806#include <errno.h>
807#include <sys/types.h>
808#include <sys/socket.h>
809 /* Check bitfields */
810 struct nbbuf {
811 unsigned int initDone:1;
812 ushort signmaplen;
813 };
814 ], [
815 /* Check creating a socket. */
816 struct sockaddr_in server;
817 (void)socket(AF_INET, SOCK_STREAM, 0);
818 (void)htons(100);
819 (void)gethostbyname("microsoft.com");
820 if (errno == ECONNREFUSED)
821 (void)connect(1, (struct sockaddr *)&server, sizeof(server));
822 ],
823 AC_MSG_RESULT(yes),
824 AC_MSG_RESULT(no); enable_netbeans="no")
825else
826 AC_MSG_RESULT(yes)
827fi
828if test "$enable_netbeans" = "yes"; then
829 AC_DEFINE(FEAT_NETBEANS_INTG)
830 NETBEANS_SRC="netbeans.c"
831 AC_SUBST(NETBEANS_SRC)
832 NETBEANS_OBJ="objects/netbeans.o"
833 AC_SUBST(NETBEANS_OBJ)
834fi
835
836AC_MSG_CHECKING(--enable-sniff argument)
837AC_ARG_ENABLE(sniff,
838 [ --enable-sniff Include Sniff interface.], ,
839 [enable_sniff="no"])
840AC_MSG_RESULT($enable_sniff)
841if test "$enable_sniff" = "yes"; then
842 AC_DEFINE(FEAT_SNIFF)
843 SNIFF_SRC="if_sniff.c"
844 AC_SUBST(SNIFF_SRC)
845 SNIFF_OBJ="objects/if_sniff.o"
846 AC_SUBST(SNIFF_OBJ)
847fi
848
849AC_MSG_CHECKING(--enable-multibyte argument)
850AC_ARG_ENABLE(multibyte,
851 [ --enable-multibyte Include multibyte editing support.], ,
852 [enable_multibyte="no"])
853AC_MSG_RESULT($enable_multibyte)
854if test "$enable_multibyte" = "yes"; then
855 AC_DEFINE(FEAT_MBYTE)
856fi
857
858AC_MSG_CHECKING(--enable-hangulinput argument)
859AC_ARG_ENABLE(hangulinput,
860 [ --enable-hangulinput Include Hangul input support.], ,
861 [enable_hangulinput="no"])
862AC_MSG_RESULT($enable_hangulinput)
863
864AC_MSG_CHECKING(--enable-xim argument)
865AC_ARG_ENABLE(xim,
866 [ --enable-xim Include XIM input support.],
867 AC_MSG_RESULT($enable_xim),
868 [enable_xim="auto"; AC_MSG_RESULT(defaulting to auto)])
869dnl defining FEAT_XIM is delayed, so that it can be disabled for older GTK
870
871AC_MSG_CHECKING(--enable-fontset argument)
872AC_ARG_ENABLE(fontset,
873 [ --enable-fontset Include X fontset output support.], ,
874 [enable_fontset="no"])
875AC_MSG_RESULT($enable_fontset)
876dnl defining FEAT_XFONTSET is delayed, so that it can be disabled for no GUI
877
878test -z "$with_x" && with_x=yes
879test "${enable_gui-yes}" != no -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && with_x=yes
880if test "$with_x" = no; then
881 AC_MSG_RESULT(defaulting to: don't HAVE_X11)
882else
883 dnl Do this check early, so that its failure can override user requests.
884
885 AC_PATH_PROG(xmkmfpath, xmkmf)
886
887 AC_PATH_XTRA
888
889 dnl On OS390Unix the X libraries are DLLs. To use them the code must
890 dnl be compiled with a special option.
891 dnl Also add SM, ICE and Xmu to X_EXTRA_LIBS.
892 if test "$OS390Unix" = "yes"; then
893 CFLAGS="$CFLAGS -W c,dll"
894 LDFLAGS="$LDFLAGS -W l,dll"
895 X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE -lXmu"
896 fi
897
898 dnl On my HPUX system the X include dir is found, but the lib dir not.
899 dnl This is a desparate try to fix this.
900
901 if test -d "$x_includes" && test ! -d "$x_libraries"; then
902 x_libraries=`echo "$x_includes" | sed s/include/lib/`
903 AC_MSG_RESULT(Corrected X libraries to $x_libraries)
904 X_LIBS="$X_LIBS -L$x_libraries"
905 if test "`(uname) 2>/dev/null`" = SunOS &&
906 uname -r | grep '^5' >/dev/null; then
907 X_LIBS="$X_LIBS -R $x_libraries"
908 fi
909 fi
910
911 if test -d "$x_libraries" && test ! -d "$x_includes"; then
912 x_includes=`echo "$x_libraries" | sed s/lib/include/`
913 AC_MSG_RESULT(Corrected X includes to $x_includes)
914 X_CFLAGS="$X_CFLAGS -I$x_includes"
915 fi
916
917 dnl Remove "-I/usr/include " from X_CFLAGS, should not be needed.
918 X_CFLAGS="`echo $X_CFLAGS\ | sed 's%-I/usr/include %%'`"
919 dnl Remove "-L/usr/lib " from X_LIBS, should not be needed.
920 X_LIBS="`echo $X_LIBS\ | sed 's%-L/usr/lib %%'`"
921 dnl Same for "-R/usr/lib ".
922 X_LIBS="`echo $X_LIBS\ | sed -e 's%-R/usr/lib %%' -e 's%-R /usr/lib %%'`"
923
924
925 dnl Check if the X11 header files are correctly installed. On some systems
926 dnl Xlib.h includes files that don't exist
927 AC_MSG_CHECKING(if X11 header files can be found)
928 cflags_save=$CFLAGS
929 CFLAGS="$CFLAGS $X_CFLAGS"
930 AC_TRY_COMPILE([#include <X11/Xlib.h>], ,
931 AC_MSG_RESULT(yes),
932 AC_MSG_RESULT(no); no_x=yes)
933 CFLAGS=$cflags_save
934
935 if test "${no_x-no}" = yes; then
936 with_x=no
937 else
938 AC_DEFINE(HAVE_X11)
939 X_LIB="-lXt -lX11";
940 AC_SUBST(X_LIB)
941
942 ac_save_LDFLAGS="$LDFLAGS"
943 LDFLAGS="-L$x_libraries $LDFLAGS"
944
945 dnl Check for -lXdmcp (needed on SunOS 4.1.4)
946 dnl For HP-UX 10.20 it must be before -lSM -lICE
947 AC_CHECK_LIB(Xdmcp, _XdmcpAuthDoIt, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lXdmcp"],,
948 [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS -lXdmcp])
949
950 dnl Some systems need -lnsl -lsocket when testing for ICE.
951 dnl The check above doesn't do this, try here (again). Also needed to get
952 dnl them after Xdmcp. link.sh will remove them when not needed.
953 dnl Check for other function than above to avoid the cached value
954 AC_CHECK_LIB(ICE, IceOpenConnection,
955 [X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE"],, [$X_EXTRA_LIBS])
956
957 dnl Check for -lXpm (needed for some versions of Motif)
958 LDFLAGS="$X_LIBS $ac_save_LDFLAGS"
959 AC_CHECK_LIB(Xpm, XpmCreatePixmapFromData, [X_PRE_LIBS="$X_PRE_LIBS -lXpm"],,
960 [-lXt $X_PRE_LIBS -lXpm -lX11 $X_EXTRA_LIBS])
961
962 dnl Check that the X11 header files don't use implicit declarations
963 AC_MSG_CHECKING(if X11 header files implicitly declare return values)
964 cflags_save=$CFLAGS
965 CFLAGS="$CFLAGS $X_CFLAGS -Werror"
966 AC_TRY_COMPILE([#include <X11/Xlib.h>], ,
967 AC_MSG_RESULT(no),
968 CFLAGS="$CFLAGS -Wno-implicit-int"
969 AC_TRY_COMPILE([#include <X11/Xlib.h>], ,
970 AC_MSG_RESULT(yes); cflags_save="$cflags_save -Wno-implicit-int",
971 AC_MSG_RESULT(test failed)
972 )
973 )
974 CFLAGS=$cflags_save
975
976 LDFLAGS="$ac_save_LDFLAGS"
977
978 fi
979fi
980
981test "x$with_x" = xno -a "x$BEOS" != "xyes" -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && enable_gui=no
982
983AC_MSG_CHECKING(--enable-gui argument)
984AC_ARG_ENABLE(gui,
Bram Moolenaar843ee412004-06-30 16:16:41 +0000985 [ --enable-gui[=OPTS] X11 GUI [default=auto] [OPTS=auto/no/gtk/gtk2/gnome/gnome2/kde/motif/athena/neXtaw/beos/photon/carbon]], , enable_gui="auto")
Bram Moolenaar071d4272004-06-13 20:20:40 +0000986
987dnl Canonicalize the --enable-gui= argument so that it can be easily compared.
988dnl Do not use character classes for portability with old tools.
989enable_gui_canon=`echo "_$enable_gui" | \
990 sed 's/[[ _+-]]//g;y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
991
992dnl Skip everything by default.
993SKIP_GTK=YES
994SKIP_GTK2=YES
995SKIP_GNOME=YES
996SKIP_MOTIF=YES
997SKIP_ATHENA=YES
998SKIP_NEXTAW=YES
999SKIP_PHOTON=YES
1000SKIP_BEOS=YES
1001SKIP_CARBON=YES
1002GUITYPE=NONE
1003
1004if test "x$BEOS" = "xyes"; then
1005 SKIP_BEOS=
1006 case "$enable_gui_canon" in
1007 no) AC_MSG_RESULT(no GUI support)
1008 SKIP_BEOS=YES ;;
1009 yes|"") AC_MSG_RESULT(yes - automatic GUI support) ;;
1010 auto) AC_MSG_RESULT(auto - automatic GUI support) ;;
1011 beos) AC_MSG_RESULT(BeOS GUI support) ;;
1012 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported])
1013 SKIP_BEOS=YES ;;
1014 esac
1015
1016elif test "x$QNX" = "xyes" -a "x$with_x" = "xno" ; then
1017 SKIP_PHOTON=
1018 case "$enable_gui_canon" in
1019 no) AC_MSG_RESULT(no GUI support)
1020 SKIP_PHOTON=YES ;;
1021 yes|"") AC_MSG_RESULT(yes - automatic GUI support) ;;
1022 auto) AC_MSG_RESULT(auto - automatic GUI support) ;;
1023 photon) AC_MSG_RESULT(Photon GUI support) ;;
1024 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported])
1025 SKIP_PHOTON=YES ;;
1026 esac
1027
1028elif test "x$MACOSX" = "xyes" -a "x$with_x" = "xno" ; then
1029 SKIP_CARBON=
1030 case "$enable_gui_canon" in
1031 no) AC_MSG_RESULT(no GUI support)
1032 SKIP_CARBON=YES ;;
1033 yes|"") AC_MSG_RESULT(yes - automatic GUI support) ;;
1034 auto) AC_MSG_RESULT(auto - automatic GUI support) ;;
1035 carbon) AC_MSG_RESULT(Carbon GUI support) ;;
1036 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported])
1037 SKIP_CARBON=YES ;;
1038 esac
1039
1040else
1041
Bram Moolenaar071d4272004-06-13 20:20:40 +00001042 case "$enable_gui_canon" in
1043 no|none) AC_MSG_RESULT(no GUI support) ;;
1044 yes|""|auto) AC_MSG_RESULT(yes/auto - automatic GUI support)
1045 SKIP_GTK=
1046 SKIP_GTK2=
1047 SKIP_GNOME=
1048 SKIP_MOTIF=
1049 SKIP_ATHENA=
1050 SKIP_NEXTAW=
1051 SKIP_CARBON=;;
Bram Moolenaar843ee412004-06-30 16:16:41 +00001052 kde|Kde|KDE) AC_MSG_RESULT(KDE 2.x or 3.x GUI support)
1053 SKIP_KDE=;;
Bram Moolenaar071d4272004-06-13 20:20:40 +00001054 gtk) AC_MSG_RESULT(GTK+ 1.x GUI support)
1055 SKIP_GTK=;;
1056 gtk2) AC_MSG_RESULT(GTK+ 2.x GUI support)
1057 SKIP_GTK=
1058 SKIP_GTK2=;;
1059 gnome) AC_MSG_RESULT(GNOME 1.x GUI support)
1060 SKIP_GNOME=
1061 SKIP_GTK=;;
1062 gnome2) AC_MSG_RESULT(GNOME 2.x GUI support)
1063 SKIP_GNOME=
1064 SKIP_GTK=
1065 SKIP_GTK2=;;
1066 motif) AC_MSG_RESULT(Motif GUI support)
1067 SKIP_MOTIF=;;
1068 athena) AC_MSG_RESULT(Athena GUI support)
1069 SKIP_ATHENA=;;
1070 nextaw) AC_MSG_RESULT(neXtaw GUI support)
1071 SKIP_NEXTAW=;;
1072 *) AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported]) ;;
1073 esac
1074
1075fi
1076
Bram Moolenaar843ee412004-06-30 16:16:41 +00001077if test "x$SKIP_KDE" != "xYES" -a "$enable_gui_canon" != "kde"; then
1078 AC_MSG_CHECKING(whether or not to look for KDE)
1079 AC_ARG_ENABLE(kde-check,
1080 [ --enable-kde-check If auto-select GUI, check for KDE [default=no]],
1081 ,enable_kde_check="no")
1082 AC_MSG_RESULT($enable_kde_check);
1083 if test "x$enable_kde_check" = "xno"; then
1084 SKIP_KDE=YES
1085 fi
1086fi
1087
Bram Moolenaar071d4272004-06-13 20:20:40 +00001088if test "x$SKIP_GTK" != "xYES" -a "$enable_gui_canon" != "gtk" -a "$enable_gui_canon" != "gtk2"; then
1089 AC_MSG_CHECKING(whether or not to look for GTK)
1090 AC_ARG_ENABLE(gtk-check,
1091 [ --enable-gtk-check If auto-select GUI, check for GTK [default=yes]],
1092 , enable_gtk_check="yes")
1093 AC_MSG_RESULT($enable_gtk_check)
1094 if test "x$enable_gtk_check" = "xno"; then
1095 SKIP_GTK=YES
1096 SKIP_GNOME=YES
1097 fi
1098fi
1099
1100if test "x$SKIP_GTK2" != "xYES" -a "$enable_gui_canon" != "gtk2" \
1101 -a "$enable_gui_canon" != "gnome2"; then
1102 AC_MSG_CHECKING(whether or not to look for GTK+ 2)
1103 AC_ARG_ENABLE(gtk2-check,
1104 [ --enable-gtk2-check If GTK GUI, check for GTK+ 2 [default=yes]],
1105 , enable_gtk2_check="yes")
1106 AC_MSG_RESULT($enable_gtk2_check)
1107 if test "x$enable_gtk2_check" = "xno"; then
1108 SKIP_GTK2=YES
1109 fi
1110fi
1111
1112if test "x$SKIP_GNOME" != "xYES" -a "$enable_gui_canon" != "gnome" \
1113 -a "$enable_gui_canon" != "gnome2"; then
1114 AC_MSG_CHECKING(whether or not to look for GNOME)
1115 AC_ARG_ENABLE(gnome-check,
1116 [ --enable-gnome-check If GTK GUI, check for GNOME [default=no]],
1117 , enable_gnome_check="no")
1118 AC_MSG_RESULT($enable_gnome_check)
1119 if test "x$enable_gnome_check" = "xno"; then
1120 SKIP_GNOME=YES
1121 fi
1122fi
1123
1124if test "x$SKIP_MOTIF" != "xYES" -a "$enable_gui_canon" != "motif"; then
1125 AC_MSG_CHECKING(whether or not to look for Motif)
1126 AC_ARG_ENABLE(motif-check,
1127 [ --enable-motif-check If auto-select GUI, check for Motif [default=yes]],
1128 , enable_motif_check="yes")
1129 AC_MSG_RESULT($enable_motif_check)
1130 if test "x$enable_motif_check" = "xno"; then
1131 SKIP_MOTIF=YES
1132 fi
1133fi
1134
1135if test "x$SKIP_ATHENA" != "xYES" -a "$enable_gui_canon" != "athena"; then
1136 AC_MSG_CHECKING(whether or not to look for Athena)
1137 AC_ARG_ENABLE(athena-check,
1138 [ --enable-athena-check If auto-select GUI, check for Athena [default=yes]],
1139 , enable_athena_check="yes")
1140 AC_MSG_RESULT($enable_athena_check)
1141 if test "x$enable_athena_check" = "xno"; then
1142 SKIP_ATHENA=YES
1143 fi
1144fi
1145
1146if test "x$SKIP_NEXTAW" != "xYES" -a "$enable_gui_canon" != "nextaw"; then
1147 AC_MSG_CHECKING(whether or not to look for neXtaw)
1148 AC_ARG_ENABLE(nextaw-check,
1149 [ --enable-nextaw-check If auto-select GUI, check for neXtaw [default=yes]],
1150 , enable_nextaw_check="yes")
1151 AC_MSG_RESULT($enable_nextaw_check);
1152 if test "x$enable_nextaw_check" = "xno"; then
1153 SKIP_NEXTAW=YES
1154 fi
1155fi
1156
1157if test "x$SKIP_CARBON" != "xYES" -a "$enable_gui_canon" != "carbon"; then
1158 AC_MSG_CHECKING(whether or not to look for Carbon)
1159 AC_ARG_ENABLE(carbon-check,
1160 [ --enable-carbon-check If auto-select GUI, check for Carbon [default=yes]],
1161 , enable_carbon_check="yes")
1162 AC_MSG_RESULT($enable_carbon_check);
1163 if test "x$enable_carbon_check" = "xno"; then
1164 SKIP_CARBON=YES
1165 fi
1166fi
1167
Bram Moolenaar843ee412004-06-30 16:16:41 +00001168dnl ---------------------------------------------------------------------------
1169dnl we use the kde-config script included in KDE since 2.x to check which
1170dnl version of KDE, we'll use. We'll use additional args in configure to
1171dnl obtain the QT directory (includes and libs) as qt does not give any
1172dnl config script ! (shame on the trolls ! ;p)
1173dnl ---------------------------------------------------------------------------
1174
1175if test -z "$SKIP_KDE"; then
1176dnl ------------------
1177dnl now, take care of QT
1178dnl -----------------
1179AC_ARG_WITH(qt-dir,
1180 [ --with-qt-dir=DIR Specify prefix of QT files],
1181 [
1182 ROOTQT="$withval"
1183 MOC="$withval"/bin/moc
1184 QT_INCLUDES="$withval"/include
1185 QT_LIBS="$withval"/lib
1186 ])
1187
1188if test "x$ROOTQT" = "x"; then
1189 if test -z "$QTDIR"; then
1190 dnl Find the Qt directory by looking for the "moc" program.
1191 dnl It's better than nothing.
1192 AC_PATH_PROG(MOC, moc, no)
1193 if text"x$MOC" = "x"; then
1194 AC_MSG_ERROR(could not find Qt directory)
1195 else
1196 ROOTQT=`echo $MOC | sed 's+/bin/moc++'`
1197 fi
1198 else
1199 ROOTQT="$QTDIR"
1200 fi
1201fi
1202MOC="$ROOTQT"/bin/moc
1203QT_INCLUDES="$ROOTQT"/include
1204QT_LIBS="$ROOTQT"/lib
1205
1206AC_ARG_WITH(qt-includes,
1207 [ --with-qt-includes=DIR Specify location of Qt headers],
1208 [QT_INCLUDES="$withval"]
1209 )
1210
1211AC_ARG_WITH(qt-libraries,
1212 [ --with-qt-libs=DIR Specify location of Qt libraries],
1213 [QT_LIBS="$withval"]
1214 )
1215
1216if test "x$QT_LIBS" = "x" ; then
1217 QT_LIBS="$ROOTQT"/lib
1218fi
1219if test "x$QT_INCLUDES" = "x" ; then
1220 QT_INCLUDES="$ROOTQT"/include
1221fi
1222dnl we should get QT's version from here and compare with what kde-config
1223dnl says
1224
1225AC_MSG_CHECKING(whether or not to use a KDE Toolbar in KVim)
1226AC_ARG_ENABLE(kde-toolbar,
1227 [ --enable-kde-toolbar if KDE GUI is selected, enable a KDE-look toolbar [default=no]],
1228 , enable_kde_toolbar="no")
1229if test "x$enable_kde_toolbar" != "xno"; then
1230 AC_DEFINE(FEAT_KDETOOLBAR)
1231fi
1232AC_MSG_RESULT($enable_kde_toolbar);
1233fi
1234
1235dnl -------------------
1236dnl so, first, look up at the kde-config script
1237dnl ------------------
1238
1239if test -z "$SKIP_KDE"; then
1240AC_DEFUN(AM_PATH_KDE,
1241[
1242 if test "X$KDE_CONFIG" != "X"; then
1243 min_kde_version=ifelse([$1], ,2.0,[$1])
1244 AC_MSG_CHECKING(for KDE version >= $min_kde_version)
1245 no_kde=""
1246 if test "$KDE_CONFIG" = "no" ; then
1247 no_kde=yes
1248 else
1249 KDE_PREFIX=`$KDE_CONFIG $kde_config_args --prefix`
1250 if test "x$KDE_LIBS" = "x"; then
1251 KDE_LIBS="$KDE_PREFIX/lib"
1252 fi
1253 if test "x$KDE_INCLUDES" = "x"; then
1254 KDE_INCLUDES="$KDE_PREFIX/include"
1255 fi
1256 kde_major_version=`$KDE_CONFIG --version | grep KDE | \
1257sed 's/KDE:\ //' | sed 's/\([[0-9]]*\).\([[0-9]]*.*\)/\1/'`
1258 kde_minor_version=`$KDE_CONFIG --version | grep KDE | \
1259sed 's/KDE:\ //' | sed 's/\([[0-9]]*\).\([[0-9]]*.*\)/\2/'`
1260
1261 qt_major_version=`$KDE_CONFIG --version | grep Qt | sed -e \
1262's/Qt:\ //' | sed 's/\([[0-9]]*\).\([[0-9]]*.*\)/\1/'`
1263 qt_minor_version=`$KDE_CONFIG --version | grep Qt | sed -e \
1264's/Qt:\ //' | sed 's/\([[0-9]]*\).\([[0-9]]*.*\)/\2/'`
1265
1266 dnl maybe in a near future we'll get these ones : QT_PREFIX, QT_LIBS,
1267 dnl QT_INCLUDES
1268 dnl but for now we need configure options to get them ...
1269 if test "x$enable-kdetest" = "xyes" ; then
1270 ac_save_LIBS="$LIBS"
1271 LIBS="$LIBS $KDE_LIBS"
1272
1273 dnl fake test
1274 AC_TRY_RUN([
1275#include <stdio.h>
1276int
1277main()
1278{ return 0; }
1279 ],, no_kde=yes,[echo $ac_n "cross compiling KDE ? ? how can i remove that ? :)"])
1280 LIBS="$ac_save_LIBS"
1281 fi
1282 fi
1283 if test "x$no_kde" = x ; then
1284 AC_MSG_RESULT(found KDE $kde_major_version.$kde_minor_version)
1285 ifelse([$2], , :, [$2])
1286 else
1287 AC_MSG_RESULT(no)
1288 KDE_LIBS=""
1289 ifelse([$3], , :, [$3])
1290 fi
1291else
1292 AC_MSG_RESULT(no)
1293 KDE_LIBS=""
1294 ifelse([$3], , :, [$3])
1295fi
1296AC_SUBST(KDE_LIBS)
1297AC_SUBST(KDE_INCLUDES)
1298AC_SUBST(KDE_PREFIX)
1299])
1300
1301dnl Check all the KDE stuff
1302AC_MSG_CHECKING(--disable-rpath argument)
1303AC_ARG_ENABLE(rpath,
1304 [ --disable-rpath Disable rpath.],
1305 , enable_rpath="yes")
1306if test "$enable_rpath" = "yes"; then
1307 AC_MSG_RESULT(no)
1308else
1309 AC_MSG_RESULT(yes)
1310fi
1311
1312AC_MSG_CHECKING(--with-kde-prefix argument)
1313AC_ARG_WITH(kde-prefix,[ --with-kde-prefix=PFX Prefix where KDE is installed (optional)],kde_config_prefix="$withval";
1314AC_MSG_RESULT($kde_config_prefix), kde_config_prefix="";AC_MSG_RESULT(no))
1315
1316AC_ARG_WITH(kde-includes,
1317 [ --with-kde-includes=DIR Specify location of KDE headers],
1318 [KDE_INCLUDES="$withval"]
1319 )
1320
1321AC_ARG_WITH(kde-libraries,
1322 [ --with-kde-libs=DIR Specify location of KDE libraries],
1323 [KDE_LIBS="$withval"]
1324 )
1325
1326AC_MSG_CHECKING(--disable-kdetest argument)
1327AC_ARG_ENABLE(kdetest,
1328 [ --disable-kdetest Do not try to compile and run a test KDE program],
1329 enable_kdetest=yes)
1330
1331if test "x$enable_kdetest" = "xyes" ; then
1332 AC_MSG_RESULT(kde test enabled)
1333else
1334 AC_MSG_RESULT(kde test disabled)
1335fi
1336
1337if test "x$kde_config_prefix" != "x" ; then
1338 kde_config_args=""
1339 KDE_CONFIG=$kde_config_prefix/bin/kde-config
1340fi
1341
1342if test "X$KDE_CONFIG" = "X"; then
1343 AC_PATH_PROG(KDE_CONFIG, kde-config, no)
1344else
1345 AC_MSG_RESULT(Using KDE configuration program $KDE_CONFIG)
1346fi
1347
1348if test "X$KDE_CONFIG" != "X" ; then
1349 AM_PATH_KDE(2.0.0,
1350 [GUI_LIB_LOC="-L$KDE_LIBS -lkdeui -lkdecore -lDCOP"
1351 GUI_INC_LOC="-I$KDE_INCLUDES"
1352 KDEDIR="$KDE_PREFIX"], )
1353 if test "x$KDE_PREFIX" != "x"; then
1354 AC_MSG_CHECKING(for QT version $qt_major_version.x)
1355 if test "x$ROOTQT" != "x" ; then
1356 GUI_INC_LOC="-I$QT_INCLUDES $GUI_INC_LOC"
1357 if test $qt_major_version -lt 2; then
1358 AC_MSG_ERROR(Your QT version is prior to 2.0; KDE 2.x and 3.x require at least QT 2)
1359 fi
1360 dnl hack for FreeBSD
1361 if test "`(uname) 2>/dev/null`" = "FreeBSD"; then
1362 CFLAGS="$CFLAGS -D_THREAD_SAFE"
1363 CXXFLAGS="$CXXFLAGS -D_THREAD_SAFE"
1364 GUI_LIB_LOC="$GUI_LIB_LOC -pthread"
1365 LIBS="$LIBS -pthread"
1366 fi
1367
1368 dnl check the version
1369 if test "x$enable_rpath" = "xyes"; then
1370 if test $qt_major_version = 2; then
1371 GUI_LIB_LOC="-L$KDE_LIBS -lkfile -L$QT_LIBS -lqt $GUI_LIB_LOC \
1372-Wl,--rpath -Wl,$KDE_LIBS -Wl,--rpath -Wl,$QT_LIBS"
1373 else
1374 GUI_LIB_LOC="-L$KDE_LIBS -lkio -L$QT_LIBS -lqt-mt $GUI_LIB_LOC \
1375-Wl,--rpath -Wl,$KDE_LIBS -Wl,--rpath -Wl,$QT_LIBS"
1376 fi
1377 else
1378 if test $qt_major_version = 2; then
1379 GUI_LIB_LOC="-L$KDE_LIBS -lkfile -L$QT_LIBS -lqt $GUI_LIB_LOC"
1380 else
1381 GUI_LIB_LOC="-L$KDE_LIBS -lkio -L$QT_LIBS -lqt-mt $GUI_LIB_LOC"
1382 fi
1383 fi
1384
1385 dnl Remove "-I/usr/include " from GUI_*
1386 GUI_INC_LOC="`echo $GUI_INC_LOC\ | sed 's%-I/usr/include %%'`"
1387dnl GUI_LIB_LOC="`echo $GUI_LIB_LOC\ | sed 's% -L/usr/lib%%'`"
1388
1389 AC_MSG_RESULT(found $qt_major_version.$qt_minor_version in $ROOTQT)
1390 SKIP_GTK=YES
1391 SKIP_ATHENA=YES
1392 SKIP_MOTIF=YES
1393 GUITYPE=KDE
1394 AC_SUBST(KDE_PREFIX)
1395 AC_SUBST(QT_LIBS)
1396 AC_SUBST(QT_INCLUDES)
1397 AC_SUBST(ROOTQT)
1398 AC_SUBST(MOC)
1399 AC_DEFINE(FEAT_GUI_KDE)
1400 else
1401 AC_MSG_ERROR(Detected QT version mismatched)
1402 fi
1403 else
1404 AC_MSG_ERROR(Could not find KDE installation prefix)
1405 fi
1406fi
1407fi
1408
Bram Moolenaar071d4272004-06-13 20:20:40 +00001409if test "x$MACOSX" = "xyes" -a -z "$SKIP_CARBON" -a "x$CARBON" = "xyes"; then
1410 AC_MSG_CHECKING(for Carbon GUI)
1411 dnl already did this
1412 AC_MSG_RESULT(yes);
1413 GUITYPE=CARBONGUI
1414 dnl skip everything else
1415 SKIP_GTK=YES;
1416 SKIP_GTK2=YES;
1417 SKIP_GNOME=YES;
1418 SKIP_MOTIF=YES;
1419 SKIP_ATHENA=YES;
1420 SKIP_NEXTAW=YES;
1421 SKIP_PHOTON=YES;
1422 SKIP_BEOS=YES;
1423 SKIP_CARBON=YES
1424fi
1425
Bram Moolenaar071d4272004-06-13 20:20:40 +00001426dnl
1427dnl Get the cflags and libraries from the gtk-config script
1428dnl
1429
1430dnl define an autoconf function to check for a specified version of GTK, and
1431dnl try to compile/link a GTK program. this gets used once for GTK 1.1.16.
1432dnl
1433dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
1434dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
1435dnl
1436AC_DEFUN(AM_PATH_GTK,
1437[
1438 if test "X$GTK_CONFIG" != "Xno" -o "X$PKG_CONFIG" != "Xno"; then
1439 {
1440 min_gtk_version=ifelse([$1], ,0.99.7,$1)
1441 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
1442 no_gtk=""
1443 if (test "X$SKIP_GTK2" != "XYES" -a "X$PKG_CONFIG" != "Xno") \
1444 && $PKG_CONFIG --exists gtk+-2.0; then
1445 {
1446 dnl We should be using PKG_CHECK_MODULES() instead of this hack.
1447 dnl But I guess the dependency on pkgconfig.m4 is not wanted or
1448 dnl something like that.
1449 GTK_CFLAGS=`$PKG_CONFIG --cflags gtk+-2.0`
1450 GTK_LIBS=`$PKG_CONFIG --libs gtk+-2.0`
1451 gtk_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1452 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
1453 gtk_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1454 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
1455 gtk_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1456 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
1457 }
1458 elif test "X$GTK_CONFIG" != "Xno"; then
1459 {
1460 GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
1461 GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
1462 gtk_major_version=`$GTK_CONFIG $gtk_config_args --version | \
1463 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
1464 gtk_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
1465 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
1466 gtk_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
1467 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
1468 }
1469 else
1470 no_gtk=yes
1471 fi
1472
1473 if test "x$enable_gtktest" = "xyes" -a "x$no_gtk" = "x"; then
1474 {
1475 ac_save_CFLAGS="$CFLAGS"
1476 ac_save_LIBS="$LIBS"
1477 CFLAGS="$CFLAGS $GTK_CFLAGS"
1478 LIBS="$LIBS $GTK_LIBS"
1479
1480 dnl
1481 dnl Now check if the installed GTK is sufficiently new. (Also sanity
1482 dnl checks the results of gtk-config to some extent
1483 dnl
1484 rm -f conf.gtktest
1485 AC_TRY_RUN([
1486#include <gtk/gtk.h>
1487#include <stdio.h>
1488
1489int
1490main ()
1491{
1492int major, minor, micro;
1493char *tmp_version;
1494
1495system ("touch conf.gtktest");
1496
1497/* HP/UX 9 (%@#!) writes to sscanf strings */
1498tmp_version = g_strdup("$min_gtk_version");
1499if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
1500 printf("%s, bad version string\n", "$min_gtk_version");
1501 exit(1);
1502 }
1503
1504if ((gtk_major_version > major) ||
1505 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
1506 ((gtk_major_version == major) && (gtk_minor_version == minor) &&
1507 (gtk_micro_version >= micro)))
1508{
1509 return 0;
1510}
1511return 1;
1512}
1513],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1514 CFLAGS="$ac_save_CFLAGS"
1515 LIBS="$ac_save_LIBS"
1516 }
1517 fi
1518 if test "x$no_gtk" = x ; then
1519 if test "x$enable_gtktest" = "xyes"; then
1520 AC_MSG_RESULT(yes; found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version)
1521 else
1522 AC_MSG_RESULT(found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version)
1523 fi
1524 ifelse([$2], , :, [$2])
1525 else
1526 {
1527 AC_MSG_RESULT(no)
1528 GTK_CFLAGS=""
1529 GTK_LIBS=""
1530 ifelse([$3], , :, [$3])
1531 }
1532 fi
1533 }
1534 else
1535 GTK_CFLAGS=""
1536 GTK_LIBS=""
1537 ifelse([$3], , :, [$3])
1538 fi
1539 AC_SUBST(GTK_CFLAGS)
1540 AC_SUBST(GTK_LIBS)
1541 rm -f conf.gtktest
1542])
1543
1544dnl ---------------------------------------------------------------------------
1545dnl gnome
1546dnl ---------------------------------------------------------------------------
1547AC_DEFUN([GNOME_INIT_HOOK],
1548[
1549 AC_SUBST(GNOME_LIBS)
1550 AC_SUBST(GNOME_LIBDIR)
1551 AC_SUBST(GNOME_INCLUDEDIR)
1552
1553 AC_ARG_WITH(gnome-includes,
1554 [ --with-gnome-includes=DIR Specify location of GNOME headers],
1555 [CFLAGS="$CFLAGS -I$withval"]
1556 )
1557
1558 AC_ARG_WITH(gnome-libs,
1559 [ --with-gnome-libs=DIR Specify location of GNOME libs],
1560 [LDFLAGS="$LDFLAGS -L$withval" gnome_prefix=$withval]
1561 )
1562
1563 AC_ARG_WITH(gnome,
1564 [ --with-gnome Specify prefix for GNOME files],
1565 if test x$withval = xyes; then
1566 want_gnome=yes
1567 ifelse([$1], [], :, [$1])
1568 else
1569 if test "x$withval" = xno; then
1570 want_gnome=no
1571 else
1572 want_gnome=yes
1573 LDFLAGS="$LDFLAGS -L$withval/lib"
1574 CFLAGS="$CFLAGS -I$withval/include"
1575 gnome_prefix=$withval/lib
1576 fi
1577 fi,
1578 want_gnome=yes)
1579
1580 if test "x$want_gnome" = xyes -a "0$gtk_major_version" -ge 2; then
1581 {
1582 AC_MSG_CHECKING(for libgnomeui-2.0)
1583 if $PKG_CONFIG --exists libgnomeui-2.0; then
1584 AC_MSG_RESULT(yes)
1585 GNOME_LIBS=`$PKG_CONFIG --libs-only-l libgnomeui-2.0`
1586 GNOME_LIBDIR=`$PKG_CONFIG --libs-only-L libgnomeui-2.0`
1587 GNOME_INCLUDEDIR=`$PKG_CONFIG --cflags libgnomeui-2.0`
1588 $1
1589 else
1590 AC_MSG_RESULT(not found)
1591 if test "x$2" = xfail; then
1592 AC_MSG_ERROR(Could not find libgnomeui-2.0 via pkg-config)
1593 fi
1594 fi
1595 }
1596 elif test "x$want_gnome" = xyes; then
1597 {
1598 AC_PATH_PROG(GNOME_CONFIG,gnome-config,no)
1599 if test "$GNOME_CONFIG" = "no"; then
1600 no_gnome_config="yes"
1601 else
1602 AC_MSG_CHECKING(if $GNOME_CONFIG works)
1603 if $GNOME_CONFIG --libs-only-l gnome >/dev/null 2>&1; then
1604 AC_MSG_RESULT(yes)
1605 GNOME_LIBS="`$GNOME_CONFIG --libs-only-l gnome gnomeui`"
1606 GNOME_LIBDIR="`$GNOME_CONFIG --libs-only-L gnorba gnomeui`"
1607 GNOME_INCLUDEDIR="`$GNOME_CONFIG --cflags gnorba gnomeui`"
1608 $1
1609 else
1610 AC_MSG_RESULT(no)
1611 no_gnome_config="yes"
1612 fi
1613 fi
1614
1615 if test x$exec_prefix = xNONE; then
1616 if test x$prefix = xNONE; then
1617 gnome_prefix=$ac_default_prefix/lib
1618 else
1619 gnome_prefix=$prefix/lib
1620 fi
1621 else
1622 gnome_prefix=`eval echo \`echo $libdir\``
1623 fi
1624
1625 if test "$no_gnome_config" = "yes"; then
1626 AC_MSG_CHECKING(for gnomeConf.sh file in $gnome_prefix)
1627 if test -f $gnome_prefix/gnomeConf.sh; then
1628 AC_MSG_RESULT(found)
1629 echo "loading gnome configuration from" \
1630 "$gnome_prefix/gnomeConf.sh"
1631 . $gnome_prefix/gnomeConf.sh
1632 $1
1633 else
1634 AC_MSG_RESULT(not found)
1635 if test x$2 = xfail; then
1636 AC_MSG_ERROR(Could not find the gnomeConf.sh file that is generated by gnome-libs install)
1637 fi
1638 fi
1639 fi
1640 }
1641 fi
1642])
1643
1644AC_DEFUN([GNOME_INIT],[
1645 GNOME_INIT_HOOK([],fail)
1646])
1647
1648
1649dnl ---------------------------------------------------------------------------
1650dnl Check for GTK. First checks for gtk-config, cause it needs that to get the
1651dnl correct compiler flags. Then checks for GTK 1.1.16. If that fails, then
1652dnl it checks for 1.0.6. If both fail, then continue on for Motif as before...
1653dnl ---------------------------------------------------------------------------
1654if test -z "$SKIP_GTK"; then
1655
1656 AC_MSG_CHECKING(--with-gtk-prefix argument)
1657 AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
1658 gtk_config_prefix="$withval"; AC_MSG_RESULT($gtk_config_prefix),
1659 gtk_config_prefix=""; AC_MSG_RESULT(no))
1660
1661 AC_MSG_CHECKING(--with-gtk-exec-prefix argument)
1662 AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
1663 gtk_config_exec_prefix="$withval"; AC_MSG_RESULT($gtk_config_prefix),
1664 gtk_config_exec_prefix=""; AC_MSG_RESULT(no))
1665
1666 AC_MSG_CHECKING(--disable-gtktest argument)
1667 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
1668 , enable_gtktest=yes)
1669 if test "x$enable_gtktest" = "xyes" ; then
1670 AC_MSG_RESULT(gtk test enabled)
1671 else
1672 AC_MSG_RESULT(gtk test disabled)
1673 fi
1674
1675 if test "x$gtk_config_prefix" != "x" ; then
1676 gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
1677 GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
1678 fi
1679 if test "x$gtk_config_exec_prefix" != "x" ; then
1680 gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
1681 GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
1682 fi
1683 if test "X$GTK_CONFIG" = "X"; then
1684 AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
1685 if test "X$GTK_CONFIG" = "Xno"; then
1686 dnl Some distributions call it gtk12-config, annoying!
1687 AC_PATH_PROG(GTK12_CONFIG, gtk12-config, no)
1688 GTK_CONFIG="$GTK12_CONFIG"
1689 fi
1690 else
1691 AC_MSG_RESULT(Using GTK configuration program $GTK_CONFIG)
1692 fi
1693 if test "X$PKG_CONFIG" = "X"; then
1694 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1695 fi
1696
1697 if test "x$GTK_CONFIG:$PKG_CONFIG" != "xno:no"; then
1698 dnl First try finding version 2.2.0 or later. The 2.0.x series has
1699 dnl problems (bold fonts, --remote doesn't work).
1700 if test "X$SKIP_GTK2" != "XYES"; then
1701 AM_PATH_GTK(2.2.0,
1702 [GTK_LIBNAME="$GTK_LIBS"
1703 GUI_INC_LOC="$GTK_CFLAGS"], )
1704 if test "x$GTK_CFLAGS" != "x"; then
1705 SKIP_ATHENA=YES
1706 SKIP_NEXTAW=YES
1707 SKIP_MOTIF=YES
1708 GUITYPE=GTK
1709 AC_SUBST(GTK_LIBNAME)
1710 fi
1711 fi
1712
1713 dnl If there is no 2.2.0 or later try the 1.x.x series. We require at
1714 dnl least GTK 1.1.16. 1.0.6 doesn't work. 1.1.1 to 1.1.15
1715 dnl were test versions.
1716 if test "x$GUITYPE" != "xGTK"; then
1717 SKIP_GTK2=YES
1718 AM_PATH_GTK(1.1.16,
1719 [GTK_LIBNAME="$GTK_LIBS"
1720 GUI_INC_LOC="$GTK_CFLAGS"], )
1721 if test "x$GTK_CFLAGS" != "x"; then
1722 SKIP_ATHENA=YES
1723 SKIP_NEXTAW=YES
1724 SKIP_MOTIF=YES
1725 GUITYPE=GTK
1726 AC_SUBST(GTK_LIBNAME)
1727 fi
1728 fi
1729 fi
1730 dnl Give a warning if GTK is older than 1.2.3
1731 if test "x$GUITYPE" = "xGTK"; then
1732 if test "$gtk_major_version" = 1 -a "0$gtk_minor_version" -lt 2 \
1733 -o "$gtk_major_version" = 1 -a "$gtk_minor_version" = 2 -a "0$gtk_micro_version" -lt 3; then
1734 AC_MSG_RESULT(this GTK version is old; version 1.2.3 or later is recommended)
1735 else
1736 {
1737 if test "0$gtk_major_version" -ge 2; then
1738 AC_DEFINE(HAVE_GTK2)
1739 if test "$gtk_minor_version" = 1 -a "0$gtk_micro_version" -ge 1 \
1740 || test "0$gtk_minor_version" -ge 2 \
1741 || test "0$gtk_major_version" -gt 2; then
1742 AC_DEFINE(HAVE_GTK_MULTIHEAD)
1743 fi
1744 fi
1745 dnl
1746 dnl if GTK exists, and it's not the 1.0.x series, then check for GNOME.
1747 dnl
1748 if test -z "$SKIP_GNOME"; then
1749 {
1750 GNOME_INIT_HOOK([have_gnome=yes])
1751 if test x$have_gnome = xyes ; then
1752 AC_DEFINE(FEAT_GUI_GNOME)
1753 GUI_INC_LOC="$GUI_INC_LOC $GNOME_INCLUDEDIR"
1754 GTK_LIBNAME="$GTK_LIBNAME $GNOME_LIBDIR $GNOME_LIBS"
1755 fi
1756 }
1757 fi
1758 }
1759 fi
1760 fi
1761fi
1762
1763dnl Check for Motif include files location.
1764dnl The LAST one found is used, this makes the highest version to be used,
1765dnl e.g. when Motif1.2 and Motif2.0 are both present.
1766
1767if test -z "$SKIP_MOTIF"; then
1768 gui_XXX="/usr/XXX/Motif* /usr/Motif*/XXX /usr/XXX /usr/shlib /usr/X11*/XXX /usr/XXX/X11* /usr/dt/XXX /local/Motif*/XXX /local/XXX/Motif* /usr/local/Motif*/XXX /usr/local/XXX/Motif* /usr/local/XXX /usr/local/X11*/XXX /usr/local/LessTif/Motif*/XXX $MOTIFHOME/XXX"
1769 dnl Remove "-I" from before $GUI_INC_LOC if it's there
1770 GUI_INC_LOC="`echo $GUI_INC_LOC|sed 's%-I%%g'`"
1771
1772 AC_MSG_CHECKING(for location of Motif GUI includes)
1773 gui_includes="`echo $x_includes|sed 's%/[^/][^/]*$%%'` `echo "$gui_XXX" | sed s/XXX/include/g` $GUI_INC_LOC"
1774 GUI_INC_LOC=
1775 for try in $gui_includes; do
1776 if test -f "$try/Xm/Xm.h"; then
1777 GUI_INC_LOC=$try
1778 fi
1779 done
1780 if test -n "$GUI_INC_LOC"; then
1781 if test "$GUI_INC_LOC" = /usr/include; then
1782 GUI_INC_LOC=
1783 AC_MSG_RESULT(in default path)
1784 else
1785 AC_MSG_RESULT($GUI_INC_LOC)
1786 fi
1787 else
1788 AC_MSG_RESULT(<not found>)
1789 SKIP_MOTIF=YES
1790 fi
1791fi
1792
1793dnl Check for Motif library files location. In the same order as the include
1794dnl files, to avoid a mixup if several versions are present
1795
1796if test -z "$SKIP_MOTIF"; then
1797 AC_MSG_CHECKING(--with-motif-lib argument)
1798 AC_ARG_WITH(motif-lib,
1799 [ --with-motif-lib=STRING Library for Motif ],
1800 [ MOTIF_LIBNAME="${withval}" ] )
1801
1802 if test -n "$MOTIF_LIBNAME"; then
1803 AC_MSG_RESULT($MOTIF_LIBNAME)
1804 GUI_LIB_LOC=
1805 else
1806 AC_MSG_RESULT(no)
1807
1808 dnl Remove "-L" from before $GUI_LIB_LOC if it's there
1809 GUI_LIB_LOC="`echo $GUI_LIB_LOC|sed 's%-L%%g'`"
1810
1811 AC_MSG_CHECKING(for location of Motif GUI libs)
1812 gui_libs="`echo $x_libraries|sed 's%/[^/][^/]*$%%'` `echo "$gui_XXX" | sed s/XXX/lib/g` `echo "$GUI_INC_LOC" | sed s/include/lib/` $GUI_LIB_LOC"
1813 GUI_LIB_LOC=
1814 for try in $gui_libs; do
1815 for libtry in "$try"/libXm.a "$try"/libXm.so* "$try"/libXm.sl; do
1816 if test -f "$libtry"; then
1817 GUI_LIB_LOC=$try
1818 fi
1819 done
1820 done
1821 if test -n "$GUI_LIB_LOC"; then
1822 dnl Remove /usr/lib, it causes trouble on some systems
1823 if test "$GUI_LIB_LOC" = /usr/lib; then
1824 GUI_LIB_LOC=
1825 AC_MSG_RESULT(in default path)
1826 else
1827 if test -n "$GUI_LIB_LOC"; then
1828 AC_MSG_RESULT($GUI_LIB_LOC)
1829 if test "`(uname) 2>/dev/null`" = SunOS &&
1830 uname -r | grep '^5' >/dev/null; then
1831 GUI_LIB_LOC="$GUI_LIB_LOC -R $GUI_LIB_LOC"
1832 fi
1833 fi
1834 fi
1835 MOTIF_LIBNAME=-lXm
1836 else
1837 AC_MSG_RESULT(<not found>)
1838 SKIP_MOTIF=YES
1839 fi
1840 fi
1841fi
1842
1843if test -z "$SKIP_MOTIF"; then
1844 SKIP_ATHENA=YES
1845 SKIP_NEXTAW=YES
1846 GUITYPE=MOTIF
1847 AC_SUBST(MOTIF_LIBNAME)
1848fi
1849
1850dnl Check if the Athena files can be found
1851
1852GUI_X_LIBS=
1853
1854if test -z "$SKIP_ATHENA"; then
1855 AC_MSG_CHECKING(if Athena header files can be found)
1856 cflags_save=$CFLAGS
1857 CFLAGS="$CFLAGS $X_CFLAGS"
1858 AC_TRY_COMPILE([
1859#include <X11/Intrinsic.h>
1860#include <X11/Xaw/Paned.h>], ,
1861 AC_MSG_RESULT(yes),
1862 AC_MSG_RESULT(no); SKIP_ATHENA=YES )
1863 CFLAGS=$cflags_save
1864fi
1865
1866if test -z "$SKIP_ATHENA"; then
1867 GUITYPE=ATHENA
1868fi
1869
1870if test -z "$SKIP_NEXTAW"; then
1871 AC_MSG_CHECKING(if neXtaw header files can be found)
1872 cflags_save=$CFLAGS
1873 CFLAGS="$CFLAGS $X_CFLAGS"
1874 AC_TRY_COMPILE([
1875#include <X11/Intrinsic.h>
1876#include <X11/neXtaw/Paned.h>], ,
1877 AC_MSG_RESULT(yes),
1878 AC_MSG_RESULT(no); SKIP_NEXTAW=YES )
1879 CFLAGS=$cflags_save
1880fi
1881
1882if test -z "$SKIP_NEXTAW"; then
1883 GUITYPE=NEXTAW
1884fi
1885
1886if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
1887 dnl Prepend -I and -L to $GUI_INC_LOC and $GUI_LIB_LOC if not empty
1888 dnl Avoid adding it when it twice
1889 if test -n "$GUI_INC_LOC"; then
1890 GUI_INC_LOC=-I"`echo $GUI_INC_LOC|sed 's%-I%%'`"
1891 fi
1892 if test -n "$GUI_LIB_LOC"; then
1893 GUI_LIB_LOC=-L"`echo $GUI_LIB_LOC|sed 's%-L%%'`"
1894 fi
1895
1896 dnl Check for -lXext and then for -lXmu
1897 ldflags_save=$LDFLAGS
1898 LDFLAGS="$X_LIBS $LDFLAGS"
1899 AC_CHECK_LIB(Xext, XShapeQueryExtension, [GUI_X_LIBS="-lXext"],,
1900 [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1901 dnl For Solaris we need -lw and -ldl before linking with -lXmu works.
1902 AC_CHECK_LIB(w, wslen, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lw"],,
1903 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1904 AC_CHECK_LIB(dl, dlsym, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldl"],,
1905 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1906 AC_CHECK_LIB(Xmu, XmuCreateStippledPixmap, [GUI_X_LIBS="-lXmu $GUI_X_LIBS"],,
1907 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1908 if test -z "$SKIP_MOTIF"; then
1909 AC_CHECK_LIB(Xp, XpEndJob, [GUI_X_LIBS="-lXp $GUI_X_LIBS"],,
1910 [$GUI_X_LIBS -lXm -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1911 fi
1912 LDFLAGS=$ldflags_save
1913
1914 dnl Execute xmkmf to figure out if -DNARROWPROTO is needed.
1915 AC_MSG_CHECKING(for extra X11 defines)
1916 NARROW_PROTO=
1917 rm -fr conftestdir
1918 if mkdir conftestdir; then
1919 cd conftestdir
1920 cat > Imakefile <<'EOF'
1921acfindx:
1922 @echo 'NARROW_PROTO="${PROTO_DEFINES}"'
1923EOF
1924 if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
1925 eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
1926 fi
1927 cd ..
1928 rm -fr conftestdir
1929 fi
1930 if test -z "$NARROW_PROTO"; then
1931 AC_MSG_RESULT(no)
1932 else
1933 AC_MSG_RESULT($NARROW_PROTO)
1934 fi
1935 AC_SUBST(NARROW_PROTO)
1936fi
1937
1938dnl Look for XSMP support - but don't necessarily restrict it to X11 GUIs
1939dnl use the X11 include path
1940if test "$enable_xsmp" = "yes"; then
1941 cppflags_save=$CPPFLAGS
1942 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
1943 AC_CHECK_HEADERS(X11/SM/SMlib.h)
1944 CPPFLAGS=$cppflags_save
1945fi
1946
1947
1948if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF" -o -z "$SKIP_GTK"; then
1949 dnl Check for X11/xpm.h and X11/Sunkeysym.h with the GUI include path
1950 cppflags_save=$CPPFLAGS
1951 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
1952 AC_CHECK_HEADERS(X11/xpm.h X11/Sunkeysym.h)
1953
1954 dnl automatically disable XIM when XIMtext isn't in X11/Xlib.h
1955 if test ! "$enable_xim" = "no"; then
1956 AC_MSG_CHECKING(for XIMText in X11/Xlib.h)
1957 AC_EGREP_CPP(XIMText, [#include <X11/Xlib.h>],
1958 AC_MSG_RESULT(yes),
1959 AC_MSG_RESULT(no; xim has been disabled); enable_xim = "no")
1960 fi
1961 CPPFLAGS=$cppflags_save
1962
1963 dnl automatically enable XIM when hangul input isn't enabled
1964 if test "$enable_xim" = "auto" -a "$enable_hangulinput" != "yes" \
1965 -a "x$GUITYPE" != "xNONE" ; then
1966 AC_MSG_RESULT(X GUI selected; xim has been enabled)
1967 enable_xim="yes"
1968 fi
1969fi
1970
1971if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
1972 cppflags_save=$CPPFLAGS
1973 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
1974 AC_CHECK_HEADERS(X11/Xmu/Editres.h)
1975 CPPFLAGS=$cppflags_save
1976fi
1977
1978dnl Only use the Xm directory when compiling Motif, don't use it for Athena
1979if test -z "$SKIP_MOTIF"; then
1980 cppflags_save=$CPPFLAGS
1981 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
1982 AC_CHECK_HEADERS(Xm/Xm.h Xm/XpmP.h)
1983 CPPFLAGS=$cppflags_save
1984fi
1985
1986if test "x$GUITYPE" = "xNONE" -a "$enable_xim" = "yes"; then
1987 AC_MSG_RESULT(no GUI selected; xim has been disabled)
1988 enable_xim="no"
1989fi
1990if test "x$GUITYPE" = "xNONE" -a "$enable_fontset" = "yes"; then
1991 AC_MSG_RESULT(no GUI selected; fontset has been disabled)
1992 enable_fontset="no"
1993fi
1994if test "x$GUITYPE:$enable_fontset" = "xGTK:yes" -a "0$gtk_major_version" -ge 2; then
1995 AC_MSG_RESULT(GTK+ 2 GUI selected; fontset has been disabled)
1996 enable_fontset="no"
1997fi
1998
1999dnl There is no test for the BeOS GUI, if it's selected it's used
2000if test -z "$SKIP_BEOS"; then
2001 GUITYPE=BEOSGUI
2002fi
2003
2004if test -z "$SKIP_PHOTON"; then
2005 GUITYPE=PHOTONGUI
2006fi
2007
2008AC_SUBST(GUI_INC_LOC)
2009AC_SUBST(GUI_LIB_LOC)
2010AC_SUBST(GUITYPE)
2011AC_SUBST(GUI_X_LIBS)
2012
2013if test "$enable_workshop" = "yes" -a -n "$SKIP_MOTIF"; then
2014 AC_MSG_ERROR([cannot use workshop without Motif])
2015fi
2016
2017dnl defining FEAT_XIM and FEAT_XFONTSET is delayed, so that they can be disabled
2018if test "$enable_xim" = "yes"; then
2019 AC_DEFINE(FEAT_XIM)
2020fi
2021if test "$enable_fontset" = "yes"; then
2022 AC_DEFINE(FEAT_XFONTSET)
2023fi
2024
2025
2026dnl ---------------------------------------------------------------------------
2027dnl end of GUI-checking
2028dnl ---------------------------------------------------------------------------
2029
2030
2031dnl Only really enable hangul input when GUI and XFONTSET are available
2032if test "$enable_hangulinput" = "yes"; then
2033 if test "x$GUITYPE" = "xNONE"; then
2034 AC_MSG_RESULT(no GUI selected; hangul input has been disabled)
2035 enable_hangulinput=no
2036 else
2037 AC_DEFINE(FEAT_HANGULIN)
2038 HANGULIN_SRC=hangulin.c
2039 AC_SUBST(HANGULIN_SRC)
2040 HANGULIN_OBJ=objects/hangulin.o
2041 AC_SUBST(HANGULIN_OBJ)
2042 fi
2043fi
2044
2045dnl Checks for libraries and include files.
2046
2047AC_MSG_CHECKING(quality of toupper)
2048AC_TRY_RUN([#include <ctype.h>
2049main() { exit(toupper('A') == 'A' && tolower('z') == 'z'); }],
2050 AC_DEFINE(BROKEN_TOUPPER) AC_MSG_RESULT(bad),
2051 AC_MSG_RESULT(good), AC_MSG_ERROR(failed to compile test program))
2052
2053AC_MSG_CHECKING(whether __DATE__ and __TIME__ work)
2054AC_TRY_COMPILE(, [printf("(" __DATE__ " " __TIME__ ")");],
2055 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_DATE_TIME),
2056 AC_MSG_RESULT(no))
2057
2058dnl Checks for header files.
2059AC_CHECK_HEADER(elf.h, HAS_ELF=1)
2060dnl AC_CHECK_HEADER(dwarf.h, SVR4=1)
2061if test "$HAS_ELF" = 1; then
2062 AC_CHECK_LIB(elf, main)
2063fi
2064
2065AC_HEADER_DIRENT
2066
2067dnl check for standard headers, we don't use this in Vim but other stuff
2068dnl in autoconf needs it
2069AC_HEADER_STDC
2070AC_HEADER_SYS_WAIT
2071
2072dnl If sys/wait.h is not found it might still exist but not be POSIX
2073dnl compliant. In that case we define HAVE_UNION_WAIT (for NeXT)
2074if test $ac_cv_header_sys_wait_h = no; then
2075 AC_MSG_CHECKING([for sys/wait.h that defines union wait])
2076 AC_TRY_COMPILE([#include <sys/wait.h>],
2077 [union wait xx, yy; xx = yy],
2078 AC_MSG_RESULT(yes)
2079 AC_DEFINE(HAVE_SYS_WAIT_H)
2080 AC_DEFINE(HAVE_UNION_WAIT),
2081 AC_MSG_RESULT(no))
2082fi
2083
2084AC_CHECK_HEADERS(stdarg.h stdlib.h string.h sys/select.h sys/utsname.h \
2085 termcap.h fcntl.h sgtty.h sys/ioctl.h sys/time.h termio.h \
2086 iconv.h langinfo.h unistd.h stropts.h errno.h \
2087 sys/resource.h sys/systeminfo.h locale.h \
2088 sys/stream.h sys/ptem.h termios.h libc.h sys/statfs.h \
2089 poll.h sys/poll.h pwd.h utime.h sys/param.h libintl.h \
2090 libgen.h util/debug.h util/msg18n.h frame.h pthread_np.h \
2091 sys/acl.h sys/access.h sys/sysctl.h sys/sysinfo.h wchar.h)
2092
2093dnl On Mac OS X strings.h exists but produces a warning message :-(
2094if test "x$MACOSX" != "xyes"; then
2095 AC_CHECK_HEADERS(strings.h)
2096fi
2097
2098dnl Check if strings.h and string.h can both be included when defined.
2099AC_MSG_CHECKING([if strings.h can be included after string.h])
2100cppflags_save=$CPPFLAGS
2101CPPFLAGS="$CPPFLAGS $X_CFLAGS"
2102AC_TRY_COMPILE([
2103#if defined(_AIX) && !defined(_AIX51) && !defined(_NO_PROTO)
2104# define _NO_PROTO /* like in os_unix.h, causes conflict for AIX (Winn) */
2105 /* but don't do it on AIX 5.1 (Uribarri) */
2106#endif
2107#ifdef HAVE_XM_XM_H
2108# include <Xm/Xm.h> /* This breaks it for HP-UX 11 (Squassabia) */
2109#endif
2110#ifdef HAVE_STRING_H
2111# include <string.h>
2112#endif
2113#if defined(HAVE_STRINGS_H)
2114# include <strings.h>
2115#endif
2116 ], [int i; i = 0;],
2117 AC_MSG_RESULT(yes),
2118 AC_DEFINE(NO_STRINGS_WITH_STRING_H)
2119 AC_MSG_RESULT(no))
2120CPPFLAGS=$cppflags_save
2121
2122dnl Checks for typedefs, structures, and compiler characteristics.
2123AC_PROG_GCC_TRADITIONAL
2124AC_C_CONST
2125AC_TYPE_MODE_T
2126AC_TYPE_OFF_T
2127AC_TYPE_PID_T
2128AC_TYPE_SIZE_T
2129AC_TYPE_UID_T
2130AC_HEADER_TIME
2131AC_CHECK_TYPE(ino_t, long)
2132AC_CHECK_TYPE(dev_t, unsigned)
2133
2134AC_MSG_CHECKING(for rlim_t)
2135if eval "test \"`echo '$''{'ac_cv_type_rlim_t'+set}'`\" = set"; then
2136 AC_MSG_RESULT([(cached) $ac_cv_type_rlim_t])
2137else
2138 AC_EGREP_CPP(dnl
2139changequote(<<,>>)dnl
2140<<(^|[^a-zA-Z_0-9])rlim_t[^a-zA-Z_0-9]>>dnl
2141changequote([,]),
2142 [
2143#include <sys/types.h>
2144#if STDC_HEADERS
2145#include <stdlib.h>
2146#include <stddef.h>
2147#endif
2148#ifdef HAVE_SYS_RESOURCE_H
2149#include <sys/resource.h>
2150#endif
2151 ], ac_cv_type_rlim_t=yes, ac_cv_type_rlim_t=no)
2152 AC_MSG_RESULT($ac_cv_type_rlim_t)
2153fi
2154if test $ac_cv_type_rlim_t = no; then
2155 cat >> confdefs.h <<\EOF
2156#define rlim_t unsigned long
2157EOF
2158fi
2159
2160AC_MSG_CHECKING(for stack_t)
2161if eval "test \"`echo '$''{'ac_cv_type_stack_t'+set}'`\" = set"; then
2162 AC_MSG_RESULT([(cached) $ac_cv_type_stack_t])
2163else
2164 AC_EGREP_CPP(stack_t,
2165 [
2166#include <sys/types.h>
2167#if STDC_HEADERS
2168#include <stdlib.h>
2169#include <stddef.h>
2170#endif
2171#include <signal.h>
2172 ], ac_cv_type_stack_t=yes, ac_cv_type_stack_t=no)
2173 AC_MSG_RESULT($ac_cv_type_stack_t)
2174fi
2175if test $ac_cv_type_stack_t = no; then
2176 cat >> confdefs.h <<\EOF
2177#define stack_t struct sigaltstack
2178EOF
2179fi
2180
2181dnl BSDI uses ss_base while others use ss_sp for the stack pointer.
2182AC_MSG_CHECKING(whether stack_t has an ss_base field)
2183AC_TRY_COMPILE([
2184#include <sys/types.h>
2185#if STDC_HEADERS
2186#include <stdlib.h>
2187#include <stddef.h>
2188#endif
2189#include <signal.h>
2190#include "confdefs.h"
2191 ], [stack_t sigstk; sigstk.ss_base = 0; ],
2192 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SS_BASE),
2193 AC_MSG_RESULT(no))
2194
2195olibs="$LIBS"
2196AC_MSG_CHECKING(--with-tlib argument)
2197AC_ARG_WITH(tlib, [ --with-tlib=library terminal library to be used ],)
2198if test -n "$with_tlib"; then
2199 AC_MSG_RESULT($with_tlib)
2200 LIBS="$LIBS -l$with_tlib"
2201else
2202 AC_MSG_RESULT([automatic terminal library selection])
2203 dnl On HP-UX 10.10 termcap or termlib should be used instead of
2204 dnl curses, because curses is much slower.
2205 dnl Newer versions of ncurses are preferred over anything.
2206 dnl Older versions of ncurses have bugs, get a new one!
2207 dnl Digital Unix (OSF1) should use curses (Ronald Schild).
2208 case "`uname -s 2>/dev/null`" in
2209 OSF1) tlibs="ncurses curses termlib termcap";;
2210 *) tlibs="ncurses termlib termcap curses";;
2211 esac
2212 for libname in $tlibs; do
2213 AC_CHECK_LIB(${libname}, tgetent,,)
2214 if test "x$olibs" != "x$LIBS"; then
2215 dnl It's possible that a library is found but it doesn't work
2216 dnl e.g., shared library that cannot be found
2217 dnl compile and run a test program to be sure
2218 AC_TRY_RUN([
2219#ifdef HAVE_TERMCAP_H
2220# include <termcap.h>
2221#endif
2222main() {char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(0); }],
2223 res="OK", res="FAIL", res="FAIL")
2224 if test "$res" = "OK"; then
2225 break
2226 fi
2227 AC_MSG_RESULT($libname library is not usable)
2228 LIBS="$olibs"
2229 fi
2230 done
2231fi
2232if test "x$olibs" != "x$LIBS"; then
2233 AC_MSG_CHECKING(whether we talk terminfo)
2234 AC_TRY_RUN([
2235#ifdef HAVE_TERMCAP_H
2236# include <termcap.h>
2237#endif
2238main()
2239{char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(!strcmp(s==0 ? "" : s, "1")); }],
2240 AC_MSG_RESULT([no -- we are in termcap land]),
2241 AC_MSG_RESULT([yes -- terminfo spoken here]); AC_DEFINE(TERMINFO),
2242 AC_MSG_ERROR(failed to compile test program.))
2243else
2244 AC_MSG_RESULT(none found)
2245fi
2246
2247if test "x$olibs" != "x$LIBS"; then
2248 AC_MSG_CHECKING(what tgetent() returns for an unknown terminal)
2249 AC_TRY_RUN([
2250#ifdef HAVE_TERMCAP_H
2251# include <termcap.h>
2252#endif
2253main()
2254{char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist"); exit(res != 0); }],
2255 AC_MSG_RESULT(zero); AC_DEFINE(TGETENT_ZERO_ERR, 0),
2256 AC_MSG_RESULT(non-zero),
2257 AC_MSG_ERROR(failed to compile test program.))
2258fi
2259
2260AC_MSG_CHECKING(whether termcap.h contains ospeed)
2261AC_TRY_LINK([
2262#ifdef HAVE_TERMCAP_H
2263# include <termcap.h>
2264#endif
2265 ], [ospeed = 20000],
2266 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OSPEED),
2267 [AC_MSG_RESULT(no)
2268 AC_MSG_CHECKING(whether ospeed can be extern)
2269 AC_TRY_LINK([
2270#ifdef HAVE_TERMCAP_H
2271# include <termcap.h>
2272#endif
2273extern short ospeed;
2274 ], [ospeed = 20000],
2275 AC_MSG_RESULT(yes); AC_DEFINE(OSPEED_EXTERN),
2276 AC_MSG_RESULT(no))]
2277 )
2278
2279AC_MSG_CHECKING([whether termcap.h contains UP, BC and PC])
2280AC_TRY_LINK([
2281#ifdef HAVE_TERMCAP_H
2282# include <termcap.h>
2283#endif
2284 ], [if (UP == 0 && BC == 0) PC = 1],
2285 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_UP_BC_PC),
2286 [AC_MSG_RESULT(no)
2287 AC_MSG_CHECKING([whether UP, BC and PC can be extern])
2288 AC_TRY_LINK([
2289#ifdef HAVE_TERMCAP_H
2290# include <termcap.h>
2291#endif
2292extern char *UP, *BC, PC;
2293 ], [if (UP == 0 && BC == 0) PC = 1],
2294 AC_MSG_RESULT(yes); AC_DEFINE(UP_BC_PC_EXTERN),
2295 AC_MSG_RESULT(no))]
2296 )
2297
2298AC_MSG_CHECKING(whether tputs() uses outfuntype)
2299AC_TRY_COMPILE([
2300#ifdef HAVE_TERMCAP_H
2301# include <termcap.h>
2302#endif
2303 ], [extern int xx(); tputs("test", 1, (outfuntype)xx)],
2304 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OUTFUNTYPE),
2305 AC_MSG_RESULT(no))
2306
2307dnl On some SCO machines sys/select redefines struct timeval
2308AC_MSG_CHECKING([whether sys/select.h and sys/time.h may both be included])
2309AC_TRY_COMPILE([
2310#include <sys/types.h>
2311#include <sys/time.h>
2312#include <sys/select.h>], ,
2313 AC_MSG_RESULT(yes)
2314 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME),
2315 AC_MSG_RESULT(no))
2316
2317dnl AC_DECL_SYS_SIGLIST
2318
2319dnl Checks for pty.c (copied from screen) ==========================
2320AC_MSG_CHECKING(for /dev/ptc)
2321if test -r /dev/ptc; then
2322 AC_DEFINE(HAVE_DEV_PTC)
2323 AC_MSG_RESULT(yes)
2324else
2325 AC_MSG_RESULT(no)
2326fi
2327
2328AC_MSG_CHECKING(for SVR4 ptys)
2329if test -c /dev/ptmx ; then
2330 AC_TRY_LINK([], [ptsname(0);grantpt(0);unlockpt(0);],
2331 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SVR4_PTYS),
2332 AC_MSG_RESULT(no))
2333else
2334 AC_MSG_RESULT(no)
2335fi
2336
2337AC_MSG_CHECKING(for ptyranges)
2338if test -d /dev/ptym ; then
2339 pdir='/dev/ptym'
2340else
2341 pdir='/dev'
2342fi
2343dnl SCO uses ptyp%d
2344AC_EGREP_CPP(yes,
2345[#ifdef M_UNIX
2346 yes;
2347#endif
2348 ], ptys=`echo /dev/ptyp??`, ptys=`echo $pdir/pty??`)
2349dnl if test -c /dev/ptyp19; then
2350dnl ptys=`echo /dev/ptyp??`
2351dnl else
2352dnl ptys=`echo $pdir/pty??`
2353dnl fi
2354if test "$ptys" != "$pdir/pty??" ; then
2355 p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'`
2356 p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'`
2357 AC_DEFINE_UNQUOTED(PTYRANGE0,"$p0")
2358 AC_DEFINE_UNQUOTED(PTYRANGE1,"$p1")
2359 AC_MSG_RESULT([$p0 / $p1])
2360else
2361 AC_MSG_RESULT([don't know])
2362fi
2363
2364dnl **** pty mode/group handling ****
2365dnl
2366dnl support provided by Luke Mewburn <lm@rmit.edu.au>, 931222
2367AC_MSG_CHECKING(default tty permissions/group)
2368rm -f conftest_grp
2369AC_TRY_RUN([
2370#include <sys/types.h>
2371#include <sys/stat.h>
2372#include <stdio.h>
2373main()
2374{
2375 struct stat sb;
2376 char *x,*ttyname();
2377 int om, m;
2378 FILE *fp;
2379
2380 if (!(x = ttyname(0))) exit(1);
2381 if (stat(x, &sb)) exit(1);
2382 om = sb.st_mode;
2383 if (om & 002) exit(0);
2384 m = system("mesg y");
2385 if (m == -1 || m == 127) exit(1);
2386 if (stat(x, &sb)) exit(1);
2387 m = sb.st_mode;
2388 if (chmod(x, om)) exit(1);
2389 if (m & 002) exit(0);
2390 if (sb.st_gid == getgid()) exit(1);
2391 if (!(fp=fopen("conftest_grp", "w")))
2392 exit(1);
2393 fprintf(fp, "%d\n", sb.st_gid);
2394 fclose(fp);
2395 exit(0);
2396}
2397],[
2398 if test -f conftest_grp; then
2399 ptygrp=`cat conftest_grp`
2400 AC_MSG_RESULT([pty mode: 0620, group: $ptygrp])
2401 AC_DEFINE(PTYMODE, 0620)
2402 AC_DEFINE_UNQUOTED(PTYGROUP,$ptygrp)
2403 else
2404 AC_MSG_RESULT([ptys are world accessable])
2405 fi
2406],
2407 AC_MSG_RESULT([can't determine - assume ptys are world accessable]),
2408 AC_MSG_ERROR(failed to compile test program))
2409rm -f conftest_grp
2410
2411dnl Checks for library functions. ===================================
2412
2413AC_TYPE_SIGNAL
2414
2415dnl find out what to use at the end of a signal function
2416if test $ac_cv_type_signal = void; then
2417 AC_DEFINE(SIGRETURN, [return])
2418else
2419 AC_DEFINE(SIGRETURN, [return 0])
2420fi
2421
2422dnl check if struct sigcontext is defined (used for SGI only)
2423AC_MSG_CHECKING(for struct sigcontext)
2424AC_TRY_COMPILE([
2425#include <signal.h>
2426test_sig()
2427{
2428 struct sigcontext *scont;
2429 scont = (struct sigcontext *)0;
2430 return 1;
2431} ], ,
2432 AC_MSG_RESULT(yes)
2433 AC_DEFINE(HAVE_SIGCONTEXT),
2434 AC_MSG_RESULT(no))
2435
2436dnl tricky stuff: try to find out if getcwd() is implemented with
2437dnl system("sh -c pwd")
2438AC_MSG_CHECKING(getcwd implementation)
2439AC_TRY_RUN([
2440char *dagger[] = { "IFS=pwd", 0 };
2441main()
2442{
2443 char buffer[500];
2444 extern char **environ;
2445 environ = dagger;
2446 return getcwd(buffer, 500) ? 0 : 1;
2447}],
2448 AC_MSG_RESULT(it is usable),
2449 AC_MSG_RESULT(it stinks)
2450 AC_DEFINE(BAD_GETCWD),
2451 AC_MSG_ERROR(failed to compile test program))
2452
2453dnl Check for functions in one big call, to reduce the size of configure
2454AC_CHECK_FUNCS(bcmp fchdir fchown fseeko fsync ftello getcwd getpseudotty \
2455 getpwnam getpwuid getrlimit gettimeofday getwd lstat memcmp \
2456 memset nanosleep opendir putenv qsort readlink select setenv \
2457 setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \
2458 sigvec snprintf strcasecmp strerror strftime stricmp strncasecmp \
2459 strnicmp strpbrk strtol tgetent towlower towupper usleep utime utimes)
2460
2461dnl fstatfs() can take 2 to 4 arguments, try to use st_blksize if possible
2462AC_MSG_CHECKING(for st_blksize)
2463AC_TRY_COMPILE(
2464[#include <sys/types.h>
2465#include <sys/stat.h>],
2466[ struct stat st;
2467 int n;
2468
2469 stat("/", &st);
2470 n = (int)st.st_blksize;],
2471 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ST_BLKSIZE),
2472 AC_MSG_RESULT(no))
2473
2474AC_MSG_CHECKING(whether stat() ignores a trailing slash)
2475AC_TRY_RUN(
2476[#include <sys/types.h>
2477#include <sys/stat.h>
2478main() {struct stat st; exit(stat("configure/", &st) != 0); }],
2479 AC_MSG_RESULT(yes); AC_DEFINE(STAT_IGNORES_SLASH),
2480 AC_MSG_RESULT(no), AC_MSG_ERROR(failed to compile test program))
2481
2482dnl Link with iconv for charset translation, if not found without library.
2483dnl check for iconv() requires including iconv.h
2484dnl Add "-liconv" when possible; Solaris has iconv but use GNU iconv when it
2485dnl has been installed.
2486AC_MSG_CHECKING(for iconv_open())
2487save_LIBS="$LIBS"
2488LIBS="$LIBS -liconv"
2489AC_TRY_LINK([
2490#ifdef HAVE_ICONV_H
2491# include <iconv.h>
2492#endif
2493 ], [iconv_open("fr", "to");],
2494 AC_MSG_RESULT(yes; with -liconv); AC_DEFINE(HAVE_ICONV),
2495 LIBS="$save_LIBS"
2496 AC_TRY_LINK([
2497#ifdef HAVE_ICONV_H
2498# include <iconv.h>
2499#endif
2500 ], [iconv_open("fr", "to");],
2501 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ICONV),
2502 AC_MSG_RESULT(no)))
2503
2504
2505AC_MSG_CHECKING(for nl_langinfo(CODESET))
2506AC_TRY_LINK([
2507#ifdef HAVE_LANGINFO_H
2508# include <langinfo.h>
2509#endif
2510], [char *cs = nl_langinfo(CODESET);],
2511 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_NL_LANGINFO_CODESET),
2512 AC_MSG_RESULT(no))
2513
2514dnl Link with -lposix1e for ACL stuff; if not found, try -lacl for SGI
2515dnl when -lacl works, also try to use -lattr (required for Debian).
2516AC_MSG_CHECKING(--disable-acl argument)
2517AC_ARG_ENABLE(acl,
2518 [ --disable-acl Don't check for ACL support.],
2519 , [enable_acl="yes"])
2520if test "$enable_acl" = "yes"; then
2521AC_MSG_RESULT(no)
2522AC_CHECK_LIB(posix1e, acl_get_file, [LIBS="$LIBS -lposix1e"],
2523 AC_CHECK_LIB(acl, acl_get_file, [LIBS="$LIBS -lacl"
2524 AC_CHECK_LIB(attr, fgetxattr, LIBS="$LIBS -lattr",,)],,),)
2525
2526AC_MSG_CHECKING(for POSIX ACL support)
2527AC_TRY_LINK([
2528#include <sys/types.h>
2529#ifdef HAVE_SYS_ACL_H
2530# include <sys/acl.h>
2531#endif
2532acl_t acl;], [acl = acl_get_file("foo", ACL_TYPE_ACCESS);
2533 acl_set_file("foo", ACL_TYPE_ACCESS, acl);
2534 acl_free(acl);],
2535 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_POSIX_ACL),
2536 AC_MSG_RESULT(no))
2537
2538AC_MSG_CHECKING(for Solaris ACL support)
2539AC_TRY_LINK([
2540#ifdef HAVE_SYS_ACL_H
2541# include <sys/acl.h>
2542#endif], [acl("foo", GETACLCNT, 0, NULL);
2543 ],
2544 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SOLARIS_ACL),
2545 AC_MSG_RESULT(no))
2546
2547AC_MSG_CHECKING(for AIX ACL support)
2548AC_TRY_LINK([
2549#ifdef HAVE_SYS_ACL_H
2550# include <sys/acl.h>
2551#endif
2552#ifdef HAVE_SYS_ACCESS_H
2553# include <sys/access.h>
2554#endif
2555#define _ALL_SOURCE
2556
2557#include <sys/stat.h>
2558
2559int aclsize;
2560struct acl *aclent;], [aclsize = sizeof(struct acl);
2561 aclent = (void *)malloc(aclsize);
2562 statacl("foo", STX_NORMAL, aclent, aclsize);
2563 ],
2564 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_AIX_ACL),
2565 AC_MSG_RESULT(no))
2566else
2567 AC_MSG_RESULT(yes)
2568fi
2569
2570AC_MSG_CHECKING(--disable-gpm argument)
2571AC_ARG_ENABLE(gpm,
2572 [ --disable-gpm Don't use gpm (Linux mouse daemon).], ,
2573 [enable_gpm="yes"])
2574
2575if test "$enable_gpm" = "yes"; then
2576 AC_MSG_RESULT(no)
2577 dnl Checking if gpm support can be compiled
2578 AC_CACHE_CHECK([for gpm], vi_cv_have_gpm,
2579 [olibs="$LIBS" ; LIBS="-lgpm"]
2580 AC_TRY_LINK(
2581 [#include <gpm.h>
2582 #include <linux/keyboard.h>],
2583 [Gpm_GetLibVersion(NULL);],
2584 dnl Configure defines HAVE_GPM, if it is defined feature.h defines
2585 dnl FEAT_MOUSE_GPM if mouse support is included
2586 [vi_cv_have_gpm=yes],
2587 [vi_cv_have_gpm=no])
2588 [LIBS="$olibs"]
2589 )
2590 if test $vi_cv_have_gpm = yes; then
2591 LIBS="$LIBS -lgpm"
2592 AC_DEFINE(HAVE_GPM)
2593 fi
2594else
2595 AC_MSG_RESULT(yes)
2596fi
2597
2598AC_MSG_CHECKING(for vsnprintf())
2599AC_TRY_RUN([
2600#include <stdio.h>
2601#include <stdarg.h>
2602 /* Check use of vsnprintf() */
2603 void warn(char *fmt, ...);
2604 void warn(char *fmt, ...)
2605 {
2606 va_list ap; char buf[20];
2607 va_start(ap, fmt);
2608 vsnprintf(buf, 20, fmt, ap);
2609 va_end(ap);
2610 }
2611 main()
2612 {
2613 warn("testing %s\n", "a very long string that won't fit");
2614 exit(0);
2615 }
2616 ],
2617 AC_DEFINE(HAVE_VSNPRINTF) AC_MSG_RESULT(yes),
2618 AC_MSG_RESULT(no),
2619 AC_MSG_ERROR(failed to compile test program))
2620
2621
2622dnl rename needs to be checked separately to work on Nextstep with cc
2623AC_MSG_CHECKING(for rename)
2624AC_TRY_LINK([#include <stdio.h>], [rename("this", "that")],
2625 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_RENAME),
2626 AC_MSG_RESULT(no))
2627
2628dnl sysctl() may exist but not the arguments we use
2629AC_MSG_CHECKING(for sysctl)
2630AC_TRY_COMPILE(
2631[#include <sys/types.h>
2632#include <sys/sysctl.h>],
2633[ int mib[2], r;
2634 size_t len;
2635
2636 mib[0] = CTL_HW;
2637 mib[1] = HW_USERMEM;
2638 len = sizeof(r);
2639 (void)sysctl(mib, 2, &r, &len, (void *)0, (size_t)0);
2640 ],
2641 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCTL),
2642 AC_MSG_RESULT(not usable))
2643
2644dnl sysinfo() may exist but not be Linux compatible
2645AC_MSG_CHECKING(for sysinfo)
2646AC_TRY_COMPILE(
2647[#include <sys/types.h>
2648#include <sys/sysinfo.h>],
2649[ struct sysinfo sinfo;
2650 int t;
2651
2652 (void)sysinfo(&sinfo);
2653 t = sinfo.totalram;
2654 ],
2655 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO),
2656 AC_MSG_RESULT(not usable))
2657
2658dnl sysconf() may exist but not support what we want to use
2659AC_MSG_CHECKING(for sysconf)
2660AC_TRY_COMPILE(
2661[#include <unistd.h>],
2662[ (void)sysconf(_SC_PAGESIZE);
2663 (void)sysconf(_SC_PHYS_PAGES);
2664 ],
2665 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCONF),
2666 AC_MSG_RESULT(not usable))
2667
2668dnl Our own version of AC_CHECK_SIZEOF(int); fixes a bug when sizeof() can't
2669dnl be printed with "%d", and avoids a warning for cross-compiling.
2670
2671AC_MSG_CHECKING(size of int)
2672AC_CACHE_VAL(ac_cv_sizeof_int,
2673 [AC_TRY_RUN([#include <stdio.h>
2674 main()
2675 {
2676 FILE *f=fopen("conftestval", "w");
2677 if (!f) exit(1);
2678 fprintf(f, "%d\n", (int)sizeof(int));
2679 exit(0);
2680 }],
2681 ac_cv_sizeof_int=`cat conftestval`,
2682 ac_cv_sizeof_int=0,
2683 AC_MSG_ERROR(failed to compile test program))])
2684AC_MSG_RESULT($ac_cv_sizeof_int)
2685AC_DEFINE_UNQUOTED(SIZEOF_INT, $ac_cv_sizeof_int)
2686
2687AC_MSG_CHECKING(whether memmove/bcopy/memcpy handle overlaps)
2688[bcopy_test_prog='
2689main() {
2690 char buf[10];
2691 strcpy(buf, "abcdefghi");
2692 mch_memmove(buf, buf + 2, 3);
2693 if (strncmp(buf, "ababcf", 6))
2694 exit(1);
2695 strcpy(buf, "abcdefghi");
2696 mch_memmove(buf + 2, buf, 3);
2697 if (strncmp(buf, "cdedef", 6))
2698 exit(1);
2699 exit(0); /* libc version works properly. */
2700}']
2701
2702dnl Check for memmove() before bcopy(), makes memmove() be used when both are
2703dnl present, fixes problem with incompatibility between Solaris 2.4 and 2.5.
2704
2705AC_TRY_RUN([#define mch_memmove(s,d,l) memmove(d,s,l) $bcopy_test_prog],
2706 AC_DEFINE(USEMEMMOVE) AC_MSG_RESULT(memmove does),
2707 AC_TRY_RUN([#define mch_memmove(s,d,l) bcopy(d,s,l) $bcopy_test_prog],
2708 AC_DEFINE(USEBCOPY) AC_MSG_RESULT(bcopy does),
2709 AC_TRY_RUN([#define mch_memmove(s,d,l) memcpy(d,s,l) $bcopy_test_prog],
2710 AC_DEFINE(USEMEMCPY) AC_MSG_RESULT(memcpy does), AC_MSG_RESULT(no),
2711 AC_MSG_ERROR(failed to compile test program)),
2712 AC_MSG_ERROR(failed to compile test program)),
2713 AC_MSG_ERROR(failed to compile test program))
2714
2715dnl Check for multibyte locale functions
2716dnl Find out if _Xsetlocale() is supported by libX11.
2717dnl Check if X_LOCALE should be defined.
2718
2719if test "$enable_multibyte" = "yes"; then
2720 cflags_save=$CFLAGS
2721 ldflags_save=$LDFLAGS
2722 if test -n "$x_includes" ; then
2723 CFLAGS="$CFLAGS -I$x_includes"
2724 LDFLAGS="$X_LIBS $LDFLAGS -lX11"
2725 AC_MSG_CHECKING(whether X_LOCALE needed)
2726 AC_TRY_COMPILE([#include <X11/Xlocale.h>],,
2727 AC_TRY_LINK_FUNC([_Xsetlocale], [AC_MSG_RESULT(yes)
2728 AC_DEFINE(X_LOCALE)], AC_MSG_RESULT(no)),
2729 AC_MSG_RESULT(no))
2730 fi
2731 CFLAGS=$cflags_save
2732 LDFLAGS=$ldflags_save
2733fi
2734
2735dnl Link with xpg4, it is said to make Korean locale working
2736AC_CHECK_LIB(xpg4, _xpg4_setrunelocale, [LIBS="$LIBS -lxpg4"],,)
2737
2738dnl Check how we can run ctags
2739dnl --version for Exuberant ctags (preferred)
2740dnl -t for typedefs (many ctags have this)
2741dnl -s for static functions (Elvis ctags only?)
2742dnl -v for variables. Dangerous, most ctags take this for 'vgrind style'.
2743dnl -i+m to test for older Exuberant ctags
2744AC_MSG_CHECKING(how to create tags)
2745test -f tags && mv tags tags.save
2746if (eval ctags --version /dev/null | grep Exuberant) < /dev/null 1>&AC_FD_CC 2>&1; then
2747 TAGPRG="ctags"
2748else
2749 (eval etags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags"
2750 (eval etags -c /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags -c"
2751 (eval ctags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags"
2752 (eval ctags -t /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -t"
2753 (eval ctags -ts /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -ts"
2754 (eval ctags -tvs /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -tvs"
2755 (eval ctags -i+m /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -i+m"
2756fi
2757test -f tags.save && mv tags.save tags
2758AC_MSG_RESULT($TAGPRG) AC_SUBST(TAGPRG)
2759
2760dnl Check how we can run man with a section number
2761AC_MSG_CHECKING(how to run man with a section nr)
2762MANDEF="man"
2763(eval man -s 2 read) < /dev/null > /dev/null 2>&AC_FD_CC && MANDEF="man -s"
2764AC_MSG_RESULT($MANDEF)
2765if test "$MANDEF" = "man -s"; then
2766 AC_DEFINE(USEMAN_S)
2767fi
2768
2769dnl Check if gettext() is working and if it needs -lintl
2770AC_MSG_CHECKING(--disable-nls argument)
2771AC_ARG_ENABLE(nls,
2772 [ --disable-nls Don't support NLS (gettext()).], ,
2773 [enable_nls="yes"])
2774
2775if test "$enable_nls" = "yes"; then
2776 AC_MSG_RESULT(no)
2777 AC_CHECK_PROG(MSGFMT, msgfmt, msgfmt, )
2778 AC_MSG_CHECKING([for NLS])
2779 if test -f po/Makefile; then
2780 have_gettext="no"
2781 if test -n "$MSGFMT"; then
2782 AC_TRY_LINK(
2783 [#include <libintl.h>],
2784 [gettext("Test");],
2785 AC_MSG_RESULT([gettext() works]); have_gettext="yes",
2786 olibs=$LIBS
2787 LIBS="$LIBS -lintl"
2788 AC_TRY_LINK(
2789 [#include <libintl.h>],
2790 [gettext("Test");],
2791 AC_MSG_RESULT([gettext() works with -lintl]); have_gettext="yes",
2792 AC_MSG_RESULT([gettext() doesn't work]);
2793 LIBS=$olibs))
2794 else
2795 AC_MSG_RESULT([msgfmt not found - disabled]);
2796 fi
2797 if test $have_gettext = "yes"; then
2798 AC_DEFINE(HAVE_GETTEXT)
2799 MAKEMO=yes
2800 AC_SUBST(MAKEMO)
2801 dnl this was added in GNU gettext 0.10.36
2802 AC_CHECK_FUNCS(bind_textdomain_codeset)
2803 dnl _nl_msg_cat_cntr is required for GNU gettext
2804 AC_MSG_CHECKING([for _nl_msg_cat_cntr])
2805 AC_TRY_LINK(
2806 [#include <libintl.h>
2807 extern int _nl_msg_cat_cntr;],
2808 [++_nl_msg_cat_cntr;],
2809 AC_MSG_RESULT([yes]); AC_DEFINE(HAVE_NL_MSG_CAT_CNTR),
2810 AC_MSG_RESULT([no]))
2811 fi
2812 else
2813 AC_MSG_RESULT([no "po/Makefile" - disabled]);
2814 fi
2815else
2816 AC_MSG_RESULT(yes)
2817fi
2818
2819dnl Check for dynamic linking loader
2820AC_CHECK_HEADER(dlfcn.h, DLL=dlfcn.h, [AC_CHECK_HEADER(dl.h, DLL=dl.h)])
2821if test x${DLL} = xdlfcn.h; then
2822 AC_DEFINE(HAVE_DLFCN_H, 1, [ Define if we have dlfcn.h. ])
2823 AC_MSG_CHECKING([for dlopen()])
2824 AC_TRY_LINK(,[
2825 extern void* dlopen();
2826 dlopen();
2827 ],
2828 AC_MSG_RESULT(yes);
2829 AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]),
2830 AC_MSG_RESULT(no);
2831 AC_MSG_CHECKING([for dlopen() in -ldl])
2832 olibs=$LIBS
2833 LIBS="$LIBS -ldl"
2834 AC_TRY_LINK(,[
2835 extern void* dlopen();
2836 dlopen();
2837 ],
2838 AC_MSG_RESULT(yes);
2839 AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]),
2840 AC_MSG_RESULT(no);
2841 LIBS=$olibs))
2842 dnl ReliantUNIX has dlopen() in libc but everything else in libdl
2843 dnl ick :-)
2844 AC_MSG_CHECKING([for dlsym()])
2845 AC_TRY_LINK(,[
2846 extern void* dlsym();
2847 dlsym();
2848 ],
2849 AC_MSG_RESULT(yes);
2850 AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]),
2851 AC_MSG_RESULT(no);
2852 AC_MSG_CHECKING([for dlsym() in -ldl])
2853 olibs=$LIBS
2854 LIBS="$LIBS -ldl"
2855 AC_TRY_LINK(,[
2856 extern void* dlsym();
2857 dlsym();
2858 ],
2859 AC_MSG_RESULT(yes);
2860 AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]),
2861 AC_MSG_RESULT(no);
2862 LIBS=$olibs))
2863elif test x${DLL} = xdl.h; then
2864 AC_DEFINE(HAVE_DL_H, 1, [ Define if we have dl.h. ])
2865 AC_MSG_CHECKING([for shl_load()])
2866 AC_TRY_LINK(,[
2867 extern void* shl_load();
2868 shl_load();
2869 ],
2870 AC_MSG_RESULT(yes);
2871 AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]),
2872 AC_MSG_RESULT(no);
2873 AC_MSG_CHECKING([for shl_load() in -ldld])
2874 olibs=$LIBS
2875 LIBS="$LIBS -ldld"
2876 AC_TRY_LINK(,[
2877 extern void* shl_load();
2878 shl_load();
2879 ],
2880 AC_MSG_RESULT(yes);
2881 AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]),
2882 AC_MSG_RESULT(no);
2883 LIBS=$olibs))
2884fi
2885AC_CHECK_HEADERS(setjmp.h)
2886
2887if test "x$MACOSX" = "xyes" -a -n "$PERL"; then
2888 dnl -ldl must come after DynaLoader.a
2889 if echo $LIBS | grep -e '-ldl' >/dev/null; then
2890 LIBS=`echo $LIBS | sed s/-ldl//`
2891 PERL_LIBS="$PERL_LIBS -ldl"
2892 fi
2893fi
2894
2895if test "x$MACOSX" = "xyes" && test "x$CARBON" = "xyes" \
2896 && test "x$GUITYPE" != "xCARBONGUI"; then
2897 AC_MSG_CHECKING(whether we need -framework Carbon)
2898 dnl check for MACOSX without Carbon GUI, but with FEAT_MBYTE
2899 if test "x$enable_multibyte" = "xyes" || test "x$features" == "xbig" \
2900 || test "x$features" = "xhuge"; then
2901 LIBS="$LIBS -framework Carbon"
2902 AC_MSG_RESULT(yes)
2903 else
2904 AC_MSG_RESULT(no)
2905 fi
2906fi
2907
2908
2909dnl write output files
2910AC_OUTPUT(auto/config.mk:config.mk.in)
2911
2912dnl vim: set sw=2 tw=78 fo+=l: