Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
134 lines (122 sloc) 4.21 KB
#
# Copyright 2012 Couchbase, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
AC_PREREQ(2.60)
m4_include([m4/version.m4])
AC_INIT(libcbio, VERSION_NUMBER, support@couchbase.com)
AC_CONFIG_SRCDIR([src/internal.h])
AC_CONFIG_AUX_DIR(config)
AC_USE_SYSTEM_EXTENSIONS
AM_INIT_AUTOMAKE(subdir-objects)
AC_PROG_CXX
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_LN_S
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
AM_CONFIG_HEADER([src/config.h])
AC_CONFIG_MACRO_DIR([m4])
# the malloc tests seems to be broken for cross compilation.. ignore them
ac_cv_func_malloc_0_nonnull=yes
ac_cv_func_realloc_0_nonnull=yes
COUCHBASE_GENERIC_COMPILER(c89)
AM_CPPFLAGS="$AM_CPPFLAGS -I\${top_srcdir}/src"
LIBCBIO_API_CURRENT=1
LIBCBIO_API_REVISION=0
LIBCBIO_API_AGE=0
AC_SUBST(LIBCBIO_API_CURRENT)
AC_SUBST(LIBCBIO_API_REVISION)
AC_SUBST(LIBCBIO_API_AGE)
AS_IF([test "x$GTEST_ROOT" != "x"], [
AC_CACHE_CHECK([for gtest source], [ac_cv_have_gtest_src], [
AS_IF([test -f "$GTEST_ROOT/src/gtest-all.cc"],
[ac_cv_have_gtest_src=yes],
[ac_cv_have_gtest_src=no]) ])
], [
ac_cv_have_gtest_src=no
GTEST_ROOT=.
])
AC_SUBST(GTEST_ROOT)
AS_IF([test "x$ac_cv_have_gtest_src" = "xno"], [
AC_CACHE_CHECK([for gtest], [ac_cv_have_gtest], [
AC_LANG_PUSH([C++])
SAVED_LIBS="$LIBS"
LIBS="-lgtest"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[
#include "gtest/gtest.h"
],
[
return 0;
])],
[ac_cv_have_gtest=yes],
[ac_cv_have_gtest=no])
AC_LANG_POP([C++])
LIBS="$SAVED_LIBS"
])
])
AM_CONDITIONAL(HAVE_GOOGLETEST_SRC, [test "$ac_cv_have_gtest_src" = "yes"])
AM_CONDITIONAL(HAVE_GOOGLETEST, [test "$ac_cv_have_gtest" = "yes" -o \
"$ac_cv_have_gtest_src" = "yes"])
AC_CHECK_HEADERS_ONCE([libcouchstore/couch_common.h])
AS_IF([test "x$ac_cv_header_libcouchstore_couch_common_h" != "xyes"],
[AC_MSG_ERROR(Failed to locate libcouchstore/couch_common.h)])
AH_TOP([
#ifndef CONFIG_H
#define CONFIG_H
/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* Copyright 2012 Couchbase, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* This file is generated by running configure. Any changes you make to this
* file will be overwritten the next time you run configure. If you want to
* make permanent changes to the file you should edit configure.ac instead.
* All platform-specific includes should be placed inside config_static.h
* to keep the config.h as small as possible. That allows us for easily
* use another build systems with a poor support for automake (like Windows)
*/
])
AH_BOTTOM([
#endif
])
dnl ----------------------------------------------------------------------------
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
AS_IF([test "$ac_cv_have_gtest" = "no" -a "$ac_cv_have_gtest_src" = "no"],
[
echo "*****"
echo "*"
echo "* WARNING: I couldn't find the googletest testsuite framework."
echo "* This means you cannot run the test suite to verify"
echo "* that the library works as expected."
echo "* You should consider installing it from:"
echo "* http://code.google.com/p/googletest/"
echo "*"
echo "*****"
])