From 4ab21edfb10d0a910e24709aab9f3afff8a84ae7 Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date: Tue, 22 Dec 2015 22:29:20 +0100
Subject: [PATCH] configure: Allow to override the location of the *-config
 scripts.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: André Hentschel <nerv@dawncrow.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
---
 configure    | 28 ++++++++++++++--------------
 configure.ac | 20 ++++++++++----------
 2 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/configure b/configure
index a1b7247e2ab..4d513c25c60 100755
--- a/configure
+++ b/configure
@@ -10897,13 +10897,13 @@ then
   XML2_CFLAGS=`$PKG_CONFIG --cflags libxml-2.0 2>/dev/null`
 fi
 fi
-test "$cross_compiling" = yes || XML2_CFLAGS=${XML2_CFLAGS:-`xml2-config --cflags 2>/dev/null`}
+test "$cross_compiling" = yes || XML2_CFLAGS=${XML2_CFLAGS:-`${XML2_CONFIG:-xml2-config} --cflags 2>/dev/null`}
 if ${XML2_LIBS:+false} :; then :
   if ${PKG_CONFIG+:} false; then :
   XML2_LIBS=`$PKG_CONFIG --libs libxml-2.0 2>/dev/null`
 fi
 fi
-test "$cross_compiling" = yes || XML2_LIBS=${XML2_LIBS:-`xml2-config --libs 2>/dev/null`}
+test "$cross_compiling" = yes || XML2_LIBS=${XML2_LIBS:-`${XML2_CONFIG:-xml2-config} --libs 2>/dev/null`}
 XML2_LIBS=${XML2_LIBS:-"-lxml2"}
 $as_echo "$as_me:${as_lineno-$LINENO}: libxml-2.0 cflags: $XML2_CFLAGS" >&5
 $as_echo "$as_me:${as_lineno-$LINENO}: libxml-2.0 libs: $XML2_LIBS" >&5
@@ -11211,13 +11211,13 @@ then
   XSLT_CFLAGS=`$PKG_CONFIG --cflags libxslt 2>/dev/null`
 fi
 fi
-test "$cross_compiling" = yes || XSLT_CFLAGS=${XSLT_CFLAGS:-`xslt-config --cflags 2>/dev/null`}
+test "$cross_compiling" = yes || XSLT_CFLAGS=${XSLT_CFLAGS:-`${XSLT_CONFIG:-xslt-config} --cflags 2>/dev/null`}
 if ${XSLT_LIBS:+false} :; then :
   if ${PKG_CONFIG+:} false; then :
   XSLT_LIBS=`$PKG_CONFIG --libs libxslt 2>/dev/null`
 fi
 fi
-test "$cross_compiling" = yes || XSLT_LIBS=${XSLT_LIBS:-`xslt-config --libs 2>/dev/null`}
+test "$cross_compiling" = yes || XSLT_LIBS=${XSLT_LIBS:-`${XSLT_CONFIG:-xslt-config} --libs 2>/dev/null`}
 XSLT_LIBS=${XSLT_LIBS:-"-lxml2"}
 $as_echo "$as_me:${as_lineno-$LINENO}: libxslt cflags: $XSLT_CFLAGS" >&5
 $as_echo "$as_me:${as_lineno-$LINENO}: libxslt libs: $XSLT_LIBS" >&5
@@ -11749,13 +11749,13 @@ then
   SANE_CFLAGS=`$PKG_CONFIG --cflags libsane 2>/dev/null`
 fi
 fi
-test "$cross_compiling" = yes || SANE_CFLAGS=${SANE_CFLAGS:-`sane-config --cflags 2>/dev/null`}
+test "$cross_compiling" = yes || SANE_CFLAGS=${SANE_CFLAGS:-`${SANE_CONFIG:-sane-config} --cflags 2>/dev/null`}
 if ${SANE_LIBS:+false} :; then :
   if ${PKG_CONFIG+:} false; then :
   SANE_LIBS=`$PKG_CONFIG --libs libsane 2>/dev/null`
 fi
 fi
-test "$cross_compiling" = yes || SANE_LIBS=${SANE_LIBS:-`sane-config --ldflags 2>/dev/null`}
+test "$cross_compiling" = yes || SANE_LIBS=${SANE_LIBS:-`${SANE_CONFIG:-sane-config} --ldflags 2>/dev/null`}
 
 $as_echo "$as_me:${as_lineno-$LINENO}: libsane cflags: $SANE_CFLAGS" >&5
 $as_echo "$as_me:${as_lineno-$LINENO}: libsane libs: $SANE_LIBS" >&5
@@ -11907,13 +11907,13 @@ then
   GPHOTO2_CFLAGS=`$PKG_CONFIG --cflags libgphoto2 2>/dev/null`
 fi
 fi
-test "$cross_compiling" = yes || GPHOTO2_CFLAGS=${GPHOTO2_CFLAGS:-`gphoto2-config --cflags 2>/dev/null`}
+test "$cross_compiling" = yes || GPHOTO2_CFLAGS=${GPHOTO2_CFLAGS:-`${GPHOTO2_CONFIG:-gphoto2-config} --cflags 2>/dev/null`}
 if ${GPHOTO2_LIBS:+false} :; then :
   if ${PKG_CONFIG+:} false; then :
   GPHOTO2_LIBS=`$PKG_CONFIG --libs libgphoto2 2>/dev/null`
 fi
 fi
-test "$cross_compiling" = yes || GPHOTO2_LIBS=${GPHOTO2_LIBS:-`gphoto2-config --libs 2>/dev/null`}
+test "$cross_compiling" = yes || GPHOTO2_LIBS=${GPHOTO2_LIBS:-`${GPHOTO2_CONFIG:-gphoto2-config} --libs 2>/dev/null`}
 GPHOTO2_LIBS=${GPHOTO2_LIBS:-"-lgphoto2"}
 $as_echo "$as_me:${as_lineno-$LINENO}: libgphoto2 cflags: $GPHOTO2_CFLAGS" >&5
 $as_echo "$as_me:${as_lineno-$LINENO}: libgphoto2 libs: $GPHOTO2_LIBS" >&5
@@ -11979,13 +11979,13 @@ test -z "$GPHOTO2_LIBS" || GPHOTO2_LIBS=`echo " $GPHOTO2_LIBS" | sed 's/ -L\([^/
   GPHOTO2_PORT_CFLAGS=`$PKG_CONFIG --cflags libgphoto2_port 2>/dev/null`
 fi
 fi
-test "$cross_compiling" = yes || GPHOTO2_PORT_CFLAGS=${GPHOTO2_PORT_CFLAGS:-`gphoto2-port-config --cflags 2>/dev/null`}
+test "$cross_compiling" = yes || GPHOTO2_PORT_CFLAGS=${GPHOTO2_PORT_CFLAGS:-`${GPHOTO2_PORT_CONFIG:-gphoto2-port-config} --cflags 2>/dev/null`}
 if ${GPHOTO2_PORT_LIBS:+false} :; then :
   if ${PKG_CONFIG+:} false; then :
   GPHOTO2_PORT_LIBS=`$PKG_CONFIG --libs libgphoto2_port 2>/dev/null`
 fi
 fi
-test "$cross_compiling" = yes || GPHOTO2_PORT_LIBS=${GPHOTO2_PORT_LIBS:-`gphoto2-port-config --libs 2>/dev/null`}
+test "$cross_compiling" = yes || GPHOTO2_PORT_LIBS=${GPHOTO2_PORT_LIBS:-`${GPHOTO2_PORT_CONFIG:-gphoto2-port-config} --libs 2>/dev/null`}
 GPHOTO2_PORT_LIBS=${GPHOTO2_PORT_LIBS:-"-lgphoto2_port"}
 $as_echo "$as_me:${as_lineno-$LINENO}: libgphoto2_port cflags: $GPHOTO2_PORT_CFLAGS" >&5
 $as_echo "$as_me:${as_lineno-$LINENO}: libgphoto2_port libs: $GPHOTO2_PORT_LIBS" >&5
@@ -12220,13 +12220,13 @@ then
   FREETYPE_CFLAGS=`$PKG_CONFIG --cflags freetype2 2>/dev/null`
 fi
 fi
-test "$cross_compiling" = yes || FREETYPE_CFLAGS=${FREETYPE_CFLAGS:-`(freetype-config --cflags || freetype2-config --cflags) 2>/dev/null`}
+test "$cross_compiling" = yes || FREETYPE_CFLAGS=${FREETYPE_CFLAGS:-`(${FREETYPE_CONFIG:-freetype-config} --cflags || ${FREETYPE2_CONFIG:-freetype2-config} --cflags) 2>/dev/null`}
 if ${FREETYPE_LIBS:+false} :; then :
   if ${PKG_CONFIG+:} false; then :
   FREETYPE_LIBS=`$PKG_CONFIG --libs freetype2 2>/dev/null`
 fi
 fi
-test "$cross_compiling" = yes || FREETYPE_LIBS=${FREETYPE_LIBS:-`(freetype-config --libs || freetype2-config --libs) 2>/dev/null`}
+test "$cross_compiling" = yes || FREETYPE_LIBS=${FREETYPE_LIBS:-`(${FREETYPE_CONFIG:-freetype-config} --libs || ${FREETYPE2_CONFIG:-freetype2-config} --libs) 2>/dev/null`}
 FREETYPE_LIBS=${FREETYPE_LIBS:-"-lfreetype"}
 $as_echo "$as_me:${as_lineno-$LINENO}: freetype2 cflags: $FREETYPE_CFLAGS" >&5
 $as_echo "$as_me:${as_lineno-$LINENO}: freetype2 libs: $FREETYPE_LIBS" >&5
@@ -12953,8 +12953,8 @@ CUPS_CFLAGS=""
 if test "x$with_cups" != "xno"
 then
     ac_save_CPPFLAGS="$CPPFLAGS"
-    ac_cups_cflags=`cups-config --cflags 2>/dev/null`
-    ac_cups_libs=`cups-config --ldflags 2>/dev/null`
+    ac_cups_cflags=`${CUPS_CONFIG:-cups-config} --cflags 2>/dev/null`
+    ac_cups_libs=`${CUPS_CONFIG:-cups-config} --ldflags 2>/dev/null`
     CPPFLAGS="$CPPFLAGS $ac_cups_cflags"
     for ac_header in cups/cups.h
 do :
diff --git a/configure.ac b/configure.ac
index 01c481b214b..02eb1448ec4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1191,7 +1191,7 @@ dnl **** Check for libxml2 ****
 if test "x$with_xml" != "xno"
 then
     WINE_PACKAGE_FLAGS(XML2,[libxml-2.0],[-lxml2],
-                       [`xml2-config --cflags 2>/dev/null`],[`xml2-config --libs 2>/dev/null`],
+                       [`${XML2_CONFIG:-xml2-config} --cflags 2>/dev/null`],[`${XML2_CONFIG:-xml2-config} --libs 2>/dev/null`],
         [AC_CHECK_HEADERS([libxml/parser.h libxml/xmlsave.h libxml/SAX2.h])
         if test "$ac_cv_header_libxml_parser_h" = "yes" -a "$ac_cv_header_libxml_xmlsave_h" = "yes" -a "$ac_cv_header_libxml_SAX2_h" = "yes"
         then
@@ -1220,7 +1220,7 @@ WINE_WARNING_WITH(xml,[test "$ac_cv_lib_xml2_xmlParseMemory" != "yes"],
 if test "x$with_xslt" != "xno"
 then
     WINE_PACKAGE_FLAGS(XSLT,[libxslt],[-lxml2],
-                       [`xslt-config --cflags 2>/dev/null`],[`xslt-config --libs 2>/dev/null`],
+                       [`${XSLT_CONFIG:-xslt-config} --cflags 2>/dev/null`],[`${XSLT_CONFIG:-xslt-config} --libs 2>/dev/null`],
         [AC_CHECK_HEADERS([libxslt/pattern.h libxslt/transform.h],,,
         [#ifdef HAVE_LIBXSLT_PATTERN_H
 # include <libxslt/pattern.h>
@@ -1291,7 +1291,7 @@ WINE_NOTICE_WITH(curses,[test "x$ac_cv_lib_soname_curses$ac_cv_lib_soname_ncurse
 dnl **** Check for SANE ****
 if test "x$with_sane" != "xno"
 then
-    WINE_PACKAGE_FLAGS(SANE,[libsane],,[`sane-config --cflags 2>/dev/null`],[`sane-config --ldflags 2>/dev/null`],
+    WINE_PACKAGE_FLAGS(SANE,[libsane],,[`${SANE_CONFIG:-sane-config} --cflags 2>/dev/null`],[`${SANE_CONFIG:-sane-config} --ldflags 2>/dev/null`],
         [AC_CHECK_HEADER(sane/sane.h,
             [WINE_CHECK_SONAME(sane,sane_init,,[SANE_CFLAGS=""],[$SANE_LIBS])],
             [SANE_CFLAGS=""])])
@@ -1311,7 +1311,7 @@ dnl **** Check for libgphoto2 ****
 if test "x$with_gphoto" != "xno"
 then
     WINE_PACKAGE_FLAGS(GPHOTO2,[libgphoto2],[-lgphoto2],
-                       [`gphoto2-config --cflags 2>/dev/null`],[`gphoto2-config --libs 2>/dev/null`],
+                       [`${GPHOTO2_CONFIG:-gphoto2-config} --cflags 2>/dev/null`],[`${GPHOTO2_CONFIG:-gphoto2-config} --libs 2>/dev/null`],
         [AC_CHECK_HEADER(gphoto2-camera.h,
                         [AC_CHECK_LIB(gphoto2,gp_camera_new,
                                       [AC_DEFINE(HAVE_GPHOTO2, 1, [Define if we have the libgphoto2 development environment])],
@@ -1319,8 +1319,8 @@ then
                                       [$GPHOTO2_LIBS])],
                         [GPHOTO2_LIBS=""; GPHOTO2_CFLAGS=""])])
     WINE_PACKAGE_FLAGS(GPHOTO2_PORT,[libgphoto2_port],[-lgphoto2_port],
-                       [`gphoto2-port-config --cflags 2>/dev/null`],
-                       [`gphoto2-port-config --libs 2>/dev/null`],
+                       [`${GPHOTO2_PORT_CONFIG:-gphoto2-port-config} --cflags 2>/dev/null`],
+                       [`${GPHOTO2_PORT_CONFIG:-gphoto2-port-config} --libs 2>/dev/null`],
         [AC_CHECK_HEADER(gphoto2-port.h,
                         [AC_CHECK_LIB(gphoto2_port,gp_port_info_list_new,
                                       [AC_DEFINE(HAVE_GPHOTO2_PORT, 1, [Define if we have the libgphoto2_port development environment])],
@@ -1382,8 +1382,8 @@ dnl **** Check for FreeType 2 ****
 if test "x$with_freetype" != "xno"
 then
     WINE_PACKAGE_FLAGS(FREETYPE,[freetype2],[-lfreetype],
-                       [`(freetype-config --cflags || freetype2-config --cflags) 2>/dev/null`],
-                       [`(freetype-config --libs || freetype2-config --libs) 2>/dev/null`],
+                       [`(${FREETYPE_CONFIG:-freetype-config} --cflags || ${FREETYPE2_CONFIG:-freetype2-config} --cflags) 2>/dev/null`],
+                       [`(${FREETYPE_CONFIG:-freetype-config} --libs || ${FREETYPE2_CONFIG:-freetype2-config} --libs) 2>/dev/null`],
         [AC_CHECK_HEADERS([ft2build.h])
         if test "$ac_cv_header_ft2build_h" = "yes"
         then
@@ -1538,8 +1538,8 @@ AC_SUBST(CUPS_CFLAGS,"")
 if test "x$with_cups" != "xno"
 then
     ac_save_CPPFLAGS="$CPPFLAGS"
-    ac_cups_cflags=`cups-config --cflags 2>/dev/null`
-    ac_cups_libs=`cups-config --ldflags 2>/dev/null`
+    ac_cups_cflags=`${CUPS_CONFIG:-cups-config} --cflags 2>/dev/null`
+    ac_cups_libs=`${CUPS_CONFIG:-cups-config} --ldflags 2>/dev/null`
     CPPFLAGS="$CPPFLAGS $ac_cups_cflags"
     AC_CHECK_HEADERS(cups/cups.h,
             [WINE_CHECK_SONAME(cups,cupsGetDefault,
-- 
GitLab