...and make the GiNaC library aware of where it is installed.
The ginac-excompiler script is only invoked by GiNaC::compile_ex(...)
and serves no purpose on its own. In compliance with the FHS, it should
be installed in $LIBEXECDIR, not in $BINDIR. This also disburdens
distribution packagers from having to provide a manpage (which may be
required for all programs in $BINDIR).
The location for $LIBEXECDIR defaults to ${prefix}/libexec/. It may be
overwritten at configuration time. (Many distributions want to set it to
${prefix}/lib/ginac/.)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
add_definitions(-DHAVE_CONFIG_H)
+if (NOT LIBEXECDIR)
+ set (LIBEXECDIR "${CMAKE_INSTALL_PREFIX}/libexec")
+endif()
+
add_subdirectory(ginac)
add_subdirectory(tools)
add_subdirectory(check)
@cindex ginac-excompiler
@code{compile_ex} uses the shell script @code{ginac-excompiler} to start the C
compiler and produce the object files. This shell script comes with GiNaC and
-will be installed together with GiNaC in the configured @code{$PREFIX/bin}
-directory. You can also export additional compiler flags via the $CXXFLAGS
-variable:
+will be installed together with GiNaC in the configured @code{$LIBEXECDIR}
+(typically @code{$PREFIX/libexec} or @code{$PREFIX/lib/ginac}). You can also
+export additional compiler flags via the @env{$CXXFLAGS} variable:
@example
setenv("CXXFLAGS", "-O3 -fomit-frame-pointer -ffast-math", 1);
)
add_library(ginac ${ginaclib_sources})
+add_definitions(-DLIBEXECDIR="${LIBEXECDIR}/")
set_target_properties(ginac PROPERTIES
SOVERSION ${ginaclib_soversion}
VERSION ${ginaclib_version})
polynomial/debug.h
libginac_la_LDFLAGS = -version-info $(LT_VERSION_INFO)
+libginac_la_CPPFLAGS = -DLIBEXECDIR='"$(libexecdir)/"'
libginac_la_LIBADD = $(DL_LIBS)
ginacincludedir = $(includedir)/ginac
ginacinclude_HEADERS = ginac.h add.h archive.h assertion.h basic.h class_info.h \
*/
void compile_src_file(const std::string filename, bool clean_up)
{
- std::string strcompile = "ginac-excompiler " + filename;
+ std::string strcompile = LIBEXECDIR "ginac-excompiler " + filename;
if (system(strcompile.c_str())) {
throw std::runtime_error("excompiler::compile_src_file: error compiling source file!");
}
"${CMAKE_CURRENT_BINARY_DIR}/ginac-excompiler"
)
- install(PROGRAMS ginac-excompiler DESTINATION "${BIN_INSTALL_DIR}")
-endif (CMAKE_COMPILER_IS_GNUCC)
+ install(PROGRAMS ginac-excompiler DESTINATION "${LIBEXECDIR}")
+endif (CMAKE_COMPILER_IS_GNUCC)
viewgar_SOURCES = viewgar.cpp
viewgar_LDADD = ../ginac/libginac.la
-bin_SCRIPTS =
+libexec_SCRIPTS =
if CONFIG_EXCOMPILER
-bin_SCRIPTS += ginac-excompiler
+libexec_SCRIPTS += ginac-excompiler
endif
AM_CPPFLAGS = -I$(srcdir)/../ginac -I../ginac -DIN_GINAC