From: Bruno Haible Date: Tue, 16 Jul 2024 03:24:27 +0000 (+0200) Subject: Find the Objective-C compiler out-of-the-box on AlmaLinux 9 systems. X-Git-Tag: v0.23~250 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=272a409b3ce136d3c67156096973917f063f30c5;p=thirdparty%2Fgettext.git Find the Objective-C compiler out-of-the-box on AlmaLinux 9 systems. * gettext-tools/configure.ac: Invoke AC_PROG_OBJC with a customized search list. * gettext-tools/tests/init-env.in (OBJC, OBJCFLAGS): Set to the configure- determined values. * gettext-tools/tests/lang-objc: Use OBJC instead of CC, and OBJCFLAGS instead of CFLAGS. * gettext-tools/examples/hello-objc/configure.ac: Invoke AC_PROG_OBJC with a customized search list. Don't invoke AC_PROC_CC. --- diff --git a/gettext-tools/configure.ac b/gettext-tools/configure.ac index 8f3c0f37f..3e79d4776 100644 --- a/gettext-tools/configure.ac +++ b/gettext-tools/configure.ac @@ -550,6 +550,9 @@ gt_LOCALE_FR gt_LOCALE_FR_UTF8 gt_LOCALE_JA gt_LOCALE_DE_UTF8 +dnl Test for gobjc before gcc, since that's what the EPEL 9 package 'gcc-objc' +dnl installs (on systems where gcc does not support Objective C). +AC_PROG_OBJC([gobjc gcc objcc objc cc CC clang]) dnl Checks for functions for the tests/*.c tests. AC_CHECK_FUNCS_ONCE([getrlimit setrlimit uselocale]) diff --git a/gettext-tools/examples/hello-objc/configure.ac b/gettext-tools/examples/hello-objc/configure.ac index 5d76cd916..7702df168 100644 --- a/gettext-tools/examples/hello-objc/configure.ac +++ b/gettext-tools/examples/hello-objc/configure.ac @@ -7,8 +7,9 @@ AC_INIT([hello-objc], [0]) AC_CONFIG_SRCDIR([hello.m]) AM_INIT_AUTOMAKE([1.11]) -AC_PROG_CC -AC_SUBST([OBJC], ["$CC"]) +dnl Test for gobjc before gcc, since that's what the EPEL 9 package 'gcc-objc' +dnl installs (on systems where gcc does not support Objective C). +AC_PROG_OBJC([gobjc gcc objcc objc cc CC clang]) AM_GNU_GETTEXT([external]) AM_GNU_GETTEXT_VERSION([0.22]) diff --git a/gettext-tools/tests/init-env.in b/gettext-tools/tests/init-env.in index cc84ffd39..096838848 100644 --- a/gettext-tools/tests/init-env.in +++ b/gettext-tools/tests/init-env.in @@ -7,6 +7,8 @@ CC="@CC@" CFLAGS="@CFLAGS@" CXX="@CXX@" CXXFLAGS="@CXXFLAGS@" +OBJC="@OBJC@" +OBJCFLAGS="@OBJCFLAGS@" CPPFLAGS="@CPPFLAGS@" LDFLAGS="@LDFLAGS@" LTLIBINTL="@LTLIBINTL@" diff --git a/gettext-tools/tests/lang-objc b/gettext-tools/tests/lang-objc index 925a04c9d..938a0a6c9 100755 --- a/gettext-tools/tests/lang-objc +++ b/gettext-tools/tests/lang-objc @@ -19,7 +19,7 @@ int main () exit (0); } EOF -${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -o hello hello.m 2>/dev/null \ +${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS} -o hello hello.m 2>/dev/null \ || { echo "Skipping test: Objective C compiler not found" Exit 77 } @@ -58,15 +58,15 @@ int main (int argc, char *argv[]) } EOF -# Put the -I flags before ${CFLAGS} ${CPPFLAGS}, to make sure that libintl.h +# Put the -I flags before ${OBJCFLAGS} ${CPPFLAGS}, to make sure that libintl.h # is found in the build directory, regardless of -I options present in -# ${CFLAGS} or ${CPPFLAGS}. -${CC} -I../.. -I"$abs_top_srcdir"/gnulib-lib -I../../../gettext-runtime/intl ${CFLAGS} ${CPPFLAGS} -c prog.m \ +# ${OBJCFLAGS} or ${CPPFLAGS}. +${OBJC} -I../.. -I"$abs_top_srcdir"/gnulib-lib -I../../../gettext-runtime/intl ${OBJCFLAGS} ${CPPFLAGS} -c prog.m \ || Exit 1 : ${CONFIG_SHELL=${SHELL-/bin/sh}} ${CONFIG_SHELL} "$top_builddir"/libtool --quiet --tag=CC --mode=link \ - ${CC} ${CFLAGS} -o prog prog.${OBJEXT} ../../gnulib-lib/libgettextlib.la ${LDFLAGS} ${LTLIBINTL} \ + ${OBJC} ${OBJCFLAGS} -o prog prog.${OBJEXT} ../../gnulib-lib/libgettextlib.la ${LDFLAGS} ${LTLIBINTL} \ || Exit 1 : ${XGETTEXT=xgettext}