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