Move Boinc detection to a separate .m4 file so it can be reused

Update the package version to match the comments in the header files


git-svn-id: svn+ssh://cvs.lpds.sztaki.hu/var/lib/svn/szdg/dcapi/trunk@162 a7169a2c-3604-0410-bc95-c702d8d87f7a
This commit is contained in:
gombasg 2005-12-08 14:18:56 +00:00 committed by Adam Visegradi
parent 46c59fa5eb
commit 5e1b94f00d
2 changed files with 166 additions and 60 deletions

157
dcapi/cf/boinc.m4 Normal file
View File

@ -0,0 +1,157 @@
dnl
dnl Check for BOINC components
dnl
dnl
dnl SZDG_BOINC_COMMON
dnl
dnl Check for components common for the client and server API
dnl
AC_DEFUN([SZDG_BOINC_COMMON], [
AC_ARG_WITH([boinc], AS_HELP_STRING([--with-boinc@<:@=DIR@:>@],
[Use BOINC (compiled or installed in DIR)]),, [with_boinc=auto])
no_boinc=
if test "$with_boinc" = no; then
no_boinc=yes
fi
if test "$no_boinc" != yes; then
case "$with_boinc" in
yes|auto)
BOINC_INCLUDES="/usr/include/BOINC"
BOINC_CPPFLAGS="-I/usr/include/BOINC"
BOINC_LDFLAGS=
;;
*)
# Check if this is an installed or just a compiled-in-place
# version
if test -d "$with_boinc/sched"; then
BOINC_CPPFLAGS="-I$with_boinc/api -I$with_boinc/lib -I$with_boinc/sched -I$with_boinc/tools"
if test -d "$with_boinc/RSAEuro/source"; then
BOINC_CPPFLAGS="$BOINC_CPPFLAGS -I$with_boinc/RSAEuro/source"
fi
BOINC_LDFLAGS="-L$with_boinc/api -L$with_boinc/lib -L$with_boinc/sched"
else
BOINC_CPPFLAGS="-I$with_boinc/include/BOINC"
if test -d "$with_boinc/RSAEuro"; then
BOINC_CPPFLAGS="$BOINC_CPPFLAGS -I$with_boinc/RSAEuro"
fi
BOINC_LDFLAGS="-L$with_boinc/lib"
fi
;;
esac
fi
dnl
dnl Check if BOINC uses RSAEuro or OpenSSL
dnl
if test "$no_boinc" != yes; then
AC_CACHE_CHECK([if BOINC still uses RSAEuro], [boinc_cv_use_rsaeuro], [
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $BOINC_CPPFLAGS"
AC_LANG_PUSH([C++])
AC_EGREP_HEADER([rsaeuro.h], [crypt.h], [boinc_cv_use_rsaeuro=yes],
[boinc_cv_use_rsaeuro=no])
AC_LANG_POP([C++])
CPPFLAGS="$save_CPPFLAGS"
])
BOINC_COMMON_LIBS="-lsched -lboinc"
BOINC_CPPFLAGS="$BOINC_CPPFLAGS"
if test "$boinc_cv_use_rsaeuro" = yes; then
if test -d "$BOINC_INCLUDES/RSAEuro/source"; then
BOINC_CPPFLAGS="$BOINC_CPPFLAGS -I$BOINC_INCLUDES/RSAEuro/source"
else
if test -d "$BOINC_INCLUDES/RSAEuro"; then
BOINC_CPPFLAGS="$BOINC_CPPFLAGS -I$BOINC_INCLUDES/RSAEuro"
fi
fi
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $BOINC_CPPFLAGS"
AC_CHECK_HEADER([rsaeuro.h],,
[AC_MSG_ERROR([rsaeuro.h is required but missing])])
CPPFLAGS="$save_CPPFLAGS"
BOINC_COMMON_LIBS="$BOINC_COMMON_LIBS -lrsaeuro"
else
BOINC_COMMON_LIBS="$BOINC_COMMON_LIBS -lcrypto"
fi
fi
AC_SUBST([BOINC_CPPFLAGS])
AC_SUBST([BOINC_LDFLAGS])
])
dnl
dnl SZDG_BOINC_SERVER
dnl
dnl Check for BOINC server-side API
dnl
AC_DEFUN([SZDG_BOINC_SERVER], [
AC_REQUIRE([SZDG_BOINC_COMMON])
dnl
dnl First check for MySQL
dnl
AC_PATH_PROG([MYSQL_CONFIG], [mysql_config])
if test "$MYSQL_CONFIG" = ""; then
no_boinc=yes
else
MYSQL_CPPFLAGS="`$MYSQL_CONFIG --include`"
MYSQL_LIBS=`$MYSQL_CONFIG --libs | sed -e 's,-L/usr/lib , ,'`
fi
AC_SUBST([MYSQL_CPPFLAGS])
AC_SUBST([MYSQL_LIBS])
dnl
dnl Check for BOINC 4.x/5.x
dnl
AC_LANG_PUSH([C++])
AH_TEMPLATE([BOINC_VERSION], [BOINC major version])
if test "$no_boinc" != yes; then
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $BOINC_CPPFLAGS"
AC_CACHE_CHECK([for BOINC version], [boinc_cv_boinc_version], [
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sched_msgs.h>],
[SCHED_MSG_LOG::Kind level = SCHED_MSG_LOG::CRITICAL;])],
[boinc_cv_boinc_version=4],
[boinc_cv_boinc_version=5])
])
CPPFLAGS="$save_CPPFLAGS"
AC_DEFINE_UNQUOTED([BOINC_VERSION], [$boinc_cv_boinc_version])
fi
AC_LANG_POP([C++])
if test "$no_boinc" != yes; then
BOINC_SERVER_CPPFLAGS="$BOINC_CPPFLAGS $MYSQL_CPPFLAGS"
BOINC_SERVER_LIBS="$BOINC_COMMON_LIBS -lstdc++ $MYSQL_LIBS"
fi
AC_SUBST([BOINC_SERVER_CPPFLAGS])
AC_SUBST([BOINC_SERVER_LIBS])
if test "$with_boinc" = yes && test "$no_boinc" = yes; then
AC_MSG_ERROR([BOINC development environment was not found])
fi
])
dnl
dnl SZDG_BOINC_CLIENT
dnl
dnl Check for BOINC client-side API
dnl
AC_DEFUN([SZDG_BOINC_CLIENT], [
AC_REQUIRE([SZDG_BOINC_COMMON])
CPPFLAGS="$CPPFLAGS $BOINC_CPPFLAGS"
AC_CHECK_HEADERS([boinc_api.h filesys.h diagnostics.h],, [no_boinc=yes])
AC_LANG_PUSH([C++])
AC_CHECK_LIB([boinc_api], [boinc_init], [true], [no_boinc=yes],
[-lboinc -lpthread -lz -lm])
AC_LANG_POP([C++])
BOINC_CLIENT_LIBS="-lboinc_api $BOINC_COMMON_LIBS -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic -lpthread -lz -lm"
AC_SUBST([BOINC_CLIENT_LIBS])
])

View File

@ -1,4 +1,5 @@
AC_INIT([Distributed Computing API], [0.1], [podhorszki@sztaki.hu], [dcapi])
AC_INIT([Distributed Computing API], [0.2], [podhorszki@sztaki.hu], [dcapi])
AC_CONFIG_MACRO_DIR([cf])
AC_CONFIG_HEADERS([include/config.h])
AC_CONFIG_AUX_DIR([scripts])
AC_CONFIG_SRCDIR([include/dc.h])
@ -10,67 +11,15 @@ AC_PROG_LIBTOOL
LIBTOOL="$LIBTOOL --silent"
AC_ARG_WITH([boinc], AS_HELP_STRING([--with-boinc@<:@=DIR@:>@],
[Use BOINC (installed in DIR)]),, [with_boinc=auto])
no_boinc=
if test "$with_boinc" = no; then
no_boinc=yes
fi
if test "$no_boinc" != yes; then
case "$with_boinc" in
yes|auto)
BOINC_INCLUDES="/usr/include/BOINC"
;;
*)
BOINC_INCLUDES="$with_boinc"
;;
esac
AC_PATH_PROG([MYSQL_CONFIG], [mysql_config])
if test "$MYSQL_CONFIG" = ""; then
no_boinc=yes
fi
fi
if test "$no_boinc" != yes; then
BOINC_CPPFLAGS="-I$BOINC_INCLUDES -I$BOINC_INCLUDES/db -I$BOINC_INCLUDES/lib -I$BOINC_INCLUDES/sched -I$BOINC_INCLUDES/tools"
if test -d "$BOINC_INCLUDES/RSAEuro/source"; then
BOINC_CPPFLAGS="$BOINC_CPPFLAGS -I$BOINC_INCLUDES/RSAEuro/source"
else
if test -d "$BOINC_INCLUDES/RSAEuro"; then
BOINC_CPPFLAGS="$BOINC_CPPFLAGS -I$BOINC_INCLUDES/RSAEuro"
fi
fi
BOINC_LIBS="-lboinc -lboinc_api -lsched -lboinc_zip"
AC_CHECK_LIB([rsaeuro], [RSAPrivateEncrypt],
[BOINC_LIBS="$BOINC_LIBS -lrsaeuro"],
[BOINC_LIBS="$BOINC_LIBS -lcrypto"])
MYSQL_CPPFLAGS=`$MYSQL_CONFIG --cflags`
MYSQL_LIBS=`$MYSQL_CONFIG --libs | sed -e 's,-L/usr/lib , ,'`
AC_SUBST([BOINC_CPPFLAGS])
AC_SUBST([BOINC_LIBS])
AC_SUBST([MYSQL_CPPFLAGS])
AC_SUBST([MYSQL_LIBS])
if test "$ac_cv_c_compiler_gnu" = yes; then
CFLAGS="-Wall -Wmissing-prototypes -Wstrict-prototypes -Wsign-compare ${CFLAGS}"
CXXFLAGS="-Wall -Wsign-compare ${CXXFLAGS}"
fi
AC_LANG([C++])
AH_TEMPLATE([BOINC_VERSION], [BOINC major version])
SZDG_BOINC_SERVER
if test "$no_boinc" != yes; then
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $BOINC_CPPFLAGS"
AC_CACHE_CHECK([for BOINC version], [dc_cv_boinc_version], [
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sched_msgs.h>],
[SCHED_MSG_LOG::Kind level = SCHED_MSG_LOG::CRITICAL;])],
[dc_cv_boinc_version=4],
[dc_cv_boinc_version=5])
])
CPPFLAGS="$save_CPPFLAGS"
AC_DEFINE_UNQUOTED([BOINC_VERSION], [$dc_cv_boinc_version])
AC_CHECK_HEADERS([uuid/uuid.h],, [AC_MSG_ERROR([libuuid headers are missing])])
AC_CHECK_LIB([uuid], [uuid_generate], [true], [AC_MSG_ERROR([libuuid is missing])])
fi
AC_ARG_WITH([clgr], AS_HELP_STRING([--with-clgr@<:@=DIR@:>@],
@ -79,7 +28,7 @@ AC_ARG_WITH([clgr], AS_HELP_STRING([--with-clgr@<:@=DIR@:>@],
AC_ARG_ENABLE([local], AS_HELP_STRING([--enable-local],
[Build local DC-API]),, [enable_local=yes])
AM_CONDITIONAL([WITH_BOINC], [test "$with_boinc" != no])
AM_CONDITIONAL([WITH_BOINC], [test "$no_boinc" != yes])
AM_CONDITIONAL([WITH_CLGR], [test "$with_clgr" != no])
AM_CONDITIONAL([WITH_LOCAL], [test "$enable_local" == yes])