comparison configure.in @ 1:8b1883341c6f

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