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