1#2345678901234567890123456789012345678901234567890123456789012345678901234567890 2AC_INIT([gui/main.cxx]) 3AM_CONFIG_HEADER(config.h) 4 5# WARNING! Version number must have 4 characters! 6# So use 1.20 instead of 1.2 !!! 7AM_INIT_AUTOMAKE(quat,1.20) 8 9# get rid of the autoconf defaults that are set if 10# variables are empty (-g -O2) 11CFLAGS="${CFLAGS:=}" 12CXXFLAGS="${CXXFLAGS:=}" 13CPPFLAGS="${CPPFLAGS:=}" 14LDFLAGS="${LDFLAGS:=}" 15#DEFS="${DEFS:=}" 16LIBS="${LIBS:=}" 17 18enableval=yes; 19AC_ARG_ENABLE(gui, [AC_HELP_STRING(--enable-gui,[also compile and link the GUI. [default=yes]])]) 20if test x$enableval != xno; then 21 enable_gui=yes 22fi 23 24enableval=no; 25AC_ARG_ENABLE(cygwin, [AC_HELP_STRING(--enable-cygwin,[use cygwin.dll. [default=no]])]) 26if test x$enableval = xyes; then 27 enable_cygwin=yes 28else 29 enable_cygwin=no 30fi 31 32enableval=no; 33AC_ARG_ENABLE(debug, [AC_HELP_STRING(--enable-debug,[enable debugging. [default=no]])]) 34if test x$enableval = xyes; then 35 CFLAGS="-g $CFLAGS" 36 CXXFLAGS="-g $CXXFLAGS" 37fi 38 39enableval=no; 40AC_ARG_ENABLE(prof, [AC_HELP_STRING(--enable-prof,[enable profiling. [default=no]])]) 41if test x$enableval = xyes; then 42 if test x$enable_debug = xyes; then 43 CFLAGS="-pg $CFLAGS" 44 CXXFLAGS="-pg $CXXFLAGS" 45 else 46 CFLAGS="-pg -g $CFLAGS" 47 CXXFLAGS="-pg -g $CXXFLAGS" 48 fi 49 LDADD="-pg $LDADD" 50fi 51 52dnl AC_ARG_WITH(optim, [AC_HELP_STRING([--with-optim="flags"],[use custom optimization flags])]) 53 54AC_LANG(C) 55AC_PROG_CC 56AC_PROG_INSTALL 57AC_PROG_AWK 58AC_PROG_LN_S 59AC_PROG_RANLIB 60 61# DEBUG_ONLY 62 # Do this first, as it changes the compiler's 63 # behaviour, like undefining 'inline' 64# #ACX_FLAG(-pg,pg) 65# ACX_FLAG(-ansi,ansi) 66# ACX_FLAG(-pedantic,pedantic) 67# DEBUG_ONLY_END 68 69dnl AC_CHECK_HEADERS([stdlib.h string.h]) 70 71AC_C_CONST 72AC_C_INLINE 73 74# don't do AC_TYPE_SIZE_T, because it invokes a check 75# for unistd.h, which confuses zlib.h in strict ansi mode. 76# (zconf.h uses HAVE_UNISTD_H to define z_off_t to off_t 77# which isn't available in strict ansi mode) 78#AC_TYPE_SIZE_T 79AC_FUNC_MALLOC 80AC_CHECK_FUNCS([memmove memset strchr strrchr strstr strtod strtol]) 81 82AC_CANONICAL_HOST 83case "$host_os" in 84 *cygwin* ) if test x$enable_cygwin != xyes; then 85 CPPFLAGS="-mno-cygwin $CPPFLAGS" 86 LDFLAGS="-mno-cygwin $LDFLAGS" 87 AC_MSG_WARN([ 88 There may be problems with C++ include files and libs in no-cygwin mode, 89 because Cygwin lacks them currently. 90 See 'INSTALL' file for more information.]) 91 fi;; 92esac 93 94ACX_FLAG(-Wall,Wall) 95ACX_FLAG(-O3,O3,,[ACX_FLAG(-O2,O2,,[ACX_FLAG(-O,O)])]) 96ACX_FLAG(-ffast-math,ffast_math) 97 98AC_SEARCH_LIBS(pow, m) 99 100AC_CHECK_FUNCS([floor pow sqrt]) 101 102ACX_CHECK_LIB(zlib.h,z,gzopen,, 103 [AC_MSG_ERROR([Library 'zlib' is required, aborting.])]) 104 105# save libs without Win/X, in case a console version will be compiled. 106SAVELDFLAGS="$LDFLAGS" 107SAVELIBS="$LIBS" 108if test x$enable_gui = xyes; then 109 ACX_FLTK_CONFIG(1.1,[--use-images], 110 [FLTK_am_cond=yes 111 AC_DEFINE_UNQUOTED(GUI, 1, [Define if you want to build the GUI (FLTK, X/Windows required.)]) 112 case "$host_os" in 113 *cygwin* | *mingw* ) 114 WIN32_am_cond=yes 115 AC_DEFINE_UNQUOTED(WIN32, 1, [Define if you compile on Windows.]);; 116 esac 117 ],[ 118 enable_gui=no 119 LDFLAGS="$SAVELDFLAGS" 120 LIBS="$SAVELIBS" 121 AC_MSG_WARN([ 122 'fltk-config' not found. Compiling console version. 123 If FLTK 1.1.x is not installed, please install it first if you want to 124 compile the GUI version (strongly recommended). 125 If FLTK 1.1.x is installed, and 'fltk-config' is not in your path, use 126 the variable 'FLTK' in the configure command. Example: 127 ./configure FLTK=/usr/local/fltk-1.1.0/bin/fltk-config]) 128 ]) 129fi 130 131if test x$enable_gui = xyes; then 132 SAVELIBS="$LIBS" 133 LIBS="" 134 AC_LANG_PUSH(C++) 135 AC_PROG_CXX 136 137 ACX_FLAG(-Wall,Wall) 138 ACX_FLAG(-fno-exceptions,fno_exceptions) 139 ACX_FLAG(-fno-rtti,fno_rtti) 140 ACX_FLAG(-O3,O3,,[ACX_FLAG(-O2,O2,,[ACX_FLAG(-O,O)])]) 141 ACX_FLAG(-ffast-math,ffast_math) 142 143# DEBUG_ONLY 144# #ACX_FLAG(-pg,pg) 145# ACX_FLAG(-ansi,ansi) 146# ACX_FLAG(-pedantic,pedantic) 147# DEBUG_ONLY_END 148 149 ACX_NAMESPACE 150 ACX_M_PI 151 ACX_FL_PIXMAP 152 153 LIBS="$SAVELIBS" 154 AC_LANG_POP(C++) 155else 156 AC_CHECK_FUNCS([select]) 157 AC_HEADER_TIME 158 AC_CHECK_HEADERS([termios.h sys/time.h memory.h]) 159 AC_CHECK_HEADER(conio.h, [AC_DEFINE_UNQUOTED(GCC_DOS, 1, [Define if you compile text version under DOS and have conio.h])]) 160 fltk=no 161fi 162 163# DEBUG_ONLY 164# AC_CHECK_LIB(efence, Page_Size) 165# DEBUG_ONLY_END 166 167AM_CONDITIONAL(FLTK, [test x$FLTK_am_cond = xyes] ) 168AM_CONDITIONAL(WIN32, [test x$WIN32_am_cond = xyes] ) 169 170dnl CONFIGURE_DEBUG_ONLY 171#echo CPPFLAGS: x"$CPPFLAGS"x 172#echo CFLAGS: x"$CFLAGS"x 173#echo CXXFLAGS: x"$CXXFLAGS"x 174#echo LDADD: x"$LDADD"x 175#echo LDFLAGS: x"$LDFLAGS"x 176#echo LIBS: x"$LIBS"x 177dnl CONFIGURE_DEBUG_ONLY_END 178 179CXXFLAGS="$CXXFLAGS -DDOCDIR=\\\"$datadir/$PACKAGE\\\"" 180 181AC_OUTPUT(Makefile \ 182 doc/Makefile \ 183 kernel/Makefile \ 184 gui/Makefile) 185 186 187 188 189