Skip to content

Commit

Permalink
Build lpsolve55 if it is not found
Browse files Browse the repository at this point in the history
Belonging to [master]:
  - OpenModelica/OMCompiler#2443
  • Loading branch information
sjoelund authored and OpenModelica-Hudson committed May 18, 2018
1 parent 74abb64 commit c0cc57f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion 3rdParty
Submodule 3rdParty updated 1 files
+1 −0 README.md
1 change: 1 addition & 0 deletions Makefile.in
Expand Up @@ -68,6 +68,7 @@ LIBMODELICAIO=@OMBUILDDIR@/lib/@host_short@/omc/libModelicaIO@SHREXT@
LIBMODELICAMATIO=@OMBUILDDIR@/lib/@host_short@/omc/libModelicaMatIO@SHREXT@
OMENCRYPTION=@OMENCRYPTION@
LVE_EXE_SUFFIX=@MODELICA_SPEC_PLATFORM@
MINGW_EXTRA_LIBS=@MINGW_EXTRA_LIBS@

SUITESPARSE_LIBS = -DKLU_LIBRARY="libklu$(SHREXT)" -DAMD_LIBRARY="libamd$(SHREXT)" -DCOLAMD_LIBRARY="libcolamd$(SHREXT)" -DBTF_LIBRARY="libbtf$(SHREXT)"

Expand Down
21 changes: 15 additions & 6 deletions configure.ac
Expand Up @@ -95,6 +95,7 @@ AC_SUBST(BOOST_INCLUDE)
AC_SUBST(LDFLAGS_LIBSTDCXX)
AC_SUBST(CPP_RUNTIME_ARGS)
AC_SUBST(OMENCRYPTION)
AC_SUBST(MINGW_EXTRA_LIBS)

FINAL_MESSAGES="\nConfigured OpenModelica successfully using the following options:"

Expand Down Expand Up @@ -467,7 +468,7 @@ if test "$WANT_STATIC_LPSOLVE" = "no"; then
LIBDL="$LIBS"
AC_SEARCH_LIBS(sqrt,m)
AC_SEARCH_LIBS(colamd,colamd)
AC_SEARCH_LIBS(make_lp,[lpsolve55_pic lpsolve55],[LIBLPSOLVE55=$LIBS],[MINGW_EXTRA_LIBS="$MINGW_EXTRA_LIBS lpsolve"; AC_MSG_RESULT([lpsolve linking failed using $LIBS])])
AC_SEARCH_LIBS(make_lp,[lpsolve55_pic lpsolve55],[LIBLPSOLVE55=$LIBS],[COMPILE_LPSOLVE=1])
LIBS=""
else
if test "$WANT_STATIC_LPSOLVE" = "yes"; then
Expand All @@ -480,19 +481,27 @@ else
AC_SEARCH_LIBS(sqrt,m)
LIBS="$LPLIB/liblpsolve55_pic.a $LPLIB/libcolamd.a $LIBS"
AC_MSG_CHECKING([for static lpsolve55])
AC_LINK_IFELSE([AC_LANG_CALL([], [make_lp])], [LIBLPSOLVE55=$LIBS], [MINGW_EXTRA_LIBS="$MINGW_EXTRA_LIBS lpsolve"; AC_MSG_RESULT([failed])])
AC_LINK_IFELSE([AC_LANG_CALL([], [make_lp])], [LIBLPSOLVE55=$LIBS], [COMPILE_LPSOLVE="1"])
AC_MSG_RESULT([$LIBLPSOLVE55])
LIBS=""
fi
AC_CHECK_HEADER([lp_lib.h],[LPSOLVEINC=lp_lib.h],[
AC_CHECK_HEADER([lpsolve/lp_lib.h],[LPSOLVEINC=lpsolve/lp_lib.h],[
if ! ( echo $MINGW_EXTRA_LIBS | grep -q lpsolve ); then
MINGW_EXTRA_LIBS="$MINGW_EXTRA_LIBS lpsolve";
fi
AC_MSG_RESULT([failed to find lpsolve55 headers])
COMPILE_LPSOLVE=1
])
])

if test "$COMPILE_LPSOLVE" = 1; then
MINGW_EXTRA_LIBS="$MINGW_EXTRA_LIBS lpsolve";
AC_MSG_RESULT([failed to find lpsolve55 headers or library; will compile them ourselves])
LPSOLVEINC="$ac_pwd/3rdParty/lpsolve/build/include/lpsolve/lp_lib.h"
if test "$WANT_STATIC_LPSOLVE" = "yes"; then
LIBLPSOLVE55="-Wl,-Bstatic -llpsolve55 -Wl,-Bdynamic"
else
LIBLPSOLVE55="-llpsolve55"
fi
fi

fi # NO_LPLIB

if ! (echo "$host" | grep -q "mingw"); then
Expand Down

0 comments on commit c0cc57f

Please sign in to comment.