Build: Leave LIBS alone during configure
Put the extra libraries into SR_EXTRA_LIBS instead of LIBS. Create an SR_CHECK_LIBS macro to make that easy. Substitute SR_EXTRA_LIBS into libsigrok.pc, too.
This commit is contained in:
parent
4ed3d9b6db
commit
bc8ff24de6
|
@ -419,7 +419,7 @@ libsigrok_la_SOURCES += \
|
|||
src/hardware/zeroplus-logic-cube/api.c
|
||||
endif
|
||||
|
||||
libsigrok_la_LIBADD = $(LIBSIGROK_LIBS)
|
||||
libsigrok_la_LIBADD = $(SR_EXTRA_LIBS) $(LIBSIGROK_LIBS)
|
||||
libsigrok_la_LDFLAGS = -version-info $(SR_LIB_VERSION) -no-undefined
|
||||
|
||||
library_includedir = $(includedir)/libsigrok
|
||||
|
@ -487,7 +487,7 @@ tests_main_SOURCES = \
|
|||
tests/device.c \
|
||||
tests/trigger.c
|
||||
|
||||
tests_main_LDADD = libsigrok.la $(CHECK_LIBS)
|
||||
tests_main_LDADD = libsigrok.la $(SR_EXTRA_LIBS) $(CHECK_LIBS)
|
||||
|
||||
endif
|
||||
|
||||
|
@ -501,7 +501,7 @@ lib_LTLIBRARIES += bindings/cxx/libsigrokcxx.la
|
|||
|
||||
bindings_cxx_libsigrokcxx_la_SOURCES = bindings/cxx/classes.cpp
|
||||
|
||||
bindings_cxx_libsigrokcxx_la_LIBADD = libsigrok.la $(LIBSIGROKCXX_LIBS)
|
||||
bindings_cxx_libsigrokcxx_la_LIBADD = libsigrok.la $(SR_EXTRA_LIBS) $(LIBSIGROKCXX_LIBS)
|
||||
bindings_cxx_libsigrokcxx_la_LDFLAGS = -version-info $(SR_LIB_VERSION) -no-undefined
|
||||
|
||||
bindings_cxx_libsigrokcxx_la_includedir = $(includedir)/libsigrokcxx
|
||||
|
|
14
configure.ac
14
configure.ac
|
@ -122,6 +122,12 @@ AC_CHECK_HEADERS([sys/mman.h], [SR_APPEND([sr_deps_avail], [sys_mman_h])])
|
|||
AC_CHECK_HEADERS([sys/ioctl.h], [SR_APPEND([sr_deps_avail], [sys_ioctl_h])])
|
||||
AC_CHECK_HEADERS([sys/timerfd.h], [SR_APPEND([sr_deps_avail], [sys_timerfd_h])])
|
||||
|
||||
# We need to link against the Winsock2 library for SCPI over TCP.
|
||||
AS_CASE([$host], [*-mingw*], [SR_EXTRA_LIBS='-lws2_32'], [SR_EXTRA_LIBS=])
|
||||
|
||||
# libm (the standard math library) is always needed.
|
||||
SR_SEARCH_LIBS([SR_EXTRA_LIBS], [pow], [m])
|
||||
|
||||
# RPC is only needed for VXI support.
|
||||
AC_CACHE_CHECK([for RPC support], [sr_cv_have_rpc],
|
||||
[AC_LINK_IFELSE([AC_LANG_PROGRAM(
|
||||
|
@ -406,14 +412,6 @@ AC_DEFINE_UNQUOTED([CONF_LIBZIP_VERSION], ["$sr_libzip_version"],
|
|||
AC_DEFINE_UNQUOTED([CONF_HOST], ["$host"],
|
||||
[The canonical host libsigrok will run on.])
|
||||
|
||||
AC_LANG([C])
|
||||
|
||||
# libm (the standard math library) is always needed.
|
||||
AC_SEARCH_LIBS([pow], [m])
|
||||
|
||||
# We need to link against the Winsock2 library for SCPI over TCP.
|
||||
AS_CASE([$host], [*mingw*], [LIBS="$LIBS -lws2_32"])
|
||||
|
||||
AC_SUBST([FIRMWARE_DIR], ['$(datadir)/sigrok-firmware'])
|
||||
AC_SUBST([MAKEFLAGS], ['--no-print-directory'])
|
||||
AC_SUBST([AM_LIBTOOLFLAGS], ['--silent'])
|
||||
|
|
|
@ -10,5 +10,5 @@ Requires: glib-2.0
|
|||
Requires.private: @SR_PKGLIBS@
|
||||
Version: @SR_PACKAGE_VERSION@
|
||||
Libs: -L${libdir} -lsigrok
|
||||
Libs.private: -lm
|
||||
Libs.private: @SR_EXTRA_LIBS@
|
||||
Cflags: -I${includedir}
|
||||
|
|
33
m4/sigrok.m4
33
m4/sigrok.m4
|
@ -16,7 +16,7 @@
|
|||
## You should have received a copy of the GNU General Public License
|
||||
## along with sigrok. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#serial 20150823
|
||||
#serial 20150824
|
||||
|
||||
## SR_APPEND(var-name, [list-sep,] element)
|
||||
##
|
||||
|
@ -31,6 +31,19 @@ m4_assert([$# >= 2])[]dnl
|
|||
$1=[$]{$1[}]m4_if([$#], [2], [[$]{$1:+' '}$2], [[$]{$1:+$2}$3])[]dnl
|
||||
])
|
||||
|
||||
## SR_PREPEND(var-name, [list-sep,] element)
|
||||
##
|
||||
## Prepend the shell word <element> to the shell variable named <var-name>,
|
||||
## suffixed by <list-sep> unless the list was empty before prepending. If
|
||||
## only two arguments are supplied, <list-sep> defaults to a single space
|
||||
## character.
|
||||
##
|
||||
AC_DEFUN([SR_PREPEND],
|
||||
[dnl
|
||||
m4_assert([$# >= 2])[]dnl
|
||||
$1=m4_if([$#], [2], [$2[$]{$1:+' '}], [$3[$]{$1:+$2}])[$]$1[]dnl
|
||||
])
|
||||
|
||||
## _SR_PKG_VERSION_SET(var-prefix, pkg-name, tag-prefix, base-version, major, minor, [micro])
|
||||
##
|
||||
m4_define([_SR_PKG_VERSION_SET],
|
||||
|
@ -115,6 +128,24 @@ _SR_LIB_VERSION_SET([$1],
|
|||
[$2], m4_unquote(m4_split([$2], [:])))
|
||||
])
|
||||
|
||||
## SR_SEARCH_LIBS(libs-var, function, search-libs,
|
||||
## [action-if-found], [action-if-not-found], [other-libs])
|
||||
##
|
||||
## Same as AC_SEARCH_LIBS, except that the result is prepended
|
||||
## to <libs-var> instead of LIBS. Calls AC_SUBST on <libs-var>.
|
||||
##
|
||||
AC_DEFUN([SR_SEARCH_LIBS],
|
||||
[dnl
|
||||
m4_assert([$# >= 3])[]dnl
|
||||
sr_sl_save_LIBS=$LIBS
|
||||
AC_SEARCH_LIBS([$2], [$3],,, m4_join([$6], [[$]$1]))
|
||||
LIBS=$sr_sl_save_LIBS
|
||||
AS_CASE([$ac_cv_search_$2], [no*],,
|
||||
[SR_PREPEND([$1], [$ac_cv_search_$2])])
|
||||
m4_ifvaln([$4$5], [AS_IF([test "x$ac_cv_search_$2" = xno], [$5], [$4])])[]dnl
|
||||
AC_SUBST([$1])[]dnl
|
||||
])
|
||||
|
||||
## _SR_VAR_SUMMARY(tag, var-name, line-leader, align-columns, align-char)
|
||||
##
|
||||
m4_define([_SR_VAR_SUMMARY], [dnl
|
||||
|
|
Loading…
Reference in New Issue