changeset 24121:e2dc75c661ac

configure: add a command-line option '--without-freetype' to disable FreeType * configure.ac: Add a command-line option '--without-freetype' to optionally disable building Octave with FreeType.
author Mike Miller <mtmiller@octave.org>
date Mon, 02 Oct 2017 16:25:58 -0700
parents 0d446e938f1f
children 813b1385f85d
files configure.ac
diffstat 1 files changed, 28 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Mon Oct 02 10:36:28 2017 -0700
+++ b/configure.ac	Mon Oct 02 16:25:58 2017 -0700
@@ -2020,24 +2020,35 @@
 
 ## Check for FreeType 2 library
 
+check_freetype=yes
 warn_freetype=""
-PKG_CHECK_MODULES([FT2], [freetype2], [
-  min_ft2_version=9.03
-  AC_MSG_CHECKING([for FreeType2 version >= $min_ft2_version])
-  $PKG_CONFIG freetype2 --atleast-version=$min_ft2_version
-  ac_status=$?
-  if test "$ac_status" = 0; then
-    AC_MSG_RESULT(yes)
-    AC_DEFINE(HAVE_FREETYPE, 1, [Define to 1 if Freetype is available.])
-    save_LIBS="$LIBS"
-    LIBS="$FT2_LIBS $LIBS"
-    AC_CHECK_FUNCS([FT_Reference_Face])
-    LIBS="$save_LIBS"
-  else
-    AC_MSG_RESULT(no)
-    warn_freetype="FreeType library >= 9.03 not found.  OpenGL graphics will not be fully functional."
-  fi],
-  [warn_freetype="FreeType library not found.  OpenGL graphics will not be fully functional."])
+AC_ARG_WITH([freetype],
+  [AS_HELP_STRING([--without-freetype],
+    [don't use FreeType library, OpenGL graphics will not be fully functional])],
+  [if test x"$withval" = xno; then
+     check_freetype=no
+     warn_freetype="--without-freetype specified.  OpenGL graphics will not be fully functional."
+   fi])
+
+if test $check_freetype = yes; then
+  PKG_CHECK_MODULES([FT2], [freetype2], [
+    min_ft2_version=9.03
+    AC_MSG_CHECKING([for FreeType2 version >= $min_ft2_version])
+    $PKG_CONFIG freetype2 --atleast-version=$min_ft2_version
+    ac_status=$?
+    if test "$ac_status" = 0; then
+      AC_MSG_RESULT(yes)
+      AC_DEFINE(HAVE_FREETYPE, 1, [Define to 1 if Freetype is available.])
+      save_LIBS="$LIBS"
+      LIBS="$FT2_LIBS $LIBS"
+      AC_CHECK_FUNCS([FT_Reference_Face])
+      LIBS="$save_LIBS"
+    else
+      AC_MSG_RESULT(no)
+      warn_freetype="FreeType library >= 9.03 not found.  OpenGL graphics will not be fully functional."
+    fi],
+    [warn_freetype="FreeType library not found.  OpenGL graphics will not be fully functional."])
+fi
 
 if test -n "$warn_freetype"; then
   OCTAVE_CONFIGURE_WARNING([warn_freetype])