Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Commit c0cc57f

Browse files
sjoelundOpenModelica-Hudson
authored andcommitted
Build lpsolve55 if it is not found
Belonging to [master]: - #2443
1 parent 74abb64 commit c0cc57f

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

3rdParty

Submodule 3rdParty updated 1 file

Makefile.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ LIBMODELICAIO=@OMBUILDDIR@/lib/@host_short@/omc/libModelicaIO@SHREXT@
6868
LIBMODELICAMATIO=@OMBUILDDIR@/lib/@host_short@/omc/libModelicaMatIO@SHREXT@
6969
OMENCRYPTION=@OMENCRYPTION@
7070
LVE_EXE_SUFFIX=@MODELICA_SPEC_PLATFORM@
71+
MINGW_EXTRA_LIBS=@MINGW_EXTRA_LIBS@
7172

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

configure.ac

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ AC_SUBST(BOOST_INCLUDE)
9595
AC_SUBST(LDFLAGS_LIBSTDCXX)
9696
AC_SUBST(CPP_RUNTIME_ARGS)
9797
AC_SUBST(OMENCRYPTION)
98+
AC_SUBST(MINGW_EXTRA_LIBS)
9899

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

@@ -467,7 +468,7 @@ if test "$WANT_STATIC_LPSOLVE" = "no"; then
467468
LIBDL="$LIBS"
468469
AC_SEARCH_LIBS(sqrt,m)
469470
AC_SEARCH_LIBS(colamd,colamd)
470-
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])])
471+
AC_SEARCH_LIBS(make_lp,[lpsolve55_pic lpsolve55],[LIBLPSOLVE55=$LIBS],[COMPILE_LPSOLVE=1])
471472
LIBS=""
472473
else
473474
if test "$WANT_STATIC_LPSOLVE" = "yes"; then
@@ -480,19 +481,27 @@ else
480481
AC_SEARCH_LIBS(sqrt,m)
481482
LIBS="$LPLIB/liblpsolve55_pic.a $LPLIB/libcolamd.a $LIBS"
482483
AC_MSG_CHECKING([for static lpsolve55])
483-
AC_LINK_IFELSE([AC_LANG_CALL([], [make_lp])], [LIBLPSOLVE55=$LIBS], [MINGW_EXTRA_LIBS="$MINGW_EXTRA_LIBS lpsolve"; AC_MSG_RESULT([failed])])
484+
AC_LINK_IFELSE([AC_LANG_CALL([], [make_lp])], [LIBLPSOLVE55=$LIBS], [COMPILE_LPSOLVE="1"])
484485
AC_MSG_RESULT([$LIBLPSOLVE55])
485486
LIBS=""
486487
fi
487488
AC_CHECK_HEADER([lp_lib.h],[LPSOLVEINC=lp_lib.h],[
488489
AC_CHECK_HEADER([lpsolve/lp_lib.h],[LPSOLVEINC=lpsolve/lp_lib.h],[
489-
if ! ( echo $MINGW_EXTRA_LIBS | grep -q lpsolve ); then
490-
MINGW_EXTRA_LIBS="$MINGW_EXTRA_LIBS lpsolve";
491-
fi
492-
AC_MSG_RESULT([failed to find lpsolve55 headers])
490+
COMPILE_LPSOLVE=1
493491
])
494492
])
495493

494+
if test "$COMPILE_LPSOLVE" = 1; then
495+
MINGW_EXTRA_LIBS="$MINGW_EXTRA_LIBS lpsolve";
496+
AC_MSG_RESULT([failed to find lpsolve55 headers or library; will compile them ourselves])
497+
LPSOLVEINC="$ac_pwd/3rdParty/lpsolve/build/include/lpsolve/lp_lib.h"
498+
if test "$WANT_STATIC_LPSOLVE" = "yes"; then
499+
LIBLPSOLVE55="-Wl,-Bstatic -llpsolve55 -Wl,-Bdynamic"
500+
else
501+
LIBLPSOLVE55="-llpsolve55"
502+
fi
503+
fi
504+
496505
fi # NO_LPLIB
497506

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

0 commit comments

Comments
 (0)