@@ -7,11 +7,30 @@ AC_SUBST(PHP_COUCHBASE)
7
7
8
8
if test "$PHP_COUCHBASE" != "no"; then
9
9
PHP_REQUIRE_CXX
10
+
11
+ # PHP_REQUIRE_CXX macro might incorrectly format CXX variable,
12
+ # concatenating standard selection flags directly to the path,
13
+ # instead of using CXXFLAGS. Let's try to fix this issue.
14
+ AC_CHECK_FILE ( [ $CXX] , [ CXX_PATH=$CXX] , [ CXX_PATH=no] )
15
+ if test "$CXX_PATH" = "no"; then
16
+ AC_MSG_NOTICE ( [ PHP suggested C++ compiler, which includes flags "$CXX", trying to strip them] )
17
+ # Remove extra flags (considering flags are separated by spaces)
18
+ CXX_PATH=$(echo "$CXX" | cut -d' ' -f1)
19
+ AC_CHECK_FILE ( [ $CXX_PATH] , [ ] , [ CXX_PATH=no] )
20
+ # If a valid path is found, update CXX
21
+ if test "$CXX_PATH" == "no"; then
22
+ AC_MSG_NOTICE ( [ Unable to locate path to C++ compiler, falling back to "c++"] )
23
+ AC_SUBST ( [ CXX_PATH] , [ c++] )
24
+ fi
25
+ fi
26
+ AC_MSG_NOTICE ( [ Detected C++ compiler: $CXX_PATH] )
27
+
10
28
AC_PATH_PROG ( CMAKE , cmake , no )
11
29
if ! test -x "${CMAKE}"; then
12
30
AC_MSG_ERROR ( Please install cmake to build couchbase extension )
13
31
fi
14
32
33
+ CXX="${CXX_PATH}"
15
34
CXXFLAGS="${CXXFLAGS} -std=c++17"
16
35
COUCHBASE_CMAKE_SOURCE_DIRECTORY="$srcdir/src"
17
36
COUCHBASE_CMAKE_BUILD_DIRECTORY="$ac_pwd/cmake-build"
0 commit comments