autogen.sh: use glibtoolize when available

libtoolize is called glibtoolize on osx.

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>
client: use struct stat member tests for time

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
pipe: avoid conflict with Pipe.cc on case-insensitive fs

pipe.c and Pipe.cc produce the same intermediate file names on
case-insensitive file systems (like HFS). This renames pipe.c/pipe.h in
order to avoid the conflict.

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). The
$LIBS variable will be updated with the result, so we don't need an
explicit -luuid in src/Makefile.am.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
autoconf: search for -mt version of boost_program_options

The -mt version of the boost libraries shows up in OSX. Other boost
libraries were searching for the same alternative. Adds lib to LIBS to
avoid explicit -l in Makefile.am.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
log: remove unused lock

m_lock is initialized and destroyed, but never used.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
code_env: do not use prctl on non-linux

get_process_name is platform specific. Check for Linux prctl function and
headers, and add reference to the relevant OSX function.

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>
utime: use to_timespec for conversion

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
wbthrottle: use posix_fadvise if available

Only adding information about data usage. This won't effect correctness;
finding analagous techniques on other platforms woudld be useful for
performance.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
context: handle platform without sem_timedwait

On OSX sem_timedwait is not available. This patch simply turns off the
heartbeat interval feature. Building a replacement should be possible, but is
needs some careful thought because pthread mutex/conds aren't thread safe, and
sem_post is called from SIGHUP.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
mon: check for platform specific headers

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
doc: add osx build documentation

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
pipe: use feature tests for pipe2 and O_CLOEXEC

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

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
xattr: format code, remove unused intialization

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>
fuse: better fuse check and compiler error fixes

Use pkg-config to look for libfuse (which also catches fuse4x on OSX).
This also fixes the HAVE_FUSE_GETGROUPS feature test, which hadn't been
updating LIBS prior to the test. This enabled code with an error in
fuse_ll.cc that had compiler errors.

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