summaryrefslogtreecommitdiff
path: root/dmake/configure.in
blob: 05f2ef0240d3d06d9f7c47fab240cc3c9895784a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194

dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.50)
AC_INIT

dnl set the DMAKEROOT
#AC_FUNC_SET_DMAKEROOT
PACKAGE=dmake
VERSION=4.2

AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
AM_MAINTAINER_MODE

dnl Checks for programs.
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_RANLIB

dnl Checks for utilities.
AC_PROG_AWK

dnl Checks for libraries.

dnl Initialize libtool
#AM_PROG_LIBTOOL


dnl Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h limits.h strings.h sys/types.h sys/stat.h unistd.h errno.h utime.h spawn.h wait.h sys/wait.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_CHECK_SIZEOF(short, 2)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long, 4)

dnl Checks for library functions.
AC_FUNC_MEMCMP
AC_TYPE_SIGNAL
AC_FUNC_UTIME_NULL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(getcwd getwd putenv strcspn strerror strspn strstr setvbuf tzset settz mkstemp tempnam)

dnl Checks for OS
AC_MSG_CHECKING([the operating system])

_os=`uname`

if test `echo $_os | $AWK -F_ '{ print $1 }'` = "CYGWIN"; then
   if test "$GCC" = "yes"; then
      if test `$CC -dumpmachine | $AWK -F- '{ print $3 }'` = "mingw32"; then
         _os="MINGW"
      else
         _os="CYGWIN"
      fi
   else
      _os="MSVC6"
   fi
fi


## At the moment all except mingw builds are OS_TYPE unix
OS_TYPE=unix

## The following allows like systems to share settings this is not meant to
## Imply that these OS are the same thing.
case "$_os" in
	"SunOS")
	  OS_VERSION=solaris  
	  ;;
	"Linux")
	  OS_VERSION=linux
	  ;;
	"CYGWIN")
	  OS_VERSION=cygwin
	  ;;
	"MINGW")
	  OS_VERSION=mingw
	  OS_TYPE=winnt
	  ;;
	"MSVC6")
	  OS_VERSION=msvc6
	  OS_TYPE=winnt
	  ;;
	"Darwin")
	  OS_VERSION=macosx
	  ;;
	"FreeBSD")
	  OS_VERSION=linux
	  ;;
	"OSF1")
	  OS_VERSION=sysvr4
	  ;;
	"NetBSD")
	  OS_VERSION=linux
	  ;;
	"IRIX")
	  OS_VERSION=sysvr4
	  ;;
	"IRIX64")
	  OS_VERSION=sysvr4
	  ;;
	"GNU")
	  OS_VERSION=linux
	  ;;
   *)
      AC_MSG_ERROR([$_os operating system is not suitable to build dmake!])
      ;;
esac

AC_MSG_RESULT([checked ($_os)])

if test x$OS_TYPE = xunix; then
  OS_SUBDIRS=["unix startup"]
  OS_LIBRARY=unix/libunix.a
else
  OS_SUBDIRS=["win95 msdos startup"]
  OS_LIBRARY=["win95/libwin95.a msdos/libmsdos.a win95/microsft/libmsft.a"]
fi

AC_SUBST(OS_TYPE)
AC_SUBST(OS_VERSION)
AC_SUBST(OS_SUBDIRS)
AC_SUBST(OS_LIBRARY)

AM_CONFIG_HEADER(config.h)

AC_CONFIG_FILES(Makefile unix/Makefile startup/Makefile startup/unix/Makefile \
		startup/unix/linux/Makefile startup/unix/solaris/Makefile \
		startup/unix/macosx/Makefile startup/unix/sysvr4/Makefile \
		startup/unix/cygwin/Makefile \
		startup/winnt/Makefile startup/winnt/mingw/Makefile \
		startup/winnt/msvc6/Makefile \
		msdos/Makefile win95/Makefile win95/microsft/Makefile )

dnl ******************************
dnl *** output the whole stuff ***
dnl ******************************

AC_CONFIG_COMMANDS_POST([


## Generate `dmakeroot.h' in two cases
## 1. `config.status' is run either explicitly, or via configure.
##     Esp. not when it is run in `Makefile' to generate makefiles and
##     config.h
## 2. CONFIG_OTHER is set explicitly
##
## Case 1 is difficult.  We know that `automake' sets one of
## CONFIG_FILES or CONFIG_HEADERS to empty.  This heuristic works
## only when AM_CONFIG_HEADER is set, however.

if test -n "${CONFIG_FILES}" && test -n "${CONFIG_HEADERS}"; then
	# Both CONFIG_FILES and CONFIG_HEADERS are non-empty ==> Case 1
	CONFIG_OTHER=${CONFIG_OTHER:-dmakeroot.h}
fi
    outfile=dmakeroot.h-tmp
    cat > $outfile <<\_______EOF
	/* dmakeroot.h
	 *
  	 * This is a generated file.  Please modify `configure.in'
     */

_______EOF

if test x$prefix != x; then
   if test x$OS_TYPE = xunix; then
       echo '"DMAKEROOT := '$prefix'/share/startup",' >> $outfile
   fi
   echo '"OS := '${OS_VERSION}'",' >> $outfile
fi
if cmp -s $outfile dmakeroot.h; then
    echo dmakeroot.h is unchanged
    rm -f $outfile
else
    mv $outfile dmakeroot.h
fi
])
							  
				   
dnl set the DMAKEROOT
AC_SET_DMAKEROOT

dnl *** output to disk ***
AC_OUTPUT