dnl Process this file with autoconf to produce a configure script. AC_INIT(src/cce.cfg) #, 0.51, herui_cce@yahoo.com) dnl Detect the canonical host and target build environment dnl AC_CANONICAL_HOST dnl AC_CANONICAL_TARGET AC_CANONICAL_SYSTEM AM_CONFIG_HEADER(include/config.h) AM_INIT_AUTOMAKE(cce, 0.51) AC_PREFIX_DEFAULT(/usr/local) #AC_PREFIX_DEFAULT(/usr) # If you uncomment the 2nd line, cce will be installed into /usr/bin # and fonts/input methods to /usr/lib/cce, otherwise /usr/local/bin and # /usr/local/lib/cce # If you use /usr, the configure script will generate the wrong man page # directory for FreeBSD(/usr/man/man1 instead of /usr/share/man/man1) # if test "x$prefix" = "xNONE"; then prefix=$ac_default_prefix ac_configure_args="$ac_configure_args --prefix $prefix" fi dnl Check target architecture case $target in i?86*) AC_DEFINE(CCE_TARGETARCH_I386, 1, [Define this for i386 architecture]);; m68k*) AC_DEFINE(CCE_TARGETARCH_M68K, 1, [Define this for M68K architecture]);; mips*) AC_DEFINE(CCE_TARGETARCH_MIPS, 1, [Define this for MIPS architecture]);; arm*|xscale*) AC_DEFINE(CCE_TARGETARCH_ARM, 1, [Define this for ARM/XScale architecture]);; powerpc*) AC_DEFINE(CCE_TARGETARCH_POWERPC, 1, [Define this for PowerPC architecture]);; esac dnl Check target OS case $target in *linux*) CCE_TARGETOS=Linux;; *freebsd*) CCE_TARGETOS=FreeBSD;; *netbsd*) CCE_TARGETOS=NetBSD case $target in i?86*) OSDEP_LIB='-li386';; esac;; *openbsd*) CCE_TARGETOS=OpenBSD case $target in i?86*) OSDE_LIB='-li386';; esac;; *solaris* | *sunos*) CCE_TARGETOS=Solaris CFLAGS="$CFLAGS -D__SunOS__" OSDEP_FILE='osdep_inout.$(OBJEXT)' ;; i?86*sco*5.0.7) CCE_TARGETOS=SCO_OpenServer CFLAGS="$CFLAGS -D__SCO__ -D__SCOOpenServer__";; i?86*sco*) CCE_TARGETOS=SCO_OpenServer OSDEP_FILE='osdep_inout.$(OBJEXT)' CFLAGS="$CFLAGS -D__SCO__ -D__SCOOpenServer__ -DUSE_EXTERN_INOUT";; *UnixWare* | *unixware*) CCE_TARGETOS=SCO_UnixWare CFLAGS="$CFLAGS -D__SCO__ -D__SCOUnixWare__";; *lynxos*) CCE_TARGETOS=Lynx;; *qnx* | *nto*) CCE_TARGETOS=QNX OSDEP_FILE='osdep_mmap.$(OBJEXT)' ;; *minixvmd*) CCE_TARGETOS=Minix CFLAGS="$CFLAGS -D__Minix__ -D_MINIX -D_POSIX_SOURCE -D_MINIX_SOURCE -wa -stack 4096000" OSDEP_FILE='osdep_mmap.$(OBJEXT) osdep_minix.$(OBJEXT)' ;; *minix*) CCE_TARGETOS=Minix CFLAGS="$CFLAGS -D__Minix__ -D_MINIX -D_POSIX_SOURCE -D_MINIX_SOURCE -wa -stack 4096000" OSDEP_FILE='osdep_mmap.$(OBJEXT) osdep_minix.$(OBJEXT) minix_inout.$(OBJEXT)' ;; *beos*) CCE_TARGETOS=BeOS prefix=/boot/beos OSDEP_FILE='osdep_mmap.$(OBJEXT)';; *msdosdjgpp*) CCE_TARGETOS=DOS CFLAGS="$CFLAGS -D__MSDOS__" OSDEP_FILE='osdep_mmap.$(OBJEXT) osdep_dos.$(OBJEXT)' ;; *cygwin*|*pw32*) CCE_TARGETOS=Windows CFLAGS="$CFLAGS -D__WINDOWS__";; *mingw32*) CCE_TARGETOS=Windows CFLAGS="$CFLAGS -D__WINDOWS__ -D__MINGW32__" OSDEP_LIB='-liberty' OSDEP_FILE='osdep_mmap.$(OBJEXT)' ;; *gnu0.*) CCE_TARGETOS=Hurd CFLAGS="$CFLAGS -D__Hurd__ -D__Mach__" OSDEP_FILE='osdep_mach.$(OBJEXT)' ;; *darwin*) dnl MacOSX will give you powerpc-apple-darwin7.x.x, Darwin will give you *apple-darwin* CCE_TARGETOS=Darwin CFLAGS="$CFLAGS -D__Darwin__ " OSDEP_FILE='osdep_darwin.$(OBJEXT)' ;; *) echo "Unsupported operating system. Good Luck! " dnl exit 1 ;; Do not exit, just try it ;; esac dnl http://www.debian.org/port/hurd Mach 1.2 Hurd 0.3 K4 ISO dnl host is i386-unknown-gnu0.3, sometimes linux is *linux-gnu dnl __GNU__ will be defined, but we use Hurd instead? dnl SCO OpenServer 5.0.7 will give you i386-pc-sco3.2v5.0.7 by config.guess dnl SCO OpenServer 5.0.6 has no GNU tools on CD, can't compile inline gcc assembly? dnl so we define USE_EXTERN_IO (gcc 2.95.2, but Unixware is fine??) dnl SCO Unixware 7.1.3 will give you i686-unknown-sysv5Unixware7.1.3 dnl Standard Minix 2.0.x is using ACK C compiler(ANSI) dnl -wa can turn off all the warnings. ACK-cc can't understand gcc's dnl externsion like inline assembly, anonymous union, etc. dnl Minix-vmd 1.7.x is using gcc(in distribution), -wa is not valid for gcc dnl uncomment the following line to use ANSI-C, no gcc extension dnl CFLAGS="$CFLAGS -ansi" AC_DEFINE_UNQUOTED(CCE_TARGETOS, "$CCE_TARGETOS", [Target operating system]) AC_SUBST([OSDEP_FILE]) AC_SUBST([OSDEP_LIB]) AC_SUBST([CCE_TARGETOS]) dnl Checks for programs. AM_PROG_AS AC_PROG_CC AC_PROG_INSTALL AC_PROG_MAKE_SET AC_PROG_LN_S AC_PROG_RANLIB dnl Checks for header files. AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS([fcntl.h malloc.h pwd.h sys/file.h sys/ioctl.h sys/time.h \ termios.h unistd.h netinet/in.h sys/mman.h sys/memio.h sys/vt.h \ sys/vtkd.h sys/kd.h iconv.h]) dnl dnl ===================== item X header lib fonts support ====================== dnl dnl X headers for x11 font support dnl AC_PATH_X dnl dnl # X related header dnl xfont_headers="FSproto.h Xdefs.h Xdefs.h \ dnl Xfuncproto.h Xfuncs.h Xproto.h Xmd.h fsmasks.h" dnl for header in $xfont_headers; do dnl have_xfont_header="no" dnl for x_dir in $x_includes; do dnl if test -f $x_dir/X11/$header; then dnl have_xfont_header="yes" dnl break dnl else dnl if test -f $x_dir/X11/fonts/$header; then dnl have_xfont_header="yes" dnl break dnl fi dnl fi dnl done dnl if test "$have_xfont_header" = no; then dnl AC_MSG_ERROR([Cannot find $header. Please install X11 related header files first.]) dnl fi dnl done dnl AC_MSG_CHECKING(for X11 fonts related headers) dnl AC_MSG_RESULT($have_xfont_header) dnl X_CFLAGS="-I$x_includes/X11 -I$x_includes/X11/fonts" dnl ################################################################# dnl # Checks for libraries. dnl dnl AC_CHECK_LIB(z, inflate,,AC_MSG_WARN([Cannot find libz library. Please install first.])) dnl dnl # Xfont Library check dnl have_x_font_lib="no" dnl for x_dir in $x_libraries; do dnl for ext in so a ; do dnl if test -f $x_dir/libXfont.$ext; then dnl have_x_font_lib="yes" dnl if test "$ext" = "a"; then dnl X_LIBS="$X_LIBS $x_dir/libXfont.$ext" dnl fi dnl break dnl fi dnl done dnl done dnl AC_MSG_CHECKING(for libXfont library) dnl if test "$have_x_font_lib" != yes; then dnl AC_MSG_RESULT(no) dnl AC_MSG_ERROR([Cannot find libXfont library. Please install X11 first.]) dnl else dnl AC_MSG_RESULT(yes) dnl fi dnl dnl ################################################################# dnl # Checks for fonts. dnl have_mb_font="no" dnl for x_dir in $x_libraries; do dnl if test -f $x_dir/X11/fonts/misc/unifont.pcf.gz; then dnl have_mb_font="yes" dnl break dnl fi dnl done dnl AC_MSG_CHECKING(for multibyte(unicode) font) dnl AC_MSG_RESULT($have_mb_font) dnl if test "$have_mb_font" = no; then dnl AC_MSG_WARN([Cannot find unicode font. Please install unicode font (unifont.pcf.gz).]) dnl fi dnl dnl have_ascii_font="no" dnl for x_dir in $x_libraries; do dnl if test -f $x_dir/X11/fonts/misc/8x16.pcf.gz; then dnl have_ascii_font="yes" dnl break dnl fi dnl done dnl AC_MSG_CHECKING(for ascii font) dnl AC_MSG_RESULT($have_ascii_font) dnl if test "$have_ascii_font" = no; then dnl AC_MSG_WARN([Cannot find ascii font. Please install ascii font (8x16.pcf.gz).]) dnl fi dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_C_INLINE AC_TYPE_OFF_T AC_TYPE_PID_T AC_TYPE_SIZE_T AC_DECL_SYS_SIGLIST AC_HEADER_TIME AC_STRUCT_TM dnl Checks for library functions. AC_PROG_GCC_TRADITIONAL AC_FUNC_MEMCMP dnl Do we need to check for mmap function? check sys/mman.h? dnl AC_FUNC_MMAP AC_TYPE_SIGNAL AC_FUNC_UTIME_NULL AC_FUNC_VPRINTF dnl AC_FUNC_WAIT3 AC_CHECK_FUNCS(basename waitpid putenv select strdup strerror strstr mkstemp \ snprintf getuid kill ttyname iconv) ########################################################### ## Definiation of compile args. ## ########################################################### # 1st Argument: variable, enable-variable, disable-variable # 2nd Argument: shell script if enable-variable or disable-variable is assigned # 3nd Argument: if neither one is assigned, default one AC_ARG_ENABLE(debug, [ --enable-debug Turn on debugging], [],enable_debug=no) # By default, enable mouse support for Linux/FreeBSD # No mouse support in MSDOS and Minix AC_ARG_ENABLE(mouse, [ --enable-mouse Turn on mouse support], [case $target in *msdosdjgpp*|*minix*) enable_mouse=no;; esac], [case $target in *linux* | *freebsd* | *lynxos*) enable_mouse=yes;; *) enable_mouse=no;; esac]) # Currently gpm only runs on Linux, so disable it on other system # By default, gpm mouse support is turned on for Linux AC_ARG_ENABLE(gpmmouse, [ --enable-gpmmouse Turn on gpm mouse server support in Linux], [case $target in *linux*) ;; *) enable_gpmmouse=no;; esac], [case $target in *linux*) enable_gpmmouse=yes;; esac]) # LRMI only support Linux/FreeBSD/NetBSD, not OpenBSD? # By default, enable lrmi for Linux, FreeBSD/NetBSD's lrmi support has bug? AC_ARG_ENABLE(lrmi, [ --enable-lrmi Use LRMI(Linux Real Mode Interface)], [case $target in *linux*|*freebsd*|*netbsd*) ;; *) enable_lrmi=no;; esac], [case $target in i?86*linux*) enable_lrmi=yes;; *) enable_lrmi=no;; esac]) # By default VGA is enabled for all OS AC_ARG_ENABLE(vga, [ --enable-vga Enable 640x480x16 colors VGA support], [case $target in i?86*) ;; *) enable_vga=no;; esac], [case $target in *beos*) enable_vga=no;; *cygwin*|*mingw32*|*pw32*) enable_vga=no;; i?86*) enable_vga=yes;; *) enable_vga=no;; esac]) # Only Linux/FreeBSD support framebuffer # By default, enable fb for Linux/FreeBSD AC_ARG_ENABLE(fb, [ --enable-fb Enable Linux/*BSD's frame buffer], [case $target in *linux*|*freebsd*|*openbsd*|*netbsd*|*darwin*) ;; *) enable_fb=no;; esac], [case $target in *linux* | *freebsd* | *darwin* ) enable_fb=yes;; i?86*openbsd*) enable_fb=no;; *openbsd*) enable_fb=yes;; i?86*netbsd*) enable_fb=no;; *netbsd*) enable_fb=yes;; *) enable_fb=no;; esac]) AC_ARG_ENABLE(ggi, [ --enable-ggi Use GGI library for display/input], [], [case $target in *linux*|*freebsd*|*netbsd*|*openbsd*) enable_ggi=yes;; *solaris*|*sunos*) enable_ggi=yes;; *cygwin*|*mingw32*|*pw32*) enable_ggi=yes;; esac]) AC_ARG_ENABLE(sdl, [ --enable-sdl Use SDL library for display/input], [], [case $target in *linux*|*freebsd*|*netbsd*|*openbsd*) enable_sdl=yes;; *solaris*|*sunos*|*beos*|*qnx*|*nto*) enable_sdl=yes;; *cygwin*|*mingw32*|*pw32*) enable_sdl=yes;; *darwin*) enable_sdl=yes;; esac]) AC_ARG_ENABLE(freetype,[ --enable-freetype Support FreeType fonts], [], []) dnl [case $target in dnl *linux*|*freebsd*|*netbsd*|*openbsd*) enable_freetype=yes;; dnl *solaris*|*sunos*|*beos*|*qnx*|*nto*) enable_freetype=yes;; dnl *cygwin*|*mingw32*|*pw32*) enable_freetype=yes;; dnl esac]) AC_ARG_ENABLE(x11font, [ --enable-x11font Support X11 pcf/bdf fonts], [], []) # memfile works on Linux, FreeBSD, NetBSD, Minix, doesn't work on # Solaris, OpenBSD, LynxOS, QNX, MSDOS AC_ARG_ENABLE(memfile, [ --enable-memfile Use /dev/mem file operation for VGA], [case $target in *lynxos*|*solaris*|*sunos*|*qnx*|*msdosdjgpp*|*openbsd*) enable_memfile=no;; esac], [case $target in *minix* ) enable_memfile=yes;; *) enable_memfile=no;; esac]) # Linux/FreeBSD has iconv and iconv.h by default(in glibc) AC_ARG_ENABLE(filter, [ --enable-filter Support encoding filter such as UTF8], [], [case $target in *linux* ) enable_filter=yes;; *) enable_filter=no;; esac]) if test "$enable_debug" = "yes"; then AC_DEFINE(DEBUG, 1, [Define this to enable the debug]) CFLAGS="$CFLAGS -g" CXXFLAGS="$CXXFLAGS -g" fi if test "$enable_mouse" = "yes"; then AC_DEFINE(SUPPORT_MOUSE, 1, [Define this to enable mouse support]) fi if test "$enable_gpmmouse" = "yes"; then AC_DEFINE(SUPPORT_GPMMOUSE, 1, [Define this to enable gpm mouse server support in Linux]) fi if test "$enable_lrmi" = "yes"; then AC_DEFINE(USE_LRMI, 1, [Define this to use LRMI]) fi if test "$enable_vga" = "yes"; then AC_DEFINE(SUPPORT_VGA, 1, [Define this to enable 640x480x16 colors VGA support]) fi if test "$enable_fb" = "yes"; then AC_DEFINE(SUPPORT_FRAMEBUF, 1, [Define this to use Linux/FreeBSD's frame buffer]) case $target in *darwin*) CCE_LIBS="$CCE_LIBS -framework IOKit" ;; esac fi dnl Dynamic loading of shared library testing dnl For Mac OS X/Darwin, we will use link against libSDL, easier *.dylib Mach-O format AC_CHECK_HEADERS(dlfcn.h, [has_dl_library="yes"], [has_dl_library="no"]) case $target in *mingw32*|*pw32*|*minix*|*darwin*) has_dl_library="no" ;; *cygwin*|*freebsd*|*netbsd*|*openbsd*) ;; *qnx*|*nto*) ;; *) AC_CHECK_LIB(dl, dlopen, [CCE_DL_LIB="-ldl"], [has_dl_library="no"]) ;; esac if test "$enable_sdl" = "yes"; then case $target in *beos*) CCE_EXTRAINCLUDES="$CCE_EXTRAINCLUDES -I/boot/develop/tools/gnupro/include" CCE_LIBS="$CCE_LIBS -L/boot/develop/tools/gnupro/lib -lSDL" AC_DEFINE(SUPPORT_SDLLIB, 1, [Define this to support SDL library]);; *) has_sdl_library="yes" #AC_CHECK_LIB(SDL, [SDL_Init], [has_sdl_library="yes"], # AC_MSG_WARN([Cannot find libSDL library. Please install first.])) AC_CHECK_HEADERS(SDL/SDL.h, , [has_sdl_library="no"]) if test "$has_sdl_library" = "yes"; then AC_DEFINE(SUPPORT_SDLLIB, 1, [Define this to support SDL library]) if test "$has_dl_library" = "yes"; then AC_DEFINE(USE_DYNAMIC_SDLLIB, 1, [Define this to dynamically load SDL lib]) #case $target in # *qnx*|*nto*) CCE_LIBS="$CCE_LIBS CCE_LIBS="$CCE_LIBS $CCE_DL_LIB" # dynamic loading of libSDL else # static loading of libSDL case $target in *qnx*|*nto*) CCE_LIBS="$CCE_LIBS -lSDL -lm -lph -lasound";; # We should follow SDL's tradition, use SDL_LIBS *darwin*) CCE_LIBS="$CCE_LIBS -lSDLmain -lSDL -framework Cocoa";; # For Mac OS X 10.X.Y *) CCE_LIBS="$CCE_LIBS -lSDL" ;; esac fi fi esac fi if test "$enable_ggi" = "yes"; then has_ggi_library="yes" # AC_CHECK_LIB(ggi, [ggiInit], [has_ggi_library="yes"], # AC_MSG_WARN([Cannot find libggi library. Please install first.])) AC_CHECK_HEADERS(ggi/ggi.h, , [has_ggi_library="no"]) if test "$has_ggi_library" = "yes"; then AC_DEFINE(SUPPORT_GGILIB, 1, [Define this to support GGI/GII library]) if test "$has_dl_library" = "yes"; then AC_DEFINE(USE_DYNAMIC_GGILIB, 1, [Define this to dynamically load GGI lib]) CCE_LIBS="$CCE_LIBS $CCE_DL_LIB" # dynamic loading of libggi else CCE_LIBS="$CCE_LIBS -lggi" # static loading of libggi fi fi fi if test "$enable_freetype" = "yes"; then has_freetype_library="yes" #AC_CHECK_HEADERS([freetype2/freetype/freetype.h], , [has_freetype_library="no"]) # freetype.h is not usable! needs -I/usr/include/freetype2/freetype if test "$has_freetype_library" = "yes"; then AC_DEFINE(SUPPORT_FREETYPE_FONT, 1, [Define this to support FreeType fonts]) CCE_EXTRAINCLUDES="$CCE_EXTRAINCLUDES -I/usr/include/freetype2" if test "$has_dl_library" = "yes"; then AC_DEFINE(USE_DYNAMIC_FREETYPELIB, 1, [Define this to dynamically load FreeType lib]) CCE_LIBS="$CCE_LIBS $CCE_DL_LIB" # dynamically loading of libfreetype else CCE_LIBS="$CCE_LIBS -lfreetype" # static loading of libfreetype fi fi fi if test "$enable_x11font" = "yes"; then AC_DEFINE(SUPPORT_X11FONT, 1, [Define this to support X11 pcf/bdf fonts]) CCE_EXTRALIBS="$CCE_EXTRALIBS -L/usr/X11R6/lib -lXfont -lz -lm" dnl /usr/X11R6/lib/libXfont.so depends on libz.so and it has a fabs() which is in libm dnl we need to put EXTRALIBS at the head of linking since libXfont has some unresolved dnl symbos defined in xfont_stubs.c fi if test "$enable_memfile" = "yes"; then AC_DEFINE(USE_DEVMEM_FILE, 1, [Define this to use /dev/mem file operation for VGA]) fi if test "$enable_filter" = "yes"; then AC_DEFINE(SUPPORT_ENCODING_FILTER, 1, [Define this to support encoding filter such as UTF8]) fi dnl AC_DEFINE_UNQUOTED(LIBDIR, "$prefix" "/lib", [CCE installation lib directory]) dnl AC_DEFINE(CCELIB, "@datadir@" "/cce", [CCE's data file path]) CFLAGS="$CFLAGS -DCCELIB=\\\"$datadir/cce\\\" " AC_SUBST(CCE_EXTRALIBS) AC_SUBST(CCE_EXTRAINCLUDES) AC_SUBST(CCE_LIBS) AC_SUBST(CCE_DL_LIB) dnl AC_DEFINE(CONFIG_NAME, [ CCELIB "/cce.cfg" ], [CCE's configuration file]) dnl Move Config File to etc/cce.cfg AC_DEFINE_UNQUOTED(CONFIG_NAME, "$DESTDIR" "/etc/cce.cfg", [CCE's configuration file]) AC_OUTPUT([Makefile src/Makefile src/font/Makefile src/input/Makefile src/kbmouse/Makefile src/display/Makefile src/term/Makefile src/osdep/Makefile inputs/Makefile inputs/utils/Makefile inputs/all/Makefile inputs/gb/Makefile inputs/gbk/Makefile inputs/big5/Makefile inputs/jis/Makefile inputs/ksc/Makefile fonts/Makefile doc/Makefile])