1 # Process this file with autoconf to produce a configure script.
2 AC_INIT([LHa for UNIX], 1.14i-ac20070904, arai@users.sourceforge.jp, lha)
6 AM_CONFIG_HEADER(config.h)
8 AC_DEFINE_UNQUOTED(PLATFORM, "$ac_cv_host",
9 [the type of system on which the package will run.])
11 # Checks for programs.
13 AC_PROG_GCC_TRADITIONAL
19 AC_CHECK_PROGS(sh_for_lha_test, [zsh bash ksh pdksh], [sh])
21 # Checks for libraries.
22 AC_SEARCH_LIBS(opendir, [mingwex])
23 AC_CHECK_LIB(applefile, af_open)
25 # Checks for header files.
28 AC_CHECK_HEADERS(fcntl.h limits.h sys/file.h sys/param.h sys/time.h)
29 AC_CHECK_HEADERS(pwd.h grp.h utime.h inttypes.h stdint.h fnmatch.h)
31 # Checks for typedefs, structures, and compiler characteristics.
38 AC_CHECK_SIZEOF(off_t)
39 AC_CHECK_TYPES([uid_t, gid_t, long long, uint64_t, ssize_t])
40 AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct stat.st_ino],,,
43 # include <sys/types.h>
46 # include <sys/stat.h>
48 #if TIME_WITH_SYS_TIME
49 # include <sys/time.h>
53 # include <sys/time.h>
60 # Checks for library functions.
65 AC_CHECK_FUNCS(strchr strdup memcpy memset memmove strcasecmp)
66 AC_CHECK_FUNCS(mktime timelocal tzset ftime gettimeofday utime)
67 AC_CHECK_FUNCS(ftruncate chsize lchown mkstemp ftello)
68 AC_CHECK_FUNCS(getpwuid getgrgid getpwnam getgrnam)
69 AC_CHECK_FUNCS(iconv basename)
70 AC_REPLACE_FUNCS(vsnprintf fnmatch)
72 if test $ac_header_dirent = no; then
76 AC_CHECK_DECLS([basename])
78 # checking whether 8 bit clean or not
79 AC_CACHE_CHECK([whether strchr()/strrchr() is 8bit clean],
80 [lha_cv_func_strchr_8bit_clean],
87 # define strrchr rindex
89 char *strchr (), *strrchr ();
95 if (strchr(s, 0xff) != s) exit(1);
96 if (strchr(s, '\377') != s) exit(1);
97 if (strrchr(s, 0xff) != s) exit(1);
98 if (strrchr(s, '\377') != s) exit(1);
101 ], lha_cv_func_strchr_8bit_clean=yes,
102 lha_cv_func_strchr_8bit_clean=no,
103 lha_cv_func_strchr_8bit_clean=no))
105 if test x$lha_cv_func_strchr_8bit_clean = xyes; then
106 AC_DEFINE(STRCHR_8BIT_CLEAN, 1,
107 [Define to 1 if strchr()/strrchr() works correctly.])
110 # checking whether the 2nd argument of gettimeofday() is effective or not.
111 # note that this timezone argument is obsolete.
112 AC_CACHE_CHECK([whether the 2nd argument of gettimeofday() is effective],
113 [lha_cv_func_gettimeofday_2nd_arg],
115 #if TIME_WITH_SYS_TIME
116 # include <sys/time.h>
120 # include <sys/time.h>
131 tz.tz_minuteswest = -1;
132 if (gettimeofday(&tv, &tz) == -1)
135 if (tz.tz_minuteswest == -1)
136 exit(1); /* the timezone information is no given */
139 }], lha_cv_func_gettimeofday_2nd_arg=yes,
140 lha_cv_func_gettimeofday_2nd_arg=no,
141 lha_cv_func_gettimeofday_2nd_arg=no))
143 if test x$lha_cv_func_gettimeofday_2nd_arg = xyes; then
144 AC_DEFINE(GETTIMEOFDAY_HAS_2ND_ARG, 1,
145 [Define to 1 if the 2nd argument of gettimeofday() is effective.])
148 # support kanji code conversion
150 AC_MSG_CHECKING(kanji code conversion on text file)
151 AC_ARG_ENABLE(text-conv,
152 AC_HELP_STRING([--enable-text-conv],
153 [support text code convert from/to EUC [[default=yes]]]),
154 , enable_text_conv=yes)
156 AC_MSG_RESULT($enable_text_conv)
157 if test $enable_text_conv = yes; then
161 # force support -lh7-
162 AC_SUBST(SUPPORT_LZHUFF_METHOD)
163 SUPPORT_LZHUFF_METHOD=-DSUPPORT_LH7
165 # whether use the -lh567- method
166 AC_MSG_CHECKING(default archive method)
167 AC_ARG_WITH(default-method,
168 AC_HELP_STRING([--with-default-method=[[567]]],
169 [create the -lh[[567]]- archive default [[default=5]]]),
172 *) AC_MSG_ERROR(you should have specified 5, 6 or 7);;
174 with_default_method=5)
175 AC_MSG_RESULT(-lh$with_default_method-)
176 AC_DEFINE_UNQUOTED(DEFAULT_LZHUFF_METHOD, LZHUFF${with_default_method}_METHOD_NUM, [Define it to 5, 6 or 7 which you want to use -lhX- method, default])
178 # decide temporary path names
179 AC_MSG_CHECKING(template of the temporary file)
180 AC_ARG_WITH(tmp-file,
181 AC_HELP_STRING([--with-tmp-file=TEMPLATE],
182 [temporary file template [[default=/tmp/lhXXXXXX]]]),
184 yes) with_tmp_file=/tmp/lhXXXXXX ;;
187 with_tmp_file=/tmp/lhXXXXXX)
189 AC_MSG_RESULT($with_tmp_file)
190 if test x"$with_tmp_file" != xno; then
191 AC_DEFINE_UNQUOTED(TMP_FILENAME_TEMPLATE, "$with_tmp_file",
192 [temporary file template for mktemp/mkstemp])
195 # incremental indicator
196 AC_MSG_CHECKING(whether incremental indicator is needed)
197 AC_ARG_ENABLE(indicator,
198 AC_HELP_STRING([--enable-indicator],
199 [need incremental indicator [[default=yes]]]),
202 enable_indicator=yes)
204 AC_MSG_RESULT($enable_indicator)
205 if test "x$enable_indicator" = xyes; then
206 AC_DEFINE(NEED_INCREMENTAL_INDICATOR, 1,
207 [Define to 1 if you want to use the incremental indicator])
210 # support multibyte filename
211 AC_MSG_CHECKING(kanji code of filename)
212 AC_ARG_ENABLE(multibyte-filename,
213 AC_HELP_STRING([--enable-multibyte-filename],
214 [support multibyte filename. specify kanji code (euc, sjis, utf8 or auto) [[default=auto]]]),,
216 enable_multibyte_filename=auto)
218 case $enable_multibyte_filename in
221 #if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__hpux)
223 #endif], enable_multibyte_filename=CODE_SJIS,
225 #if defined(__APPLE__) /* for Mac OS X */
227 #endif], enable_multibyte_filename=CODE_UTF8,
228 enable_multibyte_filename=CODE_EUC));;
229 sjis) enable_multibyte_filename=CODE_SJIS;;
230 euc) enable_multibyte_filename=CODE_EUC;;
231 utf8) enable_multibyte_filename=CODE_UTF8;;
233 *) AC_MSG_ERROR([you should specify auto, sjis or euc as your system filename code.]);;
236 AC_MSG_RESULT($enable_multibyte_filename)
237 if test x$enable_multibyte_filename != xno; then
238 AC_DEFINE_UNQUOTED(MULTIBYTE_FILENAME, $enable_multibyte_filename,
239 [Define to CODE_EUC or CODE_SJIS if you want to use multibyte filename])
243 # for multibyte filename
244 LDFLAGS="$LDFLAGS -framework CoreFoundation"
249 # make user/group name extented header
250 AC_MSG_CHECKING(whether user/group name extended header is needed)
251 AC_ARG_ENABLE(user-name-header,
252 AC_HELP_STRING([--enable-user-name-header],
253 [make user/group name extended header [[default=no]]]),
256 enable_user_name_header=no)
258 AC_MSG_RESULT($enable_user_name_header)
259 if test "x$enable_user_name_header" = xyes; then
260 AC_DEFINE(INCLUDE_OWNER_NAME_IN_HEADER, 1,
261 [Define to 1 if you want to use the user/group name extened header])
264 # backup old archive file
265 AC_MSG_CHECKING(whether backup file for old archive is left)
266 AC_ARG_ENABLE(backup-archive,
267 AC_HELP_STRING([--enable-backup-archive],
268 [backup old archive [[default=no]]]),
271 enable_backup_archive=no)
273 AC_MSG_RESULT($enable_backup_archive)
274 if test "x$enable_backup_archive" = xyes; then
275 AC_DEFINE(BACKUP_OLD_ARCHIVE, 1,
276 [Define to 1 if you want to leave an old archive])
281 CFLAGS="$CFLAGS -DNOT_COMPATIBLE_MODE"
285 AC_CONFIG_FILES([Makefile src/Makefile man/Makefile olddoc/Makefile])
286 AC_CONFIG_FILES([tests/Makefile tests/lha-test])