Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4 | magnus | 1 | # PSG_LIB_READLINE |
2 | # ---------------- |
||
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]) |
||
10 | fi |
||
11 | ]) |
||
12 | |||
13 | |||
14 | # PSG_LIB_TAR |
||
15 | # ----------- |
||
16 | # Check for usable version of libtar library. |
||
17 | AC_DEFUN([PSG_LIB_TAR], [ |
||
18 | psg_old_libs="$LIBS" |
||
19 | LIBS="$LIBS -ltar" |
||
20 | AC_CACHE_CHECK([for usable version of libtar], |
||
21 | [psg_cv_lib_tar_usable], |
||
22 | [AC_TRY_RUN([ |
||
23 | #include <stdio.h> |
||
24 | #include <string.h> |
||
25 | #include <libtar.h> |
||
26 | |||
27 | int main(int argc, char *argv[]) { |
||
28 | return (strcmp(libtar_version, "1.2") >= 0 ? 0 : 1); |
||
29 | } |
||
30 | ], |
||
31 | [psg_cv_lib_tar_usable=yes], |
||
32 | [psg_cv_lib_tar_usable=no], |
||
33 | [psg_cv_lib_tar_usable=no] |
||
34 | )] |
||
35 | ) |
||
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]) |
||
39 | else |
||
40 | LIBS="$psg_old_libs" |
||
41 | fi |
||
42 | ]) |
||
43 | |||
44 | |||
45 | # PSG_LIB_FGET |
||
46 | # ------------ |
||
47 | # Check for usable version of libfget library. |
||
48 | AC_DEFUN([PSG_LIB_FGET], [ |
||
49 | psg_old_libs="$LIBS" |
||
50 | AC_CHECK_LIB([socket], [socket]) |
||
51 | AC_CHECK_LIB([nsl], [gethostbyname]) |
||
52 | LIBS="$LIBS -lfget" |
||
53 | AC_CACHE_CHECK([for usable version of libfget], |
||
54 | [psg_cv_lib_fget_usable], |
||
55 | [AC_TRY_COMPILE([ |
||
56 | #include <libfget.h> |
||
57 | ], [ |
||
58 | FTP *ftp; |
||
59 | char buf[10240]; |
||
60 | struct ftp_url fu; |
||
61 | |||
62 | ftp_url_parse("ftp://host.com/dir/file.txt", &fu); |
||
63 | |||
64 | ftp_connect(&ftp, fu.fu_hostname, buf, sizeof(buf), 0, 0, |
||
65 | -1, -1, NULL, NULL); |
||
66 | ], |
||
67 | [psg_cv_lib_fget_usable=yes], |
||
68 | [psg_cv_lib_fget_usable=no] |
||
69 | )] |
||
70 | ) |
||
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]) |
||
74 | else |
||
75 | LIBS="$psg_old_libs"; |
||
76 | fi |
||
77 | ]) |
||
78 | |||
79 | |||
80 | # PSG_LIB_WRAP |
||
81 | # ------------ |
||
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 |
||
86 | psg_old_libs="$LIBS" |
||
87 | LIBS="$LIBS -lwrap" |
||
88 | AC_CACHE_CHECK([for libwrap library], |
||
89 | [psg_cv_lib_wrap_hosts_ctl], |
||
90 | AC_TRY_LINK([ |
||
91 | #include <stdio.h> |
||
92 | #include <tcpd.h> |
||
93 | int allow_severity; |
||
94 | int deny_severity; |
||
95 | ], [ |
||
96 | hosts_ctl("test", STRING_UNKNOWN, "10.0.0.1", STRING_UNKNOWN); |
||
97 | ], |
||
98 | [psg_cv_lib_wrap_hosts_ctl=yes], |
||
99 | [psg_cv_lib_wrap_hosts_ctl=no] |
||
100 | ) |
||
101 | ) |
||
102 | if test "$psg_cv_lib_wrap_hosts_ctl" = "yes"; then |
||
103 | AC_DEFINE([HAVE_LIBWRAP], 1, [Define if you have libwrap]) |
||
104 | else |
||
105 | LIBS="$psg_old_libs" |
||
106 | fi |
||
107 | fi |
||
108 | ]) |
||
109 | |||
110 | |||
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], |
||
116 | , |
||
117 | [AC_DEFINE($1, $2, |
||
118 | [Define to `$2' if not defined in system header files.] |
||
119 | )], |
||
120 | $3 |
||
121 | )] |
||
122 | ) |
||
123 | |||
124 | |||
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 |
||
134 | case "`uname`" in |
||
135 | HP-UX) |
||
136 | cflag_options="+Z $cflag_options"; |
||
137 | ldflag_options="-Wl,-b $ldflag_options"; |
||
138 | ;; |
||
139 | SunOS) |
||
140 | cflag_options="-Kpic $cflag_options"; |
||
141 | ;; |
||
142 | esac |
||
143 | fi |
||
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([[ |
||
151 | $1 |
||
152 | |||
153 | int |
||
154 | dummy(void) |
||
155 | { |
||
156 | $2 |
||
157 | return 0; |
||
158 | } |
||
159 | ]])], |
||
160 | [psg_cv_flags_shlib="CFLAGS=$SHLIB_CFLAGS LDFLAGS=$SHLIB_LDFLAGS"], |
||
161 | [psg_cv_flags_shlib=no] |
||
162 | ) |
||
163 | CFLAGS="$psg_old_cflags"; |
||
164 | LDFLAGS="$psg_old_ldflags"; |
||
165 | if test "$psg_cv_flags_shlib" != "no"; then |
||
166 | break; |
||
167 | fi |
||
168 | done |
||
169 | if test "$psg_cv_flags_shlib" != "no"; then |
||
170 | break; |
||
171 | fi |
||
172 | done |
||
173 | if test "$psg_cv_flags_shlib" = "no"; then |
||
174 | SHLIB_CFLAGS=""; |
||
175 | SHLIB_LDFLAGS=""; |
||
176 | fi |
||
177 | AC_SUBST([SHLIB_CFLAGS]) |
||
178 | AC_SUBST([SHLIB_LDFLAGS]) |
||
179 | AC_MSG_RESULT([$psg_cv_flags_shlib]) |
||
180 | ]) |
||
181 | |||
182 | |||
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 |
||
187 | # PSG_MODULE(). |
||
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 |
||
193 | ]) |
||
194 | |||
195 |