Browse Source

Compile `indiana` and `stranamore` *only* with --enable-mpi.

Add a new automake variable CLUSTER, to discriminate for programs being run in cluster mode.
Michele Orrù 11 years ago
parent
commit
7d955d3e7f
3 changed files with 32 additions and 5 deletions
  1. 19 1
      configure
  2. 4 1
      configure.ac
  3. 9 3
      src/Makefile.am

+ 19 - 1
configure

@@ -625,6 +625,8 @@ ac_includes_default="\
 ac_subst_vars='am__EXEEXT_FALSE
 am__EXEEXT_TRUE
 LTLIBOBJS
+CLUSTER_FALSE
+CLUSTER_TRUE
 LIBOBJS
 EGREP
 GREP
@@ -4445,9 +4447,21 @@ fi
 
 # Check whether --enable-mpi was given.
 if test "${enable_mpi+set}" = set; then :
-  enableval=$enable_mpi;
+  enableval=$enable_mpi; mpi=true
+fi
+
+
+if test x$mpi = xtrue; then :
+
 $as_echo "#define HAVE_OPENMPI 1" >>confdefs.h
 
+fi
+ if test x$mpi = xtrue; then
+  CLUSTER_TRUE=
+  CLUSTER_FALSE='#'
+else
+  CLUSTER_TRUE='#'
+  CLUSTER_FALSE=
 fi
 
 
@@ -4586,6 +4600,10 @@ if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
   as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${CLUSTER_TRUE}" && test -z "${CLUSTER_FALSE}"; then
+  as_fn_error $? "conditional \"CLUSTER\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 
 : "${CONFIG_STATUS=./config.status}"
 ac_write_fail=0

+ 4 - 1
configure.ac

@@ -41,7 +41,10 @@ AC_ARG_ENABLE(debug,
 
 AC_ARG_ENABLE(mpi,
    AS_HELP_STRING([--enable-mpi], [enable mpi library, default:no]),
-   AC_DEFINE([HAVE_OPENMPI], [1], [OpenMPI support]))
+   [mpi=true])
+
+AS_IF([test x$mpi = xtrue], AC_DEFINE([HAVE_OPENMPI], [1], [OpenMPI support]))
+AM_CONDITIONAL([CLUSTER], [test x$mpi = xtrue])
 
 AC_OUTPUT([Makefile
            src/Makefile src/questions/Makefile

+ 9 - 3
src/Makefile.am

@@ -1,12 +1,18 @@
 SUBDIRS = questions/ apps/ tests/
 
+if CLUSTER
 bin_PROGRAMS = qa indiana stranamore
 
-qa_SOURCES = qa.c qa_sock.c cmdline.c
-qa_LDADD = questions/libquestions.a -lssl -lcrypto
-
 indiana_SOURCES = indiana.c qa_sock.c
 indiana_LDADD = questions/libquestions.a -lssl -lcrypto
 
 stranamore_SOURCES = stranamore.c
 stranamore_LDADD = -lssl -lcrypto
+
+else
+bin_PROGRAMS = qa
+
+endif
+
+qa_SOURCES = qa.c qa_sock.c cmdline.c
+qa_LDADD = questions/libquestions.a -lssl -lcrypto