Initial import from the conversion Fossil -> Git
[dragora.git] / patches / vim / 8.0.0082
blob731bf31b009bb2a097f61d0845122e52a94f6979
1 To: vim_dev@googlegroups.com
2 Subject: Patch 8.0.0082
3 Fcc: outbox
4 From: Bram Moolenaar <Bram@moolenaar.net>
5 Mime-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8 ------------
10 Patch 8.0.0082
11 Problem:    Extension for configure should be ".ac".
12 Solution:   Rename configure.in to configure.ac. (James McCoy, closes #1173)
13 Files:      src/configure.in, src/configure.ac, Filelist, src/Makefile,
14             src/blowfish.c, src/channel.c, src/config.h.in, src/main.aap,
15             src/os_unix.c, src/INSTALL, src/mysign
18 *** ../vim-8.0.0081/src/configure.in    2016-10-18 16:27:20.544756017 +0200
19 --- src/configure.in    1970-01-01 01:00:00.000000000 +0100
20 ***************
21 *** 1,4314 ****
22 - dnl configure.in: autoconf script for Vim
23
24 - dnl Process this file with autoconf 2.12 or 2.13 to produce "configure".
25 - dnl Should also work with autoconf 2.54 and later.
26
27 - AC_INIT(vim.h)
28 - AC_CONFIG_HEADER(auto/config.h:config.h.in)
29
30 - dnl Being able to run configure means the system is Unix (compatible).
31 - AC_DEFINE(UNIX)
32 - AC_PROG_MAKE_SET
33
34 - dnl Checks for programs.
35 - AC_PROG_CC    dnl required by almost everything
36 - AC_PROG_CPP   dnl required by header file checks
37 - AC_PROGRAM_EGREP dnl required by AC_EGREP_CPP
38 - AC_PROG_FGREP dnl finds working grep -F
39 - AC_ISC_POSIX  dnl required by AC_C_CROSS
40 - AC_PROG_AWK   dnl required for "make html" in ../doc
41
42 - dnl Don't strip if we don't have it
43 - AC_CHECK_PROG(STRIP, strip, strip, :)
44
45 - dnl Check for extension of executables
46 - AC_EXEEXT
47
48 - dnl Check for standard headers.  We don't use this in Vim but other stuff
49 - dnl in autoconf needs it, where it uses STDC_HEADERS.
50 - AC_HEADER_STDC
51 - AC_HEADER_SYS_WAIT
52
53 - dnl Check for the flag that fails if stuff are missing.
54
55 - AC_MSG_CHECKING(--enable-fail-if-missing argument)
56 - AC_ARG_ENABLE(fail_if_missing,
57 -       [  --enable-fail-if-missing    Fail if dependencies on additional features
58 -      specified on the command line are missing.], 
59 -       [fail_if_missing="yes"],
60 -       [fail_if_missing="no"])
61 - AC_MSG_RESULT($fail_if_missing)
62
63 - dnl Set default value for CFLAGS if none is defined or it's empty
64 - if test -z "$CFLAGS"; then
65 -   CFLAGS="-O"
66 -   test "$GCC" = yes && CFLAGS="-O2 -fno-strength-reduce -Wall"
67 - fi
68 - if test "$GCC" = yes; then
69 -   dnl method that should work for nearly all versions
70 -   gccversion=`$CC -dumpversion`
71 -   if test "x$gccversion" = "x"; then
72 -     dnl old method; fall-back for when -dumpversion doesn't work
73 -     gccversion=`$CC --version | sed -e '2,$d' -e 's/darwin.//' -e 's/^[[^0-9]]*\([[0-9]]\.[[0-9.]]*\).*$/\1/g'`
74 -   fi
75 -   dnl version 4.0.1 was reported to cause trouble on Macintosh by Marcin Dalecki
76 -   if test "$gccversion" = "3.0.1" -o "$gccversion" = "3.0.2" -o "$gccversion" = "4.0.1"; then
77 -     echo 'GCC [[34]].0.[[12]] has a bug in the optimizer, disabling "-O#"'
78 -     CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-O/'`
79 -   else
80 -     if test "$gccversion" = "3.1" -o "$gccversion" = "3.2" -o "$gccversion" = "3.2.1" && `echo "$CFLAGS" | grep -v fno-strength-reduce >/dev/null`; then
81 -       echo 'GCC 3.1 and 3.2 have a bug in the optimizer, adding "-fno-strength-reduce"'
82 -       CFLAGS="$CFLAGS -fno-strength-reduce"
83 -     fi
84 -   fi
85 - fi
86
87 - dnl clang-500.2.75 or around has abandoned -f[no-]strength-reduce and issues a
88 - dnl warning when that flag is passed to.  Accordingly, adjust CFLAGS based on
89 - dnl the version number of the clang in use.
90 - dnl Note that this does not work to get the version of clang 3.1 or 3.2.
91 - AC_MSG_CHECKING(for recent clang version)
92 - CLANG_VERSION_STRING=`$CC --version 2>/dev/null | sed  -n -e 's/^.*clang.*\([[0-9]][[0-9]]*\.[[0-9]][[0-9]]*\.[[0-9]][[0-9]]*\).*$/\1/p'`
93 - if test x"$CLANG_VERSION_STRING" != x"" ; then
94 -   CLANG_MAJOR=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/\([[0-9]][[0-9]]*\)\.[[0-9]][[0-9]]*\.[[0-9]][[0-9]]*/\1/p'`
95 -   CLANG_MINOR=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/[[0-9]][[0-9]]*\.\([[0-9]][[0-9]]*\)\.[[0-9]][[0-9]]*/\1/p'`
96 -   CLANG_REVISION=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/[[0-9]][[0-9]]*\.[[0-9]][[0-9]]*\.\([[0-9]][[0-9]]*\)/\1/p'`
97 -   CLANG_VERSION=`expr $CLANG_MAJOR '*' 1000000 '+' $CLANG_MINOR '*' 1000 '+' $CLANG_REVISION`
98 -   AC_MSG_RESULT($CLANG_VERSION)
99 -   dnl If you find the same issue with versions earlier than 500.2.75,
100 -   dnl change the constant 500002075 below appropriately.  To get the
101 -   dnl integer corresponding to a version number, refer to the
102 -   dnl definition of CLANG_VERSION above.
103 -   if test "$CLANG_VERSION" -ge 500002075 ; then
104 -     CFLAGS=`echo "$CFLAGS" | sed -n -e 's/-fno-strength-reduce/ /p'`
105 -   fi
106 - else
107 -   AC_MSG_RESULT(no)
108 - fi
110 - dnl If configure thinks we are cross compiling, there might be something
111 - dnl wrong with the CC or CFLAGS settings, give a useful warning message
112 - CROSS_COMPILING=
113 - if test "$cross_compiling" = yes; then
114 -   AC_MSG_RESULT([cannot compile a simple program; if not cross compiling check CC and CFLAGS])
115 -   CROSS_COMPILING=1
116 - fi
117 - AC_SUBST(CROSS_COMPILING)
119 - dnl gcc-cpp has the wonderful -MM option to produce nicer dependencies.
120 - dnl But gcc 3.1 changed the meaning!  See near the end.
121 - test "$GCC" = yes && CPP_MM=M; AC_SUBST(CPP_MM)
123 - if test -f ./toolcheck; then
124 -   AC_CHECKING(for buggy tools)
125 -   sh ./toolcheck 1>&AC_FD_MSG
126 - fi
128 - OS_EXTRA_SRC=""; OS_EXTRA_OBJ=""
130 - dnl Check for BeOS, which needs an extra source file
131 - AC_MSG_CHECKING(for BeOS)
132 - case `uname` in
133 -     BeOS)     OS_EXTRA_SRC=os_beos.c; OS_EXTRA_OBJ=objects/os_beos.o
134 -               BEOS=yes; AC_MSG_RESULT(yes);;
135 -     *)                BEOS=no; AC_MSG_RESULT(no);;
136 - esac
138 - dnl If QNX is found, assume we don't want to use Xphoton
139 - dnl unless it was specifically asked for (--with-x)
140 - AC_MSG_CHECKING(for QNX)
141 - case `uname` in
142 -     QNX)      OS_EXTRA_SRC=os_qnx.c; OS_EXTRA_OBJ=objects/os_qnx.o
143 -               test -z "$with_x" && with_x=no
144 -               QNX=yes; AC_MSG_RESULT(yes);;
145 -     *)                QNX=no; AC_MSG_RESULT(no);;
146 - esac
148 - dnl Check for Darwin and MacOS X
149 - dnl We do a check for MacOS X in the very beginning because there
150 - dnl are a lot of other things we need to change besides GUI stuff
151 - AC_MSG_CHECKING([for Darwin (Mac OS X)])
152 - if test "`(uname) 2>/dev/null`" = Darwin; then
153 -   AC_MSG_RESULT(yes)
155 -   AC_MSG_CHECKING(--disable-darwin argument)
156 -   AC_ARG_ENABLE(darwin,
157 -         [  --disable-darwin        Disable Darwin (Mac OS X) support.],
158 -         , [enable_darwin="yes"])
159 -   if test "$enable_darwin" = "yes"; then
160 -     AC_MSG_RESULT(no)
161 -     AC_MSG_CHECKING(if Darwin files are there)
162 -     if test -f os_macosx.m; then
163 -       AC_MSG_RESULT(yes)
164 -     else
165 -       AC_MSG_RESULT([no, Darwin support disabled])
166 -       enable_darwin=no
167 -     fi
168 -   else
169 -     AC_MSG_RESULT([yes, Darwin support excluded])
170 -   fi
172 -   AC_MSG_CHECKING(--with-mac-arch argument)
173 -   AC_ARG_WITH(mac-arch, [  --with-mac-arch=ARCH    current, intel, ppc or both],
174 -       MACARCH="$withval"; AC_MSG_RESULT($MACARCH),
175 -       MACARCH="current"; AC_MSG_RESULT(defaulting to $MACARCH))
177 -   AC_MSG_CHECKING(--with-developer-dir argument)
178 -   AC_ARG_WITH(developer-dir, [  --with-developer-dir=PATH    use PATH as location for Xcode developer tools],
179 -       DEVELOPER_DIR="$withval"; AC_MSG_RESULT($DEVELOPER_DIR),
180 -         AC_MSG_RESULT(not present))
181 -   
182 -   if test "x$DEVELOPER_DIR" = "x"; then
183 -     AC_PATH_PROG(XCODE_SELECT, xcode-select)
184 -     if test "x$XCODE_SELECT" != "x"; then
185 -       AC_MSG_CHECKING(for developer dir using xcode-select)
186 -       DEVELOPER_DIR=`$XCODE_SELECT -print-path`
187 -       AC_MSG_RESULT([$DEVELOPER_DIR])
188 -     else
189 -       DEVELOPER_DIR=/Developer
190 -     fi
191 -   fi
193 -   if test "x$MACARCH" = "xboth"; then
194 -     AC_MSG_CHECKING(for 10.4 universal SDK)
195 -     dnl There is a terrible inconsistency (but we appear to get away with it):
196 -     dnl $CFLAGS uses the 10.4u SDK library for the headers, while $CPPFLAGS
197 -     dnl doesn't, because "gcc -E" doesn't grok it.  That means the configure
198 -     dnl tests using the preprocessor are actually done with the wrong header
199 -     dnl files. $LDFLAGS is set at the end, because configure uses it together
200 -     dnl with $CFLAGS and we can only have one -sysroot argument.
201 -     save_cppflags="$CPPFLAGS"
202 -     save_cflags="$CFLAGS"
203 -     save_ldflags="$LDFLAGS"
204 -     CFLAGS="$CFLAGS -isysroot $DEVELOPER_DIR/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
205 -     AC_TRY_LINK([ ], [ ],
206 -       AC_MSG_RESULT(found, will make universal binary),
208 -       AC_MSG_RESULT(not found)
209 -       CFLAGS="$save_cflags"
210 -       AC_MSG_CHECKING(if Intel architecture is supported)
211 -       CPPFLAGS="$CPPFLAGS -arch i386"
212 -       LDFLAGS="$save_ldflags -arch i386"
213 -       AC_TRY_LINK([ ], [ ],
214 -           AC_MSG_RESULT(yes); MACARCH="intel",
215 -           AC_MSG_RESULT(no, using PowerPC)
216 -               MACARCH="ppc"
217 -               CPPFLAGS="$save_cppflags -arch ppc"
218 -               LDFLAGS="$save_ldflags -arch ppc"))
219 -   elif test "x$MACARCH" = "xintel"; then
220 -     CPPFLAGS="$CPPFLAGS -arch intel"
221 -     LDFLAGS="$LDFLAGS -arch intel"
222 -   elif test "x$MACARCH" = "xppc"; then
223 -     CPPFLAGS="$CPPFLAGS -arch ppc"
224 -     LDFLAGS="$LDFLAGS -arch ppc"
225 -   fi
227 -   if test "$enable_darwin" = "yes"; then
228 -     MACOSX=yes
229 -     OS_EXTRA_SRC="os_macosx.m os_mac_conv.c";
230 -     OS_EXTRA_OBJ="objects/os_macosx.o objects/os_mac_conv.o"
231 -     dnl TODO: use -arch i386 on Intel machines
232 -     dnl Removed -no-cpp-precomp, only for very old compilers.
233 -     CPPFLAGS="$CPPFLAGS -DMACOS_X_UNIX"
235 -     dnl If Carbon is found, assume we don't want X11
236 -     dnl unless it was specifically asked for (--with-x)
237 -     dnl or Motif, Athena or GTK GUI is used.
238 -     AC_CHECK_HEADER(Carbon/Carbon.h, CARBON=yes)
239 -     if test "x$CARBON" = "xyes"; then
240 -       if test -z "$with_x" -a "X$enable_gui" != Xmotif -a "X$enable_gui" != Xathena -a "X$enable_gui" != Xgtk2 -a "X$enable_gui" != Xgtk3; then
241 -       with_x=no
242 -       fi
243 -     fi
244 -   fi
246 -   dnl Avoid a bug with -O2 with gcc 4.0.1.  Symptom: malloc() reports double
247 -   dnl free.  This happens in expand_filename(), because the optimizer swaps
248 -   dnl two blocks of code, both using "repl", that can't be swapped.
249 -   if test "$MACARCH" = "intel" -o "$MACARCH" = "both"; then
250 -     CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-Oz/'`
251 -   fi
253 - else
254 -   AC_MSG_RESULT(no)
255 - fi
257 - dnl Mac OS X 10.9+ no longer include AvailabilityMacros.h in Carbon
258 - dnl so we need to include it to have access to version macros.
259 - AC_CHECK_HEADERS(AvailabilityMacros.h)
261 - AC_SUBST(OS_EXTRA_SRC)
262 - AC_SUBST(OS_EXTRA_OBJ)
264 - dnl Add /usr/local/lib to $LDFLAGS and /usr/local/include to CFLAGS.
265 - dnl Only when the directory exists and it wasn't there yet.
266 - dnl For gcc don't do this when it is already in the default search path.
267 - dnl Skip all of this when cross-compiling.
268 - if test "$cross_compiling" = no; then
269 -   AC_MSG_CHECKING(--with-local-dir argument)
270 -   have_local_include=''
271 -   have_local_lib=''
272 -   AC_ARG_WITH([local-dir], [  --with-local-dir=PATH   search PATH instead of /usr/local for local libraries.
273 -   --without-local-dir     do not search /usr/local for local libraries.], [
274 -     local_dir="$withval"
275 -     case "$withval" in
276 -     */*) ;;
277 -     no)
278 -       # avoid adding local dir to LDFLAGS and CPPFLAGS
279 -       have_local_include=yes
280 -       have_local_lib=yes
281 -       ;;
282 -     *) AC_MSG_ERROR(must pass path argument to --with-local-dir) ;;
283 -     esac
284 -       AC_MSG_RESULT($local_dir)
285 -   ], [
286 -     local_dir=/usr/local
287 -     AC_MSG_RESULT(Defaulting to $local_dir)
288 -   ])
289 -   if test "$GCC" = yes -a "$local_dir" != no; then
290 -     echo 'void f(){}' > conftest.c
291 -     dnl Removed -no-cpp-precomp, only needed for OS X 10.2 (Ben Fowler)
292 -     have_local_include=`${CC-cc} -c -v conftest.c 2>&1 | grep "${local_dir}/include"`
293 -     have_local_lib=`${CC-cc} -c -v conftest.c 2>&1 | grep "${local_dir}/lib"`
294 -     rm -f conftest.c conftest.o
295 -   fi
296 -   if test -z "$have_local_lib" -a -d "${local_dir}/lib"; then
297 -     tt=`echo "$LDFLAGS" | sed -e "s+-L${local_dir}/lib ++g" -e "s+-L${local_dir}/lib$++g"`
298 -     if test "$tt" = "$LDFLAGS"; then
299 -       LDFLAGS="$LDFLAGS -L${local_dir}/lib"
300 -     fi
301 -   fi
302 -   if test -z "$have_local_include" -a -d "${local_dir}/include"; then
303 -     tt=`echo "$CPPFLAGS" | sed -e "s+-I${local_dir}/include ++g" -e "s+-I${local_dir}/include$++g"`
304 -     if test "$tt" = "$CPPFLAGS"; then
305 -       CPPFLAGS="$CPPFLAGS -I${local_dir}/include"
306 -     fi
307 -   fi
308 - fi
310 - AC_MSG_CHECKING(--with-vim-name argument)
311 - AC_ARG_WITH(vim-name, [  --with-vim-name=NAME    what to call the Vim executable],
312 -       VIMNAME="$withval"; AC_MSG_RESULT($VIMNAME),
313 -       VIMNAME="vim"; AC_MSG_RESULT(Defaulting to $VIMNAME))
314 - AC_SUBST(VIMNAME)
315 - AC_MSG_CHECKING(--with-ex-name argument)
316 - AC_ARG_WITH(ex-name, [  --with-ex-name=NAME     what to call the Ex executable],
317 -       EXNAME="$withval"; AC_MSG_RESULT($EXNAME),
318 -       EXNAME="ex"; AC_MSG_RESULT(Defaulting to ex))
319 - AC_SUBST(EXNAME)
320 - AC_MSG_CHECKING(--with-view-name argument)
321 - AC_ARG_WITH(view-name, [  --with-view-name=NAME   what to call the View executable],
322 -       VIEWNAME="$withval"; AC_MSG_RESULT($VIEWNAME),
323 -       VIEWNAME="view"; AC_MSG_RESULT(Defaulting to view))
324 - AC_SUBST(VIEWNAME)
326 - AC_MSG_CHECKING(--with-global-runtime argument)
327 - AC_ARG_WITH(global-runtime, [  --with-global-runtime=DIR    global runtime directory in 'runtimepath'],
328 -       AC_MSG_RESULT($withval); AC_DEFINE_UNQUOTED(RUNTIME_GLOBAL, "$withval"),
329 -       AC_MSG_RESULT(no))
331 - AC_MSG_CHECKING(--with-modified-by argument)
332 - AC_ARG_WITH(modified-by, [  --with-modified-by=NAME       name of who modified a release version],
333 -       AC_MSG_RESULT($withval); AC_DEFINE_UNQUOTED(MODIFIED_BY, "$withval"),
334 -       AC_MSG_RESULT(no))
336 - dnl Check for EBCDIC stolen from the LYNX port to z/OS Unix
337 - AC_MSG_CHECKING(if character set is EBCDIC)
338 - AC_TRY_COMPILE([ ],
339 - [ /* TryCompile function for CharSet.
340 -    Treat any failure as ASCII for compatibility with existing art.
341 -    Use compile-time rather than run-time tests for cross-compiler
342 -    tolerance.  */
343 - #if '0'!=240
344 - make an error "Character set is not EBCDIC"
345 - #endif ],
346 - [ # TryCompile action if true
347 - cf_cv_ebcdic=yes ],
348 - [ # TryCompile action if false
349 - cf_cv_ebcdic=no])
350 - # end of TryCompile ])
351 - # end of CacheVal CvEbcdic
352 - AC_MSG_RESULT($cf_cv_ebcdic)
353 - case "$cf_cv_ebcdic" in  #(vi
354 -     yes)      AC_DEFINE(EBCDIC)
355 -               line_break='"\\n"'
356 -               ;;
357 -     *)                line_break='"\\012"';;
358 - esac
359 - AC_SUBST(line_break)
361 - if test "$cf_cv_ebcdic" = "yes"; then
362 - dnl If we have EBCDIC we most likely have z/OS Unix, let's test it!
363 - AC_MSG_CHECKING(for z/OS Unix)
364 - case `uname` in
365 -     OS/390)   zOSUnix="yes";
366 -               dnl If using cc the environment variable _CC_CCMODE must be
367 -               dnl set to "1", so that some compiler extensions are enabled.
368 -               dnl If using c89 the environment variable is named _CC_C89MODE.
369 -               dnl Note: compile with c89 never tested.
370 -               if test "$CC" = "cc"; then
371 -                 ccm="$_CC_CCMODE"
372 -                 ccn="CC"
373 -               else
374 -                 if test "$CC" = "c89"; then
375 -                   ccm="$_CC_C89MODE"
376 -                   ccn="C89"
377 -                 else
378 -                   ccm=1
379 -                 fi
380 -               fi
381 -               if test "$ccm" != "1"; then
382 -                 echo ""
383 -                 echo "------------------------------------------"
384 -                 echo " On z/OS Unix, the environment variable"
385 -                 echo " _CC_${ccn}MODE must be set to \"1\"!"
386 -                 echo " Do:"
387 -                 echo "    export _CC_${ccn}MODE=1"
388 -                 echo " and then call configure again."
389 -                 echo "------------------------------------------"
390 -                 exit 1
391 -               fi
392 -               # Set CFLAGS for configure process.
393 -               # This will be reset later for config.mk.
394 -               # Use haltonmsg to force error for missing H files.
395 -               CFLAGS="$CFLAGS -D_ALL_SOURCE -Wc,float(ieee),haltonmsg(3296)";
396 -               LDFLAGS="$LDFLAGS -Wl,EDIT=NO"
397 -               AC_MSG_RESULT(yes)
398 -               ;;
399 -     *)                zOSUnix="no";
400 -               AC_MSG_RESULT(no)
401 -               ;;
402 - esac
403 - fi
405 - dnl Set QUOTESED. Needs additional backslashes on zOS
406 - if test "$zOSUnix" = "yes"; then
407 -     QUOTESED="sed -e 's/[[\\\\\"]]/\\\\\\\\&/g' -e 's/\\\\\\\\\"/\"/' -e 's/\\\\\\\\\";\$\$/\";/'"
408 - else
409 -     QUOTESED="sed -e 's/[[\\\\\"]]/\\\\&/g' -e 's/\\\\\"/\"/' -e 's/\\\\\";\$\$/\";/'"
410 - fi
411 - AC_SUBST(QUOTESED)
414 - dnl Link with -lsmack for Smack stuff; if not found
415 - AC_MSG_CHECKING(--disable-smack argument)
416 - AC_ARG_ENABLE(smack,
417 -       [  --disable-smack        Do not check for Smack support.],
418 -       , enable_smack="yes")
419 - if test "$enable_smack" = "yes"; then
420 -   AC_MSG_RESULT(no)
421 -   AC_CHECK_HEADER([linux/xattr.h], true, enable_smack="no")
422 - else
423 -   AC_MSG_RESULT(yes)
424 - fi
425 - if test "$enable_smack" = "yes"; then
426 -   AC_CHECK_HEADER([attr/xattr.h], true, enable_smack="no")
427 - fi
428 - if test "$enable_smack" = "yes"; then
429 -   AC_MSG_CHECKING(for XATTR_NAME_SMACKEXEC in linux/xattr.h)
430 -   AC_EGREP_CPP(XATTR_NAME_SMACKEXEC, [#include <linux/xattr.h>],
431 -              AC_MSG_RESULT(yes),
432 -              AC_MSG_RESULT(no); enable_smack="no")
433 - fi
434 - if test "$enable_smack" = "yes"; then
435 -   AC_CHECK_LIB(attr, setxattr,
436 -         [LIBS="$LIBS -lattr"
437 -          found_smack="yes"
438 -          AC_DEFINE(HAVE_SMACK)])
439 - fi
441 - dnl When smack was found don't search for SELinux
442 - if test "x$found_smack" = "x"; then
443 -   dnl Link with -lselinux for SELinux stuff; if not found
444 -   AC_MSG_CHECKING(--disable-selinux argument)
445 -   AC_ARG_ENABLE(selinux,
446 -         [  --disable-selinux    Do not check for SELinux support.],
447 -         , enable_selinux="yes")
448 -   if test "$enable_selinux" = "yes"; then
449 -     AC_MSG_RESULT(no)
450 -     AC_CHECK_LIB(selinux, is_selinux_enabled,
451 -           [LIBS="$LIBS -lselinux"
452 -            AC_DEFINE(HAVE_SELINUX)])
453 -   else
454 -      AC_MSG_RESULT(yes)
455 -   fi
456 - fi
458 - dnl Check user requested features.
460 - AC_MSG_CHECKING(--with-features argument)
461 - AC_ARG_WITH(features, [  --with-features=TYPE    tiny, small, normal, big or huge (default: huge)],
462 -       features="$withval"; AC_MSG_RESULT($features),
463 -       features="huge"; AC_MSG_RESULT(Defaulting to huge))
465 - dovimdiff=""
466 - dogvimdiff=""
467 - case "$features" in
468 -   tiny)               AC_DEFINE(FEAT_TINY) ;;
469 -   small)      AC_DEFINE(FEAT_SMALL) ;;
470 -   normal)     AC_DEFINE(FEAT_NORMAL) dovimdiff="installvimdiff";
471 -                       dogvimdiff="installgvimdiff" ;;
472 -   big)                AC_DEFINE(FEAT_BIG) dovimdiff="installvimdiff";
473 -                       dogvimdiff="installgvimdiff" ;;
474 -   huge)               AC_DEFINE(FEAT_HUGE) dovimdiff="installvimdiff";
475 -                       dogvimdiff="installgvimdiff" ;;
476 -   *)          AC_MSG_RESULT([Sorry, $features is not supported]) ;;
477 - esac
479 - AC_SUBST(dovimdiff)
480 - AC_SUBST(dogvimdiff)
482 - AC_MSG_CHECKING(--with-compiledby argument)
483 - AC_ARG_WITH(compiledby, [  --with-compiledby=NAME  name to show in :version message],
484 -       compiledby="$withval"; AC_MSG_RESULT($withval),
485 -       compiledby=""; AC_MSG_RESULT(no))
486 - AC_SUBST(compiledby)
488 - AC_MSG_CHECKING(--disable-xsmp argument)
489 - AC_ARG_ENABLE(xsmp,
490 -       [  --disable-xsmp          Disable XSMP session management],
491 -       , enable_xsmp="yes")
493 - if test "$enable_xsmp" = "yes"; then
494 -   AC_MSG_RESULT(no)
495 -   AC_MSG_CHECKING(--disable-xsmp-interact argument)
496 -   AC_ARG_ENABLE(xsmp-interact,
497 -         [  --disable-xsmp-interact Disable XSMP interaction],
498 -         , enable_xsmp_interact="yes")
499 -   if test "$enable_xsmp_interact" = "yes"; then
500 -     AC_MSG_RESULT(no)
501 -     AC_DEFINE(USE_XSMP_INTERACT)
502 -   else
503 -     AC_MSG_RESULT(yes)
504 -   fi
505 - else
506 -   AC_MSG_RESULT(yes)
507 - fi
509 - dnl Check for Lua feature.
510 - AC_MSG_CHECKING(--enable-luainterp argument)
511 - AC_ARG_ENABLE(luainterp,
512 -       [  --enable-luainterp[=OPTS]     Include Lua interpreter.  [default=no] [OPTS=no/yes/dynamic]], ,
513 -       [enable_luainterp="no"])
514 - AC_MSG_RESULT($enable_luainterp)
516 - if test "$enable_luainterp" = "yes" -o "$enable_luainterp" = "dynamic"; then
517 -   if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
518 -     AC_MSG_ERROR([cannot use Lua with tiny or small features])
519 -   fi
521 -   dnl -- find the lua executable
522 -   AC_SUBST(vi_cv_path_lua)
524 -   AC_MSG_CHECKING(--with-lua-prefix argument)
525 -   AC_ARG_WITH(lua_prefix,
526 -       [  --with-lua-prefix=PFX   Prefix where Lua is installed.],
527 -       with_lua_prefix="$withval"; AC_MSG_RESULT($with_lua_prefix),
528 -       with_lua_prefix="";AC_MSG_RESULT(no))
530 -   if test "X$with_lua_prefix" != "X"; then
531 -        vi_cv_path_lua_pfx="$with_lua_prefix"
532 -   else
533 -     AC_MSG_CHECKING(LUA_PREFIX environment var)
534 -     if test "X$LUA_PREFIX" != "X"; then
535 -       AC_MSG_RESULT("$LUA_PREFIX")
536 -       vi_cv_path_lua_pfx="$LUA_PREFIX"
537 -     else
538 -       AC_MSG_RESULT([not set, default to /usr])
539 -       vi_cv_path_lua_pfx="/usr"
540 -     fi
541 -   fi
543 -   AC_MSG_CHECKING(--with-luajit)
544 -   AC_ARG_WITH(luajit,
545 -       [  --with-luajit           Link with LuaJIT instead of Lua.],
546 -       [vi_cv_with_luajit="$withval"],
547 -       [vi_cv_with_luajit="no"])
548 -   AC_MSG_RESULT($vi_cv_with_luajit)
550 -   LUA_INC=
551 -   if test "X$vi_cv_path_lua_pfx" != "X"; then
552 -     if test "x$vi_cv_with_luajit" != "xno"; then
553 -       dnl -- try to find LuaJIT executable
554 -       AC_PATH_PROG(vi_cv_path_luajit, luajit)
555 -       if test "X$vi_cv_path_luajit" != "X"; then
556 -       dnl -- find LuaJIT version
557 -       AC_CACHE_CHECK(LuaJIT version, vi_cv_version_luajit,
558 -       [ vi_cv_version_luajit=`${vi_cv_path_luajit} -v 2>&1 | sed 's/LuaJIT \([[0-9.]]*\)\.[[0-9]]\(-[[a-z0-9]]*\)* .*/\1/'` ])
559 -       AC_CACHE_CHECK(Lua version of LuaJIT, vi_cv_version_lua_luajit,
560 -       [ vi_cv_version_lua_luajit=`${vi_cv_path_luajit} -e "print(_VERSION)" | sed 's/.* //'` ])
561 -       vi_cv_path_lua="$vi_cv_path_luajit"
562 -       vi_cv_version_lua="$vi_cv_version_lua_luajit"
563 -       fi
564 -     else
565 -       dnl -- try to find Lua executable
566 -       AC_PATH_PROG(vi_cv_path_plain_lua, lua)
567 -       if test "X$vi_cv_path_plain_lua" != "X"; then
568 -       dnl -- find Lua version
569 -       AC_CACHE_CHECK(Lua version, vi_cv_version_plain_lua,
570 -       [ vi_cv_version_plain_lua=`${vi_cv_path_plain_lua} -e "print(_VERSION)" | sed 's/.* //'` ])
571 -       fi
572 -       vi_cv_path_lua="$vi_cv_path_plain_lua"
573 -       vi_cv_version_lua="$vi_cv_version_plain_lua"
574 -     fi
575 -     if test "x$vi_cv_with_luajit" != "xno" && test "X$vi_cv_version_luajit" != "X"; then
576 -       AC_MSG_CHECKING(if lua.h can be found in $vi_cv_path_lua_pfx/include/luajit-$vi_cv_version_luajit)
577 -       if test -f "$vi_cv_path_lua_pfx/include/luajit-$vi_cv_version_luajit/lua.h"; then
578 -       AC_MSG_RESULT(yes)
579 -       LUA_INC=/luajit-$vi_cv_version_luajit
580 -       fi
581 -     fi
582 -     if test "X$LUA_INC" = "X"; then
583 -       AC_MSG_CHECKING(if lua.h can be found in $vi_cv_path_lua_pfx/include)
584 -       if test -f "$vi_cv_path_lua_pfx/include/lua.h"; then
585 -       AC_MSG_RESULT(yes)
586 -       else
587 -       AC_MSG_RESULT(no)
588 -       AC_MSG_CHECKING(if lua.h can be found in $vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua)
589 -       if test -f "$vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua/lua.h"; then
590 -         AC_MSG_RESULT(yes)
591 -         LUA_INC=/lua$vi_cv_version_lua
592 -       else
593 -         AC_MSG_RESULT(no)
594 -         vi_cv_path_lua_pfx=
595 -       fi
596 -       fi
597 -     fi
598 -   fi
600 -   if test "X$vi_cv_path_lua_pfx" != "X"; then
601 -     if test "x$vi_cv_with_luajit" != "xno"; then
602 -       multiarch=`dpkg-architecture -qDEB_HOST_MULTIARCH 2> /dev/null`
603 -       if test "X$multiarch" != "X"; then
604 -       lib_multiarch="lib/${multiarch}"
605 -       else
606 -       lib_multiarch="lib"
607 -       fi
608 -       if test "X$vi_cv_version_lua" = "X"; then
609 -       LUA_LIBS="-L${vi_cv_path_lua_pfx}/${lib_multiarch} -lluajit"
610 -       else
611 -       LUA_LIBS="-L${vi_cv_path_lua_pfx}/${lib_multiarch} -lluajit-$vi_cv_version_lua"
612 -       fi
613 -     else
614 -       if test "X$LUA_INC" != "X"; then
615 -       dnl Test alternate location using version
616 -       LUA_LIBS="-L${vi_cv_path_lua_pfx}/lib -llua$vi_cv_version_lua"
617 -       else
618 -       LUA_LIBS="-L${vi_cv_path_lua_pfx}/lib -llua"
619 -       fi
620 -     fi
621 -     if test "$enable_luainterp" = "dynamic"; then
622 -       lua_ok="yes"
623 -     else
624 -       AC_MSG_CHECKING([if link with ${LUA_LIBS} is sane])
625 -       libs_save=$LIBS
626 -       LIBS="$LIBS $LUA_LIBS"
627 -       AC_TRY_LINK(,[ ],
628 -       AC_MSG_RESULT(yes); lua_ok="yes",
629 -       AC_MSG_RESULT(no); lua_ok="no"; LUA_LIBS="")
630 -       LIBS=$libs_save
631 -     fi
632 -     if test "x$lua_ok" = "xyes"; then
633 -       LUA_CFLAGS="-I${vi_cv_path_lua_pfx}/include${LUA_INC}"
634 -       LUA_SRC="if_lua.c"
635 -       LUA_OBJ="objects/if_lua.o"
636 -       LUA_PRO="if_lua.pro"
637 -       AC_DEFINE(FEAT_LUA)
638 -     fi
639 -     if test "$enable_luainterp" = "dynamic"; then
640 -       if test "x$vi_cv_with_luajit" != "xno"; then
641 -       luajit="jit"
642 -       fi
643 -       if test -f "${vi_cv_path_lua_pfx}/bin/cyglua-${vi_cv_version_lua}.dll"; then
644 -       vi_cv_dll_name_lua="cyglua-${vi_cv_version_lua}.dll"
645 -       else
646 -       if test "x$MACOSX" = "xyes"; then
647 -         ext="dylib"
648 -         indexes=""
649 -       else
650 -         ext="so"
651 -         indexes=".0 .1 .2 .3 .4 .5 .6 .7 .8 .9"
652 -         multiarch=`dpkg-architecture -qDEB_HOST_MULTIARCH 2> /dev/null`
653 -         if test "X$multiarch" != "X"; then
654 -           lib_multiarch="lib/${multiarch}"
655 -         fi
656 -       fi
657 -       dnl Determine the sover for the current version, but fallback to
658 -       dnl liblua${vi_cv_version_lua}.so if no sover-versioned file is found.
659 -       AC_MSG_CHECKING(if liblua${luajit}*.${ext}* can be found in $vi_cv_path_lua_pfx)
660 -       for subdir in "${lib_multiarch}" lib64 lib; do
661 -         if test -z "$subdir"; then
662 -           continue
663 -         fi
664 -         for sover in "${vi_cv_version_lua}.${ext}" "-${vi_cv_version_lua}.${ext}" \
665 -           ".${vi_cv_version_lua}.${ext}" ".${ext}.${vi_cv_version_lua}"; do
666 -           for i in $indexes ""; do
667 -             if test -f "${vi_cv_path_lua_pfx}/${subdir}/liblua${luajit}${sover}$i"; then
668 -               sover2="$i"
669 -               break 3
670 -             fi
671 -           done
672 -         done
673 -         sover=""
674 -       done
675 -       if test "X$sover" = "X"; then
676 -         AC_MSG_RESULT(no)
677 -         lua_ok="no"
678 -         vi_cv_dll_name_lua="liblua${luajit}.${ext}"
679 -       else
680 -         AC_MSG_RESULT(yes)
681 -         lua_ok="yes"
682 -         vi_cv_dll_name_lua="liblua${luajit}${sover}$sover2"
683 -       fi
684 -       fi
685 -       AC_DEFINE(DYNAMIC_LUA)
686 -       LUA_LIBS=""
687 -       LUA_CFLAGS="-DDYNAMIC_LUA_DLL=\\\"${vi_cv_dll_name_lua}\\\" $LUA_CFLAGS"
688 -     fi
689 -     if test "X$LUA_CFLAGS$LUA_LIBS" != "X" && \
690 -        test "x$MACOSX" = "xyes" && test "x$vi_cv_with_luajit" != "xno" && \
691 -        test "`(uname -m) 2>/dev/null`" = "x86_64"; then
692 -       dnl OSX/x64 requires these flags. See http://luajit.org/install.html
693 -       LUA_LIBS="-pagezero_size 10000 -image_base 100000000 $LUA_LIBS"
694 -     fi
695 -   fi
696 -   if test "$fail_if_missing" = "yes" -a "$lua_ok" != "yes"; then
697 -     AC_MSG_ERROR([could not configure lua])
698 -   fi
699 -   AC_SUBST(LUA_SRC)
700 -   AC_SUBST(LUA_OBJ)
701 -   AC_SUBST(LUA_PRO)
702 -   AC_SUBST(LUA_LIBS)
703 -   AC_SUBST(LUA_CFLAGS)
704 - fi
707 - dnl Check for MzScheme feature.
708 - AC_MSG_CHECKING(--enable-mzschemeinterp argument)
709 - AC_ARG_ENABLE(mzschemeinterp,
710 -       [  --enable-mzschemeinterp   Include MzScheme interpreter.], ,
711 -       [enable_mzschemeinterp="no"])
712 - AC_MSG_RESULT($enable_mzschemeinterp)
714 - if test "$enable_mzschemeinterp" = "yes"; then
715 -   dnl -- find the mzscheme executable
716 -   AC_SUBST(vi_cv_path_mzscheme)
718 -   AC_MSG_CHECKING(--with-plthome argument)
719 -   AC_ARG_WITH(plthome,
720 -       [  --with-plthome=PLTHOME   Use PLTHOME.],
721 -       with_plthome="$withval"; AC_MSG_RESULT($with_plthome),
722 -       with_plthome="";AC_MSG_RESULT("no"))
724 -   if test "X$with_plthome" != "X"; then
725 -        vi_cv_path_mzscheme_pfx="$with_plthome"
726 -        vi_cv_path_mzscheme="${vi_cv_path_mzscheme_pfx}/bin/mzscheme"
727 -   else
728 -     AC_MSG_CHECKING(PLTHOME environment var)
729 -     if test "X$PLTHOME" != "X"; then
730 -       AC_MSG_RESULT("$PLTHOME")
731 -       vi_cv_path_mzscheme_pfx="$PLTHOME"
732 -       vi_cv_path_mzscheme="${vi_cv_path_mzscheme_pfx}/bin/mzscheme"
733 -     else
734 -       AC_MSG_RESULT(not set)
735 -       dnl -- try to find MzScheme executable
736 -       AC_PATH_PROG(vi_cv_path_mzscheme, mzscheme)
738 -       dnl resolve symbolic link, the executable is often elsewhere and there
739 -       dnl are no links for the include files.
740 -       if test "X$vi_cv_path_mzscheme" != "X"; then
741 -         lsout=`ls -l $vi_cv_path_mzscheme`
742 -         if echo "$lsout" | grep -e '->' >/dev/null 2>/dev/null; then
743 -           vi_cv_path_mzscheme=`echo "$lsout" | sed 's/.*-> \(.*\)/\1/'`
744 -         fi
745 -       fi
747 -       if test "X$vi_cv_path_mzscheme" != "X"; then
748 -           dnl -- find where MzScheme thinks it was installed
749 -           AC_CACHE_CHECK(MzScheme install prefix,vi_cv_path_mzscheme_pfx,
750 -           dnl different versions of MzScheme differ in command line processing
751 -           dnl use universal approach
752 -           echo "(display (simplify-path               \
753 -              (build-path (call-with-values    \
754 -               (lambda () (split-path (find-system-path (quote exec-file)))) \
755 -               (lambda (base name must-be-dir?) base)) (quote up))))" > mzdirs.scm
756 -           dnl Remove a trailing slash
757 -           [ vi_cv_path_mzscheme_pfx=`${vi_cv_path_mzscheme} -r mzdirs.scm | \
758 -               sed -e 's+/$++'` ])
759 -           rm -f mzdirs.scm
760 -       fi
761 -     fi
762 -   fi
764 -   if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
765 -     AC_MSG_CHECKING(for racket include directory)
766 -     SCHEME_INC=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-include-dir))) (when (path? p) (display p)))'`
767 -     if test "X$SCHEME_INC" != "X"; then
768 -       AC_MSG_RESULT(${SCHEME_INC})
769 -     else
770 -       AC_MSG_RESULT(not found)
771 -       AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include)
772 -       if test -f "$vi_cv_path_mzscheme_pfx/include/scheme.h"; then
773 -       SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include
774 -       AC_MSG_RESULT(yes)
775 -       else
776 -       AC_MSG_RESULT(no)
777 -       AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/plt)
778 -       if test -f "$vi_cv_path_mzscheme_pfx/include/plt/scheme.h"; then
779 -         AC_MSG_RESULT(yes)
780 -         SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/plt
781 -       else
782 -         AC_MSG_RESULT(no)
783 -         AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/racket)
784 -         if test -f "$vi_cv_path_mzscheme_pfx/include/racket/scheme.h"; then
785 -           AC_MSG_RESULT(yes)
786 -           SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/racket
787 -         else
788 -           AC_MSG_RESULT(no)
789 -           AC_MSG_CHECKING(if scheme.h can be found in /usr/include/plt/)
790 -           if test -f /usr/include/plt/scheme.h; then
791 -             AC_MSG_RESULT(yes)
792 -             SCHEME_INC=/usr/include/plt
793 -           else
794 -             AC_MSG_RESULT(no)
795 -             AC_MSG_CHECKING(if scheme.h can be found in /usr/include/racket/)
796 -             if test -f /usr/include/racket/scheme.h; then
797 -               AC_MSG_RESULT(yes)
798 -               SCHEME_INC=/usr/include/racket
799 -             else
800 -               AC_MSG_RESULT(no)
801 -               vi_cv_path_mzscheme_pfx=
802 -             fi
803 -           fi
804 -         fi
805 -       fi
806 -       fi
807 -     fi
808 -   fi
810 -   if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
812 -     AC_MSG_CHECKING(for racket lib directory)
813 -     SCHEME_LIB=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-lib-dir))) (when (path? p) (display p)))'`
814 -     if test "X$SCHEME_LIB" != "X"; then
815 -       AC_MSG_RESULT(${SCHEME_LIB})
816 -     else
817 -       AC_MSG_RESULT(not found)
818 -     fi
820 -     for path in "${vi_cv_path_mzscheme_pfx}/lib" "${SCHEME_LIB}"; do
821 -       if test "X$path" != "X"; then
822 -       if test "x$MACOSX" = "xyes"; then
823 -         MZSCHEME_LIBS="-framework Racket"
824 -         MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
825 -       elif test -f "${path}/libmzscheme3m.a"; then
826 -         MZSCHEME_LIBS="${path}/libmzscheme3m.a"
827 -         MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
828 -       elif test -f "${path}/libracket3m.a"; then
829 -         MZSCHEME_LIBS="${path}/libracket3m.a"
830 -         MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
831 -       elif test -f "${path}/libracket.a"; then
832 -         MZSCHEME_LIBS="${path}/libracket.a ${path}/libmzgc.a"
833 -       elif test -f "${path}/libmzscheme.a"; then
834 -         MZSCHEME_LIBS="${path}/libmzscheme.a ${path}/libmzgc.a"
835 -       else
836 -         dnl Using shared objects
837 -         if test -f "${path}/libmzscheme3m.so"; then
838 -           MZSCHEME_LIBS="-L${path} -lmzscheme3m"
839 -           MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
840 -         elif test -f "${path}/libracket3m.so"; then
841 -           MZSCHEME_LIBS="-L${path} -lracket3m"
842 -           MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
843 -         elif test -f "${path}/libracket.so"; then
844 -           MZSCHEME_LIBS="-L${path} -lracket -lmzgc"
845 -         else
846 -           dnl try next until last
847 -           if test "$path" != "$SCHEME_LIB"; then
848 -             continue
849 -           fi
850 -           MZSCHEME_LIBS="-L${path} -lmzscheme -lmzgc"
851 -         fi
852 -         if test "$GCC" = yes; then
853 -           dnl Make Vim remember the path to the library.  For when it's not in
854 -           dnl $LD_LIBRARY_PATH.
855 -           MZSCHEME_LIBS="${MZSCHEME_LIBS} -Wl,-rpath -Wl,${path}"
856 -         elif test "`(uname) 2>/dev/null`" = SunOS &&
857 -                                  uname -r | grep '^5' >/dev/null; then
858 -           MZSCHEME_LIBS="${MZSCHEME_LIBS} -R ${path}"
859 -         fi
860 -       fi
861 -       fi
862 -       if test "X$MZSCHEME_LIBS" != "X"; then
863 -       break
864 -       fi
865 -     done
867 -     AC_MSG_CHECKING([if racket requires -pthread])
868 -     if test "X$SCHEME_LIB" != "X" && $FGREP -e -pthread "$SCHEME_LIB/buildinfo" >/dev/null ; then
869 -       AC_MSG_RESULT(yes)
870 -       MZSCHEME_LIBS="${MZSCHEME_LIBS} -pthread"
871 -       MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -pthread"
872 -     else
873 -       AC_MSG_RESULT(no)
874 -     fi
876 -     AC_MSG_CHECKING(for racket config directory)
877 -     SCHEME_CONFIGDIR=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-config-dir))) (when (path? p) (display p)))'`
878 -     if test "X$SCHEME_CONFIGDIR" != "X"; then
879 -       MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DMZSCHEME_CONFIGDIR='\"${SCHEME_CONFIGDIR}\"'"
880 -       AC_MSG_RESULT(${SCHEME_CONFIGDIR})
881 -     else
882 -       AC_MSG_RESULT(not found)
883 -     fi
885 -     AC_MSG_CHECKING(for racket collects directory)
886 -     SCHEME_COLLECTS=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-collects-dir))) (when (path? p) (let-values (((base _1 _2) (split-path p))) (display base))))'`
887 -     if test "X$SCHEME_COLLECTS" = "X"; then
888 -       if test -d "$vi_cv_path_mzscheme_pfx/lib/plt/collects"; then
889 -       SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/lib/plt/
890 -       else
891 -       if test -d "$vi_cv_path_mzscheme_pfx/lib/racket/collects"; then
892 -         SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/lib/racket/
893 -       else
894 -         if test -d "$vi_cv_path_mzscheme_pfx/share/racket/collects"; then
895 -           SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/share/racket/
896 -         else
897 -           if test -d "$vi_cv_path_mzscheme_pfx/collects"; then
898 -             SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/
899 -           fi
900 -         fi
901 -       fi
902 -       fi
903 -     fi
904 -     if test "X$SCHEME_COLLECTS" != "X" ; then
905 -       AC_MSG_RESULT(${SCHEME_COLLECTS})
906 -     else
907 -       AC_MSG_RESULT(not found)
908 -     fi
910 -     AC_MSG_CHECKING(for mzscheme_base.c)
911 -     if test -f "${SCHEME_COLLECTS}collects/scheme/base.ss" ; then
912 -       MZSCHEME_EXTRA="mzscheme_base.c"
913 -       MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/mzc"
914 -       MZSCHEME_MOD="++lib scheme/base"
915 -     else
916 -       if test -f "${SCHEME_COLLECTS}collects/scheme/base.rkt" ; then
917 -       MZSCHEME_EXTRA="mzscheme_base.c"
918 -       MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/mzc"
919 -       MZSCHEME_MOD="++lib scheme/base"
920 -       else
921 -       if test -f "${SCHEME_COLLECTS}collects/racket/base.rkt" ; then
922 -         MZSCHEME_EXTRA="mzscheme_base.c"
923 -         MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/raco ctool"
924 -         MZSCHEME_MOD=""
925 -       fi
926 -       fi
927 -     fi
928 -     if test "X$MZSCHEME_EXTRA" != "X" ; then
929 -       dnl need to generate bytecode for MzScheme base
930 -       MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DINCLUDE_MZSCHEME_BASE"
931 -       AC_MSG_RESULT(needed)
932 -     else
933 -       AC_MSG_RESULT(not needed)
934 -     fi
936 -     dnl On Ubuntu this fixes "undefined reference to symbol 'ffi_type_void'".
937 -     AC_CHECK_LIB(ffi, ffi_type_void, [MZSCHEME_LIBS="$MZSCHEME_LIBS -lffi"])
939 -     MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -I${SCHEME_INC} \
940 -       -DMZSCHEME_COLLECTS='\"${SCHEME_COLLECTS}collects\"'"
942 -     dnl Test that we can compile a simple program with these CFLAGS and LIBS.
943 -     AC_MSG_CHECKING([if compile and link flags for MzScheme are sane])
944 -     cflags_save=$CFLAGS
945 -     libs_save=$LIBS
946 -     CFLAGS="$CFLAGS $MZSCHEME_CFLAGS"
947 -     LIBS="$LIBS $MZSCHEME_LIBS"
948 -     AC_TRY_LINK(,[ ],
949 -          AC_MSG_RESULT(yes); mzs_ok=yes,
950 -          AC_MSG_RESULT(no: MZSCHEME DISABLED); mzs_ok=no)
951 -     CFLAGS=$cflags_save
952 -     LIBS=$libs_save
953 -     if test $mzs_ok = yes; then
954 -       MZSCHEME_SRC="if_mzsch.c"
955 -       MZSCHEME_OBJ="objects/if_mzsch.o"
956 -       MZSCHEME_PRO="if_mzsch.pro"
957 -       AC_DEFINE(FEAT_MZSCHEME)
958 -     else
959 -       MZSCHEME_CFLAGS=
960 -       MZSCHEME_LIBS=
961 -       MZSCHEME_EXTRA=
962 -       MZSCHEME_MZC=
963 -     fi
964 -   fi
965 -   AC_SUBST(MZSCHEME_SRC)
966 -   AC_SUBST(MZSCHEME_OBJ)
967 -   AC_SUBST(MZSCHEME_PRO)
968 -   AC_SUBST(MZSCHEME_LIBS)
969 -   AC_SUBST(MZSCHEME_CFLAGS)
970 -   AC_SUBST(MZSCHEME_EXTRA)
971 -   AC_SUBST(MZSCHEME_MZC)
972 - fi
975 - AC_MSG_CHECKING(--enable-perlinterp argument)
976 - AC_ARG_ENABLE(perlinterp,
977 -       [  --enable-perlinterp[=OPTS]     Include Perl interpreter.  [default=no] [OPTS=no/yes/dynamic]], ,
978 -       [enable_perlinterp="no"])
979 - AC_MSG_RESULT($enable_perlinterp)
980 - if test "$enable_perlinterp" = "yes" -o "$enable_perlinterp" = "dynamic"; then
981 -   if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
982 -     AC_MSG_ERROR([cannot use Perl with tiny or small features])
983 -   fi
984 -   AC_SUBST(vi_cv_path_perl)
985 -   AC_PATH_PROG(vi_cv_path_perl, perl)
986 -   if test "X$vi_cv_path_perl" != "X"; then
987 -     AC_MSG_CHECKING(Perl version)
988 -     if $vi_cv_path_perl -e 'require 5.003_01' >/dev/null 2>/dev/null; then
989 -      eval `$vi_cv_path_perl -V:usethreads`
990 -      eval `$vi_cv_path_perl -V:libperl`
991 -      if test "X$usethreads" = "XUNKNOWN" -o "X$usethreads" = "Xundef"; then
992 -        badthreads=no
993 -      else
994 -        if $vi_cv_path_perl -e 'require 5.6.0' >/dev/null 2>/dev/null; then
995 -        eval `$vi_cv_path_perl -V:use5005threads`
996 -        if test "X$use5005threads" = "XUNKNOWN" -o "X$use5005threads" = "Xundef"; then
997 -          badthreads=no
998 -        else
999 -          badthreads=yes
1000 -          AC_MSG_RESULT(>>> Perl > 5.6 with 5.5 threads cannot be used <<<)
1001 -        fi
1002 -        else
1003 -        badthreads=yes
1004 -        AC_MSG_RESULT(>>> Perl 5.5 with threads cannot be used <<<)
1005 -        fi
1006 -      fi
1007 -      if test $badthreads = no; then
1008 -       AC_MSG_RESULT(OK)
1009 -       eval `$vi_cv_path_perl -V:shrpenv`
1010 -       if test "X$shrpenv" = "XUNKNOWN"; then # pre 5.003_04
1011 -       shrpenv=""
1012 -       fi
1013 -       vi_cv_perllib=`$vi_cv_path_perl -MConfig -e 'print $Config{privlibexp}'`
1014 -       AC_SUBST(vi_cv_perllib)
1015 -       vi_cv_perl_extutils=unknown_perl_extutils_path
1016 -       for extutils_rel_path in ExtUtils vendor_perl/ExtUtils; do
1017 -       xsubpp_path="$vi_cv_perllib/$extutils_rel_path/xsubpp"
1018 -       if test -f "$xsubpp_path"; then
1019 -         vi_cv_perl_xsubpp="$xsubpp_path"
1020 -       fi
1021 -       done
1022 -       AC_SUBST(vi_cv_perl_xsubpp)
1023 -       dnl Remove "-fno-something", it breaks using cproto.
1024 -       dnl Remove "-fdebug-prefix-map", it isn't supported by clang.
1025 -       perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \
1026 -             -e 'ccflags;perl_inc;print"\n"' | sed -e 's/-fno[[^ ]]*//' \
1027 -                       -e 's/-fdebug-prefix-map[[^ ]]*//g'`
1028 -       dnl Remove "-lc", it breaks on FreeBSD when using "-pthread".
1029 -       perllibs=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed -e 'ldopts' | \
1030 -               sed -e '/Warning/d' -e '/Note (probably harmless)/d' \
1031 -                       -e 's/-bE:perl.exp//' -e 's/-lc //'`
1032 -       dnl Don't add perl lib to $LIBS: if it's not in LD_LIBRARY_PATH
1033 -       dnl a test in configure may fail because of that.
1034 -       perlldflags=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed \
1035 -               -e 'ccdlflags' | sed -e 's/-bE:perl.exp//'`
1037 -       dnl check that compiling a simple program still works with the flags
1038 -       dnl added for Perl.
1039 -       AC_MSG_CHECKING([if compile and link flags for Perl are sane])
1040 -       cflags_save=$CFLAGS
1041 -       libs_save=$LIBS
1042 -       ldflags_save=$LDFLAGS
1043 -       CFLAGS="$CFLAGS $perlcppflags"
1044 -       LIBS="$LIBS $perllibs"
1045 -       perlldflags=`echo "$perlldflags" | sed -e 's/^ *//g'`
1046 -       LDFLAGS="$perlldflags $LDFLAGS"
1047 -       AC_TRY_LINK(,[ ],
1048 -            AC_MSG_RESULT(yes); perl_ok=yes,
1049 -            AC_MSG_RESULT(no: PERL DISABLED); perl_ok=no)
1050 -       CFLAGS=$cflags_save
1051 -       LIBS=$libs_save
1052 -       LDFLAGS=$ldflags_save
1053 -       if test $perl_ok = yes; then
1054 -       if test "X$perlcppflags" != "X"; then
1055 -         dnl remove -pipe and -Wxxx, it confuses cproto
1056 -         PERL_CFLAGS=`echo "$perlcppflags" | sed -e 's/-pipe //' -e 's/-W[[^ ]]*//'`
1057 -       fi
1058 -       if test "X$perlldflags" != "X"; then
1059 -         if test "X`echo \"$LDFLAGS\" | $FGREP -e \"$perlldflags\"`" = "X"; then
1060 -           LDFLAGS="$perlldflags $LDFLAGS"
1061 -         fi
1062 -       fi
1063 -       PERL_LIBS=$perllibs
1064 -       PERL_SRC="auto/if_perl.c if_perlsfio.c"
1065 -       PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o"
1066 -       PERL_PRO="if_perl.pro if_perlsfio.pro"
1067 -       AC_DEFINE(FEAT_PERL)
1068 -       fi
1069 -      fi
1070 -     else
1071 -       AC_MSG_RESULT(>>> too old; need Perl version 5.003_01 or later <<<)
1072 -     fi
1073 -   fi
1075 -   if test "x$MACOSX" = "xyes"; then
1076 -     dnl Mac OS X 10.2 or later
1077 -     dir=/System/Library/Perl
1078 -     darwindir=$dir/darwin
1079 -     if test -d $darwindir; then
1080 -       PERL=/usr/bin/perl
1081 -     else
1082 -       dnl Mac OS X 10.3
1083 -       dir=/System/Library/Perl/5.8.1
1084 -       darwindir=$dir/darwin-thread-multi-2level
1085 -       if test -d $darwindir; then
1086 -       PERL=/usr/bin/perl
1087 -       fi
1088 -     fi
1089 -     if test -n "$PERL"; then
1090 -       PERL_DIR="$dir"
1091 -       PERL_CFLAGS="-DFEAT_PERL -I$darwindir/CORE"
1092 -       PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o $darwindir/auto/DynaLoader/DynaLoader.a"
1093 -       PERL_LIBS="-L$darwindir/CORE -lperl"
1094 -     fi
1095 -     dnl Perl on Mac OS X 10.5 adds "-arch" flags but these should only
1096 -     dnl be included if requested by passing --with-mac-arch to
1097 -     dnl configure, so strip these flags first (if present)
1098 -     PERL_LIBS=`echo "$PERL_LIBS" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'`
1099 -     PERL_CFLAGS=`echo "$PERL_CFLAGS" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'`
1100 -   fi
1101 -   if test "$enable_perlinterp" = "dynamic"; then
1102 -     if test "$perl_ok" = "yes" -a "X$libperl" != "X"; then
1103 -       AC_DEFINE(DYNAMIC_PERL)
1104 -       PERL_CFLAGS="-DDYNAMIC_PERL_DLL=\\\"$libperl\\\" $PERL_CFLAGS"
1105 -     fi
1106 -   fi
1108 -   if test "$fail_if_missing" = "yes" -a "$perl_ok" != "yes"; then
1109 -     AC_MSG_ERROR([could not configure perl])
1110 -   fi
1111 - fi
1112 - AC_SUBST(shrpenv)
1113 - AC_SUBST(PERL_SRC)
1114 - AC_SUBST(PERL_OBJ)
1115 - AC_SUBST(PERL_PRO)
1116 - AC_SUBST(PERL_CFLAGS)
1117 - AC_SUBST(PERL_LIBS)
1119 - AC_MSG_CHECKING(--enable-pythoninterp argument)
1120 - AC_ARG_ENABLE(pythoninterp,
1121 -       [  --enable-pythoninterp[=OPTS]   Include Python interpreter. [default=no] [OPTS=no/yes/dynamic]], ,
1122 -       [enable_pythoninterp="no"])
1123 - AC_MSG_RESULT($enable_pythoninterp)
1124 - if test "$enable_pythoninterp" = "yes" -o "$enable_pythoninterp" = "dynamic"; then
1125 -   if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
1126 -     AC_MSG_ERROR([cannot use Python with tiny or small features])
1127 -   fi
1129 -   dnl -- find the python executable
1130 -   AC_PATH_PROGS(vi_cv_path_python, python2 python)
1131 -   if test "X$vi_cv_path_python" != "X"; then
1133 -     dnl -- get its version number
1134 -     AC_CACHE_CHECK(Python version,vi_cv_var_python_version,
1135 -     [[vi_cv_var_python_version=`
1136 -           ${vi_cv_path_python} -c 'import sys; print sys.version[:3]'`
1137 -     ]])
1139 -     dnl -- it must be at least version 2.3
1140 -     AC_MSG_CHECKING(Python is 2.3 or better)
1141 -     if ${vi_cv_path_python} -c \
1142 -       "import sys; sys.exit(${vi_cv_var_python_version} < 2.3)"
1143 -     then
1144 -       AC_MSG_RESULT(yep)
1146 -       dnl -- find where python thinks it was installed
1147 -       AC_CACHE_CHECK(Python's install prefix,vi_cv_path_python_pfx,
1148 -       [ vi_cv_path_python_pfx=`
1149 -           ${vi_cv_path_python} -c \
1150 -               "import sys; print sys.prefix"` ])
1152 -       dnl -- and where it thinks it runs
1153 -       AC_CACHE_CHECK(Python's execution prefix,vi_cv_path_python_epfx,
1154 -       [ vi_cv_path_python_epfx=`
1155 -           ${vi_cv_path_python} -c \
1156 -               "import sys; print sys.exec_prefix"` ])
1158 -       dnl -- python's internal library path
1160 -       AC_CACHE_VAL(vi_cv_path_pythonpath,
1161 -       [ vi_cv_path_pythonpath=`
1162 -           unset PYTHONPATH;
1163 -           ${vi_cv_path_python} -c \
1164 -               "import sys, string; print string.join(sys.path,':')"` ])
1166 -       dnl -- where the Python implementation library archives are
1168 -       AC_ARG_WITH(python-config-dir,
1169 -       [  --with-python-config-dir=PATH  Python's config directory],
1170 -       [ vi_cv_path_python_conf="${withval}" ] )
1172 -       AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python_conf,
1173 -       [
1174 -       vi_cv_path_python_conf=
1175 -       d=`${vi_cv_path_python} -c "import distutils.sysconfig; print distutils.sysconfig.get_config_var('LIBPL')"`
1176 -       if test -d "$d" && test -f "$d/config.c"; then
1177 -         vi_cv_path_python_conf="$d"
1178 -       else
1179 -         for path in "${vi_cv_path_python_pfx}" "${vi_cv_path_python_epfx}"; do
1180 -           for subdir in lib64 lib share; do
1181 -             d="${path}/${subdir}/python${vi_cv_var_python_version}/config"
1182 -             if test -d "$d" && test -f "$d/config.c"; then
1183 -               vi_cv_path_python_conf="$d"
1184 -             fi
1185 -           done
1186 -         done
1187 -       fi
1188 -       ])
1190 -       PYTHON_CONFDIR="${vi_cv_path_python_conf}"
1192 -       if test "X$PYTHON_CONFDIR" = "X"; then
1193 -       AC_MSG_RESULT([can't find it!])
1194 -       else
1196 -       dnl -- we need to examine Python's config/Makefile too
1197 -       dnl    see what the interpreter is built from
1198 -       AC_CACHE_VAL(vi_cv_path_python_plibs,
1199 -       [
1200 -           pwd=`pwd`
1201 -           tmp_mkf="$pwd/config-PyMake$$"
1202 -           cat -- "${PYTHON_CONFDIR}/Makefile" - <<'eof' >"${tmp_mkf}"
1203 - __:
1204 -       @echo "python_BASEMODLIBS='$(BASEMODLIBS)'"
1205 -       @echo "python_LIBS='$(LIBS)'"
1206 -       @echo "python_SYSLIBS='$(SYSLIBS)'"
1207 -       @echo "python_LINKFORSHARED='$(LINKFORSHARED)'"
1208 -       @echo "python_DLLLIBRARY='$(DLLLIBRARY)'"
1209 -       @echo "python_INSTSONAME='$(INSTSONAME)'"
1210 -       @echo "python_PYTHONFRAMEWORK='$(PYTHONFRAMEWORK)'"
1211 -       @echo "python_PYTHONFRAMEWORKPREFIX='$(PYTHONFRAMEWORKPREFIX)'"
1212 -       @echo "python_PYTHONFRAMEWORKINSTALLDIR='$(PYTHONFRAMEWORKINSTALLDIR)'"
1213 - eof
1214 -           dnl -- delete the lines from make about Entering/Leaving directory
1215 -           eval "`cd ${PYTHON_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`"
1216 -           rm -f -- "${tmp_mkf}"
1217 -           if test "x$MACOSX" = "xyes" && test -n "${python_PYTHONFRAMEWORK}" && ${vi_cv_path_python} -c \
1218 -               "import sys; sys.exit(${vi_cv_var_python_version} < 2.3)"; then
1219 -             vi_cv_path_python_plibs="-framework Python"
1220 -             if test "x${vi_cv_path_python}" != "x/usr/bin/python" && test -n "${python_PYTHONFRAMEWORKPREFIX}"; then
1221 -                 vi_cv_path_python_plibs="-F${python_PYTHONFRAMEWORKPREFIX} -framework Python"
1222 -             fi
1223 -           else
1224 -             if test "${vi_cv_var_python_version}" = "1.4"; then
1225 -                 vi_cv_path_python_plibs="${PYTHON_CONFDIR}/libModules.a ${PYTHON_CONFDIR}/libPython.a ${PYTHON_CONFDIR}/libObjects.a ${PYTHON_CONFDIR}/libParser.a"
1226 -             else
1227 -                 vi_cv_path_python_plibs="-L${PYTHON_CONFDIR} -lpython${vi_cv_var_python_version}"
1228 -             fi
1229 -             dnl -- Check if the path contained in python_LINKFORSHARED is
1230 -             dnl    usable for vim build. If not, make and try other
1231 -             dnl    candidates.
1232 -             if test -n "${python_LINKFORSHARED}" && test -n "${python_PYTHONFRAMEWORKPREFIX}"; then
1233 -               python_link_symbol=`echo ${python_LINKFORSHARED} | sed 's/\([[^ \t]][[^ \t]]*[[ \t]][[ \t]]*[[^ \t]][[^ \t]]*\)[[ \t]].*/\1/'`
1234 -               python_link_path=`echo ${python_LINKFORSHARED} |   sed 's/\([[^ \t]][[^ \t]]*[[ \t]][[ \t]]*[[^ \t]][[^ \t]]*\)[[ \t]][[ \t]]*\(.*\)/\2/'`
1235 -               if test -n "${python_link_path}" && ! test -x "${python_link_path}"; then
1236 -                 dnl -- The path looks relative. Guess the absolute one using
1237 -                 dnl    the prefix and try that.
1238 -                 python_link_path="${python_PYTHONFRAMEWORKPREFIX}/${python_link_path}"
1239 -                 if test -n "${python_link_path}" && ! test -x "${python_link_path}"; then
1240 -                   dnl -- A last resort.
1241 -                   python_link_path="${python_PYTHONFRAMEWORKINSTALLDIR}/Versions/${vi_cv_var_python_version}/${python_PYTHONFRAMEWORK}"
1242 -                   dnl -- No check is done. The last word is left to the
1243 -                   dnl    "sanity" test on link flags that follows shortly.
1244 -                 fi
1245 -                 python_LINKFORSHARED="${python_link_symbol} ${python_link_path}"
1246 -               fi
1247 -             fi
1248 -             vi_cv_path_python_plibs="${vi_cv_path_python_plibs} ${python_BASEMODLIBS} ${python_LIBS} ${python_SYSLIBS} ${python_LINKFORSHARED}"
1249 -             dnl remove -ltermcap, it can conflict with an earlier -lncurses
1250 -             vi_cv_path_python_plibs=`echo $vi_cv_path_python_plibs | sed s/-ltermcap//`
1251 -           fi
1252 -       ])
1253 -       AC_CACHE_CHECK(Python's dll name,vi_cv_dll_name_python,
1254 -       [
1255 -         if test "X$python_DLLLIBRARY" != "X"; then
1256 -           vi_cv_dll_name_python="$python_DLLLIBRARY"
1257 -         else
1258 -           vi_cv_dll_name_python="$python_INSTSONAME"
1259 -         fi
1260 -       ])
1262 -       PYTHON_LIBS="${vi_cv_path_python_plibs}"
1263 -       if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then
1264 -         PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -DPYTHON_HOME='\"${vi_cv_path_python_pfx}\"'"
1265 -       else
1266 -         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} -DPYTHON_HOME='\"${vi_cv_path_python_pfx}\"'"
1267 -       fi
1268 -       PYTHON_SRC="if_python.c"
1269 -       PYTHON_OBJ="objects/if_python.o"
1270 -       if test "${vi_cv_var_python_version}" = "1.4"; then
1271 -          PYTHON_OBJ="$PYTHON_OBJ objects/py_getpath.o"
1272 -       fi
1273 -     PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'"
1275 -       dnl On FreeBSD linking with "-pthread" is required to use threads.
1276 -       dnl _THREAD_SAFE must be used for compiling then.
1277 -       dnl The "-pthread" is added to $LIBS, so that the following check for
1278 -       dnl sigaltstack() will look in libc_r (it's there in libc!).
1279 -       dnl Otherwise, when using GCC, try adding -pthread to $CFLAGS.  GCC
1280 -       dnl will then define target-specific defines, e.g., -D_REENTRANT.
1281 -       dnl Don't do this for Mac OSX, -pthread will generate a warning.
1282 -       AC_MSG_CHECKING([if -pthread should be used])
1283 -       threadsafe_flag=
1284 -       thread_lib=
1285 -       dnl if test "x$MACOSX" != "xyes"; then
1286 -         if test "`(uname) 2>/dev/null`" != Darwin; then
1287 -         test "$GCC" = yes && threadsafe_flag="-pthread"
1288 -         if test "`(uname) 2>/dev/null`" = FreeBSD; then
1289 -           threadsafe_flag="-D_THREAD_SAFE"
1290 -           thread_lib="-pthread"
1291 -         fi
1292 -         if test "`(uname) 2>/dev/null`" = SunOS; then
1293 -           threadsafe_flag="-pthreads"
1294 -         fi
1295 -       fi
1296 -       libs_save_old=$LIBS
1297 -       if test -n "$threadsafe_flag"; then
1298 -         cflags_save=$CFLAGS
1299 -         CFLAGS="$CFLAGS $threadsafe_flag"
1300 -         LIBS="$LIBS $thread_lib"
1301 -         AC_TRY_LINK(,[ ],
1302 -            AC_MSG_RESULT(yes); PYTHON_CFLAGS="$PYTHON_CFLAGS $threadsafe_flag",
1303 -            AC_MSG_RESULT(no); LIBS=$libs_save_old
1304 -            )
1305 -         CFLAGS=$cflags_save
1306 -       else
1307 -         AC_MSG_RESULT(no)
1308 -       fi
1310 -       dnl Check that compiling a simple program still works with the flags
1311 -       dnl added for Python.
1312 -       AC_MSG_CHECKING([if compile and link flags for Python are sane])
1313 -       cflags_save=$CFLAGS
1314 -       libs_save=$LIBS
1315 -       CFLAGS="$CFLAGS $PYTHON_CFLAGS"
1316 -       LIBS="$LIBS $PYTHON_LIBS"
1317 -       AC_TRY_LINK(,[ ],
1318 -              AC_MSG_RESULT(yes); python_ok=yes,
1319 -              AC_MSG_RESULT(no: PYTHON DISABLED); python_ok=no)
1320 -       CFLAGS=$cflags_save
1321 -       LIBS=$libs_save
1322 -       if test $python_ok = yes; then
1323 -         AC_DEFINE(FEAT_PYTHON)
1324 -       else
1325 -         LIBS=$libs_save_old
1326 -         PYTHON_SRC=
1327 -         PYTHON_OBJ=
1328 -         PYTHON_LIBS=
1329 -         PYTHON_CFLAGS=
1330 -       fi
1331 -       fi
1332 -     else
1333 -       AC_MSG_RESULT(too old)
1334 -     fi
1335 -   fi
1337 -   if test "$fail_if_missing" = "yes" -a "$python_ok" != "yes"; then
1338 -     AC_MSG_ERROR([could not configure python])
1339 -   fi
1340 - fi
1342 - AC_SUBST(PYTHON_CONFDIR)
1343 - AC_SUBST(PYTHON_LIBS)
1344 - AC_SUBST(PYTHON_GETPATH_CFLAGS)
1345 - AC_SUBST(PYTHON_CFLAGS)
1346 - AC_SUBST(PYTHON_SRC)
1347 - AC_SUBST(PYTHON_OBJ)
1350 - AC_MSG_CHECKING(--enable-python3interp argument)
1351 - AC_ARG_ENABLE(python3interp,
1352 -       [  --enable-python3interp[=OPTS]   Include Python3 interpreter. [default=no] [OPTS=no/yes/dynamic]], ,
1353 -       [enable_python3interp="no"])
1354 - AC_MSG_RESULT($enable_python3interp)
1355 - if test "$enable_python3interp" = "yes" -o "$enable_python3interp" = "dynamic"; then
1356 -   if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
1357 -     AC_MSG_ERROR([cannot use Python with tiny or small features])
1358 -   fi
1360 -   dnl -- find the python3 executable
1361 -   AC_PATH_PROGS(vi_cv_path_python3, python3 python)
1362 -   if test "X$vi_cv_path_python3" != "X"; then
1364 -     dnl -- get its version number
1365 -     AC_CACHE_CHECK(Python version,vi_cv_var_python3_version,
1366 -     [[vi_cv_var_python3_version=`
1367 -           ${vi_cv_path_python3} -c 'import sys; print(sys.version[:3])'`
1368 -     ]])
1370 -     dnl -- it must be at least version 3
1371 -     AC_MSG_CHECKING(Python is 3.0 or better)
1372 -     if ${vi_cv_path_python3} -c \
1373 -       "import sys; sys.exit(${vi_cv_var_python3_version} < 3.0)"
1374 -     then
1375 -       AC_MSG_RESULT(yep)
1377 -       dnl -- get abiflags for python 3.2 or higher (PEP 3149)
1378 -       AC_CACHE_CHECK(Python's abiflags,vi_cv_var_python3_abiflags,
1379 -       [
1380 -        vi_cv_var_python3_abiflags=
1381 -        if ${vi_cv_path_python3} -c \
1382 -            "import sys; sys.exit(${vi_cv_var_python3_version} < 3.2)"
1383 -        then
1384 -          vi_cv_var_python3_abiflags=`${vi_cv_path_python3} -c \    
1385 -            "import sys; print(sys.abiflags)"`
1386 -        fi ])
1387 -   
1388 -       dnl -- find where python3 thinks it was installed
1389 -       AC_CACHE_CHECK(Python's install prefix,vi_cv_path_python3_pfx,
1390 -       [ vi_cv_path_python3_pfx=`
1391 -        ${vi_cv_path_python3} -c \
1392 -        "import sys; print(sys.prefix)"` ])
1393 -   
1394 -       dnl -- and where it thinks it runs
1395 -       AC_CACHE_CHECK(Python's execution prefix,vi_cv_path_python3_epfx,
1396 -       [ vi_cv_path_python3_epfx=`
1397 -        ${vi_cv_path_python3} -c \
1398 -        "import sys; print(sys.exec_prefix)"` ])
1399 -   
1400 -       dnl -- python3's internal library path
1401 -   
1402 -       AC_CACHE_VAL(vi_cv_path_python3path,
1403 -       [ vi_cv_path_python3path=`
1404 -        unset PYTHONPATH;
1405 -        ${vi_cv_path_python3} -c \
1406 -        "import sys, string; print(':'.join(sys.path))"` ])
1407 -   
1408 -       dnl -- where the Python implementation library archives are
1409 -   
1410 -       AC_ARG_WITH(python3-config-dir,
1411 -        [  --with-python3-config-dir=PATH  Python's config directory],
1412 -        [ vi_cv_path_python3_conf="${withval}" ] )
1413 -   
1414 -       AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python3_conf,
1415 -       [
1416 -        vi_cv_path_python3_conf=
1417 -        config_dir="config-${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags}"
1418 -        d=`${vi_cv_path_python3} -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBPL'))"`
1419 -        if test -d "$d" && test -f "$d/config.c"; then
1420 -          vi_cv_path_python3_conf="$d"
1421 -        else
1422 -          for path in "${vi_cv_path_python3_pfx}" "${vi_cv_path_python3_epfx}"; do
1423 -          for subdir in lib64 lib share; do
1424 -            d="${path}/${subdir}/python${vi_cv_var_python3_version}/${config_dir}"
1425 -            if test -d "$d" && test -f "$d/config.c"; then
1426 -              vi_cv_path_python3_conf="$d"
1427 -            fi
1428 -          done
1429 -          done
1430 -        fi
1431 -       ])
1432 -   
1433 -       PYTHON3_CONFDIR="${vi_cv_path_python3_conf}"
1434 -   
1435 -       if test "X$PYTHON3_CONFDIR" = "X"; then
1436 -         AC_MSG_RESULT([can't find it!])
1437 -       else
1438 -   
1439 -         dnl -- we need to examine Python's config/Makefile too
1440 -         dnl    see what the interpreter is built from
1441 -         AC_CACHE_VAL(vi_cv_path_python3_plibs,
1442 -         [
1443 -             pwd=`pwd`
1444 -             tmp_mkf="$pwd/config-PyMake$$"
1445 -             cat -- "${PYTHON3_CONFDIR}/Makefile" - <<'eof' >"${tmp_mkf}"
1446 - __:
1447 -       @echo "python3_BASEMODLIBS='$(BASEMODLIBS)'"
1448 -       @echo "python3_LIBS='$(LIBS)'"
1449 -       @echo "python3_SYSLIBS='$(SYSLIBS)'"
1450 -       @echo "python3_DLLLIBRARY='$(DLLLIBRARY)'"
1451 -       @echo "python3_INSTSONAME='$(INSTSONAME)'"
1452 - eof
1453 -           dnl -- delete the lines from make about Entering/Leaving directory
1454 -           eval "`cd ${PYTHON3_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`"
1455 -           rm -f -- "${tmp_mkf}"
1456 -           vi_cv_path_python3_plibs="-L${PYTHON3_CONFDIR} -lpython${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags}"
1457 -           vi_cv_path_python3_plibs="${vi_cv_path_python3_plibs} ${python3_BASEMODLIBS} ${python3_LIBS} ${python3_SYSLIBS}"
1458 -           dnl remove -ltermcap, it can conflict with an earlier -lncurses
1459 -           vi_cv_path_python3_plibs=`echo $vi_cv_path_python3_plibs | sed s/-ltermcap//`
1460 -           vi_cv_path_python3_plibs=`echo $vi_cv_path_python3_plibs | sed s/-lffi//`
1461 -       ])
1462 -       AC_CACHE_CHECK(Python3's dll name,vi_cv_dll_name_python3,
1463 -       [
1464 -         if test "X$python3_DLLLIBRARY" != "X"; then
1465 -           vi_cv_dll_name_python3="$python3_DLLLIBRARY"
1466 -         else
1467 -           vi_cv_dll_name_python3="$python3_INSTSONAME"
1468 -         fi
1469 -       ])
1471 -         PYTHON3_LIBS="${vi_cv_path_python3_plibs}"
1472 -         if test "${vi_cv_path_python3_pfx}" = "${vi_cv_path_python3_epfx}"; then
1473 -           PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags} -DPYTHON3_HOME='L\"${vi_cv_path_python3_pfx}\"'"
1474 -         else
1475 -           PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags} -I${vi_cv_path_python3_epfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags} -DPYTHON3_HOME='L\"${vi_cv_path_python3_pfx}\"'"
1476 -         fi
1477 -         PYTHON3_SRC="if_python3.c"
1478 -         PYTHON3_OBJ="objects/if_python3.o"
1479 -   
1480 -         dnl On FreeBSD linking with "-pthread" is required to use threads.
1481 -         dnl _THREAD_SAFE must be used for compiling then.
1482 -         dnl The "-pthread" is added to $LIBS, so that the following check for
1483 -         dnl sigaltstack() will look in libc_r (it's there in libc!).
1484 -         dnl Otherwise, when using GCC, try adding -pthread to $CFLAGS.  GCC
1485 -         dnl will then define target-specific defines, e.g., -D_REENTRANT.
1486 -         dnl Don't do this for Mac OSX, -pthread will generate a warning.
1487 -         AC_MSG_CHECKING([if -pthread should be used])
1488 -         threadsafe_flag=
1489 -         thread_lib=
1490 -         dnl if test "x$MACOSX" != "xyes"; then
1491 -         if test "`(uname) 2>/dev/null`" != Darwin; then
1492 -           test "$GCC" = yes && threadsafe_flag="-pthread"
1493 -           if test "`(uname) 2>/dev/null`" = FreeBSD; then
1494 -             threadsafe_flag="-D_THREAD_SAFE"
1495 -             thread_lib="-pthread"
1496 -           fi
1497 -           if test "`(uname) 2>/dev/null`" = SunOS; then
1498 -             threadsafe_flag="-pthreads"
1499 -           fi
1500 -         fi
1501 -         libs_save_old=$LIBS
1502 -         if test -n "$threadsafe_flag"; then
1503 -           cflags_save=$CFLAGS
1504 -           CFLAGS="$CFLAGS $threadsafe_flag"
1505 -           LIBS="$LIBS $thread_lib"
1506 -           AC_TRY_LINK(,[ ],
1507 -              AC_MSG_RESULT(yes); PYTHON3_CFLAGS="$PYTHON3_CFLAGS $threadsafe_flag",
1508 -              AC_MSG_RESULT(no); LIBS=$libs_save_old
1509 -              )
1510 -           CFLAGS=$cflags_save
1511 -         else
1512 -           AC_MSG_RESULT(no)
1513 -         fi
1514 -   
1515 -         dnl check that compiling a simple program still works with the flags
1516 -         dnl added for Python.
1517 -         AC_MSG_CHECKING([if compile and link flags for Python 3 are sane])
1518 -         cflags_save=$CFLAGS
1519 -         libs_save=$LIBS
1520 -         CFLAGS="$CFLAGS $PYTHON3_CFLAGS"
1521 -         LIBS="$LIBS $PYTHON3_LIBS"
1522 -         AC_TRY_LINK(,[ ],
1523 -                AC_MSG_RESULT(yes); python3_ok=yes,
1524 -                AC_MSG_RESULT(no: PYTHON3 DISABLED); python3_ok=no)
1525 -         CFLAGS=$cflags_save
1526 -         LIBS=$libs_save
1527 -         if test "$python3_ok" = yes; then
1528 -           AC_DEFINE(FEAT_PYTHON3)
1529 -         else
1530 -           LIBS=$libs_save_old
1531 -           PYTHON3_SRC=
1532 -           PYTHON3_OBJ=
1533 -           PYTHON3_LIBS=
1534 -           PYTHON3_CFLAGS=
1535 -         fi
1536 -       fi
1537 -     else
1538 -       AC_MSG_RESULT(too old)
1539 -     fi
1540 -   fi
1541 -   if test "$fail_if_missing" = "yes" -a "$python3_ok" != "yes"; then
1542 -     AC_MSG_ERROR([could not configure python3])
1543 -   fi
1544 - fi
1546 - AC_SUBST(PYTHON3_CONFDIR)
1547 - AC_SUBST(PYTHON3_LIBS)
1548 - AC_SUBST(PYTHON3_CFLAGS)
1549 - AC_SUBST(PYTHON3_SRC)
1550 - AC_SUBST(PYTHON3_OBJ)
1552 - dnl if python2.x and python3.x are enabled one can only link in code
1553 - dnl with dlopen(), dlsym(), dlclose() 
1554 - if test "$python_ok" = yes && test "$python3_ok" = yes; then
1555 -   AC_DEFINE(DYNAMIC_PYTHON)
1556 -   AC_DEFINE(DYNAMIC_PYTHON3)
1557 -   AC_MSG_CHECKING(whether we can do without RTLD_GLOBAL for Python)
1558 -   cflags_save=$CFLAGS
1559 -   CFLAGS="$CFLAGS $PYTHON_CFLAGS"
1560 -   libs_save=$LIBS
1561 -   dnl -ldl must go first to make this work on Archlinux (Roland Puntaier)
1562 -   LIBS="-ldl $LIBS"
1563 -   AC_RUN_IFELSE([AC_LANG_SOURCE([
1564 -     #include <dlfcn.h>
1565 -     /* If this program fails, then RTLD_GLOBAL is needed.
1566 -      * RTLD_GLOBAL will be used and then it is not possible to
1567 -      * have both python versions enabled in the same vim instance.
1568 -      * Only the first python version used will be switched on.
1569 -      */
1571 -     int no_rtl_global_needed_for(char *python_instsoname, char *prefix)
1572 -     {
1573 -       int needed = 0;
1574 -       void* pylib = dlopen(python_instsoname, RTLD_LAZY|RTLD_LOCAL);
1575 -       if (pylib != 0)
1576 -       {
1577 -           void (*pfx)(char *home) = dlsym(pylib, "Py_SetPythonHome");
1578 -           void (*init)(void) = dlsym(pylib, "Py_Initialize");
1579 -           int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString");
1580 -           void (*final)(void) = dlsym(pylib, "Py_Finalize");
1581 -           (*pfx)(prefix);
1582 -           (*init)();
1583 -           needed = (*simple)("import termios") == -1;
1584 -           (*final)();
1585 -           dlclose(pylib);
1586 -       }
1587 -       return !needed;
1588 -     }
1590 -     int main(int argc, char** argv)
1591 -     {
1592 -       int not_needed = 0;
1593 -       if (no_rtl_global_needed_for("${vi_cv_dll_name_python}", "${vi_cv_path_python_pfx}"))
1594 -             not_needed = 1;
1595 -       return !not_needed;
1596 -     }])],
1597 -     [AC_MSG_RESULT(yes);AC_DEFINE(PY_NO_RTLD_GLOBAL)], [AC_MSG_RESULT(no)])
1599 -   CFLAGS=$cflags_save
1600 -   LIBS=$libs_save
1602 -   AC_MSG_CHECKING(whether we can do without RTLD_GLOBAL for Python3)
1603 -   cflags_save=$CFLAGS
1604 -   CFLAGS="$CFLAGS $PYTHON3_CFLAGS"
1605 -   libs_save=$LIBS
1606 -   dnl -ldl must go first to make this work on Archlinux (Roland Puntaier)
1607 -   LIBS="-ldl $LIBS"
1608 -   AC_RUN_IFELSE([AC_LANG_SOURCE([
1609 -     #include <dlfcn.h>
1610 -     #include <wchar.h>
1611 -     /* If this program fails, then RTLD_GLOBAL is needed.
1612 -      * RTLD_GLOBAL will be used and then it is not possible to
1613 -      * have both python versions enabled in the same vim instance.
1614 -      * Only the first python version used will be switched on.
1615 -      */
1617 -     int no_rtl_global_needed_for(char *python_instsoname, wchar_t *prefix)
1618 -     {
1619 -       int needed = 0;
1620 -       void* pylib = dlopen(python_instsoname, RTLD_LAZY|RTLD_LOCAL);
1621 -       if (pylib != 0)
1622 -       {
1623 -           void (*pfx)(wchar_t *home) = dlsym(pylib, "Py_SetPythonHome");
1624 -           void (*init)(void) = dlsym(pylib, "Py_Initialize");
1625 -           int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString");
1626 -           void (*final)(void) = dlsym(pylib, "Py_Finalize");
1627 -           (*pfx)(prefix);
1628 -           (*init)();
1629 -           needed = (*simple)("import termios") == -1;
1630 -           (*final)();
1631 -           dlclose(pylib);
1632 -       }
1633 -       return !needed;
1634 -     }
1636 -     int main(int argc, char** argv)
1637 -     {
1638 -       int not_needed = 0;
1639 -       if (no_rtl_global_needed_for("${vi_cv_dll_name_python3}", L"${vi_cv_path_python3_pfx}"))
1640 -             not_needed = 1;
1641 -       return !not_needed;
1642 -     }])],
1643 -     [AC_MSG_RESULT(yes);AC_DEFINE(PY3_NO_RTLD_GLOBAL)], [AC_MSG_RESULT(no)])
1645 -   CFLAGS=$cflags_save
1646 -   LIBS=$libs_save
1648 -   PYTHON_SRC="if_python.c"
1649 -   PYTHON_OBJ="objects/if_python.o"
1650 -   PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"${vi_cv_dll_name_python}\\\""
1651 -   PYTHON_LIBS=
1652 -   PYTHON3_SRC="if_python3.c"
1653 -   PYTHON3_OBJ="objects/if_python3.o"
1654 -   PYTHON3_CFLAGS="$PYTHON3_CFLAGS -DDYNAMIC_PYTHON3_DLL=\\\"${vi_cv_dll_name_python3}\\\""
1655 -   PYTHON3_LIBS=
1656 - elif test "$python_ok" = yes && test "$enable_pythoninterp" = "dynamic"; then
1657 -   AC_DEFINE(DYNAMIC_PYTHON)
1658 -   PYTHON_SRC="if_python.c"
1659 -   PYTHON_OBJ="objects/if_python.o"
1660 -   PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"${vi_cv_dll_name_python}\\\""
1661 -   PYTHON_LIBS=
1662 - elif test "$python_ok" = yes; then
1663 -   dnl Check that adding -fPIE works.  It may be needed when using a static
1664 -   dnl Python library.
1665 -   AC_MSG_CHECKING([if -fPIE can be added for Python])
1666 -   cflags_save=$CFLAGS
1667 -   libs_save=$LIBS
1668 -   CFLAGS="$CFLAGS $PYTHON_CFLAGS -fPIE"
1669 -   LIBS="$LIBS $PYTHON_LIBS"
1670 -   AC_TRY_LINK(,[ ],
1671 -        AC_MSG_RESULT(yes); fpie_ok=yes,
1672 -        AC_MSG_RESULT(no); fpie_ok=no)
1673 -   CFLAGS=$cflags_save
1674 -   LIBS=$libs_save
1675 -   if test $fpie_ok = yes; then
1676 -     PYTHON_CFLAGS="$PYTHON_CFLAGS -fPIE"
1677 -   fi
1678 - elif test "$python3_ok" = yes && test "$enable_python3interp" = "dynamic"; then
1679 -   AC_DEFINE(DYNAMIC_PYTHON3)
1680 -   PYTHON3_SRC="if_python3.c"
1681 -   PYTHON3_OBJ="objects/if_python3.o"
1682 -   PYTHON3_CFLAGS="$PYTHON3_CFLAGS -DDYNAMIC_PYTHON3_DLL=\\\"${vi_cv_dll_name_python3}\\\""
1683 -   PYTHON3_LIBS=
1684 - elif test "$python3_ok" = yes; then
1685 -   dnl Check that adding -fPIE works.  It may be needed when using a static
1686 -   dnl Python library.
1687 -   AC_MSG_CHECKING([if -fPIE can be added for Python3])
1688 -   cflags_save=$CFLAGS
1689 -   libs_save=$LIBS
1690 -   CFLAGS="$CFLAGS $PYTHON3_CFLAGS -fPIE"
1691 -   LIBS="$LIBS $PYTHON3_LIBS"
1692 -   AC_TRY_LINK(,[ ],
1693 -        AC_MSG_RESULT(yes); fpie_ok=yes,
1694 -        AC_MSG_RESULT(no); fpie_ok=no)
1695 -   CFLAGS=$cflags_save
1696 -   LIBS=$libs_save
1697 -   if test $fpie_ok = yes; then
1698 -     PYTHON3_CFLAGS="$PYTHON3_CFLAGS -fPIE"
1699 -   fi
1700 - fi
1702 - AC_MSG_CHECKING(--enable-tclinterp argument)
1703 - AC_ARG_ENABLE(tclinterp,
1704 -       [  --enable-tclinterp[=OPTS]      Include Tcl interpreter. [default=no] [OPTS=no/yes/dynamic]], ,
1705 -       [enable_tclinterp="no"])
1706 - AC_MSG_RESULT($enable_tclinterp)
1708 - if test "$enable_tclinterp" = "yes" -o "$enable_tclinterp" = "dynamic"; then
1710 -   dnl on FreeBSD tclsh is a silly script, look for tclsh8.[5420]
1711 -   AC_MSG_CHECKING(--with-tclsh argument)
1712 -   AC_ARG_WITH(tclsh, [  --with-tclsh=PATH       which tclsh to use (default: tclsh8.0)],
1713 -       tclsh_name="$withval"; AC_MSG_RESULT($tclsh_name),
1714 -       tclsh_name="tclsh8.5"; AC_MSG_RESULT(no))
1715 -   AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1716 -   AC_SUBST(vi_cv_path_tcl)
1718 -   dnl when no specific version specified, also try 8.4, 8.2 and 8.0
1719 -   if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.5"; then
1720 -     tclsh_name="tclsh8.4"
1721 -     AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1722 -   fi
1723 -   if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.4"; then
1724 -     tclsh_name="tclsh8.2"
1725 -     AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1726 -   fi
1727 -   if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.2"; then
1728 -     tclsh_name="tclsh8.0"
1729 -     AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1730 -   fi
1731 -   dnl still didn't find it, try without version number
1732 -   if test "X$vi_cv_path_tcl" = "X"; then
1733 -     tclsh_name="tclsh"
1734 -     AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
1735 -   fi
1736 -   if test "X$vi_cv_path_tcl" != "X"; then
1737 -     AC_MSG_CHECKING(Tcl version)
1738 -     if echo 'exit [[expr [info tclversion] < 8.0]]' | "$vi_cv_path_tcl" - ; then
1739 -       tclver=`echo 'puts [[info tclversion]]' | $vi_cv_path_tcl -`
1740 -       AC_MSG_RESULT($tclver - OK);
1741 -       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 -`
1742 -       tcldll=`echo 'puts libtcl[[info tclversion]][[info sharedlibextension]]' | $vi_cv_path_tcl -`
1744 -       AC_MSG_CHECKING(for location of Tcl include)
1745 -       if test "x$MACOSX" != "xyes"; then
1746 -       tclinc="$tclloc/include $tclloc/include/tcl $tclloc/include/tcl$tclver /usr/local/include /usr/local/include/tcl$tclver /usr/include /usr/include/tcl$tclver"
1747 -       else
1748 -       dnl For Mac OS X 10.3, use the OS-provided framework location
1749 -       tclinc="/System/Library/Frameworks/Tcl.framework/Headers"
1750 -       fi
1751 -       TCL_INC=
1752 -       for try in $tclinc; do
1753 -       if test -f "$try/tcl.h"; then
1754 -         AC_MSG_RESULT($try/tcl.h)
1755 -         TCL_INC=$try
1756 -         break
1757 -       fi
1758 -       done
1759 -       if test -z "$TCL_INC"; then
1760 -       AC_MSG_RESULT(<not found>)
1761 -       SKIP_TCL=YES
1762 -       fi
1763 -       if test -z "$SKIP_TCL"; then
1764 -       AC_MSG_CHECKING(for location of tclConfig.sh script)
1765 -       if test "x$MACOSX" != "xyes"; then
1766 -         tclcnf=`echo $tclinc | sed s/include/lib/g`
1767 -         tclcnf="$tclcnf `echo $tclinc | sed s/include/lib64/g`"
1768 -       else
1769 -         dnl For Mac OS X 10.3, use the OS-provided framework location
1770 -         tclcnf="/System/Library/Frameworks/Tcl.framework"
1771 -       fi
1772 -       for try in $tclcnf; do
1773 -         if test -f "$try/tclConfig.sh"; then
1774 -           AC_MSG_RESULT($try/tclConfig.sh)
1775 -           . "$try/tclConfig.sh"
1776 -           dnl use eval, because tcl 8.2 includes ${TCL_DBGX}
1777 -           if test "$enable_tclinterp" = "dynamic"; then
1778 -             TCL_LIBS=`eval echo "$TCL_STUB_LIB_SPEC $TCL_LIBS"`
1779 -           else
1780 -             TCL_LIBS=`eval echo "$TCL_LIB_SPEC $TCL_LIBS"`
1781 -           fi
1782 -           dnl Use $TCL_DEFS for -D_THREAD_SAFE et al.  But only use the
1783 -           dnl "-D_ABC" items.  Watch out for -DFOO=long\ long.
1784 -           TCL_DEFS=`echo $TCL_DEFS | sed -e 's/\\\\ /\\\\X/g' | tr ' ' '\012' | sed -e '/^[[^-]]/d' -e '/^-[[^D]]/d' -e '/-D[[^_]]/d' -e 's/-D_/ -D_/' | tr '\012' ' ' | sed -e 's/\\\\X/\\\\ /g'`
1785 -           break
1786 -         fi
1787 -       done
1788 -       if test -z "$TCL_LIBS"; then
1789 -         AC_MSG_RESULT(<not found>)
1790 -         AC_MSG_CHECKING(for Tcl library by myself)
1791 -         tcllib=`echo $tclinc | sed s/include/lib/g`
1792 -         tcllib="$tcllib `echo $tclinc | sed s/include/lib64/g`"
1793 -         for ext in .so .a ; do
1794 -           for ver in "" $tclver ; do
1795 -             for try in $tcllib ; do
1796 -               trylib=tcl$ver$ext
1797 -               if test -f "$try/lib$trylib" ; then
1798 -                 AC_MSG_RESULT($try/lib$trylib)
1799 -                 TCL_LIBS="-L\"$try\" -ltcl$ver -ldl -lm"
1800 -                 if test "`(uname) 2>/dev/null`" = SunOS &&
1801 -                                        uname -r | grep '^5' >/dev/null; then
1802 -                   TCL_LIBS="$TCL_LIBS -R $try"
1803 -                 fi
1804 -                 break 3
1805 -               fi
1806 -             done
1807 -           done
1808 -         done
1809 -         if test -z "$TCL_LIBS"; then
1810 -           AC_MSG_RESULT(<not found>)
1811 -           SKIP_TCL=YES
1812 -         fi
1813 -       fi
1814 -       if test -z "$SKIP_TCL"; then
1815 -         AC_DEFINE(FEAT_TCL)
1816 -         TCL_SRC=if_tcl.c
1817 -         TCL_OBJ=objects/if_tcl.o
1818 -         TCL_PRO=if_tcl.pro
1819 -         TCL_CFLAGS="-I$TCL_INC $TCL_DEFS"
1820 -       fi
1821 -       fi
1822 -     else
1823 -       AC_MSG_RESULT(too old; need Tcl version 8.0 or later)
1824 -     fi
1825 -   fi
1826 -   if test "$enable_tclinterp" = "dynamic"; then
1827 -     if test "X$TCL_SRC" != "X" -a "X$tcldll" != "X"; then
1828 -       AC_DEFINE(DYNAMIC_TCL)
1829 -       TCL_CFLAGS="-DDYNAMIC_TCL_DLL=\\\"$tcldll\\\" -DDYNAMIC_TCL_VER=\\\"$tclver\\\" $TCL_CFLAGS"
1830 -     fi
1831 -   fi
1832 -   if test "$fail_if_missing" = "yes" -a -z "$TCL_SRC"; then
1833 -     AC_MSG_ERROR([could not configure Tcl])
1834 -   fi
1835 - fi
1836 - AC_SUBST(TCL_SRC)
1837 - AC_SUBST(TCL_OBJ)
1838 - AC_SUBST(TCL_PRO)
1839 - AC_SUBST(TCL_CFLAGS)
1840 - AC_SUBST(TCL_LIBS)
1842 - AC_MSG_CHECKING(--enable-rubyinterp argument)
1843 - AC_ARG_ENABLE(rubyinterp,
1844 -       [  --enable-rubyinterp[=OPTS]     Include Ruby interpreter.  [default=no] [OPTS=no/yes/dynamic]], ,
1845 -       [enable_rubyinterp="no"])
1846 - AC_MSG_RESULT($enable_rubyinterp)
1847 - if test "$enable_rubyinterp" = "yes" -o "$enable_rubyinterp" = "dynamic"; then
1848 -   if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
1849 -     AC_MSG_ERROR([cannot use Ruby with tiny or small features])
1850 -   fi
1852 -   AC_MSG_CHECKING(--with-ruby-command argument)
1853 -   AC_SUBST(vi_cv_path_ruby)
1854 -   AC_ARG_WITH(ruby-command, [  --with-ruby-command=RUBY  name of the Ruby command (default: ruby)],
1855 -       RUBY_CMD="$withval"; vi_cv_path_ruby="$withval"; AC_MSG_RESULT($RUBY_CMD),
1856 -       RUBY_CMD="ruby"; AC_MSG_RESULT(defaulting to $RUBY_CMD))
1857 -   AC_PATH_PROG(vi_cv_path_ruby, $RUBY_CMD)
1858 -   if test "X$vi_cv_path_ruby" != "X"; then
1859 -     AC_MSG_CHECKING(Ruby version)
1860 -     if $vi_cv_path_ruby -e '(VERSION rescue RUBY_VERSION) >= "1.6.0" or exit 1' >/dev/null 2>/dev/null; then
1861 -       AC_MSG_RESULT(OK)
1862 -       AC_MSG_CHECKING(Ruby rbconfig)
1863 -       ruby_rbconfig="RbConfig"
1864 -       if ! $vi_cv_path_ruby -r rbconfig -e 'RbConfig' >/dev/null 2>/dev/null; then
1865 -       ruby_rbconfig="Config"
1866 -       fi
1867 -       AC_MSG_RESULT($ruby_rbconfig)
1868 -       AC_MSG_CHECKING(Ruby header files)
1869 -       rubyhdrdir=`$vi_cv_path_ruby -r mkmf -e "print $ruby_rbconfig::CONFIG[['rubyhdrdir']] || $ruby_rbconfig::CONFIG[['archdir']] || \\$hdrdir" 2>/dev/null`
1870 -       if test "X$rubyhdrdir" != "X"; then
1871 -       AC_MSG_RESULT($rubyhdrdir)
1872 -       RUBY_CFLAGS="-I$rubyhdrdir"
1873 -         rubyarchdir=`$vi_cv_path_ruby -r rbconfig -e "print ($ruby_rbconfig::CONFIG.has_key? 'rubyarchhdrdir') ? $ruby_rbconfig::CONFIG[['rubyarchhdrdir']] : '$rubyhdrdir/'+$ruby_rbconfig::CONFIG[['arch']]"`
1874 -         if test -d "$rubyarchdir"; then
1875 -           RUBY_CFLAGS="$RUBY_CFLAGS -I$rubyarchdir"
1876 -         fi
1877 -         rubyversion=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG[['ruby_version']].gsub(/\./, '')[[0,2]]"`
1878 -       if test "X$rubyversion" = "X"; then
1879 -         rubyversion=`$vi_cv_path_ruby -e "print ((VERSION rescue RUBY_VERSION)).gsub(/\./, '')[[0,2]]"`
1880 -       fi
1881 -         RUBY_CFLAGS="$RUBY_CFLAGS -DRUBY_VERSION=$rubyversion"
1882 -       rubylibs=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG[['LIBS']]"`
1883 -       if test "X$rubylibs" != "X"; then
1884 -         RUBY_LIBS="$rubylibs"
1885 -       fi
1886 -       librubyarg=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG[['LIBRUBYARG']])"`
1887 -       librubya=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG[['LIBRUBY_A']])"`
1888 -       rubylibdir=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG[['libdir']])"`
1889 -       if test -f "$rubylibdir/$librubya"; then
1890 -         librubyarg="$librubyarg"
1891 -         RUBY_LIBS="$RUBY_LIBS -L$rubylibdir"
1892 -       elif test "$librubyarg" = "libruby.a"; then
1893 -         dnl required on Mac OS 10.3 where libruby.a doesn't exist
1894 -         librubyarg="-lruby"
1895 -         RUBY_LIBS="$RUBY_LIBS -L$rubylibdir"
1896 -       fi
1898 -       if test "X$librubyarg" != "X"; then
1899 -         RUBY_LIBS="$librubyarg $RUBY_LIBS"
1900 -       fi
1901 -       rubyldflags=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG[['LDFLAGS']]"`
1902 -       if test "X$rubyldflags" != "X"; then
1903 -         dnl Ruby on Mac OS X 10.5 adds "-arch" flags but these should only
1904 -         dnl be included if requested by passing --with-mac-arch to
1905 -         dnl configure, so strip these flags first (if present)
1906 -         rubyldflags=`echo "$rubyldflags" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'`
1907 -         if test "X$rubyldflags" != "X"; then
1908 -           if test "X`echo \"$LDFLAGS\" | $FGREP -e \"$rubyldflags\"`" = "X"; then
1909 -             LDFLAGS="$rubyldflags $LDFLAGS"
1910 -           fi
1911 -         fi
1912 -       fi
1913 -       RUBY_SRC="if_ruby.c"
1914 -       RUBY_OBJ="objects/if_ruby.o"
1915 -       RUBY_PRO="if_ruby.pro"
1916 -       AC_DEFINE(FEAT_RUBY)
1917 -       if test "$enable_rubyinterp" = "dynamic"; then
1918 -         libruby=`$vi_cv_path_ruby -r rbconfig -e "puts $ruby_rbconfig::CONFIG[['LIBRUBY_SO']]"`
1919 -         AC_DEFINE(DYNAMIC_RUBY)
1920 -         RUBY_CFLAGS="-DDYNAMIC_RUBY_DLL=\\\"$libruby\\\" -DDYNAMIC_RUBY_VER=$rubyversion $RUBY_CFLAGS"
1921 -         RUBY_LIBS=
1922 -       fi
1923 -       else
1924 -       AC_MSG_RESULT(not found; disabling Ruby)
1925 -       fi
1926 -     else
1927 -       AC_MSG_RESULT(too old; need Ruby version 1.6.0 or later)
1928 -     fi
1929 -   fi
1931 -   if test "$fail_if_missing" = "yes" -a -z "$RUBY_OBJ"; then
1932 -     AC_MSG_ERROR([could not configure Ruby])
1933 -   fi
1934 - fi
1935 - AC_SUBST(RUBY_SRC)
1936 - AC_SUBST(RUBY_OBJ)
1937 - AC_SUBST(RUBY_PRO)
1938 - AC_SUBST(RUBY_CFLAGS)
1939 - AC_SUBST(RUBY_LIBS)
1941 - AC_MSG_CHECKING(--enable-cscope argument)
1942 - AC_ARG_ENABLE(cscope,
1943 -       [  --enable-cscope         Include cscope interface.], ,
1944 -       [enable_cscope="no"])
1945 - AC_MSG_RESULT($enable_cscope)
1946 - if test "$enable_cscope" = "yes"; then
1947 -   AC_DEFINE(FEAT_CSCOPE)
1948 - fi
1950 - AC_MSG_CHECKING(--enable-workshop argument)
1951 - AC_ARG_ENABLE(workshop,
1952 -       [  --enable-workshop       Include Sun Visual Workshop support.], ,
1953 -       [enable_workshop="no"])
1954 - AC_MSG_RESULT($enable_workshop)
1955 - if test "$enable_workshop" = "yes"; then
1956 -   AC_DEFINE(FEAT_SUN_WORKSHOP)
1957 -   WORKSHOP_SRC="workshop.c integration.c"
1958 -   AC_SUBST(WORKSHOP_SRC)
1959 -   WORKSHOP_OBJ="objects/workshop.o objects/integration.o"
1960 -   AC_SUBST(WORKSHOP_OBJ)
1961 -   if test "${enable_gui-xxx}" = xxx; then
1962 -     enable_gui=motif
1963 -   fi
1964 - fi
1966 - AC_MSG_CHECKING(--disable-netbeans argument)
1967 - AC_ARG_ENABLE(netbeans,
1968 -       [  --disable-netbeans      Disable NetBeans integration support.],
1969 -       , [enable_netbeans="yes"])
1970 - if test "$enable_netbeans" = "yes"; then
1971 -   if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
1972 -     AC_MSG_RESULT([cannot use NetBeans with tiny or small features])
1973 -     enable_netbeans="no"
1974 -   else
1975 -     AC_MSG_RESULT(no)
1976 -   fi
1977 - else
1978 -   AC_MSG_RESULT(yes)
1979 - fi
1981 - AC_MSG_CHECKING(--disable-channel argument)
1982 - AC_ARG_ENABLE(channel,
1983 -       [  --disable-channel      Disable process communication support.],
1984 -       , [enable_channel="yes"])
1985 - if test "$enable_channel" = "yes"; then
1986 -   if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
1987 -     AC_MSG_RESULT([cannot use channels with tiny or small features])
1988 -     enable_channel="no"
1989 -   else
1990 -     AC_MSG_RESULT(no)
1991 -   fi
1992 - else
1993 -   if test "$enable_netbeans" = "yes"; then
1994 -     AC_MSG_RESULT([yes, netbeans also disabled])
1995 -     enable_netbeans="no"
1996 -   else
1997 -     AC_MSG_RESULT(yes)
1998 -   fi
1999 - fi
2001 - if test "$enable_channel" = "yes"; then
2002 -   dnl On Solaris we need the socket and nsl library.
2003 -   AC_CHECK_LIB(socket, socket)
2004 -   AC_CHECK_LIB(nsl, gethostbyname)
2005 -   AC_MSG_CHECKING(whether compiling with process communication is possible)
2006 -   AC_TRY_LINK([
2007 - #include <stdio.h>
2008 - #include <stdlib.h>
2009 - #include <stdarg.h>
2010 - #include <fcntl.h>
2011 - #include <netdb.h>
2012 - #include <netinet/in.h>
2013 - #include <errno.h>
2014 - #include <sys/types.h>
2015 - #include <sys/socket.h>
2016 -       /* Check bitfields */
2017 -       struct nbbuf {
2018 -       unsigned int  initDone:1;
2019 -       ushort signmaplen;
2020 -       };
2021 -           ], [
2022 -               /* Check creating a socket. */
2023 -               struct sockaddr_in server;
2024 -               (void)socket(AF_INET, SOCK_STREAM, 0);
2025 -               (void)htons(100);
2026 -               (void)gethostbyname("microsoft.com");
2027 -               if (errno == ECONNREFUSED)
2028 -                 (void)connect(1, (struct sockaddr *)&server, sizeof(server));
2029 -           ],
2030 -       AC_MSG_RESULT(yes),
2031 -       AC_MSG_RESULT(no); enable_netbeans="no"; enable_channel="no")
2032 - fi
2033 - if test "$enable_netbeans" = "yes"; then
2034 -   AC_DEFINE(FEAT_NETBEANS_INTG)
2035 -   NETBEANS_SRC="netbeans.c"
2036 -   AC_SUBST(NETBEANS_SRC)
2037 -   NETBEANS_OBJ="objects/netbeans.o"
2038 -   AC_SUBST(NETBEANS_OBJ)
2039 - fi
2040 - if test "$enable_channel" = "yes"; then
2041 -   AC_DEFINE(FEAT_JOB_CHANNEL)
2042 -   CHANNEL_SRC="channel.c"
2043 -   AC_SUBST(CHANNEL_SRC)
2044 -   CHANNEL_OBJ="objects/channel.o"
2045 -   AC_SUBST(CHANNEL_OBJ)
2046 - fi
2048 - AC_MSG_CHECKING(--enable-multibyte argument)
2049 - AC_ARG_ENABLE(multibyte,
2050 -       [  --enable-multibyte      Include multibyte editing support.], ,
2051 -       [enable_multibyte="no"])
2052 - AC_MSG_RESULT($enable_multibyte)
2053 - if test "$enable_multibyte" = "yes"; then
2054 -   AC_DEFINE(FEAT_MBYTE)
2055 - fi
2057 - AC_MSG_CHECKING(--enable-hangulinput argument)
2058 - AC_ARG_ENABLE(hangulinput,
2059 -       [  --enable-hangulinput    Include Hangul input support.], ,
2060 -       [enable_hangulinput="no"])
2061 - AC_MSG_RESULT($enable_hangulinput)
2063 - AC_MSG_CHECKING(--enable-xim argument)
2064 - AC_ARG_ENABLE(xim,
2065 -       [  --enable-xim            Include XIM input support.],
2066 -       AC_MSG_RESULT($enable_xim),
2067 -       [enable_xim="auto"; AC_MSG_RESULT(defaulting to auto)])
2069 - AC_MSG_CHECKING(--enable-fontset argument)
2070 - AC_ARG_ENABLE(fontset,
2071 -       [  --enable-fontset        Include X fontset output support.], ,
2072 -       [enable_fontset="no"])
2073 - AC_MSG_RESULT($enable_fontset)
2074 - dnl defining FEAT_XFONTSET is delayed, so that it can be disabled for no GUI
2076 - test -z "$with_x" && with_x=yes
2077 - test "${enable_gui-yes}" != no -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && with_x=yes
2078 - if test "$with_x" = no; then
2079 -   AC_MSG_RESULT(defaulting to: don't HAVE_X11)
2080 - else
2081 -   dnl Do this check early, so that its failure can override user requests.
2083 -   AC_PATH_PROG(xmkmfpath, xmkmf)
2085 -   AC_PATH_XTRA
2087 -   dnl On z/OS Unix the X libraries are DLLs. To use them the code must
2088 -   dnl be compiled with a special option.
2089 -   dnl Also add SM, ICE and Xmu to X_EXTRA_LIBS.
2090 -   if test "$zOSUnix" = "yes"; then
2091 -     CFLAGS="$CFLAGS -W c,dll"
2092 -     LDFLAGS="$LDFLAGS -W l,dll"
2093 -     X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE -lXmu"
2094 -   fi
2096 -   dnl On my HPUX system the X include dir is found, but the lib dir not.
2097 -   dnl This is a desparate try to fix this.
2099 -   if test -d "$x_includes" && test ! -d "$x_libraries"; then
2100 -     x_libraries=`echo "$x_includes" | sed s/include/lib/`
2101 -     AC_MSG_RESULT(Corrected X libraries to $x_libraries)
2102 -     X_LIBS="$X_LIBS -L$x_libraries"
2103 -     if test "`(uname) 2>/dev/null`" = SunOS &&
2104 -                                        uname -r | grep '^5' >/dev/null; then
2105 -       X_LIBS="$X_LIBS -R $x_libraries"
2106 -     fi
2107 -   fi
2109 -   if test -d "$x_libraries" && test ! -d "$x_includes"; then
2110 -     x_includes=`echo "$x_libraries" | sed s/lib/include/`
2111 -     AC_MSG_RESULT(Corrected X includes to $x_includes)
2112 -     X_CFLAGS="$X_CFLAGS -I$x_includes"
2113 -   fi
2115 -   dnl Remove "-I/usr/include " from X_CFLAGS, should not be needed.
2116 -   X_CFLAGS="`echo $X_CFLAGS\  | sed 's%-I/usr/include %%'`"
2117 -   dnl Remove "-L/usr/lib " from X_LIBS, should not be needed.
2118 -   X_LIBS="`echo $X_LIBS\  | sed 's%-L/usr/lib %%'`"
2119 -   dnl Same for "-R/usr/lib ".
2120 -   X_LIBS="`echo $X_LIBS\  | sed -e 's%-R/usr/lib %%' -e 's%-R /usr/lib %%'`"
2123 -   dnl Check if the X11 header files are correctly installed. On some systems
2124 -   dnl Xlib.h includes files that don't exist.  On some systems X11/Intrinsic.h
2125 -   dnl is missing.
2126 -   AC_MSG_CHECKING(if X11 header files can be found)
2127 -   cflags_save=$CFLAGS
2128 -   CFLAGS="$CFLAGS $X_CFLAGS"
2129 -   AC_TRY_COMPILE([#include <X11/Xlib.h>
2130 - #include <X11/Intrinsic.h>], ,
2131 -       AC_MSG_RESULT(yes),
2132 -       AC_MSG_RESULT(no); no_x=yes)
2133 -   CFLAGS=$cflags_save
2135 -   if test "${no_x-no}" = yes; then
2136 -     with_x=no
2137 -   else
2138 -     AC_DEFINE(HAVE_X11)
2139 -     X_LIB="-lXt -lX11";
2140 -     AC_SUBST(X_LIB)
2142 -     ac_save_LDFLAGS="$LDFLAGS"
2143 -     LDFLAGS="-L$x_libraries $LDFLAGS"
2145 -     dnl Check for -lXdmcp (needed on SunOS 4.1.4)
2146 -     dnl For HP-UX 10.20 it must be before -lSM -lICE
2147 -     AC_CHECK_LIB(Xdmcp, _XdmcpAuthDoIt, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lXdmcp"],,
2148 -               [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS -lXdmcp])
2150 -     dnl Some systems need -lnsl -lsocket when testing for ICE.
2151 -     dnl The check above doesn't do this, try here (again).  Also needed to get
2152 -     dnl them after Xdmcp.  link.sh will remove them when not needed.
2153 -     dnl Check for other function than above to avoid the cached value
2154 -     AC_CHECK_LIB(ICE, IceOpenConnection,
2155 -                 [X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE"],, [$X_EXTRA_LIBS])
2157 -     dnl Check for -lXpm (needed for some versions of Motif)
2158 -     LDFLAGS="$X_LIBS $ac_save_LDFLAGS"
2159 -     AC_CHECK_LIB(Xpm, XpmCreatePixmapFromData, [X_PRE_LIBS="$X_PRE_LIBS -lXpm"],,
2160 -               [-lXt $X_PRE_LIBS -lXpm -lX11 $X_EXTRA_LIBS])
2162 -     dnl Check that the X11 header files don't use implicit declarations
2163 -     AC_MSG_CHECKING(if X11 header files implicitly declare return values)
2164 -     cflags_save=$CFLAGS
2165 -     dnl -Werror is GCC only, others like Solaris Studio might not like it
2166 -     if test "$GCC" = yes; then
2167 -       CFLAGS="$CFLAGS $X_CFLAGS -Werror"
2168 -     else
2169 -       CFLAGS="$CFLAGS $X_CFLAGS"
2170 -     fi
2171 -     AC_TRY_COMPILE([#include <X11/Xlib.h>], ,
2172 -       AC_MSG_RESULT(no),
2173 -       CFLAGS="$CFLAGS -Wno-implicit-int"
2174 -       AC_TRY_COMPILE([#include <X11/Xlib.h>], ,
2175 -           AC_MSG_RESULT(yes); cflags_save="$cflags_save -Wno-implicit-int",
2176 -           AC_MSG_RESULT(test failed)
2177 -       )
2178 -     )
2179 -     CFLAGS=$cflags_save
2181 -     LDFLAGS="$ac_save_LDFLAGS"
2183 -     AC_MSG_CHECKING(size of wchar_t is 2 bytes)
2184 -     AC_CACHE_VAL(ac_cv_small_wchar_t,
2185 -       [AC_TRY_RUN([
2186 - #include <X11/Xlib.h>
2187 - #if STDC_HEADERS
2188 - # include <stdlib.h>
2189 - # include <stddef.h>
2190 - #endif
2191 -               main()
2192 -               {
2193 -                 if (sizeof(wchar_t) <= 2)
2194 -                   exit(1);
2195 -                 exit(0);
2196 -               }],
2197 -               ac_cv_small_wchar_t="no",
2198 -               ac_cv_small_wchar_t="yes",
2199 -               AC_MSG_ERROR(failed to compile test program))])
2200 -     AC_MSG_RESULT($ac_cv_small_wchar_t)
2201 -     if test "x$ac_cv_small_wchar_t" = "xyes" ; then
2202 -       AC_DEFINE(SMALL_WCHAR_T)
2203 -     fi
2205 -   fi
2206 - fi
2208 - test "x$with_x" = xno -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && enable_gui=no
2210 - AC_MSG_CHECKING(--enable-gui argument)
2211 - AC_ARG_ENABLE(gui,
2212 -  [  --enable-gui[=OPTS]     X11 GUI [default=auto] [OPTS=auto/no/gtk2/gnome2/gtk3/motif/athena/neXtaw/photon/carbon]], , enable_gui="auto")
2214 - dnl Canonicalize the --enable-gui= argument so that it can be easily compared.
2215 - dnl Do not use character classes for portability with old tools.
2216 - enable_gui_canon=`echo "_$enable_gui" | \
2217 -       sed 's/[[ _+-]]//g;y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
2219 - dnl Skip everything by default.
2220 - SKIP_GTK2=YES
2221 - SKIP_GTK3=YES
2222 - SKIP_GNOME=YES
2223 - SKIP_MOTIF=YES
2224 - SKIP_ATHENA=YES
2225 - SKIP_NEXTAW=YES
2226 - SKIP_PHOTON=YES
2227 - SKIP_CARBON=YES
2228 - GUITYPE=NONE
2230 - if test "x$QNX" = "xyes" -a "x$with_x" = "xno" ; then
2231 -   SKIP_PHOTON=
2232 -   case "$enable_gui_canon" in
2233 -     no)               AC_MSG_RESULT(no GUI support)
2234 -               SKIP_PHOTON=YES ;;
2235 -     yes|"")   AC_MSG_RESULT(yes - automatic GUI support) ;;
2236 -     auto)     AC_MSG_RESULT(auto - automatic GUI support) ;;
2237 -     photon)   AC_MSG_RESULT(Photon GUI support) ;;
2238 -     *)                AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported])
2239 -               SKIP_PHOTON=YES ;;
2240 -   esac
2242 - elif test "x$MACOSX" = "xyes" -a "x$with_x" = "xno" ; then
2243 -   SKIP_CARBON=
2244 -   case "$enable_gui_canon" in
2245 -     no)               AC_MSG_RESULT(no GUI support)
2246 -               SKIP_CARBON=YES ;;
2247 -     yes|"")   AC_MSG_RESULT(yes - automatic GUI support) ;;
2248 -     auto)     AC_MSG_RESULT(auto - Carbon GUI is outdated - disable GUI support)
2249 -               SKIP_CARBON=YES ;;
2250 -     carbon)   AC_MSG_RESULT(Carbon GUI support) ;;
2251 -     *)                AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported])
2252 -               SKIP_CARBON=YES ;;
2253 -   esac
2255 - else
2257 -   case "$enable_gui_canon" in
2258 -     no|none)  AC_MSG_RESULT(no GUI support) ;;
2259 -     yes|""|auto)      AC_MSG_RESULT(yes/auto - automatic GUI support)
2260 -               SKIP_GTK2=
2261 -               SKIP_GNOME=
2262 -               SKIP_MOTIF=
2263 -               SKIP_ATHENA=
2264 -               SKIP_NEXTAW=
2265 -               SKIP_CARBON=;;
2266 -     gtk2)     AC_MSG_RESULT(GTK+ 2.x GUI support)
2267 -               SKIP_GTK2=;;
2268 -     gnome2)   AC_MSG_RESULT(GNOME 2.x GUI support)
2269 -               SKIP_GNOME=
2270 -               SKIP_GTK2=;;
2271 -     gtk3)     AC_MSG_RESULT(GTK+ 3.x GUI support)
2272 -               SKIP_GTK3=;;
2273 -     motif)    AC_MSG_RESULT(Motif GUI support)
2274 -               SKIP_MOTIF=;;
2275 -     athena)   AC_MSG_RESULT(Athena GUI support)
2276 -               SKIP_ATHENA=;;
2277 -     nextaw)   AC_MSG_RESULT(neXtaw GUI support)
2278 -               SKIP_NEXTAW=;;
2279 -     *)                AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported]) ;;
2280 -   esac
2282 - fi
2284 - if test "x$SKIP_GTK2" != "xYES" -a "$enable_gui_canon" != "gtk2" \
2285 -                               -a "$enable_gui_canon" != "gnome2"; then
2286 -   AC_MSG_CHECKING(whether or not to look for GTK+ 2)
2287 -   AC_ARG_ENABLE(gtk2-check,
2288 -       [  --enable-gtk2-check     If auto-select GUI, check for GTK+ 2 [default=yes]],
2289 -       , enable_gtk2_check="yes")
2290 -   AC_MSG_RESULT($enable_gtk2_check)
2291 -   if test "x$enable_gtk2_check" = "xno"; then
2292 -     SKIP_GTK2=YES
2293 -     SKIP_GNOME=YES
2294 -   fi
2295 - fi
2297 - if test "x$SKIP_GNOME" != "xYES" -a "$enable_gui_canon" != "gnome2"; then
2298 -   AC_MSG_CHECKING(whether or not to look for GNOME)
2299 -   AC_ARG_ENABLE(gnome-check,
2300 -       [  --enable-gnome-check    If GTK GUI, check for GNOME [default=no]],
2301 -       , enable_gnome_check="no")
2302 -   AC_MSG_RESULT($enable_gnome_check)
2303 -   if test "x$enable_gnome_check" = "xno"; then
2304 -     SKIP_GNOME=YES
2305 -   fi
2306 - fi
2308 - if test "x$SKIP_GTK3" != "xYES" -a "$enable_gui_canon" != "gtk3"; then
2309 -   AC_MSG_CHECKING(whether or not to look for GTK+ 3)
2310 -   AC_ARG_ENABLE(gtk3-check,
2311 -       [  --enable-gtk3-check     If auto-select GUI, check for GTK+ 3 [default=yes]],
2312 -       , enable_gtk3_check="yes")
2313 -   AC_MSG_RESULT($enable_gtk3_check)
2314 -   if test "x$enable_gtk3_check" = "xno"; then
2315 -     SKIP_GTK3=YES
2316 -   fi
2317 - fi
2319 - if test "x$SKIP_MOTIF" != "xYES" -a "$enable_gui_canon" != "motif"; then
2320 -   AC_MSG_CHECKING(whether or not to look for Motif)
2321 -   AC_ARG_ENABLE(motif-check,
2322 -       [  --enable-motif-check    If auto-select GUI, check for Motif [default=yes]],
2323 -       , enable_motif_check="yes")
2324 -   AC_MSG_RESULT($enable_motif_check)
2325 -   if test "x$enable_motif_check" = "xno"; then
2326 -     SKIP_MOTIF=YES
2327 -   fi
2328 - fi
2330 - if test "x$SKIP_ATHENA" != "xYES" -a "$enable_gui_canon" != "athena"; then
2331 -   AC_MSG_CHECKING(whether or not to look for Athena)
2332 -   AC_ARG_ENABLE(athena-check,
2333 -       [  --enable-athena-check   If auto-select GUI, check for Athena [default=yes]],
2334 -       , enable_athena_check="yes")
2335 -   AC_MSG_RESULT($enable_athena_check)
2336 -   if test "x$enable_athena_check" = "xno"; then
2337 -     SKIP_ATHENA=YES
2338 -   fi
2339 - fi
2341 - if test "x$SKIP_NEXTAW" != "xYES" -a "$enable_gui_canon" != "nextaw"; then
2342 -   AC_MSG_CHECKING(whether or not to look for neXtaw)
2343 -   AC_ARG_ENABLE(nextaw-check,
2344 -       [  --enable-nextaw-check   If auto-select GUI, check for neXtaw [default=yes]],
2345 -       , enable_nextaw_check="yes")
2346 -   AC_MSG_RESULT($enable_nextaw_check);
2347 -   if test "x$enable_nextaw_check" = "xno"; then
2348 -     SKIP_NEXTAW=YES
2349 -   fi
2350 - fi
2352 - if test "x$SKIP_CARBON" != "xYES" -a "$enable_gui_canon" != "carbon"; then
2353 -   AC_MSG_CHECKING(whether or not to look for Carbon)
2354 -   AC_ARG_ENABLE(carbon-check,
2355 -       [  --enable-carbon-check   If auto-select GUI, check for Carbon [default=yes]],
2356 -       , enable_carbon_check="yes")
2357 -   AC_MSG_RESULT($enable_carbon_check);
2358 -   if test "x$enable_carbon_check" = "xno"; then
2359 -     SKIP_CARBON=YES
2360 -   fi
2361 - fi
2364 - if test "x$MACOSX" = "xyes" -a -z "$SKIP_CARBON" -a "x$CARBON" = "xyes"; then
2365 -   AC_MSG_CHECKING(for Carbon GUI)
2366 -   dnl already did the check, just give the message
2367 -   AC_MSG_RESULT(yes);
2368 -   GUITYPE=CARBONGUI
2369 -   if test "$VIMNAME" = "vim"; then
2370 -     VIMNAME=Vim
2371 -   fi
2373 -   if test "x$MACARCH" = "xboth"; then
2374 -     CPPFLAGS="$CPPFLAGS -I$DEVELOPER_DIR/SDKs/MacOSX10.4u.sdk/Developer/Headers/FlatCarbon"
2375 -   else
2376 -     CPPFLAGS="$CPPFLAGS -I$DEVELOPER_DIR/Headers/FlatCarbon"
2377 -   fi
2379 -   dnl Default install directory is not /usr/local
2380 -   if test x$prefix = xNONE; then
2381 -     prefix=/Applications
2382 -   fi
2384 -   dnl Sorry for the hard coded default
2385 -   datadir='${prefix}/Vim.app/Contents/Resources'
2387 -   dnl skip everything else
2388 -   SKIP_GTK2=YES;
2389 -   SKIP_GNOME=YES;
2390 -   SKIP_MOTIF=YES;
2391 -   SKIP_ATHENA=YES;
2392 -   SKIP_NEXTAW=YES;
2393 -   SKIP_PHOTON=YES;
2394 -   SKIP_CARBON=YES
2395 - fi
2397 - dnl define an autoconf function to check for a specified version of GTK, and
2398 - dnl try to compile/link a GTK program.
2399 - dnl
2400 - dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
2401 - dnl Test for GTK, and define GTK_CFLAGS, GTK_LIBDIR and GTK_LIBS
2402 - dnl
2403 - AC_DEFUN(AM_PATH_GTK,
2404 - [
2405 -   if test "X$GTK_CONFIG" != "Xno" -o "X$PKG_CONFIG" != "Xno"; then
2406 -   {
2407 -     no_gtk=""
2408 -     if (test "X$SKIP_GTK2" != "XYES" -a "X$PKG_CONFIG" != "Xno") \
2409 -         && $PKG_CONFIG --exists gtk+-2.0; then
2410 -     {
2411 -       min_gtk_version=ifelse([$1], ,2.2.0,$1)
2412 -       AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
2413 -       dnl We should be using PKG_CHECK_MODULES() instead of this hack.
2414 -       dnl But I guess the dependency on pkgconfig.m4 is not wanted or
2415 -       dnl something like that.
2416 -       GTK_CFLAGS=`$PKG_CONFIG --cflags gtk+-2.0`
2417 -       GTK_LIBDIR=`$PKG_CONFIG --libs-only-L gtk+-2.0`
2418 -       GTK_LIBS=`$PKG_CONFIG --libs gtk+-2.0`
2419 -       gtk_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
2420 -            sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
2421 -       gtk_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
2422 -            sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
2423 -       gtk_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
2424 -            sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
2425 -     }
2426 -     elif (test "X$SKIP_GTK3" != "XYES" -a "X$PKG_CONFIG" != "Xno") \
2427 -         && $PKG_CONFIG --exists gtk+-3.0; then
2428 -     {
2429 -       min_gtk_version=ifelse([$1], ,3.0.0,$1)
2430 -       AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
2432 -       GTK_CFLAGS=`$PKG_CONFIG --cflags gtk+-3.0`
2433 -       GTK_LIBDIR=`$PKG_CONFIG --libs-only-L gtk+-3.0`
2434 -       GTK_LIBS=`$PKG_CONFIG --libs gtk+-3.0`
2435 -       gtk_major_version=`$PKG_CONFIG --modversion gtk+-3.0 | \
2436 -            sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
2437 -       gtk_minor_version=`$PKG_CONFIG --modversion gtk+-3.0 | \
2438 -            sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
2439 -       gtk_micro_version=`$PKG_CONFIG --modversion gtk+-3.0 | \
2440 -            sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
2441 -     }
2442 -     else
2443 -       no_gtk=yes
2444 -     fi
2446 -     if test "x$enable_gtktest" = "xyes" -a "x$no_gtk" = "x"; then
2447 -     {
2448 -       ac_save_CFLAGS="$CFLAGS"
2449 -       ac_save_LIBS="$LIBS"
2450 -       CFLAGS="$CFLAGS $GTK_CFLAGS"
2451 -       LIBS="$LIBS $GTK_LIBS"
2453 -       dnl
2454 -       dnl Now check if the installed GTK is sufficiently new.
2455 -       dnl
2456 -       rm -f conf.gtktest
2457 -       AC_TRY_RUN([
2458 - #include <gtk/gtk.h>
2459 - #include <stdio.h>
2460 - #if STDC_HEADERS
2461 - # include <stdlib.h>
2462 - # include <stddef.h>
2463 - #endif
2465 - int
2466 - main ()
2467 - {
2468 - int major, minor, micro;
2469 - char *tmp_version;
2471 - system ("touch conf.gtktest");
2473 - /* HP/UX 9 (%@#!) writes to sscanf strings */
2474 - tmp_version = g_strdup("$min_gtk_version");
2475 - if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
2476 -    printf("%s, bad version string\n", "$min_gtk_version");
2477 -    exit(1);
2478 -  }
2480 - if ((gtk_major_version > major) ||
2481 -     ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
2482 -     ((gtk_major_version == major) && (gtk_minor_version == minor) &&
2483 -                                    (gtk_micro_version >= micro)))
2484 - {
2485 -     return 0;
2486 - }
2487 - return 1;
2488 - }
2489 - ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
2490 -       CFLAGS="$ac_save_CFLAGS"
2491 -       LIBS="$ac_save_LIBS"
2492 -     }
2493 -     fi
2494 -     if test "x$no_gtk" = x ; then
2495 -       if test "x$enable_gtktest" = "xyes"; then
2496 -       AC_MSG_RESULT(yes; found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version)
2497 -       else
2498 -       AC_MSG_RESULT(found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version)
2499 -       fi
2500 -       ifelse([$2], , :, [$2])
2501 -     else
2502 -     {
2503 -       AC_MSG_RESULT(no)
2504 -       GTK_CFLAGS=""
2505 -       GTK_LIBS=""
2506 -       ifelse([$3], , :, [$3])
2507 -     }
2508 -     fi
2509 -   }
2510 -   else
2511 -     GTK_CFLAGS=""
2512 -     GTK_LIBS=""
2513 -     ifelse([$3], , :, [$3])
2514 -   fi
2515 -   AC_SUBST(GTK_CFLAGS)
2516 -   AC_SUBST(GTK_LIBS)
2517 -   rm -f conf.gtktest
2518 - ])
2520 - dnl ---------------------------------------------------------------------------
2521 - dnl gnome
2522 - dnl ---------------------------------------------------------------------------
2523 - AC_DEFUN([GNOME_INIT_HOOK],
2524 - [
2525 -   AC_SUBST(GNOME_LIBS)
2526 -   AC_SUBST(GNOME_LIBDIR)
2527 -   AC_SUBST(GNOME_INCLUDEDIR)
2529 -   AC_ARG_WITH(gnome-includes,
2530 -     [  --with-gnome-includes=DIR Specify location of GNOME headers],
2531 -     [CFLAGS="$CFLAGS -I$withval"]
2532 -   )
2534 -   AC_ARG_WITH(gnome-libs,
2535 -     [  --with-gnome-libs=DIR   Specify location of GNOME libs],
2536 -     [LDFLAGS="$LDFLAGS -L$withval" gnome_prefix=$withval]
2537 -   )
2539 -   AC_ARG_WITH(gnome,
2540 -     [  --with-gnome            Specify prefix for GNOME files],
2541 -     if test x$withval = xyes; then
2542 -       want_gnome=yes
2543 -       ifelse([$1], [], :, [$1])
2544 -     else
2545 -       if test "x$withval" = xno; then
2546 -       want_gnome=no
2547 -       else
2548 -       want_gnome=yes
2549 -       LDFLAGS="$LDFLAGS -L$withval/lib"
2550 -       CFLAGS="$CFLAGS -I$withval/include"
2551 -       gnome_prefix=$withval/lib
2552 -       fi
2553 -     fi,
2554 -     want_gnome=yes)
2556 -   if test "x$want_gnome" = xyes; then
2557 -   {
2558 -     AC_MSG_CHECKING(for libgnomeui-2.0)
2559 -     if $PKG_CONFIG --exists libgnomeui-2.0; then
2560 -       AC_MSG_RESULT(yes)
2561 -       GNOME_LIBS=`$PKG_CONFIG --libs-only-l libgnomeui-2.0`
2562 -       GNOME_LIBDIR=`$PKG_CONFIG --libs-only-L libgnomeui-2.0`
2563 -       GNOME_INCLUDEDIR=`$PKG_CONFIG --cflags libgnomeui-2.0`
2565 -       dnl On FreeBSD we need -pthread but pkg-config doesn't include it.
2566 -       dnl This might not be the right way but it works for me...
2567 -       AC_MSG_CHECKING(for FreeBSD)
2568 -       if test "`(uname) 2>/dev/null`" = FreeBSD; then
2569 -       AC_MSG_RESULT(yes, adding -pthread)
2570 -       GNOME_INCLUDEDIR="$GNOME_INCLUDEDIR -D_THREAD_SAFE"
2571 -       GNOME_LIBS="$GNOME_LIBS -pthread"
2572 -       else
2573 -       AC_MSG_RESULT(no)
2574 -       fi
2575 -       $1
2576 -     else
2577 -       AC_MSG_RESULT(not found)
2578 -       if test "x$2" = xfail; then
2579 -       AC_MSG_ERROR(Could not find libgnomeui-2.0 via pkg-config)
2580 -       fi
2581 -     fi
2582 -   }
2583 -   fi
2584 - ])
2586 - AC_DEFUN([GNOME_INIT],[
2587 -       GNOME_INIT_HOOK([],fail)
2588 - ])
2591 - dnl ---------------------------------------------------------------------------
2592 - dnl Check for GTK2.  If it fails, then continue on for Motif as before...
2593 - dnl ---------------------------------------------------------------------------
2594 - if test -z "$SKIP_GTK2"; then
2596 -   AC_MSG_CHECKING(--disable-gtktest argument)
2597 -   AC_ARG_ENABLE(gtktest, [  --disable-gtktest       Do not try to compile and run a test GTK program],
2598 -       , enable_gtktest=yes)
2599 -   if test "x$enable_gtktest" = "xyes" ; then
2600 -     AC_MSG_RESULT(gtk test enabled)
2601 -   else
2602 -     AC_MSG_RESULT(gtk test disabled)
2603 -   fi
2605 -   if test "X$PKG_CONFIG" = "X"; then
2606 -     AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
2607 -   fi
2609 -   if test "x$PKG_CONFIG" != "xno"; then
2610 -     dnl First try finding version 2.2.0 or later.  The 2.0.x series has
2611 -     dnl problems (bold fonts, --remote doesn't work).
2612 -     AM_PATH_GTK(2.2.0,
2613 -               [GUI_LIB_LOC="$GTK_LIBDIR"
2614 -                GTK_LIBNAME="$GTK_LIBS"
2615 -               GUI_INC_LOC="$GTK_CFLAGS"], )
2616 -     if test "x$GTK_CFLAGS" != "x"; then
2617 -       SKIP_GTK3=YES
2618 -       SKIP_ATHENA=YES
2619 -       SKIP_NEXTAW=YES
2620 -       SKIP_MOTIF=YES
2621 -       GUITYPE=GTK
2622 -       AC_SUBST(GTK_LIBNAME)
2623 -     fi
2624 -   fi
2625 -   if test "x$GUITYPE" = "xGTK"; then
2626 -     if test "$gtk_minor_version" = 1 -a "0$gtk_micro_version" -ge 1 \
2627 -       || test "0$gtk_minor_version" -ge 2; then
2628 -       AC_DEFINE(HAVE_GTK_MULTIHEAD)
2629 -     fi
2630 -     dnl
2631 -     dnl if GTK exists, then check for GNOME.
2632 -     dnl
2633 -     if test -z "$SKIP_GNOME"; then
2634 -     {
2635 -       GNOME_INIT_HOOK([have_gnome=yes])
2636 -       if test "x$have_gnome" = xyes ; then
2637 -       AC_DEFINE(FEAT_GUI_GNOME)
2638 -       GUI_INC_LOC="$GUI_INC_LOC $GNOME_INCLUDEDIR"
2639 -       GTK_LIBNAME="$GTK_LIBNAME $GNOME_LIBDIR $GNOME_LIBS"
2640 -       fi
2641 -     }
2642 -     fi
2643 -   fi
2644 - fi
2647 - dnl ---------------------------------------------------------------------------
2648 - dnl Check for GTK3.
2649 - dnl ---------------------------------------------------------------------------
2650 - if test -z "$SKIP_GTK3"; then
2652 -   AC_MSG_CHECKING(--disable-gtktest argument)
2653 -   AC_ARG_ENABLE(gtktest, [  --disable-gtktest       Do not try to compile and run a test GTK program],
2654 -       , enable_gtktest=yes)
2655 -   if test "x$enable_gtktest" = "xyes" ; then
2656 -     AC_MSG_RESULT(gtk test enabled)
2657 -   else
2658 -     AC_MSG_RESULT(gtk test disabled)
2659 -   fi
2661 -   if test "X$PKG_CONFIG" = "X"; then
2662 -     AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
2663 -   fi
2665 -   if test "x$PKG_CONFIG" != "xno"; then
2666 -     AM_PATH_GTK(3.0.0,
2667 -               [GUI_LIB_LOC="$GTK_LIBDIR"
2668 -                GTK_LIBNAME="$GTK_LIBS"
2669 -               GUI_INC_LOC="$GTK_CFLAGS"], )
2670 -     if test "x$GTK_CFLAGS" != "x"; then
2671 -       SKIP_GTK2=YES
2672 -       SKIP_GNOME=YES
2673 -       SKIP_ATHENA=YES
2674 -       SKIP_NEXTAW=YES
2675 -       SKIP_MOTIF=YES
2676 -       GUITYPE=GTK
2677 -       AC_SUBST(GTK_LIBNAME)
2678 -       AC_DEFINE(HAVE_GTK_MULTIHEAD)
2679 -       AC_DEFINE(USE_GTK3)
2680 -     fi
2681 -   fi
2682 - fi
2684 - dnl Check the version of Gdk-Pixbuf.  If the version is 2.31 or later and
2685 - dnl glib-compile-resources is found in PATH, use GResource.
2686 - if test "x$GUITYPE" = "xGTK"; then
2687 -   AC_MSG_CHECKING([version of Gdk-Pixbuf])
2688 -   gdk_pixbuf_version=`$PKG_CONFIG --modversion gdk-pixbuf-2.0`
2689 -   if test "x$gdk_pixbuf_version" != x ; then
2690 -     gdk_pixbuf_version_minor=`echo $gdk_pixbuf_version | \
2691 -       sed -e 's/[[0-9]][[0-9]]*\.\([[0-9]][[0-9]]*\)\.[[0-9]][[0-9]]*/\1/'`
2692 -     if test "x$gdk_pixbuf_version_minor" != x -a \
2693 -       $gdk_pixbuf_version_minor -ge 31 ; then
2694 -       AC_MSG_RESULT([OK.])
2695 -       AC_PATH_PROG(GLIB_COMPILE_RESOURCES,[glib-compile-resources],no)
2696 -       AC_MSG_CHECKING([glib-compile-resources])
2697 -       if test "x$GLIB_COMPILE_RESOURCES" = xno ; then
2698 -       GLIB_COMPILE_RESOURCES=""
2699 -       AC_MSG_RESULT([cannot be found in PATH.])
2700 -       else
2701 -       AC_MSG_RESULT([usable.])
2702 -       AC_DEFINE(USE_GRESOURCE)
2703 -       GRESOURCE_SRC="auto/gui_gtk_gresources.c"
2704 -       GRESOURCE_OBJ="objects/gui_gtk_gresources.o"
2705 -       fi
2706 -     else
2707 -       AC_MSG_RESULT([not usable.])
2708 -     fi
2709 -   else
2710 -     AC_MSG_RESULT([cannot obtain from pkg_config.])
2711 -   fi
2713 -   AC_MSG_CHECKING([--disable-icon-cache-update argument])
2714 -   AC_ARG_ENABLE(icon_cache_update,
2715 -           [  --disable-icon-cache-update        update disabled],
2716 -           [],
2717 -           [enable_icon_cache_update="yes"])
2718 -   if test "$enable_icon_cache_update" = "yes"; then
2719 -     AC_MSG_RESULT([not set])
2720 -     AC_PATH_PROG(GTK_UPDATE_ICON_CACHE,[gtk-update-icon-cache],no)
2721 -     if test "x$GTK_UPDATE_ICON_CACHE" = "xno" ; then
2722 -       AC_MSG_RESULT([not found in PATH.])
2723 -     fi
2724 -   else
2725 -     AC_MSG_RESULT([update disabled])
2726 -   fi
2728 -   AC_MSG_CHECKING([--disable-desktop-database-update argument])
2729 -   AC_ARG_ENABLE(desktop_database_update,
2730 -           [  --disable-desktop-database-update  update disabled],
2731 -           [],
2732 -           [enable_desktop_database_update="yes"])
2733 -   if test "$enable_desktop_database_update" = "yes"; then
2734 -     AC_MSG_RESULT([not set])
2735 -     AC_PATH_PROG(UPDATE_DESKTOP_DATABASE,[update-desktop-database],no)
2736 -     if test "x$UPDATE_DESKTOP_DATABASE" = "xno" ; then
2737 -       AC_MSG_RESULT([not found in PATH.])
2738 -     fi
2739 -   else
2740 -     AC_MSG_RESULT([update disabled])
2741 -   fi
2742 - fi
2743 - AC_SUBST(GLIB_COMPILE_RESOURCES)
2744 - AC_SUBST(GRESOURCE_SRC)
2745 - AC_SUBST(GRESOURCE_OBJ)
2746 - AC_SUBST(GTK_UPDATE_ICON_CACHE)
2747 - AC_SUBST(UPDATE_DESKTOP_DATABASE)
2749 - dnl Check for Motif include files location.
2750 - dnl The LAST one found is used, this makes the highest version to be used,
2751 - dnl e.g. when Motif1.2 and Motif2.0 are both present.
2753 - if test -z "$SKIP_MOTIF"; then
2754 -   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"
2755 -   dnl Remove "-I" from before $GUI_INC_LOC if it's there
2756 -   GUI_INC_LOC="`echo $GUI_INC_LOC|sed 's%-I%%g'`"
2758 -   AC_MSG_CHECKING(for location of Motif GUI includes)
2759 -   gui_includes="`echo $x_includes|sed 's%/[^/][^/]*$%%'` `echo "$gui_XXX" | sed s/XXX/include/g` $GUI_INC_LOC"
2760 -   GUI_INC_LOC=
2761 -   for try in $gui_includes; do
2762 -     if test -f "$try/Xm/Xm.h"; then
2763 -       GUI_INC_LOC=$try
2764 -     fi
2765 -   done
2766 -   if test -n "$GUI_INC_LOC"; then
2767 -     if test "$GUI_INC_LOC" = /usr/include; then
2768 -       GUI_INC_LOC=
2769 -       AC_MSG_RESULT(in default path)
2770 -     else
2771 -       AC_MSG_RESULT($GUI_INC_LOC)
2772 -     fi
2773 -   else
2774 -     AC_MSG_RESULT(<not found>)
2775 -     SKIP_MOTIF=YES
2776 -   fi
2777 - fi
2779 - dnl Check for Motif library files location.  In the same order as the include
2780 - dnl files, to avoid a mixup if several versions are present
2782 - if test -z "$SKIP_MOTIF"; then
2783 -   AC_MSG_CHECKING(--with-motif-lib argument)
2784 -   AC_ARG_WITH(motif-lib,
2785 -   [  --with-motif-lib=STRING   Library for Motif ],
2786 -   [ MOTIF_LIBNAME="${withval}" ] )
2788 -   if test -n "$MOTIF_LIBNAME"; then
2789 -     AC_MSG_RESULT($MOTIF_LIBNAME)
2790 -     GUI_LIB_LOC=
2791 -   else
2792 -     AC_MSG_RESULT(no)
2794 -     dnl Remove "-L" from before $GUI_LIB_LOC if it's there
2795 -     GUI_LIB_LOC="`echo $GUI_LIB_LOC|sed 's%-L%%g'`"
2797 -     dnl Ubuntu has libXm.so in /usr/lib/i386-linux-gnu and elsewhere.  The
2798 -     dnl linker will figure out which one to use, we only check if one exists.
2799 -     AC_MSG_CHECKING(for location of Motif GUI libs)
2800 -     gui_libs="`echo $x_libraries|sed 's%/[^/][^/]*$%%'` `echo "$gui_XXX" | sed s/XXX/lib/g` /usr/lib/i386-linux-gnu /usr/lib/x86_64-linux-gnu `echo "$GUI_INC_LOC" | sed s/include/lib/` $GUI_LIB_LOC"
2801 -     GUI_LIB_LOC=
2802 -     for try in $gui_libs; do
2803 -       for libtry in "$try"/libXm.a "$try"/libXm.so* "$try"/libXm.sl "$try"/libXm.dylib; do
2804 -       if test -f "$libtry"; then
2805 -         GUI_LIB_LOC=$try
2806 -       fi
2807 -       done
2808 -     done
2809 -     if test -n "$GUI_LIB_LOC"; then
2810 -       dnl Remove /usr/lib, it causes trouble on some systems
2811 -       if test "$GUI_LIB_LOC" = /usr/lib \
2812 -          -o "$GUI_LIB_LOC" = /usr/lib/i386-linux-gnu \
2813 -          -o "$GUI_LIB_LOC" = /usr/lib/x86_64-linux-gnu; then
2814 -       GUI_LIB_LOC=
2815 -       AC_MSG_RESULT(in default path)
2816 -       else
2817 -       if test -n "$GUI_LIB_LOC"; then
2818 -         AC_MSG_RESULT($GUI_LIB_LOC)
2819 -         if test "`(uname) 2>/dev/null`" = SunOS &&
2820 -                                        uname -r | grep '^5' >/dev/null; then
2821 -           GUI_LIB_LOC="$GUI_LIB_LOC -R $GUI_LIB_LOC"
2822 -         fi
2823 -       fi
2824 -       fi
2825 -       MOTIF_LIBNAME=-lXm
2826 -     else
2827 -       AC_MSG_RESULT(<not found>)
2828 -       SKIP_MOTIF=YES
2829 -     fi
2830 -   fi
2831 - fi
2833 - if test -z "$SKIP_MOTIF"; then
2834 -   SKIP_ATHENA=YES
2835 -   SKIP_NEXTAW=YES
2836 -   GUITYPE=MOTIF
2837 -   AC_SUBST(MOTIF_LIBNAME)
2838 - fi
2840 - dnl Check if the Athena files can be found
2842 - GUI_X_LIBS=
2844 - if test -z "$SKIP_ATHENA"; then
2845 -   AC_MSG_CHECKING(if Athena header files can be found)
2846 -   cflags_save=$CFLAGS
2847 -   CFLAGS="$CFLAGS $X_CFLAGS"
2848 -   AC_TRY_COMPILE([
2849 - #include <X11/Intrinsic.h>
2850 - #include <X11/Xaw/Paned.h>], ,
2851 -       AC_MSG_RESULT(yes),
2852 -       AC_MSG_RESULT(no); SKIP_ATHENA=YES )
2853 -   CFLAGS=$cflags_save
2854 - fi
2856 - if test -z "$SKIP_ATHENA"; then
2857 -   GUITYPE=ATHENA
2858 - fi
2860 - if test -z "$SKIP_NEXTAW"; then
2861 -   AC_MSG_CHECKING(if neXtaw header files can be found)
2862 -   cflags_save=$CFLAGS
2863 -   CFLAGS="$CFLAGS $X_CFLAGS"
2864 -   AC_TRY_COMPILE([
2865 - #include <X11/Intrinsic.h>
2866 - #include <X11/neXtaw/Paned.h>], ,
2867 -       AC_MSG_RESULT(yes),
2868 -       AC_MSG_RESULT(no); SKIP_NEXTAW=YES )
2869 -   CFLAGS=$cflags_save
2870 - fi
2872 - if test -z "$SKIP_NEXTAW"; then
2873 -   GUITYPE=NEXTAW
2874 - fi
2876 - if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
2877 -   dnl Prepend -I and -L to $GUI_INC_LOC and $GUI_LIB_LOC if not empty
2878 -   dnl Avoid adding it when it twice
2879 -   if test -n "$GUI_INC_LOC"; then
2880 -     GUI_INC_LOC=-I"`echo $GUI_INC_LOC|sed 's%-I%%'`"
2881 -   fi
2882 -   if test -n "$GUI_LIB_LOC"; then
2883 -     GUI_LIB_LOC=-L"`echo $GUI_LIB_LOC|sed 's%-L%%'`"
2884 -   fi
2886 -   dnl Check for -lXext and then for -lXmu
2887 -   ldflags_save=$LDFLAGS
2888 -   LDFLAGS="$X_LIBS $LDFLAGS"
2889 -   AC_CHECK_LIB(Xext, XShapeQueryExtension, [GUI_X_LIBS="-lXext"],,
2890 -               [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
2891 -   dnl For Solaris we need -lw and -ldl before linking with -lXmu works.
2892 -   AC_CHECK_LIB(w, wslen, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lw"],,
2893 -               [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
2894 -   AC_CHECK_LIB(dl, dlsym, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldl"],,
2895 -               [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
2896 -   AC_CHECK_LIB(Xmu, XmuCreateStippledPixmap, [GUI_X_LIBS="-lXmu $GUI_X_LIBS"],,
2897 -               [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
2898 -   if test -z "$SKIP_MOTIF"; then
2899 -     AC_CHECK_LIB(Xp, XpEndJob, [GUI_X_LIBS="-lXp $GUI_X_LIBS"],,
2900 -               [$GUI_X_LIBS -lXm -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
2901 -   fi
2902 -   LDFLAGS=$ldflags_save
2904 -   dnl Execute xmkmf to figure out if -DNARROWPROTO is needed.
2905 -   AC_MSG_CHECKING(for extra X11 defines)
2906 -   NARROW_PROTO=
2907 -   rm -fr conftestdir
2908 -   if mkdir conftestdir; then
2909 -     cd conftestdir
2910 -     cat > Imakefile <<'EOF'
2911 - acfindx:
2912 -       @echo 'NARROW_PROTO="${PROTO_DEFINES}"'
2913 - EOF
2914 -     if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
2915 -       eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
2916 -     fi
2917 -     cd ..
2918 -     rm -fr conftestdir
2919 -   fi
2920 -   if test -z "$NARROW_PROTO"; then
2921 -     AC_MSG_RESULT(no)
2922 -   else
2923 -     AC_MSG_RESULT($NARROW_PROTO)
2924 -   fi
2925 -   AC_SUBST(NARROW_PROTO)
2926 - fi
2928 - dnl Look for XSMP support - but don't necessarily restrict it to X11 GUIs
2929 - dnl use the X11 include path
2930 - if test "$enable_xsmp" = "yes"; then
2931 -   cppflags_save=$CPPFLAGS
2932 -   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
2933 -   AC_CHECK_HEADERS(X11/SM/SMlib.h)
2934 -   CPPFLAGS=$cppflags_save
2935 - fi
2938 - if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF" -o -z "$SKIP_GTK2" -o -z "$SKIP_GTK3"; then
2939 -   dnl Check for X11/xpm.h and X11/Sunkeysym.h with the GUI include path
2940 -   cppflags_save=$CPPFLAGS
2941 -   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
2942 -   AC_CHECK_HEADERS(X11/xpm.h X11/Sunkeysym.h)
2944 -   dnl automatically disable XIM when XIMtext isn't in X11/Xlib.h
2945 -   if test ! "$enable_xim" = "no"; then
2946 -     AC_MSG_CHECKING(for XIMText in X11/Xlib.h)
2947 -     AC_EGREP_CPP(XIMText, [#include <X11/Xlib.h>],
2948 -                 AC_MSG_RESULT(yes),
2949 -                 AC_MSG_RESULT(no; xim has been disabled); enable_xim="no")
2950 -   fi
2951 -   CPPFLAGS=$cppflags_save
2953 -   dnl automatically enable XIM when hangul input isn't enabled
2954 -   if test "$enable_xim" = "auto" -a "$enable_hangulinput" != "yes" \
2955 -               -a "x$GUITYPE" != "xNONE" ; then
2956 -     AC_MSG_RESULT(X GUI selected; xim has been enabled)
2957 -     enable_xim="yes"
2958 -   fi
2959 - fi
2961 - if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
2962 -   cppflags_save=$CPPFLAGS
2963 -   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
2964 - dnl Xmu/Editres.h may exist but can only be used after including Intrinsic.h
2965 -   AC_MSG_CHECKING([for X11/Xmu/Editres.h])
2966 -   AC_TRY_COMPILE([
2967 - #include <X11/Intrinsic.h>
2968 - #include <X11/Xmu/Editres.h>],
2969 -                     [int i; i = 0;],
2970 -             AC_MSG_RESULT(yes)
2971 -                     AC_DEFINE(HAVE_X11_XMU_EDITRES_H),
2972 -             AC_MSG_RESULT(no))
2973 -   CPPFLAGS=$cppflags_save
2974 - fi
2976 - dnl Only use the Xm directory when compiling Motif, don't use it for Athena
2977 - if test -z "$SKIP_MOTIF"; then
2978 -   cppflags_save=$CPPFLAGS
2979 -   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
2980 -   if test "$zOSUnix" = "yes"; then
2981 -       xmheader="Xm/Xm.h"
2982 -   else
2983 -       xmheader="Xm/Xm.h Xm/XpmP.h Xm/JoinSideT.h Xm/TraitP.h Xm/Manager.h
2984 -          Xm/UnhighlightT.h Xm/Notebook.h"  
2985 -   fi    
2986 -   AC_CHECK_HEADERS($xmheader)
2988 -   if test "x$ac_cv_header_Xm_XpmP_h" = "xyes"; then
2989 -     dnl Solaris uses XpmAttributes_21, very annoying.
2990 -     AC_MSG_CHECKING([for XpmAttributes_21 in Xm/XpmP.h])
2991 -     AC_TRY_COMPILE([#include <Xm/XpmP.h>], [XpmAttributes_21 attr;],
2992 -       AC_MSG_RESULT(yes); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes_21),
2993 -       AC_MSG_RESULT(no); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes)
2994 -       )
2995 -   else
2996 -     AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes)
2997 -   fi
2998 -   CPPFLAGS=$cppflags_save
2999 - fi
3001 - if test "x$GUITYPE" = "xNONE" -a "$enable_xim" = "yes"; then
3002 -   AC_MSG_RESULT(no GUI selected; xim has been disabled)
3003 -   enable_xim="no"
3004 - fi
3005 - if test "x$GUITYPE" = "xNONE" -a "$enable_fontset" = "yes"; then
3006 -   AC_MSG_RESULT(no GUI selected; fontset has been disabled)
3007 -   enable_fontset="no"
3008 - fi
3009 - if test "x$GUITYPE:$enable_fontset" = "xGTK:yes"; then
3010 -   AC_MSG_RESULT(GTK+ 2 GUI selected; fontset has been disabled)
3011 -   enable_fontset="no"
3012 - fi
3014 - if test -z "$SKIP_PHOTON"; then
3015 -   GUITYPE=PHOTONGUI
3016 - fi
3018 - AC_SUBST(GUI_INC_LOC)
3019 - AC_SUBST(GUI_LIB_LOC)
3020 - AC_SUBST(GUITYPE)
3021 - AC_SUBST(GUI_X_LIBS)
3023 - if test "$enable_workshop" = "yes" -a -n "$SKIP_MOTIF"; then
3024 -   AC_MSG_ERROR([cannot use workshop without Motif])
3025 - fi
3027 - dnl defining FEAT_XIM and FEAT_XFONTSET is delayed, so that they can be disabled
3028 - if test "$enable_xim" = "yes"; then
3029 -   AC_DEFINE(FEAT_XIM)
3030 - fi
3031 - if test "$enable_fontset" = "yes"; then
3032 -   AC_DEFINE(FEAT_XFONTSET)
3033 - fi
3036 - dnl ---------------------------------------------------------------------------
3037 - dnl end of GUI-checking
3038 - dnl ---------------------------------------------------------------------------
3040 - dnl Check for Cygwin, which needs an extra source file if not using X11
3041 - AC_MSG_CHECKING(for CYGWIN or MSYS environment)
3042 - case `uname` in
3043 -     CYGWIN*|MSYS*)    CYGWIN=yes; AC_MSG_RESULT(yes)
3044 -                 AC_MSG_CHECKING(for CYGWIN clipboard support)
3045 -                 if test "x$with_x" = "xno" ; then
3046 -                   OS_EXTRA_SRC=winclip.c; OS_EXTRA_OBJ=objects/winclip.o
3047 -                   AC_MSG_RESULT(yes)
3048 -                   AC_DEFINE(FEAT_CYGWIN_WIN32_CLIPBOARD)
3049 -                 else
3050 -                   AC_MSG_RESULT(no - using X11)
3051 -                 fi ;;
3053 -     *)          CYGWIN=no; AC_MSG_RESULT(no);;
3054 - esac
3056 - dnl Only really enable hangul input when GUI and XFONTSET are available
3057 - if test "$enable_hangulinput" = "yes"; then
3058 -   if test "x$GUITYPE" = "xNONE"; then
3059 -     AC_MSG_RESULT(no GUI selected; hangul input has been disabled)
3060 -     enable_hangulinput=no
3061 -   else
3062 -     AC_DEFINE(FEAT_HANGULIN)
3063 -     HANGULIN_SRC=hangulin.c
3064 -     AC_SUBST(HANGULIN_SRC)
3065 -     HANGULIN_OBJ=objects/hangulin.o
3066 -     AC_SUBST(HANGULIN_OBJ)
3067 -   fi
3068 - fi
3070 - dnl Checks for libraries and include files.
3072 - AC_CACHE_CHECK([whether toupper is broken], [vim_cv_toupper_broken],
3073 -   [
3074 -     AC_RUN_IFELSE([AC_LANG_SOURCE([[
3075 - #include "confdefs.h"
3076 - #include <ctype.h>
3077 - #if STDC_HEADERS
3078 - # include <stdlib.h>
3079 - # include <stddef.h>
3080 - #endif
3081 - main() { exit(toupper('A') == 'A' && tolower('z') == 'z'); }
3082 -   ]])],[
3083 -     vim_cv_toupper_broken=yes
3084 -   ],[
3085 -     vim_cv_toupper_broken=no
3086 -   ],[
3087 -     AC_MSG_ERROR(cross-compiling: please set 'vim_cv_toupper_broken')
3088 -   ])])
3090 - if test "x$vim_cv_toupper_broken" = "xyes" ; then
3091 -   AC_DEFINE(BROKEN_TOUPPER)
3092 - fi
3094 - AC_MSG_CHECKING(whether __DATE__ and __TIME__ work)
3095 - AC_TRY_COMPILE([#include <stdio.h>], [printf("(" __DATE__ " " __TIME__ ")");],
3096 -       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_DATE_TIME),
3097 -       AC_MSG_RESULT(no))
3099 - AC_MSG_CHECKING(whether __attribute__((unused)) is allowed)
3100 - AC_TRY_COMPILE([#include <stdio.h>], [int x __attribute__((unused));],
3101 -       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ATTRIBUTE_UNUSED),
3102 -       AC_MSG_RESULT(no))
3104 - dnl Checks for header files.
3105 - AC_CHECK_HEADER(elf.h, HAS_ELF=1)
3106 - dnl AC_CHECK_HEADER(dwarf.h, SVR4=1)
3107 - if test "$HAS_ELF" = 1; then
3108 -   AC_CHECK_LIB(elf, main)
3109 - fi
3111 - AC_HEADER_DIRENT
3113 - dnl If sys/wait.h is not found it might still exist but not be POSIX
3114 - dnl compliant. In that case we define HAVE_UNION_WAIT (for NeXT)
3115 - if test $ac_cv_header_sys_wait_h = no; then
3116 -   AC_MSG_CHECKING([for sys/wait.h that defines union wait])
3117 -   AC_TRY_COMPILE([#include <sys/wait.h>],
3118 -                       [union wait xx, yy; xx = yy],
3119 -               AC_MSG_RESULT(yes)
3120 -                       AC_DEFINE(HAVE_SYS_WAIT_H)
3121 -                       AC_DEFINE(HAVE_UNION_WAIT),
3122 -               AC_MSG_RESULT(no))
3123 - fi
3125 - AC_CHECK_HEADERS(stdint.h stdlib.h string.h \
3126 -       sys/select.h sys/utsname.h termcap.h fcntl.h \
3127 -       sgtty.h sys/ioctl.h sys/time.h sys/types.h \
3128 -       termio.h iconv.h inttypes.h langinfo.h math.h \
3129 -       unistd.h stropts.h errno.h sys/resource.h \
3130 -       sys/systeminfo.h locale.h sys/stream.h termios.h \
3131 -       libc.h sys/statfs.h poll.h sys/poll.h pwd.h \
3132 -       utime.h sys/param.h libintl.h libgen.h \
3133 -       util/debug.h util/msg18n.h frame.h sys/acl.h \
3134 -       sys/access.h sys/sysinfo.h wchar.h wctype.h)
3136 - dnl sys/ptem.h depends on sys/stream.h on Solaris
3137 - AC_CHECK_HEADERS(sys/ptem.h, [], [],
3138 - [#if defined HAVE_SYS_STREAM_H
3139 - #  include <sys/stream.h>
3140 - #endif])
3142 - dnl sys/sysctl.h depends on sys/param.h on OpenBSD
3143 - AC_CHECK_HEADERS(sys/sysctl.h, [], [],
3144 - [#if defined HAVE_SYS_PARAM_H
3145 - #  include <sys/param.h>
3146 - #endif])
3149 - dnl pthread_np.h may exist but can only be used after including pthread.h
3150 - AC_MSG_CHECKING([for pthread_np.h])
3151 - AC_TRY_COMPILE([
3152 - #include <pthread.h>
3153 - #include <pthread_np.h>],
3154 -                     [int i; i = 0;],
3155 -             AC_MSG_RESULT(yes)
3156 -                     AC_DEFINE(HAVE_PTHREAD_NP_H),
3157 -             AC_MSG_RESULT(no))
3159 - AC_CHECK_HEADERS(strings.h)
3160 - if test "x$MACOSX" = "xyes"; then
3161 -   dnl The strings.h file on OS/X contains a warning and nothing useful.
3162 -   AC_DEFINE(NO_STRINGS_WITH_STRING_H)
3163 - else
3165 - dnl Check if strings.h and string.h can both be included when defined.
3166 - AC_MSG_CHECKING([if strings.h can be included after string.h])
3167 - cppflags_save=$CPPFLAGS
3168 - CPPFLAGS="$CPPFLAGS $X_CFLAGS"
3169 - AC_TRY_COMPILE([
3170 - #if defined(_AIX) && !defined(_AIX51) && !defined(_NO_PROTO)
3171 - # define _NO_PROTO    /* like in os_unix.h, causes conflict for AIX (Winn) */
3172 -                       /* but don't do it on AIX 5.1 (Uribarri) */
3173 - #endif
3174 - #ifdef HAVE_XM_XM_H
3175 - # include <Xm/Xm.h>   /* This breaks it for HP-UX 11 (Squassabia) */
3176 - #endif
3177 - #ifdef HAVE_STRING_H
3178 - # include <string.h>
3179 - #endif
3180 - #if defined(HAVE_STRINGS_H)
3181 - # include <strings.h>
3182 - #endif
3183 -               ], [int i; i = 0;],
3184 -               AC_MSG_RESULT(yes),
3185 -               AC_DEFINE(NO_STRINGS_WITH_STRING_H)
3186 -               AC_MSG_RESULT(no))
3187 - CPPFLAGS=$cppflags_save
3188 - fi
3190 - dnl Checks for typedefs, structures, and compiler characteristics.
3191 - AC_PROG_GCC_TRADITIONAL
3192 - AC_C_CONST
3193 - AC_C_VOLATILE
3194 - AC_TYPE_MODE_T
3195 - AC_TYPE_OFF_T
3196 - AC_TYPE_PID_T
3197 - AC_TYPE_SIZE_T
3198 - AC_TYPE_UID_T
3199 - AC_TYPE_UINT32_T
3201 - AC_HEADER_TIME
3202 - AC_CHECK_TYPE(ino_t, long)
3203 - AC_CHECK_TYPE(dev_t, unsigned)
3204 - AC_C_BIGENDIAN(,,,)
3205 - AC_C_INLINE
3207 - AC_MSG_CHECKING(for rlim_t)
3208 - if eval "test \"`echo '$''{'ac_cv_type_rlim_t'+set}'`\" = set"; then
3209 -   AC_MSG_RESULT([(cached) $ac_cv_type_rlim_t])
3210 - else
3211 -   AC_EGREP_CPP(dnl
3212 - changequote(<<,>>)dnl
3213 - <<(^|[^a-zA-Z_0-9])rlim_t[^a-zA-Z_0-9]>>dnl
3214 - changequote([,]),
3215 -   [
3216 - #include <sys/types.h>
3217 - #if STDC_HEADERS
3218 - # include <stdlib.h>
3219 - # include <stddef.h>
3220 - #endif
3221 - #ifdef HAVE_SYS_RESOURCE_H
3222 - # include <sys/resource.h>
3223 - #endif
3224 -         ], ac_cv_type_rlim_t=yes, ac_cv_type_rlim_t=no)
3225 -         AC_MSG_RESULT($ac_cv_type_rlim_t)
3226 - fi
3227 - if test $ac_cv_type_rlim_t = no; then
3228 -   cat >> confdefs.h <<\EOF
3229 - #define rlim_t unsigned long
3230 - EOF
3231 - fi
3233 - AC_MSG_CHECKING(for stack_t)
3234 - if eval "test \"`echo '$''{'ac_cv_type_stack_t'+set}'`\" = set"; then
3235 -   AC_MSG_RESULT([(cached) $ac_cv_type_stack_t])
3236 - else
3237 -   AC_EGREP_CPP(stack_t,
3238 -   [
3239 - #include <sys/types.h>
3240 - #if STDC_HEADERS
3241 - # include <stdlib.h>
3242 - # include <stddef.h>
3243 - #endif
3244 - #include <signal.h>
3245 -         ], ac_cv_type_stack_t=yes, ac_cv_type_stack_t=no)
3246 -         AC_MSG_RESULT($ac_cv_type_stack_t)
3247 - fi
3248 - if test $ac_cv_type_stack_t = no; then
3249 -   cat >> confdefs.h <<\EOF
3250 - #define stack_t struct sigaltstack
3251 - EOF
3252 - fi
3254 - dnl BSDI uses ss_base while others use ss_sp for the stack pointer.
3255 - AC_MSG_CHECKING(whether stack_t has an ss_base field)
3256 - AC_TRY_COMPILE([
3257 - #include <sys/types.h>
3258 - #if STDC_HEADERS
3259 - # include <stdlib.h>
3260 - # include <stddef.h>
3261 - #endif
3262 - #include <signal.h>
3263 - #include "confdefs.h"
3264 -                       ], [stack_t sigstk; sigstk.ss_base = 0; ],
3265 -       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SS_BASE),
3266 -       AC_MSG_RESULT(no))
3268 - olibs="$LIBS"
3269 - AC_MSG_CHECKING(--with-tlib argument)
3270 - AC_ARG_WITH(tlib, [  --with-tlib=library     terminal library to be used ],)
3271 - if test -n "$with_tlib"; then
3272 -   AC_MSG_RESULT($with_tlib)
3273 -   LIBS="$LIBS -l$with_tlib"
3274 -   AC_MSG_CHECKING(for linking with $with_tlib library)
3275 -   AC_TRY_LINK([], [], AC_MSG_RESULT(OK), AC_MSG_ERROR(FAILED))
3276 -   dnl Need to check for tgetent() below.
3277 -   olibs="$LIBS"
3278 - else
3279 -   AC_MSG_RESULT([empty: automatic terminal library selection])
3280 -   dnl  On HP-UX 10.10 termcap or termlib should be used instead of
3281 -   dnl  curses, because curses is much slower.
3282 -   dnl  Newer versions of ncurses are preferred over anything, except
3283 -   dnl  when tinfo has been split off, it contains all we need.
3284 -   dnl  Older versions of ncurses have bugs, get a new one!
3285 -   dnl  Digital Unix (OSF1) should use curses (Ronald Schild).
3286 -   dnl  On SCO Openserver should prefer termlib (Roger Cornelius).
3287 -   case "`uname -s 2>/dev/null`" in
3288 -       OSF1|SCO_SV)    tlibs="tinfo ncurses curses termlib termcap";;
3289 -       *)      tlibs="tinfo ncurses termlib termcap curses";;
3290 -   esac
3291 -   for libname in $tlibs; do
3292 -     AC_CHECK_LIB(${libname}, tgetent,,)
3293 -     if test "x$olibs" != "x$LIBS"; then
3294 -       dnl It's possible that a library is found but it doesn't work
3295 -       dnl e.g., shared library that cannot be found
3296 -       dnl compile and run a test program to be sure
3297 -       AC_TRY_RUN([
3298 - #ifdef HAVE_TERMCAP_H
3299 - # include <termcap.h>
3300 - #endif
3301 - #if STDC_HEADERS
3302 - # include <stdlib.h>
3303 - # include <stddef.h>
3304 - #endif
3305 - main() {char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(0); }],
3306 -                         res="OK", res="FAIL", res="FAIL")
3307 -       if test "$res" = "OK"; then
3308 -       break
3309 -       fi
3310 -       AC_MSG_RESULT($libname library is not usable)
3311 -       LIBS="$olibs"
3312 -     fi
3313 -   done
3314 -   if test "x$olibs" = "x$LIBS"; then
3315 -     AC_MSG_RESULT(no terminal library found)
3316 -   fi
3317 - fi
3319 - if test "x$olibs" = "x$LIBS"; then
3320 -   AC_MSG_CHECKING([for tgetent()])
3321 -   AC_TRY_LINK([],
3322 -       [char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist");],
3323 -       AC_MSG_RESULT(yes),
3324 -       AC_MSG_ERROR([NOT FOUND!
3325 -       You need to install a terminal library; for example ncurses.
3326 -       Or specify the name of the library with --with-tlib.]))
3327 - fi
3329 - AC_CACHE_CHECK([whether we talk terminfo], [vim_cv_terminfo],
3330 -   [
3331 -     AC_RUN_IFELSE([AC_LANG_SOURCE([[
3332 - #include "confdefs.h"
3333 - #ifdef HAVE_TERMCAP_H
3334 - # include <termcap.h>
3335 - #endif
3336 - #ifdef HAVE_STRING_H
3337 - # include <string.h>
3338 - #endif
3339 - #if STDC_HEADERS
3340 - # include <stdlib.h>
3341 - # include <stddef.h>
3342 - #endif
3343 - main()
3344 - {char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(!strcmp(s==0 ? "" : s, "1")); }
3345 -     ]])],[
3346 -       vim_cv_terminfo=no
3347 -     ],[
3348 -       vim_cv_terminfo=yes
3349 -     ],[
3350 -       AC_MSG_ERROR(cross-compiling: please set 'vim_cv_terminfo')
3351 -     ])
3352 -   ])
3354 - if test "x$vim_cv_terminfo" = "xyes" ; then
3355 -   AC_DEFINE(TERMINFO)
3356 - fi
3358 - if test "x$olibs" != "x$LIBS"; then
3359 -   AC_CACHE_CHECK([what tgetent() returns for an unknown terminal], [vim_cv_tgent],
3360 -     [
3361 -       AC_RUN_IFELSE([AC_LANG_SOURCE([[
3362 - #include "confdefs.h"
3363 - #ifdef HAVE_TERMCAP_H
3364 - # include <termcap.h>
3365 - #endif
3366 - #if STDC_HEADERS
3367 - # include <stdlib.h>
3368 - # include <stddef.h>
3369 - #endif
3370 - main()
3371 - {char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist"); exit(res != 0); }
3372 -       ]])],[
3373 -       vim_cv_tgent=zero
3374 -       ],[
3375 -       vim_cv_tgent=non-zero
3376 -       ],[
3377 -       AC_MSG_ERROR(failed to compile test program.)
3378 -       ])
3379 -     ])
3380 -   
3381 -   if test "x$vim_cv_tgent" = "xzero" ; then
3382 -     AC_DEFINE(TGETENT_ZERO_ERR, 0)
3383 -   fi
3384 - fi
3386 - AC_MSG_CHECKING(whether termcap.h contains ospeed)
3387 - AC_TRY_LINK([
3388 - #ifdef HAVE_TERMCAP_H
3389 - # include <termcap.h>
3390 - #endif
3391 -                       ], [ospeed = 20000],
3392 -       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OSPEED),
3393 -       [AC_MSG_RESULT(no)
3394 -       AC_MSG_CHECKING(whether ospeed can be extern)
3395 -       AC_TRY_LINK([
3396 - #ifdef HAVE_TERMCAP_H
3397 - # include <termcap.h>
3398 - #endif
3399 - extern short ospeed;
3400 -                       ], [ospeed = 20000],
3401 -               AC_MSG_RESULT(yes); AC_DEFINE(OSPEED_EXTERN),
3402 -               AC_MSG_RESULT(no))]
3403 -       )
3405 - AC_MSG_CHECKING([whether termcap.h contains UP, BC and PC])
3406 - AC_TRY_LINK([
3407 - #ifdef HAVE_TERMCAP_H
3408 - # include <termcap.h>
3409 - #endif
3410 -                       ], [if (UP == 0 && BC == 0) PC = 1],
3411 -       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_UP_BC_PC),
3412 -       [AC_MSG_RESULT(no)
3413 -       AC_MSG_CHECKING([whether UP, BC and PC can be extern])
3414 -       AC_TRY_LINK([
3415 - #ifdef HAVE_TERMCAP_H
3416 - # include <termcap.h>
3417 - #endif
3418 - extern char *UP, *BC, PC;
3419 -                       ], [if (UP == 0 && BC == 0) PC = 1],
3420 -               AC_MSG_RESULT(yes); AC_DEFINE(UP_BC_PC_EXTERN),
3421 -               AC_MSG_RESULT(no))]
3422 -       )
3424 - AC_MSG_CHECKING(whether tputs() uses outfuntype)
3425 - AC_TRY_COMPILE([
3426 - #ifdef HAVE_TERMCAP_H
3427 - # include <termcap.h>
3428 - #endif
3429 -                       ], [extern int xx(); tputs("test", 1, (outfuntype)xx)],
3430 -       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OUTFUNTYPE),
3431 -       AC_MSG_RESULT(no))
3433 - dnl On some SCO machines sys/select redefines struct timeval
3434 - AC_MSG_CHECKING([whether sys/select.h and sys/time.h may both be included])
3435 - AC_TRY_COMPILE([
3436 - #include <sys/types.h>
3437 - #include <sys/time.h>
3438 - #include <sys/select.h>], ,
3439 -         AC_MSG_RESULT(yes)
3440 -                       AC_DEFINE(SYS_SELECT_WITH_SYS_TIME),
3441 -         AC_MSG_RESULT(no))
3443 - dnl AC_DECL_SYS_SIGLIST
3445 - dnl Checks for pty.c (copied from screen) ==========================
3446 - AC_MSG_CHECKING(for /dev/ptc)
3447 - if test -r /dev/ptc; then
3448 -   AC_DEFINE(HAVE_DEV_PTC)
3449 -   AC_MSG_RESULT(yes)
3450 - else
3451 -   AC_MSG_RESULT(no)
3452 - fi
3454 - AC_MSG_CHECKING(for SVR4 ptys)
3455 - if test -c /dev/ptmx ; then
3456 -   AC_TRY_LINK([], [ptsname(0);grantpt(0);unlockpt(0);],
3457 -       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SVR4_PTYS),
3458 -       AC_MSG_RESULT(no))
3459 - else
3460 -   AC_MSG_RESULT(no)
3461 - fi
3463 - AC_MSG_CHECKING(for ptyranges)
3464 - if test -d /dev/ptym ; then
3465 -   pdir='/dev/ptym'
3466 - else
3467 -   pdir='/dev'
3468 - fi
3469 - dnl SCO uses ptyp%d
3470 - AC_EGREP_CPP(yes,
3471 - [#ifdef M_UNIX
3472 -    yes;
3473 - #endif
3474 -       ], ptys=`echo /dev/ptyp??`, ptys=`echo $pdir/pty??`)
3475 - dnl if test -c /dev/ptyp19; then
3476 - dnl ptys=`echo /dev/ptyp??`
3477 - dnl else
3478 - dnl ptys=`echo $pdir/pty??`
3479 - dnl fi
3480 - if test "$ptys" != "$pdir/pty??" ; then
3481 -   p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'`
3482 -   p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g'  | sort -u | tr -d '\012'`
3483 -   AC_DEFINE_UNQUOTED(PTYRANGE0,"$p0")
3484 -   AC_DEFINE_UNQUOTED(PTYRANGE1,"$p1")
3485 -   AC_MSG_RESULT([$p0 / $p1])
3486 - else
3487 -   AC_MSG_RESULT([don't know])
3488 - fi
3490 - dnl    ****  pty mode/group handling ****
3491 - dnl
3492 - dnl support provided by Luke Mewburn <lm@rmit.edu.au>, 931222
3493 - rm -f conftest_grp
3494 - AC_CACHE_CHECK([default tty permissions/group], [vim_cv_tty_group],
3495 -   [
3496 -     AC_RUN_IFELSE([AC_LANG_SOURCE([[
3497 - #include "confdefs.h"
3498 - #include <sys/types.h>
3499 - #if STDC_HEADERS
3500 - # include <stdlib.h>
3501 - # include <stddef.h>
3502 - #endif
3503 - #ifdef HAVE_UNISTD_H
3504 - #include <unistd.h>
3505 - #endif
3506 - #include <sys/stat.h>
3507 - #include <stdio.h>
3508 - main()
3509 - {
3510 -   struct stat sb;
3511 -   char *x,*ttyname();
3512 -   int om, m;
3513 -   FILE *fp;
3515 -   if (!(x = ttyname(0))) exit(1);
3516 -   if (stat(x, &sb)) exit(1);
3517 -   om = sb.st_mode;
3518 -   if (om & 002) exit(0);
3519 -   m = system("mesg y");
3520 -   if (m == -1 || m == 127) exit(1);
3521 -   if (stat(x, &sb)) exit(1);
3522 -   m = sb.st_mode;
3523 -   if (chmod(x, om)) exit(1);
3524 -   if (m & 002) exit(0);
3525 -   if (sb.st_gid == getgid()) exit(1);
3526 -   if (!(fp=fopen("conftest_grp", "w")))
3527 -     exit(1);
3528 -   fprintf(fp, "%d\n", sb.st_gid);
3529 -   fclose(fp);
3530 -   exit(0);
3531 - }
3532 -     ]])],[
3533 -       if test -f conftest_grp; then
3534 -       vim_cv_tty_group=`cat conftest_grp`
3535 -       if test "x$vim_cv_tty_mode" = "x" ; then
3536 -         vim_cv_tty_mode=0620
3537 -       fi
3538 -       AC_MSG_RESULT([pty mode: $vim_cv_tty_mode, group: $vim_cv_tty_group])
3539 -       else
3540 -       vim_cv_tty_group=world
3541 -       AC_MSG_RESULT([ptys are world accessible])
3542 -       fi
3543 -     ],[
3544 -       vim_cv_tty_group=world
3545 -       AC_MSG_RESULT([can't determine - assume ptys are world accessible])
3546 -     ],[
3547 -       AC_MSG_ERROR(cross-compiling: please set 'vim_cv_tty_group' and 'vim_cv_tty_mode')
3548 -     ])
3549 -   ])
3550 - rm -f conftest_grp
3552 - if test "x$vim_cv_tty_group" != "xworld" ; then
3553 -   AC_DEFINE_UNQUOTED(PTYGROUP,$vim_cv_tty_group)
3554 -   if test "x$vim_cv_tty_mode" = "x" ; then
3555 -     AC_MSG_ERROR([It seems you're cross compiling and have 'vim_cv_tty_group' set, please also set the environment variable 'vim_cv_tty_mode' to the correct mode (probably 0620)])
3556 -   else
3557 -     AC_DEFINE(PTYMODE, 0620)
3558 -   fi
3559 - fi
3561 - dnl Checks for library functions. ===================================
3563 - AC_TYPE_SIGNAL
3565 - dnl find out what to use at the end of a signal function
3566 - if test $ac_cv_type_signal = void; then
3567 -   AC_DEFINE(SIGRETURN, [return])
3568 - else
3569 -   AC_DEFINE(SIGRETURN, [return 0])
3570 - fi
3572 - dnl check if struct sigcontext is defined (used for SGI only)
3573 - AC_MSG_CHECKING(for struct sigcontext)
3574 - AC_TRY_COMPILE([
3575 - #include <signal.h>
3576 - test_sig()
3577 - {
3578 -     struct sigcontext *scont;
3579 -     scont = (struct sigcontext *)0;
3580 -     return 1;
3581 - } ], ,
3582 -         AC_MSG_RESULT(yes)
3583 -               AC_DEFINE(HAVE_SIGCONTEXT),
3584 -         AC_MSG_RESULT(no))
3586 - dnl tricky stuff: try to find out if getcwd() is implemented with
3587 - dnl system("sh -c pwd")
3588 - AC_CACHE_CHECK([getcwd implementation is broken], [vim_cv_getcwd_broken],
3589 -   [
3590 -     AC_RUN_IFELSE([AC_LANG_SOURCE([[
3591 - #include "confdefs.h"
3592 - #ifdef HAVE_UNISTD_H
3593 - #include <unistd.h>
3594 - #endif
3595 - char *dagger[] = { "IFS=pwd", 0 };
3596 - main()
3597 - {
3598 -   char buffer[500];
3599 -   extern char **environ;
3600 -   environ = dagger;
3601 -   return getcwd(buffer, 500) ? 0 : 1;
3602 - }
3603 -     ]])],[
3604 -       vim_cv_getcwd_broken=no
3605 -     ],[
3606 -       vim_cv_getcwd_broken=yes
3607 -     ],[
3608 -       AC_MSG_ERROR(cross-compiling: please set 'vim_cv_getcwd_broken')
3609 -     ])
3610 -   ])
3612 - if test "x$vim_cv_getcwd_broken" = "xyes" ; then
3613 -   AC_DEFINE(BAD_GETCWD)
3614 - fi
3616 - dnl Check for functions in one big call, to reduce the size of configure.
3617 - dnl Can only be used for functions that do not require any include.
3618 - AC_CHECK_FUNCS(bcmp fchdir fchown fsync getcwd getpseudotty \
3619 -       getpwent getpwnam getpwuid getrlimit gettimeofday getwd lstat memcmp \
3620 -       memset mkdtemp nanosleep opendir putenv qsort readlink select setenv \
3621 -       setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \
3622 -       sigprocmask sigvec strcasecmp strerror strftime stricmp strncasecmp \
3623 -       strnicmp strpbrk strtol tgetent towlower towupper iswupper \
3624 -       usleep utime utimes)
3625 - AC_FUNC_FSEEKO
3627 - dnl define _LARGE_FILES, _FILE_OFFSET_BITS and _LARGEFILE_SOURCE when
3628 - dnl appropriate, so that off_t is 64 bits when needed.
3629 - AC_SYS_LARGEFILE
3631 - dnl fstatfs() can take 2 to 4 arguments, try to use st_blksize if possible
3632 - AC_MSG_CHECKING(for st_blksize)
3633 - AC_TRY_COMPILE(
3634 - [#include <sys/types.h>
3635 - #include <sys/stat.h>],
3636 - [     struct stat st;
3637 -       int n;
3639 -       stat("/", &st);
3640 -       n = (int)st.st_blksize;],
3641 -       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ST_BLKSIZE),
3642 -       AC_MSG_RESULT(no))
3644 - AC_CACHE_CHECK([whether stat() ignores a trailing slash], [vim_cv_stat_ignores_slash],
3645 -   [
3646 -     AC_RUN_IFELSE([AC_LANG_SOURCE([[
3647 - #include "confdefs.h"
3648 - #if STDC_HEADERS
3649 - # include <stdlib.h>
3650 - # include <stddef.h>
3651 - #endif
3652 - #include <sys/types.h>
3653 - #include <sys/stat.h>
3654 - main() {struct stat st;  exit(stat("configure/", &st) != 0); }
3655 -     ]])],[
3656 -       vim_cv_stat_ignores_slash=yes
3657 -     ],[
3658 -       vim_cv_stat_ignores_slash=no
3659 -     ],[
3660 -       AC_MSG_ERROR(cross-compiling: please set 'vim_cv_stat_ignores_slash')
3661 -     ])
3662 -   ])
3664 - if test "x$vim_cv_stat_ignores_slash" = "xyes" ; then
3665 -   AC_DEFINE(STAT_IGNORES_SLASH)
3666 - fi
3667 -   
3668 - dnl Link with iconv for charset translation, if not found without library.
3669 - dnl check for iconv() requires including iconv.h
3670 - dnl Add "-liconv" when possible; Solaris has iconv but use GNU iconv when it
3671 - dnl has been installed.
3672 - AC_MSG_CHECKING(for iconv_open())
3673 - save_LIBS="$LIBS"
3674 - LIBS="$LIBS -liconv"
3675 - AC_TRY_LINK([
3676 - #ifdef HAVE_ICONV_H
3677 - # include <iconv.h>
3678 - #endif
3679 -     ], [iconv_open("fr", "to");],
3680 -     AC_MSG_RESULT(yes; with -liconv); AC_DEFINE(HAVE_ICONV),
3681 -     LIBS="$save_LIBS"
3682 -     AC_TRY_LINK([
3683 - #ifdef HAVE_ICONV_H
3684 - # include <iconv.h>
3685 - #endif
3686 -       ], [iconv_open("fr", "to");],
3687 -       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ICONV),
3688 -       AC_MSG_RESULT(no)))
3691 - AC_MSG_CHECKING(for nl_langinfo(CODESET))
3692 - AC_TRY_LINK([
3693 - #ifdef HAVE_LANGINFO_H
3694 - # include <langinfo.h>
3695 - #endif
3696 - ], [char *cs = nl_langinfo(CODESET);],
3697 -       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_NL_LANGINFO_CODESET),
3698 -       AC_MSG_RESULT(no))
3700 - dnl Need various functions for floating point support.  Only enable
3701 - dnl floating point when they are all present.
3702 - AC_CHECK_LIB(m, strtod)
3703 - AC_MSG_CHECKING([for strtod() and other floating point functions])
3704 - AC_TRY_LINK([
3705 - #ifdef HAVE_MATH_H
3706 - # include <math.h>
3707 - #endif
3708 - #if STDC_HEADERS
3709 - # include <stdlib.h>
3710 - # include <stddef.h>
3711 - #endif
3712 - ], [char *s; double d;
3713 -     d = strtod("1.1", &s);
3714 -     d = fabs(1.11);
3715 -     d = ceil(1.11);
3716 -     d = floor(1.11);
3717 -     d = log10(1.11);
3718 -     d = pow(1.11, 2.22);
3719 -     d = sqrt(1.11);
3720 -     d = sin(1.11);
3721 -     d = cos(1.11);
3722 -     d = atan(1.11);
3723 -     ],
3724 -       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FLOAT_FUNCS),
3725 -       AC_MSG_RESULT(no))
3727 - dnl isinf() and isnan() need to include header files and may need -lm.
3728 - AC_MSG_CHECKING([for isinf()])
3729 - AC_TRY_LINK([
3730 - #ifdef HAVE_MATH_H
3731 - # include <math.h>
3732 - #endif
3733 - #if STDC_HEADERS
3734 - # include <stdlib.h>
3735 - # include <stddef.h>
3736 - #endif
3737 - ], [int r = isinf(1.11); ],
3738 -       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ISINF),
3739 -       AC_MSG_RESULT(no))
3741 - AC_MSG_CHECKING([for isnan()])
3742 - AC_TRY_LINK([
3743 - #ifdef HAVE_MATH_H
3744 - # include <math.h>
3745 - #endif
3746 - #if STDC_HEADERS
3747 - # include <stdlib.h>
3748 - # include <stddef.h>
3749 - #endif
3750 - ], [int r = isnan(1.11); ],
3751 -       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ISNAN),
3752 -       AC_MSG_RESULT(no))
3754 - dnl Link with -lposix1e for ACL stuff; if not found, try -lacl for SGI
3755 - dnl when -lacl works, also try to use -lattr (required for Debian).
3756 - dnl On Solaris, use the acl_get/set functions in libsec, if present.
3757 - AC_MSG_CHECKING(--disable-acl argument)
3758 - AC_ARG_ENABLE(acl,
3759 -       [  --disable-acl           Don't check for ACL support.],
3760 -       , [enable_acl="yes"])
3761 - if test "$enable_acl" = "yes"; then
3762 - AC_MSG_RESULT(no)
3763 - AC_CHECK_LIB(posix1e, acl_get_file, [LIBS="$LIBS -lposix1e"],
3764 -       AC_CHECK_LIB(acl, acl_get_file, [LIBS="$LIBS -lacl"
3765 -                 AC_CHECK_LIB(attr, fgetxattr, LIBS="$LIBS -lattr",,)],,),)
3767 - AC_MSG_CHECKING(for POSIX ACL support)
3768 - AC_TRY_LINK([
3769 - #include <sys/types.h>
3770 - #ifdef HAVE_SYS_ACL_H
3771 - # include <sys/acl.h>
3772 - #endif
3773 - acl_t acl;], [acl = acl_get_file("foo", ACL_TYPE_ACCESS);
3774 -       acl_set_file("foo", ACL_TYPE_ACCESS, acl);
3775 -       acl_free(acl);],
3776 -       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_POSIX_ACL),
3777 -       AC_MSG_RESULT(no))
3779 - AC_CHECK_LIB(sec, acl_get, [LIBS="$LIBS -lsec"; AC_DEFINE(HAVE_SOLARIS_ZFS_ACL)],
3780 - AC_MSG_CHECKING(for Solaris ACL support)
3781 - AC_TRY_LINK([
3782 - #ifdef HAVE_SYS_ACL_H
3783 - # include <sys/acl.h>
3784 - #endif], [acl("foo", GETACLCNT, 0, NULL);
3785 -       ],
3786 -       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SOLARIS_ACL),
3787 -       AC_MSG_RESULT(no)))
3789 - AC_MSG_CHECKING(for AIX ACL support)
3790 - AC_TRY_LINK([
3791 - #if STDC_HEADERS
3792 - # include <stdlib.h>
3793 - # include <stddef.h>
3794 - #endif
3795 - #ifdef HAVE_SYS_ACL_H
3796 - # include <sys/acl.h>
3797 - #endif
3798 - #ifdef HAVE_SYS_ACCESS_H
3799 - # include <sys/access.h>
3800 - #endif
3801 - #define _ALL_SOURCE
3803 - #include <sys/stat.h>
3805 - int aclsize;
3806 - struct acl *aclent;], [aclsize = sizeof(struct acl);
3807 -       aclent = (void *)malloc(aclsize);
3808 -       statacl("foo", STX_NORMAL, aclent, aclsize);
3809 -       ],
3810 -       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_AIX_ACL),
3811 -       AC_MSG_RESULT(no))
3812 - else
3813 -   AC_MSG_RESULT(yes)
3814 - fi
3816 - if test "x$GTK_CFLAGS" != "x"; then
3817 -   dnl pango_shape_full() is new, fall back to pango_shape().
3818 -   AC_MSG_CHECKING(for pango_shape_full)
3819 -   ac_save_CFLAGS="$CFLAGS"
3820 -   ac_save_LIBS="$LIBS"
3821 -   CFLAGS="$CFLAGS $GTK_CFLAGS"
3822 -   LIBS="$LIBS $GTK_LIBS"
3823 -   AC_TRY_LINK(
3824 -   [#include <gtk/gtk.h>],
3825 -   [ pango_shape_full(NULL, 0, NULL, 0, NULL, NULL); ],
3826 -         AC_MSG_RESULT(yes); AC_DEFINE(HAVE_PANGO_SHAPE_FULL),
3827 -         AC_MSG_RESULT(no))
3828 -   CFLAGS="$ac_save_CFLAGS"
3829 -   LIBS="$ac_save_LIBS"
3830 - fi
3832 - AC_MSG_CHECKING(--disable-gpm argument)
3833 - AC_ARG_ENABLE(gpm,
3834 -       [  --disable-gpm           Don't use gpm (Linux mouse daemon).], ,
3835 -       [enable_gpm="yes"])
3837 - if test "$enable_gpm" = "yes"; then
3838 -   AC_MSG_RESULT(no)
3839 -   dnl Checking if gpm support can be compiled
3840 -   AC_CACHE_CHECK([for gpm], vi_cv_have_gpm,
3841 -       [olibs="$LIBS" ; LIBS="-lgpm"]
3842 -       AC_TRY_LINK(
3843 -           [#include <gpm.h>
3844 -           #include <linux/keyboard.h>],
3845 -           [Gpm_GetLibVersion(NULL);],
3846 -           dnl Configure defines HAVE_GPM, if it is defined feature.h defines
3847 -           dnl FEAT_MOUSE_GPM if mouse support is included
3848 -           [vi_cv_have_gpm=yes],
3849 -           [vi_cv_have_gpm=no])
3850 -       [LIBS="$olibs"]
3851 -     )
3852 -   if test $vi_cv_have_gpm = yes; then
3853 -     LIBS="$LIBS -lgpm"
3854 -     AC_DEFINE(HAVE_GPM)
3855 -   fi
3856 - else
3857 -   AC_MSG_RESULT(yes)
3858 - fi
3860 - AC_MSG_CHECKING(--disable-sysmouse argument)
3861 - AC_ARG_ENABLE(sysmouse,
3862 -       [  --disable-sysmouse    Don't use sysmouse (mouse in *BSD console).], ,
3863 -       [enable_sysmouse="yes"])
3865 - if test "$enable_sysmouse" = "yes"; then
3866 -   AC_MSG_RESULT(no)
3867 -   dnl Checking if sysmouse support can be compiled
3868 -   dnl Configure defines HAVE_SYSMOUSE, if it is defined feature.h
3869 -   dnl defines FEAT_SYSMOUSE if mouse support is included
3870 -   AC_CACHE_CHECK([for sysmouse], vi_cv_have_sysmouse,
3871 -       AC_TRY_LINK(
3872 -           [#include <sys/consio.h>
3873 -            #include <signal.h>
3874 -            #include <sys/fbio.h>],
3875 -           [struct mouse_info   mouse;
3876 -            mouse.operation = MOUSE_MODE;
3877 -            mouse.operation = MOUSE_SHOW;
3878 -            mouse.u.mode.mode = 0;
3879 -            mouse.u.mode.signal = SIGUSR2;],
3880 -           [vi_cv_have_sysmouse=yes],
3881 -           [vi_cv_have_sysmouse=no])
3882 -     )
3883 -   if test $vi_cv_have_sysmouse = yes; then
3884 -     AC_DEFINE(HAVE_SYSMOUSE)
3885 -   fi
3886 - else
3887 -   AC_MSG_RESULT(yes)
3888 - fi
3890 - dnl make sure the FD_CLOEXEC flag for fcntl()'s F_SETFD command is known
3891 - AC_MSG_CHECKING(for FD_CLOEXEC)
3892 - AC_TRY_COMPILE(
3893 - [#if HAVE_FCNTL_H
3894 - # include <fcntl.h>
3895 - #endif],
3896 - [     int flag = FD_CLOEXEC;],
3897 -       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FD_CLOEXEC),
3898 -       AC_MSG_RESULT(not usable))
3900 - dnl rename needs to be checked separately to work on Nextstep with cc
3901 - AC_MSG_CHECKING(for rename)
3902 - AC_TRY_LINK([#include <stdio.h>], [rename("this", "that")],
3903 -       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_RENAME),
3904 -       AC_MSG_RESULT(no))
3906 - dnl sysctl() may exist but not the arguments we use
3907 - AC_MSG_CHECKING(for sysctl)
3908 - AC_TRY_COMPILE(
3909 - [#include <sys/types.h>
3910 - #include <sys/sysctl.h>],
3911 - [     int mib[2], r;
3912 -       size_t len;
3914 -       mib[0] = CTL_HW;
3915 -       mib[1] = HW_USERMEM;
3916 -       len = sizeof(r);
3917 -       (void)sysctl(mib, 2, &r, &len, (void *)0, (size_t)0);
3918 -       ],
3919 -       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCTL),
3920 -       AC_MSG_RESULT(not usable))
3922 - dnl sysinfo() may exist but not be Linux compatible
3923 - AC_MSG_CHECKING(for sysinfo)
3924 - AC_TRY_COMPILE(
3925 - [#include <sys/types.h>
3926 - #include <sys/sysinfo.h>],
3927 - [     struct sysinfo sinfo;
3928 -       int t;
3930 -       (void)sysinfo(&sinfo);
3931 -       t = sinfo.totalram;
3932 -       ],
3933 -       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO),
3934 -       AC_MSG_RESULT(not usable))
3936 - dnl struct sysinfo may have the mem_unit field or not
3937 - AC_MSG_CHECKING(for sysinfo.mem_unit)
3938 - AC_TRY_COMPILE(
3939 - [#include <sys/types.h>
3940 - #include <sys/sysinfo.h>],
3941 - [     struct sysinfo sinfo;
3942 -       sinfo.mem_unit = 1;
3943 -       ],
3944 -       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO_MEM_UNIT),
3945 -       AC_MSG_RESULT(no))
3947 - dnl sysconf() may exist but not support what we want to use
3948 - AC_MSG_CHECKING(for sysconf)
3949 - AC_TRY_COMPILE(
3950 - [#include <unistd.h>],
3951 - [     (void)sysconf(_SC_PAGESIZE);
3952 -       (void)sysconf(_SC_PHYS_PAGES);
3953 -       ],
3954 -       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCONF),
3955 -       AC_MSG_RESULT(not usable))
3957 - AC_CHECK_SIZEOF([int])
3958 - AC_CHECK_SIZEOF([long])
3959 - AC_CHECK_SIZEOF([time_t])
3960 - AC_CHECK_SIZEOF([off_t])
3962 - dnl Use different names to avoid clashing with other header files.
3963 - AC_DEFINE_UNQUOTED(VIM_SIZEOF_INT, [$ac_cv_sizeof_int])
3964 - AC_DEFINE_UNQUOTED(VIM_SIZEOF_LONG, [$ac_cv_sizeof_long])
3966 - dnl Make sure that uint32_t is really 32 bits unsigned.
3967 - AC_MSG_CHECKING([uint32_t is 32 bits])
3968 - AC_TRY_RUN([
3969 - #ifdef HAVE_STDINT_H
3970 - # include <stdint.h>
3971 - #endif
3972 - #ifdef HAVE_INTTYPES_H
3973 - # include <inttypes.h>
3974 - #endif
3975 - main() {
3976 -   uint32_t nr1 = (uint32_t)-1;
3977 -   uint32_t nr2 = (uint32_t)0xffffffffUL;
3978 -   if (sizeof(uint32_t) != 4 || nr1 != 0xffffffffUL || nr2 + 1 != 0) exit(1);
3979 -   exit(0);
3980 - }],
3981 - AC_MSG_RESULT(ok),
3982 - AC_MSG_ERROR([WRONG!  uint32_t not defined correctly.]),
3983 - AC_MSG_WARN([cannot check uint32_t when cross-compiling.]))
3985 - dnl Check for memmove() before bcopy(), makes memmove() be used when both are
3986 - dnl present, fixes problem with incompatibility between Solaris 2.4 and 2.5.
3988 - [bcopy_test_prog='
3989 - #include "confdefs.h"
3990 - #ifdef HAVE_STRING_H
3991 - # include <string.h>
3992 - #endif
3993 - #if STDC_HEADERS
3994 - # include <stdlib.h>
3995 - # include <stddef.h>
3996 - #endif
3997 - main() {
3998 -   char buf[10];
3999 -   strcpy(buf, "abcdefghi");
4000 -   mch_memmove(buf, buf + 2, 3);
4001 -   if (strncmp(buf, "ababcf", 6))
4002 -     exit(1);
4003 -   strcpy(buf, "abcdefghi");
4004 -   mch_memmove(buf + 2, buf, 3);
4005 -   if (strncmp(buf, "cdedef", 6))
4006 -     exit(1);
4007 -   exit(0); /* libc version works properly.  */
4008 - }']
4010 - AC_CACHE_CHECK([whether memmove handles overlaps],[vim_cv_memmove_handles_overlap],
4011 -   [
4012 -     AC_RUN_IFELSE([AC_LANG_SOURCE([[#define mch_memmove(s,d,l) memmove(d,s,l) $bcopy_test_prog]])],
4013 -       [
4014 -       vim_cv_memmove_handles_overlap=yes
4015 -       ],[
4016 -       vim_cv_memmove_handles_overlap=no
4017 -       ],[
4018 -       AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memmove_handles_overlap')
4019 -       ])
4020 -   ])
4022 - if test "x$vim_cv_memmove_handles_overlap" = "xyes" ; then
4023 -   AC_DEFINE(USEMEMMOVE)
4024 - else
4025 -   AC_CACHE_CHECK([whether bcopy handles overlaps],[vim_cv_bcopy_handles_overlap],
4026 -     [
4027 -       AC_RUN_IFELSE([AC_LANG_SOURCE([[#define mch_bcopy(s,d,l) bcopy(d,s,l) $bcopy_test_prog]])],
4028 -       [
4029 -       vim_cv_bcopy_handles_overlap=yes
4030 -       ],[
4031 -       vim_cv_bcopy_handles_overlap=no
4032 -       ],[
4033 -       AC_MSG_ERROR(cross-compiling: please set 'vim_cv_bcopy_handles_overlap')
4034 -       ])
4035 -     ])
4037 -   if test "x$vim_cv_bcopy_handles_overlap" = "xyes" ; then
4038 -     AC_DEFINE(USEBCOPY)
4039 -   else
4040 -     AC_CACHE_CHECK([whether memcpy handles overlaps],[vim_cv_memcpy_handles_overlap],
4041 -       [
4042 -       AC_RUN_IFELSE([AC_LANG_SOURCE([[#define mch_memcpy(s,d,l) memcpy(d,s,l) $bcopy_test_prog]])],
4043 -         [
4044 -           vim_cv_memcpy_handles_overlap=yes
4045 -         ],[
4046 -           vim_cv_memcpy_handles_overlap=no
4047 -         ],[
4048 -           AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memcpy_handles_overlap')
4049 -         ])
4050 -       ])
4052 -     if test "x$vim_cv_memcpy_handles_overlap" = "xyes" ; then
4053 -       AC_DEFINE(USEMEMCPY)
4054 -     fi
4055 -   fi
4056 - fi
4059 - dnl Check for multibyte locale functions
4060 - dnl Find out if _Xsetlocale() is supported by libX11.
4061 - dnl Check if X_LOCALE should be defined.
4062 - if test "x$with_x" = "xyes"; then
4063 -   cflags_save=$CFLAGS
4064 -   libs_save=$LIBS
4065 -   LIBS="$LIBS $X_LIBS $GUI_LIB_LOC $GUI_X_LIBS $X_PRE_LIBS $X_LIB $X_EXTRA_LIBS"
4066 -   CFLAGS="$CFLAGS $X_CFLAGS"
4068 -   AC_MSG_CHECKING(whether X_LOCALE needed)
4069 -   AC_TRY_COMPILE([#include <X11/Xlocale.h>],,
4070 -       AC_TRY_LINK_FUNC([_Xsetlocale], [AC_MSG_RESULT(yes)
4071 -             AC_DEFINE(X_LOCALE)], AC_MSG_RESULT(no)),
4072 -       AC_MSG_RESULT(no))
4074 -   AC_MSG_CHECKING(whether Xutf8SetWMProperties() can be used)
4075 -   AC_TRY_LINK_FUNC([Xutf8SetWMProperties], [AC_MSG_RESULT(yes)
4076 -             AC_DEFINE(HAVE_XUTF8SETWMPROPERTIES)], AC_MSG_RESULT(no))
4078 -   CFLAGS=$cflags_save
4079 -   LIBS=$libs_save
4080 - fi
4082 - dnl Link with xpg4, it is said to make Korean locale working
4083 - AC_CHECK_LIB(xpg4, _xpg4_setrunelocale, [LIBS="$LIBS -lxpg4"],,)
4085 - dnl Check how we can run ctags.  Default to "ctags" when nothing works.
4086 - dnl Use --version to detect Exuberant ctags (preferred)
4087 - dnl       Add --fields=+S to get function signatures for omni completion.
4088 - dnl -t for typedefs (many ctags have this)
4089 - dnl -s for static functions (Elvis ctags only?)
4090 - dnl -v for variables. Dangerous, most ctags take this for 'vgrind style'.
4091 - dnl -i+m to test for older Exuberant ctags
4092 - AC_MSG_CHECKING(how to create tags)
4093 - test -f tags && mv tags tags.save
4094 - if (eval ctags --version /dev/null | grep Exuberant) < /dev/null 1>&AC_FD_CC 2>&1; then
4095 -   TAGPRG="ctags -I INIT+ --fields=+S"
4096 - elif (eval exctags --version /dev/null | grep Exuberant) < /dev/null 1>&AC_FD_CC 2>&1; then
4097 -   TAGPRG="exctags -I INIT+ --fields=+S"
4098 - elif (eval exuberant-ctags --version /dev/null | grep Exuberant) < /dev/null 1>&AC_FD_CC 2>&1; then
4099 -   TAGPRG="exuberant-ctags -I INIT+ --fields=+S"
4100 - else
4101 -   TAGPRG="ctags"
4102 -   (eval etags    /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags"
4103 -   (eval etags -c   /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags -c"
4104 -   (eval ctags    /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags"
4105 -   (eval ctags -t   /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -t"
4106 -   (eval ctags -ts  /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -ts"
4107 -   (eval ctags -tvs /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -tvs"
4108 -   (eval ctags -i+m /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -i+m"
4109 - fi
4110 - test -f tags.save && mv tags.save tags
4111 - AC_MSG_RESULT($TAGPRG) AC_SUBST(TAGPRG)
4113 - dnl Check how we can run man with a section number
4114 - AC_MSG_CHECKING(how to run man with a section nr)
4115 - MANDEF="man"
4116 - (eval MANPAGER=cat PAGER=cat man -s 2 read) < /dev/null > /dev/null 2>&AC_FD_CC && MANDEF="man -s"
4117 - AC_MSG_RESULT($MANDEF)
4118 - if test "$MANDEF" = "man -s"; then
4119 -   AC_DEFINE(USEMAN_S)
4120 - fi
4122 - dnl Check if gettext() is working and if it needs -lintl
4123 - dnl We take care to base this on an empty LIBS: on some systems libelf would be
4124 - dnl in LIBS and implicitly take along libintl. The final LIBS would then not
4125 - dnl contain libintl, and the link step would fail due to -Wl,--as-needed.
4126 - AC_MSG_CHECKING(--disable-nls argument)
4127 - AC_ARG_ENABLE(nls,
4128 -       [  --disable-nls           Don't support NLS (gettext()).], ,
4129 -       [enable_nls="yes"])
4131 - if test "$enable_nls" = "yes"; then
4132 -   AC_MSG_RESULT(no)
4134 -   INSTALL_LANGS=install-languages
4135 -   AC_SUBST(INSTALL_LANGS)
4136 -   INSTALL_TOOL_LANGS=install-tool-languages
4137 -   AC_SUBST(INSTALL_TOOL_LANGS)
4139 -   AC_CHECK_PROG(MSGFMT, msgfmt, msgfmt, )
4140 -   AC_MSG_CHECKING([for NLS])
4141 -   if test -f po/Makefile; then
4142 -     have_gettext="no"
4143 -     if test -n "$MSGFMT"; then
4144 -       olibs=$LIBS
4145 -       LIBS=""
4146 -       AC_TRY_LINK(
4147 -       [#include <libintl.h>],
4148 -       [gettext("Test");],
4149 -       AC_MSG_RESULT([gettext() works]); have_gettext="yes"; LIBS=$olibs,
4150 -         LIBS="-lintl"
4151 -         AC_TRY_LINK(
4152 -             [#include <libintl.h>],
4153 -             [gettext("Test");],
4154 -             AC_MSG_RESULT([gettext() works with -lintl]); have_gettext="yes";
4155 -             LIBS="$olibs -lintl",
4156 -             AC_MSG_RESULT([gettext() doesn't work]);
4157 -             LIBS=$olibs))
4158 -     else
4159 -       AC_MSG_RESULT([msgfmt not found - disabled]);
4160 -     fi
4161 -     if test $have_gettext = "yes" -a "x$features" != "xtiny" -a "x$features" != "xsmall"; then
4162 -       AC_DEFINE(HAVE_GETTEXT)
4163 -       MAKEMO=yes
4164 -       AC_SUBST(MAKEMO)
4165 -       dnl this was added in GNU gettext 0.10.36
4166 -       AC_CHECK_FUNCS(bind_textdomain_codeset)
4167 -       dnl _nl_msg_cat_cntr is required for GNU gettext
4168 -       AC_MSG_CHECKING([for _nl_msg_cat_cntr])
4169 -       AC_TRY_LINK(
4170 -               [#include <libintl.h>
4171 -               extern int _nl_msg_cat_cntr;],
4172 -               [++_nl_msg_cat_cntr;],
4173 -               AC_MSG_RESULT([yes]); AC_DEFINE(HAVE_NL_MSG_CAT_CNTR),
4174 -               AC_MSG_RESULT([no]))
4175 -     fi
4176 -   else
4177 -     AC_MSG_RESULT([no "po/Makefile" - disabled]);
4178 -   fi
4179 - else
4180 -   AC_MSG_RESULT(yes)
4181 - fi
4183 - dnl Check for dynamic linking loader
4184 - AC_CHECK_HEADER(dlfcn.h, DLL=dlfcn.h, [AC_CHECK_HEADER(dl.h, DLL=dl.h)])
4185 - if test x${DLL} = xdlfcn.h; then
4186 -   AC_DEFINE(HAVE_DLFCN_H, 1, [ Define if we have dlfcn.h. ])
4187 -   AC_MSG_CHECKING([for dlopen()])
4188 -   AC_TRY_LINK(,[
4189 -               extern void* dlopen();
4190 -               dlopen();
4191 -       ],
4192 -       AC_MSG_RESULT(yes);
4193 -             AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]),
4194 -       AC_MSG_RESULT(no);
4195 -             AC_MSG_CHECKING([for dlopen() in -ldl])
4196 -             olibs=$LIBS
4197 -             LIBS="$LIBS -ldl"
4198 -             AC_TRY_LINK(,[
4199 -                               extern void* dlopen();
4200 -                               dlopen();
4201 -                ],
4202 -                AC_MSG_RESULT(yes);
4203 -                         AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]),
4204 -                AC_MSG_RESULT(no);
4205 -                         LIBS=$olibs))
4206 -   dnl ReliantUNIX has dlopen() in libc but everything else in libdl
4207 -   dnl ick :-)
4208 -   AC_MSG_CHECKING([for dlsym()])
4209 -   AC_TRY_LINK(,[
4210 -               extern void* dlsym();
4211 -               dlsym();
4212 -       ],
4213 -       AC_MSG_RESULT(yes);
4214 -             AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]),
4215 -       AC_MSG_RESULT(no);
4216 -             AC_MSG_CHECKING([for dlsym() in -ldl])
4217 -             olibs=$LIBS
4218 -             LIBS="$LIBS -ldl"
4219 -             AC_TRY_LINK(,[
4220 -                               extern void* dlsym();
4221 -                               dlsym();
4222 -                ],
4223 -                AC_MSG_RESULT(yes);
4224 -                         AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]),
4225 -                AC_MSG_RESULT(no);
4226 -                         LIBS=$olibs))
4227 - elif test x${DLL} = xdl.h; then
4228 -   AC_DEFINE(HAVE_DL_H, 1, [ Define if we have dl.h. ])
4229 -   AC_MSG_CHECKING([for shl_load()])
4230 -   AC_TRY_LINK(,[
4231 -               extern void* shl_load();
4232 -               shl_load();
4233 -      ],
4234 -      AC_MSG_RESULT(yes);
4235 -         AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]),
4236 -      AC_MSG_RESULT(no);
4237 -         AC_MSG_CHECKING([for shl_load() in -ldld])
4238 -         olibs=$LIBS
4239 -         LIBS="$LIBS -ldld"
4240 -         AC_TRY_LINK(,[
4241 -                       extern void* shl_load();
4242 -                       shl_load();
4243 -            ],
4244 -            AC_MSG_RESULT(yes);
4245 -                 AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]),
4246 -            AC_MSG_RESULT(no);
4247 -                 LIBS=$olibs))
4248 - fi
4249 - AC_CHECK_HEADERS(setjmp.h)
4251 - if test "x$MACOSX" = "xyes" -a -n "$PERL"; then
4252 -   dnl -ldl must come after DynaLoader.a
4253 -   if echo $LIBS | grep -e '-ldl' >/dev/null; then
4254 -     LIBS=`echo $LIBS | sed s/-ldl//`
4255 -     PERL_LIBS="$PERL_LIBS -ldl"
4256 -   fi
4257 - fi
4259 - if test "x$MACOSX" = "xyes"; then
4260 -   AC_MSG_CHECKING(whether we need -framework Cocoa)
4261 -   dnl Cocoa is needed with FEAT_CLIPBOARD or FEAT_MBYTE (the former is
4262 -   dnl disabled during tiny build)
4263 -   if test "x$features" != "xtiny" || test "x$enable_multibyte" = "xyes"; then
4264 -     LIBS=$"$LIBS -framework Cocoa"
4265 -     AC_MSG_RESULT(yes)
4266 -   else
4267 -     AC_MSG_RESULT(no)
4268 -   fi
4269 -   dnl As mentioned above, tiny build implies os_macosx.m isn't needed.  
4270 -   dnl Exclude it from OS_EXTRA_SRC so that linker won't complain about
4271 -   dnl missing Objective-C symbols.
4272 -   if test "x$features" = "xtiny"; then
4273 -     OS_EXTRA_SRC=`echo "$OS_EXTRA_SRC" | sed -e 's+os_macosx.m++'`
4274 -     OS_EXTRA_OBJ=`echo "$OS_EXTRA_OBJ" | sed -e 's+objects/os_macosx.o++'`
4275 -   fi
4276 - fi
4277 - if test "x$MACARCH" = "xboth" && test "x$GUITYPE" = "xCARBONGUI"; then
4278 -   LDFLAGS="$LDFLAGS -isysroot $DEVELOPER_DIR/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
4279 - fi
4281 - dnl gcc 3.1 changed the meaning of -MM.  The only solution appears to be to
4282 - dnl use "-isystem" instead of "-I" for all non-Vim include dirs.
4283 - dnl But only when making dependencies, cproto and lint don't take "-isystem".
4284 - dnl Mac gcc returns "powerpc-apple-darwin8-gcc-4.0.1 (GCC)...", need to allow
4285 - dnl the number before the version number.
4286 - DEPEND_CFLAGS_FILTER=
4287 - if test "$GCC" = yes; then
4288 -   AC_MSG_CHECKING(for GCC 3 or later)
4289 -   gccmajor=`echo "$gccversion" | sed -e 's/^\([[1-9]]\)\..*$/\1/g'`
4290 -   if test "$gccmajor" -gt "2"; then
4291 -     DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
4292 -     AC_MSG_RESULT(yes)
4293 -   else
4294 -     AC_MSG_RESULT(no)
4295 -   fi
4296 -   dnl -D_FORTIFY_SOURCE=2 crashes Vim on strcpy(buf, "000") when buf is
4297 -   dnl declared as char x[1] but actually longer.  Introduced in gcc 4.0.
4298 -   dnl Also remove duplicate _FORTIFY_SOURCE arguments.
4299 -   dnl And undefine it first to avoid a warning.
4300 -   AC_MSG_CHECKING(whether we need -D_FORTIFY_SOURCE=1)
4301 -   if test "$gccmajor" -gt "3"; then
4302 -     CFLAGS=`echo "$CFLAGS" | sed -e 's/ *-Wp,-D_FORTIFY_SOURCE=.//g' -e 's/ *-D_FORTIFY_SOURCE=.//g' -e 's/ *-U_FORTIFY_SOURCE//g' -e 's/$/ -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1/'`
4303 -     AC_MSG_RESULT(yes)
4304 -   else
4305 -     AC_MSG_RESULT(no)
4306 -   fi
4307 - fi
4308 - AC_SUBST(DEPEND_CFLAGS_FILTER)
4310 - dnl link.sh tries to avoid overlinking in a hackish way.
4311 - dnl At least GNU ld supports --as-needed which provides the same functionality
4312 - dnl at linker level. Let's use it.
4313 - AC_MSG_CHECKING(linker --as-needed support)
4314 - LINK_AS_NEEDED=
4315 - # Check if linker supports --as-needed and --no-as-needed options
4316 - if $CC -Wl,--help 2>/dev/null | grep as-needed > /dev/null; then
4317 -   LDFLAGS=`echo "$LDFLAGS" | sed -e 's/ *-Wl,--as-needed//g' | sed -e 's/$/ -Wl,--as-needed/'`
4318 -   LINK_AS_NEEDED=yes
4319 - fi
4320 - if test "$LINK_AS_NEEDED" = yes; then
4321 -   AC_MSG_RESULT(yes)
4322 - else
4323 -   AC_MSG_RESULT(no)
4324 - fi
4325 - AC_SUBST(LINK_AS_NEEDED)
4327 - # IBM z/OS reset CFLAGS for config.mk
4328 - if test "$zOSUnix" = "yes"; then
4329 -       CFLAGS="-D_ALL_SOURCE -Wc,float\(ieee\),dll"
4330 - fi
4332 - dnl write output files
4333 - AC_OUTPUT(auto/config.mk:config.mk.in)
4335 - dnl vim: set sw=2 tw=78 fo+=l:
4336 --- 0 ----
4337 *** ../vim-8.0.0081/src/configure.ac    2016-11-12 21:11:48.758573129 +0100
4338 --- src/configure.ac    2016-11-12 20:10:17.939642034 +0100
4339 ***************
4340 *** 0 ****
4341 --- 1,4314 ----
4342 + dnl configure.ac: autoconf script for Vim
4344 + dnl Process this file with autoconf 2.12 or 2.13 to produce "configure".
4345 + dnl Should also work with autoconf 2.54 and later.
4347 + AC_INIT(vim.h)
4348 + AC_CONFIG_HEADER(auto/config.h:config.h.in)
4350 + dnl Being able to run configure means the system is Unix (compatible).
4351 + AC_DEFINE(UNIX)
4352 + AC_PROG_MAKE_SET
4354 + dnl Checks for programs.
4355 + AC_PROG_CC    dnl required by almost everything
4356 + AC_PROG_CPP   dnl required by header file checks
4357 + AC_PROGRAM_EGREP dnl required by AC_EGREP_CPP
4358 + AC_PROG_FGREP dnl finds working grep -F
4359 + AC_ISC_POSIX  dnl required by AC_C_CROSS
4360 + AC_PROG_AWK   dnl required for "make html" in ../doc
4362 + dnl Don't strip if we don't have it
4363 + AC_CHECK_PROG(STRIP, strip, strip, :)
4365 + dnl Check for extension of executables
4366 + AC_EXEEXT
4368 + dnl Check for standard headers.  We don't use this in Vim but other stuff
4369 + dnl in autoconf needs it, where it uses STDC_HEADERS.
4370 + AC_HEADER_STDC
4371 + AC_HEADER_SYS_WAIT
4373 + dnl Check for the flag that fails if stuff are missing.
4375 + AC_MSG_CHECKING(--enable-fail-if-missing argument)
4376 + AC_ARG_ENABLE(fail_if_missing,
4377 +       [  --enable-fail-if-missing    Fail if dependencies on additional features
4378 +      specified on the command line are missing.], 
4379 +       [fail_if_missing="yes"],
4380 +       [fail_if_missing="no"])
4381 + AC_MSG_RESULT($fail_if_missing)
4383 + dnl Set default value for CFLAGS if none is defined or it's empty
4384 + if test -z "$CFLAGS"; then
4385 +   CFLAGS="-O"
4386 +   test "$GCC" = yes && CFLAGS="-O2 -fno-strength-reduce -Wall"
4387 + fi
4388 + if test "$GCC" = yes; then
4389 +   dnl method that should work for nearly all versions
4390 +   gccversion=`$CC -dumpversion`
4391 +   if test "x$gccversion" = "x"; then
4392 +     dnl old method; fall-back for when -dumpversion doesn't work
4393 +     gccversion=`$CC --version | sed -e '2,$d' -e 's/darwin.//' -e 's/^[[^0-9]]*\([[0-9]]\.[[0-9.]]*\).*$/\1/g'`
4394 +   fi
4395 +   dnl version 4.0.1 was reported to cause trouble on Macintosh by Marcin Dalecki
4396 +   if test "$gccversion" = "3.0.1" -o "$gccversion" = "3.0.2" -o "$gccversion" = "4.0.1"; then
4397 +     echo 'GCC [[34]].0.[[12]] has a bug in the optimizer, disabling "-O#"'
4398 +     CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-O/'`
4399 +   else
4400 +     if test "$gccversion" = "3.1" -o "$gccversion" = "3.2" -o "$gccversion" = "3.2.1" && `echo "$CFLAGS" | grep -v fno-strength-reduce >/dev/null`; then
4401 +       echo 'GCC 3.1 and 3.2 have a bug in the optimizer, adding "-fno-strength-reduce"'
4402 +       CFLAGS="$CFLAGS -fno-strength-reduce"
4403 +     fi
4404 +   fi
4405 + fi
4407 + dnl clang-500.2.75 or around has abandoned -f[no-]strength-reduce and issues a
4408 + dnl warning when that flag is passed to.  Accordingly, adjust CFLAGS based on
4409 + dnl the version number of the clang in use.
4410 + dnl Note that this does not work to get the version of clang 3.1 or 3.2.
4411 + AC_MSG_CHECKING(for recent clang version)
4412 + CLANG_VERSION_STRING=`$CC --version 2>/dev/null | sed  -n -e 's/^.*clang.*\([[0-9]][[0-9]]*\.[[0-9]][[0-9]]*\.[[0-9]][[0-9]]*\).*$/\1/p'`
4413 + if test x"$CLANG_VERSION_STRING" != x"" ; then
4414 +   CLANG_MAJOR=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/\([[0-9]][[0-9]]*\)\.[[0-9]][[0-9]]*\.[[0-9]][[0-9]]*/\1/p'`
4415 +   CLANG_MINOR=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/[[0-9]][[0-9]]*\.\([[0-9]][[0-9]]*\)\.[[0-9]][[0-9]]*/\1/p'`
4416 +   CLANG_REVISION=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/[[0-9]][[0-9]]*\.[[0-9]][[0-9]]*\.\([[0-9]][[0-9]]*\)/\1/p'`
4417 +   CLANG_VERSION=`expr $CLANG_MAJOR '*' 1000000 '+' $CLANG_MINOR '*' 1000 '+' $CLANG_REVISION`
4418 +   AC_MSG_RESULT($CLANG_VERSION)
4419 +   dnl If you find the same issue with versions earlier than 500.2.75,
4420 +   dnl change the constant 500002075 below appropriately.  To get the
4421 +   dnl integer corresponding to a version number, refer to the
4422 +   dnl definition of CLANG_VERSION above.
4423 +   if test "$CLANG_VERSION" -ge 500002075 ; then
4424 +     CFLAGS=`echo "$CFLAGS" | sed -n -e 's/-fno-strength-reduce/ /p'`
4425 +   fi
4426 + else
4427 +   AC_MSG_RESULT(no)
4428 + fi
4430 + dnl If configure thinks we are cross compiling, there might be something
4431 + dnl wrong with the CC or CFLAGS settings, give a useful warning message
4432 + CROSS_COMPILING=
4433 + if test "$cross_compiling" = yes; then
4434 +   AC_MSG_RESULT([cannot compile a simple program; if not cross compiling check CC and CFLAGS])
4435 +   CROSS_COMPILING=1
4436 + fi
4437 + AC_SUBST(CROSS_COMPILING)
4439 + dnl gcc-cpp has the wonderful -MM option to produce nicer dependencies.
4440 + dnl But gcc 3.1 changed the meaning!  See near the end.
4441 + test "$GCC" = yes && CPP_MM=M; AC_SUBST(CPP_MM)
4443 + if test -f ./toolcheck; then
4444 +   AC_CHECKING(for buggy tools)
4445 +   sh ./toolcheck 1>&AC_FD_MSG
4446 + fi
4448 + OS_EXTRA_SRC=""; OS_EXTRA_OBJ=""
4450 + dnl Check for BeOS, which needs an extra source file
4451 + AC_MSG_CHECKING(for BeOS)
4452 + case `uname` in
4453 +     BeOS)     OS_EXTRA_SRC=os_beos.c; OS_EXTRA_OBJ=objects/os_beos.o
4454 +               BEOS=yes; AC_MSG_RESULT(yes);;
4455 +     *)                BEOS=no; AC_MSG_RESULT(no);;
4456 + esac
4458 + dnl If QNX is found, assume we don't want to use Xphoton
4459 + dnl unless it was specifically asked for (--with-x)
4460 + AC_MSG_CHECKING(for QNX)
4461 + case `uname` in
4462 +     QNX)      OS_EXTRA_SRC=os_qnx.c; OS_EXTRA_OBJ=objects/os_qnx.o
4463 +               test -z "$with_x" && with_x=no
4464 +               QNX=yes; AC_MSG_RESULT(yes);;
4465 +     *)                QNX=no; AC_MSG_RESULT(no);;
4466 + esac
4468 + dnl Check for Darwin and MacOS X
4469 + dnl We do a check for MacOS X in the very beginning because there
4470 + dnl are a lot of other things we need to change besides GUI stuff
4471 + AC_MSG_CHECKING([for Darwin (Mac OS X)])
4472 + if test "`(uname) 2>/dev/null`" = Darwin; then
4473 +   AC_MSG_RESULT(yes)
4475 +   AC_MSG_CHECKING(--disable-darwin argument)
4476 +   AC_ARG_ENABLE(darwin,
4477 +         [  --disable-darwin        Disable Darwin (Mac OS X) support.],
4478 +         , [enable_darwin="yes"])
4479 +   if test "$enable_darwin" = "yes"; then
4480 +     AC_MSG_RESULT(no)
4481 +     AC_MSG_CHECKING(if Darwin files are there)
4482 +     if test -f os_macosx.m; then
4483 +       AC_MSG_RESULT(yes)
4484 +     else
4485 +       AC_MSG_RESULT([no, Darwin support disabled])
4486 +       enable_darwin=no
4487 +     fi
4488 +   else
4489 +     AC_MSG_RESULT([yes, Darwin support excluded])
4490 +   fi
4492 +   AC_MSG_CHECKING(--with-mac-arch argument)
4493 +   AC_ARG_WITH(mac-arch, [  --with-mac-arch=ARCH    current, intel, ppc or both],
4494 +       MACARCH="$withval"; AC_MSG_RESULT($MACARCH),
4495 +       MACARCH="current"; AC_MSG_RESULT(defaulting to $MACARCH))
4497 +   AC_MSG_CHECKING(--with-developer-dir argument)
4498 +   AC_ARG_WITH(developer-dir, [  --with-developer-dir=PATH    use PATH as location for Xcode developer tools],
4499 +       DEVELOPER_DIR="$withval"; AC_MSG_RESULT($DEVELOPER_DIR),
4500 +         AC_MSG_RESULT(not present))
4501 +   
4502 +   if test "x$DEVELOPER_DIR" = "x"; then
4503 +     AC_PATH_PROG(XCODE_SELECT, xcode-select)
4504 +     if test "x$XCODE_SELECT" != "x"; then
4505 +       AC_MSG_CHECKING(for developer dir using xcode-select)
4506 +       DEVELOPER_DIR=`$XCODE_SELECT -print-path`
4507 +       AC_MSG_RESULT([$DEVELOPER_DIR])
4508 +     else
4509 +       DEVELOPER_DIR=/Developer
4510 +     fi
4511 +   fi
4513 +   if test "x$MACARCH" = "xboth"; then
4514 +     AC_MSG_CHECKING(for 10.4 universal SDK)
4515 +     dnl There is a terrible inconsistency (but we appear to get away with it):
4516 +     dnl $CFLAGS uses the 10.4u SDK library for the headers, while $CPPFLAGS
4517 +     dnl doesn't, because "gcc -E" doesn't grok it.  That means the configure
4518 +     dnl tests using the preprocessor are actually done with the wrong header
4519 +     dnl files. $LDFLAGS is set at the end, because configure uses it together
4520 +     dnl with $CFLAGS and we can only have one -sysroot argument.
4521 +     save_cppflags="$CPPFLAGS"
4522 +     save_cflags="$CFLAGS"
4523 +     save_ldflags="$LDFLAGS"
4524 +     CFLAGS="$CFLAGS -isysroot $DEVELOPER_DIR/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
4525 +     AC_TRY_LINK([ ], [ ],
4526 +       AC_MSG_RESULT(found, will make universal binary),
4528 +       AC_MSG_RESULT(not found)
4529 +       CFLAGS="$save_cflags"
4530 +       AC_MSG_CHECKING(if Intel architecture is supported)
4531 +       CPPFLAGS="$CPPFLAGS -arch i386"
4532 +       LDFLAGS="$save_ldflags -arch i386"
4533 +       AC_TRY_LINK([ ], [ ],
4534 +           AC_MSG_RESULT(yes); MACARCH="intel",
4535 +           AC_MSG_RESULT(no, using PowerPC)
4536 +               MACARCH="ppc"
4537 +               CPPFLAGS="$save_cppflags -arch ppc"
4538 +               LDFLAGS="$save_ldflags -arch ppc"))
4539 +   elif test "x$MACARCH" = "xintel"; then
4540 +     CPPFLAGS="$CPPFLAGS -arch intel"
4541 +     LDFLAGS="$LDFLAGS -arch intel"
4542 +   elif test "x$MACARCH" = "xppc"; then
4543 +     CPPFLAGS="$CPPFLAGS -arch ppc"
4544 +     LDFLAGS="$LDFLAGS -arch ppc"
4545 +   fi
4547 +   if test "$enable_darwin" = "yes"; then
4548 +     MACOSX=yes
4549 +     OS_EXTRA_SRC="os_macosx.m os_mac_conv.c";
4550 +     OS_EXTRA_OBJ="objects/os_macosx.o objects/os_mac_conv.o"
4551 +     dnl TODO: use -arch i386 on Intel machines
4552 +     dnl Removed -no-cpp-precomp, only for very old compilers.
4553 +     CPPFLAGS="$CPPFLAGS -DMACOS_X_UNIX"
4555 +     dnl If Carbon is found, assume we don't want X11
4556 +     dnl unless it was specifically asked for (--with-x)
4557 +     dnl or Motif, Athena or GTK GUI is used.
4558 +     AC_CHECK_HEADER(Carbon/Carbon.h, CARBON=yes)
4559 +     if test "x$CARBON" = "xyes"; then
4560 +       if test -z "$with_x" -a "X$enable_gui" != Xmotif -a "X$enable_gui" != Xathena -a "X$enable_gui" != Xgtk2 -a "X$enable_gui" != Xgtk3; then
4561 +       with_x=no
4562 +       fi
4563 +     fi
4564 +   fi
4566 +   dnl Avoid a bug with -O2 with gcc 4.0.1.  Symptom: malloc() reports double
4567 +   dnl free.  This happens in expand_filename(), because the optimizer swaps
4568 +   dnl two blocks of code, both using "repl", that can't be swapped.
4569 +   if test "$MACARCH" = "intel" -o "$MACARCH" = "both"; then
4570 +     CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-Oz/'`
4571 +   fi
4573 + else
4574 +   AC_MSG_RESULT(no)
4575 + fi
4577 + dnl Mac OS X 10.9+ no longer include AvailabilityMacros.h in Carbon
4578 + dnl so we need to include it to have access to version macros.
4579 + AC_CHECK_HEADERS(AvailabilityMacros.h)
4581 + AC_SUBST(OS_EXTRA_SRC)
4582 + AC_SUBST(OS_EXTRA_OBJ)
4584 + dnl Add /usr/local/lib to $LDFLAGS and /usr/local/include to CFLAGS.
4585 + dnl Only when the directory exists and it wasn't there yet.
4586 + dnl For gcc don't do this when it is already in the default search path.
4587 + dnl Skip all of this when cross-compiling.
4588 + if test "$cross_compiling" = no; then
4589 +   AC_MSG_CHECKING(--with-local-dir argument)
4590 +   have_local_include=''
4591 +   have_local_lib=''
4592 +   AC_ARG_WITH([local-dir], [  --with-local-dir=PATH   search PATH instead of /usr/local for local libraries.
4593 +   --without-local-dir     do not search /usr/local for local libraries.], [
4594 +     local_dir="$withval"
4595 +     case "$withval" in
4596 +     */*) ;;
4597 +     no)
4598 +       # avoid adding local dir to LDFLAGS and CPPFLAGS
4599 +       have_local_include=yes
4600 +       have_local_lib=yes
4601 +       ;;
4602 +     *) AC_MSG_ERROR(must pass path argument to --with-local-dir) ;;
4603 +     esac
4604 +       AC_MSG_RESULT($local_dir)
4605 +   ], [
4606 +     local_dir=/usr/local
4607 +     AC_MSG_RESULT(Defaulting to $local_dir)
4608 +   ])
4609 +   if test "$GCC" = yes -a "$local_dir" != no; then
4610 +     echo 'void f(){}' > conftest.c
4611 +     dnl Removed -no-cpp-precomp, only needed for OS X 10.2 (Ben Fowler)
4612 +     have_local_include=`${CC-cc} -c -v conftest.c 2>&1 | grep "${local_dir}/include"`
4613 +     have_local_lib=`${CC-cc} -c -v conftest.c 2>&1 | grep "${local_dir}/lib"`
4614 +     rm -f conftest.c conftest.o
4615 +   fi
4616 +   if test -z "$have_local_lib" -a -d "${local_dir}/lib"; then
4617 +     tt=`echo "$LDFLAGS" | sed -e "s+-L${local_dir}/lib ++g" -e "s+-L${local_dir}/lib$++g"`
4618 +     if test "$tt" = "$LDFLAGS"; then
4619 +       LDFLAGS="$LDFLAGS -L${local_dir}/lib"
4620 +     fi
4621 +   fi
4622 +   if test -z "$have_local_include" -a -d "${local_dir}/include"; then
4623 +     tt=`echo "$CPPFLAGS" | sed -e "s+-I${local_dir}/include ++g" -e "s+-I${local_dir}/include$++g"`
4624 +     if test "$tt" = "$CPPFLAGS"; then
4625 +       CPPFLAGS="$CPPFLAGS -I${local_dir}/include"
4626 +     fi
4627 +   fi
4628 + fi
4630 + AC_MSG_CHECKING(--with-vim-name argument)
4631 + AC_ARG_WITH(vim-name, [  --with-vim-name=NAME    what to call the Vim executable],
4632 +       VIMNAME="$withval"; AC_MSG_RESULT($VIMNAME),
4633 +       VIMNAME="vim"; AC_MSG_RESULT(Defaulting to $VIMNAME))
4634 + AC_SUBST(VIMNAME)
4635 + AC_MSG_CHECKING(--with-ex-name argument)
4636 + AC_ARG_WITH(ex-name, [  --with-ex-name=NAME     what to call the Ex executable],
4637 +       EXNAME="$withval"; AC_MSG_RESULT($EXNAME),
4638 +       EXNAME="ex"; AC_MSG_RESULT(Defaulting to ex))
4639 + AC_SUBST(EXNAME)
4640 + AC_MSG_CHECKING(--with-view-name argument)
4641 + AC_ARG_WITH(view-name, [  --with-view-name=NAME   what to call the View executable],
4642 +       VIEWNAME="$withval"; AC_MSG_RESULT($VIEWNAME),
4643 +       VIEWNAME="view"; AC_MSG_RESULT(Defaulting to view))
4644 + AC_SUBST(VIEWNAME)
4646 + AC_MSG_CHECKING(--with-global-runtime argument)
4647 + AC_ARG_WITH(global-runtime, [  --with-global-runtime=DIR    global runtime directory in 'runtimepath'],
4648 +       AC_MSG_RESULT($withval); AC_DEFINE_UNQUOTED(RUNTIME_GLOBAL, "$withval"),
4649 +       AC_MSG_RESULT(no))
4651 + AC_MSG_CHECKING(--with-modified-by argument)
4652 + AC_ARG_WITH(modified-by, [  --with-modified-by=NAME       name of who modified a release version],
4653 +       AC_MSG_RESULT($withval); AC_DEFINE_UNQUOTED(MODIFIED_BY, "$withval"),
4654 +       AC_MSG_RESULT(no))
4656 + dnl Check for EBCDIC stolen from the LYNX port to z/OS Unix
4657 + AC_MSG_CHECKING(if character set is EBCDIC)
4658 + AC_TRY_COMPILE([ ],
4659 + [ /* TryCompile function for CharSet.
4660 +    Treat any failure as ASCII for compatibility with existing art.
4661 +    Use compile-time rather than run-time tests for cross-compiler
4662 +    tolerance.  */
4663 + #if '0'!=240
4664 + make an error "Character set is not EBCDIC"
4665 + #endif ],
4666 + [ # TryCompile action if true
4667 + cf_cv_ebcdic=yes ],
4668 + [ # TryCompile action if false
4669 + cf_cv_ebcdic=no])
4670 + # end of TryCompile ])
4671 + # end of CacheVal CvEbcdic
4672 + AC_MSG_RESULT($cf_cv_ebcdic)
4673 + case "$cf_cv_ebcdic" in  #(vi
4674 +     yes)      AC_DEFINE(EBCDIC)
4675 +               line_break='"\\n"'
4676 +               ;;
4677 +     *)                line_break='"\\012"';;
4678 + esac
4679 + AC_SUBST(line_break)
4681 + if test "$cf_cv_ebcdic" = "yes"; then
4682 + dnl If we have EBCDIC we most likely have z/OS Unix, let's test it!
4683 + AC_MSG_CHECKING(for z/OS Unix)
4684 + case `uname` in
4685 +     OS/390)   zOSUnix="yes";
4686 +               dnl If using cc the environment variable _CC_CCMODE must be
4687 +               dnl set to "1", so that some compiler extensions are enabled.
4688 +               dnl If using c89 the environment variable is named _CC_C89MODE.
4689 +               dnl Note: compile with c89 never tested.
4690 +               if test "$CC" = "cc"; then
4691 +                 ccm="$_CC_CCMODE"
4692 +                 ccn="CC"
4693 +               else
4694 +                 if test "$CC" = "c89"; then
4695 +                   ccm="$_CC_C89MODE"
4696 +                   ccn="C89"
4697 +                 else
4698 +                   ccm=1
4699 +                 fi
4700 +               fi
4701 +               if test "$ccm" != "1"; then
4702 +                 echo ""
4703 +                 echo "------------------------------------------"
4704 +                 echo " On z/OS Unix, the environment variable"
4705 +                 echo " _CC_${ccn}MODE must be set to \"1\"!"
4706 +                 echo " Do:"
4707 +                 echo "    export _CC_${ccn}MODE=1"
4708 +                 echo " and then call configure again."
4709 +                 echo "------------------------------------------"
4710 +                 exit 1
4711 +               fi
4712 +               # Set CFLAGS for configure process.
4713 +               # This will be reset later for config.mk.
4714 +               # Use haltonmsg to force error for missing H files.
4715 +               CFLAGS="$CFLAGS -D_ALL_SOURCE -Wc,float(ieee),haltonmsg(3296)";
4716 +               LDFLAGS="$LDFLAGS -Wl,EDIT=NO"
4717 +               AC_MSG_RESULT(yes)
4718 +               ;;
4719 +     *)                zOSUnix="no";
4720 +               AC_MSG_RESULT(no)
4721 +               ;;
4722 + esac
4723 + fi
4725 + dnl Set QUOTESED. Needs additional backslashes on zOS
4726 + if test "$zOSUnix" = "yes"; then
4727 +     QUOTESED="sed -e 's/[[\\\\\"]]/\\\\\\\\&/g' -e 's/\\\\\\\\\"/\"/' -e 's/\\\\\\\\\";\$\$/\";/'"
4728 + else
4729 +     QUOTESED="sed -e 's/[[\\\\\"]]/\\\\&/g' -e 's/\\\\\"/\"/' -e 's/\\\\\";\$\$/\";/'"
4730 + fi
4731 + AC_SUBST(QUOTESED)
4734 + dnl Link with -lsmack for Smack stuff; if not found
4735 + AC_MSG_CHECKING(--disable-smack argument)
4736 + AC_ARG_ENABLE(smack,
4737 +       [  --disable-smack        Do not check for Smack support.],
4738 +       , enable_smack="yes")
4739 + if test "$enable_smack" = "yes"; then
4740 +   AC_MSG_RESULT(no)
4741 +   AC_CHECK_HEADER([linux/xattr.h], true, enable_smack="no")
4742 + else
4743 +   AC_MSG_RESULT(yes)
4744 + fi
4745 + if test "$enable_smack" = "yes"; then
4746 +   AC_CHECK_HEADER([attr/xattr.h], true, enable_smack="no")
4747 + fi
4748 + if test "$enable_smack" = "yes"; then
4749 +   AC_MSG_CHECKING(for XATTR_NAME_SMACKEXEC in linux/xattr.h)
4750 +   AC_EGREP_CPP(XATTR_NAME_SMACKEXEC, [#include <linux/xattr.h>],
4751 +              AC_MSG_RESULT(yes),
4752 +              AC_MSG_RESULT(no); enable_smack="no")
4753 + fi
4754 + if test "$enable_smack" = "yes"; then
4755 +   AC_CHECK_LIB(attr, setxattr,
4756 +         [LIBS="$LIBS -lattr"
4757 +          found_smack="yes"
4758 +          AC_DEFINE(HAVE_SMACK)])
4759 + fi
4761 + dnl When smack was found don't search for SELinux
4762 + if test "x$found_smack" = "x"; then
4763 +   dnl Link with -lselinux for SELinux stuff; if not found
4764 +   AC_MSG_CHECKING(--disable-selinux argument)
4765 +   AC_ARG_ENABLE(selinux,
4766 +         [  --disable-selinux    Do not check for SELinux support.],
4767 +         , enable_selinux="yes")
4768 +   if test "$enable_selinux" = "yes"; then
4769 +     AC_MSG_RESULT(no)
4770 +     AC_CHECK_LIB(selinux, is_selinux_enabled,
4771 +           [LIBS="$LIBS -lselinux"
4772 +            AC_DEFINE(HAVE_SELINUX)])
4773 +   else
4774 +      AC_MSG_RESULT(yes)
4775 +   fi
4776 + fi
4778 + dnl Check user requested features.
4780 + AC_MSG_CHECKING(--with-features argument)
4781 + AC_ARG_WITH(features, [  --with-features=TYPE    tiny, small, normal, big or huge (default: huge)],
4782 +       features="$withval"; AC_MSG_RESULT($features),
4783 +       features="huge"; AC_MSG_RESULT(Defaulting to huge))
4785 + dovimdiff=""
4786 + dogvimdiff=""
4787 + case "$features" in
4788 +   tiny)               AC_DEFINE(FEAT_TINY) ;;
4789 +   small)      AC_DEFINE(FEAT_SMALL) ;;
4790 +   normal)     AC_DEFINE(FEAT_NORMAL) dovimdiff="installvimdiff";
4791 +                       dogvimdiff="installgvimdiff" ;;
4792 +   big)                AC_DEFINE(FEAT_BIG) dovimdiff="installvimdiff";
4793 +                       dogvimdiff="installgvimdiff" ;;
4794 +   huge)               AC_DEFINE(FEAT_HUGE) dovimdiff="installvimdiff";
4795 +                       dogvimdiff="installgvimdiff" ;;
4796 +   *)          AC_MSG_RESULT([Sorry, $features is not supported]) ;;
4797 + esac
4799 + AC_SUBST(dovimdiff)
4800 + AC_SUBST(dogvimdiff)
4802 + AC_MSG_CHECKING(--with-compiledby argument)
4803 + AC_ARG_WITH(compiledby, [  --with-compiledby=NAME  name to show in :version message],
4804 +       compiledby="$withval"; AC_MSG_RESULT($withval),
4805 +       compiledby=""; AC_MSG_RESULT(no))
4806 + AC_SUBST(compiledby)
4808 + AC_MSG_CHECKING(--disable-xsmp argument)
4809 + AC_ARG_ENABLE(xsmp,
4810 +       [  --disable-xsmp          Disable XSMP session management],
4811 +       , enable_xsmp="yes")
4813 + if test "$enable_xsmp" = "yes"; then
4814 +   AC_MSG_RESULT(no)
4815 +   AC_MSG_CHECKING(--disable-xsmp-interact argument)
4816 +   AC_ARG_ENABLE(xsmp-interact,
4817 +         [  --disable-xsmp-interact Disable XSMP interaction],
4818 +         , enable_xsmp_interact="yes")
4819 +   if test "$enable_xsmp_interact" = "yes"; then
4820 +     AC_MSG_RESULT(no)
4821 +     AC_DEFINE(USE_XSMP_INTERACT)
4822 +   else
4823 +     AC_MSG_RESULT(yes)
4824 +   fi
4825 + else
4826 +   AC_MSG_RESULT(yes)
4827 + fi
4829 + dnl Check for Lua feature.
4830 + AC_MSG_CHECKING(--enable-luainterp argument)
4831 + AC_ARG_ENABLE(luainterp,
4832 +       [  --enable-luainterp[=OPTS]     Include Lua interpreter.  [default=no] [OPTS=no/yes/dynamic]], ,
4833 +       [enable_luainterp="no"])
4834 + AC_MSG_RESULT($enable_luainterp)
4836 + if test "$enable_luainterp" = "yes" -o "$enable_luainterp" = "dynamic"; then
4837 +   if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
4838 +     AC_MSG_ERROR([cannot use Lua with tiny or small features])
4839 +   fi
4841 +   dnl -- find the lua executable
4842 +   AC_SUBST(vi_cv_path_lua)
4844 +   AC_MSG_CHECKING(--with-lua-prefix argument)
4845 +   AC_ARG_WITH(lua_prefix,
4846 +       [  --with-lua-prefix=PFX   Prefix where Lua is installed.],
4847 +       with_lua_prefix="$withval"; AC_MSG_RESULT($with_lua_prefix),
4848 +       with_lua_prefix="";AC_MSG_RESULT(no))
4850 +   if test "X$with_lua_prefix" != "X"; then
4851 +        vi_cv_path_lua_pfx="$with_lua_prefix"
4852 +   else
4853 +     AC_MSG_CHECKING(LUA_PREFIX environment var)
4854 +     if test "X$LUA_PREFIX" != "X"; then
4855 +       AC_MSG_RESULT("$LUA_PREFIX")
4856 +       vi_cv_path_lua_pfx="$LUA_PREFIX"
4857 +     else
4858 +       AC_MSG_RESULT([not set, default to /usr])
4859 +       vi_cv_path_lua_pfx="/usr"
4860 +     fi
4861 +   fi
4863 +   AC_MSG_CHECKING(--with-luajit)
4864 +   AC_ARG_WITH(luajit,
4865 +       [  --with-luajit           Link with LuaJIT instead of Lua.],
4866 +       [vi_cv_with_luajit="$withval"],
4867 +       [vi_cv_with_luajit="no"])
4868 +   AC_MSG_RESULT($vi_cv_with_luajit)
4870 +   LUA_INC=
4871 +   if test "X$vi_cv_path_lua_pfx" != "X"; then
4872 +     if test "x$vi_cv_with_luajit" != "xno"; then
4873 +       dnl -- try to find LuaJIT executable
4874 +       AC_PATH_PROG(vi_cv_path_luajit, luajit)
4875 +       if test "X$vi_cv_path_luajit" != "X"; then
4876 +       dnl -- find LuaJIT version
4877 +       AC_CACHE_CHECK(LuaJIT version, vi_cv_version_luajit,
4878 +       [ vi_cv_version_luajit=`${vi_cv_path_luajit} -v 2>&1 | sed 's/LuaJIT \([[0-9.]]*\)\.[[0-9]]\(-[[a-z0-9]]*\)* .*/\1/'` ])
4879 +       AC_CACHE_CHECK(Lua version of LuaJIT, vi_cv_version_lua_luajit,
4880 +       [ vi_cv_version_lua_luajit=`${vi_cv_path_luajit} -e "print(_VERSION)" | sed 's/.* //'` ])
4881 +       vi_cv_path_lua="$vi_cv_path_luajit"
4882 +       vi_cv_version_lua="$vi_cv_version_lua_luajit"
4883 +       fi
4884 +     else
4885 +       dnl -- try to find Lua executable
4886 +       AC_PATH_PROG(vi_cv_path_plain_lua, lua)
4887 +       if test "X$vi_cv_path_plain_lua" != "X"; then
4888 +       dnl -- find Lua version
4889 +       AC_CACHE_CHECK(Lua version, vi_cv_version_plain_lua,
4890 +       [ vi_cv_version_plain_lua=`${vi_cv_path_plain_lua} -e "print(_VERSION)" | sed 's/.* //'` ])
4891 +       fi
4892 +       vi_cv_path_lua="$vi_cv_path_plain_lua"
4893 +       vi_cv_version_lua="$vi_cv_version_plain_lua"
4894 +     fi
4895 +     if test "x$vi_cv_with_luajit" != "xno" && test "X$vi_cv_version_luajit" != "X"; then
4896 +       AC_MSG_CHECKING(if lua.h can be found in $vi_cv_path_lua_pfx/include/luajit-$vi_cv_version_luajit)
4897 +       if test -f "$vi_cv_path_lua_pfx/include/luajit-$vi_cv_version_luajit/lua.h"; then
4898 +       AC_MSG_RESULT(yes)
4899 +       LUA_INC=/luajit-$vi_cv_version_luajit
4900 +       fi
4901 +     fi
4902 +     if test "X$LUA_INC" = "X"; then
4903 +       AC_MSG_CHECKING(if lua.h can be found in $vi_cv_path_lua_pfx/include)
4904 +       if test -f "$vi_cv_path_lua_pfx/include/lua.h"; then
4905 +       AC_MSG_RESULT(yes)
4906 +       else
4907 +       AC_MSG_RESULT(no)
4908 +       AC_MSG_CHECKING(if lua.h can be found in $vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua)
4909 +       if test -f "$vi_cv_path_lua_pfx/include/lua$vi_cv_version_lua/lua.h"; then
4910 +         AC_MSG_RESULT(yes)
4911 +         LUA_INC=/lua$vi_cv_version_lua
4912 +       else
4913 +         AC_MSG_RESULT(no)
4914 +         vi_cv_path_lua_pfx=
4915 +       fi
4916 +       fi
4917 +     fi
4918 +   fi
4920 +   if test "X$vi_cv_path_lua_pfx" != "X"; then
4921 +     if test "x$vi_cv_with_luajit" != "xno"; then
4922 +       multiarch=`dpkg-architecture -qDEB_HOST_MULTIARCH 2> /dev/null`
4923 +       if test "X$multiarch" != "X"; then
4924 +       lib_multiarch="lib/${multiarch}"
4925 +       else
4926 +       lib_multiarch="lib"
4927 +       fi
4928 +       if test "X$vi_cv_version_lua" = "X"; then
4929 +       LUA_LIBS="-L${vi_cv_path_lua_pfx}/${lib_multiarch} -lluajit"
4930 +       else
4931 +       LUA_LIBS="-L${vi_cv_path_lua_pfx}/${lib_multiarch} -lluajit-$vi_cv_version_lua"
4932 +       fi
4933 +     else
4934 +       if test "X$LUA_INC" != "X"; then
4935 +       dnl Test alternate location using version
4936 +       LUA_LIBS="-L${vi_cv_path_lua_pfx}/lib -llua$vi_cv_version_lua"
4937 +       else
4938 +       LUA_LIBS="-L${vi_cv_path_lua_pfx}/lib -llua"
4939 +       fi
4940 +     fi
4941 +     if test "$enable_luainterp" = "dynamic"; then
4942 +       lua_ok="yes"
4943 +     else
4944 +       AC_MSG_CHECKING([if link with ${LUA_LIBS} is sane])
4945 +       libs_save=$LIBS
4946 +       LIBS="$LIBS $LUA_LIBS"
4947 +       AC_TRY_LINK(,[ ],
4948 +       AC_MSG_RESULT(yes); lua_ok="yes",
4949 +       AC_MSG_RESULT(no); lua_ok="no"; LUA_LIBS="")
4950 +       LIBS=$libs_save
4951 +     fi
4952 +     if test "x$lua_ok" = "xyes"; then
4953 +       LUA_CFLAGS="-I${vi_cv_path_lua_pfx}/include${LUA_INC}"
4954 +       LUA_SRC="if_lua.c"
4955 +       LUA_OBJ="objects/if_lua.o"
4956 +       LUA_PRO="if_lua.pro"
4957 +       AC_DEFINE(FEAT_LUA)
4958 +     fi
4959 +     if test "$enable_luainterp" = "dynamic"; then
4960 +       if test "x$vi_cv_with_luajit" != "xno"; then
4961 +       luajit="jit"
4962 +       fi
4963 +       if test -f "${vi_cv_path_lua_pfx}/bin/cyglua-${vi_cv_version_lua}.dll"; then
4964 +       vi_cv_dll_name_lua="cyglua-${vi_cv_version_lua}.dll"
4965 +       else
4966 +       if test "x$MACOSX" = "xyes"; then
4967 +         ext="dylib"
4968 +         indexes=""
4969 +       else
4970 +         ext="so"
4971 +         indexes=".0 .1 .2 .3 .4 .5 .6 .7 .8 .9"
4972 +         multiarch=`dpkg-architecture -qDEB_HOST_MULTIARCH 2> /dev/null`
4973 +         if test "X$multiarch" != "X"; then
4974 +           lib_multiarch="lib/${multiarch}"
4975 +         fi
4976 +       fi
4977 +       dnl Determine the sover for the current version, but fallback to
4978 +       dnl liblua${vi_cv_version_lua}.so if no sover-versioned file is found.
4979 +       AC_MSG_CHECKING(if liblua${luajit}*.${ext}* can be found in $vi_cv_path_lua_pfx)
4980 +       for subdir in "${lib_multiarch}" lib64 lib; do
4981 +         if test -z "$subdir"; then
4982 +           continue
4983 +         fi
4984 +         for sover in "${vi_cv_version_lua}.${ext}" "-${vi_cv_version_lua}.${ext}" \
4985 +           ".${vi_cv_version_lua}.${ext}" ".${ext}.${vi_cv_version_lua}"; do
4986 +           for i in $indexes ""; do
4987 +             if test -f "${vi_cv_path_lua_pfx}/${subdir}/liblua${luajit}${sover}$i"; then
4988 +               sover2="$i"
4989 +               break 3
4990 +             fi
4991 +           done
4992 +         done
4993 +         sover=""
4994 +       done
4995 +       if test "X$sover" = "X"; then
4996 +         AC_MSG_RESULT(no)
4997 +         lua_ok="no"
4998 +         vi_cv_dll_name_lua="liblua${luajit}.${ext}"
4999 +       else
5000 +         AC_MSG_RESULT(yes)
5001 +         lua_ok="yes"
5002 +         vi_cv_dll_name_lua="liblua${luajit}${sover}$sover2"
5003 +       fi
5004 +       fi
5005 +       AC_DEFINE(DYNAMIC_LUA)
5006 +       LUA_LIBS=""
5007 +       LUA_CFLAGS="-DDYNAMIC_LUA_DLL=\\\"${vi_cv_dll_name_lua}\\\" $LUA_CFLAGS"
5008 +     fi
5009 +     if test "X$LUA_CFLAGS$LUA_LIBS" != "X" && \
5010 +        test "x$MACOSX" = "xyes" && test "x$vi_cv_with_luajit" != "xno" && \
5011 +        test "`(uname -m) 2>/dev/null`" = "x86_64"; then
5012 +       dnl OSX/x64 requires these flags. See http://luajit.org/install.html
5013 +       LUA_LIBS="-pagezero_size 10000 -image_base 100000000 $LUA_LIBS"
5014 +     fi
5015 +   fi
5016 +   if test "$fail_if_missing" = "yes" -a "$lua_ok" != "yes"; then
5017 +     AC_MSG_ERROR([could not configure lua])
5018 +   fi
5019 +   AC_SUBST(LUA_SRC)
5020 +   AC_SUBST(LUA_OBJ)
5021 +   AC_SUBST(LUA_PRO)
5022 +   AC_SUBST(LUA_LIBS)
5023 +   AC_SUBST(LUA_CFLAGS)
5024 + fi
5027 + dnl Check for MzScheme feature.
5028 + AC_MSG_CHECKING(--enable-mzschemeinterp argument)
5029 + AC_ARG_ENABLE(mzschemeinterp,
5030 +       [  --enable-mzschemeinterp   Include MzScheme interpreter.], ,
5031 +       [enable_mzschemeinterp="no"])
5032 + AC_MSG_RESULT($enable_mzschemeinterp)
5034 + if test "$enable_mzschemeinterp" = "yes"; then
5035 +   dnl -- find the mzscheme executable
5036 +   AC_SUBST(vi_cv_path_mzscheme)
5038 +   AC_MSG_CHECKING(--with-plthome argument)
5039 +   AC_ARG_WITH(plthome,
5040 +       [  --with-plthome=PLTHOME   Use PLTHOME.],
5041 +       with_plthome="$withval"; AC_MSG_RESULT($with_plthome),
5042 +       with_plthome="";AC_MSG_RESULT("no"))
5044 +   if test "X$with_plthome" != "X"; then
5045 +        vi_cv_path_mzscheme_pfx="$with_plthome"
5046 +        vi_cv_path_mzscheme="${vi_cv_path_mzscheme_pfx}/bin/mzscheme"
5047 +   else
5048 +     AC_MSG_CHECKING(PLTHOME environment var)
5049 +     if test "X$PLTHOME" != "X"; then
5050 +       AC_MSG_RESULT("$PLTHOME")
5051 +       vi_cv_path_mzscheme_pfx="$PLTHOME"
5052 +       vi_cv_path_mzscheme="${vi_cv_path_mzscheme_pfx}/bin/mzscheme"
5053 +     else
5054 +       AC_MSG_RESULT(not set)
5055 +       dnl -- try to find MzScheme executable
5056 +       AC_PATH_PROG(vi_cv_path_mzscheme, mzscheme)
5058 +       dnl resolve symbolic link, the executable is often elsewhere and there
5059 +       dnl are no links for the include files.
5060 +       if test "X$vi_cv_path_mzscheme" != "X"; then
5061 +         lsout=`ls -l $vi_cv_path_mzscheme`
5062 +         if echo "$lsout" | grep -e '->' >/dev/null 2>/dev/null; then
5063 +           vi_cv_path_mzscheme=`echo "$lsout" | sed 's/.*-> \(.*\)/\1/'`
5064 +         fi
5065 +       fi
5067 +       if test "X$vi_cv_path_mzscheme" != "X"; then
5068 +           dnl -- find where MzScheme thinks it was installed
5069 +           AC_CACHE_CHECK(MzScheme install prefix,vi_cv_path_mzscheme_pfx,
5070 +           dnl different versions of MzScheme differ in command line processing
5071 +           dnl use universal approach
5072 +           echo "(display (simplify-path               \
5073 +              (build-path (call-with-values    \
5074 +               (lambda () (split-path (find-system-path (quote exec-file)))) \
5075 +               (lambda (base name must-be-dir?) base)) (quote up))))" > mzdirs.scm
5076 +           dnl Remove a trailing slash
5077 +           [ vi_cv_path_mzscheme_pfx=`${vi_cv_path_mzscheme} -r mzdirs.scm | \
5078 +               sed -e 's+/$++'` ])
5079 +           rm -f mzdirs.scm
5080 +       fi
5081 +     fi
5082 +   fi
5084 +   if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
5085 +     AC_MSG_CHECKING(for racket include directory)
5086 +     SCHEME_INC=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-include-dir))) (when (path? p) (display p)))'`
5087 +     if test "X$SCHEME_INC" != "X"; then
5088 +       AC_MSG_RESULT(${SCHEME_INC})
5089 +     else
5090 +       AC_MSG_RESULT(not found)
5091 +       AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include)
5092 +       if test -f "$vi_cv_path_mzscheme_pfx/include/scheme.h"; then
5093 +       SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include
5094 +       AC_MSG_RESULT(yes)
5095 +       else
5096 +       AC_MSG_RESULT(no)
5097 +       AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/plt)
5098 +       if test -f "$vi_cv_path_mzscheme_pfx/include/plt/scheme.h"; then
5099 +         AC_MSG_RESULT(yes)
5100 +         SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/plt
5101 +       else
5102 +         AC_MSG_RESULT(no)
5103 +         AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/racket)
5104 +         if test -f "$vi_cv_path_mzscheme_pfx/include/racket/scheme.h"; then
5105 +           AC_MSG_RESULT(yes)
5106 +           SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/racket
5107 +         else
5108 +           AC_MSG_RESULT(no)
5109 +           AC_MSG_CHECKING(if scheme.h can be found in /usr/include/plt/)
5110 +           if test -f /usr/include/plt/scheme.h; then
5111 +             AC_MSG_RESULT(yes)
5112 +             SCHEME_INC=/usr/include/plt
5113 +           else
5114 +             AC_MSG_RESULT(no)
5115 +             AC_MSG_CHECKING(if scheme.h can be found in /usr/include/racket/)
5116 +             if test -f /usr/include/racket/scheme.h; then
5117 +               AC_MSG_RESULT(yes)
5118 +               SCHEME_INC=/usr/include/racket
5119 +             else
5120 +               AC_MSG_RESULT(no)
5121 +               vi_cv_path_mzscheme_pfx=
5122 +             fi
5123 +           fi
5124 +         fi
5125 +       fi
5126 +       fi
5127 +     fi
5128 +   fi
5130 +   if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
5132 +     AC_MSG_CHECKING(for racket lib directory)
5133 +     SCHEME_LIB=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-lib-dir))) (when (path? p) (display p)))'`
5134 +     if test "X$SCHEME_LIB" != "X"; then
5135 +       AC_MSG_RESULT(${SCHEME_LIB})
5136 +     else
5137 +       AC_MSG_RESULT(not found)
5138 +     fi
5140 +     for path in "${vi_cv_path_mzscheme_pfx}/lib" "${SCHEME_LIB}"; do
5141 +       if test "X$path" != "X"; then
5142 +       if test "x$MACOSX" = "xyes"; then
5143 +         MZSCHEME_LIBS="-framework Racket"
5144 +         MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
5145 +       elif test -f "${path}/libmzscheme3m.a"; then
5146 +         MZSCHEME_LIBS="${path}/libmzscheme3m.a"
5147 +         MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
5148 +       elif test -f "${path}/libracket3m.a"; then
5149 +         MZSCHEME_LIBS="${path}/libracket3m.a"
5150 +         MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
5151 +       elif test -f "${path}/libracket.a"; then
5152 +         MZSCHEME_LIBS="${path}/libracket.a ${path}/libmzgc.a"
5153 +       elif test -f "${path}/libmzscheme.a"; then
5154 +         MZSCHEME_LIBS="${path}/libmzscheme.a ${path}/libmzgc.a"
5155 +       else
5156 +         dnl Using shared objects
5157 +         if test -f "${path}/libmzscheme3m.so"; then
5158 +           MZSCHEME_LIBS="-L${path} -lmzscheme3m"
5159 +           MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
5160 +         elif test -f "${path}/libracket3m.so"; then
5161 +           MZSCHEME_LIBS="-L${path} -lracket3m"
5162 +           MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
5163 +         elif test -f "${path}/libracket.so"; then
5164 +           MZSCHEME_LIBS="-L${path} -lracket -lmzgc"
5165 +         else
5166 +           dnl try next until last
5167 +           if test "$path" != "$SCHEME_LIB"; then
5168 +             continue
5169 +           fi
5170 +           MZSCHEME_LIBS="-L${path} -lmzscheme -lmzgc"
5171 +         fi
5172 +         if test "$GCC" = yes; then
5173 +           dnl Make Vim remember the path to the library.  For when it's not in
5174 +           dnl $LD_LIBRARY_PATH.
5175 +           MZSCHEME_LIBS="${MZSCHEME_LIBS} -Wl,-rpath -Wl,${path}"
5176 +         elif test "`(uname) 2>/dev/null`" = SunOS &&
5177 +                                  uname -r | grep '^5' >/dev/null; then
5178 +           MZSCHEME_LIBS="${MZSCHEME_LIBS} -R ${path}"
5179 +         fi
5180 +       fi
5181 +       fi
5182 +       if test "X$MZSCHEME_LIBS" != "X"; then
5183 +       break
5184 +       fi
5185 +     done
5187 +     AC_MSG_CHECKING([if racket requires -pthread])
5188 +     if test "X$SCHEME_LIB" != "X" && $FGREP -e -pthread "$SCHEME_LIB/buildinfo" >/dev/null ; then
5189 +       AC_MSG_RESULT(yes)
5190 +       MZSCHEME_LIBS="${MZSCHEME_LIBS} -pthread"
5191 +       MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -pthread"
5192 +     else
5193 +       AC_MSG_RESULT(no)
5194 +     fi
5196 +     AC_MSG_CHECKING(for racket config directory)
5197 +     SCHEME_CONFIGDIR=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-config-dir))) (when (path? p) (display p)))'`
5198 +     if test "X$SCHEME_CONFIGDIR" != "X"; then
5199 +       MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DMZSCHEME_CONFIGDIR='\"${SCHEME_CONFIGDIR}\"'"
5200 +       AC_MSG_RESULT(${SCHEME_CONFIGDIR})
5201 +     else
5202 +       AC_MSG_RESULT(not found)
5203 +     fi
5205 +     AC_MSG_CHECKING(for racket collects directory)
5206 +     SCHEME_COLLECTS=`${vi_cv_path_mzscheme} -e '(require setup/dirs)(let ((p (find-collects-dir))) (when (path? p) (let-values (((base _1 _2) (split-path p))) (display base))))'`
5207 +     if test "X$SCHEME_COLLECTS" = "X"; then
5208 +       if test -d "$vi_cv_path_mzscheme_pfx/lib/plt/collects"; then
5209 +       SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/lib/plt/
5210 +       else
5211 +       if test -d "$vi_cv_path_mzscheme_pfx/lib/racket/collects"; then
5212 +         SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/lib/racket/
5213 +       else
5214 +         if test -d "$vi_cv_path_mzscheme_pfx/share/racket/collects"; then
5215 +           SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/share/racket/
5216 +         else
5217 +           if test -d "$vi_cv_path_mzscheme_pfx/collects"; then
5218 +             SCHEME_COLLECTS=$vi_cv_path_mzscheme_pfx/
5219 +           fi
5220 +         fi
5221 +       fi
5222 +       fi
5223 +     fi
5224 +     if test "X$SCHEME_COLLECTS" != "X" ; then
5225 +       AC_MSG_RESULT(${SCHEME_COLLECTS})
5226 +     else
5227 +       AC_MSG_RESULT(not found)
5228 +     fi
5230 +     AC_MSG_CHECKING(for mzscheme_base.c)
5231 +     if test -f "${SCHEME_COLLECTS}collects/scheme/base.ss" ; then
5232 +       MZSCHEME_EXTRA="mzscheme_base.c"
5233 +       MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/mzc"
5234 +       MZSCHEME_MOD="++lib scheme/base"
5235 +     else
5236 +       if test -f "${SCHEME_COLLECTS}collects/scheme/base.rkt" ; then
5237 +       MZSCHEME_EXTRA="mzscheme_base.c"
5238 +       MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/mzc"
5239 +       MZSCHEME_MOD="++lib scheme/base"
5240 +       else
5241 +       if test -f "${SCHEME_COLLECTS}collects/racket/base.rkt" ; then
5242 +         MZSCHEME_EXTRA="mzscheme_base.c"
5243 +         MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/raco ctool"
5244 +         MZSCHEME_MOD=""
5245 +       fi
5246 +       fi
5247 +     fi
5248 +     if test "X$MZSCHEME_EXTRA" != "X" ; then
5249 +       dnl need to generate bytecode for MzScheme base
5250 +       MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DINCLUDE_MZSCHEME_BASE"
5251 +       AC_MSG_RESULT(needed)
5252 +     else
5253 +       AC_MSG_RESULT(not needed)
5254 +     fi
5256 +     dnl On Ubuntu this fixes "undefined reference to symbol 'ffi_type_void'".
5257 +     AC_CHECK_LIB(ffi, ffi_type_void, [MZSCHEME_LIBS="$MZSCHEME_LIBS -lffi"])
5259 +     MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -I${SCHEME_INC} \
5260 +       -DMZSCHEME_COLLECTS='\"${SCHEME_COLLECTS}collects\"'"
5262 +     dnl Test that we can compile a simple program with these CFLAGS and LIBS.
5263 +     AC_MSG_CHECKING([if compile and link flags for MzScheme are sane])
5264 +     cflags_save=$CFLAGS
5265 +     libs_save=$LIBS
5266 +     CFLAGS="$CFLAGS $MZSCHEME_CFLAGS"
5267 +     LIBS="$LIBS $MZSCHEME_LIBS"
5268 +     AC_TRY_LINK(,[ ],
5269 +          AC_MSG_RESULT(yes); mzs_ok=yes,
5270 +          AC_MSG_RESULT(no: MZSCHEME DISABLED); mzs_ok=no)
5271 +     CFLAGS=$cflags_save
5272 +     LIBS=$libs_save
5273 +     if test $mzs_ok = yes; then
5274 +       MZSCHEME_SRC="if_mzsch.c"
5275 +       MZSCHEME_OBJ="objects/if_mzsch.o"
5276 +       MZSCHEME_PRO="if_mzsch.pro"
5277 +       AC_DEFINE(FEAT_MZSCHEME)
5278 +     else
5279 +       MZSCHEME_CFLAGS=
5280 +       MZSCHEME_LIBS=
5281 +       MZSCHEME_EXTRA=
5282 +       MZSCHEME_MZC=
5283 +     fi
5284 +   fi
5285 +   AC_SUBST(MZSCHEME_SRC)
5286 +   AC_SUBST(MZSCHEME_OBJ)
5287 +   AC_SUBST(MZSCHEME_PRO)
5288 +   AC_SUBST(MZSCHEME_LIBS)
5289 +   AC_SUBST(MZSCHEME_CFLAGS)
5290 +   AC_SUBST(MZSCHEME_EXTRA)
5291 +   AC_SUBST(MZSCHEME_MZC)
5292 + fi
5295 + AC_MSG_CHECKING(--enable-perlinterp argument)
5296 + AC_ARG_ENABLE(perlinterp,
5297 +       [  --enable-perlinterp[=OPTS]     Include Perl interpreter.  [default=no] [OPTS=no/yes/dynamic]], ,
5298 +       [enable_perlinterp="no"])
5299 + AC_MSG_RESULT($enable_perlinterp)
5300 + if test "$enable_perlinterp" = "yes" -o "$enable_perlinterp" = "dynamic"; then
5301 +   if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
5302 +     AC_MSG_ERROR([cannot use Perl with tiny or small features])
5303 +   fi
5304 +   AC_SUBST(vi_cv_path_perl)
5305 +   AC_PATH_PROG(vi_cv_path_perl, perl)
5306 +   if test "X$vi_cv_path_perl" != "X"; then
5307 +     AC_MSG_CHECKING(Perl version)
5308 +     if $vi_cv_path_perl -e 'require 5.003_01' >/dev/null 2>/dev/null; then
5309 +      eval `$vi_cv_path_perl -V:usethreads`
5310 +      eval `$vi_cv_path_perl -V:libperl`
5311 +      if test "X$usethreads" = "XUNKNOWN" -o "X$usethreads" = "Xundef"; then
5312 +        badthreads=no
5313 +      else
5314 +        if $vi_cv_path_perl -e 'require 5.6.0' >/dev/null 2>/dev/null; then
5315 +        eval `$vi_cv_path_perl -V:use5005threads`
5316 +        if test "X$use5005threads" = "XUNKNOWN" -o "X$use5005threads" = "Xundef"; then
5317 +          badthreads=no
5318 +        else
5319 +          badthreads=yes
5320 +          AC_MSG_RESULT(>>> Perl > 5.6 with 5.5 threads cannot be used <<<)
5321 +        fi
5322 +        else
5323 +        badthreads=yes
5324 +        AC_MSG_RESULT(>>> Perl 5.5 with threads cannot be used <<<)
5325 +        fi
5326 +      fi
5327 +      if test $badthreads = no; then
5328 +       AC_MSG_RESULT(OK)
5329 +       eval `$vi_cv_path_perl -V:shrpenv`
5330 +       if test "X$shrpenv" = "XUNKNOWN"; then # pre 5.003_04
5331 +       shrpenv=""
5332 +       fi
5333 +       vi_cv_perllib=`$vi_cv_path_perl -MConfig -e 'print $Config{privlibexp}'`
5334 +       AC_SUBST(vi_cv_perllib)
5335 +       vi_cv_perl_extutils=unknown_perl_extutils_path
5336 +       for extutils_rel_path in ExtUtils vendor_perl/ExtUtils; do
5337 +       xsubpp_path="$vi_cv_perllib/$extutils_rel_path/xsubpp"
5338 +       if test -f "$xsubpp_path"; then
5339 +         vi_cv_perl_xsubpp="$xsubpp_path"
5340 +       fi
5341 +       done
5342 +       AC_SUBST(vi_cv_perl_xsubpp)
5343 +       dnl Remove "-fno-something", it breaks using cproto.
5344 +       dnl Remove "-fdebug-prefix-map", it isn't supported by clang.
5345 +       perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \
5346 +             -e 'ccflags;perl_inc;print"\n"' | sed -e 's/-fno[[^ ]]*//' \
5347 +                       -e 's/-fdebug-prefix-map[[^ ]]*//g'`
5348 +       dnl Remove "-lc", it breaks on FreeBSD when using "-pthread".
5349 +       perllibs=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed -e 'ldopts' | \
5350 +               sed -e '/Warning/d' -e '/Note (probably harmless)/d' \
5351 +                       -e 's/-bE:perl.exp//' -e 's/-lc //'`
5352 +       dnl Don't add perl lib to $LIBS: if it's not in LD_LIBRARY_PATH
5353 +       dnl a test in configure may fail because of that.
5354 +       perlldflags=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed \
5355 +               -e 'ccdlflags' | sed -e 's/-bE:perl.exp//'`
5357 +       dnl check that compiling a simple program still works with the flags
5358 +       dnl added for Perl.
5359 +       AC_MSG_CHECKING([if compile and link flags for Perl are sane])
5360 +       cflags_save=$CFLAGS
5361 +       libs_save=$LIBS
5362 +       ldflags_save=$LDFLAGS
5363 +       CFLAGS="$CFLAGS $perlcppflags"
5364 +       LIBS="$LIBS $perllibs"
5365 +       perlldflags=`echo "$perlldflags" | sed -e 's/^ *//g'`
5366 +       LDFLAGS="$perlldflags $LDFLAGS"
5367 +       AC_TRY_LINK(,[ ],
5368 +            AC_MSG_RESULT(yes); perl_ok=yes,
5369 +            AC_MSG_RESULT(no: PERL DISABLED); perl_ok=no)
5370 +       CFLAGS=$cflags_save
5371 +       LIBS=$libs_save
5372 +       LDFLAGS=$ldflags_save
5373 +       if test $perl_ok = yes; then
5374 +       if test "X$perlcppflags" != "X"; then
5375 +         dnl remove -pipe and -Wxxx, it confuses cproto
5376 +         PERL_CFLAGS=`echo "$perlcppflags" | sed -e 's/-pipe //' -e 's/-W[[^ ]]*//'`
5377 +       fi
5378 +       if test "X$perlldflags" != "X"; then
5379 +         if test "X`echo \"$LDFLAGS\" | $FGREP -e \"$perlldflags\"`" = "X"; then
5380 +           LDFLAGS="$perlldflags $LDFLAGS"
5381 +         fi
5382 +       fi
5383 +       PERL_LIBS=$perllibs
5384 +       PERL_SRC="auto/if_perl.c if_perlsfio.c"
5385 +       PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o"
5386 +       PERL_PRO="if_perl.pro if_perlsfio.pro"
5387 +       AC_DEFINE(FEAT_PERL)
5388 +       fi
5389 +      fi
5390 +     else
5391 +       AC_MSG_RESULT(>>> too old; need Perl version 5.003_01 or later <<<)
5392 +     fi
5393 +   fi
5395 +   if test "x$MACOSX" = "xyes"; then
5396 +     dnl Mac OS X 10.2 or later
5397 +     dir=/System/Library/Perl
5398 +     darwindir=$dir/darwin
5399 +     if test -d $darwindir; then
5400 +       PERL=/usr/bin/perl
5401 +     else
5402 +       dnl Mac OS X 10.3
5403 +       dir=/System/Library/Perl/5.8.1
5404 +       darwindir=$dir/darwin-thread-multi-2level
5405 +       if test -d $darwindir; then
5406 +       PERL=/usr/bin/perl
5407 +       fi
5408 +     fi
5409 +     if test -n "$PERL"; then
5410 +       PERL_DIR="$dir"
5411 +       PERL_CFLAGS="-DFEAT_PERL -I$darwindir/CORE"
5412 +       PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o $darwindir/auto/DynaLoader/DynaLoader.a"
5413 +       PERL_LIBS="-L$darwindir/CORE -lperl"
5414 +     fi
5415 +     dnl Perl on Mac OS X 10.5 adds "-arch" flags but these should only
5416 +     dnl be included if requested by passing --with-mac-arch to
5417 +     dnl configure, so strip these flags first (if present)
5418 +     PERL_LIBS=`echo "$PERL_LIBS" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'`
5419 +     PERL_CFLAGS=`echo "$PERL_CFLAGS" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'`
5420 +   fi
5421 +   if test "$enable_perlinterp" = "dynamic"; then
5422 +     if test "$perl_ok" = "yes" -a "X$libperl" != "X"; then
5423 +       AC_DEFINE(DYNAMIC_PERL)
5424 +       PERL_CFLAGS="-DDYNAMIC_PERL_DLL=\\\"$libperl\\\" $PERL_CFLAGS"
5425 +     fi
5426 +   fi
5428 +   if test "$fail_if_missing" = "yes" -a "$perl_ok" != "yes"; then
5429 +     AC_MSG_ERROR([could not configure perl])
5430 +   fi
5431 + fi
5432 + AC_SUBST(shrpenv)
5433 + AC_SUBST(PERL_SRC)
5434 + AC_SUBST(PERL_OBJ)
5435 + AC_SUBST(PERL_PRO)
5436 + AC_SUBST(PERL_CFLAGS)
5437 + AC_SUBST(PERL_LIBS)
5439 + AC_MSG_CHECKING(--enable-pythoninterp argument)
5440 + AC_ARG_ENABLE(pythoninterp,
5441 +       [  --enable-pythoninterp[=OPTS]   Include Python interpreter. [default=no] [OPTS=no/yes/dynamic]], ,
5442 +       [enable_pythoninterp="no"])
5443 + AC_MSG_RESULT($enable_pythoninterp)
5444 + if test "$enable_pythoninterp" = "yes" -o "$enable_pythoninterp" = "dynamic"; then
5445 +   if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
5446 +     AC_MSG_ERROR([cannot use Python with tiny or small features])
5447 +   fi
5449 +   dnl -- find the python executable
5450 +   AC_PATH_PROGS(vi_cv_path_python, python2 python)
5451 +   if test "X$vi_cv_path_python" != "X"; then
5453 +     dnl -- get its version number
5454 +     AC_CACHE_CHECK(Python version,vi_cv_var_python_version,
5455 +     [[vi_cv_var_python_version=`
5456 +           ${vi_cv_path_python} -c 'import sys; print sys.version[:3]'`
5457 +     ]])
5459 +     dnl -- it must be at least version 2.3
5460 +     AC_MSG_CHECKING(Python is 2.3 or better)
5461 +     if ${vi_cv_path_python} -c \
5462 +       "import sys; sys.exit(${vi_cv_var_python_version} < 2.3)"
5463 +     then
5464 +       AC_MSG_RESULT(yep)
5466 +       dnl -- find where python thinks it was installed
5467 +       AC_CACHE_CHECK(Python's install prefix,vi_cv_path_python_pfx,
5468 +       [ vi_cv_path_python_pfx=`
5469 +           ${vi_cv_path_python} -c \
5470 +               "import sys; print sys.prefix"` ])
5472 +       dnl -- and where it thinks it runs
5473 +       AC_CACHE_CHECK(Python's execution prefix,vi_cv_path_python_epfx,
5474 +       [ vi_cv_path_python_epfx=`
5475 +           ${vi_cv_path_python} -c \
5476 +               "import sys; print sys.exec_prefix"` ])
5478 +       dnl -- python's internal library path
5480 +       AC_CACHE_VAL(vi_cv_path_pythonpath,
5481 +       [ vi_cv_path_pythonpath=`
5482 +           unset PYTHONPATH;
5483 +           ${vi_cv_path_python} -c \
5484 +               "import sys, string; print string.join(sys.path,':')"` ])
5486 +       dnl -- where the Python implementation library archives are
5488 +       AC_ARG_WITH(python-config-dir,
5489 +       [  --with-python-config-dir=PATH  Python's config directory],
5490 +       [ vi_cv_path_python_conf="${withval}" ] )
5492 +       AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python_conf,
5493 +       [
5494 +       vi_cv_path_python_conf=
5495 +       d=`${vi_cv_path_python} -c "import distutils.sysconfig; print distutils.sysconfig.get_config_var('LIBPL')"`
5496 +       if test -d "$d" && test -f "$d/config.c"; then
5497 +         vi_cv_path_python_conf="$d"
5498 +       else
5499 +         for path in "${vi_cv_path_python_pfx}" "${vi_cv_path_python_epfx}"; do
5500 +           for subdir in lib64 lib share; do
5501 +             d="${path}/${subdir}/python${vi_cv_var_python_version}/config"
5502 +             if test -d "$d" && test -f "$d/config.c"; then
5503 +               vi_cv_path_python_conf="$d"
5504 +             fi
5505 +           done
5506 +         done
5507 +       fi
5508 +       ])
5510 +       PYTHON_CONFDIR="${vi_cv_path_python_conf}"
5512 +       if test "X$PYTHON_CONFDIR" = "X"; then
5513 +       AC_MSG_RESULT([can't find it!])
5514 +       else
5516 +       dnl -- we need to examine Python's config/Makefile too
5517 +       dnl    see what the interpreter is built from
5518 +       AC_CACHE_VAL(vi_cv_path_python_plibs,
5519 +       [
5520 +           pwd=`pwd`
5521 +           tmp_mkf="$pwd/config-PyMake$$"
5522 +           cat -- "${PYTHON_CONFDIR}/Makefile" - <<'eof' >"${tmp_mkf}"
5523 + __:
5524 +       @echo "python_BASEMODLIBS='$(BASEMODLIBS)'"
5525 +       @echo "python_LIBS='$(LIBS)'"
5526 +       @echo "python_SYSLIBS='$(SYSLIBS)'"
5527 +       @echo "python_LINKFORSHARED='$(LINKFORSHARED)'"
5528 +       @echo "python_DLLLIBRARY='$(DLLLIBRARY)'"
5529 +       @echo "python_INSTSONAME='$(INSTSONAME)'"
5530 +       @echo "python_PYTHONFRAMEWORK='$(PYTHONFRAMEWORK)'"
5531 +       @echo "python_PYTHONFRAMEWORKPREFIX='$(PYTHONFRAMEWORKPREFIX)'"
5532 +       @echo "python_PYTHONFRAMEWORKINSTALLDIR='$(PYTHONFRAMEWORKINSTALLDIR)'"
5533 + eof
5534 +           dnl -- delete the lines from make about Entering/Leaving directory
5535 +           eval "`cd ${PYTHON_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`"
5536 +           rm -f -- "${tmp_mkf}"
5537 +           if test "x$MACOSX" = "xyes" && test -n "${python_PYTHONFRAMEWORK}" && ${vi_cv_path_python} -c \
5538 +               "import sys; sys.exit(${vi_cv_var_python_version} < 2.3)"; then
5539 +             vi_cv_path_python_plibs="-framework Python"
5540 +             if test "x${vi_cv_path_python}" != "x/usr/bin/python" && test -n "${python_PYTHONFRAMEWORKPREFIX}"; then
5541 +                 vi_cv_path_python_plibs="-F${python_PYTHONFRAMEWORKPREFIX} -framework Python"
5542 +             fi
5543 +           else
5544 +             if test "${vi_cv_var_python_version}" = "1.4"; then
5545 +                 vi_cv_path_python_plibs="${PYTHON_CONFDIR}/libModules.a ${PYTHON_CONFDIR}/libPython.a ${PYTHON_CONFDIR}/libObjects.a ${PYTHON_CONFDIR}/libParser.a"
5546 +             else
5547 +                 vi_cv_path_python_plibs="-L${PYTHON_CONFDIR} -lpython${vi_cv_var_python_version}"
5548 +             fi
5549 +             dnl -- Check if the path contained in python_LINKFORSHARED is
5550 +             dnl    usable for vim build. If not, make and try other
5551 +             dnl    candidates.
5552 +             if test -n "${python_LINKFORSHARED}" && test -n "${python_PYTHONFRAMEWORKPREFIX}"; then
5553 +               python_link_symbol=`echo ${python_LINKFORSHARED} | sed 's/\([[^ \t]][[^ \t]]*[[ \t]][[ \t]]*[[^ \t]][[^ \t]]*\)[[ \t]].*/\1/'`
5554 +               python_link_path=`echo ${python_LINKFORSHARED} |   sed 's/\([[^ \t]][[^ \t]]*[[ \t]][[ \t]]*[[^ \t]][[^ \t]]*\)[[ \t]][[ \t]]*\(.*\)/\2/'`
5555 +               if test -n "${python_link_path}" && ! test -x "${python_link_path}"; then
5556 +                 dnl -- The path looks relative. Guess the absolute one using
5557 +                 dnl    the prefix and try that.
5558 +                 python_link_path="${python_PYTHONFRAMEWORKPREFIX}/${python_link_path}"
5559 +                 if test -n "${python_link_path}" && ! test -x "${python_link_path}"; then
5560 +                   dnl -- A last resort.
5561 +                   python_link_path="${python_PYTHONFRAMEWORKINSTALLDIR}/Versions/${vi_cv_var_python_version}/${python_PYTHONFRAMEWORK}"
5562 +                   dnl -- No check is done. The last word is left to the
5563 +                   dnl    "sanity" test on link flags that follows shortly.
5564 +                 fi
5565 +                 python_LINKFORSHARED="${python_link_symbol} ${python_link_path}"
5566 +               fi
5567 +             fi
5568 +             vi_cv_path_python_plibs="${vi_cv_path_python_plibs} ${python_BASEMODLIBS} ${python_LIBS} ${python_SYSLIBS} ${python_LINKFORSHARED}"
5569 +             dnl remove -ltermcap, it can conflict with an earlier -lncurses
5570 +             vi_cv_path_python_plibs=`echo $vi_cv_path_python_plibs | sed s/-ltermcap//`
5571 +           fi
5572 +       ])
5573 +       AC_CACHE_CHECK(Python's dll name,vi_cv_dll_name_python,
5574 +       [
5575 +         if test "X$python_DLLLIBRARY" != "X"; then
5576 +           vi_cv_dll_name_python="$python_DLLLIBRARY"
5577 +         else
5578 +           vi_cv_dll_name_python="$python_INSTSONAME"
5579 +         fi
5580 +       ])
5582 +       PYTHON_LIBS="${vi_cv_path_python_plibs}"
5583 +       if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then
5584 +         PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -DPYTHON_HOME='\"${vi_cv_path_python_pfx}\"'"
5585 +       else
5586 +         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} -DPYTHON_HOME='\"${vi_cv_path_python_pfx}\"'"
5587 +       fi
5588 +       PYTHON_SRC="if_python.c"
5589 +       PYTHON_OBJ="objects/if_python.o"
5590 +       if test "${vi_cv_var_python_version}" = "1.4"; then
5591 +          PYTHON_OBJ="$PYTHON_OBJ objects/py_getpath.o"
5592 +       fi
5593 +     PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'"
5595 +       dnl On FreeBSD linking with "-pthread" is required to use threads.
5596 +       dnl _THREAD_SAFE must be used for compiling then.
5597 +       dnl The "-pthread" is added to $LIBS, so that the following check for
5598 +       dnl sigaltstack() will look in libc_r (it's there in libc!).
5599 +       dnl Otherwise, when using GCC, try adding -pthread to $CFLAGS.  GCC
5600 +       dnl will then define target-specific defines, e.g., -D_REENTRANT.
5601 +       dnl Don't do this for Mac OSX, -pthread will generate a warning.
5602 +       AC_MSG_CHECKING([if -pthread should be used])
5603 +       threadsafe_flag=
5604 +       thread_lib=
5605 +       dnl if test "x$MACOSX" != "xyes"; then
5606 +         if test "`(uname) 2>/dev/null`" != Darwin; then
5607 +         test "$GCC" = yes && threadsafe_flag="-pthread"
5608 +         if test "`(uname) 2>/dev/null`" = FreeBSD; then
5609 +           threadsafe_flag="-D_THREAD_SAFE"
5610 +           thread_lib="-pthread"
5611 +         fi
5612 +         if test "`(uname) 2>/dev/null`" = SunOS; then
5613 +           threadsafe_flag="-pthreads"
5614 +         fi
5615 +       fi
5616 +       libs_save_old=$LIBS
5617 +       if test -n "$threadsafe_flag"; then
5618 +         cflags_save=$CFLAGS
5619 +         CFLAGS="$CFLAGS $threadsafe_flag"
5620 +         LIBS="$LIBS $thread_lib"
5621 +         AC_TRY_LINK(,[ ],
5622 +            AC_MSG_RESULT(yes); PYTHON_CFLAGS="$PYTHON_CFLAGS $threadsafe_flag",
5623 +            AC_MSG_RESULT(no); LIBS=$libs_save_old
5624 +            )
5625 +         CFLAGS=$cflags_save
5626 +       else
5627 +         AC_MSG_RESULT(no)
5628 +       fi
5630 +       dnl Check that compiling a simple program still works with the flags
5631 +       dnl added for Python.
5632 +       AC_MSG_CHECKING([if compile and link flags for Python are sane])
5633 +       cflags_save=$CFLAGS
5634 +       libs_save=$LIBS
5635 +       CFLAGS="$CFLAGS $PYTHON_CFLAGS"
5636 +       LIBS="$LIBS $PYTHON_LIBS"
5637 +       AC_TRY_LINK(,[ ],
5638 +              AC_MSG_RESULT(yes); python_ok=yes,
5639 +              AC_MSG_RESULT(no: PYTHON DISABLED); python_ok=no)
5640 +       CFLAGS=$cflags_save
5641 +       LIBS=$libs_save
5642 +       if test $python_ok = yes; then
5643 +         AC_DEFINE(FEAT_PYTHON)
5644 +       else
5645 +         LIBS=$libs_save_old
5646 +         PYTHON_SRC=
5647 +         PYTHON_OBJ=
5648 +         PYTHON_LIBS=
5649 +         PYTHON_CFLAGS=
5650 +       fi
5651 +       fi
5652 +     else
5653 +       AC_MSG_RESULT(too old)
5654 +     fi
5655 +   fi
5657 +   if test "$fail_if_missing" = "yes" -a "$python_ok" != "yes"; then
5658 +     AC_MSG_ERROR([could not configure python])
5659 +   fi
5660 + fi
5662 + AC_SUBST(PYTHON_CONFDIR)
5663 + AC_SUBST(PYTHON_LIBS)
5664 + AC_SUBST(PYTHON_GETPATH_CFLAGS)
5665 + AC_SUBST(PYTHON_CFLAGS)
5666 + AC_SUBST(PYTHON_SRC)
5667 + AC_SUBST(PYTHON_OBJ)
5670 + AC_MSG_CHECKING(--enable-python3interp argument)
5671 + AC_ARG_ENABLE(python3interp,
5672 +       [  --enable-python3interp[=OPTS]   Include Python3 interpreter. [default=no] [OPTS=no/yes/dynamic]], ,
5673 +       [enable_python3interp="no"])
5674 + AC_MSG_RESULT($enable_python3interp)
5675 + if test "$enable_python3interp" = "yes" -o "$enable_python3interp" = "dynamic"; then
5676 +   if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
5677 +     AC_MSG_ERROR([cannot use Python with tiny or small features])
5678 +   fi
5680 +   dnl -- find the python3 executable
5681 +   AC_PATH_PROGS(vi_cv_path_python3, python3 python)
5682 +   if test "X$vi_cv_path_python3" != "X"; then
5684 +     dnl -- get its version number
5685 +     AC_CACHE_CHECK(Python version,vi_cv_var_python3_version,
5686 +     [[vi_cv_var_python3_version=`
5687 +           ${vi_cv_path_python3} -c 'import sys; print(sys.version[:3])'`
5688 +     ]])
5690 +     dnl -- it must be at least version 3
5691 +     AC_MSG_CHECKING(Python is 3.0 or better)
5692 +     if ${vi_cv_path_python3} -c \
5693 +       "import sys; sys.exit(${vi_cv_var_python3_version} < 3.0)"
5694 +     then
5695 +       AC_MSG_RESULT(yep)
5697 +       dnl -- get abiflags for python 3.2 or higher (PEP 3149)
5698 +       AC_CACHE_CHECK(Python's abiflags,vi_cv_var_python3_abiflags,
5699 +       [
5700 +        vi_cv_var_python3_abiflags=
5701 +        if ${vi_cv_path_python3} -c \
5702 +            "import sys; sys.exit(${vi_cv_var_python3_version} < 3.2)"
5703 +        then
5704 +          vi_cv_var_python3_abiflags=`${vi_cv_path_python3} -c \    
5705 +            "import sys; print(sys.abiflags)"`
5706 +        fi ])
5707 +   
5708 +       dnl -- find where python3 thinks it was installed
5709 +       AC_CACHE_CHECK(Python's install prefix,vi_cv_path_python3_pfx,
5710 +       [ vi_cv_path_python3_pfx=`
5711 +        ${vi_cv_path_python3} -c \
5712 +        "import sys; print(sys.prefix)"` ])
5713 +   
5714 +       dnl -- and where it thinks it runs
5715 +       AC_CACHE_CHECK(Python's execution prefix,vi_cv_path_python3_epfx,
5716 +       [ vi_cv_path_python3_epfx=`
5717 +        ${vi_cv_path_python3} -c \
5718 +        "import sys; print(sys.exec_prefix)"` ])
5719 +   
5720 +       dnl -- python3's internal library path
5721 +   
5722 +       AC_CACHE_VAL(vi_cv_path_python3path,
5723 +       [ vi_cv_path_python3path=`
5724 +        unset PYTHONPATH;
5725 +        ${vi_cv_path_python3} -c \
5726 +        "import sys, string; print(':'.join(sys.path))"` ])
5727 +   
5728 +       dnl -- where the Python implementation library archives are
5729 +   
5730 +       AC_ARG_WITH(python3-config-dir,
5731 +        [  --with-python3-config-dir=PATH  Python's config directory],
5732 +        [ vi_cv_path_python3_conf="${withval}" ] )
5733 +   
5734 +       AC_CACHE_CHECK(Python's configuration directory,vi_cv_path_python3_conf,
5735 +       [
5736 +        vi_cv_path_python3_conf=
5737 +        config_dir="config-${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags}"
5738 +        d=`${vi_cv_path_python3} -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBPL'))"`
5739 +        if test -d "$d" && test -f "$d/config.c"; then
5740 +          vi_cv_path_python3_conf="$d"
5741 +        else
5742 +          for path in "${vi_cv_path_python3_pfx}" "${vi_cv_path_python3_epfx}"; do
5743 +          for subdir in lib64 lib share; do
5744 +            d="${path}/${subdir}/python${vi_cv_var_python3_version}/${config_dir}"
5745 +            if test -d "$d" && test -f "$d/config.c"; then
5746 +              vi_cv_path_python3_conf="$d"
5747 +            fi
5748 +          done
5749 +          done
5750 +        fi
5751 +       ])
5752 +   
5753 +       PYTHON3_CONFDIR="${vi_cv_path_python3_conf}"
5754 +   
5755 +       if test "X$PYTHON3_CONFDIR" = "X"; then
5756 +         AC_MSG_RESULT([can't find it!])
5757 +       else
5758 +   
5759 +         dnl -- we need to examine Python's config/Makefile too
5760 +         dnl    see what the interpreter is built from
5761 +         AC_CACHE_VAL(vi_cv_path_python3_plibs,
5762 +         [
5763 +             pwd=`pwd`
5764 +             tmp_mkf="$pwd/config-PyMake$$"
5765 +             cat -- "${PYTHON3_CONFDIR}/Makefile" - <<'eof' >"${tmp_mkf}"
5766 + __:
5767 +       @echo "python3_BASEMODLIBS='$(BASEMODLIBS)'"
5768 +       @echo "python3_LIBS='$(LIBS)'"
5769 +       @echo "python3_SYSLIBS='$(SYSLIBS)'"
5770 +       @echo "python3_DLLLIBRARY='$(DLLLIBRARY)'"
5771 +       @echo "python3_INSTSONAME='$(INSTSONAME)'"
5772 + eof
5773 +           dnl -- delete the lines from make about Entering/Leaving directory
5774 +           eval "`cd ${PYTHON3_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`"
5775 +           rm -f -- "${tmp_mkf}"
5776 +           vi_cv_path_python3_plibs="-L${PYTHON3_CONFDIR} -lpython${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags}"
5777 +           vi_cv_path_python3_plibs="${vi_cv_path_python3_plibs} ${python3_BASEMODLIBS} ${python3_LIBS} ${python3_SYSLIBS}"
5778 +           dnl remove -ltermcap, it can conflict with an earlier -lncurses
5779 +           vi_cv_path_python3_plibs=`echo $vi_cv_path_python3_plibs | sed s/-ltermcap//`
5780 +           vi_cv_path_python3_plibs=`echo $vi_cv_path_python3_plibs | sed s/-lffi//`
5781 +       ])
5782 +       AC_CACHE_CHECK(Python3's dll name,vi_cv_dll_name_python3,
5783 +       [
5784 +         if test "X$python3_DLLLIBRARY" != "X"; then
5785 +           vi_cv_dll_name_python3="$python3_DLLLIBRARY"
5786 +         else
5787 +           vi_cv_dll_name_python3="$python3_INSTSONAME"
5788 +         fi
5789 +       ])
5791 +         PYTHON3_LIBS="${vi_cv_path_python3_plibs}"
5792 +         if test "${vi_cv_path_python3_pfx}" = "${vi_cv_path_python3_epfx}"; then
5793 +           PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags} -DPYTHON3_HOME='L\"${vi_cv_path_python3_pfx}\"'"
5794 +         else
5795 +           PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags} -I${vi_cv_path_python3_epfx}/include/python${vi_cv_var_python3_version}${vi_cv_var_python3_abiflags} -DPYTHON3_HOME='L\"${vi_cv_path_python3_pfx}\"'"
5796 +         fi
5797 +         PYTHON3_SRC="if_python3.c"
5798 +         PYTHON3_OBJ="objects/if_python3.o"
5799 +   
5800 +         dnl On FreeBSD linking with "-pthread" is required to use threads.
5801 +         dnl _THREAD_SAFE must be used for compiling then.
5802 +         dnl The "-pthread" is added to $LIBS, so that the following check for
5803 +         dnl sigaltstack() will look in libc_r (it's there in libc!).
5804 +         dnl Otherwise, when using GCC, try adding -pthread to $CFLAGS.  GCC
5805 +         dnl will then define target-specific defines, e.g., -D_REENTRANT.
5806 +         dnl Don't do this for Mac OSX, -pthread will generate a warning.
5807 +         AC_MSG_CHECKING([if -pthread should be used])
5808 +         threadsafe_flag=
5809 +         thread_lib=
5810 +         dnl if test "x$MACOSX" != "xyes"; then
5811 +         if test "`(uname) 2>/dev/null`" != Darwin; then
5812 +           test "$GCC" = yes && threadsafe_flag="-pthread"
5813 +           if test "`(uname) 2>/dev/null`" = FreeBSD; then
5814 +             threadsafe_flag="-D_THREAD_SAFE"
5815 +             thread_lib="-pthread"
5816 +           fi
5817 +           if test "`(uname) 2>/dev/null`" = SunOS; then
5818 +             threadsafe_flag="-pthreads"
5819 +           fi
5820 +         fi
5821 +         libs_save_old=$LIBS
5822 +         if test -n "$threadsafe_flag"; then
5823 +           cflags_save=$CFLAGS
5824 +           CFLAGS="$CFLAGS $threadsafe_flag"
5825 +           LIBS="$LIBS $thread_lib"
5826 +           AC_TRY_LINK(,[ ],
5827 +              AC_MSG_RESULT(yes); PYTHON3_CFLAGS="$PYTHON3_CFLAGS $threadsafe_flag",
5828 +              AC_MSG_RESULT(no); LIBS=$libs_save_old
5829 +              )
5830 +           CFLAGS=$cflags_save
5831 +         else
5832 +           AC_MSG_RESULT(no)
5833 +         fi
5834 +   
5835 +         dnl check that compiling a simple program still works with the flags
5836 +         dnl added for Python.
5837 +         AC_MSG_CHECKING([if compile and link flags for Python 3 are sane])
5838 +         cflags_save=$CFLAGS
5839 +         libs_save=$LIBS
5840 +         CFLAGS="$CFLAGS $PYTHON3_CFLAGS"
5841 +         LIBS="$LIBS $PYTHON3_LIBS"
5842 +         AC_TRY_LINK(,[ ],
5843 +                AC_MSG_RESULT(yes); python3_ok=yes,
5844 +                AC_MSG_RESULT(no: PYTHON3 DISABLED); python3_ok=no)
5845 +         CFLAGS=$cflags_save
5846 +         LIBS=$libs_save
5847 +         if test "$python3_ok" = yes; then
5848 +           AC_DEFINE(FEAT_PYTHON3)
5849 +         else
5850 +           LIBS=$libs_save_old
5851 +           PYTHON3_SRC=
5852 +           PYTHON3_OBJ=
5853 +           PYTHON3_LIBS=
5854 +           PYTHON3_CFLAGS=
5855 +         fi
5856 +       fi
5857 +     else
5858 +       AC_MSG_RESULT(too old)
5859 +     fi
5860 +   fi
5861 +   if test "$fail_if_missing" = "yes" -a "$python3_ok" != "yes"; then
5862 +     AC_MSG_ERROR([could not configure python3])
5863 +   fi
5864 + fi
5866 + AC_SUBST(PYTHON3_CONFDIR)
5867 + AC_SUBST(PYTHON3_LIBS)
5868 + AC_SUBST(PYTHON3_CFLAGS)
5869 + AC_SUBST(PYTHON3_SRC)
5870 + AC_SUBST(PYTHON3_OBJ)
5872 + dnl if python2.x and python3.x are enabled one can only link in code
5873 + dnl with dlopen(), dlsym(), dlclose() 
5874 + if test "$python_ok" = yes && test "$python3_ok" = yes; then
5875 +   AC_DEFINE(DYNAMIC_PYTHON)
5876 +   AC_DEFINE(DYNAMIC_PYTHON3)
5877 +   AC_MSG_CHECKING(whether we can do without RTLD_GLOBAL for Python)
5878 +   cflags_save=$CFLAGS
5879 +   CFLAGS="$CFLAGS $PYTHON_CFLAGS"
5880 +   libs_save=$LIBS
5881 +   dnl -ldl must go first to make this work on Archlinux (Roland Puntaier)
5882 +   LIBS="-ldl $LIBS"
5883 +   AC_RUN_IFELSE([AC_LANG_SOURCE([
5884 +     #include <dlfcn.h>
5885 +     /* If this program fails, then RTLD_GLOBAL is needed.
5886 +      * RTLD_GLOBAL will be used and then it is not possible to
5887 +      * have both python versions enabled in the same vim instance.
5888 +      * Only the first python version used will be switched on.
5889 +      */
5891 +     int no_rtl_global_needed_for(char *python_instsoname, char *prefix)
5892 +     {
5893 +       int needed = 0;
5894 +       void* pylib = dlopen(python_instsoname, RTLD_LAZY|RTLD_LOCAL);
5895 +       if (pylib != 0)
5896 +       {
5897 +           void (*pfx)(char *home) = dlsym(pylib, "Py_SetPythonHome");
5898 +           void (*init)(void) = dlsym(pylib, "Py_Initialize");
5899 +           int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString");
5900 +           void (*final)(void) = dlsym(pylib, "Py_Finalize");
5901 +           (*pfx)(prefix);
5902 +           (*init)();
5903 +           needed = (*simple)("import termios") == -1;
5904 +           (*final)();
5905 +           dlclose(pylib);
5906 +       }
5907 +       return !needed;
5908 +     }
5910 +     int main(int argc, char** argv)
5911 +     {
5912 +       int not_needed = 0;
5913 +       if (no_rtl_global_needed_for("${vi_cv_dll_name_python}", "${vi_cv_path_python_pfx}"))
5914 +             not_needed = 1;
5915 +       return !not_needed;
5916 +     }])],
5917 +     [AC_MSG_RESULT(yes);AC_DEFINE(PY_NO_RTLD_GLOBAL)], [AC_MSG_RESULT(no)])
5919 +   CFLAGS=$cflags_save
5920 +   LIBS=$libs_save
5922 +   AC_MSG_CHECKING(whether we can do without RTLD_GLOBAL for Python3)
5923 +   cflags_save=$CFLAGS
5924 +   CFLAGS="$CFLAGS $PYTHON3_CFLAGS"
5925 +   libs_save=$LIBS
5926 +   dnl -ldl must go first to make this work on Archlinux (Roland Puntaier)
5927 +   LIBS="-ldl $LIBS"
5928 +   AC_RUN_IFELSE([AC_LANG_SOURCE([
5929 +     #include <dlfcn.h>
5930 +     #include <wchar.h>
5931 +     /* If this program fails, then RTLD_GLOBAL is needed.
5932 +      * RTLD_GLOBAL will be used and then it is not possible to
5933 +      * have both python versions enabled in the same vim instance.
5934 +      * Only the first python version used will be switched on.
5935 +      */
5937 +     int no_rtl_global_needed_for(char *python_instsoname, wchar_t *prefix)
5938 +     {
5939 +       int needed = 0;
5940 +       void* pylib = dlopen(python_instsoname, RTLD_LAZY|RTLD_LOCAL);
5941 +       if (pylib != 0)
5942 +       {
5943 +           void (*pfx)(wchar_t *home) = dlsym(pylib, "Py_SetPythonHome");
5944 +           void (*init)(void) = dlsym(pylib, "Py_Initialize");
5945 +           int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString");
5946 +           void (*final)(void) = dlsym(pylib, "Py_Finalize");
5947 +           (*pfx)(prefix);
5948 +           (*init)();
5949 +           needed = (*simple)("import termios") == -1;
5950 +           (*final)();
5951 +           dlclose(pylib);
5952 +       }
5953 +       return !needed;
5954 +     }
5956 +     int main(int argc, char** argv)
5957 +     {
5958 +       int not_needed = 0;
5959 +       if (no_rtl_global_needed_for("${vi_cv_dll_name_python3}", L"${vi_cv_path_python3_pfx}"))
5960 +             not_needed = 1;
5961 +       return !not_needed;
5962 +     }])],
5963 +     [AC_MSG_RESULT(yes);AC_DEFINE(PY3_NO_RTLD_GLOBAL)], [AC_MSG_RESULT(no)])
5965 +   CFLAGS=$cflags_save
5966 +   LIBS=$libs_save
5968 +   PYTHON_SRC="if_python.c"
5969 +   PYTHON_OBJ="objects/if_python.o"
5970 +   PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"${vi_cv_dll_name_python}\\\""
5971 +   PYTHON_LIBS=
5972 +   PYTHON3_SRC="if_python3.c"
5973 +   PYTHON3_OBJ="objects/if_python3.o"
5974 +   PYTHON3_CFLAGS="$PYTHON3_CFLAGS -DDYNAMIC_PYTHON3_DLL=\\\"${vi_cv_dll_name_python3}\\\""
5975 +   PYTHON3_LIBS=
5976 + elif test "$python_ok" = yes && test "$enable_pythoninterp" = "dynamic"; then
5977 +   AC_DEFINE(DYNAMIC_PYTHON)
5978 +   PYTHON_SRC="if_python.c"
5979 +   PYTHON_OBJ="objects/if_python.o"
5980 +   PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"${vi_cv_dll_name_python}\\\""
5981 +   PYTHON_LIBS=
5982 + elif test "$python_ok" = yes; then
5983 +   dnl Check that adding -fPIE works.  It may be needed when using a static
5984 +   dnl Python library.
5985 +   AC_MSG_CHECKING([if -fPIE can be added for Python])
5986 +   cflags_save=$CFLAGS
5987 +   libs_save=$LIBS
5988 +   CFLAGS="$CFLAGS $PYTHON_CFLAGS -fPIE"
5989 +   LIBS="$LIBS $PYTHON_LIBS"
5990 +   AC_TRY_LINK(,[ ],
5991 +        AC_MSG_RESULT(yes); fpie_ok=yes,
5992 +        AC_MSG_RESULT(no); fpie_ok=no)
5993 +   CFLAGS=$cflags_save
5994 +   LIBS=$libs_save
5995 +   if test $fpie_ok = yes; then
5996 +     PYTHON_CFLAGS="$PYTHON_CFLAGS -fPIE"
5997 +   fi
5998 + elif test "$python3_ok" = yes && test "$enable_python3interp" = "dynamic"; then
5999 +   AC_DEFINE(DYNAMIC_PYTHON3)
6000 +   PYTHON3_SRC="if_python3.c"
6001 +   PYTHON3_OBJ="objects/if_python3.o"
6002 +   PYTHON3_CFLAGS="$PYTHON3_CFLAGS -DDYNAMIC_PYTHON3_DLL=\\\"${vi_cv_dll_name_python3}\\\""
6003 +   PYTHON3_LIBS=
6004 + elif test "$python3_ok" = yes; then
6005 +   dnl Check that adding -fPIE works.  It may be needed when using a static
6006 +   dnl Python library.
6007 +   AC_MSG_CHECKING([if -fPIE can be added for Python3])
6008 +   cflags_save=$CFLAGS
6009 +   libs_save=$LIBS
6010 +   CFLAGS="$CFLAGS $PYTHON3_CFLAGS -fPIE"
6011 +   LIBS="$LIBS $PYTHON3_LIBS"
6012 +   AC_TRY_LINK(,[ ],
6013 +        AC_MSG_RESULT(yes); fpie_ok=yes,
6014 +        AC_MSG_RESULT(no); fpie_ok=no)
6015 +   CFLAGS=$cflags_save
6016 +   LIBS=$libs_save
6017 +   if test $fpie_ok = yes; then
6018 +     PYTHON3_CFLAGS="$PYTHON3_CFLAGS -fPIE"
6019 +   fi
6020 + fi
6022 + AC_MSG_CHECKING(--enable-tclinterp argument)
6023 + AC_ARG_ENABLE(tclinterp,
6024 +       [  --enable-tclinterp[=OPTS]      Include Tcl interpreter. [default=no] [OPTS=no/yes/dynamic]], ,
6025 +       [enable_tclinterp="no"])
6026 + AC_MSG_RESULT($enable_tclinterp)
6028 + if test "$enable_tclinterp" = "yes" -o "$enable_tclinterp" = "dynamic"; then
6030 +   dnl on FreeBSD tclsh is a silly script, look for tclsh8.[5420]
6031 +   AC_MSG_CHECKING(--with-tclsh argument)
6032 +   AC_ARG_WITH(tclsh, [  --with-tclsh=PATH       which tclsh to use (default: tclsh8.0)],
6033 +       tclsh_name="$withval"; AC_MSG_RESULT($tclsh_name),
6034 +       tclsh_name="tclsh8.5"; AC_MSG_RESULT(no))
6035 +   AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
6036 +   AC_SUBST(vi_cv_path_tcl)
6038 +   dnl when no specific version specified, also try 8.4, 8.2 and 8.0
6039 +   if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.5"; then
6040 +     tclsh_name="tclsh8.4"
6041 +     AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
6042 +   fi
6043 +   if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.4"; then
6044 +     tclsh_name="tclsh8.2"
6045 +     AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
6046 +   fi
6047 +   if test "X$vi_cv_path_tcl" = "X" -a $tclsh_name = "tclsh8.2"; then
6048 +     tclsh_name="tclsh8.0"
6049 +     AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
6050 +   fi
6051 +   dnl still didn't find it, try without version number
6052 +   if test "X$vi_cv_path_tcl" = "X"; then
6053 +     tclsh_name="tclsh"
6054 +     AC_PATH_PROG(vi_cv_path_tcl, $tclsh_name)
6055 +   fi
6056 +   if test "X$vi_cv_path_tcl" != "X"; then
6057 +     AC_MSG_CHECKING(Tcl version)
6058 +     if echo 'exit [[expr [info tclversion] < 8.0]]' | "$vi_cv_path_tcl" - ; then
6059 +       tclver=`echo 'puts [[info tclversion]]' | $vi_cv_path_tcl -`
6060 +       AC_MSG_RESULT($tclver - OK);
6061 +       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 -`
6062 +       tcldll=`echo 'puts libtcl[[info tclversion]][[info sharedlibextension]]' | $vi_cv_path_tcl -`
6064 +       AC_MSG_CHECKING(for location of Tcl include)
6065 +       if test "x$MACOSX" != "xyes"; then
6066 +       tclinc="$tclloc/include $tclloc/include/tcl $tclloc/include/tcl$tclver /usr/local/include /usr/local/include/tcl$tclver /usr/include /usr/include/tcl$tclver"
6067 +       else
6068 +       dnl For Mac OS X 10.3, use the OS-provided framework location
6069 +       tclinc="/System/Library/Frameworks/Tcl.framework/Headers"
6070 +       fi
6071 +       TCL_INC=
6072 +       for try in $tclinc; do
6073 +       if test -f "$try/tcl.h"; then
6074 +         AC_MSG_RESULT($try/tcl.h)
6075 +         TCL_INC=$try
6076 +         break
6077 +       fi
6078 +       done
6079 +       if test -z "$TCL_INC"; then
6080 +       AC_MSG_RESULT(<not found>)
6081 +       SKIP_TCL=YES
6082 +       fi
6083 +       if test -z "$SKIP_TCL"; then
6084 +       AC_MSG_CHECKING(for location of tclConfig.sh script)
6085 +       if test "x$MACOSX" != "xyes"; then
6086 +         tclcnf=`echo $tclinc | sed s/include/lib/g`
6087 +         tclcnf="$tclcnf `echo $tclinc | sed s/include/lib64/g`"
6088 +       else
6089 +         dnl For Mac OS X 10.3, use the OS-provided framework location
6090 +         tclcnf="/System/Library/Frameworks/Tcl.framework"
6091 +       fi
6092 +       for try in $tclcnf; do
6093 +         if test -f "$try/tclConfig.sh"; then
6094 +           AC_MSG_RESULT($try/tclConfig.sh)
6095 +           . "$try/tclConfig.sh"
6096 +           dnl use eval, because tcl 8.2 includes ${TCL_DBGX}
6097 +           if test "$enable_tclinterp" = "dynamic"; then
6098 +             TCL_LIBS=`eval echo "$TCL_STUB_LIB_SPEC $TCL_LIBS"`
6099 +           else
6100 +             TCL_LIBS=`eval echo "$TCL_LIB_SPEC $TCL_LIBS"`
6101 +           fi
6102 +           dnl Use $TCL_DEFS for -D_THREAD_SAFE et al.  But only use the
6103 +           dnl "-D_ABC" items.  Watch out for -DFOO=long\ long.
6104 +           TCL_DEFS=`echo $TCL_DEFS | sed -e 's/\\\\ /\\\\X/g' | tr ' ' '\012' | sed -e '/^[[^-]]/d' -e '/^-[[^D]]/d' -e '/-D[[^_]]/d' -e 's/-D_/ -D_/' | tr '\012' ' ' | sed -e 's/\\\\X/\\\\ /g'`
6105 +           break
6106 +         fi
6107 +       done
6108 +       if test -z "$TCL_LIBS"; then
6109 +         AC_MSG_RESULT(<not found>)
6110 +         AC_MSG_CHECKING(for Tcl library by myself)
6111 +         tcllib=`echo $tclinc | sed s/include/lib/g`
6112 +         tcllib="$tcllib `echo $tclinc | sed s/include/lib64/g`"
6113 +         for ext in .so .a ; do
6114 +           for ver in "" $tclver ; do
6115 +             for try in $tcllib ; do
6116 +               trylib=tcl$ver$ext
6117 +               if test -f "$try/lib$trylib" ; then
6118 +                 AC_MSG_RESULT($try/lib$trylib)
6119 +                 TCL_LIBS="-L\"$try\" -ltcl$ver -ldl -lm"
6120 +                 if test "`(uname) 2>/dev/null`" = SunOS &&
6121 +                                        uname -r | grep '^5' >/dev/null; then
6122 +                   TCL_LIBS="$TCL_LIBS -R $try"
6123 +                 fi
6124 +                 break 3
6125 +               fi
6126 +             done
6127 +           done
6128 +         done
6129 +         if test -z "$TCL_LIBS"; then
6130 +           AC_MSG_RESULT(<not found>)
6131 +           SKIP_TCL=YES
6132 +         fi
6133 +       fi
6134 +       if test -z "$SKIP_TCL"; then
6135 +         AC_DEFINE(FEAT_TCL)
6136 +         TCL_SRC=if_tcl.c
6137 +         TCL_OBJ=objects/if_tcl.o
6138 +         TCL_PRO=if_tcl.pro
6139 +         TCL_CFLAGS="-I$TCL_INC $TCL_DEFS"
6140 +       fi
6141 +       fi
6142 +     else
6143 +       AC_MSG_RESULT(too old; need Tcl version 8.0 or later)
6144 +     fi
6145 +   fi
6146 +   if test "$enable_tclinterp" = "dynamic"; then
6147 +     if test "X$TCL_SRC" != "X" -a "X$tcldll" != "X"; then
6148 +       AC_DEFINE(DYNAMIC_TCL)
6149 +       TCL_CFLAGS="-DDYNAMIC_TCL_DLL=\\\"$tcldll\\\" -DDYNAMIC_TCL_VER=\\\"$tclver\\\" $TCL_CFLAGS"
6150 +     fi
6151 +   fi
6152 +   if test "$fail_if_missing" = "yes" -a -z "$TCL_SRC"; then
6153 +     AC_MSG_ERROR([could not configure Tcl])
6154 +   fi
6155 + fi
6156 + AC_SUBST(TCL_SRC)
6157 + AC_SUBST(TCL_OBJ)
6158 + AC_SUBST(TCL_PRO)
6159 + AC_SUBST(TCL_CFLAGS)
6160 + AC_SUBST(TCL_LIBS)
6162 + AC_MSG_CHECKING(--enable-rubyinterp argument)
6163 + AC_ARG_ENABLE(rubyinterp,
6164 +       [  --enable-rubyinterp[=OPTS]     Include Ruby interpreter.  [default=no] [OPTS=no/yes/dynamic]], ,
6165 +       [enable_rubyinterp="no"])
6166 + AC_MSG_RESULT($enable_rubyinterp)
6167 + if test "$enable_rubyinterp" = "yes" -o "$enable_rubyinterp" = "dynamic"; then
6168 +   if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
6169 +     AC_MSG_ERROR([cannot use Ruby with tiny or small features])
6170 +   fi
6172 +   AC_MSG_CHECKING(--with-ruby-command argument)
6173 +   AC_SUBST(vi_cv_path_ruby)
6174 +   AC_ARG_WITH(ruby-command, [  --with-ruby-command=RUBY  name of the Ruby command (default: ruby)],
6175 +       RUBY_CMD="$withval"; vi_cv_path_ruby="$withval"; AC_MSG_RESULT($RUBY_CMD),
6176 +       RUBY_CMD="ruby"; AC_MSG_RESULT(defaulting to $RUBY_CMD))
6177 +   AC_PATH_PROG(vi_cv_path_ruby, $RUBY_CMD)
6178 +   if test "X$vi_cv_path_ruby" != "X"; then
6179 +     AC_MSG_CHECKING(Ruby version)
6180 +     if $vi_cv_path_ruby -e '(VERSION rescue RUBY_VERSION) >= "1.6.0" or exit 1' >/dev/null 2>/dev/null; then
6181 +       AC_MSG_RESULT(OK)
6182 +       AC_MSG_CHECKING(Ruby rbconfig)
6183 +       ruby_rbconfig="RbConfig"
6184 +       if ! $vi_cv_path_ruby -r rbconfig -e 'RbConfig' >/dev/null 2>/dev/null; then
6185 +       ruby_rbconfig="Config"
6186 +       fi
6187 +       AC_MSG_RESULT($ruby_rbconfig)
6188 +       AC_MSG_CHECKING(Ruby header files)
6189 +       rubyhdrdir=`$vi_cv_path_ruby -r mkmf -e "print $ruby_rbconfig::CONFIG[['rubyhdrdir']] || $ruby_rbconfig::CONFIG[['archdir']] || \\$hdrdir" 2>/dev/null`
6190 +       if test "X$rubyhdrdir" != "X"; then
6191 +       AC_MSG_RESULT($rubyhdrdir)
6192 +       RUBY_CFLAGS="-I$rubyhdrdir"
6193 +         rubyarchdir=`$vi_cv_path_ruby -r rbconfig -e "print ($ruby_rbconfig::CONFIG.has_key? 'rubyarchhdrdir') ? $ruby_rbconfig::CONFIG[['rubyarchhdrdir']] : '$rubyhdrdir/'+$ruby_rbconfig::CONFIG[['arch']]"`
6194 +         if test -d "$rubyarchdir"; then
6195 +           RUBY_CFLAGS="$RUBY_CFLAGS -I$rubyarchdir"
6196 +         fi
6197 +         rubyversion=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG[['ruby_version']].gsub(/\./, '')[[0,2]]"`
6198 +       if test "X$rubyversion" = "X"; then
6199 +         rubyversion=`$vi_cv_path_ruby -e "print ((VERSION rescue RUBY_VERSION)).gsub(/\./, '')[[0,2]]"`
6200 +       fi
6201 +         RUBY_CFLAGS="$RUBY_CFLAGS -DRUBY_VERSION=$rubyversion"
6202 +       rubylibs=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG[['LIBS']]"`
6203 +       if test "X$rubylibs" != "X"; then
6204 +         RUBY_LIBS="$rubylibs"
6205 +       fi
6206 +       librubyarg=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG[['LIBRUBYARG']])"`
6207 +       librubya=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG[['LIBRUBY_A']])"`
6208 +       rubylibdir=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG[['libdir']])"`
6209 +       if test -f "$rubylibdir/$librubya"; then
6210 +         librubyarg="$librubyarg"
6211 +         RUBY_LIBS="$RUBY_LIBS -L$rubylibdir"
6212 +       elif test "$librubyarg" = "libruby.a"; then
6213 +         dnl required on Mac OS 10.3 where libruby.a doesn't exist
6214 +         librubyarg="-lruby"
6215 +         RUBY_LIBS="$RUBY_LIBS -L$rubylibdir"
6216 +       fi
6218 +       if test "X$librubyarg" != "X"; then
6219 +         RUBY_LIBS="$librubyarg $RUBY_LIBS"
6220 +       fi
6221 +       rubyldflags=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig::CONFIG[['LDFLAGS']]"`
6222 +       if test "X$rubyldflags" != "X"; then
6223 +         dnl Ruby on Mac OS X 10.5 adds "-arch" flags but these should only
6224 +         dnl be included if requested by passing --with-mac-arch to
6225 +         dnl configure, so strip these flags first (if present)
6226 +         rubyldflags=`echo "$rubyldflags" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'`
6227 +         if test "X$rubyldflags" != "X"; then
6228 +           if test "X`echo \"$LDFLAGS\" | $FGREP -e \"$rubyldflags\"`" = "X"; then
6229 +             LDFLAGS="$rubyldflags $LDFLAGS"
6230 +           fi
6231 +         fi
6232 +       fi
6233 +       RUBY_SRC="if_ruby.c"
6234 +       RUBY_OBJ="objects/if_ruby.o"
6235 +       RUBY_PRO="if_ruby.pro"
6236 +       AC_DEFINE(FEAT_RUBY)
6237 +       if test "$enable_rubyinterp" = "dynamic"; then
6238 +         libruby=`$vi_cv_path_ruby -r rbconfig -e "puts $ruby_rbconfig::CONFIG[['LIBRUBY_SO']]"`
6239 +         AC_DEFINE(DYNAMIC_RUBY)
6240 +         RUBY_CFLAGS="-DDYNAMIC_RUBY_DLL=\\\"$libruby\\\" -DDYNAMIC_RUBY_VER=$rubyversion $RUBY_CFLAGS"
6241 +         RUBY_LIBS=
6242 +       fi
6243 +       else
6244 +       AC_MSG_RESULT(not found; disabling Ruby)
6245 +       fi
6246 +     else
6247 +       AC_MSG_RESULT(too old; need Ruby version 1.6.0 or later)
6248 +     fi
6249 +   fi
6251 +   if test "$fail_if_missing" = "yes" -a -z "$RUBY_OBJ"; then
6252 +     AC_MSG_ERROR([could not configure Ruby])
6253 +   fi
6254 + fi
6255 + AC_SUBST(RUBY_SRC)
6256 + AC_SUBST(RUBY_OBJ)
6257 + AC_SUBST(RUBY_PRO)
6258 + AC_SUBST(RUBY_CFLAGS)
6259 + AC_SUBST(RUBY_LIBS)
6261 + AC_MSG_CHECKING(--enable-cscope argument)
6262 + AC_ARG_ENABLE(cscope,
6263 +       [  --enable-cscope         Include cscope interface.], ,
6264 +       [enable_cscope="no"])
6265 + AC_MSG_RESULT($enable_cscope)
6266 + if test "$enable_cscope" = "yes"; then
6267 +   AC_DEFINE(FEAT_CSCOPE)
6268 + fi
6270 + AC_MSG_CHECKING(--enable-workshop argument)
6271 + AC_ARG_ENABLE(workshop,
6272 +       [  --enable-workshop       Include Sun Visual Workshop support.], ,
6273 +       [enable_workshop="no"])
6274 + AC_MSG_RESULT($enable_workshop)
6275 + if test "$enable_workshop" = "yes"; then
6276 +   AC_DEFINE(FEAT_SUN_WORKSHOP)
6277 +   WORKSHOP_SRC="workshop.c integration.c"
6278 +   AC_SUBST(WORKSHOP_SRC)
6279 +   WORKSHOP_OBJ="objects/workshop.o objects/integration.o"
6280 +   AC_SUBST(WORKSHOP_OBJ)
6281 +   if test "${enable_gui-xxx}" = xxx; then
6282 +     enable_gui=motif
6283 +   fi
6284 + fi
6286 + AC_MSG_CHECKING(--disable-netbeans argument)
6287 + AC_ARG_ENABLE(netbeans,
6288 +       [  --disable-netbeans      Disable NetBeans integration support.],
6289 +       , [enable_netbeans="yes"])
6290 + if test "$enable_netbeans" = "yes"; then
6291 +   if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
6292 +     AC_MSG_RESULT([cannot use NetBeans with tiny or small features])
6293 +     enable_netbeans="no"
6294 +   else
6295 +     AC_MSG_RESULT(no)
6296 +   fi
6297 + else
6298 +   AC_MSG_RESULT(yes)
6299 + fi
6301 + AC_MSG_CHECKING(--disable-channel argument)
6302 + AC_ARG_ENABLE(channel,
6303 +       [  --disable-channel      Disable process communication support.],
6304 +       , [enable_channel="yes"])
6305 + if test "$enable_channel" = "yes"; then
6306 +   if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
6307 +     AC_MSG_RESULT([cannot use channels with tiny or small features])
6308 +     enable_channel="no"
6309 +   else
6310 +     AC_MSG_RESULT(no)
6311 +   fi
6312 + else
6313 +   if test "$enable_netbeans" = "yes"; then
6314 +     AC_MSG_RESULT([yes, netbeans also disabled])
6315 +     enable_netbeans="no"
6316 +   else
6317 +     AC_MSG_RESULT(yes)
6318 +   fi
6319 + fi
6321 + if test "$enable_channel" = "yes"; then
6322 +   dnl On Solaris we need the socket and nsl library.
6323 +   AC_CHECK_LIB(socket, socket)
6324 +   AC_CHECK_LIB(nsl, gethostbyname)
6325 +   AC_MSG_CHECKING(whether compiling with process communication is possible)
6326 +   AC_TRY_LINK([
6327 + #include <stdio.h>
6328 + #include <stdlib.h>
6329 + #include <stdarg.h>
6330 + #include <fcntl.h>
6331 + #include <netdb.h>
6332 + #include <netinet/in.h>
6333 + #include <errno.h>
6334 + #include <sys/types.h>
6335 + #include <sys/socket.h>
6336 +       /* Check bitfields */
6337 +       struct nbbuf {
6338 +       unsigned int  initDone:1;
6339 +       ushort signmaplen;
6340 +       };
6341 +           ], [
6342 +               /* Check creating a socket. */
6343 +               struct sockaddr_in server;
6344 +               (void)socket(AF_INET, SOCK_STREAM, 0);
6345 +               (void)htons(100);
6346 +               (void)gethostbyname("microsoft.com");
6347 +               if (errno == ECONNREFUSED)
6348 +                 (void)connect(1, (struct sockaddr *)&server, sizeof(server));
6349 +           ],
6350 +       AC_MSG_RESULT(yes),
6351 +       AC_MSG_RESULT(no); enable_netbeans="no"; enable_channel="no")
6352 + fi
6353 + if test "$enable_netbeans" = "yes"; then
6354 +   AC_DEFINE(FEAT_NETBEANS_INTG)
6355 +   NETBEANS_SRC="netbeans.c"
6356 +   AC_SUBST(NETBEANS_SRC)
6357 +   NETBEANS_OBJ="objects/netbeans.o"
6358 +   AC_SUBST(NETBEANS_OBJ)
6359 + fi
6360 + if test "$enable_channel" = "yes"; then
6361 +   AC_DEFINE(FEAT_JOB_CHANNEL)
6362 +   CHANNEL_SRC="channel.c"
6363 +   AC_SUBST(CHANNEL_SRC)
6364 +   CHANNEL_OBJ="objects/channel.o"
6365 +   AC_SUBST(CHANNEL_OBJ)
6366 + fi
6368 + AC_MSG_CHECKING(--enable-multibyte argument)
6369 + AC_ARG_ENABLE(multibyte,
6370 +       [  --enable-multibyte      Include multibyte editing support.], ,
6371 +       [enable_multibyte="no"])
6372 + AC_MSG_RESULT($enable_multibyte)
6373 + if test "$enable_multibyte" = "yes"; then
6374 +   AC_DEFINE(FEAT_MBYTE)
6375 + fi
6377 + AC_MSG_CHECKING(--enable-hangulinput argument)
6378 + AC_ARG_ENABLE(hangulinput,
6379 +       [  --enable-hangulinput    Include Hangul input support.], ,
6380 +       [enable_hangulinput="no"])
6381 + AC_MSG_RESULT($enable_hangulinput)
6383 + AC_MSG_CHECKING(--enable-xim argument)
6384 + AC_ARG_ENABLE(xim,
6385 +       [  --enable-xim            Include XIM input support.],
6386 +       AC_MSG_RESULT($enable_xim),
6387 +       [enable_xim="auto"; AC_MSG_RESULT(defaulting to auto)])
6389 + AC_MSG_CHECKING(--enable-fontset argument)
6390 + AC_ARG_ENABLE(fontset,
6391 +       [  --enable-fontset        Include X fontset output support.], ,
6392 +       [enable_fontset="no"])
6393 + AC_MSG_RESULT($enable_fontset)
6394 + dnl defining FEAT_XFONTSET is delayed, so that it can be disabled for no GUI
6396 + test -z "$with_x" && with_x=yes
6397 + test "${enable_gui-yes}" != no -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && with_x=yes
6398 + if test "$with_x" = no; then
6399 +   AC_MSG_RESULT(defaulting to: don't HAVE_X11)
6400 + else
6401 +   dnl Do this check early, so that its failure can override user requests.
6403 +   AC_PATH_PROG(xmkmfpath, xmkmf)
6405 +   AC_PATH_XTRA
6407 +   dnl On z/OS Unix the X libraries are DLLs. To use them the code must
6408 +   dnl be compiled with a special option.
6409 +   dnl Also add SM, ICE and Xmu to X_EXTRA_LIBS.
6410 +   if test "$zOSUnix" = "yes"; then
6411 +     CFLAGS="$CFLAGS -W c,dll"
6412 +     LDFLAGS="$LDFLAGS -W l,dll"
6413 +     X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE -lXmu"
6414 +   fi
6416 +   dnl On my HPUX system the X include dir is found, but the lib dir not.
6417 +   dnl This is a desparate try to fix this.
6419 +   if test -d "$x_includes" && test ! -d "$x_libraries"; then
6420 +     x_libraries=`echo "$x_includes" | sed s/include/lib/`
6421 +     AC_MSG_RESULT(Corrected X libraries to $x_libraries)
6422 +     X_LIBS="$X_LIBS -L$x_libraries"
6423 +     if test "`(uname) 2>/dev/null`" = SunOS &&
6424 +                                        uname -r | grep '^5' >/dev/null; then
6425 +       X_LIBS="$X_LIBS -R $x_libraries"
6426 +     fi
6427 +   fi
6429 +   if test -d "$x_libraries" && test ! -d "$x_includes"; then
6430 +     x_includes=`echo "$x_libraries" | sed s/lib/include/`
6431 +     AC_MSG_RESULT(Corrected X includes to $x_includes)
6432 +     X_CFLAGS="$X_CFLAGS -I$x_includes"
6433 +   fi
6435 +   dnl Remove "-I/usr/include " from X_CFLAGS, should not be needed.
6436 +   X_CFLAGS="`echo $X_CFLAGS\  | sed 's%-I/usr/include %%'`"
6437 +   dnl Remove "-L/usr/lib " from X_LIBS, should not be needed.
6438 +   X_LIBS="`echo $X_LIBS\  | sed 's%-L/usr/lib %%'`"
6439 +   dnl Same for "-R/usr/lib ".
6440 +   X_LIBS="`echo $X_LIBS\  | sed -e 's%-R/usr/lib %%' -e 's%-R /usr/lib %%'`"
6443 +   dnl Check if the X11 header files are correctly installed. On some systems
6444 +   dnl Xlib.h includes files that don't exist.  On some systems X11/Intrinsic.h
6445 +   dnl is missing.
6446 +   AC_MSG_CHECKING(if X11 header files can be found)
6447 +   cflags_save=$CFLAGS
6448 +   CFLAGS="$CFLAGS $X_CFLAGS"
6449 +   AC_TRY_COMPILE([#include <X11/Xlib.h>
6450 + #include <X11/Intrinsic.h>], ,
6451 +       AC_MSG_RESULT(yes),
6452 +       AC_MSG_RESULT(no); no_x=yes)
6453 +   CFLAGS=$cflags_save
6455 +   if test "${no_x-no}" = yes; then
6456 +     with_x=no
6457 +   else
6458 +     AC_DEFINE(HAVE_X11)
6459 +     X_LIB="-lXt -lX11";
6460 +     AC_SUBST(X_LIB)
6462 +     ac_save_LDFLAGS="$LDFLAGS"
6463 +     LDFLAGS="-L$x_libraries $LDFLAGS"
6465 +     dnl Check for -lXdmcp (needed on SunOS 4.1.4)
6466 +     dnl For HP-UX 10.20 it must be before -lSM -lICE
6467 +     AC_CHECK_LIB(Xdmcp, _XdmcpAuthDoIt, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lXdmcp"],,
6468 +               [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS -lXdmcp])
6470 +     dnl Some systems need -lnsl -lsocket when testing for ICE.
6471 +     dnl The check above doesn't do this, try here (again).  Also needed to get
6472 +     dnl them after Xdmcp.  link.sh will remove them when not needed.
6473 +     dnl Check for other function than above to avoid the cached value
6474 +     AC_CHECK_LIB(ICE, IceOpenConnection,
6475 +                 [X_EXTRA_LIBS="$X_EXTRA_LIBS -lSM -lICE"],, [$X_EXTRA_LIBS])
6477 +     dnl Check for -lXpm (needed for some versions of Motif)
6478 +     LDFLAGS="$X_LIBS $ac_save_LDFLAGS"
6479 +     AC_CHECK_LIB(Xpm, XpmCreatePixmapFromData, [X_PRE_LIBS="$X_PRE_LIBS -lXpm"],,
6480 +               [-lXt $X_PRE_LIBS -lXpm -lX11 $X_EXTRA_LIBS])
6482 +     dnl Check that the X11 header files don't use implicit declarations
6483 +     AC_MSG_CHECKING(if X11 header files implicitly declare return values)
6484 +     cflags_save=$CFLAGS
6485 +     dnl -Werror is GCC only, others like Solaris Studio might not like it
6486 +     if test "$GCC" = yes; then
6487 +       CFLAGS="$CFLAGS $X_CFLAGS -Werror"
6488 +     else
6489 +       CFLAGS="$CFLAGS $X_CFLAGS"
6490 +     fi
6491 +     AC_TRY_COMPILE([#include <X11/Xlib.h>], ,
6492 +       AC_MSG_RESULT(no),
6493 +       CFLAGS="$CFLAGS -Wno-implicit-int"
6494 +       AC_TRY_COMPILE([#include <X11/Xlib.h>], ,
6495 +           AC_MSG_RESULT(yes); cflags_save="$cflags_save -Wno-implicit-int",
6496 +           AC_MSG_RESULT(test failed)
6497 +       )
6498 +     )
6499 +     CFLAGS=$cflags_save
6501 +     LDFLAGS="$ac_save_LDFLAGS"
6503 +     AC_MSG_CHECKING(size of wchar_t is 2 bytes)
6504 +     AC_CACHE_VAL(ac_cv_small_wchar_t,
6505 +       [AC_TRY_RUN([
6506 + #include <X11/Xlib.h>
6507 + #if STDC_HEADERS
6508 + # include <stdlib.h>
6509 + # include <stddef.h>
6510 + #endif
6511 +               main()
6512 +               {
6513 +                 if (sizeof(wchar_t) <= 2)
6514 +                   exit(1);
6515 +                 exit(0);
6516 +               }],
6517 +               ac_cv_small_wchar_t="no",
6518 +               ac_cv_small_wchar_t="yes",
6519 +               AC_MSG_ERROR(failed to compile test program))])
6520 +     AC_MSG_RESULT($ac_cv_small_wchar_t)
6521 +     if test "x$ac_cv_small_wchar_t" = "xyes" ; then
6522 +       AC_DEFINE(SMALL_WCHAR_T)
6523 +     fi
6525 +   fi
6526 + fi
6528 + test "x$with_x" = xno -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && enable_gui=no
6530 + AC_MSG_CHECKING(--enable-gui argument)
6531 + AC_ARG_ENABLE(gui,
6532 +  [  --enable-gui[=OPTS]     X11 GUI [default=auto] [OPTS=auto/no/gtk2/gnome2/gtk3/motif/athena/neXtaw/photon/carbon]], , enable_gui="auto")
6534 + dnl Canonicalize the --enable-gui= argument so that it can be easily compared.
6535 + dnl Do not use character classes for portability with old tools.
6536 + enable_gui_canon=`echo "_$enable_gui" | \
6537 +       sed 's/[[ _+-]]//g;y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
6539 + dnl Skip everything by default.
6540 + SKIP_GTK2=YES
6541 + SKIP_GTK3=YES
6542 + SKIP_GNOME=YES
6543 + SKIP_MOTIF=YES
6544 + SKIP_ATHENA=YES
6545 + SKIP_NEXTAW=YES
6546 + SKIP_PHOTON=YES
6547 + SKIP_CARBON=YES
6548 + GUITYPE=NONE
6550 + if test "x$QNX" = "xyes" -a "x$with_x" = "xno" ; then
6551 +   SKIP_PHOTON=
6552 +   case "$enable_gui_canon" in
6553 +     no)               AC_MSG_RESULT(no GUI support)
6554 +               SKIP_PHOTON=YES ;;
6555 +     yes|"")   AC_MSG_RESULT(yes - automatic GUI support) ;;
6556 +     auto)     AC_MSG_RESULT(auto - automatic GUI support) ;;
6557 +     photon)   AC_MSG_RESULT(Photon GUI support) ;;
6558 +     *)                AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported])
6559 +               SKIP_PHOTON=YES ;;
6560 +   esac
6562 + elif test "x$MACOSX" = "xyes" -a "x$with_x" = "xno" ; then
6563 +   SKIP_CARBON=
6564 +   case "$enable_gui_canon" in
6565 +     no)               AC_MSG_RESULT(no GUI support)
6566 +               SKIP_CARBON=YES ;;
6567 +     yes|"")   AC_MSG_RESULT(yes - automatic GUI support) ;;
6568 +     auto)     AC_MSG_RESULT(auto - Carbon GUI is outdated - disable GUI support)
6569 +               SKIP_CARBON=YES ;;
6570 +     carbon)   AC_MSG_RESULT(Carbon GUI support) ;;
6571 +     *)                AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported])
6572 +               SKIP_CARBON=YES ;;
6573 +   esac
6575 + else
6577 +   case "$enable_gui_canon" in
6578 +     no|none)  AC_MSG_RESULT(no GUI support) ;;
6579 +     yes|""|auto)      AC_MSG_RESULT(yes/auto - automatic GUI support)
6580 +               SKIP_GTK2=
6581 +               SKIP_GNOME=
6582 +               SKIP_MOTIF=
6583 +               SKIP_ATHENA=
6584 +               SKIP_NEXTAW=
6585 +               SKIP_CARBON=;;
6586 +     gtk2)     AC_MSG_RESULT(GTK+ 2.x GUI support)
6587 +               SKIP_GTK2=;;
6588 +     gnome2)   AC_MSG_RESULT(GNOME 2.x GUI support)
6589 +               SKIP_GNOME=
6590 +               SKIP_GTK2=;;
6591 +     gtk3)     AC_MSG_RESULT(GTK+ 3.x GUI support)
6592 +               SKIP_GTK3=;;
6593 +     motif)    AC_MSG_RESULT(Motif GUI support)
6594 +               SKIP_MOTIF=;;
6595 +     athena)   AC_MSG_RESULT(Athena GUI support)
6596 +               SKIP_ATHENA=;;
6597 +     nextaw)   AC_MSG_RESULT(neXtaw GUI support)
6598 +               SKIP_NEXTAW=;;
6599 +     *)                AC_MSG_RESULT([Sorry, $enable_gui GUI is not supported]) ;;
6600 +   esac
6602 + fi
6604 + if test "x$SKIP_GTK2" != "xYES" -a "$enable_gui_canon" != "gtk2" \
6605 +                               -a "$enable_gui_canon" != "gnome2"; then
6606 +   AC_MSG_CHECKING(whether or not to look for GTK+ 2)
6607 +   AC_ARG_ENABLE(gtk2-check,
6608 +       [  --enable-gtk2-check     If auto-select GUI, check for GTK+ 2 [default=yes]],
6609 +       , enable_gtk2_check="yes")
6610 +   AC_MSG_RESULT($enable_gtk2_check)
6611 +   if test "x$enable_gtk2_check" = "xno"; then
6612 +     SKIP_GTK2=YES
6613 +     SKIP_GNOME=YES
6614 +   fi
6615 + fi
6617 + if test "x$SKIP_GNOME" != "xYES" -a "$enable_gui_canon" != "gnome2"; then
6618 +   AC_MSG_CHECKING(whether or not to look for GNOME)
6619 +   AC_ARG_ENABLE(gnome-check,
6620 +       [  --enable-gnome-check    If GTK GUI, check for GNOME [default=no]],
6621 +       , enable_gnome_check="no")
6622 +   AC_MSG_RESULT($enable_gnome_check)
6623 +   if test "x$enable_gnome_check" = "xno"; then
6624 +     SKIP_GNOME=YES
6625 +   fi
6626 + fi
6628 + if test "x$SKIP_GTK3" != "xYES" -a "$enable_gui_canon" != "gtk3"; then
6629 +   AC_MSG_CHECKING(whether or not to look for GTK+ 3)
6630 +   AC_ARG_ENABLE(gtk3-check,
6631 +       [  --enable-gtk3-check     If auto-select GUI, check for GTK+ 3 [default=yes]],
6632 +       , enable_gtk3_check="yes")
6633 +   AC_MSG_RESULT($enable_gtk3_check)
6634 +   if test "x$enable_gtk3_check" = "xno"; then
6635 +     SKIP_GTK3=YES
6636 +   fi
6637 + fi
6639 + if test "x$SKIP_MOTIF" != "xYES" -a "$enable_gui_canon" != "motif"; then
6640 +   AC_MSG_CHECKING(whether or not to look for Motif)
6641 +   AC_ARG_ENABLE(motif-check,
6642 +       [  --enable-motif-check    If auto-select GUI, check for Motif [default=yes]],
6643 +       , enable_motif_check="yes")
6644 +   AC_MSG_RESULT($enable_motif_check)
6645 +   if test "x$enable_motif_check" = "xno"; then
6646 +     SKIP_MOTIF=YES
6647 +   fi
6648 + fi
6650 + if test "x$SKIP_ATHENA" != "xYES" -a "$enable_gui_canon" != "athena"; then
6651 +   AC_MSG_CHECKING(whether or not to look for Athena)
6652 +   AC_ARG_ENABLE(athena-check,
6653 +       [  --enable-athena-check   If auto-select GUI, check for Athena [default=yes]],
6654 +       , enable_athena_check="yes")
6655 +   AC_MSG_RESULT($enable_athena_check)
6656 +   if test "x$enable_athena_check" = "xno"; then
6657 +     SKIP_ATHENA=YES
6658 +   fi
6659 + fi
6661 + if test "x$SKIP_NEXTAW" != "xYES" -a "$enable_gui_canon" != "nextaw"; then
6662 +   AC_MSG_CHECKING(whether or not to look for neXtaw)
6663 +   AC_ARG_ENABLE(nextaw-check,
6664 +       [  --enable-nextaw-check   If auto-select GUI, check for neXtaw [default=yes]],
6665 +       , enable_nextaw_check="yes")
6666 +   AC_MSG_RESULT($enable_nextaw_check);
6667 +   if test "x$enable_nextaw_check" = "xno"; then
6668 +     SKIP_NEXTAW=YES
6669 +   fi
6670 + fi
6672 + if test "x$SKIP_CARBON" != "xYES" -a "$enable_gui_canon" != "carbon"; then
6673 +   AC_MSG_CHECKING(whether or not to look for Carbon)
6674 +   AC_ARG_ENABLE(carbon-check,
6675 +       [  --enable-carbon-check   If auto-select GUI, check for Carbon [default=yes]],
6676 +       , enable_carbon_check="yes")
6677 +   AC_MSG_RESULT($enable_carbon_check);
6678 +   if test "x$enable_carbon_check" = "xno"; then
6679 +     SKIP_CARBON=YES
6680 +   fi
6681 + fi
6684 + if test "x$MACOSX" = "xyes" -a -z "$SKIP_CARBON" -a "x$CARBON" = "xyes"; then
6685 +   AC_MSG_CHECKING(for Carbon GUI)
6686 +   dnl already did the check, just give the message
6687 +   AC_MSG_RESULT(yes);
6688 +   GUITYPE=CARBONGUI
6689 +   if test "$VIMNAME" = "vim"; then
6690 +     VIMNAME=Vim
6691 +   fi
6693 +   if test "x$MACARCH" = "xboth"; then
6694 +     CPPFLAGS="$CPPFLAGS -I$DEVELOPER_DIR/SDKs/MacOSX10.4u.sdk/Developer/Headers/FlatCarbon"
6695 +   else
6696 +     CPPFLAGS="$CPPFLAGS -I$DEVELOPER_DIR/Headers/FlatCarbon"
6697 +   fi
6699 +   dnl Default install directory is not /usr/local
6700 +   if test x$prefix = xNONE; then
6701 +     prefix=/Applications
6702 +   fi
6704 +   dnl Sorry for the hard coded default
6705 +   datadir='${prefix}/Vim.app/Contents/Resources'
6707 +   dnl skip everything else
6708 +   SKIP_GTK2=YES;
6709 +   SKIP_GNOME=YES;
6710 +   SKIP_MOTIF=YES;
6711 +   SKIP_ATHENA=YES;
6712 +   SKIP_NEXTAW=YES;
6713 +   SKIP_PHOTON=YES;
6714 +   SKIP_CARBON=YES
6715 + fi
6717 + dnl define an autoconf function to check for a specified version of GTK, and
6718 + dnl try to compile/link a GTK program.
6719 + dnl
6720 + dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
6721 + dnl Test for GTK, and define GTK_CFLAGS, GTK_LIBDIR and GTK_LIBS
6722 + dnl
6723 + AC_DEFUN(AM_PATH_GTK,
6724 + [
6725 +   if test "X$GTK_CONFIG" != "Xno" -o "X$PKG_CONFIG" != "Xno"; then
6726 +   {
6727 +     no_gtk=""
6728 +     if (test "X$SKIP_GTK2" != "XYES" -a "X$PKG_CONFIG" != "Xno") \
6729 +         && $PKG_CONFIG --exists gtk+-2.0; then
6730 +     {
6731 +       min_gtk_version=ifelse([$1], ,2.2.0,$1)
6732 +       AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
6733 +       dnl We should be using PKG_CHECK_MODULES() instead of this hack.
6734 +       dnl But I guess the dependency on pkgconfig.m4 is not wanted or
6735 +       dnl something like that.
6736 +       GTK_CFLAGS=`$PKG_CONFIG --cflags gtk+-2.0`
6737 +       GTK_LIBDIR=`$PKG_CONFIG --libs-only-L gtk+-2.0`
6738 +       GTK_LIBS=`$PKG_CONFIG --libs gtk+-2.0`
6739 +       gtk_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
6740 +            sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
6741 +       gtk_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
6742 +            sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
6743 +       gtk_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
6744 +            sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
6745 +     }
6746 +     elif (test "X$SKIP_GTK3" != "XYES" -a "X$PKG_CONFIG" != "Xno") \
6747 +         && $PKG_CONFIG --exists gtk+-3.0; then
6748 +     {
6749 +       min_gtk_version=ifelse([$1], ,3.0.0,$1)
6750 +       AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
6752 +       GTK_CFLAGS=`$PKG_CONFIG --cflags gtk+-3.0`
6753 +       GTK_LIBDIR=`$PKG_CONFIG --libs-only-L gtk+-3.0`
6754 +       GTK_LIBS=`$PKG_CONFIG --libs gtk+-3.0`
6755 +       gtk_major_version=`$PKG_CONFIG --modversion gtk+-3.0 | \
6756 +            sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
6757 +       gtk_minor_version=`$PKG_CONFIG --modversion gtk+-3.0 | \
6758 +            sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
6759 +       gtk_micro_version=`$PKG_CONFIG --modversion gtk+-3.0 | \
6760 +            sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
6761 +     }
6762 +     else
6763 +       no_gtk=yes
6764 +     fi
6766 +     if test "x$enable_gtktest" = "xyes" -a "x$no_gtk" = "x"; then
6767 +     {
6768 +       ac_save_CFLAGS="$CFLAGS"
6769 +       ac_save_LIBS="$LIBS"
6770 +       CFLAGS="$CFLAGS $GTK_CFLAGS"
6771 +       LIBS="$LIBS $GTK_LIBS"
6773 +       dnl
6774 +       dnl Now check if the installed GTK is sufficiently new.
6775 +       dnl
6776 +       rm -f conf.gtktest
6777 +       AC_TRY_RUN([
6778 + #include <gtk/gtk.h>
6779 + #include <stdio.h>
6780 + #if STDC_HEADERS
6781 + # include <stdlib.h>
6782 + # include <stddef.h>
6783 + #endif
6785 + int
6786 + main ()
6787 + {
6788 + int major, minor, micro;
6789 + char *tmp_version;
6791 + system ("touch conf.gtktest");
6793 + /* HP/UX 9 (%@#!) writes to sscanf strings */
6794 + tmp_version = g_strdup("$min_gtk_version");
6795 + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
6796 +    printf("%s, bad version string\n", "$min_gtk_version");
6797 +    exit(1);
6798 +  }
6800 + if ((gtk_major_version > major) ||
6801 +     ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
6802 +     ((gtk_major_version == major) && (gtk_minor_version == minor) &&
6803 +                                    (gtk_micro_version >= micro)))
6804 + {
6805 +     return 0;
6806 + }
6807 + return 1;
6808 + }
6809 + ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
6810 +       CFLAGS="$ac_save_CFLAGS"
6811 +       LIBS="$ac_save_LIBS"
6812 +     }
6813 +     fi
6814 +     if test "x$no_gtk" = x ; then
6815 +       if test "x$enable_gtktest" = "xyes"; then
6816 +       AC_MSG_RESULT(yes; found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version)
6817 +       else
6818 +       AC_MSG_RESULT(found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version)
6819 +       fi
6820 +       ifelse([$2], , :, [$2])
6821 +     else
6822 +     {
6823 +       AC_MSG_RESULT(no)
6824 +       GTK_CFLAGS=""
6825 +       GTK_LIBS=""
6826 +       ifelse([$3], , :, [$3])
6827 +     }
6828 +     fi
6829 +   }
6830 +   else
6831 +     GTK_CFLAGS=""
6832 +     GTK_LIBS=""
6833 +     ifelse([$3], , :, [$3])
6834 +   fi
6835 +   AC_SUBST(GTK_CFLAGS)
6836 +   AC_SUBST(GTK_LIBS)
6837 +   rm -f conf.gtktest
6838 + ])
6840 + dnl ---------------------------------------------------------------------------
6841 + dnl gnome
6842 + dnl ---------------------------------------------------------------------------
6843 + AC_DEFUN([GNOME_INIT_HOOK],
6844 + [
6845 +   AC_SUBST(GNOME_LIBS)
6846 +   AC_SUBST(GNOME_LIBDIR)
6847 +   AC_SUBST(GNOME_INCLUDEDIR)
6849 +   AC_ARG_WITH(gnome-includes,
6850 +     [  --with-gnome-includes=DIR Specify location of GNOME headers],
6851 +     [CFLAGS="$CFLAGS -I$withval"]
6852 +   )
6854 +   AC_ARG_WITH(gnome-libs,
6855 +     [  --with-gnome-libs=DIR   Specify location of GNOME libs],
6856 +     [LDFLAGS="$LDFLAGS -L$withval" gnome_prefix=$withval]
6857 +   )
6859 +   AC_ARG_WITH(gnome,
6860 +     [  --with-gnome            Specify prefix for GNOME files],
6861 +     if test x$withval = xyes; then
6862 +       want_gnome=yes
6863 +       ifelse([$1], [], :, [$1])
6864 +     else
6865 +       if test "x$withval" = xno; then
6866 +       want_gnome=no
6867 +       else
6868 +       want_gnome=yes
6869 +       LDFLAGS="$LDFLAGS -L$withval/lib"
6870 +       CFLAGS="$CFLAGS -I$withval/include"
6871 +       gnome_prefix=$withval/lib
6872 +       fi
6873 +     fi,
6874 +     want_gnome=yes)
6876 +   if test "x$want_gnome" = xyes; then
6877 +   {
6878 +     AC_MSG_CHECKING(for libgnomeui-2.0)
6879 +     if $PKG_CONFIG --exists libgnomeui-2.0; then
6880 +       AC_MSG_RESULT(yes)
6881 +       GNOME_LIBS=`$PKG_CONFIG --libs-only-l libgnomeui-2.0`
6882 +       GNOME_LIBDIR=`$PKG_CONFIG --libs-only-L libgnomeui-2.0`
6883 +       GNOME_INCLUDEDIR=`$PKG_CONFIG --cflags libgnomeui-2.0`
6885 +       dnl On FreeBSD we need -pthread but pkg-config doesn't include it.
6886 +       dnl This might not be the right way but it works for me...
6887 +       AC_MSG_CHECKING(for FreeBSD)
6888 +       if test "`(uname) 2>/dev/null`" = FreeBSD; then
6889 +       AC_MSG_RESULT(yes, adding -pthread)
6890 +       GNOME_INCLUDEDIR="$GNOME_INCLUDEDIR -D_THREAD_SAFE"
6891 +       GNOME_LIBS="$GNOME_LIBS -pthread"
6892 +       else
6893 +       AC_MSG_RESULT(no)
6894 +       fi
6895 +       $1
6896 +     else
6897 +       AC_MSG_RESULT(not found)
6898 +       if test "x$2" = xfail; then
6899 +       AC_MSG_ERROR(Could not find libgnomeui-2.0 via pkg-config)
6900 +       fi
6901 +     fi
6902 +   }
6903 +   fi
6904 + ])
6906 + AC_DEFUN([GNOME_INIT],[
6907 +       GNOME_INIT_HOOK([],fail)
6908 + ])
6911 + dnl ---------------------------------------------------------------------------
6912 + dnl Check for GTK2.  If it fails, then continue on for Motif as before...
6913 + dnl ---------------------------------------------------------------------------
6914 + if test -z "$SKIP_GTK2"; then
6916 +   AC_MSG_CHECKING(--disable-gtktest argument)
6917 +   AC_ARG_ENABLE(gtktest, [  --disable-gtktest       Do not try to compile and run a test GTK program],
6918 +       , enable_gtktest=yes)
6919 +   if test "x$enable_gtktest" = "xyes" ; then
6920 +     AC_MSG_RESULT(gtk test enabled)
6921 +   else
6922 +     AC_MSG_RESULT(gtk test disabled)
6923 +   fi
6925 +   if test "X$PKG_CONFIG" = "X"; then
6926 +     AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
6927 +   fi
6929 +   if test "x$PKG_CONFIG" != "xno"; then
6930 +     dnl First try finding version 2.2.0 or later.  The 2.0.x series has
6931 +     dnl problems (bold fonts, --remote doesn't work).
6932 +     AM_PATH_GTK(2.2.0,
6933 +               [GUI_LIB_LOC="$GTK_LIBDIR"
6934 +                GTK_LIBNAME="$GTK_LIBS"
6935 +               GUI_INC_LOC="$GTK_CFLAGS"], )
6936 +     if test "x$GTK_CFLAGS" != "x"; then
6937 +       SKIP_GTK3=YES
6938 +       SKIP_ATHENA=YES
6939 +       SKIP_NEXTAW=YES
6940 +       SKIP_MOTIF=YES
6941 +       GUITYPE=GTK
6942 +       AC_SUBST(GTK_LIBNAME)
6943 +     fi
6944 +   fi
6945 +   if test "x$GUITYPE" = "xGTK"; then
6946 +     if test "$gtk_minor_version" = 1 -a "0$gtk_micro_version" -ge 1 \
6947 +       || test "0$gtk_minor_version" -ge 2; then
6948 +       AC_DEFINE(HAVE_GTK_MULTIHEAD)
6949 +     fi
6950 +     dnl
6951 +     dnl if GTK exists, then check for GNOME.
6952 +     dnl
6953 +     if test -z "$SKIP_GNOME"; then
6954 +     {
6955 +       GNOME_INIT_HOOK([have_gnome=yes])
6956 +       if test "x$have_gnome" = xyes ; then
6957 +       AC_DEFINE(FEAT_GUI_GNOME)
6958 +       GUI_INC_LOC="$GUI_INC_LOC $GNOME_INCLUDEDIR"
6959 +       GTK_LIBNAME="$GTK_LIBNAME $GNOME_LIBDIR $GNOME_LIBS"
6960 +       fi
6961 +     }
6962 +     fi
6963 +   fi
6964 + fi
6967 + dnl ---------------------------------------------------------------------------
6968 + dnl Check for GTK3.
6969 + dnl ---------------------------------------------------------------------------
6970 + if test -z "$SKIP_GTK3"; then
6972 +   AC_MSG_CHECKING(--disable-gtktest argument)
6973 +   AC_ARG_ENABLE(gtktest, [  --disable-gtktest       Do not try to compile and run a test GTK program],
6974 +       , enable_gtktest=yes)
6975 +   if test "x$enable_gtktest" = "xyes" ; then
6976 +     AC_MSG_RESULT(gtk test enabled)
6977 +   else
6978 +     AC_MSG_RESULT(gtk test disabled)
6979 +   fi
6981 +   if test "X$PKG_CONFIG" = "X"; then
6982 +     AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
6983 +   fi
6985 +   if test "x$PKG_CONFIG" != "xno"; then
6986 +     AM_PATH_GTK(3.0.0,
6987 +               [GUI_LIB_LOC="$GTK_LIBDIR"
6988 +                GTK_LIBNAME="$GTK_LIBS"
6989 +               GUI_INC_LOC="$GTK_CFLAGS"], )
6990 +     if test "x$GTK_CFLAGS" != "x"; then
6991 +       SKIP_GTK2=YES
6992 +       SKIP_GNOME=YES
6993 +       SKIP_ATHENA=YES
6994 +       SKIP_NEXTAW=YES
6995 +       SKIP_MOTIF=YES
6996 +       GUITYPE=GTK
6997 +       AC_SUBST(GTK_LIBNAME)
6998 +       AC_DEFINE(HAVE_GTK_MULTIHEAD)
6999 +       AC_DEFINE(USE_GTK3)
7000 +     fi
7001 +   fi
7002 + fi
7004 + dnl Check the version of Gdk-Pixbuf.  If the version is 2.31 or later and
7005 + dnl glib-compile-resources is found in PATH, use GResource.
7006 + if test "x$GUITYPE" = "xGTK"; then
7007 +   AC_MSG_CHECKING([version of Gdk-Pixbuf])
7008 +   gdk_pixbuf_version=`$PKG_CONFIG --modversion gdk-pixbuf-2.0`
7009 +   if test "x$gdk_pixbuf_version" != x ; then
7010 +     gdk_pixbuf_version_minor=`echo $gdk_pixbuf_version | \
7011 +       sed -e 's/[[0-9]][[0-9]]*\.\([[0-9]][[0-9]]*\)\.[[0-9]][[0-9]]*/\1/'`
7012 +     if test "x$gdk_pixbuf_version_minor" != x -a \
7013 +       $gdk_pixbuf_version_minor -ge 31 ; then
7014 +       AC_MSG_RESULT([OK.])
7015 +       AC_PATH_PROG(GLIB_COMPILE_RESOURCES,[glib-compile-resources],no)
7016 +       AC_MSG_CHECKING([glib-compile-resources])
7017 +       if test "x$GLIB_COMPILE_RESOURCES" = xno ; then
7018 +       GLIB_COMPILE_RESOURCES=""
7019 +       AC_MSG_RESULT([cannot be found in PATH.])
7020 +       else
7021 +       AC_MSG_RESULT([usable.])
7022 +       AC_DEFINE(USE_GRESOURCE)
7023 +       GRESOURCE_SRC="auto/gui_gtk_gresources.c"
7024 +       GRESOURCE_OBJ="objects/gui_gtk_gresources.o"
7025 +       fi
7026 +     else
7027 +       AC_MSG_RESULT([not usable.])
7028 +     fi
7029 +   else
7030 +     AC_MSG_RESULT([cannot obtain from pkg_config.])
7031 +   fi
7033 +   AC_MSG_CHECKING([--disable-icon-cache-update argument])
7034 +   AC_ARG_ENABLE(icon_cache_update,
7035 +           [  --disable-icon-cache-update        update disabled],
7036 +           [],
7037 +           [enable_icon_cache_update="yes"])
7038 +   if test "$enable_icon_cache_update" = "yes"; then
7039 +     AC_MSG_RESULT([not set])
7040 +     AC_PATH_PROG(GTK_UPDATE_ICON_CACHE,[gtk-update-icon-cache],no)
7041 +     if test "x$GTK_UPDATE_ICON_CACHE" = "xno" ; then
7042 +       AC_MSG_RESULT([not found in PATH.])
7043 +     fi
7044 +   else
7045 +     AC_MSG_RESULT([update disabled])
7046 +   fi
7048 +   AC_MSG_CHECKING([--disable-desktop-database-update argument])
7049 +   AC_ARG_ENABLE(desktop_database_update,
7050 +           [  --disable-desktop-database-update  update disabled],
7051 +           [],
7052 +           [enable_desktop_database_update="yes"])
7053 +   if test "$enable_desktop_database_update" = "yes"; then
7054 +     AC_MSG_RESULT([not set])
7055 +     AC_PATH_PROG(UPDATE_DESKTOP_DATABASE,[update-desktop-database],no)
7056 +     if test "x$UPDATE_DESKTOP_DATABASE" = "xno" ; then
7057 +       AC_MSG_RESULT([not found in PATH.])
7058 +     fi
7059 +   else
7060 +     AC_MSG_RESULT([update disabled])
7061 +   fi
7062 + fi
7063 + AC_SUBST(GLIB_COMPILE_RESOURCES)
7064 + AC_SUBST(GRESOURCE_SRC)
7065 + AC_SUBST(GRESOURCE_OBJ)
7066 + AC_SUBST(GTK_UPDATE_ICON_CACHE)
7067 + AC_SUBST(UPDATE_DESKTOP_DATABASE)
7069 + dnl Check for Motif include files location.
7070 + dnl The LAST one found is used, this makes the highest version to be used,
7071 + dnl e.g. when Motif1.2 and Motif2.0 are both present.
7073 + if test -z "$SKIP_MOTIF"; then
7074 +   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"
7075 +   dnl Remove "-I" from before $GUI_INC_LOC if it's there
7076 +   GUI_INC_LOC="`echo $GUI_INC_LOC|sed 's%-I%%g'`"
7078 +   AC_MSG_CHECKING(for location of Motif GUI includes)
7079 +   gui_includes="`echo $x_includes|sed 's%/[^/][^/]*$%%'` `echo "$gui_XXX" | sed s/XXX/include/g` $GUI_INC_LOC"
7080 +   GUI_INC_LOC=
7081 +   for try in $gui_includes; do
7082 +     if test -f "$try/Xm/Xm.h"; then
7083 +       GUI_INC_LOC=$try
7084 +     fi
7085 +   done
7086 +   if test -n "$GUI_INC_LOC"; then
7087 +     if test "$GUI_INC_LOC" = /usr/include; then
7088 +       GUI_INC_LOC=
7089 +       AC_MSG_RESULT(in default path)
7090 +     else
7091 +       AC_MSG_RESULT($GUI_INC_LOC)
7092 +     fi
7093 +   else
7094 +     AC_MSG_RESULT(<not found>)
7095 +     SKIP_MOTIF=YES
7096 +   fi
7097 + fi
7099 + dnl Check for Motif library files location.  In the same order as the include
7100 + dnl files, to avoid a mixup if several versions are present
7102 + if test -z "$SKIP_MOTIF"; then
7103 +   AC_MSG_CHECKING(--with-motif-lib argument)
7104 +   AC_ARG_WITH(motif-lib,
7105 +   [  --with-motif-lib=STRING   Library for Motif ],
7106 +   [ MOTIF_LIBNAME="${withval}" ] )
7108 +   if test -n "$MOTIF_LIBNAME"; then
7109 +     AC_MSG_RESULT($MOTIF_LIBNAME)
7110 +     GUI_LIB_LOC=
7111 +   else
7112 +     AC_MSG_RESULT(no)
7114 +     dnl Remove "-L" from before $GUI_LIB_LOC if it's there
7115 +     GUI_LIB_LOC="`echo $GUI_LIB_LOC|sed 's%-L%%g'`"
7117 +     dnl Ubuntu has libXm.so in /usr/lib/i386-linux-gnu and elsewhere.  The
7118 +     dnl linker will figure out which one to use, we only check if one exists.
7119 +     AC_MSG_CHECKING(for location of Motif GUI libs)
7120 +     gui_libs="`echo $x_libraries|sed 's%/[^/][^/]*$%%'` `echo "$gui_XXX" | sed s/XXX/lib/g` /usr/lib/i386-linux-gnu /usr/lib/x86_64-linux-gnu `echo "$GUI_INC_LOC" | sed s/include/lib/` $GUI_LIB_LOC"
7121 +     GUI_LIB_LOC=
7122 +     for try in $gui_libs; do
7123 +       for libtry in "$try"/libXm.a "$try"/libXm.so* "$try"/libXm.sl "$try"/libXm.dylib; do
7124 +       if test -f "$libtry"; then
7125 +         GUI_LIB_LOC=$try
7126 +       fi
7127 +       done
7128 +     done
7129 +     if test -n "$GUI_LIB_LOC"; then
7130 +       dnl Remove /usr/lib, it causes trouble on some systems
7131 +       if test "$GUI_LIB_LOC" = /usr/lib \
7132 +          -o "$GUI_LIB_LOC" = /usr/lib/i386-linux-gnu \
7133 +          -o "$GUI_LIB_LOC" = /usr/lib/x86_64-linux-gnu; then
7134 +       GUI_LIB_LOC=
7135 +       AC_MSG_RESULT(in default path)
7136 +       else
7137 +       if test -n "$GUI_LIB_LOC"; then
7138 +         AC_MSG_RESULT($GUI_LIB_LOC)
7139 +         if test "`(uname) 2>/dev/null`" = SunOS &&
7140 +                                        uname -r | grep '^5' >/dev/null; then
7141 +           GUI_LIB_LOC="$GUI_LIB_LOC -R $GUI_LIB_LOC"
7142 +         fi
7143 +       fi
7144 +       fi
7145 +       MOTIF_LIBNAME=-lXm
7146 +     else
7147 +       AC_MSG_RESULT(<not found>)
7148 +       SKIP_MOTIF=YES
7149 +     fi
7150 +   fi
7151 + fi
7153 + if test -z "$SKIP_MOTIF"; then
7154 +   SKIP_ATHENA=YES
7155 +   SKIP_NEXTAW=YES
7156 +   GUITYPE=MOTIF
7157 +   AC_SUBST(MOTIF_LIBNAME)
7158 + fi
7160 + dnl Check if the Athena files can be found
7162 + GUI_X_LIBS=
7164 + if test -z "$SKIP_ATHENA"; then
7165 +   AC_MSG_CHECKING(if Athena header files can be found)
7166 +   cflags_save=$CFLAGS
7167 +   CFLAGS="$CFLAGS $X_CFLAGS"
7168 +   AC_TRY_COMPILE([
7169 + #include <X11/Intrinsic.h>
7170 + #include <X11/Xaw/Paned.h>], ,
7171 +       AC_MSG_RESULT(yes),
7172 +       AC_MSG_RESULT(no); SKIP_ATHENA=YES )
7173 +   CFLAGS=$cflags_save
7174 + fi
7176 + if test -z "$SKIP_ATHENA"; then
7177 +   GUITYPE=ATHENA
7178 + fi
7180 + if test -z "$SKIP_NEXTAW"; then
7181 +   AC_MSG_CHECKING(if neXtaw header files can be found)
7182 +   cflags_save=$CFLAGS
7183 +   CFLAGS="$CFLAGS $X_CFLAGS"
7184 +   AC_TRY_COMPILE([
7185 + #include <X11/Intrinsic.h>
7186 + #include <X11/neXtaw/Paned.h>], ,
7187 +       AC_MSG_RESULT(yes),
7188 +       AC_MSG_RESULT(no); SKIP_NEXTAW=YES )
7189 +   CFLAGS=$cflags_save
7190 + fi
7192 + if test -z "$SKIP_NEXTAW"; then
7193 +   GUITYPE=NEXTAW
7194 + fi
7196 + if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
7197 +   dnl Prepend -I and -L to $GUI_INC_LOC and $GUI_LIB_LOC if not empty
7198 +   dnl Avoid adding it when it twice
7199 +   if test -n "$GUI_INC_LOC"; then
7200 +     GUI_INC_LOC=-I"`echo $GUI_INC_LOC|sed 's%-I%%'`"
7201 +   fi
7202 +   if test -n "$GUI_LIB_LOC"; then
7203 +     GUI_LIB_LOC=-L"`echo $GUI_LIB_LOC|sed 's%-L%%'`"
7204 +   fi
7206 +   dnl Check for -lXext and then for -lXmu
7207 +   ldflags_save=$LDFLAGS
7208 +   LDFLAGS="$X_LIBS $LDFLAGS"
7209 +   AC_CHECK_LIB(Xext, XShapeQueryExtension, [GUI_X_LIBS="-lXext"],,
7210 +               [-lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
7211 +   dnl For Solaris we need -lw and -ldl before linking with -lXmu works.
7212 +   AC_CHECK_LIB(w, wslen, [X_EXTRA_LIBS="$X_EXTRA_LIBS -lw"],,
7213 +               [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
7214 +   AC_CHECK_LIB(dl, dlsym, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldl"],,
7215 +               [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
7216 +   AC_CHECK_LIB(Xmu, XmuCreateStippledPixmap, [GUI_X_LIBS="-lXmu $GUI_X_LIBS"],,
7217 +               [$GUI_X_LIBS -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
7218 +   if test -z "$SKIP_MOTIF"; then
7219 +     AC_CHECK_LIB(Xp, XpEndJob, [GUI_X_LIBS="-lXp $GUI_X_LIBS"],,
7220 +               [$GUI_X_LIBS -lXm -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS])
7221 +   fi
7222 +   LDFLAGS=$ldflags_save
7224 +   dnl Execute xmkmf to figure out if -DNARROWPROTO is needed.
7225 +   AC_MSG_CHECKING(for extra X11 defines)
7226 +   NARROW_PROTO=
7227 +   rm -fr conftestdir
7228 +   if mkdir conftestdir; then
7229 +     cd conftestdir
7230 +     cat > Imakefile <<'EOF'
7231 + acfindx:
7232 +       @echo 'NARROW_PROTO="${PROTO_DEFINES}"'
7233 + EOF
7234 +     if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
7235 +       eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
7236 +     fi
7237 +     cd ..
7238 +     rm -fr conftestdir
7239 +   fi
7240 +   if test -z "$NARROW_PROTO"; then
7241 +     AC_MSG_RESULT(no)
7242 +   else
7243 +     AC_MSG_RESULT($NARROW_PROTO)
7244 +   fi
7245 +   AC_SUBST(NARROW_PROTO)
7246 + fi
7248 + dnl Look for XSMP support - but don't necessarily restrict it to X11 GUIs
7249 + dnl use the X11 include path
7250 + if test "$enable_xsmp" = "yes"; then
7251 +   cppflags_save=$CPPFLAGS
7252 +   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
7253 +   AC_CHECK_HEADERS(X11/SM/SMlib.h)
7254 +   CPPFLAGS=$cppflags_save
7255 + fi
7258 + if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF" -o -z "$SKIP_GTK2" -o -z "$SKIP_GTK3"; then
7259 +   dnl Check for X11/xpm.h and X11/Sunkeysym.h with the GUI include path
7260 +   cppflags_save=$CPPFLAGS
7261 +   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
7262 +   AC_CHECK_HEADERS(X11/xpm.h X11/Sunkeysym.h)
7264 +   dnl automatically disable XIM when XIMtext isn't in X11/Xlib.h
7265 +   if test ! "$enable_xim" = "no"; then
7266 +     AC_MSG_CHECKING(for XIMText in X11/Xlib.h)
7267 +     AC_EGREP_CPP(XIMText, [#include <X11/Xlib.h>],
7268 +                 AC_MSG_RESULT(yes),
7269 +                 AC_MSG_RESULT(no; xim has been disabled); enable_xim="no")
7270 +   fi
7271 +   CPPFLAGS=$cppflags_save
7273 +   dnl automatically enable XIM when hangul input isn't enabled
7274 +   if test "$enable_xim" = "auto" -a "$enable_hangulinput" != "yes" \
7275 +               -a "x$GUITYPE" != "xNONE" ; then
7276 +     AC_MSG_RESULT(X GUI selected; xim has been enabled)
7277 +     enable_xim="yes"
7278 +   fi
7279 + fi
7281 + if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
7282 +   cppflags_save=$CPPFLAGS
7283 +   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
7284 + dnl Xmu/Editres.h may exist but can only be used after including Intrinsic.h
7285 +   AC_MSG_CHECKING([for X11/Xmu/Editres.h])
7286 +   AC_TRY_COMPILE([
7287 + #include <X11/Intrinsic.h>
7288 + #include <X11/Xmu/Editres.h>],
7289 +                     [int i; i = 0;],
7290 +             AC_MSG_RESULT(yes)
7291 +                     AC_DEFINE(HAVE_X11_XMU_EDITRES_H),
7292 +             AC_MSG_RESULT(no))
7293 +   CPPFLAGS=$cppflags_save
7294 + fi
7296 + dnl Only use the Xm directory when compiling Motif, don't use it for Athena
7297 + if test -z "$SKIP_MOTIF"; then
7298 +   cppflags_save=$CPPFLAGS
7299 +   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
7300 +   if test "$zOSUnix" = "yes"; then
7301 +       xmheader="Xm/Xm.h"
7302 +   else
7303 +       xmheader="Xm/Xm.h Xm/XpmP.h Xm/JoinSideT.h Xm/TraitP.h Xm/Manager.h
7304 +          Xm/UnhighlightT.h Xm/Notebook.h"  
7305 +   fi    
7306 +   AC_CHECK_HEADERS($xmheader)
7308 +   if test "x$ac_cv_header_Xm_XpmP_h" = "xyes"; then
7309 +     dnl Solaris uses XpmAttributes_21, very annoying.
7310 +     AC_MSG_CHECKING([for XpmAttributes_21 in Xm/XpmP.h])
7311 +     AC_TRY_COMPILE([#include <Xm/XpmP.h>], [XpmAttributes_21 attr;],
7312 +       AC_MSG_RESULT(yes); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes_21),
7313 +       AC_MSG_RESULT(no); AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes)
7314 +       )
7315 +   else
7316 +     AC_DEFINE(XPMATTRIBUTES_TYPE, XpmAttributes)
7317 +   fi
7318 +   CPPFLAGS=$cppflags_save
7319 + fi
7321 + if test "x$GUITYPE" = "xNONE" -a "$enable_xim" = "yes"; then
7322 +   AC_MSG_RESULT(no GUI selected; xim has been disabled)
7323 +   enable_xim="no"
7324 + fi
7325 + if test "x$GUITYPE" = "xNONE" -a "$enable_fontset" = "yes"; then
7326 +   AC_MSG_RESULT(no GUI selected; fontset has been disabled)
7327 +   enable_fontset="no"
7328 + fi
7329 + if test "x$GUITYPE:$enable_fontset" = "xGTK:yes"; then
7330 +   AC_MSG_RESULT(GTK+ 2 GUI selected; fontset has been disabled)
7331 +   enable_fontset="no"
7332 + fi
7334 + if test -z "$SKIP_PHOTON"; then
7335 +   GUITYPE=PHOTONGUI
7336 + fi
7338 + AC_SUBST(GUI_INC_LOC)
7339 + AC_SUBST(GUI_LIB_LOC)
7340 + AC_SUBST(GUITYPE)
7341 + AC_SUBST(GUI_X_LIBS)
7343 + if test "$enable_workshop" = "yes" -a -n "$SKIP_MOTIF"; then
7344 +   AC_MSG_ERROR([cannot use workshop without Motif])
7345 + fi
7347 + dnl defining FEAT_XIM and FEAT_XFONTSET is delayed, so that they can be disabled
7348 + if test "$enable_xim" = "yes"; then
7349 +   AC_DEFINE(FEAT_XIM)
7350 + fi
7351 + if test "$enable_fontset" = "yes"; then
7352 +   AC_DEFINE(FEAT_XFONTSET)
7353 + fi
7356 + dnl ---------------------------------------------------------------------------
7357 + dnl end of GUI-checking
7358 + dnl ---------------------------------------------------------------------------
7360 + dnl Check for Cygwin, which needs an extra source file if not using X11
7361 + AC_MSG_CHECKING(for CYGWIN or MSYS environment)
7362 + case `uname` in
7363 +     CYGWIN*|MSYS*)    CYGWIN=yes; AC_MSG_RESULT(yes)
7364 +                 AC_MSG_CHECKING(for CYGWIN clipboard support)
7365 +                 if test "x$with_x" = "xno" ; then
7366 +                   OS_EXTRA_SRC=winclip.c; OS_EXTRA_OBJ=objects/winclip.o
7367 +                   AC_MSG_RESULT(yes)
7368 +                   AC_DEFINE(FEAT_CYGWIN_WIN32_CLIPBOARD)
7369 +                 else
7370 +                   AC_MSG_RESULT(no - using X11)
7371 +                 fi ;;
7373 +     *)          CYGWIN=no; AC_MSG_RESULT(no);;
7374 + esac
7376 + dnl Only really enable hangul input when GUI and XFONTSET are available
7377 + if test "$enable_hangulinput" = "yes"; then
7378 +   if test "x$GUITYPE" = "xNONE"; then
7379 +     AC_MSG_RESULT(no GUI selected; hangul input has been disabled)
7380 +     enable_hangulinput=no
7381 +   else
7382 +     AC_DEFINE(FEAT_HANGULIN)
7383 +     HANGULIN_SRC=hangulin.c
7384 +     AC_SUBST(HANGULIN_SRC)
7385 +     HANGULIN_OBJ=objects/hangulin.o
7386 +     AC_SUBST(HANGULIN_OBJ)
7387 +   fi
7388 + fi
7390 + dnl Checks for libraries and include files.
7392 + AC_CACHE_CHECK([whether toupper is broken], [vim_cv_toupper_broken],
7393 +   [
7394 +     AC_RUN_IFELSE([AC_LANG_SOURCE([[
7395 + #include "confdefs.h"
7396 + #include <ctype.h>
7397 + #if STDC_HEADERS
7398 + # include <stdlib.h>
7399 + # include <stddef.h>
7400 + #endif
7401 + main() { exit(toupper('A') == 'A' && tolower('z') == 'z'); }
7402 +   ]])],[
7403 +     vim_cv_toupper_broken=yes
7404 +   ],[
7405 +     vim_cv_toupper_broken=no
7406 +   ],[
7407 +     AC_MSG_ERROR(cross-compiling: please set 'vim_cv_toupper_broken')
7408 +   ])])
7410 + if test "x$vim_cv_toupper_broken" = "xyes" ; then
7411 +   AC_DEFINE(BROKEN_TOUPPER)
7412 + fi
7414 + AC_MSG_CHECKING(whether __DATE__ and __TIME__ work)
7415 + AC_TRY_COMPILE([#include <stdio.h>], [printf("(" __DATE__ " " __TIME__ ")");],
7416 +       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_DATE_TIME),
7417 +       AC_MSG_RESULT(no))
7419 + AC_MSG_CHECKING(whether __attribute__((unused)) is allowed)
7420 + AC_TRY_COMPILE([#include <stdio.h>], [int x __attribute__((unused));],
7421 +       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ATTRIBUTE_UNUSED),
7422 +       AC_MSG_RESULT(no))
7424 + dnl Checks for header files.
7425 + AC_CHECK_HEADER(elf.h, HAS_ELF=1)
7426 + dnl AC_CHECK_HEADER(dwarf.h, SVR4=1)
7427 + if test "$HAS_ELF" = 1; then
7428 +   AC_CHECK_LIB(elf, main)
7429 + fi
7431 + AC_HEADER_DIRENT
7433 + dnl If sys/wait.h is not found it might still exist but not be POSIX
7434 + dnl compliant. In that case we define HAVE_UNION_WAIT (for NeXT)
7435 + if test $ac_cv_header_sys_wait_h = no; then
7436 +   AC_MSG_CHECKING([for sys/wait.h that defines union wait])
7437 +   AC_TRY_COMPILE([#include <sys/wait.h>],
7438 +                       [union wait xx, yy; xx = yy],
7439 +               AC_MSG_RESULT(yes)
7440 +                       AC_DEFINE(HAVE_SYS_WAIT_H)
7441 +                       AC_DEFINE(HAVE_UNION_WAIT),
7442 +               AC_MSG_RESULT(no))
7443 + fi
7445 + AC_CHECK_HEADERS(stdint.h stdlib.h string.h \
7446 +       sys/select.h sys/utsname.h termcap.h fcntl.h \
7447 +       sgtty.h sys/ioctl.h sys/time.h sys/types.h \
7448 +       termio.h iconv.h inttypes.h langinfo.h math.h \
7449 +       unistd.h stropts.h errno.h sys/resource.h \
7450 +       sys/systeminfo.h locale.h sys/stream.h termios.h \
7451 +       libc.h sys/statfs.h poll.h sys/poll.h pwd.h \
7452 +       utime.h sys/param.h libintl.h libgen.h \
7453 +       util/debug.h util/msg18n.h frame.h sys/acl.h \
7454 +       sys/access.h sys/sysinfo.h wchar.h wctype.h)
7456 + dnl sys/ptem.h depends on sys/stream.h on Solaris
7457 + AC_CHECK_HEADERS(sys/ptem.h, [], [],
7458 + [#if defined HAVE_SYS_STREAM_H
7459 + #  include <sys/stream.h>
7460 + #endif])
7462 + dnl sys/sysctl.h depends on sys/param.h on OpenBSD
7463 + AC_CHECK_HEADERS(sys/sysctl.h, [], [],
7464 + [#if defined HAVE_SYS_PARAM_H
7465 + #  include <sys/param.h>
7466 + #endif])
7469 + dnl pthread_np.h may exist but can only be used after including pthread.h
7470 + AC_MSG_CHECKING([for pthread_np.h])
7471 + AC_TRY_COMPILE([
7472 + #include <pthread.h>
7473 + #include <pthread_np.h>],
7474 +                     [int i; i = 0;],
7475 +             AC_MSG_RESULT(yes)
7476 +                     AC_DEFINE(HAVE_PTHREAD_NP_H),
7477 +             AC_MSG_RESULT(no))
7479 + AC_CHECK_HEADERS(strings.h)
7480 + if test "x$MACOSX" = "xyes"; then
7481 +   dnl The strings.h file on OS/X contains a warning and nothing useful.
7482 +   AC_DEFINE(NO_STRINGS_WITH_STRING_H)
7483 + else
7485 + dnl Check if strings.h and string.h can both be included when defined.
7486 + AC_MSG_CHECKING([if strings.h can be included after string.h])
7487 + cppflags_save=$CPPFLAGS
7488 + CPPFLAGS="$CPPFLAGS $X_CFLAGS"
7489 + AC_TRY_COMPILE([
7490 + #if defined(_AIX) && !defined(_AIX51) && !defined(_NO_PROTO)
7491 + # define _NO_PROTO    /* like in os_unix.h, causes conflict for AIX (Winn) */
7492 +                       /* but don't do it on AIX 5.1 (Uribarri) */
7493 + #endif
7494 + #ifdef HAVE_XM_XM_H
7495 + # include <Xm/Xm.h>   /* This breaks it for HP-UX 11 (Squassabia) */
7496 + #endif
7497 + #ifdef HAVE_STRING_H
7498 + # include <string.h>
7499 + #endif
7500 + #if defined(HAVE_STRINGS_H)
7501 + # include <strings.h>
7502 + #endif
7503 +               ], [int i; i = 0;],
7504 +               AC_MSG_RESULT(yes),
7505 +               AC_DEFINE(NO_STRINGS_WITH_STRING_H)
7506 +               AC_MSG_RESULT(no))
7507 + CPPFLAGS=$cppflags_save
7508 + fi
7510 + dnl Checks for typedefs, structures, and compiler characteristics.
7511 + AC_PROG_GCC_TRADITIONAL
7512 + AC_C_CONST
7513 + AC_C_VOLATILE
7514 + AC_TYPE_MODE_T
7515 + AC_TYPE_OFF_T
7516 + AC_TYPE_PID_T
7517 + AC_TYPE_SIZE_T
7518 + AC_TYPE_UID_T
7519 + AC_TYPE_UINT32_T
7521 + AC_HEADER_TIME
7522 + AC_CHECK_TYPE(ino_t, long)
7523 + AC_CHECK_TYPE(dev_t, unsigned)
7524 + AC_C_BIGENDIAN(,,,)
7525 + AC_C_INLINE
7527 + AC_MSG_CHECKING(for rlim_t)
7528 + if eval "test \"`echo '$''{'ac_cv_type_rlim_t'+set}'`\" = set"; then
7529 +   AC_MSG_RESULT([(cached) $ac_cv_type_rlim_t])
7530 + else
7531 +   AC_EGREP_CPP(dnl
7532 + changequote(<<,>>)dnl
7533 + <<(^|[^a-zA-Z_0-9])rlim_t[^a-zA-Z_0-9]>>dnl
7534 + changequote([,]),
7535 +   [
7536 + #include <sys/types.h>
7537 + #if STDC_HEADERS
7538 + # include <stdlib.h>
7539 + # include <stddef.h>
7540 + #endif
7541 + #ifdef HAVE_SYS_RESOURCE_H
7542 + # include <sys/resource.h>
7543 + #endif
7544 +         ], ac_cv_type_rlim_t=yes, ac_cv_type_rlim_t=no)
7545 +         AC_MSG_RESULT($ac_cv_type_rlim_t)
7546 + fi
7547 + if test $ac_cv_type_rlim_t = no; then
7548 +   cat >> confdefs.h <<\EOF
7549 + #define rlim_t unsigned long
7550 + EOF
7551 + fi
7553 + AC_MSG_CHECKING(for stack_t)
7554 + if eval "test \"`echo '$''{'ac_cv_type_stack_t'+set}'`\" = set"; then
7555 +   AC_MSG_RESULT([(cached) $ac_cv_type_stack_t])
7556 + else
7557 +   AC_EGREP_CPP(stack_t,
7558 +   [
7559 + #include <sys/types.h>
7560 + #if STDC_HEADERS
7561 + # include <stdlib.h>
7562 + # include <stddef.h>
7563 + #endif
7564 + #include <signal.h>
7565 +         ], ac_cv_type_stack_t=yes, ac_cv_type_stack_t=no)
7566 +         AC_MSG_RESULT($ac_cv_type_stack_t)
7567 + fi
7568 + if test $ac_cv_type_stack_t = no; then
7569 +   cat >> confdefs.h <<\EOF
7570 + #define stack_t struct sigaltstack
7571 + EOF
7572 + fi
7574 + dnl BSDI uses ss_base while others use ss_sp for the stack pointer.
7575 + AC_MSG_CHECKING(whether stack_t has an ss_base field)
7576 + AC_TRY_COMPILE([
7577 + #include <sys/types.h>
7578 + #if STDC_HEADERS
7579 + # include <stdlib.h>
7580 + # include <stddef.h>
7581 + #endif
7582 + #include <signal.h>
7583 + #include "confdefs.h"
7584 +                       ], [stack_t sigstk; sigstk.ss_base = 0; ],
7585 +       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SS_BASE),
7586 +       AC_MSG_RESULT(no))
7588 + olibs="$LIBS"
7589 + AC_MSG_CHECKING(--with-tlib argument)
7590 + AC_ARG_WITH(tlib, [  --with-tlib=library     terminal library to be used ],)
7591 + if test -n "$with_tlib"; then
7592 +   AC_MSG_RESULT($with_tlib)
7593 +   LIBS="$LIBS -l$with_tlib"
7594 +   AC_MSG_CHECKING(for linking with $with_tlib library)
7595 +   AC_TRY_LINK([], [], AC_MSG_RESULT(OK), AC_MSG_ERROR(FAILED))
7596 +   dnl Need to check for tgetent() below.
7597 +   olibs="$LIBS"
7598 + else
7599 +   AC_MSG_RESULT([empty: automatic terminal library selection])
7600 +   dnl  On HP-UX 10.10 termcap or termlib should be used instead of
7601 +   dnl  curses, because curses is much slower.
7602 +   dnl  Newer versions of ncurses are preferred over anything, except
7603 +   dnl  when tinfo has been split off, it contains all we need.
7604 +   dnl  Older versions of ncurses have bugs, get a new one!
7605 +   dnl  Digital Unix (OSF1) should use curses (Ronald Schild).
7606 +   dnl  On SCO Openserver should prefer termlib (Roger Cornelius).
7607 +   case "`uname -s 2>/dev/null`" in
7608 +       OSF1|SCO_SV)    tlibs="tinfo ncurses curses termlib termcap";;
7609 +       *)      tlibs="tinfo ncurses termlib termcap curses";;
7610 +   esac
7611 +   for libname in $tlibs; do
7612 +     AC_CHECK_LIB(${libname}, tgetent,,)
7613 +     if test "x$olibs" != "x$LIBS"; then
7614 +       dnl It's possible that a library is found but it doesn't work
7615 +       dnl e.g., shared library that cannot be found
7616 +       dnl compile and run a test program to be sure
7617 +       AC_TRY_RUN([
7618 + #ifdef HAVE_TERMCAP_H
7619 + # include <termcap.h>
7620 + #endif
7621 + #if STDC_HEADERS
7622 + # include <stdlib.h>
7623 + # include <stddef.h>
7624 + #endif
7625 + main() {char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(0); }],
7626 +                         res="OK", res="FAIL", res="FAIL")
7627 +       if test "$res" = "OK"; then
7628 +       break
7629 +       fi
7630 +       AC_MSG_RESULT($libname library is not usable)
7631 +       LIBS="$olibs"
7632 +     fi
7633 +   done
7634 +   if test "x$olibs" = "x$LIBS"; then
7635 +     AC_MSG_RESULT(no terminal library found)
7636 +   fi
7637 + fi
7639 + if test "x$olibs" = "x$LIBS"; then
7640 +   AC_MSG_CHECKING([for tgetent()])
7641 +   AC_TRY_LINK([],
7642 +       [char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist");],
7643 +       AC_MSG_RESULT(yes),
7644 +       AC_MSG_ERROR([NOT FOUND!
7645 +       You need to install a terminal library; for example ncurses.
7646 +       Or specify the name of the library with --with-tlib.]))
7647 + fi
7649 + AC_CACHE_CHECK([whether we talk terminfo], [vim_cv_terminfo],
7650 +   [
7651 +     AC_RUN_IFELSE([AC_LANG_SOURCE([[
7652 + #include "confdefs.h"
7653 + #ifdef HAVE_TERMCAP_H
7654 + # include <termcap.h>
7655 + #endif
7656 + #ifdef HAVE_STRING_H
7657 + # include <string.h>
7658 + #endif
7659 + #if STDC_HEADERS
7660 + # include <stdlib.h>
7661 + # include <stddef.h>
7662 + #endif
7663 + main()
7664 + {char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(!strcmp(s==0 ? "" : s, "1")); }
7665 +     ]])],[
7666 +       vim_cv_terminfo=no
7667 +     ],[
7668 +       vim_cv_terminfo=yes
7669 +     ],[
7670 +       AC_MSG_ERROR(cross-compiling: please set 'vim_cv_terminfo')
7671 +     ])
7672 +   ])
7674 + if test "x$vim_cv_terminfo" = "xyes" ; then
7675 +   AC_DEFINE(TERMINFO)
7676 + fi
7678 + if test "x$olibs" != "x$LIBS"; then
7679 +   AC_CACHE_CHECK([what tgetent() returns for an unknown terminal], [vim_cv_tgent],
7680 +     [
7681 +       AC_RUN_IFELSE([AC_LANG_SOURCE([[
7682 + #include "confdefs.h"
7683 + #ifdef HAVE_TERMCAP_H
7684 + # include <termcap.h>
7685 + #endif
7686 + #if STDC_HEADERS
7687 + # include <stdlib.h>
7688 + # include <stddef.h>
7689 + #endif
7690 + main()
7691 + {char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist"); exit(res != 0); }
7692 +       ]])],[
7693 +       vim_cv_tgent=zero
7694 +       ],[
7695 +       vim_cv_tgent=non-zero
7696 +       ],[
7697 +       AC_MSG_ERROR(failed to compile test program.)
7698 +       ])
7699 +     ])
7700 +   
7701 +   if test "x$vim_cv_tgent" = "xzero" ; then
7702 +     AC_DEFINE(TGETENT_ZERO_ERR, 0)
7703 +   fi
7704 + fi
7706 + AC_MSG_CHECKING(whether termcap.h contains ospeed)
7707 + AC_TRY_LINK([
7708 + #ifdef HAVE_TERMCAP_H
7709 + # include <termcap.h>
7710 + #endif
7711 +                       ], [ospeed = 20000],
7712 +       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OSPEED),
7713 +       [AC_MSG_RESULT(no)
7714 +       AC_MSG_CHECKING(whether ospeed can be extern)
7715 +       AC_TRY_LINK([
7716 + #ifdef HAVE_TERMCAP_H
7717 + # include <termcap.h>
7718 + #endif
7719 + extern short ospeed;
7720 +                       ], [ospeed = 20000],
7721 +               AC_MSG_RESULT(yes); AC_DEFINE(OSPEED_EXTERN),
7722 +               AC_MSG_RESULT(no))]
7723 +       )
7725 + AC_MSG_CHECKING([whether termcap.h contains UP, BC and PC])
7726 + AC_TRY_LINK([
7727 + #ifdef HAVE_TERMCAP_H
7728 + # include <termcap.h>
7729 + #endif
7730 +                       ], [if (UP == 0 && BC == 0) PC = 1],
7731 +       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_UP_BC_PC),
7732 +       [AC_MSG_RESULT(no)
7733 +       AC_MSG_CHECKING([whether UP, BC and PC can be extern])
7734 +       AC_TRY_LINK([
7735 + #ifdef HAVE_TERMCAP_H
7736 + # include <termcap.h>
7737 + #endif
7738 + extern char *UP, *BC, PC;
7739 +                       ], [if (UP == 0 && BC == 0) PC = 1],
7740 +               AC_MSG_RESULT(yes); AC_DEFINE(UP_BC_PC_EXTERN),
7741 +               AC_MSG_RESULT(no))]
7742 +       )
7744 + AC_MSG_CHECKING(whether tputs() uses outfuntype)
7745 + AC_TRY_COMPILE([
7746 + #ifdef HAVE_TERMCAP_H
7747 + # include <termcap.h>
7748 + #endif
7749 +                       ], [extern int xx(); tputs("test", 1, (outfuntype)xx)],
7750 +       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_OUTFUNTYPE),
7751 +       AC_MSG_RESULT(no))
7753 + dnl On some SCO machines sys/select redefines struct timeval
7754 + AC_MSG_CHECKING([whether sys/select.h and sys/time.h may both be included])
7755 + AC_TRY_COMPILE([
7756 + #include <sys/types.h>
7757 + #include <sys/time.h>
7758 + #include <sys/select.h>], ,
7759 +         AC_MSG_RESULT(yes)
7760 +                       AC_DEFINE(SYS_SELECT_WITH_SYS_TIME),
7761 +         AC_MSG_RESULT(no))
7763 + dnl AC_DECL_SYS_SIGLIST
7765 + dnl Checks for pty.c (copied from screen) ==========================
7766 + AC_MSG_CHECKING(for /dev/ptc)
7767 + if test -r /dev/ptc; then
7768 +   AC_DEFINE(HAVE_DEV_PTC)
7769 +   AC_MSG_RESULT(yes)
7770 + else
7771 +   AC_MSG_RESULT(no)
7772 + fi
7774 + AC_MSG_CHECKING(for SVR4 ptys)
7775 + if test -c /dev/ptmx ; then
7776 +   AC_TRY_LINK([], [ptsname(0);grantpt(0);unlockpt(0);],
7777 +       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SVR4_PTYS),
7778 +       AC_MSG_RESULT(no))
7779 + else
7780 +   AC_MSG_RESULT(no)
7781 + fi
7783 + AC_MSG_CHECKING(for ptyranges)
7784 + if test -d /dev/ptym ; then
7785 +   pdir='/dev/ptym'
7786 + else
7787 +   pdir='/dev'
7788 + fi
7789 + dnl SCO uses ptyp%d
7790 + AC_EGREP_CPP(yes,
7791 + [#ifdef M_UNIX
7792 +    yes;
7793 + #endif
7794 +       ], ptys=`echo /dev/ptyp??`, ptys=`echo $pdir/pty??`)
7795 + dnl if test -c /dev/ptyp19; then
7796 + dnl ptys=`echo /dev/ptyp??`
7797 + dnl else
7798 + dnl ptys=`echo $pdir/pty??`
7799 + dnl fi
7800 + if test "$ptys" != "$pdir/pty??" ; then
7801 +   p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'`
7802 +   p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g'  | sort -u | tr -d '\012'`
7803 +   AC_DEFINE_UNQUOTED(PTYRANGE0,"$p0")
7804 +   AC_DEFINE_UNQUOTED(PTYRANGE1,"$p1")
7805 +   AC_MSG_RESULT([$p0 / $p1])
7806 + else
7807 +   AC_MSG_RESULT([don't know])
7808 + fi
7810 + dnl    ****  pty mode/group handling ****
7811 + dnl
7812 + dnl support provided by Luke Mewburn <lm@rmit.edu.au>, 931222
7813 + rm -f conftest_grp
7814 + AC_CACHE_CHECK([default tty permissions/group], [vim_cv_tty_group],
7815 +   [
7816 +     AC_RUN_IFELSE([AC_LANG_SOURCE([[
7817 + #include "confdefs.h"
7818 + #include <sys/types.h>
7819 + #if STDC_HEADERS
7820 + # include <stdlib.h>
7821 + # include <stddef.h>
7822 + #endif
7823 + #ifdef HAVE_UNISTD_H
7824 + #include <unistd.h>
7825 + #endif
7826 + #include <sys/stat.h>
7827 + #include <stdio.h>
7828 + main()
7829 + {
7830 +   struct stat sb;
7831 +   char *x,*ttyname();
7832 +   int om, m;
7833 +   FILE *fp;
7835 +   if (!(x = ttyname(0))) exit(1);
7836 +   if (stat(x, &sb)) exit(1);
7837 +   om = sb.st_mode;
7838 +   if (om & 002) exit(0);
7839 +   m = system("mesg y");
7840 +   if (m == -1 || m == 127) exit(1);
7841 +   if (stat(x, &sb)) exit(1);
7842 +   m = sb.st_mode;
7843 +   if (chmod(x, om)) exit(1);
7844 +   if (m & 002) exit(0);
7845 +   if (sb.st_gid == getgid()) exit(1);
7846 +   if (!(fp=fopen("conftest_grp", "w")))
7847 +     exit(1);
7848 +   fprintf(fp, "%d\n", sb.st_gid);
7849 +   fclose(fp);
7850 +   exit(0);
7851 + }
7852 +     ]])],[
7853 +       if test -f conftest_grp; then
7854 +       vim_cv_tty_group=`cat conftest_grp`
7855 +       if test "x$vim_cv_tty_mode" = "x" ; then
7856 +         vim_cv_tty_mode=0620
7857 +       fi
7858 +       AC_MSG_RESULT([pty mode: $vim_cv_tty_mode, group: $vim_cv_tty_group])
7859 +       else
7860 +       vim_cv_tty_group=world
7861 +       AC_MSG_RESULT([ptys are world accessible])
7862 +       fi
7863 +     ],[
7864 +       vim_cv_tty_group=world
7865 +       AC_MSG_RESULT([can't determine - assume ptys are world accessible])
7866 +     ],[
7867 +       AC_MSG_ERROR(cross-compiling: please set 'vim_cv_tty_group' and 'vim_cv_tty_mode')
7868 +     ])
7869 +   ])
7870 + rm -f conftest_grp
7872 + if test "x$vim_cv_tty_group" != "xworld" ; then
7873 +   AC_DEFINE_UNQUOTED(PTYGROUP,$vim_cv_tty_group)
7874 +   if test "x$vim_cv_tty_mode" = "x" ; then
7875 +     AC_MSG_ERROR([It seems you're cross compiling and have 'vim_cv_tty_group' set, please also set the environment variable 'vim_cv_tty_mode' to the correct mode (probably 0620)])
7876 +   else
7877 +     AC_DEFINE(PTYMODE, 0620)
7878 +   fi
7879 + fi
7881 + dnl Checks for library functions. ===================================
7883 + AC_TYPE_SIGNAL
7885 + dnl find out what to use at the end of a signal function
7886 + if test $ac_cv_type_signal = void; then
7887 +   AC_DEFINE(SIGRETURN, [return])
7888 + else
7889 +   AC_DEFINE(SIGRETURN, [return 0])
7890 + fi
7892 + dnl check if struct sigcontext is defined (used for SGI only)
7893 + AC_MSG_CHECKING(for struct sigcontext)
7894 + AC_TRY_COMPILE([
7895 + #include <signal.h>
7896 + test_sig()
7897 + {
7898 +     struct sigcontext *scont;
7899 +     scont = (struct sigcontext *)0;
7900 +     return 1;
7901 + } ], ,
7902 +         AC_MSG_RESULT(yes)
7903 +               AC_DEFINE(HAVE_SIGCONTEXT),
7904 +         AC_MSG_RESULT(no))
7906 + dnl tricky stuff: try to find out if getcwd() is implemented with
7907 + dnl system("sh -c pwd")
7908 + AC_CACHE_CHECK([getcwd implementation is broken], [vim_cv_getcwd_broken],
7909 +   [
7910 +     AC_RUN_IFELSE([AC_LANG_SOURCE([[
7911 + #include "confdefs.h"
7912 + #ifdef HAVE_UNISTD_H
7913 + #include <unistd.h>
7914 + #endif
7915 + char *dagger[] = { "IFS=pwd", 0 };
7916 + main()
7917 + {
7918 +   char buffer[500];
7919 +   extern char **environ;
7920 +   environ = dagger;
7921 +   return getcwd(buffer, 500) ? 0 : 1;
7922 + }
7923 +     ]])],[
7924 +       vim_cv_getcwd_broken=no
7925 +     ],[
7926 +       vim_cv_getcwd_broken=yes
7927 +     ],[
7928 +       AC_MSG_ERROR(cross-compiling: please set 'vim_cv_getcwd_broken')
7929 +     ])
7930 +   ])
7932 + if test "x$vim_cv_getcwd_broken" = "xyes" ; then
7933 +   AC_DEFINE(BAD_GETCWD)
7934 + fi
7936 + dnl Check for functions in one big call, to reduce the size of configure.
7937 + dnl Can only be used for functions that do not require any include.
7938 + AC_CHECK_FUNCS(bcmp fchdir fchown fsync getcwd getpseudotty \
7939 +       getpwent getpwnam getpwuid getrlimit gettimeofday getwd lstat memcmp \
7940 +       memset mkdtemp nanosleep opendir putenv qsort readlink select setenv \
7941 +       setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \
7942 +       sigprocmask sigvec strcasecmp strerror strftime stricmp strncasecmp \
7943 +       strnicmp strpbrk strtol tgetent towlower towupper iswupper \
7944 +       usleep utime utimes)
7945 + AC_FUNC_FSEEKO
7947 + dnl define _LARGE_FILES, _FILE_OFFSET_BITS and _LARGEFILE_SOURCE when
7948 + dnl appropriate, so that off_t is 64 bits when needed.
7949 + AC_SYS_LARGEFILE
7951 + dnl fstatfs() can take 2 to 4 arguments, try to use st_blksize if possible
7952 + AC_MSG_CHECKING(for st_blksize)
7953 + AC_TRY_COMPILE(
7954 + [#include <sys/types.h>
7955 + #include <sys/stat.h>],
7956 + [     struct stat st;
7957 +       int n;
7959 +       stat("/", &st);
7960 +       n = (int)st.st_blksize;],
7961 +       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ST_BLKSIZE),
7962 +       AC_MSG_RESULT(no))
7964 + AC_CACHE_CHECK([whether stat() ignores a trailing slash], [vim_cv_stat_ignores_slash],
7965 +   [
7966 +     AC_RUN_IFELSE([AC_LANG_SOURCE([[
7967 + #include "confdefs.h"
7968 + #if STDC_HEADERS
7969 + # include <stdlib.h>
7970 + # include <stddef.h>
7971 + #endif
7972 + #include <sys/types.h>
7973 + #include <sys/stat.h>
7974 + main() {struct stat st;  exit(stat("configure/", &st) != 0); }
7975 +     ]])],[
7976 +       vim_cv_stat_ignores_slash=yes
7977 +     ],[
7978 +       vim_cv_stat_ignores_slash=no
7979 +     ],[
7980 +       AC_MSG_ERROR(cross-compiling: please set 'vim_cv_stat_ignores_slash')
7981 +     ])
7982 +   ])
7984 + if test "x$vim_cv_stat_ignores_slash" = "xyes" ; then
7985 +   AC_DEFINE(STAT_IGNORES_SLASH)
7986 + fi
7987 +   
7988 + dnl Link with iconv for charset translation, if not found without library.
7989 + dnl check for iconv() requires including iconv.h
7990 + dnl Add "-liconv" when possible; Solaris has iconv but use GNU iconv when it
7991 + dnl has been installed.
7992 + AC_MSG_CHECKING(for iconv_open())
7993 + save_LIBS="$LIBS"
7994 + LIBS="$LIBS -liconv"
7995 + AC_TRY_LINK([
7996 + #ifdef HAVE_ICONV_H
7997 + # include <iconv.h>
7998 + #endif
7999 +     ], [iconv_open("fr", "to");],
8000 +     AC_MSG_RESULT(yes; with -liconv); AC_DEFINE(HAVE_ICONV),
8001 +     LIBS="$save_LIBS"
8002 +     AC_TRY_LINK([
8003 + #ifdef HAVE_ICONV_H
8004 + # include <iconv.h>
8005 + #endif
8006 +       ], [iconv_open("fr", "to");],
8007 +       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ICONV),
8008 +       AC_MSG_RESULT(no)))
8011 + AC_MSG_CHECKING(for nl_langinfo(CODESET))
8012 + AC_TRY_LINK([
8013 + #ifdef HAVE_LANGINFO_H
8014 + # include <langinfo.h>
8015 + #endif
8016 + ], [char *cs = nl_langinfo(CODESET);],
8017 +       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_NL_LANGINFO_CODESET),
8018 +       AC_MSG_RESULT(no))
8020 + dnl Need various functions for floating point support.  Only enable
8021 + dnl floating point when they are all present.
8022 + AC_CHECK_LIB(m, strtod)
8023 + AC_MSG_CHECKING([for strtod() and other floating point functions])
8024 + AC_TRY_LINK([
8025 + #ifdef HAVE_MATH_H
8026 + # include <math.h>
8027 + #endif
8028 + #if STDC_HEADERS
8029 + # include <stdlib.h>
8030 + # include <stddef.h>
8031 + #endif
8032 + ], [char *s; double d;
8033 +     d = strtod("1.1", &s);
8034 +     d = fabs(1.11);
8035 +     d = ceil(1.11);
8036 +     d = floor(1.11);
8037 +     d = log10(1.11);
8038 +     d = pow(1.11, 2.22);
8039 +     d = sqrt(1.11);
8040 +     d = sin(1.11);
8041 +     d = cos(1.11);
8042 +     d = atan(1.11);
8043 +     ],
8044 +       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FLOAT_FUNCS),
8045 +       AC_MSG_RESULT(no))
8047 + dnl isinf() and isnan() need to include header files and may need -lm.
8048 + AC_MSG_CHECKING([for isinf()])
8049 + AC_TRY_LINK([
8050 + #ifdef HAVE_MATH_H
8051 + # include <math.h>
8052 + #endif
8053 + #if STDC_HEADERS
8054 + # include <stdlib.h>
8055 + # include <stddef.h>
8056 + #endif
8057 + ], [int r = isinf(1.11); ],
8058 +       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ISINF),
8059 +       AC_MSG_RESULT(no))
8061 + AC_MSG_CHECKING([for isnan()])
8062 + AC_TRY_LINK([
8063 + #ifdef HAVE_MATH_H
8064 + # include <math.h>
8065 + #endif
8066 + #if STDC_HEADERS
8067 + # include <stdlib.h>
8068 + # include <stddef.h>
8069 + #endif
8070 + ], [int r = isnan(1.11); ],
8071 +       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ISNAN),
8072 +       AC_MSG_RESULT(no))
8074 + dnl Link with -lposix1e for ACL stuff; if not found, try -lacl for SGI
8075 + dnl when -lacl works, also try to use -lattr (required for Debian).
8076 + dnl On Solaris, use the acl_get/set functions in libsec, if present.
8077 + AC_MSG_CHECKING(--disable-acl argument)
8078 + AC_ARG_ENABLE(acl,
8079 +       [  --disable-acl           Don't check for ACL support.],
8080 +       , [enable_acl="yes"])
8081 + if test "$enable_acl" = "yes"; then
8082 + AC_MSG_RESULT(no)
8083 + AC_CHECK_LIB(posix1e, acl_get_file, [LIBS="$LIBS -lposix1e"],
8084 +       AC_CHECK_LIB(acl, acl_get_file, [LIBS="$LIBS -lacl"
8085 +                 AC_CHECK_LIB(attr, fgetxattr, LIBS="$LIBS -lattr",,)],,),)
8087 + AC_MSG_CHECKING(for POSIX ACL support)
8088 + AC_TRY_LINK([
8089 + #include <sys/types.h>
8090 + #ifdef HAVE_SYS_ACL_H
8091 + # include <sys/acl.h>
8092 + #endif
8093 + acl_t acl;], [acl = acl_get_file("foo", ACL_TYPE_ACCESS);
8094 +       acl_set_file("foo", ACL_TYPE_ACCESS, acl);
8095 +       acl_free(acl);],
8096 +       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_POSIX_ACL),
8097 +       AC_MSG_RESULT(no))
8099 + AC_CHECK_LIB(sec, acl_get, [LIBS="$LIBS -lsec"; AC_DEFINE(HAVE_SOLARIS_ZFS_ACL)],
8100 + AC_MSG_CHECKING(for Solaris ACL support)
8101 + AC_TRY_LINK([
8102 + #ifdef HAVE_SYS_ACL_H
8103 + # include <sys/acl.h>
8104 + #endif], [acl("foo", GETACLCNT, 0, NULL);
8105 +       ],
8106 +       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SOLARIS_ACL),
8107 +       AC_MSG_RESULT(no)))
8109 + AC_MSG_CHECKING(for AIX ACL support)
8110 + AC_TRY_LINK([
8111 + #if STDC_HEADERS
8112 + # include <stdlib.h>
8113 + # include <stddef.h>
8114 + #endif
8115 + #ifdef HAVE_SYS_ACL_H
8116 + # include <sys/acl.h>
8117 + #endif
8118 + #ifdef HAVE_SYS_ACCESS_H
8119 + # include <sys/access.h>
8120 + #endif
8121 + #define _ALL_SOURCE
8123 + #include <sys/stat.h>
8125 + int aclsize;
8126 + struct acl *aclent;], [aclsize = sizeof(struct acl);
8127 +       aclent = (void *)malloc(aclsize);
8128 +       statacl("foo", STX_NORMAL, aclent, aclsize);
8129 +       ],
8130 +       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_AIX_ACL),
8131 +       AC_MSG_RESULT(no))
8132 + else
8133 +   AC_MSG_RESULT(yes)
8134 + fi
8136 + if test "x$GTK_CFLAGS" != "x"; then
8137 +   dnl pango_shape_full() is new, fall back to pango_shape().
8138 +   AC_MSG_CHECKING(for pango_shape_full)
8139 +   ac_save_CFLAGS="$CFLAGS"
8140 +   ac_save_LIBS="$LIBS"
8141 +   CFLAGS="$CFLAGS $GTK_CFLAGS"
8142 +   LIBS="$LIBS $GTK_LIBS"
8143 +   AC_TRY_LINK(
8144 +   [#include <gtk/gtk.h>],
8145 +   [ pango_shape_full(NULL, 0, NULL, 0, NULL, NULL); ],
8146 +         AC_MSG_RESULT(yes); AC_DEFINE(HAVE_PANGO_SHAPE_FULL),
8147 +         AC_MSG_RESULT(no))
8148 +   CFLAGS="$ac_save_CFLAGS"
8149 +   LIBS="$ac_save_LIBS"
8150 + fi
8152 + AC_MSG_CHECKING(--disable-gpm argument)
8153 + AC_ARG_ENABLE(gpm,
8154 +       [  --disable-gpm           Don't use gpm (Linux mouse daemon).], ,
8155 +       [enable_gpm="yes"])
8157 + if test "$enable_gpm" = "yes"; then
8158 +   AC_MSG_RESULT(no)
8159 +   dnl Checking if gpm support can be compiled
8160 +   AC_CACHE_CHECK([for gpm], vi_cv_have_gpm,
8161 +       [olibs="$LIBS" ; LIBS="-lgpm"]
8162 +       AC_TRY_LINK(
8163 +           [#include <gpm.h>
8164 +           #include <linux/keyboard.h>],
8165 +           [Gpm_GetLibVersion(NULL);],
8166 +           dnl Configure defines HAVE_GPM, if it is defined feature.h defines
8167 +           dnl FEAT_MOUSE_GPM if mouse support is included
8168 +           [vi_cv_have_gpm=yes],
8169 +           [vi_cv_have_gpm=no])
8170 +       [LIBS="$olibs"]
8171 +     )
8172 +   if test $vi_cv_have_gpm = yes; then
8173 +     LIBS="$LIBS -lgpm"
8174 +     AC_DEFINE(HAVE_GPM)
8175 +   fi
8176 + else
8177 +   AC_MSG_RESULT(yes)
8178 + fi
8180 + AC_MSG_CHECKING(--disable-sysmouse argument)
8181 + AC_ARG_ENABLE(sysmouse,
8182 +       [  --disable-sysmouse    Don't use sysmouse (mouse in *BSD console).], ,
8183 +       [enable_sysmouse="yes"])
8185 + if test "$enable_sysmouse" = "yes"; then
8186 +   AC_MSG_RESULT(no)
8187 +   dnl Checking if sysmouse support can be compiled
8188 +   dnl Configure defines HAVE_SYSMOUSE, if it is defined feature.h
8189 +   dnl defines FEAT_SYSMOUSE if mouse support is included
8190 +   AC_CACHE_CHECK([for sysmouse], vi_cv_have_sysmouse,
8191 +       AC_TRY_LINK(
8192 +           [#include <sys/consio.h>
8193 +            #include <signal.h>
8194 +            #include <sys/fbio.h>],
8195 +           [struct mouse_info   mouse;
8196 +            mouse.operation = MOUSE_MODE;
8197 +            mouse.operation = MOUSE_SHOW;
8198 +            mouse.u.mode.mode = 0;
8199 +            mouse.u.mode.signal = SIGUSR2;],
8200 +           [vi_cv_have_sysmouse=yes],
8201 +           [vi_cv_have_sysmouse=no])
8202 +     )
8203 +   if test $vi_cv_have_sysmouse = yes; then
8204 +     AC_DEFINE(HAVE_SYSMOUSE)
8205 +   fi
8206 + else
8207 +   AC_MSG_RESULT(yes)
8208 + fi
8210 + dnl make sure the FD_CLOEXEC flag for fcntl()'s F_SETFD command is known
8211 + AC_MSG_CHECKING(for FD_CLOEXEC)
8212 + AC_TRY_COMPILE(
8213 + [#if HAVE_FCNTL_H
8214 + # include <fcntl.h>
8215 + #endif],
8216 + [     int flag = FD_CLOEXEC;],
8217 +       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FD_CLOEXEC),
8218 +       AC_MSG_RESULT(not usable))
8220 + dnl rename needs to be checked separately to work on Nextstep with cc
8221 + AC_MSG_CHECKING(for rename)
8222 + AC_TRY_LINK([#include <stdio.h>], [rename("this", "that")],
8223 +       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_RENAME),
8224 +       AC_MSG_RESULT(no))
8226 + dnl sysctl() may exist but not the arguments we use
8227 + AC_MSG_CHECKING(for sysctl)
8228 + AC_TRY_COMPILE(
8229 + [#include <sys/types.h>
8230 + #include <sys/sysctl.h>],
8231 + [     int mib[2], r;
8232 +       size_t len;
8234 +       mib[0] = CTL_HW;
8235 +       mib[1] = HW_USERMEM;
8236 +       len = sizeof(r);
8237 +       (void)sysctl(mib, 2, &r, &len, (void *)0, (size_t)0);
8238 +       ],
8239 +       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCTL),
8240 +       AC_MSG_RESULT(not usable))
8242 + dnl sysinfo() may exist but not be Linux compatible
8243 + AC_MSG_CHECKING(for sysinfo)
8244 + AC_TRY_COMPILE(
8245 + [#include <sys/types.h>
8246 + #include <sys/sysinfo.h>],
8247 + [     struct sysinfo sinfo;
8248 +       int t;
8250 +       (void)sysinfo(&sinfo);
8251 +       t = sinfo.totalram;
8252 +       ],
8253 +       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO),
8254 +       AC_MSG_RESULT(not usable))
8256 + dnl struct sysinfo may have the mem_unit field or not
8257 + AC_MSG_CHECKING(for sysinfo.mem_unit)
8258 + AC_TRY_COMPILE(
8259 + [#include <sys/types.h>
8260 + #include <sys/sysinfo.h>],
8261 + [     struct sysinfo sinfo;
8262 +       sinfo.mem_unit = 1;
8263 +       ],
8264 +       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO_MEM_UNIT),
8265 +       AC_MSG_RESULT(no))
8267 + dnl sysconf() may exist but not support what we want to use
8268 + AC_MSG_CHECKING(for sysconf)
8269 + AC_TRY_COMPILE(
8270 + [#include <unistd.h>],
8271 + [     (void)sysconf(_SC_PAGESIZE);
8272 +       (void)sysconf(_SC_PHYS_PAGES);
8273 +       ],
8274 +       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSCONF),
8275 +       AC_MSG_RESULT(not usable))
8277 + AC_CHECK_SIZEOF([int])
8278 + AC_CHECK_SIZEOF([long])
8279 + AC_CHECK_SIZEOF([time_t])
8280 + AC_CHECK_SIZEOF([off_t])
8282 + dnl Use different names to avoid clashing with other header files.
8283 + AC_DEFINE_UNQUOTED(VIM_SIZEOF_INT, [$ac_cv_sizeof_int])
8284 + AC_DEFINE_UNQUOTED(VIM_SIZEOF_LONG, [$ac_cv_sizeof_long])
8286 + dnl Make sure that uint32_t is really 32 bits unsigned.
8287 + AC_MSG_CHECKING([uint32_t is 32 bits])
8288 + AC_TRY_RUN([
8289 + #ifdef HAVE_STDINT_H
8290 + # include <stdint.h>
8291 + #endif
8292 + #ifdef HAVE_INTTYPES_H
8293 + # include <inttypes.h>
8294 + #endif
8295 + main() {
8296 +   uint32_t nr1 = (uint32_t)-1;
8297 +   uint32_t nr2 = (uint32_t)0xffffffffUL;
8298 +   if (sizeof(uint32_t) != 4 || nr1 != 0xffffffffUL || nr2 + 1 != 0) exit(1);
8299 +   exit(0);
8300 + }],
8301 + AC_MSG_RESULT(ok),
8302 + AC_MSG_ERROR([WRONG!  uint32_t not defined correctly.]),
8303 + AC_MSG_WARN([cannot check uint32_t when cross-compiling.]))
8305 + dnl Check for memmove() before bcopy(), makes memmove() be used when both are
8306 + dnl present, fixes problem with incompatibility between Solaris 2.4 and 2.5.
8308 + [bcopy_test_prog='
8309 + #include "confdefs.h"
8310 + #ifdef HAVE_STRING_H
8311 + # include <string.h>
8312 + #endif
8313 + #if STDC_HEADERS
8314 + # include <stdlib.h>
8315 + # include <stddef.h>
8316 + #endif
8317 + main() {
8318 +   char buf[10];
8319 +   strcpy(buf, "abcdefghi");
8320 +   mch_memmove(buf, buf + 2, 3);
8321 +   if (strncmp(buf, "ababcf", 6))
8322 +     exit(1);
8323 +   strcpy(buf, "abcdefghi");
8324 +   mch_memmove(buf + 2, buf, 3);
8325 +   if (strncmp(buf, "cdedef", 6))
8326 +     exit(1);
8327 +   exit(0); /* libc version works properly.  */
8328 + }']
8330 + AC_CACHE_CHECK([whether memmove handles overlaps],[vim_cv_memmove_handles_overlap],
8331 +   [
8332 +     AC_RUN_IFELSE([AC_LANG_SOURCE([[#define mch_memmove(s,d,l) memmove(d,s,l) $bcopy_test_prog]])],
8333 +       [
8334 +       vim_cv_memmove_handles_overlap=yes
8335 +       ],[
8336 +       vim_cv_memmove_handles_overlap=no
8337 +       ],[
8338 +       AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memmove_handles_overlap')
8339 +       ])
8340 +   ])
8342 + if test "x$vim_cv_memmove_handles_overlap" = "xyes" ; then
8343 +   AC_DEFINE(USEMEMMOVE)
8344 + else
8345 +   AC_CACHE_CHECK([whether bcopy handles overlaps],[vim_cv_bcopy_handles_overlap],
8346 +     [
8347 +       AC_RUN_IFELSE([AC_LANG_SOURCE([[#define mch_bcopy(s,d,l) bcopy(d,s,l) $bcopy_test_prog]])],
8348 +       [
8349 +       vim_cv_bcopy_handles_overlap=yes
8350 +       ],[
8351 +       vim_cv_bcopy_handles_overlap=no
8352 +       ],[
8353 +       AC_MSG_ERROR(cross-compiling: please set 'vim_cv_bcopy_handles_overlap')
8354 +       ])
8355 +     ])
8357 +   if test "x$vim_cv_bcopy_handles_overlap" = "xyes" ; then
8358 +     AC_DEFINE(USEBCOPY)
8359 +   else
8360 +     AC_CACHE_CHECK([whether memcpy handles overlaps],[vim_cv_memcpy_handles_overlap],
8361 +       [
8362 +       AC_RUN_IFELSE([AC_LANG_SOURCE([[#define mch_memcpy(s,d,l) memcpy(d,s,l) $bcopy_test_prog]])],
8363 +         [
8364 +           vim_cv_memcpy_handles_overlap=yes
8365 +         ],[
8366 +           vim_cv_memcpy_handles_overlap=no
8367 +         ],[
8368 +           AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memcpy_handles_overlap')
8369 +         ])
8370 +       ])
8372 +     if test "x$vim_cv_memcpy_handles_overlap" = "xyes" ; then
8373 +       AC_DEFINE(USEMEMCPY)
8374 +     fi
8375 +   fi
8376 + fi
8379 + dnl Check for multibyte locale functions
8380 + dnl Find out if _Xsetlocale() is supported by libX11.
8381 + dnl Check if X_LOCALE should be defined.
8382 + if test "x$with_x" = "xyes"; then
8383 +   cflags_save=$CFLAGS
8384 +   libs_save=$LIBS
8385 +   LIBS="$LIBS $X_LIBS $GUI_LIB_LOC $GUI_X_LIBS $X_PRE_LIBS $X_LIB $X_EXTRA_LIBS"
8386 +   CFLAGS="$CFLAGS $X_CFLAGS"
8388 +   AC_MSG_CHECKING(whether X_LOCALE needed)
8389 +   AC_TRY_COMPILE([#include <X11/Xlocale.h>],,
8390 +       AC_TRY_LINK_FUNC([_Xsetlocale], [AC_MSG_RESULT(yes)
8391 +             AC_DEFINE(X_LOCALE)], AC_MSG_RESULT(no)),
8392 +       AC_MSG_RESULT(no))
8394 +   AC_MSG_CHECKING(whether Xutf8SetWMProperties() can be used)
8395 +   AC_TRY_LINK_FUNC([Xutf8SetWMProperties], [AC_MSG_RESULT(yes)
8396 +             AC_DEFINE(HAVE_XUTF8SETWMPROPERTIES)], AC_MSG_RESULT(no))
8398 +   CFLAGS=$cflags_save
8399 +   LIBS=$libs_save
8400 + fi
8402 + dnl Link with xpg4, it is said to make Korean locale working
8403 + AC_CHECK_LIB(xpg4, _xpg4_setrunelocale, [LIBS="$LIBS -lxpg4"],,)
8405 + dnl Check how we can run ctags.  Default to "ctags" when nothing works.
8406 + dnl Use --version to detect Exuberant ctags (preferred)
8407 + dnl       Add --fields=+S to get function signatures for omni completion.
8408 + dnl -t for typedefs (many ctags have this)
8409 + dnl -s for static functions (Elvis ctags only?)
8410 + dnl -v for variables. Dangerous, most ctags take this for 'vgrind style'.
8411 + dnl -i+m to test for older Exuberant ctags
8412 + AC_MSG_CHECKING(how to create tags)
8413 + test -f tags && mv tags tags.save
8414 + if (eval ctags --version /dev/null | grep Exuberant) < /dev/null 1>&AC_FD_CC 2>&1; then
8415 +   TAGPRG="ctags -I INIT+ --fields=+S"
8416 + elif (eval exctags --version /dev/null | grep Exuberant) < /dev/null 1>&AC_FD_CC 2>&1; then
8417 +   TAGPRG="exctags -I INIT+ --fields=+S"
8418 + elif (eval exuberant-ctags --version /dev/null | grep Exuberant) < /dev/null 1>&AC_FD_CC 2>&1; then
8419 +   TAGPRG="exuberant-ctags -I INIT+ --fields=+S"
8420 + else
8421 +   TAGPRG="ctags"
8422 +   (eval etags    /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags"
8423 +   (eval etags -c   /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags -c"
8424 +   (eval ctags    /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags"
8425 +   (eval ctags -t   /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -t"
8426 +   (eval ctags -ts  /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -ts"
8427 +   (eval ctags -tvs /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -tvs"
8428 +   (eval ctags -i+m /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags -i+m"
8429 + fi
8430 + test -f tags.save && mv tags.save tags
8431 + AC_MSG_RESULT($TAGPRG) AC_SUBST(TAGPRG)
8433 + dnl Check how we can run man with a section number
8434 + AC_MSG_CHECKING(how to run man with a section nr)
8435 + MANDEF="man"
8436 + (eval MANPAGER=cat PAGER=cat man -s 2 read) < /dev/null > /dev/null 2>&AC_FD_CC && MANDEF="man -s"
8437 + AC_MSG_RESULT($MANDEF)
8438 + if test "$MANDEF" = "man -s"; then
8439 +   AC_DEFINE(USEMAN_S)
8440 + fi
8442 + dnl Check if gettext() is working and if it needs -lintl
8443 + dnl We take care to base this on an empty LIBS: on some systems libelf would be
8444 + dnl in LIBS and implicitly take along libintl. The final LIBS would then not
8445 + dnl contain libintl, and the link step would fail due to -Wl,--as-needed.
8446 + AC_MSG_CHECKING(--disable-nls argument)
8447 + AC_ARG_ENABLE(nls,
8448 +       [  --disable-nls           Don't support NLS (gettext()).], ,
8449 +       [enable_nls="yes"])
8451 + if test "$enable_nls" = "yes"; then
8452 +   AC_MSG_RESULT(no)
8454 +   INSTALL_LANGS=install-languages
8455 +   AC_SUBST(INSTALL_LANGS)
8456 +   INSTALL_TOOL_LANGS=install-tool-languages
8457 +   AC_SUBST(INSTALL_TOOL_LANGS)
8459 +   AC_CHECK_PROG(MSGFMT, msgfmt, msgfmt, )
8460 +   AC_MSG_CHECKING([for NLS])
8461 +   if test -f po/Makefile; then
8462 +     have_gettext="no"
8463 +     if test -n "$MSGFMT"; then
8464 +       olibs=$LIBS
8465 +       LIBS=""
8466 +       AC_TRY_LINK(
8467 +       [#include <libintl.h>],
8468 +       [gettext("Test");],
8469 +       AC_MSG_RESULT([gettext() works]); have_gettext="yes"; LIBS=$olibs,
8470 +         LIBS="-lintl"
8471 +         AC_TRY_LINK(
8472 +             [#include <libintl.h>],
8473 +             [gettext("Test");],
8474 +             AC_MSG_RESULT([gettext() works with -lintl]); have_gettext="yes";
8475 +             LIBS="$olibs -lintl",
8476 +             AC_MSG_RESULT([gettext() doesn't work]);
8477 +             LIBS=$olibs))
8478 +     else
8479 +       AC_MSG_RESULT([msgfmt not found - disabled]);
8480 +     fi
8481 +     if test $have_gettext = "yes" -a "x$features" != "xtiny" -a "x$features" != "xsmall"; then
8482 +       AC_DEFINE(HAVE_GETTEXT)
8483 +       MAKEMO=yes
8484 +       AC_SUBST(MAKEMO)
8485 +       dnl this was added in GNU gettext 0.10.36
8486 +       AC_CHECK_FUNCS(bind_textdomain_codeset)
8487 +       dnl _nl_msg_cat_cntr is required for GNU gettext
8488 +       AC_MSG_CHECKING([for _nl_msg_cat_cntr])
8489 +       AC_TRY_LINK(
8490 +               [#include <libintl.h>
8491 +               extern int _nl_msg_cat_cntr;],
8492 +               [++_nl_msg_cat_cntr;],
8493 +               AC_MSG_RESULT([yes]); AC_DEFINE(HAVE_NL_MSG_CAT_CNTR),
8494 +               AC_MSG_RESULT([no]))
8495 +     fi
8496 +   else
8497 +     AC_MSG_RESULT([no "po/Makefile" - disabled]);
8498 +   fi
8499 + else
8500 +   AC_MSG_RESULT(yes)
8501 + fi
8503 + dnl Check for dynamic linking loader
8504 + AC_CHECK_HEADER(dlfcn.h, DLL=dlfcn.h, [AC_CHECK_HEADER(dl.h, DLL=dl.h)])
8505 + if test x${DLL} = xdlfcn.h; then
8506 +   AC_DEFINE(HAVE_DLFCN_H, 1, [ Define if we have dlfcn.h. ])
8507 +   AC_MSG_CHECKING([for dlopen()])
8508 +   AC_TRY_LINK(,[
8509 +               extern void* dlopen();
8510 +               dlopen();
8511 +       ],
8512 +       AC_MSG_RESULT(yes);
8513 +             AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]),
8514 +       AC_MSG_RESULT(no);
8515 +             AC_MSG_CHECKING([for dlopen() in -ldl])
8516 +             olibs=$LIBS
8517 +             LIBS="$LIBS -ldl"
8518 +             AC_TRY_LINK(,[
8519 +                               extern void* dlopen();
8520 +                               dlopen();
8521 +                ],
8522 +                AC_MSG_RESULT(yes);
8523 +                         AC_DEFINE(HAVE_DLOPEN, 1, [ Define if we have dlopen() ]),
8524 +                AC_MSG_RESULT(no);
8525 +                         LIBS=$olibs))
8526 +   dnl ReliantUNIX has dlopen() in libc but everything else in libdl
8527 +   dnl ick :-)
8528 +   AC_MSG_CHECKING([for dlsym()])
8529 +   AC_TRY_LINK(,[
8530 +               extern void* dlsym();
8531 +               dlsym();
8532 +       ],
8533 +       AC_MSG_RESULT(yes);
8534 +             AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]),
8535 +       AC_MSG_RESULT(no);
8536 +             AC_MSG_CHECKING([for dlsym() in -ldl])
8537 +             olibs=$LIBS
8538 +             LIBS="$LIBS -ldl"
8539 +             AC_TRY_LINK(,[
8540 +                               extern void* dlsym();
8541 +                               dlsym();
8542 +                ],
8543 +                AC_MSG_RESULT(yes);
8544 +                         AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]),
8545 +                AC_MSG_RESULT(no);
8546 +                         LIBS=$olibs))
8547 + elif test x${DLL} = xdl.h; then
8548 +   AC_DEFINE(HAVE_DL_H, 1, [ Define if we have dl.h. ])
8549 +   AC_MSG_CHECKING([for shl_load()])
8550 +   AC_TRY_LINK(,[
8551 +               extern void* shl_load();
8552 +               shl_load();
8553 +      ],
8554 +      AC_MSG_RESULT(yes);
8555 +         AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]),
8556 +      AC_MSG_RESULT(no);
8557 +         AC_MSG_CHECKING([for shl_load() in -ldld])
8558 +         olibs=$LIBS
8559 +         LIBS="$LIBS -ldld"
8560 +         AC_TRY_LINK(,[
8561 +                       extern void* shl_load();
8562 +                       shl_load();
8563 +            ],
8564 +            AC_MSG_RESULT(yes);
8565 +                 AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]),
8566 +            AC_MSG_RESULT(no);
8567 +                 LIBS=$olibs))
8568 + fi
8569 + AC_CHECK_HEADERS(setjmp.h)
8571 + if test "x$MACOSX" = "xyes" -a -n "$PERL"; then
8572 +   dnl -ldl must come after DynaLoader.a
8573 +   if echo $LIBS | grep -e '-ldl' >/dev/null; then
8574 +     LIBS=`echo $LIBS | sed s/-ldl//`
8575 +     PERL_LIBS="$PERL_LIBS -ldl"
8576 +   fi
8577 + fi
8579 + if test "x$MACOSX" = "xyes"; then
8580 +   AC_MSG_CHECKING(whether we need -framework Cocoa)
8581 +   dnl Cocoa is needed with FEAT_CLIPBOARD or FEAT_MBYTE (the former is
8582 +   dnl disabled during tiny build)
8583 +   if test "x$features" != "xtiny" || test "x$enable_multibyte" = "xyes"; then
8584 +     LIBS=$"$LIBS -framework Cocoa"
8585 +     AC_MSG_RESULT(yes)
8586 +   else
8587 +     AC_MSG_RESULT(no)
8588 +   fi
8589 +   dnl As mentioned above, tiny build implies os_macosx.m isn't needed.  
8590 +   dnl Exclude it from OS_EXTRA_SRC so that linker won't complain about
8591 +   dnl missing Objective-C symbols.
8592 +   if test "x$features" = "xtiny"; then
8593 +     OS_EXTRA_SRC=`echo "$OS_EXTRA_SRC" | sed -e 's+os_macosx.m++'`
8594 +     OS_EXTRA_OBJ=`echo "$OS_EXTRA_OBJ" | sed -e 's+objects/os_macosx.o++'`
8595 +   fi
8596 + fi
8597 + if test "x$MACARCH" = "xboth" && test "x$GUITYPE" = "xCARBONGUI"; then
8598 +   LDFLAGS="$LDFLAGS -isysroot $DEVELOPER_DIR/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
8599 + fi
8601 + dnl gcc 3.1 changed the meaning of -MM.  The only solution appears to be to
8602 + dnl use "-isystem" instead of "-I" for all non-Vim include dirs.
8603 + dnl But only when making dependencies, cproto and lint don't take "-isystem".
8604 + dnl Mac gcc returns "powerpc-apple-darwin8-gcc-4.0.1 (GCC)...", need to allow
8605 + dnl the number before the version number.
8606 + DEPEND_CFLAGS_FILTER=
8607 + if test "$GCC" = yes; then
8608 +   AC_MSG_CHECKING(for GCC 3 or later)
8609 +   gccmajor=`echo "$gccversion" | sed -e 's/^\([[1-9]]\)\..*$/\1/g'`
8610 +   if test "$gccmajor" -gt "2"; then
8611 +     DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
8612 +     AC_MSG_RESULT(yes)
8613 +   else
8614 +     AC_MSG_RESULT(no)
8615 +   fi
8616 +   dnl -D_FORTIFY_SOURCE=2 crashes Vim on strcpy(buf, "000") when buf is
8617 +   dnl declared as char x[1] but actually longer.  Introduced in gcc 4.0.
8618 +   dnl Also remove duplicate _FORTIFY_SOURCE arguments.
8619 +   dnl And undefine it first to avoid a warning.
8620 +   AC_MSG_CHECKING(whether we need -D_FORTIFY_SOURCE=1)
8621 +   if test "$gccmajor" -gt "3"; then
8622 +     CFLAGS=`echo "$CFLAGS" | sed -e 's/ *-Wp,-D_FORTIFY_SOURCE=.//g' -e 's/ *-D_FORTIFY_SOURCE=.//g' -e 's/ *-U_FORTIFY_SOURCE//g' -e 's/$/ -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1/'`
8623 +     AC_MSG_RESULT(yes)
8624 +   else
8625 +     AC_MSG_RESULT(no)
8626 +   fi
8627 + fi
8628 + AC_SUBST(DEPEND_CFLAGS_FILTER)
8630 + dnl link.sh tries to avoid overlinking in a hackish way.
8631 + dnl At least GNU ld supports --as-needed which provides the same functionality
8632 + dnl at linker level. Let's use it.
8633 + AC_MSG_CHECKING(linker --as-needed support)
8634 + LINK_AS_NEEDED=
8635 + # Check if linker supports --as-needed and --no-as-needed options
8636 + if $CC -Wl,--help 2>/dev/null | grep as-needed > /dev/null; then
8637 +   LDFLAGS=`echo "$LDFLAGS" | sed -e 's/ *-Wl,--as-needed//g' | sed -e 's/$/ -Wl,--as-needed/'`
8638 +   LINK_AS_NEEDED=yes
8639 + fi
8640 + if test "$LINK_AS_NEEDED" = yes; then
8641 +   AC_MSG_RESULT(yes)
8642 + else
8643 +   AC_MSG_RESULT(no)
8644 + fi
8645 + AC_SUBST(LINK_AS_NEEDED)
8647 + # IBM z/OS reset CFLAGS for config.mk
8648 + if test "$zOSUnix" = "yes"; then
8649 +       CFLAGS="-D_ALL_SOURCE -Wc,float\(ieee\),dll"
8650 + fi
8652 + dnl write output files
8653 + AC_OUTPUT(auto/config.mk:config.mk.in)
8655 + dnl vim: set sw=2 tw=78 fo+=l:
8656 *** ../vim-8.0.0081/Filelist    2016-08-28 20:13:39.000000000 +0200
8657 --- Filelist    2016-11-12 20:12:35.618728568 +0100
8658 ***************
8659 *** 207,213 ****
8660                 src/config.mk.dist \
8661                 src/config.mk.in \
8662                 src/configure \
8663 !               src/configure.in \
8664                 src/gui_at_fs.c \
8665                 src/gui_at_sb.c \
8666                 src/gui_at_sb.h \
8667 --- 207,213 ----
8668                 src/config.mk.dist \
8669                 src/config.mk.in \
8670                 src/configure \
8671 !               src/configure.ac \
8672                 src/gui_at_fs.c \
8673                 src/gui_at_sb.c \
8674                 src/gui_at_sb.h \
8675 *** ../vim-8.0.0081/src/Makefile        2016-11-10 20:01:41.201582868 +0100
8676 --- src/Makefile        2016-11-12 20:11:51.591020603 +0100
8677 ***************
8678 *** 690,697 ****
8679   #####################################################
8680   
8681   ### Uncomment things here only if the values chosen by configure are wrong.
8682 ! ### It's better to adjust configure.in and "make autoconf", if you can!
8683 ! ### Then send the required changes to configure.in to the bugs list.
8684   
8685   ### (1) BSD/OS 2.0.1, 2.1 or 3.0 using shared libraries
8686   ###
8687 --- 690,697 ----
8688   #####################################################
8689   
8690   ### Uncomment things here only if the values chosen by configure are wrong.
8691 ! ### It's better to adjust configure.ac and "make autoconf", if you can!
8692 ! ### Then send the required changes to configure.ac to the bugs list.
8693   
8694   ### (1) BSD/OS 2.0.1, 2.1 or 3.0 using shared libraries
8695   ###
8696 ***************
8697 *** 1832,1838 ****
8698   # - DO NOT RUN autoconf MANUALLY!  It will overwrite ./configure instead of
8699   #   producing auto/configure.
8700   # - autoconf is not run automatically, because a patch usually changes both
8701 ! #   configure.in and auto/configure but can't update the timestamps.  People
8702   #   who do not have (the correct version of) autoconf would run into trouble.
8703   #
8704   # Two tricks are required to make autoconf put its output in the "auto" dir:
8705 --- 1832,1838 ----
8706   # - DO NOT RUN autoconf MANUALLY!  It will overwrite ./configure instead of
8707   #   producing auto/configure.
8708   # - autoconf is not run automatically, because a patch usually changes both
8709 ! #   configure.ac and auto/configure but can't update the timestamps.  People
8710   #   who do not have (the correct version of) autoconf would run into trouble.
8711   #
8712   # Two tricks are required to make autoconf put its output in the "auto" dir:
8713 *** ../vim-8.0.0081/src/blowfish.c      2016-11-10 20:01:41.181582995 +0100
8714 --- src/blowfish.c      2016-11-12 20:08:09.272496358 +0100
8715 ***************
8716 *** 38,44 ****
8717     /* MS-Windows is always little endian */
8718   #else
8719   # ifdef HAVE_CONFIG_H
8720 !    /* in configure.in AC_C_BIGENDIAN() defines WORDS_BIGENDIAN when needed */
8721   # else
8722      error!
8723      Please change this code to define WORDS_BIGENDIAN for big-endian machines.
8724 --- 38,44 ----
8725     /* MS-Windows is always little endian */
8726   #else
8727   # ifdef HAVE_CONFIG_H
8728 !    /* in configure.ac AC_C_BIGENDIAN() defines WORDS_BIGENDIAN when needed */
8729   # else
8730      error!
8731      Please change this code to define WORDS_BIGENDIAN for big-endian machines.
8732 *** ../vim-8.0.0081/src/channel.c       2016-11-11 21:13:56.836753930 +0100
8733 --- src/channel.c       2016-11-12 20:08:27.040378345 +0100
8734 ***************
8735 *** 19,25 ****
8736   # define CH_HAS_GUI (gui.in_use || gui.starting)
8737   #endif
8738   
8739 ! /* Note: when making changes here also adjust configure.in. */
8740   #ifdef WIN32
8741   /* WinSock API is separated from C API, thus we can't use read(), write(),
8742    * errno... */
8743 --- 19,25 ----
8744   # define CH_HAS_GUI (gui.in_use || gui.starting)
8745   #endif
8746   
8747 ! /* Note: when making changes here also adjust configure.ac. */
8748   #ifdef WIN32
8749   /* WinSock API is separated from C API, thus we can't use read(), write(),
8750    * errno... */
8751 *** ../vim-8.0.0081/src/config.h.in     2016-10-18 16:27:20.540756047 +0200
8752 --- src/config.h.in     2016-11-12 20:09:15.712055133 +0100
8753 ***************
8754 *** 1,6 ****
8755   /*
8756 !  * config.h.in.  Generated automatically from configure.in by autoheader, and
8757 !  * manually changed after that.
8758    */
8759   
8760   /* Define if we have EBCDIC code */
8761 --- 1,6 ----
8762   /*
8763 !  * config.h.in.  Originally generated automatically from configure.ac by
8764 !  * autoheader and manually changed after that.
8765    */
8766   
8767   /* Define if we have EBCDIC code */
8768 *** ../vim-8.0.0081/src/main.aap        2016-09-25 21:44:59.441600148 +0200
8769 --- src/main.aap        2016-11-12 20:10:45.471459311 +0100
8770 ***************
8771 *** 22,32 ****
8772       # A U T O C O N F
8773       #
8774   
8775 !     # Run autoconf when configure.in has been changed since it was last run.
8776       # This is skipped when the signatures in "mysign" are up-to-date.  When
8777       # there is no autoconf program skip this (the signature is often the only
8778       # thing that's outdated)
8779 !     auto/configure {signfile = mysign} : configure.in
8780           @if not program_path("autoconf"):
8781               :print Can't find autoconf, using existing configure script.
8782           @else:
8783 --- 22,32 ----
8784       # A U T O C O N F
8785       #
8786   
8787 !     # Run autoconf when configure.ac has been changed since it was last run.
8788       # This is skipped when the signatures in "mysign" are up-to-date.  When
8789       # there is no autoconf program skip this (the signature is often the only
8790       # thing that's outdated)
8791 !     auto/configure {signfile = mysign} : configure.ac
8792           @if not program_path("autoconf"):
8793               :print Can't find autoconf, using existing configure script.
8794           @else:
8795 *** ../vim-8.0.0081/src/os_unix.c       2016-11-07 22:42:48.828350757 +0100
8796 --- src/os_unix.c       2016-11-12 20:11:05.415326964 +0100
8797 ***************
8798 *** 265,271 ****
8799    * that describe the signals. That is nearly what we want here.  But
8800    * autoconf does only check for sys_siglist (without the underscore), I
8801    * do not want to change everything today.... jw.
8802 !  * This is why AC_DECL_SYS_SIGLIST is commented out in configure.in
8803    */
8804   #endif
8805   
8806 --- 265,271 ----
8807    * that describe the signals. That is nearly what we want here.  But
8808    * autoconf does only check for sys_siglist (without the underscore), I
8809    * do not want to change everything today.... jw.
8810 !  * This is why AC_DECL_SYS_SIGLIST is commented out in configure.ac.
8811    */
8812   #endif
8813   
8814 *** ../vim-8.0.0081/src/INSTALL 2016-04-12 22:44:00.000000000 +0200
8815 --- src/INSTALL 2016-11-12 20:11:25.459193970 +0100
8816 ***************
8817 *** 221,228 ****
8818   be considered for the next release.  If at some point `config.cache'
8819   contains results you don't want to keep, you may remove or edit it.
8820   
8821 !    The file `configure.in' is used to create `configure' by a program
8822 ! called `autoconf'.  You only need `configure.in' if you want to change
8823   it or regenerate `configure' using a newer version of `autoconf'.
8824   
8825   The simplest way to compile this package is:
8826 --- 221,228 ----
8827   be considered for the next release.  If at some point `config.cache'
8828   contains results you don't want to keep, you may remove or edit it.
8829   
8830 !    The file `configure.ac' is used to create `configure' by a program
8831 ! called `autoconf'.  You only need `configure.ac' if you want to change
8832   it or regenerate `configure' using a newer version of `autoconf'.
8833   
8834   The simplest way to compile this package is:
8835 *** ../vim-8.0.0081/src/mysign  2010-05-15 13:04:12.000000000 +0200
8836 --- src/mysign  2016-11-12 21:01:30.478617518 +0100
8837 ***************
8838 *** 1 ****
8839 ! =auto/configure\e-lastupdate=1178970549.78\e-@buildcheck=dfc15c059b7ce88a951584995c49a201\e=configure.in@md5=e0d6e9a7d7b986d63ce4e8e7362fd0b9\e
8840 --- 1 ----
8841 ! =auto/configure\e-lastupdate=1178970549.78\e-@buildcheck=dfc15c059b7ce88a951584995c49a201\e=configure.ac@md5=e0d6e9a7d7b986d63ce4e8e7362fd0b9\e
8842 *** ../vim-8.0.0081/src/version.c       2016-11-12 19:16:42.216999886 +0100
8843 --- src/version.c       2016-11-12 20:06:39.673091660 +0100
8844 ***************
8845 *** 766,767 ****
8846 --- 766,769 ----
8847   {   /* Add new patch number below this line */
8848 + /**/
8849 +     82,
8850   /**/
8852 -- 
8853 hundred-and-one symptoms of being an internet addict:
8854 27. You refer to your age as 3.x.
8856  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
8857 ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
8858 \\\  an exciting new programming language -- http://www.Zimbu.org        ///
8859  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///