Skip to content

Commit

Permalink
libcrushwrapper.so now builds, yay
Browse files Browse the repository at this point in the history
  • Loading branch information
liewegas committed Mar 13, 2008
1 parent 05611eb commit 57db9eb
Show file tree
Hide file tree
Showing 4 changed files with 124 additions and 34 deletions.
1 change: 0 additions & 1 deletion autogen.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/bin/sh
rm -f config.cache
libtoolize --force --copy
aclocal -I m4
autoconf
autoheader
Expand Down
35 changes: 16 additions & 19 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,8 @@ AC_PROG_RANLIB
AC_PROG_MAKE_SET

# swig
#AM_PROG_CC_C_O
#AC_DISABLE_STATIC
AC_PROG_LIBTOOL
AX_WITH_PERL
AC_PROG_SWIG
CEPH_CHECK_SWIG
SWIG_ENABLE_CXX


Expand Down Expand Up @@ -117,22 +114,22 @@ AC_TYPE_UINT64_T
AC_TYPE_UINT8_T

# Checks for library functions.
AC_FUNC_CHOWN
AC_FUNC_CLOSEDIR_VOID
AC_FUNC_ERROR_AT_LINE
AC_FUNC_FORK
AC_PROG_GCC_TRADITIONAL
AC_FUNC_LSTAT
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
#AC_FUNC_CHOWN
#AC_FUNC_CLOSEDIR_VOID
#AC_FUNC_ERROR_AT_LINE
#AC_FUNC_FORK
#AC_PROG_GCC_TRADITIONAL
#AC_FUNC_LSTAT
#AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
#AC_FUNC_MALLOC # this causes annoying rpl_malloc error on some machines; skip it
AC_FUNC_MEMCMP
AC_FUNC_MMAP
AC_FUNC_REALLOC
AC_FUNC_SELECT_ARGTYPES
AC_TYPE_SIGNAL
AC_FUNC_STAT
AC_FUNC_UTIME_NULL
AC_CHECK_FUNCS([bzero fchdir fdatasync floor ftruncate getcwd gethostbyname gethostname gettimeofday inet_ntoa localtime_r memmove memset mkdir munmap pow rmdir select socket sqrt strcasecmp strchr strerror strstr utime])
#AC_FUNC_MEMCMP
#AC_FUNC_MMAP
#AC_FUNC_REALLOC
#AC_FUNC_SELECT_ARGTYPES
#AC_TYPE_SIGNAL
#AC_FUNC_STAT
#AC_FUNC_UTIME_NULL
#AC_CHECK_FUNCS([bzero fchdir fdatasync floor ftruncate getcwd gethostbyname gethostname gettimeofday inet_ntoa localtime_r memmove memset mkdir munmap pow rmdir select socket sqrt strcasecmp strchr strerror strstr utime])

AC_CONFIG_HEADERS([src/acconfig.h])
AC_CONFIG_FILES([Makefile
Expand Down
95 changes: 95 additions & 0 deletions m4/swig.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
dnl check to see if SWIG is current enough.
dnl
dnl if it is, then check to see if we have the correct version of python.
dnl
dnl if we do, then set up the appropriate SWIG_ variables to build the
dnl python bindings.

AC_DEFUN([CEPH_CHECK_SWIG],
[
AC_ARG_WITH(swig,
AS_HELP_STRING([--with-swig=PATH],
[Try to use 'PATH/bin/swig' to build the
swig bindings. If PATH is not specified,
look for a 'swig' binary in your PATH.]),
[
case "$withval" in
"no")
SWIG_SUITABLE=no
CEPH_FIND_SWIG(no)
;;
"yes")
CEPH_FIND_SWIG(check)
;;
*)
CEPH_FIND_SWIG($withval)
;;
esac
],
[
CEPH_FIND_SWIG(check)
])
])

AC_DEFUN([CEPH_FIND_SWIG],
[
where=$1
if test $where = no; then
AC_PATH_PROG(SWIG, none, none)
elif test $where = check; then
AC_PATH_PROG(SWIG, swig, none)
else
if test -f "$where"; then
SWIG="$where"
else
SWIG="$where/bin/swig"
fi
if test ! -f "$SWIG" || test ! -x "$SWIG"; then
AC_MSG_ERROR([Could not find swig binary at $SWIG])
fi
fi
if test "$SWIG" != "none"; then
AC_MSG_CHECKING([swig version])
SWIG_VERSION_RAW="`$SWIG -version 2>&1 | \
sed -ne 's/^.*Version \(.*\)$/\1/p'`"
# We want the version as an integer so we can test against
# which version we're using. SWIG doesn't provide this
# to us so we have to come up with it on our own.
# The major is passed straight through,
# the minor is zero padded to two places,
# and the patch level is zero padded to three places.
# e.g. 1.3.24 becomes 103024
SWIG_VERSION="`echo \"$SWIG_VERSION_RAW\" | \
sed -e 's/[[^0-9\.]].*$//' \
-e 's/\.\([[0-9]]\)$/.0\1/' \
-e 's/\.\([[0-9]][[0-9]]\)$/.0\1/' \
-e 's/\.\([[0-9]]\)\./0\1/; s/\.//g;'`"
AC_MSG_RESULT([$SWIG_VERSION_RAW])
# If you change the required swig version number, don't forget to update:
# subversion/bindings/swig/INSTALL
# packages/rpm/redhat-8+/subversion.spec
# packages/rpm/redhat-7.x/subversion.spec
# packages/rpm/rhel-3/subversion.spec
# packages/rpm/rhel-4/subversion.spec
SWIG_SUITABLE=yes
fi
if test "$PERL" != "none"; then
AC_MSG_CHECKING([perl version])
dnl Note that the q() bit is there to avoid unbalanced brackets
dnl which m4 really doesn't like.
PERL_VERSION="`$PERL -e 'q([[); print $]] * 1000000,$/;'`"
AC_MSG_RESULT([$PERL_VERSION])
if test "$PERL_VERSION" -ge "5008000"; then
SWIG_PL_INCLUDES="\$(SWIG_INCLUDES) `$PERL -MExtUtils::Embed -e ccopts`"
else
AC_MSG_WARN([perl bindings require perl 5.8.0 or newer.])
fi
fi
AC_SUBST(SWIG)
AC_SUBST(SWIG_PL_INCLUDES)
])
27 changes: 13 additions & 14 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,24 @@ streamtest_SOURCES = streamtest.cc
streamtest_LDADD = libosd.a libebofs.a libcommon.a

# crushwrapper
lib_LTLIBRARIES = libcrushwrapper.la
libcrushwrapper_la_SOURCES = crush/CrushWrapper.h config.cc crush/mapper.c crush/builder.c crush/crush.c
libcrushwrapper_la_CFLAGS = ${AM_CFLAGS}
libcrushwrapper_la_CXXFLAGS = ${AM_CXXFLAGS}

BUILT_SOURCES = crush/CrushWrapper_wrap.cxx

SWIG_FILES = crush/CrushWrapper.i crush/CrushWrapper.h
crush/CrushWrapper_wrap.cxx: ${SWIG_FILES}
${SWIG} -perl5 -c++ -shadow $<

#crushtool_PERL = crushtool.pl
_crushwrapper_la_SOURCES = crush/CrushWrapper_wrap.cxx ${SWIG_FILES}
_crushwrapper_la_CPPFLAGS = ${SWIG_PERL_CPPFLAGS} -I/usr/lib/perl/5.8/CORE -dno-strict-aliasing -pipe
_crushwrapper_la_LDFLAGS = -module
#_crushwrapper_la_LIBADD = lib
crush/mapper.fpicco: crush/mapper.c
${CC} -fPIC ${CFLAGS} -I. -c $< -o $@

crush/builder.fpicco: crush/builder.c
${CC} -fPIC ${CFLAGS} -I. -c $< -o $@

crush/crush.fpicco: crush/crush.c
${CC} -fPIC ${CFLAGS} -I. -c $< -o $@

CRUSH_FILES = crush/mapper.fpicco crush/builder.fpicco crush/crush.fpicco
libcrushwrapper.so: crush/CrushWrapper_wrap.cxx ${CRUSH_FILES}
${CXX} ${CXXFLAGS} ${SWIG_PL_INCLUDES} -I. -shared -fPIC crush/CrushWrapper_wrap.cxx config.cc ${CRUSH_FILES} -o libcrushwrapper.so

BUILT_SOURCES = libcrushwrapper.so

##
INCLUDES =
Expand All @@ -96,8 +97,6 @@ noinst_LIBRARIES = \
libcommon.a libcrush.a \
libmon.a libmds.a libosdc.a libosd.a libebofs.a libclient.a

noinst_LTLIBRARIES = _crushwrapper.la

# extra bits
EXTRA_DIST = start.sh stop.sh

Expand Down

0 comments on commit 57db9eb

Please sign in to comment.