-
Notifications
You must be signed in to change notification settings - Fork 156
/
hitch.m4
42 lines (36 loc) · 1.01 KB
/
hitch.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
# HITCH_SEARCH_LIBS(VAR, LIBS, FUNC, NOTFOUND)
# --------------------------------------------
AC_DEFUN([HITCH_SEARCH_LIBS], [
hitch_save_LIBS=$LIBS
LIBS=""
AC_SEARCH_LIBS([$3], [$2], [], [$4])
AC_SUBST([$1_LIBS], [$LIBS])
LIBS=$hitch_save_LIBS
])
# HITCH_CHECK_FUNC(FUNC, LIBS, FOUND, NOTFOUND)
# --------------------------------------------
AC_DEFUN([HITCH_CHECK_FUNC], [
hitch_save_LIBS=$LIBS
LIBS="$2"
AC_CHECK_FUNC([$1], [$3], [$4])
LIBS=$hitch_save_LIBS
])
# _HITCH_CHECK_FLAG(VAR, FLAG)
------------------------------
AC_DEFUN([_HITCH_CHECK_FLAG], [
AC_MSG_CHECKING([whether the compiler accepts $2])
hitch_save_CFLAGS=$CFLAGS
CFLAGS="[$]$1 $2 $CFLAGS"
AC_LINK_IFELSE(
[AC_LANG_SOURCE([int main(void) { return (0); }])],
[AC_MSG_RESULT([yes]); $1="[$]$1 $2"],
[AC_MSG_RESULT([no])])
CFLAGS=$hitch_save_CFLAGS
])
# HITCH_CHECK_FLAGS(VAR, FLAGS)
-------------------------------
AC_DEFUN([HITCH_CHECK_FLAGS], [
m4_foreach([_flag],
m4_split(m4_normalize([$2])),
[_HITCH_CHECK_FLAG([$1], _flag)])
])