1 AC_INIT(src/engine/zoom.c)
2 AC_CONFIG_HEADER(src/include/aconfig.h)
7 AC_PROG_GCC_TRADITIONAL
10 dnl drivers to test (if available)
14 curses_driver_test=yes
21 dnl Long double is a way to archieve deeper zooms. It is very fast
22 dnl at intel processors familly but seems to be very slow at almost
23 dnl all other platforms. This switch tries to determine whether long_double
26 AC_ARG_WITH(long-double,
27 [ --with-long-double=yes/no Used to enable/disable usage of long double],[
28 if test x$withval = xyes; then
31 if test x$withval = xno; then
36 [ --with-pthread=yes Used to enable SMP support (experimental)],[
37 if test x$withval = xyes; then
40 if test x$withval = xno; then
45 AC_DEFUN(AC_PROG_CC_M,
46 [AC_CACHE_CHECK(whether ${CC-cc} accepts -m$1, ac_cv_prog_cc_m$1,
47 [echo 'void f(){}' > conftest.c
48 if test -z "`${CC-cc} -m$1 -c conftest.c 2>&1`"; then
55 AC_DEFUN(PROG_CC_SWITCH1,
56 [AC_CACHE_CHECK(whether ${CC-cc} accepts -$1, ac_$2,
57 [echo 'void f(){}' > conftest.c
58 if test -z "`${CC-cc} -$1 -c conftest.c 2>&1`"; then
60 CCOPTS1="$CCOPTS1 -$1"
66 AC_DEFUN(PROG_CC_SWITCH,
67 [AC_CACHE_CHECK(whether ${CC-cc} accepts -$1, ac_$2,
68 [echo 'void f(){}' > conftest.c
69 if test -z "`${CC-cc} -$1 -c conftest.c 2>&1`"; then
78 [AC_CACHE_CHECK(whether ${CC-cc} accepts -Os, ac_Os,
79 [echo 'void f(){}' > conftest.c
80 if test -z "`${CC-cc} -Os -c conftest.c 2>&1`"; then
91 if test x$long_double = xtest; then
93 i?86*) long_double=yes
103 AC_PROG_CC_M(pentium)
104 if test $ac_cv_prog_cc_mpentium = yes; then
108 if test $ac_cv_prog_cc_m586 = yes; then
116 AC_PROG_CC_M(pentiumpro)
117 if test $ac_cv_prog_cc_mpentiumpro = yes; then
121 if test $ac_cv_prog_cc_m686 = yes; then
129 #PROG_CC_SWITCH(mno-ieee-fp,ieefp)
141 dnl Checks for programs.
152 AC_ARG_WITH(x11-driver,
153 [ --with-x11-driver=no Used to disable x11 driver],[
154 if test x$withval = xno; then
158 AC_ARG_WITH(svga-driver,
159 [ --with-svga-driver=no Used to disable svga driver],[
160 if test x$withval = xno; then
164 AC_ARG_WITH(curses-driver,
165 [ --with-curses-driver=no Used to disable curses driver],[
166 if test x$withval = xno; then
167 curses_driver_test=no
170 AC_ARG_WITH(aa-driver,
171 [ --with-aa-driver=no Used to disable aa-lib driver],[
172 if test x$withval = xno; then
177 if test "$x_driver_test" = yes -o "$aa_driver_test" = yes; then
182 dnl This part supplies reasonable defaults for CFLAGS, if they weren't
183 dnl specified by ''CFLAGS=flags ./configure''
186 if test x$GCC = xyes; then
187 if test x$ac_cv_prog_gcc_g = xyes; then
194 if test "x$CCOPTS" = x; then
195 if test x$GCC = xyes; then
197 if test x$mflag = x486; then
198 CCOPTS="-Wall $mmflag -fstrength-reduce -ffast-math -fomit-frame-pointer -pipe "
199 PROG_CC_SWITCH(fno-exceptions,exceptions)
200 CCOPTS1="$CCOPTS -O6 -funroll-loops"
201 if test x$use_cc_g_flag = xyes; then
202 if test $cc_uses_g = yes; then
207 CCOPTS='-Wall -fstrength-reduce -ffast-math -pipe'
208 PROG_CC_SWITCH(fno-exceptions,exceptions)
209 CCOPTS1='-O6 -Wall -fstrength-reduce -ffast-math -fforce-mem -fforce-addr -funroll-loops -pipe'
210 if test x$use_cc_g_flag = xyes; then
211 if test $cc_uses_g = yes; then
216 if test x$ac_Os = xyes; then
221 PROG_CC_SWITCH1(fmove-all-movables,movables)
222 PROG_CC_SWITCH1(frerun-loop-opt,loopopt)
224 if test x$use_cc_g_flag = xyes; then
230 CCOPTS="-Aa -D_INCLUDE_POSIX_SOURCE -D_INCLUDE_HPUX_SOURCE -D_INCLUDE_XOPEN_SOURCE +O3"
233 PROG_CC_SWITCH(O,optimizations)
241 if test "$CCOPTS1" = "" ; then
251 CFLAGS1=${CFLAGS1--O}
252 LDFLAGS=${LDFLAGS--O}
254 if test x$pthread = xtest; then
255 AC_CHECK_FUNCS(pthread_create)
256 if test "x$ac_cv_func_pthread_create" = xyes; then
257 AC_DEFINE(USE_PTHREAD)
258 CFLAGS="$CFLAGS -D_REENTRANT"
259 CFLAGS1="$CFLAGS1 -D_REENTRANT"
260 AC_CHECK_FUNCS(pthread_sighandler)
262 AC_CHECK_LIB(pthread,pthread_create)
263 if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then
264 AC_DEFINE(USE_PTHREAD)
265 CFLAGS="$CFLAGS -D_REENTRANT"
266 CFLAGS1="$CFLAGS1 -D_REENTRANT"
267 AC_CHECK_FUNCS(pthread_sighandler)
269 echo "No pthread library available! Can not compile threaded version"
275 AC_DEFUN(AC_USE_SUNOS_CURSES, [
278 screen_manager="SunOS 4.x /usr/5include curses"
279 AC_MSG_RESULT(Using SunOS 4.x /usr/5include curses)
280 AC_DEFINE(SUNOS_CURSES)
281 AC_DEFINE(NO_COLOR_SUPPORT)
282 AC_DEFINE(USE_SYSV_CURSES)
283 CFLAGS="$CFLAGS -I/usr/5include"
284 AC_MSG_RESULT(Please note that some screen refreshs may fail)
285 AC_WARN(Reconsider using Slang)
292 LIBS="$LIBS $X_EXTRA_LIBS $X_LIBS -lX11"
293 if test -f $1/aalib.h
297 unset ac_cv_lib_aa_aa_init
298 AC_CHECK_LIB(aa, aa_init)
299 if test "x$ac_cv_lib_aa_aa_init" = xyes; then
300 AC_MSG_RESULT(Found aalib on $1/aalib.h)
306 unset ac_cv_lib_aa_aa_init
313 AC_DEFUN(AC_USE_OSF1_CURSES, [
314 AC_CHECK_LIB(curses, initscr)
315 if test "x$ac_cv_lib_curses_initscr" = xyes; then
316 AC_MSG_RESULT(Using OSF1 curses)
319 screen_manager="OSF1 curses"
320 AC_DEFINE(NO_COLOR_SUPPORT)
321 AC_DEFINE(USE_SYSV_CURSES)
325 AC_DEFUN(AC_USE_SYSV_CURSES, [
326 AC_CHECK_LIB(curses, initscr)
327 if test "x$ac_cv_lib_curses_initscr" = xyes; then
328 AC_MSG_RESULT(Using SysV curses)
330 AC_DEFINE(USE_SYSV_CURSES)
332 screen_manager="SysV/curses"
336 AC_ARG_WITH(sunos-curses,
337 [ --with-sunos-curses Used to force SunOS 4.x curses],[
338 if test x$withval = xyes; then
343 AC_ARG_WITH(osf1-curses,
344 [ --with-osf1-curses Used to force OSF/1 curses],[
345 if test x$withval = xyes; then
351 [ --with-vcurses[=incdir] Used to force SysV curses],
352 if test x$withval = xyes; then
355 CFLAGS="$CFLAGS -I$withval"
361 [ --with-ncurses[=base-dir] Compile with ncurses/locate base dir],
362 if test x$withval = xyes
366 LIBS="$LIBS -L$withval/lib -lncurses"
367 CFLAGS="$CFLAGS -I$withval/include"
370 screen_manager="ncurses"
371 AC_DEFINE(USE_NCURSES)
377 dnl Parameters: directory filename LIBS_append CFLAGS_append nicename
379 AC_DEFUN(AC_NCURSES, [
386 AC_CHECK_LIB(ncurses, initscr)
387 if test "x$ac_cv_lib_ncurses_initscr" = xyes; then
388 AC_MSG_RESULT(Found ncurses on $1/$2)
394 AC_DEFINE(USE_NCURSES)
396 unset ac_cv_lib_ncurses_initscr
404 dnl Parameters: directory filename LIBS_append CFLAGS_append nicename
406 AC_DEFUN(AC_CURSES, [
413 AC_CHECK_LIB(curses, initscr)
414 if test "x$ac_cv_lib_curses_initscr" = xyes; then
415 AC_MSG_RESULT(Found generic curses on $1/$2)
420 AC_DEFINE(USE_CURSES)
422 unset ac_cv_lib_curses_initscr
429 if test "$aa_driver_test" = yes; then
430 AC_CHECKING("location of curses")
431 AC_CHECK_LIB(gpm, Gpm_Repeat)
432 dnl Replace `main' with a function in -lm:
433 AC_CHECK_LIB(slang, SLsmg_init_smg)
435 AC_NCURSES(/usr/include, ncurses.h, , -I/usr/include/ncurses , "ncurses on /usr/include")
436 AC_NCURSES(/usr/include/ncurses, ncurses.h, , -I/usr/include/ncurses, "ncurses on /usr/include/ncurses")
437 AC_NCURSES(/usr/local/include, ncurses.h, ,-L/usr/local/lib, -I/usr/local/include, "ncurses on /usr/local")
438 AC_NCURSES(/usr/local/include/ncurses, ncurses.h, -L/usr/local/lib -L/usr/local/lib/ncurses, -I/usr/local/include/ncurses, "ncurses on /usr/local/include/ncurses")
440 AC_NCURSES(/usr/local/include/ncurses, curses.h, -L/usr/local/lib, -I/usr/local/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/local/.../ncurses")
442 AC_NCURSES(/usr/include/ncurses, curses.h, , -I/usr/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/include/ncurses")
443 AC_CURSES(/usr/include, curses.h, , , "curses on /usr/include")
446 dnl We couldn't find ncurses, try SysV curses
450 AC_EGREP_HEADER(init_color, /usr/include/curses.h,
455 dnl Try SunOS 4.x /usr/5{lib,include} ncurses
456 dnl The flags SUNOS_CURSES, USE_BSD_CURSES and BUGGY_CURSES
457 dnl should be replaced by a more fine grained selection routine
461 if test -f /usr/5include/curses.h
468 if test "x$no_x" = x; then
469 LIBS="$LIBS $X_EXTRA_LIBS $X_LIBS"
470 CFLAGS="$CFLAGS $X_CFLAGS"
472 AC_AALIB(/usr/include, , )
473 AC_AALIB(/usr/local/include, -L/usr/local/lib, -I/usr/local/include)
474 for name in ../aalib-*.*
476 AC_AALIB($name,"-L$name","-I$name")
483 curses_driver_test=no
487 if test "$curses_driver_test" = yes; then
490 AC_CHECKING("location of curses")
492 AC_NCURSES(/usr/include, ncurses.h, , -I/usr/include/ncurses , "ncurses on /usr/include")
493 AC_NCURSES(/usr/include/ncurses, ncurses.h, , -I/usr/include/ncurses, "ncurses on /usr/include/ncurses")
494 AC_NCURSES(/usr/local/include, ncurses.h, ,-L/usr/local/lib, -I/usr/local/include, "ncurses on /usr/local")
495 AC_NCURSES(/usr/local/include/ncurses, ncurses.h, -L/usr/local/lib -L/usr/local/lib/ncurses, -I/usr/local/include/ncurses, "ncurses on /usr/local/include/ncurses")
497 AC_NCURSES(/usr/local/include/ncurses, curses.h, -L/usr/local/lib, -I/usr/local/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/local/.../ncurses")
499 AC_NCURSES(/usr/include/ncurses, curses.h, , -I/usr/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/include/ncurses")
500 AC_CURSES(/usr/include, curses.h, , , "curses on /usr/include")
503 dnl We couldn't find ncurses, try SysV curses
507 AC_EGREP_HEADER(init_color, /usr/include/curses.h,
512 dnl Try SunOS 4.x /usr/5{lib,include} ncurses
513 dnl The flags SUNOS_CURSES, USE_BSD_CURSES and BUGGY_CURSES
514 dnl should be replaced by a more fine grained selection routine
518 if test -f /usr/5include/curses.h
524 AC_CHECK_FUNCS(mousemask termattrs wredrawln redrawwin)
527 if test "$vga_driver_test" = yes; then
528 AC_CHECK_LIB(vga, vga_hasmode)
529 AC_CHECK_LIB(vgagl, gl_write)
533 dnl Checks for header files.
535 AC_CHECK_HEADERS(limits.h sys/time.h unistd.h)
537 dnl Checks for typedefs, structures, and compiler characteristics.
540 if test "x$long_double" = xyes; then
543 echo Long double disabled, since it should be too slow at this CPU
547 test "x$prefix" = xNONE && prefix=$ac_default_prefix
548 eval datadir2=$datadir
549 AC_DEFINE_UNQUOTED(DATAPATH,"${datadir2}/XaoS")
551 AC_CHECK_SIZEOF(short)
553 AC_CHECK_SIZEOF(long)
555 dnl Checks for library functions.
558 AC_CHECK_LIB(z, inflate)
559 if test x"$ac_cv_lib_z_inflate" = xno; then
560 AC_CHECK_LIB(gz, inflate)
561 if test x"$ac_cv_lib_gz_inflate" = xno; then
565 AC_CHECK_LIB(png, png_create_info_struct)
566 if test x"$ac_cv_lib_png_png_create_info_struct" = xno; then
569 if test "$save_code" = yes; then
574 AC_CHECK_FUNCS(gettimeofday usleep select setitimer ftime finite)
576 if test "$x_driver_test" = yes; then
578 if test "x$no_x" = x; then
579 AC_CHECK_HEADER(sys/ipc.h, AC_DEFINE(HAVE_IPC_H), no_sys_ipc=yes)
580 AC_CHECK_HEADER(sys/shm.h, AC_DEFINE(HAVE_IPC_H), no_sys_shm=yes)
582 AC_MSG_CHECKING(X11/extensions/XShm.h)
583 if eval "test -f $x_includes/X11/extensions/XShm.h"; then
585 AC_DEFINE(HAVE_MITSHM_H)
591 dnl AC_CHECK_LIB(Xext,XShmEventBase,LIBS="$LIBS -lXext", no_ext_lib=yes, $X_LIBS)
592 AC_CHECK_LIB(Xext,XShmAttach,LIBS="$LIBS -lXext", no_ext_lib=yes, $X_LIBS )
596 echo "------------------------------------------------------------"
597 echo "Avaiable drivers:"
599 if test "$aa_driver_test" = yes; then
600 if test "x$aa_driver" = xtrue; then
603 DRIVERDIRS="$DRIVERDIRS ui/ui-drv/aa"
604 DRIVERLIBS="$DRIVERLIBS lib/libuiaa.a"
609 if test "$curses_driver_test" = yes; then
610 if test "x$curses_driver" = xtrue; then
611 dnl if test "x$ac_cv_lib_ncurses_initscr" = xyes; then
613 AC_DEFINE(CURSES_DRIVER)
614 DRIVERDIRS="$DRIVERDIRS ui/ui-drv/curses"
615 DRIVERLIBS="$DRIVERLIBS lib/libuicurses.a"
616 if test "x$ac_cv_func_mousemask" = xyes; then
617 echo " ncurses with additional mouse driver"
622 dnl if test "x$ac_cv_lib_curses_initscr" = xyes; then
625 dnl AC_DEFINE(CURSES_DRIVER)
629 if test "$x_driver_test" = yes; then
630 if test "x$no_x" = x; then
632 AC_DEFINE(X11_DRIVER)
633 DRIVERDIRS="$DRIVERDIRS ui/ui-drv/x11"
634 DRIVERLIBS="$DRIVERLIBS lib/libuix11.a"
635 if test "x$no_sys_ipc$no_sys_shm y$ac_cv_lib_Xext_XShmAttach" = "x yyes"; then
636 echo " X11 with MIT shared memory support"
641 LIBS="$LIBS $X_EXTRA_LIBS $X_LIBS -lX11"
642 CFLAGS="$CFLAGS $X_CFLAGS"
643 CFLAGS1="$CFLAGS1 $X_CFLAGS"
646 if test "$vga_driver_test" = yes; then
647 if test "x$ac_cv_lib_vga_vga_hasmode$ac_cv_lib_vgagl_gl_write" = xyesyes; then
649 AC_DEFINE(SVGA_DRIVER)
650 STICKY='chmod +s $(bindir)/xaos; chown root $(bindir)/xaos; chgrp root $(bindir)/xaos'
651 DRIVERDIRS="$DRIVERDIRS ui/ui-drv/svga"
652 DRIVERLIBS="$DRIVERLIBS lib/libuisvga.a"
653 if test "x$ac_cv_func_pthread_sighandler" = xyes; then
654 echo " SVGAlib with linuxthread hack"
660 REALTOPDIR=`nolinks=1; pwd`
662 BINPATH="$REALTOPDIR/bin"
666 SRCPATH="$REALTOPDIR/src"
668 LIBPATH="$SRCPATH/lib"
670 # does this work if you do make -C <some dir>
671 TOPDIR=`nolinks=1;pwd`
674 INCDIR="-I${SRCPATH}/include"
675 CFLAGS="$CFLAGS $INCDIR"
676 CFLAGS1="$CFLAGS1 $INCDIR"
685 echo "Compiler options:"
687 echo " CFLAGS : $CFLAGS"
688 echo " CFLAGS1 : $CFLAGS1"
689 echo " LDLAGS : $LDLAGS"
691 echo " X_LIBS : $X_LIBS"
692 echo "------------------------------------------------------------"
693 AC_OUTPUT(Makefile src/Makefile src/engine/Makefile src/util/Makefile src/ui/Makefile src/filter/Makefile
694 src/ui/ui-drv/curses/Makefile
695 src/ui/ui-drv/aa/Makefile
696 src/ui/ui-drv/svga/Makefile
697 src/ui/ui-drv/x11/Makefile
699 echo "------------------------------------------------------------"
701 echo "READ CUREFULLY FOLLOWING WARNINGS"
703 if test "x$ac_cv_header_stdc" = xno; then
704 AC_MSG_WARN(There is no ansi c headers avaiable. XaoS will have troubles with compiling.)
707 if test "x$ac_cv_prog_gcc" = xyes; then
710 AC_MSG_WARN(The gnu c compiler is recomended to get best performance. XaoS crashes many compiler so your compiler can cause troubles.)
712 if test "x$ac_cv_c_long_double" = xyes; then
713 if test "x$long_double" = xyes; then
714 AC_MSG_WARN(Long double enabled. This works well for x86 architectures. On other systems this should slow down much. Especially on sun workstations. If XaoS works incredibly slowly try to rebuild it using:
715 configure --with-long-double=no
720 if test "x$drivers" = xno; then
721 AC_MSG_WARN(There is no driver avaible. XaoS will not start.)
724 if test "x$config_problem" = xyes; then
725 AC_MSG_WARN(There was a problem with automatic configuration.)
726 AC_MSG_WARN(Read INSTALL file for trouble-shooting tips.)
728 if test x"$ac_cv_lib_z_inflate" = xno; then
729 if test x"$ac_cv_lib_gz_inflate" = xno; then
730 echo "You need zlib to compile XaoS with image saving code."
731 echo "Please download it from:"
732 echo " XaoS homepage at http://www.paru.cas.cz/~hubicka/XaoS"
733 echo " or ftp://sunsite.unc.edu/pub/Linux/libs"
734 echo " or ftp://ftp.uu.net/graphics/png/src/zlib-0.95.tar.gz"
738 if test x"$ac_cv_lib_png_png_create_info_struct" = xno; then
739 echo "You need pnglib to compile XaoS with image saving code."
740 echo "Please download it from:"
741 echo " XaoS homepage at http://www.paru.cas.cz/~hubicka/XaoS"
742 echo " or ftp://sunsite.unc.edu/pub/Linux/libs"
743 echo " or ftp://ftp.uu.net/graphics/png/src/libpng-0.81.tar.gz"
747 echo "END OF WARNINGS"
749 echo "In case you have troubles with compiling or running"
750 echo "XaoS please read compilers.txt."
751 echo "------------------------------------------------------------"