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