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
11 # echo " + already had $incdir" 1>&6
14 if test "$CPPFLAGS" = "" ; then
17 CPPFLAGS="$CPPFLAGS -I$incdir"
19 echo " + found $incdir" 1>&6
28 AC_DEFUN([wi_EXTRA_LDIR], [
30 if test -r $mylibdir ; then
33 # echo " + already had $mylibdir" 1>&6
36 if test "$LDFLAGS" = "" ; then
39 LDFLAGS="$LDFLAGS -L$mylibdir"
41 echo " + found $mylibdir" 1>&6
50 AC_DEFUN([wi_EXTRA_PDIR], [
52 if test -r $progdir ; then
55 # echo " + already had $progdir" 1>&6
58 # echo " + already had $progdir" 1>&6
61 if test "$PATH" = "" ; then
66 echo " + found $progdir" 1>&6
73 dnl If you want to also look for include and lib subdirectories in the
74 dnl $HOME tree, you supply "yes" as the first argument to this macro.
76 dnl If you want to look for subdirectories in include/lib directories,
77 dnl you pass the names in argument 3, otherwise pass a dash.
79 AC_DEFUN([wi_EXTRA_DIRS], [echo "checking for extra include and lib directories..." 1>&6
80 ifelse([$1], yes, [dnl
83 exdirs="$HOME $j $b1 $b2 $prefix $2"
88 if test "$subexdirs" = "" ; then
91 for subexdir in $subexdirs ; do
92 if test "$subexdir" = "-" ; then
97 for exdir in $exdirs ; do
98 if test "$exdir" != "/usr" || test "$subexdir" != ""; then
99 incdir="${exdir}/include${subexdir}"
100 wi_EXTRA_IDIR($incdir)
102 mylibdir="${exdir}/lib${subexdir}"
103 wi_EXTRA_LDIR($mylibdir)
105 progdir="${exdir}/bin${subexdir}"
106 wi_EXTRA_PDIR($progdir)
114 AC_DEFUN([wi_HPUX_CFLAGS],
115 [AC_MSG_CHECKING(if HP-UX ansi C compiler flags are needed)
116 AC_REQUIRE([AC_PROG_CC])
117 os=`uname -s | tr '[A-Z]' '[a-z]'`
119 if test "$os" = hp-ux ; then
120 if test "$ac_cv_prog_gcc" = yes ; then
121 if test "$CFLAGS" != "" ; then
122 # Shouldn't be in there.
123 CFLAGS=`echo "$CFLAGS" | sed 's/-Aa//g'`
126 # If you're not using gcc, then you better have a cc/c89
127 # that is usable. If you have the barebones compiler, it
128 # won't work. The good compiler uses -Aa for the ANSI
130 x=`echo $CFLAGS | grep 'Aa' 2>/dev/null`
131 if test "$x" = "" ; then
136 # Also add _HPUX_SOURCE to get the extended namespace.
137 x=`echo $CFLAGS | grep '_HPUX_SOURCE' 2>/dev/null`
138 if test "$x" = "" ; then
139 CFLAGS="$CFLAGS -D_HPUX_SOURCE"
142 AC_MSG_RESULT($ac_cv_hpux_flags)
147 AC_DEFUN([wi_CFLAGS], [AC_REQUIRE([AC_PROG_CC])
149 if test "$CFLAGS" = "" ; then
151 elif test "$ac_cv_prog_gcc" = "yes" ; then
154 #echo "using -g as default gcc CFLAGS" 1>&6
155 CFLAGS=`echo $CFLAGS | sed 's/-g\ -O/-O/'`
158 # Leave the -g, but remove all -O options.
159 #echo "using -g as default gcc CFLAGS" 1>&6
160 CFLAGS=`echo $CFLAGS | sed 's/-O\ -g/-O/'`
168 AC_DEFUN([wi_PROTOTYPES], [
169 AC_MSG_CHECKING(if the compiler supports function prototypes)
170 AC_TRY_COMPILE(,[extern void exit(int status);],[wi_cv_prototypes=yes
171 AC_DEFINE(PROTOTYPES)],wi_cv_prototypes=no)
172 AC_MSG_RESULT($wi_cv_prototypes)
177 AC_DEFUN([wi_ANSI_C], [
178 AC_MSG_CHECKING(ANSI-style function definitions)
179 AC_TRY_COMPILE(,[int blubb(int x) { return 0; }],[wi_cv_ansi_funcs=yes
180 AC_DEFINE(ANSI_FUNCS)],wi_cv_ansi_funcs=no)
181 AC_MSG_RESULT($wi_cv_ansi_funcs)
186 AC_DEFUN([wi_HEADER_SYS_SELECT_H], [
187 # See if <sys/select.h> is includable after <sys/time.h>
188 if test "$ac_cv_header_sys_time_h" = no ; then
189 AC_CHECK_HEADERS(sys/time.h sys/select.h)
191 AC_CHECK_HEADERS(sys/select.h)
193 if test "$ac_cv_header_sys_select_h" = yes ; then
194 AC_MSG_CHECKING([if <sys/select.h> is compatible with <sys/time.h>])
196 if test "$ac_cv_header_sys_time_h" = yes ; then
197 AC_TRY_COMPILE([#include <sys/time.h>
198 #include <sys/select.h>],[
200 struct timeval tmval;
202 tmval.tv_sec = 0;],selecth=yes,selecth=no)
204 if test "$selecth" = yes ; then
205 AC_DEFINE(CAN_USE_SYS_SELECT_H)
208 AC_MSG_RESULT($selecth)
214 AC_DEFUN([wi_LIB_RESOLV], [
215 # See if we could access two well-known sites without help of any special
216 # libraries, like resolv.
219 #include <sys/types.h>
220 #include <sys/socket.h>
221 #include <netinet/in.h>
226 struct hostent *hp1, *hp2;
229 hp1 = gethostbyname("gatekeeper.dec.com");
230 hp2 = gethostbyname("ftp.ncsa.uiuc.edu");
231 result = ((hp1 != (struct hostent *) 0) && (hp2 != (struct hostent *) 0));
233 }],look_for_resolv=no,look_for_resolv=yes,look_for_resolv=yes)
235 AC_MSG_CHECKING([if we need to look for -lresolv])
236 AC_MSG_RESULT($look_for_resolv)
237 if test "$look_for_resolv" = yes ; then
238 AC_CHECK_LIB(resolv,main)
247 AC_DEFUN([wi_LIB_NSL], [
248 AC_MSG_CHECKING(if we can use -lnsl)
249 ac_save_LIBS="$LIBS";
251 AC_CACHE_VAL(r_cv_use_libnsl, [
253 main() { if (getpwuid(getuid())) exit(0); exit(-1); },
254 nc_cv_use_libnsl=yes, nc_cv_use_libnsl=no, nc_cv_use_libnsl=no)
256 if test "$nc_cv_use_libnsl" = "no"; then LIBS="$ac_save_LIBS"; fi
257 AC_MSG_RESULT($nc_cv_use_libnsl)
264 AC_DEFUN([nc_PATH_PROG_ZCAT], [
265 AC_PATH_PROG(GZCAT,gzcat)
266 AC_PATH_PROG(ZCAT,zcat)
267 if test "x$GZCAT" = x ; then
268 if test "x$ZCAT" != x ; then
269 # See if zcat is really gzcat. gzcat has a --version option, regular
271 AC_MSG_CHECKING(if zcat is really gzcat in disguise)
272 if $ZCAT --version 2> /dev/null ; then
273 AC_DEFINE_UNQUOTED(GZCAT, "$ZCAT")
280 AC_DEFINE_UNQUOTED(GZCAT, "$GZCAT")
283 if test "x$ZCAT" != x ; then
284 AC_DEFINE_UNQUOTED(ZCAT, "$ZCAT")
290 AC_DEFUN([wi_SYSV_EXTRA_DIRS], [
291 # Use System V because their curses extensions are required. This must
292 # be done early so we use the -I and -L in the library checks also.
293 # This is mostly a Solaris/SunOS hack. Note that doing this will also
294 # use all of the other System V libraries and headers.
296 AC_MSG_CHECKING(for alternative System V libraries)
297 if test -f /usr/5include/curses.h ; then
298 CPPFLAGS="$CPPFLAGS -I/usr/5include"
299 LDFLAGS="$LDFLAGS -L/usr/5lib"
308 AC_DEFUN([wi_DEFINE_UNAME], [
309 # Get first 127 chars of all uname information. Some folks have
310 # way too much stuff there, so grab only the first 127.
311 unam=`uname -a 2>/dev/null | cut -c1-127`
312 if test "$unam" != "" ; then
313 AC_DEFINE_UNQUOTED(UNAME, "$unam")
319 AC_DEFUN([wi_READLINE_WITH_NCURSES], [
320 # Readline and Ncurses could both define "backspace".
321 # Warn about this if we have both things in our definitions list.
323 if test "$ac_cv_lib_readline" = yes && test "$ac_cv_lib_ncurses" = yes ; then
325 AC_MSG_CHECKING(if readline and ncurses will link together)
327 LIBS="-lreadline -lncurses"
332 if test "$k" = no ; then
334 # Remove '-lreadline' from LIBS.
335 LIBS=`echo $j | sed s/-lreadline//g`
336 ac_cv_lib_readline=no
337 AC_WARN([The versions of GNU readline and ncurses you have installed on this system
338 can't be used together, because they use the same symbol, backspace. If
339 possible, recompile one of the libraries with -Dbackspace=back_space, then
354 dnl Check for an external variable daylight. Stolen from w3c-libwww.
355 AC_DEFUN([AC_EXT_DAYLIGHT],
356 [ AC_MSG_CHECKING(int daylight variable)
357 AC_TRY_COMPILE([#include <time.h>], [return daylight;],
360 AC_MSG_RESULT($have_daylight)
364 dnl Check for an external variable timezone. Stolen from tcl-8.0.
365 AC_DEFUN([AC_EXT_TIMEZONE],
368 # Its important to include time.h in this check, as some systems (like convex)
369 # have timezone functions, etc.
372 AC_MSG_CHECKING([long timezone variable])
373 AC_TRY_COMPILE([#include <time.h>],
374 [extern long timezone;
382 # On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
384 if test "$have_timezone" = no; then
385 AC_MSG_CHECKING([time_t timezone variable])
386 AC_TRY_COMPILE([#include <time.h>],
387 [extern time_t timezone;
396 ## AC_BZ_SET_COMPILER: Addition by Theodore Papadopoulo
397 ## Patch by Jim McKelvey: change sed -e 's/ /@/g' to sed -e 's/ /@/'
398 AC_DEFUN([AC_SG_SET_COMPILER],
399 [cxxwith=`echo $1 | sed -e 's/ /@/'`
401 *:*@*) # Full initialization syntax
402 CXX=`echo "$cxxwith" | sed -n -e 's/.*:\(.*\)@.*/\1/p'`
403 CXXFLAGS=`echo "$cxxwith" | sed -n -e 's/.*:.*@\(.*\)/\1/p'`
405 *:*) # Simple initialization syntax
406 CXX=`echo "$cxxwith" | sed -n -e 's/.*:\(.*\)/\1/p'`
417 pushdef([AC_PROG_INSTALL],
419 dnl our own version, testing for a -p flag
420 popdef([AC_PROG_INSTALL])
421 dnl as AC_PROG_INSTALL works as it works we first have
422 dnl to save if the user didn't specify INSTALL, as the
423 dnl autoconf one overwrites INSTALL and we have no chance to find
427 # OK, user hasn't given any INSTALL, autoconf found one for us
428 # now we test, if it supports the -p flag
429 AC_MSG_CHECKING(for -p flag to install)
430 rm -f confinst.$$.* > /dev/null 2>&1
431 echo "Testtest" > confinst.$$.orig
433 if ${INSTALL} -p confinst.$$.orig confinst.$$.new > /dev/null 2>&1 ; then
434 if test -f confinst.$$.new ; then
435 # OK, -p seems to do no harm to install
436 INSTALL="${INSTALL} -p"
441 AC_MSG_RESULT($ac_res)
442 dnl the following tries to resolve some signs and wonders coming up
443 dnl with different autoconf/automake versions
445 dnl *automake 1.4 install-strip sets A_M_INSTALL_PROGRAM_FLAGS to -s
446 dnl and has INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(A_M_INSTALL_PROGRAM_FLAGS)
447 dnl it header-vars.am, so there the actual INSTALL_PROGRAM gets the -s
448 dnl *automake 1.4a (and above) use INSTALL_STRIP_FLAG and only has
449 dnl INSTALL_PROGRAM = @INSTALL_PROGRAM@ there, but changes the
450 dnl install-@DIR@PROGRAMS targets to explicitly use that flag
451 dnl *autoconf 2.13 is dumb, and thinks it can use INSTALL_PROGRAM as
452 dnl INSTALL_SCRIPT, which breaks with automake <= 1.4
453 dnl *autoconf >2.13 (since 10.Apr 1999) has not that failure
454 dnl to clean up that mess we:
455 dnl +set INSTALL_PROGRAM to use INSTALL_STRIP_FLAG
456 dnl which cleans KDE's program with automake > 1.4;
457 dnl +set INSTALL_SCRIPT to only use INSTALL, to clean up autoconf's problems
458 dnl with automake<=1.4
459 dnl note that dues to this sometimes two '-s' flags are used
460 INSTALL_PROGRAM='${INSTALL} $(INSTALL_STRIP_FLAG)'
461 INSTALL_SCRIPT='${INSTALL}'
464 # ===========================================================================
465 # http://autoconf-archive.cryp.to/ax_boost_base.html
466 # ===========================================================================
470 # AX_BOOST_BASE([MINIMUM-VERSION])
474 # Test for the Boost C++ libraries of a particular version (or newer)
476 # If no path to the installed boost library is given the macro searchs
477 # under /usr, /usr/local, /opt and /opt/local and evaluates the
478 # $BOOST_ROOT environment variable. Further documentation is available at
479 # <http://randspringer.de/boost/index.html>.
483 # AC_SUBST(BOOST_CPPFLAGS) / AC_SUBST(BOOST_LDFLAGS)
495 # Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
497 # Copying and distribution of this file, with or without modification, are
498 # permitted in any medium without royalty provided the copyright notice
499 # and this notice are preserved.
501 AC_DEFUN([AX_BOOST_BASE],
504 AS_HELP_STRING([--with-boost@<:@=DIR@:>@], [use boost (default is yes) - it is possible to specify the root directory for boost (optional)]),
506 if test "$withval" = "no"; then
508 elif test "$withval" = "yes"; then
513 ac_boost_path="$withval"
519 AC_ARG_WITH([boost-libdir],
520 AS_HELP_STRING([--with-boost-libdir=LIB_DIR],
521 [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.]),
525 ac_boost_lib_path="$withval"
527 AC_MSG_ERROR(--with-boost-libdir expected directory name)
530 [ac_boost_lib_path=""]
533 if test "x$want_boost" = "xyes"; then
534 boost_lib_version_req=ifelse([$1], ,1.20.0,$1)
535 boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'`
536 boost_lib_version_req_major=`expr $boost_lib_version_req : '\([[0-9]]*\)'`
537 boost_lib_version_req_minor=`expr $boost_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
538 boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
539 if test "x$boost_lib_version_req_sub_minor" = "x" ; then
540 boost_lib_version_req_sub_minor="0"
542 WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+ $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor`
543 AC_MSG_CHECKING(for boostlib >= $boost_lib_version_req)
546 dnl first we check the system location for boost libraries
547 dnl this location ist chosen if boost libraries are installed with the --layout=system option
548 dnl or if you install boost with RPM
549 if test "$ac_boost_path" != ""; then
550 BOOST_LDFLAGS="-L$ac_boost_path/lib"
551 BOOST_CPPFLAGS="-I$ac_boost_path/include"
553 for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
554 if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then
555 BOOST_LDFLAGS="-L$ac_boost_path_tmp/lib"
556 BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include"
562 dnl overwrite ld flags if we have required special directory with
563 dnl --with-boost-libdir parameter
564 if test "$ac_boost_lib_path" != ""; then
565 BOOST_LDFLAGS="-L$ac_boost_lib_path"
568 CPPFLAGS_SAVED="$CPPFLAGS"
569 CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
572 LDFLAGS_SAVED="$LDFLAGS"
573 LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
577 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
578 @%:@include <boost/version.hpp>
580 #if BOOST_VERSION >= $WANT_BOOST_VERSION
581 // Everything is okay
583 # error Boost version is too old
595 dnl if we found no boost with system layout we search for boost libraries
596 dnl built and installed without the --layout=system option or for a staged(not installed) version
597 if test "x$succeeded" != "xyes"; then
599 if test "$ac_boost_path" != ""; then
600 if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
601 for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
602 _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
603 V_CHECK=`expr $_version_tmp \> $_version`
604 if test "$V_CHECK" = "1" ; then
605 _version=$_version_tmp
607 VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
608 BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE"
612 for ac_boost_path in /usr /usr/local /opt /opt/local ; do
613 if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
614 for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
615 _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
616 V_CHECK=`expr $_version_tmp \> $_version`
617 if test "$V_CHECK" = "1" ; then
618 _version=$_version_tmp
619 best_path=$ac_boost_path
625 VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
626 BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE"
627 if test "$ac_boost_lib_path" = ""
629 BOOST_LDFLAGS="-L$best_path/lib"
632 if test "x$BOOST_ROOT" != "x"; then
633 if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/lib" && test -r "$BOOST_ROOT/stage/lib"; then
634 version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'`
635 stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'`
636 stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'`
637 V_CHECK=`expr $stage_version_shorten \>\= $_version`
638 if test "$V_CHECK" = "1" -a "$ac_boost_lib_path" = "" ; then
639 AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT)
640 BOOST_CPPFLAGS="-I$BOOST_ROOT"
641 BOOST_LDFLAGS="-L$BOOST_ROOT/stage/lib"
647 CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
649 LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
653 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
654 @%:@include <boost/version.hpp>
656 #if BOOST_VERSION >= $WANT_BOOST_VERSION
657 // Everything is okay
659 # error Boost version is too old
670 if test "$succeeded" != "yes" ; then
671 if test "$_version" = "0" ; then
672 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.]])
674 AC_MSG_NOTICE([Your boost libraries seems to old (version $_version).])
677 AC_SUBST(BOOST_CPPFLAGS)
678 AC_SUBST(BOOST_LDFLAGS)
679 AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available])
682 CPPFLAGS="$CPPFLAGS_SAVED"
683 LDFLAGS="$LDFLAGS_SAVED"