-
Notifications
You must be signed in to change notification settings - Fork 1
/
acinclude.m4
80 lines (71 loc) · 2.46 KB
/
acinclude.m4
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
dnl thread-local storage support macro
m4_include(m4/tls.m4)
dnl CLANLIB_CHECK_LIB(lib, testprog, module, failed_message, use_libs, use_cflags) library test macro
define([CLANLIB_CHECK_LIB],[if test "$enable_$3" != "no"; then
OLDLIBS="$LIBS"; LIBS="$5"; AC_MSG_CHECKING(for $1)
OLD_CXXFLAGS="$CXXFLAGS"; CXXFLAGS="$6";
AC_RUN_IFELSE([AC_LANG_SOURCE($2)], [CL_RESULT=yes], [CL_RESULT=no], [AC_LINK_IFELSE([AC_LANG_SOURCE($2)], [CL_RESULT="yes, linked"],[CL_RESULT=no])])
AC_MSG_RESULT([$CL_RESULT])
if test "$CL_RESULT" = "no"; then
CLANLIB_DISABLE_MODULE([$3],[$4])
else
$3_CXXFLAGS=" $$3_CXXFLAGS $CXXFLAGS "
extra_LIBS_$3=" $extra_LIBS_$3 $LIBS "
fi
CXXFLAGS="$OLD_CXXFLAGS"
LIBS="$OLDLIBS"
fi])
dnl CLANLIB_CHECK_CPP(testprog, use_libs, use_cflags) library test macro
define([CLANLIB_CHECK_CPP],[
OLDLIBS="$LIBS"; LIBS="$2";
OLD_CXXFLAGS="$CXXFLAGS"; CXXFLAGS="$3";
AC_RUN_IFELSE([AC_LANG_SOURCE($1)], [CL_RESULT=yes], [CL_RESULT=no], [CL_RESULT=no])
CXXFLAGS="$OLD_CXXFLAGS"
LIBS="$OLDLIBS"
])
dnl CLANLIB_DISABLE_MODULE(module, message)
define([CLANLIB_DISABLE_MODULE],[
if test "$enable_$1" = "yes"; then
AC_MSG_ERROR([$2])
else
AC_MSG_WARN([$2. Disabling $1]);enable_$1=no
fi])
dnl CLANLIB_ENABLE_MODULES(modules) set Module variables
define([CLANLIB_ENABLE_MODULES],[
ClanLib_Modules="$ClanLib_Modules $1"
ClanLib_pkgconfig="$ClanLib_pkgconfig m4_bpatsubst($1,\w+,[clan\&.pc])"
ClanLib_API_Modules="$ClanLib_API_Modules m4_bpatsubst($1,\w+,[\\$(clan\&_includes)])"
AC_CONFIG_FILES(m4_bpatsubst($1,\w+,Sources/\&/Makefile Setup/pkgconfig/clan\&.pc))])
dnl CLANLIB_ARG_ENABLE(option, default, option label, checking message)
define([CLANLIB_ARG_ENABLE],[AC_MSG_CHECKING($4)
AC_ARG_ENABLE($1, AC_HELP_STRING([--enable-$1], [$3]), ,[enable_$1="$2"])
AC_MSG_RESULT([$enable_$1])])
dnl ------------------------------------------------
dnl BBNs macro for checking commandline parameters:
dnl ------------------------------------------------
dnl CHECK_ENABLED(feature,help,define,default)
define([CHECK_ENABLED],
[
AC_ARG_ENABLE($1,[$2],
[
if test "$enableval" != "no"; then
$3="enabled"
AC_DEFINE($3)
AC_MSG_RESULT([enabled])
else
$3="disabled"
AC_MSG_RESULT([disabled])
fi
],
[
if test "$4" = "enabled"; then
$3="enabled"
AC_DEFINE($3)
AC_MSG_RESULT([enabled])
else
$3="disabled"
AC_MSG_RESULT([disabled])
fi
])
])
dnl EOF dnl