Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow building with autotools #7

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
*.so
__pycache__/
aclocal.m4
autom4te.cache/
configure
configure~
install-sh
ltmain.sh
missing
Makefile.in
compile
Makefile
config.log
config.status
3 changes: 3 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SUBDIRS = \
src \
tests
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# sst-external-element

## How to build
26 changes: 26 additions & 0 deletions bootstrap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

if [ -z $LIBTOOLIZE ] ; then
LIBTOOLIZE=$(type -P libtoolize)
if [ -z $LIBTOOLIZE ] ; then
LIBTOOLIZE=$(type -P glibtoolize)
fi
fi
if [ -z $LIBTOOL ] ; then
LIBTOOL=$(type -P "${LIBTOOLIZE%???}")
fi

if [ -z $LIBTOOL ] || [ -z $LIBTOOLIZE ] ; then
echo "Unable to find working libtool. [$LIBTOOL][$LIBTOOLIZE]"
exit 1
fi

echo "Running ${LIBTOOLIZE}..."
$LIBTOOLIZE --automake --copy

aclocal -I config
# Only if you need things in AC_CONFIG_HEADERS
# autoheader
autoconf
automake --foreign --add-missing --include-deps
autoreconf --force --install
5 changes: 5 additions & 0 deletions config/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
libtool.m4
ltoptions.m4
ltsugar.m4
ltversion.m4
lt~obsolete.m4
72 changes: 72 additions & 0 deletions config/sst_core_check_install.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# -*- mode: autoconf -*-
AC_DEFUN([SST_CORE_CHECK_INSTALL], [
AC_ARG_WITH([sst-core],
[AS_HELP_STRING([--with-sst-core=@<:@=DIR@:>@],
[Use SST Discrete Event Core installed in DIR])],
[with_sst_core=$withval/bin],
[with_sst_core=$PATH])

SST_CONFIG_TOOL=""
SST_REGISTER_TOOL=""

AS_IF( [test x"$with_sst_core" = "x/bin"],
[AC_MSG_ERROR([User undefined path while using --with-sst-core], [1])],
[AC_MSG_NOTICE([--with-sst-core check = good 1])] )

AS_IF( [test x"$with_sst_core" = "xyes/bin"],
[AC_MSG_ERROR([User undefined path while using --with-sst-core], [1])],
[AC_MSG_NOTICE([--with-sst-core check = good 2])] )

AC_PATH_PROG([SST_CONFIG_TOOL], [sst-config], [], [$with_sst_core])

AC_MSG_CHECKING([for sst-config tool available])
AS_IF([test -x "$SST_CONFIG_TOOL"],
[AC_MSG_RESULT([found $SST_CONFIG_TOOL])],
[AC_MSG_ERROR([Unable to find sst-config in $with_sst_core], [1])])

AC_PATH_PROG([SST_REGISTER_TOOL], [sst-register], [], [$with_sst_core])

AC_MSG_CHECKING([for sst-register tool available])
AS_IF([test -x "$SST_REGISTER_TOOL"],
[AC_MSG_RESULT([found $SST_REGISTER_TOOL])],
[AC_MSG_ERROR([Unable to find sst-register in $with_sst_core], [1])])

SST_CC=`$SST_CONFIG_TOOL --CC`
SST_CXX=`$SST_CONFIG_TOOL --CXX`
SST_MPICC=`$SST_CONFIG_TOOL --MPICC`
SST_MPICXX=`$SST_CONFIG_TOOL --MPICXX`
SST_PREFIX=`$SST_CONFIG_TOOL --prefix`
SST_CPPFLAGS=`$SST_CONFIG_TOOL --CPPFLAGS`
SST_CFLAGS=`$SST_CONFIG_TOOL --CFLAGS`
SST_CXXFLAGS=`$SST_CONFIG_TOOL --CXXFLAGS`
SST_LDFLAGS=`$SST_CONFIG_TOOL --LDFLAGS`
SST_LIBS=`$SST_CONFIG_TOOL --LIBS`
SST_PREVIEW_BUILD=`$SST_CONFIG_TOOL --PREVIEW_BUILD`

CC="$SST_CC"
CPP="$SST_CC"
CXX="$SST_CXX"
MPICC="$SST_MPICC"
MPICXX="$SST_MPICXX"

PYTHON_CPPFLAGS=`$SST_CONFIG_TOOL --PYTHON_CPPFLAGS`
PYTHON_LDFLAGS=`$SST_CONFIG_TOOL --PYTHON_LDFLAGS`

TEMP_CPPFLAGS="$SST_CPPFLAGS $PYTHON_CPPFLAGS -I$SST_PREFIX/include/sst/core -I$SST_PREFIX/include"
TEMP_CFLAGS="$SST_CFLAGS"
TEMP_CXXFLAGS="$SST_CXXFLAGS"
TEMP_LDFLAGS="$SST_LDFLAGS $PYTHON_LDFLAGS"
LIBS="$SST_LIBS $LIBS"

AC_SUBST([AM_CPPFLAGS], [$TEMP_CPPFLAGS])
AC_SUBST([AM_CFLAGS], [$TEMP_CFLAGS])
AC_SUBST([AM_CXXFLAGS], [$TEMP_CXXFLAGS])
AC_SUBST([AM_LDFLAGS], [$TEMP_LDFLAGS])

AC_SUBST([SST_CONFIG_TOOL])
AC_SUBST([SST_REGISTER_TOOL])
AC_SUBST([SST_PREFIX])

AM_CONDITIONAL([SST_ENABLE_PREVIEW_BUILD], [test "x$SST_PREVIEW_BUILD" = "xyes"])

])
11 changes: 11 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
AC_INIT([SST External Element Example],[-dev],[[email protected]])

AC_PREREQ([2.59])
AC_COPYRIGHT([Copyright National Technology and Engineering Solutions of Sandia (NTESS), 2004-2023])

AC_CONFIG_AUX_DIR([config])
AC_CONFIG_MACRO_DIR([config])
AM_INIT_AUTOMAKE([1.9.6 foreign])
dnl AC_PROG_CXX
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
21 changes: 21 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# AM_CPPFLAGS += \
# $(MPI_CPPFLAGS) \
# -I$(top_srcdir)/src

compdir = $(pkglibdir)
comp_LTLIBRARIES = libsimpleExternalElement.la

# SIMPLEEXTERNALELEMENT_SRC_FILES = \
# simpleExternalElement.cc \
# simpleExternalElement.h

# EXTRA_DIST =

libsimpleExternalElement_la_SOURCES = \
simpleExternalElement.cc \
simpleExternalElement.h

install-exec-hook:
$(SST_REGISTER_TOOL) simpleExternalElement simpleExternalElement_LIBDIR=$(abs_srcdir)
$(SST_REGISTER_TOOL) SST_ELEMENT_SOURCE simpleExternalElement=$(abs_srcdir)
$(SST_REGISTER_TOOL) SST_ELEMENT_TESTS simpleExternalElement=$(abs_srcdir)/tests
File renamed without changes.
4 changes: 4 additions & 0 deletions tests/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
EXTRA_DIST = \
refFiles/simpleElementExample-test-001.out \
simpleElementExample-test-001.py \
testsuite_default_sstexternalelement.py