-
Notifications
You must be signed in to change notification settings - Fork 3
/
configure.ac
64 lines (51 loc) · 1.71 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
# Process this file with autoconf to produce a configure script.
# author: Mike Smith ([email protected])
AC_PREREQ([2.65])
AC_INIT([RProtoBufLib], [0.99.0], [[email protected]])
AC_CONFIG_SRCDIR([src])
# Check the compiler configured with R
: ${R_HOME=`R RHOME`}
if test -z "${R_HOME}"; then
echo "could not determine R_HOME"
exit 1
fi
CC=`"${R_HOME}/bin/R" CMD config CC`
CFLAGS=`"${R_HOME}/bin/R" CMD config CFLAGS`
MAKE=`${R_HOME}/bin/R CMD config MAKE`
CXX=`"${R_HOME}/bin/R" CMD config CXX`
CXXFLAGS=`"${R_HOME}/bin/R" CMD config CXXFLAGS`
F77=`"${R_HOME}/bin/R" CMD config F77`
AC_LANG(C++)
# Checks for programs.
AC_PROG_CC
AC_PROG_CXX
#untar the lib
BASEPBNAME="protobuf-3.8.0"
PBTGZNAME=${BASEPBNAME}.tar.gz
cd src
if test -d ./${BASEPBNAME}; then
echo 'found ' $BASEPBNAME ' header sources and tar archive;using what is there.'
else
echo "untarring protobuf ...";
gzip -dc ${PBTGZNAME} | tar -xf -
fi;
#run this bootstrap script to update all the gnu auto build files (e.g. automake symlinked fils (e.g. ./compile), alocal.m4,etc... )
cd ${BASEPBNAME}
#./autogen.sh
#automake --add-missing #do this because the old Autoconf (e.g. 2.13) may not handle this in autoreconf
#mv m4/lt~obsolete.m4 m4/lt-obsolete.m4 # R CMD check gives warning about ~ character in filename
cd ..
echo "building protobuf...";
PBBUILD=$(pwd)/pb_build
if test -d ${PBBUILD}; then
echo 'found ' $PBBUILD ' ;using what is there.'
else
mkdir ${PBBUILD}
fi;
cd ${BASEPBNAME};
./configure --enable-static=no --with-pic=yes --enable-shared=yes --prefix="${PBBUILD}" --libdir="${PBBUILD}/lib" CXX="${CXX}" CXXFLAGS="${CXXFLAGS}" CC="${CC}" CFLAGS="${CFLAGS}"
$MAKE install
cd ../../
AC_SUBST(PBBUILD)
AC_CONFIG_FILES([src/Makevars])
AC_OUTPUT