From alsa-devel-owner@alsa.jcu.cz  Sat Oct 31 15:51:51 1998
Received: from downstairs.db-bbs.com (root@300.hiper02.shef.dialup.force9.net [195.166.145.44])
	by marvin.jcu.cz (8.9.1a/8.9.1) with ESMTP id PAA31070
	for <alsa-devel@alsa.jcu.cz>; Sat, 31 Oct 1998 15:51:36 +0100
Received: by sandy.force9.co.uk
	via sendmail from stdin
	id <m0zZcNK-000BIhC@downstairs.db-bbs.com> (Debian Smail3.2.0.101)
	for alsa-devel@alsa.jcu.cz; Sat, 31 Oct 1998 14:51:34 +0000 (GMT) 
Message-Id: <m0zZcNK-000BIhC@downstairs.db-bbs.com>
From: chrisb@sandy.force9.co.uk (Chris Butler)
Subject: AC_TRY_COMPILE instead of AC_TRY_RUN
To: alsa-devel@alsa.jcu.cz
Date: Sat, 31 Oct 1998 14:51:34 +0000 (GMT)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=ELM909845494-1952-0_
Content-Transfer-Encoding: 7bit
Reply-To: alsa-devel@alsa.jcu.cz
Sender: alsa-devel-owner@alsa.jcu.cz
Precedence: list


--ELM909845494-1952-0_
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

Hi,

I was just looking through the configure.in and utils/alsa.m4 [1]
files in the alsa-lib package on CVS and I noticed that there were a
few places that used AC_TRY_RUN, where AC_TRY_COMPILE would be
sufficient. The patch below eliminates this, which will speed up
configure, and allow cross-compiling. Instead of returning an
errorlevel when run, it makes the compilation fail with an error
(using #error).

Also corrects some quoting in arguments to the AC_MSG macros. Autoconf
puts them in double-quotes itself, so things will not be as expected
if double-quotes are used in the m4 files.

I may be able to convert the alsa-lib makefiles to use automake and
libtool if anyone wants me to do this?

--
Chris Butler
<chrisb@sandy.force9.co.uk>

[1] What is that m4 file in utils for anyway, perhaps it should be
    aclocal.m4?


--ELM909845494-1952-0_
Content-Type: text/plain
Content-Disposition: inline; filename="/tmp/alsa-lib-m4.diff"
Content-Transfer-Encoding: 7bit

--- alsa.m4.old	Sat Oct 31 14:31:43 1998
+++ alsa.m4	Sat Oct 31 14:46:09 1998
@@ -65,23 +65,30 @@
     alsa_min_micro_version=`echo $min_alsa_version | \
            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
 
-AC_TRY_RUN([
+AC_TRY_COMPILE([
 #include <sys/asoundlib.h>
+], [
 void main(void)
 {
-  if(SOUNDLIB_VERSION_MAJOR >= $alsa_min_major_version)
-    if(SOUNDLIB_VERSION_MINOR >= $alsa_min_minor_version) 
-      if(SOUNDLIB_VERSION_SUBMINOR >= $alsa_min_micro_version)
- 	exit(0);
+#if (SOUNDLIB_VERSION_MAJOR >= $alsa_min_major_version)
+# if (SOUNDLIB_VERSION_MINOR >= $alsa_min_minor_version) 
+#  if (SOUNDLIB_VERSION_SUBMINOR >= $alsa_min_micro_version)
+  exit(0);
+#  else
+#   error not present
+#  endif
+# else
+#  error not present
+# endif
+#else
+# error not present
+#endif
 
-  exit(1);
 }
 ],
-  [AC_MSG_RESULT("found.")],
-  [AC_MSG_RESULT("not present.")
-  AC_MSG_ERROR(Fatal error: Installed version of alsa-lib is too old.)],
-  [AC_MSG_RESULT("not supported")
-  AC_MSG_ERROR(Fatal error: Cross-compiling is not supported...)]
+  [AC_MSG_RESULT(found.)],
+  [AC_MSG_RESULT(not present.)
+  AC_MSG_ERROR(Fatal error: Installed version of alsa-lib is too old.)]
 )
 
 dnl That should be it.  Now just export out symbols:
--- configure.in.old	Sat Oct 31 14:30:22 1998
+++ configure.in	Sat Oct 31 14:48:15 1998
@@ -31,20 +31,21 @@
 CFLAGS="-I$myprefix/include"
 #echo "CFLAGS=$CFLAGS"
 AC_MSG_CHECKING(for alsa-driver package)
-AC_TRY_RUN([
+AC_TRY_COMPILE([
 #include <linux/asound.h>
+], [
 void main(void)
 {
 #if !defined( SND_PROTOCOL_VERSION ) || !defined( SND_PROTOCOL_UNCOMPATIBLE )
-  exit(1);
+#error not found
 #else
   exit(0);
 #endif
 }
 ],
-  AC_MSG_RESULT("present"),
-  AC_MSG_RESULT("not found"); echo "Fatal error: Install alsa-driver v0.2.0pre6+ package at first..."; exit 1;,
-  AC_MSG_RESULT("not supported"); echo "Fatal error: Cross-compiling isn't supported..."; exit 1;,
+  AC_MSG_RESULT(present),
+  AC_MSG_RESULT(not found);
+  AC_MSG_ERROR(Fatal error: Install alsa-driver v0.2.0pre6+ package first.)
 )
 
 dnl Check for version...

--ELM909845494-1952-0_

--ELM909845494-1952-0_--

