OSDN Git Service

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