if test "$USE_UNIX" = 1 ; then
wxUSE_UNIX=yes
AC_DEFINE(__UNIX__)
+ EXTRA_VPATH="$EXTRA_VPATH:\$(srcdir)/unix"
+ INCLUDE_SUBDIRS="$INCLUDE_SUBDIRS unix"
fi
dnl Linux: test for libc5/glibc2: glibc2 has gettext() included
AC_ARG_WITH(gtk-exec-prefix, [ --with-gtk-exec-prefix=PFX exec prefix where GTK is installed],
gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
AC_ARG_WITH(gtk, [ --with-gtk use GTK+],
- wxUSE_GTK="$withval",wxUSE_GTK=0)
+ [wxUSE_GTK="$withval" TOOLKIT_GIVEN=1])
AC_ARG_WITH(motif, [ --with-motif use Motif/Lesstif],
- wxUSE_MOTIF="$withval",wxUSE_MOTIF=0)
+ [wxUSE_MOTIF="$withval" TOOLKIT_GIVEN=1])
AC_ARG_WITH(cygwin, [ --with-cygwin use Cygwin for MS-Windows],
- wxUSE_CYGWIN="$withval",wxUSE_CYGWIN=0)
+ [wxUSE_CYGWIN="$withval" TOOLKIT_GIVEN=1])
AC_ARG_WITH(mingw, [ --with-mingw use GCC Minimal MS-Windows],
- wxUSE_MINGW="$withval",wxUSE_MINGW=0)
+ [wxUSE_MINGW="$withval" TOOLKIT_GIVEN=1])
AC_ARG_WITH(dmalloc, [ --with-dmalloc use dmalloc library (www.letters.com/dmalloc)],
wxUSE_DMALLOC="$withval",wxUSE_DMALLOC=$DEFAULT_wxUSE_DMALLOC)
wxUSE_OPTIMISE="$enableval",wxUSE_OPTIMISE=$DEFAULT_wxUSE_OPTIMISE)
AC_ARG_ENABLE(optimize, [ --enable-optimize create optimized code],
wxUSE_OPTIMISE="$enableval",wxUSE_OPTIMISE=$DEFAULT_wxUSE_OPTIMISE)
+AC_ARG_ENABLE(debug, [ --enable-debug same as debug_flag and debug_info],
+ wxUSE_DEBUG="${enableval}",wxUSE_DEBUG=$DEFAULT_wxUSE_DEBUG)
+
+if test "$wxUSE_DEBUG" = "yes"; then
+ DEFAULT_wxUSE_DEBUG_FLAG=yes
+ DEFAULT_wxUSE_DEBUG_INFO=yes
+elif test "$wxUSE_DEBUG" = "no"; then
+ DEFAULT_wxUSE_DEBUG_FLAG=no
+ DEFAULT_wxUSE_DEBUG_INFO=no
+fi
+
AC_ARG_ENABLE(debug_flag, [ --enable-debug_flag set __WXDEBUG__ flag (recommended for developers!)],
wxUSE_DEBUG_FLAG="$enableval",wxUSE_DEBUG_FLAG=$DEFAULT_wxUSE_DEBUG_FLAG)
AC_ARG_ENABLE(debug_info, [ --enable-debug_info create code with debugging information],
dnl check that no more than one toolkit is given and that if none are given that
dnl we have a default one
-dnl
+
+if test "$TOOLKIT_GIVEN" = 1; then
+ dnl convert "yes" to 1 and "no" to 0
+ wxUSE_GTK=`echo $wxUSE_GTK | sed -e 's/yes/1/' -e 's/no/0/'`
+ wxUSE_MOTIF=`echo $wxUSE_MOTIF | sed -e 's/yes/1/' -e 's/no/0/'`
+ wxUSE_MSW=`echo $wxUSE_MSW | sed -e 's/yes/1/' -e 's/no/0/'`
+else
+ dnl try to guess the most apropriate toolkit for this platform
+ wxUSE_GTK=$DEFAULT_wxUSE_GTK
+ wxUSE_MOTIF=$DEFAULT_wxUSE_MOTIF
+ wxUSE_MSW=$DEFAULT_wxUSE_MSW
+fi
+
dnl NB: this supposes that the shell is able to handle arithmetic expansion and
dnl the ${VAR:-VALUE} construction. It does simplify our life though...
NUM_TOOLKITS="$((${wxUSE_GTK:-0}+${wxUSE_MOTIF:-0}+${wxUSE_MSW:-0}))"
1)
;;
0)
- if test "$((${DEFAULT_wxUSE_GTK:-0}+${DEFAULT_wxUSE_MOTIF:-0}+${DEFAULT_wxUSE_MSW:-0}))" = 0; then
- AC_MSG_ERROR(Please specify a toolkit)
- fi
-
- wxUSE_GTK=$DEFAULT_wxUSE_GTK
- wxUSE_MOTIF=$DEFAULT_wxUSE_MOTIF
- wxUSE_MSW=$DEFAULT_wxUSE_MSW
+ AC_MSG_ERROR(Please specify a toolkit)
;;
*)
AC_MSG_ERROR(Please specify at most one toolkit)
dnl defines INSTALL with the appropriate command
AC_PROG_INSTALL
-dnl does ln -s works
-dnl defines LN_S with the appropriate command
-AC_PROG_LN_S
-
dnl strip command
dnl defines STRIP as strip or nothing if not found
AC_CHECK_PROG(STRIP, strip, strip, true)
dnl filename output by the lexer
AM_PROG_LEX
+dnl needed for making link to setup.h
+AC_PROG_LN_S
+
dnl libtool checks (disable static libs by default, this takes too much time...)
AM_DISABLE_STATIC
AM_PROG_LIBTOOL
AC_MSG_WARN(library will be compiled without support for images in XPM format)
fi
- GUI_TK_LINK="-lXm $(XPM_LINK)-lXmu -lXt -lX11 -lm"
+ GUI_TK_LINK="-lXm $XPM_LINK -lXmu -lXt -lX11 -lm"
GUI_TK_LIBRARY="$CHECK_LIB $GUI_TK_LINK"
TOOLKIT=MOTIF
fi
dnl the symbol which allows conditional compilation for the given toolkit
TOOLKIT_DEF=-D__WX${TOOLKIT}__
-dnl the name (without leading 'wx_') of the library
-WX_LIBRARY=${TOOLKIT_DIR}2
+dnl the name of the (libtool) library
+WX_LIBRARY_NAME="libwx_${TOOLKIT_DIR}2.la"
dnl ------------------------------------------------------------------------
dnl Check for headers
CXXFLAGS="${CXXFLAGS} -D_REENTRANT"
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS thread"
- EXTRA_VPATH="$EXTRA_VPATH:\$(srcdir)/unix"
LTLIBOBJS="$LTLIBOBJS $THREADS_OBJ"
dnl define autoconf macro to check for given function in both pthread and
AC_DEFINE(wxUSE_SOCKETS)
LTLIBOBJS="$LTLIBOBJS sckint.lo socket.lo sckaddr.lo protocol.lo http.lo ftp.lo url.lo"
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS wxsocket"
+ INCLUDE_SUBDIRS="$INCLUDE_SUBDIRS protocol"
else
AC_MSG_WARN(socket classes require --with-threads and won't be compiled without it)
wxUSE_SOCKETS=0
dnl misc options
dnl ---------------------------------------------------------------------------
-if test "$wxUSE_WXTREE" = "yes"; then
- AC_DEFINE(wxUSE_WXTREE)
-fi
+dnl TODO this is unused for now...
+dnl if test "$wxUSE_WXTREE" = "yes"; then
+dnl AC_DEFINE(wxUSE_WXTREE)
+dnl fi
if test "$wxUSE_METAFILE" = "yes"; then
AC_DEFINE(wxUSE_METAFILE)
dnl all the libraries needed to link wxWindows programs (when the library is not
dnl yet installed)
-LIBS="\${top_builddir}/src/libwx_${WX_LIBRARY}.la $EXTRA_LIBS"
+LIBS="\${top_builddir}/src/${WX_LIBRARY_NAME} $EXTRA_LIBS"
dnl all -I options we must pass to the compiler
INCLUDES="$TOOLKIT_INCLUDE $ZLIB_INCLUDE $LIBPNG_INCLUDE -I. -I\${top_builddir}/include -I\${top_srcdir}/include"
forty fractal image wxpoem"
fi
+dnl for convenience, sort the files to build in alphabetical order
+dnl
+dnl another shell command to do it which might be faster but is less clear:
+dnl LTLIBOBJS="`for obj in $LTLIBOBJS; do echo $obj; done | sort | sed 's@^@ @'`"
+LTLIBOBJS="`echo $LTLIBOBJS | tr -s ' ' | tr ' ' '\n' | sort | tr '\n' ' '`"
+
+dnl for convenience, sort the samples in alphabetical order
+dnl
+dnl FIXME For some mysterious reasons, sometimes the directories are duplicated
+dnl in this list - hence uniq. But normally, this shouldn't be needed!
+SAMPLES_SUBDIRS="`echo $SAMPLES_SUBDIRS | tr -s ' ' | tr ' ' '\n' | sort | uniq | tr '\n' ' '`"
+
dnl global options
AC_SUBST(WX_MAJOR_VERSION_NUMBER)
AC_SUBST(WX_MINOR_VERSION_NUMBER)
AC_SUBST(WX_RELEASE_NUMBER)
-AC_SUBST(WX_LIBRARY)
+AC_SUBST(WX_LIBRARY_NAME)
dnl suppress libtool's informational messages - they duplicate its command line
LIBTOOL="$LIBTOOL --silent"
AC_SUBST(LTLIBOBJS)
dnl additional subdirectories where we will build
+AC_SUBST(INCLUDE_SUBDIRS)
AC_SUBST(UTILS_SUBDIRS)
AC_SUBST(DOCS_SUBDIRS)
AC_SUBST(SAMPLES_SUBDIRS)
AC_SUBST(LIBS)
dnl create the configuration header file from the template
-SETUPH_DIR=include/wx/${TOOLKIT_DIR}
-mkdir -p ${SETUPH_DIR}
-AM_CONFIG_HEADER(${SETUPH_DIR}/setup.h:include/wx/unix/setup.h.in)
+dnl
+dnl NB: automake can't work correctly if our header lives in a directory which
+dnl is only determined at configure time, so we create it on the top-level
+dnl and make a link to allow '#include "wx/setup.h"' to still work
+AM_CONFIG_HEADER(setup.h)
dnl MAKE_SET will be replaced with "MAKE=..." or nothing if make sets MAKE
dnl itself (this is macro is required if SUBDIRS variable is used in Makefile.am
dnl (the original file name may be overriden by appending another name after a
dnl colon)
AC_OUTPUT([
- Makefile src/Makefile wx-config
+ wx-config
+ Makefile src/Makefile
+ include/Makefile
+ include/wx/Makefile
+ include/wx/generic/Makefile
+ include/wx/gtk/Makefile
+ include/wx/motif/Makefile
+ include/wx/msw/Makefile
+ include/wx/protocol/Makefile
+ include/wx/unix/Makefile
samples/Makefile
samples/bombs/Makefile
samples/caret/Makefile
samples/wxpoem/Makefile
samples/wxsocket/Makefile
],
- [chmod +x wx-config], [SETUPH_DIR=${SETUPH_DIR}])
+ [
+ chmod +x wx-config
+ if test ! -e include/wx/${TOOLKIT_DIR}/setup.h; then
+ ${LN_S} `pwd`/setup.h include/wx/${TOOLKIT_DIR}/setup.h
+ fi
+ ],
+ [
+ LN_S="${ac_cv_prog_LN_S}"
+ TOOLKIT_DIR="${TOOLKIT_DIR}"
+ ]
+ )