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