I have Xcode 3.2 installed into /Xcode3.2, and did not install anything into /Developer. When I wish to do development, I start up a shell as follows
alias sysroot='PATH=${PATH}:${XCODE}/usr/bin CFLAGS=--sysroot\ ${SDK_ROOT} CXXFLAGS=--sysroot\ ${SDK_ROOT} LDFLAGS=--sysroot\ ${SDK_ROOT} CPPFLAGS=--sysroot\ ${SDK_ROOT}'
where XCODE
is /Xcode3.2
and SDK_ROOT
is ${XCODE}/SDKs/MacOSX10.6.sdk
. This handles most of the oddities of trying to build projects. However, I recently ran into a case where I wanted to re-run aclocal
and got the following error:
autom4te: m4sugar/m4sugar.m4: no such file or directory
aclocal: /Xcode3.2/usr/bin/autom4te failed with exit status: 1
Specifying -I
flags to aclocal
to point at the alternative /Xcode3.2/usr/share/aclocal-1.10
and /Xcode3.2/usr/share/aclocal
doesn't seem to help. If I use --verbose
, and then re-run the m4
command it lists manually with an added -I
flag to point to /Xcode3.2/usr/share/autoconf
, then that works, but I cannot seem to pipe it through from aclocal
. In addition the M4PATH
environment variable that the man
pages for m4
suggest will let me add paths does not seem to make a difference. (And setting an environment variable would be my preferred setting, just so I could add it to the alias above.)
So far, I've not come up with a solution other than the "dirtying" procedure of creating a symlink from /usr/share/autoconf
to /Xcode3.2/usr/share/autoconf
. Is there another better way?
NOTE: The reason I keep such distinct lines between installs of the developer tools and the OS is to provide reliable cross-OS compilations (e.g., so that one Xcode version's tools don't perturb another Xcode version's build behavior.)
I got around this by creating a new symlink
sudo ln -s /Developer/usr/share/autoconf /usr/share
To clarify the fix as identified in adl's answer and Nathan's comment on it:
If you have autoconf
installed in the default location (under /Developer
) as part of XCode 4.3, you'll need to edit /Developer/usr/share/autoconf/autom4te.cfg
as it has various wrong paths set it in that don't include the /Developer
directory:
(The edits are illustrated as some kind of diff that I found in the Google cache of this post)
*** /Developer/usr/share/autoconf/autom4te.cfg 2011-10-28 00:15:15.000000000 -0700
--- /Developer/usr/share/autoconf/autom4te.cfg 2011-10-28 00:14:33.000000000 -0700
***************
*** 99,101 ****
begin-language: "Autoconf-without-aclocal-m4"
! args: --prepend-include /usr/share/autoconf
args: --cache=autom4te.cache
--- 99,101 ----
begin-language: "Autoconf-without-aclocal-m4"
! args: --prepend-include /Developer/usr/share/autoconf
args: --cache=autom4te.cache
***************
*** 126,128 ****
begin-language: "Autotest"
! args: --prepend-include /usr/share/autoconf
args: autotest/autotest.m4f
--- 126,128 ----
begin-language: "Autotest"
! args: --prepend-include /Developer/usr/share/autoconf
args: autotest/autotest.m4f
***************
*** 140,142 ****
begin-language: "M4sh"
! args: --prepend-include /usr/share/autoconf
args: m4sugar/m4sh.m4f
--- 140,142 ----
begin-language: "M4sh"
! args: --prepend-include /Developer/usr/share/autoconf
args: m4sugar/m4sh.m4f
***************
*** 152,154 ****
begin-language: "M4sugar"
! args: --prepend-include /usr/share/autoconf
args: m4sugar/m4sugar.m4f
--- 152,154 ----
begin-language: "M4sugar"
! args: --prepend-include /Developer/usr/share/autoconf
args: m4sugar/m4sugar.m4f
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With