dnl Process this file with autoconf to produce a configure script. AC_INIT(sigcx/thread.h) AC_CONFIG_AUX_DIR(scripts) AM_INIT_AUTOMAKE(libsigcx, 0.6.5) AM_CONFIG_HEADER(config.h) AC_SUBST(VERSION) ISODATE=`date +%Y-%m-%d` AC_SUBST(ISODATE) AC_CANONICAL_HOST if test "x$CFLAGS" != "x"; then have_CFLAGS="yes" fi if test "x$CXXFLAGS" != "x"; then have_CXXFLAGS="yes" fi dnl Checks for programs. AC_CHECK_PROGS(M4, gm4 m4, m4) AC_PROG_INSTALL AC_PROG_CC AC_PROG_CXX dnl Checks for libraries. AM_DISABLE_STATIC AM_PROG_LIBTOOL dnl Checks for arguments AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [build debugging version]), \ if test "$enableval" = "yes"; then DEBUG=1 else DEBUG=0 fi;) test "x$have_CFLAGS" != "xyes" && CFLAGS="-Wall -Wmissing-prototypes" test "x$have_CXXFLAGS" != "xyes" && CXXFLAGS="-Wall" #LDFLAGS="" if test "$DEBUG" = "1"; then AC_DEFINE(DEBUG, 1, [define for debugging version]) test "x$have_CFLAGS" != "xyes" && CFLAGS="$CFLAGS -g" test "x$have_CXXFLAGS" != "xyes" && CXXFLAGS="$CXXFLAGS -g" else test "x$have_CFLAGS" != "xyes" && CFLAGS="$CFLAGS -O2" test "x$have_CXXFLAGS" != "xyes" && CXXFLAGS="$CXXFLAGS -O2" fi AC_SUBST(CXXFLAGS) AC_SUBST(LDFLAGS) dnl Branch names for version we head at and real version. dnl These will differ for development versions and be the same for dnl stable versions. SIGCX_BRANCH=0.6 SIGCX_DEVBRANCH=0.6 AC_SUBST(SIGCX_BRANCH) AC_SUBST(SIGCX_DEVBRANCH) dnl SigC++ PKG_CHECK_MODULES(SIGC, sigc++-1.2) AC_SUBST(SIGC_LIBS) AC_SUBST(SIGC_CFLAGS) dnl SigC++ macros AC_MSG_CHECKING([for SigC++ macros]) SIGC_MACROS="`pkg-config --variable=prefix sigc++-1.2`/include/sigc++-1.2/sigc++/macros" if test "$?" != "0"; then AC_MSG_ERROR([failed to locate the SigC++ macros]) else AC_MSG_RESULT([$SIGC_MACROS]) fi AC_SUBST(SIGC_MACROS) dnl Check for thread support AC_ARG_WITH(threads, AC_HELP_STRING([--with-threads], [which threading library to use default=auto]), [ if test "$withval" = "auto"; then THREAD_CHECKS="pthreads glib" elif test "$withval" = "no"; then THREAD_CHECKS="none" else THREAD_CHECKS="$withval" fi], [ THREAD_CHECKS="pthreads glib" ]) THREADS_USED=none for check in $THREAD_CHECKS; do case "$check" in (none) THREAD_LIBS="" THREAD_CFLAGS="" ;; (pthreads) AM_WITH_PTHREAD_INFO if test $HAVE_PTHREAD=yes; then THREADS_USED=pthreads THREAD_LIBS=$PTHREAD_LIBS THREAD_CFLAGS=$PTHREAD_CFLAGS fi ;; (glib) PKG_CHECK_MODULES(GTHREAD, gthread-2.0, [THREADS_USED=glib]) THREAD_LIBS=$GTHREAD_LIBS THREAD_CFLAGS=$GTHREAD_CFLAGS ;; esac if test $THREADS_USED != none; then break fi done AC_SUBST(THREADS_USED) THREAD_IMPL_HEADER="\"thread-${THREADS_USED}.h\"" AC_DEFINE_UNQUOTED(THREAD_IMPL_HEADER, [$THREAD_IMPL_HEADER], [Header containing the thread implementation declarations]) AC_SUBST(THREAD_LIBS) AC_SUBST(THREAD_CFLAGS) AC_ARG_WITH(gtk, AC_HELP_STRING([--with-gtk], [build GTK+ dispatcher]), [ if test "$withval" = "yes"; then CHECK_GTK=yes else CHECK_GTK=no fi], [ CHECK_GTK=yes ]) if test "$CHECK_GTK" = "yes"; then PKG_CHECK_MODULES(GTK, gtk+-2.0, [HAVE_GTK=yes], [HAVE_GTK=no]) if test "$HAVE_GTK" = "yes"; then AC_SUBST(GTK_LIBS) AC_SUBST(GTK_CFLAGS) GTKLIB="libsigcx-gtk-$SIGCX_DEVBRANCH.la" else GTKLIB="" AC_MSG_WARN([GTK+ not found: $GTK_PKG_ERRORS, not building GTK+ dispatcher]) fi else GTKLIB="" fi AC_SUBST(GTKLIB) dnl Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS(unistd.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_CHECK_CXX_EH if test "x$ac_cv_cxx_eh" != "xyes" then AC_MSG_ERROR([$CXX does provide correct exception handling]) fi AC_CHECK_CXX_NS if test "x$ac_cv_cxx_ns" != "xyes" then AC_MSG_ERROR([$CXX does not support namespaces]) fi AC_CHECK_CXX_STL if test "x$ac_cv_cxx_stl" != "xyes" then AC_MSG_ERROR([STL is not available]) fi dnl dnl Checks for functions dnl AC_CHECK_FUNCS(strerror_r __strerror_r) dnl dnl Checks for documentation tools dnl MAYBE_DOC="" AC_CHECK_DOXYGEN if test -n "$DOXYGEN"; then MAYBE_DOC="doc" fi AC_SUBST(MAYBE_DOC) AC_CONFIG_COMMANDS([sigcxconfig.h], [ ## Generate `sigcxconfig.h' in two cases ## 1. `config.status' is run either explicitly, or via configure. ## Esp. not when it is run in `Makefile' to generate makefiles and ## config.h ## 2. CONFIG_OTHER is set explicitly ## ## Case 1 is difficult. We know that `automake' sets one of ## CONFIG_FILES or CONFIG_HEADERS to empty. This heuristic works ## only when AM_CONFIG_HEADER is set, however. if test -n "${CONFIG_FILES}" && test -n "${CONFIG_HEADERS}"; then # Both CONFIG_FILES and CONFIG_HEADERS are non-empty ==> Case 1 CONFIG_OTHER=${CONFIG_OTHER:-sigcxconfig.h} fi case "$CONFIG_OTHER" in *sigcxconfig.h*) echo creating sigcxconfig.h outfile=sigcxconfig.h-tmp cat > $outfile <<\_______EOF /* sigcxconfig.h * * This is a generated file. Please modify 'configure.ac' */ #ifndef __LIB_SIGCX_CONFIG_H__ #define __LIB_SIGCX_CONFIG_H__ _______EOF echo "#define SIGCX_THREADS_IMPL $THREADS_USED" >> $outfile if test "$THREADS_USED" != "none"; then echo "#define SIGCX_THREADS 1" >> $outfile else echo "#define SIGCX_THREADS 0" >> $outfile fi cat >>$outfile <<_______EOF #endif /* __LIB_SIGCX_CONFIG_H */ _______EOF if cmp -s $outfile sigcxconfig.h; then echo sigcxconfig.h is unchanged rm -f $outfile else mv $outfile sigcxconfig.h fi ;; esac]) AC_OUTPUT([ Makefile scripts/Makefile sigcx/Makefile sigcx/sigcx-0.6.pc sigcx/sigcx-0.6-gtk+.pc sigcx/macros/Makefile tests/Makefile examples/Makefile doc/Makefile])