21cc3851e342ecdbf2308e0b4882a97d587adc34
[openafs.git] / src / cf / osconf.m4
1
2 AC_DEFUN([OPENAFS_OSCONF], [
3
4 dnl defaults, override in case below as needed
5 RXDEBUG="-DRXDEBUG"
6 SHLIB_SUFFIX="so"
7 CCOBJ="\$(CC)"
8 MT_CC="\$(CC)"
9 XLIBS="${LIB_AFSDB} ${LIB_libintl}"
10 MT_LIBS='-lpthread ${XLIBS}'
11 XCFLAGS=
12
13 dnl debugging and optimization flag defaults
14 dnl Note, these are all the defaults for if debug/optimize turned on, and
15 dnl the arch cases below do override as needed
16 KERN_DBG=-g
17 KERN_OPTMZ=-O
18 DBG=-g
19 OPTMZ=-O
20 LWP_DBG=-g
21 NO_STRIP_BIN=
22 LWP_OPTMZ=-O
23 PAM_DBG=-g
24 PAM_OPTMZ=
25
26 dnl standard programs
27 AC_PROG_RANLIB
28 AC_CHECK_TOOL(AS, as, [false])
29 AC_CHECK_PROGS(MV, mv, [false])
30 AC_CHECK_PROGS(RM, rm, [false])
31 AC_CHECK_TOOL(LD, ld, [false])
32 AC_CHECK_PROGS(CP, cp, [false])
33 AC_CHECK_PROGS(GENCAT, gencat, [false])
34
35 case $AFS_SYSNAME in
36         alpha_linux_22 | alpha_linux_24 | alpha_linux_26)
37                 CCOBJ="\$(CC) -fPIC"
38                 MT_CFLAGS='-pthread -D_REENTRANT'
39                 PAM_OPTMZ=-O2
40                 PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
41                 SHLIB_CFLAGS="-fPIC"
42                 SHLIB_LINKER="${CC} -shared"
43                 ;;
44
45         arm_linux_24 | arm_linux26 | arm64_linux26)
46                 CCOBJ="\$(CC) -fPIC"
47                 MT_CFLAGS='-pthread -D_REENTRANT'
48                 PAM_OPTMZ=-O2
49                 PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
50                 SHLIB_CFLAGS="-fPIC"
51                 SHLIB_LINKER="${CC} -shared"
52                 ;;
53
54         hp_ux102)
55                 AS="/usr/ccs/bin/as"
56                 CC="/opt/ansic/bin/cc -Ae"
57                 DBM="/lib/libndbm.a"
58                 LD="/bin/ld"
59                 LEX="/opt/langtools/bin/lex"
60                 LWP_OPTMZ="-O"
61                 MT_CFLAGS='-D_POSIX_C_SOURCE=199506L'
62                 MT_LIBS='-L/opt/dce/lib -ldce ${XLIBS}'
63                 MV="/bin/mv"
64                 OPTMZ="-O"
65                 PAM_CFLAGS="+DA1.0 +z -Wl,+k"
66                 PAM_LIBS="/usr/lib/libpam.1"
67                 RANLIB="/usr/bin/ranlib"
68                 RM="/bin/rm"
69                 SHLIB_SUFFIX="sl"
70                 VFSCK_CFLAGS="-D_FILE64"
71                 XCFLAGS0="-ldld -lc -Wp,-H200000 -Wl,-a,archive -DAUTH_DBM_LOG +z -Wl,+k -D_LARGEFILE64_SOURCE"
72                 XCFLAGS64="${XCFLAGS0} +DA2.0W"
73                 XCFLAGS="${XCFLAGS0} +DA1.0"
74                 YACC="/opt/langtools/bin/yacc"
75                 SHLIB_LINKER="ld -b"
76                 ;;
77
78         hp_ux11*)
79                 AR="/usr/bin/ar"
80                 AS="/usr/ccs/bin/as"
81                 CC="/opt/ansic/bin/cc"
82                 DBM="/lib/libndbm.a"
83                 LD="/bin/ld   "
84                 LEX="/opt/langtools/bin/lex"
85                 LWP_OPTMZ="-O"
86                 MT_CFLAGS='-D_POSIX_C_SOURCE=199506L'
87                 MV="/bin/mv"
88                 OPTMZ="-O"
89                 PAM_CFLAGS="+DA1.0 +z -Wl,+k"
90                 PAM_LIBS="/usr/lib/libpam.1"
91                 RANLIB="/usr/bin/ranlib"
92                 RM="/bin/rm"
93                 SHLIB_SUFFIX="sl"
94                 VFSCK_CFLAGS="-I/usr/old/usr/include -D_FILE64"
95                 XCFLAGS0="-ldld -lc -Wp,-H200000 -Wl,-a,archive -DAUTH_DBM_LOG +z -Wl,+k -D_LARGEFILE64_SOURCE"
96                 XCFLAGS64="${XCFLAGS0} +DA2.0W"
97                 XCFLAGS="${XCFLAGS0} +DA1.0"
98                 XLIBELFA="-lelf"
99                 YACC="/opt/langtools/bin/yacc"
100                 SHLIB_LINKER="ld -b"
101                 ;;
102
103         ia64_hpux*)
104                 AR="/usr/bin/ar"
105                 AS="/usr/ccs/bin/as"
106                 CC="/opt/ansic/bin/cc"
107                 DBM="/lib/hpux32/libndbm.so"
108                 LD="/bin/ld   "
109                 LEX="/opt/langtools/bin/lex"
110                 LWP_OPTMZ=""
111                 MT_CFLAGS='-D_POSIX_C_SOURCE=199506L'
112                 MV="/bin/mv"
113                 OPTMZ="-O"
114                 PAM_CFLAGS="-b +z -Wl,+k"
115                 PAM_LIBS="/usr/lib/hpux32/libpam.so"
116                 RANLIB="/usr/bin/ranlib"
117                 RM="/bin/rm"
118                 SHLIB_SUFFIX="sl"
119                 VFSCK_CFLAGS="-I/usr/old/usr/include -D_FILE64"
120                 XCFLAGS0="-ldld -lc -Wp,-H200000 -Wl,-a,archive_shared -DAUTH_DBM_LOG +z -Wl,+k -D_LARGEFILE64_SOURCE"
121                 XCFLAGS64="${XCFLAGS0} +DD64"
122                 XCFLAGS="${XCFLAGS0}"
123                 XLIBELFA="-lelf"
124                 YACC="/opt/langtools/bin/yacc"
125                 SHLIB_LINKER="ld -b"
126                 ;;
127
128         i386_fbsd_*)
129                 MT_CFLAGS='-pthread -D_REENTRANT'
130                 PAM_OPTMZ=-O2
131                 PAM_CFLAGS="-pipe -fPIC"
132                 SHLIB_LINKER="${CC} -shared"
133                 XCFLAGS="-pipe"
134                 ;;
135
136         i386_dfbsd_*)
137                 MT_CFLAGS='-pthread -D_REENTRANT'
138                 PAM_OPTMZ=-O2
139                 PAM_CFLAGS="-pipe -fPIC"
140                 SHLIB_LINKER="${CC} -shared"
141                 XCFLAGS="-pipe"
142                 ;;
143
144         amd64_fbsd_*)
145                 MT_CFLAGS='-pthread -D_REENTRANT'
146                 PAM_CFLAGS="-O2 -pipe -fPIC"
147                 SHLIB_LINKER="${CC} -shared"
148                 XCFLAGS="-O2 -pipe -fPIC"
149                 ;;
150
151         *nbsd2*|*nbsd3*|*nbsd4*|*nbsd5*|*nbsd6*|*nbsd7*)
152                 MT_CFLAGS='-pthread -D_REENTRANT'
153                 PAM_OPTMZ=-O2
154                 PAM_CFLAGS="-pipe -fPIC"
155                 SHLIB_CFLAGS="-fPIC"
156                 SHLIB_LINKER="${CC} -shared"
157                 XCFLAGS="-pipe"
158                 ;;
159
160         *nbsd15|*nbsd16)
161                 MT_LIBS='${XLIBS}'
162                 PAM_OPTMZ=-O2
163                 PAM_CFLAGS="-pipe -fPIC"
164                 SHLIB_LINKER="${CC} -shared"
165                 XCFLAGS="-pipe"
166                 ;;
167
168         ia64_linux26)
169                 KERN_OPTMZ=-O2
170                 MT_CFLAGS='-pthread -D_REENTRANT'
171                 PAM_OPTMZ=-O2
172                 PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
173                 SHLIB_CFLAGS="-fPIC"
174                 XCFLAGS="-G0"
175                 SHLIB_LINKER="${CC} -shared"
176                 ;;
177
178         amd64_linux*)
179                 CCOBJ="\$(CC) -fPIC"
180                 KERN_OPTMZ=-O2
181                 MT_CFLAGS='-pthread -D_REENTRANT'
182                 PAM_OPTMZ=-O2
183                 PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
184                 SHLIB_CFLAGS="-fPIC"
185                 SHLIB_LINKER="${CC} -shared"
186                 ;;
187
188         ppc64_linux26|ppc64le_linux26)
189                 MT_CFLAGS='-pthread -D_REENTRANT'
190                 PAM_OPTMZ=-O2
191                 PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
192                 SHLIB_CFLAGS="-fPIC"
193                 SHLIB_LINKER="${CC} -shared -m64"
194                 XCFLAGS="-m64"
195                 XLDFLAGS="-m64"
196                 ASFLAGS="-a64"
197                 ;;
198
199         i386_linux*)
200                 KERN_OPTMZ=-O2
201                 MT_CFLAGS='-pthread -D_REENTRANT'
202                 DBG=-g
203                 KERN_DBG=-g
204                 LWP_DBG=-g
205                 LWP_OPTMZ=-O2
206                 OPTMZ=-O2
207                 PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
208                 SHLIB_CFLAGS="-fPIC"
209                 SHLIB_LINKER="${CC} -shared"
210                 ;;
211
212         i386_umlinux26)
213                 MT_CFLAGS='-pthread -D_REENTRANT'
214                 DBG=-g
215                 LWP_DBG=-g
216                 LWP_OPTMZ=-O2
217                 OPTMZ=-O2
218                 PAM_OPTMZ=-O2
219                 PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
220                 SHLIB_CFLAGS="-fPIC"
221                 SHLIB_LINKER="${CC} -shared"
222                 ;;
223
224         *_obsd*)
225                 KERN_OPTMZ=-O2
226                 MT_CFLAGS='-pthread -D_REENTRANT'
227                 LWP_OPTMZ=-O2
228                 OPTMZ=-O2
229                 PAM_OPTMZ=-O2
230                 PAM_CFLAGS="-pipe -fpic"
231                 SHLIB_CFLAGS="-fpic"
232                 SHLIB_LINKER="${CC} -shared"
233                 XCFLAGS=
234                 ;;
235
236         ppc_darwin_70)
237                 CC="cc"
238                 AFSD_LDFLAGS="-F/System/Library/PrivateFrameworks -framework DiskArbitration -framework SystemConfiguration -framework IOKit -framework CoreFoundation"
239                 MT_CFLAGS='-D_REENTRANT'
240                 KROOT=
241                 KINCLUDES='-I$(KROOT)/System/Library/Frameworks/Kernel.framework/Headers'
242                 LWP_OPTMZ="-O2"
243                 REGEX_OBJ="regex.lo"
244                 XCFLAGS="-no-cpp-precomp"
245                 EXTRA_VLIBOBJS="fstab.o"
246                 SHLIB_LINKER="${CC} \${ARCHFLAGS} -dynamiclib"
247                 SHLIB_SUFFIX="dylib"
248                 XLIBS="${LIB_AFSDB} -framework CoreFoundation"
249                 ;;
250
251         *_darwin_80)
252                 CC="cc"
253                 AFSD_LDFLAGS="-F/System/Library/PrivateFrameworks -framework DiskArbitration -framework SystemConfiguration -framework IOKit -framework CoreFoundation"
254                 MT_CFLAGS="-D_REENTRANT"
255                 KROOT=
256                 KINCLUDES='-I$(KROOT)/System/Library/Frameworks/Kernel.framework/Headers'
257                 KERN_OPTMZ="-Os"
258                 LWP_OPTMZ="-Os"
259                 OPTMZ="-Os"
260                 REGEX_OBJ="regex.lo"
261                 EXTRA_VLIBOBJS="fstab.o"
262                 SHLIB_LINKER="${CC} \${ARCHFLAGS} -dynamiclib"
263                 SHLIB_SUFFIX="dylib"
264                 RANLIB="ranlib -c"
265                 XLIBS="${LIB_AFSDB} -framework CoreFoundation"
266                 ;;
267
268         *_darwin_90)
269                 AFSD_LDFLAGS="-F/System/Library/PrivateFrameworks -framework DiskArbitration -framework SystemConfiguration -framework IOKit -framework CoreFoundation"
270                 MT_CFLAGS="-D_REENTRANT"
271                 KROOT=
272                 KINCLUDES='-I$(KROOT)/System/Library/Frameworks/Kernel.framework/Headers'
273                 LD="cc"
274                 KERN_OPTMZ="-Os"
275                 LWP_OPTMZ="-Os"
276                 OPTMZ="-Os"
277                 REGEX_OBJ="regex.lo"
278                 EXTRA_VLIBOBJS="fstab.o"
279                 SHLIB_LINKER="${CC} \${ARCHFLAGS} -dynamiclib"
280                 SHLIB_SUFFIX="dylib"
281                 RANLIB="ranlib -c"
282                 XLIBS="${LIB_AFSDB} -framework CoreFoundation"
283                 ;;
284
285         arm_darwin_100)
286                 AFSD_LDFLAGS="-F/System/Library/PrivateFrameworks -framework SystemConfiguration -framework IOKit -framework CoreFoundation"
287                 MT_CFLAGS="-D_REENTRANT"
288                 MT_LIBS="${LIB_AFSDB} -framework CoreFoundation"
289                 KROOT=
290                 KINCLUDES='-I$(KROOT)/System/Library/Frameworks/Kernel.framework/Headers'
291                 LD="cc"
292                 KERN_OPTMZ="-Os"
293                 LWP_OPTMZ="-Os"
294                 OPTMZ="-Os"
295                 PAM_LIBS="-lpam"
296                 REGEX_OBJ="regex.lo"
297                 TXLIBS="-lncurses"
298                 EXTRA_VLIBOBJS="fstab.o"
299                 SHLIB_LINKER="${CC} -dynamiclib"
300                 SHLIB_SUFFIX="dylib"
301                 RANLIB="ranlib"
302                 XLIBS="${LIB_AFSDB} -framework CoreFoundation"
303                 ;;
304
305         *_darwin_100 | *_darwin_110 | *_darwin_120 | *_darwin_130 | *_darwin_140 | *_darwin_150 | *_darwin_160 | *_darwin_170 | *_darwin_180)
306                 AFSD_LDFLAGS="-F/System/Library/PrivateFrameworks -framework DiskArbitration -framework SystemConfiguration -framework IOKit -framework CoreFoundation"
307                 MT_CFLAGS="-D_REENTRANT"
308                 MT_LIBS='${XLIBS}'
309                 KROOT=
310                 KINCLUDES='-I$(KROOT)/System/Library/Frameworks/Kernel.framework/Headers'
311                 LD="cc"
312                 KERN_OPTMZ="-Os"
313                 LWP_OPTMZ="-Os"
314                 OPTMZ="-Os"
315                 PAM_LIBS="-lpam"
316                 REGEX_OBJ="regex.lo"
317                 EXTRA_VLIBOBJS="fstab.o"
318                 SHLIB_LINKER="${CC} \${ARCHFLAGS} -dynamiclib"
319                 SHLIB_SUFFIX="dylib"
320                 RANLIB="ranlib"
321                 XLIBS="${LIB_AFSDB} -framework CoreFoundation"
322                 ;;
323
324         *_darwin_190)
325                 AFSD_LDFLAGS="-F/System/Library/PrivateFrameworks -framework DiskArbitration -framework SystemConfiguration -framework IOKit -framework CoreFoundation"
326                 MT_CFLAGS="-D_REENTRANT"
327                 MT_LIBS='${XLIBS}'
328                 KROOT='/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk'
329                 KINCLUDES='-I$(KROOT)/System/Library/Frameworks/Kernel.framework/Headers'
330                 LD="cc"
331                 KERN_OPTMZ="-Os"
332                 LWP_OPTMZ="-Os"
333                 OPTMZ="-Os"
334                 PAM_LIBS="-lpam"
335                 REGEX_OBJ="regex.lo"
336                 EXTRA_VLIBOBJS="fstab.o"
337                 SHLIB_LINKER="${CC} \${ARCHFLAGS} -dynamiclib"
338                 SHLIB_SUFFIX="dylib"
339                 RANLIB="ranlib"
340                 XLIBS="${LIB_AFSDB} -framework CoreFoundation"
341                 ;;
342
343         ppc_linux*)
344                 KERN_OPTMZ=-O2
345                 MT_CFLAGS='-pthread -D_REENTRANT'
346                 PAM_OPTMZ=-O2
347                 PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
348                 SHLIB_CFLAGS="-fPIC"
349                 SHLIB_LINKER="${CC} -shared"
350                 ;;
351
352         rs_aix42)
353                 CC="cc"
354                 DBG=""
355                 LIBSYS_AIX_EXP="afsl.exp"
356                 MT_CC="xlc_r"
357                 SHLIB_SUFFIX="o"
358                 XCFLAGS="-K -D_NONSTD_TYPES -D_MBI=void"
359                 XLIBS="${LIB_AFSDB} ${LIB_libintl} -ldl"
360                 SHLIB_LINKER="${MT_CC} -bM:SRE -berok"
361                 AIX32="yes"
362                 AIX64="no"
363                 ;;
364
365         rs_aix51 | rs_aix52 | rs_aix53) 
366                 CC="cc"
367                 DBG="-g"
368                 LIBSYS_AIX_EXP="afsl.exp"
369                 MT_CC="xlc_r"
370                 SHLIB_SUFFIX="o"
371                 XCFLAGS="-K -D_NONSTD_TYPES -D_MBI=void"
372                 XLIBS="${LIB_AFSDB} ${LIB_libintl} -ldl"
373                 SHLIB_LINKER="${MT_CC} -bM:SRE -berok"
374                 AIX32="yes"
375                 AIX64="yes"
376                 ;;
377
378         rs_aix61)       
379                 CC="cc"
380                 DBG="-g"
381                 LIBSYS_AIX_EXP="afsl.exp"
382                 MT_CC="xlc_r"
383                 SHLIB_SUFFIX="o"
384                 XCFLAGS="-K -D_NONSTD_TYPES -D_MBI=void"
385                 XLIBS="${LIB_AFSDB} ${LIB_libintl} -ldl"
386                 SHLIB_LINKER="${MT_CC} -bM:SRE -berok"
387                 AIX32="no"
388                 AIX64="yes"
389                 ;;
390
391         s390_linux26)
392                 LD="ld"
393                 KERN_OPTMZ=-O2
394                 MT_CFLAGS='-pthread -D_REENTRANT'
395                 PAM_OPTMZ=-O2
396                 PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
397                 SHLIB_CFLAGS="-fPIC"
398                 SHLIB_LINKER="${CC} -shared"
399                 ;;
400
401         s390x_linux26)
402                 CCOBJ="\$(CC) -fPIC"
403                 LD="ld"
404                 KERN_OPTMZ=-O2
405                 MT_CFLAGS='-pthread -D_REENTRANT'
406                 PAM_OPTMZ=-O
407                 PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
408                 SHLIB_CFLAGS="-fPIC"
409                 OPTMZ=-O
410                 XCFLAGS="-D__s390x__"
411                 SHLIB_LINKER="${CC} -shared"
412                 ;;
413
414         sgi_62)
415                 CC="cc"
416                 AFSD_LIBS="/usr/lib/libdwarf.a /usr/lib/libelf.a"
417                 FSINCLUDES="-I/usr/include/sys/fs"
418                 MT_CFLAGS='-D_SGI_MP_SOURCE'
419                 XCFLAGS64="-64 -mips3"
420                 XCFLAGS="-o32"
421                 XLDFLAGS64="-64"
422                 XLDFLAGS="-o32"
423                 SHLIB_LINKER="${CC} -shared"
424                 ;;
425
426         sgi_63)
427                 CC="cc"
428                 AFSD_LIBS="/usr/lib/libdwarf.a /usr/lib/libelf.a"
429                 FSINCLUDES="-I/usr/include/sys/fs"
430                 MT_CFLAGS='-D_SGI_MP_SOURCE'
431                 XCFLAGS64="-D_BSD_COMPAT -64 -mips3"
432                 XCFLAGS="-D_OLD_TERMIOS -D_BSD_COMPAT -o32"
433                 XLDFLAGS64="-64"
434                 XLDFLAGS="-o32"
435                 SHLIB_LINKER="${CC} -shared"
436                 ;;
437
438         sgi_64)
439                 CC="cc"
440                 AFSD_LIBS="/usr/lib32/libdwarf.a /usr/lib32/libelf.a"
441                 FSINCLUDES="-I/usr/include/sys/fs"
442                 MT_CFLAGS='-D_SGI_MP_SOURCE'
443                 XCFLAGS64="-D_BSD_COMPAT -64 -mips3"
444                 XCFLAGS="-D_OLD_TERMIOS -D_BSD_COMPAT -n32 -woff 1009,1014,1110,1116,1164,1169,1171,1174,1177,1183,1185,1204,1233,1515,1516,1548,1169,1174,1177,1196,1498,1506,1552,3201 -Wl,-woff,84,-woff,15"
445                 XLDFLAGS64="-64"
446                 XLDFLAGS="-n32"
447                 SHLIB_LINKER="${CC} -shared"
448                 ;;
449
450         sgi_65)
451                 AFSD_LIBS="/usr/lib32/libdwarf.a /usr/lib32/libelf.a"
452                 CC="/usr/bin/cc"
453                 FSINCLUDES="-I/usr/include/sys/fs"
454                 LD="/usr/bin/ld"
455                 MT_CFLAGS='-D_SGI_MP_SOURCE'
456                 XCFLAGS64="-64 -mips3"
457                 XCFLAGS="-n32 -mips3 -woff 1009,1014,1110,1116,1164,1171,1177,1183,1185,1204,1233,1515,1516,1548,1169,1174,1177,1196,1498,1506,1552,3201 -Wl,-woff,84,-woff,15"
458                 XLDFLAGS64="-64 -mips3"
459                 XLDFLAGS="-n32 -mips3"
460                 SHLIB_LINKER="${CC} -shared"
461                 ;;
462
463         sparc*_linux*)
464                 KERN_OPTMZ=-O2
465                 MT_CFLAGS='-pthread -D_REENTRANT'
466                 PAM_OPTMZ=-O2
467                 PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
468                 SHLIB_CFLAGS="-fPIC"
469                 XCFLAGS64="-m64"
470                 XLDFLAGS64="-m64"
471                 SHLIB_LINKER="${CC} -shared"
472                 ;;
473
474         sun4x_5*)
475                 CC=$SOLARISCC
476                 LD="/usr/ccs/bin/ld"
477                 MT_CFLAGS='-mt'
478                 PAM_CFLAGS="-KPIC"
479                 PAM_LIBS="-lc -lpam -lsocket -lnsl -lm"
480                 SHLIB_CFLAGS="-KPIC"
481                 XCFLAGS64='${XCFLAGS} -m64'
482                 XCFLAGS="-dy -Bdynamic"
483                 XLIBELFA="-lelf"
484                 XLIBKVM="-lkvm"
485                 XLIBS="${LIB_AFSDB} -lsocket -lnsl -lintl -ldl"
486                 SHLIB_LINKER="${CC} -G -dy -Bsymbolic -z text"
487                 LWP_OPTMZ="-g"
488                 ;;
489
490         sunx86_5*)
491                 case $AFS_SYSNAME in
492                         sunx86_58|sunx86_59)
493                                 XARCHFLAGS=""
494                                 ;;
495                         *)
496                                 if test "x`echo "${ARCHFLAGS}" | grep m32`" != "x" ; then
497                                         CURRENTBUILDARCH=i386
498                                 fi
499                                 if test "x`echo "${ARCHFLAGS}" | grep m64`" != "x" ; then
500                                         CURRENTBUILDARCH=amd64
501                                 fi
502                                 if test "x${CURRENTBUILDARCH}" = "x" ; then
503                                         CURRENTBUILDARCH=`isainfo -k`
504                                 fi
505                                 if test "${CURRENTBUILDARCH}" = "amd64" ; then
506                                         XARCHFLAGS="-m64"
507                                 fi
508                                 ;;
509                 esac
510
511                 CC=$SOLARISCC
512                 CFLAGS="$CFLAGS ${XARCHFLAGS}"
513                 LD="/usr/ccs/bin/ld"
514                 MT_CFLAGS='-mt'
515                 KERN_OPTMZ="-xO3"
516                 PAM_CFLAGS="-KPIC"
517                 PAM_LIBS="-lc -lpam -lsocket -lnsl -lm"
518                 SHLIB_CFLAGS="-KPIC"
519                 XCFLAGS0="-dy -Bdynamic"
520                 XCFLAGS64="${XCFLAGS0} -m64"
521                 XCFLAGS="${XCFLAGS0} ${XARCHFLAGS}"
522                 XLDFLAGS64="-m64"
523                 XLDFLAGS="${XARCHFLAGS}"
524                 ASFLAGS="${XARCHFLAGS}"
525                 XLIBELFA="-lelf"
526                 XLIBKVM="-lkvm"
527                 XLIBS="${LIB_AFSDB} -lsocket -lnsl -lintl -ldl"
528                 SHLIB_LINKER="${CC} ${XARCHFLAGS} -G -dy -Bsymbolic -z text"
529                 ;;
530
531 esac
532
533 MT_CFLAGS="${MT_CFLAGS} -DAFS_PTHREAD_ENV"
534
535 AFS_LT_INIT
536
537 dnl if ar is not present, libtool.m4 (provided by libtool) sets AR to false
538 dnl if strip is not present, libtool.m4 (provided by libtool) sets STRIP to :
539 AS_IF([test "x$AR" = "xfalse"], [AC_MSG_ERROR([cannot find required command 'ar'])])
540 AS_IF([test "x$AS" = "xfalse"], [AC_MSG_ERROR([cannot find required command 'as'])])
541 AS_IF([test "x$MV" = "xfalse"], [AC_MSG_ERROR([cannot find required command 'mv'])])
542 AS_IF([test "x$RM" = "xfalse"], [AC_MSG_ERROR([cannot find required command 'rm'])])
543 AS_IF([test "x$LD" = "xfalse"], [AC_MSG_ERROR([cannot find required command 'ld'])])
544 AS_IF([test "x$CP" = "xfalse"], [AC_MSG_ERROR([cannot find required command 'cp'])])
545 AS_IF([test "x$GENCAT" = "xfalse"], [AC_MSG_ERROR([cannot find required command 'gencat'])])
546
547 dnl TODO - need to disable STRIP if we are doing debugging in any user space code
548
549 #
550 # Defaults for --enable-optimize-kernel
551 #
552 if test "x$enable_optimize_kernel" = "x" ; then
553   AS_CASE([$AFS_SYSNAME],
554     [sunx86_510|sunx86_511],
555       dnl Somewhere around Solaris Studio 12.*, the compiler started adding SSE
556       dnl instructions to optimized code, without any known way to turn it off.
557       dnl To cope, this condition was added to change the default to
558       dnl 'no'.
559       dnl Now that we have an autoconf test to allow disabling the SSE
560       dnl optimizations, it's safe to once more default to 'yes' here.
561       [enable_optimize_kernel=yes],
562     [enable_optimize_kernel=yes])
563 fi
564
565 #
566 # Special build targets
567 #
568 case $AFS_SYSNAME in
569         sgi_6*)
570                 IRIX_SYS_SYSTM_H_HAS_MEM_FUNCS
571                 XFS_SIZE_CHECK="xfs_size_check"
572                 install_XFS_SIZE_CHECK='$(DESTDIR)${afssrvsbindir}/xfs_size_check'
573                 dest_XFS_SIZE_CHECK='$(DEST)/root.server/usr/afs/bin/xfs_size_check'
574         
575                 AC_SUBST(XFS_SIZE_CHECK)
576                 AC_SUBST(install_XFS_SIZE_CHECK)
577                 AC_SUBST(dest_XFS_SIZE_CHECK)
578         ;;
579         *_fbsd_*)
580                 if test "x$enable_debug_kernel" = "xyes"; then
581                         DEBUG_FLAGS=-g
582                         AC_SUBST(DEBUG_FLAGS)
583                 fi
584         ;;
585 esac
586
587 dnl Disable the default for debugging/optimization if not enabled
588 if test "x$enable_debug_kernel" = "xno"; then
589   KERN_DBG=
590 fi
591
592 if test "x$enable_optimize_kernel" = "xno"; then
593   KERN_OPTMZ=
594 fi
595
596 if test "x$enable_debug" = "xno"; then
597   DBG=
598   NO_STRIP_BIN=-s
599 fi
600
601 if test "x$enable_optimize" = "xno"; then
602   OPTMZ=
603 fi
604
605 if test "x$enable_debug_lwp" = "xno"; then
606   LWP_DBG=
607 fi
608
609 if test "x$enable_optimize_lwp" = "xno"; then
610   LWP_OPTMZ=
611 fi
612
613 if test "x$enable_strip_binaries" != "xno"; then
614   if test "x$enable_strip_binaries" = "xmaybe" -a "x$enable_debug" = "xyes"; then
615     NO_STRIP_BIN=
616   else
617     NO_STRIP_BIN=-s
618   fi
619 else
620   NO_STRIP_BIN=
621 fi
622
623 CFLAGS_NOERROR=
624 CFLAGS_NOSTRICT=-fno-strict-aliasing
625 CFLAGS_NOUNUSED=
626 CFLAGS_NOOLDSTYLE=
627 CFLAGS_NOIMPLICIT_FALLTHROUGH=
628 XCFLAGS_NOCHECKING="$XCFLAGS"
629
630 if test "x$GCC" = "xyes"; then
631   if test "x$enable_warnings" = "xyes"; then
632     XCFLAGS="${XCFLAGS} -Wall -Wstrict-prototypes -Wold-style-definition -Wpointer-arith"
633   fi
634   if test "x$enable_checking" != "xno"; then
635     XCFLAGS="${XCFLAGS} -Wall -Wstrict-prototypes -Wold-style-definition -Werror -fdiagnostics-show-option -Wpointer-arith -fno-common"
636     CFLAGS_WERROR="-Werror"
637     if test "x$enable_checking" != "xall"; then
638       CFLAGS_NOERROR="-Wno-error"
639       CFLAGS_NOUNUSED="-Wno-unused"
640       CFLAGS_NOOLDSTYLE="-Wno-old-style-definition"
641       AX_APPEND_COMPILE_FLAGS([-Wno-implicit-fallthrough],
642                                [CFLAGS_NOIMPLICIT_FALLTHROUGH])
643       AC_DEFINE(IGNORE_SOME_GCC_WARNINGS, 1, [define to disable some gcc warnings in warnings-as-errors mode])
644     else
645       CFLAGS_NOSTRICT=
646     fi
647   fi
648 else
649   case $AFS_SYSNAME in
650     sun*_51?)
651       # Solaris Studio
652       warn_common="-v -errfmt=error -errtags=yes -erroff=E_ATTRIBUTE_UNKNOWN,E_END_OF_LOOP_CODE_NOT_REACHED"
653       if test "x$enable_warnings" = "xyes" ; then
654         XCFLAGS="${XCFLAGS} $warn_common"
655       fi
656       if test "x$enable_checking" != "xno" ; then
657         XCFLAGS="${XCFLAGS} $warn_common -errwarn=%all"
658         if test "x$enable_checking" != "xall" ; then
659           CFLAGS_NOERROR="-errwarn=%none"
660         fi
661       fi
662       ;;
663   esac
664 fi
665
666 dnl add additional checks if compilers support the flags
667 AS_IF([test "x$enable_checking" != "xno"],
668       [AX_APPEND_COMPILE_FLAGS([-Wimplicit-fallthrough], [XCFLAGS])
669 ])
670
671 dnl horribly cheating, assuming double / is ok.
672 case $INSTALL in
673   ./* ) 
674     INSTALL="/@abs_top_srcdir@/install-sh -c"
675   ;;
676   *) 
677   ;;
678 esac
679
680 INSTALL_PROGRAM="${INSTALL_PROGRAM} ${NO_STRIP_BIN}"
681
682 AC_SUBST(CCXPG2)
683 AC_SUBST(CCOBJ)
684 AC_SUBST(AFSD_LIBS)
685 AC_SUBST(AFSD_LDFLAGS)
686 AC_SUBST(AIX32)
687 AC_SUBST(AIX64)
688 AC_SUBST(AR)
689 AC_SUBST(AS)
690 AC_SUBST(ASFLAGS)
691 AC_SUBST(CP)
692 AC_SUBST(DBG)
693 AC_SUBST(FSINCLUDES)
694 AC_SUBST(KERN_DBG)
695 AC_SUBST(KERN_OPTMZ)
696 AC_SUBST(LD)
697 AC_SUBST(LEX)
698 AC_SUBST(LWP_DBG)
699 AC_SUBST(LWP_OPTMZ)
700 AC_SUBST(MT_CC)
701 AC_SUBST(MT_CFLAGS)
702 AC_SUBST(MT_LIBS)
703 AC_SUBST(MV)
704 AC_SUBST(NO_STRIP_BIN)
705 AC_SUBST(OPTMZ)
706 AC_SUBST(PAM_CFLAGS)
707 AC_SUBST(PAM_LIBS)
708 AC_SUBST(PAM_DBG)
709 AC_SUBST(PAM_OPTMZ)
710 AC_SUBST(RANLIB)
711 AC_SUBST(REGEX_OBJ)
712 AC_SUBST(RM)
713 AC_SUBST(RXDEBUG)
714 AC_SUBST(SHLIB_CFLAGS)
715 AC_SUBST(SHLIB_LINKER)
716 AC_SUBST(SHLIB_SUFFIX)
717 AC_SUBST(VFSCK_CFLAGS)
718 AC_SUBST(XCFLAGS)
719 AC_SUBST(CFLAGS_NOERROR)
720 AC_SUBST(CFLAGS_NOSTRICT)
721 AC_SUBST(CFLAGS_NOUNUSED)
722 AC_SUBST(CFLAGS_NOOLDSTYLE)
723 AC_SUBST(CFLAGS_NOIMPLICIT_FALLTHROUGH)
724 AC_SUBST(CFLAGS_WERROR)
725 AC_SUBST(XCFLAGS64)
726 AC_SUBST(XLDFLAGS)
727 AC_SUBST(XLDFLAGS64)
728 AC_SUBST(XLIBELFA)
729 AC_SUBST(XLIBKVM)
730 AC_SUBST(XLIBS)
731 AC_SUBST(YACC)
732 AC_SUBST(KROOT)
733 AC_SUBST(KINCLUDES)
734
735
736 ])