ax_check_pcre2

Synopsis

AX_CHECK_PCRE2([bits], [action-if-found], [action-if-not-found])

Description

Search for an installed libpcre2-8 library. If nothing was specified when calling configure, it searches first in /usr/local and then in /usr, /opt/local and /sw. If the –with-pcre2=DIR is specified, it will try to find it in DIR/include/pcre2.h and DIR/lib/libpcre2-8. If –without-pcre2 is specified, the library is not searched at all.

If ’bits’ is empty or ’8’, PCRE2 8-bit character support is checked only. If ’bits’ contains ’16’, PCRE2 8-bit and 16-bit character support are checked. If ’bits’ contains ’32’, PCRE2 8-bit and 32-bit character support are checked. When ’bits’ contains both ’16’ and ’32’, PCRE2 8-bit, 16-bit, and 32-bit character support is checked.

If either the header file (pcre2.h), or the library (libpcre2-8) is not found, or the specified PCRE2 character bit width is not supported, shell commands ’action-if-not-found’ is run. If ’action-if-not-found’ is not specified, the configuration exits on error, asking for a valid PCRE2 installation directory or –without-pcre2.

If both header file and library are found, and the specified PCRE2 bit widths are supported, shell commands ’action-if-found’ is run. If ’action-if-found’ is not specified, the default action appends ’-I${PCRE2_HOME}/include’ to CPFLAGS, appends ’-L$PCRE2_HOME}/lib’ to LDFLAGS, prepends ’-lpcre2-8’ to LIBS, and calls AC_DEFINE(HAVE_PCRE2). You should use autoheader to include a definition for this symbol in a config.h file. Sample usage in a C/C++ source is as follows:

  #ifdef HAVE_PCRE2
  #define PCRE2_CODE_UNIT_WIDTH 8
  #include <pcre2.h>
  #endif /* HAVE_PCRE2 */

Source Code

Download the latest version of ax_check_pcre2.m4 or browse the macro’s revision history.

License

Copyright © 2020 Robert van Engelen 

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

As a special exception, the respective Autoconf Macro’s copyright owner gives unlimited permission to copy, distribute and modify the configure scripts that are the output of Autoconf when processing the Macro. You need not follow the terms of the GNU General Public License when using or distributing such scripts, even though portions of the text of the Macro appear in them. The GNU General Public License (GPL) does govern all other use of the material that constitutes the Autoconf Macro.

This special exception to the GPL applies to versions of the Autoconf Macro released by the Autoconf Archive. When you make and distribute a modified version of the Autoconf Macro, you may extend this special exception to the GPL to apply to your modified version as well.