glibtoolize on MacOS tells me to consider adding `-I m4' to ACLOCAL_AMFLAGS, but that produces an error

StackOverflow https://stackoverflow.com/questions/16657991

  •  30-05-2022
  •  | 
  •  

Question

I am trying to get libtool working on my MacOS 10.8.3 machine. Because everything Apple ships is out of date, I'm using macports. I have up-to-date versions:

libtool (GNU libtool) 2.4.2
automake (GNU automake) 1.13.1
autoconf (GNU Autoconf) 2.69

It's all installed in /opt.

Here is configure.ac:

AC_INIT([Hello], [0.1], [bug-report@hello.example.com], [hello], [http://hello.example.com/])
AC_PREREQ([2.59])
AM_INIT_AUTOMAKE([1.10 no-define])
LT_INIT
AC_CONFIG_HEADERS([config.h])
AC_PROG_CXX
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

Here is Makefile.am:

lib_LTLIBRARIES = libsomething-1.0.la
libsomething_1_0_la_SOURCES = something.cc


bin_PROGRAMS = hello
hello_SOURCES = hello.h hello.cc main.cc

Running glibtoolize produces this error:

glibtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and
glibtoolize: rerunning glibtoolize, to keep the correct libtool macros in-tree.
glibtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.

When I add this line to Makefile.am: ACLOCAL_AMFLAGS="-I m4" I get this error;

glibtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.

If I change it to this: ACLOCAL_AMFLAGS="-Im4"

I get the same error: glibtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.

The second error I get is:

 configure.ac:5: error: required file '../ltmain.sh' not found

How do I make these errors go away?

Was it helpful?

Solution

It needs to be:

ACLOCAL_AMFLAGS = -I m4

in Makefile.am and:

AC_CONFIG_MACRO_DIR([m4])

in configure.ac. You do have an m4 directory, at $(top_srcdir) right?

OTHER TIPS

Maybe I'm late to the part, the answer of @ldav1s is the solution, BUT I still had issues. After some Googling, I found this: https://pete.akeo.ie/2010/12/that-darn-libtoolize-acconfigmacrodirm4.html

So, ldav1's answer + this worked for me:

dos2unix Makefile.am

And now it works!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top