Index: 3depict/Makefile.in
===================================================================
--- 3depict.orig/Makefile.in	2018-04-20 00:48:13.462994299 +0200
+++ 3depict/Makefile.in	2018-04-20 00:48:13.454994299 +0200
@@ -233,10 +233,9 @@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
-FREETYPE_CONFIG = @FREETYPE_CONFIG@
 FTGL_CFLAGS = @FTGL_CFLAGS@
 FTGL_LIBS = @FTGL_LIBS@
-FT_INCLUDES = @FT_INCLUDES@
+FT_CFLAGS = @FT_CFLAGS@
 FT_LIBS = @FT_LIBS@
 GETTEXT_LIBS = @GETTEXT_LIBS@
 GL_LIBS = @GL_LIBS@
Index: 3depict/config.h.in
===================================================================
--- 3depict.orig/config.h.in	2018-04-20 00:48:13.462994299 +0200
+++ 3depict/config.h.in	2018-04-20 00:48:13.454994299 +0200
@@ -12,9 +12,6 @@
 /* Define to 1 if you have the `floor' function. */
 #undef HAVE_FLOOR
 
-/* Define to 1 if you have the <ft2build.h> header file. */
-#undef HAVE_FT2BUILD_H
-
 /* Define to 1 if you have the `getcwd' function. */
 #undef HAVE_GETCWD
 
@@ -27,9 +24,6 @@
 /* Define to 1 if you have the `isascii' function. */
 #undef HAVE_ISASCII
 
-/* Define if you have the FREETYPE2 library */
-#undef HAVE_LIBFREETYPE
-
 /* Define to 1 if you have the `ftgl' library (-lftgl). */
 #undef HAVE_LIBFTGL
 
Index: 3depict/configure
===================================================================
--- 3depict.orig/configure	2018-04-20 00:48:13.462994299 +0200
+++ 3depict/configure	2018-04-20 00:48:13.458994299 +0200
@@ -644,12 +644,11 @@
 CXXCPP
 FTGL_LIBS
 FTGL_CFLAGS
+FT_LIBS
+FT_CFLAGS
 PKG_CONFIG_LIBDIR
 PKG_CONFIG_PATH
 PKG_CONFIG
-FT_LIBS
-FT_INCLUDES
-FREETYPE_CONFIG
 USE_XML_FALSE
 USE_XML_TRUE
 XML_LIBS
@@ -781,7 +780,6 @@
 with_wx_prefix
 with_wx_exec_prefix
 with_xml_config
-with_freetype
 enable_sweep_hull
 with_libqhull_flags
 with_libqhull_link
@@ -816,6 +814,8 @@
 PKG_CONFIG
 PKG_CONFIG_PATH
 PKG_CONFIG_LIBDIR
+FT_CFLAGS
+FT_LIBS
 FTGL_CFLAGS
 FTGL_LIBS
 CXXCPP
@@ -1475,7 +1475,6 @@
   --with-wx-exec-prefix=PREFIX
                           Exec prefix where wxWidgets is installed (optional)
   --with-xml-config=PATH  use xml-config in PATH to find libxml
-  --with-freetype=DIR     where to find the freetype 2.x library
   --with-libqhull-flags=PATH : specify compiler flags for libqhull
   --with-libqhull-link=PATH : specify linker flag (library) for libqhull
   --with-libpng-flags=PATH : specify compiler flags for libpng
@@ -1504,6 +1503,8 @@
               directories to add to pkg-config's search path
   PKG_CONFIG_LIBDIR
               path overriding pkg-config's built-in search path
+  FT_CFLAGS   C compiler flags for FT, overriding pkg-config
+  FT_LIBS     linker flags for FT, overriding pkg-config
   FTGL_CFLAGS C compiler flags for FTGL, overriding pkg-config
   FTGL_LIBS   linker flags for FTGL, overriding pkg-config
   CXXCPP      C++ preprocessor
@@ -1959,6 +1960,89 @@
 
 } # ac_fn_c_check_header_compile
 
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext conftest$ac_exeext
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+	 test "$cross_compiling" = yes ||
+	 test -x conftest$ac_exeext
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
+fi
+  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+  # interfere with the next link command; also delete a directory that is
+  # left behind by Apple's compiler.  We do this before executing the actions.
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_link
+
+# ac_fn_cxx_try_cpp LINENO
+# ------------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_try_cpp ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } > conftest.i && {
+	 test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+    ac_retval=1
+fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_cxx_try_cpp
+
 # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
 # -------------------------------------------------------
 # Tests whether HEADER exists, giving a warning if it cannot be compiled using
@@ -2046,89 +2130,6 @@
 
 } # ac_fn_c_check_header_mongrel
 
-# ac_fn_c_try_link LINENO
-# -----------------------
-# Try to link conftest.$ac_ext, and return whether this succeeded.
-ac_fn_c_try_link ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  rm -f conftest.$ac_objext conftest$ac_exeext
-  if { { ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_link") 2>conftest.err
-  ac_status=$?
-  if test -s conftest.err; then
-    grep -v '^ *+' conftest.err >conftest.er1
-    cat conftest.er1 >&5
-    mv -f conftest.er1 conftest.err
-  fi
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 test -x conftest$ac_exeext
-       }; then :
-  ac_retval=0
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_retval=1
-fi
-  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
-  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
-  # interfere with the next link command; also delete a directory that is
-  # left behind by Apple's compiler.  We do this before executing the actions.
-  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-  as_fn_set_status $ac_retval
-
-} # ac_fn_c_try_link
-
-# ac_fn_cxx_try_cpp LINENO
-# ------------------------
-# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
-ac_fn_cxx_try_cpp ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if { { ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
-  ac_status=$?
-  if test -s conftest.err; then
-    grep -v '^ *+' conftest.err >conftest.er1
-    cat conftest.er1 >&5
-    mv -f conftest.er1 conftest.err
-  fi
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } > conftest.i && {
-	 test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
-	 test ! -s conftest.err
-       }; then :
-  ac_retval=0
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-    ac_retval=1
-fi
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-  as_fn_set_status $ac_retval
-
-} # ac_fn_cxx_try_cpp
-
 # ac_fn_cxx_check_header_mongrel LINENO HEADER VAR INCLUDES
 # ---------------------------------------------------------
 # Tests whether HEADER exists, giving a warning if it cannot be compiled using
@@ -6020,203 +6021,10 @@
 
 #----------------
 
-# Check for FT2
-#FT2 teset from the graphviz library configure.ac
-FREETYPE_DIR="yes"
-
-# Check whether --with-freetype was given.
-if test "${with_freetype+set}" = set; then :
-  withval=$with_freetype; FREETYPE_DIR=$withval
-fi
-
-
-if test "x$FREETYPE_DIR" = "xno"; then
-  as_fn_error $? "FREETYPE2 library disabled" "$LINENO" 5
-else
-
-  if test "x$FREETYPE_DIR" != "xyes"; then
-    # Extract the first word of "freetype-config", so it can be a program name with args.
-set dummy freetype-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_FREETYPE_CONFIG+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $FREETYPE_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_FREETYPE_CONFIG="$FREETYPE_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-as_dummy="$FREETYPE_DIR/bin:$PATH"
-for as_dir in $as_dummy
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_FREETYPE_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  ;;
-esac
-fi
-FREETYPE_CONFIG=$ac_cv_path_FREETYPE_CONFIG
-if test -n "$FREETYPE_CONFIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_CONFIG" >&5
-$as_echo "$FREETYPE_CONFIG" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  else
-    # Extract the first word of "freetype-config", so it can be a program name with args.
-set dummy freetype-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_FREETYPE_CONFIG+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $FREETYPE_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_FREETYPE_CONFIG="$FREETYPE_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_FREETYPE_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  ;;
-esac
-fi
-FREETYPE_CONFIG=$ac_cv_path_FREETYPE_CONFIG
-if test -n "$FREETYPE_CONFIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_CONFIG" >&5
-$as_echo "$FREETYPE_CONFIG" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  fi
-
-  if test -n "$FREETYPE_CONFIG"; then
-    if test "x$FREETYPE_DIR" != "xyes"; then
-      FT_INCLUDES="`$FREETYPE_CONFIG --cflags` -I$FREETYPE_DIR/include"
-    else
-      FT_INCLUDES=`$FREETYPE_CONFIG --cflags`
-    fi
-    ft_libtool=`$FREETYPE_CONFIG --libtool`
-    # check that it really exists (FreeBSD apparently forgot to insttall it!)
-    if test -f "$ft_libtool"; then
-	FT_LIBTOOL="$ft_libtool"
-    else
-	FT_LIBTOOL=""
-    fi
-    FT_LIBS=`$FREETYPE_CONFIG --libs`
-    FT_LDFLAGS=`echo " $FT_LIBS" |sed 's/ -l[^ ][^ ]*//g'`
-  else
-    if test "x$FREETYPE_DIR" != "xyes"; then
-      FT_INCLUDES="-I$FREETYPE_DIR/include/freetype2 -I$FREETYPE_DIR/include"
-      FT_LDFLAGS="-L$FREETYPE_DIR/lib"
-      FT_LIBS="-lfreetype"
-    else
-      FT_INCLUDES=""
-      FT_LDFLAGS=""
-      FT_LIBS=""
-    fi
-    FT_LIBTOOL=""
-  fi
-
-  save_CPPFLAGS=$CPPFLAGS
-  save_LDFLAGS=$LDFLAGS
-  CPPFLAGS="$CPPFLAGS $FT_INCLUDES"
-  LDFLAGS="$LDFLAGS $FT_LDFLAGS"
-  for ac_header in ft2build.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "ft2build.h" "ac_cv_header_ft2build_h" "$ac_includes_default"
-if test "x$ac_cv_header_ft2build_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_FT2BUILD_H 1
-_ACEOF
-
-fi
-
-done
-
-  if test `eval echo '${'$as_ac_Header'}'` = yes; then
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lfreetype" >&5
-$as_echo_n "checking for main in -lfreetype... " >&6; }
-if ${ac_cv_lib_freetype_main+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lfreetype  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-
-int
-main ()
-{
-return main ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_freetype_main=yes
-else
-  ac_cv_lib_freetype_main=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_freetype_main" >&5
-$as_echo "$ac_cv_lib_freetype_main" >&6; }
-if test "x$ac_cv_lib_freetype_main" = xyes; then :
-  FT_LIBS="$FT_LIBS"
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBFREETYPE 1
-_ACEOF
-
-else
-  as_fn_error $? "Error: FREETYPE2 library not available - no libfreetype." "$LINENO" 5
-fi
-
-  else
-	as_fn_error $? "Required FREETYPE2 library not available - no ft2build.h" "$LINENO" 5
-  fi
-  CPPFLAGS=$save_CPPFLAGS
-  LDFLAGS=$save_LDFLAGS
-
-
-fi
-
-
-
-#Check for FTGL using custom script.
+# Check for FT2 - use pkg-config
+#  freetype2  >=2.9.1 will no longer ship freetype-config
+#  we used to use a modified version fo the graphviz code
+#  to check for freetype, but it was over-complex for our needs
 
 
 
@@ -6338,6 +6146,101 @@
 	fi
 fi
 
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for FT" >&5
+$as_echo_n "checking for FT... " >&6; }
+
+if test -n "$FT_CFLAGS"; then
+    pkg_cv_FT_CFLAGS="$FT_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"freetype2\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "freetype2") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_FT_CFLAGS=`$PKG_CONFIG --cflags "freetype2" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+if test -n "$FT_LIBS"; then
+    pkg_cv_FT_LIBS="$FT_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"freetype2\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "freetype2") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_FT_LIBS=`$PKG_CONFIG --libs "freetype2" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+   	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+	        FT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "freetype2" 2>&1`
+        else
+	        FT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "freetype2" 2>&1`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$FT_PKG_ERRORS" >&5
+
+	as_fn_error $? "Package requirements (freetype2) were not met:
+
+$FT_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables FT_CFLAGS
+and FT_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+	{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables FT_CFLAGS
+and FT_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5; }
+else
+	FT_CFLAGS=$pkg_cv_FT_CFLAGS
+	FT_LIBS=$pkg_cv_FT_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+fi
+CPPFLAGS="$CPPFLAGS $FT_CFLAGS"
+LDFLAGS="$LDFLAGS $FT_LIBS"
+
+#Check for FTGL using custom script.
+
 ac_ext=cpp
 ac_cpp='$CXXCPP $CPPFLAGS'
 ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -6945,7 +6848,8 @@
 fi
 
 
-	if test x"$PNG_USE_PKG_CFG" == x"yes" ; then
+	if test x"$PNG_USE_PKG_CFG" == x"yes" ; then :
+
 
 pkg_failed=no
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PNG" >&5
@@ -7037,7 +6941,7 @@
 $as_echo "yes" >&6; }
 
 fi
-	fi
+fi
 fi
 
 
Index: 3depict/configure.ac
===================================================================
--- 3depict.orig/configure.ac	2018-04-20 00:48:13.462994299 +0200
+++ 3depict/configure.ac	2018-04-20 00:48:13.458994299 +0200
@@ -105,72 +105,14 @@
 AM_CONDITIONAL(USE_XML, test "$have_xml" = "yes")
 #----------------
 
-# Check for FT2
+# Check for FT2 - use pkg-config
+#  freetype2  >=2.9.1 will no longer ship freetype-config
+#  we used to use a modified version fo the graphviz code 
+#  to check for freetype, but it was over-complex for our needs
 dnl ----------
-#FT2 teset from the graphviz library configure.ac
-FREETYPE_DIR="yes" 
-AC_ARG_WITH(freetype,
-	[  --with-freetype=DIR     where to find the freetype 2.x library],
-       FREETYPE_DIR=$withval)
-
-if test "x$FREETYPE_DIR" = "xno"; then
-  AC_MSG_ERROR(FREETYPE2 library disabled)
-else
-                                                                              
-  if test "x$FREETYPE_DIR" != "xyes"; then
-    AC_PATH_PROG(FREETYPE_CONFIG,freetype-config,,[$FREETYPE_DIR/bin:$PATH])
-  else
-    AC_PATH_PROG(FREETYPE_CONFIG,freetype-config)
-  fi
-
-  if test -n "$FREETYPE_CONFIG"; then
-    if test "x$FREETYPE_DIR" != "xyes"; then
-      FT_INCLUDES="`$FREETYPE_CONFIG --cflags` -I$FREETYPE_DIR/include"
-    else
-      FT_INCLUDES=`$FREETYPE_CONFIG --cflags`
-    fi
-    ft_libtool=`$FREETYPE_CONFIG --libtool`
-    # check that it really exists (FreeBSD apparently forgot to insttall it!)
-    if test -f "$ft_libtool"; then
-	FT_LIBTOOL="$ft_libtool"
-    else
-	FT_LIBTOOL=""
-    fi
-    FT_LIBS=`$FREETYPE_CONFIG --libs`
-    FT_LDFLAGS=`echo " $FT_LIBS" |sed 's/ -l[[^ ]][[^ ]]*//g'`
-  else
-    if test "x$FREETYPE_DIR" != "xyes"; then
-      FT_INCLUDES="-I$FREETYPE_DIR/include/freetype2 -I$FREETYPE_DIR/include"
-      FT_LDFLAGS="-L$FREETYPE_DIR/lib"
-      FT_LIBS="-lfreetype"
-    else
-      FT_INCLUDES=""
-      FT_LDFLAGS=""
-      FT_LIBS=""
-    fi
-    FT_LIBTOOL=""
-  fi
-
-  save_CPPFLAGS=$CPPFLAGS
-  save_LDFLAGS=$LDFLAGS
-  CPPFLAGS="$CPPFLAGS $FT_INCLUDES"
-  LDFLAGS="$LDFLAGS $FT_LDFLAGS"
-  AC_CHECK_HEADERS(ft2build.h)
-  if test `eval echo '${'$as_ac_Header'}'` = yes; then
-	AC_CHECK_LIB(freetype,main,
-		[FT_LIBS="$FT_LIBS"
-		AC_DEFINE_UNQUOTED(HAVE_LIBFREETYPE,1,[Define if you have the FREETYPE2 library])],
-		[AC_MSG_ERROR(Error: FREETYPE2 library not available - no libfreetype.)])
-  else
-	AC_MSG_ERROR(Required FREETYPE2 library not available - no ft2build.h)
-  fi
-  CPPFLAGS=$save_CPPFLAGS
-  LDFLAGS=$save_LDFLAGS
-  AC_SUBST(FT_INCLUDES)
-  AC_SUBST(FT_LIBS)
-fi
-
-
+PKG_CHECK_MODULES(FT,freetype2)
+CPPFLAGS="$CPPFLAGS $FT_CFLAGS"
+LDFLAGS="$LDFLAGS $FT_LIBS"
 dnl ----------
 
 #Check for FTGL using custom script.
@@ -248,9 +190,8 @@
 	AC_CHECK_LIB([png],[png_create_write_struct_2] , 
 		[PNG_LIBS=-lpng], [PNG_USE_PKG_CFG=yes],-lm)
 
-	if test x"$PNG_USE_PKG_CFG" == x"yes" ; then
-		PKG_CHECK_MODULES(PNG, libpng >= 1.2)
-	fi
+	AS_IF([test x"$PNG_USE_PKG_CFG" == x"yes" ],[
+		PKG_CHECK_MODULES(PNG, libpng >= 1.2) ])
 fi
 
 AC_SUBST(PNG_LIBS)
Index: 3depict/src/Makefile.in
===================================================================
--- 3depict.orig/src/Makefile.in	2018-04-20 00:48:13.462994299 +0200
+++ 3depict/src/Makefile.in	2018-04-20 00:48:13.458994299 +0200
@@ -390,10 +390,9 @@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
-FREETYPE_CONFIG = @FREETYPE_CONFIG@
 FTGL_CFLAGS = @FTGL_CFLAGS@
 FTGL_LIBS = @FTGL_LIBS@
-FT_INCLUDES = @FT_INCLUDES@
+FT_CFLAGS = @FT_CFLAGS@
 FT_LIBS = @FT_LIBS@
 GETTEXT_LIBS = @GETTEXT_LIBS@
 GL_LIBS = @GL_LIBS@
