Skip to content

dblommesteijn/autotools-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Autotools Example

This repo contains a sample project with the Makefile.am and configure.ac files with content to construct a shared and static library for C++ (Linux and OSX).

Prerequisites

OSX:

brew install automake autoconf libtool

Installation

Clone repo

git clone [email protected]:dblommesteijn/autotools-example.git
cd autotools-example

Configuration

Constructing configuration and Makefiles

autoreconf -vfi
./configure

Compiling/ Linking

Compile and install the library to the OS defaults (/usr/local/lib and /usr/local/include)

sudo make install

Using Lib

Including the created library with your project.

NOTE: you have to install the library before headers can be found, and linking can be done

C++ code snippet

This example can be found in example/.

#include <toollib.h>
int main(int args, char** argv) {
	toollib("I'm using toollib!!");	
	return 0;
}

Compile with clang

Assuming the library is installed at the OS default location, otherwise you have to provide flags -I and -L accordingly.

clang++ -Wall -std=c++11 -O3 -fPIC -c main.cpp
clang++ main.o -o main -lautotools
./main

Removing Clutter

You have to become root to cleanup, because sudo make install generates src/.libs/*.

sudo sh cleanup.sh

Uninstalling Library

sudo make uninstall

About

Example how to use autoconf and automake

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published