1
1

Improve/expand the database configure logic for future use

This commit was SVN r30984.
Этот коммит содержится в:
Ralph Castain 2014-03-11 03:01:15 +00:00
родитель c6906e8b8c
Коммит 96f67507a5
2 изменённых файлов: 93 добавлений и 12 удалений

80
config/opal_check_db.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,80 @@
# -*- shell-script -*-
#
# Copyright (c) 2014 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# --------------------------------------------------------
AC_DEFUN([OPAL_CHECK_POSTGRES],[
AC_ARG_WITH([postgres],
[AC_HELP_STRING([--with-postgres(=DIR)],
[Build Postgres support, optionally adding DIR to the search path (default: no)])],
[], with_postgres=no)
AC_MSG_CHECKING([if Postgres support requested])
AS_IF([test "$with_postgres" = "no" -o "x$with_postgres" = "x"],
[opal_check_postgres_happy=no
AC_MSG_RESULT([no])],
[AS_IF([test "$with_postgres" = "yes"],
[AS_IF([test "x`ls /usr/include/libpq-fe.h 2> /dev/null`" = "x"],
[AC_MSG_RESULT([not found in standard location])
AC_MSG_WARN([Expected file /usr/include/libpq-fe.h not found])
AC_MSG_ERROR([Cannot continue])],
[AC_MSG_RESULT([found])
opal_check_postgres_happy=yes
opal_postgres_incdir="/usr/include"])],
[AS_IF([test ! -d "$with_postgres"],
[AC_MSG_RESULT([not found])
AC_MSG_WARN([Directory $with_postgres not found])
AC_MSG_ERROR([Cannot continue])],
[AS_IF([test "x`ls $with_postgres/include/libpq-fe.h 2> /dev/null`" = "x"],
[AS_IF([test "x`ls $with_postgres/libpq-fe.h 2> /dev/null`" = "x"],
[AC_MSG_RESULT([not found])
AC_MSG_WARN([Could not find libpq-fe.h in $with_postgres/include or $with_postgres])
AC_MSG_ERROR([Cannot continue])],
[opal_check_postgres_happy=yes
opal_postgres_incdir=$with_postgres
AC_MSG_RESULT([found ($with_postgres/libpq-fe.h)])])],
[opal_check_postgres_happy=yes
opal_postgres_incdir="$with_postgres/include"
AC_MSG_RESULT([found ($opal_postgres_incdir/libpq-fe.h)])])])])])
])
# --------------------------------------------------------
AC_DEFUN([OPAL_CHECK_MYSQL],[
AC_ARG_WITH([mysql],
[AC_HELP_STRING([--with-mysql(=DIR)],
[Build Mysql support, optionally adding DIR to the search path (default: no)])],
[], with_mysql=no)
AC_MSG_CHECKING([if Mysql support requested])
AS_IF([test "$with_mysql" = "no" -o "x$with_mysql" = "x"],
[opal_check_mysql_happy=no
AC_MSG_RESULT([no])],
[AS_IF([test "$with_mysql" = "yes"],
[AS_IF([test "x`ls /usr/include/mysql/mysql.h 2> /dev/null`" = "x"],
[AC_MSG_RESULT([not found in standard location])
AC_MSG_WARN([Expected file /usr/include/mysql/mysql.h not found])
AC_MSG_ERROR([Cannot continue])],
[AC_MSG_RESULT([found])
opal_check_mysql_happy=yes
opal_mysql_incdir="/usr/include/mysql"])],
[AS_IF([test ! -d "$with_mysql"],
[AC_MSG_RESULT([not found])
AC_MSG_WARN([Directory $with_mysql not found])
AC_MSG_ERROR([Cannot continue])],
[AS_IF([test "x`ls $with_mysql/include/mysql.h 2> /dev/null`" = "x"],
[AS_IF([test "x`ls $with_mysql/mysql.h 2> /dev/null`" = "x"],
[AC_MSG_RESULT([not found])
AC_MSG_WARN([Could not find mysql.h in $with_mysql/include or $with_mysql])
AC_MSG_ERROR([Cannot continue])],
[opal_check_mysql_happy=yes
opal_mysql_incdir=$with_mysql
AC_MSG_RESULT([found ($with_mysql/mysql.h)])])],
[opal_check_mysql_happy=yes
opal_mysql_incdir="$with_mysql/include"
AC_MSG_RESULT([found ($opal_mysql_incdir/mysql.h)])])])])])
])

Просмотреть файл

@ -14,27 +14,28 @@ dnl
AC_DEFUN([MCA_opal_db_postgres_CONFIG], [
AC_CONFIG_FILES([opal/mca/db/postgres/Makefile])
AC_ARG_WITH([postgres],
[AC_HELP_STRING([--with-postgres],
[Build postgres support (default: no)])],
[], with_postgres=no)
AC_REQUIRE([OPAL_CHECK_POSTGRES])
# do not build if support not requested
AS_IF([test "$with_postgres" != "no"],
[AS_IF([test ! -z "$with_postgres" -a "$with_postgres" != "yes"],
[opal_check_postgres_dir="$with_postgres"])
AS_IF([test "$opal_check_postgres_happy" == "yes"],
[opal_db_postgres_check_save_CPPFLAGS=$CPPFLAGS
opal_db_postgres_check_save_LDFLAGS=$LDFLAGS
opal_db_postgres_check_save_LIBS=$LIBS
OMPI_CHECK_PACKAGE([db_postgres],
[libpq-fe.h],
[pq],
[PQconnectdb],
[],
[$opal_check_postgres_dir],
[$opal_postgres_incdir],
[],
[$1],
[AC_MSG_WARN([POSTGRES DATABASE SUPPORT REQUESTED])
AC_MSG_WARN([BUT REQUIRED LIBRARY OR HEADER NOT FOUND])
AC_MSG_ERROR([CANNOT CONTINUE])
$2])],
[AC_MSG_WARN([Postgres database support requested])
AC_MSG_WARN([but required library or header not found])
AC_MSG_ERROR([Cannot continue])
$2])
CPPFLAGS=$opal_db_postgres_check_save_CPPFLAGS
LDFLAGS=$opal_db_postgres_check_save_LDFLAGS
LIBS=$opal_db_postgres_check_save_LIBS],
[$2])
AC_SUBST(db_postgres_CPPFLAGS)