[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Setup for a project with autotools so resulting executables can see requ

From: Jamil Egdemir
Subject: Setup for a project with autotools so resulting executables can see required binary files?
Date: Sat, 14 Mar 2015 12:10:39 -0400

Hi Everyone,

I'm using c to work on some code building against allegro and using
autotools to handle the build system.  Trouble is the code is trying
to pull in a bitmap and I'm not sure how to handle this properly when
using autotools. (My apologies in advance if this is more of a c
question or I'm posting on the wrong list here.)

The layout of my project:


The code in stargate.c pulls in the bitmap with:

    stargate = load_bitmap("stargate.bmp", NULL);

Contents of allegro-learning/

    AC_INIT([allegro-learning], [1.0], address@hidden)
    AM_INIT_AUTOMAKE([-Wall -Werror foreign])
    PKG_CHECK_MODULES([ALLEGRO], [allegro >= 4.2.3])

Contents of allegro-learning/

    SUBDIRS = src
    dist_doc_DATA = README

Contents of allegro-learning/src/

    bin_PROGRAMS = stargate

    stargate_SOURCES = stargate.c
    stargate_CFLAGS = $(ALLEGRO_CFLAGS) 
    stargate_LDFLAGS = $(ALLEGRO_LIBS) 

When I use autotools to build and install:

    # autoreconf --install
    # ./configure --prefix=$HOME/usr
    # make
    # make install

and run the resulting executable everything segfaults.  Cracking it
open with GDB shows the failure is on the line I've highlighted above
that pulls in stargate.bmp. 

However, when I just go to allegro-learning/src and just build
directly w/o using autotools:

    # cd allegro-learning/src
    # gcc `pkg-config allegro --cflags --libs` -o stargate stargate.c

everything works fine.  So I believe I haven't setup the project
properly with autotools to install the bitmaps.

What is the right way to do this?  

I have consulted the book 'Autotools' by John Calcote:

and it looks like installation of jars when using autotools with java
is a similar problem where you have .jar files that must also get
installed and be available for the executing code to see.  But his
example is embedded in a much larger project that is difficult for me to

I've also looked at 'Data files with Automake':

but I'm still unsure as to how I should modify my project.

Any specific guidance on how to handle situations like this would be
most appreciated.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]