opensmalltalk-vm icon indicating copy to clipboard operation
opensmalltalk-vm copied to clipboard

configure autoconf 2.72 : AC_TRY_COMPILE and AC_COMPILE_IFELSE

Open dcstes opened this issue 7 months ago • 4 comments

autoconf 2.72 claims that AC_TRY_COMPILE is obsolete. it may be possible to replace this macro by AC_COMPILE_IFELSE in some cases, or by other macros (AC_CHECK_HEADERS or so)

https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.72/autoconf.html#index-AC_005fTRY_005fCOMPILE

In section: 18.4 Obsolete Macros Several macros are obsoleted in Autoconf, for various reasons (typically they failed to quote properly, couldn’t be extended for more recent issues, etc.). They are still supported, but deprecated: their use should be avoided.

apparently AC_TRY_COMPILE is still accepted and it seems autoconf 2.72 only prints a warning

dcstes avatar May 20 '25 19:05 dcstes

When running autoconf 2.72 on the OpenSmalltalk platforms/unix/config/configure.in script, this emits a bunch of warnings that AC_TRY_COMPILE supposedly is obsolete.

Although that replacing AC_TRY_COMPILE( somecode ) by AC_COMPILE_IFELSE( some other code) is possible, perhaps there is a better way.

dcstes avatar May 22 '25 06:05 dcstes

Tested the following platforms/unix/vm-sound-Sun/acinclude.m4

AC_MSG_CHECKING([for SunOS/Solaris audio])
AC_TRY_COMPILE([#include <sys/audioio.h>],[AUDIO_SUNVTS;],[
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <sys/audioio.h> int test = AUDIO_SUNVTS;]])],[
  AC_MSG_RESULT(yes)
  AC_DEFINE_UNQUOTED(HAVE_SYS_AUDIOIO_H,1, [SunOS/Solaris audio])
],[
  AC_TRY_COMPILE([#include <sun/audioio.h>],[AUDIO_SUNVTS;],[
  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <sun/audioio.h> int test = AUDIO_SUNVTS;]])],[
    AC_MSG_RESULT(yes)
    AC_DEFINE_UNQUOTED(HAVE_SUN_AUDIOIO_H,1, [Sun audioio])
  ],[

dcstes avatar May 22 '25 06:05 dcstes

The other sound plugins (like OSS and ALSA) simply seem to use AC_CHECK_HEADERS which is not obsolete in autoconf 2.72.

In pull request #724 I update (and simplify) the acinclude.m4 of the vm-sound-Sun plugin so that it also uses AC_CHECK_HEADERS. And this makes the acinclude.m4 file smaller as well.

By updating the acinclude.m4, this prepares for using autoconf 2.72, and it avoids the warning with autoconf 2.72 that AC_TRY_COMPILE is obsolete in that version of autoconf.

There are some other instances of AC_TRY_COMPILE in the platforms/unix/config/acinclude.m4 file.

Currently autoconf 2.72 warns (or complains) that AC_TRY_COMPILE is obsolete, although it is not nice from the autoconf part to make such an incompatible change and force a migration to something else ...

dcstes avatar May 22 '25 16:05 dcstes

There are 7 occurences of AC_TRY_COMPILE in platforms/unix/config/acinclude.m4

Those are accepted by autoconf 2.72 but it complains that those macro's are obsolete (or will be obsolete in the future by a new version of autoconf, perhaps ?)

Anyway I am not convinced that replacing AC_TRY_COMPILE by AC_COMPILE_IFELSE is much of an improvement.

In fact I think AC_TRY_COMPILE could be supported in the future by autoconf, they could easily provide a backwared compatibility implementation of that macro at the autoconf level ...

Perhaps some of the other AC_TRY_COMPILE occurences could also be moved to AC_CHECK_HEADERS.

dcstes avatar May 24 '25 06:05 dcstes