ax_dlflags.m4
1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# ===========================================================================
#
# SYNOPSIS
#
# AX_DLFLAGS
#
# DESCRIPTION
#
# This macro determines the value of a DL flags such as RTLD_GLOBAL or
# RTLD_NOW from the dlfcn.h file.
#
# USAGE
#
# AX_DLFLAGS(RTLD_GLOBAL)
# AC_MSG_RESULT($DLFLAGS_RTLD_GLOBAL)
#
# LICENSE
#
# Copyright (c) 2021 Juergen Knoedlseder
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#serial 8
AC_DEFUN([AX_DLFLAGS], [
DLFLAGS_$1=""
AC_CHECK_HEADERS([dlfcn.h])
AS_IF([test "x$ac_cv_header_dlfcn_h" = "xyes"],[
AC_MSG_CHECKING([for value of $1])
for flags in 1 2 4 8 16 32 64 128 256 512 ; do
AC_EGREP_CPP([test_true],[
#include <dlfcn.h>
#if defined($1) && $1 == $flags
test_true
#endif
],[DLFLAGS_$1=$flags],[])
done
])
AC_MSG_RESULT($DLFLAGS_$1)
AC_SUBST([DLFLAGS_$1])
])