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