Search code examples
autotoolsobjective-c++

Objective C++ support in autotools


I'm working under Mac OS X 10.6.5 autoconf version 2.68 automake version 1.11.1 In a large project that is built using autoconf, automake, I need to add .mm files to the library sources. When I add them to the library_SOURCES variable they won't compile even after I use

AS_IF([test "$with_target" = "quartz"], [AC_PROG_OBJCXX])

in my configure.ac. The test is passed successfully and it event outputs

checking whether we are using the GNU Objective C++ compiler... yes

and .mm files don't compile. Where can I look to solve this problem?


Solution

  • I solved this problem with custom suffix rule:

    $ cat Makefile.am
    
    .mm.o :
      $(CXXCOMPILE) -x objective-c++ -с $< -o $@
    
    bin_PROGRAMS = foo
    foo_SOURCES = foo.mm bar.m baz.cpp
    

    BTW, if *.o from *.mm are placed in library, i failed to link target binary properly.