2002-05-28 21:33:10 +00:00
|
|
|
dnl Configure Paths for Hamlib
|
|
|
|
dnl Cloned from Alsa project http://www.alsa-project.org
|
|
|
|
dnl AM_PATH_HAMLIB([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
|
2020-05-30 23:30:29 +00:00
|
|
|
dnl Test for libhamlib, and define HAMLIB_LTDL,
|
2002-05-28 21:33:10 +00:00
|
|
|
dnl HAMLIB_CFLAGS and HAMLIB_LIBS as appropriate.
|
|
|
|
dnl enables arguments --with-hamlib-prefix=
|
|
|
|
dnl --with-hamlib-inc-prefix=
|
|
|
|
dnl --disable-hamlibtest (this has no effect, as yet)
|
2001-08-08 21:40:51 +00:00
|
|
|
dnl
|
2002-05-28 21:33:10 +00:00
|
|
|
dnl For backwards compatibility, if ACTION_IF_NOT_FOUND is not specified,
|
|
|
|
dnl and the hamlib libraries are not found, a fatal AC_MSG_ERROR() will result.
|
2001-08-08 21:40:51 +00:00
|
|
|
dnl
|
2005-09-28 21:07:59 +00:00
|
|
|
AC_DEFUN([AM_PATH_HAMLIB],
|
2002-05-28 21:33:10 +00:00
|
|
|
[dnl Save the original CFLAGS, LDFLAGS, and LIBS
|
|
|
|
hamlib_save_CFLAGS="$CFLAGS"
|
|
|
|
hamlib_save_LDFLAGS="$LDFLAGS"
|
|
|
|
hamlib_save_LIBS="$LIBS"
|
|
|
|
hamlib_found=yes
|
2001-08-08 21:40:51 +00:00
|
|
|
|
|
|
|
dnl
|
2002-05-28 21:33:10 +00:00
|
|
|
dnl Get the cflags and libraries for hamlib
|
2001-08-08 21:40:51 +00:00
|
|
|
dnl
|
2002-05-28 21:33:10 +00:00
|
|
|
AC_ARG_WITH(hamlib-prefix,
|
|
|
|
[ --with-hamlib-prefix=PFX Prefix where Hamlib library is installed(optional)],
|
|
|
|
[hamlib_prefix="$withval"], [hamlib_prefix=""])
|
|
|
|
|
|
|
|
AC_ARG_WITH(hamlib-inc-prefix,
|
|
|
|
[ --with-hamlib-inc-prefix=PFX Prefix where include libraries are (optional)],
|
|
|
|
[hamlib_inc_prefix="$withval"], [hamlib_inc_prefix=""])
|
|
|
|
|
|
|
|
dnl FIXME: this is not yet implemented
|
|
|
|
AC_ARG_ENABLE(hamlibtest,
|
|
|
|
[ --disable-hamlibtest Do not try to compile and run a test Hamlib program],
|
|
|
|
[enable_hamlibtest=no],
|
|
|
|
[enable_hamlibtest=yes])
|
|
|
|
|
|
|
|
dnl Add any special include directories
|
|
|
|
AC_MSG_CHECKING(for HAMLIB CFLAGS)
|
|
|
|
if test "$hamlib_inc_prefix" != "" ; then
|
|
|
|
HAMLIB_CFLAGS="$HAMLIB_CFLAGS -I$hamlib_inc_prefix"
|
|
|
|
CFLAGS="$CFLAGS -I$hamlib_inc_prefix"
|
2001-08-08 21:40:51 +00:00
|
|
|
fi
|
2002-05-28 21:33:10 +00:00
|
|
|
AC_MSG_RESULT($HAMLIB_CFLAGS)
|
2001-08-08 21:40:51 +00:00
|
|
|
|
2002-05-28 21:33:10 +00:00
|
|
|
dnl add any special lib dirs
|
|
|
|
AC_MSG_CHECKING(for HAMLIB LDFLAGS)
|
|
|
|
if test "$hamlib_prefix" != "" ; then
|
|
|
|
HAMLIB_LIBS="$HAMLIB_LIBS -L$hamlib_prefix -Wl,--rpath -Wl,$hamlib_prefix"
|
|
|
|
LDFLAGS="$LDFLAGS $HAMLIB_LIBS"
|
2001-08-08 21:40:51 +00:00
|
|
|
fi
|
|
|
|
|
2002-05-28 21:33:10 +00:00
|
|
|
dnl add the hamlib library
|
|
|
|
HAMLIB_LIBS="$HAMLIB_LIBS -lhamlib -lm -ldl"
|
2020-05-30 23:30:29 +00:00
|
|
|
LIBS=$(echo $LIBS | sed 's/-lm//')
|
|
|
|
LIBS=$(echo $LIBS | sed 's/-ldl//')
|
|
|
|
LIBS=$(echo $LIBS | sed 's/ //')
|
2002-05-28 21:33:10 +00:00
|
|
|
#LIBS="$HAMLIB_LIBS $LIBS"
|
|
|
|
AC_MSG_RESULT($HAMLIB_LIBS)
|
|
|
|
|
|
|
|
dnl add any special LTDL file
|
|
|
|
AC_MSG_CHECKING(for HAMLIB LTDL)
|
|
|
|
if test "$hamlib_prefix" != "" ; then
|
|
|
|
HAMLIB_LTDL="$HAMLIB_LTDL $hamlib_prefix/libhamlib.la"
|
2001-08-08 21:40:51 +00:00
|
|
|
fi
|
2002-05-28 21:33:10 +00:00
|
|
|
AC_MSG_RESULT($HAMLIB_LTDL)
|
|
|
|
|
|
|
|
dnl Check for a working version of libhamlib that is of the right version.
|
|
|
|
dnl FIXME: not implemented yet!
|
|
|
|
|
|
|
|
dnl Now that we know that we have the right version, let's see if we have the library and not just the headers.
|
|
|
|
#AC_CHECK_LIB([hamlib], [rig_init],,
|
|
|
|
# [ifelse([$3], , [AC_MSG_ERROR(No linkable libhamlib was found.)])
|
|
|
|
# hamlib_found=no]
|
|
|
|
#)
|
|
|
|
|
|
|
|
if test "x$hamlib_found" = "xyes" ; then
|
|
|
|
ifelse([$2], , :, [$2])
|
2020-05-30 23:30:29 +00:00
|
|
|
LIBS=$(echo $LIBS | sed 's/-lhamlib//g')
|
|
|
|
LIBS=$(echo $LIBS | sed 's/ //')
|
2002-05-28 21:33:10 +00:00
|
|
|
LIBS="-lhamlib $LIBS"
|
2001-08-08 21:40:51 +00:00
|
|
|
fi
|
2002-05-28 21:33:10 +00:00
|
|
|
if test "x$hamlib_found" = "xno" ; then
|
|
|
|
ifelse([$3], , :, [$3])
|
|
|
|
CFLAGS="$hamlib_save_CFLAGS"
|
|
|
|
LDFLAGS="$hamlib_save_LDFLAGS"
|
|
|
|
LIBS="$hamlib_save_LIBS"
|
|
|
|
HAMLIB_CFLAGS=""
|
|
|
|
HAMLIB_LIBS=""
|
2001-08-08 21:40:51 +00:00
|
|
|
fi
|
|
|
|
|
2002-05-28 21:33:10 +00:00
|
|
|
dnl That should be it. Now just export out symbols:
|
|
|
|
AC_SUBST(HAMLIB_CFLAGS)
|
|
|
|
AC_SUBST(HAMLIB_LIBS)
|
|
|
|
AC_SUBST(HAMLIB_LTDL)
|
2001-08-08 21:40:51 +00:00
|
|
|
])
|