summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2012-07-01 17:59:59 +0200
committerBruno Haible <bruno@clisp.org>2012-07-01 17:59:59 +0200
commitdd4c596245492622e70524b7ac672eb88418da14 (patch)
tree18ab3d3d1142556adfed5bba6c1e587e9042cb31
parent2ad5657daac1454a70b1d47fab2d01fb3460d172 (diff)
downloadgperf-dd4c596245492622e70524b7ac672eb88418da14.tar.gz
Support for building with MSVC much like for Unix.
-rw-r--r--ChangeLog9
-rw-r--r--Makefile.in5
-rw-r--r--README.woe32107
-rwxr-xr-xautogen.sh6
-rw-r--r--build-aux/.gitignore2
-rw-r--r--lib/Makefile.in10
6 files changed, 95 insertions, 44 deletions
diff --git a/ChangeLog b/ChangeLog
index a975318..fb6c1df 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2012-07-01 Bruno Haible <bruno@clisp.org>
+ Support for building with MSVC much like for Unix.
+ * autogen.sh: Fetch also 'compile' and 'ar-lib'.
+ * Makefile.in (IMPORTED_FILES): Add build-aux/compile, build-aux/ar-lib.
+ * build-aux/.gitignore: Ignore also 'compile' and 'ar-lib'.
+ * lib/Makefile.in: Use $(OBJEXT) where suitable.
+ * README.woe32: Change instructions for compiling with MSVC.
+
+2012-07-01 Bruno Haible <bruno@clisp.org>
+
Move build infrastructure files to build-aux/.
* autogen.sh: Copy install-sh and mkinstalldirst into build-aux/.
* configure.ac: Invoke AC_CONFIG_AUX_DIR.
diff --git a/Makefile.in b/Makefile.in
index 6c79c40..241cdcf 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -64,7 +64,10 @@ SOURCE_FILES = \
configure.ac aclocal.m4 Makefile.in Makefile.msvc Makefile.vms \
Makefile.devel ChangeLog
# List of distributed files imported from other packages.
-IMPORTED_FILES = COPYING INSTALL build-aux/install-sh build-aux/mkinstalldirs
+IMPORTED_FILES = \
+ COPYING INSTALL \
+ build-aux/install-sh build-aux/mkinstalldirs \
+ build-aux/compile build-aux/ar-lib
# List of distributed files generated by autotools or Makefile.devel.
GENERATED_FILES = configure
# List of distributed files generated by "make".
diff --git a/README.woe32 b/README.woe32
index 06dda70..2021bc5 100644
--- a/README.woe32
+++ b/README.woe32
@@ -1,7 +1,12 @@
-Installation on Woe32 (WinNT/2000/XP/Vista/7, Win95/98/ME):
+Installation on Woe32 (Microsoft Windows):
There are three ways to create binaries of this package for Woe32:
+1) Native binaries, built using the mingw tool chain.
+2) Native binaries, built using the MS Visual C/C++ tool chain.
+3) Binaries for the Cygwin environment. For these, please see the normal
+ INSTALL file.
+===============================================================================
1) Native binaries, built using the mingw tool chain.
I recommend to use the cygwin environment as the development environment
@@ -10,49 +15,79 @@ There are three ways to create binaries of this package for Woe32:
- cygwin,
- the mingw runtime package, also from the cygwin site.
- Building for mingw is achieved through the following preparation
- and configure commands:
+ Building for mingw is achieved through the following preparation,
+ configure, and build commands:
PATH=/usr/local/mingw/bin:$PATH
export PATH
./configure --host=i586-pc-mingw32 --prefix=/usr/local/mingw \
CC="gcc-3 -mno-cygwin" \
CXX="g++-3 -mno-cygwin"
+ make
+ make check
-2) Native binaries, built using the MS Visual C/C++ tool chain.
-
- - Requires MS Visual C/C++ 4.0 or 5.0 or 6.0 or 7.0.
-
- Note that binaries created with MSVC 7.0 should not be distributed: They
- depend on a closed-source library 'msvcr70.dll' which is not normally part
- of a Woe32 installation. You cannot distribute 'msvcr70.dll' with the
- binaries - this would be a violation of the GPL and of the Microsoft EULA.
- You can distribute the binaries without including 'msvcr70.dll', but this
- will cause problems for users that don't have this library on their system.
- Therefore it is not recommended. This problem does not occur with MSVC 6.0
- and earlier.
-
- - Cannot build in a separate directory.
+ Installation:
- - Build instructions:
+ make install
- Make sure that the MSVC4.0 or MSVC5.0 or MSVC6.0 or MSVC7.0 utilities
- ("cl" etc.) are found in PATH. In a typical MSVC6.0 installation, this
- can be achieved by running
- C:\Program Files\Microsoft Visual Studio\VC98\bin\vcvars32.bat
- In a typical MSVC7.0 installation, it can be achieved by running
- C:\Program Files\Microsoft Visual Studio .NET\Common7\Tools\vsvars32.bat
- nmake -f Makefile.msvc
-
- - Installation:
-
- Either:
-
- Copy gperf.exe to your program repository.
-
- Or:
+===============================================================================
+2) Native binaries, built using the MS Visual C/C++ tool chain.
- nmake -f Makefile.msvc install prefix=InstallBaseDirectory
+ Note that binaries created with MSVC have a distribution constraint: They
+ depend on a closed-source library ('msvcr70.dll' for MSVC 7.0, 'msvcr90.dll'
+ for MSVC 9.0, and so on) which is not normally part of a Windows
+ installation.
+ You cannot distribute 'msvcr*.dll' with the binaries - this would be a
+ violation of the GPL and of the Microsoft EULA.
+ You can distribute the binaries without including 'msvcr*.dll', but this
+ will cause problems for users that don't have this library on their system.
+ Therefore it is not recommended; the mingw tool chain is preferred for
+ this reason.
+
+ Requires MS Visual C/C++ 4.0 or newer. The "Express" edition which
+ contains just the tools and not the IDE is sufficient.
+
+ Requires also a cygwin or mingw environment (with 'bash', the common POSIX
+ commands, and 'make' ) as a build environment. Building with "nmake" is no
+ longer supported.
+
+ Make sure that the MSVC tools ("cl" etc.) are found in PATH.
+ In a typical MSVC 6.0 installation, this can be achieved by running
+ C:\Program Files\Microsoft Visual Studio\VC98\bin\vcvars32.bat
+ In a typical MSVC 7.0 installation, it can be achieved by running
+ C:\Program Files\Microsoft Visual Studio .NET\Common7\Tools\vsvars32.bat
+ In a typical MSVC 9.0 installation, it can be achieved by running
+ C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\vsvars32.bat
+
+ Then start a bash (from cygwin or mingw).
+
+ Building for mingw is achieved through the following preparation,
+ configure, and build commands:
+
+ PATH=/usr/local/msvc/bin:$PATH
+ export PATH
-3) Binaries for the Cygwin environment. For these, please see the normal
- INSTALL file.
+ win32_target=_WIN32_WINNT_WINXP # for MSVC 9.0
+ win32_target=_WIN32_WINNT_VISTA # possibly for MSVC >= 10.0
+ win32_target=_WIN32_WINNT_WIN7 # possibly for MSVC >= 10.0
+
+ ./configure --host=i586-pc-mingw32 --prefix=/usr/local/msvc \
+ CC="`pwd`/build-aux/compile cl -nologo" \
+ CFLAGS="-MD" \
+ CXX="`pwd`/build-aux/compile cl -nologo" \
+ CXXFLAGS="-MD" \
+ CPPFLAGS="-D_WIN32_WINNT=$win32_target -I/usr/local/msvc/include" \
+ LDFLAGS="-L/usr/local/msvc/lib" \
+ LD="link" \
+ NM="dumpbin -symbols" \
+ STRIP=":" \
+ AR="`pwd`/build-aux/ar-lib lib" \
+ RANLIB=":"
+ make
+ make check
+
+ Installation:
+
+ make install
+
+===============================================================================
diff --git a/autogen.sh b/autogen.sh
index 4bce7f3..4441790 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -29,7 +29,8 @@
GNULIB_REPO_URL="http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;hb=HEAD;f="
-for file in build-aux/install-sh build-aux/mkinstalldirs; do
+for file in build-aux/install-sh build-aux/mkinstalldirs \
+ build-aux/compile build-aux/ar-lib; do
if test -n "$GNULIB_TOOL"; then
$GNULIB_TOOL--copy-file $file $file
else
@@ -37,7 +38,8 @@ for file in build-aux/install-sh build-aux/mkinstalldirs; do
&& mv $file.tmp $file
fi
done
-chmod a+x build-aux/install-sh build-aux/mkinstalldirs
+chmod a+x build-aux/install-sh build-aux/mkinstalldirs \
+ build-aux/compile build-aux/ar-lib
rm -f configure lib/configure src/configure tests/configure doc/configure
rm -f src/config.h.in src/config.h.msvc src/config.h_vms
diff --git a/build-aux/.gitignore b/build-aux/.gitignore
index becb27d..0b7dfab 100644
--- a/build-aux/.gitignore
+++ b/build-aux/.gitignore
@@ -1,4 +1,6 @@
# Files brought in by gnulib-tool:
/install-sh
/mkinstalldirs
+/compile
+/ar-lib
diff --git a/lib/Makefile.in b/lib/Makefile.in
index 60cd28d..6a46d59 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -81,16 +81,16 @@ $(TARGETLIB): $(OBJECTS)
#%.o : %.cc
# $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
-getopt.o : getopt.c getopt.h
+getopt.$(OBJEXT) : getopt.c getopt.h
$(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/getopt.c
-getopt1.o : getopt1.c getopt.h
+getopt1.$(OBJEXT) : getopt1.c getopt.h
$(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/getopt1.c
-getline.o : getline.cc getline.h
+getline.$(OBJEXT) : getline.cc getline.h
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/getline.cc
-hash.o : hash.cc hash.h
+hash.$(OBJEXT) : hash.cc hash.h
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/hash.cc
install : all
@@ -104,7 +104,7 @@ check : all
mostlyclean : clean
clean : force
- $(RM) *~ *.s *.o *.a $(TARGETLIB) core
+ $(RM) *~ *.s *.$(OBJEXT) *.a $(TARGETLIB) core
distclean : clean
$(RM) config.status config.log config.cache Makefile