2 dnl originally from ncftp 2.3.0
3 dnl added wi_EXTRA_PDIR and wi_ANSI_C
6 AC_DEFUN([wi_EXTRA_IDIR], [
8 if test -r $incdir ; then
10 for CPPflag in $CPPFLAGS ; do
11 if test "_$CPPflag" = "_-I${incdir}" ; then
16 if test -n "$already" ; then
17 echo " + already had -I$incdir" 1>&AS_MESSAGE_LOG_FD
19 if test "$CPPFLAGS" = "" ; then
22 CPPFLAGS="$CPPFLAGS -I$incdir"
24 echo " + added -I$incdir" 1>&AS_MESSAGE_LOG_FD
27 echo " + IDIR is not accessible: '$myincdir'" 1>&AS_MESSAGE_LOG_FD
34 AC_DEFUN([wi_EXTRA_LDIR], [
36 if test -r $mylibdir ; then
38 for LDflag in $LDFLAGS ; do
39 if test "_$LDflag" = "_-L${mylibdir}" ; then
44 if test -n "$already" ; then
45 echo " + already had -L$mylibdir" 1>&AS_MESSAGE_LOG_FD
47 if test "$LDFLAGS" = "" ; then
50 LDFLAGS="$LDFLAGS -L$mylibdir"
52 echo " + added -L$mylibdir" 1>&AS_MESSAGE_LOG_FD
55 echo " + LDIR is not accessible: '$mylibdir'" 1>&AS_MESSAGE_LOG_FD
62 AC_DEFUN([wi_EXTRA_PDIR], [
64 if test -r $progdir ; then
67 echo " + already had $progdir in \$PATH" 1>&AS_MESSAGE_LOG_FD
70 if test "$PATH" = "" ; then
75 echo " + appended $progdir to \$PATH" 1>&AS_MESSAGE_LOG_FD
79 echo " + PDIR is not accessible: '$progdir'" 1>&AS_MESSAGE_LOG_FD
84 dnl If you want to also look for include and lib subdirectories in the
85 dnl $HOME tree, you supply "yes" as the first argument to this macro.
87 dnl If you want to look for subdirectories in include/lib directories,
88 dnl you pass the names in argument 3, otherwise pass a dash.
90 AC_DEFUN([wi_EXTRA_DIRS], [echo "checking for extra include and lib directories..." 1>&6
91 ifelse([$1], yes, [dnl
94 exdirs="$HOME $j $b1 $b2 $prefix $2"
99 if test "$subexdirs" = "" ; then
102 for subexdir in $subexdirs ; do
103 if test "$subexdir" = "-" ; then
106 subexdir="/$subexdir"
108 for exdir in $exdirs ; do
109 if test "$exdir" != "/usr" || test "$subexdir" != ""; then
110 incdir="${exdir}/include${subexdir}"
111 wi_EXTRA_IDIR($incdir)
113 dnl On 64-bit machines, if lib64/ exists and is not identical to lib/
114 dnl then it should be listed here, listed ahead of lib/.
115 mylibdir64="${exdir}/lib64${subexdir}"
116 mylibdir32="${exdir}/lib${subexdir}"
118 if test "x86_64" = $(uname -m) \
119 -a ! ${mylibdir64} -ef ${mylibdir32} ; then
120 wi_EXTRA_LDIR($mylibdir64)
123 wi_EXTRA_LDIR($mylibdir32)
125 progdir="${exdir}/bin${subexdir}"
126 wi_EXTRA_PDIR($progdir)
134 AC_DEFUN([wi_HPUX_CFLAGS],
135 [AC_MSG_CHECKING(if HP-UX ansi C compiler flags are needed)
136 AC_REQUIRE([AC_PROG_CC])
137 os=`uname -s | tr '[A-Z]' '[a-z]'`
139 if test "$os" = hp-ux ; then
140 if test "$ac_cv_prog_gcc" = yes ; then
141 if test "$CFLAGS" != "" ; then
142 # Shouldn't be in there.
143 CFLAGS=`echo "$CFLAGS" | sed 's/-Aa//g'`
146 # If you're not using gcc, then you better have a cc/c89
147 # that is usable. If you have the barebones compiler, it
148 # won't work. The good compiler uses -Aa for the ANSI
150 x=`echo $CFLAGS | grep 'Aa' 2>/dev/null`
151 if test "$x" = "" ; then
156 # Also add _HPUX_SOURCE to get the extended namespace.
157 x=`echo $CFLAGS | grep '_HPUX_SOURCE' 2>/dev/null`
158 if test "$x" = "" ; then
159 CFLAGS="$CFLAGS -D_HPUX_SOURCE"
162 AC_MSG_RESULT($ac_cv_hpux_flags)
167 AC_DEFUN([wi_CFLAGS], [AC_REQUIRE([AC_PROG_CC])
169 if test "$CFLAGS" = "" ; then
171 elif test "$ac_cv_prog_gcc" = "yes" ; then
174 #echo "using -g as default gcc CFLAGS" 1>&6
175 CFLAGS=`echo $CFLAGS | sed 's/-g\ -O/-O/'`
178 # Leave the -g, but remove all -O options.
179 #echo "using -g as default gcc CFLAGS" 1>&6
180 CFLAGS=`echo $CFLAGS | sed 's/-O\ -g/-O/'`
188 AC_DEFUN([wi_PROTOTYPES], [
189 AC_MSG_CHECKING(if the compiler supports function prototypes)
190 AC_TRY_COMPILE(,[extern void exit(int status);],[wi_cv_prototypes=yes
191 AC_DEFINE(PROTOTYPES)],wi_cv_prototypes=no)
192 AC_MSG_RESULT($wi_cv_prototypes)
197 AC_DEFUN([wi_ANSI_C], [
198 AC_MSG_CHECKING(ANSI-style function definitions)
199 AC_TRY_COMPILE(,[int blubb(int x) { return 0; }],[wi_cv_ansi_funcs=yes
200 AC_DEFINE(ANSI_FUNCS)],wi_cv_ansi_funcs=no)
201 AC_MSG_RESULT($wi_cv_ansi_funcs)
206 AC_DEFUN([wi_HEADER_SYS_SELECT_H], [
207 # See if <sys/select.h> is includable after <sys/time.h>
208 if test "$ac_cv_header_sys_time_h" = no ; then
209 AC_CHECK_HEADERS(sys/time.h sys/select.h)
211 AC_CHECK_HEADERS(sys/select.h)
213 if test "$ac_cv_header_sys_select_h" = yes ; then
214 AC_MSG_CHECKING([if <sys/select.h> is compatible with <sys/time.h>])
216 if test "$ac_cv_header_sys_time_h" = yes ; then
217 AC_TRY_COMPILE([#include <sys/time.h>
218 #include <sys/select.h>],[
220 struct timeval tmval;
222 tmval.tv_sec = 0;],selecth=yes,selecth=no)
224 if test "$selecth" = yes ; then
225 AC_DEFINE(CAN_USE_SYS_SELECT_H)
228 AC_MSG_RESULT($selecth)
234 AC_DEFUN([wi_LIB_RESOLV], [
235 # See if we could access two well-known sites without help of any special
236 # libraries, like resolv.
239 #include <sys/types.h>
240 #include <sys/socket.h>
241 #include <netinet/in.h>
246 struct hostent *hp1, *hp2;
249 hp1 = gethostbyname("gatekeeper.dec.com");
250 hp2 = gethostbyname("ftp.ncsa.uiuc.edu");
251 result = ((hp1 != (struct hostent *) 0) && (hp2 != (struct hostent *) 0));
253 }],look_for_resolv=no,look_for_resolv=yes,look_for_resolv=yes)
255 AC_MSG_CHECKING([if we need to look for -lresolv])
256 AC_MSG_RESULT($look_for_resolv)
257 if test "$look_for_resolv" = yes ; then
258 AC_CHECK_LIB(resolv,main)
267 AC_DEFUN([wi_LIB_NSL], [
268 AC_MSG_CHECKING(if we can use -lnsl)
269 ac_save_LIBS="$LIBS";
271 AC_CACHE_VAL(r_cv_use_libnsl, [
273 main() { if (getpwuid(getuid())) exit(0); exit(-1); },
274 nc_cv_use_libnsl=yes, nc_cv_use_libnsl=no, nc_cv_use_libnsl=no)
276 if test "$nc_cv_use_libnsl" = "no"; then LIBS="$ac_save_LIBS"; fi
277 AC_MSG_RESULT($nc_cv_use_libnsl)
284 AC_DEFUN([nc_PATH_PROG_ZCAT], [
285 AC_PATH_PROG(GZCAT,gzcat)
286 AC_PATH_PROG(ZCAT,zcat)
287 if test "x$GZCAT" = x ; then
288 if test "x$ZCAT" != x ; then
289 # See if zcat is really gzcat. gzcat has a --version option, regular
291 AC_MSG_CHECKING(if zcat is really gzcat in disguise)
292 if $ZCAT --version 2> /dev/null ; then
293 AC_DEFINE_UNQUOTED(GZCAT, "$ZCAT")
300 AC_DEFINE_UNQUOTED(GZCAT, "$GZCAT")
303 if test "x$ZCAT" != x ; then
304 AC_DEFINE_UNQUOTED(ZCAT, "$ZCAT")
310 AC_DEFUN([wi_SYSV_EXTRA_DIRS], [
311 # Use System V because their curses extensions are required. This must
312 # be done early so we use the -I and -L in the library checks also.
313 # This is mostly a Solaris/SunOS hack. Note that doing this will also
314 # use all of the other System V libraries and headers.
316 AC_MSG_CHECKING(for alternative System V libraries)
317 if test -f /usr/5include/curses.h ; then
318 CPPFLAGS="$CPPFLAGS -I/usr/5include"
319 LDFLAGS="$LDFLAGS -L/usr/5lib"
328 AC_DEFUN([wi_DEFINE_UNAME], [
329 # Get first 127 chars of all uname information. Some folks have
330 # way too much stuff there, so grab only the first 127.
331 unam=`uname -a 2>/dev/null | cut -c1-127`
332 if test "$unam" != "" ; then
333 AC_DEFINE_UNQUOTED(UNAME, "$unam")
339 AC_DEFUN([wi_READLINE_WITH_NCURSES], [
340 # Readline and Ncurses could both define "backspace".
341 # Warn about this if we have both things in our definitions list.
343 if test "$ac_cv_lib_readline" = yes && test "$ac_cv_lib_ncurses" = yes ; then
345 AC_MSG_CHECKING(if readline and ncurses will link together)
347 LIBS="-lreadline -lncurses"
352 if test "$k" = no ; then
354 # Remove '-lreadline' from LIBS.
355 LIBS=`echo $j | sed s/-lreadline//g`
356 ac_cv_lib_readline=no
357 AC_WARN([The versions of GNU readline and ncurses you have installed on this system
358 can't be used together, because they use the same symbol, backspace. If
359 possible, recompile one of the libraries with -Dbackspace=back_space, then
374 dnl Check for an external variable daylight. Stolen from w3c-libwww.
375 AC_DEFUN([AC_EXT_DAYLIGHT],
376 [ AC_MSG_CHECKING(int daylight variable)
377 AC_TRY_COMPILE([#include <time.h>], [return daylight;],
380 AC_MSG_RESULT($have_daylight)
384 dnl Check for an external variable timezone. Stolen from tcl-8.0.
385 AC_DEFUN([AC_EXT_TIMEZONE],
388 # Its important to include time.h in this check, as some systems (like convex)
389 # have timezone functions, etc.
392 AC_MSG_CHECKING([long timezone variable])
393 AC_TRY_COMPILE([#include <time.h>],
394 [extern long timezone;
402 # On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
404 if test "$have_timezone" = no; then
405 AC_MSG_CHECKING([time_t timezone variable])
406 AC_TRY_COMPILE([#include <time.h>],
407 [extern time_t timezone;
416 ## AC_BZ_SET_COMPILER: Addition by Theodore Papadopoulo
417 ## Patch by Jim McKelvey: change sed -e 's/ /@/g' to sed -e 's/ /@/'
418 AC_DEFUN([AC_SG_SET_COMPILER],
419 [cxxwith=`echo $1 | sed -e 's/ /@/'`
421 *:*@*) # Full initialization syntax
422 CXX=`echo "$cxxwith" | sed -n -e 's/.*:\(.*\)@.*/\1/p'`
423 CXXFLAGS=`echo "$cxxwith" | sed -n -e 's/.*:.*@\(.*\)/\1/p'`
425 *:*) # Simple initialization syntax
426 CXX=`echo "$cxxwith" | sed -n -e 's/.*:\(.*\)/\1/p'`
437 pushdef([AC_PROG_INSTALL],
439 dnl our own version, testing for a -p flag
440 popdef([AC_PROG_INSTALL])
441 dnl as AC_PROG_INSTALL works as it works we first have
442 dnl to save if the user didn't specify INSTALL, as the
443 dnl autoconf one overwrites INSTALL and we have no chance to find
447 # OK, user hasn't given any INSTALL, autoconf found one for us
448 # now we test, if it supports the -p flag
449 AC_MSG_CHECKING(for -p flag to install)
450 rm -f confinst.$$.* > /dev/null 2>&1
451 echo "Testtest" > confinst.$$.orig
453 if ${INSTALL} -p confinst.$$.orig confinst.$$.new > /dev/null 2>&1 ; then
454 if test -f confinst.$$.new ; then
455 # OK, -p seems to do no harm to install
456 INSTALL="${INSTALL} -p"
461 AC_MSG_RESULT($ac_res)
462 dnl the following tries to resolve some signs and wonders coming up
463 dnl with different autoconf/automake versions
465 dnl *automake 1.4 install-strip sets A_M_INSTALL_PROGRAM_FLAGS to -s
466 dnl and has INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(A_M_INSTALL_PROGRAM_FLAGS)
467 dnl it header-vars.am, so there the actual INSTALL_PROGRAM gets the -s
468 dnl *automake 1.4a (and above) use INSTALL_STRIP_FLAG and only has
469 dnl INSTALL_PROGRAM = @INSTALL_PROGRAM@ there, but changes the
470 dnl install-@DIR@PROGRAMS targets to explicitly use that flag
471 dnl *autoconf 2.13 is dumb, and thinks it can use INSTALL_PROGRAM as
472 dnl INSTALL_SCRIPT, which breaks with automake <= 1.4
473 dnl *autoconf >2.13 (since 10.Apr 1999) has not that failure
474 dnl to clean up that mess we:
475 dnl +set INSTALL_PROGRAM to use INSTALL_STRIP_FLAG
476 dnl which cleans KDE's program with automake > 1.4;
477 dnl +set INSTALL_SCRIPT to only use INSTALL, to clean up autoconf's problems
478 dnl with automake<=1.4
479 dnl note that dues to this sometimes two '-s' flags are used
480 INSTALL_PROGRAM='${INSTALL} $(INSTALL_STRIP_FLAG)'
481 INSTALL_SCRIPT='${INSTALL}'
484 # ===========================================================================
485 # http://autoconf-archive.cryp.to/ax_boost_base.html
486 # ===========================================================================
490 # AX_BOOST_BASE([MINIMUM-VERSION])
494 # Test for the Boost C++ libraries of a particular version (or newer)
496 # If no path to the installed boost library is given the macro searchs
497 # under /usr, /usr/local, /opt and /opt/local and evaluates the
498 # $BOOST_ROOT environment variable. Further documentation is available at
499 # <http://randspringer.de/boost/index.html>.
503 # AC_SUBST(BOOST_CPPFLAGS) / AC_SUBST(BOOST_LDFLAGS)
515 # Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
517 # Copying and distribution of this file, with or without modification, are
518 # permitted in any medium without royalty provided the copyright notice
519 # and this notice are preserved.
521 AC_DEFUN([AX_BOOST_BASE],
524 AS_HELP_STRING([--with-boost@<:@=DIR@:>@], [use boost (default is yes) - it is possible to specify the root directory for boost (optional)]),
526 if test "$withval" = "no"; then
528 elif test "$withval" = "yes"; then
533 ac_boost_path="$withval"
539 AC_ARG_WITH([boost-libdir],
540 AS_HELP_STRING([--with-boost-libdir=LIB_DIR],
541 [Force given directory for boost libraries. Note that this will overwrite library path detection, so use this parameter only if default library detection fails and you know exactly where your boost libraries are located.]),
545 ac_boost_lib_path="$withval"
547 AC_MSG_ERROR(--with-boost-libdir expected directory name)
550 [ac_boost_lib_path=""]
553 if test "x$want_boost" = "xyes"; then
554 boost_lib_version_req=ifelse([$1], ,1.20.0,$1)
555 boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'`
556 boost_lib_version_req_major=`expr $boost_lib_version_req : '\([[0-9]]*\)'`
557 boost_lib_version_req_minor=`expr $boost_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
558 boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
559 if test "x$boost_lib_version_req_sub_minor" = "x" ; then
560 boost_lib_version_req_sub_minor="0"
562 WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+ $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor`
563 AC_MSG_CHECKING(for boostlib >= $boost_lib_version_req)
566 dnl first we check the system location for boost libraries
567 dnl this location ist chosen if boost libraries are installed with the --layout=system option
568 dnl or if you install boost with RPM
569 if test "$ac_boost_path" != ""; then
570 BOOST_LDFLAGS="-L$ac_boost_path/lib"
571 BOOST_CPPFLAGS="-I$ac_boost_path/include"
573 for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
574 if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then
575 BOOST_LDFLAGS="-L$ac_boost_path_tmp/lib"
576 BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include"
582 dnl overwrite ld flags if we have required special directory with
583 dnl --with-boost-libdir parameter
584 if test "$ac_boost_lib_path" != ""; then
585 BOOST_LDFLAGS="-L$ac_boost_lib_path"
588 CPPFLAGS_SAVED="$CPPFLAGS"
589 CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
592 LDFLAGS_SAVED="$LDFLAGS"
593 LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
597 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
598 @%:@include <boost/version.hpp>
600 #if BOOST_VERSION >= $WANT_BOOST_VERSION
601 // Everything is okay
603 # error Boost version is too old
615 dnl if we found no boost with system layout we search for boost libraries
616 dnl built and installed without the --layout=system option or for a staged(not installed) version
617 if test "x$succeeded" != "xyes"; then
619 if test "$ac_boost_path" != ""; then
620 if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
621 for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
622 _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
623 V_CHECK=`expr $_version_tmp \> $_version`
624 if test "$V_CHECK" = "1" ; then
625 _version=$_version_tmp
627 VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
628 BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE"
632 for ac_boost_path in /usr /usr/local /opt /opt/local ; do
633 if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
634 for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
635 _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
636 V_CHECK=`expr $_version_tmp \> $_version`
637 if test "$V_CHECK" = "1" ; then
638 _version=$_version_tmp
639 best_path=$ac_boost_path
645 VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
646 BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE"
647 if test "$ac_boost_lib_path" = ""
649 BOOST_LDFLAGS="-L$best_path/lib"
652 if test "x$BOOST_ROOT" != "x"; then
653 if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/lib" && test -r "$BOOST_ROOT/stage/lib"; then
654 version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'`
655 stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'`
656 stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'`
657 V_CHECK=`expr $stage_version_shorten \>\= $_version`
658 if test "$V_CHECK" = "1" -a "$ac_boost_lib_path" = "" ; then
659 AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT)
660 BOOST_CPPFLAGS="-I$BOOST_ROOT"
661 BOOST_LDFLAGS="-L$BOOST_ROOT/stage/lib"
667 CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
669 LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
673 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
674 @%:@include <boost/version.hpp>
676 #if BOOST_VERSION >= $WANT_BOOST_VERSION
677 // Everything is okay
679 # error Boost version is too old
690 if test "$succeeded" != "yes" ; then
691 if test "$_version" = "0" ; then
692 AC_MSG_ERROR([[We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.]])
694 AC_MSG_ERROR([Your boost libraries seems to old (version $_version).])
697 AC_SUBST(BOOST_CPPFLAGS)
698 AC_SUBST(BOOST_LDFLAGS)
699 AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available])
702 CPPFLAGS="$CPPFLAGS_SAVED"
703 LDFLAGS="$LDFLAGS_SAVED"