23  Configure, Autoconf, Automake,  Philippe.Dax@enst.fr,  © ENST - 2001-2004 - BDL Dup Top Prev Next >>>

Exemple d'une application standard

Application standard en C++

Besoin du compilateur C++

Besoin des librairies Tcl/Tk, Posix-threads

AC_INIT([slidecast], [1.2])

AC_CONFIG_HEADERS([config.h])

# where to find install.sh, config.sub, config.guess
AC_CONFIG_AUX_DIR([config])

AC_CONFIG_SRCDIR([src/main.cpp])
AM_INIT_AUTOMAKE

# Checks for programs.
AC_LANG([C++])
AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL

# Checks for libraries.
AC_CHECK_LIB(tcl, Tcl_Init)
AC_CHECK_LIB(tk, Tk_Init)
AC_CHECK_LIB(X11, XOpenDisplay)
AC_CHECK_LIB(nsl, gethostbyname)
AC_CHECK_LIB(socket, connect)
AC_CHECK_LIB(pthread, pthread_create)

# Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_TIME

# Checks for typedefs and compiler characteristics.
AC_C_BIGENDIAN
AC_TYPE_UID_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T

AC_CHECK_HEADERS(unistd.h fcntl.h strings.h pthread.h netinet/igmp.h netinet/igmp_var.h)
AC_MSG_CHECKING(for usleep)
AH_TEMPLATE(HAVE_USLEEP)
AC_EGREP_HEADER(usleep, unistd.h, is_usleep=yes, is_usleep=no)
if test $is_usleep = yes; then
  AC_DEFINE(HAVE_USLEEP)
  AC_MSG_RESULT(yes)
else
  AC_MSG_RESULT(no)
fi

# check Multicast support
AC_MSG_CHECKING(checking if Multicast is supported)
AH_TEMPLATE(HAVE_MULTICAST)
AC_EGREP_HEADER(IP_ADD_MEMBERSHIP, netinet/in.h, is_mc=yes, is_mc=no)
if test $is_mc = yes; then
  AC_MSG_RESULT(yes)
  AC_DEFINE(HAVE_MULTICAST)
else
  if test $ac_cv_header_netinet_igmp_h = yes -o $ac_cv_header_netinet_igmp_var_h = yes; then
    AC_MSG_RESULT(yes)
    AC_DEFINE(HAVE_MULTICAST)
  else
    AC_MSG_RESULT(no)
  fi
fi

# Checks for library functions.
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(gettimeofday select socket waitpid strdup strerror uname)
if test x$ac_cv_func_strerror = xno; then
# Replace `main' with a function in -liberty:
  AC_CHECK_LIB(iberty, main)
fi

# Make Makefiles
AC_CONFIG_FILES([Makefile config/Makefile src/Makefile html/Makefile])
AC_OUTPUT