Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4060356
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:19:39+00:00 2026-05-20T15:19:39+00:00

I am running Linux, Ubuntu 10.04 . It is not the first time I

  • 0

I am running Linux, Ubuntu 10.04 .

It is not the first time I try to use autotools. I did a lot of researches and follow a lot of tutorials : here is what I want to do, what I tried and what issue I am facing.

Goal :

  • compile (and then cross-compile, but this will be an other job) my own library coded in C using libtool, autoconf and automake

What I tried and where I am :

  • The library name is FXPLib, the package name is libfxplib-0.1

  • My project folder is :

    Makefile.am (the only one)
    include
    include/fxplib.h (main header)
    include/FXPLib
    include/FXPLib/header1.h (these are public headers)
    include/FXPLib/header2.h
    include/FXPLib/...
    src
    src/sub1/file1.c
    src/sub2/file1.c
    src/sub3 ...
    
  • I ran autoscan, got a configure.ac, edited it as here :

    #                                               -*- Autoconf -*-
    # Process this file with autoconf to produce a configure script.
    
    AC_PREREQ([2.65])
    AC_INIT([libfxplib-0.1], [0.1], [<>])
    AC_CONFIG_SRCDIR([src/object_system/FXP_image_s.h])
    AC_CONFIG_HEADERS(config.h)
    
    AC_CONFIG_MACRO_DIR([m4])
    
    AM_INIT_AUTOMAKE
    AM_PROG_LIBTOOL
    
    LT_PREREQ([2.2])
    LT_INIT
    
    # Checks for programs.
    AC_PROG_CC
    AC_PROG_MAKE_SET
    
    # Checks for libraries.
    
    # Checks for header files.
    AC_CHECK_HEADERS([stdlib.h])
    
    # Checks for typedefs, structures, and compiler characteristics.
    AC_HEADER_STDBOOL
    
    # Checks for library functions.
    AC_FUNC_MALLOC
    AC_FUNC_REALLOC
    AC_CHECK_FUNCS([memset])
    
    AC_CONFIG_FILES([Makefile])
    AC_OUTPUT
    
  • I wrote Makefile.am like this :

    lib_LTLIBRARIES = libfxplib-0.1.la
    libfxplib_0_1_la_CFLAGS = -I$(srcdir)/include -I$(srcdir)/include/FXPLib `sdl-config --cflags --libs` -lSDL_image
    libfxplib_0_1_la_SOURCES = src/sub1/file1.c \
                               src/sub1/file2.c \
                               src/sub2/file1.h \
                               ...
    nobase_include_HEADERS = include/fxplib.h \
                             include/FXPLib/header1.h \
                             include/FXPLib/header2.h \
                             ...
    ACLOCAL_AMFLAGS = -I m4
    
  • Then I ran aclocal and autoheader to get files needed by automake
  • Then the most important : autoconf
  • And : automake –add-missing –copy

From there, everything is ok. But then I try to compile :

$ ./configure

Everything ok too…

$ make

and then I get :

...
src/graphics_engine/FXP_rendering.c:35:25: error: FXP_image_s.h: File not found
...

where :

  • “graphics_engine” is equivalent to src/sub
  • “FXP_rendering.c” to src/sub/file.c
  • “FXP_image_s.h” to src/sub2/header.h

This means : automake can compile .c files in a sub directory, but can’t include in these files a private .h file that is in an other sub directory.

My problem is : How to tell automake to compile every files in every subdirectories as if they were all in the same place ?

I hope I am understandable (and sorry for some problems you could find in my words, cause I am French)

Thank you by advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T15:19:39+00:00Added an answer on May 20, 2026 at 3:19 pm

    Your configure.ac and Makefile.am files look like you must have put a lot of effort into learning. Congratulations! One useful tip is that you can just run autoreconf instead of the whole chain of aclocal, autoheader, autoconf, automake, etc.

    The problem in this case is actually not the autotools, but the C compiler itself – you are executing the compiler in your project’s root directory to compile a file in src/sub, but since src/sub2 is neither the current directory nor in the include path, the compiler doesn’t know where to find it.

    Try adding -I$(srcdir)/src/sub2 to your libfxplib_0_1_la_CFLAGS line in Makefile.am. This will change the include path so as to instruct the compiler to look for header files in src/sub2, so you will have to add a similar instruction for every sub directory containing header files used in another directory.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.