From de8c725890e710aa67b691711fd42be7333f6e81 Mon Sep 17 00:00:00 2001 From: steve Date: Sun, 20 May 2001 15:09:39 +0000 Subject: [PATCH] Mingw32 support (Venkat Iyer) --- Makefile.in | 6 ++-- autoconf.sh | 3 +- configure.in | 33 +++++++++++++++++-- driver/Makefile.in | 6 ++-- driver/main.c | 70 +++++++++++++++++++++++++++++++++++++---- ivlpp/Makefile.in | 6 ++-- t-dll.cc | 41 ++++++++++++++++++++++-- t-dll.h | 10 ++++-- t-vvm.cc | 7 +++-- tgt-null/null.c | 7 +++-- tgt-pal/imain.c | 7 +++-- tgt-stub/Makefile.in | 4 +-- tgt-stub/stub.c | 7 +++-- tgt-verilog/Makefile.in | 4 +-- tgt-verilog/verilog.c | 7 +++-- tgt-vvp/Makefile.in | 4 +-- tgt-vvp/configure.in | 16 ++++++++-- tgt-vvp/vvp.c | 4 +-- vpi/Makefile.in | 10 +++--- vpi/sys_table.c | 7 +++-- vpi_user.h | 7 +++-- vpip/Makefile.in | 10 +++--- vpip/configure.in | 29 ++++++++++++++++- vpip/vpi_systask.c | 7 +++-- vvm/ivl_dlfcn.h | 30 ++++++++++++++++-- vvp/Makefile.in | 6 ++-- vvp/configure.in | 12 +++++++ vvp/ivl_dlfcn.h | 26 +++++++++++++-- 28 files changed, 317 insertions(+), 69 deletions(-) diff --git a/Makefile.in b/Makefile.in index a6deac1a4..c5877702b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -16,7 +16,7 @@ # 59 Temple Place - Suite 330 # Boston, MA 02111-1307, USA # -#ident "$Id: Makefile.in,v 1.95 2001/03/25 05:59:46 steve Exp $" +#ident "$Id: Makefile.in,v 1.96 2001/05/20 15:09:39 steve Exp $" # # SHELL = /bin/sh @@ -120,14 +120,14 @@ Makefile: Makefile.in config.status ./config.status -ifeq (@CYGWIN@,yes) +ifeq (@WIN32@,yes) ivl@EXEEXT@: $O ivl.def dlltool --dllname ivl@EXEEXT@ --def ivl.def \ --output-lib libivl.a --output-exp ivl.exp # $(CXX) -o ivl@EXEEXT@ -Wl,--base-file,ivl.base ivl.exp $O $(dllib) # dlltool --dllname ivl@EXEEXT@ --base-file ivl.base \ # --output-exp ivl.exp --def ivl.def - $(CXX) -o ivl@EXEEXT@ ivl.exp $O $(dllib) + $(CXX) -o ivl@EXEEXT@ ivl.exp $O $(dllib) @EXTRALIBS@ else ivl@EXEEXT@: $O $(CXX) $(CXXFLAGS) $(rdynamic) $(LDFLAGS) -o ivl@EXEEXT@ $O $(dllib) diff --git a/autoconf.sh b/autoconf.sh index 4d9622599..c78ab5c95 100644 --- a/autoconf.sh +++ b/autoconf.sh @@ -9,8 +9,7 @@ echo "Autoconf in root..." autoconf -for dir -in vpip vvp tgt-vvp +for dir in vpip vvp tgt-vvp do echo "Autoconf in $dir..." ( cd $dir ; autoconf ) diff --git a/configure.in b/configure.in index a98c8f20d..df6280bf8 100644 --- a/configure.in +++ b/configure.in @@ -48,9 +48,20 @@ AC_CANONICAL_HOST AC_CYGWIN AC_EXEEXT -AC_SUBST(CYGWIN) +AC_MINGW32 + + +WIN32=no +AC_MSG_CHECKING("Checking for windows") +if test "$CYGWIN" = "yes" -o "$MINGW32" = "yes" +then + WIN32=yes +fi +AC_SUBST(WIN32) +AC_MSG_RESULT($WIN32) AC_SUBST(EXEEXT) + AC_MSG_CHECKING("for leading and/or trailing underscores") cat << EOF > underscore.c void underscore(void){} @@ -61,7 +72,7 @@ CC_LEADING_UNDERSCORE=no CC_TRAILING_UNDERSCORE=no output=`nm underscore.o|grep _underscore 2>&1` -if test ! -z "$output" -a -z "$CYGWIN" ; then +if test ! -z "$output" -a -z "$CYGWIN" -a -z "$MINGW32"; then CC_LEADING_UNDERSCORE=yes AC_DEFINE(NEED_LU) fi @@ -109,6 +120,21 @@ AC_SUBST(PICFLAG) AC_MSG_RESULT($PICFLAG) +# mingw needs to link with libiberty.a + +AC_MSG_CHECKING("for extra libs needed") +EXTRALIBS= +case "${host}" in + *-*-cygwin*) + if test $ac_cv_mingw32 = yes; then + EXTRALIBS="-liberty" + fi + ;; +esac +AC_SUBST(EXTRALIBS) +AC_MSG_RESULT($EXTRALIBS) + + # The -rdynamic flag is used by iverilog when compiling the target, # to know how to export symbols of the main program to loadable modules # that are brought in by -ldl @@ -142,6 +168,9 @@ case "${host}" in *-*-cygwin*) shared="-mdll -Wl,--enable-auto-image-base" + if test $ac_cv_mingw32 = yes; then + shared="-shared -Wl,--enable-auto-image-base" + fi ;; *-*-hpux*) diff --git a/driver/Makefile.in b/driver/Makefile.in index dd0f9628c..5a0fd56a1 100644 --- a/driver/Makefile.in +++ b/driver/Makefile.in @@ -18,7 +18,7 @@ # 59 Temple Place - Suite 330 # Boston, MA 02111-1307, USA # -#ident "$Id: Makefile.in,v 1.3 2001/01/09 03:11:27 steve Exp $" +#ident "$Id: Makefile.in,v 1.4 2001/05/20 15:09:40 steve Exp $" # # SHELL = /bin/sh @@ -57,7 +57,7 @@ clean: O = main.o build_string.o lexor.o parse.o iverilog@EXEEXT@: $O - $(CC) $(LDFLAGS) $O -o iverilog@EXEEXT@ + $(CC) $(LDFLAGS) $O -o iverilog@EXEEXT@ @EXTRALIBS@ lexor.c: lexor.lex flex -s -olexor.c $(srcdir)/lexor.lex @@ -67,7 +67,7 @@ parse.h parse.c: parse.y main.o: main.c globals.h - $(CC) $(CPPFLAGS) -c -DCXX='"@CXX@"' -DIVL_ROOT='"@libdir@/ivl"' -DIVL_INC='"@includedir@"' -DIVL_LIB='"@libdir@"' -DRDYNAMIC=\"$(rdynamic)\" -DDLLIB='"@DLLIB@"' $(srcdir)/main.c + $(CC) $(CPPFLAGS) -c -DCXX='"@CXX@"' -DIVL_ROOT='"@libdir@/ivl"' -DIVL_INC='"@includedir@"' -DIVL_LIB='"@libdir@"' -DRDYNAMIC=\"$(rdynamic)\" -DDLLIB='"@DLLIB@"' -DEXEEXT='"@EXEEXT@"' $(srcdir)/main.c build_string.o: build_string.c globals.h lexor.o: lexor.c parse.h globals.h diff --git a/driver/main.c b/driver/main.c index 09da0c861..099d9134a 100644 --- a/driver/main.c +++ b/driver/main.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: main.c,v 1.10 2001/05/17 03:14:26 steve Exp $" +#ident "$Id: main.c,v 1.11 2001/05/20 15:09:40 steve Exp $" #endif const char HELP[] = @@ -39,6 +39,10 @@ See man page for details."; #include #include +#ifdef __MINGW32__ +#include +#endif + #if HAVE_GETOPT_H #include #endif @@ -53,9 +57,15 @@ See man page for details."; # include "globals.h" +#ifdef __MINGW32__ +const char *sep = "\\"; +#else +const char *sep = "/"; +#endif + const char*base = IVL_ROOT; const char*mtm = 0; -const char*opath = "a.out"; +const char*opath = "a.out" EXEEXT; const char*npath = 0; const char*targ = "vvm"; const char*start = 0; @@ -100,6 +110,16 @@ static int t_default(char*cmd, unsigned ncmd) tmp[2] = ' '; rc = build_string(tmp+3, sizeof tmp - 3, pattern); cmd = realloc(cmd, ncmd+3+rc+1); +#ifdef __MINGW32__ + { + char *t; + for (t = tmp; *t; t++) + { + if (*t == '/') *t = '\\'; + } + } +#endif + strcpy(cmd+ncmd, tmp); @@ -139,8 +159,21 @@ static int t_vvm(char*cmd, unsigned ncmd) tmp[2] = ' '; rc = build_string(tmp+3, sizeof tmp - 3, pattern); cmd = realloc(cmd, ncmd+3+rc+1); + +#ifdef __MINGW32__ + { + char *t; + for (t = tmp; *t; t++) + { + if (*t == '/') *t = '\\'; + } + } +#endif + + strcpy(cmd+ncmd, tmp); + if (verbose_flag) printf("translate: %s\n", cmd); @@ -183,11 +216,20 @@ static int t_xnf(char*cmd, unsigned ncmd) { int rc; - sprintf(tmp, " | %s/ivl %s -o %s -txnf -Fcprop -Fsynth -Fsyn-rules " - "-Fnodangle -Fxnfio", base, warning_flags, opath); + sprintf(tmp, " | %s%sepivl %s -o %s -txnf -Fcprop -Fsynth -Fsyn-rules " + "-Fnodangle -Fxnfio", base, sep,warning_flags, opath); rc = strlen(tmp); cmd = realloc(cmd, ncmd+rc+1); +#ifdef __MINGW32__ + { + char *t; + for (t = tmp; *t; t++) + { + if (*t == '/') *t = '\\'; + } + } +#endif strcpy(cmd+ncmd, tmp); ncmd += rc; @@ -391,6 +433,19 @@ int main(int argc, char **argv) return 1; } +#ifdef __MINGW32__ + { + char basepath[1024],*s; + GetModuleFileName(NULL,basepath,1024); + /* Get to the end. Search back twice for backslashes */ + s = basepath + strlen(basepath); + while (*s != '\\') s--; s--; + while (*s != '\\') s--; + strcpy(s,"\\lib\\ivl"); + base = basepath; + } +#endif + /* Load the iverilog.conf file to get our substitution strings. */ @@ -399,7 +454,7 @@ int main(int argc, char **argv) if (config_path) { strcpy(path, config_path); } else { - sprintf(path, "%s/iverilog.conf", base); + sprintf(path, "%s%siverilog.conf", base,sep); } fd = fopen(path, "r"); if (fd == 0) { @@ -412,7 +467,7 @@ int main(int argc, char **argv) /* Start building the preprocess command line. */ - sprintf(tmp, "%s/ivlpp %s%s", base, + sprintf(tmp, "%s%sivlpp %s%s", base,sep, verbose_flag?" -v":"", e_flag?"":" -L"); @@ -525,6 +580,9 @@ int main(int argc, char **argv) /* * $Log: main.c,v $ + * Revision 1.11 2001/05/20 15:09:40 steve + * Mingw32 support (Venkat Iyer) + * * Revision 1.10 2001/05/17 03:14:26 steve * Update help message. * diff --git a/ivlpp/Makefile.in b/ivlpp/Makefile.in index e81c9b8e9..4138f88d3 100644 --- a/ivlpp/Makefile.in +++ b/ivlpp/Makefile.in @@ -18,7 +18,7 @@ # 59 Temple Place - Suite 330 # Boston, MA 02111-1307, USA # -#ident "$Id: Makefile.in,v 1.9 2001/01/09 03:11:28 steve Exp $" +#ident "$Id: Makefile.in,v 1.10 2001/05/20 15:09:40 steve Exp $" # # SHELL = /bin/sh @@ -42,7 +42,7 @@ INSTALL_DATA = @INSTALL_DATA@ CPPFLAGS = @CPPFLAGS@ @DEFS@ CFLAGS = @CFLAGS@ -I. -LDFLAGS = @LDFLAGS@ +LDFLAGS = @LDFLAGS@ all: ivlpp @@ -52,7 +52,7 @@ clean: O = main.o lexor.o parse.o ivlpp: $O - $(CC) $(LDFLAGS) $O -o ivlpp + $(CC) $(LDFLAGS) $O -o ivlpp @EXTRALIBS@ lexor.c: lexor.lex flex -s -olexor.c $(srcdir)/lexor.lex diff --git a/t-dll.cc b/t-dll.cc index 3e1c94395..ce10c530c 100644 --- a/t-dll.cc +++ b/t-dll.cc @@ -17,14 +17,48 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: t-dll.cc,v 1.41 2001/05/12 03:18:45 steve Exp $" +#ident "$Id: t-dll.cc,v 1.42 2001/05/20 15:09:39 steve Exp $" #endif # include "compiler.h" # include "t-dll.h" # include -#if defined(HAVE_DLFCN_H) +#if defined(__WIN32__) + +inline ivl_dll_t ivl_dlopen(const char *name) +{ + return (ivl_dll_t) LoadLibrary(name); +} + + +inline void * ivl_dlsym(ivl_dll_t dll, const char *nm) +{ + FARPROC sym; + return GetProcAddress((HMODULE)dll, nm); +} + +inline void ivl_dlclose(ivl_dll_t dll) +{ + FreeLibrary((HMODULE)dll); +} + +const char *dlerror(void) +{ + static char msg[255]; + + FormatMessage( + FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + GetLastError(), + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language + (LPTSTR) &msg, + 0, + NULL + ); + return msg; +} +#elif defined(HAVE_DLFCN_H) inline ivl_dll_t ivl_dlopen(const char*name) { return dlopen(name,RTLD_NOW); } @@ -986,6 +1020,9 @@ extern const struct target tgt_dll = { "dll", &dll_target_obj }; /* * $Log: t-dll.cc,v $ + * Revision 1.42 2001/05/20 15:09:39 steve + * Mingw32 support (Venkat Iyer) + * * Revision 1.41 2001/05/12 03:18:45 steve * Make sure LPM devices have drives on outputs. * diff --git a/t-dll.h b/t-dll.h index d07300ad3..a08b7c0e5 100644 --- a/t-dll.h +++ b/t-dll.h @@ -19,13 +19,16 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: t-dll.h,v 1.44 2001/05/17 04:37:02 steve Exp $" +#ident "$Id: t-dll.h,v 1.45 2001/05/20 15:09:39 steve Exp $" #endif # include "target.h" # include "ivl_target.h" -#if defined(HAVE_DLFCN_H) +#if defined(__MINGW32__) +#include +typedef void *ivl_dll_t; +#elif defined(HAVE_DLFCN_H) # include typedef void* ivl_dll_t; #elif defined(HAVE_DL_H) @@ -520,6 +523,9 @@ struct ivl_statement_s { /* * $Log: t-dll.h,v $ + * Revision 1.45 2001/05/20 15:09:39 steve + * Mingw32 support (Venkat Iyer) + * * Revision 1.44 2001/05/17 04:37:02 steve * Behavioral ternary operators for vvp. * diff --git a/t-vvm.cc b/t-vvm.cc index ad3a9e2b9..ef07bb99d 100644 --- a/t-vvm.cc +++ b/t-vvm.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: t-vvm.cc,v 1.206 2001/04/22 23:09:46 steve Exp $" +#ident "$Id: t-vvm.cc,v 1.207 2001/05/20 15:09:39 steve Exp $" #endif # include @@ -1134,7 +1134,7 @@ int target_vvm::end_design(const Design*mod) string vpi_module_path = mod->get_flag("VPI_MODULE_PATH"); if (vpi_module_path.length() > 0) - out << " vvm_set_module_path(\"" << vpi_module_path << + out << " vvm_set_module_path(\"" << stresc(vpi_module_path) << "\");" << endl; string vpi_module_list = mod->get_flag("VPI_MODULE_LIST"); @@ -3634,6 +3634,9 @@ extern const struct target tgt_vvm = { }; /* * $Log: t-vvm.cc,v $ + * Revision 1.207 2001/05/20 15:09:39 steve + * Mingw32 support (Venkat Iyer) + * * Revision 1.206 2001/04/22 23:09:46 steve * More UDP consolidation from Stephan Boettcher. * diff --git a/tgt-null/null.c b/tgt-null/null.c index f826bc2dc..cc96345b5 100644 --- a/tgt-null/null.c +++ b/tgt-null/null.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: null.c,v 1.2 2001/02/07 22:21:59 steve Exp $" +#ident "$Id: null.c,v 1.3 2001/05/20 15:09:40 steve Exp $" #endif /* @@ -32,13 +32,16 @@ int target_design(ivl_design_t des) return 0; } -#ifdef __CYGWIN32__ +#if defined(__MINGW32__) || defined (__CYGWIN32__) #include DECLARE_CYGWIN_DLL(DllMain); #endif /* * $Log: null.c,v $ + * Revision 1.3 2001/05/20 15:09:40 steve + * Mingw32 support (Venkat Iyer) + * * Revision 1.2 2001/02/07 22:21:59 steve * ivl_target header search path fixes. * diff --git a/tgt-pal/imain.c b/tgt-pal/imain.c index 75569f7d4..20eea263a 100644 --- a/tgt-pal/imain.c +++ b/tgt-pal/imain.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: imain.c,v 1.6 2001/01/15 00:05:39 steve Exp $" +#ident "$Id: imain.c,v 1.7 2001/05/20 15:09:40 steve Exp $" #endif /* @@ -143,13 +143,16 @@ int target_design(ivl_design_t des) return 0; } -#ifdef __CYGWIN32__ +#if defined(__MINGW32__) || defined (__CYGWIN32__) #include DECLARE_CYGWIN_DLL(DllMain); #endif /* * $Log: imain.c,v $ + * Revision 1.7 2001/05/20 15:09:40 steve + * Mingw32 support (Venkat Iyer) + * * Revision 1.6 2001/01/15 00:05:39 steve * Add client data pointer for scope and process scanners. * diff --git a/tgt-stub/Makefile.in b/tgt-stub/Makefile.in index 2cb998967..0c4294864 100644 --- a/tgt-stub/Makefile.in +++ b/tgt-stub/Makefile.in @@ -16,7 +16,7 @@ # 59 Temple Place - Suite 330 # Boston, MA 02111-1307, USA # -#ident "$Id: Makefile.in,v 1.7 2001/02/07 22:22:00 steve Exp $" +#ident "$Id: Makefile.in,v 1.8 2001/05/20 15:09:40 steve Exp $" # # SHELL = /bin/sh @@ -52,7 +52,7 @@ all: stub.tgt O = stub.o -ifeq (@CYGWIN@,yes) +ifeq (@WIN32@,yes) TGTLDFLAGS=-L.. -livl TGTDEPLIBS=../libivl.a else diff --git a/tgt-stub/stub.c b/tgt-stub/stub.c index cfb32e2c8..9babfd3f2 100644 --- a/tgt-stub/stub.c +++ b/tgt-stub/stub.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: stub.c,v 1.40 2001/05/03 01:52:45 steve Exp $" +#ident "$Id: stub.c,v 1.41 2001/05/20 15:09:40 steve Exp $" #endif /* @@ -543,13 +543,16 @@ int target_design(ivl_design_t des) return 0; } -#ifdef __CYGWIN32__ +#if defined(__MINGW32__) || defined (__CYGWIN32__) #include DECLARE_CYGWIN_DLL(DllMain); #endif /* * $Log: stub.c,v $ + * Revision 1.41 2001/05/20 15:09:40 steve + * Mingw32 support (Venkat Iyer) + * * Revision 1.40 2001/05/03 01:52:45 steve * dll build of many probes forgot to index the probe. * diff --git a/tgt-verilog/Makefile.in b/tgt-verilog/Makefile.in index 9b9f9eb1f..b037368cc 100644 --- a/tgt-verilog/Makefile.in +++ b/tgt-verilog/Makefile.in @@ -16,7 +16,7 @@ # 59 Temple Place - Suite 330 # Boston, MA 02111-1307, USA # -#ident "$Id: Makefile.in,v 1.6 2001/02/07 22:22:00 steve Exp $" +#ident "$Id: Makefile.in,v 1.7 2001/05/20 15:09:40 steve Exp $" # # SHELL = /bin/sh @@ -52,7 +52,7 @@ all: verilog.tgt O = verilog.o -ifeq (@CYGWIN@,yes) +ifeq (@WIN32@,yes) TGTLDFLAGS= -L.. -livl TGTDEPLIBS=../libivl.a else diff --git a/tgt-verilog/verilog.c b/tgt-verilog/verilog.c index 8d1efac29..001d1f60b 100644 --- a/tgt-verilog/verilog.c +++ b/tgt-verilog/verilog.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: verilog.c,v 1.21 2001/05/08 23:59:33 steve Exp $" +#ident "$Id: verilog.c,v 1.22 2001/05/20 15:09:40 steve Exp $" #endif /* @@ -434,13 +434,16 @@ int target_design(ivl_design_t des) } -#ifdef __CYGWIN32__ +#if defined(__MINGW32__) || defined (__CYGWIN32__) #include DECLARE_CYGWIN_DLL(DllMain); #endif /* * $Log: verilog.c,v $ + * Revision 1.22 2001/05/20 15:09:40 steve + * Mingw32 support (Venkat Iyer) + * * Revision 1.21 2001/05/08 23:59:33 steve * Add ivl and vvp.tgt support for memories in * expressions and l-values. (Stephan Boettcher) diff --git a/tgt-vvp/Makefile.in b/tgt-vvp/Makefile.in index bf65005db..6d2f29aa1 100644 --- a/tgt-vvp/Makefile.in +++ b/tgt-vvp/Makefile.in @@ -16,7 +16,7 @@ # 59 Temple Place - Suite 330 # Boston, MA 02111-1307, USA # -#ident "$Id: Makefile.in,v 1.5 2001/03/31 19:29:23 steve Exp $" +#ident "$Id: Makefile.in,v 1.6 2001/05/20 15:09:40 steve Exp $" # # SHELL = /bin/sh @@ -51,7 +51,7 @@ all: vvp.tgt O = vvp.o eval_expr.o vvp_process.o vvp_scope.o -ifeq (@CYGWIN@,yes) +ifeq (@WIN32@,yes) TGTLDFLAGS=-L.. -livl TGTDEPLIBS=../libivl.a else diff --git a/tgt-vvp/configure.in b/tgt-vvp/configure.in index 1437b51d1..91f71f0ec 100644 --- a/tgt-vvp/configure.in +++ b/tgt-vvp/configure.in @@ -37,6 +37,9 @@ case "${host}" in *-*-cygwin*) shared="-mdll -Wl,--enable-auto-image-base" + if test $ac_cv_mingw32 = yes; then + shared="-shared -Wl,--enable-auto-image-base" + fi ;; *-*-hpux*) @@ -44,10 +47,19 @@ case "${host}" in ;; esac - AC_SUBST(shared) - AC_MSG_RESULT($shared) +AC_MSG_CHECKING("for Win32") +WIN32=no +case "${host}" in + + *-*-cygwin*) + WIN32=yes + ;; +esac +AC_SUBST(WIN32) +AC_MSG_RESULT($WIN32) + AC_OUTPUT(Makefile) diff --git a/tgt-vvp/vvp.c b/tgt-vvp/vvp.c index 3d29a5708..22664211e 100644 --- a/tgt-vvp/vvp.c +++ b/tgt-vvp/vvp.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vvp.c,v 1.6 2001/05/14 00:55:31 steve Exp $" +#ident "$Id: vvp.c,v 1.7 2001/05/20 15:09:40 steve Exp $" #endif /* @@ -83,7 +83,7 @@ int target_design(ivl_design_t des) return rc; } -#ifdef __CYGWIN32__ +#if defined(__MINGW32__) || defined (__CYGWIN32__) #include DECLARE_CYGWIN_DLL(DllMain); #endif diff --git a/vpi/Makefile.in b/vpi/Makefile.in index f0601c886..d03c445a4 100644 --- a/vpi/Makefile.in +++ b/vpi/Makefile.in @@ -18,7 +18,7 @@ # 59 Temple Place - Suite 330 # Boston, MA 02111-1307, USA # -#ident "$Id: Makefile.in,v 1.25 2001/04/26 00:01:33 steve Exp $" +#ident "$Id: Makefile.in,v 1.26 2001/05/20 15:09:40 steve Exp $" # # SHELL = /bin/sh @@ -57,16 +57,16 @@ O = sys_table.o sys_deposit.o sys_display.o sys_finish.o sys_random.o \ sys_readmem.o sys_readmem_lex.o sys_time.o sys_vcd.o \ mt19937int.o -ifeq (@CYGWIN@,yes) - SYSTEM_VPI_LDFLAGS=-Wl,--enable-auto-image-base -L../vvm -lvvm -L../vpip -lvpip - VPI_DEPLIBS=../vpip/libvpip.a +ifeq (@WIN32@,yes) + SYSTEM_VPI_LDFLAGS= -L../vvm -lvvm -L../vpip -lvpip @EXTRALIBS@ + VPI_DEPLIBS=../vpip/libvpip.a ../vvm/libvvm.a else SYSTEM_VPI_LDFLAGS= VPI_DEPLIBS= endif system.vpi: $O $(VPI_DEPLIBS) - $(CC) -shared -o $@ $O $(SYSTEM_VPI_LDFLAGS) + $(CC) @shared@ -o $@ $O $(SYSTEM_VPI_LDFLAGS) sys_readmem_lex.c: sys_readmem_lex.lex flex -t -Preadmem $(srcdir)/sys_readmem_lex.lex > sys_readmem_lex.c diff --git a/vpi/sys_table.c b/vpi/sys_table.c index c37907bd6..8ae47fdcd 100644 --- a/vpi/sys_table.c +++ b/vpi/sys_table.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: sys_table.c,v 1.9 2001/04/26 00:01:33 steve Exp $" +#ident "$Id: sys_table.c,v 1.10 2001/05/20 15:09:40 steve Exp $" #endif #include "vpi_user.h" @@ -40,13 +40,16 @@ void (*vlog_startup_routines[])() = { 0 }; -#ifdef __CYGWIN32__ +#if defined(__MINGW32__) || defined (__CYGWIN32__) #include DECLARE_CYGWIN_DLL(DllMain); #endif /* * $Log: sys_table.c,v $ + * Revision 1.10 2001/05/20 15:09:40 steve + * Mingw32 support (Venkat Iyer) + * * Revision 1.9 2001/04/26 00:01:33 steve * Support $deposit to a wire or reg. * diff --git a/vpi_user.h b/vpi_user.h index 8a6d8f053..cbd617beb 100644 --- a/vpi_user.h +++ b/vpi_user.h @@ -19,11 +19,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vpi_user.h,v 1.4 2001/05/10 00:16:00 steve Exp $" +#ident "$Id: vpi_user.h,v 1.5 2001/05/20 15:09:40 steve Exp $" #endif -#if defined(__CYGWIN32__) +#if defined(__MINGW32__) || defined (__CYGWIN32__) # define DLLEXPORT __declspec(dllexport) #else # define DLLEXPORT @@ -307,6 +307,9 @@ EXTERN_C_END /* * $Log: vpi_user.h,v $ + * Revision 1.5 2001/05/20 15:09:40 steve + * Mingw32 support (Venkat Iyer) + * * Revision 1.4 2001/05/10 00:16:00 steve * Add the vpi_user strength definitions. * diff --git a/vpip/Makefile.in b/vpip/Makefile.in index 5df8ad81c..d16a3a124 100644 --- a/vpip/Makefile.in +++ b/vpip/Makefile.in @@ -18,7 +18,7 @@ # 59 Temple Place - Suite 330 # Boston, MA 02111-1307, USA # -#ident "$Id: Makefile.in,v 1.3 2001/03/25 05:59:47 steve Exp $" +#ident "$Id: Makefile.in,v 1.4 2001/05/20 15:09:40 steve Exp $" # # SHELL = /bin/sh @@ -53,12 +53,12 @@ vpi_mcd.o vpi_vlog_info.o -ifeq (@CYGWIN@,yes) +ifeq (@WIN32@,yes) # In the DOS world, we make libvpip differently. all: libvpip.a vpip.dll libvpip.a vpip.dll: $P vpip.def - $(CC) -shared -Wl,--enable-auto-image-base,--out-implib,libvpip.a -o vpip.dll vpip.def $P + $(CC) @shared@,--out-implib,libvpip.a -o vpip.dll vpip.def $P else @@ -95,7 +95,7 @@ install:: all installdirs \ $(libdir)/libvpip.a: ./libvpip.a $(INSTALL_DATA) ./libvpip.a $(libdir)/libvpip.a -ifeq (@CYGWIN@,yes) +ifeq (@WIN32@,yes) install :: $(bindir)/vpip.dll $(bindir)/vpip.dll: ./vpip.dll @@ -114,7 +114,7 @@ uninstall:: rm -f $(libdir)/libvpip.a rm -f $(includedir)/vpi_priv.h -ifeq (@CYGWIN@,yes) +ifeq (@WIN32@,yes) uninstall:: rm -f $(bindir)/vpip.dll endif diff --git a/vpip/configure.in b/vpip/configure.in index 9bc5b6349..4e4566af6 100644 --- a/vpip/configure.in +++ b/vpip/configure.in @@ -4,9 +4,36 @@ AC_PROG_CC AC_CHECK_TOOL(STRIP, strip, true) AC_PROG_INSTALL + AC_CYGWIN AC_EXEEXT -AC_SUBST(CYGWIN) + + +WIN32=no +AC_MSG_CHECKING("for shared library link flag") +shared=-shared +EXTRALIBS= +case "${host}" in + *-*-cygwin*) + shared="-mdll -Wl,--enable-auto-image-base" + if test $ac_cv_mingw32 = yes; then + shared="-shared -Wl,--enable-auto-image-base" + fi + WIN32=yes + ;; + *-*-hpux*) + shared="-b" + ;; +esac +AC_SUBST(shared) +AC_MSG_RESULT($shared) +AC_MSG_CHECKING("for win 32") +AC_SUBST(WIN32) +AC_MSG_RESULT($WIN32) + +AC_SUBST(WIN32) AC_SUBST(EXEEXT) +AC_SUBST(shared) +AC_SUBST(EXTRALIBS) AC_OUTPUT(Makefile) diff --git a/vpip/vpi_systask.c b/vpip/vpi_systask.c index 5e9329f92..28c91b7d5 100644 --- a/vpip/vpi_systask.c +++ b/vpip/vpi_systask.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vpi_systask.c,v 1.1 2001/03/14 19:27:44 steve Exp $" +#ident "$Id: vpi_systask.c,v 1.2 2001/05/20 15:09:40 steve Exp $" #endif # include "vpi_priv.h" @@ -118,13 +118,16 @@ const struct __vpirt *vpip_get_sysfunc_rt(void) return &vpip_sysfunc_rt; } -#ifdef __CYGWIN32__ +#if defined(__MINGW32__) || defined (__CYGWIN32__) #include DECLARE_CYGWIN_DLL(DllMain); #endif /* * $Log: vpi_systask.c,v $ + * Revision 1.2 2001/05/20 15:09:40 steve + * Mingw32 support (Venkat Iyer) + * * Revision 1.1 2001/03/14 19:27:44 steve * Rearrange VPI support libraries. * diff --git a/vvm/ivl_dlfcn.h b/vvm/ivl_dlfcn.h index 895e1cd7c..cdd93b3bb 100644 --- a/vvm/ivl_dlfcn.h +++ b/vvm/ivl_dlfcn.h @@ -19,10 +19,14 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: ivl_dlfcn.h,v 1.1 2001/01/14 17:12:59 steve Exp $" +#ident "$Id: ivl_dlfcn.h,v 1.2 2001/05/20 15:09:40 steve Exp $" #endif -#if defined(HAVE_DLFCN_H) +#if defined(__MINGW32__) +# include +# include +typedef void * ivl_dll_t; +#elif defined(HAVE_DLFCN_H) # include typedef void* ivl_dll_t; #elif defined(HAVE_DL_H) @@ -30,7 +34,20 @@ typedef void* ivl_dll_t; typedef shl_t ivl_dll_t; #endif -#if defined(HAVE_DLFCN_H) +#if defined(__MINGW32__) +inline ivl_dll_t ivl_dlopen(const char *name) +{ return (void *)LoadLibrary(name); } + +inline void *ivl_dlsym(ivl_dll_t dll, const char *nm) +{ return (void *)GetProcAddress((HINSTANCE)dll,nm);} + +inline void ivl_dlclose(ivl_dll_t dll) +{ (void)FreeLibrary((HINSTANCE)dll);} + +inline const char *dlerror(void) +{ static char s[30]; sprintf(s,"DLError:%l", GetLastError()); return s;} + +#elif defined(HAVE_DLFCN_H) inline ivl_dll_t ivl_dlopen(const char*name) { return dlopen(name,RTLD_NOW); } @@ -60,6 +77,13 @@ inline const char*dlerror(void) /* * $Log: ivl_dlfcn.h,v $ + * Revision 1.2 2001/05/20 15:09:40 steve + * Mingw32 support (Venkat Iyer) + * + * Revision 1.1 2001/03/16 01:44:34 steve + * Add structures for VPI support, and all the %vpi_call + * instruction. Get linking of VPI modules to work. + * * Revision 1.1 2001/01/14 17:12:59 steve * possible HP/UX portability support. * diff --git a/vvp/Makefile.in b/vvp/Makefile.in index c2bc1143e..22d3b15e7 100644 --- a/vvp/Makefile.in +++ b/vvp/Makefile.in @@ -16,7 +16,7 @@ # 59 Temple Place - Suite 330 # Boston, MA 02111-1307, USA # -#ident "$Id: Makefile.in,v 1.19 2001/05/10 00:26:53 steve Exp $" +#ident "$Id: Makefile.in,v 1.20 2001/05/20 15:09:40 steve Exp $" # # SHELL = /bin/sh @@ -42,7 +42,7 @@ STRIP = @STRIP@ CPPFLAGS = -I. -I$(srcdir)/.. @CPPFLAGS@ @DEFS@ -DMODULE_DIR=\"$(libdir)/ivl\" CXXFLAGS = @CXXFLAGS@ LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ +LIBS = @LIBS@ @EXTRALIBS@ dllib=@DLLIB@ rdynamic=@rdynamic@ @@ -77,7 +77,7 @@ vvp: $O tables.cc: draw_tt.c $(CC) -o draw_tt draw_tt.c ./draw_tt > tables.cc - rm draw_tt + rm draw_tt@EXEEXT@ lexor.o: lexor.cc parse.h diff --git a/vvp/configure.in b/vvp/configure.in index f89900b41..17e3b8335 100644 --- a/vvp/configure.in +++ b/vvp/configure.in @@ -62,4 +62,16 @@ esac AC_SUBST(rdynamic) AC_MSG_RESULT($rdynamic) +AC_MSG_CHECKING("for extra libs needed") +EXTRALIBS= +case "${host}" in + *-*-cygwin*) + if test $ac_cv_mingw32 = yes; then + EXTRALIBS="-liberty" + fi + ;; +esac +AC_SUBST(EXTRALIBS) +AC_MSG_RESULT($EXTRALIBS) + AC_OUTPUT(Makefile) diff --git a/vvp/ivl_dlfcn.h b/vvp/ivl_dlfcn.h index 72f11ffde..cdd93b3bb 100644 --- a/vvp/ivl_dlfcn.h +++ b/vvp/ivl_dlfcn.h @@ -19,10 +19,14 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: ivl_dlfcn.h,v 1.1 2001/03/16 01:44:34 steve Exp $" +#ident "$Id: ivl_dlfcn.h,v 1.2 2001/05/20 15:09:40 steve Exp $" #endif -#if defined(HAVE_DLFCN_H) +#if defined(__MINGW32__) +# include +# include +typedef void * ivl_dll_t; +#elif defined(HAVE_DLFCN_H) # include typedef void* ivl_dll_t; #elif defined(HAVE_DL_H) @@ -30,7 +34,20 @@ typedef void* ivl_dll_t; typedef shl_t ivl_dll_t; #endif -#if defined(HAVE_DLFCN_H) +#if defined(__MINGW32__) +inline ivl_dll_t ivl_dlopen(const char *name) +{ return (void *)LoadLibrary(name); } + +inline void *ivl_dlsym(ivl_dll_t dll, const char *nm) +{ return (void *)GetProcAddress((HINSTANCE)dll,nm);} + +inline void ivl_dlclose(ivl_dll_t dll) +{ (void)FreeLibrary((HINSTANCE)dll);} + +inline const char *dlerror(void) +{ static char s[30]; sprintf(s,"DLError:%l", GetLastError()); return s;} + +#elif defined(HAVE_DLFCN_H) inline ivl_dll_t ivl_dlopen(const char*name) { return dlopen(name,RTLD_NOW); } @@ -60,6 +77,9 @@ inline const char*dlerror(void) /* * $Log: ivl_dlfcn.h,v $ + * Revision 1.2 2001/05/20 15:09:40 steve + * Mingw32 support (Venkat Iyer) + * * Revision 1.1 2001/03/16 01:44:34 steve * Add structures for VPI support, and all the %vpi_call * instruction. Get linking of VPI modules to work.