# -*-shell-script-*- # # configure.in # # Autoconf input file. # # Copyright (C) 2002-2006 Florian Wolff # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # ---------------------------------------------------------------------- # # Initialize autoconf and automake # AC_INIT(src/lang/Object.jlc) AC_CANONICAL_HOST AM_INIT_AUTOMAKE(jakelib2, 2.0.2, no-define) AM_CONFIG_HEADER(include/dummy.h include/jakelib2/config.h) AC_SUBST(libversion, "1:0:0") AC_PREFIX_DEFAULT("/usr") # # Check for Operating System: # case "$host" in *-*-mingw32*) AC_DEFINE(WIN32) AC_DEFINE(MINGW32) link_wsock32_lib=-lwsock32 AC_DEFINE(HAVE_WINTHREADS) AC_DEFINE(JAKELIB_WIN32API) ;; *-*-cygwin*) AC_DEFINE(WIN32) AC_DEFINE(CYGWIN) AC_DEFINE(POSIX) link_wsock32_lib=-lwsock32 ;; *-*-linux*) AC_DEFINE(LINUX) AC_DEFINE(POSIX) ;; *-*-darwin*) AC_DEFINE(MACOSX) AC_DEFINE(POSIX) ;; *) AC_DEFINE(UNIX) AC_DEFINE(POSIX) ;; esac # # Checks for programs: # AC_PROG_AWK AC_PROG_CC AC_PROG_CXX AC_PROG_RANLIB AC_PROG_CPP AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_LIBTOOL AC_PATH_PROG(AR, ar, ar) AC_PATH_PROG(FIND, find, /bin/find) AC_CHECK_PROGS(TAR, gtar gnutar tar, tar) AC_PATH_PROG(DOXYGEN, doxygen, /usr/bin) AC_PATH_PROG(GREP, grep, /usr/bin) AC_PATH_PROG(EGREP, egrep, /usr/bin) AC_PATH_PROG(PERL, perl, /usr/bin) # # Checks for libraries: # AC_SUBST(link_rt_lib) AC_SUBST(link_nsl_lib) AC_SUBST(link_socket_lib) AC_SUBST(link_pthread_lib) AC_SUBST(link_wsock32_lib) AC_SUBST(link_posix4_lib) AC_SUBST(link_dl_lib) AC_SUBST(link_stdcpp_lib) AC_CHECK_LIB(rt, main, link_rt_lib=-lrt) AC_CHECK_LIB(nsl, main, link_nsl_lib=-lnsl) AC_CHECK_LIB(socket, main, link_socket_lib=-lsocket) AC_CHECK_LIB(pthread, pthread_create, [link_pthread_lib="-lpthread"; AC_DEFINE(HAVE_PTHREADS)]) AC_CHECK_LIB(posix4, main, link_posix4_lib=-lposix4) AC_CHECK_LIB(dl, dlopen, [link_dl_lib=-ldl]) AC_CHECK_LIB(stdc++, main, link_stdcpp_lib=-lstdc++) # # Debugging mode On/Off # AC_ARG_ENABLE(debug, [ --enable-debug Enable debugging mode [[default=enabled]] ], [ enable_debug=$enableval] ) if test "$enable_debug" != "no"; then AC_DEFINE(JAKELIB_DEBUG) enable_debug="1" enable_stacktrace="1" fi # # StackTrace mode On/Off # #AC_ARG_ENABLE(stacktrace, [ --enable-stacktrace Enable StackTrace mode (on if debugging is on)], # [ enable_stacktrace=$enableval] ) #if test "$enable_stacktrace" != "no"; then # AC_DEFINE(JAKELIB_STACKTRACE) # enable_stacktrace="1" #fi # # Threads On/Off # AC_ARG_ENABLE(threads, [ --enable-threads Enable threads [[default=enabled]] ], [ enable_threads=$enableval] ) if test "$enable_threads" != "no"; then AC_DEFINE(JAKELIB_THREADS) enable_threads="1" fi # # Check for boehm garbage collector # AC_SUBST(link_gc_lib) AC_ARG_WITH(gc-dir, [ --with-gc-dir The directory where Boehm Garbage Collector libgc.a is located], [ with_gc_dir="-L$withval" ]) old_cflags=$CFLAGS CFLAGS="$CFLAGS $link_dl_lib $with_gc_dir" AC_CHECK_LIB(gc, main, [have_gc="1" ], [have_gc="0"]) link_gc_lib="$with_gc_dir -lgc" CFLAGS=$old_cflags if test "$have_gc" != "1"; then AC_MSG_RESULT() AC_MSG_RESULT(****************************************************************) AC_MSG_RESULT(Boehm Garbage Collector (gc) not found!) AC_MSG_RESULT() AC_MSG_RESULT(See http://www.hpl.hp.com/personal/Hans_Boehm/gc/index.html) AC_MSG_RESULT(or http://www.jakelib.org/lib/jakelib2/download/) AC_MSG_RESULT(****************************************************************) AC_MSG_RESULT() AC_MSG_ERROR(Cannot compile without gc!) fi # # Checks for header files: # AC_CHECK_HEADERS(stdlib.h stdio.h time.h ctype.h string.h semaphore.h pthread.h iostream.h winsock.h windows.h unistd.h netinet/in.h netdb.h sys/socket.h stdarg.h errno.h sys/errno.h sys/time.h sys/wait.h signal.h sched.h math.h sys/utsname.h pwd.h fcntl.h sys/stat.h) # # Checks for typedefs, structures, and compiler characteristics. # AC_C_CONST AC_TYPE_PID_T AC_STRUCT_TM AC_CHECK_SIZEOF(long, 4) AC_CHECK_SIZEOF(int, 4) AC_CHECK_SIZEOF(char, 1) AC_CHECK_SIZEOF(long long, 8) AC_CHECK_SIZEOF(short, 2) AC_CHECK_SIZEOF(float, 4) AC_CHECK_SIZEOF(double, 8) AC_CHECK_SIZEOF(wchar_t, 4) # # Extract Major, Minor and Micro version # JAKELIB_MAJOR_VERSION=`echo $VERSION | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)\([[a-z]]*\)/\1/'` JAKELIB_MINOR_VERSION=`echo $VERSION | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)\([[a-z]]*\)/\2/'` JAKELIB_MICRO_VERSION=`echo $VERSION | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)\([[a-z]]*\)/\3/'` AC_DEFINE_UNQUOTED(JAKELIB_MAJOR_VERSION, $JAKELIB_MAJOR_VERSION ) AC_DEFINE_UNQUOTED(JAKELIB_MINOR_VERSION, $JAKELIB_MINOR_VERSION ) AC_DEFINE_UNQUOTED(JAKELIB_MICRO_VERSION, $JAKELIB_MICRO_VERSION ) # # Stuff copied from PCRE's configure.in # dnl Provide the current PCRE version information. Do not use numbers dnl with leading zeros for the minor version, as they end up in a C dnl macro, and may be treated as octal constants. Stick to single dnl digits for minor numbers less than 10. There are unlikely to be dnl that many releases anyway. PCRE_MAJOR=4 PCRE_MINOR=4 PCRE_DATE=21-August-2003 PCRE_VERSION=${PCRE_MAJOR}.${PCRE_MINOR} dnl Default values for miscellaneous macros POSIX_MALLOC_THRESHOLD=-DPOSIX_MALLOC_THRESHOLD=10 #AC_SUBST(BUILD_EXEEXT) #AC_SUBST(BUILD_OBJEXT) #AC_SUBST(CC_FOR_BUILD) #AC_SUBST(CFLAGS_FOR_BUILD) #AC_SUBST(HAVE_MEMMOVE) #AC_SUBST(HAVE_STRERROR) #AC_SUBST(LINK_SIZE) #AC_SUBST(MATCH_LIMIT) #AC_SUBST(NEWLINE) AC_SUBST(PCRE_MAJOR) AC_SUBST(PCRE_MINOR) AC_SUBST(PCRE_DATE) AC_SUBST(PCRE_VERSION) #AC_SUBST(PCRE_LIB_VERSION) #AC_SUBST(PCRE_POSIXLIB_VERSION) AC_SUBST(POSIX_MALLOC_THRESHOLD) AC_SUBST(UTF8) # # Create all Makefiles # AC_OUTPUT([Makefile src/Makefile src/lang/Makefile src/io/Makefile src/util/Makefile src/util/regex/Makefile src/net/Makefile src/text/Makefile src/text/enc/Makefile src/test/Makefile samples/Makefile include/Makefile include/jakelib2/Makefile include/jakelib2/lang/Makefile include/jakelib2/util/Makefile include/jakelib2/util/regex/Makefile include/jakelib2/io/Makefile include/jakelib2/net/Makefile include/jakelib2/gc/Makefile include/jakelib2/text/Makefile include/jakelib2/text/enc/Makefile jlpp/Makefile jlpp/lib/Makefile jlpp/include/Makefile share/Makefile share/template/Makefile share/aclocal/Makefile doc/Makefile jakelib2-config jakelib2-skeleton jakelib2-newclass doxygen.conf]) # # Print results / summary # AC_MSG_RESULT() AC_MSG_RESULT(----------------------------------------------------------------------------) AC_MSG_RESULT() if test "$enable_threads" = "1"; then AC_MSG_RESULT(Use Threads: on) else AC_MSG_RESULT(Use Threads: off) fi if test "$enable_debug" = "1"; then AC_MSG_RESULT(Debug mode: on) else AC_MSG_RESULT(Debug mode: off) fi #if test "$enable_stacktrace" = "1"; then # AC_MSG_RESULT(StackTrace mode: on) #else # AC_MSG_RESULT(StackTrace mode: off) #fi AC_MSG_RESULT() AC_MSG_RESULT(Jakelib2 configured successfully. run 'make; make test; make install') AC_MSG_RESULT() AH_TEMPLATE([CYGWIN], [Defined if this is a Cygwin environment.]) AH_TEMPLATE([LINUX], [Defined if this is a Linux environment.]) AH_TEMPLATE([UNIX], [Defined if this is some kind of Unix environment (including Linux).]) AH_TEMPLATE([WIN32], [Defined if this is a Windows32 environment.]) AH_TEMPLATE([MINGW32], [Defined if this is a Mingw32 environment.]) AH_TEMPLATE([MACOSX], [Defined if this is a MaxOS X environment.]) AH_TEMPLATE([POSIX], [Defined if this is a Posix environment.]) AH_TEMPLATE([HAVE_PTHREADS], [Defined if we have Posix threads]) AH_TEMPLATE([HAVE_WINTHREADS], [Defined if we have Win32 threads]) AH_TEMPLATE([JAKELIB_WIN32API], [Defined if we are using WIN32 API (MSVC++, MinGW)]) AH_TEMPLATE([JAKELIB_DEBUG], [Defined if debugging messages are switched on]) AH_TEMPLATE([JAKELIB_THREADS], [Defined if we have and use threads.]) AH_TEMPLATE([JAKELIB_STACKTRACE], [Defined if we have stack trace support]) AH_TEMPLATE([JAKELIB_MAJOR_VERSION], []) AH_TEMPLATE([JAKELIB_MINOR_VERSION], []) AH_TEMPLATE([JAKELIB_MICRO_VERSION], [])