Commit 809137b02200dfffa3a7f65e68a3ebba831ce1bd

Authored by knodlseder
1 parent ec1b7b1c

use pkg-config information to detect GammaLib

Makefile.am
1   -## Process this file with automake to produce Makefile.in
2   -ACLOCAL_AMFLAGS = -I m4
3   -
4   -SUBDIRS = src
  1 +SUBDIRS = . src
5 2  
  3 +CLEANFILES =
6 4 EXTRA_DIST = autogen.sh
  5 +INCLUDES =
  6 +
... ...
autogen.sh
1 1 #!/bin/sh
2   -
3   -autoreconf --force --install --symlink \
4   -&& aclocal -I m4 \
5   -&& automake --add-missing \
6   -&& autoconf
7   -
  2 +autoreconf --force --install
  3 +#autoreconf --force --install --symlink \
  4 +#&& aclocal \
  5 +#&& automake \
  6 +#&& autoconf
8 7  
... ...
configure.ac
1   -dnl =============================================================
2   -dnl Process this file with autoconf to produce a configure script
3   -dnl =============================================================
4   -AC_INIT([CTATools], [0.1], [knodlseder@cesr.fr])
5   -AC_CONFIG_SRCDIR(src/Makefile.am)
6   -AC_CONFIG_MACRO_DIR([m4])
  1 +# Process this file with autoconf to produce a configure script.
7 2  
8   -AM_INIT_AUTOMAKE([gnu no-dependencies])
9   -AM_CONFIG_HEADER([config.h])
10   -AM_MAINTAINER_MODE
  3 +AC_PREREQ([2.64])
  4 +AC_INIT([ctatools], [0.1.0], [knodlseder@cesr.fr])
  5 +AC_CONFIG_SRCDIR([src/ctselect/ctselect.cpp])
  6 +AC_CONFIG_HEADERS([config.h])
  7 +AM_INIT_AUTOMAKE
11 8  
12   -
13   -dnl ===========================
14   -dnl things required by automake
15   -dnl ===========================
16   -dnl AC_ARG_PROGRAM
17   -AC_PROG_MAKE_SET
18   -
19   -
20   -dnl ======================
21   -dnl Check for which system
22   -dnl ======================
23   -dnl AC_CANONICAL_HOST
24   -
25   -
26   -dnl ===================
27   -dnl Checks for programs
28   -dnl ===================
  9 +# Checks for programs.
29 10 AC_PROG_CXX
30 11 AC_PROG_INSTALL
31   -dnl AC_PROG_RANLIB
32   -AC_PROG_LIBTOOL
33   -
34   -
35   -dnl =======================
36   -dnl Check compiler features
37   -dnl =======================
38   -dnl AC_TYPE_SIZE_T
39   -dnl AC_C_CONST
40   -dnl AC_C_VOLATILE
41   -dnl AC_C_INLINE
42   -
43   -
44   -dnl =======================
45   -dnl Checks for header files
46   -dnl =======================
47   -
48   -
49   -dnl =============================================================
50   -dnl Checks for typedefs, structures, and compiler characteristics
51   -dnl =============================================================
52   -
53   -
54   -dnl ============================
55   -dnl Checks for library functions
56   -dnl ============================
57   -
58   -
59   -dnl ===================
60   -dnl Checks for gammalib
61   -dnl ===================
62   -AC_SEARCH_LIBS(str, gammalib,
63   - AC_DEFINE([G_GAMMALIB], [1], [Define if gammalib is available]), ,[-lm])
64   -
65 12  
66   -dnl ======================================
67   -dnl Set list of output files to be creates
68   -dnl ======================================
69   -AC_OUTPUT([Makefile
70   - src/Makefile
71   - src/ctselect/Makefile])
  13 +# Checks for libraries.
  14 +if test "x$prefix" = xNONE; then
  15 + export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig"
  16 +else
  17 + export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$prefix/lib/pkgconfig"
  18 +fi
  19 +PKG_CHECK_MODULES(GammaLib, gammalib >= 0.0,,
  20 +AC_MSG_ERROR(
  21 +[GammaLib library not found. Consider adjusting the PKG_CONFIG_PATH
  22 +environment variable if you installed GammaLib in a non-standard prefix.]))
  23 +CFLAGS="$CFLAGS $GammaLib_CFLAGS"
  24 +CPPFLAGS="$CPPFLAGS $GammaLib_CFLAGS"
  25 +LDFLAGS="$LDFLAGS $GammaLib_LIBS"
  26 +
  27 +# Checks for header files.
  28 +
  29 +# Checks for typedefs, structures, and compiler characteristics.
  30 +
  31 +# Checks for library functions.
  32 +
  33 +AC_CONFIG_FILES([Makefile
  34 + src/Makefile
  35 + src/ctselect/Makefile])
  36 +AC_OUTPUT
... ...
src/ctselect/Makefile.am
... ... @@ -8,7 +8,9 @@ INCLUDES = -I$(top_srcdir)/include \
8 8 -I$(top_builddir)/src \
9 9 -I$(top_srcdir)/src
10 10  
11   -PROGRAMS = ctselect
  11 +bin_PROGRAMS = ctselect
12 12  
13 13 ctselect_SOURCES = ctselect.cpp
14   -ctselect_LDADD = libgamma.la
  14 +#ctselect_LDADD = libgamma.la
  15 +ctselect_LDFLAGS = @LDFLAGS@
  16 +ctselect_CPPFLAGS = @CPPFLAGS@
... ...