From 208a337e1de2183b849e6c93ada766c001f1a4db Mon Sep 17 00:00:00 2001 From: oldfaber Date: Fri, 14 Sep 2012 16:36:10 +0200 Subject: [PATCH] Add a windows scripting host configure file. Simply run cscript configure.js from the win32 directory to generate the files needed to create the modbus DLL. --- src/win32/README.win32 | 16 ++++++++-------- src/win32/config.h.win32 | 167 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/win32/configure.js | 190 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/win32/modbus.rc | 2 +- 4 files changed, 366 insertions(+), 9 deletions(-) create mode 100644 src/win32/config.h.win32 create mode 100644 src/win32/configure.js diff --git a/src/win32/README.win32 b/src/win32/README.win32 index 4689371..e1d8b61 100644 --- a/src/win32/README.win32 +++ b/src/win32/README.win32 @@ -1,17 +1,17 @@ Intro ----- -This directory contains the project file for Visual Studio 2008 to build a -modbus.dll. + +This directory contains the project file for Visual Studio 2008 to build +modbus.dll and the import library modbus.lib. + The project file searches for D:/include/msvc_std to find stdint.h. See ../../README.md -config.h and modbus-version.h were generated using a Windows native experimental -port of zsh and Microsoft cl. - -TODO ----- +config.h and ../modbus-version.h are generated using configure.js. +Run + cscript configurs.js +to generate these files. -Fix the ugly need to have config.h and modbus-version.h in this directory. diff --git a/src/win32/config.h.win32 b/src/win32/config.h.win32 new file mode 100644 index 0000000..02ac444 --- /dev/null +++ b/src/win32/config.h.win32 @@ -0,0 +1,167 @@ +/* config.h. Generated from config.h.in by configure. */ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ARPA_INET_H */ + +/* Define to 1 if you have the declaration of `TIOCSRS485', and to 0 if you + don't. */ +/* #undef HAVE_DECL_TIOCSRS485 */ + +/* Define to 1 if you have the declaration of `__CYGWIN__', and to 0 if you + don't. */ +/* #undef HAVE_DECL___CYGWIN__ */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_DLFCN_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `fork' function. */ +/* #undef HAVE_FORK */ + +/* Define to 1 if you have the `getaddrinfo' function. */ +/* #undef HAVE_GETADDRINFO */ + +/* Define to 1 if you have the `gettimeofday' function. */ +/* #undef HAVE_GETTIMEOFDAY */ + +/* Define to 1 if you have the `inet_ntoa' function. */ +/* #undef HAVE_INET_NTOA */ + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LINUX_SERIAL_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `memset' function. */ +#define HAVE_MEMSET 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NETDB_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NETINET_IN_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NETINET_TCP_H */ + +/* Define to 1 if you have the `select' function. */ +/* #undef HAVE_SELECT */ + +/* Define to 1 if you have the `socket' function. */ +/* #undef HAVE_SOCKET */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strerror' function. */ +#define HAVE_STRERROR 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_STRINGS_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strlcpy' function. */ +/* #undef HAVE_STRLCPY */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_IOCTL_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_SOCKET_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_TIME_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_TERMIOS_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_TIME_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_UNISTD_H */ + +/* Define to 1 if you have the `vfork' function. */ +/* #undef HAVE_VFORK */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_VFORK_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_WINSOCK2_H 1 + +/* Define to 1 if `fork' works. */ +/* #undef HAVE_WORKING_FORK */ + +/* Define to 1 if `vfork' works. */ +/* #undef HAVE_WORKING_VFORK */ + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +/* #undef LT_OBJDIR */ + +/* Name of package */ +#define PACKAGE "libmodbus" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "https://github.com/stephane/libmodbus/issues" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "libmodbus" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "libmodbus @LIBMODBUS_VERSION@" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "libmodbus" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "@LIBMODBUS_VERSION@" + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if you can safely include both and . */ +/* #undef TIME_WITH_SYS_TIME */ + +/* Version number of package */ +#define VERSION "@LIBMODBUS_VERSION@" + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `int' if does not define. */ +/* #undef pid_t */ + +/* Define to `unsigned int' if does not define. */ +/* #undef size_t */ + +/* Define as `fork' if `vfork' does not work. */ +#define vfork fork diff --git a/src/win32/configure.js b/src/win32/configure.js new file mode 100644 index 0000000..daa2f77 --- /dev/null +++ b/src/win32/configure.js @@ -0,0 +1,190 @@ +/* Configure script for modbus.dll, specific for Windows with Scripting Host. + * + * Inspired by configure.js from libxml2 + * + * oldfaber < oldfaber _at_ gmail _dot_ com > + * + */ + +/* The source directory, relative to the one where this file resides. */ +var srcDir = ".."; +/* Base name of what we are building. */ +var baseName = "modbus"; +/* Configure file template and output file */ +var configFile = srcDir + "\\..\\configure.ac"; +/* Input and output files for the modbus-version.h include */ +var newfile; +/* Version strings for the binary distribution. Will be filled later in the code. */ +var verMajor; +var verMinor; +var verMicro; +/* modbus features. */ +var testRun = false; +/* Win32 build options. NOT used yet */ +var compiler = "msvc"; +/* Local stuff */ +var error = 0; + +/* Helper function, transforms the option variable into the 'Enabled' + or 'Disabled' string. */ +function boolToStr(opt) +{ + if (opt == false) + return "no"; + else if (opt == true) + return "yes"; + error = 1; + return "*** undefined ***"; +} + +/* Helper function, transforms the argument string into a boolean + value. */ +function strToBool(opt) +{ + if (opt == 0 || opt == "no") + return false; + else if (opt == 1 || opt == "yes") + return true; + error = 1; + return false; +} + +/* Displays the details about how to use this script. */ +function usage() +{ + var txt; + txt = "Usage:\n"; + txt += " cscript " + WScript.ScriptName + " \n"; + txt += " cscript " + WScript.ScriptName + " help\n\n"; + txt += "Options can be specified in the form