1 # Process this file with autoconf to produce a configure script.
2 AC_INIT([LHa for UNIX], 1.14i-ac20020903, jca02266@nifty.ne.jp, lha)
5 AM_CONFIG_HEADER(config.h)
7 AC_DEFINE_UNQUOTED(PLATFORM, "$ac_cv_host",
8 [the type of system on which the package will run.])
10 # Checks for programs.
12 AC_PROG_GCC_TRADITIONAL
18 # Checks for libraries.
19 AC_SEARCH_LIBS(opendir, [mingwex])
21 # Checks for header files.
24 AC_CHECK_HEADERS(fcntl.h limits.h sys/file.h sys/param.h sys/time.h)
25 AC_CHECK_HEADERS(pwd.h grp.h utime.h inttypes.h stdint.h)
27 # Checks for typedefs, structures, and compiler characteristics.
34 AC_CHECK_TYPES([uid_t, gid_t, long long, uint64_t])
35 AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct stat.st_ino],,,
38 # include <sys/types.h>
41 # include <sys/stat.h>
43 #if TIME_WITH_SYS_TIME
44 # include <sys/time.h>
48 # include <sys/time.h>
55 # Checks for library functions.
59 AC_CHECK_FUNCS(strchr strdup memcpy memset memmove strcasecmp)
60 AC_CHECK_FUNCS(mktime timelocal tzset ftime gettimeofday utime)
61 AC_CHECK_FUNCS(mkdir rmdir ftruncate lchown mkstemp link)
62 AC_CHECK_FUNCS(getpwuid getgrgid getpwnam getgrnam)
64 AC_REPLACE_FUNCS(vsnprintf)
66 if test $ac_header_dirent = no; then
70 # checking whether 8 bit clean or not
71 AC_CACHE_CHECK([whether strchr()/strrchr() is 8bit clean],
72 [lha_cv_func_strchr_8bit_clean],
79 # define strrchr rindex
81 char *strchr (), *strrchr ();
87 if (strchr(s, 0xff) != s) exit(1);
88 if (strchr(s, '\377') != s) exit(1);
89 if (strrchr(s, 0xff) != s) exit(1);
90 if (strrchr(s, '\377') != s) exit(1);
93 ], lha_cv_func_strchr_8bit_clean=yes,
94 lha_cv_func_strchr_8bit_clean=no,
95 lha_cv_func_strchr_8bit_clean=no))
97 if test x$lha_cv_func_strchr_8bit_clean = xyes; then
98 AC_DEFINE(STRCHR_8BIT_CLEAN, 1,
99 [Define to 1 if strchr()/strrchr() works correctly.])
102 # checking whether the 2nd argument of gettimeofday() is effective or not.
103 # note that this timezone argument is obsolete.
104 AC_CACHE_CHECK([whether the 2nd argument of gettimeofday() is effective],
105 [lha_cv_func_gettimeofday_2nd_arg],
107 #if TIME_WITH_SYS_TIME
108 # include <sys/time.h>
112 # include <sys/time.h>
123 tz.tz_minuteswest = -1;
124 if (gettimeofday(&tv, &tz) == -1)
127 if (tz.tz_minuteswest == -1)
128 exit(1); /* the timezone information is no given */
131 }], lha_cv_func_gettimeofday_2nd_arg=yes,
132 lha_cv_func_gettimeofday_2nd_arg=no,
133 lha_cv_func_gettimeofday_2nd_arg=no))
135 if test x$lha_cv_func_gettimeofday_2nd_arg = xyes; then
136 AC_DEFINE(GETTIMEOFDAY_HAS_2ND_ARG, 1,
137 [Define to 1 if the 2nd argument of gettimeofday() is effective.])
140 # support kanji code conversion
142 AC_ARG_ENABLE(text_conv,
143 AC_HELP_STRING([--enable-text-conv],
144 [support text code convert from/to EUC [[default=yes]]]),
145 , enable_text_conv=yes)
147 if test $enable_text_conv = yes; then
151 # force support -lh7-
152 AC_SUBST(SUPPORT_LZHUFF_METHOD)
153 SUPPORT_LZHUFF_METHOD=-DSUPPORT_LH7
155 # whether use the -lh567- method
156 AC_MSG_CHECKING(default archive method is )
157 AC_ARG_WITH(default_method,
158 AC_HELP_STRING([--with-default-method=[[567]]],
159 [create the -lh[[567]]- archive default [[default=5]]]),
162 *) AC_MSG_ERROR(you should have specified 5, 6 or 7);;
164 with_default_method=5)
165 AC_MSG_RESULT(-lh$with_default_method-)
166 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])
168 # decide temporary path names
169 AC_MSG_CHECKING(template of the temporary file is )
170 AC_ARG_WITH(tmp_file,
171 AC_HELP_STRING([--with-tmp-file=TEMPLATE],
172 [temporary file template [[default=/tmp/lhXXXXXX]]]),
174 yes) with_tmp_file=/tmp/lhXXXXXX ;;
177 with_tmp_file=/tmp/lhXXXXXX)
178 AC_MSG_RESULT($with_tmp_file)
179 if test x"$with_tmp_file" != xno; then
180 AC_DEFINE_UNQUOTED(TMP_FILENAME_TEMPLATE, "$with_tmp_file",
181 [temporary file template for mktemp/mkstemp])
184 # incremental indicator
185 AC_ARG_ENABLE(indicator,
186 AC_HELP_STRING([--enable-indicator],
187 [need incremental indicator [[default=yes]]]),
190 enable_indicator=yes)
191 if test "x$enable_indicator" = xyes; then
192 AC_DEFINE(NEED_INCREMENTAL_INDICATOR, 1,
193 [Define to 1 if you want to use the incremental indicator])
196 # support multibyte filename
197 AC_MSG_CHECKING(kanji code for filename is )
198 AC_ARG_ENABLE(multibyte-filename,
199 AC_HELP_STRING([--enable-multibyte-filename],
200 [support multibyte filename. specify kanji code (euc, sjis, utf8 or auto) [[default=auto]]]),,
202 enable_multibyte_filename=auto)
204 case $enable_multibyte_filename in
207 #if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__hpux)
209 #endif], enable_multibyte_filename=CODE_SJIS,
211 #if defined(__APPLE__) /* for Mac OS X */
213 #endif], enable_multibyte_filename=CODE_UTF8,
214 enable_multibyte_filename=CODE_EUC));;
215 sjis) enable_multibyte_filename=CODE_SJIS;;
216 euc) enable_multibyte_filename=CODE_EUC;;
217 utf8) enable_multibyte_filename=CODE_UTF8;;
219 *) AC_MSG_ERROR([you should specify auto, sjis or euc as your system filename code.]);;
222 AC_MSG_RESULT($enable_multibyte_filename)
223 if test x$enable_multibyte_filename != xno; then
224 AC_DEFINE_UNQUOTED(MULTIBYTE_FILENAME, $enable_multibyte_filename,
225 [Define to CODE_EUC or CODE_SJIS if you want to use multibyte filename])
229 # for multibyte filename
230 LDFLAGS="$LDFLAGS -framework CoreFoundation"
235 # make user/group name extented header
236 AC_ARG_ENABLE(user-name-header,
237 AC_HELP_STRING([--enable-user-name-header],
238 [make user/group name extended header [[default=no]]]),
241 enable_user_name_header=no)
242 if test "x$enable_user_name_header" = xyes; then
243 AC_DEFINE(INCLUDE_OWNER_NAME_IN_HEADER, 1,
244 [Define to 1 if you want to use the user/group name extened header])
247 # backup old archive file
248 AC_ARG_ENABLE(backup_archive,
249 AC_HELP_STRING([--enable-backup-archive],
250 [backup old archive [[default=no]]]),
253 enable_backup_archive=no)
254 if test "x$enable_backup_archive" = xyes; then
255 AC_DEFINE(BACKUP_OLD_ARCHIVE, 1,
256 [Define to 1 if you want to leave an old archive])
259 AC_CONFIG_FILES([Makefile src/Makefile man/Makefile])
260 AC_CONFIG_FILES([tests/Makefile tests/lha-test])