I have a question regarding src/win32/orconfig.h. I guess this hand- edited file is supposed to be used by MSVC (targeting Win32, WinCE and whatnot). Or? What prevents it from being used by e.g. MingW in a non- autoconf build?
If someone (like me that doesn't want to touch autotool with a ten-feet pole) want to use this file unchanged, things like: #undef HAVE_SYS_TIME_H
has to be treated specifically for MingW. E.g.: #ifndef __MINGW32__ #undef HAVE_SYS_TIME_H #endif
Same goes for HAVE_UNISTD_H, HAVE_GETTTIMEOFDAY etc.
BTW. Older MingW does not have gettimeofday(). I'm not sure when the function was added. So to be perfect, an "#ifndef" test should consider the __MINGW32_VERSION too.
--gv
For every credibility gap, there is a gullibility fill.
On Thu, Apr 28, 2011 at 8:29 AM, Gisle Vanem gvanem@broadpark.no wrote:
I have a question regarding src/win32/orconfig.h. I guess this hand- edited file is supposed to be used by MSVC (targeting Win32, WinCE and whatnot).
That's the idea.
Or? What prevents it from being used by e.g. MingW in a non- autoconf build?
Nobody's tried it. :)
If someone (like me that doesn't want to touch autotool with a ten-feet pole) want to use this file unchanged, things like: #undef HAVE_SYS_TIME_H
has to be treated specifically for MingW. E.g.: #ifndef __MINGW32__ #undef HAVE_SYS_TIME_H #endif
Same goes for HAVE_UNISTD_H, HAVE_GETTTIMEOFDAY etc.
BTW. Older MingW does not have gettimeofday(). I'm not sure when the function was added. So to be perfect, an "#ifndef" test should consider the __MINGW32_VERSION too.
It sounds a lot like you're using what I'd call an "unsupported build environment": you want to build Tor on an old version of mingw, and you don't want to use our regular autotools build process. That's fine, and we're not going to send out the Tor goon squad to go confiscate your compiler or make you use autotools or anything, but it's not something that I think we're going to put effort into supporting.
But hey, it's free software. If you wanted to write and maintain an alternative set of build scripts to work with different versions of mingw, that would be great. I could see merging those if they were clean and didn't affect the mainline code too much. I'd greatly prefer a separate orconfig.h if you take this route: sharing the same one between msvc and mingw seems like it's asking for trouble.
yrs,
"Nick Mathewson" nickm@freehaven.net wrote:
But hey, it's free software. If you wanted to write and maintain an alternative set of build scripts to work with different versions of mingw, that would be great.
I'm using the top of the line version of MingW (v3.18). I don't think MingW has changed too much the last 5 years that it would matter for Tor. Except for the added gettimeofday() (in MingW v.316 I believe), an orconfig.h should be unaware of any MingW version.
I'd greatly prefer a separate orconfig.h if you take this route: sharing the same one between msvc and mingw seems like it's asking for trouble.
Okay, but I'm now building Tor with the attached orconfig.h. This has "only" 5 tests for __MINGW32__. I don't think that is asking for trouble.
Gisle V.
# rm -v /bin/laden /bin/laden: removed /bin/laden
You could also use MinGW shell coupled with Eclipse for C/C++. Builds can be reduced to a few button clicks.
This way, if you need to use different #defines and versions you can have separate projects with linked source folders.
I am happy to help you achieve this, and I can send you docs - you might discover a few tricks that elude me.
Enclosed is a screen shot revealing what can be achieved.
Hope it helps.
*** if the attachment gets stripped, I can resend under separate cover.
Gisle Vanem wrote:
"Nick Mathewson" nickm@freehaven.net wrote:
But hey, it's free software. If you wanted to write and maintain an alternative set of build scripts to work with different versions of mingw, that would be great.
I'm using the top of the line version of MingW (v3.18). I don't think MingW has changed too much the last 5 years that it would matter for Tor. Except for the added gettimeofday() (in MingW v.316 I believe), an orconfig.h should be unaware of any MingW version.
I'd greatly prefer a separate orconfig.h if you take this route: sharing the same one between msvc and mingw seems like it's asking for trouble.
Okay, but I'm now building Tor with the attached orconfig.h. This has "only" 5 tests for __MINGW32__. I don't think that is asking for trouble.
Gisle V.
# rm -v /bin/laden /bin/laden: removed /bin/laden /* orconfig.h for Windows -- This file is *not* generated by autoconf.
- Instead, it has to be hand-edited to keep Win32 happy.
*/
/* Windows-only defines. */ #define MS_WINDOWS #define MS_WIN32 #define CONFDIR ""
/* Define to 1 if you have the <arpa/inet.h> header file. */ #undef HAVE_ARPA_INET_H
/* Define to 1 if you have the <assert.h> header file. */ #define HAVE_ASSERT_H
/* Define to 1 if you have the <ctype.h> header file. */ #define HAVE_CTYPE_H
#define ENABLE_THREADS
/* Define to 1 if you have the <errno.h> header file. */ #define HAVE_ERRNO_H
/* Define to 1 if you have the `event_get_method' function. */ #define HAVE_EVENT_GET_METHOD 1
/* Define to 1 if you have the `event_get_version' function. */ #define HAVE_EVENT_GET_VERSION 1
/* Define to 1 if you have the `event_set_log_callback' function. */ #define HAVE_EVENT_SET_LOG_CALLBACK 1
/* Define to 1 if you have the <fcntl.h> header file. */ #define HAVE_FCNTL_H
/* Define to 1 if you have the `ftime' function. */ #define HAVE_FTIME
/* Define to 1 if you have the `gettimeofday' function. */ #ifndef __MINGW32__ #undef HAVE_GETTIMEOFDAY #endif
/* Define to 1 if you have the <grp.h> header file. */ #undef HAVE_GRP_H
/* Define to 1 if you have the `inet_aton' function. */ #undef HAVE_INET_ATON
/* Define to 1 if you have the <inttypes.h> header file. */ /* #define HAVE_INTTYPES_H */
/* Define to 1 if you have the <limits.h> header file. */ #define HAVE_LIMITS_H
/* Define to 1 if you have the <machine/limits.h> header file. */ #undef HAVE_MACHINE_LIMITS_H
/* Define to 1 if you have the <memory.h> header file. */ #define HAVE_MEMORY_H
/* Define to 1 if you have the <netdb.h> header file. */ #undef HAVE_NETDB_H
/* Define to 1 if you have the <netinet/in.h> header file. */ #undef HAVE_NETINET_IN_H
/* Define to 1 if you have the <poll.h> header file. */ #undef HAVE_POLL_H
/* Define to 1 if you have the <pwd.h> header file. */ #undef HAVE_PWD_H
/* Define to 1 if you have the <signal.h> header file. */ #define HAVE_SIGNAL_H
/* Define to 1 if you have the `socketpair' function. */ #undef HAVE_SOCKETPAIR
/* Define to 1 if you have the <stdint.h> header file. */ #undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */ #define HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */ #undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */ #define HAVE_STRING_H
/* Define to 1 if you have the `strlcat' function. */ #if defined (WINCE) #define HAVE_STRLCAT #else #undef HAVE_STRLCAT #endif
/* Define to 1 if you have the `strlcpy' function. */ #if defined (WINCE) #define HAVE_STRLCPY #else #undef HAVE_STRLCPY #endif /* Define to 1 if you have the `strptime' function. */ #undef HAVE_STRPTIME
/* Define to 1 if your timeval has a tv_sec element. */ #define HAVE_STRUCT_TIMEVAL_TV_SEC /* Change to #undef if you're using BCC */
/* Define to 1 if you have the <sys/fcntl.h> header file. */ #ifndef __MINGW32__ #undef HAVE_SYS_FCNTL_H #endif
/* Define to 1 if you have the <sys/ioctl.h> header file. */ #ifndef __MINGW32__ #undef HAVE_SYS_IOCTL_H #endif
/* Define to 1 if you have the <sys/limits.h> header file. */ #undef HAVE_SYS_LIMITS_H
/* Define to 1 if you have the <sys/poll.h> header file. */ #undef HAVE_SYS_POLL_H
/* Define to 1 if you have the <sys/socket.h> header file. */ #undef HAVE_SYS_SOCKET_H
/* Define to 1 if you have the <sys/stat.h> header file. */ #define HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/time.h> header file. */ #ifndef __MINGW32__ #undef HAVE_SYS_TIME_H #endif
/* Define to 1 if you have the <sys/types.h> header file. */ #define HAVE_SYS_TYPES_H
/* Define to 1 if you have the <sys/utime.h> header file. */ #define HAVE_SYS_UTIME_H
/* Define to 1 if you have the <sys/wait.h> header file. */ #undef HAVE_SYS_WAIT_H
/* Define to 1 if you have the <time.h> header file. */ #define HAVE_TIME_H
/* Define to 1 if you have the `uname' function. */ #undef HAVE_UNAME
/* Define to 1 if you have the <unistd.h> header file. */ #ifndef __MINGW32__ #undef HAVE_UNISTD_H #endif
/* Define to 1 iff NULL is represented by a 0 in memory. */ #define NULL_REP_IS_ZERO_BYTES 1
/* Name of package */ #define PACKAGE "tor"
/* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */ #undef PACKAGE_NAME
/* Define to the full name and version of this package. */ #undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME
/* Define to the version of this package. */ #undef PACKAGE_VERSION
/* The size of a `char', as computed by sizeof. */ #define SIZEOF_CHAR 1
/* The size of a `int', as computed by sizeof. */ #define SIZEOF_INT 4
/* The size of a `int16_t', as computed by sizeof. */ #undef SIZEOF_INT16_T
/* The size of a `int32_t', as computed by sizeof. */ #undef SIZEOF_INT32_T
/* The size of a `int64_t', as computed by sizeof. */ #undef SIZEOF_INT64_T
/* The size of a `int8_t', as computed by sizeof. */ #undef SIZEOF_INT8_T
/* The size of a `long', as computed by sizeof. */ #define SIZEOF_LONG 4
/* The size of a `long long', as computed by sizeof. */ #undef SIZEOF_LONG_LONG
/* The size of a `short', as computed by sizeof. */ #define SIZEOF_SHORT 2
/* The size of a `time_t', as computed by sizeof. */ #define SIZEOF_TIME_T 4
/* The size of a `uint16_t', as computed by sizeof. */ #undef SIZEOF_UINT16_T
/* The size of a `uint32_t', as computed by sizeof. */ #undef SIZEOF_UINT32_T
/* The size of a `uint64_t', as computed by sizeof. */ #undef SIZEOF_UINT64_T
/* The size of a `uint8_t', as computed by sizeof. */ #undef SIZEOF_UINT8_T
/* The size of a `void *', as computed by sizeof. */ #define SIZEOF_VOID_P 4
/* The size of a `__int64', as computed by sizeof. */ #define SIZEOF___INT64 8
/* The sizeof a size_t, as computed by sizeof. */ #define SIZEOF_SIZE_T 4
/* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS
/* Define to 1 if time_t is signed. */ #define TIME_T_IS_SIGNED
/* Define to 1 iff unaligned int access is allowed */ #define UNALIGNED_INT_ACCESS_OK
#define HAVE_EVENT_H
/* Define to 1 iff we represent negative integers with two's complement */ #define USING_TWOS_COMPLEMENT
/* Version number of package */
#define VERSION "0.2.3.0-alpha-dev"
tor-dev mailing list tor-dev@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev