1dnl
2dnl $Id: configure.in,v 1.16 2005/06/18 19:41:05 andrew_belov Exp $
3dnl --------------------------------------------------------------------------
4dnl This file performs setup of GNU-style makefiles.
5dnl
6
7AC_INIT([arj])
8AC_PREREQ(2.53)
9AC_CONFIG_SRCDIR([../arj.c])
10
11dnl Installation script (let it be, temporarily...)
12AC_PROG_INSTALL([e:/os2apps/autoconf/install-sh])
13
14dnl Configuration parameters
15AC_CONFIG_HEADER([../c_defs.h:config.h.in])
16
17dnl Checks for the canonical system name
18AC_CANONICAL_HOST
19
20dnl Checks for programs.
21AC_PROG_CC
22
23dnl Checks for header files.
24AC_HEADER_STDC
25AC_CHECK_HEADERS([fcntl.h limits.h malloc.h])
26
27dnl Checks for typedefs, structures, and compiler characteristics.
28AC_C_CONST
29AC_STRUCT_TM
30AC_C_BIGENDIAN
31
32dnl Checks for library functions.
33AC_PROG_GCC_TRADITIONAL
34AC_FUNC_MEMCMP
35AC_FUNC_SETVBUF_REVERSED
36AC_TYPE_SIGNAL
37AC_FUNC_VPRINTF
38AC_CHECK_FUNCS([getcwd min max mkdir mkdtemp rmdir fcloseall \
39                strcasecmp setpriority strdup strerror strstr strnlen \
40                strupr strlwr strtol strtoul])
41
42dnl Platform-specific tuning
43PROG_EXT=
44DLL_EXT=".so"
45DLL_FLAGS="-shared"
46REQUIRES_DEF=
47OS_ID="UNIX"
48OS_DEF="-D_UNIX"
49DLL_CFLAGS="-fPIC"
50
51case $host_os in
52linux*)
53	AC_DEFINE(ELF_EXECUTABLES, 1, [Define if executables use ELF format])
54        DYN_LIBS="-ldl"
55        LD_STRIP="gnu/stripgcc.lnk"
56	;;
57k*bsd*)
58	AC_DEFINE(ELF_EXECUTABLES)
59	DYN_LIBS="-ldl"
60	LD_STRIP="gnu/stripgcc.lnk"
61	;;
62*bsd*)
63	AC_DEFINE(ELF_EXECUTABLES)
64        DLL_FLAGS="-shared -export-dynamic"
65        LD_STRIP="gnu/stripgcc.lnk"
66	;;
67interix3*)
68	# not ELF
69	DLL_FLAGS="-shared"
70	DLL_CFLAGS=""
71	;;
72*qnx*)
73	AC_DEFINE(ELF_EXECUTABLES)
74        DLL_FLAGS="-shared -fPIC"
75        DLL_CFLAGS="-shared -fPIC"
76        LD_STRIP="gnu/stripgcc.lnk"
77	;;
78*solaris*)
79	AC_DEFINE(ELF_EXECUTABLES)
80        CFLAGS="-DSUNOS -D_UNIX"
81        DLL_FLAGS="-shared -fPIC"
82        DLL_CFLAGS="-shared -fPIC"
83        LD_STRIP="gnu/stripgcc.lnk"
84	;;
85os2*)
86	PROG_EXT=".exe"
87	DLL_EXT=".dll"
88	LDFLAGS="-s"
89	DLL_FLAGS="-Zdll -s"
90        DLL_CFLAGS=""
91	REQUIRES_DEF=1
92	OS_ID="OS2"
93	OS_DEF="-D_OS2"
94	;;
95esac
96
97case $host_cpu in
98alpha*)
99	AC_DEFINE(ALIGN_POINTERS,1,desc, 1, [Define if pointers need to be aligned])
100	;;
101sparc*)
102	AC_DEFINE(ALIGN_POINTERS,1,desc)
103	;;
104ia64*)
105	AC_DEFINE(ALIGN_POINTERS,1,desc)
106	;;
107arm*)
108	AC_DEFINE(ALIGN_POINTERS,1,desc)
109	;;
110hppa*)
111	AC_DEFINE(ALIGN_POINTERS,1,desc)
112	;;
113esac
114
115dnl Registration wizard is named "arj-register" under UNIX-like platforms, to
116dnl give it a unique name
117
118case $host_os in
119os2*)
120	REGISTER=register
121	;;
122*)
123	REGISTER=arj-register
124esac
125
126dnl Initial setup
127
128test -z "$CONFIG_SHELL" && CONFIG_SHELL=/bin/sh
129AC_SUBST(CONFIG_SHELL)
130
131AC_MSG_CHECKING([if dynamic C library may be used])
132AC_ARG_ENABLE(libc,
133[  --disable-libc          Disable linking with dynamic C library],
134	[enable_libc=no],
135	[enable_libc=yes
136	 case $host_os in
137	 os2*)
138		LDFLAGS="-Zcrtdll $LDFLAGS"
139		DLL_FLAGS="-Zcrtdll $DLL_FLAGS"
140	 esac
141	])
142AC_MSG_RESULT($enable_libc)
143test "$enable_libc" != "no" && AC_DEFINE(LIBC, 1, [Define if dynamic C library may be used])
144
145AC_MSG_CHECKING([if SFX executables may be packed])
146AC_ARG_ENABLE(packsfx,
147[  --disable-packsfx       Force disable packing of SFX modules],
148	[packsfx=no],
149	[packsfx=yes])
150AC_MSG_RESULT($packsfx)
151test "$packsfx" != "yes" && AC_DEFINE(NP_SFX, 1, [Define if SFX executables may be packed])
152
153AC_MSG_CHECKING([what to use as a dedicated output directory])
154AC_ARG_ENABLE(outdir,
155[  --enable-outdir         Specify a dedicated output directory],
156	[OUT_DIR=$enableval],
157	[OUT_DIR=$host_os])
158AC_MSG_RESULT($OUT_DIR)
159AC_SUBST(OUT_DIR)
160
161AC_MSG_CHECKING([fnmatch() tolerance to incomplete patterns acting as filenames])
162AC_RUN_IFELSE([AC_LANG_PROGRAM([[
163#include <fnmatch.h>
164]], [[
165int main()
166{
167 return(fnmatch("@<:@", "@<:@", 0)); /* Must return 0 for a valid match */
168}
169]])], [TOLERANT_FNMATCH=yes], [TOLERANT_FNMATCH=no], [TOLERANT_FNMATCH=cross])
170if test x$TOLERANT_FNMATCH = xyes ; then
171  AC_DEFINE(TOLERANT_FNMATCH, 1, [Trust fnmatch() when supplying incomplete patterns])
172fi
173AC_MSG_RESULT([$TOLERANT_FNMATCH])
174
175dnl Experimental feature(s)
176AC_MSG_CHECKING([if color output is demanded])
177AC_ARG_ENABLE(color-output,
178[  --enable-color-output   Enable JAR-style color output (EXPERIMENTAL)],
179        [color_output=yes],
180        [color_output=no])
181AC_MSG_RESULT($color_output)
182test "$color_output" = "yes" && AC_DEFINE(USE_COLORS,1,desc, 1, [Define if colors should be used])
183
184AC_SUBST(HAVE_MKDTEMP)
185AC_SUBST(HAVE_FCLOSEALL)
186AC_SUBST(HAVE_STRCASECMP)
187AC_SUBST(HAVE_SETPRIORITY)
188AC_SUBST(HAVE_STRUPR)
189AC_SUBST(HAVE_STRLWR)
190
191AC_SUBST(PROG_EXT)
192AC_SUBST(DLL_EXT)
193AC_SUBST(DLL_FLAGS)
194AC_SUBST(DLL_CFLAGS)
195AC_SUBST(REQUIRES_DEF)
196AC_SUBST(OS_ID)
197AC_SUBST(OS_DEF)
198AC_SUBST(LIBS)
199AC_SUBST(DYN_LIBS)
200AC_SUBST(LD_STRIP)
201AC_SUBST(REGISTER)
202AC_SUBST(TOLERANT_FNMATCH)
203
204AC_CONFIG_FILES([../GNUmakefile:makefile.in])
205AC_OUTPUT
206