comparison src/configure.in @ 1621:82b5078be2dd

updated for version 7.2a
author vimboss
date Tue, 24 Jun 2008 21:56:24 +0000
parents ebe059f69b9e
children 68f005107052
comparison
equal deleted inserted replaced
1620:73fe8baea242 1621:82b5078be2dd
20 dnl Don't strip if we don't have it 20 dnl Don't strip if we don't have it
21 AC_CHECK_PROG(STRIP, strip, strip, :) 21 AC_CHECK_PROG(STRIP, strip, strip, :)
22 22
23 dnl Check for extension of executables 23 dnl Check for extension of executables
24 AC_EXEEXT 24 AC_EXEEXT
25
26 dnl Check for standard headers. We don't use this in Vim but other stuff
27 dnl in autoconf needs it, where it uses STDC_HEADERS.
28 AC_HEADER_STDC
29 AC_HEADER_SYS_WAIT
25 30
26 dnl Set default value for CFLAGS if none is defined or it's empty 31 dnl Set default value for CFLAGS if none is defined or it's empty
27 if test -z "$CFLAGS"; then 32 if test -z "$CFLAGS"; then
28 CFLAGS="-O" 33 CFLAGS="-O"
29 test "$GCC" = yes && CFLAGS="-O2 -fno-strength-reduce -Wall" 34 test "$GCC" = yes && CFLAGS="-O2 -fno-strength-reduce -Wall"
45 CFLAGS="$CFLAGS -fno-strength-reduce" 50 CFLAGS="$CFLAGS -fno-strength-reduce"
46 fi 51 fi
47 fi 52 fi
48 fi 53 fi
49 54
50 dnl If configure thinks we are cross compiling, there is probably something 55 dnl If configure thinks we are cross compiling, there might be something
51 dnl wrong with the CC or CFLAGS settings, give an understandable error message 56 dnl wrong with the CC or CFLAGS settings, give a useful warning message
52 if test "$cross_compiling" = yes; then 57 if test "$cross_compiling" = yes; then
53 AC_MSG_ERROR([cannot compile a simple program, check CC and CFLAGS 58 AC_MSG_RESULT([cannot compile a simple program; if not cross compiling check CC and CFLAGS])
54 (cross compiling doesn't work)])
55 fi 59 fi
56 60
57 dnl gcc-cpp has the wonderful -MM option to produce nicer dependencies. 61 dnl gcc-cpp has the wonderful -MM option to produce nicer dependencies.
58 dnl But gcc 3.1 changed the meaning! See near the end. 62 dnl But gcc 3.1 changed the meaning! See near the end.
59 test "$GCC" = yes && CPP_MM=M; AC_SUBST(CPP_MM) 63 test "$GCC" = yes && CPP_MM=M; AC_SUBST(CPP_MM)
184 AC_SUBST(OS_EXTRA_OBJ) 188 AC_SUBST(OS_EXTRA_OBJ)
185 189
186 dnl Add /usr/local/lib to $LDFLAGS and /usr/local/include to CFLAGS. 190 dnl Add /usr/local/lib to $LDFLAGS and /usr/local/include to CFLAGS.
187 dnl Only when the directory exists and it wasn't there yet. 191 dnl Only when the directory exists and it wasn't there yet.
188 dnl For gcc don't do this when it is already in the default search path. 192 dnl For gcc don't do this when it is already in the default search path.
189 have_local_include='' 193 dnl Skip all of this when cross-compiling.
190 have_local_lib='' 194 if test "$cross_compiling" = no; then
191 if test "$GCC" = yes; then 195 have_local_include=''
192 echo 'void f(){}' > conftest.c 196 have_local_lib=''
193 dnl -no-cpp-precomp is needed for OS X 10.2 (Ben Fowler) 197 if test "$GCC" = yes; then
194 have_local_include=`${CC-cc} -no-cpp-precomp -c -v conftest.c 2>&1 | grep '/usr/local/include'` 198 echo 'void f(){}' > conftest.c
195 have_local_lib=`${CC-cc} -c -v conftest.c 2>&1 | grep '/usr/local/lib'` 199 dnl -no-cpp-precomp is needed for OS X 10.2 (Ben Fowler)
196 rm -f conftest.c conftest.o 200 have_local_include=`${CC-cc} -no-cpp-precomp -c -v conftest.c 2>&1 | grep '/usr/local/include'`
197 fi 201 have_local_lib=`${CC-cc} -c -v conftest.c 2>&1 | grep '/usr/local/lib'`
198 if test -z "$have_local_lib" -a -d /usr/local/lib; then 202 rm -f conftest.c conftest.o
199 tt=`echo "$LDFLAGS" | sed -e 's+-L/usr/local/lib ++g' -e 's+-L/usr/local/lib$++g'` 203 fi
200 if test "$tt" = "$LDFLAGS"; then 204 if test -z "$have_local_lib" -a -d /usr/local/lib; then
201 LDFLAGS="$LDFLAGS -L/usr/local/lib" 205 tt=`echo "$LDFLAGS" | sed -e 's+-L/usr/local/lib ++g' -e 's+-L/usr/local/lib$++g'`
202 fi 206 if test "$tt" = "$LDFLAGS"; then
203 fi 207 LDFLAGS="$LDFLAGS -L/usr/local/lib"
204 if test -z "$have_local_include" -a -d /usr/local/include; then 208 fi
205 tt=`echo "$CPPFLAGS" | sed -e 's+-I/usr/local/include ++g' -e 's+-I/usr/local/include$++g'` 209 fi
206 if test "$tt" = "$CPPFLAGS"; then 210 if test -z "$have_local_include" -a -d /usr/local/include; then
207 CPPFLAGS="$CPPFLAGS -I/usr/local/include" 211 tt=`echo "$CPPFLAGS" | sed -e 's+-I/usr/local/include ++g' -e 's+-I/usr/local/include$++g'`
212 if test "$tt" = "$CPPFLAGS"; then
213 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
214 fi
208 fi 215 fi
209 fi 216 fi
210 217
211 AC_MSG_CHECKING(--with-vim-name argument) 218 AC_MSG_CHECKING(--with-vim-name argument)
212 AC_ARG_WITH(vim-name, [ --with-vim-name=NAME what to call the Vim executable], 219 AC_ARG_WITH(vim-name, [ --with-vim-name=NAME what to call the Vim executable],
1420 dnl 1427 dnl
1421 rm -f conf.gtktest 1428 rm -f conf.gtktest
1422 AC_TRY_RUN([ 1429 AC_TRY_RUN([
1423 #include <gtk/gtk.h> 1430 #include <gtk/gtk.h>
1424 #include <stdio.h> 1431 #include <stdio.h>
1432 #if STDC_HEADERS
1433 # include <stdlib.h>
1434 # include <stddef.h>
1435 #endif
1425 1436
1426 int 1437 int
1427 main () 1438 main ()
1428 { 1439 {
1429 int major, minor, micro; 1440 int major, minor, micro;
2006 fi 2017 fi
2007 fi 2018 fi
2008 2019
2009 dnl Checks for libraries and include files. 2020 dnl Checks for libraries and include files.
2010 2021
2011 AC_MSG_CHECKING(quality of toupper) 2022 AC_CACHE_CHECK([whether toupper is broken], [vim_cv_toupper_broken],
2012 AC_TRY_RUN([#include <ctype.h> 2023 [
2013 main() { exit(toupper('A') == 'A' && tolower('z') == 'z'); }], 2024 AC_RUN_IFELSE([[
2014 AC_DEFINE(BROKEN_TOUPPER) AC_MSG_RESULT(bad), 2025 #include "confdefs.h"
2015 AC_MSG_RESULT(good), AC_MSG_ERROR(failed to compile test program)) 2026 #include <ctype.h>
2027 #if STDC_HEADERS
2028 # include <stdlib.h>
2029 # include <stddef.h>
2030 #endif
2031 main() { exit(toupper('A') == 'A' && tolower('z') == 'z'); }
2032 ]],[
2033 vim_cv_toupper_broken=yes
2034 ],[
2035 vim_cv_toupper_broken=no
2036 ],[
2037 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_toupper_broken')
2038 ])])
2039
2040 if test "x$vim_cv_toupper_broken" = "xyes" ; then
2041 AC_DEFINE(BROKEN_TOUPPER)
2042 fi
2016 2043
2017 AC_MSG_CHECKING(whether __DATE__ and __TIME__ work) 2044 AC_MSG_CHECKING(whether __DATE__ and __TIME__ work)
2018 AC_TRY_COMPILE(, [printf("(" __DATE__ " " __TIME__ ")");], 2045 AC_TRY_COMPILE([#include <stdio.h>], [printf("(" __DATE__ " " __TIME__ ")");],
2019 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_DATE_TIME), 2046 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_DATE_TIME),
2020 AC_MSG_RESULT(no)) 2047 AC_MSG_RESULT(no))
2021 2048
2022 dnl Checks for header files. 2049 dnl Checks for header files.
2023 AC_CHECK_HEADER(elf.h, HAS_ELF=1) 2050 AC_CHECK_HEADER(elf.h, HAS_ELF=1)
2025 if test "$HAS_ELF" = 1; then 2052 if test "$HAS_ELF" = 1; then
2026 AC_CHECK_LIB(elf, main) 2053 AC_CHECK_LIB(elf, main)
2027 fi 2054 fi
2028 2055
2029 AC_HEADER_DIRENT 2056 AC_HEADER_DIRENT
2030
2031 dnl check for standard headers, we don't use this in Vim but other stuff
2032 dnl in autoconf needs it
2033 AC_HEADER_STDC
2034 AC_HEADER_SYS_WAIT
2035 2057
2036 dnl If sys/wait.h is not found it might still exist but not be POSIX 2058 dnl If sys/wait.h is not found it might still exist but not be POSIX
2037 dnl compliant. In that case we define HAVE_UNION_WAIT (for NeXT) 2059 dnl compliant. In that case we define HAVE_UNION_WAIT (for NeXT)
2038 if test $ac_cv_header_sys_wait_h = no; then 2060 if test $ac_cv_header_sys_wait_h = no; then
2039 AC_MSG_CHECKING([for sys/wait.h that defines union wait]) 2061 AC_MSG_CHECKING([for sys/wait.h that defines union wait])
2045 AC_MSG_RESULT(no)) 2067 AC_MSG_RESULT(no))
2046 fi 2068 fi
2047 2069
2048 AC_CHECK_HEADERS(stdarg.h stdlib.h string.h sys/select.h sys/utsname.h \ 2070 AC_CHECK_HEADERS(stdarg.h stdlib.h string.h sys/select.h sys/utsname.h \
2049 termcap.h fcntl.h sgtty.h sys/ioctl.h sys/time.h sys/types.h termio.h \ 2071 termcap.h fcntl.h sgtty.h sys/ioctl.h sys/time.h sys/types.h termio.h \
2050 iconv.h langinfo.h unistd.h stropts.h errno.h \ 2072 iconv.h langinfo.h math.h unistd.h stropts.h errno.h \
2051 sys/resource.h sys/systeminfo.h locale.h \ 2073 sys/resource.h sys/systeminfo.h locale.h \
2052 sys/stream.h sys/ptem.h termios.h libc.h sys/statfs.h \ 2074 sys/stream.h sys/ptem.h termios.h libc.h sys/statfs.h \
2053 poll.h sys/poll.h pwd.h utime.h sys/param.h libintl.h \ 2075 poll.h sys/poll.h pwd.h utime.h sys/param.h libintl.h \
2054 libgen.h util/debug.h util/msg18n.h frame.h \ 2076 libgen.h util/debug.h util/msg18n.h frame.h \
2055 sys/acl.h sys/access.h sys/sysctl.h sys/sysinfo.h wchar.h wctype.h) 2077 sys/acl.h sys/access.h sys/sysctl.h sys/sysinfo.h wchar.h wctype.h)
2116 <<(^|[^a-zA-Z_0-9])rlim_t[^a-zA-Z_0-9]>>dnl 2138 <<(^|[^a-zA-Z_0-9])rlim_t[^a-zA-Z_0-9]>>dnl
2117 changequote([,]), 2139 changequote([,]),
2118 [ 2140 [
2119 #include <sys/types.h> 2141 #include <sys/types.h>
2120 #if STDC_HEADERS 2142 #if STDC_HEADERS
2121 #include <stdlib.h> 2143 # include <stdlib.h>
2122 #include <stddef.h> 2144 # include <stddef.h>
2123 #endif 2145 #endif
2124 #ifdef HAVE_SYS_RESOURCE_H 2146 #ifdef HAVE_SYS_RESOURCE_H
2125 #include <sys/resource.h> 2147 # include <sys/resource.h>
2126 #endif 2148 #endif
2127 ], ac_cv_type_rlim_t=yes, ac_cv_type_rlim_t=no) 2149 ], ac_cv_type_rlim_t=yes, ac_cv_type_rlim_t=no)
2128 AC_MSG_RESULT($ac_cv_type_rlim_t) 2150 AC_MSG_RESULT($ac_cv_type_rlim_t)
2129 fi 2151 fi
2130 if test $ac_cv_type_rlim_t = no; then 2152 if test $ac_cv_type_rlim_t = no; then
2139 else 2161 else
2140 AC_EGREP_CPP(stack_t, 2162 AC_EGREP_CPP(stack_t,
2141 [ 2163 [
2142 #include <sys/types.h> 2164 #include <sys/types.h>
2143 #if STDC_HEADERS 2165 #if STDC_HEADERS
2144 #include <stdlib.h> 2166 # include <stdlib.h>
2145 #include <stddef.h> 2167 # include <stddef.h>
2146 #endif 2168 #endif
2147 #include <signal.h> 2169 #include <signal.h>
2148 ], ac_cv_type_stack_t=yes, ac_cv_type_stack_t=no) 2170 ], ac_cv_type_stack_t=yes, ac_cv_type_stack_t=no)
2149 AC_MSG_RESULT($ac_cv_type_stack_t) 2171 AC_MSG_RESULT($ac_cv_type_stack_t)
2150 fi 2172 fi
2157 dnl BSDI uses ss_base while others use ss_sp for the stack pointer. 2179 dnl BSDI uses ss_base while others use ss_sp for the stack pointer.
2158 AC_MSG_CHECKING(whether stack_t has an ss_base field) 2180 AC_MSG_CHECKING(whether stack_t has an ss_base field)
2159 AC_TRY_COMPILE([ 2181 AC_TRY_COMPILE([
2160 #include <sys/types.h> 2182 #include <sys/types.h>
2161 #if STDC_HEADERS 2183 #if STDC_HEADERS
2162 #include <stdlib.h> 2184 # include <stdlib.h>
2163 #include <stddef.h> 2185 # include <stddef.h>
2164 #endif 2186 #endif
2165 #include <signal.h> 2187 #include <signal.h>
2166 #include "confdefs.h" 2188 #include "confdefs.h"
2167 ], [stack_t sigstk; sigstk.ss_base = 0; ], 2189 ], [stack_t sigstk; sigstk.ss_base = 0; ],
2168 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SS_BASE), 2190 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SS_BASE),
2198 dnl compile and run a test program to be sure 2220 dnl compile and run a test program to be sure
2199 AC_TRY_RUN([ 2221 AC_TRY_RUN([
2200 #ifdef HAVE_TERMCAP_H 2222 #ifdef HAVE_TERMCAP_H
2201 # include <termcap.h> 2223 # include <termcap.h>
2202 #endif 2224 #endif
2225 #if STDC_HEADERS
2226 # include <stdlib.h>
2227 # include <stddef.h>
2228 #endif
2203 main() {char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(0); }], 2229 main() {char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(0); }],
2204 res="OK", res="FAIL", res="FAIL") 2230 res="OK", res="FAIL", res="FAIL")
2205 if test "$res" = "OK"; then 2231 if test "$res" = "OK"; then
2206 break 2232 break
2207 fi 2233 fi
2222 AC_MSG_ERROR([NOT FOUND! 2248 AC_MSG_ERROR([NOT FOUND!
2223 You need to install a terminal library; for example ncurses. 2249 You need to install a terminal library; for example ncurses.
2224 Or specify the name of the library with --with-tlib.])) 2250 Or specify the name of the library with --with-tlib.]))
2225 fi 2251 fi
2226 2252
2227 AC_MSG_CHECKING(whether we talk terminfo) 2253 AC_CACHE_CHECK([whether we talk terminfo], [vim_cv_terminfo],
2228 AC_TRY_RUN([ 2254 [
2255 AC_RUN_IFELSE([[
2256 #include "confdefs.h"
2229 #ifdef HAVE_TERMCAP_H 2257 #ifdef HAVE_TERMCAP_H
2230 # include <termcap.h> 2258 # include <termcap.h>
2231 #endif 2259 #endif
2260 #ifdef HAVE_STRING_H
2261 # include <string.h>
2262 #endif
2263 #if STDC_HEADERS
2264 # include <stdlib.h>
2265 # include <stddef.h>
2266 #endif
2232 main() 2267 main()
2233 {char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(!strcmp(s==0 ? "" : s, "1")); }], 2268 {char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(!strcmp(s==0 ? "" : s, "1")); }
2234 AC_MSG_RESULT([no -- we are in termcap land]), 2269 ]],[
2235 AC_MSG_RESULT([yes -- terminfo spoken here]); AC_DEFINE(TERMINFO), 2270 vim_cv_terminfo=no
2236 AC_MSG_ERROR(failed to compile test program.)) 2271 ],[
2272 vim_cv_terminfo=yes
2273 ],[
2274 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_terminfo')
2275 ])
2276 ])
2277
2278 if test "x$vim_cv_terminfo" = "xyes" ; then
2279 AC_DEFINE(TERMINFO)
2280 fi
2237 2281
2238 if test "x$olibs" != "x$LIBS"; then 2282 if test "x$olibs" != "x$LIBS"; then
2239 AC_MSG_CHECKING(what tgetent() returns for an unknown terminal) 2283 AC_CACHE_CHECK([what tgetent() returns for an unknown terminal], [vim_cv_tgent],
2240 AC_TRY_RUN([ 2284 [
2285 AC_RUN_IFELSE([[
2286 #include "confdefs.h"
2241 #ifdef HAVE_TERMCAP_H 2287 #ifdef HAVE_TERMCAP_H
2242 # include <termcap.h> 2288 # include <termcap.h>
2243 #endif 2289 #endif
2290 #if STDC_HEADERS
2291 # include <stdlib.h>
2292 # include <stddef.h>
2293 #endif
2244 main() 2294 main()
2245 {char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist"); exit(res != 0); }], 2295 {char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist"); exit(res != 0); }
2246 AC_MSG_RESULT(zero); AC_DEFINE(TGETENT_ZERO_ERR, 0), 2296 ]],[
2247 AC_MSG_RESULT(non-zero), 2297 vim_cv_tgent=zero
2248 AC_MSG_ERROR(failed to compile test program.)) 2298 ],[
2299 vim_cv_tgent=non-zero
2300 ],[
2301 AC_MSG_ERROR(failed to compile test program.)
2302 ])
2303 ])
2304
2305 if test "x$vim_cv_tgent" = "xzero" ; then
2306 AC_DEFINE(TGETENT_ZERO_ERR, 0)
2307 fi
2249 fi 2308 fi
2250 2309
2251 AC_MSG_CHECKING(whether termcap.h contains ospeed) 2310 AC_MSG_CHECKING(whether termcap.h contains ospeed)
2252 AC_TRY_LINK([ 2311 AC_TRY_LINK([
2253 #ifdef HAVE_TERMCAP_H 2312 #ifdef HAVE_TERMCAP_H
2353 fi 2412 fi
2354 2413
2355 dnl **** pty mode/group handling **** 2414 dnl **** pty mode/group handling ****
2356 dnl 2415 dnl
2357 dnl support provided by Luke Mewburn <lm@rmit.edu.au>, 931222 2416 dnl support provided by Luke Mewburn <lm@rmit.edu.au>, 931222
2358 AC_MSG_CHECKING(default tty permissions/group)
2359 rm -f conftest_grp 2417 rm -f conftest_grp
2360 AC_TRY_RUN([ 2418 AC_CACHE_CHECK([default tty permissions/group], [vim_cv_tty_group],
2419 [
2420 AC_RUN_IFELSE([[
2421 #include "confdefs.h"
2361 #include <sys/types.h> 2422 #include <sys/types.h>
2423 #if STDC_HEADERS
2424 # include <stdlib.h>
2425 # include <stddef.h>
2426 #endif
2427 #ifdef HAVE_UNISTD_H
2428 #include <unistd.h>
2429 #endif
2362 #include <sys/stat.h> 2430 #include <sys/stat.h>
2363 #include <stdio.h> 2431 #include <stdio.h>
2364 main() 2432 main()
2365 { 2433 {
2366 struct stat sb; 2434 struct stat sb;
2383 exit(1); 2451 exit(1);
2384 fprintf(fp, "%d\n", sb.st_gid); 2452 fprintf(fp, "%d\n", sb.st_gid);
2385 fclose(fp); 2453 fclose(fp);
2386 exit(0); 2454 exit(0);
2387 } 2455 }
2388 ],[ 2456 ]],[
2389 if test -f conftest_grp; then 2457 if test -f conftest_grp; then
2390 ptygrp=`cat conftest_grp` 2458 vim_cv_tty_group=`cat conftest_grp`
2391 AC_MSG_RESULT([pty mode: 0620, group: $ptygrp]) 2459 if test "x$vim_cv_tty_mode" = "x" ; then
2392 AC_DEFINE(PTYMODE, 0620) 2460 vim_cv_tty_mode=0620
2393 AC_DEFINE_UNQUOTED(PTYGROUP,$ptygrp) 2461 fi
2394 else 2462 AC_MSG_RESULT([pty mode: $vim_cv_tty_mode, group: $vim_cv_tty_group])
2463 else
2464 vim_cv_tty_group=world
2395 AC_MSG_RESULT([ptys are world accessable]) 2465 AC_MSG_RESULT([ptys are world accessable])
2396 fi 2466 fi
2397 ], 2467 ],[
2398 AC_MSG_RESULT([can't determine - assume ptys are world accessable]), 2468 vim_cv_tty_group=world
2399 AC_MSG_ERROR(failed to compile test program)) 2469 AC_MSG_RESULT([can't determine - assume ptys are world accessable])
2470 ],[
2471 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_tty_group' and 'vim_cv_tty_mode')
2472 ])
2473 ])
2400 rm -f conftest_grp 2474 rm -f conftest_grp
2475
2476 if test "x$vim_cv_tty_group" != "xworld" ; then
2477 AC_DEFINE_UNQUOTED(PTYGROUP,$vim_cv_tty_group)
2478 if test "x$vim_cv_tty_mode" = "x" ; then
2479 AC_MSG_ERROR([It seems you're cross compiling and have 'vim_cv_tty_group' set, please also set the environment variable 'vim_cv_tty_mode' to the correct mode (propably 0620)])
2480 else
2481 AC_DEFINE(PTYMODE, 0620)
2482 fi
2483 fi
2401 2484
2402 dnl Checks for library functions. =================================== 2485 dnl Checks for library functions. ===================================
2403 2486
2404 AC_TYPE_SIGNAL 2487 AC_TYPE_SIGNAL
2405 2488
2424 AC_DEFINE(HAVE_SIGCONTEXT), 2507 AC_DEFINE(HAVE_SIGCONTEXT),
2425 AC_MSG_RESULT(no)) 2508 AC_MSG_RESULT(no))
2426 2509
2427 dnl tricky stuff: try to find out if getcwd() is implemented with 2510 dnl tricky stuff: try to find out if getcwd() is implemented with
2428 dnl system("sh -c pwd") 2511 dnl system("sh -c pwd")
2429 AC_MSG_CHECKING(getcwd implementation) 2512 AC_CACHE_CHECK([getcwd implementation is broken], [vim_cv_getcwd_broken],
2430 AC_TRY_RUN([ 2513 [
2514 AC_RUN_IFELSE([[
2515 #include "confdefs.h"
2516 #ifdef HAVE_UNISTD_H
2517 #include <unistd.h>
2518 #endif
2431 char *dagger[] = { "IFS=pwd", 0 }; 2519 char *dagger[] = { "IFS=pwd", 0 };
2432 main() 2520 main()
2433 { 2521 {
2434 char buffer[500]; 2522 char buffer[500];
2435 extern char **environ; 2523 extern char **environ;
2436 environ = dagger; 2524 environ = dagger;
2437 return getcwd(buffer, 500) ? 0 : 1; 2525 return getcwd(buffer, 500) ? 0 : 1;
2438 }], 2526 }
2439 AC_MSG_RESULT(it is usable), 2527 ]],[
2440 AC_MSG_RESULT(it stinks) 2528 vim_cv_getcwd_broken=no
2441 AC_DEFINE(BAD_GETCWD), 2529 ],[
2442 AC_MSG_ERROR(failed to compile test program)) 2530 vim_cv_getcwd_broken=yes
2531 ],[
2532 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_getcwd_broken')
2533 ])
2534 ])
2535
2536 if test "x$vim_cv_getcwd_broken" = "xyes" ; then
2537 AC_DEFINE(BAD_GETCWD)
2538 fi
2443 2539
2444 dnl Check for functions in one big call, to reduce the size of configure 2540 dnl Check for functions in one big call, to reduce the size of configure
2445 AC_CHECK_FUNCS(bcmp fchdir fchown fseeko fsync ftello getcwd getpseudotty \ 2541 AC_CHECK_FUNCS(bcmp fchdir fchown fseeko fsync ftello getcwd getpseudotty \
2446 getpwnam getpwuid getrlimit gettimeofday getwd lstat memcmp \ 2542 getpwnam getpwuid getrlimit gettimeofday getwd lstat memcmp \
2447 memset nanosleep opendir putenv qsort readlink select setenv \ 2543 memset nanosleep opendir putenv qsort readlink select setenv \
2461 stat("/", &st); 2557 stat("/", &st);
2462 n = (int)st.st_blksize;], 2558 n = (int)st.st_blksize;],
2463 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ST_BLKSIZE), 2559 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ST_BLKSIZE),
2464 AC_MSG_RESULT(no)) 2560 AC_MSG_RESULT(no))
2465 2561
2466 AC_MSG_CHECKING(whether stat() ignores a trailing slash) 2562 AC_CACHE_CHECK([whether stat() ignores a trailing slash], [vim_cv_stat_ignores_slash],
2467 AC_TRY_RUN( 2563 [
2468 [#include <sys/types.h> 2564 AC_RUN_IFELSE([[
2565 #include "confdefs.h"
2566 #if STDC_HEADERS
2567 # include <stdlib.h>
2568 # include <stddef.h>
2569 #endif
2570 #include <sys/types.h>
2469 #include <sys/stat.h> 2571 #include <sys/stat.h>
2470 main() {struct stat st; exit(stat("configure/", &st) != 0); }], 2572 main() {struct stat st; exit(stat("configure/", &st) != 0); }
2471 AC_MSG_RESULT(yes); AC_DEFINE(STAT_IGNORES_SLASH), 2573 ]],[
2472 AC_MSG_RESULT(no), AC_MSG_ERROR(failed to compile test program)) 2574 vim_cv_stat_ignores_slash=yes
2473 2575 ],[
2576 vim_cv_stat_ignores_slash=no
2577 ],[
2578 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_stat_ignores_slash')
2579 ])
2580 ])
2581
2582 if test "x$vim_cv_stat_ignores_slash" = "xyes" ; then
2583 AC_DEFINE(STAT_IGNORES_SLASH)
2584 fi
2585
2474 dnl Link with iconv for charset translation, if not found without library. 2586 dnl Link with iconv for charset translation, if not found without library.
2475 dnl check for iconv() requires including iconv.h 2587 dnl check for iconv() requires including iconv.h
2476 dnl Add "-liconv" when possible; Solaris has iconv but use GNU iconv when it 2588 dnl Add "-liconv" when possible; Solaris has iconv but use GNU iconv when it
2477 dnl has been installed. 2589 dnl has been installed.
2478 AC_MSG_CHECKING(for iconv_open()) 2590 AC_MSG_CHECKING(for iconv_open())
2499 #ifdef HAVE_LANGINFO_H 2611 #ifdef HAVE_LANGINFO_H
2500 # include <langinfo.h> 2612 # include <langinfo.h>
2501 #endif 2613 #endif
2502 ], [char *cs = nl_langinfo(CODESET);], 2614 ], [char *cs = nl_langinfo(CODESET);],
2503 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_NL_LANGINFO_CODESET), 2615 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_NL_LANGINFO_CODESET),
2616 AC_MSG_RESULT(no))
2617
2618 dnl Need various functions for floating point support. Only enable
2619 dnl floating point when they are all present.
2620 AC_CHECK_LIB(m, strtod)
2621 AC_MSG_CHECKING([for strtod() and other floating point functions])
2622 AC_TRY_LINK([
2623 #ifdef HAVE_MATH_H
2624 # include <math.h>
2625 #endif
2626 #if STDC_HEADERS
2627 # include <stdlib.h>
2628 # include <stddef.h>
2629 #endif
2630 ], [char *s; double d;
2631 d = strtod("1.1", &s);
2632 d = fabs(1.11);
2633 d = ceil(1.11);
2634 d = floor(1.11);
2635 d = log10(1.11);
2636 d = pow(1.11, 2.22);
2637 d = sqrt(1.11);
2638 d = sin(1.11);
2639 d = cos(1.11);
2640 d = atan(1.11);
2641 ],
2642 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FLOAT_FUNCS),
2504 AC_MSG_RESULT(no)) 2643 AC_MSG_RESULT(no))
2505 2644
2506 dnl Link with -lposix1e for ACL stuff; if not found, try -lacl for SGI 2645 dnl Link with -lposix1e for ACL stuff; if not found, try -lacl for SGI
2507 dnl when -lacl works, also try to use -lattr (required for Debian). 2646 dnl when -lacl works, also try to use -lattr (required for Debian).
2508 AC_MSG_CHECKING(--disable-acl argument) 2647 AC_MSG_CHECKING(--disable-acl argument)
2536 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SOLARIS_ACL), 2675 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SOLARIS_ACL),
2537 AC_MSG_RESULT(no)) 2676 AC_MSG_RESULT(no))
2538 2677
2539 AC_MSG_CHECKING(for AIX ACL support) 2678 AC_MSG_CHECKING(for AIX ACL support)
2540 AC_TRY_LINK([ 2679 AC_TRY_LINK([
2680 #if STDC_HEADERS
2681 # include <stdlib.h>
2682 # include <stddef.h>
2683 #endif
2541 #ifdef HAVE_SYS_ACL_H 2684 #ifdef HAVE_SYS_ACL_H
2542 # include <sys/acl.h> 2685 # include <sys/acl.h>
2543 #endif 2686 #endif
2544 #ifdef HAVE_SYS_ACCESS_H 2687 #ifdef HAVE_SYS_ACCESS_H
2545 # include <sys/access.h> 2688 # include <sys/access.h>
2585 fi 2728 fi
2586 else 2729 else
2587 AC_MSG_RESULT(yes) 2730 AC_MSG_RESULT(yes)
2588 fi 2731 fi
2589 2732
2733 AC_MSG_CHECKING(--disable-sysmouse argument)
2734 AC_ARG_ENABLE(sysmouse,
2735 [ --disable-sysmouse Don't use sysmouse (mouse in *BSD console).], ,
2736 [enable_sysmouse="yes"])
2737
2738 if test "$enable_sysmouse" = "yes"; then
2739 AC_MSG_RESULT(no)
2740 dnl Checking if sysmouse support can be compiled
2741 dnl Configure defines HAVE_SYSMOUSE, if it is defined feature.h
2742 dnl defines FEAT_SYSMOUSE if mouse support is included
2743 AC_CACHE_CHECK([for sysmouse], vi_cv_have_sysmouse,
2744 AC_TRY_LINK(
2745 [#include <sys/consio.h>
2746 #include <signal.h>
2747 #include <sys/fbio.h>],
2748 [struct mouse_info mouse;
2749 mouse.operation = MOUSE_MODE;
2750 mouse.operation = MOUSE_SHOW;
2751 mouse.u.mode.mode = 0;
2752 mouse.u.mode.signal = SIGUSR2;],
2753 [vi_cv_have_sysmouse=yes],
2754 [vi_cv_have_sysmouse=no])
2755 )
2756 if test $vi_cv_have_sysmouse = yes; then
2757 AC_DEFINE(HAVE_SYSMOUSE)
2758 fi
2759 else
2760 AC_MSG_RESULT(yes)
2761 fi
2762
2590 dnl rename needs to be checked separately to work on Nextstep with cc 2763 dnl rename needs to be checked separately to work on Nextstep with cc
2591 AC_MSG_CHECKING(for rename) 2764 AC_MSG_CHECKING(for rename)
2592 AC_TRY_LINK([#include <stdio.h>], [rename("this", "that")], 2765 AC_TRY_LINK([#include <stdio.h>], [rename("this", "that")],
2593 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_RENAME), 2766 AC_MSG_RESULT(yes); AC_DEFINE(HAVE_RENAME),
2594 AC_MSG_RESULT(no)) 2767 AC_MSG_RESULT(no))
2647 dnl Our own version of AC_CHECK_SIZEOF(int); fixes a bug when sizeof() can't 2820 dnl Our own version of AC_CHECK_SIZEOF(int); fixes a bug when sizeof() can't
2648 dnl be printed with "%d", and avoids a warning for cross-compiling. 2821 dnl be printed with "%d", and avoids a warning for cross-compiling.
2649 2822
2650 AC_MSG_CHECKING(size of int) 2823 AC_MSG_CHECKING(size of int)
2651 AC_CACHE_VAL(ac_cv_sizeof_int, 2824 AC_CACHE_VAL(ac_cv_sizeof_int,
2652 [AC_TRY_RUN([#include <stdio.h> 2825 [AC_TRY_RUN([
2653 main() 2826 #include <stdio.h>
2654 { 2827 #if STDC_HEADERS
2655 FILE *f=fopen("conftestval", "w"); 2828 # include <stdlib.h>
2656 if (!f) exit(1); 2829 # include <stddef.h>
2657 fprintf(f, "%d\n", (int)sizeof(int)); 2830 #endif
2658 exit(0); 2831 main()
2659 }], 2832 {
2833 FILE *f=fopen("conftestval", "w");
2834 if (!f) exit(1);
2835 fprintf(f, "%d\n", (int)sizeof(int));
2836 exit(0);
2837 }],
2660 ac_cv_sizeof_int=`cat conftestval`, 2838 ac_cv_sizeof_int=`cat conftestval`,
2661 ac_cv_sizeof_int=0, 2839 ac_cv_sizeof_int=0,
2662 AC_MSG_ERROR(failed to compile test program))]) 2840 AC_MSG_ERROR(failed to compile test program))])
2663 AC_MSG_RESULT($ac_cv_sizeof_int) 2841 AC_MSG_RESULT($ac_cv_sizeof_int)
2664 AC_DEFINE_UNQUOTED(SIZEOF_INT, $ac_cv_sizeof_int) 2842 AC_DEFINE_UNQUOTED(SIZEOF_INT, $ac_cv_sizeof_int)
2665 2843
2666 AC_MSG_CHECKING(whether memmove/bcopy/memcpy handle overlaps) 2844
2845 dnl Check for memmove() before bcopy(), makes memmove() be used when both are
2846 dnl present, fixes problem with incompatibility between Solaris 2.4 and 2.5.
2847
2667 [bcopy_test_prog=' 2848 [bcopy_test_prog='
2849 #include "confdefs.h"
2850 #ifdef HAVE_STRING_H
2851 # include <string.h>
2852 #endif
2853 #if STDC_HEADERS
2854 # include <stdlib.h>
2855 # include <stddef.h>
2856 #endif
2668 main() { 2857 main() {
2669 char buf[10]; 2858 char buf[10];
2670 strcpy(buf, "abcdefghi"); 2859 strcpy(buf, "abcdefghi");
2671 mch_memmove(buf, buf + 2, 3); 2860 mch_memmove(buf, buf + 2, 3);
2672 if (strncmp(buf, "ababcf", 6)) 2861 if (strncmp(buf, "ababcf", 6))
2676 if (strncmp(buf, "cdedef", 6)) 2865 if (strncmp(buf, "cdedef", 6))
2677 exit(1); 2866 exit(1);
2678 exit(0); /* libc version works properly. */ 2867 exit(0); /* libc version works properly. */
2679 }'] 2868 }']
2680 2869
2681 dnl Check for memmove() before bcopy(), makes memmove() be used when both are 2870 AC_CACHE_CHECK([whether memmove handles overlaps],[vim_cv_memmove_handles_overlap],
2682 dnl present, fixes problem with incompatibility between Solaris 2.4 and 2.5. 2871 [
2683 2872 AC_RUN_IFELSE([[#define mch_memmove(s,d,l) memmove(d,s,l) $bcopy_test_prog]],
2684 AC_TRY_RUN([#define mch_memmove(s,d,l) memmove(d,s,l) $bcopy_test_prog], 2873 [
2685 AC_DEFINE(USEMEMMOVE) AC_MSG_RESULT(memmove does), 2874 vim_cv_memmove_handles_overlap=yes
2686 AC_TRY_RUN([#define mch_memmove(s,d,l) bcopy(d,s,l) $bcopy_test_prog], 2875 ],[
2687 AC_DEFINE(USEBCOPY) AC_MSG_RESULT(bcopy does), 2876 vim_cv_memmove_handles_overlap=no
2688 AC_TRY_RUN([#define mch_memmove(s,d,l) memcpy(d,s,l) $bcopy_test_prog], 2877 ],[
2689 AC_DEFINE(USEMEMCPY) AC_MSG_RESULT(memcpy does), AC_MSG_RESULT(no), 2878 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memmove_handles_overlap')
2690 AC_MSG_ERROR(failed to compile test program)), 2879 ])
2691 AC_MSG_ERROR(failed to compile test program)), 2880 ])
2692 AC_MSG_ERROR(failed to compile test program)) 2881
2882 if test "x$vim_cv_memmove_handles_overlap" = "xyes" ; then
2883 AC_DEFINE(USEMEMMOVE)
2884 else
2885 AC_CACHE_CHECK([whether bcopy handles overlaps],[vim_cv_bcopy_handles_overlap],
2886 [
2887 AC_RUN_IFELSE([[#define mch_bcopy(s,d,l) bcopy(d,s,l) $bcopy_test_prog]],
2888 [
2889 vim_cv_bcopy_handles_overlap=yes
2890 ],[
2891 vim_cv_bcopy_handles_overlap=no
2892 ],[
2893 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_bcopy_handles_overlap')
2894 ])
2895 ])
2896
2897 if test "x$vim_cv_bcopy_handles_overlap" = "xyes" ; then
2898 AC_DEFINE(USEBCOPY)
2899 else
2900 AC_CACHE_CHECK([whether memcpy handles overlaps],[vim_cv_memcpy_handles_overlap],
2901 [
2902 AC_RUN_IFELSE([[#define mch_memcpy(s,d,l) memcpy(d,s,l) $bcopy_test_prog]],
2903 [
2904 vim_cv_memcpy_handles_overlap=yes
2905 ],[
2906 vim_cv_memcpy_handles_overlap=no
2907 ],[
2908 AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memcpy_handles_overlap')
2909 ])
2910 ])
2911
2912 if test "x$vim_cv_memcpy_handles_overlap" = "xyes" ; then
2913 AC_DEFINE(USEMEMCPY)
2914 fi
2915 fi
2916 fi
2917
2693 2918
2694 dnl Check for multibyte locale functions 2919 dnl Check for multibyte locale functions
2695 dnl Find out if _Xsetlocale() is supported by libX11. 2920 dnl Find out if _Xsetlocale() is supported by libX11.
2696 dnl Check if X_LOCALE should be defined. 2921 dnl Check if X_LOCALE should be defined.
2697 2922