Clean up spec file for packaging
[profile/ivi/pango.git] / acinclude.m4
1
2 # Checks the location of the XML Catalog
3 # Usage:
4 #   JH_PATH_XML_CATALOG([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
5 # Defines XMLCATALOG and XML_CATALOG_FILE substitutions
6 AC_DEFUN([JH_PATH_XML_CATALOG],
7 [
8   # check for the presence of the XML catalog
9   AC_ARG_WITH([xml-catalog],
10               AC_HELP_STRING([--with-xml-catalog=CATALOG],
11                              [path to xml catalog to use]),,
12               [with_xml_catalog=/etc/xml/catalog])
13   jh_found_xmlcatalog=true
14   XML_CATALOG_FILE="$with_xml_catalog"
15   AC_SUBST([XML_CATALOG_FILE])
16   AC_MSG_CHECKING([for XML catalog ($XML_CATALOG_FILE)])
17   if test -f "$XML_CATALOG_FILE"; then
18     AC_MSG_RESULT([found])
19   else
20     jh_found_xmlcatalog=false
21     AC_MSG_RESULT([not found])
22   fi
23
24   # check for the xmlcatalog program
25   AC_PATH_PROG(XMLCATALOG, xmlcatalog, no)
26   if test "x$XMLCATALOG" = xno; then
27     jh_found_xmlcatalog=false
28   fi
29
30   if $jh_found_xmlcatalog; then
31     ifelse([$1],,[:],[$1])
32   else
33     ifelse([$2],,[AC_MSG_ERROR([could not find XML catalog])],[$2])
34   fi
35 ])
36
37 # Checks if a particular URI appears in the XML catalog
38 # Usage:
39 #   JH_CHECK_XML_CATALOG(URI, [FRIENDLY-NAME], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
40 AC_DEFUN([JH_CHECK_XML_CATALOG],
41 [
42   AC_REQUIRE([JH_PATH_XML_CATALOG],[JH_PATH_XML_CATALOG(,[:])])dnl
43   AC_MSG_CHECKING([for ifelse([$2],,[$1],[$2]) in XML catalog])
44   if $jh_found_xmlcatalog && \
45      AC_RUN_LOG([$XMLCATALOG --noout "$XML_CATALOG_FILE" "$1" >&2]); then
46     AC_MSG_RESULT([found])
47     ifelse([$3],,,[$3
48 ])dnl
49   else
50     AC_MSG_RESULT([not found])
51     ifelse([$4],,
52        [AC_MSG_ERROR([could not find ifelse([$2],,[$1],[$2]) in XML catalog])],
53        [$4])
54   fi
55 ])
56
57
58 dnl REMOVE THIS WHEN introspection.m4 is widely available
59 dnl
60 dnl -*- mode: autoconf -*-
61 dnl Copyright 2009 Johan Dahlin
62 dnl
63 dnl This file is free software; the author(s) gives unlimited
64 dnl permission to copy and/or distribute it, with or without
65 dnl modifications, as long as this notice is preserved.
66 dnl
67
68 # serial 1
69
70 m4_define([_GOBJECT_INTROSPECTION_CHECK_INTERNAL],
71 [
72     AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first
73     AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
74     AC_BEFORE([LT_INIT],[$0])dnl setup libtool first
75
76     dnl enable/disable introspection
77     m4_if([$2], [require],
78     [dnl
79         enable_introspection=yes
80     ],[dnl
81         AC_ARG_ENABLE(introspection,
82                   AS_HELP_STRING([--enable-introspection[=@<:@no/auto/yes@:>@]],
83                                  [Enable introspection for this build]),, 
84                                  [enable_introspection=auto])
85     ])dnl
86
87     AC_MSG_CHECKING([for gobject-introspection])
88
89     dnl presence/version checking
90     AS_CASE([$enable_introspection],
91     [no], [dnl
92         found_introspection="no (disabled, use --enable-introspection to enable)"
93     ],dnl
94     [yes],[dnl
95         PKG_CHECK_EXISTS([gobject-introspection-1.0],,
96                          AC_MSG_ERROR([gobject-introspection-1.0 is not installed]))
97         PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1],
98                          found_introspection=yes,
99                          AC_MSG_ERROR([You need to have gobject-introspection >= $1 installed to build AC_PACKAGE_NAME]))
100     ],dnl
101     [auto],[dnl
102         PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], found_introspection=yes, found_introspection=no)
103     ],dnl
104     [dnl        
105         AC_MSG_ERROR([invalid argument passed to --enable-introspection, should be one of @<:@no/auto/yes@:>@])
106     ])dnl
107
108     AC_MSG_RESULT([$found_introspection])
109
110     INTROSPECTION_SCANNER=
111     INTROSPECTION_COMPILER=
112     INTROSPECTION_GENERATE=
113     INTROSPECTION_GIRDIR=
114     INTROSPECTION_TYPELIBDIR=
115     if test "x$found_introspection" = "xyes"; then
116        INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
117        INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
118        INTROSPECTION_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0`
119        INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0`
120        INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)"
121        INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0`
122        INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0`
123        INTROSPECTION_MAKEFILE=`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection
124     fi
125     AC_SUBST(INTROSPECTION_SCANNER)
126     AC_SUBST(INTROSPECTION_COMPILER)
127     AC_SUBST(INTROSPECTION_GENERATE)
128     AC_SUBST(INTROSPECTION_GIRDIR)
129     AC_SUBST(INTROSPECTION_TYPELIBDIR)
130     AC_SUBST(INTROSPECTION_CFLAGS)
131     AC_SUBST(INTROSPECTION_LIBS)
132     AC_SUBST(INTROSPECTION_MAKEFILE)
133
134     AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$found_introspection" = "xyes")
135 ])
136
137
138 dnl Usage:
139 dnl   GOBJECT_INTROSPECTION_CHECK([minimum-g-i-version])
140
141 AC_DEFUN([GOBJECT_INTROSPECTION_CHECK],
142 [
143   _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1])
144 ])
145
146 dnl Usage:
147 dnl   GOBJECT_INTROSPECTION_REQUIRE([minimum-g-i-version])
148
149
150 AC_DEFUN([GOBJECT_INTROSPECTION_REQUIRE],
151 [
152   _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1], [require])
153 ])