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