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