Combined patches from git.
--- /dev/null
+++ fltk1.3-1.3.11/.gitignore
@@ -0,0 +1,295 @@
+# Start Debian additions
+/.pc
+/CMakeTmp
+/aclocal.m4
+/cairo/libfltk_cairo.so*
+/documentation/doxygen_sqlite3.db
+# End Debian additions
+
+# ignore file for git - generated from subversion with:
+# git svn show-ignore
+
+*.o
+*.exe
+
+# /
+/autom4te*.cache
+/clang
+/config.cache
+/config.guess
+/config.h
+/config.log
+/config.status
+/config.sub
+/configure
+/fltk-config
+/fltk.list
+/fltk.spec
+/makeinclude
+/*.bck
+/TAGS
+
+# /FL
+/FL/abi-version.h
+/FL/Makefile
+/FL/*.bck
+
+# /documentation/
+/documentation/.xvpics
+/documentation/blocks.0
+/documentation/blocks.6
+/documentation/blocks.z
+/documentation/checkers.0
+/documentation/checkers.6
+/documentation/checkers.z
+/documentation/Doxybook
+/documentation/Doxyfile
+/documentation/fltk.0
+/documentation/fltk.3
+/documentation/fltk-config.0
+/documentation/fltk-config.1
+/documentation/fltk-config.z
+/documentation/fltk.d
+/documentation/fltk.pdf
+/documentation/fltk.z
+/documentation/fluid.0
+/documentation/fluid.1
+/documentation/fluid.z
+/documentation/html
+/documentation/latex
+/documentation/sudoku.0
+/documentation/sudoku.6
+/documentation/sudoku.z
+/documentation/*.bck
+/documentation/*.bak
+/documentation/*.log
+
+# /documentation/src/
+/documentation/src/*.0
+/documentation/src/*.1
+/documentation/src/*.3
+/documentation/src/*.6
+/documentation/src/*.z
+/documentation/src/fltk-book.tex
+
+# /examples/
+/examples/*.exe
+/examples/clipboard
+/examples/fltk-versions
+/examples/howto-add_fd-and-popen
+/examples/howto-browser-with-icons
+/examples/howto-drag-and-drop
+/examples/howto-parse-args
+/examples/howto-text-over-image-button
+/examples/menubar-add
+/examples/nativefilechooser-simple-app
+/examples/progress-simple
+/examples/shapedwindow
+/examples/table-as-container
+/examples/table-simple
+/examples/table-sort
+/examples/table-spreadsheet
+/examples/table-spreadsheet-with-keyboard-nav
+/examples/table-with-keynav
+/examples/tabs-simple
+/examples/textdisplay-with-colors
+/examples/texteditor-simple
+/examples/tree-as-container
+/examples/tree-custom-draw-items
+/examples/tree-custom-sort
+/examples/tree-of-tables
+/examples/tree-simple
+/examples/wizard-simple
+
+# /fluid/
+/fluid/fluid
+/fluid/fluid-shared
+/fluid/*.bck
+/fluid/*.exe
+/fluid/*.ilk
+/fluid/*.pdb
+/fluid/TAGS
+
+# /fluid/fluid.app/Contents/MacOS/
+/fluid/fluid.app/Contents/MacOS/fluid
+
+# /fluid/pixmaps/
+/fluid/pixmaps/*.bck
+
+# /ide/VisualC2008/
+/ide/VisualC2008/fltk.ncb
+/ide/VisualC2008/*.pdb
+/ide/VisualC2008/*.user
+/ide/VisualC2008/*_/
+/ide/VisualC2008/*__0/
+/ide/VisualC2008/fltkdll/
+/ide/VisualC2008/fltkdlld/
+/ide/VisualC2008/Debug/
+/ide/VisualC2008/Debug Cairo/
+/ide/VisualC2008/Release/
+/ide/VisualC2008/Release Cairo/
+
+# /ide/VisualC2010/
+/ide/VisualC2010/*.user
+/ide/VisualC2010/*_debug/
+/ide/VisualC2010/*_release/
+/ide/VisualC2010/fltk.*sdf
+/ide/VisualC2010/fltk.suo
+/ide/VisualC2010/fltkdlld.pdb
+/ide/VisualC2010/fltkdll/
+/ide/VisualC2010/fltkdlld/
+/ide/VisualC2010/Debug/
+/ide/VisualC2010/Debug Cairo/
+/ide/VisualC2010/Release/
+/ide/VisualC2010/Release Cairo/
+
+# /ide/Xcode3/
+/ide/Xcode3/build
+
+# /ide/Xcode3/FLTK.xcodeproj/
+/ide/Xcode3/FLTK.xcodeproj/*.pbxuser
+/ide/Xcode3/FLTK.xcodeproj/*.perspectivev3
+
+# /ide/Xcode4/
+/ide/Xcode4/build
+
+# /ide/Xcode4/FLTK.xcodeproj/
+/ide/Xcode4/FLTK.xcodeproj/*.pbxuser
+/ide/Xcode4/FLTK.xcodeproj/*.perspectivev3
+
+# /lib/
+/lib/lib*
+/lib/*.lib
+/lib/*.a
+/lib/*.bsc
+
+# /misc/
+/misc/doxystar
+
+# /src/
+/src/*.so*
+/src/*.sl*
+/src/*.a
+/src/*.bck
+/src/*.sav
+/src/*.dylib
+
+# /test/
+/test/*.pdb
+/test/CubeView
+/test/CubeViewUI.cxx
+/test/CubeViewUI.h
+/test/adjuster
+/test/animated
+/test/arc
+/test/ask
+/test/bitmap
+/test/blocks
+/test/boxtype
+/test/browser
+/test/button
+/test/buttons
+/test/cairo_test
+/test/checkers
+/test/clock
+/test/colbrowser
+/test/color_chooser
+/test/cube
+/test/cursor
+/test/curve
+/test/demo
+/test/device
+/test/doublebuffer
+/test/editor
+/test/fast_slow
+/test/fast_slow.cxx
+/test/fast_slow.h
+/test/file_chooser
+/test/fonts
+/test/forms
+/test/fractals
+/test/fullscreen
+/test/gl_overlay
+/test/glpuzzle
+/test/hello
+/test/help
+/test/icon
+/test/iconize
+/test/image
+/test/inactive
+/test/inactive.cxx
+/test/inactive.h
+/test/input
+/test/input_choice
+/test/keyboard
+/test/keyboard_ui.cxx
+/test/keyboard_ui.h
+/test/label
+/test/line_style
+/test/list_visuals
+/test/mandelbrot
+/test/mandelbrot_ui.cxx
+/test/mandelbrot_ui.h
+/test/menubar
+/test/message
+/test/minimum
+/test/native-filechooser
+/test/navigation
+/test/offscreen
+/test/output
+/test/overlay
+/test/pack
+/test/pixmap
+/test/pixmap_browser
+/test/preferences
+/test/preferences.cxx
+/test/preferences.h
+/test/print
+/test/radio
+/test/radio.cxx
+/test/radio.h
+/test/resize
+/test/resize.cxx
+/test/resize.h
+/test/resizebox
+/test/rotated_text
+/test/scroll
+/test/shape
+/test/shiny
+/test/shiny_panel.cxx
+/test/shiny_panel.h
+/test/subwindow
+/test/sudoku
+/test/symbols
+/test/table
+/test/tabs
+/test/tabs.cxx
+/test/tabs.h
+/test/threads
+/test/tile
+/test/tiled_image
+/test/tree
+/test/tree.cxx
+/test/tree.h
+/test/twowin
+/test/unittests
+/test/utf8
+/test/valuators
+/test/valuators.cxx
+/test/valuators.h
+/test/windowfocus
+/test/*.bck
+/test/*.exe
+/test/*.ilk
+/test/fltk*.lib
+/test/fltk*.exp
+/test/fltk*.dll
+
+# /test/blocks.app/Contents/MacOS/
+/test/blocks.app/Contents/MacOS/blocks
+
+# /test/checkers.app/Contents/MacOS/
+/test/checkers.app/Contents/MacOS/checkers
+
+# /test/sudoku.app/Contents/MacOS/
+/test/sudoku.app/Contents/MacOS/sudoku
--- fltk1.3-1.3.11.orig/CMake/UseFLTK.cmake.in
+++ fltk1.3-1.3.11/CMake/UseFLTK.cmake.in
@@ -6,8 +6,6 @@
 # automatically generated - do not edit
 #
 
-include_directories("@FLTK_INCLUDE_DIRS@")
-
 message(AUTHOR_WARNING
 " * Warning: UseFLTK.cmake is deprecated and will be removed in FLTK 1.4.0
  * or later. Please use 'include_directories(\${FLTK_INCLUDE_DIRS})' or
--- fltk1.3-1.3.11.orig/Makefile
+++ fltk1.3-1.3.11/Makefile
@@ -101,8 +101,8 @@ makeinclude: configure configh.in makein
 	touch config.h
 	chmod +x fltk-config
 
-configure: configure.ac
-	autoconf
+# configure: configure.ac
+# 	autoconf
 
 config.guess config.sub:
 	-automake --add-missing 2> /dev/null
--- fltk1.3-1.3.11.orig/cairo/Makefile
+++ fltk1.3-1.3.11/cairo/Makefile
@@ -21,6 +21,8 @@
 FLTKFLAGS = -DFL_LIBRARY
 include ../makeinclude
 
+CXXFLAGS := $(CXXFLAGS:-fPIE=-fPIC)
+
 #
 # Object files...
 #
--- fltk1.3-1.3.11.orig/configure
+++ fltk1.3-1.3.11/configure
@@ -732,6 +732,9 @@ FL_DSO_VERSION
 FLTK_VERSION_PATCH
 FLTK_VERSION_MINOR
 FLTK_VERSION_MAJOR
+PKG_CONFIG_LIBDIR
+PKG_CONFIG_PATH
+PKG_CONFIG
 ac_ct_CXX
 CXXFLAGS
 CXX
@@ -828,6 +831,9 @@ CPPFLAGS
 CXX
 CXXFLAGS
 CCC
+PKG_CONFIG
+PKG_CONFIG_PATH
+PKG_CONFIG_LIBDIR
 XMKMF
 CPP'
 
@@ -1495,6 +1501,11 @@ Some influential environment variables:
               you have headers in a nonstandard directory <include dir>
   CXX         C++ compiler command
   CXXFLAGS    C++ compiler flags
+  PKG_CONFIG  path to pkg-config utility
+  PKG_CONFIG_PATH
+              directories to add to pkg-config's search path
+  PKG_CONFIG_LIBDIR
+              path overriding pkg-config's built-in search path
   XMKMF       Path to xmkmf, Makefile generator for X Window System
   CPP         C preprocessor
 
@@ -4521,6 +4532,126 @@ ac_link='$CC -o conftest$ac_exeext $CFLA
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
+
+
+
+
+
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+	if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}pkg-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_PKG_CONFIG+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $PKG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PKG_CONFIG="$PKG_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_PKG_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
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+if test -n "$PKG_CONFIG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
+$as_echo "$PKG_CONFIG" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_PKG_CONFIG"; then
+  ac_pt_PKG_CONFIG=$PKG_CONFIG
+  # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-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_ac_pt_PKG_CONFIG+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $ac_pt_PKG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_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_ac_pt_PKG_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
+ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
+if test -n "$ac_pt_PKG_CONFIG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
+$as_echo "$ac_pt_PKG_CONFIG" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_pt_PKG_CONFIG" = x; then
+    PKG_CONFIG=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    PKG_CONFIG=$ac_pt_PKG_CONFIG
+  fi
+else
+  PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
+fi
+
+fi
+if test -n "$PKG_CONFIG"; then
+	_pkg_min_version=0.9.0
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
+$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
+	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+	else
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+		PKG_CONFIG=""
+	fi
+fi
+
 case $host_os in
     darwin*)
 	if test "x$with_archflags" != x ; then
@@ -4619,7 +4750,7 @@ if test x$enable_cairoext = xyes; then
 	  printf "%s\n" "#define FLTK_HAVE_CAIRO 1" >>confdefs.h
 
 	  	  	  CAIRODIR="cairo"
-	  CAIROFLAGS="`pkg-config --cflags cairo`"
+	  CAIROFLAGS="`$PKG_CONFIG --cflags cairo`"
 	  CAIROLIBS="-lcairo -lpixman-1"
 	  CXXFLAGS="$CAIROFLAGS $CXXFLAGS"
 	  LINKFLTKCAIRO="../lib/libfltk_cairo.a"
@@ -4631,7 +4762,7 @@ else
 	  printf "%s\n" "#define FLTK_HAVE_CAIRO 1" >>confdefs.h
 
 	  	  	  CAIRODIR="cairo"
-	  CAIROFLAGS="`pkg-config --cflags cairo`"
+	  CAIROFLAGS="`$PKG_CONFIG --cflags cairo`"
 	  CAIROLIBS="-lcairo -lpixman-1"
 	  CXXFLAGS="$CAIROFLAGS $CXXFLAGS"
 	  LINKFLTKCAIRO="../lib/libfltk_cairo.a"
@@ -4886,9 +5017,9 @@ printf "%s\n" "$ac_cv_cxx_fvisibility_in
 		CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden"
 	    fi
 
-	    if test "x$libdir" != "x/usr/lib" -a "x$libdir" != "x/usr/lib64"; then
-		    DSOLINK="-Wl,-rpath,$libdir"
-	    fi
+# 	    if test "x$libdir" != "x/usr/lib" -a "x$libdir" != "x/usr/lib64"; then
+# 		    DSOLINK="-Wl,-rpath,$libdir"
+# 	    fi
 	    ;;
 	aix*)
 	    DSONAME="libfltk_s.a"
@@ -8587,8 +8718,9 @@ fi
 	xft_found=no
 	if test x$enable_xft != xno; then
             # Try pkg-config first (freetype2 deprecated freetype-config from some version on)
-            # Extract the first word of "pkg-config", so it can be a program name with args.
-set dummy pkg-config; ac_word=$2
+            if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 printf %s "checking for $ac_word... " >&6; }
 if test ${ac_cv_path_PKGCONFIG+y}
@@ -8632,6 +8764,63 @@ printf "%s\n" "no" >&6; }
 fi
 
 
+fi
+if test -z "$ac_cv_path_PKGCONFIG"; then
+  ac_pt_PKGCONFIG=$PKGCONFIG
+  # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-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_ac_pt_PKGCONFIG+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $ac_pt_PKGCONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ac_pt_PKGCONFIG="$ac_pt_PKGCONFIG" # 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_ac_pt_PKGCONFIG="$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
+ac_pt_PKGCONFIG=$ac_cv_path_ac_pt_PKGCONFIG
+if test -n "$ac_pt_PKGCONFIG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKGCONFIG" >&5
+$as_echo "$ac_pt_PKGCONFIG" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_pt_PKGCONFIG" = x; then
+    PKGCONFIG=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    PKGCONFIG=$ac_pt_PKGCONFIG
+  fi
+else
+  PKGCONFIG="$ac_cv_path_PKGCONFIG"
+fi
+
             FT_FLAGS=""
             if test "x$PKGCONFIG" != x; then
                 FT_FLAGS="`$PKGCONFIG --cflags xft`"
@@ -9562,7 +9751,7 @@ case $host_os in
 	printf "%s\n" "#define FLTK_DOCDIR \"/usr/local/share/doc/fltk\"" >>confdefs.h
 
     else
-	printf "%s\n" "#define FLTK_DOCDIR \"$prefix/share/doc/fltk\"" >>confdefs.h
+	printf "%s\n" "#define FLTK_DOCDIR \"$prefix/share/doc/fltk1.3-doc/HTML\"" >>confdefs.h
 
     fi
     ;;
--- fltk1.3-1.3.11.orig/configure.ac
+++ fltk1.3-1.3.11/configure.ac
@@ -38,6 +38,7 @@ OPTIM="${OPTIM:=}"
 dnl Find compiler commands...
 AC_PROG_CC
 AC_PROG_CXX
+PKG_PROG_PKG_CONFIG
 
 dnl So --with-archflags option is used during "checking size of long"
 case $host_os in
@@ -124,7 +125,7 @@ if test x$enable_cairoext = xyes; then
 	  dnl FIXME This part should be fixed so configure do not depend on
 	  dnl we do not rely on pkg-config .
 	  CAIRODIR="cairo"
-	  CAIROFLAGS="`pkg-config --cflags cairo`"
+	  CAIROFLAGS="`$PKG_CONFIG --cflags cairo`"
 	  CAIROLIBS="-lcairo -lpixman-1"
 	  CXXFLAGS="$CAIROFLAGS $CXXFLAGS"
 	  LINKFLTKCAIRO="../lib/libfltk_cairo.a"
@@ -138,7 +139,7 @@ else
 	  dnl FIXME This part should be fixed so configure do not depend on
 	  dnl we do not rely on pkg-config .
 	  CAIRODIR="cairo"
-	  CAIROFLAGS="`pkg-config --cflags cairo`"
+	  CAIROFLAGS="`$PKG_CONFIG --cflags cairo`"
 	  CAIROLIBS="-lcairo -lpixman-1"
 	  CXXFLAGS="$CAIROFLAGS $CXXFLAGS"
 	  LINKFLTKCAIRO="../lib/libfltk_cairo.a"
@@ -302,9 +303,9 @@ if test x$enable_shared = xyes; then
 		CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden"
 	    fi
 
-	    if test "x$libdir" != "x/usr/lib" -a "x$libdir" != "x/usr/lib64"; then
-		    DSOLINK="-Wl,-rpath,$libdir"
-	    fi
+# 	    if test "x$libdir" != "x/usr/lib" -a "x$libdir" != "x/usr/lib64"; then
+# 		    DSOLINK="-Wl,-rpath,$libdir"
+# 	    fi
 	    ;;
 	aix*)
 	    DSONAME="libfltk_s.a"
@@ -1035,7 +1036,7 @@ case $host_os_gui in
 	xft_found=no
 	if test x$enable_xft != xno; then
             # Try pkg-config first (freetype2 deprecated freetype-config from some version on)
-            AC_PATH_PROG(PKGCONFIG, pkg-config)
+            AC_PATH_TOOL(PKGCONFIG, pkg-config)
             FT_FLAGS=""
             if test "x$PKGCONFIG" != x; then
                 FT_FLAGS="`$PKGCONFIG --cflags xft`"
@@ -1498,7 +1499,7 @@ case $host_os in
     if test x$prefix = xNONE; then
 	AC_DEFINE_UNQUOTED(FLTK_DOCDIR, "/usr/local/share/doc/fltk")
     else
-	AC_DEFINE_UNQUOTED(FLTK_DOCDIR, "$prefix/share/doc/fltk")
+	AC_DEFINE_UNQUOTED(FLTK_DOCDIR, "$prefix/share/doc/fltk1.3-doc/HTML")
     fi
     ;;
 esac
--- fltk1.3-1.3.11.orig/documentation/Makefile
+++ fltk1.3-1.3.11/documentation/Makefile
@@ -52,6 +52,8 @@ MANPAGES =	$(SRC_DOCDIR)/fltk.$(CAT3EXT)
 		$(SRC_DOCDIR)/fluid.$(CAT1EXT) $(SRC_DOCDIR)/blocks.$(CAT6EXT) \
 		$(SRC_DOCDIR)/checkers.$(CAT6EXT) $(SRC_DOCDIR)/sudoku.$(CAT6EXT)
 
+export DEB_DATE := $(shell cd .. && dpkg-parsechangelog -S Date)
+
 all:	$(MANPAGES)
 
 # Use `make docs' to create all docs for distribution files.
@@ -75,10 +77,10 @@ depend:
 
 install: $(MANPAGES)
 	echo "Installing documentation files in $(DESTDIR)$(docdir) ..."
-	-$(INSTALL_DIR) $(DESTDIR)$(docdir)
+	-$(INSTALL_DIR) $(DESTDIR)$(docdir)/HTML
 	if test -f html/index.html ; then \
 	  for file in html/* ; do \
-		$(INSTALL_DATA) $$file $(DESTDIR)$(docdir); \
+		$(INSTALL_DATA) $$file $(DESTDIR)$(docdir)/HTML; \
 	  done \
 	fi
 	if test -f fltk.pdf ; then \
@@ -178,14 +180,18 @@ refman.pdf: $(HTMLFILES) Doxybook src/fl
 	echo "Generating PDF documentation ..."
 	$(DOXYDOC) Doxybook
 	./make_pdf
+        MD5=`(echo $(DEB_DATE) && du -b $@) | md5sum | cut -c -32` && \
+        sed -i "s|^/ID \\[\\(<[0-9A-F]\\{32\\}>\\) \\1]$$|/ID [<$$MD5> <$$MD5>]|" $@
 
 src/fltk-book.tex: src/fltk-book.tex.in
 	echo "Generating $@ ..."
 	DOXY_VERSION=`$(DOXYDOC) --version|cut -f1 -d' '`; \
-	YEAR=`date +%Y`; \
+	YEAR=`date -ud'$(DEB_DATE)' +%Y`; \
+	TODAY=`LC_ALL=C date -ud'$(DEB_DATE)' +'%B %e, %Y'`; \
 	sed -e"s/@YEAR@/$$YEAR/g" \
 	    -e"s/@FLTK_VERSION@/$(FLTK_VERSION)/g" \
 	    -e"s/@DOXY_VERSION@/$$DOXY_VERSION/g" \
+	    -e"s/\\\\today{}/$$TODAY/g" \
 	< $< > $@
 
 src/fltk-book.tex.in: src/fltk-title.tex.in
--- fltk1.3-1.3.11.orig/documentation/make_pdf
+++ fltk1.3-1.3.11/documentation/make_pdf
@@ -26,16 +26,24 @@
 #
 # Used in: Makefile and CMakeLists.txt
 
+PDF_DATE=`date -ud "$DEB_DATE" +D:%Y%m%d%H%M%SZ`
+run_pdflatex() {
+  pdflatex --interaction=nonstopmode \
+    "\pdfinfo{/CreationDate($PDF_DATE)/ModDate($PDF_DATE)}\input{refman.tex}"
+}
+
 ( cd latex
-  pdflatex --interaction=nonstopmode refman.tex
+  sed -i 's/\(\\caption{\(\\mbox{\)\?\)\\hyperlink{[^}]*}/\1/' \
+      classFl__Input.tex classFl__Tree.tex
+  run_pdflatex
   makeindex refman.idx
-  pdflatex --interaction=nonstopmode refman.tex
+  run_pdflatex
   latex_count=5
   while egrep -s 'Rerun (LaTeX|to get cross-references right)' refman.log \
 	  && [ $latex_count -gt 0 ]
     do
       echo "Rerunning pdflatex ..."
-      pdflatex --interaction=nonstopmode refman.tex
+      run_pdflatex
       latex_count=`expr $latex_count - 1`
     done
   cd ..) > pdfall.log 2>&1
--- fltk1.3-1.3.11.orig/documentation/src/fltk-title.tex.in
+++ fltk1.3-1.3.11/documentation/src/fltk-title.tex.in
@@ -8,7 +8,7 @@
 \vspace*{2cm}
 \begin{DoxyImageNoCaption}
  \mbox{\includegraphics[width=6cm]{FL200.png}}
-\end{DoxyImageNoCaption}\\
+\end{DoxyImageNoCaption}
 \vspace*{2cm}
 {\Large
 Revision 9.10 by F. Costantini, D. Gibson, M. Melcher, \\
--- fltk1.3-1.3.11.orig/fltk-config.in
+++ fltk1.3-1.3.11/fltk-config.in
@@ -226,26 +226,26 @@ if test "$BINARY_DIR" != ""; then
     includes="-I$BINARY_DIR $includes"
 fi
 
-if test "$libdir" != /usr/lib -a "$libdir" != /usr/lib32; then
-    libs=-L$libdir
-else
-    libs=
-fi
+# if test "$libdir" != /usr/lib -a "$libdir" != /usr/lib32; then
+#     libs=-L$libdir
+# else
+#     libs=
+# fi
 
 # Calculate needed libraries
 LDSTATIC="$libdir/libfltk.a $LDLIBS"
-LDLIBS="-lfltk$SHAREDSUFFIX $LDLIBS"
+LDLIBS="-lfltk$SHAREDSUFFIX -lX11"
 
 if test x$use_forms = xyes; then
     LDLIBS="-lfltk_forms$SHAREDSUFFIX $LDLIBS"
     LDSTATIC="$libdir/libfltk_forms.a $LDSTATIC"
 fi
 if test x$use_gl = xyes; then
-    LDLIBS="-lfltk_gl$SHAREDSUFFIX @GLLIBS@ $LDLIBS"
+    LDLIBS="-lfltk_gl$SHAREDSUFFIX $LDLIBS"
     LDSTATIC="$libdir/libfltk_gl.a @GLLIBS@ $LDSTATIC"
 fi
 if test x$use_images = xyes; then
-    LDLIBS="-lfltk_images$SHAREDSUFFIX $IMAGELIBS $LDLIBS"
+    LDLIBS="-lfltk_images$SHAREDSUFFIX $LDLIBS"
     LDSTATIC="$libdir/libfltk_images.a $STATICIMAGELIBS $LDSTATIC"
 fi
 
@@ -284,8 +284,8 @@ if test -n "$compile"; then
 
     post="$prog"
 
-    echo $CXX $ARCHFLAGS $includes $CXXFLAGS $debug -o "'$prog'" "'$compile'" $LDSTATIC
-    $CXX $ARCHFLAGS $includes $CXXFLAGS $debug -o "$prog" "$compile" $LDSTATIC || exit 1
+    echo $CXX $ARCHFLAGS $includes $CXXFLAGS $debug -o "'$prog'" "'$compile'" $LDLIBS
+    $CXX $ARCHFLAGS $includes $CXXFLAGS $debug -o "$prog" "$compile" $LDLIBS || exit 1
 fi
 
 if test -n "$post"; then
@@ -337,11 +337,11 @@ EOF
 fi
 
 if test "$echo_cflags" = "yes"; then
-    echo $includes $CFLAGS
+    echo "$includes $CFLAGS" | sed -e 's/ -[DfgOW][^ ]*//g' -e 's/^ *//'
 fi
 
 if test "$echo_cxxflags" = "yes"; then
-    echo $includes $CXXFLAGS
+    echo "$includes $CXXFLAGS" | sed -e 's/ -[DfgOW][^ ]*//g' -e 's/^ *//'
 fi
 
 if test "$echo_optim" = "yes"; then
@@ -361,11 +361,11 @@ if test "$echo_ldflags" = "yes"; then
 	    fi
 	fi
     done
-    echo $libdirs $my_libs
+    echo " $libdirs $my_libs" | sed -e 's/ -W[^ ]*//g' -e 's/^ *//'
 fi
 
 if test "$echo_ldstaticflags" = "yes"; then
-    echo $LDSTATIC
+    echo " $LDSTATIC" | sed -e 's/ -W[^ ]*//g' -e 's/^ *//'
 fi
 
 if test "$echo_libs" = "yes"; then
--- fltk1.3-1.3.11.orig/fluid/Makefile
+++ fltk1.3-1.3.11/fluid/Makefile
@@ -89,8 +89,8 @@ install-linux:
 		fi; \
 		$(INSTALL_DATA) icons/fluid-$$size.png $(DESTDIR)/usr/share/icons/hicolor/$${size}x$${size}/apps/fluid.png; \
 	done
-	-$(INSTALL_DIR) $(DESTDIR)/usr/share/mimelnk/application
-	$(INSTALL_DATA) x-fluid.desktop  $(DESTDIR)/usr/share/mimelnk/application
+	-$(INSTALL_DIR) $(DESTDIR)/usr/share/mime/packages
+	$(INSTALL_DATA) fluid.xml $(DESTDIR)/usr/share/mime/packages
 
 install-osx:
 	echo Installing Fluid in $(DESTDIR)/Applications...
--- fltk1.3-1.3.11.orig/makeinclude.in
+++ fltk1.3-1.3.11/makeinclude.in
@@ -35,7 +35,7 @@ includedir	= @includedir@
 libdir		= @libdir@
 mandir		= @mandir@
 srcdir		= @srcdir@
-docdir		= $(datadir)/doc/fltk
+docdir		= $(datadir)/doc/fltk1.3-doc
 VPATH		= @srcdir@
 USEMMFILES	= @USEMMFILES@
 
@@ -145,7 +145,7 @@ INSTALL_DESKTOP	= @INSTALL_DESKTOP@
 UNINSTALL_DESKTOP = @UNINSTALL_DESKTOP@
 
 # Be quiet when building...
-.SILENT:
+#.SILENT:
 
 # Build commands and filename extensions...
 .SUFFIXES:	.0 .1 .3 .6 .c .cxx .mm .h .fl .man .o .z $(EXEEXT)
--- fltk1.3-1.3.11.orig/src/Makefile
+++ fltk1.3-1.3.11/src/Makefile
@@ -217,6 +217,9 @@ UTF8CFILES = \
 FLTKFLAGS = -DFL_LIBRARY
 include ../makeinclude
 
+CFLAGS   := $(CFLAGS:-fPIE=-fPIC)
+CXXFLAGS := $(CXXFLAGS:-fPIE=-fPIC)
+
 MMFILES = $(shell if test $(USEMMFILES) = Yes; then echo $(OBJCPPFILES); fi)
 
 OBJECTS =  $(MMFILES:.mm=.o) $(CPPFILES:.cxx=.o) $(CFILES:.c=.o) $(UTF8CFILES:.c=.o)
@@ -237,7 +240,7 @@ $(LIBNAME): $(OBJECTS)
 
 libfltk.so.$(FL_DSO_VERSION): $(OBJECTS)
 	echo $(DSOCOMMAND) $@ ...
-	$(DSOCOMMAND) $@ $(OBJECTS) $(LDLIBS)
+	$(DSOCOMMAND) $@ $(OBJECTS) $(LDLIBS) -lpthread
 	$(RM) libfltk.so
 	$(LN) libfltk.so.$(FL_DSO_VERSION) libfltk.so
 
--- fltk1.3-1.3.11.orig/test/Makefile
+++ fltk1.3-1.3.11/test/Makefile
@@ -16,6 +16,12 @@
 
 include ../makeinclude
 
+LINKFLTK      = -L../src -Wl,-rpath-link,../src -lfltk
+LINKFLTKFORMS = -L../src -Wl,-rpath-link,../src -lfltk_forms -lfltk
+LINKFLTKGL    = -L../src -Wl,-rpath-link,../src -lfltk_gl -lfltk
+LINKFLTKIMG   = -L../src -Wl,-rpath-link,../src -lfltk_images -lfltk
+LINKSHARED    = -L../src -Wl,-rpath-link,../src -lfltk_images -lfltk_forms -lfltk
+
 CPPFILES =\
 	adjuster.cxx \
 	animated.cxx \
