| | 884 | ##### http://autoconf-archive.cryp.to/ax_path_lib_pcre.html |
|---|
| | 885 | # |
|---|
| | 886 | # SYNOPSIS |
|---|
| | 887 | # |
|---|
| | 888 | # AX_PATH_LIB_PCRE [(A/NA)] |
|---|
| | 889 | # |
|---|
| | 890 | # DESCRIPTION |
|---|
| | 891 | # |
|---|
| | 892 | # check for pcre lib and set PCRE_LIBS and PCRE_CFLAGS accordingly. |
|---|
| | 893 | # |
|---|
| | 894 | # also provide --with-pcre option that may point to the $prefix of |
|---|
| | 895 | # the pcre installation - the macro will check $pcre/include and |
|---|
| | 896 | # $pcre/lib to contain the necessary files. |
|---|
| | 897 | # |
|---|
| | 898 | # the usual two ACTION-IF-FOUND / ACTION-IF-NOT-FOUND are supported |
|---|
| | 899 | # and they can take advantage of the LIBS/CFLAGS additions. |
|---|
| | 900 | # |
|---|
| | 901 | # LAST MODIFICATION |
|---|
| | 902 | # |
|---|
| | 903 | # 2006-10-13 |
|---|
| | 904 | # |
|---|
| | 905 | # COPYLEFT |
|---|
| | 906 | # |
|---|
| | 907 | # Copyright (c) 2006 Guido U. Draheim <guidod@gmx.de> |
|---|
| | 908 | # |
|---|
| | 909 | # This program is free software; you can redistribute it and/or |
|---|
| | 910 | # modify it under the terms of the GNU General Public License as |
|---|
| | 911 | # published by the Free Software Foundation; either version 2 of the |
|---|
| | 912 | # License, or (at your option) any later version. |
|---|
| | 913 | # |
|---|
| | 914 | # This program is distributed in the hope that it will be useful, but |
|---|
| | 915 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| | 916 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| | 917 | # General Public License for more details. |
|---|
| | 918 | # |
|---|
| | 919 | # You should have received a copy of the GNU General Public License |
|---|
| | 920 | # along with this program; if not, write to the Free Software |
|---|
| | 921 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
|---|
| | 922 | # 02111-1307, USA. |
|---|
| | 923 | # |
|---|
| | 924 | # As a special exception, the respective Autoconf Macro's copyright |
|---|
| | 925 | # owner gives unlimited permission to copy, distribute and modify the |
|---|
| | 926 | # configure scripts that are the output of Autoconf when processing |
|---|
| | 927 | # the Macro. You need not follow the terms of the GNU General Public |
|---|
| | 928 | # License when using or distributing such scripts, even though |
|---|
| | 929 | # portions of the text of the Macro appear in them. The GNU General |
|---|
| | 930 | # Public License (GPL) does govern all other use of the material that |
|---|
| | 931 | # constitutes the Autoconf Macro. |
|---|
| | 932 | # |
|---|
| | 933 | # This special exception to the GPL applies to versions of the |
|---|
| | 934 | # Autoconf Macro released by the Autoconf Macro Archive. When you |
|---|
| | 935 | # make and distribute a modified version of the Autoconf Macro, you |
|---|
| | 936 | # may extend this special exception to the GPL to apply to your |
|---|
| | 937 | # modified version as well. |
|---|
| | 938 | |
|---|
| | 939 | AC_DEFUN([AX_PATH_LIB_PCRE],[dnl |
|---|
| | 940 | AC_MSG_CHECKING([lib pcre]) |
|---|
| | 941 | AC_ARG_WITH(pcre, |
|---|
| | 942 | [ --with-pcre[[=prefix]] path to system pcre],, |
|---|
| | 943 | with_pcre="yes") |
|---|
| | 944 | if test ".$with_pcre" = ".no" ; then |
|---|
| | 945 | AC_MSG_RESULT([disabled]) |
|---|
| | 946 | m4_ifval($2,$2) |
|---|
| | 947 | else |
|---|
| | 948 | AC_MSG_RESULT([(testing)]) |
|---|
| | 949 | AC_CHECK_LIB(pcre, pcre_study) |
|---|
| | 950 | if test "$ac_cv_lib_pcre_pcre_study" = "yes" ; then |
|---|
| | 951 | PCRE_LIBS="-lpcre" |
|---|
| | 952 | AC_MSG_CHECKING([lib pcre]) |
|---|
| | 953 | AC_MSG_RESULT([$PCRE_LIBS]) |
|---|
| | 954 | m4_ifval($1,$1) |
|---|
| | 955 | else |
|---|
| | 956 | OLDLDFLAGS="$LDFLAGS" ; LDFLAGS="$LDFLAGS -L$with_pcre/lib" |
|---|
| | 957 | OLDCPPFLAGS="$CPPFLAGS" ; CPPFLAGS="$CPPFLAGS -I$with_pcre/include" |
|---|
| | 958 | OLDLIBS="$LIBS" |
|---|
| | 959 | AC_CHECK_LIB(pcre, pcre_compile) |
|---|
| | 960 | CPPFLAGS="$OLDCPPFLAGS" |
|---|
| | 961 | LDFLAGS="$OLDLDFLAGS" |
|---|
| | 962 | LIBS="$OLDLIBS" |
|---|
| | 963 | if test "$ac_cv_lib_pcre_pcre_compile" = "yes" ; then |
|---|
| | 964 | AC_MSG_RESULT(.setting PCRE_LIBS -L$with_pcre/lib -lpcre) |
|---|
| | 965 | PCRE_LIBS="-L$with_pcre/lib -lpcre" |
|---|
| | 966 | test -d "$with_pcre/include" && PCRE_CFLAGS="-I$with_pcre/include" |
|---|
| | 967 | AC_MSG_CHECKING([lib pcre]) |
|---|
| | 968 | AC_MSG_RESULT([$PCRE_LIBS]) |
|---|
| | 969 | m4_ifval($1,$1) |
|---|
| | 970 | else |
|---|
| | 971 | AC_MSG_CHECKING([lib pcre]) |
|---|
| | 972 | AC_MSG_RESULT([no, (WARNING)]) |
|---|
| | 973 | m4_ifval($2,$2) |
|---|
| | 974 | fi |
|---|
| | 975 | fi |
|---|
| | 976 | fi |
|---|
| | 977 | AC_SUBST([PCRE_LIBS]) |
|---|
| | 978 | AC_SUBST([PCRE_CFLAGS]) |
|---|
| | 979 | ]) |
|---|