From 76ce880bef54d80cfd5a55817b203616f50de823 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Wed, 20 Jul 2022 19:36:25 +0200 Subject: configure: add --with-sundials (preliminary work) --- Makefile.in | 5 ++++- configure | 8 ++++++++ src/grt/Makefile.inc | 12 ++++++++++++ src/grt/grt-no_sundials_c.c | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 src/grt/grt-no_sundials_c.c diff --git a/Makefile.in b/Makefile.in index 8fa441738..bf3068736 100644 --- a/Makefile.in +++ b/Makefile.in @@ -44,6 +44,9 @@ enable_checks=@enable_checks@ enable_gplcompat=@enable_gplcompat@ enable_libghdl=@enable_libghdl@ default_pic=@default_pic@ +with_sundials=@with_sundials@ +sundials_incflags=@sundials_incflags@ +sundials_ldflags=@sundials_ldflags@ INSTALL_PROGRAM=install -m 755 INSTALL_DATA=install -m 644 @@ -412,7 +415,7 @@ uninstall.llvm: uninstall.llvm.program uninstall.grt GHDL_SIMUL_INCFLAGS=$(GHDL_COMMON_INCFLAGS) -aI$(srcdir)/src/ghdldrv -aI$(srcdir)/src/simul -aI$(srcdir)/src/synth ghdl_simul$(EXEEXT): $(GRT_ADD_OBJS) $(GRT_SRC_DEPS) version.ads force - $(GNATMAKE) $(GHDL_SIMUL_INCFLAGS) $(GNATFLAGS) -gnat12 ghdl_simul $(GNAT_BARGS) -largs $(LDFLAGS) $(GRT_ADD_OBJS) $(subst @,$(GRTSRCDIR),$(GRT_EXTRA_LIB)) + $(GNATMAKE) $(GHDL_SIMUL_INCFLAGS) $(GNATFLAGS) -gnat12 ghdl_simul $(GNAT_BARGS) -largs $(LDFLAGS) $(GRT_ADD_OBJS) $(subst @,$(GRTSRCDIR),$(GRT_EXTRA_LIB)) $(sundials_ldflags) libs.vhdl.simul: ghdl_simul$(EXEEXT) $(MAKE) -f $(srcdir)/libraries/Makefile.inc $(LIBVHDL_FLAGS_TO_PASS) GHDL=$(PWD)/ghdl_simul$(EXEEXT) GHDL_FLAGS="" VHDLLIBS_COPY_OBJS=no vhdl.libs.all diff --git a/configure b/configure index 0daae1a05..6014f51c2 100755 --- a/configure +++ b/configure @@ -48,6 +48,9 @@ enable_gplcompat=unknown enable_libghdl=true enable_synth=true with_readline=None +with_sundials=false +sundials_incflags= +sundials_ldflags= default_pic=false EXEEXT= SOEXT=.so @@ -61,6 +64,7 @@ srcdir abs_srcdir prefix backend libdirsuffix libghdldirsuffix incdirsuffix gcc_src_dir llvm_config llvm_be backtrace_lib build_mode EXEEXT SOEXT PIC_FLAGS default_pic enable_werror enable_checks enable_gplcompat enable_libghdl libghdl_version ghdl_version +with_sundials sundials_incflags sundials_ldflags COMPILER_GCC COMPILER_DEBUG COMPILER_MCODE COMPILER_LLVM POST_PROCESSOR INSTALL_PREFIX LIBDIR_SUFFIX LIBGHDLDIR_SUFFIX INCDIR_SUFFIX " @@ -113,6 +117,10 @@ for opt do --with-llvm-config=*) llvm_config="$optarg"; backend=llvm;; --with-backtrace-lib=*) backtrace_lib="$optarg";; --with-readline) with_readline="Gnu";; + --with-sundials=*) with_sundials=true; + sundials_incflags="-I$optarg/include"; + sundials_ldflags="-L$optarg/lib -lsundials_ida";; + --with-sundials) with_sundials=true;; --enable-werror) enable_werror=true;; --disable-werror) enable_werror=false;; --enable-checks) enable_checks=true;; diff --git a/src/grt/Makefile.inc b/src/grt/Makefile.inc index 71c202e11..c8e0d9f06 100644 --- a/src/grt/Makefile.inc +++ b/src/grt/Makefile.inc @@ -110,6 +110,12 @@ ifeq ($(GRT_USE_PTHREADS),y) GRT_EXTRA_LIB+=-lpthread endif +ifeq ($(with_sundials),true) + GRT_ADD_OBJS+=grt-sundials_c.o +else + GRT_ADD_OBJS+=grt-no_sundials_c.o +endif + GRT_LIBBACKTRACE= ifneq ($(LIBBACKTRACE),) GRT_LIBBACKTRACE=libbacktrace.a @@ -217,6 +223,12 @@ pic/grt-cdynload.o: $(GRTSRCDIR)/grt-cdynload.c grt-cthreads.o: $(GRTSRCDIR)/grt-cthreads.c $(GRT_C_COMPILE) +grt-sundials_c.o: $(GRTSRCDIR)/grt-sundials_c.c + $(GRT_C_COMPILE) $(sundials_incflags) + +grt-no_sundials_c.o: $(GRTSRCDIR)/grt-no_sundials_c.c + $(GRT_C_COMPILE) + fstapi.o: $(GRTSRCDIR)/fst/fstapi.c $(GRT_C_COMPILE) -I$(GRTSRCDIR)/fst diff --git a/src/grt/grt-no_sundials_c.c b/src/grt/grt-no_sundials_c.c new file mode 100644 index 000000000..87e7bb7a5 --- /dev/null +++ b/src/grt/grt-no_sundials_c.c @@ -0,0 +1,32 @@ +#include +typedef double realtype; + +realtype * +grt_sundials_get_yy_vec(void) +{ + return NULL; +} + +realtype * +grt_sundials_get_yp_vec(void) +{ + return NULL; +} + +int +grt_sundials_init(int sz) +{ + return -1; +} + +int +grt_sundials_start (void) +{ + return -1; +} + +int +grt_sundials_solve(realtype t0, realtype *tn, int *res) +{ + return 1; +} -- cgit v1.2.3