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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
dnl _AM_TRY_CHECK(MINIMUM-VERSION, EXTRA-CFLAGS, EXTRA-LIBS, CHECK-LIB-NAME
dnl [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl Test for check, and define CHECK_CFLAGS and CHECK_LIBS
dnl Done this way because of the brokenness that is
dnl https://launchpad.net/distros/ubuntu/+source/check/+bug/5840
dnl
AC_DEFUN([_AM_TRY_CHECK],
[
min_check_version=$1
extra_cflags=$2
extra_libs=$3
check_lib_name=$4
CHECK_CFLAGS="$extra_cflags"
CHECK_LIBS="$extra_libs -l$check_lib_name"
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $CHECK_CFLAGS"
LIBS="$CHECK_LIBS $LIBS"
AC_MSG_CHECKING(for check named $check_lib_name - version >= $min_check_version)
rm -f conf.check-test
dnl unset no_check, since in our second run it would have been set to yes
dnl before
no_check=
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <check.h>
int main ()
{
int major, minor, micro;
char *tmp_version;
system ("touch conf.check-test");
/* HP/UX 9 (%@#!) writes to sscanf strings */
tmp_version = strdup("$min_check_version");
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
printf("%s, bad version string\n", "$min_check_version");
return 1;
}
if ((CHECK_MAJOR_VERSION != check_major_version) ||
(CHECK_MINOR_VERSION != check_minor_version) ||
(CHECK_MICRO_VERSION != check_micro_version))
{
printf("\n*** The check header file (version %d.%d.%d) does not match\n",
CHECK_MAJOR_VERSION, CHECK_MINOR_VERSION, CHECK_MICRO_VERSION);
printf("*** the check library (version %d.%d.%d).\n",
check_major_version, check_minor_version, check_micro_version);
return 1;
}
if ((check_major_version > major) ||
((check_major_version == major) && (check_minor_version > minor)) ||
((check_major_version == major) && (check_minor_version == minor) && (check_micro_version >= micro)))
{
return 0;
}
else
{
printf("\n*** An old version of check (%d.%d.%d) was found.\n",
check_major_version, check_minor_version, check_micro_version);
printf("*** You need a version of check being at least %d.%d.%d.\n", major, minor, micro);
printf("***\n");
printf("*** If you have already installed a sufficiently new version, this error\n");
printf("*** probably means that the wrong copy of the check library and header\n");
printf("*** file is being found. Rerun configure with the --with-check=PATH option\n");
printf("*** to specify the prefix where the correct version was installed.\n");
}
return 1;
}
],, no_check=yes, [echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
if test "x$no_check" = x ; then
AC_MSG_RESULT(yes)
ifelse([$5], , :, [$5])
else
AC_MSG_RESULT(no)
if test -f conf.check-test ; then
:
else
echo "*** Could not run check test program, checking why..."
CFLAGS="$CFLAGS $CHECK_CFLAGS"
LIBS="$CHECK_LIBS $LIBS"
AC_TRY_LINK([
#include <stdio.h>
#include <stdlib.h>
#include <check.h>
], , [ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding check. You'll need to set your"
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
echo "*** to the installed location Also, make sure you have run ldconfig if that"
echo "*** is required on your system"
echo "***"
echo "*** If you have an old version installed, it is best to remove it, although"
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
[ echo "*** The test program failed to compile or link. See the file config.log for"
echo "*** the exact error that occured." ])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
CHECK_CFLAGS=""
CHECK_LIBS=""
rm -f conf.check-test
ifelse([$6], , AC_MSG_ERROR([check not found]), [$6])
fi
])
dnl AM_PATH_CHECK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl Test for check, and define CHECK_CFLAGS and CHECK_LIBS
dnl
AC_DEFUN([AM_PATH_CHECK],
[
AC_ARG_WITH(check,
[ --with-check=PATH prefix where check is installed [default=auto]])
AC_ARG_WITH(checklibname,
AC_HELP_STRING([--with-check-lib-name=NAME],
[name of the PIC check library (default=check)]))
min_check_version=ifelse([$1], ,0.8.2,$1)
if test x$with_check = xno; then
AC_MSG_RESULT(disabled)
ifelse([$3], , AC_MSG_ERROR([disabling check is not supported]), [$3])
else
if test "x$with_check" != x; then
CHECK_EXTRA_CFLAGS="-I$with_check/include"
CHECK_EXTRA_LIBS="-L$with_check/lib"
else
CHECK_EXTRA_CFLAGS=""
CHECK_EXTRA_LIBS=""
fi
if test x$with_checklibname = x; then
_AM_TRY_CHECK($min_check_version, $CHECK_EXTRA_CFLAGS, $CHECK_EXTRA_LIBS,
check_pic, [have_check=true], [have_check=false])
if test x$have_check = xtrue; then
ifelse([$2], , :, [$2])
else
_AM_TRY_CHECK($min_check_version, $CHECK_EXTRA_CFLAGS, $CHECK_EXTRA_LIBS,
check, [have_check=true], [have_check=false])
if test x$have_check = xtrue; then
ifelse([$2], , :, [$2])
else
ifelse([$3], , AC_MSG_ERROR([check not found]), [$3])
fi
fi
else
_AM_TRY_CHECK($min_check_version, $CHECK_EXTRA_CFLAGS, $CHECK_EXTRA_LIBS,
$with_checklibname, [have_check=true], [have_check=false])
if test x$have_check = xtrue; then
ifelse([$2], , :, [$2])
else
ifelse([$3], , AC_MSG_ERROR([check not found]), [$3])
fi
fi
AC_SUBST(CHECK_CFLAGS)
AC_SUBST(CHECK_LIBS)
rm -f conf.check-test
fi
])
|