lundi 20 juillet 2015

Install C++ program with automake and autoconf

I've made a program in C++, but now I must install this program with autoconf and automake.

So, when I run command "./configure && make && make install", it must do the following:

  • compile program
  • create folder my_program inside /opt (example: /opt/my_program/) and in this folder I must also have all static libraries and source files
  • There must be symbolic link in /usr/local/bin for my_program
  • Libraries must be in /usr/local/lib
  • Header files of my_program must be in /usr/local/include

I've wrote this configure.ac script:

#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.69])
AC_INIT([my_program], [0.1], [my_mail])
AC_CONFIG_SRCDIR([AbsAlgorithm.hpp])
AM_INIT_AUTOMAKE

# Checks for programs.
AC_PROG_CXX
AC_PROG_CC

# Checks for libraries.

# Checks for header files.
AC_CHECK_HEADERS([stdlib.h string.h sys/time.h unistd.h wchar.h wctype.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_CHECK_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_SIZE_T

# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_MKTIME
AC_CHECK_FUNCS([gettimeofday memset mkdir])

LIBS="-ldl"

AC_CONFIG_FILES([Makefile])
AC_OUTPUT

and this Makefile.am script:

AUTOMAKE_OPTIONS = foreign

AM_CXXFLAGS=-Wall -std=gnu++11 -DVERSION=\"$(VERSION)\" -DPROG="\"$(PACKAGE)\""

bin_PROGRAMS = my_program
include_HEADERS = Timer.hpp TestSetIterator.hpp TestCase.hpp ETestSet.hpp EParameter.hpp Entity.hpp ParameterSet.hpp AbsAlgorithm.hpp Log.hpp JSON.hpp
algatorc_SOURCES = ParameterSet.cpp TestCase.cpp EParameter.cpp ETestSet.cpp TestSetIterator.cpp Entity.cpp Timer.cpp  main.cpp JSON.cpp JSONValue.cpp

Now, when I run "./configure && make && make install" I don't get new folder called my_program in /opt. But, I now, I do have header files in /usr/local/include. I don't have lib files in /usr/local/lib. There is just one folder for python. I would like to have folder called my_program and inside that folder I would like to have static libs.

I am using Ubuntu 12.04 x64

I would appreciate any help. Thanks

Aucun commentaire:

Enregistrer un commentaire