Skip to content
Snippets Groups Projects
configure.ac 2.13 KiB
Newer Older
yorhel's avatar
yorhel committed

Yorhel's avatar
Yorhel committed
AC_INIT(ncdu, 1.13, projects@yorhel.nl)
AC_CONFIG_SRCDIR([src/global.h])
yorhel's avatar
yorhel committed
AC_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE([foreign subdir-objects])
yorhel's avatar
yorhel committed

Yorhel's avatar
Yorhel committed
# Check for programs.
yorhel's avatar
yorhel committed
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_RANLIB
yorhel's avatar
yorhel committed

Yorhel's avatar
Yorhel committed
# Check for header files.
Yorhel's avatar
Yorhel committed
AC_CHECK_HEADERS(
  [limits.h sys/time.h sys/types.h sys/stat.h dirent.h unistd.h fnmatch.h ncurses.h],[],
Yorhel's avatar
Yorhel committed
  AC_MSG_ERROR([required header file not found]))
yorhel's avatar
yorhel committed

AC_CHECK_HEADERS(locale.h)

Yorhel's avatar
Yorhel committed
# Check for typedefs, structures, and compiler characteristics.
Yorhel's avatar
Yorhel committed
AC_TYPE_INT64_T
Yorhel's avatar
Yorhel committed
AC_TYPE_UINT64_T
yorhel's avatar
yorhel committed
AC_SYS_LARGEFILE
AC_STRUCT_ST_BLOCKS

Yorhel's avatar
Yorhel committed
# Check for library functions.
Yorhel's avatar
Yorhel committed
AC_CHECK_FUNCS(
  [getcwd gettimeofday fnmatch chdir rmdir unlink lstat system getenv],[],
Yorhel's avatar
Yorhel committed
  AC_MSG_ERROR([required function missing]))
yorhel's avatar
yorhel committed

Yorhel's avatar
Yorhel committed


# Look for ncurses library to link to
ncurses=auto
AC_ARG_WITH([ncurses],
            AC_HELP_STRING([--with-ncurses], [compile/link with ncurses library] ),
            [ncurses=ncurses])
AC_ARG_WITH([ncursesw],
            AC_HELP_STRING([--with-ncursesw], [compile/link with wide-char ncurses library @<:@default@:>@]),
            [ncurses=ncursesw])
if test "$ncurses" = "auto" -o "$ncurses" = "ncursesw"; then
  PKG_CHECK_MODULES([NCURSES], [ncursesw], [LIBS="$LIBS $NCURSES_LIBS"; ncurses=ncursesw],
    [AC_CHECK_LIB([ncursesw],
                 [initscr],
                 [LIBS="$LIBS -lncursesw"; ncurses=ncursesw],
                 [ncurses=ncurses])
    ])
Yorhel's avatar
Yorhel committed
fi
if test "$ncurses" = "ncurses"; then
  PKG_CHECK_MODULES([NCURSES], [ncurses], [LIBS="$LIBS $NCURSES_LIBS"],
    [AC_CHECK_LIB([ncurses],
                 [initscr],
                 [LIBS="$LIBS -lncurses"],
                 [AC_MSG_ERROR(ncurses library is required)])
    ])
# Configure default shell for spawning shell when $SHELL is not set
AC_ARG_WITH([shell],
  [AS_HELP_STRING([--with-shell],
                  [used interpreter as default shell (default is /bin/sh)])],
                  [DEFAULT_SHELL=$withval],
AC_MSG_NOTICE([Using $DEFAULT_SHELL as the default shell if \$SHELL is not set])
AC_DEFINE_UNQUOTED(DEFAULT_SHELL, "$DEFAULT_SHELL", [Used default shell interpreter])