#2345678901234567890123456789012345678901234567890123456789012345678901234567890 AC_INIT([gui/main.cxx]) AM_CONFIG_HEADER(config.h) # WARNING! Version number must have 4 characters! # So use 1.20 instead of 1.2 !!! AM_INIT_AUTOMAKE(quat,1.20) # get rid of the autoconf defaults that are set if # variables are empty (-g -O2) CFLAGS="${CFLAGS:=}" CXXFLAGS="${CXXFLAGS:=}" CPPFLAGS="${CPPFLAGS:=}" LDFLAGS="${LDFLAGS:=}" #DEFS="${DEFS:=}" LIBS="${LIBS:=}" enableval=yes; AC_ARG_ENABLE(gui, [AC_HELP_STRING(--enable-gui,[also compile and link the GUI. [default=yes]])]) if test x$enableval != xno; then enable_gui=yes fi enableval=no; AC_ARG_ENABLE(cygwin, [AC_HELP_STRING(--enable-cygwin,[use cygwin.dll. [default=no]])]) if test x$enableval = xyes; then enable_cygwin=yes else enable_cygwin=no fi enableval=no; AC_ARG_ENABLE(debug, [AC_HELP_STRING(--enable-debug,[enable debugging. [default=no]])]) if test x$enableval = xyes; then CFLAGS="-g $CFLAGS" CXXFLAGS="-g $CXXFLAGS" fi enableval=no; AC_ARG_ENABLE(prof, [AC_HELP_STRING(--enable-prof,[enable profiling. [default=no]])]) if test x$enableval = xyes; then if test x$enable_debug = xyes; then CFLAGS="-pg $CFLAGS" CXXFLAGS="-pg $CXXFLAGS" else CFLAGS="-pg -g $CFLAGS" CXXFLAGS="-pg -g $CXXFLAGS" fi LDADD="-pg $LDADD" fi dnl AC_ARG_WITH(optim, [AC_HELP_STRING([--with-optim="flags"],[use custom optimization flags])]) AC_LANG(C) AC_PROG_CC AC_PROG_INSTALL AC_PROG_AWK AC_PROG_LN_S AC_PROG_RANLIB # DEBUG_ONLY # Do this first, as it changes the compiler's # behaviour, like undefining 'inline' # #ACX_FLAG(-pg,pg) # ACX_FLAG(-ansi,ansi) # ACX_FLAG(-pedantic,pedantic) # DEBUG_ONLY_END dnl AC_CHECK_HEADERS([stdlib.h string.h]) AC_C_CONST AC_C_INLINE # don't do AC_TYPE_SIZE_T, because it invokes a check # for unistd.h, which confuses zlib.h in strict ansi mode. # (zconf.h uses HAVE_UNISTD_H to define z_off_t to off_t # which isn't available in strict ansi mode) #AC_TYPE_SIZE_T AC_FUNC_MALLOC AC_CHECK_FUNCS([memmove memset strchr strrchr strstr strtod strtol]) AC_CANONICAL_HOST case "$host_os" in *cygwin* ) if test x$enable_cygwin != xyes; then CPPFLAGS="-mno-cygwin $CPPFLAGS" LDFLAGS="-mno-cygwin $LDFLAGS" AC_MSG_WARN([ There may be problems with C++ include files and libs in no-cygwin mode, because Cygwin lacks them currently. See 'INSTALL' file for more information.]) fi;; esac ACX_FLAG(-Wall,Wall) ACX_FLAG(-O3,O3,,[ACX_FLAG(-O2,O2,,[ACX_FLAG(-O,O)])]) ACX_FLAG(-ffast-math,ffast_math) AC_SEARCH_LIBS(pow, m) AC_CHECK_FUNCS([floor pow sqrt]) ACX_CHECK_LIB(zlib.h,z,gzopen,, [AC_MSG_ERROR([Library 'zlib' is required, aborting.])]) # save libs without Win/X, in case a console version will be compiled. SAVELDFLAGS="$LDFLAGS" SAVELIBS="$LIBS" if test x$enable_gui = xyes; then ACX_FLTK_CONFIG(1.1,[--use-images], [FLTK_am_cond=yes AC_DEFINE_UNQUOTED(GUI, 1, [Define if you want to build the GUI (FLTK, X/Windows required.)]) case "$host_os" in *cygwin* | *mingw* ) WIN32_am_cond=yes AC_DEFINE_UNQUOTED(WIN32, 1, [Define if you compile on Windows.]);; esac ],[ enable_gui=no LDFLAGS="$SAVELDFLAGS" LIBS="$SAVELIBS" AC_MSG_WARN([ 'fltk-config' not found. Compiling console version. If FLTK 1.1.x is not installed, please install it first if you want to compile the GUI version (strongly recommended). If FLTK 1.1.x is installed, and 'fltk-config' is not in your path, use the variable 'FLTK' in the configure command. Example: ./configure FLTK=/usr/local/fltk-1.1.0/bin/fltk-config]) ]) fi if test x$enable_gui = xyes; then SAVELIBS="$LIBS" LIBS="" AC_LANG_PUSH(C++) AC_PROG_CXX ACX_FLAG(-Wall,Wall) ACX_FLAG(-fno-exceptions,fno_exceptions) ACX_FLAG(-fno-rtti,fno_rtti) ACX_FLAG(-O3,O3,,[ACX_FLAG(-O2,O2,,[ACX_FLAG(-O,O)])]) ACX_FLAG(-ffast-math,ffast_math) # DEBUG_ONLY # #ACX_FLAG(-pg,pg) # ACX_FLAG(-ansi,ansi) # ACX_FLAG(-pedantic,pedantic) # DEBUG_ONLY_END ACX_NAMESPACE ACX_M_PI ACX_FL_PIXMAP LIBS="$SAVELIBS" AC_LANG_POP(C++) else AC_CHECK_FUNCS([select]) AC_HEADER_TIME AC_CHECK_HEADERS([termios.h sys/time.h memory.h]) AC_CHECK_HEADER(conio.h, [AC_DEFINE_UNQUOTED(GCC_DOS, 1, [Define if you compile text version under DOS and have conio.h])]) fltk=no fi # DEBUG_ONLY # AC_CHECK_LIB(efence, Page_Size) # DEBUG_ONLY_END AM_CONDITIONAL(FLTK, [test x$FLTK_am_cond = xyes] ) AM_CONDITIONAL(WIN32, [test x$WIN32_am_cond = xyes] ) dnl CONFIGURE_DEBUG_ONLY #echo CPPFLAGS: x"$CPPFLAGS"x #echo CFLAGS: x"$CFLAGS"x #echo CXXFLAGS: x"$CXXFLAGS"x #echo LDADD: x"$LDADD"x #echo LDFLAGS: x"$LDFLAGS"x #echo LIBS: x"$LIBS"x dnl CONFIGURE_DEBUG_ONLY_END CXXFLAGS="$CXXFLAGS -DDOCDIR=\\\"$datadir/$PACKAGE\\\"" AC_OUTPUT(Makefile \ doc/Makefile \ kernel/Makefile \ gui/Makefile)