~guijemont/paf/api-fixing

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
AC_PREREQ(2.53)

dnl *** PAF package ***

dnl When going to/from release please set the nano (4th number) right!
dnl Releases only do -Wall, bzr and prerelease does -Werror too.
AC_INIT([PAF Animation Framework], [0.0.0.1],
        [guillaume@fluendo.com],
        [paf])

AC_CONFIG_SRCDIR([paf/paf.c])
AC_CONFIG_AUX_DIR([build-aux])
AM_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE([1.7 dist-bzip2])
AS_VERSION
AS_NANO(PAF_DEV="no", PAF_DEV="yes")
AM_MAINTAINER_MODE
AC_GNU_SOURCE

dnl *** Versioning ***

PAF_MAJORMINOR=$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR
AC_SUBST(PAF_MAJORMINOR)
AC_DEFINE_UNQUOTED(PAF_MAJORMINOR, "PAF_MAJORMINOR",
                   [library major.minor version])

dnl CURRENT, REVISION, AGE
dnl - library source changed -> increment REVISION
dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0
dnl - interfaces added -> increment AGE
dnl - interfaces removed -> AGE = 0
PAF_LT_CURRENT=0
PAF_LT_REV=0
PAF_LT_AGE=0
PAF_LT_VERSION="$PAF_LT_CURRENT:$PAF_LT_REV:$PAF_LT_AGE"
PAF_LT_LDFLAGS="-version-info $PAF_LT_VERSION"
AC_SUBST(PAF_LT_VERSION)
AC_SUBST(PAF_LT_LDFLAGS)

dnl *** Checks for arguments to configure ***

AG_GST_ARG_PROFILING
AG_GST_ARG_VALGRIND
AG_GST_ARG_GCOV
AG_GST_ARG_EXAMPLES

dnl define an ERROR_CFLAGS Makefile variable
AG_GST_SET_ERROR_CFLAGS($PAF_DEV)

dnl *** Checks for typedefs, structures, functions and programs ***

AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_LIBTOOL
AC_C_CONST
AC_C_INLINE

AC_PATH_PROG(VALGRIND_PATH, valgrind, no)
AM_CONDITIONAL(HAVE_VALGRIND, test ! "x$VALGRIND_PATH" = "xno")

AC_PATH_PROG(GNUPLOT_PATH, gnuplot, no)
AM_CONDITIONAL(HAVE_GNUPLOT, test ! "x$GNUPLOT_PATH" = "xno")
AC_SUBST(GNUPLOT_PATH)

dnl *** Versions of package requirements ***

AC_SUBST(glib_req, 2.8.0)

dnl *** Core library checks ***

GTK_DOC_CHECK([1.3])

PKG_CHECK_MODULES(GLIB, glib-2.0 >= $glib_req)
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)

PKG_CHECK_MODULES(GOBJECT, gobject-2.0 >= $glib_req)
AC_SUBST(GOBJECT_CFLAGS)
AC_SUBST(GOBJECT_LIBS)

dnl *** checks for doc generation ***

dnl Perl is used in building documentation
AC_PATH_PROG(PERL_PATH, perl, no)
if test x$PERL_PATH = xno -a x${enable_gtk_doc} = xyes; then
  AC_MSG_ERROR(Could not find Perl which is needed for doc generation)
fi

if test x$USE_MAINTAINER_MODE = xyes \
	-a x$GNUPLOT_PATH = xno \
	-a x${enable_gtk_doc} = xyes; then
  AC_MSG_ERROR(You need gnuplot to generate documentation in maintainer mode)
fi

dnl *** checks for unit tests ***

AC_CHECK_HEADERS(CUnit/CUnit.h, [HAVE_CUNIT=yes], [HAVE_CUNIT=no])
AC_CHECK_LIB(cunit, CU_get_error_msg, [HAVE_CUNIT=$HAVE_CUNIT], [HAVE_CUNIT=no])
AC_SUBST(HAVE_CUNIT)
if test x$HAVE_CUNIT = xyes; then
	CUNIT_LIBS="-lcunit"
fi
AC_SUBST(CUNIT_LIBS)
AM_CONDITIONAL(HAVE_CUNIT, test "x$HAVE_CUNIT" = "xyes")

dnl *** Finalize CFLAGS, LDFLAGS, LIBS ***

dnl Overview:
dnl PAF_OPTION_CFLAGS:  common cflags for profiling, debugging, errors, ...
dnl PAF_ALL_*:          vars shared by all built objects
dnl PAF_LIB_LDFLAGS:    additional linker flags for all libaries
dnl PAF_OBJ_*:          additional vars to link to the core (include PAF_ALL_*)
dnl PAF_LT_LDFLAGS:     library versioning of our libraries

if test "x$USE_DEBUG" = xyes; then
  PROFILE_CFLAGS="-g"
fi
AC_SUBST(PROFILE_CFLAGS)

dnl Every flag in PAF_OPTION_CFLAGS can be overridden at make time via e.g.
dnl make PROFILE_CFLAGS=''.
PAF_OPTION_CFLAGS="\$(ERROR_CFLAGS) \$(DEBUG_CFLAGS) \$(PROFILE_CFLAGS) \$(GCOV_CFLAGS)"
AC_SUBST(PAF_OPTION_CFLAGS)

PAF_ALL_CFLAGS="-I\$(top_srcdir) -I\$(top_builddir)/paf \$(PAF_OPTION_CFLAGS) \$(GLIB_CFLAGS) \$(GOBJECT_CFLAGS)"
PAF_ALL_LIBS="\$(GLIB_LIBS) \$(GOBJECT_LIBS) \$(GCOV_LIBS)"
PAF_ALL_LDFLAGS="-no-undefined"
AC_SUBST(PAF_ALL_CFLAGS)
AC_SUBST(PAF_ALL_LIBS)
AC_SUBST(PAF_ALL_LDFLAGS)

dnl LDFLAGS modifier defining exported symbols from built libraries
PAF_LIB_LDFLAGS="-export-symbols-regex \^[_]*\(paf_\|Paf\|PAF_\).*"
AC_SUBST(PAF_LIB_LDFLAGS)

PAF_OBJ_CFLAGS="\$(PAF_ALL_CFLAGS)"
PAF_OBJ_LIBS="\$(top_builddir)/paf/libpaf-$PAF_MAJORMINOR.la \$(PAF_ALL_LIBS)"
AC_SUBST(PAF_OBJ_CFLAGS)
AC_SUBST(PAF_OBJ_LIBS)

dnl *** Configuration files ***

AC_CONFIG_FILES(
  Makefile
  paf.spec
  paf/Makefile
  paf/pafversion.h
  tests/Makefile
  tests/unit/Makefile
  docs/Makefile
  docs/paf/Makefile
  docs/paf/version-short.xml
  docs/paf/version-full.xml
  docs/paf/images/Makefile
  pkgconfig/Makefile
  pkgconfig/paf.pc
  pkgconfig/paf-uninstalled.pc
)
AC_OUTPUT

dnl *** Configuration summary ***

echo ""
echo "  PAF Animation Framework $PACKAGE_VERSION"
echo "  ==============="
echo "  Prefix:           ${prefix}"
echo "  Documentation:    ${enable_gtk_doc}"
echo "  Tests available:  ${HAVE_CUNIT}"