[patch] Autoconf on Cygwin

Feature requests for the Windows version of Transmission
Post Reply
tbucked
Posts: 1
Joined: Sat Aug 01, 2009 4:47 pm

[patch] Autoconf on Cygwin

Post by tbucked »

Transmission doesn't build on Cygwin out of the box, but it is very, very, close. There is a patch for release 1.71, but some of the changes made there are no longer needed due to updated thirdparty libraries, and the others were made without knowledge of the configure system.

With nightly build "1.73+", only two problems remain to be resolved. I tried to add these fixes to trac, but it seems new users are not allowed to create new tickets.

Cygwin does not yet have strtold, used in libtransmission/JSON_parser.c . Configure can check for this easily, but configure's definitions file is never used (??), so rather than checking in JSON_parser, I added a define to configure.ac which replaces strtold with strtod:

Code: Select all

diff -bur transmission-1.73+/configure.ac transmission-1.73+.new/configure.ac
--- transmission-1.73+/configure.ac     2009-07-18 08:12:21.000000000 -0400
+++ transmission-1.73+.new/configure.ac 2009-08-01 12:21:58.812500000 -0400
@@ -75,11 +75,15 @@
 AC_HEADER_STDC
 AC_HEADER_TIME
 
-AC_CHECK_FUNCS([lrintf strlcpy daemon dirname basename strcasecmp localtime_r posix_fallocate memmem])
+AC_CHECK_FUNCS([lrintf strlcpy daemon dirname basename strcasecmp localtime_r posix_fallocate memmem strtold])
 AC_PROG_INSTALL
 AC_PROG_MAKE_SET
 ACX_PTHREAD
 
+if test "x$ac_cv_func_strtold" != "xyes" ; then
+    CPPFLAGS="$CPPFLAGS -Dstrtold=strtod"
+fi
+
 AC_SEARCH_LIBS(cos, [m])
 AC_SEARCH_LIBS([socket], [socket net])
 AC_SEARCH_LIBS([gethostbyname], [nsl bind])
Also, configure.ac sets the same environment for mingw and cygwin, enabling a win32-targeted build. This is inappropriate; cygwin defines a unix subsystem and is not designed for win32 compiles:

Code: Select all

diff -bur transmission-1.73+/configure.ac transmission-1.73+.new/configure.ac
--- transmission-1.73+/configure.ac     2009-07-18 08:12:21.000000000 -0400
+++ transmission-1.73+.new/configure.ac 2009-08-01 12:21:58.812500000 -0400
@@ -335,7 +339,7 @@
 have_msw="no"
 case $host_os in
 
-   *cygwin|*mingw32*)
+   *mingw32*)
      have_msw="yes"
      CXXFLAGS="$CXXFLAGS -mms-bitfields -mwin32 -mwindows"
      CPPFLAGS="$CPPFLAGS -DWIN32 -D_WIN32 -DWIN32_LEAN_AND_MEAN"
With these two small changes to just one file, the nightly build compiles fine for me in cygwin. It would be great to get that happening in svn.
rb07
Posts: 1400
Joined: Sun Aug 24, 2008 3:14 am

Re: [patch] Autoconf on Cygwin

Post by rb07 »

That works, here's as one patch with a little extra that is needed:

Code: Select all

diff -NaurX /home/rberber/diff-excludes.txt transmission-1.73-orig/configure.ac transmission-1.73/configure.ac
--- transmission-1.73-orig/configure.ac	2009-07-17 20:21:12.000000000 -0500
+++ transmission-1.73/configure.ac	2009-08-05 12:07:42.000000000 -0500
@@ -75,11 +75,15 @@
 AC_HEADER_STDC
 AC_HEADER_TIME
 
-AC_CHECK_FUNCS([lrintf strlcpy daemon dirname basename strcasecmp localtime_r posix_fallocate memmem])
+AC_CHECK_FUNCS([lrintf strlcpy daemon dirname basename strcasecmp localtime_r posix_fallocate memmem strtold])
 AC_PROG_INSTALL
 AC_PROG_MAKE_SET
 ACX_PTHREAD
 
+if test "x$ac_cv_func_strtold" != "xyes" ; then
+    CPPFLAGS="$CPPFLAGS -Dstrtold=strtod"
+fi
+
 AC_SEARCH_LIBS(cos, [m])
 AC_SEARCH_LIBS([socket], [socket net])
 AC_SEARCH_LIBS([gethostbyname], [nsl bind])
@@ -335,7 +339,7 @@
 have_msw="no"
 case $host_os in
 
-   *cygwin|*mingw32*)
+   *mingw32*)
      have_msw="yes"
      CXXFLAGS="$CXXFLAGS -mms-bitfields -mwin32 -mwindows"
      CPPFLAGS="$CPPFLAGS -DWIN32 -D_WIN32 -DWIN32_LEAN_AND_MEAN"
diff -NaurX /home/rberber/diff-excludes.txt transmission-1.73-orig/third-party/miniupnp/updateminiupnpcstrings.sh transmission-1.73/third-party/miniupnp/updateminiupnpcstrings.sh
--- transmission-1.73-orig/third-party/miniupnp/updateminiupnpcstrings.sh	2009-07-17 20:21:07.000000000 -0500
+++ transmission-1.73/third-party/miniupnp/updateminiupnpcstrings.sh	2009-08-05 12:23:47.156250000 -0500
@@ -28,8 +28,8 @@
 
 echo "Detected OS [$OS_NAME] version [$OS_VERSION]"
 
-EXPR="s/OS_STRING \".*\"/OS_STRING \"${OS_NAME}\/${OS_VERSION}\"/"
-#echo $EXPR
+EXPR="s:OS_STRING \".*\":OS_STRING \"${OS_NAME}\/${OS_VERSION}\":"
+echo $EXPR
 #echo "Backing up $OUTPUT_FILE to $OUTPUT_FILE.bak."
 #cp $OUTPUT_FILE $OUTPUT_FILE.bak
 test -f ${TEMPLATE_FILE}
Of course the full instructions are that you need to install all of auto-tools, then patch the source, and finally run the script autogen.sh. After that I usually run:

Code: Select all

./configure --disable-nls --disable-cli --enable-daemon
and the usual make && make install. Remember to include /usr/local/bin in your path (or change the configure line to install somewhere else).

BTW the patch on the Wiki worked fine with version 1.72 that's why I didn't change it, didn't see if it still works with 1.73 but your patch is better.
Jordan
Transmission Developer
Posts: 2312
Joined: Sat May 26, 2007 3:39 pm
Location: Titania's Room

Re: [patch] Autoconf on Cygwin

Post by Jordan »

These are in r8887 now. Thanks for the patch! :D
Post Reply