Imported Upstream version 2.10.4
[platform/upstream/freetype2.git] / builds / unix / configure.raw
index ef6debe..bc65e45 100644 (file)
@@ -2,7 +2,7 @@
 #
 # Process this file with autoconf to produce a configure script.
 #
-# Copyright 2001-2017 by
+# Copyright (C) 2001-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
 # fully.
 
 AC_INIT([FreeType], [@VERSION@], [freetype@nongnu.org], [freetype])
-AC_CONFIG_SRCDIR([ftconfig.in])
+AC_CONFIG_SRCDIR([ftconfig.h.in])
 
 
 # Don't forget to update `docs/VERSIONS.TXT'!
 
-version_info='20:0:14'
+version_info='23:4:17'
 AC_SUBST([version_info])
 ft_version=`echo $version_info | tr : .`
 AC_SUBST([ft_version])
@@ -37,6 +37,7 @@ AC_SUBST(EXEEXT)
 PKG_PROG_PKG_CONFIG([0.24])
 
 LT_INIT(win32-dll)
+AC_CHECK_HEADER([windows.h], [LT_PROG_RC])
 
 
 # checks for native programs to generate building tool
@@ -108,27 +109,25 @@ AC_CHECK_SIZEOF([long])
 AC_TYPE_LONG_LONG_INT
 
 
-# check whether cpp computation of size of int and long in ftconfig.in works
+# check whether cpp computation of size of int and long in ftconfig.h.in works
 
-AC_MSG_CHECKING([whether cpp computation of bit length in ftconfig.in works])
+AC_MSG_CHECKING([whether cpp computation of bit length in ftconfig.h.in works])
 orig_CPPFLAGS="${CPPFLAGS}"
-CPPFLAGS="-I${srcdir} -I. ${CPPFLAGS}"
+CPPFLAGS="-I${srcdir} -I. -I${srcdir}/../../include ${CPPFLAGS}"
 
 ac_clean_files=
-for f in ft2build.h ftoption.h ftstdlib.h; do
-  if test ! -f $f; then
-    ac_clean_files="$ac_clean_files $f"
-    touch $f
-  fi
-done
+if test ! -f ft2build.h; then
+  ac_clean_files=ft2build.h
+  touch ft2build.h
+fi
 
 cat > conftest.c <<\_ACEOF
 #include <limits.h>
-#define FT_CONFIG_OPTIONS_H "ftoption.h"
-#define FT_CONFIG_STANDARD_LIBRARY_H "ftstdlib.h"
+#define FT_CONFIG_OPTIONS_H <freetype/config/ftoption.h>
+#define FT_CONFIG_STANDARD_LIBRARY_H <freetype/config/ftstdlib.h>
 #define FT_UINT_MAX  UINT_MAX
 #define FT_ULONG_MAX ULONG_MAX
-#include "ftconfig.in"
+#include "ftconfig.h.in"
 _ACEOF
 echo >> conftest.c "#if FT_SIZEOF_INT == "${ac_cv_sizeof_int}
 echo >> conftest.c "ac_cpp_ft_sizeof_int="${ac_cv_sizeof_int}
@@ -178,6 +177,15 @@ fi
 
 CPPFLAGS="${orig_CPPFLAGS}"
 
+AC_ARG_ENABLE([freetype-config],
+  AS_HELP_STRING([--enable-freetype-config], [install freetype-config]),
+  [case "${enableval}" in
+    yes) enable_freetype_config="TRUE" ;;
+    no)  enable_freetype_config="FALSE" ;;
+    *)   AC_MSG_ERROR([unknown value '${enableval}' passed with --enable-freetype-config]) ;;
+   esac], [enable_freetype_config="FALSE"])
+
+AC_SUBST(INSTALL_FT2_CONFIG, [$enable_freetype_config])
 
 # checks for library functions
 
@@ -188,7 +196,7 @@ AC_SYS_LARGEFILE
 AC_ARG_ENABLE([mmap],
   AS_HELP_STRING([--disable-mmap],
                  [do not check mmap() and do not use]),
-  [enable_mmap="no"],[enable_mmap="yes"])
+  [enable_mmap="no"], [enable_mmap="yes"])
 if test "x${enable_mmap}" != "xno"; then
   AC_FUNC_MMAP
 fi
@@ -275,7 +283,7 @@ if test "x$GCC" = xyes; then
             }
 
           ])],
-        [AC_MSG_RESULT([ok, add it to XX_ANSIFLAGS])
+        [AC_MSG_RESULT([ok, adding to XX_ANSIFLAGS])
          XX_ANSIFLAGS="${XX_ANSIFLAGS} ${a}"
         ],
         [AC_MSG_RESULT([no])])
@@ -300,6 +308,30 @@ AC_SUBST([XX_CFLAGS])
 AC_SUBST([XX_ANSIFLAGS])
 
 
+# It is recommended that shared libraries hide symbols except those with
+# explicit __attribute__((visibility("default"))).
+#
+found_visibility_flag=no
+AC_MSG_CHECKING([for -fvisibility=hidden compiler flag])
+orig_CFLAGS="${CFLAGS}"
+CFLAGS="${CFLAGS} -fvisibility=hidden"
+AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
+               [found_visibility_flag=yes
+                AC_MSG_RESULT(yes)],
+               [CFLAGS="${orig_CFLAGS}"
+                AC_MSG_RESULT(no)])
+
+if test "${found_visibility_flag}" = "no"; then
+  AC_MSG_CHECKING([for -xldscope=hidden compiler flag])
+  orig_CFLAGS="${CFLAGS}"
+  CFLAGS="${CFLAGS} -xldscope=hidden"
+  AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
+                 [found_visibility_flag=yes
+                  AC_MSG_RESULT(yes)],
+                 [CFLAGS="${orig_CFLAGS}"
+                  AC_MSG_RESULT(no)])
+fi
+
 # All library tests below try `pkg-config' first.  If that fails, a function
 # from the library is tested in the traditional autoconf way (zlib, bzip2),
 # or a config script is called (libpng).
@@ -446,7 +478,7 @@ if test x"$with_png" = xyes -o x"$with_png" = xauto; then
       libpng_libsstaticconf="$LIBPNG_LIBS"
       have_libpng="yes (LIBPNG_CFLAGS and LIBPNG_LIBS)"
     else
-      # fall back to config script.
+      # fall back to config script
       AC_MSG_CHECKING([for libpng-config])
       if which libpng-config > /dev/null 2>&1; then
         LIBPNG_CFLAGS=`libpng-config --cflags`
@@ -476,7 +508,7 @@ AC_ARG_WITH([harfbuzz],
 
 have_harfbuzz=no
 if test x"$with_harfbuzz" = xyes -o x"$with_harfbuzz" = xauto; then
-  harfbuzz_pkg="harfbuzz >= 0.9.21"
+  harfbuzz_pkg="harfbuzz >= 1.8.0"
   have_harfbuzz_pkg=no
 
   if test x"$HARFBUZZ_CFLAGS" = x -a x"$HARFBUZZ_LIBS" = x; then
@@ -511,6 +543,65 @@ if test x"$with_harfbuzz" = xyes -a "$have_harfbuzz" = no; then
 fi
 
 
+# check for system libbrotlidec
+
+AC_ARG_WITH([brotli],
+  [AS_HELP_STRING([--with-brotli=@<:@yes|no|auto@:>@],
+                  [support decompression of WOFF2 streams @<:@default=auto@:>@])],
+  [], [with_brotli=auto])
+
+have_brotli=no
+if test x"$with_brotli" = xyes -o x"$with_brotli" = xauto; then
+  brotli_pkg="libbrotlidec"
+  have_brotli_pkg=no
+
+  if test x"$BROTLI_CFLAGS" = x -a x"$BROTLI_LIBS" = x; then
+    PKG_CHECK_EXISTS([$brotli_pkg], [have_brotli_pkg=yes])
+  fi
+  PKG_CHECK_MODULES([BROTLI], [$brotli_pkg],
+                    [have_brotli="yes (pkg-config)"], [:])
+
+  if test $have_brotli_pkg = yes; then
+    # we have libbrotlidec.pc
+    brotli_reqpriv="$brotli_pkg"
+    brotli_libspriv=
+    brotli_libsstaticconf=`$PKG_CONFIG --static --libs "$brotli_pkg"`
+  else
+    brotli_reqpriv=
+
+    if test "$have_brotli" != no; then
+      # BROTLI_CFLAGS and BROTLI_LIBS are set by the user
+      brotli_libspriv="$BROTLI_LIBS"
+      brotli_libsstaticconf="$BROTLI_LIBS"
+      have_brotli="yes (BROTLI_CFLAGS and BROTLI_LIBS)"
+    else
+      # since Brotli is quite a new library we don't fall back to a
+      # different test
+      :
+    fi
+  fi
+fi
+
+if test x"$with_brotli" = xyes -a "$have_brotli" = no; then
+  AC_MSG_ERROR([brotli support requested but library not found])
+fi
+
+
+# check for librt
+#
+# We need `clock_gettime' for the `ftbench' demo program.
+#
+# The code is modeled after gnulib's file `clock_time.m4', ignoring
+# very old Solaris systems.
+
+LIB_CLOCK_GETTIME=
+AC_SEARCH_LIBS([clock_gettime],
+               [rt],
+               [test "$ac_cv_search_clock_gettime" = "none required" \
+                || LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime])
+AC_SUBST([LIB_CLOCK_GETTIME])
+
+
 # Some options handling SDKs/archs in CFLAGS should be copied
 # to LDFLAGS. Apple TechNote 2137 recommends to include these
 # options in CFLAGS but not in LDFLAGS.
@@ -921,12 +1012,36 @@ case "$CFLAGS" in
     ;;
 esac
 
+# Check for Python and docwriter
+
+have_py3=no
+have_docwriter=no
+PIP=pip
 
-# entries in Requires.private are separated by commas;
+AC_CHECK_PROGS([PYTHON], [python3 python], [missing])
+if test "x$PYTHON" != "xmissing"; then
+  AX_PROG_PYTHON_VERSION([3.5], [have_py3=yes], [])
+
+  if test "x$have_py3" = "xyes"; then
+    PIP="$PYTHON -m $PIP"
+    AC_MSG_CHECKING([for \`docwriter' Python module])
+    $PYTHON -m docwriter -h > /dev/null 2>&1
+    if test "x$?" = "x0"; then
+      have_docwriter=yes
+      AC_MSG_RESULT([yes])
+    else
+      AC_MSG_RESULT([no])
+    fi
+  fi
+fi
+
+
+# entries in Requires.private are separated by commas
 REQUIRES_PRIVATE="$zlib_reqpriv,     \
                   $bzip2_reqpriv,    \
                   $libpng_reqpriv,   \
-                  $harfbuzz_reqpriv"
+                  $harfbuzz_reqpriv, \
+                  $brotli_reqpriv"
 # beautify
 REQUIRES_PRIVATE=`echo "$REQUIRES_PRIVATE" \
                   | sed -e 's/^  *//'      \
@@ -941,6 +1056,7 @@ LIBS_PRIVATE="$zlib_libspriv     \
               $bzip2_libspriv    \
               $libpng_libspriv   \
               $harfbuzz_libspriv \
+              $brotli_libspriv   \
               $ft2_extra_libs"
 # beautify
 LIBS_PRIVATE=`echo "$LIBS_PRIVATE"  \
@@ -953,6 +1069,7 @@ LIBSSTATIC_CONFIG="-lfreetype               \
                    $bzip2_libsstaticconf    \
                    $libpng_libsstaticconf   \
                    $harfbuzz_libsstaticconf \
+                   $brotli_libsstaticconf   \
                    $ft2_extra_libs"
 # remove -L/usr/lib and -L/usr/lib64 since `freetype-config' adds them later
 # on if necessary; also beautify
@@ -977,36 +1094,71 @@ AC_SUBST([build_libtool_libs])
 # changing LDFLAGS value should only be done after
 # lt_cv_prog_compiler_static_works test
 
+ftoption_set()
+{
+  regexp="-e \\\"s|.*#.*def.*$1.*|#define $1|\\\""
+  FTOPTION_H_SED="$FTOPTION_H_SED $regexp"
+}
+
+ftoption_unset()
+{
+  regexp="-e \\\"s|.*#.*def.*$1.*|/* #undef $1 */|\\\""
+  FTOPTION_H_SED="$FTOPTION_H_SED $regexp"
+}
+
 if test "$have_zlib" != no; then
-  CFLAGS="$CFLAGS $ZLIB_CFLAGS -DFT_CONFIG_OPTION_SYSTEM_ZLIB"
+  CFLAGS="$CFLAGS $ZLIB_CFLAGS"
   LDFLAGS="$LDFLAGS $ZLIB_LIBS"
+  ftoption_set FT_CONFIG_OPTION_SYSTEM_ZLIB
+else
+  ftoption_unset FT_CONFIG_OPTION_SYSTEM_ZLIB
 fi
-
 if test "$have_bzip2" != no; then
-  CFLAGS="$CFLAGS $BZIP2_CFLAGS -DFT_CONFIG_OPTION_USE_BZIP2"
+  CFLAGS="$CFLAGS $BZIP2_CFLAGS"
   LDFLAGS="$LDFLAGS $BZIP2_LIBS"
+  ftoption_set FT_CONFIG_OPTION_USE_BZIP2
+else
+  ftoption_unset FT_CONFIG_OPTION_USE_BZIP2
 fi
 if test "$have_libpng" != no; then
-  CFLAGS="$CFLAGS $LIBPNG_CFLAGS -DFT_CONFIG_OPTION_USE_PNG"
+  CFLAGS="$CFLAGS $LIBPNG_CFLAGS"
   LDFLAGS="$LDFLAGS $LIBPNG_LIBS"
+  ftoption_set FT_CONFIG_OPTION_USE_PNG
+else
+  ftoption_unset FT_CONFIG_OPTION_USE_PNG
 fi
 if test "$have_harfbuzz" != no; then
-  CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS -DFT_CONFIG_OPTION_USE_HARFBUZZ"
+  CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
   LDFLAGS="$LDFLAGS $HARFBUZZ_LIBS"
+  ftoption_set FT_CONFIG_OPTION_USE_HARFBUZZ
+else
+  ftoption_unset FT_CONFIG_OPTION_USE_HARFBUZZ
+fi
+if test "$have_brotli" != no; then
+  CFLAGS="$CFLAGS $BROTLI_CFLAGS"
+  LDFLAGS="$LDFLAGS $BROTLI_LIBS"
+  ftoption_set FT_CONFIG_OPTION_USE_BROTLI
+else
+  ftoption_unset FT_CONFIG_OPTION_USE_BROTLI
 fi
 
 AC_SUBST([CFLAGS])
 AC_SUBST([LDFLAGS])
 
-# configuration file -- stay in 8.3 limit
+# We don't want to use a template file for `ftoption.h', since compilation
+# should work without calling a configure script also.  For this reason, we
+# copy the `include/freetype/config/ftoption.h' file to the `unix/builds'
+# directory (using a dummy `AC_CONFIG_FILES' call) and apply the just
+# constructed $FTOPTION_H_SED regexp (using the post-action of
+# `AC_CONFIG_FILES'); this is also the version that gets installed later on.
 #
-# since #undef doesn't survive in configuration header files we replace
-# `/undef' with `#undef' after creating the output file
+AC_CONFIG_FILES([ftoption.h:${srcdir}/../../include/freetype/config/ftoption.h],
+  [mv ftoption.h ftoption.tmp
+   eval "sed $FTOPTION_H_SED < ftoption.tmp > ftoption.h"
+   rm ftoption.tmp],
+  [FTOPTION_H_SED="$FTOPTION_H_SED"])
 
-AC_CONFIG_HEADERS([ftconfig.h:ftconfig.in],
-  [mv ftconfig.h ftconfig.tmp
-   sed 's|/undef|#undef|' < ftconfig.tmp > ftconfig.h
-   rm ftconfig.tmp])
+AC_CONFIG_HEADERS([ftconfig.h])
 
 # create the Unix-specific sub-Makefiles `builds/unix/unix-def.mk'
 # and `builds/unix/unix-cc.mk' that will be used by the build system
@@ -1014,10 +1166,6 @@ AC_CONFIG_HEADERS([ftconfig.h:ftconfig.in],
 AC_CONFIG_FILES([unix-cc.mk:unix-cc.in
                  unix-def.mk:unix-def.in])
 
-# re-generate the Jamfile to use libtool now
-#
-# AC_CONFIG_FILES([../../Jamfile:../../Jamfile.in])
-
 AC_OUTPUT
 
 AC_MSG_NOTICE([
@@ -1027,6 +1175,18 @@ Library configuration:
   bzip2:         $have_bzip2
   libpng:        $have_libpng
   harfbuzz:      $have_harfbuzz
+  brotli:        $have_brotli
 ])
 
+# Warn if docwriter is not installed
+
+if test $have_docwriter = no; then
+  AC_MSG_WARN([
+  \`make refdoc' will fail since pip package \`docwriter' is not installed.
+  To install, run \`$PIP install docwriter', or to use a Python
+  virtual environment, run \`make refdoc-venv' (requires pip package
+  \`virtualenv'). These operations require Python >= 3.5.
+  ])
+fi
+
 # end of configure.raw