Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2002:
[Freeciv-Dev] Re: (PR#2579) autoconf detection of gui-win32
Home

[Freeciv-Dev] Re: (PR#2579) autoconf detection of gui-win32

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#2579) autoconf detection of gui-win32
From: "Jason Short via RT" <rt@xxxxxxxxxxxxxx>
Date: Sun, 29 Dec 2002 23:30:51 -0800
Reply-to: rt@xxxxxxxxxxxxxx

On Sun, 2002-12-15 at 02:40, Jason Short via RT wrote:
> 
> When I try configure --enable-client=win32, configure fails with no
> useful error message.
> 
> This patch makes this result better, and makes the code more modular.

This patch fixes a bug I introduced in the previous one: the libpng
check must link against libz.  It also checks for libz, removes the use
of a deprecated gcc option (-fnative-struct, which breaks compilation
under gcc 3), simplifies the win32 checks, and makes the error output
more consistent and more descriptive.

This could end up as one of a series of xxx-client.m4 files
(sdl-client.m4 already exists).  But in that case where should
FC_NO_CLIENT go?

jason


# Try to configure the Win32 client (gui-win32)

# FC_WIN32_CLIENT
# Test for Win32 and needed libraries for gui-win32

AC_DEFUN(FC_NO_CLIENT,
[
  if test "$client" = "$1"; then
    AC_MSG_ERROR([specified client '$1' not configurable ($2)])
  fi
])

AC_DEFUN(FC_WIN32_CLIENT,
[
  if test "$client" = "win32" || test "$client" = "yes" ; then
    if test "$MINGW32" = "yes"; then
      AC_CHECK_LIB([z], [gzgets],
        [
          AC_CHECK_HEADER([zlib.h],
            [
              AC_CHECK_LIB([png], [png_read_image],
                [
                  AC_CHECK_HEADER([png.h],
                    [
                      found_client=yes
                      client=win32
                      CLIENT_LIBS="-lwsock32 -lcomctl32  -lpng -lz -mwindows"
                    ],
                    [
                      FC_NO_CLIENT([win32], [libpng-dev is needed])
                    ])
                ],
                [
                  FC_NO_CLIENT([win32], [libpng is needed])
                ], [-lz])
            ],
            [
              FC_NO_CLIENT([win32], [zlib-dev is needed])
            ])
        ],
        [
          FC_NO_CLIENT([win32], [zlib is needed])
        ])
    else
      FC_NO_CLIENT([win32], [mingw32 is needed])
    fi
  fi
])
Index: Makefile.am
===================================================================
RCS file: /home/freeciv/CVS/freeciv/Makefile.am,v
retrieving revision 1.26
diff -u -r1.26 Makefile.am
--- Makefile.am 2002/11/30 20:42:01     1.26
+++ Makefile.am 2002/12/30 00:39:01
@@ -86,6 +86,7 @@
                m4/sdl-client.m4                \
                m4/sound.m4                     \
                m4/vsnprintf.m4                 \
+               m4/win32-client.m4              \
                m4/x.213                        \
                m4/x.252                        \
                vms/config.h_vms                \
Index: configure.ac
===================================================================
RCS file: /home/freeciv/CVS/freeciv/configure.ac,v
retrieving revision 1.31
diff -u -r1.31 configure.ac
--- configure.ac        2002/12/21 14:19:05     1.31
+++ configure.ac        2002/12/30 00:39:05
@@ -293,7 +293,6 @@
   AC_DEFINE(WIN32_NATIVE, 1, [Mingw32-specific setting - native])
   AC_DEFINE(HAVE_WINSOCK, 1, [Mingw32-specific setting - winsock])
   SERVER_LIBS="-lwsock32"
-  CFLAGS="$CFLAGS -fnative-struct"
 fi
 
 dnl Check and choose clients
@@ -456,21 +455,7 @@
   fi
 
   dnl Win32-specific overrides
-  if test "$client" = win32 || test "$client" = yes ; then
-    if test x"$MINGW32" = "xyes"; then
-      AC_CHECK_HEADER(png.h, ,
-         AC_MSG_ERROR("You have to install libpng"))
-      AC_CHECK_LIB(png, png_read_image,,
-         AC_MSG_ERROR("You have to install libpng"),-lz)
-      found_client=yes
-      CLIENT_LIBS="-lwsock32 -lcomctl32  -lpng -lz -mwindows"
-    fi
-    if test "x$found_client" = "xyes"; then
-      client=win32
-    elif test "$client" = "win32"; then
-      AC_MSG_ERROR(specified client 'win32' not configurable)
-    fi
-  fi
+  FC_WIN32_CLIENT
 
   dnl Stub-specific overrides
   if test "$client" = stub ; then
Index: configure.in
===================================================================
RCS file: /home/freeciv/CVS/freeciv/configure.in,v
retrieving revision 1.209
diff -u -r1.209 configure.in
--- configure.in        2002/12/21 14:19:05     1.209
+++ configure.in        2002/12/30 00:39:06
@@ -287,7 +287,6 @@
   AC_DEFINE(WIN32_NATIVE)
   AC_DEFINE(HAVE_WINSOCK)
   SERVER_LIBS="-lwsock32"
-  CFLAGS="$CFLAGS -fnative-struct"
 fi
 
 dnl Check and choose clients
@@ -450,21 +449,7 @@
   fi
 
   dnl Win32-specific overrides
-  if test "$client" = win32 || test "$client" = yes ; then
-    if test x"$MINGW32" = "xyes"; then
-      AC_CHECK_HEADER(png.h, ,
-         AC_MSG_ERROR("You have to install libpng"))
-      AC_CHECK_LIB(png, png_read_image,,
-         AC_MSG_ERROR("You have to install libpng"),-lz)
-      found_client=yes
-      CLIENT_LIBS="-lwsock32 -lcomctl32  -lpng -lz -mwindows"
-    fi
-    if test "x$found_client" = "xyes"; then
-      client=win32
-    elif test "$client" = "win32"; then
-      AC_MSG_ERROR(specified client 'win32' not configurable)
-    fi
-  fi
+  FC_WIN32_CLIENT
 
   dnl Stub-specific overrides
   if test "$client" = stub ; then

[Prev in Thread] Current Thread [Next in Thread]