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