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

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


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

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

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

---

 configure                   |  120 +++++++++----------------------------------
 configure.ac                |   27 +++-------
 dlls/gphoto2.ds/Makefile.in |    4 +-
 3 files changed, 33 insertions(+), 118 deletions(-)

diff --git a/configure b/configure
index f036eae..d4daacb 100755
--- a/configure
+++ b/configure
@@ -655,10 +655,8 @@ FREETYPELIBS
 ft_devel
 LCMSLIBS
 RESOLVLIBS
-GPHOTO2INCL
-GPHOTO2LIBS
-gphoto2port_devel
-gphoto2_devel
+GPHOTO2_LIBS
+GPHOTO2_CFLAGS
 SANE_LIBS
 SANE_CFLAGS
 GNUTLS_LIBS
@@ -874,7 +872,9 @@ HAL_LIBS
 GNUTLS_CFLAGS
 GNUTLS_LIBS
 SANE_CFLAGS
-SANE_LIBS'
+SANE_LIBS
+GPHOTO2_CFLAGS
+GPHOTO2_LIBS'
 
 
 # Initialize some variables set by options.
@@ -1575,6 +1575,10 @@ Some influential environment variables:
   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
+  GPHOTO2_CFLAGS
+              C compiler flags for libgphoto2, overriding pkg-config
+  GPHOTO2_LIBS
+              Linker flags for libgphoto2, 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.
@@ -10633,96 +10637,20 @@ fi
 if test "x$with_gphoto" != "xno"
 then
     ac_save_CPPFLAGS="$CPPFLAGS"
-    # Extract the first word of "gphoto2-config", so it can be a program name with args.
-set dummy gphoto2-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_gphoto2_devel+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$gphoto2_devel"; then
-  ac_cv_prog_gphoto2_devel="$gphoto2_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_gphoto2_devel="gphoto2-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 "$GPHOTO2_CFLAGS"; then :
 
-  test -z "$ac_cv_prog_gphoto2_devel" && ac_cv_prog_gphoto2_devel="no"
-fi
-fi
-gphoto2_devel=$ac_cv_prog_gphoto2_devel
-if test -n "$gphoto2_devel"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gphoto2_devel" >&5
-$as_echo "$gphoto2_devel" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+elif test -n "$PKG_CONFIG"; then :
+  GPHOTO2_CFLAGS=`$PKG_CONFIG --cflags libgphoto2 2>/dev/null`
 fi
+GPHOTO2_CFLAGS=${GPHOTO2_CFLAGS:-`(gphoto2-config --cflags || gphoto2-port-config --cflags) 2>/dev/null`}
+CPPFLAGS="$CPPFLAGS $GPHOTO2_CFLAGS"
+if test -n "$GPHOTO2_LIBS"; then :
 
-
-    # Extract the first word of "gphoto2-port-config", so it can be a program name with args.
-set dummy gphoto2-port-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_gphoto2port_devel+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$gphoto2port_devel"; then
-  ac_cv_prog_gphoto2port_devel="$gphoto2port_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_gphoto2port_devel="gphoto2-port-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
-
-  test -z "$ac_cv_prog_gphoto2port_devel" && ac_cv_prog_gphoto2port_devel="no"
-fi
-fi
-gphoto2port_devel=$ac_cv_prog_gphoto2port_devel
-if test -n "$gphoto2port_devel"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gphoto2port_devel" >&5
-$as_echo "$gphoto2port_devel" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+elif test -n "$PKG_CONFIG"; then :
+  GPHOTO2_LIBS=`$PKG_CONFIG --libs libgphoto2 2>/dev/null`
 fi
-
-
-    if test "$gphoto2_devel" != "no" -a "$gphoto2port_devel" != "no"
-    then
-        ac_gphoto2_incl="`$gphoto2_devel --cflags` `$gphoto2port_devel --cflags`"
-        ac_gphoto2_libs=""
-        for i in `$gphoto2_devel --libs` `$gphoto2port_devel --libs`
-        do
-            case "$i" in
-            -L/usr/lib|-L/usr/lib64) ;;
-            -L*|-l*) ac_gphoto2_libs="$ac_gphoto2_libs $i";;
-            esac
-        done
-        CPPFLAGS="$CPPFLAGS $ac_gphoto2_incl"
-    fi
-    ac_gphoto2_libs=${ac_gphoto2_libs:-"-lgphoto2"}
+GPHOTO2_LIBS=${GPHOTO2_LIBS:-`(gphoto2-config --libs || gphoto2-port-config --libs) 2>/dev/null`}
+GPHOTO2_LIBS=${GPHOTO2_LIBS:-"-lgphoto2"}
     ac_fn_c_check_header_mongrel "$LINENO" "gphoto2-camera.h" "ac_cv_header_gphoto2_camera_h" "$ac_includes_default"
 if test "x$ac_cv_header_gphoto2_camera_h" = xyes; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gp_camera_new in -lgphoto2" >&5
@@ -10731,7 +10659,7 @@ if ${ac_cv_lib_gphoto2_gp_camera_new+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lgphoto2 $ac_gphoto2_libs $LIBS"
+LIBS="-lgphoto2 $GPHOTO2_LIBS $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -10765,12 +10693,12 @@ if test "x$ac_cv_lib_gphoto2_gp_camera_new" = xyes; then :
 
 $as_echo "#define HAVE_GPHOTO2 1" >>confdefs.h
 
-                                   GPHOTO2LIBS="$ac_gphoto2_libs"
-
-                                   GPHOTO2INCL="$ac_gphoto2_incl"
-
+else
+  GPHOTO2_LIBS=""; GPHOTO2_CFLAGS=""
 fi
 
+else
+  GPHOTO2_LIBS=""; GPHOTO2_CFLAGS=""
 fi
 
 
diff --git a/configure.ac b/configure.ac
index 0df10a6..6d006d0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1399,28 +1399,15 @@ dnl **** Check for libgphoto2 ****
 if test "x$with_gphoto" != "xno"
 then
     ac_save_CPPFLAGS="$CPPFLAGS"
-    AC_CHECK_PROG(gphoto2_devel,gphoto2-config,gphoto2-config,no)
-    AC_CHECK_PROG(gphoto2port_devel,gphoto2-port-config,gphoto2-port-config,no)
-    if test "$gphoto2_devel" != "no" -a "$gphoto2port_devel" != "no"
-    then
-        ac_gphoto2_incl="`$gphoto2_devel --cflags` `$gphoto2port_devel --cflags`"
-        ac_gphoto2_libs=""
-        for i in `$gphoto2_devel --libs` `$gphoto2port_devel --libs`
-        do
-            case "$i" in
-            -L/usr/lib|-L/usr/lib64) ;;
-            -L*|-l*) ac_gphoto2_libs="$ac_gphoto2_libs $i";;
-            esac
-        done
-        CPPFLAGS="$CPPFLAGS $ac_gphoto2_incl"
-    fi
-    ac_gphoto2_libs=${ac_gphoto2_libs:-"-lgphoto2"}
+    WINE_PACKAGE_FLAGS(GPHOTO2,[libgphoto2],[-lgphoto2],
+                       [(gphoto2-config --cflags || gphoto2-port-config --cflags)],
+                       [(gphoto2-config --libs || gphoto2-port-config --libs)])
     AC_CHECK_HEADER(gphoto2-camera.h,
                     [AC_CHECK_LIB(gphoto2,gp_camera_new,
-                                  [AC_DEFINE(HAVE_GPHOTO2, 1, [Define if we have libgphoto2 development environment])
-                                   AC_SUBST(GPHOTO2LIBS,"$ac_gphoto2_libs")
-                                   AC_SUBST(GPHOTO2INCL,"$ac_gphoto2_incl")],,
-                                  [$ac_gphoto2_libs])])
+                                  [AC_DEFINE(HAVE_GPHOTO2, 1, [Define if we have libgphoto2 development environment])],
+                                  [GPHOTO2_LIBS=""; GPHOTO2_CFLAGS=""],
+                                  [$GPHOTO2_LIBS])],
+                    [GPHOTO2_LIBS=""; GPHOTO2_CFLAGS=""])
     CPPFLAGS="$ac_save_CPPFLAGS"
 fi
 WINE_NOTICE_WITH(gphoto,[test "$ac_cv_lib_gphoto2_gp_camera_new" != "yes"],
diff --git a/dlls/gphoto2.ds/Makefile.in b/dlls/gphoto2.ds/Makefile.in
index d7186e9..e77de86 100644
--- a/dlls/gphoto2.ds/Makefile.in
+++ b/dlls/gphoto2.ds/Makefile.in
@@ -1,7 +1,7 @@
 MODULE    = gphoto2.ds
 IMPORTS   = comctl32 user32 gdi32 advapi32
-EXTRALIBS = @GPHOTO2LIBS@
-EXTRAINCL = @GPHOTO2INCL@
+EXTRALIBS = @GPHOTO2_LIBS@
+EXTRAINCL = @GPHOTO2_CFLAGS@
 
 C_SRCS = \
 	capability.c \




More information about the wine-cvs mailing list