autogen.sh: use glibtoolize when available

libtoolize is called glibtoolize on osx.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
autoconf: search for uuid_parse in system libs

AC_SEARCH_LIBS will first try to resolve uuid_parse in the system
libraries (OSX), and then will try other libraries (e.g. libuuid).
UUID_LIBS is defined, containing the necessary libraries to link
against.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
autoconf: check for res_nquery explicitly

Creates a test that checks explicitly for res_nquery, which can be a
macro in resolv.h. Defines RESOLV_LIBS that contains any libraries that
need to be linked against.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
fuse: use pkg-config to check for libfuse

Provides better portability. Currently works on all the gitbuilder
platforms, as well as OSX with fuse4x installed.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
byteorder: use autoconf endian-ness detection

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
assert: use feature test for static_cast

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
assert: choose function-var name on non-gnu

Selects __PRETTY_FUNCTION__ or __func__. Linux assumes GNU, and chooses
__PRETTY_FUNCTION__ if gcc/g++ versions are favorable.

This also includes a fix in ax_c_var_func.m4:

AC_TRY_COMPILE will wrap the test in main{}, and then GCC will complain
about nested functions. Just use the original main{} body.

diff --git a/m4/ax_c_var_func.m4 b/m4/ax_c_var_func.m4
index 0ad7d2b..8b57563 100644
--- a/m4/ax_c_var_func.m4
+++ b/m4/ax_c_var_func.m4
@@ -57,9 +57,9 @@ AC_DEFUN([AX_C_VAR_FUNC],
 [AC_REQUIRE([AC_PROG_CC])
 AC_CACHE_CHECK(whether $CC recognizes __func__, ac_cv_c_var_func,
 AC_TRY_COMPILE(,
-[int main() {
+[
 char *s = __func__;
-}],
+],
 AC_DEFINE(HAVE_FUNC,,
 [Define if the C complier supports __func__]) ac_cv_c_var_func=yes,
 ac_cv_c_var_func=no) )

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
inttypes: detect and define missing integer types

Working around missing integer types is pretty easy. For example, the
__u32 family are Linux-specific types, and using these in Ceph
internally is fine because we can typedef them, but the biggest problem
is that they are also used in installed headers. Again, they could be
typedefed in the installed headers, but it isn't clear that we can't
just use standard ints in installed headers.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>

Conflicts:
	src/include/byteorder.h
utime: use to_timespec for conversion

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
spinlock: add generic spinlock implementation

Adds a ceph_spinlock_t implementation that will use pthread_spinlock_t
if available, and otherwise reverts to pthread_mutex_t. Note that this
spinlock is not intended to be used in process-shared memory.

Switches implementation in:

  ceph_context
  SimpleMessenger
  atomic_t

Only ceph_context initialized its spinlock with PTHREAD_PROCESS_SHARED.
However, there does not appear to be any instance in which CephContext
is allocated in shared memory, and thus can use the default private
memory space behavior.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
keyutil-WIP: add comments, common/secret.c?
autoconf-WIP: as-needed linker flag

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
hashing: add missing hash functions

OSX doesn't define hash<int64_t>, hash<uint64_t>, and isn't able to cast
pthread_t to a type with a hash. This fixes the problem by defining
replacements.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
compat: define replacement TEMP_FAILURE_RETRY

Not all platforms have it.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
xattr: test for xattr routine variants

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
blkdev: support blkdev size query on osx

Support OSX, add checks for platform specific headers.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
networking: assorted networking fixes

Unsure about how to properly do networking portable.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
Pipe: do not use MSG_MORE on OSX

MSG_MORE is not available on OSX, and unlike MSG_NOSIGNAL, there doesn't
appear to be an equivalent. It is not clear if MSG_MORE effects
correctness or is just an optimization.

If the MSG_MORE semantics are required for correctness, we may be able
to use TCP_CORK to do this on OSX.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
log: add compat for TEMP_FAILURE_RETRY definition

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
log: check for on_exit flush feature

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>