1From c154195fa161575363280aac9e928b7225f0de9e Mon Sep 17 00:00:00 2001
2From: "Yann E. MORIN" <yann.morin.1998@free.fr>
3Date: Sun, 29 Dec 2019 17:42:13 +0100
4Subject: [PATCH] configure: fix detection of fltk libs
5
6Chaining calls to AC_CHECK_LIB one in the other, breaks the configure
7script, because some internal functions (e.g. ac_fn_c_try_link) would
8not be defined before they are needed, leading the build to fail as
9thus:
10
11    checking for snd_tplg_new in -latopology... ./configure: line 4630:
12    ac_fn_c_try_link: command not found
13    no
14    configure: error: No linkable libatopology was found.
15
16Using AC_CHECK_LIB() in sequence (i.e. one after the other) and
17memorising the result is not trivial: AC_CHECK_LIB() implements a
18ddefault action-if-found that append to LIBS, but not if the user
19ptrovides their own action-if-found.
20
21Instead, AC_SEARH_LIBS() always append to LIBS, *and* run the
22user-provided action.
23
24So, we switch to AC_SEARCH_LIBS() and memorise the result for each
25test, to eventually test if ether worked.
26
27Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
28---
29 configure.in | 8 ++++----
30 1 file changed, 4 insertions(+), 4 deletions(-)
31
32diff --git a/configure.in b/configure.in
33index 9307cc2..55f6864 100644
34--- a/configure.in
35+++ b/configure.in
36@@ -11,10 +11,10 @@ AC_PROG_INSTALL
37 AC_PROG_LN_S
38
39 dnl Checks for libraries.
40-AC_CHECK_LIB(fltk,numericsort,,
41-AC_CHECK_LIB(fltk,fl_numericsort,,
42-AC_MSG_ERROR("missing fltk"))
43-)
44+has_fltk=false
45+AC_SEARCH_LIBS(numericsort,fltk,has_fltk=true)
46+AC_SEARCH_LIBS(fl_numericsort,fltk,has_fltk=true)
47+AS_IF(test "${has_fltk}" = "false", AC_MSG_ERROR("missing fltk"))
48 AM_PATH_ALSA(0.9.0)
49
50 dnl Checks for header files.
51--
522.20.1
53
54