xref: /ext-fiber/config.m4 (revision 118a23e5)
1PHP_ARG_ENABLE([fiber],
2  [whether to enable fiber support],
3  [AS_HELP_STRING([--enable-fiber],
4    [Enable fiber support])], [no])
5
6if test "$PHP_FIBER" != "no"; then
7  AC_DEFINE(HAVE_FIBER, 1, [ ])
8
9  FIBER_CFLAGS="-Wall -Werror -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
10
11  fiber_source_files="src/php_fiber.c \
12    src/fiber.c \
13    src/fiber_stack.c"
14
15  AC_MSG_CHECKING(for fiber switching context)
16  fiber="yes"
17
18  AS_CASE([$host_cpu],
19    [x86_64*|amd64*], [fiber_cpu="x86_64"],
20    [x86*|amd*|i?86*|pentium], [fiber_cpu="i386"],
21    [aarch64*|arm64*], [fiber_cpu="arm64"],
22    [arm*], [fiber_cpu="arm32"],
23    [ppc64*|powerpc64*], [fiber_cpu="ppc64"],
24    [ppc*|powerpc*], [fiber_cpu="ppc32"],
25    [s390x*], [fiber_cpu="s390x"],
26    [mips64*], [fiber_cpu="mips64"],
27    [mips*], [fiber_cpu="mips32"],
28    [fiber_cpu="unknown"]
29  )
30
31  AS_CASE([$host_os],
32    [darwin*], [fiber_os="mac"],
33    [fiber_os="other"]
34  )
35
36  AS_CASE([$fiber_cpu],
37    [x86_64], [fiber_asm_file_prefix="x86_64_sysv"],
38    [i386], [fiber_asm_file_prefix="i386_sysv"],
39    [arm64], [fiber_asm_file_prefix="arm64_aapcs"],
40    [arm32], [fiber_asm_file_prefix="arm_aapcs"],
41    [ppc64], [fiber_asm_file_prefix="ppc64_sysv"],
42    [ppc32], [fiber_asm_file_prefix="ppc32_sysv"],
43    [s390x], [fiber_asm_file_prefix="s390x_sysv"],
44    [mips64], [fiber_asm_file_prefix="mips64_n64"],
45    [mips32], [fiber_asm_file_prefix="mips32_o32"],
46    [fiber_asm_file_prefix="unknown"]
47  )
48
49  if test "$fiber_os" = 'mac'; then
50    fiber_asm_file="combined_sysv_macho_gas"
51  elif test "$fiber_asm_file_prefix" != 'unknown'; then
52    fiber_asm_file="${fiber_asm_file_prefix}_elf_gas"
53  else
54    fiber="no"
55  fi
56
57  if test "$fiber" = 'yes'; then
58    fiber_source_files="$fiber_source_files \
59      src/fiber_asm.c \
60      boost/asm/make_${fiber_asm_file}.S \
61      boost/asm/jump_${fiber_asm_file}.S"
62    AC_MSG_RESULT([$fiber_asm_file])
63  else
64    AC_MSG_ERROR([Unable to determine platform for fiber switching context!])
65  fi
66
67  PHP_NEW_EXTENSION(fiber, $fiber_source_files, $ext_shared,, \\$(FIBER_CFLAGS))
68  PHP_SUBST(FIBER_CFLAGS)
69  PHP_ADD_MAKEFILE_FRAGMENT
70
71  PHP_INSTALL_HEADERS([ext/fiber], [php_fiber.h fiber.h])
72fi
73