Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2004:
[Freeciv-Dev] Re: (PR#7506) Freeciv assumes ar(1) without checking
Home

[Freeciv-Dev] Re: (PR#7506) Freeciv assumes ar(1) without checking

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: i-freeciv-lists@xxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#7506) Freeciv assumes ar(1) without checking
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 24 Feb 2004 23:10:53 -0800
Reply-to: rt@xxxxxxxxxxx

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

Raimar Falke wrote:

>>Will compilation actually break if ar isn't present?
> 
> Yes of course.

Well this doesn't entirely go without saying.  We already have an 
AC_PROG_RANLIB, but this doesn't fail if ranlib isn't present.  It just 
disables ranlib usage (apparently this is optional?).

Anyway, we definitely do want a check for AR.  A line like

   AC_CHECK_TOOL(AR, ar)

will set $AR to the ar program that is found.  This is a big bonus 
because it will take the host into account, so you don't have to set $AR 
manually when cross-compiling.

A line like

   if test -z $AR; then
     AC_MSG_ERROR(...)
   fi

will exit if AR isn't present.  This isn't strictly necessary (if ar 
isn't present the user probably isn't going to be helped much by us 
telling them so!) but it is a bit helpful since compiling without ar 
gives weird results.

So this patch includes both.  I've only touched configure.ac - I'm not 
going to bother finding out if AC_CHECK_TOOL works for configure.in (can 
we drop autoconf2.13 support yet?).

---

So with this patch, you can cross-compile easily!  Yes, easily!  It only 
takes this line:

./configure --host=i586-mingw32msvc --disable-nls --enable-client=win32 
--disable-esd && make

---

Legal note: I looked at the openssh code before making this patch.  I 
suspect the openssh licence does not allow us to take code from them. 
But this code isn't copied directly (they don't use AC_CHECK_TOOL, use a 
different error message, etc.).  So I think it should be okay.

jason

Index: configure.ac
===================================================================
RCS file: /home/freeciv/CVS/freeciv/configure.ac,v
retrieving revision 1.54
diff -u -r1.54 configure.ac
--- configure.ac        2004/01/31 17:51:23     1.54
+++ configure.ac        2004/02/25 06:59:50
@@ -128,6 +128,10 @@
 AC_PROG_CPP
 AC_PROG_LN_S
 AC_PROG_RANLIB
+AC_CHECK_TOOL(AR, ar)
+if test -z $AR; then
+       AC_MSG_ERROR([*** 'ar' missing.  You may need to install binutils. ***])
+fi
 
 AC_CHECK_PROG(UNAME,uname,uname,:)
 

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