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