tests
3 years ago
config.m4
3 years ago
hash_crc32c.c
3 years ago
install_crc32c.sh
3 years ago
php_crc32c.c
3 years ago
php_crc32c.h
3 years ago
config.m4
64 lines
| 1 | dnl Copyright 2019 Google Inc. All Rights Reserved. |
| 2 | dnl |
| 3 | dnl Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | dnl you may not use this file except in compliance with the License. |
| 5 | dnl You may obtain a copy of the License at |
| 6 | dnl |
| 7 | dnl http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | dnl |
| 9 | dnl Unless required by applicable law or agreed to in writing, software |
| 10 | dnl distributed under the License is distributed on an "AS-IS" BASIS, |
| 11 | dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | dnl See the License for the specific language governing permissions and |
| 13 | dnl limitations under the License. |
| 14 | dnl |
| 15 | |
| 16 | PHP_ARG_WITH(crc32c, for crc32c support, |
| 17 | [ --with-crc32c[=DIR] Include crc32c support. File is the optional path to google/crc32c]) |
| 18 | |
| 19 | if test "$PHP_CRC32C" != "no"; then |
| 20 | PHP_REQUIRE_CXX() # The external crc32c library uses C++. |
| 21 | |
| 22 | if test -r $PHP_CRC32C/; then |
| 23 | SEARCH_PATH=$PHP_CRC32C |
| 24 | else |
| 25 | SEARCH_PATH="$PWD/crc32c/build /usr/local /usr" |
| 26 | fi |
| 27 | |
| 28 | |
| 29 | AC_MSG_CHECKING([for crc32c files]) |
| 30 | SEARCH_FOR="include/crc32c/crc32c.h" |
| 31 | |
| 32 | for i in $SEARCH_PATH ; do |
| 33 | if test -r $i/$SEARCH_FOR; then |
| 34 | CRC32C_DIR=$i |
| 35 | AC_MSG_RESULT(found in $i) |
| 36 | fi |
| 37 | done |
| 38 | |
| 39 | # --with-crc32c -> check with-path |
| 40 | if test -z "$CRC32C_DIR"; then |
| 41 | AC_MSG_RESULT([not found]) |
| 42 | AC_MSG_ERROR([Please install the google/crc32c package, and use --with-crc32c]) |
| 43 | fi |
| 44 | |
| 45 | # --with-crc32c -> add include path |
| 46 | PHP_ADD_INCLUDE($CRC32C_DIR/include) |
| 47 | |
| 48 | # --with-crc32c -> check for lib and symbol presence |
| 49 | LIBNAME=crc32c |
| 50 | LIBSYMBOL=crc32c_extend |
| 51 | |
| 52 | PHP_CHECK_LIBRARY($LIBNAME, $LIBSYMBOL, |
| 53 | [ |
| 54 | PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $CRC32C_DIR/$PHP_LIBDIR, CRC32C_SHARED_LIBADD) |
| 55 | ],[ |
| 56 | AC_MSG_FAILURE([wrong crc32c lib version or lib not found]) |
| 57 | ],[ |
| 58 | -L$CRC32C_DIR/$PHP_LIBDIR -lm |
| 59 | ]) |
| 60 | |
| 61 | PHP_SUBST(CRC32C_SHARED_LIBADD) |
| 62 | PHP_NEW_EXTENSION(crc32c, hash_crc32c.c php_crc32c.c, $ext_shared, , -Wall -Werror) |
| 63 | fi |
| 64 |