提交 7c986b57 编写于 作者: S stevenj

add --with-cxx to include C++ code, and don't include C++ (StoGO) by default

darcs-hash:20080412044837-c8de0-626c401f26424ecb5c0e76dd6fa6c0c837aaf04a.gz
上级 0e1e08f2
......@@ -3,12 +3,17 @@ lib_LTLIBRARIES = libnlopt.la
ACLOCAL_AMFLAGS=-I ./m4
SUBDIRS= util subplex direct cdirect stogo praxis luksan crs mlsl api . octave test
if WITH_CXX
CXX_DIRS = stogo
CXX_LIBS = stogo/libstogo.la
endif
SUBDIRS= util subplex direct cdirect $(CXX_DIRS) praxis luksan crs mlsl api . octave test
EXTRA_DIST=COPYRIGHT autogen.sh nlopt.pc.in m4
libnlopt_la_SOURCES =
libnlopt_la_LIBADD = subplex/libsubplex.la direct/libdirect.la \
cdirect/libcdirect.la stogo/libstogo.la praxis/libpraxis.la \
cdirect/libcdirect.la $(CXX_LIBS) praxis/libpraxis.la \
luksan/libluksan.la crs/libcrs.la mlsl/libmlsl.la api/libapi.la \
util/libutil.la
......
......@@ -51,8 +51,13 @@ static const char nlopt_algorithm_names[NLOPT_NUM_ALGORITHMS][256] = {
"Original DIRECT version (global, no-derivative)",
"Original DIRECT-L version (global, no-derivative)",
"Subplex (local, no-derivative)",
#ifdef WITH_CXX
"StoGO (global, derivative-based)",
"StoGO with randomized search (global, derivative-based)",
#else
"StoGO (NOT COMPILED)",
"StoGO randomized (NOT COMPILED)",
#endif
"Low-storage BFGS (LBFGS) (local, derivative-based)",
"Principal-axis, praxis (local, no-derivative)",
"Limited-memory variable-metric, rank 1 (local, derivative-based)",
......@@ -124,7 +129,9 @@ static double f_direct(int n, const double *x, int *undefined, void *data_)
return f;
}
#include "stogo.h"
#ifdef WITH_CXX
# include "stogo.h"
#endif
#include "cdirect.h"
......@@ -262,11 +269,15 @@ static nlopt_result nlopt_minimize_(
case NLOPT_GD_STOGO:
case NLOPT_GD_STOGO_RAND:
#ifdef WITH_CXX
if (!stogo_minimize(n, f, f_data, x, minf, lb, ub, &stop,
algorithm == NLOPT_GD_STOGO
? 0 : 2*n))
return NLOPT_FAILURE;
break;
#else
return NLOPT_FAILURE;
#endif
case NLOPT_LN_SUBPLEX: {
int iret;
......
......@@ -11,7 +11,6 @@ AC_DISABLE_SHARED dnl to hell with shared libraries
dnl Checks for programs.
AC_PROG_CC
AC_PROG_CXX
AC_PROG_CC_STDC
AC_PROG_INSTALL
AC_PROG_LN_S
......@@ -19,6 +18,15 @@ AC_PROG_MAKE_SET
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
AC_ARG_WITH(cxx,
[AC_HELP_STRING([--with-cxx], [include C++-based routines])],
with_cxx=$withval,with_cxx=no)
AM_CONDITIONAL(WITH_CXX, test "x$with_cxx" = xyes)
if test "x$with_cxx" = xyes; then
AC_PROG_CXX
AC_DEFINE([WITH_CXX], 1, [Define if compiled including C++-based routines])
fi
dnl Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDC
AC_HEADER_TIME
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册