• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#***************************************************************************
2#                                  _   _ ____  _
3#  Project                     ___| | | |  _ \| |
4#                             / __| | | | |_) | |
5#                            | (__| |_| |  _ <| |___
6#                             \___|\___/|_| \_\_____|
7#
8# Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
9#
10# This software is licensed as described in the file COPYING, which
11# you should have received as part of this distribution. The terms
12# are also available at https://curl.se/docs/copyright.html.
13#
14# You may opt to use, copy, modify, merge, publish, distribute and/or sell
15# copies of the Software, and permit persons to whom the Software is
16# furnished to do so, under the terms of the COPYING file.
17#
18# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19# KIND, either express or implied.
20#
21#***************************************************************************
22
23AC_DEFUN([CURL_WITH_MESALINK], [
24dnl ----------------------------------------------------
25dnl check for MesaLink
26dnl ----------------------------------------------------
27
28if test "x$OPT_MESALINK" != xno; then
29  _cppflags=$CPPFLAGS
30  _ldflags=$LDFLAGS
31  ssl_msg=
32
33  if test X"$OPT_MESALINK" != Xno; then
34
35    if test "$OPT_MESALINK" = "yes"; then
36      OPT_MESALINK=""
37    fi
38
39    if test -z "$OPT_MESALINK" ; then
40      dnl check for lib first without setting any new path
41
42      AC_CHECK_LIB(mesalink, mesalink_library_init,
43      dnl libmesalink found, set the variable
44       [
45         AC_DEFINE(USE_MESALINK, 1, [if MesaLink is enabled])
46         AC_SUBST(USE_MESALINK, [1])
47         MESALINK_ENABLED=1
48         USE_MESALINK="yes"
49         ssl_msg="MesaLink"
50	 test mesalink != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
51        ])
52    fi
53
54    addld=""
55    addlib=""
56    addcflags=""
57    mesalinklib=""
58
59    if test "x$USE_MESALINK" != "xyes"; then
60      dnl add the path and test again
61      addld=-L$OPT_MESALINK/lib$libsuff
62      addcflags=-I$OPT_MESALINK/include
63      mesalinklib=$OPT_MESALINK/lib$libsuff
64
65      LDFLAGS="$LDFLAGS $addld"
66      if test "$addcflags" != "-I/usr/include"; then
67         CPPFLAGS="$CPPFLAGS $addcflags"
68      fi
69
70      AC_CHECK_LIB(mesalink, mesalink_library_init,
71       [
72       AC_DEFINE(USE_MESALINK, 1, [if MesaLink is enabled])
73       AC_SUBST(USE_MESALINK, [1])
74       MESALINK_ENABLED=1
75       USE_MESALINK="yes"
76       ssl_msg="MesaLink"
77       test mesalink != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
78       ],
79       [
80         CPPFLAGS=$_cppflags
81         LDFLAGS=$_ldflags
82       ])
83    fi
84
85    if test "x$USE_MESALINK" = "xyes"; then
86      AC_MSG_NOTICE([detected MesaLink])
87
88      LIBS="-lmesalink $LIBS"
89
90      if test -n "$mesalinklib"; then
91        dnl when shared libs were found in a path that the run-time
92        dnl linker doesn't search through, we need to add it to
93        dnl LD_LIBRARY_PATH to prevent further configure tests to fail
94        dnl due to this
95        if test "x$cross_compiling" != "xyes"; then
96          LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$mesalinklib"
97          export LD_LIBRARY_PATH
98          AC_MSG_NOTICE([Added $mesalinklib to LD_LIBRARY_PATH])
99        fi
100      fi
101    fi
102
103  fi dnl MesaLink not disabled
104
105  test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
106fi
107])
108