diff --git a/CMakeLists.txt b/CMakeLists.txt index 86d76fa..2090ece 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -159,6 +159,11 @@ if (READLINE_FOUND) set(HAVE_READLINE_HISTORY_H 1) endif() +find_package(LibDL) +if (LIBDL_FOUND) + set(HAVE_LIBDL 1) +endif() + find_program(MAKEINFO makeinfo) find_program(FIG2DEV fig2dev) diff --git a/cmake/modules/FindLibDL.cmake b/cmake/modules/FindLibDL.cmake new file mode 100644 index 0000000..7aee0cd --- /dev/null +++ b/cmake/modules/FindLibDL.cmake @@ -0,0 +1,30 @@ +# - Find libdl +# Find the native LIBDL includes and library +# +# LIBDL_INCLUDE_DIR - where to find dlfcn.h, etc. +# LIBDL_LIBRARIES - List of libraries when using libdl. +# LIBDL_FOUND - True if libdl found. + + +IF (LIBDL_INCLUDE_DIR) + # Already in cache, be silent + SET(LIBDL_FIND_QUIETLY TRUE) +ENDIF (LIBDL_INCLUDE_DIR) + +FIND_PATH(LIBDL_INCLUDE_DIR dlfcn.h) + +SET(LIBDL_NAMES dl libdl ltdl libltdl) +FIND_LIBRARY(LIBDL_LIBRARY NAMES ${LIBDL_NAMES} ) + +# handle the QUIETLY and REQUIRED arguments and set LIBDL_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibDL DEFAULT_MSG LIBDL_LIBRARY LIBDL_INCLUDE_DIR) + +IF(LIBDL_FOUND) + SET( LIBDL_LIBRARIES ${LIBDL_LIBRARY} ) +ELSE(LIBDL_FOUND) + SET( LIBDL_LIBRARIES ) +ENDIF(LIBDL_FOUND) + +MARK_AS_ADVANCED( LIBDL_LIBRARY LIBDL_INCLUDE_DIR ) diff --git a/config.cmake.in b/config.cmake.in index 73fca28..b2589ee 100644 --- a/config.cmake.in +++ b/config.cmake.in @@ -3,3 +3,4 @@ #cmakedefine HAVE_LIBREADLINE #cmakedefine HAVE_READLINE_READLINE_H #cmakedefine HAVE_READLINE_HISTORY_H +#cmakedefine HAVE_LIBDL diff --git a/excompiler.patch b/excompiler.patch new file mode 100644 index 0000000..81f2814 --- /dev/null +++ b/excompiler.patch @@ -0,0 +1,85 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 86d76fa..2090ece 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -159,6 +159,11 @@ if (READLINE_FOUND) + set(HAVE_READLINE_HISTORY_H 1) + endif() + ++find_package(LibDL) ++if (LIBDL_FOUND) ++ set(HAVE_LIBDL 1) ++endif() ++ + find_program(MAKEINFO makeinfo) + find_program(FIG2DEV fig2dev) + +diff --git a/cmake/modules/FindLibDL.cmake b/cmake/modules/FindLibDL.cmake +new file mode 100644 +index 0000000..7aee0cd +--- /dev/null ++++ b/cmake/modules/FindLibDL.cmake +@@ -0,0 +1,30 @@ ++# - Find libdl ++# Find the native LIBDL includes and library ++# ++# LIBDL_INCLUDE_DIR - where to find dlfcn.h, etc. ++# LIBDL_LIBRARIES - List of libraries when using libdl. ++# LIBDL_FOUND - True if libdl found. ++ ++ ++IF (LIBDL_INCLUDE_DIR) ++ # Already in cache, be silent ++ SET(LIBDL_FIND_QUIETLY TRUE) ++ENDIF (LIBDL_INCLUDE_DIR) ++ ++FIND_PATH(LIBDL_INCLUDE_DIR dlfcn.h) ++ ++SET(LIBDL_NAMES dl libdl ltdl libltdl) ++FIND_LIBRARY(LIBDL_LIBRARY NAMES ${LIBDL_NAMES} ) ++ ++# handle the QUIETLY and REQUIRED arguments and set LIBDL_FOUND to TRUE if ++# all listed variables are TRUE ++INCLUDE(FindPackageHandleStandardArgs) ++FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibDL DEFAULT_MSG LIBDL_LIBRARY LIBDL_INCLUDE_DIR) ++ ++IF(LIBDL_FOUND) ++ SET( LIBDL_LIBRARIES ${LIBDL_LIBRARY} ) ++ELSE(LIBDL_FOUND) ++ SET( LIBDL_LIBRARIES ) ++ENDIF(LIBDL_FOUND) ++ ++MARK_AS_ADVANCED( LIBDL_LIBRARY LIBDL_INCLUDE_DIR ) +diff --git a/config.cmake.in b/config.cmake.in +index 73fca28..b2589ee 100644 +--- a/config.cmake.in ++++ b/config.cmake.in +@@ -3,3 +3,4 @@ + #cmakedefine HAVE_LIBREADLINE + #cmakedefine HAVE_READLINE_READLINE_H + #cmakedefine HAVE_READLINE_HISTORY_H ++#cmakedefine HAVE_LIBDL +diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt +index 8ad8a07..b0628ee 100644 +--- a/tools/CMakeLists.txt ++++ b/tools/CMakeLists.txt +@@ -4,4 +4,11 @@ add_definitions(-DIN_GINAC) + add_executable(viewgar viewgar.cpp) + target_link_libraries(viewgar ginac) + install(TARGETS viewgar RUNTIME DESTINATION "${BIN_INSTALL_DIR}") ++set (CC gcc) + ++configure_file ( ++ "${CMAKE_CURRENT_SOURCE_DIR}/ginac-excompiler.in" ++ "${CMAKE_CURRENT_BINARY_DIR}/ginac-excompiler" ++) ++ ++install(PROGRAMS ginac-excompiler DESTINATION "${BIN_INSTALL_DIR}") +diff --git a/tools/ginac-excompiler.in b/tools/ginac-excompiler.in +index 0bd0c97..89e0a0c 100644 +--- a/tools/ginac-excompiler.in ++++ b/tools/ginac-excompiler.in +@@ -1,2 +1,2 @@ + #!/bin/sh +-@CC@ -x c -fPIC -shared -o $1.so $1 ++@CC@ -x c -fPIC -shared $GINAC_EXCOMPILER_FLAGS -o $1.so $1 diff --git a/scripts/yaptu.pyc b/scripts/yaptu.pyc new file mode 100644 index 0000000..4fc1b3d Binary files /dev/null and b/scripts/yaptu.pyc differ diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 8ad8a07..7c516ed 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -5,3 +5,12 @@ add_executable(viewgar viewgar.cpp) target_link_libraries(viewgar ginac) install(TARGETS viewgar RUNTIME DESTINATION "${BIN_INSTALL_DIR}") +if (CMAKE_COMPILER_IS_GNUCC) + set (CC gcc) + configure_file ( + "${CMAKE_CURRENT_SOURCE_DIR}/ginac-excompiler.in" + "${CMAKE_CURRENT_BINARY_DIR}/ginac-excompiler" + ) + + install(PROGRAMS ginac-excompiler DESTINATION "${BIN_INSTALL_DIR}") +endif (CMAKE_COMPILER_IS_GNUCC) diff --git a/tools/ginac-excompiler.in b/tools/ginac-excompiler.in index 0bd0c97..89e0a0c 100644 --- a/tools/ginac-excompiler.in +++ b/tools/ginac-excompiler.in @@ -1,2 +1,2 @@ #!/bin/sh -@CC@ -x c -fPIC -shared -o $1.so $1 +@CC@ -x c -fPIC -shared $GINAC_EXCOMPILER_FLAGS -o $1.so $1