Skip to content

Commit

Permalink
Adding autoconf
Browse files Browse the repository at this point in the history
  • Loading branch information
gvegayon committed Aug 24, 2017
1 parent 105d55a commit 98020e2
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 6 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ README[.]md
^next_release\.md$
^src/rgraph_scale_free.+$
makefile
^src/Makevars$
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2017-08-24 George G. Vega Yon <[email protected]>
* : Creating the configure.ac, src/Makevars.in, and cleanup
files so that autoconf sets OpenMP.


2017-08-23 George G. Vega Yon <[email protected]>
* R/egonets.R: Working on possible bug reported by CRAN.
* R/stats.R: Documentation.
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: netdiffuseR
Title: Analysis of Diffusion and Contagion Processes on Networks
Version: 1.18.2999
Date: 2017-07-22
Date: 2017-08-24
Authors@R: c(
person("George", "Vega Yon", email="[email protected]", role=c("aut", "cre"), comment="Rewrite functions with Rcpp, plus new features"),
person("Stephanie", "Dyal", email="[email protected]", role=c("aut"), comment="Package's first version"),
Expand Down
3 changes: 3 additions & 0 deletions cleanup
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

rm -f config.* src/Makevars
60 changes: 60 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# -*- Autoconf -*-
# netdiffuseR configure.ac
# (with some code borrowed from RcppArmadillo configure.ac
# and ARTP2 configure.ac)
#
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.69])

AC_INIT(netdiffuseR, m4_esyscmd_s([awk '/^Version:/ {print $2}' DESCRIPTION]))

## Set R_HOME, respecting an environment variable if one is set
: ${R_HOME=$(R RHOME)}
if test -z "${R_HOME}"; then
AC_MSG_ERROR([Could not determine R_HOME.])
fi

## Use R to set CXX and CXXFLAGS
CXX=$(${R_HOME}/bin/R CMD config CXX)
CXXFLAGS=$("${R_HOME}/bin/R" CMD config CXXFLAGS)

## We are using C++
AC_LANG(C++)
AC_REQUIRE_CPP

dnl this the meat of R's m4/openmp.m4
OPENMP_[]_AC_LANG_PREFIX[]FLAGS=
AC_ARG_ENABLE([openmp],
[AS_HELP_STRING([--disable-openmp], [do not use OpenMP])])
if test "$enable_openmp" != no; then
AC_CACHE_CHECK([for $[]_AC_CC[] option to support OpenMP],
[ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp],
[AC_LINK_IFELSE([_AC_LANG_OPENMP],
[ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp='none needed'],
[ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp='unsupported'
for ac_option in -fopenmp -xopenmp -qopenmp \
-openmp -mp -omp -qsmp=omp -homp \
-fopenmp=libomp \
-Popenmp --openmp; do
ac_save_[]_AC_LANG_PREFIX[]FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $ac_option"
AC_LINK_IFELSE([_AC_LANG_OPENMP],
[ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp=$ac_option])
_AC_LANG_PREFIX[]FLAGS=$ac_save_[]_AC_LANG_PREFIX[]FLAGS
if test "$ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp" != unsupported; then
break
fi
done])])
case $ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp in #(
"none needed" | unsupported)
;; #(
*)
OPENMP_[]_AC_LANG_PREFIX[]FLAGS=$ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp ;;
esac
fi

AC_SUBST(OPENMP_CXXFLAGS)
AC_CONFIG_FILES([src/Makevars])
AC_OUTPUT

2 changes: 1 addition & 1 deletion makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
all:
news:
Rscript -e "rmarkdown::pandoc_convert('NEWS.md', 'plain', output='inst/NEWS')"&& \
head -n 80 inst/NEWS
check:
Expand Down
4 changes: 2 additions & 2 deletions src/Makevars
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) $(SHLIB_OPENMP_CXXFLAGS)
PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) -fopenmp
# 1.2.4 Using C++11 code
CXX_STD = CXX11

# This is necesary since ARMADILLO now supports OpenMP
PKG_CXXFLAGS=$(SHLIB_OPENMP_CXXFLAGS) -DARMA_64BIT_WORD
PKG_CXXFLAGS=-fopenmp -DARMA_64BIT_WORD

# For testing
#PKG_CXXFLAGS=-Wall
Expand Down
4 changes: 2 additions & 2 deletions src/Makevars.win → src/Makevars.in
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) $(SHLIB_OPENMP_CXXFLAGS)
PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) @OPENMP_CXXFLAGS@
# 1.2.4 Using C++11 code
CXX_STD = CXX11

# This is necesary since ARMADILLO now supports OpenMP
PKG_CXXFLAGS=$(SHLIB_OPENMP_CXXFLAGS) -DARMA_64BIT_WORD
PKG_CXXFLAGS=@OPENMP_CXXFLAGS@ -DARMA_64BIT_WORD

# For testing
#PKG_CXXFLAGS=-Wall
Expand Down

0 comments on commit 98020e2

Please sign in to comment.