Description: <short summary of the patch>
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 it.
 .
 gprolog (1.4.5-2) unstable; urgency=medium
 .
   * relocate all executables into /usr/lib/gprolog/bin/ and provide
     aliases via update-alternatives(1)
   * put includes in /usr/lib/gprolog/include/ and link back to
     /usr/include/gprolog/ (also via update-alternatives(1))
Author: Salvador Abreu <spa@debian.org>

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: 2016-12-06

--- gprolog-1.4.5.orig/src/EnginePl/gp_config.h.in
+++ gprolog-1.4.5/src/EnginePl/gp_config.h.in
@@ -277,6 +277,8 @@
 #define PROLOG_VERSION             any
 #define PROLOG_DATE                any
 #define PROLOG_COPYRIGHT           any
+#define PROLOG_BINDIR              any
+#define PROLOG_LIBDIR              any
 
 #define TOP_LEVEL                  any
 #define GPLC                       any
--- gprolog-1.4.5.orig/src/Makefile.in
+++ gprolog-1.4.5/src/Makefile.in
@@ -5,6 +5,9 @@ ROOT_DIR       = @ROOT_DIR@
 PKG_NAME       = @PKG_NAME@
 
 INSTALL_DIR    = $(DESTDIR)@INSTALL_DIR@
+INSTALL_LIB    = $(INSTALL_DIR)/lib/gprolog
+INSTALL_BIN    = $(INSTALL_LIB)/bin
+INSTALL_INC    = $(INSTALL_LIB)/include/gprolog
 LINKS_DIR      = $(DESTDIR)@LINKS_DIR@
 DOC_DIR        = $(DESTDIR)@DOC_DIR@
 HTML_DIR       = $(DESTDIR)@HTML_DIR@
--- gprolog-1.4.5.orig/src/TopComp/top_comp.c
+++ gprolog-1.4.5/src/TopComp/top_comp.c
@@ -923,7 +923,14 @@ Find_File(char *file, char *suff, char *
   sprintf(name, "%s%s", file, suff);
   if (!devel_mode)
     {
+#ifdef DEBIAN
+      sprintf(file_path, PROLOG_BINDIR "/%s", name);
+      if (access(file_path, F_OK) == 0)
+	return 1;
+      sprintf(file_path, PROLOG_LIBDIR "/%s", name);
+#else
       sprintf(file_path, "%s" DIR_SEP_S "lib" DIR_SEP_S "%s", start_path, name);
+#endif
       if (access(file_path, F_OK) == 0)
 	return 1;
     }
--- gprolog-1.4.5.orig/src/configure.in
+++ gprolog-1.4.5/src/configure.in
@@ -50,6 +50,8 @@ AC_SUBST(PROLOG_NAME)
 AC_SUBST(PROLOG_VERSION)
 AC_SUBST(PROLOG_DATE)
 AC_SUBST(PROLOG_COPYRIGHT)
+AC_SUBST(PROLOG_BINDIR)
+AC_SUBST(PROLOG_LIBDIR)
 
 AC_SUBST(TOP_LEVEL)
 AC_SUBST(GPLC)
@@ -750,6 +752,8 @@ AC_DEFINE_UNQUOTED(PROLOG_DIALECT,   "$P
 AC_DEFINE_UNQUOTED(PROLOG_VERSION,   "$PROLOG_VERSION")
 AC_DEFINE_UNQUOTED(PROLOG_DATE,      "$PROLOG_DATE")
 AC_DEFINE_UNQUOTED(PROLOG_COPYRIGHT, "$PROLOG_COPYRIGHT")
+AC_DEFINE_UNQUOTED(PROLOG_BINDIR,    "$bindir")
+AC_DEFINE_UNQUOTED(PROLOG_LIBDIR,    "$libdir")
 
 AC_DEFINE_UNQUOTED(TOP_LEVEL,        "$TOP_LEVEL")
 AC_DEFINE_UNQUOTED(GPLC,             "$GPLC")
