Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2004:
[Freeciv-Dev] (PR#9342) an xaw-client m4 file
Home

[Freeciv-Dev] (PR#9342) an xaw-client m4 file

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#9342) an xaw-client m4 file
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 11 Jul 2004 19:09:48 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=9342 >

The gtk, gtk2, win32, and sdl clients all have their own m4 files.  This 
separates the code slighly (by creating a function call like 
FC_XAW_CLIENT) and also allows it to work with both configure.ac and 
configure.in.

This patch does the same thing for the XAW check.  Apply the patch and 
copy the m4 file into m4/.  Then rerun autogen.sh.

The code in configure.in and configure.ac differed slightly.  Part of 
this was trivial stuff like a different function name for a library 
check and added parameters to AC_DEFINE().  But configure.ac has to also 
use AH_TEMPLATE in a few places because it doesn't have an acconfig.h 
and autoconf barfs because some variables are used with AC_DEFINE.  I 
assume this works with autoconf2.13 but I haven't checked.

P.S.  We should drop autoconf2.13 support.

jason

? acconfig.h
? iconv-jds.png
? m4/xaw-client.m4
Index: Makefile.am
===================================================================
RCS file: /home/freeciv/CVS/freeciv/Makefile.am,v
retrieving revision 1.40
diff -u -r1.40 Makefile.am
--- Makefile.am 20 May 2004 17:00:23 -0000      1.40
+++ Makefile.am 12 Jul 2004 02:04:19 -0000
@@ -73,6 +73,7 @@
                m4/win32-client.m4              \
                m4/x.213                        \
                m4/x.252                        \
+               m4/xaw-client.m4                \
                vms/config.h_vms                \
                vms/freeciv_h.vms               \
                vms/imlib_config.h_vms          \
Index: configure.ac
===================================================================
RCS file: /home/freeciv/CVS/freeciv/configure.ac,v
retrieving revision 1.65
diff -u -r1.65 configure.ac
--- configure.ac        1 Jun 2004 04:00:49 -0000       1.65
+++ configure.ac        12 Jul 2004 02:04:19 -0000
@@ -331,101 +331,7 @@
   FC_SDL_CLIENT
 
   dnl Xaw-specific overrides
-  if test "$client" = xaw || test "$client" = yes ; then
-    dnl Checks for X:
-    AC_PATH_XTRA
-
-    dnl Determine the Xfuncproto control definitions:
-    FC_CHECK_X_PROTO_DEFINE(FUNCPROTO)
-    if test -n "$fc_x_proto_value"; then
-      AC_DEFINE_UNQUOTED(FUNCPROTO, $fc_x_proto_value, [Xfuncproto])
-    fi
-    FC_CHECK_X_PROTO_DEFINE(NARROWPROTO)
-    if test -n "$fc_x_proto_value"; then
-      AC_DEFINE_UNQUOTED(NARROWPROTO, $fc_x_proto_value, [Narrowproto])
-    fi
-
-    dnl Check for libpng
-    AC_CHECK_LIB(png, png_read_image, [X_LIBS="$X_LIBS -lpng -lm"],
-       AC_MSG_ERROR([Could not find PNG library (libpng).]), [-lm -lz])
-    AC_CHECK_HEADER(png.h, ,
-       AC_MSG_ERROR([libpng found but not png.h.
-You may need to install a libpng \"development\" package.]))
-
-    dnl Try to get additional Xpm paths:
-    FC_XPM_PATHS
-
-    if test "$xpm_incdir" != "no"; then
-      X_CFLAGS="$X_CFLAGS -I$xpm_incdir"
-    fi
-    if test "$xpm_libdir" != "no"; then
-      X_LIBS="$X_LIBS -L$xpm_libdir"
-      dnl Try using R values set in AC_PATH_XTRA:
-      if test "$ac_R_nospace" = "yes"; then
-        X_LIBS="$X_LIBS -R$xpm_libdir"
-      elif test "$ac_R_space" = "yes"; then
-        X_LIBS="$X_LIBS -R $xpm_libdir"
-      fi
-      dnl Some sites may put xpm.h in a directory whose parent isn't "X11"
-      if test "x$xpm_h_no_x11" = "xyes"; then
-        AC_DEFINE(XPM_H_NO_X11, 1, [XPM support])
-      fi
-    fi
-
-    dnl Checks for X libs:
-    # The HAVE_LIBX** values are defined in FC_CHECK_X_LIB, but we need an
-    # AH_TEMPLATE for them so that autoheader will know about them.
-    fc_save_X_LIBS="$X_LIBS"
-    X_LIBS="$X_LIBS $X_PRE_LIBS"
-    AH_TEMPLATE([HAVE_LIBX11], [Define if the X11 lib is available])
-    FC_CHECK_X_LIB(X11, XOpenDisplay, , haveX11=no)
-    if test "x$haveX11" != "xno"; then
-      AH_TEMPLATE([HAVE_LIBXEXT], [Define if the Xext lib is available])
-      FC_CHECK_X_LIB(Xext, XShapeCombineMask)
-
-      dnl Insert X_PRE_LIBS (eg -lSM -lICE) into X_EXTRA_LIBS here:
-      X_EXTRA_LIBS="$X_PRE_LIBS $X_EXTRA_LIBS"
-      X_LIBS="$fc_save_X_LIBS"
-
-      AH_TEMPLATE([HAVE_LIBXT], [Define if the Xt lib is available])
-      FC_CHECK_X_LIB(Xt, main)
-      AH_TEMPLATE([HAVE_LIBXMU], [Define if the Xmu lib is available])
-      FC_CHECK_X_LIB(Xmu, main)
-      AH_TEMPLATE([HAVE_LIBXPM], [Define if the Xpm lib is available])
-      FC_CHECK_X_LIB(Xpm, XpmReadFileToPixmap, , haveXpm=no)
-      if test "x$haveXpm" != "xno"; then
-       dnl Xaw or Xaw3d:
-        AH_TEMPLATE([HAVE_LIBXAW], [Define if the Xaw lib is to be used])
-        AH_TEMPLATE([HAVE_LIBXAW3D], [Define if the Xaw3d lib is to be used])
-       if test -n "$WITH_XAW3D"; then
-         FC_CHECK_X_LIB(Xaw3d, main, , AC_MSG_ERROR(did not find Xaw3d 
library))
-       elif test "$client" = "xaw"; then
-         FC_CHECK_X_LIB(Xaw, main, , AC_MSG_ERROR(did not find Xaw library))
-       else
-         FC_CHECK_X_LIB(Xaw3d, main, , noXaw3d=1)
-         if test -n "$noXaw3d"; then
-           FC_CHECK_X_LIB(Xaw, main, ,
-             AC_MSG_ERROR(did not find either Xaw or Xaw3d library))
-         fi
-       fi
-
-       CLIENT_CFLAGS="$X_CFLAGS"
-       CLIENT_LIBS="$X_LIBS $X_EXTRA_LIBS"
-
-       found_client=yes
-      fi
-    fi
-
-    if test "x$found_client" = "xyes"; then
-      client=xaw
-    elif test "$client" = "xaw"; then
-      if test "x$haveXpm" = "xno"; then
-       AC_MSG_ERROR(specified client 'xaw' not configurable -- need Xpm 
library and development headers; perhaps try/adjust --with-xpm-lib)
-      else
-       AC_MSG_ERROR(specified client 'xaw' not configurable -- need X11 
libraries and development headers; perhaps try/adjust --x-libraries)
-      fi
-    fi
-  fi
+  FC_XAW_CLIENT
 
   dnl BeOS-specific overrides
   if test "$client" = beos || test "$client" = yes ; then
Index: configure.in
===================================================================
RCS file: /home/freeciv/CVS/freeciv/configure.in,v
retrieving revision 1.241
diff -u -r1.241 configure.in
--- configure.in        1 Jun 2004 04:00:49 -0000       1.241
+++ configure.in        12 Jul 2004 02:04:19 -0000
@@ -324,92 +324,7 @@
   FC_SDL_CLIENT
 
   dnl Xaw-specific overrides
-  if test "$client" = xaw || test "$client" = yes ; then
-    dnl Checks for X:
-    AC_PATH_XTRA
-
-    dnl Determine the Xfuncproto control definitions:
-    FC_CHECK_X_PROTO_DEFINE(FUNCPROTO)
-    if test -n "$fc_x_proto_value"; then
-      AC_DEFINE_UNQUOTED(FUNCPROTO, $fc_x_proto_value)
-    fi
-    FC_CHECK_X_PROTO_DEFINE(NARROWPROTO)
-    if test -n "$fc_x_proto_value"; then
-      AC_DEFINE_UNQUOTED(NARROWPROTO, $fc_x_proto_value)
-    fi
-
-    dnl Check for libpng
-    AC_CHECK_LIB(png, png_create_read_struct, [X_LIBS="$X_LIBS -lpng -lm"],
-       AC_MSG_ERROR([Could not find PNG library (libpng).]), [-lm -lz])
-    AC_CHECK_HEADER(png.h, ,
-       AC_MSG_ERROR([libpng found but not png.h.
-You may need to install a libpng \"development\" package.]))
-
-    dnl Try to get additional Xpm paths:
-    FC_XPM_PATHS
-
-    if test "$xpm_incdir" != "no"; then
-      X_CFLAGS="$X_CFLAGS -I$xpm_incdir"
-    fi
-    if test "$xpm_libdir" != "no"; then
-      X_LIBS="$X_LIBS -L$xpm_libdir"
-      dnl Try using R values set in AC_PATH_XTRA:
-      if test "$ac_R_nospace" = "yes"; then
-        X_LIBS="$X_LIBS -R$xpm_libdir"
-      elif test "$ac_R_space" = "yes"; then
-        X_LIBS="$X_LIBS -R $xpm_libdir"
-      fi
-      dnl Some sites may put xpm.h in a directory whose parent isn't "X11"
-      if test "x$xpm_h_no_x11" = "xyes"; then
-        AC_DEFINE(XPM_H_NO_X11)
-      fi
-    fi
-
-    dnl Checks for X libs:
-    fc_save_X_LIBS="$X_LIBS"
-    X_LIBS="$X_LIBS $X_PRE_LIBS"
-    FC_CHECK_X_LIB(X11, XOpenDisplay, , haveX11=no)
-    if test "x$haveX11" != "xno"; then
-      FC_CHECK_X_LIB(Xext, XShapeCombineMask)
-
-      dnl Insert X_PRE_LIBS (eg -lSM -lICE) into X_EXTRA_LIBS here:
-      X_EXTRA_LIBS="$X_PRE_LIBS $X_EXTRA_LIBS"
-      X_LIBS="$fc_save_X_LIBS"
-
-      FC_CHECK_X_LIB(Xt, main)
-      FC_CHECK_X_LIB(Xmu, main)
-      FC_CHECK_X_LIB(Xpm, XpmReadFileToPixmap, , haveXpm=no)
-      if test "x$haveXpm" != "xno"; then
-       dnl Xaw or Xaw3d:
-       if test -n "$WITH_XAW3D"; then
-         FC_CHECK_X_LIB(Xaw3d, main, , AC_MSG_ERROR(did not find Xaw3d 
library))
-       elif test "$client" = "xaw"; then
-         FC_CHECK_X_LIB(Xaw, main, , AC_MSG_ERROR(did not find Xaw library))
-       else
-         FC_CHECK_X_LIB(Xaw3d, main, , noXaw3d=1)
-         if test -n "$noXaw3d"; then
-           FC_CHECK_X_LIB(Xaw, main, ,
-             AC_MSG_ERROR(did not find either Xaw or Xaw3d library))
-         fi
-       fi
-
-       CLIENT_CFLAGS="$X_CFLAGS"
-       CLIENT_LIBS="$X_LIBS $X_EXTRA_LIBS"
-
-       found_client=yes
-      fi
-    fi
-
-    if test "x$found_client" = "xyes"; then
-      client=xaw
-    elif test "$client" = "xaw"; then
-      if test "x$haveXpm" = "xno"; then
-       AC_MSG_ERROR(specified client 'xaw' not configurable -- need Xpm 
library and development headers; perhaps try/adjust --with-xpm-lib)
-      else
-       AC_MSG_ERROR(specified client 'xaw' not configurable -- need X11 
libraries and development headers; perhaps try/adjust --x-libraries)
-      fi
-    fi
-  fi
+  FC_XAW_CLIENT
 
   dnl BeOS-specific overrides
   if test "$client" = beos || test "$client" = yes ; then
# Try to configure the XAW client (gui-xaw)

# FC_XAW_CLIENT
# Test for X and XAW libraries needed for gui-xaw

AC_DEFUN([FC_XAW_CLIENT],
[
  if test "$client" = xaw || test "$client" = yes ; then
    dnl Checks for X:
    AC_PATH_XTRA

    dnl Determine the Xfuncproto control definitions:
    FC_CHECK_X_PROTO_DEFINE(FUNCPROTO)
    if test -n "$fc_x_proto_value"; then
      AC_DEFINE_UNQUOTED(FUNCPROTO, $fc_x_proto_value, [Xfuncproto])
    fi
    FC_CHECK_X_PROTO_DEFINE(NARROWPROTO)
    if test -n "$fc_x_proto_value"; then
      AC_DEFINE_UNQUOTED(NARROWPROTO, $fc_x_proto_value, [Narrowproto])
    fi

    dnl Check for libpng
    AC_CHECK_LIB(png, png_read_image, [X_LIBS="$X_LIBS -lpng -lm"],
        AC_MSG_ERROR([Could not find PNG library (libpng).]), [-lm -lz])
    AC_CHECK_HEADER(png.h, ,
        AC_MSG_ERROR([libpng found but not png.h.
You may need to install a libpng \"development\" package.]))

    dnl Try to get additional Xpm paths:
    FC_XPM_PATHS

    if test "$xpm_incdir" != "no"; then
      X_CFLAGS="$X_CFLAGS -I$xpm_incdir"
    fi
    if test "$xpm_libdir" != "no"; then
      X_LIBS="$X_LIBS -L$xpm_libdir"
      dnl Try using R values set in AC_PATH_XTRA:
      if test "$ac_R_nospace" = "yes"; then
        X_LIBS="$X_LIBS -R$xpm_libdir"
      elif test "$ac_R_space" = "yes"; then
        X_LIBS="$X_LIBS -R $xpm_libdir"
      fi
      dnl Some sites may put xpm.h in a directory whose parent isn't "X11"
      if test "x$xpm_h_no_x11" = "xyes"; then
        AC_DEFINE(XPM_H_NO_X11, 1, [XPM support])
      fi
    fi

    dnl Checks for X libs:
    # The HAVE_LIBX** values are defined in FC_CHECK_X_LIB, but we need an
    # AH_TEMPLATE for them so that autoheader will know about them.
    fc_save_X_LIBS="$X_LIBS"
    X_LIBS="$X_LIBS $X_PRE_LIBS"
    AH_TEMPLATE([HAVE_LIBX11], [Define if the X11 lib is available])
    FC_CHECK_X_LIB(X11, XOpenDisplay, , haveX11=no)
    if test "x$haveX11" != "xno"; then
      AH_TEMPLATE([HAVE_LIBXEXT], [Define if the Xext lib is available])
      FC_CHECK_X_LIB(Xext, XShapeCombineMask)

      dnl Insert X_PRE_LIBS (eg -lSM -lICE) into X_EXTRA_LIBS here:
      X_EXTRA_LIBS="$X_PRE_LIBS $X_EXTRA_LIBS"
      X_LIBS="$fc_save_X_LIBS"

      AH_TEMPLATE([HAVE_LIBXT], [Define if the Xt lib is available])
      FC_CHECK_X_LIB(Xt, main)
      AH_TEMPLATE([HAVE_LIBXMU], [Define if the Xmu lib is available])
      FC_CHECK_X_LIB(Xmu, main)
      AH_TEMPLATE([HAVE_LIBXPM], [Define if the Xpm lib is available])
      FC_CHECK_X_LIB(Xpm, XpmReadFileToPixmap, , haveXpm=no)
      if test "x$haveXpm" != "xno"; then
        dnl Xaw or Xaw3d:
        AH_TEMPLATE([HAVE_LIBXAW], [Define if the Xaw lib is to be used])
        AH_TEMPLATE([HAVE_LIBXAW3D], [Define if the Xaw3d lib is to be used])
        if test -n "$WITH_XAW3D"; then
          FC_CHECK_X_LIB(Xaw3d, main, , AC_MSG_ERROR(did not find Xaw3d 
library))
        elif test "$client" = "xaw"; then
          FC_CHECK_X_LIB(Xaw, main, , AC_MSG_ERROR(did not find Xaw library))
        else
          FC_CHECK_X_LIB(Xaw3d, main, , noXaw3d=1)
          if test -n "$noXaw3d"; then
            FC_CHECK_X_LIB(Xaw, main, ,
              AC_MSG_ERROR(did not find either Xaw or Xaw3d library))
          fi
        fi

        CLIENT_CFLAGS="$X_CFLAGS"
        CLIENT_LIBS="$X_LIBS $X_EXTRA_LIBS"

        found_client=yes
      fi
    fi

    if test "x$found_client" = "xyes"; then
      client=xaw
    elif test "$client" = "xaw"; then
      if test "x$haveXpm" = "xno"; then
        AC_MSG_ERROR(specified client 'xaw' not configurable -- need Xpm 
library and development headers; perhaps try/adjust --with-xpm-lib)
      else
        AC_MSG_ERROR(specified client 'xaw' not configurable -- need X11 
libraries and development headers; perhaps try/adjust --x-libraries)
      fi
    fi
  fi
])

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#9342) an xaw-client m4 file, Jason Short <=