Skip to content

Commit

Permalink
- Updated makefiles to link against sqlite3 instead of compiling it o…
Browse files Browse the repository at this point in the history
…urselves on Linux

  - Updated README to cover this dependency
  - Updated omdev makefiles to generate Compiler/runtime/runtime.a like Linux does (this is so Windows and Linux can link different objects in Compiler/runtime)
  - Updated configure script to search for sqlite3


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@6228 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Sep 27, 2010
1 parent d816e0c commit b91bf95
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 26 deletions.
21 changes: 2 additions & 19 deletions Compiler/Makefile.common
Expand Up @@ -16,26 +16,9 @@ endif
AST = $(top_builddir)/Parser/libomparse.a $(top_builddir)/Parser/libantlr3.a

RTOBJ = \
$(srcdir)/runtime/systemimpl.o \
$(srcdir)/runtime/systemimplmisc.o \
$(srcdir)/runtime/dynload.o \
$(srcdir)/runtime/dynload_try.o \
$(srcdir)/runtime/optmanager.o \
$(srcdir)/runtime/runtime.a \
$(srcdir)/../c_runtime/libc_runtime.a \
$(srcdir)/runtime/rtopts.o $(srcdir)/runtime/socketimpl.o \
$(srcdir)/runtime/printimpl.o $(srcdir)/runtime/ptolemyio.o \
$(srcdir)/runtime/errorext.o $(srcdir)/runtime/ErrorMessage.o \
$(srcdir)/runtime/daeext.o \
$(srcdir)/runtime/unitparser.o \
$(srcdir)/runtime/unitparserext.o \
$(srcdir)/runtime/Database.o \
$(srcdir)/runtime/sqlite/sqlite3.o \
$(CORBAOBJ) \
$(srcdir)/modpar/libmodpar.a \
$(srcdir)/runtime/settingsimpl.o \
$(srcdir)/runtime/SimulationResults.o \
$(srcdir)/runtime/IOStreamExt.o \
$(srcdir)/runtime/rtclock.o
$(srcdir)/modpar/libmodpar.a

# The Susan-generated MO sources
SUSANMO= \
Expand Down
2 changes: 2 additions & 0 deletions Compiler/Makefile.compiler_subdirs.common
Expand Up @@ -12,6 +12,8 @@ all : .testvariables $(ALLMO) $(SRCSIGX)
SUBDIRS = runtime parser modpar
SRCHSRCDIR = $(SRCH:%.h=$(srcdir)/%.h)

SQLITE3=-lsqlite3

.SUFFIXES: .o .mo .h .c
.PHONY: all vctarget absyn_subdir clean reallyclean $(SUBDIRS)

Expand Down
2 changes: 1 addition & 1 deletion Compiler/omc_debug/Makefile.in
Expand Up @@ -32,7 +32,7 @@ endif

LDFLAGS = @LDFLAGS@ -lm -L$(RMLHOME)/lib/plain -lrml_g -lpthread \
$(LIBSOCKET) $(CORBALIBS) $(LIBLPSOLVE55) \
-L../../build/lib/omc @LIBSENDDATA_LDFLAGS@
-L../../build/lib/omc @LIBSENDDATA_LDFLAGS@ $(SQLITE3)

PROG = omcd
RMLC = @rmlc_bin@ -g -Wc,-O1 #-Wr,-East,-Ecps,-Efol
Expand Down
2 changes: 1 addition & 1 deletion Compiler/omc_profiler/Makefile.in
Expand Up @@ -29,7 +29,7 @@ endif

LDFLAGS = @LDFLAGS@ -lm -L$(RMLHOME)/lib/plain -lrml_p \
$(LIBSOCKET) $(CORBALIBS) $(LIBLPSOLVE55) \
-L../../build/lib/omc @LIBSENDDATA_LDFLAGS@
-L../../build/lib/omc @LIBSENDDATA_LDFLAGS@ $(SQLITE3)

PROG = omcp
RMLC = @rmlc_bin@ -p
Expand Down
2 changes: 1 addition & 1 deletion Compiler/omc_release/Makefile.in
Expand Up @@ -28,7 +28,7 @@ endif

LDFLAGS = @LDFLAGS@ -lm -L$(RMLHOME)/lib/plain -lrml \
$(LIBSOCKET) $(CORBALIBS) $(LIBLPSOLVE55) \
-L../../build/lib/omc @LIBSENDDATA_LDFLAGS@
-L../../build/lib/omc @LIBSENDDATA_LDFLAGS@ $(SQLITE3)

PROG = omc
RMLC = @rmlc_bin@
Expand Down
1 change: 1 addition & 0 deletions Compiler/runtime/Database.c
Expand Up @@ -6,6 +6,7 @@

void Database_5finit(void)
{
sqlite3_libversion(); // Make sure we link against sqlite3 :)
// do nothing for now
}

8 changes: 4 additions & 4 deletions Compiler/runtime/Makefile.in
Expand Up @@ -31,15 +31,16 @@ CC = gcc
IDL = @IDLCMD@
CFLAGS += @CFLAGS@
CXXFLAGS = $(CFLAGS)
CPPFLAGS = -I$(RMLINCLUDE) -I$(top_builddir)/c_runtime -I$(srcdir) -I. $(CORBAINCL) -Ilpsolve -Isqlite
SRC = rtopts.c socketimpl.c printimpl.c systemimpl.c settingsimpl.c dynload.c SimulationResults.c IOStreamExt.c rtclock.c Database.c sqlite/sqlite3.c
CPPFLAGS = -I$(RMLINCLUDE) -I$(top_builddir)/c_runtime -I$(srcdir) -I. $(CORBAINCL) -Ilpsolve
SRC = rtopts.c socketimpl.c printimpl.c systemimpl.c settingsimpl.c dynload.c SimulationResults.c IOStreamExt.c rtclock.c Database.c

CPPSRC = unitparser.cpp unitparserext.cpp ptolemyio.cpp daeext.cpp ErrorMessage.cpp errorext.cpp optmanager.cpp systemimplmisc.cpp dynload_try.o $(CORBASRC)
OBJ = $(SRC:.c=.o) $(CPPSRC:.cpp=.o) $(CPPSRC:.cc=.o)

all: runtime.a

runtime.a : $(OBJ)
rm -f $@
$(AR) -s -r $@ $(OBJ)

omc_communication.cc omc_communication.h : omc_communication.idl
Expand All @@ -51,10 +52,9 @@ omc_communication_impl.o: omc_communication.h
corbaimpl.o: omc_communication.h
dynload.o: systemimpl.h ../Absyn.h ../Values.h dynload_try.h
systemimpl.o : config.unix.h
database.o : sqlite/sqlite3.h

clean:
$(RM) -rf *.a *.o omc_communication.cc omc_communication.h omc_communication-* sqlite/*.o
$(RM) -rf *.a *.o omc_communication.cc omc_communication.h omc_communication-*

Makefile: Makefile.in
cd $(top_builddir) && ./config.status
48 changes: 48 additions & 0 deletions configure
Expand Up @@ -4409,6 +4409,54 @@ fi
fi


{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sqlite3_libversion in -lsqlite3" >&5
$as_echo_n "checking for sqlite3_libversion in -lsqlite3... " >&6; }
if test "${ac_cv_lib_sqlite3_sqlite3_libversion+set}" = set; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lsqlite3 $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 sqlite3_libversion ();
int
main ()
{
return sqlite3_libversion ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_sqlite3_sqlite3_libversion=yes
else
ac_cv_lib_sqlite3_sqlite3_libversion=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sqlite3_sqlite3_libversion" >&5
$as_echo "$ac_cv_lib_sqlite3_sqlite3_libversion" >&6; }
if test "x$ac_cv_lib_sqlite3_sqlite3_libversion" = x""yes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBSQLITE3 1
_ACEOF

LIBS="-lsqlite3 $LIBS"

else
as_fn_error "sqlite3 not found" "$LINENO" 5
fi




# Check whether --with-CORBA was given.
Expand Down
2 changes: 2 additions & 0 deletions configure.in
Expand Up @@ -200,6 +200,8 @@ AC_CHECK_FUNC(gethostbyname,
AC_CHECK_LIB(nsl,gethostbyname, [AC_MSG_RESULT([yes]); LIBNSL="-lnsl"],[AC_MSG_ERROR([neither gethostbyname nor libnsl.a found])])
])

AC_CHECK_LIB(sqlite3,sqlite3_libversion,[],[AC_MSG_ERROR([sqlite3 not found])])

dnl should we use corba?

AC_ARG_WITH(CORBA, [ --with-CORBA=DIR use mico corba installed in DIR (or use mico-config)],[WANT_MICO="$withval"],[WANT_MICO="no"])
Expand Down

0 comments on commit b91bf95

Please sign in to comment.