b9d19d6f8fae13d0e9c6aa1e9a8a8c10ff57155f
[debian/cpmtools] / configure.in
1 AC_INIT(cpmfs.c)
2 AC_CONFIG_HEADER(config.h)
3 AC_CANONICAL_HOST
4 VERSION=2.1
5 UPDATED='April 21, 2002'
6
7 DEVICE="posix"
8
9 if test "$prefix" = NONE
10 then
11   case $host in
12     *-linux-*)
13       PIPE="-pipe "
14     ;;
15   esac
16   case $host in
17     *-netbsd*)
18       PIPE="-pipe "
19     ;;
20   esac
21 fi
22
23 AC_PROG_CC
24 AC_PROG_INSTALL
25 AC_PROG_CPP
26
27 if test "$GCC" = yes
28 then
29   CFLAGS="${CFLAGS} ${PIPE}-Wmissing-prototypes -Wstrict-prototypes -Wcast-qual -Wpointer-arith -Wcast-align -Wwrite-strings -Wmissing-declarations -Wnested-externs -pedantic -fno-common"
30   LDFLAGS='-g'
31 fi
32
33 AC_ARG_WITH(defformat,[  --with-defformat        Specify default format (ibm-3740)], 
34                 [DEFFORMAT="$withval"], [DEFFORMAT="ibm-3740"])
35 AC_ARG_WITH(libdsk,   [  --with-libdsk           Specify path to libdsk library], 
36                 [LIBDSK="$withval"], [LIBDSK=""])
37 AC_ARG_WITH(dmalloc,  [  --with-dmalloc          Specify path to dmalloc library], 
38                 [DMALLOC="$withval"], [DMALLOC=""])
39
40 AC_CYGWIN
41 AC_MINGW32
42 dnl Choose between posix and win32 drivers...
43 DEVICE="posix"
44
45 if test "$CYGWIN" = "yes"
46 then
47   DEVICE="win32"
48 fi
49 if test "$MINGW32" = "yes"
50 then
51   DEVICE="win32"
52 fi
53
54
55 dnl Check for curses. If not found, don't build fsed.cpm
56 dnl Try both curses and ncurses
57 AC_CHECK_LIB(curses, printw, FSED_CPM=fsed.cpm LIBS="-lcurses $LIBS", FSED_CPM=)
58 if test x"$FSED_CPM" = x""; then
59   AC_CHECK_LIB(ncurses, printw, FSED_CPM=fsed.cpm LIBS="-lncurses $LIBS", FSED_CPM=)
60 fi
61
62 dnl If using libdsk, check it's available. 
63 if test "$LIBDSK" != ""; then
64   DEVICE="libdsk"
65   CPPFLAGS="$CPPFLAGS -I$LIBDSK/include"
66   CFLAGS="$CFLAGS -I$LIBDSK/include"
67   LDFLAGS="$LDFLAGS -L$LIBDSK/lib"
68   AC_CHECK_LIB(dsk, dsk_open)
69   AC_CHECK_HEADERS(libdsk.h, ,[echo "No libdsk.h - aborting"; exit 1])
70 fi
71
72 dnl If using win32, check it's available. 
73 if test x"$DEVICE" = x"win32"; then
74   AC_CHECK_HEADERS(windows.h winioctl.h, ,[echo "Windows headers not found - aborting"; exit 1] )
75 fi
76
77 dnl Check for dmalloc
78 if test x"$DMALLOC" != x""; then
79    CPPFLAGS  = "-I$DMALLOC/include $CPPFLAGS"
80    CFLAGS  = "-I$DMALLOC/include $CFLAGS"
81    LDFLAGS = "-L$DMALLOC/lib $LDFLAGS"
82    AC_CHECK_LIB(dmalloc, malloc)
83    AC_CHECK_HEADERS(dmalloc.h)
84 fi
85
86
87 dnl Checks for header files.
88 AC_HEADER_STDC
89 AC_CHECK_HEADERS(fcntl.h sys/types.h sys/stat.h limits.h unistd.h)
90
91 dnl Checks for typedefs, structures, and compiler characteristics.
92 AC_C_CONST
93 AC_TYPE_MODE_T
94 AC_TYPE_OFF_T
95 AC_TYPE_PID_T
96 AC_TYPE_SIZE_T
97 AC_STRUCT_TM
98 AC_EXEEXT
99 AC_OBJEXT
100
101 dnl add EXE extension to fsed.cpm
102 if test x"$FSED_CPM" != x""; then
103   FSED_CPM="$FSED_CPM$EXEEXT"
104 fi
105
106 dnl Checks for library functions.
107 AC_FUNC_MEMCMP
108 AC_FUNC_STRFTIME
109 AC_CHECK_FUNCS(mktime strerror)
110
111 AC_SUBST(LDLIBS)
112 AC_SUBST(LDDEPS)
113 AC_SUBST(DEVICE)
114 eval DATADIR=$datadir
115 AC_SUBST(DATADIR)
116 AC_SUBST(DISKDEFS)
117 AC_SUBST(DEFFORMAT)
118 AC_SUBST(FSED_CPM)
119 AC_SUBST(UPDATED)
120 AC_OUTPUT(Makefile cpm.5 cpmchattr.1 cpmchmod.1 cpmcp.1 cpmls.1 cpmrm.1 fsck.cpm.1 fsed.cpm.1 mkfs.cpm.1 )