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