aclocal/autoconf reports missing m4sugar.m4 on Mac OS X?
Asked Answered
I

5

6

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.)

Irade answered 17/5, 2011 at 16:22 Comment(0)
G
8

I got around this by creating a new symlink

sudo ln -s  /Developer/usr/share/autoconf /usr/share
Gaskins answered 4/5, 2012 at 1:58 Comment(0)
M
7

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
Mix answered 16/3, 2012 at 5:14 Comment(1)
Under xcode 6 and OSX 10.9.4 did not work but this post and previous posts gave valuable clues. What did work is: brew uninstall autoconf then brew install autoconf which gave a few instructions and then I have executed brew link --overwrite autoconf. Under OSX 10.9.4 there was no /Developer/usr/share/autoconf because it under /usr/local/Cellar/autoconfOutplay
S
3

I am not sure I understand what in your setup causes autom4te not to find the file. Did you move autom4te to the directory Xcode3.2/ after it was initially installed in /usr/bin/? It's not clear to me from your question (I'm not familiar with Xcode, is that bundled with autoconf?).

Anyway... The location where autom4te looks for m4sugar.m4 is hardcoded in autom4te when the Autoconf package is installed. In fact it is even more subtle: the search path is configured in DATADIR/autom4te.cfg, but the value of DATADIR is hardcoded into autom4te. You can change the value of DATADIR by setting an environment variable like export AC_MACRODIR=/Xcode3.2/usr/share/autoconf, but if you moved /usr/share/autoconf/autom4te.cfg to /Xcode3.2/usr/share/autoconf/autom4te.cfg, the contents of that file will still point to /usr/share/autoconf/.

You could have a local ~/.autom4te.cfg to add more --prepend-include lines, but this is crude as well. IMHO the simplest solution if you want Autoconf installed in Xcode3.2/ is to install it with ./configure --prefix /Xcode3.2 && make && make install. It takes less half a minute.

Siphonostele answered 17/5, 2011 at 19:13 Comment(2)
autom4te and m4 and all of these tools are installed along with Xcode when you install the Apple-provided developer tools on Mac OS X. This vs. installing all of them via fink or darwinports etc. You can elect to have them place helpful copies (perhaps links?) in /usr/whatever, but they all live in /Xcode3.2- or /Developer-prefixed paths instead. Thus, I am not responsible for the configuration of autoconf -- it is all Apple. It appears they need to be parameterizing their autom4te.cfg when they install it in a non-standard location (e.g., /Xcode3.2). Fixing that .cfg makes it work. Thanks!Irade
Suggestion bug to parameterize their autom4te.cfg paths has been filed as rdar://9454686.Irade
S
1

In the Xcode4 environment:

sudo ln -s /Xcode4/usr/share/autoconf /usr/share/autoconf
Sloop answered 4/7, 2012 at 21:59 Comment(0)
C
0

If you have used MacPorts for installing much, you probably have an installation of autoconf which will then add in autom4te and start messing with your paths. If, like me, you are moving from MacPorts then you'll need to uninstall autoconf ( sudo port uninstall autoconf ) before making edits like the ones suggested by Ergwun

Chiarra answered 29/8, 2017 at 8:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.