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)
|
73
|
6 AM_INIT_AUTOMAKE(gftp,2.0.14)
|
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
|
116
|
27 ALL_LINGUAS="am ar bg ca cs da de es fi fr hu it ja ko nl no pl pt_BR ro ru 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
|
80
|
67 AC_CHECK_FUNCS(gai_strerror getaddrinfo getcwd gettimeofday getwd mkdir mktime putenv rmdir select socket strdup strstr strtod strtol uname grantpt)
|
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
|
57
|
81 AC_CHECK_LIB(socket, socket, EXTRA_LIBS="-lsocket")
|
|
82
|
|
83 AC_CHECK_LIB(nsl, gethostbyname, EXTRA_LIBS="$EXTRA_LIBS -lnsl")
|
1
|
84
|
|
85 GFTP_TEXT=""
|
|
86 USE_READLINE="yes"
|
|
87 READLINE_LIBS=""
|
81
|
88 if test "x$enable_textport" = "xyes" ; then
|
1
|
89 AC_MSG_CHECKING([whether to use readline])
|
|
90 AC_ARG_WITH(readline,
|
|
91 [ --with-readline turn on readline [default=yes, default tries -lncurses, -lcurses, -ltermcap]],
|
|
92 [case "${withval}" in
|
|
93 yes) USE_READLINE="yes" ; AC_MSG_RESULT([yes]) ;;
|
|
94 no) USE_READLINE="no" ; AC_MSG_RESULT([no]) ;;
|
|
95 only) USE_READLINE="yes"
|
|
96 EXTRA_LIBREADLINE_DEPS=" "
|
|
97 AC_MSG_RESULT([yes (using only readline)]) ;;
|
|
98 *) USE_READLINE="yes"
|
|
99 EXTRA_LIBREADLINE_DEPS="${withval}"
|
|
100 AC_MSG_RESULT([yes (using extra libraries ${withval})]) ;;
|
|
101 esac],[AC_MSG_RESULT([${USE_READLINE}])])
|
|
102
|
|
103 dnl Checks for libraries.
|
|
104 dnl When checking readline, check using extra libraries first.
|
|
105 dnl We want to protect against the link somehow succeeding, but only
|
|
106 dnl failing at runtime, as seems to happen on some BSD systems.
|
|
107 if test "$USE_READLINE" = yes ; then
|
|
108 if test "$EXTRA_LIBREADLINE_DEPS" = "" ; then
|
|
109 unset ac_cv_lib_readline_readline
|
|
110 AC_CHECK_LIB(readline, readline, HAVE_LIBREADLINE=true,
|
|
111 HAVE_LIBREADLINE=false, -lncurses)
|
|
112 if test x${HAVE_LIBREADLINE} = xtrue ; then
|
|
113 echo " Using -lreadline -lncurses"
|
|
114 EXTRA_LIBREADLINE_DEPS=-lncurses
|
26
|
115 AC_DEFINE(HAVE_LIBREADLINE, [1], [Define if the text port uses readline])
|
1
|
116 else
|
|
117 unset ac_cv_lib_readline_readline
|
|
118 AC_CHECK_LIB(readline, readline, HAVE_LIBREADLINE=true,
|
|
119 HAVE_LIBREADLINE=false, -lcurses)
|
|
120 if test x${HAVE_LIBREADLINE} = xtrue ; then
|
|
121 echo " Using -lreadline -lcurses"
|
|
122 EXTRA_LIBREADLINE_DEPS=-lcurses
|
26
|
123 AC_DEFINE(HAVE_LIBREADLINE, [1], [Define if the text port uses readline])
|
1
|
124 else
|
|
125 unset ac_cv_lib_readline_readline
|
|
126 AC_CHECK_LIB(readline, readline, HAVE_LIBREADLINE=true,
|
|
127 HAVE_LIBREADLINE=false, -ltermcap)
|
|
128 if test x${HAVE_LIBREADLINE} = xtrue ; then
|
|
129 echo " Using -lreadline -ltermcap"
|
|
130 EXTRA_LIBREADLINE_DEPS=-ltermcap
|
26
|
131 AC_DEFINE(HAVE_LIBREADLINE, [1], [Define if the text port uses readline])
|
1
|
132 else
|
|
133 unset ac_cv_lib_readline_readline
|
|
134 AC_CHECK_LIB(readline, readline, HAVE_LIBREADLINE=true,
|
|
135 HAVE_LIBREADLINE=false)
|
|
136 if test x${HAVE_LIBREADLINE} = xtrue ; then
|
26
|
137 AC_DEFINE(HAVE_LIBREADLINE, [1], [Define if the text port uses readline])
|
1
|
138 else
|
26
|
139 AC_DEFINE(HAVE_LIBREADLINE, [0], [Define if the text port uses readline])
|
1
|
140 fi
|
|
141 fi
|
|
142 fi
|
|
143 fi
|
|
144 else
|
|
145 unset ac_cv_lib_readline_readline
|
|
146 AC_CHECK_LIB(readline, readline, HAVE_LIBREADLINE=true,
|
|
147 HAVE_LIBREADLINE=false, ${EXTRA_LIBREADLINE_DEPS})
|
|
148 if test x${HAVE_LIBREADLINE} = xtrue ; then
|
|
149 echo " Using -lreadline ${EXTRA_LIBREADLINE_DEPS}"
|
26
|
150 AC_DEFINE(HAVE_LIBREADLINE, [1], [Define if the text port uses readline])
|
1
|
151 else
|
26
|
152 AC_DEFINE(HAVE_LIBREADLINE, [0], [Define if the text port uses readline])
|
1
|
153 fi
|
|
154 fi
|
|
155 else
|
|
156 HAVE_LIBREADLINE=false
|
26
|
157 AC_DEFINE(HAVE_LIBREADLINE, [0], [Define if the text port uses readline])
|
1
|
158 fi
|
|
159 if test x${HAVE_LIBREADLINE} = xtrue; then
|
|
160 READLINE_LIBS="-lreadline ${EXTRA_LIBREADLINE_DEPS}"
|
|
161 GFTP_TEXT="gftp-text"
|
|
162 fi
|
|
163 fi
|
|
164
|
|
165 AC_CHECK_LIB(m, log10, EXTRA_LIBS="$EXTRA_LIBS -lm")
|
|
166
|
26
|
167 AM_WITH_DMALLOC
|
1
|
168
|
|
169 AC_SUBST(EXTRA_LIBS)
|
|
170 AC_SUBST(READLINE_LIBS)
|
|
171 AC_SUBST(GFTP_TEXT)
|
|
172
|
|
173 GFTP_GTK=""
|
|
174 PTHREAD_CFLAGS=""
|
|
175 PTHREAD_LIBS=""
|
33
|
176
|
|
177 # I don't have PKG_CHECK_MODULES or AM_PATH_GLIB check for gthread because
|
|
178 # the text port doesn't need to be compiled against the thread libraries
|
|
179 GTHREAD_LIBS=""
|
|
180
|
81
|
181 if test "x$enable_gtkport" = "xyes" ; then
|
|
182 if test $found_glib20 = 1 -a "x$enable_gtk20" = "xyes" ; then
|
57
|
183 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
|
184 fi
|
|
185
|
|
186 if test "x$GFTP_GTK" = "x" ; then
|
|
187 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
|
188 GTHREAD_LIBS="-lgthread"
|
|
189 else
|
|
190 GTHREAD_LIBS="-lgthread-2.0"
|
1
|
191 fi
|
|
192
|
|
193 if test "x$GFTP_GTK" = xgftp-gtk; then
|
|
194 AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIBS="-lpthread")
|
|
195
|
|
196 if test "x$PTHREAD_LIBS" = x ; then
|
|
197 AC_CHECK_LIB(pthreads, pthread_create, PTHREAD_LIBS="-lpthreads")
|
|
198 fi
|
|
199
|
|
200 if test "x$PTHREAD_LIBS" = x ; then
|
|
201 AC_CHECK_LIB(c_r, pthread_create, PTHREAD_LIBS="-lc_r")
|
|
202 fi
|
|
203
|
|
204 if test "x$PTHREAD_LIBS" = x ; then
|
|
205 echo ;
|
|
206 echo "Error: Cannot find the pthread libraries. If you don't have them installed," ;
|
|
207 echo "your X libraries probably aren't thread safe either. You can download the" ;
|
|
208 echo "pthread library and the thread safe X libraries from my webpage at" ;
|
|
209 echo "http://www.gftp.org/. Note the pthread library and the thread safe" ;
|
|
210 echo "X libraries on my webpage are for Linux libc5 machines ONLY" ;
|
|
211 echo ;
|
|
212 exit
|
|
213 fi
|
|
214
|
|
215 PTHREAD_CFLAGS="-D_REENTRANT"
|
|
216
|
|
217 # I took some of these from the glib 1.3.3 configure.in
|
|
218 case $host in
|
|
219 *-hpux*)
|
|
220 # From H.Merijn Brand <h.m.brand@hccnet.nl>
|
|
221 echo '#define pthread_attr_init(x) __pthread_attr_init_system(x)'
|
|
222 +>>confdefs.h
|
|
223 ;;
|
|
224 *-aix*)
|
|
225 PTHREAD_CFLAGS="$PTHREAD_CFLAGS -D_THREAD_SAFE"
|
|
226 if test x"$GCC" = xyes; then
|
|
227 PTHREAD_CFLAGS="$PTHREAD_CFLAGS -mthreads"
|
|
228 fi
|
|
229 ;;
|
|
230 *-freebsd*)
|
|
231 PTHREAD_CFLAGS="$PTHREAD_CFLAGS -D_THREAD_SAFE"
|
|
232
|
|
233 # FreeBSD 2.2.x shiped with gcc 2.7.2.x, which doesn't support
|
|
234 # -mthreads flag.
|
|
235 ;;
|
|
236 *-openbsd*)
|
|
237 PTHREAD_CFLAGS="$PTHREAD_CFLAGS -D_THREAD_SAFE"
|
|
238 if test "x$PTHREAD_LIBS" = "x-lc_r"; then
|
|
239 PTHREAD_LIBS="-pthread"
|
|
240 fi
|
|
241 ;;
|
|
242 *-sysv5uw7*) # UnixWare 7
|
|
243 if test "$GCC" != "yes"; then
|
|
244 PTHREAD_CFLAGS="$PTHREAD_CFLAGS -Kthread"
|
|
245 else
|
|
246 PTHREAD_CFLAGS="$PTHREAD_CFLAGS -pthread"
|
|
247 fi
|
|
248 ;;
|
|
249 *-dg-dgux*) # DG/UX
|
|
250 PTHREAD_CFLAGS="$PTHREAD_CFLAGS -D_POSIX4A_DRAFT10_SOURCE"
|
|
251 esac
|
|
252 fi
|
|
253 fi
|
|
254 AC_SUBST(PTHREAD_CFLAGS)
|
|
255 AC_SUBST(PTHREAD_LIBS)
|
33
|
256 AC_SUBST(GTHREAD_LIBS)
|
1
|
257 AC_SUBST(GFTP_GTK)
|
|
258
|
28
|
259 AM_GNU_GETTEXT
|
1
|
260
|
87
|
261 AC_OUTPUT(Makefile docs/Makefile docs/sample.gftp/Makefile intl/Makefile lib/Makefile po/Makefile.in src/gftp src/Makefile src/gtk/Makefile src/text/Makefile gftp.spec)
|