OSDN Git Service

Avoid duplicate definition of LOCALEDIR in pg_config.h, already defined
[pg-rex/syncrep.git] / config / programs.m4
1 # $PostgreSQL: pgsql/config/programs.m4,v 1.20 2006/05/23 19:28:45 momjian Exp $
2
3
4 # PGAC_PATH_FLEX
5 # --------------
6 # Look for Flex, set the output variable FLEX to its path if found.
7 # Avoid the buggy version 2.5.3. Also find Flex if its installed
8 # under `lex', but do not accept other Lex programs.
9
10 AC_DEFUN([PGAC_PATH_FLEX],
11 [AC_CACHE_CHECK([for flex], pgac_cv_path_flex,
12 [# Let the user override the test
13 if test -n "$FLEX"; then
14   pgac_cv_path_flex=$FLEX
15 else
16   pgac_save_IFS=$IFS
17   IFS=$PATH_SEPARATOR
18   for pgac_dir in $PATH; do
19     IFS=$pgac_save_IFS
20     if test -z "$pgac_dir" || test x"$pgac_dir" = x"."; then
21       pgac_dir=`pwd`
22     fi
23     for pgac_prog in flex lex; do
24       pgac_candidate="$pgac_dir/$pgac_prog"
25       if test -f "$pgac_candidate" \
26         && $pgac_candidate --version </dev/null >/dev/null 2>&1
27       then
28         echo '%%'  > conftest.l
29         if $pgac_candidate -t conftest.l 2>/dev/null | grep FLEX_SCANNER >/dev/null 2>&1; then
30           if $pgac_candidate --version | grep ' 2\.5\.3$' >/dev/null 2>&1; then
31             pgac_broken_flex=$pgac_candidate
32             continue
33           fi
34
35           pgac_cv_path_flex=$pgac_candidate
36           break 2
37         fi
38       fi
39     done
40   done
41   rm -f conftest.l lex.yy.c
42   : ${pgac_cv_path_flex=no}
43 fi
44 ])[]dnl AC_CACHE_CHECK
45
46 if test x"$pgac_cv_path_flex" = x"no"; then
47   if test -n "$pgac_broken_flex"; then
48     AC_MSG_WARN([
49 *** The Flex version 2.5.3 you have at $pgac_broken_flex contains a bug. You
50 *** should get version 2.5.4 or later.])
51   fi
52
53   AC_MSG_WARN([
54 *** Without Flex you will not be able to build PostgreSQL from CVS or
55 *** change any of the scanner definition files.  You can obtain Flex from
56 *** a GNU mirror site.  (If you are using the official distribution of
57 *** PostgreSQL then you do not need to worry about this because the Flex
58 *** output is pre-generated.)])
59 fi
60
61 if test x"$pgac_cv_path_flex" = x"no"; then
62   FLEX=
63 else
64   FLEX=$pgac_cv_path_flex
65 fi
66
67 AC_SUBST(FLEX)
68 AC_SUBST(FLEXFLAGS)
69 ])# PGAC_PATH_FLEX
70
71
72
73 # PGAC_CHECK_READLINE
74 # -------------------
75 # Check for the readline library and dependent libraries, either
76 # termcap or curses.  Also try libedit, since NetBSD's is compatible.
77 # Add the required flags to LIBS, define HAVE_LIBREADLINE.
78
79 AC_DEFUN([PGAC_CHECK_READLINE],
80 [AC_REQUIRE([AC_CANONICAL_HOST])
81
82 AC_CACHE_VAL([pgac_cv_check_readline],
83 [pgac_cv_check_readline=no
84 pgac_save_LIBS=$LIBS
85 if test x"$with_libedit_preferred" != x"yes"
86 then    READLINE_ORDER="-lreadline -ledit"
87 else    READLINE_ORDER="-ledit -lreadline"
88 fi
89 for pgac_rllib in $READLINE_ORDER ; do
90   AC_MSG_CHECKING([for ${pgac_rllib}])
91   for pgac_lib in "" " -ltermcap" " -lncurses" " -lcurses" ; do
92     LIBS="${pgac_rllib}${pgac_lib} $pgac_save_LIBS"
93     AC_TRY_LINK_FUNC([readline], [[
94       # Older NetBSD, OpenBSD, and Irix have a broken linker that does not
95       # recognize dependent libraries; assume curses is needed if we didn't
96       # find any dependency.
97       case $host_os in
98         netbsd* | openbsd* | irix*)
99           if test x"$pgac_lib" = x"" ; then
100             pgac_lib=" -lcurses"
101           fi ;;
102       esac
103
104       pgac_cv_check_readline="${pgac_rllib}${pgac_lib}"
105       break
106     ]])
107   done
108   if test "$pgac_cv_check_readline" != no ; then
109     AC_MSG_RESULT([yes ($pgac_cv_check_readline)])
110     break
111   else
112     AC_MSG_RESULT(no)
113   fi
114 done
115 LIBS=$pgac_save_LIBS
116 ])[]dnl AC_CACHE_VAL
117
118 if test "$pgac_cv_check_readline" != no ; then
119   LIBS="$pgac_cv_check_readline $LIBS"
120   AC_DEFINE(HAVE_LIBREADLINE, 1, [Define if you have a function readline library])
121 fi
122
123 ])# PGAC_CHECK_READLINE
124
125
126
127 # PGAC_VAR_RL_COMPLETION_APPEND_CHARACTER
128 # ---------------------------------------
129 # Readline versions < 2.1 don't have rl_completion_append_character
130
131 AC_DEFUN([PGAC_VAR_RL_COMPLETION_APPEND_CHARACTER],
132 [AC_MSG_CHECKING([for rl_completion_append_character])
133 AC_TRY_LINK([#include <stdio.h>
134 #ifdef HAVE_READLINE_READLINE_H
135 # include <readline/readline.h>
136 #elif defined(HAVE_READLINE_H)
137 # include <readline.h>
138 #endif
139 ],
140 [rl_completion_append_character = 'x';],
141 [AC_MSG_RESULT(yes)
142 AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1,
143           [Define to 1 if you have the global variable 'rl_completion_append_character'.])],
144 [AC_MSG_RESULT(no)])])# PGAC_VAR_RL_COMPLETION_APPEND_CHARACTER
145
146
147
148 # PGAC_CHECK_GETTEXT
149 # ------------------
150
151 AC_DEFUN([PGAC_CHECK_GETTEXT],
152 [
153   AC_SEARCH_LIBS(gettext, intl, [],
154                  [AC_MSG_ERROR([a gettext implementation is required for NLS])])
155   AC_CHECK_HEADER([libintl.h], [],
156                   [AC_MSG_ERROR([header file <libintl.h> is required for NLS])])
157   AC_CHECK_PROGS(MSGFMT, msgfmt)
158   if test -z "$MSGFMT"; then
159     AC_MSG_ERROR([msgfmt is required for NLS])
160   fi
161   AC_CHECK_PROGS(MSGMERGE, msgmerge)
162 dnl FIXME: We should probably check for version >=0.10.36.
163   AC_CHECK_PROGS(XGETTEXT, xgettext)
164
165   # Note: share/locale is always the default, independent of $datadir
166   localedir='${prefix}/share/locale'
167   AC_SUBST(localedir)
168 ])# PGAC_CHECK_GETTEXT
169
170
171
172 # PGAC_CHECK_STRIP
173 # ----------------
174 # Check for a 'strip' program, and figure out if that program can
175 # strip libraries.
176
177 AC_DEFUN([PGAC_CHECK_STRIP],
178 [
179   AC_CHECK_TOOL(STRIP, strip, :)
180
181   AC_MSG_CHECKING([whether it is possible to strip libraries])
182   if test x"$STRIP" != x"" && "$STRIP" -V 2>&1 | grep "GNU strip" >/dev/null; then
183     STRIP_STATIC_LIB="$STRIP -x"
184     STRIP_SHARED_LIB="$STRIP --strip-unneeded"
185     AC_MSG_RESULT(yes)
186   else
187     STRIP_STATIC_LIB=:
188     STRIP_SHARED_LIB=:
189     AC_MSG_RESULT(no)
190   fi
191   AC_SUBST(STRIP_STATIC_LIB)
192   AC_SUBST(STRIP_SHARED_LIB)
193 ])# PGAC_CHECK_STRIP