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