OSDN Git Service

* configure.ac, configure.in, README.autoconf: be able to specify
[lha/lha.git] / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(lha, 1.14i)
3 AC_CANONICAL_TARGET
4 AM_INIT_AUTOMAKE
5 AM_CONFIG_HEADER(config.h)
6
7 AC_DEFINE_UNQUOTED(PLATFORM, "$ac_cv_host",
8                    [the type of system on which the package will run.])
9
10 dnl Checks for programs.
11 AC_PROG_CC
12 AC_PROG_GCC_TRADITIONAL
13 AC_PROG_INSTALL
14 AC_PROG_MAKE_SET
15 AC_MINIX
16 AM_C_PROTOTYPES
17 AC_C_CONST
18
19 dnl Checks for libraries.
20
21 dnl Checks for header files.
22 AC_HEADER_DIRENT
23 AC_HEADER_STDC
24 AC_CHECK_HEADERS(fcntl.h limits.h sys/file.h sys/time.h)
25
26 dnl Checks for typedefs, structures, and compiler characteristics.
27 AC_HEADER_TIME
28 AC_STRUCT_TM
29 AC_STRUCT_TIMEZONE
30
31 AC_CACHE_CHECK([for tm_gmtoff in struct tm], ac_cv_struct_tm_gmtoff,
32 [AC_TRY_COMPILE([
33 #if TM_IN_SYS_TIME
34 #include <sys/time.h>
35 #else
36 #include <time.h>
37 #endif
38   ], [struct tm t; t.tm_gmtoff;],
39   ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no)
40 ])
41
42 if test "x$ac_cv_struct_tm_gmtoff" = xyes; then
43   AC_DEFINE(HAVE_TM_GMTOFF, 1, [Define if your struct tm has tm_gmtoff])
44 fi
45
46 AC_CACHE_CHECK([for st_ino in struct stat], ac_cv_struct_st_ino,
47 [AC_TRY_COMPILE([
48 #include <sys/types.h>
49 #include <sys/stat.h>
50   ], [struct stat s; s.st_ino;],
51   ac_cv_struct_st_ino=yes, ac_cv_struct_st_ino=no)
52 ])
53
54 if test "x$ac_cv_struct_st_ino" = xyes; then
55   AC_DEFINE(HAVE_ST_INO, 1, [Define if your struct stat has st_ino])
56 fi
57
58 dnl Checks for library functions.
59 AC_TYPE_SIGNAL
60 AC_FUNC_UTIME_NULL
61 AC_CHECK_FUNCS(strchr memcpy)
62 AC_CHECK_FUNCS(mktime timelocal tzset ftime gettimeofday)
63 AC_CHECK_FUNCS(mkdir rmdir strdup memset ftruncate lchown mkstemp)
64 AC_CHECK_FUNCS(strcasecmp link)
65
66 if test $ac_header_dirent = no; then
67   AC_LIBOBJ(lhdir)
68 fi
69
70 dnl support kanji code conversion
71 AC_SUBST(DEF_KCODE)
72 AC_ARG_ENABLE(text_conv,
73   AC_HELP_STRING([--enable-text-conv],
74                  [support text code convert from/to EUC [[default=yes]]]),
75   , enable_text_conv=yes)
76
77 if test $enable_text_conv = yes; then
78   DEF_KCODE=-DEUC
79 fi
80
81 # force support -lh7-
82 AC_SUBST(SUPPORT_LZHUFF_METHOD)
83 SUPPORT_LZHUFF_METHOD=-DSUPPORT_LH7
84
85 dnl whether use the -lh567- method
86 AC_MSG_CHECKING(default archive method is )
87 AC_ARG_WITH(default_method,
88   AC_HELP_STRING([--with-default-method=[[567]]],
89                  [create the -lh[[567]]- archive default [[default=5]]]),
90   [case $withval in
91    [567]) ;;
92    *) AC_MSG_ERROR(you should have specified 5, 6 or 7);;
93    esac],
94   with_default_method=5)
95
96 AC_MSG_RESULT(-lh$with_default_method-)
97 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])
98
99 dnl decide temporary path names
100 AC_MSG_CHECKING(template of the temporary file is )
101 AC_ARG_WITH(tmp_file,
102   AC_HELP_STRING([--with-tmp-file=TEMPLATE],
103                  [temporary file template [[default=/tmp/lhXXXXXX]]]),
104   [case $withval in
105    yes)  with_tmp_file=/tmp/lhXXXXXX ;;
106    no)   ;;
107    esac],
108   with_tmp_file=/tmp/lhXXXXXX)
109
110 AC_MSG_RESULT($with_tmp_file)
111 if test x"$with_tmp_file" != xno; then
112   AC_DEFINE_UNQUOTED(TMP_FILENAME_TEMPLATE, "$with_tmp_file",
113     [temporary file template])
114 fi
115
116 dnl incremental indicator
117 AC_ARG_ENABLE(indicator,
118   AC_HELP_STRING([--enable-indicator],
119                  [need incremental indicator [[default=yes]]]),
120   ,
121   # default
122   enable_indicator=yes)
123
124 if test "x$enable_indicator" = xyes; then
125   AC_DEFINE(NEED_INCREMENTAL_INDICATOR, 1, [Define you want to use the incremental indicator])
126 fi
127
128 dnl support multibyte filename
129 AC_ARG_ENABLE(multibyte-char,
130   AC_HELP_STRING([--enable-multibyte-char],
131                  [support multibyte filename [[default=yes]]]),
132   ,
133   # default
134   enable_multibyte_char=yes)
135
136 if test "x$enable_multibyte_char" = xyes; then
137   AC_DEFINE(MULTIBYTE_CHAR, 1, [Define you want to use multibyte filename])
138 fi
139
140 AC_CONFIG_FILES([Makefile src/Makefile man/Makefile])
141 AC_OUTPUT