I'm trying to compile a program which requires gettext (for intltools) on macOS. I tried the following commands to run the configure script:LDFLAGS=-L/usr/local/opt/gettext/lib CPPFLAGS=-I/usr/local/opt/gettext/include ./configureLDFLAGS=/usr/local/opt/gettext/lib CPPFLAGS=/usr/local/opt/gettext/include ./configureIn the first case it failed with the following error messageconfigure: error: GNU gettext tools not found; required for intltoolIn the latter case it couldn't find the C compilerWhat's the right way to solve this kind of problem?I understand that this is probably related to this
Using gettext in configure
osx;compiling;homebrew
The configure script fails because it can't find the gettext tools in the current $PATH.  These tools include xgettext, msgfmt and other binaries.On macOS with Homebrew, the gettext Homebrew package does actually install these binaries, but they are located in the /usr/local/Cellar/gettext/0.18.1.1/bin directory rather than directly in /usr/local/bin.The reason for this is that Homebrew installs all keggs in the cellar, and gettext is a keg package.If everything is working as intended, your gettext tools should already be symbolically linked from the Cellar directory to /usr/local/bin, and if your Homebrew setup is correct, /usr/local/bin should be in your $PATH.Obviously, this is not set up properly, so I'd suggest making sure that your $PATH is correctly set up with /usr/local/bin before /usr/bin and that the links for the gettext tools exists from the cellar to the /usr/local/bin directory.  Fixing one or both of those things will resolve this issue for you.Update:  According to this SuperUser answer, symbolic links to the gettext tools may not be set up properly by default.  The following command will fix it:$ brew link gettext --forceOnce you have compiled your other application, you may undo the above with$ brew unlink gettext... if you wish.This other answer on StackOverflow goes on to explain that executables of Homebrew packages that are keg-only (gettext is one of those) are not linked from the cellar to /usr/local/bin.  This is by design. This explains why the brew link step will be necessary to get your configure script working properly.The reason keg-only binaries are not put in you $PATH by default is that they may interfere with similarly named tools already present in the macOS base system.