-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfig.m4
More file actions
71 lines (62 loc) · 2.08 KB
/
config.m4
File metadata and controls
71 lines (62 loc) · 2.08 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
PHP_ARG_WITH([libarchive],
[for libarchive support],
[AS_HELP_STRING([[--with-libarchive[=DIR]]],
[Include libarchive support])])
PHP_ARG_WITH([libarchive-read-callbacks],
[whether to use stream read callbacks],
[AS_HELP_STRING([[--with-libarchive-read-callbacks]],
[Use libarchive read callbacks instead of FILE* for stream sources (required on platforms without fopencookie)])],
[no], [no])
if test "$PHP_LIBARCHIVE" != "no"; then
if test -r $PHP_LIBARCHIVE/include/archive.h; then
LIBARCHIVE_DIR=$PHP_LIBARCHIVE
else
AC_MSG_CHECKING(for libarchive in default path)
for i in /usr/local /usr; do
if test -r $i/include/archive.h; then
LIBARCHIVE_DIR=$i
AC_MSG_RESULT(found in $i)
break
fi
done
fi
if test -z "$LIBARCHIVE_DIR"; then
AC_MSG_RESULT(not found)
AC_MSG_ERROR(Please install libarchive first)
fi
PHP_ADD_INCLUDE($LIBARCHIVE_DIR/include)
PHP_ADD_LIBRARY_WITH_PATH(archive, $LIBARCHIVE_DIR/$PHP_LIBDIR, ARCHIVE_SHARED_LIBADD)
PHP_CHECK_LIBRARY(archive, archive_version_number,
[
AC_DEFINE(HAVE_LIBARCHIVE,1,[ ])
], [
AC_MSG_ERROR(function archive_version_number not found)
], [
-L$LIBARCHIVE_DIR/$PHP_LIBDIR
])
cflags_null=""
AC_DEFUN([CC_FLAG_CHECK],
[
ac_saved_cflags="$CFLAGS"
CFLAGS="$1 -Werror"
flag_to_add=m4_default([$2],[$1])
AC_MSG_CHECKING([whether the C compiler supports $1])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([])],
[AC_MSG_RESULT([yes])]
[cflags_null="$cflags_null $flag_to_add"],
[AC_MSG_RESULT([no])]
)
CFLAGS="$ac_saved_cflags"
])
CC_FLAG_CHECK([-Wnullability-completeness], [-Wno-nullability-completeness])
extra_cflags="-Wall $cflags_null -fvisibility=hidden"
ext_sources="libarchive.c stream.c"
if test "$PHP_LIBARCHIVE_READ_CALLBACKS" != "no"; then
AC_DEFINE(HAVE_LIBARCHIVE_STREAM_CALLBACKS, 1,
[Use stream read callbacks for archive sources])
ext_sources="$ext_sources stream_callbacks.c"
fi
PHP_SUBST(ARCHIVE_SHARED_LIBADD)
PHP_NEW_EXTENSION(archive, $ext_sources, $ext_shared,,$extra_cflags)
fi