-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathconfigure.ac
141 lines (123 loc) · 4.5 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# Copyright 2017 GoogleGenomics R package authors. All rights reserved.
#
# 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.69)
AC_INIT([GoogleGenomics],[2.0.0]) dnl package name, version
dnl Find the compiler and compiler flags to use
: ${R_HOME=`R RHOME`}
if test -z "${R_HOME}"; then
AC_MSG_ERROR("could not determine R_HOME")
fi
CC=`"${R_HOME}/bin/R" CMD config CC`
CPP=`"${R_HOME}/bin/R" CMD config CPP`
CFLAGS=`"${R_HOME}/bin/R" CMD config CFLAGS`
CPPFLAGS=`"${R_HOME}/bin/R" CMD config CPPFLAGS`
CXX=`"${R_HOME}/bin/R" CMD config CXX`
CXXFLAGS=`"${R_HOME}/bin/R" CMD config CXXFLAGS`
LIBS=`"${R_HOME}/bin/R" CMD CONFIG LDFLAGS`
CPPFLAGS="${CPPFLAGS} -I."
dnl Check for user supplied include paths, from a configure option or
dnl from an environment variable
AC_ARG_WITH([grpc-include],
AC_HELP_STRING([--with-grpc-include=INCLUDE_PATH],
[the location of GRPC header files]),
[grpc_include_path=$withval])
if test -n "${grpc_include_path}"; then
CPPFLAGS="${CPPFLAGS} -I${grpc_include_path}"
else
if test -n "${GRPC_INCLUDE_PATH}"; then
CPPFLAGS="${CPPFLAGS} -I${GRPC_INCLUDE_PATH}"
fi
fi
dnl Same for library search paths
AC_ARG_WITH([grpc-libs],
AC_HELP_STRING([--with-grpc-libs=LIB_PATH],
[the location of GRPC libraries]),
[grpc_libs_path=$withval])
if test -n "${grpc_libs_path}"; then
LIBS="${LIBS} -L${grpc_libs_path}"
else
if test -n "${GRPC_LIBS_PATH}"; then
LIBS="${LIBS} -L${GRPC_LIBS_PATH}"
fi
fi
dnl Same for binary search paths
AC_ARG_WITH([grpc-bin],
AC_HELP_STRING([--with-grpc-bin=BIN_PATH],
[the location of GRPC binaries]),
[grpc_bin_path=$withval])
if test -n "${grpc_bin_path}"; then
PATH="${grpc_bin_path}:${PATH}"
else
if test -n "${GRPC_BIN_PATH}"; then
PATH="${GRPC_BIN_PATH}:${PATH}"
fi
fi
DEFAULT_LIBS="${LIBS}"
AC_LANG(C++)
AC_REQUIRE_CPP
dnl use pkg-config for ProtoBuf settings if available
AC_ARG_VAR(PKGCONFIG, "Whether pkg-config exists or not")
PKGCONFIG=0
AC_CHECK_PROG(PKGCONFIG, pkg-config, 1)
if test "${PKGCONFIG}" -eq 1 && pkg-config --exists protobuf; then
CPPFLAGS="${CPPFLAGS} "`pkg-config --cflags protobuf`
LIBS="${LIBS} "`pkg-config --libs protobuf`
else
LIBS="${LIBS} -lprotobuf"
fi
AC_MSG_CHECKING([if ProtoBuf version >= 3.0.0])
AC_RUN_IFELSE([AC_LANG_PROGRAM(
[#include <google/protobuf/stubs/common.h>
#include <google/protobuf/descriptor.pb.h>],
[exit(GOOGLE_PROTOBUF_VERSION < 3000000)])],
[AC_MSG_RESULT("yes"); HAVE_PROTOBUF=1],
[AC_MSG_RESULT("no"); HAVE_PROTOBUF=0])
HAVE_GRPC=0
if test "${HAVE_PROTOBUF}" -eq 1; then
AC_ARG_VAR(PROTOC_BINARY, "Absolute path of the protoc binary")
AC_PATH_PROG(PROTOC_BINARY, protoc,
AC_MSG_ERROR("protoc binary not found in $PATH"))
dnl Use pkg-config for gRPC settings
if test "${PKGCONFIG}" -eq 1 && pkg-config --exists grpc grpc; then
CPPFLAGS="${CPPFLAGS} "`pkg-config --cflags grpc grpc++`
LIBS="${LIBS} "`pkg-config --libs grpc grpc++`
else
LIBS="${LIBS} -lgrpc -lgrpc++"
fi
AC_MSG_CHECKING([gRPC])
AC_RUN_IFELSE([AC_LANG_PROGRAM(
[#include <grpc++/client_context.h>],
[::grpc::ClientContext context])],
[AC_MSG_RESULT("yes"); HAVE_GRPC=1],
[AC_MSG_RESULT("no")])
fi
AC_ARG_VAR(GRPC_PLUGIN, "Absolute path of the grpc plugin binary")
dnl Some final checks
if test "${HAVE_GRPC}" -eq 1; then
AC_PATH_PROG(GRPC_PLUGIN, grpc_cpp_plugin,
AC_MSG_ERROR("grpc_cpp_plugin binary not found in $PATH"))
fi
if test "${HAVE_GRPC}" -eq 0; then
LIBS=${DEFAULT_LIBS}
AC_MSG_WARN("[
gRPC installation could not be found,
or protocol buffer library is not >= 3.0.0.
If your installation is in a non-standard location,
please see installation instructions at
https://github.com/Bioconductor/GoogleGenomics/blob/master/README.rst
"])
fi
AC_SUBST(HAVE_GRPC)
AC_CONFIG_FILES([src/Makevars])
AC_OUTPUT