Merge pull request #35 from DevManu-de/dev-redirect-handle
[psh.git] / configure.ac
blob5939fbccd60e188f5ab495e6f6b24af5afd6884b
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AC_PREREQ([2.69])
5 AC_INIT([psh], [0.18.0], [myzhang1029@hotmail.com])
6 AC_CONFIG_SRCDIR([src/main.c], [lib/util.c])
7 AC_CONFIG_HEADERS([config.h])
8 AM_INIT_AUTOMAKE([subdir-objects])
10 # Code to select a backend
11 AC_CANONICAL_HOST
13 posix_backend=false
14 generic_backend=false
15 case "${host_os}" in
16     cygwin*|darwin*|linux*|bsd*)
17         posix_backend=true
18         ;;
19     *)
20         AC_MSG_ERROR(["Currently unsupported host system: $host_os"])
21         #generic_backend=true
22         ;;
23 esac
24 AM_CONDITIONAL([POSIX], [test "$posix_backend" = "true"])
25 AM_CONDITIONAL([GENERIC], [test "$generic_backend" = "true"])
27 # Checks for programs.
28 AC_PROG_CC
29 AC_PROG_RANLIB
31 # Checks for libraries.
32 AC_SEARCH_LIBS([readline],
33                [readline],
34                [
35                 AC_DEFINE_UNQUOTED([HAVE_READLINE_GNU], [1], [Define to 1 if GNU libreadline is found])
36                 AC_DEFINE_UNQUOTED([HAVE_READLINE], [1], [Define to 1 if libreadline is found])
37                ],
38                [AC_SEARCH_LIBS([readline],
39                                [edit],
40                                [
41                                 AC_DEFINE_UNQUOTED([HAVE_READLINE_ALTS], [1], [Define to 1 if alternative readline implementations are found])
42                                 AC_DEFINE_UNQUOTED([HAVE_READLINE], [1], [Define to 1 if libreadline is found])
43                                ],
44                                [AC_MSG_WARN(
45                                 [No libreadline or libedit, disabling readline. If yout think this is a mistake, try adding its path to CFLAGS and LDFLAGS.])
46                                ])
47                ])
49 AC_SEARCH_LIBS([history_list],
50                [history],
51                [AC_DEFINE_UNQUOTED([HAVE_WORKING_HISTORY], [1],
52                                    [Define to 1 if working libhistory if found])
53                ],
54                [AC_MSG_WARN([No libhistory, disabling history. If you think this is a mistake, try adding its path to CFLAGS and LDFLAGS.])])
56 # Checks for header files.
57 AC_CHECK_HEADERS([fcntl.h stddef.h stdint.h stdlib.h string.h unistd.h readline/readline.h readline/history.h])
59 # Checks for typedefs, structures, and compiler characteristics.
60 AC_C_INLINE
61 AC_TYPE_PID_T
62 AC_TYPE_SIZE_T
64 # Checks for library functions.
65 AC_FUNC_FORK
66 AC_FUNC_MALLOC
67 AC_FUNC_REALLOC
69 AC_OUTPUT([Makefile lib/Makefile src/Makefile src/backends/posix2/Makefile])