1
|
1 dnl Process this file with autoconf to produce a configure script.
|
|
2
|
|
3 AC_INIT(lib/gftp.h)
|
|
4
|
|
5 AM_CONFIG_HEADER(config.h)
|
143
|
6 AM_INIT_AUTOMAKE(gftp,2.0.15)
|
1
|
7
|
81
|
8 AC_ARG_ENABLE(gtk20,
|
|
9 [ --disable-gtk20 Don't look for GTK+ 2.0 libraries],
|
|
10 enable_gtk20=$enableval,
|
|
11 enable_gtk20="yes")
|
|
12
|
|
13 AC_ARG_ENABLE(gtkport,
|
|
14 [ --disable-gtkport Disable compiling the GTK+ port],
|
|
15 enable_gtkport=$enableval,
|
|
16 enable_gtkport="yes")
|
|
17
|
|
18 AC_ARG_ENABLE(textport,
|
|
19 [ --disable-textport Disable compiling the text port],
|
|
20 enable_textport=$enableval,
|
|
21 enable_textport="yes")
|
1
|
22
|
|
23 AC_SUBST(PACKAGE)
|
|
24 AC_SUBST(VERSION)
|
|
25 AC_SUBST(PREFIX)
|
|
26
|
158
|
27 ALL_LINGUAS="am ar bg ca cs da de es fi fr hu it ja ko ms nl no pl pt pt_BR ro ru sr sr@Latn sv tr uk zh_CN zh_TW"
|
1
|
28
|
16
|
29 AC_DEFINE(_GNU_SOURCE, 1, [Define for setting a GNU environment])
|
|
30
|
1
|
31 AC_CANONICAL_HOST
|
16
|
32 AC_PROG_CC
|
|
33 AC_AIX
|
|
34 AC_MINIX
|
|
35 AC_EXEEXT
|
|
36 AC_PROG_RANLIB
|
|
37 AC_SYS_LARGEFILE
|
|
38 dnl AC_ISC_POSIX
|
|
39 AM_C_PROTOTYPES
|
|
40 AC_C_CONST
|
|
41 AC_C_INLINE
|
1
|
42
|
26
|
43 AM_MAINTAINER_MODE
|
|
44
|
1
|
45 AC_PROG_AWK
|
|
46 AC_PROG_INSTALL
|
|
47 AC_PROG_LN_S
|
|
48 AC_PROG_MAKE_SET
|
|
49
|
|
50 AC_HEADER_DIRENT
|
|
51 AC_HEADER_STDC
|
|
52 AC_HEADER_SYS_WAIT
|
|
53 AC_CHECK_HEADERS(fcntl.h limits.h malloc.h strings.h sys/ioctl.h sys/time.h unistd.h)
|
|
54
|
|
55 AC_TYPE_MODE_T
|
|
56 AC_TYPE_PID_T
|
|
57 AC_TYPE_SIZE_T
|
|
58 AC_HEADER_TIME
|
|
59 AC_STRUCT_TM
|
|
60
|
|
61 AC_FUNC_ALLOCA
|
|
62 AC_PROG_GCC_TRADITIONAL
|
|
63 AC_FUNC_MMAP
|
|
64 AC_TYPE_SIGNAL
|
|
65 AC_FUNC_STRFTIME
|
|
66 AC_FUNC_UTIME_NULL
|
146
|
67 AC_CHECK_FUNCS(gai_strerror getaddrinfo getcwd gettimeofday getwd mkdir mktime putenv rmdir select socket strdup strstr strtod strtol uname grantpt openpty)
|
1
|
68
|
81
|
69 if test "x$enable_gtk20" = "xyes" ; then
|
57
|
70 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.0.0, found_glib20=1, found_glib20=0)
|
|
71 else
|
|
72 found_glib20=0;
|
|
73 fi
|
|
74
|
|
75 if test "x$GFTP_TEXT" = "x" -a $found_glib20 = 0 ; then
|
26
|
76 AM_PATH_GLIB(1.2.3, , AC_MSG_ERROR(gFTP needs GLIB 1.2.3 or higher))
|
1
|
77 fi
|
|
78
|
93
|
79 EXTRA_LIBS=""
|
|
80
|
146
|
81 # FreeBSD needs this
|
|
82 AC_CHECK_LIB(util, openpty, EXTRA_LIBS="-lutil")
|
|
83
|
57
|
84 AC_CHECK_LIB(socket, socket, EXTRA_LIBS="-lsocket")
|
|
85
|
|
86 AC_CHECK_LIB(nsl, gethostbyname, EXTRA_LIBS="$EXTRA_LIBS -lnsl")
|
1
|
87
|
|
88 GFTP_TEXT=""
|
|
89 USE_READLINE="yes"
|
|
90 READLINE_LIBS=""
|
81
|
91 if test "x$enable_textport" = "xyes" ; then
|
1
|
92 AC_MSG_CHECKING([whether to use readline])
|
|
93 AC_ARG_WITH(readline,
|
|
94 [ --with-readline turn on readline [default=yes, default tries -lncurses, -lcurses, -ltermcap]],
|
|
95 [case "${withval}" in
|
|
96 yes) USE_READLINE="yes" ; AC_MSG_RESULT([yes]) ;;
|
|
97 no) USE_READLINE="no" ; AC_MSG_RESULT([no]) ;;
|
|
98 only) USE_READLINE="yes"
|
|
99 EXTRA_LIBREADLINE_DEPS=" "
|
|
100 AC_MSG_RESULT([yes (using only readline)]) ;;
|
|
101 *) USE_READLINE="yes"
|
|
102 EXTRA_LIBREADLINE_DEPS="${withval}"
|
|
103 AC_MSG_RESULT([yes (using extra libraries ${withval})]) ;;
|
|
104 esac],[AC_MSG_RESULT([${USE_READLINE}])])
|
|
105
|
|
106 dnl Checks for libraries.
|
|
107 dnl When checking readline, check using extra libraries first.
|
|
108 dnl We want to protect against the link somehow succeeding, but only
|
|
109 dnl failing at runtime, as seems to happen on some BSD systems.
|
|
110 if test "$USE_READLINE" = yes ; then
|
|
111 if test "$EXTRA_LIBREADLINE_DEPS" = "" ; then
|
|
112 unset ac_cv_lib_readline_readline
|
|
113 AC_CHECK_LIB(readline, readline, HAVE_LIBREADLINE=true,
|
|
114 HAVE_LIBREADLINE=false, -lncurses)
|
|
115 if test x${HAVE_LIBREADLINE} = xtrue ; then
|
|
116 echo " Using -lreadline -lncurses"
|
|
117 EXTRA_LIBREADLINE_DEPS=-lncurses
|
26
|
118 AC_DEFINE(HAVE_LIBREADLINE, [1], [Define if the text port uses readline])
|
1
|
119 else
|
|
120 unset ac_cv_lib_readline_readline
|
|
121 AC_CHECK_LIB(readline, readline, HAVE_LIBREADLINE=true,
|
|
122 HAVE_LIBREADLINE=false, -lcurses)
|
|
123 if test x${HAVE_LIBREADLINE} = xtrue ; then
|
|
124 echo " Using -lreadline -lcurses"
|
|
125 EXTRA_LIBREADLINE_DEPS=-lcurses
|
26
|
126 AC_DEFINE(HAVE_LIBREADLINE, [1], [Define if the text port uses readline])
|
1
|
127 else
|
|
128 unset ac_cv_lib_readline_readline
|
|
129 AC_CHECK_LIB(readline, readline, HAVE_LIBREADLINE=true,
|
|
130 HAVE_LIBREADLINE=false, -ltermcap)
|
|
131 if test x${HAVE_LIBREADLINE} = xtrue ; then
|
|
132 echo " Using -lreadline -ltermcap"
|
|
133 EXTRA_LIBREADLINE_DEPS=-ltermcap
|
26
|
134 AC_DEFINE(HAVE_LIBREADLINE, [1], [Define if the text port uses readline])
|
1
|
135 else
|
|
136 unset ac_cv_lib_readline_readline
|
|
137 AC_CHECK_LIB(readline, readline, HAVE_LIBREADLINE=true,
|
|
138 HAVE_LIBREADLINE=false)
|
|
139 if test x${HAVE_LIBREADLINE} = xtrue ; then
|
26
|
140 AC_DEFINE(HAVE_LIBREADLINE, [1], [Define if the text port uses readline])
|
1
|
141 else
|
26
|
142 AC_DEFINE(HAVE_LIBREADLINE, [0], [Define if the text port uses readline])
|
1
|
143 fi
|
|
144 fi
|
|
145 fi
|
|
146 fi
|
|
147 else
|
|
148 unset ac_cv_lib_readline_readline
|
|
149 AC_CHECK_LIB(readline, readline, HAVE_LIBREADLINE=true,
|
|
150 HAVE_LIBREADLINE=false, ${EXTRA_LIBREADLINE_DEPS})
|
|
151 if test x${HAVE_LIBREADLINE} = xtrue ; then
|
|
152 echo " Using -lreadline ${EXTRA_LIBREADLINE_DEPS}"
|
26
|
153 AC_DEFINE(HAVE_LIBREADLINE, [1], [Define if the text port uses readline])
|
1
|
154 else
|
26
|
155 AC_DEFINE(HAVE_LIBREADLINE, [0], [Define if the text port uses readline])
|
1
|
156 fi
|
|
157 fi
|
|
158 else
|
|
159 HAVE_LIBREADLINE=false
|
26
|
160 AC_DEFINE(HAVE_LIBREADLINE, [0], [Define if the text port uses readline])
|
1
|
161 fi
|
|
162 if test x${HAVE_LIBREADLINE} = xtrue; then
|
|
163 READLINE_LIBS="-lreadline ${EXTRA_LIBREADLINE_DEPS}"
|
|
164 GFTP_TEXT="gftp-text"
|
|
165 fi
|
|
166 fi
|
|
167
|
|
168 AC_CHECK_LIB(m, log10, EXTRA_LIBS="$EXTRA_LIBS -lm")
|
|
169
|
26
|
170 AM_WITH_DMALLOC
|
1
|
171
|
|
172 AC_SUBST(EXTRA_LIBS)
|
|
173 AC_SUBST(READLINE_LIBS)
|
|
174 AC_SUBST(GFTP_TEXT)
|
|
175
|
|
176 GFTP_GTK=""
|
|
177 PTHREAD_CFLAGS=""
|
|
178 PTHREAD_LIBS=""
|
33
|
179
|
|
180 # I don't have PKG_CHECK_MODULES or AM_PATH_GLIB check for gthread because
|
|
181 # the text port doesn't need to be compiled against the thread libraries
|
|
182 GTHREAD_LIBS=""
|
|
183
|
81
|
184 if test "x$enable_gtkport" = "xyes" ; then
|
|
185 if test $found_glib20 = 1 -a "x$enable_gtk20" = "xyes" ; then
|
57
|
186 PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.0.0, GFTP_GTK=gftp-gtk, AC_MSG_ERROR(You have GLIB 2.0 installed but I cannot find GTK+ 2.0. Run configure with --disable-gtk20 or install GTK+ 2.0))
|
1
|
187 fi
|
|
188
|
|
189 if test "x$GFTP_GTK" = "x" ; then
|
|
190 AM_PATH_GTK(1.2.3, GFTP_GTK=gftp-gtk, AC_MSG_WARN(gFTP needs GTK+ 1.2.3 or higher for the graphical version. Only building the text version))
|
33
|
191 GTHREAD_LIBS="-lgthread"
|
|
192 else
|
|
193 GTHREAD_LIBS="-lgthread-2.0"
|
1
|
194 fi
|
|
195
|
|
196 if test "x$GFTP_GTK" = xgftp-gtk; then
|
|
197 AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIBS="-lpthread")
|
|
198
|
|
199 if test "x$PTHREAD_LIBS" = x ; then
|
|
200 AC_CHECK_LIB(pthreads, pthread_create, PTHREAD_LIBS="-lpthreads")
|
|
201 fi
|
|
202
|
|
203 if test "x$PTHREAD_LIBS" = x ; then
|
|
204 AC_CHECK_LIB(c_r, pthread_create, PTHREAD_LIBS="-lc_r")
|
|
205 fi
|
|
206
|
|
207 if test "x$PTHREAD_LIBS" = x ; then
|
|
208 echo ;
|
|
209 echo "Error: Cannot find the pthread libraries. If you don't have them installed," ;
|
|
210 echo "your X libraries probably aren't thread safe either. You can download the" ;
|
|
211 echo "pthread library and the thread safe X libraries from my webpage at" ;
|
|
212 echo "http://www.gftp.org/. Note the pthread library and the thread safe" ;
|
|
213 echo "X libraries on my webpage are for Linux libc5 machines ONLY" ;
|
|
214 echo ;
|
|
215 exit
|
|
216 fi
|
|
217
|
|
218 PTHREAD_CFLAGS="-D_REENTRANT"
|
|
219
|
|
220 # I took some of these from the glib 1.3.3 configure.in
|
|
221 case $host in
|
|
222 *-hpux*)
|
|
223 # From H.Merijn Brand <h.m.brand@hccnet.nl>
|
|
224 echo '#define pthread_attr_init(x) __pthread_attr_init_system(x)'
|
|
225 +>>confdefs.h
|
|
226 ;;
|
|
227 *-aix*)
|
|
228 PTHREAD_CFLAGS="$PTHREAD_CFLAGS -D_THREAD_SAFE"
|
|
229 if test x"$GCC" = xyes; then
|
|
230 PTHREAD_CFLAGS="$PTHREAD_CFLAGS -mthreads"
|
|
231 fi
|
|
232 ;;
|
|
233 *-freebsd*)
|
|
234 PTHREAD_CFLAGS="$PTHREAD_CFLAGS -D_THREAD_SAFE"
|
|
235
|
|
236 # FreeBSD 2.2.x shiped with gcc 2.7.2.x, which doesn't support
|
|
237 # -mthreads flag.
|
|
238 ;;
|
|
239 *-openbsd*)
|
|
240 PTHREAD_CFLAGS="$PTHREAD_CFLAGS -D_THREAD_SAFE"
|
|
241 if test "x$PTHREAD_LIBS" = "x-lc_r"; then
|
|
242 PTHREAD_LIBS="-pthread"
|
|
243 fi
|
|
244 ;;
|
|
245 *-sysv5uw7*) # UnixWare 7
|
|
246 if test "$GCC" != "yes"; then
|
|
247 PTHREAD_CFLAGS="$PTHREAD_CFLAGS -Kthread"
|
|
248 else
|
|
249 PTHREAD_CFLAGS="$PTHREAD_CFLAGS -pthread"
|
|
250 fi
|
|
251 ;;
|
|
252 *-dg-dgux*) # DG/UX
|
|
253 PTHREAD_CFLAGS="$PTHREAD_CFLAGS -D_POSIX4A_DRAFT10_SOURCE"
|
|
254 esac
|
|
255 fi
|
|
256 fi
|
|
257 AC_SUBST(PTHREAD_CFLAGS)
|
|
258 AC_SUBST(PTHREAD_LIBS)
|
33
|
259 AC_SUBST(GTHREAD_LIBS)
|
1
|
260 AC_SUBST(GFTP_GTK)
|
|
261
|
166
|
262 AM_GNU_GETTEXT
|
1
|
263
|
166
|
264 AC_OUTPUT(Makefile docs/Makefile docs/sample.gftp/Makefile src/gftp src/Makefile src/gtk/Makefile src/text/Makefile gftp.spec)
|