[stunnel-users] Compile stunnel 4.10 using VC7(aka Visual Studio 2003)

Han Jun Li hanjun.li at verizon.net
Thu Jun 23 19:59:07 CEST 2005


Stunnel 4.10 does not compile with Visual Studio 7.  After spending the past few days to get it to compile, I thought someone might find this useful.  There is a change to the common.h that you need to hack.  Basically, you need to include <winsock2.h> and <ws2tcpip.h> before <windows.h> to make it compile without any warning.

The content of the make file(stunnel.mak) is below:

!IF "$(CFG)" == ""
CFG=stunnel - Release
!MESSAGE No configuration specified. Defaulting to "stunnel - Release"
!ENDIF 

!IF "$(CFG)" != "stunnel - Release"
!MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE 
!MESSAGE NMAKE /f "stunnel.mak" CFG="stunnel - Release"
!MESSAGE 
!MESSAGE Possible choices for configuration are:
!MESSAGE 
!MESSAGE "stunnel Release" (based on "Win32 (x86) Console Application")
!MESSAGE 
!ERROR An invalid configuration is specified.
!ENDIF 

!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE 
NULL=nul
!ENDIF 

CPP=cl.exe
RSC=rc.exe

!IF  "$(CFG)" == "stunnel - Release"

OPENSSL=c:\openssl-0.9.7g
!MESSAGE  ===   OpenSSL is configured to be at $(OPENSSL)  ===
OUTDIR=.\Release
INTDIR=.\Release
# Begin Custom Macros
OutDir=.\Release
# End Custom Macros

ALL : "$(OUTDIR)\stunnel.exe"


CLEAN :
	- at erase "$(INTDIR)\client.obj"
	- at erase "$(INTDIR)\gui.obj"
	- at erase "$(INTDIR)\log.obj"
	- at erase "$(INTDIR)\network.obj"
	- at erase "$(INTDIR)\options.obj"
	- at erase "$(INTDIR)\protocol.obj"
	- at erase "$(INTDIR)\resources.res"
	- at erase "$(INTDIR)\resolver.obj" 
	- at erase "$(INTDIR)\ssl.obj"
	- at erase "$(INTDIR)\sthreads.obj"
	- at erase "$(INTDIR)\stunnel.obj"
	- at erase "$(INTDIR)\vc60.idb"
	- at erase "$(OUTDIR)\stunnel.exe"

"$(OUTDIR)" :
    if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"

CPP_PROJ=/nologo /MT /W3 /G5 /O2 /I "$(OPENSSL)\inc32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "USE_WIN32" /D "HAVE_OPENSSL" /D "HAVE_GETADDRINFO" /D "HAVE_GETNAMEINFO" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c 
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\resources.res" /d "NDEBUG" 

.c{$(INTDIR)}.obj::
   $(CPP) @<<
   $(CPP_PROJ) $< 
<<

.cpp{$(INTDIR)}.obj::
   $(CPP) @<<
   $(CPP_PROJ) $< 
<<

.cxx{$(INTDIR)}.obj::
   $(CPP) @<<
   $(CPP_PROJ) $< 
<<

.c{$(INTDIR)}.sbr::
   $(CPP) @<<
   $(CPP_PROJ) $< 
<<

.cpp{$(INTDIR)}.sbr::
   $(CPP) @<<
   $(CPP_PROJ) $< 
<<

.cxx{$(INTDIR)}.sbr::
   $(CPP) @<<
   $(CPP_PROJ) $< 
<<


BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\stunnel.bsc" 
BSC32_SBRS= \
	
LINK32=link.exe
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  wsock32.lib $(OPENSSL)\out32dll\ssleay32.lib $(OPENSSL)\out32dll\libeay32.lib /nologo /subsystem:windows /incremental:no /pdb:"$(OUTDIR)\stunnel.pdb" /machine:I386 /out:"$(OUTDIR)\stunnel.exe"
LINK32_OBJS= \
	"$(INTDIR)\stunnel.obj" \
	"$(INTDIR)\client.obj" \
	"$(INTDIR)\gui.obj" \
	"$(INTDIR)\log.obj" \
	"$(INTDIR)\network.obj" \
	"$(INTDIR)\options.obj" \
	"$(INTDIR)\protocol.obj" \
	"$(INTDIR)\resources.res" \
	"$(INTDIR)\resolver.obj" \
	"$(INTDIR)\ssl.obj" \
	"$(INTDIR)\sthreads.obj"

"$(OUTDIR)\stunnel.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
    $(LINK32) @<<
    $(LINK32_FLAGS) $(LINK32_OBJS)
<<

!ENDIF 


!IF "$(CFG)" == "stunnel - Release" || "$(CFG)" == "stunnel - Debug"
SOURCE=.\client.c

"$(INTDIR)\client.obj" : $(SOURCE) "$(INTDIR)"


SOURCE=.\gui.c

"$(INTDIR)\gui.obj" : $(SOURCE) "$(INTDIR)"


SOURCE=.\log.c

"$(INTDIR)\log.obj" : $(SOURCE) "$(INTDIR)"


SOURCE=.\network.c

"$(INTDIR)\network.obj" : $(SOURCE) "$(INTDIR)"


SOURCE=.\options.c

"$(INTDIR)\options.obj" : $(SOURCE) "$(INTDIR)"


SOURCE=.\protocol.c

"$(INTDIR)\protocol.obj" : $(SOURCE) "$(INTDIR)"


SOURCE=.\resources.rc

"$(INTDIR)\resources.res" : $(SOURCE) "$(INTDIR)"
	$(RSC) $(RSC_PROJ) $(SOURCE)


SOURCE=.\resolver.c

"$(INTDIR)\resolver.obj" : $(SOURCE) "$(INTDIR)"


SOURCE=.\ssl.c

"$(INTDIR)\ssl.obj" : $(SOURCE) "$(INTDIR)"


SOURCE=.\sthreads.c

"$(INTDIR)\sthreads.obj" : $(SOURCE) "$(INTDIR)"


SOURCE=.\stunnel.c

"$(INTDIR)\stunnel.obj" : $(SOURCE) "$(INTDIR)"


!ENDIF 




More information about the stunnel-users mailing list