OSDN Git Service

* configure.in, configure.ac, config.h.in: checks having
[lha/lha.git] / configure.in
index a2d3332..4c95772 100644 (file)
@@ -1,19 +1,20 @@
 dnl Process this file with autoconf to produce a configure script.
 AC_INIT(src/lha.h)
-AM_INIT_AUTOMAKE(lha, 1.14i)
+AM_INIT_AUTOMAKE(lha, 1.14i-ac20020527a)
 AM_CONFIG_HEADER(config.h)
 
 AC_CANONICAL_HOST
 
+AC_DEFINE_UNQUOTED(PLATFORM, "$ac_cv_host",
+                  [the type of system on which the package will run.])
+
 dnl Checks for programs.
 AC_PROG_CC
 AC_PROG_GCC_TRADITIONAL
 AC_PROG_INSTALL
 AC_PROG_MAKE_SET
-
-dnl on MINIX, define _MINIX and _POSIX_SOURCE
 AC_MINIX
-
+AM_C_PROTOTYPES
 AC_EXEEXT
 AC_OBJEXT
 
@@ -22,14 +23,16 @@ dnl Checks for libraries.
 dnl Checks for header files.
 AC_HEADER_DIRENT
 AC_HEADER_STDC
-AC_CHECK_HEADERS(fcntl.h limits.h sys/file.h sys/time.h)
+AC_CHECK_HEADERS(fcntl.h limits.h sys/file.h sys/param.h sys/time.h)
+AC_CHECK_HEADERS(pwd.h grp.h)
 
 dnl Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
 AC_HEADER_TIME
 AC_STRUCT_TM
 AC_STRUCT_TIMEZONE
 
-AC_CACHE_CHECK([for tm_gmtoff in struct tm], ac_cv_struct_tm_gmtoff,
+AC_CACHE_CHECK([for tm_gmtoff in struct tm], ac_cv_member_struct_tm_tm_gmtoff,
 [AC_TRY_COMPILE([
 #if TM_IN_SYS_TIME
 #include <sys/time.h>
@@ -37,32 +40,38 @@ AC_CACHE_CHECK([for tm_gmtoff in struct tm], ac_cv_struct_tm_gmtoff,
 #include <time.h>
 #endif
   ], [struct tm t; t.tm_gmtoff;],
-  ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no)
+  ac_cv_member_struct_tm_tm_gmtoff=yes,
+  ac_cv_member_struct_tm_tm_gmtoff=no)
 ])
 
-if test "x$ac_cv_struct_tm_gmtoff" = xyes; then
-  AC_DEFINE(HAVE_TM_GMTOFF, 1, [Define if your struct tm has tm_gmtoff])
+if test "x$ac_cv_member_struct_tm_tm_gmtoff" = xyes; then
+  AC_DEFINE(HAVE_STRUCT_TM_TM_GMTOFF, 1,
+           [Define if your struct tm has tm_gmtoff])
 fi
 
-AC_CACHE_CHECK([for st_ino in struct stat], ac_cv_struct_st_ino,
+AC_CACHE_CHECK([for st_ino in struct stat], ac_cv_member_struct_stat_st_ino,
 [AC_TRY_COMPILE([
 #include <sys/types.h>
 #include <sys/stat.h>
   ], [struct stat s; s.st_ino;],
-  ac_cv_struct_st_ino=yes, ac_cv_struct_st_ino=no)
+  ac_cv_member_struct_stat_st_ino=yes,
+  ac_cv_member_struct_stat_st_ino=no)
 ])
 
-if test "x$ac_cv_struct_st_ino" = xyes; then
-  AC_DEFINE(HAVE_ST_INO, 1, [Define if your struct stat has st_ino])
+if test "x$ac_cv_member_struct_stat_st_ino" = xyes; then
+  AC_DEFINE(HAVE_STRUCT_STAT_ST_INO, 1,
+           [Define if your struct stat has st_ino])
 fi
 
 dnl Checks for library functions.
 AC_TYPE_SIGNAL
+AC_FUNC_FORK
 AC_FUNC_UTIME_NULL
-AC_CHECK_FUNCS(strchr memcpy)
-AC_CHECK_FUNCS(mktime timelocal tzset ftime gettimeofday)
-AC_CHECK_FUNCS(mkdir rmdir strdup memset ftruncate lchown mkstemp)
-AC_CHECK_FUNCS(strcasecmp)
+AC_CHECK_FUNCS(strchr strdup memcpy memset memmove)
+AC_CHECK_FUNCS(mktime timelocal tzset ftime gettimeofday utime)
+AC_CHECK_FUNCS(mkdir rmdir ftruncate lchown mkstemp)
+AC_CHECK_FUNCS(strcasecmp link)
+AC_CHECK_FUNCS(getpwuid getgrgid getpwnam getgrnam)
 
 AC_SUBST(LIBOBJS)
 if test $ac_header_dirent = no; then
@@ -96,18 +105,21 @@ AC_ARG_WITH(default_method,
 AC_MSG_RESULT(-lh$with_default_method-)
 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])
 
-dnl decide path names
+dnl decide temporary path names
 AC_MSG_CHECKING(template of the temporary file is )
 AC_ARG_WITH(tmp_file,
   [  --with-tmp-file=TEMPLATE temporary file template [default=/tmp/lhXXXXXX]],
   [case $withval in
-   yes|no) AC_MSG_ERROR(you should have specified path name);;
+   yes)  with_tmp_file=/tmp/lhXXXXXX ;;
+   no)   ;;
    esac],
   with_tmp_file=/tmp/lhXXXXXX)
 
 AC_MSG_RESULT($with_tmp_file)
-AC_DEFINE_UNQUOTED(TMP_FILENAME_TEMPLATE, "$with_tmp_file",
-  [temporary file template])
+if test x"$with_tmp_file" != xno; then
+  AC_DEFINE_UNQUOTED(TMP_FILENAME_TEMPLATE, "$with_tmp_file",
+    [temporary file template for mktemp/mkstemp])
+fi
 
 dnl incremental indicator
 AC_ARG_ENABLE(indicator,
@@ -122,7 +134,7 @@ fi
 
 dnl support multibyte filename
 AC_ARG_ENABLE(multibyte-char,
-  [  --enable-multibyte-char support multibyte(sjis) filename [default=yes]],
+  [  --enable-multibyte-char support multibyte filename [default=yes]],
   ,
   # default
   enable_multibyte_char=yes)
@@ -131,4 +143,4 @@ if test "x$enable_multibyte_char" = xyes; then
   AC_DEFINE(MULTIBYTE_CHAR, 1, [Define you want to use multibyte filename])
 fi
 
-AC_OUTPUT([Makefile src/Makefile man/Makefile])
+AC_OUTPUT([Makefile src/Makefile man/Makefile tests/Makefile tests/lha-test])