diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,8 +28,10 @@ # C4996: 'function': was declared deprecated ENDIF(MSVC) +ADD_DEFINITIONS(-DHAVE_CONFIG_H) + INCLUDE(CheckTypeSize) -CHECK_TYPE_SIZE("long long" LONG_LONG) +CHECK_TYPE_SIZE("long long" LEMON_LONG_LONG) ENABLE_TESTING() diff --git a/cmake/FindCOIN.cmake b/cmake/FindCOIN.cmake --- a/cmake/FindCOIN.cmake +++ b/cmake/FindCOIN.cmake @@ -61,8 +61,8 @@ ) IF(COIN_FOUND) - SET(HAVE_LP TRUE) - SET(HAVE_MIP TRUE) - SET(HAVE_CLP TRUE) - SET(HAVE_CBC TRUE) + SET(LEMON_HAVE_LP TRUE) + SET(LEMON_HAVE_MIP TRUE) + SET(LEMON_HAVE_CLP TRUE) + SET(LEMON_HAVE_CBC TRUE) ENDIF(COIN_FOUND) diff --git a/cmake/FindCPLEX.cmake b/cmake/FindCPLEX.cmake --- a/cmake/FindCPLEX.cmake +++ b/cmake/FindCPLEX.cmake @@ -21,7 +21,7 @@ MARK_AS_ADVANCED(CPLEX_LIBRARY CPLEX_INCLUDE_DIR CPLEX_BIN_DIR) IF(CPLEX_FOUND) - SET(HAVE_LP TRUE) - SET(HAVE_MIP TRUE) - SET(HAVE_CPLEX TRUE) + SET(LEMON_HAVE_LP TRUE) + SET(LEMON_HAVE_MIP TRUE) + SET(LEMON_HAVE_CPLEX TRUE) ENDIF(CPLEX_FOUND) diff --git a/cmake/FindGLPK.cmake b/cmake/FindGLPK.cmake --- a/cmake/FindGLPK.cmake +++ b/cmake/FindGLPK.cmake @@ -21,7 +21,7 @@ MARK_AS_ADVANCED(GLPK_LIBRARY GLPK_INCLUDE_DIR GLPK_BIN_DIR) IF(GLPK_FOUND) - SET(HAVE_LP TRUE) - SET(HAVE_MIP TRUE) - SET(HAVE_GLPK TRUE) + SET(LEMON_HAVE_LP TRUE) + SET(LEMON_HAVE_MIP TRUE) + SET(LEMON_HAVE_GLPK TRUE) ENDIF(GLPK_FOUND) diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -25,7 +25,7 @@ dnl Check the existence of long long type. AC_CHECK_TYPE(long long, [long_long_found=yes], [long_long_found=no]) if test x"$long_long_found" = x"yes"; then - AC_DEFINE([HAVE_LONG_LONG], [1], [Define to 1 if you have long long.]) + AC_DEFINE([LEMON_HAVE_LONG_LONG], [1], [Define to 1 if you have long long.]) fi dnl Checks for programs. diff --git a/lemon/CMakeLists.txt b/lemon/CMakeLists.txt --- a/lemon/CMakeLists.txt +++ b/lemon/CMakeLists.txt @@ -18,7 +18,7 @@ bits/windows.cc ) -IF(HAVE_GLPK) +IF(LEMON_HAVE_GLPK) SET(LEMON_SOURCES ${LEMON_SOURCES} glpk.cc) INCLUDE_DIRECTORIES(${GLPK_INCLUDE_DIRS}) IF(WIN32) @@ -26,22 +26,22 @@ INSTALL(FILES ${GLPK_BIN_DIR}/libltdl3.dll DESTINATION bin) INSTALL(FILES ${GLPK_BIN_DIR}/zlib1.dll DESTINATION bin) ENDIF(WIN32) -ENDIF(HAVE_GLPK) +ENDIF(LEMON_HAVE_GLPK) -IF(HAVE_CPLEX) +IF(LEMON_HAVE_CPLEX) SET(LEMON_SOURCES ${LEMON_SOURCES} cplex.cc) INCLUDE_DIRECTORIES(${CPLEX_INCLUDE_DIRS}) -ENDIF(HAVE_CPLEX) +ENDIF(LEMON_HAVE_CPLEX) -IF(HAVE_CLP) +IF(LEMON_HAVE_CLP) SET(LEMON_SOURCES ${LEMON_SOURCES} clp.cc) INCLUDE_DIRECTORIES(${COIN_INCLUDE_DIRS}) -ENDIF(HAVE_CLP) +ENDIF(LEMON_HAVE_CLP) -IF(HAVE_CBC) +IF(LEMON_HAVE_CBC) SET(LEMON_SOURCES ${LEMON_SOURCES} cbc.cc) INCLUDE_DIRECTORIES(${COIN_INCLUDE_DIRS}) -ENDIF(HAVE_CBC) +ENDIF(LEMON_HAVE_CBC) ADD_LIBRARY(lemon ${LEMON_SOURCES}) @@ -55,3 +55,8 @@ DESTINATION include/lemon COMPONENT headers FILES_MATCHING PATTERN "*.h") + +INSTALL( + FILES ${CMAKE_CURRENT_BINARY_DIR}/config.h + DESTINATION include/lemon + COMPONENT headers) diff --git a/lemon/Makefile.am b/lemon/Makefile.am --- a/lemon/Makefile.am +++ b/lemon/Makefile.am @@ -61,6 +61,7 @@ lemon/clp.h \ lemon/color.h \ lemon/concept_check.h \ + lemon/config.h \ lemon/connectivity.h \ lemon/counter.h \ lemon/core.h \ diff --git a/lemon/bits/default_map.h b/lemon/bits/default_map.h --- a/lemon/bits/default_map.h +++ b/lemon/bits/default_map.h @@ -97,7 +97,7 @@ }; -#if defined HAVE_LONG_LONG +#if defined LEMON_HAVE_LONG_LONG // long long template diff --git a/lemon/config.h.cmake b/lemon/config.h.cmake --- a/lemon/config.h.cmake +++ b/lemon/config.h.cmake @@ -1,7 +1,7 @@ -#cmakedefine HAVE_LONG_LONG 1 -#cmakedefine HAVE_LP 1 -#cmakedefine HAVE_MIP 1 -#cmakedefine HAVE_GLPK 1 -#cmakedefine HAVE_CPLEX 1 -#cmakedefine HAVE_CLP 1 -#cmakedefine HAVE_CBC 1 +#cmakedefine LEMON_HAVE_LONG_LONG 1 +#cmakedefine LEMON_HAVE_LP 1 +#cmakedefine LEMON_HAVE_MIP 1 +#cmakedefine LEMON_HAVE_GLPK 1 +#cmakedefine LEMON_HAVE_CPLEX 1 +#cmakedefine LEMON_HAVE_CLP 1 +#cmakedefine LEMON_HAVE_CBC 1 diff --git a/lemon/config.h.in b/lemon/config.h.in --- a/lemon/config.h.in +++ b/lemon/config.h.in @@ -1,23 +1,23 @@ /* Define to 1 if you have long long */ -#undef HAVE_LONG_LONG +#undef LEMON_HAVE_LONG_LONG /* Define to 1 if you have any LP solver. */ -#undef HAVE_LP +#undef LEMON_HAVE_LP /* Define to 1 if you have any MIP solver. */ -#undef HAVE_MIP +#undef LEMON_HAVE_MIP /* Define to 1 if you have CPLEX. */ -#undef HAVE_CPLEX +#undef LEMON_HAVE_CPLEX /* Define to 1 if you have GLPK. */ -#undef HAVE_GLPK +#undef LEMON_HAVE_GLPK /* Define to 1 if you have SOPLEX */ -#undef HAVE_SOPLEX +#undef LEMON_HAVE_SOPLEX /* Define to 1 if you have CLP */ -#undef HAVE_CLP +#undef LEMON_HAVE_CLP /* Define to 1 if you have CBC */ -#undef HAVE_CBC +#undef LEMON_HAVE_CBC diff --git a/lemon/lp.h b/lemon/lp.h --- a/lemon/lp.h +++ b/lemon/lp.h @@ -22,13 +22,13 @@ #include -#ifdef HAVE_GLPK +#ifdef LEMON_HAVE_GLPK #include -#elif HAVE_CPLEX +#elif LEMON_HAVE_CPLEX #include -#elif HAVE_SOPLEX +#elif LEMON_HAVE_SOPLEX #include -#elif HAVE_CLP +#elif LEMON_HAVE_CLP #include #endif @@ -69,20 +69,20 @@ ///Currently, it is either \c GlpkMip or \c CplexMip typedef GlpkMip Mip; #else -#ifdef HAVE_GLPK +#ifdef LEMON_HAVE_GLPK # define LEMON_DEFAULT_LP GLPK typedef GlpkLp Lp; # define LEMON_DEFAULT_MIP GLPK typedef GlpkMip Mip; -#elif HAVE_CPLEX +#elif LEMON_HAVE_CPLEX # define LEMON_DEFAULT_LP CPLEX typedef CplexLp Lp; # define LEMON_DEFAULT_MIP CPLEX typedef CplexMip Mip; -#elif HAVE_SOPLEX +#elif LEMON_HAVE_SOPLEX # define DEFAULT_LP SOPLEX typedef SoplexLp Lp; -#elif HAVE_CLP +#elif LEMON_HAVE_CLP # define DEFAULT_LP CLP typedef ClpLp Lp; #endif diff --git a/m4/lx_check_coin.m4 b/m4/lx_check_coin.m4 --- a/m4/lx_check_coin.m4 +++ b/m4/lx_check_coin.m4 @@ -55,9 +55,9 @@ LIBS="$lx_save_libs" if test x"$lx_clp_found" = x"yes"; then - AC_DEFINE([HAVE_CLP], [1], [Define to 1 if you have CLP.]) + AC_DEFINE([LEMON_HAVE_CLP], [1], [Define to 1 if you have CLP.]) lx_lp_found=yes - AC_DEFINE([HAVE_LP], [1], [Define to 1 if you have any LP solver.]) + AC_DEFINE([LEMON_HAVE_LP], [1], [Define to 1 if you have any LP solver.]) AC_MSG_RESULT([yes]) else CLP_CXXFLAGS="" @@ -115,11 +115,11 @@ LIBS="$lx_save_libs" if test x"$lx_cbc_found" = x"yes"; then - AC_DEFINE([HAVE_CBC], [1], [Define to 1 if you have CBC.]) + AC_DEFINE([LEMON_HAVE_CBC], [1], [Define to 1 if you have CBC.]) lx_lp_found=yes - AC_DEFINE([HAVE_LP], [1], [Define to 1 if you have any LP solver.]) + AC_DEFINE([LEMON_HAVE_LP], [1], [Define to 1 if you have any LP solver.]) lx_mip_found=yes - AC_DEFINE([HAVE_MIP], [1], [Define to 1 if you have any MIP solver.]) + AC_DEFINE([LEMON_HAVE_MIP], [1], [Define to 1 if you have any MIP solver.]) AC_MSG_RESULT([yes]) else CBC_CXXFLAGS="" diff --git a/m4/lx_check_cplex.m4 b/m4/lx_check_cplex.m4 --- a/m4/lx_check_cplex.m4 +++ b/m4/lx_check_cplex.m4 @@ -61,11 +61,11 @@ LIBS="$lx_save_libs" if test x"$lx_cplex_found" = x"yes"; then - AC_DEFINE([HAVE_CPLEX], [1], [Define to 1 if you have CPLEX.]) + AC_DEFINE([LEMON_HAVE_CPLEX], [1], [Define to 1 if you have CPLEX.]) lx_lp_found=yes - AC_DEFINE([HAVE_LP], [1], [Define to 1 if you have any LP solver.]) + AC_DEFINE([LEMON_HAVE_LP], [1], [Define to 1 if you have any LP solver.]) lx_mip_found=yes - AC_DEFINE([HAVE_MIP], [1], [Define to 1 if you have any MIP solver.]) + AC_DEFINE([LEMON_HAVE_MIP], [1], [Define to 1 if you have any MIP solver.]) AC_MSG_RESULT([yes]) else CPLEX_CFLAGS="" diff --git a/m4/lx_check_glpk.m4 b/m4/lx_check_glpk.m4 --- a/m4/lx_check_glpk.m4 +++ b/m4/lx_check_glpk.m4 @@ -64,11 +64,11 @@ LIBS="$lx_save_libs" if test x"$lx_glpk_found" = x"yes"; then - AC_DEFINE([HAVE_GLPK], [1], [Define to 1 if you have GLPK.]) + AC_DEFINE([LEMON_HAVE_GLPK], [1], [Define to 1 if you have GLPK.]) lx_lp_found=yes - AC_DEFINE([HAVE_LP], [1], [Define to 1 if you have any LP solver.]) + AC_DEFINE([LEMON_HAVE_LP], [1], [Define to 1 if you have any LP solver.]) lx_mip_found=yes - AC_DEFINE([HAVE_MIP], [1], [Define to 1 if you have any MIP solver.]) + AC_DEFINE([LEMON_HAVE_MIP], [1], [Define to 1 if you have any MIP solver.]) AC_MSG_RESULT([yes]) else GLPK_CFLAGS="" diff --git a/m4/lx_check_soplex.m4 b/m4/lx_check_soplex.m4 --- a/m4/lx_check_soplex.m4 +++ b/m4/lx_check_soplex.m4 @@ -55,9 +55,9 @@ LIBS="$lx_save_libs" if test x"$lx_soplex_found" = x"yes"; then - AC_DEFINE([HAVE_SOPLEX], [1], [Define to 1 if you have SOPLEX.]) + AC_DEFINE([LEMON_HAVE_SOPLEX], [1], [Define to 1 if you have SOPLEX.]) lx_lp_found=yes - AC_DEFINE([HAVE_LP], [1], [Define to 1 if you have any LP solver.]) + AC_DEFINE([LEMON_HAVE_LP], [1], [Define to 1 if you have any LP solver.]) AC_MSG_RESULT([yes]) else SOPLEX_CXXFLAGS="" diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -36,22 +36,22 @@ time_measure_test unionfind_test) -IF(HAVE_LP) +IF(LEMON_HAVE_LP) ADD_EXECUTABLE(lp_test lp_test.cc) SET(LP_TEST_LIBS lemon) - IF(HAVE_GLPK) + IF(LEMON_HAVE_GLPK) SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES}) - ENDIF(HAVE_GLPK) - IF(HAVE_CPLEX) + ENDIF(LEMON_HAVE_GLPK) + IF(LEMON_HAVE_CPLEX) SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES}) - ENDIF(HAVE_CPLEX) - IF(HAVE_CLP) + ENDIF(LEMON_HAVE_CPLEX) + IF(LEMON_HAVE_CLP) SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES}) - ENDIF(HAVE_CLP) + ENDIF(LEMON_HAVE_CLP) TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS}) ADD_TEST(lp_test lp_test) - IF(WIN32 AND HAVE_GLPK) + IF(WIN32 AND LEMON_HAVE_GLPK) GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION) GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH) ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD @@ -59,32 +59,32 @@ COMMAND cmake -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH} COMMAND cmake -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH} ) - ENDIF(WIN32 AND HAVE_GLPK) - IF(WIN32 AND HAVE_CPLEX) + ENDIF(WIN32 AND LEMON_HAVE_GLPK) + IF(WIN32 AND LEMON_HAVE_CPLEX) GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION) GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH) ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD COMMAND cmake -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH} ) - ENDIF(WIN32 AND HAVE_CPLEX) -ENDIF(HAVE_LP) + ENDIF(WIN32 AND LEMON_HAVE_CPLEX) +ENDIF(LEMON_HAVE_LP) -IF(HAVE_MIP) +IF(LEMON_HAVE_MIP) ADD_EXECUTABLE(mip_test mip_test.cc) SET(MIP_TEST_LIBS lemon) - IF(HAVE_GLPK) + IF(LEMON_HAVE_GLPK) SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES}) - ENDIF(HAVE_GLPK) - IF(HAVE_CPLEX) + ENDIF(LEMON_HAVE_GLPK) + IF(LEMON_HAVE_CPLEX) SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES}) - ENDIF(HAVE_CPLEX) - IF(HAVE_CBC) + ENDIF(LEMON_HAVE_CPLEX) + IF(LEMON_HAVE_CBC) SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES}) - ENDIF(HAVE_CBC) + ENDIF(LEMON_HAVE_CBC) TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS}) ADD_TEST(mip_test mip_test) - IF(WIN32 AND HAVE_GLPK) + IF(WIN32 AND LEMON_HAVE_GLPK) GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION) GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH) ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD @@ -92,15 +92,15 @@ COMMAND cmake -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH} COMMAND cmake -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH} ) - ENDIF(WIN32 AND HAVE_GLPK) - IF(WIN32 AND HAVE_CPLEX) + ENDIF(WIN32 AND LEMON_HAVE_GLPK) + IF(WIN32 AND LEMON_HAVE_CPLEX) GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION) GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH) ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD COMMAND cmake -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH} ) - ENDIF(WIN32 AND HAVE_CPLEX) -ENDIF(HAVE_MIP) + ENDIF(WIN32 AND LEMON_HAVE_CPLEX) +ENDIF(LEMON_HAVE_MIP) FOREACH(TEST_NAME ${TESTS}) ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc) diff --git a/test/lp_test.cc b/test/lp_test.cc --- a/test/lp_test.cc +++ b/test/lp_test.cc @@ -25,19 +25,19 @@ #include #endif -#ifdef HAVE_GLPK +#ifdef LEMON_HAVE_GLPK #include #endif -#ifdef HAVE_CPLEX +#ifdef LEMON_HAVE_CPLEX #include #endif -#ifdef HAVE_SOPLEX +#ifdef LEMON_HAVE_SOPLEX #include #endif -#ifdef HAVE_CLP +#ifdef LEMON_HAVE_CLP #include #endif @@ -379,7 +379,7 @@ LpSkeleton lp_skel; lpTest(lp_skel); -#ifdef HAVE_GLPK +#ifdef LEMON_HAVE_GLPK { GlpkLp lp_glpk1,lp_glpk2; lpTest(lp_glpk1); @@ -388,7 +388,7 @@ } #endif -#ifdef HAVE_CPLEX +#ifdef LEMON_HAVE_CPLEX try { CplexLp lp_cplex1,lp_cplex2; lpTest(lp_cplex1); @@ -399,7 +399,7 @@ } #endif -#ifdef HAVE_SOPLEX +#ifdef LEMON_HAVE_SOPLEX { SoplexLp lp_soplex1,lp_soplex2; lpTest(lp_soplex1); @@ -408,7 +408,7 @@ } #endif -#ifdef HAVE_CLP +#ifdef LEMON_HAVE_CLP { ClpLp lp_clp1,lp_clp2; lpTest(lp_clp1); diff --git a/test/mip_test.cc b/test/mip_test.cc --- a/test/mip_test.cc +++ b/test/mip_test.cc @@ -22,15 +22,15 @@ #include #endif -#ifdef HAVE_CPLEX +#ifdef LEMON_HAVE_CPLEX #include #endif -#ifdef HAVE_GLPK +#ifdef LEMON_HAVE_GLPK #include #endif -#ifdef HAVE_CBC +#ifdef LEMON_HAVE_CBC #include #endif @@ -129,7 +129,7 @@ int main() { -#ifdef HAVE_GLPK +#ifdef LEMON_HAVE_GLPK { GlpkMip mip1; aTest(mip1); @@ -137,7 +137,7 @@ } #endif -#ifdef HAVE_CPLEX +#ifdef LEMON_HAVE_CPLEX try { CplexMip mip2; aTest(mip2); @@ -147,7 +147,7 @@ } #endif -#ifdef HAVE_CBC +#ifdef LEMON_HAVE_CBC { CbcMip mip1; aTest(mip1); diff --git a/tools/dimacs-solver.cc b/tools/dimacs-solver.cc --- a/tools/dimacs-solver.cc +++ b/tools/dimacs-solver.cc @@ -200,7 +200,7 @@ .boolOption("q", "Do not print any report") .boolOption("int","Use 'int' for capacities, costs etc. (default)") .optionGroup("datatype","int") -#ifdef HAVE_LONG_LONG +#ifdef LEMON_HAVE_LONG_LONG .boolOption("long","Use 'long long' for capacities, costs etc.") .optionGroup("datatype","long") #endif @@ -267,7 +267,7 @@ solve(ap,is,os,desc); else if(ap.given("ldouble")) solve(ap,is,os,desc); -#ifdef HAVE_LONG_LONG +#ifdef LEMON_HAVE_LONG_LONG else if(ap.given("long")) solve(ap,is,os,desc); #endif