+AC_LANG([C++])
+AC_DEFUN([CY_CHECK_UNIVERSAL], [
+ AC_MSG_CHECKING([for universal binary support])
+ AS_CASE([$host_vendor], [apple], [
+ AS_CASE([$host_cpu], [armv6|i386|x86_64], [
+ for cy_arch in armv6 i386 x86_64; do
+ cy_save_CXXFLAGS=$CXXFLAGS
+ AC_LIB_APPENDTOVAR([CXXFLAGS], ["-arch $cy_arch"])
+ AC_TRY_LINK([], [], [
+ AC_LIB_APPENDTOVAR([cy_arches], [$cy_arch])
+ AC_LIB_APPENDTOVAR([CFLAGS], ["-arch $cy_arch"])
+ AC_LIB_APPENDTOVAR([LDFLAGS], ["-arch $cy_arch"])
+ AC_LIB_APPENDTOVAR([OBJCXXFLAGS], ["-arch $cy_arch"])
+ ], [
+ CXXFLAGS=$cy_save_CXXFLAGS
+ ])
+ done
+ ])
+ ])
+ AC_MSG_RESULT([${cy_arches-no}])
+])
+AC_ARG_ENABLE([universal-binary], [AS_HELP_STRING(
+ [--disable-universal-binary],
+ [do not build with universal binary support on Darwin]
+)], [
+ AS_CASE([$enableval], [no], [], [CY_CHECK_UNIVERSAL])
+], [CY_CHECK_UNIVERSAL])