[sr #110294] AC_LANG_PUSH/AC_LANG_POP malfunction inside AC_DEFUN

Zack Weinberg <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.bugs
Message-ID <[email protected]>
Update of sr #110294 (project autoconf):

                  Status:                    None => Invalid                
             Open/Closed:                    Open => Closed                 

    _______________________________________________________

Follow-up Comment #2:

After a bunch of head-scratching I have figured out what's going on. This
code


    AC_LANG_PUSH([C++])
    AC_CACHE_CHECK([whether the C++ compiler has <cuchar>],
      [gl_cv_cxxheader_cuchar],
      [
       AC_COMPILE_IFELSE(
         [AC_LANG_PROGRAM(
            [[#include <cuchar>]],
            [[]])
         ],
         [gl_cv_cxxheader_cuchar=yes],
         [gl_cv_cxxheader_cuchar=no])
      ])
    AC_LANG_POP([C++])
-verbatim+

invokes AC_COMPILE_IFELSE with the current language set to C++. 
AC_COMPILE_IFELSE calls AC_LANG_COMPILER_REQUIRE, which AC_REQUIREs
AC_LANG_COMPILER(C++), which AC_REQUIREs AC_PROG_CXX.  Because of your earlier
"kind of an optional AC_PROG_CXX" code, this causes the AC_LANG machinery to
get confused about what the correct setting for $ac_compile is, for checks in
between the top of the AC_DEFUN and the AC_LANG_PUSH.

We can't support your code as-is in Autoconf 2.70.  However, I can offer you a
simple workaround.  Move all of the "optional AC_PROG_CXX" code into a new
AC_DEFUN.  Make the last line of that AC_DEFUN be


m4_provide([AC_PROG_CXX])


(right after the "Determine a good default for CXXFLAGS" if-block).

In my testing, those modifications make your sample configure script work
correctly.  They should be harmless with 2.69.

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/support/?110294>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.