Skip to content

Commit

Permalink
- Configure check for OpenMP availability
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@13009 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Sep 21, 2012
1 parent 347c042 commit b319256
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Compiler/runtime/Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ Print_omc.o : printimpl.c
Error_rml.o : errorext.cpp ErrorMessage.hpp
Error_omc.o : errorext.cpp ErrorMessage.hpp ../OpenModelicaBootstrappingHeader.h
System_rml.o : System_rml.c systemimpl.c config.h errorext.h $(configUnix)
$(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) -fopenmp $<
$(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(OPENMP) $<
System_omc.o : System_omc.c systemimpl.c config.h errorext.h $(configUnix) $(RML_COMPAT)
$(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) -fopenmp $<
$(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(OPENMP) $<
Lapack_rml.o : lapackimpl.c config.h $(configUnix)
Lapack_omc.o : lapackimpl.c config.h $(configUnix) $(RML_COMPAT)
IOStreamExt_rml.o : IOStreamExt.c
Expand Down
1 change: 1 addition & 0 deletions Compiler/runtime/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ USE_CORBA = @USE_CORBA@
RMLINCLUDE = @rmlinc@
FMIINCLUDE = ../../3rdParty/FMIL/install/include
CFLAGS = @CFLAGS@ $(USE_CORBA)
OPENMP = @OPENMP@

ifdef USE_CORBA
CORBASRC = omc_communication.cc omc_communication_impl.cpp Corba_rml.cpp
Expand Down
25 changes: 22 additions & 3 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ AC_SUBST(OMSHELL_TERMINAL)
AC_SUBST(MODELICA_SPEC_PLATFORM)
AC_SUBST(OPENMODELICA_SPEC_PLATFORM)
AC_SUBST(SQLITE3_LIBS)
AC_SUBST(OPENMP_CFLAGS)
AC_SUBST(OPENMP)
AC_SUBST(MAKE)
AC_SUBST(LIBREADLINE)
AC_SUBST(LD_LAPACK)
Expand Down Expand Up @@ -239,6 +239,25 @@ return 0;
], [AC_MSG_RESULT([yes]); AC_DEFINE([HAVE_SCANDIR])],
[AC_MSG_RESULT([no])])

dnl Check if OpenMP is available
AC_MSG_CHECKING([for OpenMP])

CFLAGS_OLD="$CFLAGS"
CFLAGS="$CFLAGS -fopenmp"
AC_TRY_LINK([
#include <omp.h>
#include <stdio.h>
], [int main() {
int i;
#pragma omp parallel for private(i) schedule(dynamic)
for (i=0; i<16; i++)
printf("Thread %d\n", i);
return 0;
}
], [AC_MSG_RESULT([yes]); OPENMP=-fopenmp],
[AC_MSG_RESULT([no])])
CFLAGS="$CFLAGS_OLD"

dnl check for lpsolve55

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"])
Expand Down Expand Up @@ -578,9 +597,9 @@ else
fi

if test "Darwin" != `uname`; then
RT_LDFLAGS="$RT_LDFLAGS -lrt -fopenmp"
RT_LDFLAGS="$RT_LDFLAGS -lrt $OPENMP"
else
RT_LDFLAGS="$RT_LDFLAGS -liconv -fopenmp"
RT_LDFLAGS="$RT_LDFLAGS -liconv $OPENMP"
fi

dnl should we compile modpar
Expand Down

0 comments on commit b319256

Please sign in to comment.