[PATCH weston 03/11] configure.ac: Correctly check for functions and libraries

Kristian Høgsberg hoegsberg at gmail.com
Mon Dec 16 16:58:55 PST 2013


On Sun, Dec 08, 2013 at 07:45:35PM +0100, Quentin Glidic wrote:
> From: Quentin Glidic <sardemff7+git at sardemff7.net>
> 
> AC_SEARCH_LIBS is preferred over AC_CHECK_FUNC and AC_CHECK_LIB
> 
> Signed-off-by: Quentin Glidic <sardemff7+git at sardemff7.net>
> ---
>  configure.ac | 37 +++++++++++++++++++++----------------
>  1 file changed, 21 insertions(+), 16 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 40ae145..c169311 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -41,9 +41,13 @@ AC_ARG_VAR([WESTON_SHELL_CLIENT],
>  
>  PKG_PROG_PKG_CONFIG()
>  
> -AC_CHECK_FUNC([dlopen], [],
> -              AC_CHECK_LIB([dl], [dlopen], DLOPEN_LIBS="-ldl"))
> -AC_SUBST(DLOPEN_LIBS)
> +AC_SEARCH_LIBS([dlopen], [dl])
> +case "$ac_cv_search_dlopen" in
> +	no) AC_MSG_ERROR([dlopen support required for Weston]) ;;
> +	"none required") ;;
> +	*) DLOPEN_LIBS="$ac_cv_search_dlopen" ;;
> +esac
> +AC_SUBST([DLOPEN_LIBS])
>  
>  AC_CHECK_DECL(SFD_CLOEXEC,[],
>  	      [AC_MSG_ERROR("SFD_CLOEXEC is needed to compile weston")],
> @@ -258,13 +262,13 @@ fi
>  AM_CONDITIONAL(ENABLE_VAAPI_RECORDER, test "x$have_libva" = xyes)
>  
>  
> -AC_CHECK_LIB([jpeg], [jpeg_CreateDecompress], have_jpeglib=yes)
> -if test x$have_jpeglib = xyes; then
> -  JPEG_LIBS="-ljpeg"
> -else
> -  AC_ERROR([libjpeg not found])
> -fi
> -AC_SUBST(JPEG_LIBS)
> +AC_SEARCH_LIBS([jpeg_CreateDecompress], [jpeg])
> +case "$ac_cv_search_pam_open_session" in

Typo here, should be $ac_cv_search_jpeg_CreateDecompress.

> +	no) AC_MSG_ERROR([libjpeg required but not found]) ;;
> +	"none required") ;;
> +	*) JPEG_LIBS="$ac_cv_search_jpeg_CreateDecompress" ;;
> +esac
> +AC_SUBST([JPEG_LIBS])
>  
>  PKG_CHECK_MODULES(CAIRO, [cairo])
>  
> @@ -334,12 +338,13 @@ AS_IF([test "x$have_systemd_login_209" = "xyes"],
>  AC_ARG_ENABLE(weston-launch, [  --enable-weston-launch],, enable_weston_launch=yes)
>  AM_CONDITIONAL(BUILD_WESTON_LAUNCH, test x$enable_weston_launch == xyes)
>  if test x$enable_weston_launch == xyes; then
> -  AC_CHECK_LIB([pam], [pam_open_session], [have_pam=yes], [have_pam=no])
> -  if test x$have_pam == xno; then
> -    AC_ERROR([weston-launch requires pam])
> -  fi
> -  PAM_LIBS=-lpam
> -  AC_SUBST(PAM_LIBS)
> +	AC_SEARCH_LIBS([pam_open_session], [pam])
> +	case "$ac_cv_search_pam_open_session" in
> +		no) AC_MSG_ERROR([pam support required for weston-launch]) ;;
> +		"none required") ;;
> +		*) PAM_LIBS="$ac_cv_search_pam_open_session" ;;
> +	esac
> +	AC_SUBST([PAM_LIBS])
>  fi
>  
>  if test x$enable_egl = xyes; then
> -- 
> 1.8.4.3
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list