changelog for 0.9.1
[posh.git] / configure.ac
bloba760fcee7054b8f6794514f0f6a4dc18c2ebea72
1 dnl
2 dnl Process this file with autoconf to produce a configure script
3 dnl
4 AC_INIT([Debian posh],POSH_VERSION,[schizo@debian.org],[posh])
5 AC_PREREQ(2.59)
6 AM_INIT_AUTOMAKE
7 AC_CONFIG_HEADERS([config.h])
8 AC_GNU_SOURCE
9 AC_PROG_MAKE_SET
11 dnl
12 dnl
13 AC_PROG_CC
14 AC_PROG_GCC_TRADITIONAL
15 AC_PROG_CPP
16 dnl
17 dnl  Set up command line options (--enable/--disable)
18 dnl
19 def_path_unix="/bin:/usr/bin:/usr/ucb"
20 def_path_os2="c:/usr/bin;c:/os2;/os2"
21 enable_shell=posh
22 AC_ARG_ENABLE(path,
23 [  --enable-path=PaTh      (NOTE: this value isn't used if confstr() and _CS_PATH
24                           are available, or if <paths.h> defines _PATH_DEFPATH)
25                           Use PaTh if PATH isn't specified in the environment
26                           when the shell starts.  A value without . in it is
27                           safest.
28                           The default value is \"/bin:/usr/bin:/usr/ucb\".],,
29                 enable_path=default)
30 case $enable_path:$ksh_cv_os_type in
31  default:OS2_EMX) enable_path="$def_path_os2" ;;
32  default:*) enable_path="$def_path_unix" ;;
33 esac
34 case $enable_path in
35   \"*\") ;;
36   *)
37     enable_path="\"$enable_path\""
38     ;;
39 esac
40 AC_DEFINE_UNQUOTED(DEFAULT_PATH, $enable_path, [default hardcoded PATH])
41 dnl
42 dnl
43 dnl
44 dnl  Specify what kind of shell we are to build.  Options are ksh and sh.
45 dnl  This must be before most other options, as it controls their default
46 dnl  behaviour.
47 dnl
48 SHELL_PROG=posh
49 AC_SUBST(SHELL_PROG)
50 dnl
51 dnl
52 dnl
53 dnl
54 dnl
55 dnl
56 dnl
57 AC_ARG_ENABLE(posixly_correct,
58 [  --enable-posixly-correct Enable if you want POSIX behavior by default
59                           (otherwise, posix behavior is only turned on if the
60                           environment variable POSIXLY_CORRECT is present or by
61                           using \"set -o posix\"; it can be turned off with
62                           \"set +o posix\").  See the POSIX Mode section in the
63                           man page for details on what this option affects.
64                           NOTE:  posix mode is not compatable with some bourne
65                           sh/at&t ksh scripts.])
66 case $enable_posixly_correct:$enable_shell in
67   yes:*) enable_posixly_correct=yes; AC_DEFINE(POSIXLY_CORRECT, 1, [POSIX behavior]) ;;
68   no:*|:*) enable_posixly_correct=no;;
69   *) AC_MSG_ERROR(bad --enable-posixly_correct argument)
70 esac
71 dnl
72 dnl
73 AC_ARG_ENABLE(default-env,
74 [  --enable-default-env=FILE Include FILE if ENV parameter is not set when
75                           the shell starts.  This can be useful when used with
76                           rsh(1), which creates a non-login shell (ie, profile
77                           isn't read, so there is no opertunity to set ENV).
78                           Setting ENV to null disables the inclusion of
79                           DEFAULT_ENV.  NOTE: This is a non-standard feature
80                           (ie, at&t ksh has no default environment).],,
81   enable_default_env=no)
82 if test X"$enable_default_env" != Xno; then
83   # The [a-zA-Z]:/ is for os2 types...
84   case $enable_default_env in
85     /*|[[a-zA-Z]]:/*)
86       enable_default_env="\"$enable_default_env\""
87       ;;
88     \"/*\"|\"[[a-zA-Z]]:/*\")
89       ;;
90     *)
91       AC_MSG_ERROR(--enable-default-env argument must be an absolute path (was $enable_default_env))
92       ;;
93   esac
94   AC_DEFINE_UNQUOTED(DEFAULT_ENV, $enable_default_env, [enable default environment])
96 dnl
97 dnl
98 dnl Don't want silly documented - its silly
99 AC_ARG_ENABLE(silly,[  --enable-silly          [A silly option]])
100 case $enable_silly:$enable_shell in
101   yes:*) enable_silly=yes; AC_DEFINE(SILLY, 1, [oookay]) ;;
102   no:*|:*) enable_silly=no;;
103   *) AC_MSG_ERROR(bad --enable-silly argument)
104 esac
107 dnl don't want swtch documented - its ancient and probably doesn't work
108 AC_ARG_ENABLE(swtch,
109 [  --enable-swtch          For use with shell layers (shl(1)).  This has not
110                           been tested for some time.])
111 case $enable_swtch:$enable_shell in
112   yes:*) enable_swtch=yes; AC_DEFINE(SWTCH, 1, [swtch]) ;;
113   no:*|:*) enable_swtch=no;;
114   *) AC_MSG_ERROR(bad --enable-swtch argument)
115 esac
118 dnl  Start of auto-configuration stuff...
121 dnl A hack to turn on warning messages for gcc - Warn-flags is not in
122 dnl the distribution since not everyone wants to see this stuff.
123 dnl (Warn-flags contains: -Wall)
124 if test X"$GCC" = Xyes && test -f $srcdir/Warn-flags; then
125   CFLAGS="${CFLAGS+$CFLAGS }`cat $srcdir/Warn-flags`"
129 dnl If LDSTATIC set in environment, pass it on to the Makefile and use it when
130 dnl doing compile checks to ensure we are checking the right thing.
131 AC_SUBST(LDSTATIC)LDSTATIC=${LDSTATIC-}
132 test X"$LDSTATIC" != X && LDFLAGS="${LDFLAGS+$LDFLAGS }$LDSTATIC"
134 dnl Executable suffix - normally empty; .exe on os2.
135 AC_SUBST(ac_exe_suffix)dnl
138 dnl Program name munging stuff (prefix, suffix, transform)
139 dnl AC_ARG_PROGRAM
142 dnl Headers
144 AC_HEADER_STDC
145 AC_HEADER_DIRENT
146 dnl KSH_TERM_CHECK
147 AC_SYS_POSIX_TERMIOS
148 AC_CHECK_HEADERS(stddef.h stdlib.h memory.h fcntl.h limits.h paths.h \
149         sys/param.h sys/resource.h values.h ulimit.h sys/time.h unistd.h \
150         termio.h termios.h)
151 AC_HEADER_TIME
152 AC_HEADER_SYS_WAIT
155 dnl Typedefs
157 dnl (don't use AC_TYPE_XXX() 'cause it doesn't check word boundaries)
158 AC_CHECK_TYPE(off_t)
159 AC_CHECK_TYPE(mode_t)
160 AC_CHECK_TYPE(pid_t)
161 AC_CHECK_TYPE(uid_t)
162 dnl if test $ac_cv_type_uid_t = no; then
163 dnl   AC_DEFINE(gid_t, int)
164 dnl fi
165 define([AC_PROVIDE_AC_TYPE_UID_T],)
166 AC_TYPE_SIGNAL
167 case $ac_cv_type_signal in
168 int)  ksh_cv_signal_retval=0 ;;
169 void) ksh_cv_signal_retval=  ;;
171     AC_MSG_ERROR(Internal erorr: unknown signal return type: $ac_cv_type_signal)
172 esac
173 AC_DEFINE_UNQUOTED(RETSIGVAL, $ksh_cv_signal_retval, [retsigval])
174 AC_CHECK_SIZEOF(int)
175 AC_CHECK_SIZEOF(long)
176 dnl sh.h sets INT32 to int or long as appropriate.  Some burnt systems, such
177 dnl as NeXT's, clock_t is in sys/time.h (in non-posix mode).
178 dnl KSH_CHECK_H_TYPE(clock_t, [[for clock_t in any of <sys/types.h>, <sys/times.h> and <sys/time.h>]],
179 dnl   [
180 dnl #ifdef HAVE_SYS_TIME_H
181 dnl #include <sys/time.h>
182 dnl #endif /* HAVE_SYS_TIME_H */
183 dnl #include <sys/times.h>
184 dnl     ], INT32)
185 dnl KSH_CHECK_H_TYPE(sigset_t, for sigset_t in <sys/types.h> and <signal.h>,
186 dnl   [#include <signal.h>], unsigned)
187 dnl KSH_RLIM_CHECK
188 AC_CHECK_TYPE(sigset_t)
189 AC_CHECK_TYPE(rlim_t)
192 dnl Library functions
194 AC_CHECK_FUNCS(confstr dup2 flock getcwd getwd killpg nice \
195         setrlimit sysconf tcsetpgrp \
196         ulimit waitpid wait3 lstat setpgrp tcsetattr \
197         get_current_dir_name canonicalize_file_name)
198 AC_FUNC_MMAP
199 AC_FUNC_SETPGRP
200 AC_FUNC_STAT
201 AC_FUNC_LSTAT
202 dnl KSH_SYS_ERRLIST
203 dnl KSH_SYS_SIGLIST
204 dnl KSH_TIME_DECLARED
205 dnl KSH_TIMES_CHECK
208 dnl Structures
210 AC_HEADER_STAT
213 dnl Compiler characteristics
215 AC_C_CONST
216 dnl KSH_C_VOID
217 dnl KSH_C_VOLATILE
218 dnl KSH_C_PROTOTYPES
219 dnl KSH_C_FUNC_ATTR
222 dnl System services
224 AC_SYS_INTERPRETER
225 if test $ac_cv_sys_interpreter = no;
226   then AC_DEFINE(SHARPBANG, 1, [sharpbang])
228 AC_PROG_INSTALL
231 dnl  Misc ksh tests
233 dnl KSH_DUP2_CLEXEC_CHECK
234 dnl KSH_SIGNAL_CHECK
235 dnl KSH_OPENDIR_CHECK
236 dnl KSH_DEV_FD
239 dnl Take replace value of LDSTATIC in LDFLAGS with reference to make variable
240 if test X"$LDSTATIC" != X; then
241   LDFLAGS=`echo -- "$LDFLAGS" | sed -e 's/^-- //' -e 's?$LDSTATIC?\$(LDSTATIC)?'`
244 AC_CONFIG_FILES(Makefile src/Makefile tests/Makefile)
245 AC_OUTPUT