3 # Check for GNU readline library.
4 AC_DEFUN([PSG_LIB_READLINE], [
5 AC_CHECK_HEADERS([readline/readline.h])
6 AC_CHECK_HEADERS([readline/history.h])
7 if test "$ac_cv_header_readline_readline_h" = "yes"; then
8 AC_SEARCH_LIBS([tputs], [termcap curses])
9 AC_CHECK_LIB([readline], [rl_callback_handler_install])
16 # Check for usable version of libtar library.
17 AC_DEFUN([PSG_LIB_TAR], [
20 AC_CACHE_CHECK([for usable version of libtar],
21 [psg_cv_lib_tar_usable],
27 int main(int argc, char *argv[]) {
28 return (strcmp(libtar_version, "1.2") >= 0 ? 0 : 1);
31 [psg_cv_lib_tar_usable=yes],
32 [psg_cv_lib_tar_usable=no],
33 [psg_cv_lib_tar_usable=no]
36 if test "$psg_cv_lib_tar_usable" = "yes"; then
37 AC_DEFINE([HAVE_LIBTAR], 1,
38 [Define if your system has a current version of libtar])
47 # Check for usable version of libfget library.
48 AC_DEFUN([PSG_LIB_FGET], [
50 AC_CHECK_LIB([socket], [socket])
51 AC_CHECK_LIB([nsl], [gethostbyname])
53 AC_CACHE_CHECK([for usable version of libfget],
54 [psg_cv_lib_fget_usable],
62 ftp_url_parse("ftp://host.com/dir/file.txt", &fu);
64 ftp_connect(&ftp, fu.fu_hostname, buf, sizeof(buf), 0, 0,
67 [psg_cv_lib_fget_usable=yes],
68 [psg_cv_lib_fget_usable=no]
71 if test "$psg_cv_lib_fget_usable" = "yes"; then
72 AC_DEFINE([HAVE_LIBFGET], 1,
73 [Define if your system has a current version of libfget])
82 # Check for TCP Wrapper library.
83 AC_DEFUN([PSG_LIB_WRAP], [
84 AC_CHECK_HEADERS([tcpd.h])
85 if test "$ac_cv_header_tcpd_h" = "yes"; then
88 AC_CACHE_CHECK([for libwrap library],
89 [psg_cv_lib_wrap_hosts_ctl],
96 hosts_ctl("test", STRING_UNKNOWN, "10.0.0.1", STRING_UNKNOWN);
98 [psg_cv_lib_wrap_hosts_ctl=yes],
99 [psg_cv_lib_wrap_hosts_ctl=no]
102 if test "$psg_cv_lib_wrap_hosts_ctl" = "yes"; then
103 AC_DEFINE([HAVE_LIBWRAP], 1, [Define if you have libwrap])
111 # PSG_REPLACE_TYPE(type_t, default, [includes])
112 # ---------------------------------------------
113 # Check for arbitrary type in arbitrary header file(s).
114 AC_DEFUN([PSG_REPLACE_TYPE],
115 [AC_CHECK_TYPES([$1],
118 [Define to `$2' if not defined in system header files.]
125 # PSG_SHLIB(includes, code)
126 # -------------------------
127 # Check how to build shared libraries containing the specified code
128 # (very rudimentary).
129 AC_DEFUN([PSG_SHLIB], [
130 AC_MSG_CHECKING([how to build shared libraries])
131 cflag_options="-fpic";
132 ldflag_options="-G -shared";
133 if test "$CC" != "gcc"; then
136 cflag_options="+Z $cflag_options";
137 ldflag_options="-Wl,-b $ldflag_options";
140 cflag_options="-Kpic $cflag_options";
144 for SHLIB_CFLAGS in $cflag_options ""; do
145 for SHLIB_LDFLAGS in $ldflag_options ""; do
146 psg_old_cflags="$CFLAGS";
147 CFLAGS="$CFLAGS $SHLIB_CFLAGS";
148 psg_old_ldflags="$LDFLAGS";
149 LDFLAGS="$LDFLAGS $SHLIB_LDFLAGS";
150 AC_LINK_IFELSE([AC_LANG_SOURCE([[
160 [psg_cv_flags_shlib="CFLAGS=$SHLIB_CFLAGS LDFLAGS=$SHLIB_LDFLAGS"],
161 [psg_cv_flags_shlib=no]
163 CFLAGS="$psg_old_cflags";
164 LDFLAGS="$psg_old_ldflags";
165 if test "$psg_cv_flags_shlib" != "no"; then
169 if test "$psg_cv_flags_shlib" != "no"; then
173 if test "$psg_cv_flags_shlib" = "no"; then
177 AC_SUBST([SHLIB_CFLAGS])
178 AC_SUBST([SHLIB_LDFLAGS])
179 AC_MSG_RESULT([$psg_cv_flags_shlib])
183 # PSG_MODULE(subdir, [args, ...])
184 # -------------------------------
185 # Process the module.ac file in subdir. If the module.ac file defines a
186 # macro called subdir[]_INIT, call it with the arguments passed to
188 AC_DEFUN([PSG_MODULE], [
189 m4_define([subdir], [$1])dnl
190 m4_include([$1]/module.ac)dnl
191 m4_ifdef([$1][_INIT], [$1][_INIT($@)])dnl
192 m4_undefine([subdir])dnl