1 # Extract data from preprocessor output using sed expresions.
4 # Derek R. Price, Ximbiot <http://ximbiot.com>,
5 # and the Free Software Foundation, Inc.
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2, or (at your option)
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
22 # ACX_EXTRACT_CPP_DEFN(VARIABLE, PROGRAM,
23 # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
24 # -------------------------------------------
25 # Extract single line definitions from preprocessor output. If the
26 # output of the C preprocessor on PROGRAM contains a definition for VARIABLE,
27 # assign it to shell variable VARIABLE and run ACTION-IF-FOUND. Otherwise run
28 # ACTION-IF-NOT-FOUND.
29 AC_DEFUN([ACX_EXTRACT_CPP_DEFN],
30 [AC_LANG_PREPROC_REQUIRE()dnl
31 AC_LANG_CONFTEST([AC_LANG_SOURCE([[$2]])])
32 dnl eval is necessary to expand ac_cpp.
33 dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell.
34 ac_extract_cpp_result=`(eval "$ac_cpp -dM conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
35 dnl m4 quote the argument to sed to prevent m4 from eating character classes
37 dnl C89 6.8.3 Specifies that all whitespace separation in macro definitions is
38 dnl equivalent, so eat leading and trailing whitespace to account for
39 dnl preprocessor quirks (commands 1.2 & 1.3 in the sed script below).
40 sed -n ["/^#define $1 /{
44 p;}"] 2>&AS_MESSAGE_LOG_FD`
45 if test -n "$ac_extract_cpp_result"; then
46 $1=$ac_extract_cpp_result
47 m4_ifvaln([$3], [$3])dnl
52 ])# ACX_EXTRACT_CPP_DEFN
56 # ACX_EXTRACT_HEADER_DEFN(VARIABLE, HEADER-FILE,
57 # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
58 # ---------------------------------------------------------
59 AC_DEFUN([ACX_EXTRACT_HEADER_DEFN],
60 [ACX_EXTRACT_CPP_DEFN([$1],