diff src/configure.ac @ 12716:351cf7c67bbe v8.0.1236

patch 8.0.1236: Mac features are confusing commit https://github.com/vim/vim/commit/d057301b1f28736f094affa17b190244ad56e8d9 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Oct 28 21:11:06 2017 +0200 patch 8.0.1236: Mac features are confusing Problem: Mac features are confusing. Solution: Make feature names more consistent, add "osxdarwin". Rename feature flags, cleanup Mac code. (Kazunobu Kuriyama, closes #2178)
author Christian Brabandt <cb@256bit.org>
date Sat, 28 Oct 2017 21:15:35 +0200
parents baf88919c791
children f473855aa9a9
line wrap: on
line diff
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -134,6 +134,8 @@ dnl are a lot of other things we need to
 AC_MSG_CHECKING([for Darwin (Mac OS X)])
 if test "`(uname) 2>/dev/null`" = Darwin; then
   AC_MSG_RESULT(yes)
+  MACOS_X=yes
+  CPPFLAGS="$CPPFLAGS -DMACOS_X"
 
   AC_MSG_CHECKING(--disable-darwin argument)
   AC_ARG_ENABLE(darwin,
@@ -208,12 +210,12 @@ if test "`(uname) 2>/dev/null`" = Darwin
   fi
 
   if test "$enable_darwin" = "yes"; then
-    MACOSX=yes
+    MACOS_X_DARWIN=yes
     OS_EXTRA_SRC="os_macosx.m os_mac_conv.c";
     OS_EXTRA_OBJ="objects/os_macosx.o objects/os_mac_conv.o"
     dnl TODO: use -arch i386 on Intel machines
     dnl Removed -no-cpp-precomp, only for very old compilers.
-    CPPFLAGS="$CPPFLAGS -DMACOS_X_UNIX"
+    CPPFLAGS="$CPPFLAGS -DMACOS_X_DARWIN"
 
     dnl If Carbon is found, assume we don't want X11
     dnl unless it was specifically asked for (--with-x)
@@ -626,7 +628,7 @@ if test "$enable_luainterp" = "yes" -o "
       if test -f "${vi_cv_path_lua_pfx}/bin/cyglua-${vi_cv_version_lua}.dll"; then
 	vi_cv_dll_name_lua="cyglua-${vi_cv_version_lua}.dll"
       else
-	if test "x$MACOSX" = "xyes"; then
+	if test "x$MACOS_X" = "xyes"; then
 	  ext="dylib"
 	  indexes=""
 	else
@@ -670,7 +672,7 @@ if test "$enable_luainterp" = "yes" -o "
       LUA_CFLAGS="-DDYNAMIC_LUA_DLL=\\\"${vi_cv_dll_name_lua}\\\" $LUA_CFLAGS"
     fi
     if test "X$LUA_CFLAGS$LUA_LIBS" != "X" && \
-       test "x$MACOSX" = "xyes" && test "x$vi_cv_with_luajit" != "xno" && \
+       test "x$MACOS_X" = "xyes" && test "x$vi_cv_with_luajit" != "xno" && \
        test "`(uname -m) 2>/dev/null`" = "x86_64"; then
       dnl OSX/x64 requires these flags. See http://luajit.org/install.html
       LUA_LIBS="-pagezero_size 10000 -image_base 100000000 $LUA_LIBS"
@@ -802,7 +804,7 @@ if test "$enable_mzschemeinterp" = "yes"
 
     for path in "${vi_cv_path_mzscheme_pfx}/lib" "${SCHEME_LIB}"; do
       if test "X$path" != "X"; then
-	if test "x$MACOSX" = "xyes"; then
+	if test "x$MACOS_X" = "xyes"; then
 	  MZSCHEME_LIBS="-framework Racket"
 	  MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
 	elif test -f "${path}/libmzscheme3m.a"; then
@@ -1059,7 +1061,7 @@ if test "$enable_perlinterp" = "yes" -o 
     fi
   fi
 
-  if test "x$MACOSX" = "xyes"; then
+  if test "x$MACOS_X" = "xyes"; then
     dnl Mac OS X 10.2 or later
     dir=/System/Library/Perl
     darwindir=$dir/darwin
@@ -1201,7 +1203,7 @@ eof
 	    dnl -- delete the lines from make about Entering/Leaving directory
 	    eval "`cd ${PYTHON_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`"
 	    rm -f -- "${tmp_mkf}"
-	    if test "x$MACOSX" = "xyes" && test -n "${python_PYTHONFRAMEWORK}" && ${vi_cv_path_python} -c \
+	    if test "x$MACOS_X" = "xyes" && test -n "${python_PYTHONFRAMEWORK}" && ${vi_cv_path_python} -c \
 		"import sys; sys.exit(${vi_cv_var_python_version} < 2.3)"; then
 	      vi_cv_path_python_plibs="-framework Python"
 	      if test "x${vi_cv_path_python}" != "x/usr/bin/python" && test -n "${python_PYTHONFRAMEWORKPREFIX}"; then
@@ -1269,7 +1271,7 @@ eof
 	AC_MSG_CHECKING([if -pthread should be used])
 	threadsafe_flag=
 	thread_lib=
-	dnl if test "x$MACOSX" != "xyes"; then
+	dnl if test "x$MACOS_X" != "xyes"; then
         if test "`(uname) 2>/dev/null`" != Darwin; then
 	  test "$GCC" = yes && threadsafe_flag="-pthread"
 	  if test "`(uname) 2>/dev/null`" = FreeBSD; then
@@ -1474,7 +1476,7 @@ eof
         AC_MSG_CHECKING([if -pthread should be used])
         threadsafe_flag=
         thread_lib=
-        dnl if test "x$MACOSX" != "xyes"; then
+        dnl if test "x$MACOS_X" != "xyes"; then
         if test "`(uname) 2>/dev/null`" != Darwin; then
           test "$GCC" = yes && threadsafe_flag="-pthread"
           if test "`(uname) 2>/dev/null`" = FreeBSD; then
@@ -1729,7 +1731,7 @@ if test "$enable_tclinterp" = "yes" -o "
       tcldll=`echo 'puts libtcl[[info tclversion]][[info sharedlibextension]]' | $vi_cv_path_tcl -`
 
       AC_MSG_CHECKING(for location of Tcl include)
-      if test "x$MACOSX" != "xyes"; then
+      if test "x$MACOS_X" != "xyes"; then
 	tclinc="$tclloc/include $tclloc/include/tcl $tclloc/include/tcl$tclver /usr/local/include /usr/local/include/tcl$tclver /usr/include /usr/include/tcl$tclver"
       else
 	dnl For Mac OS X 10.3, use the OS-provided framework location
@@ -1749,7 +1751,7 @@ if test "$enable_tclinterp" = "yes" -o "
       fi
       if test -z "$SKIP_TCL"; then
 	AC_MSG_CHECKING(for location of tclConfig.sh script)
-	if test "x$MACOSX" != "xyes"; then
+	if test "x$MACOS_X" != "xyes"; then
 	  tclcnf=`echo $tclinc | sed s/include/lib/g`
 	  tclcnf="$tclcnf `echo $tclinc | sed s/include/lib64/g`"
 	else
@@ -2093,7 +2095,7 @@ AC_MSG_RESULT($enable_fontset)
 dnl defining FEAT_XFONTSET is delayed, so that it can be disabled for no GUI
 
 test -z "$with_x" && with_x=yes
-test "${enable_gui-yes}" != no -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && with_x=yes
+test "${enable_gui-yes}" != no -a "x$MACOS_X" != "xyes" -a "x$QNX" != "xyes" && with_x=yes
 if test "$with_x" = no; then
   AC_MSG_RESULT(defaulting to: don't HAVE_X11)
 else
@@ -2224,7 +2226,7 @@ else
   fi
 fi
 
-test "x$with_x" = xno -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && enable_gui=no
+test "x$with_x" = xno -a "x$MACOS_X" != "xyes" -a "x$QNX" != "xyes" && enable_gui=no
 
 AC_MSG_CHECKING(--enable-gui argument)
 AC_ARG_ENABLE(gui,
@@ -2258,7 +2260,7 @@ if test "x$QNX" = "xyes" -a "x$with_x" =
 		SKIP_PHOTON=YES ;;
   esac
 
-elif test "x$MACOSX" = "xyes" -a "x$with_x" = "xno" ; then
+elif test "x$MACOS_X" = "xyes" -a "x$with_x" = "xno" ; then
   SKIP_CARBON=
   case "$enable_gui_canon" in
     no)		AC_MSG_RESULT(no GUI support)
@@ -2380,7 +2382,7 @@ if test "x$SKIP_CARBON" != "xYES" -a "$e
 fi
 
 
-if test "x$MACOSX" = "xyes" -a -z "$SKIP_CARBON" -a "x$CARBON" = "xyes"; then
+if test "x$MACOS_X" = "xyes" -a -z "$SKIP_CARBON" -a "x$CARBON" = "xyes"; then
   AC_MSG_CHECKING(for Carbon GUI)
   dnl already did the check, just give the message
   AC_MSG_RESULT(yes);
@@ -3188,7 +3190,7 @@ AC_TRY_COMPILE([
 	      AC_MSG_RESULT(no))
 
 AC_CHECK_HEADERS(strings.h)
-if test "x$MACOSX" = "xyes"; then
+if test "x$MACOS_X" = "xyes"; then
   dnl The strings.h file on OS/X contains a warning and nothing useful.
   AC_DEFINE(NO_STRINGS_WITH_STRING_H)
 else
@@ -3650,7 +3652,7 @@ AC_CHECK_FUNCS(fchdir fchown fsync getcw
 	getpgid setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \
 	sigprocmask sigvec strcasecmp strerror strftime stricmp strncasecmp \
 	strnicmp strpbrk strtol tgetent towlower towupper iswupper \
-	usleep utime utimes)
+	usleep utime utimes mblen)
 AC_FUNC_FSEEKO
 
 dnl define _LARGE_FILES, _FILE_OFFSET_BITS and _LARGEFILE_SOURCE when
@@ -4277,7 +4279,7 @@ elif test x${DLL} = xdl.h; then
 fi
 AC_CHECK_HEADERS(setjmp.h)
 
-if test "x$MACOSX" = "xyes" -a -n "$PERL"; then
+if test "x$MACOS_X" = "xyes" -a -n "$PERL"; then
   dnl -ldl must come after DynaLoader.a
   if echo $LIBS | grep -e '-ldl' >/dev/null; then
     LIBS=`echo $LIBS | sed s/-ldl//`
@@ -4285,22 +4287,40 @@ if test "x$MACOSX" = "xyes" -a -n "$PERL
   fi
 fi
 
-if test "x$MACOSX" = "xyes"; then
-  AC_MSG_CHECKING(whether we need -framework Cocoa)
-  dnl Cocoa is needed with FEAT_CLIPBOARD or FEAT_MBYTE (the former is
-  dnl disabled during tiny build)
-  if test "x$features" != "xtiny" || test "x$enable_multibyte" = "xyes"; then
-    LIBS=$"$LIBS -framework Cocoa"
-    AC_MSG_RESULT(yes)
+if test "$MACOS_X" = "yes"; then
+  AC_MSG_CHECKING([whether we need macOS frameworks])
+  if test "$GUITYPE" = "CARBONGUI"; then
+    AC_MSG_RESULT([yes, we need Carbon])
+    LIBS="$LIBS -framework Carbon"
+  elif test "$MACOS_X_DARWIN" = "yes"; then
+    if test "$features" = "tiny"; then
+      dnl Since no FEAT_CLIPBOARD, no longer need for os_macosx.m.
+      OS_EXTRA_SRC=`echo "$OS_EXTRA_SRC" | sed -e 's+os_macosx.m++'`
+      OS_EXTRA_OBJ=`echo "$OS_EXTRA_OBJ" | sed -e 's+objects/os_macosx.o++'`
+      if test "$enable_multibyte" = "yes"; then
+        AC_MSG_RESULT([yes, we need CoreServices])
+        LIBS="$LIBS -framework CoreServices"
+      else
+        dnl Since no FEAT_MBYTE, no longer need for os_mac_conv.c.
+        AC_MSG_RESULT([no])
+        OS_EXTRA_SRC=`echo "$OS_EXTRA_SRC" | sed -e 's+os_mac_conv.c++'`
+        OS_EXTRA_OBJ=`echo "$OS_EXTRA_OBJ" | sed -e 's+objects/os_mac_conv.o++'`
+        CPPFLAGS=`echo "$CPPFLAGS" | sed -e 's+-DMACOS_X_DARWIN++'`
+      fi
+    else
+      AC_MSG_RESULT([yes, we need AppKit])
+      LIBS="$LIBS -framework AppKit"
+      if test "$features" = "small" -a "$enable_multibyte" = "no"; then
+        dnl Since FEAT_CLIPBOARD is to be defined in vim.h for FEAT_SMALL, define
+        dnl FEAT_MBYTE in order not to compromise the interoperability of the
+        dnl clipboard.
+        AC_MSG_NOTICE([+multi_byte will be set in favor of +clipboard])
+        enable_multibyte=yes
+        AC_DEFINE(FEAT_MBYTE)
+      fi
+    fi
   else
-    AC_MSG_RESULT(no)
-  fi
-  dnl As mentioned above, tiny build implies os_macosx.m isn't needed.  
-  dnl Exclude it from OS_EXTRA_SRC so that linker won't complain about
-  dnl missing Objective-C symbols.
-  if test "x$features" = "xtiny"; then
-    OS_EXTRA_SRC=`echo "$OS_EXTRA_SRC" | sed -e 's+os_macosx.m++'`
-    OS_EXTRA_OBJ=`echo "$OS_EXTRA_OBJ" | sed -e 's+objects/os_macosx.o++'`
+    AC_MSG_RESULT([no])
   fi
 fi
 if test "x$MACARCH" = "xboth" && test "x$GUITYPE" = "xCARBONGUI"; then