Skip to content

Use pkg-config first, then icu-config if it fails. #339

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

Closed
wants to merge 2 commits into from
Closed

Use pkg-config first, then icu-config if it fails. #339

wants to merge 2 commits into from

Conversation

fpoirotte
Copy link

When trying to determine cflags & libs related to ICU, first use pkg-config
and only use icu-config if this fails.

On distributions were a multiarch libicu-dev package is available, this makes
it possible to build both a 32 bit & 64 bit version of PHP with --enable-intl
without the need for chroots.

Note: for now, Debian does not provide such a package (for more information,
see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=699763).

fpoirotte added 2 commits May 6, 2013 16:15
When trying to determine cflags & libs related to ICU, first use pkg-config
and only use icu-config if this fails.

On distributions were a multiarch libicu-dev package is available, this makes
it possible to build both a 32 bit & 64 bit version of PHP with --enable-intl
without the need for chroots.

Note: for now, Debian does not provide such a package (for more information,
see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=699763).

dnl Check ICU version
dnl If pkg-config is found try using it
if test "$PHP_ICU_DIR" = "DEFAULT" && test -x "$PKG_CONFIG" && $PKG_CONFIG --exists icu-io; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the package name is icu-io? Is it a standard name? Should any other alternatives be tried?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smalyshev: icu-io is the name of the most specific ICU library that the intl extension links to (see also line 2244 below in the old code).
As such, I don't think it's necessary to look for alternatives here.
The name is standard and comes directly from the ICU project (see http://userguide.icu-project.org/howtouseicu#TOC-pkg-config)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just check on my linux (Centos):

pkg-config --modversion icu
4.2.1
pkg-config --modversion icu-io
Package icu-io was not found in the pkg-config search path.
Perhaps you should add the directory containing `icu-io.pc'
to the PKG_CONFIG_PATH environment variable
No package 'icu-io' found

Not sure it is going to work. Also --exists returns true for icu, false for icu-io.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @smalyshev, sorry I didn't answer earlier, I've been busy with work.

RedHat created its own icu.pc (which contains the same data as if icu-uc.pc and icu-i18n.pc were combined together).
There was a discussion some time ago in the ICU project to create a file named icu.pc for compatibility with RH, but this was rejected since Fedora/RH later decided to drop that file and use the regular .pc files provided by ICU.

See also https://bugzilla.redhat.com/show_bug.cgi?id=460168 and http://bugs.icu-project.org/trac/ticket/9478 for details.

Anyway, even on RH/CentOS, PHP should still continue to build since the code falls back to the old behaviour (using icu-config) in case icu-io.pc cannot be found.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked libicu-devel-50.1.2-5 from Fedora 19 and libicu-dev 4.8.1.1-12 from Debian 7 and both have icu-uc.pc

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So maybe check both icu-io and icu packages? Having both of them with different versions is unlikely.

@kaplanlior
Copy link
Contributor

Probably check for the first and than the other.
I agree that having different version of them is unlikely.

@php-pulls
Copy link

Comment on behalf of krakjoe at php.net:

Since we have been waiting for more than a year for this PR to be completed, I'm closing this PR.

If anyone is watching, please take this action as encouragement to open a clean PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants