Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Linux Tools Project » Some questions regarding using autotools
Some questions regarding using autotools [message #524515] Thu, 01 April 2010 08:36 Go to next message
Missing name Mising name is currently offline Missing name Mising nameFriend
Messages: 2
Registered: April 2010
Junior Member
Hi everyone,

I am now in the process of moving my project from kdevelop to eclipse. Reason being that I was not able to get some code to compile as a shared library within a project, and kdevelop being quite buggy.

I am using Ubuntu 9.10 as my development machine. What I have done is installed eclipse 3.5.1, CDT 6.0 and the latest version of linux tools.

I have created a GNU autotools project.
My directory structure is as follows:
src/
      myapp.c
      someothercfile.c
                  plugins/
                       myplugin/
                             myplugin.c


So far, when it compiles, I get the following result (I have changed the built path to be in "debug"):
debug/
      src/
            a.out


Firstly, where in the settings can I change so that myapp is compiled as myapp and not a.out?

Secondly, I would like to have myplugin.c compiled as myplugin.so. How do I do this?

Thirdly, I would like the filestructure of debug to be as follows

debug/
         myapp
         plugins/
               myplugin.so


How do I go about setting this?

Thank you Smile
Re: Some questions regarding using autotools [message #524702 is a reply to message #524515] Thu, 01 April 2010 21:14 Go to previous message
Jeff Johnston is currently offline Jeff JohnstonFriend
Messages: 215
Registered: July 2009
Senior Member
If you indeed have an autotools project, that means you should have a configuration script, (configure) generated from configure.in or configure.ac and an automake file (Makefile.am). You should end up with a generated Makefile in your build tree.

The Autotools plugin does not generate autotool files for you, though, when creating a new C or C++ GNU Autotools project, you can elect to create a sample ANSI Hello world project which includes autotool files for you to create a simple hello world executable with the name of the project. You can change this after-the-fact to replace the hello world source with your own code and just take advantage of the autotool files created.

If you are unfamiliar with autotools, I suggest you look at the online documentation you can find at:

http://www.gnu.org/software/autoconf/manual/autoconf.html
http://www.gnu.org/software/automake/manual/automake.html

To set up an executable with name myapp, there are multiple ways.

To do it via Makefile.am and have automake generate appropriate stuff in your Makefile, you can put:

bin_PROGRAMS = myapp
myapp_SOURCES = myapp.c

You can add additional sources to myapp_SOURCES if you need to.

When you run this through automake, you will get what you want. Automake will generate other targets for you such as info, install, etc...

Alternatively, you could just hard-code the Makefile targets in your Makefile.am:

all: myapp

myapp: myapp.o
gcc -o $@ $<

myapp.o: myapp.c
gcc -c $<

These will end up in your generated Makefile as-is.

A shared library should use libtool. In your Makefile.am, you might have:

mylibdir=[where_you_want_your_library_installed]
mylib_LTLIBRARIES=myplugin.la
myplugin_la_SOURCES=myplugin.c
myplugin_la_LDFLAGS= -lc -lgcc

for libtool, you must have AC_PROG_LIBTOOL in your configure.ac file.

Here is not a place to do a course on autotools or GNU make, so take a look at the documentation in conjunction with the examples above.
Previous Topic:Call R in Eclipse
Next Topic:Some questions regarding using autotools
Goto Forum:
  


Current Time: Tue Apr 16 21:51:15 GMT 2024

Powered by FUDForum. Page generated in 6.27851 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top