1 dnl Process this file with autoconf to produce a configure script.
3 AM_INIT_AUTOMAKE(bbkeys, 0.9.0beta3)
5 AC_PREFIX_DEFAULT(/usr/local)
7 AC_CHECK_PROGS(regex_cmd, sed)
8 if test x$regex_cmd = "x"; then
9 AC_MSG_ERROR([error. sed is required to build the default bbtoolsrc file.])
12 dnl get the debug values right
13 AC_DEFUN(AC_SET_DEBUG,
15 _CFLAGS="-g -Wall -DDEBUG"
16 _CXXFLAGS="-g -Wall -DDEBUG"
20 dnl On solaris, we get a ton of multiply-defined errors if we don't include
22 _LDFLAGS="$_LDFLAGS -z muldefs"
25 test "$CFLAGS" = "" && CFLAGS=$_CFLAGS
26 test "$CXXFLAGS" = "" && CXXFLAGS=$_CXXFLAGS
27 test "$LDFLAGS" = "" && LDFLAGS=$_LDFLAGS
30 AC_DEFUN(AC_SET_NODEBUG,
38 _CXXFLAGS="$_CXXFLAGS -O"
39 dnl On solaris, we get a ton of multiply-defined errors if we don't include
41 _LDFLAGS="$_LDFLAGS -z muldefs"
44 _CFLAGS="$_CFLAGS -O2"
45 _CXXFLAGS="$_CXXFLAGS -O2"
48 test "$CFLAGS" = "" && CFLAGS=$_CFLAGS
49 test "$CXXFLAGS" = "" && CXXFLAGS=$_CXXFLAGS
50 test "$LDFLAGS" = "" && LDFLAGS=$_LDFLAGS
53 AC_ARG_ENABLE(debug,[ --enable-debug create debugging code [default=no]],
55 if test $enableval = "no";
62 dnl Checks for programs.
71 dnl minimum version we can live with
73 dnl check for perl for our command-line configurator
74 AC_PATH_PROGS(PERL, $PERL perl5 perl )
75 if test -z "$PERL" || test "$PERL" = ":"; then
76 AC_MSG_ERROR([perl not found in \$PATH])
79 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
80 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
82 AC_MSG_RESULT([$_perl_version])
84 if test "$_perl_res" != 0; then
85 AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
88 AC_MSG_CHECKING([for full perl installation])
89 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
91 if test "$_perl_res" != 0; then
93 AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
99 # Checks for header files.
103 AC_CHECK_HEADERS(ctype.h strings.h fcntl.h libgen.h locale.h process.h signal.h stdio.h time.h errno.h unistd.h sys/signal.h sys/param.h sys/select.h sys/stat.h sys/time.h sys/types.h sys/wait.h stdlib.h string.h malloc.h)
105 # Checks for typedefs, structures, and compiler characteristics.
111 # Checks for library functions.
116 AC_CHECK_FUNCS(setlocale sigaction strftime gettimeofday memset strcasecmp strchr strcspn strdup strncasecmp select strstr)
118 dnl these have to be here for X tests...
119 CFLAGS="$CFLAGS $X_CFLAGS"
120 CXXFLAGS="$CXXFLAGS $X_CFLAGS"
121 LDFLAGS="$LDFLAGS $X_LIBS $X_PRE_LIBS"
124 dnl Checks for X libraries.
125 AC_CHECK_LIB(X11, XOpenDisplay, LIBS="-lX11",
126 AC_MSG_ERROR(XOpenDisplay not found in -lX11))
128 dnl Checks for Xextension
129 AC_CHECK_LIB(Xext, XMissingExtension, LIBS="$LIBS -lXext",
130 AC_MSG_ERROR(XMissingExtension not found in -lXext))
132 dnl pkgconfig checks for blackbox library
133 PKG_CHECK_MODULES(LIBBT, libbt)
134 CXXFLAGS="$CXXFLAGS $LIBBT_CFLAGS"
135 LIBS="$LIBS $LIBBT_LIBS"
137 dnl generate the config header
138 AM_CONFIG_HEADER(config.h)
152 AC_MSG_RESULT([ $PACKAGE version $VERSION configured successfully.])
154 AC_MSG_RESULT([Using '$prefix' for installation.])
155 AC_MSG_RESULT([Using '$CXX' for C++ compiler.])
156 AC_MSG_RESULT([Building with '$CXXFLAGS' for C++ compiler flags.])
157 AC_MSG_RESULT([Building with '$LDFLAGS' for linker flags.])
158 AC_MSG_RESULT([Building with '$LIBS' libraries.])