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