Fixed hangup on initial run on uClinux (TCSADRAIN -> TCSANOW)
[gnokii.git] / configure.in
index 87ea315..7ad1b9c 100644 (file)
@@ -15,13 +15,17 @@ AC_CANONICAL_SYSTEM
 AC_PREFIX_DEFAULT("/usr/local")
 
 dnl ======================== Default setting
-CFLAGS="-O2 -Wall"
+test -n "$CFLAGS"   || export CFLAGS="-O2 -Wall"
 ALL_LINGUAS="cs de et fi nl sk pl it"
 
 dnl ======================== Checks for programs.
 AC_PROG_CC
+AC_LANG_C
 AC_PROG_CPP
 AC_PROG_LEX
+if test -z "$AR";then
+       AC_PATH_PROG(AR, ar, no)
+fi
 AC_PATH_PROG(RM, rm, no)
 AC_PATH_PROG(FIND, find, no)
 AC_CHECK_PROGS(MAKE, gmake make)
@@ -30,9 +34,25 @@ AC_PROG_INSTALL
 dnl Let us have $prefix variable aviable here
 test x"$prefix" = xNONE && prefix="$ac_default_prefix"
 
+AC_ARG_WITH(cfg_model,
+       [  --with-cfg-model=5110   specifies the mobile phone model],,
+       [ with_cfg_model="5110" ])
+AC_DEFINE_UNQUOTED(CONFIG_CFG_MODEL, "$with_cfg_model")
+AC_ARG_WITH(cfg_port,
+       [  --with-cfg-port=/dev/ttyS0 specifies the mobile phone port],,
+       [ with_cfg_port="/dev/ttyS0" ])
+AC_DEFINE_UNQUOTED(CONFIG_CFG_PORT, "$with_cfg_port")
+AC_ARG_WITH(cfg_initlength,
+       [  --with-cfg-initlength=default specifies the mobile phone initlength],,
+       [ with_cfg_initlength="default" ])
+AC_DEFINE_UNQUOTED(CONFIG_CFG_INITLENGTH, "$with_cfg_initlength")
+
 AC_ARG_ENABLE(debug, 
        [  --enable-debug          compile with debug code],
-       [ CFLAGS="-g -Wall"
+       [
+changequote({,})dnl
+         CFLAGS="-ggdb3 `echo " $CFLAGS "|sed 's/ -O[0-9]* / /g'`" #CFLAGS="-g -Wall"
+changequote([,])dnl
          AC_DEFINE(DEBUG)
          debug="yes" ],
        [ debug="no"  ]
@@ -70,9 +90,9 @@ AC_ARG_WITH(libintl,
 )
 
 AC_ARG_ENABLE(nls,
-       [  --disable-nls           do not use NLS],
+       [  --enable-nls            force use of NLS],
        [ USE_NLS=$enableval ],
-       [ USE_NLS=yes ]
+       [ USE_NLS=no ]
 )
 
 if test "$USE_NLS" = "yes"; then
@@ -222,7 +242,7 @@ if test "x$PTHREAD_LIBS" = xerror; then
 fi
 
 dnl FIXME: do we really test here if libc contains this function?
-if test "x$PTHREAD_LIBS" = xerror; then
+if test "x$PTHREAD_LIBS" = xerror -a "x$cross_compiling" = xno; then
    AC_CHECK_FUNC(pthread_attr_init, PTHREAD_LIBS="",
       AC_MSG_ERROR(not found library: pthread !!!))
 fi
@@ -444,8 +464,8 @@ LIBS="$LIBS $NLS_LIBS"
 
 PACKAGE=gnokii
 XPACKAGE=xgnokii
-VERSION=`cat VERSION`
-XVERSION=`cat xgnokii/VERSION`
+AC_DEFINE_UNQUOTED(VERSION, "`cat VERSION`")
+AC_DEFINE_UNQUOTED(XVERSION, "`cat xgnokii/VERSION`")
 HAVE_XGNOKII=$x_support
 
 case "$INSTALL" in
@@ -465,6 +485,7 @@ AC_CONFIG_HEADER(include/config.h)
 
 AC_SUBST(PACKAGE)
 AC_SUBST(VERSION)
+AC_SUBST(AR)
 AC_SUBST(XVERSION)
 AC_SUBST(XPACKAGE)
 AC_SUBST(XGNOKIIDIR)
@@ -482,7 +503,6 @@ AC_SUBST(USE_UNIX98PTYS)
 AC_SUBST(HAVE_XGNOKII)
 
 AC_OUTPUT(
-   include/config.h.in
    Makefile.global
    po/Makefile.in
    packaging/RedHat/gnokii.spec