OSDN Git Service

Examine the printf command to pass the test13 on MacOS X
[lha/lha.git] / configure.ac
index 6243897..7b642f0 100644 (file)
@@ -1,5 +1,7 @@
 # Process this file with autoconf to produce a configure script.
-AC_INIT([LHa for UNIX], 1.14i-ac20030324, jca02266@nifty.ne.jp, lha)
+AC_INIT([LHa for UNIX], 1.14i-ac20081023, arai@users.sourceforge.jp, lha)
+AC_DEFINE_UNQUOTED(LHA_CONFIGURE_OPTIONS, "$ac_configure_args",
+           [specified options for the configure script.])
 AC_CANONICAL_HOST
 AC_CANONICAL_TARGET
 AM_INIT_AUTOMAKE
@@ -14,10 +16,49 @@ AC_PROG_GCC_TRADITIONAL
 AC_PROG_INSTALL
 AC_PROG_MAKE_SET
 AC_MINIX
-AM_C_PROTOTYPES
+AC_SYS_LARGEFILE
+dnl Workaround for Zsh bug? on Cygwin:
+dnl
+dnl  Environment to trouble
+dnl    Cygwin version 1.1.5.25
+dnl    Zsh version 4.3.4
+dnl
+dnl  Examples:
+dnl
+dnl  o One machine(no problem)
+dnl    $ uname -srvmpio
+dnl    -> CYGWIN_NT-5.1 1.5.25(0.156/4/2) 2007-12-09 09:47 i686 unknown unknown Cygwin
+dnl    $ zsh -c 'echo | diff - /dev/null' >/dev/null
+dnl    -> $? set to 1
+dnl  o Another machine(problem)
+dnl    $ uname -srvmpio
+dnl    -> CYGWIN_NT-5.1 1.5.25(0.156/4/2) 2008-05-26 20:37 i686 unknown unknown Cygwin
+dnl    zsh -c 'echo | diff - /dev/null' >/dev/null
+dnl    -> diff: -: Illegal seek
+dnl    -> $? set to 2
+dnl
+dnl  I don't know why this problem happend.
+dnl
+# AC_CHECK_PROGS(sh_for_lha_test, [zsh bash ksh pdksh], [sh])
+AC_CACHE_VAL([lha_cv_prog_sh_for_lha_test],[
+AC_CHECK_PROG(sh_for_lha_test, [zsh], [zsh])
+
+if test -n "$sh_for_lha_test"; then
+  $sh_for_lha_test -c 'echo | diff - /dev/null' >/dev/null 2>&1
+  if test $? -eq 2; then
+    sh_for_lha_test=''   # cannot use Zsh
+    $as_unset ac_cv_prog_sh_for_lha_test
+  fi
+fi
+
+if test -z "$sh_for_lha_test"; then
+  AC_CHECK_PROGS(sh_for_lha_test, [bash ksh pdksh], [sh])
+fi
+])
 
 # Checks for libraries.
 AC_SEARCH_LIBS(opendir, [mingwex])
+AC_CHECK_LIB(applefile, af_open)
 
 # Checks for header files.
 AC_HEADER_DIRENT
@@ -32,6 +73,7 @@ AC_STRUCT_TM
 AC_STRUCT_TIMEZONE
 
 AC_CHECK_SIZEOF(long)
+AC_CHECK_SIZEOF(off_t)
 AC_CHECK_TYPES([uid_t, gid_t, long long, uint64_t, ssize_t])
 AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct stat.st_ino],,,
 [
@@ -57,9 +99,10 @@ AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct stat.st_ino],,,
 AC_TYPE_SIGNAL
 AC_FUNC_UTIME_NULL
 AC_FUNC_FNMATCH
+AC_FUNC_FSEEKO
 AC_CHECK_FUNCS(strchr strdup memcpy memset memmove strcasecmp)
 AC_CHECK_FUNCS(mktime timelocal tzset ftime gettimeofday utime)
-AC_CHECK_FUNCS(ftruncate chsize lchown mkstemp)
+AC_CHECK_FUNCS(ftruncate chsize lchown mkstemp ftello)
 AC_CHECK_FUNCS(getpwuid getgrgid getpwnam getgrnam)
 AC_CHECK_FUNCS(iconv basename)
 AC_REPLACE_FUNCS(vsnprintf fnmatch)
@@ -68,6 +111,8 @@ if test $ac_header_dirent = no; then
   AC_LIBOBJ(lhdir)
 fi
 
+AC_CHECK_DECLS([basename])
+
 # checking whether 8 bit clean or not
 AC_CACHE_CHECK([whether strchr()/strrchr() is 8bit clean],
   [lha_cv_func_strchr_8bit_clean],
@@ -158,11 +203,11 @@ SUPPORT_LZHUFF_METHOD=-DSUPPORT_LH7
 # whether use the -lh567- method
 AC_MSG_CHECKING(default archive method)
 AC_ARG_WITH(default-method,
-  AC_HELP_STRING([--with-default-method=[[567]]],
-                [create the -lh[[567]]- archive default [[default=5]]]),
+  [AC_HELP_STRING([[[[--with-default-method=[567]]]]],
+                [create the -lh[567]- archive default [default=5]])],
   [case $withval in
-   [567]) ;;
-   *) AC_MSG_ERROR(you should have specified 5, 6 or 7);;
+   [[567]]) ;;
+   *) AC_MSG_ERROR([you should have specified 5, 6 or 7]);;
    esac],
   with_default_method=5)
 AC_MSG_RESULT(-lh$with_default_method-)
@@ -269,21 +314,23 @@ if test "x$enable_backup_archive" = xyes; then
            [Define to 1 if you want to leave an old archive])
 fi
 
-# enable this option if you need to ignore '.file' files
-# (mainly for the Mac OS X) *experimental*
-AC_MSG_CHECKING(whether enable -X option which ignore dot files)
-AC_ARG_ENABLE(ignore-dot-files,
-  AC_HELP_STRING([--enable-ignore-dot-files],
-                [enable -X option [[default=no]]]),
+# additional suffixes of archive filename.
+AC_MSG_CHECKING(additional suffixes of archive filename)
+AC_ARG_WITH(additional-suffixes,
+  [AC_HELP_STRING([[[--with-additional-suffixes=foo,bar]]],
+                [additional suffixes of archive filename, default is empty string])],
   ,
-  # default
-  enable_ignore_dot_files=no)
+  with_additional_suffixes="")
 
-AC_MSG_RESULT($enable_ignore_dot_files)
-if test "x$enable_ignore_dot_files" = xyes; then
-  AC_DEFINE(IGNORE_DOT_FILES, 1,
-           [Define to 1 if you want to ignore dot files with -X command line switch])
-fi
+AC_MSG_RESULT($with_additional_suffixes)
+AC_DEFINE_UNQUOTED(ADDITIONAL_SUFFIXES, "$with_additional_suffixes",
+           [Define to comma separated suffixes list if you wish to regard it as implicit archive suffixes.])
+
+case $host_os in
+*msdosdjgpp*)
+CFLAGS="$CFLAGS -DNOT_COMPATIBLE_MODE"
+;;
+esac
 
 AC_CONFIG_FILES([Makefile src/Makefile man/Makefile olddoc/Makefile])
 AC_CONFIG_FILES([tests/Makefile tests/lha-test])