This repository has been archived on 2020-06-07. You can view files and clone it, but cannot push or open issues or pull requests.
php-armadillo/config.m4

65 lines
2.4 KiB
Plaintext
Raw Permalink Normal View History

2019-04-16 11:00:50 +00:00
PHP_ARG_ENABLE(arma, for armadillo support,
[ --enable-arma Enable armadillo support])
2019-02-05 13:31:16 +00:00
2019-04-16 11:00:50 +00:00
PHP_ARG_ENABLE(arma-operators, for operator overloading support in armadillo,
[ --enable-arma-operators Enable operator overloading for armadillo ], no, no)
2019-03-25 07:14:53 +00:00
2019-09-24 10:41:37 +00:00
PHP_ARG_ENABLE(arma-pch, build PCH header of armadillo,
[ --enable-arma-pch Enable building PCH header of armadillo ], no, no)
2019-02-05 13:31:16 +00:00
if test "$PHP_ARMA" != "no"; then
PHP_REQUIRE_CXX()
2019-07-12 16:29:03 +00:00
2019-09-24 10:41:37 +00:00
# If enabled, try building pre-compiled header for armadillo.
if test "$PHP_ARMA_PCH" != "no"; then
CXX_INCLEDE_PATHS=($(echo | $CXX -xc++ -E -v - 2>&1 | grep -e '^ /\S*$'))
2019-09-24 10:41:37 +00:00
PCH_FILE='./build/armadillo.gch'
# Note that '-D' option is valid when compiling PCH header, but not when using it.
PCH_COMPILE_FLAGS=(-std=c++17 -xc++-header -DARMA_DONT_PRINT_ERRORS -fPIC -g)
2019-09-25 03:55:55 +00:00
if test "$PHP_DEBUG" != "0"; then
PCH_COMPILE_FLAGS+=(-O0)
2019-09-24 10:41:37 +00:00
else
PCH_COMPILE_FLAGS+=(-O2)
2019-09-24 10:41:37 +00:00
fi
fi
for POSSIBLE_INCLUDE_DIR in ${CXX_INCLEDE_PATHS[[@]]}; do
ARMADILLO_HEADER_FILE=$POSSIBLE_INCLUDE_DIR/armadillo
2019-09-24 10:41:37 +00:00
if test -f "$ARMADILLO_HEADER_FILE"; then
$CXX ${PCH_COMPILE_FLAGS[[@]]} $ARMADILLO_HEADER_FILE -o $PCH_FILE
2019-09-24 10:41:37 +00:00
break
fi
done
# Include PCH file if valid.
EXTRA_CXXFLAGS="-std=c++17 -DARMA_DONT_PRINT_ERRORS"
CLANG_TEST_STR=`echo | $CXX -dM -E - | grep __clang__`
2019-09-24 10:41:37 +00:00
if test -f "$PCH_FILE"; then
if test -n "$CLANG_TEST_STR"; then
EXTRA_CXXFLAGS+=" -include-pch $PCH_FILE"
else
DUMMY_ARMADILLO_HEADER_FILE='./build/armadillo'
touch "$DUMMY_ARMADILLO_HEADER_FILE"
EXTRA_CXXFLAGS+=" -include $DUMMY_ARMADILLO_HEADER_FILE"
2019-09-24 10:41:37 +00:00
fi
AC_DEFINE(PHP_ARMA_ENABLE_PCH, 1, [ Defined if using pre-compiled armadillo header. ])
2019-09-24 10:41:37 +00:00
fi
# Disable some clang warnings, which we don't care.
2019-07-12 18:16:55 +00:00
if test -n "$CLANG_TEST_STR"; then
2019-09-24 10:41:37 +00:00
EXTRA_CXXFLAGS+=' -Wno-undefined-var-template -Wno-deprecated-declarations'
2019-07-12 16:29:03 +00:00
fi
2019-06-07 08:44:07 +00:00
2019-09-24 10:41:37 +00:00
# Enable/disable operator overloading support.
2019-07-09 14:02:49 +00:00
OPERATORS_SRC="src/operators.cc"
ARMA_SRC=`ls -1d src/*.cc | grep -v $OPERATORS_SRC`
2019-04-16 11:00:50 +00:00
if test "$PHP_ARMA_OPERATORS" != "no"; then
AC_DEFINE(PHP_ARMA_OPERATORS, 1, [ Defined if operator overloading is enabled for armadillo. ])
2019-07-09 14:02:49 +00:00
ARMA_SRC+=" $OPERATORS_SRC"
2019-03-25 07:14:53 +00:00
fi
2019-06-07 08:44:07 +00:00
PHP_NEW_EXTENSION(arma, $ARMA_SRC, $ext_shared, , $EXTRA_CXXFLAGS)
2019-03-23 16:24:34 +00:00
PHP_ADD_LIBRARY(armadillo, 1, ARMA_SHARED_LIBADD)
PHP_SUBST(ARMA_SHARED_LIBADD)
2019-02-05 13:31:16 +00:00
fi