configure.ac: Rename AM_LDFLAGS to LTLDFLAGS and actually use them
The new variable name tries to clarify that libtool is being used.
Linker flags must thus always be specified with -Wl.
Factor out the libtool flag -no-undefined from host specific cases.
The flag is required to build a Windows DLL, but is correct also for
the other supported systems.
Also, start actually using LTLDFLAGS in libusb/Makefile.am, so that
libtool will see the options set by configure.
diff --git a/configure.ac b/configure.ac
index f810473..95623f2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -15,9 +15,7 @@
lt_current="1"
lt_revision="0"
lt_age="1"
-AC_SUBST(lt_current)
-AC_SUBST(lt_revision)
-AC_SUBST(lt_age)
+LTLDFLAGS="-version-info ${lt_current}:${lt_revision}:${lt_age}"
AM_INIT_AUTOMAKE
AM_MAINTAINER_MODE
@@ -34,6 +32,8 @@
AM_PROG_CC_C_O
AC_DEFINE([_GNU_SOURCE], 1, [Use GNU extensions])
+LTLDFLAGS="${LTLDFLAGS} -no-undefined"
+
AC_MSG_CHECKING([operating system])
case $host in
*-linux*)
@@ -45,7 +45,6 @@
threads="posix"
THREAD_CFLAGS="-pthread"
PC_LIBS_PRIVATE="${PC_LIBS_PRIVATE} -pthread"
- AM_LDFLAGS="-Wl,--no-undefined"
AC_CHECK_HEADERS([poll.h])
AC_DEFINE([POLL_NFDS_TYPE],[nfds_t],[type of second poll() argument])
;;
@@ -56,7 +55,7 @@
backend="darwin"
threads="posix"
PC_LIBS_PRIVATE="-Wl,-framework,IOKit -Wl,-framework,CoreFoundation"
- AM_LDFLAGS="-Wl,-prebind -Wl,--no-undefined"
+ LTLDFLAGS="${LTLDFLAGS} -Wl,-prebind"
AC_CHECK_HEADERS([poll.h])
AC_CHECK_TYPE([nfds_t],
[AC_DEFINE([POLL_NFDS_TYPE],[nfds_t],[type of second poll() argument])],
@@ -69,7 +68,7 @@
AC_MSG_RESULT([Windows])
backend="windows"
PC_LIBS_PRIVATE="-lsetupapi -lole32 -ladvapi32"
- AM_LDFLAGS="-no-undefined -avoid-version --add-stdcall-alias"
+ LTLDFLAGS="${LTLDFLAGS} -avoid-version -Wl,--add-stdcall-alias"
AC_CHECK_TOOL(RC, windres, no)
AC_DEFINE([POLL_NFDS_TYPE],[unsigned int],[type of second poll() argument])
;;
@@ -80,7 +79,7 @@
backend="windows"
threads="posix"
PC_LIBS_PRIVATE="-lsetupapi -lole32 -ladvapi32"
- AM_LDFLAGS="-no-undefined -avoid-version --add-stdcall-alias"
+ LTLDFLAGS="${LTLDFLAGS} -avoid-version -Wl,--add-stdcall-alias"
AC_CHECK_TOOL(RC, windres, no)
AC_DEFINE([POLL_NFDS_TYPE],[unsigned int],[type of second poll() argument])
;;
@@ -188,7 +187,7 @@
AC_SUBST(VISIBILITY_CFLAGS)
AC_SUBST(AM_CFLAGS)
-AC_SUBST(AM_LDFLAGS)
+AC_SUBST(LTLDFLAGS)
AC_CONFIG_FILES([libusb-1.0.pc])
AC_CONFIG_FILES([Makefile])