Package: autoconf
Version: 2.61-4
Severity: normal
Tags: patch

AC_COMPILE_IFELSE and AC_LINK_IFELSE don't work as documented when
Erlang is the current language. I include a configure.ac which shows two
bugs.

1. AC_COMPILE_IFELSE always fails and runs ACTION-IF-NOT-FOUND, because
   configure checks if conftest.$ac_objext is present. But it never is
   when using Erlang.
   
2. AC_LINK_IFELSE always succeeds and runs ACTION-IF-FOUND, because
   the exit status of erlc (the Erlang compiler) is thrown away and
   configure uses the exit status of "chmod +x conftest$ac_exeext"
   instead. (Solution replace all semicolons with "&&" in the link
   command "ac_link".)

Test case and patch for 2. included.

Mikael

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (750, 'testing'), (671, 'stable'), (500, 'testing'), (300, 
'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.18-5-k7 (SMP w/1 CPU core)
Locale: LANG=sv_SE.UTF-8, LC_CTYPE=sv_SE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages autoconf depends on:
ii  debianutils                   2.25.1     Miscellaneous utilities specific t
ii  m4                            1.4.10-1   a macro processing language
ii  perl                          5.8.8-12   Larry Wall's Practical Extraction 

Versions of packages autoconf recommends:
ii  automake [automaken]     1:1.10+nogfdl-1 A tool for generating GNU Standard
ii  automake1.8 [automaken]  1.8.5+nogfdl-2  A tool for generating GNU Standard
ii  automake1.9 [automaken]  1.9.6+nogfdl-3  A tool for generating GNU Standard

-- no debconf information
--- ./autoconf.m4f.orig	2007-01-18 04:57:38.000000000 +0100
+++ ./autoconf.m4f	2007-12-07 21:06:05.000000000 +0100
@@ -2171,7 +2171,7 @@
 T15,312
 AC_LANG(Erlang)ac_ext=erl
 ac_compile='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext >&AS_MESSAGE_LOG_FD'
-ac_link='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext >&AS_MESSAGE_LOG_FD ; echo "#!/bin/sh" > conftest$ac_exeext ; echo "\"$ERL\" -run conftest start -run init stop -noshell" >> conftest$ac_exeext ; chmod +x conftest$ac_exeext'
+ac_link='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext >&AS_MESSAGE_LOG_FD&& echo "#!/bin/sh" > conftest$ac_exeext&& echo "\"$ERL\" -run conftest start -run init stop -noshell" >> conftest$ac_exeext&& chmod +x conftest$ac_exeext'
 
 T13,515
 AC_CHECK_FILE_m4_defun_pro([AC_CHECK_FILE])AC_DIAGNOSE([cross],
--- ./erlang.m4.orig	2007-01-18 04:57:38.000000000 +0100
+++ ./erlang.m4	2007-12-07 21:01:22.000000000 +0100
@@ -112,7 +112,7 @@
 m4_define([AC_LANG(Erlang)],
 [ac_ext=erl
 ac_compile='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext >&AS_MESSAGE_LOG_FD'
-ac_link='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext >&AS_MESSAGE_LOG_FD ; echo "#!/bin/sh" > conftest$ac_exeext ; echo "\"$ERL\" -run conftest start -run init stop -noshell" >> conftest$ac_exeext ; chmod +x conftest$ac_exeext'
+ac_link='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext >&AS_MESSAGE_LOG_FD && echo "#!/bin/sh" > conftest$ac_exeext && echo "\"$ERL\" -run conftest start -run init stop -noshell" >> conftest$ac_exeext && chmod +x conftest$ac_exeext'
 ])
 
 # AC_LANG_ERLANG
AC_PREREQ(2.59c)
AC_INIT(test, 1.0)

AC_ERLANG_NEED_ERLC
AC_ERLANG_PATH_ERL

AC_LANG_PUSH(Erlang)

AC_COMPILE_IFELSE(
        [AC_LANG_PROGRAM([],[
                ok
        ])],
        [],
        [AC_MSG_WARN([Erlang COMPILE_IFELSE failed!])]
)

AC_LINK_IFELSE(
        [AC_LANG_PROGRAM([],[
        ])], [AC_MSG_WARN([Erlang LINK_IFELSE should fail!])],
        []
)

AC_LANG_POP(Erlang)

AC_OUTPUT

Reply via email to