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