2 dnl Process this file with autoconf to produce a configure script
4 AC_INIT([Debian posh],POSH_VERSION,[schizo@debian.org],[posh])
7 AC_CONFIG_HEADERS([config.h])
14 AC_PROG_GCC_TRADITIONAL
17 dnl Set up command line options (--enable/--disable)
19 def_path_unix="/bin:/usr/bin:/usr/ucb"
20 def_path_os2="c:/usr/bin;c:/os2;/os2"
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
28 The default value is \"/bin:/usr/bin:/usr/ucb\".],,
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" ;;
37 enable_path="\"$enable_path\""
40 AC_DEFINE_UNQUOTED(DEFAULT_PATH, $enable_path, [default hardcoded PATH])
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
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)
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
86 enable_default_env="\"$enable_default_env\""
88 \"/*\"|\"[[a-zA-Z]]:/*\")
91 AC_MSG_ERROR(--enable-default-env argument must be an absolute path (was $enable_default_env))
94 AC_DEFINE_UNQUOTED(DEFAULT_ENV, $enable_default_env, [enable default environment])
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)
107 dnl don't want swtch documented - its ancient and probably doesn't work
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)
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)
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 \
157 dnl (don't use AC_TYPE_XXX() 'cause it doesn't check word boundaries)
159 AC_CHECK_TYPE(mode_t)
162 dnl if test $ac_cv_type_uid_t = no; then
163 dnl AC_DEFINE(gid_t, int)
165 define([AC_PROVIDE_AC_TYPE_UID_T],)
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)
173 AC_DEFINE_UNQUOTED(RETSIGVAL, $ksh_cv_signal_retval, [retsigval])
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>]],
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>
185 dnl KSH_CHECK_H_TYPE(sigset_t, for sigset_t in <sys/types.h> and <signal.h>,
186 dnl [#include <signal.h>], unsigned)
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)
204 dnl KSH_TIME_DECLARED
213 dnl Compiler characteristics
225 if test $ac_cv_sys_interpreter = no;
226 then AC_DEFINE(SHARPBANG, 1, [sharpbang])
233 dnl KSH_DUP2_CLEXEC_CHECK
235 dnl KSH_OPENDIR_CHECK
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)