blob: 42d6bfadb6ee5c081a3bd3734f9513a692a9e573 [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
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001254 KDE_INCLUDES="$KDE_PREFIX/include"
1255 if test -d "$KDE_INCLUDES/kde"; then
1256 KDE_INCLUDES="$KDE_INCLUDES/kde"
1257 fi
Bram Moolenaar843ee412004-06-30 16:16:41 +00001258 fi
1259 kde_major_version=`$KDE_CONFIG --version | grep KDE | \
1260sed 's/KDE:\ //' | sed 's/\([[0-9]]*\).\([[0-9]]*.*\)/\1/'`
1261 kde_minor_version=`$KDE_CONFIG --version | grep KDE | \
1262sed 's/KDE:\ //' | sed 's/\([[0-9]]*\).\([[0-9]]*.*\)/\2/'`
1263
1264 qt_major_version=`$KDE_CONFIG --version | grep Qt | sed -e \
1265's/Qt:\ //' | sed 's/\([[0-9]]*\).\([[0-9]]*.*\)/\1/'`
1266 qt_minor_version=`$KDE_CONFIG --version | grep Qt | sed -e \
1267's/Qt:\ //' | sed 's/\([[0-9]]*\).\([[0-9]]*.*\)/\2/'`
1268
1269 dnl maybe in a near future we'll get these ones : QT_PREFIX, QT_LIBS,
1270 dnl QT_INCLUDES
1271 dnl but for now we need configure options to get them ...
1272 if test "x$enable-kdetest" = "xyes" ; then
1273 ac_save_LIBS="$LIBS"
1274 LIBS="$LIBS $KDE_LIBS"
1275
1276 dnl fake test
1277 AC_TRY_RUN([
1278#include <stdio.h>
1279int
1280main()
1281{ return 0; }
1282 ],, no_kde=yes,[echo $ac_n "cross compiling KDE ? ? how can i remove that ? :)"])
1283 LIBS="$ac_save_LIBS"
1284 fi
1285 fi
1286 if test "x$no_kde" = x ; then
1287 AC_MSG_RESULT(found KDE $kde_major_version.$kde_minor_version)
1288 ifelse([$2], , :, [$2])
1289 else
1290 AC_MSG_RESULT(no)
1291 KDE_LIBS=""
1292 ifelse([$3], , :, [$3])
1293 fi
1294else
1295 AC_MSG_RESULT(no)
1296 KDE_LIBS=""
1297 ifelse([$3], , :, [$3])
1298fi
1299AC_SUBST(KDE_LIBS)
1300AC_SUBST(KDE_INCLUDES)
1301AC_SUBST(KDE_PREFIX)
1302])
1303
1304dnl Check all the KDE stuff
1305AC_MSG_CHECKING(--disable-rpath argument)
1306AC_ARG_ENABLE(rpath,
1307 [ --disable-rpath Disable rpath.],
1308 , enable_rpath="yes")
1309if test "$enable_rpath" = "yes"; then
1310 AC_MSG_RESULT(no)
1311else
1312 AC_MSG_RESULT(yes)
1313fi
1314
1315AC_MSG_CHECKING(--with-kde-prefix argument)
1316AC_ARG_WITH(kde-prefix,[ --with-kde-prefix=PFX Prefix where KDE is installed (optional)],kde_config_prefix="$withval";
1317AC_MSG_RESULT($kde_config_prefix), kde_config_prefix="";AC_MSG_RESULT(no))
1318
1319AC_ARG_WITH(kde-includes,
1320 [ --with-kde-includes=DIR Specify location of KDE headers],
1321 [KDE_INCLUDES="$withval"]
1322 )
1323
1324AC_ARG_WITH(kde-libraries,
1325 [ --with-kde-libs=DIR Specify location of KDE libraries],
1326 [KDE_LIBS="$withval"]
1327 )
1328
1329AC_MSG_CHECKING(--disable-kdetest argument)
1330AC_ARG_ENABLE(kdetest,
1331 [ --disable-kdetest Do not try to compile and run a test KDE program],
1332 enable_kdetest=yes)
1333
1334if test "x$enable_kdetest" = "xyes" ; then
1335 AC_MSG_RESULT(kde test enabled)
1336else
1337 AC_MSG_RESULT(kde test disabled)
1338fi
1339
1340if test "x$kde_config_prefix" != "x" ; then
1341 kde_config_args=""
1342 KDE_CONFIG=$kde_config_prefix/bin/kde-config
1343fi
1344
1345if test "X$KDE_CONFIG" = "X"; then
1346 AC_PATH_PROG(KDE_CONFIG, kde-config, no)
1347else
1348 AC_MSG_RESULT(Using KDE configuration program $KDE_CONFIG)
1349fi
1350
1351if test "X$KDE_CONFIG" != "X" ; then
1352 AM_PATH_KDE(2.0.0,
1353 [GUI_LIB_LOC="-L$KDE_LIBS -lkdeui -lkdecore -lDCOP"
1354 GUI_INC_LOC="-I$KDE_INCLUDES"
1355 KDEDIR="$KDE_PREFIX"], )
1356 if test "x$KDE_PREFIX" != "x"; then
1357 AC_MSG_CHECKING(for QT version $qt_major_version.x)
1358 if test "x$ROOTQT" != "x" ; then
1359 GUI_INC_LOC="-I$QT_INCLUDES $GUI_INC_LOC"
1360 if test $qt_major_version -lt 2; then
1361 AC_MSG_ERROR(Your QT version is prior to 2.0; KDE 2.x and 3.x require at least QT 2)
1362 fi
1363 dnl hack for FreeBSD
1364 if test "`(uname) 2>/dev/null`" = "FreeBSD"; then
1365 CFLAGS="$CFLAGS -D_THREAD_SAFE"
1366 CXXFLAGS="$CXXFLAGS -D_THREAD_SAFE"
1367 GUI_LIB_LOC="$GUI_LIB_LOC -pthread"
1368 LIBS="$LIBS -pthread"
1369 fi
1370
1371 dnl check the version
1372 if test "x$enable_rpath" = "xyes"; then
1373 if test $qt_major_version = 2; then
1374 GUI_LIB_LOC="-L$KDE_LIBS -lkfile -L$QT_LIBS -lqt $GUI_LIB_LOC \
1375-Wl,--rpath -Wl,$KDE_LIBS -Wl,--rpath -Wl,$QT_LIBS"
1376 else
1377 GUI_LIB_LOC="-L$KDE_LIBS -lkio -L$QT_LIBS -lqt-mt $GUI_LIB_LOC \
1378-Wl,--rpath -Wl,$KDE_LIBS -Wl,--rpath -Wl,$QT_LIBS"
1379 fi
1380 else
1381 if test $qt_major_version = 2; then
1382 GUI_LIB_LOC="-L$KDE_LIBS -lkfile -L$QT_LIBS -lqt $GUI_LIB_LOC"
1383 else
1384 GUI_LIB_LOC="-L$KDE_LIBS -lkio -L$QT_LIBS -lqt-mt $GUI_LIB_LOC"
1385 fi
1386 fi
1387
1388 dnl Remove "-I/usr/include " from GUI_*
1389 GUI_INC_LOC="`echo $GUI_INC_LOC\ | sed 's%-I/usr/include %%'`"
1390dnl GUI_LIB_LOC="`echo $GUI_LIB_LOC\ | sed 's% -L/usr/lib%%'`"
1391
1392 AC_MSG_RESULT(found $qt_major_version.$qt_minor_version in $ROOTQT)
1393 SKIP_GTK=YES
1394 SKIP_ATHENA=YES
1395 SKIP_MOTIF=YES
1396 GUITYPE=KDE
1397 AC_SUBST(KDE_PREFIX)
1398 AC_SUBST(QT_LIBS)
1399 AC_SUBST(QT_INCLUDES)
1400 AC_SUBST(ROOTQT)
1401 AC_SUBST(MOC)
1402 AC_DEFINE(FEAT_GUI_KDE)
1403 else
1404 AC_MSG_ERROR(Detected QT version mismatched)
1405 fi
1406 else
1407 AC_MSG_ERROR(Could not find KDE installation prefix)
1408 fi
1409fi
1410fi
1411
Bram Moolenaar071d4272004-06-13 20:20:40 +00001412if test "x$MACOSX" = "xyes" -a -z "$SKIP_CARBON" -a "x$CARBON" = "xyes"; then
1413 AC_MSG_CHECKING(for Carbon GUI)
1414 dnl already did this
1415 AC_MSG_RESULT(yes);
1416 GUITYPE=CARBONGUI
1417 dnl skip everything else
1418 SKIP_GTK=YES;
1419 SKIP_GTK2=YES;
1420 SKIP_GNOME=YES;
1421 SKIP_MOTIF=YES;
1422 SKIP_ATHENA=YES;
1423 SKIP_NEXTAW=YES;
1424 SKIP_PHOTON=YES;
1425 SKIP_BEOS=YES;
1426 SKIP_CARBON=YES
1427fi
1428
Bram Moolenaar071d4272004-06-13 20:20:40 +00001429dnl
1430dnl Get the cflags and libraries from the gtk-config script
1431dnl
1432
1433dnl define an autoconf function to check for a specified version of GTK, and
1434dnl try to compile/link a GTK program. this gets used once for GTK 1.1.16.
1435dnl
1436dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
1437dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
1438dnl
1439AC_DEFUN(AM_PATH_GTK,
1440[
1441 if test "X$GTK_CONFIG" != "Xno" -o "X$PKG_CONFIG" != "Xno"; then
1442 {
1443 min_gtk_version=ifelse([$1], ,0.99.7,$1)
1444 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
1445 no_gtk=""
1446 if (test "X$SKIP_GTK2" != "XYES" -a "X$PKG_CONFIG" != "Xno") \
1447 && $PKG_CONFIG --exists gtk+-2.0; then
1448 {
1449 dnl We should be using PKG_CHECK_MODULES() instead of this hack.
1450 dnl But I guess the dependency on pkgconfig.m4 is not wanted or
1451 dnl something like that.
1452 GTK_CFLAGS=`$PKG_CONFIG --cflags gtk+-2.0`
1453 GTK_LIBS=`$PKG_CONFIG --libs gtk+-2.0`
1454 gtk_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1455 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
1456 gtk_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1457 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
1458 gtk_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1459 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
1460 }
1461 elif test "X$GTK_CONFIG" != "Xno"; then
1462 {
1463 GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
1464 GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
1465 gtk_major_version=`$GTK_CONFIG $gtk_config_args --version | \
1466 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
1467 gtk_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
1468 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
1469 gtk_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
1470 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
1471 }
1472 else
1473 no_gtk=yes
1474 fi
1475
1476 if test "x$enable_gtktest" = "xyes" -a "x$no_gtk" = "x"; then
1477 {
1478 ac_save_CFLAGS="$CFLAGS"
1479 ac_save_LIBS="$LIBS"
1480 CFLAGS="$CFLAGS $GTK_CFLAGS"
1481 LIBS="$LIBS $GTK_LIBS"
1482
1483 dnl
1484 dnl Now check if the installed GTK is sufficiently new. (Also sanity
1485 dnl checks the results of gtk-config to some extent
1486 dnl
1487 rm -f conf.gtktest
1488 AC_TRY_RUN([
1489#include <gtk/gtk.h>
1490#include <stdio.h>
1491
1492int
1493main ()
1494{
1495int major, minor, micro;
1496char *tmp_version;
1497
1498system ("touch conf.gtktest");
1499
1500/* HP/UX 9 (%@#!) writes to sscanf strings */
1501tmp_version = g_strdup("$min_gtk_version");
1502if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
1503 printf("%s, bad version string\n", "$min_gtk_version");
1504 exit(1);
1505 }
1506
1507if ((gtk_major_version > major) ||
1508 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
1509 ((gtk_major_version == major) && (gtk_minor_version == minor) &&
1510 (gtk_micro_version >= micro)))
1511{
1512 return 0;
1513}
1514return 1;
1515}
1516],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1517 CFLAGS="$ac_save_CFLAGS"
1518 LIBS="$ac_save_LIBS"
1519 }
1520 fi
1521 if test "x$no_gtk" = x ; then
1522 if test "x$enable_gtktest" = "xyes"; then
1523 AC_MSG_RESULT(yes; found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version)
1524 else
1525 AC_MSG_RESULT(found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version)
1526 fi
1527 ifelse([$2], , :, [$2])
1528 else
1529 {
1530 AC_MSG_RESULT(no)
1531 GTK_CFLAGS=""
1532 GTK_LIBS=""
1533 ifelse([$3], , :, [$3])
1534 }
1535 fi
1536 }
1537 else
1538 GTK_CFLAGS=""
1539 GTK_LIBS=""
1540 ifelse([$3], , :, [$3])
1541 fi
1542 AC_SUBST(GTK_CFLAGS)
1543 AC_SUBST(GTK_LIBS)
1544 rm -f conf.gtktest
1545])
1546
1547dnl ---------------------------------------------------------------------------
1548dnl gnome
1549dnl ---------------------------------------------------------------------------
1550AC_DEFUN([GNOME_INIT_HOOK],
1551[
1552 AC_SUBST(GNOME_LIBS)
1553 AC_SUBST(GNOME_LIBDIR)
1554 AC_SUBST(GNOME_INCLUDEDIR)
1555
1556 AC_ARG_WITH(gnome-includes,
1557 [ --with-gnome-includes=DIR Specify location of GNOME headers],
1558 [CFLAGS="$CFLAGS -I$withval"]
1559 )
1560
1561 AC_ARG_WITH(gnome-libs,
1562 [ --with-gnome-libs=DIR Specify location of GNOME libs],
1563 [LDFLAGS="$LDFLAGS -L$withval" gnome_prefix=$withval]
1564 )
1565
1566 AC_ARG_WITH(gnome,
1567 [ --with-gnome Specify prefix for GNOME files],
1568 if test x$withval = xyes; then
1569 want_gnome=yes
1570 ifelse([$1], [], :, [$1])
1571 else
1572 if test "x$withval" = xno; then
1573 want_gnome=no
1574 else
1575 want_gnome=yes
1576 LDFLAGS="$LDFLAGS -L$withval/lib"
1577 CFLAGS="$CFLAGS -I$withval/include"
1578 gnome_prefix=$withval/lib
1579 fi
1580 fi,
1581 want_gnome=yes)
1582
1583 if test "x$want_gnome" = xyes -a "0$gtk_major_version" -ge 2; then
1584 {
1585 AC_MSG_CHECKING(for libgnomeui-2.0)
1586 if $PKG_CONFIG --exists libgnomeui-2.0; then
1587 AC_MSG_RESULT(yes)
1588 GNOME_LIBS=`$PKG_CONFIG --libs-only-l libgnomeui-2.0`
1589 GNOME_LIBDIR=`$PKG_CONFIG --libs-only-L libgnomeui-2.0`
1590 GNOME_INCLUDEDIR=`$PKG_CONFIG --cflags libgnomeui-2.0`
1591 $1
1592 else
1593 AC_MSG_RESULT(not found)
1594 if test "x$2" = xfail; then
1595 AC_MSG_ERROR(Could not find libgnomeui-2.0 via pkg-config)
1596 fi
1597 fi
1598 }
1599 elif test "x$want_gnome" = xyes; then
1600 {
1601 AC_PATH_PROG(GNOME_CONFIG,gnome-config,no)
1602 if test "$GNOME_CONFIG" = "no"; then
1603 no_gnome_config="yes"
1604 else
1605 AC_MSG_CHECKING(if $GNOME_CONFIG works)
1606 if $GNOME_CONFIG --libs-only-l gnome >/dev/null 2>&1; then
1607 AC_MSG_RESULT(yes)
1608 GNOME_LIBS="`$GNOME_CONFIG --libs-only-l gnome gnomeui`"
1609 GNOME_LIBDIR="`$GNOME_CONFIG --libs-only-L gnorba gnomeui`"
1610 GNOME_INCLUDEDIR="`$GNOME_CONFIG --cflags gnorba gnomeui`"
1611 $1
1612 else
1613 AC_MSG_RESULT(no)
1614 no_gnome_config="yes"
1615 fi
1616 fi
1617
1618 if test x$exec_prefix = xNONE; then
1619 if test x$prefix = xNONE; then
1620 gnome_prefix=$ac_default_prefix/lib
1621 else
1622 gnome_prefix=$prefix/lib
1623 fi
1624 else
1625 gnome_prefix=`eval echo \`echo $libdir\``
1626 fi
1627
1628 if test "$no_gnome_config" = "yes"; then
1629 AC_MSG_CHECKING(for gnomeConf.sh file in $gnome_prefix)
1630 if test -f $gnome_prefix/gnomeConf.sh; then
1631 AC_MSG_RESULT(found)
1632 echo "loading gnome configuration from" \
1633 "$gnome_prefix/gnomeConf.sh"
1634 . $gnome_prefix/gnomeConf.sh
1635 $1
1636 else
1637 AC_MSG_RESULT(not found)
1638 if test x$2 = xfail; then
1639 AC_MSG_ERROR(Could not find the gnomeConf.sh file that is generated by gnome-libs install)
1640 fi
1641 fi
1642 fi
1643 }
1644 fi
1645])
1646
1647AC_DEFUN([GNOME_INIT],[
1648 GNOME_INIT_HOOK([],fail)
1649])
1650
1651
1652dnl ---------------------------------------------------------------------------
1653dnl Check for GTK. First checks for gtk-config, cause it needs that to get the
1654dnl correct compiler flags. Then checks for GTK 1.1.16. If that fails, then
1655dnl it checks for 1.0.6. If both fail, then continue on for Motif as before...
1656dnl ---------------------------------------------------------------------------
1657if test -z "$SKIP_GTK"; then
1658
1659 AC_MSG_CHECKING(--with-gtk-prefix argument)
1660 AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
1661 gtk_config_prefix="$withval"; AC_MSG_RESULT($gtk_config_prefix),
1662 gtk_config_prefix=""; AC_MSG_RESULT(no))
1663
1664 AC_MSG_CHECKING(--with-gtk-exec-prefix argument)
1665 AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
1666 gtk_config_exec_prefix="$withval"; AC_MSG_RESULT($gtk_config_prefix),
1667 gtk_config_exec_prefix=""; AC_MSG_RESULT(no))
1668
1669 AC_MSG_CHECKING(--disable-gtktest argument)
1670 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
1671 , enable_gtktest=yes)
1672 if test "x$enable_gtktest" = "xyes" ; then
1673 AC_MSG_RESULT(gtk test enabled)
1674 else
1675 AC_MSG_RESULT(gtk test disabled)
1676 fi
1677
1678 if test "x$gtk_config_prefix" != "x" ; then
1679 gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
1680 GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
1681 fi
1682 if test "x$gtk_config_exec_prefix" != "x" ; then
1683 gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
1684 GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
1685 fi
1686 if test "X$GTK_CONFIG" = "X"; then
1687 AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
1688 if test "X$GTK_CONFIG" = "Xno"; then
1689 dnl Some distributions call it gtk12-config, annoying!
1690 AC_PATH_PROG(GTK12_CONFIG, gtk12-config, no)
1691 GTK_CONFIG="$GTK12_CONFIG"
1692 fi
1693 else
1694 AC_MSG_RESULT(Using GTK configuration program $GTK_CONFIG)
1695 fi
1696 if test "X$PKG_CONFIG" = "X"; then
1697 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1698 fi
1699
1700 if test "x$GTK_CONFIG:$PKG_CONFIG" != "xno:no"; then
1701 dnl First try finding version 2.2.0 or later. The 2.0.x series has
1702 dnl problems (bold fonts, --remote doesn't work).
1703 if test "X$SKIP_GTK2" != "XYES"; then
1704 AM_PATH_GTK(2.2.0,
1705 [GTK_LIBNAME="$GTK_LIBS"
1706 GUI_INC_LOC="$GTK_CFLAGS"], )
1707 if test "x$GTK_CFLAGS" != "x"; then
1708 SKIP_ATHENA=YES
1709 SKIP_NEXTAW=YES
1710 SKIP_MOTIF=YES
1711 GUITYPE=GTK
1712 AC_SUBST(GTK_LIBNAME)
1713 fi
1714 fi
1715
1716 dnl If there is no 2.2.0 or later try the 1.x.x series. We require at
1717 dnl least GTK 1.1.16. 1.0.6 doesn't work. 1.1.1 to 1.1.15
1718 dnl were test versions.
1719 if test "x$GUITYPE" != "xGTK"; then
1720 SKIP_GTK2=YES
1721 AM_PATH_GTK(1.1.16,
1722 [GTK_LIBNAME="$GTK_LIBS"
1723 GUI_INC_LOC="$GTK_CFLAGS"], )
1724 if test "x$GTK_CFLAGS" != "x"; then
1725 SKIP_ATHENA=YES
1726 SKIP_NEXTAW=YES
1727 SKIP_MOTIF=YES
1728 GUITYPE=GTK
1729 AC_SUBST(GTK_LIBNAME)
1730 fi
1731 fi
1732 fi
1733 dnl Give a warning if GTK is older than 1.2.3
1734 if test "x$GUITYPE" = "xGTK"; then
1735 if test "$gtk_major_version" = 1 -a "0$gtk_minor_version" -lt 2 \
1736 -o "$gtk_major_version" = 1 -a "$gtk_minor_version" = 2 -a "0$gtk_micro_version" -lt 3; then
1737 AC_MSG_RESULT(this GTK version is old; version 1.2.3 or later is recommended)
1738 else
1739 {
1740 if test "0$gtk_major_version" -ge 2; then
1741 AC_DEFINE(HAVE_GTK2)
1742 if test "$gtk_minor_version" = 1 -a "0$gtk_micro_version" -ge 1 \
1743 || test "0$gtk_minor_version" -ge 2 \
1744 || test "0$gtk_major_version" -gt 2; then
1745 AC_DEFINE(HAVE_GTK_MULTIHEAD)
1746 fi
1747 fi
1748 dnl
1749 dnl if GTK exists, and it's not the 1.0.x series, then check for GNOME.
1750 dnl
1751 if test -z "$SKIP_GNOME"; then
1752 {
1753 GNOME_INIT_HOOK([have_gnome=yes])
1754 if test x$have_gnome = xyes ; then
1755 AC_DEFINE(FEAT_GUI_GNOME)
1756 GUI_INC_LOC="$GUI_INC_LOC $GNOME_INCLUDEDIR"
1757 GTK_LIBNAME="$GTK_LIBNAME $GNOME_LIBDIR $GNOME_LIBS"
1758 fi
1759 }
1760 fi
1761 }
1762 fi
1763 fi
1764fi
1765
1766dnl Check for Motif include files location.
1767dnl The LAST one found is used, this makes the highest version to be used,
1768dnl e.g. when Motif1.2 and Motif2.0 are both present.
1769
1770if test -z "$SKIP_MOTIF"; then
1771 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"
1772 dnl Remove "-I" from before $GUI_INC_LOC if it's there
1773 GUI_INC_LOC="`echo $GUI_INC_LOC|sed 's%-I%%g'`"
1774
1775 AC_MSG_CHECKING(for location of Motif GUI includes)
1776 gui_includes="`echo $x_includes|sed 's%/[^/][^/]*$%%'` `echo "$gui_XXX" | sed s/XXX/include/g` $GUI_INC_LOC"
1777 GUI_INC_LOC=
1778 for try in $gui_includes; do
1779 if test -f "$try/Xm/Xm.h"; then
1780 GUI_INC_LOC=$try
1781 fi
1782 done
1783 if test -n "$GUI_INC_LOC"; then
1784 if test "$GUI_INC_LOC" = /usr/include; then
1785 GUI_INC_LOC=
1786 AC_MSG_RESULT(in default path)
1787 else
1788 AC_MSG_RESULT($GUI_INC_LOC)
1789 fi
1790 else
1791 AC_MSG_RESULT(<not found>)
1792 SKIP_MOTIF=YES
1793 fi
1794fi
1795
1796dnl Check for Motif library files location. In the same order as the include
1797dnl files, to avoid a mixup if several versions are present
1798
1799if test -z "$SKIP_MOTIF"; then
1800 AC_MSG_CHECKING(--with-motif-lib argument)
1801 AC_ARG_WITH(motif-lib,
1802 [ --with-motif-lib=STRING Library for Motif ],
1803 [ MOTIF_LIBNAME="${withval}" ] )
1804
1805 if test -n "$MOTIF_LIBNAME"; then
1806 AC_MSG_RESULT($MOTIF_LIBNAME)
1807 GUI_LIB_LOC=
1808 else
1809 AC_MSG_RESULT(no)
1810
1811 dnl Remove "-L" from before $GUI_LIB_LOC if it's there
1812 GUI_LIB_LOC="`echo $GUI_LIB_LOC|sed 's%-L%%g'`"
1813
1814 AC_MSG_CHECKING(for location of Motif GUI libs)
1815 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"
1816 GUI_LIB_LOC=
1817 for try in $gui_libs; do
1818 for libtry in "$try"/libXm.a "$try"/libXm.so* "$try"/libXm.sl; do
1819 if test -f "$libtry"; then
1820 GUI_LIB_LOC=$try
1821 fi
1822 done
1823 done
1824 if test -n "$GUI_LIB_LOC"; then
1825 dnl Remove /usr/lib, it causes trouble on some systems
1826 if test "$GUI_LIB_LOC" = /usr/lib; then
1827 GUI_LIB_LOC=
1828 AC_MSG_RESULT(in default path)
1829 else
1830 if test -n "$GUI_LIB_LOC"; then
1831 AC_MSG_RESULT($GUI_LIB_LOC)
1832 if test "`(uname) 2>/dev/null`" = SunOS &&
1833 uname -r | grep '^5' >/dev/null; then
1834 GUI_LIB_LOC="$GUI_LIB_LOC -R $GUI_LIB_LOC"
1835 fi
1836 fi
1837 fi
1838 MOTIF_LIBNAME=-lXm
1839 else
1840 AC_MSG_RESULT(<not found>)
1841 SKIP_MOTIF=YES
1842 fi
1843 fi
1844fi
1845
1846if test -z "$SKIP_MOTIF"; then
1847 SKIP_ATHENA=YES
1848 SKIP_NEXTAW=YES
1849 GUITYPE=MOTIF
1850 AC_SUBST(MOTIF_LIBNAME)
1851fi
1852
1853dnl Check if the Athena files can be found
1854
1855GUI_X_LIBS=
1856
1857if test -z "$SKIP_ATHENA"; then
1858 AC_MSG_CHECKING(if Athena header files can be found)
1859 cflags_save=$CFLAGS
1860 CFLAGS="$CFLAGS $X_CFLAGS"
1861 AC_TRY_COMPILE([
1862#include <X11/Intrinsic.h>
1863#include <X11/Xaw/Paned.h>], ,
1864 AC_MSG_RESULT(yes),
1865 AC_MSG_RESULT(no); SKIP_ATHENA=YES )
1866 CFLAGS=$cflags_save
1867fi
1868
1869if test -z "$SKIP_ATHENA"; then
1870 GUITYPE=ATHENA
1871fi
1872
1873if test -z "$SKIP_NEXTAW"; then
1874 AC_MSG_CHECKING(if neXtaw header files can be found)
1875 cflags_save=$CFLAGS
1876 CFLAGS="$CFLAGS $X_CFLAGS"
1877 AC_TRY_COMPILE([
1878#include <X11/Intrinsic.h>
1879#include <X11/neXtaw/Paned.h>], ,
1880 AC_MSG_RESULT(yes),
1881 AC_MSG_RESULT(no); SKIP_NEXTAW=YES )
1882 CFLAGS=$cflags_save
1883fi
1884
1885if test -z "$SKIP_NEXTAW"; then
1886 GUITYPE=NEXTAW
1887fi
1888
1889if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
1890 dnl Prepend -I and -L to $GUI_INC_LOC and $GUI_LIB_LOC if not empty
1891 dnl Avoid adding it when it twice
1892 if test -n "$GUI_INC_LOC"; then
1893 GUI_INC_LOC=-I"`echo $GUI_INC_LOC|sed 's%-I%%'`"
1894 fi
1895 if test -n "$GUI_LIB_LOC"; then
1896 GUI_LIB_LOC=-L"`echo $GUI_LIB_LOC|sed 's%-L%%'`"
1897 fi
1898
1899 dnl Check for -lXext and then for -lXmu
1900 ldflags_save=$LDFLAGS
1901 LDFLAGS="$X_LIBS $LDFLAGS"
1902 AC_CHECK_LIB(Xext, XShapeQueryExtension, [GUI_X_LIBS="-lXext"],,
1903 [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1904 dnl For Solaris we need -lw and -ldl before linking with -lXmu works.
1905 AC_CHECK_LIB(w, wslen, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lw"],,
1906 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1907 AC_CHECK_LIB(dl, dlsym, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldl"],,
1908 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1909 AC_CHECK_LIB(Xmu, XmuCreateStippledPixmap, [GUI_X_LIBS="-lXmu $GUI_X_LIBS"],,
1910 [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1911 if test -z "$SKIP_MOTIF"; then
1912 AC_CHECK_LIB(Xp, XpEndJob, [GUI_X_LIBS="-lXp $GUI_X_LIBS"],,
1913 [$GUI_X_LIBS -lXm -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
1914 fi
1915 LDFLAGS=$ldflags_save
1916
1917 dnl Execute xmkmf to figure out if -DNARROWPROTO is needed.
1918 AC_MSG_CHECKING(for extra X11 defines)
1919 NARROW_PROTO=
1920 rm -fr conftestdir
1921 if mkdir conftestdir; then
1922 cd conftestdir
1923 cat > Imakefile <<'EOF'
1924acfindx:
1925 @echo 'NARROW_PROTO="${PROTO_DEFINES}"'
1926EOF
1927 if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
1928 eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
1929 fi
1930 cd ..
1931 rm -fr conftestdir
1932 fi
1933 if test -z "$NARROW_PROTO"; then
1934 AC_MSG_RESULT(no)
1935 else
1936 AC_MSG_RESULT($NARROW_PROTO)
1937 fi
1938 AC_SUBST(NARROW_PROTO)
1939fi
1940
1941dnl Look for XSMP support - but don't necessarily restrict it to X11 GUIs
1942dnl use the X11 include path
1943if test "$enable_xsmp" = "yes"; then
1944 cppflags_save=$CPPFLAGS
1945 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
1946 AC_CHECK_HEADERS(X11/SM/SMlib.h)
1947 CPPFLAGS=$cppflags_save
1948fi
1949
1950
1951if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF" -o -z "$SKIP_GTK"; then
1952 dnl Check for X11/xpm.h and X11/Sunkeysym.h with the GUI include path
1953 cppflags_save=$CPPFLAGS
1954 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
1955 AC_CHECK_HEADERS(X11/xpm.h X11/Sunkeysym.h)
1956
1957 dnl automatically disable XIM when XIMtext isn't in X11/Xlib.h
1958 if test ! "$enable_xim" = "no"; then
1959 AC_MSG_CHECKING(for XIMText in X11/Xlib.h)
1960 AC_EGREP_CPP(XIMText, [#include <X11/Xlib.h>],
1961 AC_MSG_RESULT(yes),
1962 AC_MSG_RESULT(no; xim has been disabled); enable_xim = "no")
1963 fi
1964 CPPFLAGS=$cppflags_save
1965
1966 dnl automatically enable XIM when hangul input isn't enabled
1967 if test "$enable_xim" = "auto" -a "$enable_hangulinput" != "yes" \
1968 -a "x$GUITYPE" != "xNONE" ; then
1969 AC_MSG_RESULT(X GUI selected; xim has been enabled)
1970 enable_xim="yes"
1971 fi
1972fi
1973
1974if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
1975 cppflags_save=$CPPFLAGS
1976 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
1977 AC_CHECK_HEADERS(X11/Xmu/Editres.h)
1978 CPPFLAGS=$cppflags_save
1979fi
1980
1981dnl Only use the Xm directory when compiling Motif, don't use it for Athena
1982if test -z "$SKIP_MOTIF"; then
1983 cppflags_save=$CPPFLAGS
1984 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
1985 AC_CHECK_HEADERS(Xm/Xm.h Xm/XpmP.h)
1986 CPPFLAGS=$cppflags_save
1987fi
1988
1989if test "x$GUITYPE" = "xNONE" -a "$enable_xim" = "yes"; then
1990 AC_MSG_RESULT(no GUI selected; xim has been disabled)
1991 enable_xim="no"
1992fi
1993if test "x$GUITYPE" = "xNONE" -a "$enable_fontset" = "yes"; then
1994 AC_MSG_RESULT(no GUI selected; fontset has been disabled)
1995 enable_fontset="no"
1996fi
1997if test "x$GUITYPE:$enable_fontset" = "xGTK:yes" -a "0$gtk_major_version" -ge 2; then
1998 AC_MSG_RESULT(GTK+ 2 GUI selected; fontset has been disabled)
1999 enable_fontset="no"
2000fi
2001
2002dnl There is no test for the BeOS GUI, if it's selected it's used
2003if test -z "$SKIP_BEOS"; then
2004 GUITYPE=BEOSGUI
2005fi
2006
2007if test -z "$SKIP_PHOTON"; then
2008 GUITYPE=PHOTONGUI
2009fi
2010
2011AC_SUBST(GUI_INC_LOC)
2012AC_SUBST(GUI_LIB_LOC)
2013AC_SUBST(GUITYPE)
2014AC_SUBST(GUI_X_LIBS)
2015
2016if test "$enable_workshop" = "yes" -a -n "$SKIP_MOTIF"; then
2017 AC_MSG_ERROR([cannot use workshop without Motif])
2018fi
2019
2020dnl defining FEAT_XIM and FEAT_XFONTSET is delayed, so that they can be disabled
2021if test "$enable_xim" = "yes"; then
2022 AC_DEFINE(FEAT_XIM)
2023fi
2024if test "$enable_fontset" = "yes"; then
2025 AC_DEFINE(FEAT_XFONTSET)
2026fi
2027
2028
2029dnl ---------------------------------------------------------------------------
2030dnl end of GUI-checking
2031dnl ---------------------------------------------------------------------------
2032
2033
2034dnl Only really enable hangul input when GUI and XFONTSET are available
2035if test "$enable_hangulinput" = "yes"; then
2036 if test "x$GUITYPE" = "xNONE"; then
2037 AC_MSG_RESULT(no GUI selected; hangul input has been disabled)
2038 enable_hangulinput=no
2039 else
2040 AC_DEFINE(FEAT_HANGULIN)
2041 HANGULIN_SRC=hangulin.c
2042 AC_SUBST(HANGULIN_SRC)
2043 HANGULIN_OBJ=objects/hangulin.o
2044 AC_SUBST(HANGULIN_OBJ)
2045 fi
2046fi
2047
2048dnl Checks for libraries and include files.
2049
2050AC_MSG_CHECKING(quality of toupper)
2051AC_TRY_RUN([#include <ctype.h>
2052main() { exit(toupper('A') == 'A' && tolower('z') == 'z'); }],
2053 AC_DEFINE(BROKEN_TOUPPER) AC_MSG_RESULT(bad),
2054 AC_MSG_RESULT(good), AC_MSG_ERROR(failed to compile test program))
2055
2056AC_MSG_CHECKING(whether __DATE__ and __TIME__ work)
2057AC_TRY_COMPILE(, [printf("(" __DATE__ " " __TIME__ ")");],
2058 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_DATE_TIME),
2059 AC_MSG_RESULT(no))
2060
2061dnl Checks for header files.
2062AC_CHECK_HEADER(elf.h, HAS_ELF=1)
2063dnl AC_CHECK_HEADER(dwarf.h, SVR4=1)
2064if test "$HAS_ELF" = 1; then
2065 AC_CHECK_LIB(elf, main)
2066fi
2067
2068AC_HEADER_DIRENT
2069
2070dnl check for standard headers, we don't use this in Vim but other stuff
2071dnl in autoconf needs it
2072AC_HEADER_STDC
2073AC_HEADER_SYS_WAIT
2074
2075dnl If sys/wait.h is not found it might still exist but not be POSIX
2076dnl compliant. In that case we define HAVE_UNION_WAIT (for NeXT)
2077if test $ac_cv_header_sys_wait_h = no; then
2078 AC_MSG_CHECKING([for sys/wait.h that defines union wait])
2079 AC_TRY_COMPILE([#include <sys/wait.h>],
2080 [union wait xx, yy; xx = yy],
2081 AC_MSG_RESULT(yes)
2082 AC_DEFINE(HAVE_SYS_WAIT_H)
2083 AC_DEFINE(HAVE_UNION_WAIT),
2084 AC_MSG_RESULT(no))
2085fi
2086
2087AC_CHECK_HEADERS(stdarg.h stdlib.h string.h sys/select.h sys/utsname.h \
2088 termcap.h fcntl.h sgtty.h sys/ioctl.h sys/time.h termio.h \
2089 iconv.h langinfo.h unistd.h stropts.h errno.h \
2090 sys/resource.h sys/systeminfo.h locale.h \
2091 sys/stream.h sys/ptem.h termios.h libc.h sys/statfs.h \
2092 poll.h sys/poll.h pwd.h utime.h sys/param.h libintl.h \
2093 libgen.h util/debug.h util/msg18n.h frame.h pthread_np.h \
2094 sys/acl.h sys/access.h sys/sysctl.h sys/sysinfo.h wchar.h)
2095
2096dnl On Mac OS X strings.h exists but produces a warning message :-(
2097if test "x$MACOSX" != "xyes"; then
2098 AC_CHECK_HEADERS(strings.h)
2099fi
2100
2101dnl Check if strings.h and string.h can both be included when defined.
2102AC_MSG_CHECKING([if strings.h can be included after string.h])
2103cppflags_save=$CPPFLAGS
2104CPPFLAGS="$CPPFLAGS $X_CFLAGS"
2105AC_TRY_COMPILE([
2106#if defined(_AIX) && !defined(_AIX51) && !defined(_NO_PROTO)
2107# define _NO_PROTO /* like in os_unix.h, causes conflict for AIX (Winn) */
2108 /* but don't do it on AIX 5.1 (Uribarri) */
2109#endif
2110#ifdef HAVE_XM_XM_H
2111# include <Xm/Xm.h> /* This breaks it for HP-UX 11 (Squassabia) */
2112#endif
2113#ifdef HAVE_STRING_H
2114# include <string.h>
2115#endif
2116#if defined(HAVE_STRINGS_H)
2117# include <strings.h>
2118#endif
2119 ], [int i; i = 0;],
2120 AC_MSG_RESULT(yes),
2121 AC_DEFINE(NO_STRINGS_WITH_STRING_H)
2122 AC_MSG_RESULT(no))
2123CPPFLAGS=$cppflags_save
2124
2125dnl Checks for typedefs, structures, and compiler characteristics.
2126AC_PROG_GCC_TRADITIONAL
2127AC_C_CONST
2128AC_TYPE_MODE_T
2129AC_TYPE_OFF_T
2130AC_TYPE_PID_T
2131AC_TYPE_SIZE_T
2132AC_TYPE_UID_T
2133AC_HEADER_TIME
2134AC_CHECK_TYPE(ino_t, long)
2135AC_CHECK_TYPE(dev_t, unsigned)
2136
2137AC_MSG_CHECKING(for rlim_t)
2138if eval "test \"`echo '$''{'ac_cv_type_rlim_t'+set}'`\" = set"; then
2139 AC_MSG_RESULT([(cached) $ac_cv_type_rlim_t])
2140else
2141 AC_EGREP_CPP(dnl
2142changequote(<<,>>)dnl
2143<<(^|[^a-zA-Z_0-9])rlim_t[^a-zA-Z_0-9]>>dnl
2144changequote([,]),
2145 [
2146#include <sys/types.h>
2147#if STDC_HEADERS
2148#include <stdlib.h>
2149#include <stddef.h>
2150#endif
2151#ifdef HAVE_SYS_RESOURCE_H
2152#include <sys/resource.h>
2153#endif
2154 ], ac_cv_type_rlim_t=yes, ac_cv_type_rlim_t=no)
2155 AC_MSG_RESULT($ac_cv_type_rlim_t)
2156fi
2157if test $ac_cv_type_rlim_t = no; then
2158 cat >> confdefs.h <<\EOF
2159#define rlim_t unsigned long
2160EOF
2161fi
2162
2163AC_MSG_CHECKING(for stack_t)
2164if eval "test \"`echo '$''{'ac_cv_type_stack_t'+set}'`\" = set"; then
2165 AC_MSG_RESULT([(cached) $ac_cv_type_stack_t])
2166else
2167 AC_EGREP_CPP(stack_t,
2168 [
2169#include <sys/types.h>
2170#if STDC_HEADERS
2171#include <stdlib.h>
2172#include <stddef.h>
2173#endif
2174#include <signal.h>
2175 ], ac_cv_type_stack_t=yes, ac_cv_type_stack_t=no)
2176 AC_MSG_RESULT($ac_cv_type_stack_t)
2177fi
2178if test $ac_cv_type_stack_t = no; then
2179 cat >> confdefs.h <<\EOF
2180#define stack_t struct sigaltstack
2181EOF
2182fi
2183
2184dnl BSDI uses ss_base while others use ss_sp for the stack pointer.
2185AC_MSG_CHECKING(whether stack_t has an ss_base field)
2186AC_TRY_COMPILE([
2187#include <sys/types.h>
2188#if STDC_HEADERS
2189#include <stdlib.h>
2190#include <stddef.h>
2191#endif
2192#include <signal.h>
2193#include "confdefs.h"
2194 ], [stack_t sigstk; sigstk.ss_base = 0; ],
2195 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SS_BASE),
2196 AC_MSG_RESULT(no))
2197
2198olibs="$LIBS"
2199AC_MSG_CHECKING(--with-tlib argument)
2200AC_ARG_WITH(tlib, [ --with-tlib=library terminal library to be used ],)
2201if test -n "$with_tlib"; then
2202 AC_MSG_RESULT($with_tlib)
2203 LIBS="$LIBS -l$with_tlib"
2204else
2205 AC_MSG_RESULT([automatic terminal library selection])
2206 dnl On HP-UX 10.10 termcap or termlib should be used instead of
2207 dnl curses, because curses is much slower.
2208 dnl Newer versions of ncurses are preferred over anything.
2209 dnl Older versions of ncurses have bugs, get a new one!
2210 dnl Digital Unix (OSF1) should use curses (Ronald Schild).
2211 case "`uname -s 2>/dev/null`" in
2212 OSF1) tlibs="ncurses curses termlib termcap";;
2213 *) tlibs="ncurses termlib termcap curses";;
2214 esac
2215 for libname in $tlibs; do
2216 AC_CHECK_LIB(${libname}, tgetent,,)
2217 if test "x$olibs" != "x$LIBS"; then
2218 dnl It's possible that a library is found but it doesn't work
2219 dnl e.g., shared library that cannot be found
2220 dnl compile and run a test program to be sure
2221 AC_TRY_RUN([
2222#ifdef HAVE_TERMCAP_H
2223# include <termcap.h>
2224#endif
2225main() {char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(0); }],
2226 res="OK", res="FAIL", res="FAIL")
2227 if test "$res" = "OK"; then
2228 break
2229 fi
2230 AC_MSG_RESULT($libname library is not usable)
2231 LIBS="$olibs"
2232 fi
2233 done
2234fi
2235if test "x$olibs" != "x$LIBS"; then
2236 AC_MSG_CHECKING(whether we talk terminfo)
2237 AC_TRY_RUN([
2238#ifdef HAVE_TERMCAP_H
2239# include <termcap.h>
2240#endif
2241main()
2242{char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(!strcmp(s==0 ? "" : s, "1")); }],
2243 AC_MSG_RESULT([no -- we are in termcap land]),
2244 AC_MSG_RESULT([yes -- terminfo spoken here]); AC_DEFINE(TERMINFO),
2245 AC_MSG_ERROR(failed to compile test program.))
2246else
2247 AC_MSG_RESULT(none found)
2248fi
2249
2250if test "x$olibs" != "x$LIBS"; then
2251 AC_MSG_CHECKING(what tgetent() returns for an unknown terminal)
2252 AC_TRY_RUN([
2253#ifdef HAVE_TERMCAP_H
2254# include <termcap.h>
2255#endif
2256main()
2257{char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist"); exit(res != 0); }],
2258 AC_MSG_RESULT(zero); AC_DEFINE(TGETENT_ZERO_ERR, 0),
2259 AC_MSG_RESULT(non-zero),
2260 AC_MSG_ERROR(failed to compile test program.))
2261fi
2262
2263AC_MSG_CHECKING(whether termcap.h contains ospeed)
2264AC_TRY_LINK([
2265#ifdef HAVE_TERMCAP_H
2266# include <termcap.h>
2267#endif
2268 ], [ospeed = 20000],
2269 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OSPEED),
2270 [AC_MSG_RESULT(no)
2271 AC_MSG_CHECKING(whether ospeed can be extern)
2272 AC_TRY_LINK([
2273#ifdef HAVE_TERMCAP_H
2274# include <termcap.h>
2275#endif
2276extern short ospeed;
2277 ], [ospeed = 20000],
2278 AC_MSG_RESULT(yes); AC_DEFINE(OSPEED_EXTERN),
2279 AC_MSG_RESULT(no))]
2280 )
2281
2282AC_MSG_CHECKING([whether termcap.h contains UP, BC and PC])
2283AC_TRY_LINK([
2284#ifdef HAVE_TERMCAP_H
2285# include <termcap.h>
2286#endif
2287 ], [if (UP == 0 && BC == 0) PC = 1],
2288 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_UP_BC_PC),
2289 [AC_MSG_RESULT(no)
2290 AC_MSG_CHECKING([whether UP, BC and PC can be extern])
2291 AC_TRY_LINK([
2292#ifdef HAVE_TERMCAP_H
2293# include <termcap.h>
2294#endif
2295extern char *UP, *BC, PC;
2296 ], [if (UP == 0 && BC == 0) PC = 1],
2297 AC_MSG_RESULT(yes); AC_DEFINE(UP_BC_PC_EXTERN),
2298 AC_MSG_RESULT(no))]
2299 )
2300
2301AC_MSG_CHECKING(whether tputs() uses outfuntype)
2302AC_TRY_COMPILE([
2303#ifdef HAVE_TERMCAP_H
2304# include <termcap.h>
2305#endif
2306 ], [extern int xx(); tputs("test", 1, (outfuntype)xx)],
2307 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OUTFUNTYPE),
2308 AC_MSG_RESULT(no))
2309
2310dnl On some SCO machines sys/select redefines struct timeval
2311AC_MSG_CHECKING([whether sys/select.h and sys/time.h may both be included])
2312AC_TRY_COMPILE([
2313#include <sys/types.h>
2314#include <sys/time.h>
2315#include <sys/select.h>], ,
2316 AC_MSG_RESULT(yes)
2317 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME),
2318 AC_MSG_RESULT(no))
2319
2320dnl AC_DECL_SYS_SIGLIST
2321
2322dnl Checks for pty.c (copied from screen) ==========================
2323AC_MSG_CHECKING(for /dev/ptc)
2324if test -r /dev/ptc; then
2325 AC_DEFINE(HAVE_DEV_PTC)
2326 AC_MSG_RESULT(yes)
2327else
2328 AC_MSG_RESULT(no)
2329fi
2330
2331AC_MSG_CHECKING(for SVR4 ptys)
2332if test -c /dev/ptmx ; then
2333 AC_TRY_LINK([], [ptsname(0);grantpt(0);unlockpt(0);],
2334 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SVR4_PTYS),
2335 AC_MSG_RESULT(no))
2336else
2337 AC_MSG_RESULT(no)
2338fi
2339
2340AC_MSG_CHECKING(for ptyranges)
2341if test -d /dev/ptym ; then
2342 pdir='/dev/ptym'
2343else
2344 pdir='/dev'
2345fi
2346dnl SCO uses ptyp%d
2347AC_EGREP_CPP(yes,
2348[#ifdef M_UNIX
2349 yes;
2350#endif
2351 ], ptys=`echo /dev/ptyp??`, ptys=`echo $pdir/pty??`)
2352dnl if test -c /dev/ptyp19; then
2353dnl ptys=`echo /dev/ptyp??`
2354dnl else
2355dnl ptys=`echo $pdir/pty??`
2356dnl fi
2357if test "$ptys" != "$pdir/pty??" ; then
2358 p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'`
2359 p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'`
2360 AC_DEFINE_UNQUOTED(PTYRANGE0,"$p0")
2361 AC_DEFINE_UNQUOTED(PTYRANGE1,"$p1")
2362 AC_MSG_RESULT([$p0 / $p1])
2363else
2364 AC_MSG_RESULT([don't know])
2365fi
2366
2367dnl **** pty mode/group handling ****
2368dnl
2369dnl support provided by Luke Mewburn <lm@rmit.edu.au>, 931222
2370AC_MSG_CHECKING(default tty permissions/group)
2371rm -f conftest_grp
2372AC_TRY_RUN([
2373#include <sys/types.h>
2374#include <sys/stat.h>
2375#include <stdio.h>
2376main()
2377{
2378 struct stat sb;
2379 char *x,*ttyname();
2380 int om, m;
2381 FILE *fp;
2382
2383 if (!(x = ttyname(0))) exit(1);
2384 if (stat(x, &sb)) exit(1);
2385 om = sb.st_mode;
2386 if (om & 002) exit(0);
2387 m = system("mesg y");
2388 if (m == -1 || m == 127) exit(1);
2389 if (stat(x, &sb)) exit(1);
2390 m = sb.st_mode;
2391 if (chmod(x, om)) exit(1);
2392 if (m & 002) exit(0);
2393 if (sb.st_gid == getgid()) exit(1);
2394 if (!(fp=fopen("conftest_grp", "w")))
2395 exit(1);
2396 fprintf(fp, "%d\n", sb.st_gid);
2397 fclose(fp);
2398 exit(0);
2399}
2400],[
2401 if test -f conftest_grp; then
2402 ptygrp=`cat conftest_grp`
2403 AC_MSG_RESULT([pty mode: 0620, group: $ptygrp])
2404 AC_DEFINE(PTYMODE, 0620)
2405 AC_DEFINE_UNQUOTED(PTYGROUP,$ptygrp)
2406 else
2407 AC_MSG_RESULT([ptys are world accessable])
2408 fi
2409],
2410 AC_MSG_RESULT([can't determine - assume ptys are world accessable]),
2411 AC_MSG_ERROR(failed to compile test program))
2412rm -f conftest_grp
2413
2414dnl Checks for library functions. ===================================
2415
2416AC_TYPE_SIGNAL
2417
2418dnl find out what to use at the end of a signal function
2419if test $ac_cv_type_signal = void; then
2420 AC_DEFINE(SIGRETURN, [return])
2421else
2422 AC_DEFINE(SIGRETURN, [return 0])
2423fi
2424
2425dnl check if struct sigcontext is defined (used for SGI only)
2426AC_MSG_CHECKING(for struct sigcontext)
2427AC_TRY_COMPILE([
2428#include <signal.h>
2429test_sig()
2430{
2431 struct sigcontext *scont;
2432 scont = (struct sigcontext *)0;
2433 return 1;
2434} ], ,
2435 AC_MSG_RESULT(yes)
2436 AC_DEFINE(HAVE_SIGCONTEXT),
2437 AC_MSG_RESULT(no))
2438
2439dnl tricky stuff: try to find out if getcwd() is implemented with
2440dnl system("sh -c pwd")
2441AC_MSG_CHECKING(getcwd implementation)
2442AC_TRY_RUN([
2443char *dagger[] = { "IFS=pwd", 0 };
2444main()
2445{
2446 char buffer[500];
2447 extern char **environ;
2448 environ = dagger;
2449 return getcwd(buffer, 500) ? 0 : 1;
2450}],
2451 AC_MSG_RESULT(it is usable),
2452 AC_MSG_RESULT(it stinks)
2453 AC_DEFINE(BAD_GETCWD),
2454 AC_MSG_ERROR(failed to compile test program))
2455
2456dnl Check for functions in one big call, to reduce the size of configure
2457AC_CHECK_FUNCS(bcmp fchdir fchown fseeko fsync ftello getcwd getpseudotty \
2458 getpwnam getpwuid getrlimit gettimeofday getwd lstat memcmp \
2459 memset nanosleep opendir putenv qsort readlink select setenv \
2460 setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \
2461 sigvec snprintf strcasecmp strerror strftime stricmp strncasecmp \
2462 strnicmp strpbrk strtol tgetent towlower towupper usleep utime utimes)
2463
2464dnl fstatfs() can take 2 to 4 arguments, try to use st_blksize if possible
2465AC_MSG_CHECKING(for st_blksize)
2466AC_TRY_COMPILE(
2467[#include <sys/types.h>
2468#include <sys/stat.h>],
2469[ struct stat st;
2470 int n;
2471
2472 stat("/", &st);
2473 n = (int)st.st_blksize;],
2474 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ST_BLKSIZE),
2475 AC_MSG_RESULT(no))
2476
2477AC_MSG_CHECKING(whether stat() ignores a trailing slash)
2478AC_TRY_RUN(
2479[#include <sys/types.h>
2480#include <sys/stat.h>
2481main() {struct stat st; exit(stat("configure/", &st) != 0); }],
2482 AC_MSG_RESULT(yes); AC_DEFINE(STAT_IGNORES_SLASH),
2483 AC_MSG_RESULT(no), AC_MSG_ERROR(failed to compile test program))
2484
2485dnl Link with iconv for charset translation, if not found without library.
2486dnl check for iconv() requires including iconv.h
2487dnl Add "-liconv" when possible; Solaris has iconv but use GNU iconv when it
2488dnl has been installed.
2489AC_MSG_CHECKING(for iconv_open())
2490save_LIBS="$LIBS"
2491LIBS="$LIBS -liconv"
2492AC_TRY_LINK([
2493#ifdef HAVE_ICONV_H
2494# include <iconv.h>
2495#endif
2496 ], [iconv_open("fr", "to");],
2497 AC_MSG_RESULT(yes; with -liconv); AC_DEFINE(HAVE_ICONV),
2498 LIBS="$save_LIBS"
2499 AC_TRY_LINK([
2500#ifdef HAVE_ICONV_H
2501# include <iconv.h>
2502#endif
2503 ], [iconv_open("fr", "to");],
2504 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ICONV),
2505 AC_MSG_RESULT(no)))
2506
2507
2508AC_MSG_CHECKING(for nl_langinfo(CODESET))
2509AC_TRY_LINK([
2510#ifdef HAVE_LANGINFO_H
2511# include <langinfo.h>
2512#endif
2513], [char *cs = nl_langinfo(CODESET);],
2514 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_NL_LANGINFO_CODESET),
2515 AC_MSG_RESULT(no))
2516
2517dnl Link with -lposix1e for ACL stuff; if not found, try -lacl for SGI
2518dnl when -lacl works, also try to use -lattr (required for Debian).
2519AC_MSG_CHECKING(--disable-acl argument)
2520AC_ARG_ENABLE(acl,
2521 [ --disable-acl Don't check for ACL support.],
2522 , [enable_acl="yes"])
2523if test "$enable_acl" = "yes"; then
2524AC_MSG_RESULT(no)
2525AC_CHECK_LIB(posix1e, acl_get_file, [LIBS="$LIBS -lposix1e"],
2526 AC_CHECK_LIB(acl, acl_get_file, [LIBS="$LIBS -lacl"
2527 AC_CHECK_LIB(attr, fgetxattr, LIBS="$LIBS -lattr",,)],,),)
2528
2529AC_MSG_CHECKING(for POSIX ACL support)
2530AC_TRY_LINK([
2531#include <sys/types.h>
2532#ifdef HAVE_SYS_ACL_H
2533# include <sys/acl.h>
2534#endif
2535acl_t acl;], [acl = acl_get_file("foo", ACL_TYPE_ACCESS);
2536 acl_set_file("foo", ACL_TYPE_ACCESS, acl);
2537 acl_free(acl);],
2538 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_POSIX_ACL),
2539 AC_MSG_RESULT(no))
2540
2541AC_MSG_CHECKING(for Solaris ACL support)
2542AC_TRY_LINK([
2543#ifdef HAVE_SYS_ACL_H
2544# include <sys/acl.h>
2545#endif], [acl("foo", GETACLCNT, 0, NULL);
2546 ],
2547 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SOLARIS_ACL),
2548 AC_MSG_RESULT(no))
2549
2550AC_MSG_CHECKING(for AIX ACL support)
2551AC_TRY_LINK([
2552#ifdef HAVE_SYS_ACL_H
2553# include <sys/acl.h>
2554#endif
2555#ifdef HAVE_SYS_ACCESS_H
2556# include <sys/access.h>
2557#endif
2558#define _ALL_SOURCE
2559
2560#include <sys/stat.h>
2561
2562int aclsize;
2563struct acl *aclent;], [aclsize = sizeof(struct acl);
2564 aclent = (void *)malloc(aclsize);
2565 statacl("foo", STX_NORMAL, aclent, aclsize);
2566 ],
2567 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_AIX_ACL),
2568 AC_MSG_RESULT(no))
2569else
2570 AC_MSG_RESULT(yes)
2571fi
2572
2573AC_MSG_CHECKING(--disable-gpm argument)
2574AC_ARG_ENABLE(gpm,
2575 [ --disable-gpm Don't use gpm (Linux mouse daemon).], ,
2576 [enable_gpm="yes"])
2577
2578if test "$enable_gpm" = "yes"; then
2579 AC_MSG_RESULT(no)
2580 dnl Checking if gpm support can be compiled
2581 AC_CACHE_CHECK([for gpm], vi_cv_have_gpm,
2582 [olibs="$LIBS" ; LIBS="-lgpm"]
2583 AC_TRY_LINK(
2584 [#include <gpm.h>
2585 #include <linux/keyboard.h>],
2586 [Gpm_GetLibVersion(NULL);],
2587 dnl Configure defines HAVE_GPM, if it is defined feature.h defines
2588 dnl FEAT_MOUSE_GPM if mouse support is included
2589 [vi_cv_have_gpm=yes],
2590 [vi_cv_have_gpm=no])
2591 [LIBS="$olibs"]
2592 )
2593 if test $vi_cv_have_gpm = yes; then
2594 LIBS="$LIBS -lgpm"
2595 AC_DEFINE(HAVE_GPM)
2596 fi
2597else
2598 AC_MSG_RESULT(yes)
2599fi
2600
2601AC_MSG_CHECKING(for vsnprintf())
2602AC_TRY_RUN([
2603#include <stdio.h>
2604#include <stdarg.h>
2605 /* Check use of vsnprintf() */
2606 void warn(char *fmt, ...);
2607 void warn(char *fmt, ...)
2608 {
2609 va_list ap; char buf[20];
2610 va_start(ap, fmt);
2611 vsnprintf(buf, 20, fmt, ap);
2612 va_end(ap);
2613 }
2614 main()
2615 {
2616 warn("testing %s\n", "a very long string that won't fit");
2617 exit(0);
2618 }
2619 ],
2620 AC_DEFINE(HAVE_VSNPRINTF) AC_MSG_RESULT(yes),
2621 AC_MSG_RESULT(no),
2622 AC_MSG_ERROR(failed to compile test program))
2623
2624
2625dnl rename needs to be checked separately to work on Nextstep with cc
2626AC_MSG_CHECKING(for rename)
2627AC_TRY_LINK([#include <stdio.h>], [rename("this", "that")],
2628 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_RENAME),
2629 AC_MSG_RESULT(no))
2630
2631dnl sysctl() may exist but not the arguments we use
2632AC_MSG_CHECKING(for sysctl)
2633AC_TRY_COMPILE(
2634[#include <sys/types.h>
2635#include <sys/sysctl.h>],
2636[ int mib[2], r;
2637 size_t len;
2638
2639 mib[0] = CTL_HW;
2640 mib[1] = HW_USERMEM;
2641 len = sizeof(r);
2642 (void)sysctl(mib, 2, &r, &len, (void *)0, (size_t)0);
2643 ],
2644 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCTL),
2645 AC_MSG_RESULT(not usable))
2646
2647dnl sysinfo() may exist but not be Linux compatible
2648AC_MSG_CHECKING(for sysinfo)
2649AC_TRY_COMPILE(
2650[#include <sys/types.h>
2651#include <sys/sysinfo.h>],
2652[ struct sysinfo sinfo;
2653 int t;
2654
2655 (void)sysinfo(&sinfo);
2656 t = sinfo.totalram;
2657 ],
2658 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO),
2659 AC_MSG_RESULT(not usable))
2660
2661dnl sysconf() may exist but not support what we want to use
2662AC_MSG_CHECKING(for sysconf)
2663AC_TRY_COMPILE(
2664[#include <unistd.h>],
2665[ (void)sysconf(_SC_PAGESIZE);
2666 (void)sysconf(_SC_PHYS_PAGES);
2667 ],
2668 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCONF),
2669 AC_MSG_RESULT(not usable))
2670
2671dnl Our own version of AC_CHECK_SIZEOF(int); fixes a bug when sizeof() can't
2672dnl be printed with "%d", and avoids a warning for cross-compiling.
2673
2674AC_MSG_CHECKING(size of int)
2675AC_CACHE_VAL(ac_cv_sizeof_int,
2676 [AC_TRY_RUN([#include <stdio.h>
2677 main()
2678 {
2679 FILE *f=fopen("conftestval", "w");
2680 if (!f) exit(1);
2681 fprintf(f, "%d\n", (int)sizeof(int));
2682 exit(0);
2683 }],
2684 ac_cv_sizeof_int=`cat conftestval`,
2685 ac_cv_sizeof_int=0,
2686 AC_MSG_ERROR(failed to compile test program))])
2687AC_MSG_RESULT($ac_cv_sizeof_int)
2688AC_DEFINE_UNQUOTED(SIZEOF_INT, $ac_cv_sizeof_int)
2689
2690AC_MSG_CHECKING(whether memmove/bcopy/memcpy handle overlaps)
2691[bcopy_test_prog='
2692main() {
2693 char buf[10];
2694 strcpy(buf, "abcdefghi");
2695 mch_memmove(buf, buf + 2, 3);
2696 if (strncmp(buf, "ababcf", 6))
2697 exit(1);
2698 strcpy(buf, "abcdefghi");
2699 mch_memmove(buf + 2, buf, 3);
2700 if (strncmp(buf, "cdedef", 6))
2701 exit(1);
2702 exit(0); /* libc version works properly. */
2703}']
2704
2705dnl Check for memmove() before bcopy(), makes memmove() be used when both are
2706dnl present, fixes problem with incompatibility between Solaris 2.4 and 2.5.
2707
2708AC_TRY_RUN([#define mch_memmove(s,d,l) memmove(d,s,l) $bcopy_test_prog],
2709 AC_DEFINE(USEMEMMOVE) AC_MSG_RESULT(memmove does),
2710 AC_TRY_RUN([#define mch_memmove(s,d,l) bcopy(d,s,l) $bcopy_test_prog],
2711 AC_DEFINE(USEBCOPY) AC_MSG_RESULT(bcopy does),
2712 AC_TRY_RUN([#define mch_memmove(s,d,l) memcpy(d,s,l) $bcopy_test_prog],
2713 AC_DEFINE(USEMEMCPY) AC_MSG_RESULT(memcpy does), AC_MSG_RESULT(no),
2714 AC_MSG_ERROR(failed to compile test program)),
2715 AC_MSG_ERROR(failed to compile test program)),
2716 AC_MSG_ERROR(failed to compile test program))
2717
2718dnl Check for multibyte locale functions
2719dnl Find out if _Xsetlocale() is supported by libX11.
2720dnl Check if X_LOCALE should be defined.
2721
2722if test "$enable_multibyte" = "yes"; then
2723 cflags_save=$CFLAGS
2724 ldflags_save=$LDFLAGS
2725 if test -n "$x_includes" ; then
2726 CFLAGS="$CFLAGS -I$x_includes"
2727 LDFLAGS="$X_LIBS $LDFLAGS -lX11"
2728 AC_MSG_CHECKING(whether X_LOCALE needed)
2729 AC_TRY_COMPILE([#include <X11/Xlocale.h>],,
2730 AC_TRY_LINK_FUNC([_Xsetlocale], [AC_MSG_RESULT(yes)
2731 AC_DEFINE(X_LOCALE)], AC_MSG_RESULT(no)),
2732 AC_MSG_RESULT(no))
2733 fi
2734 CFLAGS=$cflags_save
2735 LDFLAGS=$ldflags_save
2736fi
2737
2738dnl Link with xpg4, it is said to make Korean locale working
2739AC_CHECK_LIB(xpg4, _xpg4_setrunelocale, [LIBS="$LIBS -lxpg4"],,)
2740
2741dnl Check how we can run ctags
2742dnl --version for Exuberant ctags (preferred)
2743dnl -t for typedefs (many ctags have this)
2744dnl -s for static functions (Elvis ctags only?)
2745dnl -v for variables. Dangerous, most ctags take this for 'vgrind style'.
2746dnl -i+m to test for older Exuberant ctags
2747AC_MSG_CHECKING(how to create tags)
2748test -f tags && mv tags tags.save
2749if (eval ctags --version /dev/null | grep Exuberant) < /dev/null 1>&AC_FD_CC 2>&1; then
2750 TAGPRG="ctags"
2751else
2752 (eval etags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags"
2753 (eval etags -c /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags -c"
2754 (eval ctags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags"
2755 (eval ctags -t /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -t"
2756 (eval ctags -ts /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -ts"
2757 (eval ctags -tvs /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -tvs"
2758 (eval ctags -i+m /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -i+m"
2759fi
2760test -f tags.save && mv tags.save tags
2761AC_MSG_RESULT($TAGPRG) AC_SUBST(TAGPRG)
2762
2763dnl Check how we can run man with a section number
2764AC_MSG_CHECKING(how to run man with a section nr)
2765MANDEF="man"
2766(eval man -s 2 read) < /dev/null > /dev/null 2>&AC_FD_CC && MANDEF="man -s"
2767AC_MSG_RESULT($MANDEF)
2768if test "$MANDEF" = "man -s"; then
2769 AC_DEFINE(USEMAN_S)
2770fi
2771
2772dnl Check if gettext() is working and if it needs -lintl
2773AC_MSG_CHECKING(--disable-nls argument)
2774AC_ARG_ENABLE(nls,
2775 [ --disable-nls Don't support NLS (gettext()).], ,
2776 [enable_nls="yes"])
2777
2778if test "$enable_nls" = "yes"; then
2779 AC_MSG_RESULT(no)
2780 AC_CHECK_PROG(MSGFMT, msgfmt, msgfmt, )
2781 AC_MSG_CHECKING([for NLS])
2782 if test -f po/Makefile; then
2783 have_gettext="no"
2784 if test -n "$MSGFMT"; then
2785 AC_TRY_LINK(
2786 [#include <libintl.h>],
2787 [gettext("Test");],
2788 AC_MSG_RESULT([gettext() works]); have_gettext="yes",
2789 olibs=$LIBS
2790 LIBS="$LIBS -lintl"
2791 AC_TRY_LINK(
2792 [#include <libintl.h>],
2793 [gettext("Test");],
2794 AC_MSG_RESULT([gettext() works with -lintl]); have_gettext="yes",
2795 AC_MSG_RESULT([gettext() doesn't work]);
2796 LIBS=$olibs))
2797 else
2798 AC_MSG_RESULT([msgfmt not found - disabled]);
2799 fi
2800 if test $have_gettext = "yes"; then
2801 AC_DEFINE(HAVE_GETTEXT)
2802 MAKEMO=yes
2803 AC_SUBST(MAKEMO)
2804 dnl this was added in GNU gettext 0.10.36
2805 AC_CHECK_FUNCS(bind_textdomain_codeset)
2806 dnl _nl_msg_cat_cntr is required for GNU gettext
2807 AC_MSG_CHECKING([for _nl_msg_cat_cntr])
2808 AC_TRY_LINK(
2809 [#include <libintl.h>
2810 extern int _nl_msg_cat_cntr;],
2811 [++_nl_msg_cat_cntr;],
2812 AC_MSG_RESULT([yes]); AC_DEFINE(HAVE_NL_MSG_CAT_CNTR),
2813 AC_MSG_RESULT([no]))
2814 fi
2815 else
2816 AC_MSG_RESULT([no "po/Makefile" - disabled]);
2817 fi
2818else
2819 AC_MSG_RESULT(yes)
2820fi
2821
2822dnl Check for dynamic linking loader
2823AC_CHECK_HEADER(dlfcn.h, DLL=dlfcn.h, [AC_CHECK_HEADER(dl.h, DLL=dl.h)])
2824if test x${DLL} = xdlfcn.h; then
2825 AC_DEFINE(HAVE_DLFCN_H, 1, [ Define if we have dlfcn.h. ])
2826 AC_MSG_CHECKING([for dlopen()])
2827 AC_TRY_LINK(,[
2828 extern void* dlopen();
2829 dlopen();
2830 ],
2831 AC_MSG_RESULT(yes);
2832 AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]),
2833 AC_MSG_RESULT(no);
2834 AC_MSG_CHECKING([for dlopen() in -ldl])
2835 olibs=$LIBS
2836 LIBS="$LIBS -ldl"
2837 AC_TRY_LINK(,[
2838 extern void* dlopen();
2839 dlopen();
2840 ],
2841 AC_MSG_RESULT(yes);
2842 AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]),
2843 AC_MSG_RESULT(no);
2844 LIBS=$olibs))
2845 dnl ReliantUNIX has dlopen() in libc but everything else in libdl
2846 dnl ick :-)
2847 AC_MSG_CHECKING([for dlsym()])
2848 AC_TRY_LINK(,[
2849 extern void* dlsym();
2850 dlsym();
2851 ],
2852 AC_MSG_RESULT(yes);
2853 AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]),
2854 AC_MSG_RESULT(no);
2855 AC_MSG_CHECKING([for dlsym() in -ldl])
2856 olibs=$LIBS
2857 LIBS="$LIBS -ldl"
2858 AC_TRY_LINK(,[
2859 extern void* dlsym();
2860 dlsym();
2861 ],
2862 AC_MSG_RESULT(yes);
2863 AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]),
2864 AC_MSG_RESULT(no);
2865 LIBS=$olibs))
2866elif test x${DLL} = xdl.h; then
2867 AC_DEFINE(HAVE_DL_H, 1, [ Define if we have dl.h. ])
2868 AC_MSG_CHECKING([for shl_load()])
2869 AC_TRY_LINK(,[
2870 extern void* shl_load();
2871 shl_load();
2872 ],
2873 AC_MSG_RESULT(yes);
2874 AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]),
2875 AC_MSG_RESULT(no);
2876 AC_MSG_CHECKING([for shl_load() in -ldld])
2877 olibs=$LIBS
2878 LIBS="$LIBS -ldld"
2879 AC_TRY_LINK(,[
2880 extern void* shl_load();
2881 shl_load();
2882 ],
2883 AC_MSG_RESULT(yes);
2884 AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]),
2885 AC_MSG_RESULT(no);
2886 LIBS=$olibs))
2887fi
2888AC_CHECK_HEADERS(setjmp.h)
2889
2890if test "x$MACOSX" = "xyes" -a -n "$PERL"; then
2891 dnl -ldl must come after DynaLoader.a
2892 if echo $LIBS | grep -e '-ldl' >/dev/null; then
2893 LIBS=`echo $LIBS | sed s/-ldl//`
2894 PERL_LIBS="$PERL_LIBS -ldl"
2895 fi
2896fi
2897
2898if test "x$MACOSX" = "xyes" && test "x$CARBON" = "xyes" \
2899 && test "x$GUITYPE" != "xCARBONGUI"; then
2900 AC_MSG_CHECKING(whether we need -framework Carbon)
2901 dnl check for MACOSX without Carbon GUI, but with FEAT_MBYTE
2902 if test "x$enable_multibyte" = "xyes" || test "x$features" == "xbig" \
2903 || test "x$features" = "xhuge"; then
2904 LIBS="$LIBS -framework Carbon"
2905 AC_MSG_RESULT(yes)
2906 else
2907 AC_MSG_RESULT(no)
2908 fi
2909fi
2910
2911
2912dnl write output files
2913AC_OUTPUT(auto/config.mk:config.mk.in)
2914
2915dnl vim: set sw=2 tw=78 fo+=l: