Added ncftp to rosapps
[reactos.git] / rosapps / net / ncftp / libncftp / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(rcmd.c)
3 AC_PREREQ(2.4)
4 AC_CONFIG_HEADER(config.h)
5
6 nc_cv_socks5=no
7 no_signals=yes
8
9 AC_ARG_ENABLE(socks5,[ --enable-socks5 try to find and use the socks5 library],nc_cv_socks5=yes,nc_cv_socks5=no)
10 AC_ARG_ENABLE(signals,[ --enable-signals allow use of signal handling],[no_signals=no])
11
12
13 wi_OS_VAR
14
15 changequote(<<, >>)dnl
16 MAINDIR=`pwd`
17 if test -f "$MAINDIR/dos2unix.sh" ; then
18 chmod u+rwx $MAINDIR/dos2unix.sh
19 for dir in . ../sio ../Strn ; do
20 if [ -d "$dir" ] ; then
21 dir=`cd "$dir" ; pwd`
22 find "$dir" -name '*.in' -exec "$MAINDIR/dos2unix.sh" {} \;
23 find "$dir" -name '*.h' -exec "$MAINDIR/dos2unix.sh" {} \;
24 find "$dir" -name '*.c' -exec "$MAINDIR/dos2unix.sh" {} \;
25 fi
26 done
27 fi
28 MAKE=make
29 STATIC=""
30 BDYNAMIC="# -Wl,-Bdynamic"
31 BSTATIC="# -Wl,-Bstatic"
32 LIBSET='$(LIB)'
33 Z31=''
34 Z32=''
35 Z33=''
36 Z34=''
37 REDWING='no'
38 SFLAG='-s'
39
40 case "$host" in
41 redwing*) CC=cc
42 LDFLAGS=''
43 STATIC=''
44 Z31=' -@mv $(STGZFILE) newbin/'
45 Z32=' -@mv $(DTGZFILE) newbin/'
46 Z33=' -@mv $(MTGZFILE) newbin/'
47 Z34=' -@mv $(PTGZFILE) newbin/'
48 REDWING='yes'
49 ;;
50 esac
51
52 case "$os" in
53 linux)
54 BDYNAMIC="-Wl,-Bdynamic"
55 BSTATIC="-Wl,-Bstatic"
56 if [ "$MAKEWORLD_SH" = "" ] ; then
57 LIBSET='$(LIBSO) $(LIB)'
58 fi
59 ;;
60 freebsd)
61 BDYNAMIC="-Wl,-Bdynamic"
62 BSTATIC="-Wl,-Bstatic"
63 ;;
64 macosx*|rhapsody)
65 SFLAG='-Wl,-x'
66 ;;
67 esac
68
69 changequote([, ])dnl
70
71 AC_SUBST(CC)
72 AC_SUBST(CFLAGS)
73 AC_SUBST(CPPFLAGS)
74 AC_SUBST(LDFLAGS)
75 AC_SUBST(STATIC)
76 AC_SUBST(SFLAG)
77 AC_SUBST(LIBS)
78 AC_SUBST(DEFS)
79 AC_SUBST(MAKE)
80 AC_SUBST(Z31)
81 AC_SUBST(Z32)
82 AC_SUBST(Z33)
83 AC_SUBST(Z34)
84 AC_SUBST(LIBSET)
85 AC_SUBST(BDYNAMIC)
86 AC_SUBST(BSTATIC)
87 AC_SUBST(MAINDIR)
88
89 if test -f ./samples/ncftpput2probe.c ; then
90 PROBE="ncftpget2probe ncftpput2probe"
91 else
92 PROBE=""
93 fi
94 AC_SUBST(PROBE)
95
96 AC_PROG_CC
97 wi_REQUEST_NO_Y2K_WARNINGS
98 wi_CFLAGS_LFS64
99 wi_DEFINE_UNAME
100
101 if test -f /usr/src/include/eos.h ; then
102 if test "$REDWING" = no ; then
103 prefix=/usr/src
104 fi
105 fi
106
107 if test "$wi_cv_prototypes" = no ; then
108 AC_WARN([Your compiler is probably won't be able to compile the package.])
109 AC_WARN([Get gcc, or any compiler that supports function prototypes.])
110 fi
111
112 dnl # See if we should add -I/usr/local/include -L/usr/local/lib, etc.
113 dnl wi_EXTRA_DIRS(yes, /usr/local /usr/ccs, -)
114
115 dnl For the sample programs.
116 wi_NET_LIBS
117
118 if test "$nc_cv_socks5" = yes ; then
119 # Look for the "SOCKS" library for use with Firewalls/Gateways.
120 savelibs="$LIBS"
121 AC_CHECK_LIB(db, main)
122 AC_CHECK_LIB(isode, main)
123 AC_CHECK_LIB(com_err, main)
124 AC_CHECK_LIB(crypto, main)
125 AC_CHECK_LIB(krb5, main)
126 AC_CHECK_LIB(gssapi_krb5, main)
127 AC_CHECK_LIB(socks5,SOCKSinit)
128 if test "$ac_cv_lib_socks5" = yes ; then
129 nc_cv_socks=no
130 else
131 LIBS="$savelibs"
132 fi
133 else
134 ac_cv_lib_socks5=no
135 fi
136
137
138 dnl Checks for header files.
139 AC_HEADER_STDC
140 AC_CHECK_HEADERS(sys/time.h unistd.h utime.h nserve.h resolv.h arpa/nameser.h)
141 AC_TIME_WITH_SYS_TIME
142
143 dnl Checks for typedefs, structures, and compiler characteristics.
144 AC_C_CONST
145 AC_TYPE_SIZE_T
146 AC_TYPE_OFF_T
147 AC_TYPE_MODE_T
148 AC_TYPE_PID_T
149 AC_TYPE_UID_T
150 wi__RES_DEFDNAME
151 wi_USE_LONG_LONG
152
153 dnl Checks for library functions.
154 if test "$SYS" != sunos ; then
155 # Use getwd on SunOS -- getcwd does a "popen("/bin/pwd")" -- aaaccck.
156 #
157 AC_CHECK_FUNCS(getcwd)
158 fi
159 AC_CHECK_FUNCS(getwd gethostname socket strerror strstr)
160 AC_CHECK_FUNCS(getpass strcasecmp getdomainname mktime symlink inet_ntop)
161 AC_CHECK_FUNCS(res_init snprintf vsnprintf strtoq sigaction waitpid)
162 AC_CHECK_FUNCS(open64 stat64 fstat64 lstat64 lseek64 llseek)
163 wi_FUNC_SIGSETJMP
164 AC_FUNC_SETVBUF_REVERSED
165
166 wi_HEADER_SYS_SELECT_H
167 AC_FUNC_SELECT_ARGTYPES
168
169 if test -f ../sio/sio.h ; then
170 ldir=`cd ../sio ; pwd`
171 LDFLAGS="$LDFLAGS -L${ldir}"
172 CPPFLAGS="$CPPFLAGS -I${ldir}"
173 LIBS="$LIBS -lsio"
174 fi
175
176 if test -f ../Strn/Strn.h ; then
177 ldir=`cd ../Strn ; pwd`
178 LDFLAGS="$LDFLAGS -L${ldir}"
179 CPPFLAGS="$CPPFLAGS -I${ldir}"
180 LIBS="$LIBS -lStrn"
181 fi
182
183 if test $ac_cv_func_getcwd = no && test $ac_cv_func_getwd = no ; then
184 AC_WARN(This system does not have either getwd or getcwd?)
185 AC_WARN(I find that a little hard to believe.)
186 AC_WARN(You may want to try -DHAVE_GETWD anyway.)
187 AC_WARN([
188 This could also mean that your compiler isn't working])
189 AC_WARN(with this configure script. Check the ./config.log)
190 AC_WARN(and look for anomalies.)
191 fi
192
193 wi_PROG_TAR
194 AC_PROG_RANLIB
195
196 if test "$LONGEST_INT" = "long long" ; then
197 if sed 's/^#define longest_int.*/#define longest_int long long/;
198 s/^#define longest_uint.*/#define longest_uint unsigned long long/' ncftp.h > temp.h ; then
199 mv temp.h ncftp.h
200 chmod a+r ncftp.h
201 fi
202 else
203 if sed 's/^#define longest_int.*/#define longest_int long/;
204 s/^#define longest_uint.*/#define longest_uint unsigned long/' ncftp.h > temp.h ; then
205 mv temp.h ncftp.h
206 chmod a+r ncftp.h
207 fi
208 fi
209
210 CPPFLAGS="-I$MAINDIR $CPPFLAGS"
211
212 if test "$no_signals" = no ; then
213 dv1='# if 0'
214 dv2='#if 0'
215 else
216 dv1='# if 1'
217 dv2='#if 1'
218 fi
219
220 if sed "s!^.*/. %config1!${dv1} /* %config1!;s!^.*/. %config2!${dv2} /* %config2!" ncftp.h > temp.h ; then
221 mv temp.h ncftp.h
222 chmod a+r ncftp.h
223 fi
224
225 if sed "s!^.*/. %config1!${dv1} /* %config1!;s!^.*/. %config2!${dv2} /* %config2!" syshdrs.h > temp.h ; then
226 mv temp.h syshdrs.h
227 chmod a+r syshdrs.h
228 fi
229
230 changequote(<<, >>)dnl
231 #
232 # Configure sio specially, like it would do.
233 #
234 if [ -d ../sio ] ; then
235 if sed "s!^.*/. %config1!${dv1} /* %config1!;s!^.*/. %config2!${dv2} /* %config2!" ../sio/sio.h > temp.h ; then
236 mv temp.h ../sio/sio.h
237 chmod a+r ../sio/sio.h
238 fi
239 if sed "s!^.*/. %config1!${dv1} /* %config1!;s!^.*/. %config2!${dv2} /* %config2!" ../sio/usio.h > temp.h ; then
240 mv temp.h ../sio/usio.h
241 chmod a+r ../sio/usio.h
242 fi
243
244 patterns1=""
245 patterns2=""
246 if [ "$SYS" = solaris ] ; then
247 patterns1='s!/. %configure%.*!#define SAccept SAcceptS!'
248 patterns2='s!/. %configure%.*!#define UAccept UAcceptS!'
249 fi
250
251 if [ "$patterns1" != "" ] ; then
252 sed "$patterns1" < ../sio/sio.h > tmpfile
253 if [ $? -eq 0 ] ; then
254 mv tmpfile ../sio/sio.h
255 chmod 644 ../sio/sio.h
256 else
257 /bin/rm tmpfile
258 fi
259 fi
260
261 if [ "$patterns2" != "" ] ; then
262 sed "$patterns2" < ../sio/usio.h > tmpfile
263 if [ $? -eq 0 ] ; then
264 mv tmpfile ../sio/usio.h
265 chmod 644 ../sio/usio.h
266 else
267 /bin/rm tmpfile
268 fi
269 fi
270 fi
271 changequote([, ])dnl
272
273 if test -d bin.only ; then
274 binonly="bin.only/Makefile bin.only/samples/Makefile"
275 else
276 binonly=""
277 fi
278
279 LIBS=`echo "$LIBS" | sed 's/^ *//;s/ *$//;s/ */ /g'`
280 LDFLAGS=`echo "$LDFLAGS" | sed 's/^ *//;s/ *$//;s/ */ /g'`
281 CPPFLAGS=`echo "$CPPFLAGS" | sed 's/^ *//;s/ *$//;s/ */ /g'`
282 CFLAGS=`echo "$CFLAGS" | sed 's/^ *//;s/ *$//;s/ */ /g'`
283 DEFS=`echo "$DEFS" | sed 's/^ *//;s/ *$//;s/ */ /g'`
284
285 samples=''
286 for sample in minincftp monkey ncftpget ncftpput ncftpls simpleget ncftpsyncput misc ; do
287 if test -f samples/$sample/Makefile.in ; then
288 samples="$samples samples/$sample/Makefile"
289 fi
290 done
291
292 AC_OUTPUT([Makefile ../Strn/Makefile ../sio/Makefile $samples $binonly])