Description: Upstream changes introduced in version 1.5.0.svn.r5382-2
 This patch has been created by dpkg-source during the package build.
 Here's the last changelog entry, hopefully it gives details on why
 those changes were made:
 .
 openmodelica (1.5.0.svn.r5382-2) unstable; urgency=low
 .
   * Added static linking for lpsolve55.
 .
 The person named in the Author field signed this changelog entry.
Author: Martin Sjölund <martin.sjolund@liu.se>

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: http://bugs.debian.org/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- openmodelica-1.5.0.svn.r5382.orig/configure.in
+++ openmodelica-1.5.0.svn.r5382/configure.in
@@ -161,12 +161,32 @@ return 0;
 
 dnl check for lpsolve55
 
-LIBS=""
-AC_CHECK_LIB(colamd,colamd)
-AC_CHECK_LIB(dl,dlsym)
-AC_CHECK_LIB(lpsolve55,make_lp,[],[AC_MSG_ERROR([linking failed])])
-LIBLPSOLVE55=$LIBS
-LIBS=""
+AC_ARG_WITH(static-lpsolve,  [  --with-static-lpsolve=DIR  (default to dynamic linking; searches /usr if no other directory is provided)],[WANT_STATIC_LPSOLVE="$withval"],[WANT_STATIC_LPSOLVE="no"])
+
+if test "$WANT_STATIC_LPSOLVE" = "no"; then
+  AC_SEARCH_LIBS(dlopen,dl)
+  AC_SEARCH_LIBS(sqrt,m)
+  AC_SEARCH_LIBS(colamd,colamd)
+  AC_SEARCH_LIBS(make_lp,lpsolve55,[],[AC_MSG_ERROR([linking failed])])
+  LIBLPSOLVE55=$LIBS
+  LIBS=""
+else
+  if test "$WANT_STATIC_LPSOLVE" = "yes"; then
+    LPLIB=/usr/lib;
+  else
+    LPLIB=$WANT_STATIC_LPSOLVE/lib
+  fi
+  LIBS=""
+  AC_SEARCH_LIBS(dlopen,dl)
+  AC_SEARCH_LIBS(sqrt,m)
+  LIBS="$LPLIB/liblpsolve55.a $LPLIB/libcolamd.a $LIBS"
+  AC_MSG_CHECKING([for static lpsolve55])
+  AC_LINK_IFELSE([AC_LANG_CALL([], [make_lp])], [LIBLPSOLVE55=$LIBS], [AC_MSG_ERROR([failed])])
+  AC_MSG_RESULT([$LIBLPSOLVE55])
+  LIBS=""
+fi
+
+
 
 dnl check for socket
 
--- openmodelica-1.5.0.svn.r5382.orig/configure
+++ openmodelica-1.5.0.svn.r5382/configure
@@ -667,6 +667,7 @@ SHELL'
 ac_subst_files=''
 ac_user_opts='
 enable_option_checking
+with_static_lpsolve
 with_CORBA
 with_MICO
 with_ORBIT2
@@ -1290,6 +1291,7 @@ if test -n "$ac_init_help"; then
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-static-lpsolve=DIR  (default to dynamic linking; searches /usr if no other directory is provided)
   --with-CORBA=DIR       use mico corba installed in DIR (or use mico-config)
   --with-MICO=DIR        use mico corba installed in DIR (or use mico-config)
   --with-ORBIT2=DIR      use orbit2 installed in DIR (or use orbit2-config)
@@ -3836,14 +3838,22 @@ rm -f core conftest.err conftest.$ac_obj
     conftest$ac_exeext conftest.$ac_ext
 
 
-LIBS=""
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for colamd in -lcolamd" >&5
-$as_echo_n "checking for colamd in -lcolamd... " >&6; }
-if test "${ac_cv_lib_colamd_colamd+set}" = set; then :
+
+# Check whether --with-static-lpsolve was given.
+if test "${with_static_lpsolve+set}" = set; then :
+  withval=$with_static_lpsolve; WANT_STATIC_LPSOLVE="$withval"
+else
+  WANT_STATIC_LPSOLVE="no"
+fi
+
+
+if test "$WANT_STATIC_LPSOLVE" = "no"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5
+$as_echo_n "checking for library containing dlopen... " >&6; }
+if test "${ac_cv_search_dlopen+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lcolamd  $LIBS"
+  ac_func_search_save_LIBS=$LIBS
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -3853,42 +3863,53 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_
 #ifdef __cplusplus
 extern "C"
 #endif
-char colamd ();
+char dlopen ();
 int
 main ()
 {
-return colamd ();
+return dlopen ();
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_colamd_colamd=yes
-else
-  ac_cv_lib_colamd_colamd=no
+for ac_lib in '' dl; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_dlopen=$ac_res
 fi
 rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+    conftest$ac_exeext
+  if test "${ac_cv_search_dlopen+set}" = set; then :
+  break
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_colamd_colamd" >&5
-$as_echo "$ac_cv_lib_colamd_colamd" >&6; }
-if test "x$ac_cv_lib_colamd_colamd" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBCOLAMD 1
-_ACEOF
+done
+if test "${ac_cv_search_dlopen+set}" = set; then :
 
-  LIBS="-lcolamd $LIBS"
+else
+  ac_cv_search_dlopen=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5
+$as_echo "$ac_cv_search_dlopen" >&6; }
+ac_res=$ac_cv_search_dlopen
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 
 fi
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlsym in -ldl" >&5
-$as_echo_n "checking for dlsym in -ldl... " >&6; }
-if test "${ac_cv_lib_dl_dlsym+set}" = set; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sqrt" >&5
+$as_echo_n "checking for library containing sqrt... " >&6; }
+if test "${ac_cv_search_sqrt+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldl  $LIBS"
+  ac_func_search_save_LIBS=$LIBS
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -3898,42 +3919,109 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_
 #ifdef __cplusplus
 extern "C"
 #endif
-char dlsym ();
+char sqrt ();
 int
 main ()
 {
-return dlsym ();
+return sqrt ();
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_dl_dlsym=yes
-else
-  ac_cv_lib_dl_dlsym=no
+for ac_lib in '' m; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_sqrt=$ac_res
 fi
 rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+    conftest$ac_exeext
+  if test "${ac_cv_search_sqrt+set}" = set; then :
+  break
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlsym" >&5
-$as_echo "$ac_cv_lib_dl_dlsym" >&6; }
-if test "x$ac_cv_lib_dl_dlsym" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBDL 1
+done
+if test "${ac_cv_search_sqrt+set}" = set; then :
+
+else
+  ac_cv_search_sqrt=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_sqrt" >&5
+$as_echo "$ac_cv_search_sqrt" >&6; }
+ac_res=$ac_cv_search_sqrt
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing colamd" >&5
+$as_echo_n "checking for library containing colamd... " >&6; }
+if test "${ac_cv_search_colamd+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char colamd ();
+int
+main ()
+{
+return colamd ();
+  ;
+  return 0;
+}
 _ACEOF
+for ac_lib in '' colamd; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_colamd=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if test "${ac_cv_search_colamd+set}" = set; then :
+  break
+fi
+done
+if test "${ac_cv_search_colamd+set}" = set; then :
 
-  LIBS="-ldl $LIBS"
+else
+  ac_cv_search_colamd=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_colamd" >&5
+$as_echo "$ac_cv_search_colamd" >&6; }
+ac_res=$ac_cv_search_colamd
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 
 fi
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for make_lp in -llpsolve55" >&5
-$as_echo_n "checking for make_lp in -llpsolve55... " >&6; }
-if test "${ac_cv_lib_lpsolve55_make_lp+set}" = set; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing make_lp" >&5
+$as_echo_n "checking for library containing make_lp... " >&6; }
+if test "${ac_cv_search_make_lp+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-llpsolve55  $LIBS"
+  ac_func_search_save_LIBS=$LIBS
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -3952,30 +4040,195 @@ return make_lp ();
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_lpsolve55_make_lp=yes
+for ac_lib in '' lpsolve55; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_make_lp=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if test "${ac_cv_search_make_lp+set}" = set; then :
+  break
+fi
+done
+if test "${ac_cv_search_make_lp+set}" = set; then :
+
+else
+  ac_cv_search_make_lp=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_make_lp" >&5
+$as_echo "$ac_cv_search_make_lp" >&6; }
+ac_res=$ac_cv_search_make_lp
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+else
+  as_fn_error "linking failed" "$LINENO" 5
+fi
+
+  LIBLPSOLVE55=$LIBS
+  LIBS=""
+else
+  if test "$WANT_STATIC_LPSOLVE" = "yes"; then
+    LPLIB=/usr/lib;
+  else
+    LPLIB=$WANT_STATIC_LPSOLVE/lib
+  fi
+  LIBS=""
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5
+$as_echo_n "checking for library containing dlopen... " >&6; }
+if test "${ac_cv_search_dlopen+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  ac_cv_lib_lpsolve55_make_lp=no
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' dl; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_dlopen=$ac_res
 fi
 rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+    conftest$ac_exeext
+  if test "${ac_cv_search_dlopen+set}" = set; then :
+  break
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lpsolve55_make_lp" >&5
-$as_echo "$ac_cv_lib_lpsolve55_make_lp" >&6; }
-if test "x$ac_cv_lib_lpsolve55_make_lp" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBLPSOLVE55 1
+done
+if test "${ac_cv_search_dlopen+set}" = set; then :
+
+else
+  ac_cv_search_dlopen=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5
+$as_echo "$ac_cv_search_dlopen" >&6; }
+ac_res=$ac_cv_search_dlopen
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sqrt" >&5
+$as_echo_n "checking for library containing sqrt... " >&6; }
+if test "${ac_cv_search_sqrt+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char sqrt ();
+int
+main ()
+{
+return sqrt ();
+  ;
+  return 0;
+}
 _ACEOF
+for ac_lib in '' m; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_sqrt=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if test "${ac_cv_search_sqrt+set}" = set; then :
+  break
+fi
+done
+if test "${ac_cv_search_sqrt+set}" = set; then :
 
-  LIBS="-llpsolve55 $LIBS"
+else
+  ac_cv_search_sqrt=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_sqrt" >&5
+$as_echo "$ac_cv_search_sqrt" >&6; }
+ac_res=$ac_cv_search_sqrt
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+  LIBS="$LPLIB/liblpsolve55.a $LPLIB/libcolamd.a $LIBS"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for static lpsolve55" >&5
+$as_echo_n "checking for static lpsolve55... " >&6; }
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char make_lp ();
+int
+main ()
+{
+return make_lp ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  LIBLPSOLVE55=$LIBS
 else
-  as_fn_error "linking failed" "$LINENO" 5
+  as_fn_error "failed" "$LINENO" 5
 fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBLPSOLVE55" >&5
+$as_echo "$LIBLPSOLVE55" >&6; }
+  LIBS=""
+fi
+
 
-LIBLPSOLVE55=$LIBS
-LIBS=""
 
 
 ac_fn_c_check_func "$LINENO" "socket" "ac_cv_func_socket"
