configure.in
上传用户:tjfeida
上传日期:2013-03-10
资源大小:1917k
文件大小:8k
源码类别:

Ftp客户端

开发平台:

Visual C++

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