* INSTALL.android: Document how to build with libtiff.
* build-aux/ndk-build-helper-1.mk (NDK_SO_NAME):
* build-aux/ndk-build-helper-2.mk (NDK_A_NAME):
* build-aux/ndk-build-helper-4.mk: Decrease number of duplicate
dependencies found.
* configure.ac (ANDROID_SDK_18_OR_EARLIER, XCONFIGURE, PNG_CFLAGS)
(HAVE_TIFF): Allow using libtiff on Android.
* cross/ndk-build/ndk-clear-vars.mk: Undefine additional
variables.
* cross/ndk-build/ndk-resolve.mk: Split CFLAGS resolution from
a-name resolution, and do not recursively add archive or shared
object names for dependencies of shared libraries.
* src/Makefile.in (TIFF_CFLAGS): New variable.
(EMACS_CFLAGS): Use it.
gnutls, gmp - https://sourceforge.net/projects/android-ports-for-gnu-emacs
(Please see the section GNUTLS near the end of this file.)
+ libtiff - https://sourceforge.net/projects/android-ports-for-gnu-emacs
+ (Extract and point ``--with-ndk-path'' to tiff-4.5.0-emacs.tar.gz.)
We anticipate that most untested non-trivial ndk-build dependencies
will need adjustments in Emacs to work, as the Emacs build system
5.0 or later, so your mileage may vary, especially if you are trying
to build Emacs for another kind of machine.
-To build Emacs with GnuTLS, you must unpack each tar archive in that
-site, and add the resulting folder to ``--with-ndk-path''.
+To build Emacs with GnuTLS, you must unpack each of the following tar
+archives in that site:
+
+ gmp-6.2.1-emacs.tgz
+ gnutls-3.7.8-emacs.tar.gz
+ libtasn1-4.19.0-emacs.tar.gz
+ p11-kit-0.24.1-emacs.tar.gz
+ nettle-3.8-emacs.tar.gz
+
+and add the resulting folders to ``--with-ndk-path''.
\f
NDK_SO_NAME = lib$(1)_emacs.so
endif
-ifeq ($$(NDK_SO_NAMES:$$(NDK_SO_NAME)=),$$(NDK_SO_NAMES))
+ifeq ($$(findstring $$(NDK_SO_NAME),$$(NDK_SO_NAMES)),)
NDK_SO_NAMES := $$(NDK_SO_NAMES) $$(NDK_SO_NAME)
# Now recurse over this module's dependencies.
NDK_A_NAME = lib$(1).a
endif
-ifeq ($$(NDK_A_NAMES:$$(NDK_A_NAME)=),$$(NDK_A_NAMES))
+ifeq ($$(findstring $$(NDK_A_NAME),$$(NDK_A_NAMES)),)
NDK_A_NAMES := $$(NDK_A_NAMES) $$(NDK_A_NAME)
# Now recurse over this module's dependencies.
undefine LOCAL_EXPORT_CFLAGS
undefine LOCAL_EXPORT_CPPFLAGS
undefine LOCAL_EXPORT_C_INCLUDES
+undefine LOCAL_EXPORT_C_INCLUDE_DIRS
undefine LOCAL_EXPORT_LDFLAGS
undefine LOCAL_EXPORT_LDLIBS
passthrough="$passthrough --with-xml2=$with_xml2"
passthrough="$passthrough --with-sqlite3=$with_sqlite3"
passthrough="$passthrough --with-gnutls=$with_gnutls"
+ passthrough="$passthrough --with-tiff=$with_tiff"
AS_IF([XCONFIGURE=android ANDROID_CC="$ANDROID_CC" \
ANDROID_SDK="$android_sdk" android_abi=$android_abi \
# disabled, both within the recursive invocation of configure and
# outside.
with_xpm=no
- with_tiff=no
# Some of these dependencies are now supported within Android, so
# they can be enabled.
with_xml2=no
with_sqlite3=no
with_gnutls=no
+ with_tiff=no
fi
with_rsvg=no
### mingw32 doesn't use -ltiff, since it loads the library dynamically.
HAVE_TIFF=no
LIBTIFF=
+TIFF_CFLAGS=
if test "${opsys}" = "mingw32"; then
if test "${with_tiff}" != "no"; then
AC_CHECK_HEADER([tiffio.h], [HAVE_TIFF=yes], [HAVE_TIFF=no])
fi
elif test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes" \
|| test "${HAVE_NS}" = "yes" || test "${HAVE_BE_APP}" = "yes" \
- || test "$window_system" = "pgtk"; then
+ || test "$window_system" = "pgtk" \
+ || test "${REALLY_ANDROID}" = "yes"; then
if test "${with_tiff}" != "no"; then
- AC_CHECK_HEADER([tiffio.h],
- [tifflibs="-lz -lm"
- # At least one tiff package requires the jpeg library.
- if test "${HAVE_JPEG}" = yes; then tifflibs="-ljpeg $tifflibs"; fi
- AC_CHECK_LIB([tiff], [TIFFGetVersion], [HAVE_TIFF=yes], [],
- [$tifflibs])])
+ if test "${REALLY_ANDROID}" != "yes"; then
+ AC_CHECK_HEADER([tiffio.h],
+ [tifflibs="-lz -lm"
+ # At least one tiff package requires the jpeg library.
+ if test "${HAVE_JPEG}" = yes; then tifflibs="-ljpeg $tifflibs"; fi
+ AC_CHECK_LIB([tiff], [TIFFGetVersion], [HAVE_TIFF=yes], [],
+ [$tifflibs])])
+ else
+ ndk_SEARCH_MODULE([libtiff], [TIFF], [HAVE_TIFF=yes])
+
+ if test "$HAVE_TIFF" = "yes"; then
+ LIBTIFF="$TIFF_LIBS"
+ fi
+ fi
fi
if test "${HAVE_TIFF}" = "yes"; then
AC_DEFINE([HAVE_TIFF], [1],
[Define to 1 if you have the tiff library (-ltiff).])
- dnl FIXME -lz -lm, as per libpng?
- LIBTIFF=-ltiff
+
+ if test "$REALLY_ANDROID" != "yes"; then
+ dnl FIXME -lz -lm, as per libpng?
+ LIBTIFF=-ltiff
+ fi
fi
fi
AC_SUBST([LIBTIFF])
+AC_SUBST([TIFF_CFLAGS])
### Use -lgif or -lungif if available, unless '--with-gif=no'.
### mingw32 doesn't use -lgif/-lungif, since it loads the library dynamically.
undefine LOCAL_EXPORT_CFLAGS
undefine LOCAL_EXPORT_CPPFLAGS
undefine LOCAL_EXPORT_C_INCLUDES
+undefine LOCAL_EXPORT_C_INCLUDE_DIRS
undefine LOCAL_EXPORT_LDFLAGS
undefine LOCAL_EXPORT_LDLIBS
# List of all dependencies resolved for this module thus far.
# Used to avoid infinite recursion.
+# Separate the variable which lists modules for which CFLAGS
+# have been resolved from the variable which lists modules
+# for which library dependencies have been resolved, in order
+# to catch the case where a library dependency is skipped
+# despite its CFLAGS being added.
NDK_RESOLVED_$(LOCAL_MODULE) :=
+NDK_RESOLVED_CFLAGS_$(LOCAL_MODULE) :=
define ndk-resolve
-ifeq ($(patsubst $(1),,$(NDK_RESOLVED$(LOCAL_MODULE))),$(NDK_RESOLVED$(LOCAL_MODULE)))
-NDK_RESOLVED_$(LOCAL_MODULE) += $(1)
+ifeq ($$(filter $(1)$(and $(3),whole),$$(NDK_RESOLVED_CFLAGS_$(LOCAL_MODULE))),)
+# Always mark this module's cflags as having been resolved, even if
+# this is a whole library.
+NDK_RESOLVED_CFLAGS_$(LOCAL_MODULE) += $(1)
+
NDK_CFLAGS_$(LOCAL_MODULE) += $(NDK_LOCAL_EXPORT_CFLAGS_$(1))
NDK_CFLAGS_$(LOCAL_MODULE) += $(addprefix -I,$(NDK_LOCAL_EXPORT_C_INCLUDES_$(1)))
+endif
+
+ifeq ($$(filter $(1)$(and $(3),whole),$$(NDK_RESOLVED_$(LOCAL_MODULE))),)
+# Now append local libraries, as long as this library isn't a shared
+# library itself.
+ifeq ($(4),)
+
+# Mark this module's library dependencies as having been resolved.
+NDK_RESOLVED_$(LOCAL_MODULE) += $(1)
+
+# If this is a whole library, then mark this as resolved too, and
+# remove the library from the normal static library list.
+ifneq ($(3),)
+NDK_RESOLVED_$(LOCAL_MODULE) += $(1)whole
+endif
# If the module happens to be zlib, then add -lz to the shared library
# flags.
else
NDK_WHOLE_A_NAMES_$(LOCAL_MODULE) += lib$(1).a
endif
+
+# Remove this archive from the regular archive list, should it already
+# exists. Any given archive should only appear once, and if an
+# archive has been specified as whole it should always be whole.
+NDK_LOCAL_A_NAMES_$(LOCAL_MODULE) := $$(filter-out lib$(1).a,$$(NDK_LOCAL_A_NAMES_$(LOCAL_MODULE)))
+NDK_LOCAL_A_NAMES_$(LOCAL_MODULE) := $$(filter-out $(1).a,$$(NDK_LOCAL_A_NAMES_$(LOCAL_MODULE)))
+endif
endif
-$$(foreach module,$$(NDK_LOCAL_STATIC_LIBRARIES_$(1)),$$(eval $$(call ndk-resolve,$$(module),1,)))
-$$(foreach module,$$(NDK_LOCAL_SHARED_LIBRARIES_$(1)),$$(eval $$(call ndk-resolve,$$(module),,)))
-$$(foreach module,$$(NDK_LOCAL_WHOLE_LIBRARIES_$(1)),$$(eval $$(call ndk-resolve,$$(module),,1)))
+$$(foreach module,$$(NDK_LOCAL_STATIC_LIBRARIES_$(1)),$$(eval $$(call ndk-resolve,$$(module),1,,$(or $(4),$(if $(2)$(3),,1)))))
+$$(foreach module,$$(NDK_LOCAL_SHARED_LIBRARIES_$(1)),$$(eval $$(call ndk-resolve,$$(module),,,$(or $(4),$(if $(2)$(3),,1)))))
+$$(foreach module,$$(NDK_LOCAL_WHOLE_LIBRARIES_$(1)),$$(eval $$(call ndk-resolve,$$(module),,1,$(or $(4),$(if $(2)$(3),,1)))))
endif
endef
-$(foreach module,$(LOCAL_SHARED_LIBRARIES),$(eval $(call ndk-resolve,$(module),,)))
-$(foreach module,$(LOCAL_STATIC_LIBRARIES),$(eval $(call ndk-resolve,$(module),1,)))
-$(foreach module,$(LOCAL_WHOLE_STATIC_LIBRARIES), $(eval $(call ndk-resolve,$(module),,1)))
+# Add shared libraries to the shared object names when they appear as
+# a top level dependency. However, do not recursively add the names
+# of this module's shared library dependencies, if it is just a shared
+# library, since it will link to those shared libraries itself.
+$(foreach module,$(LOCAL_SHARED_LIBRARIES),$(eval $(call ndk-resolve,$(module),,,)))
+$(foreach module,$(LOCAL_STATIC_LIBRARIES),$(eval $(call ndk-resolve,$(module),1,,)))
+$(foreach module,$(LOCAL_WHOLE_STATIC_LIBRARIES), $(eval $(call ndk-resolve,$(module),,1,)))
GIF_CFLAGS=@GIF_CFLAGS@
JPEG_CFLAGS=@JPEG_CFLAGS@
+TIFF_CFLAGS=@TIFF_CFLAGS@
XCB_LIBS=@XCB_LIBS@
XFT_LIBS=@XFT_LIBS@
$(LIBGNUTLS_CFLAGS) $(NOTIFY_CFLAGS) $(CAIRO_CFLAGS) \
$(WERROR_CFLAGS) $(HAIKU_CFLAGS) $(XCOMPOSITE_CFLAGS) $(XSHAPE_CFLAGS) \
$(ANDROID_CFLAGS) $(GIF_CFLAGS) $(JPEG_CFLAGS) $(SQLITE3_CFLAGS) \
- $(LIBGMP_CFLAGS)
+ $(LIBGMP_CFLAGS) $(TIFF_CFLAGS)
ALL_CFLAGS = $(EMACS_CFLAGS) $(WARN_CFLAGS) $(CFLAGS)
ALL_OBJC_CFLAGS = $(EMACS_CFLAGS) \
$(filter-out $(NON_OBJC_CFLAGS),$(WARN_CFLAGS)) $(CFLAGS) \