dnl Process this file with autoconf to produce a configure script. AC_INIT([bbsmount.cc]) AM_INIT_AUTOMAKE(bbsmount, 0.3.1) AM_CONFIG_HEADER(config.h) AC_PREFIX_DEFAULT(/usr/local) dnl get the debug values right AC_DEFUN(AC_SET_DEBUG, [ test "$CFLAGS" = "" && CFLAGS="-g -Wall -DDEBUG=1" test "$CXXFLAGS" = "" && CXXFLAGS="-g -Wall -DDEBUG=1" test "$LDFLAGS" = "" && LDFLAGS="" ]) AC_DEFUN(AC_SET_NODEBUG, [ test "$CFLAGS" = "" && CFLAGS="-O2 -Wall" test "$CXXFLAGS" = "" && default_cxxflags=yes && CXXFLAGS="-O2 -Wall" test "$LDFLAGS" = "" && LDFLAGS="-s" ]) AC_ARG_ENABLE(debug, [ --enable-debug create debugging code [default=no].], [case "${enableval}" in no) AC_SET_NODEBUG ;; yes) AC_SET_DEBUG ;; esac], AC_SET_NODEBUG) AC_ARG_ENABLE(runback, [ --disable-runback disable creating threads for commands [[default=yes]].], [case "${enableval}" in no) AC_DEFINE(RUN_IN_BACKGROUND, 0, [This controls how new commands are executed]) ;; yes) AC_DEFINE(RUN_IN_BACKGROUND, 1, [This controls how new commands are executed]) ;; esac], AC_DEFINE(RUN_IN_BACKGROUND, 1, [This controls how new commands are executed])) AC_ARG_ENABLE(delayed-tooltips, [ --disable-delayed-tooltips disable creating thread for tooltip [[default=yes]].], [case "${enableval}" in no) AC_DEFINE(DELAYED_TOOLTIPS, 0, [If thread for tooltips must be created.]) ;; yes) AC_DEFINE(DELAYED_TOOLTIPS, 1, [If thread for tooltips must be created.]) ;; esac], AC_DEFINE(DELAYED_TOOLTIPS, 1, [If thread for tooltips must be created.])) AC_ARG_ENABLE(mtab, [ --disable-mtab use output of mount command instead of mtab file [[default=enabled]].], [case "${enableval}" in no) use_mtab=0;; yes) use_mtab=1;; esac], use_mtab=auto) dnl AC_ARG_ENABLE(strict-ansi, dnl [ --enable-strict-ansi Enable warnings for ANSI C++ violations [default=no].], dnl [case "${enableval}" in dnl yes) check_ansi=true ;; dnl no) check_ansi=false ;; dnl esac], [check_ansi=false]) AC_ARG_WITH(cpp, [ --with-cpp specify alternative c++ compiler.], [CCC="${withval}"]) AC_ARG_WITH(mtab, [ --with-mtab specify alternative location of mtab file [default=/etc/mtab].], mtab=$withval, mtab=/etc/mtab) AC_ARG_WITH(mount, [ --with-mount specify alternative location of mount command [default=`which mount`].], mount=$withval, mount=`which mount`) # Change default location of config files (if not changed by configure) if test x$sysconfdir = 'x${prefix}/etc'; then sysconfdir=$datadir fi AC_CHECK_PROGS(regex_cmd, sed) if test x$regex_cmd = "x"; then AC_MSG_ERROR([error. sed is required to build the default bbtoolsrc file.]) fi dnl Checks for programs. AC_PROG_AWK AC_PROG_CXX AC_PROG_CC AC_PROG_INSTALL AC_PROG_LN_S dnl Test if const is working AC_C_CONST dnl Set C++ as default compiler AC_LANG_CPLUSPLUS ORIG_CXXFLAGS=$CXXFLAGS if test x$default_cxxflags = xyes; then CXXFLAGS="-Os " AC_CACHE_CHECK([whether $CXX accepts -Os], sa_cv_arg_cc_optsize, AC_TRY_COMPILE([],[], sa_cv_arg_cc_optsize=yes, sa_cv_arg_cc_optsize=no)) if test x$sa_cv_arg_cc_optsize = xyes; then ORIG_CXXFLAGS="-Os -Wall" fi fi if test x$check_ansi = xtrue; then CXXFLAGS="-ansi " AC_CACHE_CHECK([whether $CXX accepts -ansi], sa_cv_arg_cc_ansi, AC_TRY_COMPILE([],[], sa_cv_arg_cc_ansi=yes, sa_cv_arg_cc_ansi=no)) if test $sa_cv_arg_cc_ansi = yes; then ORIG_CXXFLAGS="$ORIG_CXXFLAGS -ansi" fi CXXFLAGS="-pedantic " AC_CACHE_CHECK([whether $CXX accepts -pedantic], sa_cv_arg_cc_pedantic, AC_TRY_COMPILE([],[], sa_cv_arg_cc_pedantic=yes, sa_cv_arg_cc_pedantic=no)) if test $sa_cv_arg_cc_pedantic = yes; then ORIG_CXXFLAGS="$ORIG_CXXFLAGS -pedantic" fi fi CXXFLAGS=$ORIG_CXXFLAGS # Checks for header files. AC_PATH_X AC_PATH_XTRA AC_HEADER_STDC AC_CHECK_HEADERS([ctype.h fcntl.h locale.h malloc.h memory.h process.h pthread.h signal.h stdarg.h stdlib.h stdio.h string.h sys/param.h sys/mount.h sys/select.h sys/statfs.h sys/statvfs.h sys/time.h sys/wait.h unistd.h],,, [[#if HAVE_SYS_PARAM_H #include #endif /* HAVE_SYS_PARAM_H */ ]]) CFLAGS="$CFLAGS $X_CFLAGS" CXXFLAGS="$CXXFLAGS $X_CFLAGS" LDFLAGS="$LDFLAGS $X_LIBS $X_PRE_LIBS" #DATADIR=$(datadir) DATADIR=$datadir AC_CHECK_LIB(pthread, pthread_create,, AC_MSG_ERROR([pthread_create not found in -lpthread])) dnl Checks for X libraries. AC_CHECK_LIB(X11, XOpenDisplay,, AC_MSG_ERROR([XOpenDisplay not found in -lX11])) AC_CHECK_LIB(Xpm, XpmCreatePixmapFromXpmImage,, AC_MSG_ERROR([XpmCreatePixmapFromXpmImage not found in -lXpm])) LDFLAGS="$LDFLAGS $X_EXTRA_LIBS" AC_CHECK_HEADERS(X11/Xlib.h,, AC_MSG_ERROR([Xlib.h not found. Do you have X11 development files installed?])) AC_CHECK_HEADERS(X11/xpm.h,, AC_MSG_ERROR([xpm.h not found. Do you have Xpm development files installed?])) dnl Checks for typedefs, structures, and compiler characteristics. AC_TYPE_SIZE_T AC_HEADER_TIME dnl Checks for library functions. AC_TYPE_SIGNAL AC_CHECK_FUNCS([bzero malloc memset mkstemp setlocale sigaction stat statfs statvfs strdup strncasecmp strstr strcasestr tmpnam]) if test x$use_mtab = xauto; then if test -e "$mtab"; then use_mtab=1 else use_mtab=0 fi fi if test 0$use_mtab -eq 0; then AC_DEFINE(READ_MOUNT, 1, [Use output of mount command instead of mtab file]) else AC_DEFINE(READ_MOUNT, 0, [Use output of mount command instead of mtab file]) fi AC_DEFINE_UNQUOTED(MTAB_FILE, "$mtab", [This specifies location of mtab file]) AC_DEFINE_UNQUOTED(MOUNT_COMMAND, "$mount", [This specifies location of mount command]) AC_OUTPUT(version.h Makefile data/Makefile images/Makefile)