2 m4_include([ac_path_generic.m4])
7 # Check for GNU readline library.
8 AC_DEFUN([PSG_LIB_READLINE], [
9 AC_CHECK_HEADERS([readline/readline.h])
10 AC_CHECK_HEADERS([readline/history.h])
11 if test "$ac_cv_header_readline_readline_h" = "yes"; then
12 AC_SEARCH_LIBS([tputs], [termcap curses])
13 AC_CHECK_LIB([readline], [rl_callback_handler_install])
20 # Check for usable version of libtar library.
21 AC_DEFUN([PSG_LIB_TAR], [
24 AC_CACHE_CHECK([for usable version of libtar],
25 [psg_cv_lib_tar_usable],
31 int main(int argc, char *argv[]) {
32 return (strcmp(libtar_version, "1.2") >= 0 ? 0 : 1);
35 [psg_cv_lib_tar_usable=yes],
36 [psg_cv_lib_tar_usable=no],
37 [psg_cv_lib_tar_usable=no]
40 if test "$psg_cv_lib_tar_usable" = "yes"; then
41 AC_DEFINE([HAVE_LIBTAR], 1,
42 [Define if your system has a current version of libtar])
51 # Check for usable version of libfget library.
52 AC_DEFUN([PSG_LIB_FGET], [
54 AC_CHECK_LIB([socket], [socket])
55 AC_CHECK_LIB([nsl], [gethostbyname])
57 AC_CACHE_CHECK([for usable version of libfget],
58 [psg_cv_lib_fget_usable],
66 ftp_url_parse("ftp://host.com/dir/file.txt", &fu);
68 ftp_connect(&ftp, fu.fu_hostname, buf, sizeof(buf), 0, 0,
71 [psg_cv_lib_fget_usable=yes],
72 [psg_cv_lib_fget_usable=no]
75 if test "$psg_cv_lib_fget_usable" = "yes"; then
76 AC_DEFINE([HAVE_LIBFGET], 1,
77 [Define if your system has a current version of libfget])
86 # Check for TCP Wrapper library.
87 AC_DEFUN([PSG_LIB_WRAP], [
88 AC_CHECK_HEADERS([tcpd.h])
89 if test "$ac_cv_header_tcpd_h" = "yes"; then
92 AC_CACHE_CHECK([for libwrap library],
93 [psg_cv_lib_wrap_hosts_ctl],
100 hosts_ctl("test", STRING_UNKNOWN, "10.0.0.1", STRING_UNKNOWN);
102 [psg_cv_lib_wrap_hosts_ctl=yes],
103 [psg_cv_lib_wrap_hosts_ctl=no]
106 if test "$psg_cv_lib_wrap_hosts_ctl" = "yes"; then
107 AC_DEFINE([HAVE_LIBWRAP], 1, [Define if you have libwrap])
115 # PSG_REPLACE_TYPE(type_t, default, [includes])
116 # ---------------------------------------------
117 # Check for arbitrary type in arbitrary header file(s).
118 AC_DEFUN([PSG_REPLACE_TYPE],
119 [AC_CHECK_TYPES([$1],
122 [Define to `$2' if not defined in system header files.]
129 # PSG_SHLIB(includes, code)
130 # -------------------------
131 # Check how to build shared libraries containing the specified code
132 # (very rudimentary).
133 AC_DEFUN([PSG_SHLIB], [
134 AC_MSG_CHECKING([how to build shared libraries])
135 cflag_options="-fpic";
136 ldflag_options="-G -shared";
137 if test "$CC" != "gcc"; then
140 cflag_options="+Z $cflag_options";
141 ldflag_options="-Wl,-b $ldflag_options";
144 cflag_options="-Kpic $cflag_options";
148 for SHLIB_CFLAGS in $cflag_options ""; do
149 for SHLIB_LDFLAGS in $ldflag_options ""; do
150 psg_old_cflags="$CFLAGS";
151 CFLAGS="$CFLAGS $SHLIB_CFLAGS";
152 psg_old_ldflags="$LDFLAGS";
153 LDFLAGS="$LDFLAGS $SHLIB_LDFLAGS";
154 AC_LINK_IFELSE([AC_LANG_SOURCE([[
164 [psg_cv_flags_shlib="CFLAGS=$SHLIB_CFLAGS LDFLAGS=$SHLIB_LDFLAGS"],
165 [psg_cv_flags_shlib=no]
167 CFLAGS="$psg_old_cflags";
168 LDFLAGS="$psg_old_ldflags";
169 if test "$psg_cv_flags_shlib" != "no"; then
173 if test "$psg_cv_flags_shlib" != "no"; then
177 if test "$psg_cv_flags_shlib" = "no"; then
181 AC_SUBST([SHLIB_CFLAGS])
182 AC_SUBST([SHLIB_LDFLAGS])
183 AC_MSG_RESULT([$psg_cv_flags_shlib])
187 # PSG_MODULE(subdir, [args, ...])
188 # -------------------------------
189 # Process the module.ac file in subdir. If the module.ac file defines a
190 # macro called subdir[]_INIT, call it with the arguments passed to
192 AC_DEFUN([PSG_MODULE], [
193 m4_define([subdir], [$1])dnl
194 m4_include([$1/module.ac])dnl
195 m4_ifdef([$1][_INIT], [$1][_INIT($@)])dnl
196 m4_undefine([subdir])dnl