Alexandre Julliard : configure: Use the pkg-config helper macro for sane.

Alexandre Julliard julliard at winehq.org
Fri May 3 15:24:50 CDT 2013


Module: wine
Branch: master
Commit: ad6ee47defba6dad4ca490c11af1848bbc90cc11
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ad6ee47defba6dad4ca490c11af1848bbc90cc11

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri May  3 17:03:29 2013 +0200

configure: Use the pkg-config helper macro for sane.

---

 configure                |   66 ++++++++++++++--------------------------------
 configure.ac             |   11 ++-----
 dlls/sane.ds/Makefile.in |    2 +-
 3 files changed, 24 insertions(+), 55 deletions(-)

diff --git a/configure b/configure
index 98c3869..f036eae 100755
--- a/configure
+++ b/configure
@@ -659,8 +659,8 @@ GPHOTO2INCL
 GPHOTO2LIBS
 gphoto2port_devel
 gphoto2_devel
-SANEINCL
-sane_devel
+SANE_LIBS
+SANE_CFLAGS
 GNUTLS_LIBS
 GNUTLS_CFLAGS
 HAL_LIBS
@@ -872,7 +872,9 @@ DBUS_LIBS
 HAL_CFLAGS
 HAL_LIBS
 GNUTLS_CFLAGS
-GNUTLS_LIBS'
+GNUTLS_LIBS
+SANE_CFLAGS
+SANE_LIBS'
 
 
 # Initialize some variables set by options.
@@ -1571,6 +1573,8 @@ Some influential environment variables:
   GNUTLS_CFLAGS
               C compiler flags for gnutls, overriding pkg-config
   GNUTLS_LIBS Linker flags for gnutls, overriding pkg-config
+  SANE_CFLAGS C compiler flags for libsane, overriding pkg-config
+  SANE_LIBS   Linker flags for libsane, overriding pkg-config
 
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
@@ -10477,50 +10481,20 @@ fi
 if test "x$with_sane" != "xno"
 then
     ac_save_CPPFLAGS="$CPPFLAGS"
-    # Extract the first word of "sane-config", so it can be a program name with args.
-set dummy sane-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_prog_sane_devel+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$sane_devel"; then
-  ac_cv_prog_sane_devel="$sane_devel" # Let the user override the test.
-else
-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_prog_sane_devel="sane-config"
-    $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
+    if test -n "$SANE_CFLAGS"; then :
 
-  test -z "$ac_cv_prog_sane_devel" && ac_cv_prog_sane_devel="no"
-fi
-fi
-sane_devel=$ac_cv_prog_sane_devel
-if test -n "$sane_devel"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $sane_devel" >&5
-$as_echo "$sane_devel" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+elif test -n "$PKG_CONFIG"; then :
+  SANE_CFLAGS=`$PKG_CONFIG --cflags libsane 2>/dev/null`
 fi
+SANE_CFLAGS=${SANE_CFLAGS:-`sane-config --cflags 2>/dev/null`}
+CPPFLAGS="$CPPFLAGS $SANE_CFLAGS"
+if test -n "$SANE_LIBS"; then :
 
+elif test -n "$PKG_CONFIG"; then :
+  SANE_LIBS=`$PKG_CONFIG --libs libsane 2>/dev/null`
+fi
+SANE_LIBS=${SANE_LIBS:-`sane-config --ldflags 2>/dev/null`}
 
-    if test "$sane_devel" != "no"
-    then
-        ac_sane_incl="`$sane_devel --cflags`"
-        ac_sane_libs="`$sane_devel --ldflags`"
-        CPPFLAGS="$CPPFLAGS $ac_sane_incl"
-    fi
     ac_fn_c_check_header_mongrel "$LINENO" "sane/sane.h" "ac_cv_header_sane_sane_h" "$ac_includes_default"
 if test "x$ac_cv_header_sane_sane_h" = xyes; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -lsane" >&5
@@ -10529,7 +10503,7 @@ if ${ac_cv_lib_soname_sane+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_soname_save_LIBS=$LIBS
-LIBS="-lsane $ac_sane_libs $LIBS"
+LIBS="-lsane $SANE_LIBS $LIBS"
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -10565,7 +10539,7 @@ fi
 if test "x$ac_cv_lib_soname_sane" = "x"; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
 $as_echo "not found" >&6; }
-
+       SANE_CFLAGS=""
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_sane" >&5
 $as_echo "$ac_cv_lib_soname_sane" >&6; }
@@ -10574,9 +10548,9 @@ cat >>confdefs.h <<_ACEOF
 #define SONAME_LIBSANE "$ac_cv_lib_soname_sane"
 _ACEOF
 
-       SANEINCL="$ac_sane_incl"
 
 fi
+        SANE_CFLAGS=""
 fi
 
 
diff --git a/configure.ac b/configure.ac
index 05593dc..0df10a6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1378,15 +1378,10 @@ dnl **** Check for SANE ****
 if test "x$with_sane" != "xno"
 then
     ac_save_CPPFLAGS="$CPPFLAGS"
-    AC_CHECK_PROG(sane_devel,sane-config,sane-config,no)
-    if test "$sane_devel" != "no"
-    then
-        ac_sane_incl="`$sane_devel --cflags`"
-        ac_sane_libs="`$sane_devel --ldflags`"
-        CPPFLAGS="$CPPFLAGS $ac_sane_incl"
-    fi
+    WINE_PACKAGE_FLAGS(SANE,[libsane],,[sane-config --cflags],[sane-config --ldflags])
     AC_CHECK_HEADER(sane/sane.h,
-        [WINE_CHECK_SONAME(sane,sane_init,[AC_SUBST(SANEINCL,"$ac_sane_incl")],,[$ac_sane_libs])])
+        [WINE_CHECK_SONAME(sane,sane_init,,[SANE_CFLAGS=""],[$SANE_LIBS])]
+        [SANE_CFLAGS=""])
     CPPFLAGS="$ac_save_CPPFLAGS"
 fi
 WINE_NOTICE_WITH(sane,[test "x$ac_cv_lib_soname_sane" = "x"],
diff --git a/dlls/sane.ds/Makefile.in b/dlls/sane.ds/Makefile.in
index 20be6ea..64c49db 100644
--- a/dlls/sane.ds/Makefile.in
+++ b/dlls/sane.ds/Makefile.in
@@ -1,6 +1,6 @@
 MODULE    = sane.ds
 IMPORTS   = comctl32 user32 gdi32
-EXTRAINCL = @SANEINCL@
+EXTRAINCL = @SANE_CFLAGS@
 
 C_SRCS = \
 	capability.c \




More information about the wine-cvs mailing list