~ubuntu-branches/ubuntu/karmic/regexxer/karmic

« back to all changes in this revision

Viewing changes to macros/pcre.m4

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-02-19 11:28:21 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20070219112821-3w5j8kdhwiar1uoh
Tags: 0.9-0ubuntu1
* New upstream release:
  - Command line option support
  - Icon theme support
  - Now builds a working executable on systems with newer libglade
  - New GTK+ file chooser button
  - Replaced about dialog with stock GTK+ one
  - Completely revamped build system
  - Lots of new translations: bg ca dz es eu fi fr hu ne pa pl sl sr 
    sr@Latn uk vi zh_CN zh_HK zh_TW
  - Other minor cleanups and fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
## $Id: pcre.m4,v 1.15 2004/05/30 03:56:14 daniel Exp $
2
 
##
3
 
## Copyright (c) 2002  Daniel Elstner  <daniel.elstner@gmx.net>
4
 
##
5
 
## This program is free software; you can redistribute it and/or modify
6
 
## it under the terms of the GNU General Public License VERSION 2 as
7
 
## published by the Free Software Foundation.  You are not allowed to
8
 
## use any other version of the license; unless you got the explicit
9
 
## permission from the author to do so.
10
 
##
11
 
## This program is distributed in the hope that it will be useful,
12
 
## but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 
## GNU General Public License for more details.
15
 
##
16
 
## You should have received a copy of the GNU General Public License
17
 
## along with this program; if not, write to the Free Software
18
 
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
 
 
20
 
 
21
 
## PCRE_CHECK_VERSION(min_version)
22
 
##
23
 
## Run pcre-config to determine the libpcre version number and
24
 
## bail out if it is insufficient.  Also retrieve the necessary
25
 
## compiler flags and store them in PCRE_CFLAGS rpt. PCRE_LIBS.
26
 
##
27
 
AC_DEFUN([PCRE_CHECK_VERSION],
28
 
[
29
 
m4_if([$1],, [AC_FATAL([argument required])])
30
 
 
31
 
AC_ARG_VAR([PCRE_CONFIG], [path to pcre-config script])
32
 
AC_PATH_PROG([PCRE_CONFIG], [pcre-config])
33
 
 
34
 
AS_IF([test "x$PCRE_CONFIG" = x],
35
 
[
36
 
AC_MSG_FAILURE([[
37
 
*** pcre-config is missing.  Please install your distribution's
38
 
*** libpcre development package and then try again.
39
 
]])
40
 
])
41
 
 
42
 
AC_MSG_CHECKING([[for libpcre >= ]$1])
43
 
 
44
 
pcre_version_string=`$PCRE_CONFIG --version 2>&5`
45
 
 
46
 
d='@<:@0123456789@:>@'
47
 
pcre_transform='s/^\('$d$d'*\)\.\('$d$d'*\)\.*\('$d'*\).*$/\1 \\* 1000000 + \2 \\* 1000 + 0\3/p'
48
 
pcre_required=`echo "$1" | sed -n "$pcre_transform" 2>&5`
49
 
pcre_version=`echo "$pcre_version_string" | sed -n "$pcre_transform" 2>&5`
50
 
 
51
 
AS_IF([eval "expr $pcre_version \\>= $pcre_required" >/dev/null 2>&5],
52
 
      [pcre_version_ok=yes],
53
 
      [pcre_version_ok=no])
54
 
 
55
 
AC_MSG_RESULT([${pcre_version_ok}])
56
 
 
57
 
AS_IF([test "x$pcre_version_ok" = xno],
58
 
[
59
 
AC_MSG_FAILURE([[
60
 
*** libpcre ]$1[ or higher is required, but you only have
61
 
*** version $pcre_version_string installed.  Please upgrade and try again.
62
 
]])
63
 
])
64
 
 
65
 
AC_MSG_CHECKING([[PCRE_CFLAGS]])
66
 
PCRE_CFLAGS=`$PCRE_CONFIG --cflags | sed 's,-I/usr/include$,,;s,-I/usr/include ,,g' 2>&5`
67
 
AC_MSG_RESULT([${PCRE_CFLAGS}])
68
 
AC_SUBST([PCRE_CFLAGS])
69
 
 
70
 
AC_MSG_CHECKING([[PCRE_LIBS]])
71
 
PCRE_LIBS=`$PCRE_CONFIG --libs | sed 's,-L/usr/lib$,,;s,-L/usr/lib ,,g' 2>&5`
72
 
AC_MSG_RESULT([${PCRE_LIBS}])
73
 
AC_SUBST([PCRE_LIBS])
74
 
])
75
 
 
76
 
 
77
 
## PCRE_CHECK_UTF8()
78
 
##
79
 
## Run a test program to determine whether PCRE was compiled with
80
 
## UTF-8 support.  If it wasn't, bail out with an error message.
81
 
##
82
 
AC_DEFUN([PCRE_CHECK_UTF8],
83
 
[
84
 
AC_REQUIRE([PCRE_CHECK_VERSION])
85
 
 
86
 
AC_CACHE_CHECK(
87
 
  [whether libpcre was compiled with UTF-8 support],
88
 
  [pcre_cv_has_utf8_support],
89
 
[
90
 
  AC_LANG_PUSH([C])
91
 
  pcre_saved_CPPFLAGS=$CPPFLAGS
92
 
  pcre_saved_LIBS=$LIBS
93
 
  CPPFLAGS="$CPPFLAGS $PCRE_CFLAGS"
94
 
  LIBS="$LIBS $PCRE_LIBS"
95
 
 
96
 
  AC_RUN_IFELSE(
97
 
  [
98
 
    AC_LANG_PROGRAM(
99
 
    [[
100
 
      #include <stdio.h>
101
 
      #include <stdlib.h>
102
 
      #include <pcre.h>
103
 
    ]],[[
104
 
      const char* errmessage = NULL;
105
 
      int erroffset = 0;
106
 
 
107
 
      if (pcre_compile(".", PCRE_UTF8, &errmessage, &erroffset, NULL))
108
 
        exit(0);
109
 
 
110
 
      fprintf(stderr, "%s\n", errmessage);
111
 
      exit(1);
112
 
    ]])
113
 
  ],
114
 
    [pcre_cv_has_utf8_support=yes],
115
 
    [pcre_cv_has_utf8_support=no],
116
 
    [pcre_cv_has_utf8_support="cross compile: assuming yes"])
117
 
 
118
 
  CPPFLAGS=$pcre_saved_CPPFLAGS
119
 
  LIBS=$pcre_saved_LIBS
120
 
  AC_LANG_POP([C])
121
 
])
122
 
 
123
 
AS_IF([test "x$pcre_cv_has_utf8_support" = xno],
124
 
[
125
 
AC_MSG_FAILURE([[
126
 
*** Sorry, the PCRE library installed on your system doesn't support
127
 
*** UTF-8 encoding.  Please install a libpcre package which includes
128
 
*** support for UTF-8.  Note that if you compile libpcre from source
129
 
*** you have to pass the --enable-utf8 flag to its ./configure script.
130
 
]])
131
 
])
132
 
])
133