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