[PATCH v3 06/20] configure: Add support for udev

Sebastian Lackner sebastian at fds-team.de
Wed Sep 7 04:54:28 CDT 2016


On 02.09.2016 14:16, Aric Stewart wrote:
> Signed-off-by: Aric Stewart <aric at codeweavers.com>
> ---
>  configure           | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>  configure.ac        |  14 +++++++
>  include/config.h.in |   6 +++
>  3 files changed, 137 insertions(+)
> 
> 
> 
> v3-0006-configure-Add-support-for-udev.txt
> 
> 
> diff --git a/configure b/configure
> index 9808e11..3904a8b 100755
> --- a/configure
> +++ b/configure
> @@ -652,6 +652,8 @@ FONTCONFIG_CFLAGS
>  CUPS_CFLAGS
>  CAPI20_LIBS
>  CAPI20_CFLAGS
> +UDEV_LIBS
> +UDEV_CFLAGS
>  OSS4_CFLAGS
>  ALSA_LIBS
>  GSTREAMER_LIBS
> @@ -1589,6 +1591,8 @@ GSTREAMER_CFLAGS
>  GSTREAMER_LIBS
>  CAPI20_CFLAGS
>  CAPI20_LIBS
> +UDEV_LIBS
> +UDEV_CFLAGS
>  FONTCONFIG_CFLAGS
>  FONTCONFIG_LIBS
>  JPEG_CFLAGS
> @@ -2273,6 +2277,7 @@ Optional Packages:
>    --without-sane          do not use SANE (scanner support)
>    --without-tiff          do not use TIFF
>    --without-v4l           do not use v4l1 (v4l support)
> +  --without-udev          do not use udev
>    --without-xcomposite    do not use the Xcomposite extension
>    --without-xcursor       do not use the Xcursor extension
>    --without-xinerama      do not use Xinerama (multi-monitor support)
> @@ -2342,6 +2347,8 @@ Some influential environment variables:
>    CAPI20_CFLAGS
>                C compiler flags for capi20, overriding pkg-config
>    CAPI20_LIBS Linker flags for capi20, overriding pkg-config
> +  UDEV_CFLAGS C compiler flags for udev, overriding pkg-config
> +  UDEV_LIBS Linker flags for udev, overriding pkg-config
>    FONTCONFIG_CFLAGS
>                C compiler flags for fontconfig, overriding pkg-config
>    FONTCONFIG_LIBS
> @@ -3543,6 +3550,12 @@ if test "${with_tiff+set}" = set; then :
>  fi
>  
>  
> +# Check whether --with-udev was given.
> +if test "${with_udev+set}" = set; then :
> +  withval=$with_udev;
> +fi
> +
> +
>  # Check whether --with-v4l was given.
>  if test "${with_v4l+set}" = set; then :
>    withval=$with_v4l;
> @@ -12899,6 +12912,108 @@ esac
>  enable_wineoss_drv=${enable_wineoss_drv:-no}
>  fi
>  
> +if test "x$with_udev" != "xno"
> +then
> +    if ${UDEV_CFLAGS:+false} :; then :
> +  if ${PKG_CONFIG+:} false; then :
> +  UDEV_CFLAGS=`$PKG_CONFIG --cflags udev 2>/dev/null`
> +fi
> +fi
> +
> +if ${UDEV_LIBS:+false} :; then :
> +  if ${PKG_CONFIG+:} false; then :
> +  UDEV_LIBS=`$PKG_CONFIG --libs udev 2>/dev/null`
> +fi
> +fi
> +
> +
> +$as_echo "$as_me:${as_lineno-$LINENO}: udev cflags: $UDEV_CFLAGS" >&5
> +$as_echo "$as_me:${as_lineno-$LINENO}: udev libs: $UDEV_LIBS" >&5
> +ac_save_CPPFLAGS=$CPPFLAGS
> +CPPFLAGS="$CPPFLAGS $UDEV_CFLAGS"
> +for ac_header in libudev.h
> +do :
> +  ac_fn_c_check_header_mongrel "$LINENO" "libudev.h" "ac_cv_header_libudev_h" "$ac_includes_default"
> +if test "x$ac_cv_header_libudev_h" = xyes; then :
> +  cat >>confdefs.h <<_ACEOF
> +#define HAVE_LIBUDEV_H 1
> +_ACEOF
> +
> +fi
> +
> +done
> +
> +    if test "$ac_cv_header_libudev_h" = "yes" -a "$ac_cv_header_libudev_h" = "yes"
> +    then
> +	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -ludev" >&5
> +$as_echo_n "checking for -ludev... " >&6; }
> +if ${ac_cv_lib_soname_udev+:} false; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +  ac_check_soname_save_LIBS=$LIBS
> +LIBS="-ludev  $LIBS"
> +  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h.  */
> +
> +/* Override any GCC internal prototype to avoid an error.
> +   Use char because int might match the return type of a GCC
> +   builtin and then its argument prototype would still apply.  */
> +#ifdef __cplusplus
> +extern "C"
> +#endif
> +char udev_new ();
> +int
> +main ()
> +{
> +return udev_new ();
> +  ;
> +  return 0;
> +}
> +_ACEOF
> +if ac_fn_c_try_link "$LINENO"; then :
> +  case "$LIBEXT" in
> +    dll) ac_cv_lib_soname_udev=`$ac_cv_path_LDD conftest.exe | grep "udev" | sed -e "s/dll.*/dll/"';2,$d'` ;;
> +    dylib) ac_cv_lib_soname_udev=`$OTOOL -L conftest$ac_exeext | grep "libudev\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libudev\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;;
> +    *) ac_cv_lib_soname_udev=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libudev\\.$LIBEXT" | sed -e "s/^.*\\[\\(libudev\\.$LIBEXT[^	 ]*\\)\\].*$/\1/"';2,$d'`
> +       if ${ac_cv_lib_soname_udev:+false} :; then :
> +  ac_cv_lib_soname_udev=`$LDD conftest$ac_exeext | grep "libudev\\.$LIBEXT" | sed -e "s/^.*\(libudev\.$LIBEXT[^	 ]*\).*$/\1/"';2,$d'`
> +fi ;;
> +  esac
> +fi
> +rm -f core conftest.err conftest.$ac_objext \
> +    conftest$ac_exeext conftest.$ac_ext
> +  LIBS=$ac_check_soname_save_LIBS
> +fi
> +if ${ac_cv_lib_soname_udev:+false} :; then :
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
> +$as_echo "not found" >&6; }
> +
> +else
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_udev" >&5
> +$as_echo "$ac_cv_lib_soname_udev" >&6; }
> +
> +cat >>confdefs.h <<_ACEOF
> +#define SONAME_LIBUDEV "$ac_cv_lib_soname_udev"
> +_ACEOF
> +
> +       UDEV_LIBS="-ludev"
> +
> +fi
> +    fi
> +CPPFLAGS=$ac_save_CPPFLAGS
> +test -z "$UDEV_CFLAGS" || UDEV_CFLAGS=`echo " $UDEV_CFLAGS" | sed 's/ -I\([^/]\)/ -I\$(top_builddir)\/\1/g'`
> +test -z "$UDEV_LIBS" || UDEV_LIBS=`echo " $UDEV_LIBS" | sed 's/ -L\([^/]\)/ -L\$(top_builddir)\/\1/g'`
> +
> +fi
> +if test "x$ac_cv_lib_soname_udev" = "x"; then :
> +  case "x$with_udev" in
> +  x)   as_fn_append wine_notices "|libudev ${notice_platform}development files not found, hidraw HID will not be supported." ;;
> +  xno) ;;
> +  *)   as_fn_error $? "libudev ${notice_platform}development files not found, hidraw HID will not be supported.
> +This is an error since --with-udev was requested." "$LINENO" 5 ;;
> +esac
> +fi
> +
>  if test "x$with_capi" != "xno"
>  then
>      if ${CAPI20_CFLAGS:+false} :; then :
> @@ -17349,6 +17464,8 @@ ALSA_LIBS = $ALSA_LIBS
>  OSS4_CFLAGS = $OSS4_CFLAGS
>  CAPI20_CFLAGS = $CAPI20_CFLAGS
>  CAPI20_LIBS = $CAPI20_LIBS
> +UDEV_CFLAGS = $UDEV_CFLAGS
> +UDEV_LIBS = $UDEV_LIBS
>  CUPS_CFLAGS = $CUPS_CFLAGS
>  FONTCONFIG_CFLAGS = $FONTCONFIG_CFLAGS
>  FONTCONFIG_LIBS = $FONTCONFIG_LIBS
> diff --git a/configure.ac b/configure.ac
> index f02ab98..524777d 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -103,6 +103,7 @@ AC_ARG_WITH(zlib,      AS_HELP_STRING([--without-zlib],[do not use Zlib (data co
>  
>  AC_ARG_WITH(wine-tools,AS_HELP_STRING([--with-wine-tools=DIR],[use Wine tools from directory DIR]))
>  AC_ARG_WITH(wine64,    AS_HELP_STRING([--with-wine64=DIR],[use the 64-bit Wine in DIR for a Wow64 build]))
> +AC_ARG_WITH(udev,      AS_HELP_STRING([--without-udev],[do not use udev]))

This list is sorted alphabetically.

>  
>  AC_CANONICAL_HOST
>  
> @@ -1519,6 +1520,19 @@ WINE_NOTICE_WITH(oss,[test "x$ac_cv_member_oss_sysinfo_numaudioengines" != xyes]
>                   [OSS sound system found but too old (OSSv4 needed), OSS won't be supported.],
>                   [enable_wineoss_drv])
>  
> +dnl **** Check for libudev****

There is a space missing before the "****".

> +if test "x$with_udev" != "xno"
> +then
> +    WINE_PACKAGE_FLAGS(UDEV,[udev],,,,
> +    [AC_CHECK_HEADERS([libudev.h])
> +    if test "$ac_cv_header_libudev_h" = "yes" -a "$ac_cv_header_libudev_h" = "yes"
> +    then
> +        WINE_CHECK_SONAME(udev,udev_new,AC_SUBST(UDEV_LIBS,"-ludev"),,[$UDEV_LIBS])

Do we want to link directly against udev or load it at runtime (wine_dlopen)?
For direct linking it would be better to use AC_CHECK_LIB to match the existing
configure.ac code (the only exception I've found is OpenAL). For loading at
runtime there is no need to define UDEV_LIBS.

> +    fi])
> +fi
> +WINE_NOTICE_WITH(udev,[test "x$ac_cv_lib_soname_udev" = "x"],
> +                 [libudev ${notice_platform}development files not found, hidraw HID not supported.])
> +
>  dnl **** Check for capi4linux ****
>  if test "x$with_capi" != "xno"
>  then
> diff --git a/include/config.h.in b/include/config.h.in
> index 382beb6..b9f9f19 100644
> --- a/include/config.h.in
> +++ b/include/config.h.in
> @@ -378,6 +378,9 @@
>  /* Define to 1 if you have the <libproc.h> header file. */
>  #undef HAVE_LIBPROC_H
>  
> +/* Define to 1 if you have the <libudev.h> header file. */
> +#undef HAVE_LIBUDEV_H
> +
>  /* Define to 1 if you have the <libunwind.h> header file. */
>  #undef HAVE_LIBUNWIND_H
>  
> @@ -1466,6 +1469,9 @@
>  /* Define to the soname of the libXxf86vm library. */
>  #undef SONAME_LIBXXF86VM
>  
> +/* Define to the soname of the libudev library. */
> +#undef SONAME_LIBUDEV
> +
>  /* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
>  #undef STAT_MACROS_BROKEN
>  
> 
> 
> 




More information about the wine-devel mailing list