octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

MSVC compiler support [patch 1]: Extra define's


From: Michael Goffioul
Subject: MSVC compiler support [patch 1]: Extra define's
Date: Tue, 17 Oct 2006 21:38:09 +0200
User-agent: Thunderbird 1.5.0.7 (Windows/20060909)

John W. Eaton a écrit :
On 17-Oct-2006, address@hidden wrote:

| OK, I tried to split the full patch into smaller consistent pieces and put 
everything
| on-line. The entry point is 
http://www.geocities.com/sw286000/README-patches.htm
| I hope it'll be OK like that.
| | What's still not handled is the generation of mx-files that do not make MSVC to crash.
| For the moment, I still apply a local patch.

Thanks for splitting the patches.  That will help a lot.  But I would
like to ask you to do one more thing, which will make it much easier
to handle these patches.  Please submit each patch to the list
in a separate message.  That way, we can easily discuss the merits of
each patch in a separate thread on the list, and I can more easily
keep track of which ones have been applied.

As you wish. Here we go.

1) Defines extra DEFS flags to allow DLL compilation under MSVC. This kind of trick is required to swicth from __declspec(dllexport) to __declspec(dllimport) depending
on whether we are compiling the DLL or using it.
2) Additionally, it defines omit_deps to true for all MSVC compilation as dependency
list is not supported.
3) Disable compilation of "doc/" under MSVC as I couldn't get it work yet


Index: Makeconf.in
===================================================================
RCS file: /cvs/octave/Makeconf.in,v
retrieving revision 1.180
diff -p -c -r1.180 Makeconf.in
*** Makeconf.in 13 Oct 2006 18:11:26 -0000      1.180
--- Makeconf.in 17 Oct 2006 11:07:41 -0000
*************** CFLAGS = @CFLAGS@
*** 139,145 ****
  CPICFLAG = @CPICFLAG@
  XTRA_CFLAGS = @XTRA_CFLAGS@
  WARN_CFLAGS = @WARN_CFLAGS@
! ALL_CFLAGS = $(INCFLAGS) $(DEFS) $(XTRA_CFLAGS) $(WARN_CFLAGS) $(CFLAGS)
  BUG_CFLAGS = $(DEFS) $(XTRA_CFLAGS) $(WARN_CFLAGS) $(CFLAGS)
  
  BUILD_CC = @BUILD_CC@
--- 139,145 ----
  CPICFLAG = @CPICFLAG@
  XTRA_CFLAGS = @XTRA_CFLAGS@
  WARN_CFLAGS = @WARN_CFLAGS@
! ALL_CFLAGS = $(INCFLAGS) $(XTRA_CDEFS) $(DEFS) $(XTRA_CFLAGS) $(WARN_CFLAGS) 
$(CFLAGS)
  BUG_CFLAGS = $(DEFS) $(XTRA_CFLAGS) $(WARN_CFLAGS) $(CFLAGS)
  
  BUILD_CC = @BUILD_CC@
*************** CXXPICFLAG = @CXXPICFLAG@
*** 156,162 ****
  XTRA_CXXFLAGS = @XTRA_CXXFLAGS@
  WARN_CXXFLAGS = @WARN_CXXFLAGS@
  ALL_CXXFLAGS = \
!   $(INCFLAGS) $(DEFS) $(XTRA_CXXFLAGS) $(WARN_CXXFLAGS) $(CXXFLAGS)
  BUG_CXXFLAGS = $(DEFS) $(XTRA_CXXFLAGS) $(WARN_CXXFLAGS) $(CXXFLAGS)
  
  BUILD_CXX = @BUILD_CXX@
--- 156,162 ----
  XTRA_CXXFLAGS = @XTRA_CXXFLAGS@
  WARN_CXXFLAGS = @WARN_CXXFLAGS@
  ALL_CXXFLAGS = \
!   $(INCFLAGS) $(XTRA_CXXDEFS) $(DEFS) $(XTRA_CXXFLAGS) $(WARN_CXXFLAGS) 
$(CXXFLAGS)
  BUG_CXXFLAGS = $(DEFS) $(XTRA_CXXFLAGS) $(WARN_CXXFLAGS) $(CXXFLAGS)
  
  BUILD_CXX = @BUILD_CXX@
*************** for f in $(FCN_FILES_NO_DIR); \
*** 597,599 ****
--- 603,607 ----
    do rm -f $(DESTDIR)$(fcnfiledir)/$(script_sub_dir)/$$f; \
  done
  endef
+ 
+ @OMIT_DEPS@
Index: libcruft/misc/Makefile.in
===================================================================
RCS file: /cvs/octave/libcruft/misc/Makefile.in,v
retrieving revision 1.31
diff -p -c -r1.31 Makefile.in
*** libcruft/misc/Makefile.in   30 Oct 2003 16:48:09 -0000      1.31
--- libcruft/misc/Makefile.in   17 Oct 2006 11:07:41 -0000
*************** srcdir = @srcdir@
*** 12,17 ****
--- 12,20 ----
  top_srcdir = @top_srcdir@
  VPATH = @srcdir@
  
+ XTRA_CDEFS = @XTRA_CRUFT_DEFS@
+ XTRA_CXXDEFS = @XTRA_CRUFT_DEFS@
+ 
  SPECIAL_SRC := machar.c f77-extern.cc f77-fcn.c lo-error.c cquit.c quit.cc
  
  DEP_1 := $(patsubst %.c, %.d, $(SPECIAL_SRC))
Index: liboctave/Makefile.in
===================================================================
RCS file: /cvs/octave/liboctave/Makefile.in,v
retrieving revision 1.220
diff -p -c -r1.220 Makefile.in
*** liboctave/Makefile.in       13 Oct 2006 18:11:26 -0000      1.220
--- liboctave/Makefile.in       17 Oct 2006 11:07:41 -0000
*************** INSTALL = @INSTALL@
*** 18,23 ****
--- 18,26 ----
  INSTALL_PROGRAM = @INSTALL_PROGRAM@
  INSTALL_DATA = @INSTALL_DATA@
  
+ XTRA_CDEFS = @XTRA_OCTAVE_DEFS@
+ XTRA_CXXDEFS = @XTRA_OCTAVE_DEFS@
+ 
  LINK_DEPS = \
    -L../libcruft -L. $(RLD_FLAG) \
    $(LIBCRUFT) $(CHOLMOD_LIBS) $(UMFPACK_LIBS)  $(AMD_LIBS) \
Index: src/Makefile.in
===================================================================
RCS file: /cvs/octave/src/Makefile.in,v
retrieving revision 1.417
diff -p -c -r1.417 Makefile.in
*** src/Makefile.in     13 Oct 2006 18:11:27 -0000      1.417
--- src/Makefile.in     17 Oct 2006 11:07:42 -0000
*************** VPATH = @srcdir@:@srcdir@/DLD-FUNCTIONS:
*** 14,19 ****
--- 14,22 ----
  
  include $(TOPDIR)/Makeconf
  
+ XTRA_CDEFS = @XTRA_SRC_DEFS@
+ XTRA_CXXDEFS = @XTRA_SRC_DEFS@
+ 
  INSTALL = @INSTALL@
  INSTALL_PROGRAM = @INSTALL_PROGRAM@
  INSTALL_DATA = @INSTALL_DATA@
Index: configure.in
===================================================================
RCS file: /cvs/octave/configure.in,v
retrieving revision 1.526
diff -p -c -r1.526 configure.in
*** configure.in        13 Oct 2006 18:11:26 -0000      1.526
--- configure.in        17 Oct 2006 11:07:41 -0000
*************** AC_ARG_ENABLE(rpath,
*** 942,947 ****
--- 985,991 ----
      fi], [use_rpath=true])
  
  DLFCN_DIR=
+ DOC_DIR=doc
  CPICFLAG=-fPIC
  CXXPICFLAG=-fPIC
  FPICFLAG=-fPIC
*************** RLD_FLAG=
*** 963,968 ****
--- 1007,1015 ----
  NO_OCT_FILE_STRIP=false
  TEMPLATE_AR='$(AR)'
  TEMPLATE_ARFLAGS="$ARFLAGS"
+ XTRA_CRUFT_DEFS=
+ XTRA_OCTAVE_DEFS=
+ XTRA_SRC_DEFS=
  library_path_var=LD_LIBRARY_PATH
  case "$canonical_host_type" in
    *-*-386bsd* | *-*-openbsd* | *-*-netbsd*)
*************** case "$canonical_host_type" in
*** 1019,1024 ****
--- 1066,1077 ----
      SHLBIN=dll
      LIBPRE=
      SH_LDFLAGS="-shared -g"
+     # do not build documentation for MSVC target
+     DOC_DIR=
+     # extra compilation flags
+     XTRA_CRUFT_DEFS="-DCRUFT_DLL"
+     XTRA_OCTAVE_DEFS="-DOCTAVE_DLL"
+     XTRA_SRC_DEFS="-DOCTINTERP_DLL"
    ;;
    *-*-linux* | *-*-gnu*)
      MKOCTFILE_DL_LDFLAGS="-shared -Wl,-Bsymbolic"
*************** AC_MSG_NOTICE([defining SHLBIN_VER to be
*** 1111,1116 ****
--- 1164,1170 ----
  AC_MSG_NOTICE([defining SHLLINKEXT to be $SHLLINKEXT])
  AC_MSG_NOTICE([defining LIBPRE to be $LIBPRE])
  AC_MSG_NOTICE([defining DLFCN_DIR to be $DLFCN_DIR])
+ AC_MSG_NOTICE([defining DOC_DIR to be $DOC_DIR])
  AC_MSG_NOTICE([defining SH_LD to be $SH_LD])
  AC_MSG_NOTICE([defining SH_LDFLAGS to be $SH_LDFLAGS])
  AC_MSG_NOTICE([defining DL_LD to be $DL_LD])
*************** AC_MSG_NOTICE([defining NO_OCT_FILE_STRI
*** 1121,1126 ****
--- 1175,1183 ----
  AC_MSG_NOTICE([defining RLD_FLAG to be $RLD_FLAG])
  AC_MSG_NOTICE([defining TEMPLATE_AR to be $TEMPLATE_AR])
  AC_MSG_NOTICE([defining TEMPLATE_ARFLAGS to be $TEMPLATE_ARFLAGS])
+ AC_MSG_NOTICE([defining XTRA_CRUFT_DEFS to be $XTRA_CRUFT_DEFS])
+ AC_MSG_NOTICE([defining XTRA_OCTAVE_DEFS to be $XTRA_OCTAVE_DEFS])
+ AC_MSG_NOTICE([defining XTRA_SRC_DEFS to be $XTRA_SRC_DEFS])
  AC_MSG_NOTICE([defining library_path_var to be $library_path_var])
  AC_SUBST(FPICFLAG)
  AC_SUBST(CPICFLAG)
*************** AC_SUBST(SHLBIN_VER)
*** 1134,1139 ****
--- 1191,1197 ----
  AC_SUBST(SHLLINKEXT)
  AC_SUBST(LIBPRE)
  AC_SUBST(DLFCN_DIR)
+ AC_SUBST(DOC_DIR)
  AC_SUBST(SH_LD)
  AC_SUBST(SH_LDFLAGS)
  AC_SUBST(DL_LD)
*************** AC_SUBST(NO_OCT_FILE_STRIP)
*** 1144,1149 ****
--- 1202,1210 ----
  AC_SUBST(RLD_FLAG)
  AC_SUBST(TEMPLATE_AR)
  AC_SUBST(TEMPLATE_ARFLAGS)
+ AC_SUBST(XTRA_CRUFT_DEFS)
+ AC_SUBST(XTRA_OCTAVE_DEFS)
+ AC_SUBST(XTRA_SRC_DEFS)
  AC_SUBST(library_path_var)
  
  ### special checks for odd OS specific things.
*************** typedef int sig_atomic_t;
*** 1786,1796 ****
--- 1901,1944 ----
  #pragma warning (disable: 4996)
  /* deprecated function names (FIXME?) */
  #pragma warning (disable: 4661)
+ /* API macro for libcruft */
+ #ifdef CRUFT_DLL
+ #define CRUFT_API __declspec(dllexport)
+ #else
+ #define CRUFT_API __declspec(dllimport)
+ #endif
+ /* API macro for liboctave */
+ #ifdef OCTAVE_DLL
+ #define OCTAVE_API __declspec(dllexport)
+ #else
+ #define OCTAVE_API __declspec(dllimport)
+ #endif
+ /* API macro for src */
+ #ifdef OCTINTERP_DLL
+ #define OCTINTERP_API __declspec(dllexport)
+ #else
+ #define OCTINTERP_API __declspec(dllimport)
+ #endif
+ #else
+ /* All other compilers */
+ #define OCTAVE_API
+ #define OCTINTERP_API
+ #define CRUFT_API
  #endif
  
  #include "oct-types.h"
  ])
  
+ ### MSVC cannot build dependency
+ 
+ OMIT_DEPS=
+ case "$canonical_host_type" in
+   *-*-msdos)
+     OMIT_DEPS="omit_deps=true"
+     ;;
+ esac
+ AC_SUBST(OMIT_DEPS)
+ 
  ### Do the substitutions in all the Makefiles.
  
  AC_CONFIG_FILES([Makefile octMakefile Makeconf test/Makefile \
Index: octMakefile.in
===================================================================
RCS file: /cvs/octave/octMakefile.in,v
retrieving revision 1.212
diff -p -c -r1.212 octMakefile.in
*** octMakefile.in      28 Jul 2006 17:06:15 -0000      1.212
--- octMakefile.in      17 Oct 2006 11:07:41 -0000
*************** DISTFILES = $(CONF_DISTFILES) \
*** 36,45 ****
  DISTDIRS = # plplot
  
  # Subdirectories in which to run `make all'.
! SUBDIRS = @DLFCN_DIR@ libcruft liboctave src scripts doc examples
  
  # Subdirectories in which to run `make all'.
! INSTALL_SUBDIRS = libcruft liboctave src scripts doc examples
  
  # Subdirectories in which to run `make conf-dist'.
  CONF_DISTSUBDIRS = src
--- 36,45 ----
  DISTDIRS = # plplot
  
  # Subdirectories in which to run `make all'.
! SUBDIRS = @DLFCN_DIR@ libcruft liboctave src scripts @DOC_DIR@ examples
  
  # Subdirectories in which to run `make all'.
! INSTALL_SUBDIRS = libcruft liboctave src scripts @DOC_DIR@ examples
  
  # Subdirectories in which to run `make conf-dist'.
  CONF_DISTSUBDIRS = src

reply via email to

[Prev in Thread] Current Thread [Next in Thread]