Blame ld10k1/ld10k1.m4

Packit Service b98cfc
dnl Configure Paths for ld10k1 - stolen from ASLA (1.0.5a)
Packit Service b98cfc
dnl Configure Paths for Alsa
Packit Service b98cfc
dnl Some modifications by Richard Boulton <richard-alsa@tartarus.org>
Packit Service b98cfc
dnl Christopher Lansdown <lansdoct@cs.alfred.edu>
Packit Service b98cfc
dnl Jaroslav Kysela <perex@perex.cz>
Packit Service b98cfc
dnl AM_PATH_LD10K1([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
Packit Service b98cfc
dnl Test for liblo10k1, and define LD10K1_CFLAGS and LD10K1_LIBS as appropriate.
Packit Service b98cfc
dnl enables arguments --with-ld10k1-prefix=
Packit Service b98cfc
dnl                   --with-ld10k1-enc-prefix=
Packit Service b98cfc
dnl                   --disable-ld10k1test
Packit Service b98cfc
dnl
Packit Service b98cfc
dnl For backwards compatibility, if ACTION_IF_NOT_FOUND is not specified,
Packit Service b98cfc
dnl and the ld10k1 libraries are not found, a fatal AC_MSG_ERROR() will result.
Packit Service b98cfc
dnl
Packit Service b98cfc
AC_DEFUN([AM_PATH_LD10K1],
Packit Service b98cfc
[dnl Save the original CFLAGS, LDFLAGS, and LIBS
Packit Service b98cfc
ld10k1_save_CFLAGS="$CFLAGS"
Packit Service b98cfc
ld10k1_save_LDFLAGS="$LDFLAGS"
Packit Service b98cfc
ld10k1_save_LIBS="$LIBS"
Packit Service b98cfc
ld10k1_found=yes
Packit Service b98cfc
Packit Service b98cfc
dnl
Packit Service b98cfc
dnl Get the cflags and libraries for ld10k1
Packit Service b98cfc
dnl
Packit Service b98cfc
AC_ARG_WITH(ld10k1-prefix,
Packit Service b98cfc
[  --with-ld10k1-prefix=PFX  Prefix where ld10k1 library is installed(optional)],
Packit Service b98cfc
[ld10k1_prefix="$withval"], [ld10k1_prefix=""])
Packit Service b98cfc
Packit Service b98cfc
AC_ARG_WITH(ld10k1-inc-prefix,
Packit Service b98cfc
[  --with-ld10k1-inc-prefix=PFX  Prefix where include libraries are (optional)],
Packit Service b98cfc
[ld10k1_inc_prefix="$withval"], [ld10k1_inc_prefix=""])
Packit Service b98cfc
Packit Service b98cfc
dnl FIXME: this is not yet implemented
Packit Service b98cfc
AC_ARG_ENABLE(ld10k1test,
Packit Service b98cfc
[  --disable-ld10k1test      Do not try to compile and run a test ld10k1 program],
Packit Service b98cfc
[enable_ld10k1test="$enableval"],
Packit Service b98cfc
[enable_ld10k1test=yes])
Packit Service b98cfc
Packit Service b98cfc
dnl Add any special include directories
Packit Service b98cfc
AC_MSG_CHECKING(for ld10k1 CFLAGS)
Packit Service b98cfc
if test "$ld10k1_inc_prefix" != "" ; then
Packit Service b98cfc
	LD10K1_CFLAGS="$LD10K1_CFLAGS -I$ld10k1_inc_prefix"
Packit Service b98cfc
	CFLAGS="$CFLAGS -I$ld10k1_inc_prefix"
Packit Service b98cfc
fi
Packit Service b98cfc
AC_MSG_RESULT($LD10K1_CFLAGS)
Packit Service b98cfc
Packit Service b98cfc
dnl add any special lib dirs
Packit Service b98cfc
AC_MSG_CHECKING(for ld10l1 LDFLAGS)
Packit Service b98cfc
if test "$ld10k1_prefix" != "" ; then
Packit Service b98cfc
	LD10K1_LIBS="$LD10K1_LIBS -L$ld10k1_prefix"
Packit Service b98cfc
	LDFLAGS="$LDFLAGS $LD10K1_LIBS"
Packit Service b98cfc
fi
Packit Service b98cfc
Packit Service b98cfc
dnl add the ld10k1 library
Packit Service b98cfc
LD10K1_LIBS="$LD10K1_LIBS -llo10k1"
Packit Service b98cfc
dnl LIBS=`echo $LIBS | sed 's/-lm//'`
Packit Service b98cfc
dnl LIBS=`echo $LIBS | sed 's/-ldl//'`
Packit Service b98cfc
dnl LIBS=`echo $LIBS | sed 's/-lpthread//'`
Packit Service b98cfc
LIBS=`echo $LIBS | sed 's/  //'`
Packit Service b98cfc
LIBS="$LD10K1_LIBS $LIBS"
Packit Service b98cfc
AC_MSG_RESULT($LD10K1_LIBS)
Packit Service b98cfc
Packit Service b98cfc
dnl Check for a working version of liblo10k1 that is of the right version.
Packit Service b98cfc
min_ld10k1_version=ifelse([$1], ,0.1.5,$1)
Packit Service b98cfc
AC_MSG_CHECKING(for liblo10k1 headers version >= $min_ld10k1_version)
Packit Service b98cfc
no_ld10k1=""
Packit Service b98cfc
    ld10k1_min_major_version=`echo $min_ld10k1_version | \
Packit Service b98cfc
           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
Packit Service b98cfc
    ld10k1_min_minor_version=`echo $min_ld10k1_version | \
Packit Service b98cfc
           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
Packit Service b98cfc
    ld10k1_min_micro_version=`echo $min_ld10k1_version | \
Packit Service b98cfc
           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
Packit Service b98cfc
Packit Service b98cfc
AC_LANG_SAVE
Packit Service b98cfc
AC_LANG_C
Packit Service b98cfc
AC_TRY_COMPILE([
Packit Service b98cfc
#include <lo10k1/lo10k1.h>
Packit Service b98cfc
], [
Packit Service b98cfc
/* ensure backward compatibility */
Packit Service b98cfc
#  if(LD10K1_LIB_MAJOR > $ld10k1_min_major_version)
Packit Service b98cfc
  exit(0);
Packit Service b98cfc
#  else
Packit Service b98cfc
#    if(LD10K1_LIB_MAJOR < $ld10k1_min_major_version)
Packit Service b98cfc
#       error not present
Packit Service b98cfc
#    endif
Packit Service b98cfc
Packit Service b98cfc
#   if(LD10K1_LIB_MINOR > $ld10k1_min_minor_version)
Packit Service b98cfc
  exit(0);
Packit Service b98cfc
#   else
Packit Service b98cfc
#     if(LD10K1_LIB_MINOR < $ld10k1_min_minor_version)
Packit Service b98cfc
#          error not present
Packit Service b98cfc
#      endif
Packit Service b98cfc
Packit Service b98cfc
#      if(LD10K1_LIB_SUBMINOR < $ld10k1_min_micro_version)
Packit Service b98cfc
#        error not present
Packit Service b98cfc
#      endif
Packit Service b98cfc
#    endif
Packit Service b98cfc
#  endif
Packit Service b98cfc
exit(0);
Packit Service b98cfc
],
Packit Service b98cfc
  [AC_MSG_RESULT(found.)],
Packit Service b98cfc
  [AC_MSG_RESULT(not present.)
Packit Service b98cfc
   ifelse([$3], , [AC_MSG_ERROR(Sufficiently new version of liblo10k1 not found.)])
Packit Service b98cfc
   ld10k1_found=no]
Packit Service b98cfc
)
Packit Service b98cfc
AC_LANG_RESTORE
Packit Service b98cfc
Packit Service b98cfc
dnl Now that we know that we have the right version, let's see if we have the library and not just the headers.
Packit Service b98cfc
if test "x$enable_ld10k1test" = "xyes"; then
Packit Service b98cfc
AC_CHECK_LIB([lo10k1], [liblo10k1_connection_init],,
Packit Service b98cfc
	[ifelse([$3], , [AC_MSG_ERROR(No linkable liblo10k1 was found.)])
Packit Service b98cfc
	 ld10k1_found=no]
Packit Service b98cfc
)
Packit Service b98cfc
fi
Packit Service b98cfc
Packit Service b98cfc
if test "x$ld10k1_found" = "xyes" ; then
Packit Service b98cfc
   ifelse([$2], , :, [$2])
Packit Service b98cfc
   LIBS=`echo $LIBS | sed 's/-llo10k1//g'`
Packit Service b98cfc
   LIBS=`echo $LIBS | sed 's/  //'`
Packit Service b98cfc
   LIBS="-llo10k1 $LIBS"
Packit Service b98cfc
fi
Packit Service b98cfc
if test "x$ld10k1_found" = "xno" ; then
Packit Service b98cfc
   ifelse([$3], , :, [$3])
Packit Service b98cfc
   CFLAGS="$ld10k1_save_CFLAGS"
Packit Service b98cfc
   LDFLAGS="$ld10k1_save_LDFLAGS"
Packit Service b98cfc
   LIBS="$ld10k1_save_LIBS"
Packit Service b98cfc
   LD10K1_CFLAGS=""
Packit Service b98cfc
   LD10K1_LIBS=""
Packit Service b98cfc
fi
Packit Service b98cfc
Packit Service b98cfc
dnl That should be it.  Now just export out symbols:
Packit Service b98cfc
AC_SUBST(LD10K1_CFLAGS)
Packit Service b98cfc
AC_SUBST(LD10K1_LIBS)
Packit Service b98cfc
])
Packit Service b98cfc