Ignore:
Timestamp:
Dec 26, 2003, 12:22:13 AM (17 years ago)
Author:
Sam Hocevar
Message:
  • configure.ac: + Autodetect ncurses, slang and X11. + Abort if no output driver was selected or detected.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/configure.ac

    r282 r284  
    1818AC_EGREP_CPP(foo,foo)
    1919
     20AC_ARG_ENABLE(slang,
     21  [  --enable-slang          slang graphics support (default enabled)])
    2022AC_ARG_ENABLE(ncurses,
    2123  [  --enable-ncurses        ncurses graphics support (default enabled)])
    22 AC_ARG_ENABLE(slang,
    23   [  --enable-slang          slang graphics support (default disabled)])
    2424AC_ARG_ENABLE(conio,
    2525  [  --enable-conio          DOS conio.h graphics support (default disabled)])
    2626AC_ARG_ENABLE(x11,
    27   [  --enable-x11            X11 support (default disabled) (EXPERIMENTAL)])
     27  [  --enable-x11            X11 support (default disabled) (default enabled)])
    2828
    2929AC_CHECK_HEADERS(inttypes.h endian.h)
    3030AC_CHECK_FUNCS(vsnprintf getenv putenv strcasecmp)
    3131
     32CACA_DRIVERS=""
     33
    3234if test "${enable_conio}" = "yes"; then
    3335  AC_CHECK_HEADERS(conio.h,:,AC_MSG_ERROR([cannot find conio.h header]))
    3436  AC_MSG_CHECKING(for ScreenUpdate in pc.h)
    35   AC_EGREP_HEADER(ScreenUpdate,pc.h,[
    36     AC_MSG_RESULT(yes)
     37  AC_EGREP_HEADER(ScreenUpdate,pc.h,
     38   [AC_MSG_RESULT(yes)
    3739    AC_DEFINE(SCREENUPDATE_IN_PC_H, 1,
    38               Define if <pc.h> defines ScreenUpdate.)],[
    39     AC_MSG_RESULT(no)])
     40              Define if <pc.h> defines ScreenUpdate.)],
     41   [AC_MSG_RESULT(no)])
     42  CACA_DRIVERS="${CACA_DRIVERS} conio"
    4043  AC_DEFINE(USE_CONIO, 1, Define to activate the conio.h backend driver)
    4144fi
    4245
    43 if test "${enable_slang}" = "yes"; then
    44   AC_CHECK_HEADERS(slang.h,:,AC_MSG_ERROR([cannot find slang headers]))
    45   AC_CHECK_LIB(slang,SLkp_init,:,AC_MSG_ERROR([cannot find slang library]))
    46   AC_DEFINE(USE_SLANG, 1, Define to activate the slang backend driver)
    47   CPPFLAGS="${CPPFLAGS} -DOPTIMISE_SLANG_PALETTE=1"
    48   CACA_LIBS="${CACA_LIBS} -lslang"
     46if test "${enable_slang}" != "no"; then
     47  AC_CHECK_HEADERS(slang.h,
     48   [AC_CHECK_LIB(slang, SLkp_init,
     49     [ac_cv_my_have_slang="yes"
     50      AC_DEFINE(USE_SLANG, 1, Define to activate the slang backend driver)
     51      CPPFLAGS="${CPPFLAGS} -DOPTIMISE_SLANG_PALETTE=1"
     52      CACA_LIBS="${CACA_LIBS} -lslang"
     53      CACA_DRIVERS="${CACA_DRIVERS} slang"],
     54     [ac_cv_my_have_slang="no"])],
     55   [ac_cv_my_have_slang="no"])
     56  if test "${ac_cv_my_have_slang}" = "no" -a "${enable_slang}" = "yes"; then
     57    AC_MSG_ERROR([cannot find slang development files])
     58  fi
    4959fi
    5060
    51 if test "${enable_x11}" = "yes"; then
     61if test "${enable_x11}" != "no"; then
    5262  AC_PATH_X
    5363  AC_CHECK_LIB(X11, XOpenDisplay,
    54    [ac_cv_my_have_x11=yes
     64   [ac_cv_my_have_x11="yes"
    5565    if test -n "${x_includes}"; then X_CFLAGS="-I${x_includes}"; fi
    56     if test -n "${x_libraries}"; then X_LIBS="-lX11 -L${x_libraries}"; fi],
    57    [ac_cv_my_have_x11=no],
     66    if test -n "${x_libraries}"; then X_LIBS="-lX11 -L${x_libraries}"; fi
     67    AC_DEFINE(USE_X11, 1, Define to activate the X11 backend driver)
     68    CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
     69    CACA_LIBS="${CACA_LIBS} ${X_LIBS}"
     70    CACA_DRIVERS="${CACA_DRIVERS} x11"],
     71   [ac_cv_my_have_x11="no"],
    5872   [[-lXt -L${x_libraries}]])
    59   if test "${ac_cv_my_have_x11}" != "yes"; then
     73  if test "${ac_cv_my_have_x11}" != "yes" -a "${enable_x11}" = "yes"; then
    6074    AC_MSG_ERROR([cannot find X11 development files])
    6175  fi
    62   AC_DEFINE(USE_X11, 1, Define to activate the X11 backend driver)
    63   CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
    64   CACA_LIBS="${CACA_LIBS} ${X_LIBS}"
    6576fi
    6677
    6778if test "${enable_ncurses}" != "no"; then
    68   AC_CHECK_HEADERS(ncurses.h,:,AC_MSG_ERROR([cannot find ncurses headers]))
    69   AC_CHECK_LIB(ncurses,initscr,:,AC_MSG_ERROR([cannot find ncurses library]))
    70   AC_DEFINE(USE_NCURSES, 1, Define to activate the ncurses backend driver)
    71   CACA_LIBS="${CACA_LIBS} -lncurses"
     79  AC_CHECK_HEADERS(ncurses.h,
     80   [AC_CHECK_LIB(ncurses, initscr,
     81     [ac_cv_my_have_ncurses="yes"
     82      AC_DEFINE(USE_NCURSES, 1, Define to activate the ncurses backend driver)
     83      CACA_LIBS="${CACA_LIBS} -lncurses"
     84      CACA_DRIVERS="${CACA_DRIVERS} ncurses"],
     85     [ac_cv_my_have_ncurses="no"])],
     86   [ac_cv_my_have_ncurses="no"])
     87  if test "${ac_cv_my_have_ncurses}" = "no" -a "${enable_ncurses}" = "yes"; then
     88    AC_MSG_ERROR([cannot find ncurses development files])
     89  fi
     90fi
     91
     92AC_MSG_CHECKING(valid output drivers)
     93if test -z "${CACA_DRIVERS}"; then
     94  AC_MSG_RESULT(no)
     95  AC_MSG_ERROR([no output drivers were selected!])
     96else
     97  AC_MSG_RESULT([${CACA_DRIVERS}])
    7298fi
    7399
Note: See TracChangeset for help on using the changeset viewer.