OSDN Git Service

correct English
[lha/lha.git] / configure.ac
1 # Process this file with autoconf to produce a configure script.
2 AC_INIT([LHa for UNIX], 1.14i-ac20080217, arai@users.sourceforge.jp, lha)
3 AC_DEFINE_UNQUOTED(LHA_CONFIGURE_OPTIONS, "$ac_configure_args",
4             [specified options for the configure script.])
5 AC_CANONICAL_HOST
6 AC_CANONICAL_TARGET
7 AM_INIT_AUTOMAKE
8 AM_CONFIG_HEADER(config.h)
9
10 AC_DEFINE_UNQUOTED(PLATFORM, "$ac_cv_host",
11                    [the type of system on which the package will run.])
12
13 # Checks for programs.
14 AC_PROG_CC
15 AC_PROG_GCC_TRADITIONAL
16 AC_PROG_INSTALL
17 AC_PROG_MAKE_SET
18 AC_MINIX
19 AM_C_PROTOTYPES
20 AC_SYS_LARGEFILE
21 AC_CHECK_PROGS(sh_for_lha_test, [zsh bash ksh pdksh], [sh])
22
23 # Checks for libraries.
24 AC_SEARCH_LIBS(opendir, [mingwex])
25 AC_CHECK_LIB(applefile, af_open)
26
27 # Checks for header files.
28 AC_HEADER_DIRENT
29 AC_HEADER_STDC
30 AC_CHECK_HEADERS(fcntl.h limits.h sys/file.h sys/param.h sys/time.h)
31 AC_CHECK_HEADERS(pwd.h grp.h utime.h inttypes.h stdint.h fnmatch.h)
32
33 # Checks for typedefs, structures, and compiler characteristics.
34 AC_C_CONST
35 AC_HEADER_TIME
36 AC_STRUCT_TM
37 AC_STRUCT_TIMEZONE
38
39 AC_CHECK_SIZEOF(long)
40 AC_CHECK_SIZEOF(off_t)
41 AC_CHECK_TYPES([uid_t, gid_t, long long, uint64_t, ssize_t])
42 AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct stat.st_ino],,,
43 [
44 #if HAVE_SYS_TYPES_H
45 # include <sys/types.h>
46 #endif
47 #if HAVE_SYS_STAT_H
48 # include <sys/stat.h>
49 #endif
50 #if TIME_WITH_SYS_TIME
51 # include <sys/time.h>
52 # include <time.h>
53 #else
54 # if HAVE_SYS_TIME_H
55 #  include <sys/time.h>
56 # else
57 #  include <time.h>
58 # endif
59 #endif
60 ])
61
62 # Checks for library functions.
63 AC_TYPE_SIGNAL
64 AC_FUNC_UTIME_NULL
65 AC_FUNC_FNMATCH
66 AC_FUNC_FSEEKO
67 AC_CHECK_FUNCS(strchr strdup memcpy memset memmove strcasecmp)
68 AC_CHECK_FUNCS(mktime timelocal tzset ftime gettimeofday utime)
69 AC_CHECK_FUNCS(ftruncate chsize lchown mkstemp ftello)
70 AC_CHECK_FUNCS(getpwuid getgrgid getpwnam getgrnam)
71 AC_CHECK_FUNCS(iconv basename)
72 AC_REPLACE_FUNCS(vsnprintf fnmatch)
73
74 if test $ac_header_dirent = no; then
75   AC_LIBOBJ(lhdir)
76 fi
77
78 AC_CHECK_DECLS([basename])
79
80 # checking whether 8 bit clean or not
81 AC_CACHE_CHECK([whether strchr()/strrchr() is 8bit clean],
82   [lha_cv_func_strchr_8bit_clean],
83   AC_TRY_RUN([
84 #if STDC_HEADERS
85 # include <string.h>
86 #else
87 # if !HAVE_STRCHR
88 #  define strchr index
89 #  define strrchr rindex
90 # endif
91 char *strchr (), *strrchr ();
92 #endif
93
94 main()
95 {
96   char *s = "\377";
97   if (strchr(s, 0xff) != s) exit(1);
98   if (strchr(s, '\377') != s) exit(1);
99   if (strrchr(s, 0xff) != s) exit(1);
100   if (strrchr(s, '\377') != s) exit(1);
101   exit(0); /* ok */
102 }
103 ], lha_cv_func_strchr_8bit_clean=yes,
104    lha_cv_func_strchr_8bit_clean=no,
105    lha_cv_func_strchr_8bit_clean=no))
106
107 if test x$lha_cv_func_strchr_8bit_clean = xyes; then
108   AC_DEFINE(STRCHR_8BIT_CLEAN, 1,
109             [Define to 1 if strchr()/strrchr() works correctly.])
110 fi
111
112 # checking whether the 2nd argument of gettimeofday() is effective or not.
113 # note that this timezone argument is obsolete.
114 AC_CACHE_CHECK([whether the 2nd argument of gettimeofday() is effective],
115   [lha_cv_func_gettimeofday_2nd_arg],
116   AC_TRY_RUN([
117 #if TIME_WITH_SYS_TIME
118 # include <sys/time.h>
119 # include <time.h>
120 #else
121 # if HAVE_SYS_TIME_H
122 #  include <sys/time.h>
123 # else
124 #  include <time.h>
125 # endif
126 #endif
127
128 main()
129 {
130     struct timeval tv;
131     struct timezone tz;
132
133     tz.tz_minuteswest = -1;
134     if (gettimeofday(&tv, &tz) == -1)
135         exit(1);
136
137     if (tz.tz_minuteswest == -1)
138         exit(1);        /* the timezone information is no given */
139
140     exit(0);
141 }], lha_cv_func_gettimeofday_2nd_arg=yes,
142    lha_cv_func_gettimeofday_2nd_arg=no,
143    lha_cv_func_gettimeofday_2nd_arg=no))
144
145 if test x$lha_cv_func_gettimeofday_2nd_arg = xyes; then
146   AC_DEFINE(GETTIMEOFDAY_HAS_2ND_ARG, 1,
147             [Define to 1 if the 2nd argument of gettimeofday() is effective.])
148 fi
149
150 # support kanji code conversion
151 AC_SUBST(DEF_KCODE)
152 AC_MSG_CHECKING(kanji code conversion on text file)
153 AC_ARG_ENABLE(text-conv,
154   AC_HELP_STRING([--enable-text-conv],
155                  [support text code convert from/to EUC [[default=yes]]]),
156   , enable_text_conv=yes)
157
158 AC_MSG_RESULT($enable_text_conv)
159 if test $enable_text_conv = yes; then
160   DEF_KCODE=-DEUC
161 fi
162
163 # force support -lh7-
164 AC_SUBST(SUPPORT_LZHUFF_METHOD)
165 SUPPORT_LZHUFF_METHOD=-DSUPPORT_LH7
166
167 # whether use the -lh567- method
168 AC_MSG_CHECKING(default archive method)
169 AC_ARG_WITH(default-method,
170   [AC_HELP_STRING([[[[--with-default-method=[567]]]]],
171                  [create the -lh[567]- archive default [default=5]])],
172   [case $withval in
173    [[567]]) ;;
174    *) AC_MSG_ERROR([you should have specified 5, 6 or 7]);;
175    esac],
176   with_default_method=5)
177 AC_MSG_RESULT(-lh$with_default_method-)
178 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])
179
180 # decide temporary path names
181 AC_MSG_CHECKING(template of the temporary file)
182 AC_ARG_WITH(tmp-file,
183   AC_HELP_STRING([--with-tmp-file=TEMPLATE],
184                  [temporary file template [[default=/tmp/lhXXXXXX]]]),
185   [case $withval in
186    yes)  with_tmp_file=/tmp/lhXXXXXX ;;
187    no)   ;;
188    esac],
189   with_tmp_file=/tmp/lhXXXXXX)
190
191 AC_MSG_RESULT($with_tmp_file)
192 if test x"$with_tmp_file" != xno; then
193   AC_DEFINE_UNQUOTED(TMP_FILENAME_TEMPLATE, "$with_tmp_file",
194     [temporary file template for mktemp/mkstemp])
195 fi
196
197 # incremental indicator
198 AC_MSG_CHECKING(whether incremental indicator is needed)
199 AC_ARG_ENABLE(indicator,
200   AC_HELP_STRING([--enable-indicator],
201                  [need incremental indicator [[default=yes]]]),
202   ,
203   # default
204   enable_indicator=yes)
205
206 AC_MSG_RESULT($enable_indicator)
207 if test "x$enable_indicator" = xyes; then
208   AC_DEFINE(NEED_INCREMENTAL_INDICATOR, 1,
209             [Define to 1 if you want to use the incremental indicator])
210 fi
211
212 # support multibyte filename
213 AC_MSG_CHECKING(kanji code of filename)
214 AC_ARG_ENABLE(multibyte-filename,
215   AC_HELP_STRING([--enable-multibyte-filename],
216                  [support multibyte filename. specify kanji code (euc, sjis, utf8 or auto) [[default=auto]]]),,
217   # default
218   enable_multibyte_filename=auto)
219
220 case $enable_multibyte_filename in
221 auto|yes)
222   AC_EGREP_CPP(SJIS,[
223 #if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__hpux)
224 SJIS
225 #endif], enable_multibyte_filename=CODE_SJIS,
226   AC_EGREP_CPP(UTF8,[
227 #if defined(__APPLE__)  /* for Mac OS X */
228 UTF8
229 #endif], enable_multibyte_filename=CODE_UTF8,
230          enable_multibyte_filename=CODE_EUC));;
231 sjis)    enable_multibyte_filename=CODE_SJIS;;
232 euc)     enable_multibyte_filename=CODE_EUC;;
233 utf8)    enable_multibyte_filename=CODE_UTF8;;
234 no)      ;;
235 *)       AC_MSG_ERROR([you should specify auto, sjis or euc as your system filename code.]);;
236 esac
237
238 AC_MSG_RESULT($enable_multibyte_filename)
239 if test x$enable_multibyte_filename != xno; then
240   AC_DEFINE_UNQUOTED(MULTIBYTE_FILENAME, $enable_multibyte_filename,
241       [Define to CODE_EUC or CODE_SJIS if you want to use multibyte filename])
242
243   case $target_os in
244   darwin*)
245         # for multibyte filename
246         LDFLAGS="$LDFLAGS -framework CoreFoundation"
247         ;;
248   esac
249 fi
250
251 # make user/group name extented header
252 AC_MSG_CHECKING(whether user/group name extended header is needed)
253 AC_ARG_ENABLE(user-name-header,
254   AC_HELP_STRING([--enable-user-name-header],
255                  [make user/group name extended header [[default=no]]]),
256   ,
257   # default
258   enable_user_name_header=no)
259
260 AC_MSG_RESULT($enable_user_name_header)
261 if test "x$enable_user_name_header" = xyes; then
262   AC_DEFINE(INCLUDE_OWNER_NAME_IN_HEADER, 1,
263             [Define to 1 if you want to use the user/group name extened header])
264 fi
265
266 # backup old archive file
267 AC_MSG_CHECKING(whether backup file for old archive is left)
268 AC_ARG_ENABLE(backup-archive,
269   AC_HELP_STRING([--enable-backup-archive],
270                  [backup old archive [[default=no]]]),
271   ,
272   # default
273   enable_backup_archive=no)
274
275 AC_MSG_RESULT($enable_backup_archive)
276 if test "x$enable_backup_archive" = xyes; then
277   AC_DEFINE(BACKUP_OLD_ARCHIVE, 1,
278             [Define to 1 if you want to leave an old archive])
279 fi
280
281 # additional suffixes of archive filename.
282 AC_MSG_CHECKING(additional suffixes of archive filename)
283 AC_ARG_WITH(additional-suffixes,
284   [AC_HELP_STRING([[[--with-additional-suffixes=foo,bar]]],
285                  [additional suffixes of archive filename, default is empty string])],
286   ,
287   with_additional_suffixes="")
288
289 AC_MSG_RESULT($with_additional_suffixes)
290 AC_DEFINE_UNQUOTED(ADDITIONAL_SUFFIXES, "$with_additional_suffixes",
291             [Define to comma separated suffixes list if you wish to regard it as implicit archive suffixes.])
292
293 case $host_os in
294 *msdosdjgpp*)
295 CFLAGS="$CFLAGS -DNOT_COMPATIBLE_MODE"
296 ;;
297 esac
298
299 AC_CONFIG_FILES([Makefile src/Makefile man/Makefile olddoc/Makefile])
300 AC_CONFIG_FILES([tests/Makefile tests/lha-test])
301 AC_OUTPUT