libc++: __locale:24:7: error: '_AIX' is not defined, evaluates to 0 [-Werror, -Wundef]

(please CC, not on list)

While building Xapian on OS X with a recent version of Clang/LLVM HEAD I encountered the following error:

libtool: compile: clang++-3.5 -stdlib=libc++ -DHAVE_CONFIG_H -I. -I./common -I./include -Wall -W -Wredundant-decls -Wpointer-arith -Wcast-qual -Wcast-align -Wno-long-long -Wformat-security -fno-gnu-keywords -Wundef -Woverloaded-virtual -Wshadow -Wstrict-overflow=1 -Winit-self -Wmissing-declarations -Werror -fvisibility=hidden -nostdinc++ -I/usr/local/lib/llvm-3.5/include/c++/v1 -MT api/compactor.lo -MD -MP -MF api/.deps/compactor.Tpo -c api/compactor.cc -fno-common -DPIC -o api/.libs/compactor.o
In file included from api/compactor.cc:30:
In file included from /usr/local/lib/llvm-3.5/include/c++/v1/fstream:169:
In file included from /usr/local/lib/llvm-3.5/include/c++/v1/ostream:131:
In file included from /usr/local/lib/llvm-3.5/include/c++/v1/ios:216:
/usr/local/lib/llvm-3.5/include/c++/v1/__locale:24:7: error: '_AIX' is not defined, evaluates to 0 [-Werror,-Wundef]
#elif _AIX
      ^
1 error generated.
make[3]: *** [api/compactor.lo] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all] Error 2
make: *** [all] Error 2

Attached patch should fix it.

aix_defined.diff (485 Bytes)