Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configure: Don't do AC_CHECK_FILE when cross compiling #2606

Closed
wants to merge 1 commit into from

Conversation

oreo639
Copy link

@oreo639 oreo639 commented Jan 25, 2024

AC_CHECK_FILE() is not available when cross compiling.

This removes AC_SUBST(X11_PREFIX) as it is currently unused, if you want me to add it back, I can, as that does work correctly when cross compiling.
This also does not handle the situation where both the build machine and target machine have X11/locale in different directories.

If you don't want this to be an option, replacing AC_CHECK_FILE() with test -f also works for checking for the X11/locale directory in the host environment.

There is also the issue that this doesn't handle environments where the build machine and the target machine have X11/locale in different directories. This isn't an issue in my case, and is something that can be worked around in the build environment, but let me know if that is an issue.

oreo639 added a commit to oreo639/ibus that referenced this pull request Jan 25, 2024
AC_CHECK_FILE() is not available when cross compiling.
This removes `AC_SUBST(X11_PREFIX)` as it is currently unused.

BUG=ibus#2606
oreo639 added a commit to oreo639/ibus that referenced this pull request Jan 25, 2024
AC_CHECK_FILE() is not available when cross compiling.
This removes AC_SUBST(X11_PREFIX) as it is currently unused.

BUG=ibus#2606
@fujiwarat
Copy link
Member

I'm thinking adding the patch one by one for the cross compiling is not good and your patch is a workaround and it's good to fix autoconf/automake to work AC_* macros with the cross compiling.

I'd ask you to report your issue to autoconf/automake upstream at first.

I think the following change would be good at the moment.

-AC_CHECK_FILE($X11_PREFIX/share/X11/locale/locale.dir,
-              X11_LOCALEDATADIR="$X11_PREFIX/share/X11/locale",
-              [AC_CHECK_FILE($X11_PREFIX/lib/X11/locale/locale.dir,
-                             X11_LOCALEDATADIR="$X11_PREFIX/lib/X11/locale",
-                             X11_LOCALEDATADIR="$(datadir)/X11/locale")])
+if test x"cross_compiling" != xyes; then
+    AC_CHECK_FILE($X11_PREFIX/share/X11/locale/locale.dir,
+                  X11_LOCALEDATADIR="$X11_PREFIX/share/X11/locale",
+                  [AC_CHECK_FILE($X11_PREFIX/lib/X11/locale/locale.dir,
+                                 X11_LOCALEDATADIR="$X11_PREFIX/lib/X11/locale",
+                                 X11_LOCALEDATADIR="$(datadir)/X11/locale")])
+fi

You can run env X11_LOCALEDATADIR=/usr/share/foo ./configure.

@oreo639
Copy link
Author

oreo639 commented Feb 16, 2024

I'd ask you to report your issue to autoconf/automake upstream at first.

AC_CHECK_FILE() not working when cross-compiling is intentional and it prints a message stating that it cannot be used when cross compiling, unless I am misunderstanding?

https://www.gnu.org/software/autoconf/manual/autoconf-2.67/html_node/Files.html

Be aware that, like most Autoconf macros, they test a feature of the host machine, and therefore, they die when cross-compiling.

I think the following change would be good at the moment.

I'll test that when I am available.

@fujiwarat
Copy link
Member

AC_CHECK_FILE() not working when cross-compiling is intentional and it prints a message stating that it cannot be used when cross compiling, unless I am misunderstanding?

I think there are several ideas to resolve your issue. E.g. Adding another argument of AC_CHECK_FILE and make the exception for cross-compiling likes my suggestion.

@oreo639 oreo639 changed the title configure: Allow manually overriding X11_LOCALEDATADIR configure: Don't do AC_CHECK_FILE when cross compiling Feb 17, 2024
@fujiwarat fujiwarat self-requested a review February 20, 2024 11:17
@fujiwarat fujiwarat added this to the 1.5.30 milestone Feb 20, 2024
@fujiwarat fujiwarat closed this Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants