AIX: Add buildsystem support for AIX 7.2
[openafs.git] / src / cf / sysname.m4
1 AC_DEFUN([OPENAFS_SYSNAME],[
2 if test "x$with_afs_sysname" != "x"; then
3         AFS_SYSNAME="$with_afs_sysname"
4 else
5         AC_MSG_CHECKING(your AFS sysname)
6         case $host in
7                 i?86-*-openbsd?.?)
8                         v=${host#*openbsd}
9                         vM=${v%.*}
10                         vm=${v#*.}
11                         AFS_SYSNAME="i386_obsd${vM}${vm}"
12                         ;;
13                 sparc64-*-openbsd?.?)
14                         v=${host#*openbsd}
15                         vM=${v%.*}
16                         vm=${v#*.}
17                         AFS_SYSNAME="sparc64_obsd${vM}${vm}"
18                         ;;
19                 x86_64-*-openbsd?.?)
20                         v=${host#*openbsd}
21                         vM=${v%.*}
22                         vm=${v#*.}
23                         AFS_SYSNAME="amd64_obsd${vM}${vm}"
24                         ;;
25                 i?86-*-freebsd*.*)
26                         v=${host#*freebsd}
27                         vM=${v%.*}
28                         vm=${v#*.}
29                         AFS_SYSNAME="i386_fbsd_${vM}${vm}"
30                         ;;
31                 x86_64-*-freebsd*.*)
32                         v=${host#*freebsd}
33                         vM=${v%.*}
34                         vm=${v#*.}
35                         AFS_SYSNAME="amd64_fbsd_${vM}${vm}"
36                         ;;
37                 i386-*-dragonfly?.*)
38                         v=${host#*dragonfly}
39                         vM=${v%.*}
40                         vm=${v#*.}
41                         AFS_SYSNAME="i386_dfbsd_${vM}${vm}"
42                         ;;
43                 i?86-*-netbsd*1.6[[M-Z]]*)
44                         AFS_SYSNAME="i386_nbsd20"
45                         ;;
46                 powerpc-*-netbsd*1.6[[M-Z]]*)
47                         AFS_SYSNAME="ppc_nbsd20"
48                         ;;
49                 *-*-netbsd*)
50                         arch=${host%%-unknown*}
51                         arch=$(echo $arch |sed -e 's/x86_64/amd64/g' \
52                                                -e 's/powerpc/ppc/g')
53                         v=${host#*netbsd}
54                         v=${v#*aout}
55                         v=${v#*ecoff}
56                         v=${v#*elf}
57                         vM=${v%%.*}
58                         vM=${vM%.*}
59                         v=${v#*.}
60                         vm=${v%%.*}
61                         vm=${vm%.*}
62                         vm=${vm%%[[_A-Z]]*}
63                         if test $vm -eq 99 ; then
64                                 vM=$((vM+1))
65                         fi
66                         if test $vM -gt 1 ; then
67                                 vm=0
68                         fi
69                         AFS_SYSNAME="${arch}_nbsd${vM}${vm}"
70                         ;;
71                 hppa*-hp-hpux11.0*)
72                         AFS_SYSNAME="hp_ux110"
73                         ;;
74                 hppa*-hp-hpux11.11)
75                         AFS_SYSNAME="hp_ux11i"
76                         ;;
77                 hppa*-hp-hpux11.23)
78                         AFS_SYSNAME="hp_ux1123"
79                         ;;
80                 ia64-hp-hpux11.22)
81                         AFS_SYSNAME="ia64_hpux1122"
82                         ;;
83                 ia64-hp-hpux*)
84                         AFS_SYSNAME="ia64_hpux1123"
85                         ;;
86                 hppa*-hp-hpux10*)
87                         AFS_SYSNAME="hp_ux102"
88                         ;;
89                 powerpc-apple-darwin7*)
90                         AFS_SYSNAME="ppc_darwin_70"
91                         OSXSDK="macosx10.3"
92                         ;;
93                 powerpc-apple-darwin8.*)
94                         AFS_SYSNAME="ppc_darwin_80"
95                         OSXSDK="macosx10.4"
96                         ;;
97                 i386-apple-darwin8.*)
98                         AFS_SYSNAME="x86_darwin_80"
99                         OSXSDK="macosx10.4"
100                         ;;
101                 powerpc-apple-darwin9.*)
102                         AFS_SYSNAME="ppc_darwin_90"
103                         OSXSDK="macosx10.5"
104                         ;;
105                 i386-apple-darwin9.*)
106                         AFS_SYSNAME="x86_darwin_90"
107                         OSXSDK="macosx10.5"
108                         ;;
109                 i?86-apple-darwin10.*)
110                         AFS_SYSNAME="x86_darwin_100"
111                         OSXSDK="macosx10.6"
112                         ;;
113                 x86_64-apple-darwin10.*)
114                         AFS_SYSNAME="x86_darwin_100"
115                         OSXSDK="macosx10.6"
116                         ;;
117                 arm-apple-darwin10.*)
118                         AFS_SYSNAME="arm_darwin_100"
119                         OSXSDK="iphoneos4.0"
120                         ;;
121                 x86_64-apple-darwin11.*)
122                         AFS_SYSNAME="x86_darwin_110"
123                         OSXSDK="macosx10.7"
124                         ;;
125                 i?86-apple-darwin11.*)
126                         AFS_SYSNAME="x86_darwin_110"
127                         OSXSDK="macosx10.7"
128                         ;;
129                 x86_64-apple-darwin12.*)
130                         AFS_SYSNAME="x86_darwin_120"
131                         OSXSDK="macosx10.8"
132                         ;;
133                 i?86-apple-darwin12.*)
134                         AFS_SYSNAME="x86_darwin_120"
135                         OSXSDK="macosx10.8"
136                         ;;
137                 x86_64-apple-darwin13.*)
138                         AFS_SYSNAME="x86_darwin_130"
139                         OSXSDK="macosx10.9"
140                         ;;
141                 i?86-apple-darwin13.*)
142                         AFS_SYSNAME="x86_darwin_130"
143                         OSXSDK="macosx10.9"
144                         ;;
145                 x86_64-apple-darwin14.*)
146                         AFS_SYSNAME="x86_darwin_140"
147                         OSXSDK="macosx10.10"
148                         ;;
149                 i?86-apple-darwin14.*)
150                         AFS_SYSNAME="x86_darwin_140"
151                         OSXSDK="macosx10.10"
152                         ;;
153                 x86_64-apple-darwin15.*)
154                         AFS_SYSNAME="x86_darwin_150"
155                         OSXSDK="macosx10.11"
156                         ;;
157                 i?86-apple-darwin15.*)
158                         AFS_SYSNAME="x86_darwin_150"
159                         OSXSDK="macosx10.11"
160                         ;;
161                 x86_64-apple-darwin16.*)
162                         AFS_SYSNAME="x86_darwin_160"
163                         OSXSDK="macosx10.12"
164                         ;;
165                 i?86-apple-darwin16.*)
166                         AFS_SYSNAME="x86_darwin_160"
167                         OSXSDK="macosx10.12"
168                         ;;
169                 x86_64-apple-darwin17.*)
170                         AFS_SYSNAME="x86_darwin_170"
171                         OSXSDK="macosx10.13"
172                         ;;
173                 i?86-apple-darwin17.*)
174                         AFS_SYSNAME="x86_darwin_170"
175                         OSXSDK="macosx10.13"
176                         ;;
177                 x86_64-apple-darwin18.*)
178                         AFS_SYSNAME="x86_darwin_180"
179                         OSXSDK="macosx10.14"
180                         ;;
181                 i?86-apple-darwin18.*)
182                         AFS_SYSNAME="x86_darwin_180"
183                         OSXSDK="macosx10.14"
184                         ;;
185                 x86_64-apple-darwin19.*)
186                         AFS_SYSNAME="x86_darwin_190"
187                         OSXSDK="macosx10.15"
188                         ;;
189                 i?86-apple-darwin19.*)
190                         AFS_SYSNAME="x86_darwin_190"
191                         OSXSDK="macosx10.15"
192                         ;;
193                 x86_64-apple-darwin20.*)
194                         AFS_SYSNAME="x86_darwin_200"
195                         OSXSDK="macosx11.0"
196                         ;;
197                 sparc-sun-solaris2.8)
198                         AFS_SYSNAME="sun4x_58"
199                         ;;
200                 sparc-sun-solaris2.9)
201                         AFS_SYSNAME="sun4x_59"
202                         ;;
203                 sparc-sun-solaris2.10)
204                         AFS_SYSNAME="sun4x_510"
205                         ;;
206                 sparc-sun-solaris2.11)
207                         AFS_SYSNAME="sun4x_511"
208                         ;;
209                 i386-pc-solaris2.8)
210                         AFS_SYSNAME="sunx86_58"
211                         ;;
212                 i386-pc-solaris2.9)
213                         AFS_SYSNAME="sunx86_59"
214                         ;;
215                 i386-pc-solaris2.10)
216                         AFS_SYSNAME="sunx86_510"
217                         ;;
218                 i386-pc-solaris2.11)
219                         AFS_SYSNAME="sunx86_511"
220                         ;;
221                 mips-sgi-irix6.5)
222                         AFS_SYSNAME="sgi_65"
223                         enable_pam="no"
224                         ;;
225                 ia64-*-linux*)
226                         AFS_SYSNAME="ia64_linuxXX"
227                         ;;
228                 powerpc-*-linux*)
229                         AFS_SYSNAME="`/bin/arch`_linuxXX"
230                         ;;
231                 powerpc64-*-linux*)
232                         AFS_SYSNAME="ppc64_linuxXX"
233                         ;;
234                 powerpc64le-*-linux*)
235                         AFS_SYSNAME="ppc64le_linuxXX"
236                         ;;
237                 alpha*-linux*)
238                         AFS_SYSNAME="alpha_linux_XX"
239                         ;;
240                 s390-*-linux*)
241                         AFS_SYSNAME="s390_linuxXX"
242                         ;;
243                 s390x-*-linux*)
244                         AFS_SYSNAME="s390x_linuxXX"
245                         ;;
246                 sparc-*-linux*)
247                         AFS_SYSNAME="`/bin/arch`_linuxXX"
248                         ;;
249                 sparc64-*-linux*)
250                         AFS_SYSNAME="sparc64_linuxXX"
251                         ;;
252                 i?86-*-linux*)
253                         AFS_SYSNAME="i386_linuxXX"
254                         ;;
255                 arm*-linux*)
256                         AFS_SYSNAME="arm_linuxXX"
257                         ;;
258                 aarch64*-linux*)
259                         AFS_SYSNAME="arm64_linuxXX"
260                         ;;
261                 parisc-*-linux-gnu|hppa-*-linux-gnu)
262                         AFS_SYSNAME="parisc_linuxXX"
263                         enable_pam="no"
264                         ;;
265                 power*-ibm-aix4.2*)
266                         AFS_SYSNAME="rs_aix42"
267                         enable_pam="no"
268                         ;;
269                 power*-ibm-aix4.3*)
270                         AFS_SYSNAME="rs_aix42"
271                         enable_pam="no"
272                         ;;
273                 power*-ibm-aix5.1*)
274                         AFS_SYSNAME="rs_aix51"
275                         enable_pam="no"
276                         ;;
277                 power*-ibm-aix5.2*)
278                         AFS_SYSNAME="rs_aix52"
279                         enable_pam="no"
280                         ;;
281                 power*-ibm-aix5.3*)
282                         AFS_SYSNAME="rs_aix53"
283                         enable_pam="no"
284                         ;;
285                 power*-ibm-aix6.1*)
286                         AFS_SYSNAME="rs_aix61"
287                         enable_pam="no"
288                         ;;
289                 power*-ibm-aix7.2*)
290                         AFS_SYSNAME="rs_aix72"
291                         enable_pam="no"
292                         ;;
293                 x86_64-*-linux-gnu)
294                         AFS_SYSNAME="amd64_linuxXX"
295                         enable_pam="yes"
296                         ;;
297                 *)
298                         AC_MSG_ERROR(An AFS sysname is required)
299                         exit 1
300                         ;;
301         esac
302         case $AFS_SYSNAME in
303                 *_linux* | *_umlinux*)
304                         if test "x${AFS_SYSKVERS}" = "x"; then
305                          AC_MSG_ERROR(Couldn't guess your Linux version. Please use the --with-afs-sysname option to configure an AFS sysname.)
306                         fi
307                         if test "x${AFS_SYSKVERS}" = "x24" ||
308                                 test "x${AFS_SYSKVERS}" = "x22"; then
309                             AC_MSG_ERROR([Linux 2.4.x and older are no longer supported by OpenAFS.  Please use an OpenAFS 1.6.x release on those systems.])
310                         fi
311                         _AFS_SYSNAME=`echo $AFS_SYSNAME|sed s/XX\$/$AFS_SYSKVERS/`
312                         AFS_SYSNAME="$_AFS_SYSNAME"
313                         AC_TRY_KBUILD(
314                          [],
315                          [#ifndef CONFIG_USERMODE
316                           #error not UML
317                           #endif],
318                          ac_cv_linux_is_uml=yes,)
319                         if test "${ac_cv_linux_is_uml}" = yes; then
320                          _AFS_SYSNAME=`echo $AFS_SYSNAME|sed s/linux/umlinux/`
321                         fi
322                         AFS_SYSNAME="$_AFS_SYSNAME"
323                         ;;
324         esac
325         AC_MSG_RESULT($AFS_SYSNAME)
326 fi
327
328 case $AFS_SYSNAME in
329         *_darwin*)
330                 AC_CHECK_HEADERS(crt_externs.h)
331                 DARWIN_PLIST=src/libafs/afs.${AFS_SYSNAME}.plist
332                 DARWIN_INFOFILE=afs.${AFS_SYSNAME}.plist
333                 AC_SUBST(OSXSDK)
334                 ;;
335 esac
336
337 dnl Some hosts have a separate common param file they should include.  Figure
338 dnl out if we're on one of them now that we know the sysname.
339 case $AFS_SYSNAME in
340     *_nbsd15)   AFS_PARAM_COMMON=param.nbsd15.h  ;;
341     *_nbsd16)   AFS_PARAM_COMMON=param.nbsd16.h  ;;
342     *_nbsd20)   AFS_PARAM_COMMON=param.nbsd20.h  ;;
343     *_nbsd21)   AFS_PARAM_COMMON=param.nbsd21.h  ;;
344     *_nbsd30)   AFS_PARAM_COMMON=param.nbsd30.h  ;;
345     *_nbsd40)   AFS_PARAM_COMMON=param.nbsd40.h  ;;
346     *_nbsd50)   AFS_PARAM_COMMON=param.nbsd50.h  ;;
347     *_nbsd60)   AFS_PARAM_COMMON=param.nbsd60.h  ;;
348     *_nbsd70)   AFS_PARAM_COMMON=param.nbsd70.h  ;;
349     *_obsd31)   AFS_PARAM_COMMON=param.obsd31.h  ;;
350     *_obsd32)   AFS_PARAM_COMMON=param.obsd32.h  ;;
351     *_obsd33)   AFS_PARAM_COMMON=param.obsd33.h  ;;
352     *_obsd34)   AFS_PARAM_COMMON=param.obsd34.h  ;;
353     *_obsd35)   AFS_PARAM_COMMON=param.obsd35.h  ;;
354     *_obsd36)   AFS_PARAM_COMMON=param.obsd36.h  ;;
355     *_obsd37)   AFS_PARAM_COMMON=param.obsd37.h  ;;
356     *_obsd38)   AFS_PARAM_COMMON=param.obsd38.h  ;;
357     *_obsd39)   AFS_PARAM_COMMON=param.obsd39.h  ;;
358     *_obsd40)   AFS_PARAM_COMMON=param.obsd40.h  ;;
359     *_obsd41)   AFS_PARAM_COMMON=param.obsd41.h  ;;
360     *_obsd42)   AFS_PARAM_COMMON=param.obsd42.h  ;;
361     *_obsd43)   AFS_PARAM_COMMON=param.obsd43.h  ;;
362     *_obsd44)   AFS_PARAM_COMMON=param.obsd44.h  ;;
363     *_obsd45)   AFS_PARAM_COMMON=param.obsd45.h  ;;
364     *_obsd46)   AFS_PARAM_COMMON=param.obsd46.h  ;;
365     *_obsd47)   AFS_PARAM_COMMON=param.obsd47.h  ;;
366     *_obsd48)   AFS_PARAM_COMMON=param.obsd48.h  ;;
367     *_obsd49)   AFS_PARAM_COMMON=param.obsd49.h  ;;
368     *_obsd50)   AFS_PARAM_COMMON=param.obsd50.h  ;;
369     *_obsd51)   AFS_PARAM_COMMON=param.obsd51.h  ;;
370     *_obsd52)   AFS_PARAM_COMMON=param.obsd52.h  ;;
371     *_obsd53)   AFS_PARAM_COMMON=param.obsd53.h  ;;
372     *_obsd54)   AFS_PARAM_COMMON=param.obsd54.h  ;;
373     *_linux26)  AFS_PARAM_COMMON=param.linux26.h ;;
374 # Linux alpha adds an extra underscore for no good reason.
375     *_linux_26) AFS_PARAM_COMMON=param.linux26.h ;;
376     *_fbsd_*)   AFS_PARAM_COMMON=param.generic_fbsd.h ;;
377 esac
378 ])